tui: the F6 wallet screen draws its body in the slot that has the height #167

Merged
sirius merged 2 commits from onionwire/t_716400d7-onionwire-tui-the-f6-wallet-screen-clips into main 2026-09-27 18:45:14 +00:00
Owner

What was wrong

draw_wallet in src/tui.rs split its area into five rows: Length(2) title, Min(4), Length(2), Length(3) help, Length(1). The address / balance / recent transfers paragraph was rendered into the Length(2) slot, whose block borders consume both rows (inner height 0), while the tall Min(4) slot above it was never rendered into. Every install — configured or not — showed an empty wallet screen, and the no address line had never been seen.

Frame at 80x24 before (real App::draw, TestBackend, bare install)

┌wallet────────────────────────────────────────────────────────────────────────┐
└──────────────────────────────────────────────────────────────────────────────┘
                            (16 blank rows — nothing drawn)
┌──────────────────────────────────────────────────────────────────────────────┐
└──────────────────────────────────────────────────────────────────────────────┘
s start child  x stop child  p probe  c create  i import  r qr  Esc back

What changed

The body is rendered into the slot that has the height. The dead Length(2) row is dropped, so the layout is Length(2) title / Min(4) body / Length(3) help / Length(1) leftover: the body moves from cols[2] to cols[1], the help line from cols[3] to cols[2]. Nothing else in draw_wallet moves.

Frame at 80x24 after, bare install

┌wallet────────────────────────────────────────────────────────────────────────┐
└──────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────┐
│address                                                                       │
│  no address                                                                  │
│                                                                              │
│balance                                                                       │
│  off                                                                         │
│                                                                              │
│recent transfers                                                              │
│  (none)                                                                      │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘
s start child  x stop child  p probe  c create  i import  r qr  Esc back

Frame at 80x24 after, filled receive address

┌wallet────────────────────────────────────────────────────────────────────────┐
└──────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────┐
│address                                                                       │
│  4AdUndXHHZ6cfufTMvppY6JwXNouMBzSkbLYfpAV5Usx3skxNgYeYTRj5UzqtReoS44qo9mtmXCq│
│Y45DJ852K5Jv2684Rge                                                           │
│                                                                              │
│balance                                                                       │
│  off                                                                         │
│                                                                              │
│recent transfers                                                              │
│  (none)                                                                      │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘
s start child  x stop child  p probe  c create  i import  r qr  Esc back

Tests (through the real App::draw, TestBackend)

Added to mod wallet_store_tests, which already had the frame_text helper; frame_text now delegates to a new frame_at(app, width, height) so each case is checked at 80x24, 120x40 and 200x60 where relevant. Two small inspect helpers (flattened, unwrapped) drop the pane border glyphs so a wrapped address still reads as one string without collapsing the whitespace that separates a heading from its value.

  1. the_wallet_screen_draws_its_body_on_a_bare_install — F6 on an install with no wallet (the #161 degrade path): the frame carries address, no address, balance, recent transfers, (none) and the help line at 80x24 / 120x40 / 200x60, and never the node's refusal text no receive address — set profile xmr or ONIONWIRE_WALLET_RPC.
  2. the_wallet_screen_shows_the_filled_address — a profile address reaches the screen intact at 80x24 (it is wider than the pane, so the wrap is checked too) and 200x60.
  3. an_empty_transfer_list_still_names_recent_transfers — an empty history still renders recent transfers (none) at 80x24 and 120x40.

RED first: with the fix absent, all three fail (test result: FAILED. 8 passed; 3 failed), the first dump being exactly the empty frame quoted above. The doc comment on f6_on_a_bare_install_never_draws_the_error_and_states_the_way_forward, which said the body was a separate card, now points at these tests.

Evidence

$ export TMPDIR=/home/lancelot/.hermes/tmp/t_716400d7-tmp
$ export CARGO_TARGET_DIR=/home/lancelot/.hermes/tmp/t_716400d7-target
$ cargo test --locked
test result: ok. ... (35 test binaries, 478 passed, 0 failed)
exit 0

$ cargo clippy --locked --all-targets -- -D warnings
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.49s
exit 0

Known flake, not from this change: one full-suite run hit tests/tui_spec.rs::wallets_settings_menu_frame_shows_the_shipped_footer (footer glyph ok vs ✓ — the NO_COLOR env race that PR #164 fixes); it passed standalone and in the next full run on the same tree.

rustfmt --edition 2024 --check src/tui.rs reports the same 16 inherited hunks as origin/main (identical diff bodies), none of them in the added code.

Scope, base and sequencing

Only src/tui.rs changed (one commit, 143 insertions, 9 deletions). src/wallet.rs, src/node.rs, src/store.rs, src/main.rs, docs/, Cargo.toml untouched.

Open against main. The card suggested basing on the still-open F7 branch (PR #165), but F7 does not touch draw_wallet at all (git diff origin/main...origin/onionwire/t_00c81aa6... touches draw_wallet_setup_config and the footers only), and the bare-install F6 path this card's test 1 exercises needs the #161 degrade that is on main but not yet on that branch. git merge-tree --write-tree HEAD origin/onionwire/t_00c81aa6-onionwire-tui-f7-setup-screen-configure exits 0, so this branch merges cleanly into F7's branch either way.

No new crates, no network, no wallet RPC dial: the frames come from TestBackend over the offline node harness the existing tests use.

## What was wrong `draw_wallet` in `src/tui.rs` split its area into five rows: `Length(2)` title, `Min(4)`, `Length(2)`, `Length(3)` help, `Length(1)`. The `address` / `balance` / `recent transfers` paragraph was rendered into the `Length(2)` slot, whose block borders consume both rows (inner height 0), while the tall `Min(4)` slot above it was never rendered into. Every install — configured or not — showed an empty wallet screen, and the `no address` line had never been seen. ### Frame at 80x24 before (real `App::draw`, `TestBackend`, bare install) ``` ┌wallet────────────────────────────────────────────────────────────────────────┐ └──────────────────────────────────────────────────────────────────────────────┘ (16 blank rows — nothing drawn) ┌──────────────────────────────────────────────────────────────────────────────┐ └──────────────────────────────────────────────────────────────────────────────┘ s start child x stop child p probe c create i import r qr Esc back ``` ## What changed The body is rendered into the slot that has the height. The dead `Length(2)` row is dropped, so the layout is `Length(2)` title / `Min(4)` body / `Length(3)` help / `Length(1)` leftover: the body moves from `cols[2]` to `cols[1]`, the help line from `cols[3]` to `cols[2]`. Nothing else in `draw_wallet` moves. ### Frame at 80x24 after, bare install ``` ┌wallet────────────────────────────────────────────────────────────────────────┐ └──────────────────────────────────────────────────────────────────────────────┘ ┌──────────────────────────────────────────────────────────────────────────────┐ │address │ │ no address │ │ │ │balance │ │ off │ │ │ │recent transfers │ │ (none) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ s start child x stop child p probe c create i import r qr Esc back ``` ### Frame at 80x24 after, filled receive address ``` ┌wallet────────────────────────────────────────────────────────────────────────┐ └──────────────────────────────────────────────────────────────────────────────┘ ┌──────────────────────────────────────────────────────────────────────────────┐ │address │ │ 4AdUndXHHZ6cfufTMvppY6JwXNouMBzSkbLYfpAV5Usx3skxNgYeYTRj5UzqtReoS44qo9mtmXCq│ │Y45DJ852K5Jv2684Rge │ │ │ │balance │ │ off │ │ │ │recent transfers │ │ (none) │ │ │ │ │ │ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ s start child x stop child p probe c create i import r qr Esc back ``` ## Tests (through the real `App::draw`, `TestBackend`) Added to `mod wallet_store_tests`, which already had the `frame_text` helper; `frame_text` now delegates to a new `frame_at(app, width, height)` so each case is checked at 80x24, 120x40 and 200x60 where relevant. Two small inspect helpers (`flattened`, `unwrapped`) drop the pane border glyphs so a wrapped address still reads as one string without collapsing the whitespace that separates a heading from its value. 1. `the_wallet_screen_draws_its_body_on_a_bare_install` — `F6` on an install with no wallet (the `#161` degrade path): the frame carries `address`, `no address`, `balance`, `recent transfers`, `(none)` and the help line at 80x24 / 120x40 / 200x60, and never the node's refusal text `no receive address — set profile xmr or ONIONWIRE_WALLET_RPC`. 2. `the_wallet_screen_shows_the_filled_address` — a profile address reaches the screen intact at 80x24 (it is wider than the pane, so the wrap is checked too) and 200x60. 3. `an_empty_transfer_list_still_names_recent_transfers` — an empty history still renders `recent transfers (none)` at 80x24 and 120x40. RED first: with the fix absent, all three fail (`test result: FAILED. 8 passed; 3 failed`), the first dump being exactly the empty frame quoted above. The doc comment on `f6_on_a_bare_install_never_draws_the_error_and_states_the_way_forward`, which said the body was a separate card, now points at these tests. ## Evidence ``` $ export TMPDIR=/home/lancelot/.hermes/tmp/t_716400d7-tmp $ export CARGO_TARGET_DIR=/home/lancelot/.hermes/tmp/t_716400d7-target $ cargo test --locked test result: ok. ... (35 test binaries, 478 passed, 0 failed) exit 0 $ cargo clippy --locked --all-targets -- -D warnings Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.49s exit 0 ``` Known flake, not from this change: one full-suite run hit `tests/tui_spec.rs::wallets_settings_menu_frame_shows_the_shipped_footer` (footer glyph `ok` vs `✓` — the NO_COLOR env race that PR #164 fixes); it passed standalone and in the next full run on the same tree. `rustfmt --edition 2024 --check src/tui.rs` reports the same 16 inherited hunks as `origin/main` (identical diff bodies), none of them in the added code. ## Scope, base and sequencing Only `src/tui.rs` changed (one commit, 143 insertions, 9 deletions). `src/wallet.rs`, `src/node.rs`, `src/store.rs`, `src/main.rs`, `docs/`, `Cargo.toml` untouched. Open against `main`. The card suggested basing on the still-open F7 branch (PR #165), but F7 does not touch `draw_wallet` at all (`git diff origin/main...origin/onionwire/t_00c81aa6...` touches `draw_wallet_setup_config` and the footers only), and the bare-install `F6` path this card's test 1 exercises needs the `#161` degrade that is on `main` but not yet on that branch. `git merge-tree --write-tree HEAD origin/onionwire/t_00c81aa6-onionwire-tui-f7-setup-screen-configure` exits 0, so this branch merges cleanly into F7's branch either way. No new crates, no network, no wallet RPC dial: the frames come from `TestBackend` over the offline node harness the existing tests use.
tui: the F6 wallet screen draws its body in the slot that has the height
All checks were successful
android-ci / android (pull_request) Successful in 10m37s
ci / test (pull_request) Successful in 6m46s
ci / sdk (pull_request) Successful in 1m17s
ci / fuzz (pull_request) Successful in 5m1s
3bec3bffbf
Merge branch 'main' into onionwire/t_716400d7-onionwire-tui-the-f6-wallet-screen-clips
Some checks failed
android-ci / android (pull_request) Has been cancelled
ci / test (pull_request) Failing after 42s
ci / sdk (pull_request) Successful in 1m45s
ci / fuzz (pull_request) Successful in 5m10s
d93e9c3276
sirius merged commit 9f3745cd1d into main 2026-09-27 18:45:14 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!167
No description provided.