tui: the spend-authority warning is readable on a standard 80x24 terminal #163

Owner

draw_text_overlay sized its popup from the body's logical line count, so the
184-char SPEND_AUTHORITY_WARNING (one logical line, three wrapped rows at 80 columns,
plus the blank, the Type SPEND to confirm prompt and the typed buffer) got a 6-row
popup with a 4-row body box. The scroll-to-tail then left only

|trust.                                                                      |
|                                                                            |
|Type SPEND to confirm    Esc to cancel                                      |

on a standard 80x24 terminal: the sentence that makes the spend warning a warning was
off screen at every terminal size except 200x60.

Fix

Height now comes from the body's wrapped row count plus the border rows, capped by
the frame; width is unchanged. scroll = wrapped - inner_h therefore stays 0 whenever
the body fits, and a body that still cannot fit the frame scrolls to its tail exactly as
before (? help on 80x24 is unchanged: 30 rows, frame-capped, tail visible — its pin
tests/tui_spec.rs::help_overlay_at_80x24_is_fullscreen_last_line_visible and
tests/tui_frames.rs::help_overlay_keeps_a_margin_and_shows_the_tail still pass).

Nothing about the warning moved: SPEND_AUTHORITY_WARNING is byte-identical,
WalletSetup::CreateWarn is still the only screen it is drawn on, and it is still not
dismissible.

The 80x24 frame the create flow now draws:

 ┌create spend wallet─────────────────────────────────────────────────────────┐
 │this wallet file can spend. anyone with its passphrase or the RPC creds can │
 │move the balance. write down the seed. do not leave it on a box you do not  │
 │trust.                                                                      │
 │                                                                            │
 │Type SPEND to confirm    Esc to cancel                                      │
 └────────────────────────────────────────────────────────────────────────────┘

Test

src/tui.rs::tui::wallet_store_tests::the_create_flow_is_still_reachable_and_still_warns
(the test this defect forced to run its full-sentence assertion on a 200x60 frame) now
asserts the whole warning and Type SPEND to confirm on the 80x24 frame drawn
through App::draw, and keeps the 200x60 check. It is RED on the parent commit (the
frame printed only trust.) and green after the one-function change.

New helper unframed: a wrapped sentence has the popup's side border glyph between its
rows, so whole-frame whitespace flattening cannot see ...you do not <border> trust. as
one sentence. It blanks the box-drawing cells; the copy is what is asserted.

Evidence

export TMPDIR=/home/lancelot/.hermes/tmp/onionwire-tui
cargo test --locked                          -> exit 0, 35 suites, 473 passed, 0 failed
cargo clippy --locked --all-targets -- -D warnings -> exit 0

rustfmt hunks on src/tui.rs: 16 before, 16 after (all inherited; only one context line
differs), so this commit adds no formatting churn.

Base

Stacked on onionwire/t_6aa61cf8-onionwire-tui-a-fresh-install-must-not-o (PR #162),
because the assertion being tightened is that PR's test. Retarget this PR to main once
#162 merges; no merge conflict is expected (this diff is draw_text_overlay plus that
one test function).

`draw_text_overlay` sized its popup from the body's **logical** line count, so the 184-char `SPEND_AUTHORITY_WARNING` (one logical line, three wrapped rows at 80 columns, plus the blank, the `Type SPEND to confirm` prompt and the typed buffer) got a 6-row popup with a 4-row body box. The scroll-to-tail then left only ``` |trust. | | | |Type SPEND to confirm Esc to cancel | ``` on a standard 80x24 terminal: the sentence that makes the spend warning a warning was off screen at every terminal size except 200x60. ## Fix Height now comes from the body's **wrapped** row count plus the border rows, capped by the frame; width is unchanged. `scroll = wrapped - inner_h` therefore stays 0 whenever the body fits, and a body that still cannot fit the frame scrolls to its tail exactly as before (`? help` on 80x24 is unchanged: 30 rows, frame-capped, tail visible — its pin `tests/tui_spec.rs::help_overlay_at_80x24_is_fullscreen_last_line_visible` and `tests/tui_frames.rs::help_overlay_keeps_a_margin_and_shows_the_tail` still pass). Nothing about the warning moved: `SPEND_AUTHORITY_WARNING` is byte-identical, `WalletSetup::CreateWarn` is still the only screen it is drawn on, and it is still not dismissible. The 80x24 frame the create flow now draws: ``` ┌create spend wallet─────────────────────────────────────────────────────────┐ │this wallet file can spend. anyone with its passphrase or the RPC creds can │ │move the balance. write down the seed. do not leave it on a box you do not │ │trust. │ │ │ │Type SPEND to confirm Esc to cancel │ └────────────────────────────────────────────────────────────────────────────┘ ``` ## Test `src/tui.rs::tui::wallet_store_tests::the_create_flow_is_still_reachable_and_still_warns` (the test this defect forced to run its full-sentence assertion on a 200x60 frame) now asserts the whole warning **and** `Type SPEND to confirm` on the 80x24 frame drawn through `App::draw`, and keeps the 200x60 check. It is RED on the parent commit (the frame printed only `trust.`) and green after the one-function change. New helper `unframed`: a wrapped sentence has the popup's side border glyph between its rows, so whole-frame whitespace flattening cannot see `...you do not <border> trust.` as one sentence. It blanks the box-drawing cells; the copy is what is asserted. ## Evidence ``` export TMPDIR=/home/lancelot/.hermes/tmp/onionwire-tui cargo test --locked -> exit 0, 35 suites, 473 passed, 0 failed cargo clippy --locked --all-targets -- -D warnings -> exit 0 ``` rustfmt hunks on `src/tui.rs`: 16 before, 16 after (all inherited; only one context line differs), so this commit adds no formatting churn. ## Base Stacked on `onionwire/t_6aa61cf8-onionwire-tui-a-fresh-install-must-not-o` (PR #162), because the assertion being tightened is that PR's test. Retarget this PR to `main` once #162 merges; no merge conflict is expected (this diff is `draw_text_overlay` plus that one test function).
tui: size the modal popup from the body's wrapped rows
All checks were successful
android-ci / android (pull_request) Successful in 11m29s
ci / test (pull_request) Successful in 6m18s
ci / sdk (pull_request) Successful in 1m15s
ci / fuzz (pull_request) Successful in 4m55s
02e170114c
draw_text_overlay sized its height from the body's logical line count, so
the 184-char SPEND_AUTHORITY_WARNING (one logical line, three wrapped rows
at 80 columns) got a 4-row body box and the scroll-to-tail put only
"trust. / Type SPEND to confirm" on screen. Height now comes from the
wrapped row count, capped by the frame; a body that still cannot fit
scrolls to its tail as before.

the_create_flow_is_still_reachable_and_still_warns now asserts the whole
warning on the standard 80x24 frame instead of 200x60, via a helper that
blanks the popup's border cells (a wrapped sentence has a border glyph
between its rows).
Merge branch 'onionwire/t_6aa61cf8-onionwire-tui-a-fresh-install-must-not-o' into onionwire/t_c6ec1508-onionwire-tui-the-create-wallet-spend-au
Some checks failed
ci / test (pull_request) Failing after 32s
ci / fuzz (pull_request) Has been cancelled
ci / sdk (pull_request) Has been cancelled
android-ci / android (pull_request) Successful in 12m56s
3fed0c9e32
sirius merged commit 52b62b1fb3 into onionwire/t_6aa61cf8-onionwire-tui-a-fresh-install-must-not-o 2026-09-27 18:08:24 +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!163
No description provided.