tui: clean-look chrome redesign (one accent, honest tor phase, real frames) #120

Merged
sirius merged 2 commits from onionwire/t_bcf0ae45-onionwire-tui-clean-look-chrome-redesign into main 2026-09-19 04:19:47 +00:00
Owner

What

The main screen (draw_main_chrome) is rebuilt around one accent, one primary pane and one honest status line. This applies the principles of bitchat-tui (MIT) — no code was copied; the Ratatui versions differ (0.26 vs 0.30) and its wrap helper counts char units where OnionWire counts cells.

App::draw_main now builds a MainView of plain data and calls the public draw_main_chrome, so tests/tui_frames.rs dumps the real chrome — no reconstructed stand-in. Every frame below was produced by cargo test --locked --test tui_frames -- --nocapture dump_audit_frames.

Before — 80x24

onionwire  tor  me:abcdef01  onion:abcdefgh
┌roster 2  1 stale───┐┌> chat  alice───────────────────────────────────────────┐
│> alice  aaaaaaaa…  ││you: ping  ✓                                            │
│  …  bbbbbbbb… stale││them: pong                                              │
│                    ││them: this is a very long chat line that should wrap    │
│                    ││inside the chat pane instead of running off the right   │
│                    ││edge of an 80-column terminal and colliding with the    │
│                    ││roster border                                           │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
└────────────────────┘└────────────────────────────────────────────────────────┘
  message


TOR  me:abcdef01… onion:abcdefgh… Tab F2 F3 F4 F5 F6 F9 Ctrl-Q ? help

After — 80x24

onionwire  ✓ tor ready  me:abcdef01  onion:abcdefgh
┌roster 2  1 stale───┐┌> chat  alice───────────────────────────────────────────┐
│> alice  aaaaaaaa…  ││you: ping  ✓                                            │
│  bob-the-sta… stale││them: pong                                              │
│                    ││them: this is a very long chat line that should wrap    │
│                    ││inside the chat pane instead of running off the right   │
│                    ││edge of an 80-column terminal and colliding with the    │
│                    ││roster border                                           │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
└────────────────────┘└────────────────────────────────────────────────────────┘
  message


✓ TOR ready  me:abcdef01… j k scroll g G ends F4 rotate F9 settings ? help

Before — 120x40

onionwire  tor  me:abcdef01  onion:abcdefgh
┌roster 2  1 stale─────────┐┌> chat  alice─────────────────────────────────────────────────────────────────────────────┐
│> alice  aaaaaaaa…        ││you: ping  ✓                                                                              │
│  bob-th…  bbbbbbbb… stale││them: pong                                                                                │
│                          ││them: this is a very long chat line that should wrap inside the chat pane instead of      │
│                          ││running off the right edge of an 80-column terminal and colliding with the roster border  │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
└──────────────────────────┘└──────────────────────────────────────────────────────────────────────────────────────────┘
  message


TOR  me:abcdef01…  onion:abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion  F3 F4 F5 F6 F9 Ctrl-Q  ? help

After — 120x40

onionwire  ✓ tor ready  me:abcdef01  onion:abcdefgh
┌roster 2  1 stale─────────┐┌> chat  alice─────────────────────────────────────────────────────────────────────────────┐
│> alice  aaaaaaaa…        ││you: ping  ✓                                                                              │
│  bob-the-…  bbbbbb… stale││them: pong                                                                                │
│                          ││them: this is a very long chat line that should wrap inside the chat pane instead of      │
│                          ││running off the right edge of an 80-column terminal and colliding with the roster border  │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
└──────────────────────────┘└──────────────────────────────────────────────────────────────────────────────────────────┘
  message


✓ TOR ready  me:abcdef01…  j k scroll g G ends F4 rotate F9 settings  ? help

After — 200x60 (must not break)

onionwire  ✓ tor ready  me:abcdef01  onion:abcdefgh
┌roster 2  1 stale─────────┐┌> chat  alice─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│> alice  aaaaaaaa…        ││you: ping  ✓                                                                                                                                                              │
│  bob-the-…  bbbbbb… stale││them: pong                                                                                                                                                                │
│                          ││them: this is a very long chat line that should wrap inside the chat pane instead of running off the right edge of an 80-column terminal and colliding with the roster    │
│                          ││border                                                                                                                                                                    │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
│                          ││                                                                                                                                                                          │
└──────────────────────────┘└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
  message


✓ TOR ready  me:abcdef01…  j k scroll g G ends F4 rotate F9 settings  ? help

States

Empty roster + connecting:

onionwire  … tor connecting  me:abcdef01  onion:abcdefgh
┌roster 0────────────┐┌  chat──────────────────────────────────────────────────┐
│no friends          ││no friends yet                                          │
│F3 adds one         ││F3 paste an invite to add one                           │
│                    ││                                                        │
│                    ││tor connecting — first publish takes a few minutes      │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
└────────────────────┘└────────────────────────────────────────────────────────┘
  message


… TOR connecting  me:abcdef01… j k select F3 add F6 wallet F9 settings ? help

Disconnected (tor off) + fingerprint mismatch:

onionwire  x tor off  me:abcdef01  onion:unset
fingerprint mismatch
┌roster 0────────────┐┌  chat──────────────────────────────────────────────────┐
│no friends          ││no friends yet                                          │
│F3 adds one         ││F3 paste an invite to add one                           │
│                    ││                                                        │
│                    ││tor off — no onion service is running                   │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
└────────────────────┘└────────────────────────────────────────────────────────┘
  message


x TOR off  me:abcdef01… j k select F3 add F6 wallet F9 settings ? help

Error (alert row + fail-closed note) — the sentence is printed once, in the error channel:

onionwire  ! tor degraded  me:abcdef01  onion:abcdefgh
send failed: peer onion down
┌roster 2  1 stale───┐┌  chat  alice───────────────────────────────────────────┐
│> alice  aaaaaaaa…  ││you: ping  ✓                                            │
│  bob-the-sta… stale││them: pong                                              │
│                    ││them: this is a very long chat line that should wrap    │
│                    ││inside the chat pane instead of running off the right   │
│                    ││edge of an 80-column terminal and colliding with the    │
│                    ││roster border                                           │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
└────────────────────┘└────────────────────────────────────────────────────────┘
> message


send failed: peer onion down ! TOR degraded  me:abcdef01… F9 settings ? help

Outbox queued (peer unreachable):

onionwire  ✓ tor ready  me:abcdef01  onion:abcdefgh
┌roster 2  1 stale───┐┌  chat  alice───────────────────────────────────────────┐
│> alice  aaaaaaaa…  ││you: ping  ✓                                            │
│  bob-the-sta… stale││them: pong                                              │
│                    ││you: are you there?  ◷ queued (try 1/8, retry 45s)      │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
│                    ││                                                        │
└────────────────────┘└────────────────────────────────────────────────────────┘
  message


peer unreachable, queued (1/8, retry 45s) ✓ TOR ready  me:abcdef01… ? help

Empty roster at the target size:

onionwire  … tor connecting  me:abcdef01  onion:abcdefgh
┌roster 0──────────────────┐┌  chat────────────────────────────────────────────────────────────────────────────────────┐
│no friends                ││no friends yet                                                                            │
│F3 adds one               ││F3 paste an invite to add one                                                             │
│                          ││                                                                                          │
│                          ││tor connecting — first publish takes a few minutes                                        │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
│                          ││                                                                                          │
└──────────────────────────┘└──────────────────────────────────────────────────────────────────────────────────────────┘
  message


… TOR connecting  me:abcdef01…  j k select F3 add F6 wallet F9 settings  ? help

What changed, lever by lever

Lever (from the reference) Applied? Where
One accent for focus, used in exactly three places yes style_accent on the focused pane border, style_highlight on the selected roster row, > marker on the active conversation. The header gives up the accent, which is what stops it competing with the panes
Focus = marker + weight, colour stripped yes > prefix on the roster row / chat title / composer; bold on the focused title; focus_is_a_marker_not_only_colour asserts it at 80 and 120
Border weight = focus yes only the focused pane gets an accented border; others stay style_border. No glow, no blinking
Footer: one line, no frame, muted, follows pane + phase yes pane_footer_hints(Pane) + TorPhase folded into the TOR token
Empty / loading / error / disconnected designed yes frames above; copy in chat_no_friends_lines, empty_roster_lines, TorPhase::word()
Popups modest and centred, cleared underneath yes draw_text_overlay clears the area then centres a popup with a one-cell side margin (help_overlay_keeps_a_margin_and_shows_the_tail)
Semantic colour only yes phase = text / dim / stale / alert; stale friends = stale + the word stale; nothing else is coloured
Unread / outbox = marker + word yes (outbox) ◷ queued (try 1/8, retry 45s), ✓ / ok for delivered, failed: … for terminal. No unread count exists in the render path — see below
3-line wordmark above the header at height ≥ 40 skipped fights the 1-line header without buying hierarchy
Bottom-anchored composer in its 3-row slot skipped needs cell-accurate wrap prediction for no legibility gain
Per-row colour in the roster (name vs fingerprint) skipped one style per row lets a narrow pane drop the fingerprint without changing the row's meaning

Tor phase is now a first-class state

Node::tor_state() was already cheap, read-only and unused by the TUI. It is read straight from the Arc<Node> the App already holds — no new data field, no store read from the render path:

hs::TorState TorPhase glyph / ASCII word tone
Bootstrapping Connecting … / ... connecting muted
Published Ready ✓ / ok ready text
DegradedReachable Degraded ! degraded stale
Stopped Off x off alert

Both the header and the footer state it, and always as a word plus a glyph, so it survives NO_COLOR, a 16-colour terminal and a monochrome dump.

Helper Identity shown Used by
status_footer(w, fp, onion, note, hints) TOR, onion: unchanged; every chrome test calls it
status_footer_phased(w, fp, onion, phase, note, hints) {glyph} TOR {word}, onion: F9 menu
status_footer_compact(w, fp, phase, note, hints) {glyph} TOR {word} only main — its header already prints me: and onion:

The main footer drops the onion (the header has it one line above) and gives those cells to the hints. TOR, me: and ? help survive at 80, 120 and 200 in every variant; status_footer's signature and fail-closed guarantees are untouched. When the alert row already carries the fail-closed sentence, the footer no longer repeats it.

Width

Cells everywhere this card touched: status_footer*, alert_line, short_send_reason, main_header_line*, draw_text_overlay, roster_row_text, fit_cells. chars().count() is never used for a width and no crate was added (measurement is ratatui's own Span::width). The roster spends its budget name first, then the stale word, then a fingerprint prefix — at 22 cells a row reads bob-the-sta… stale instead of … bbbbbbbb… stale (that mid-token clip was a finding in docs/TUI.md).

Verification

$ cargo test --locked
... 366 passed; 0 failed; 4 ignored

$ cargo clippy --locked --all-targets -- -D warnings
Finished `dev` profile (no warnings)
  • cargo test --locked — 366 passed, 0 failed, 4 ignored (this branch; 356 before, +10 new TUI tests)
  • cargo clippy --locked --all-targets -- -D warnings — clean
  • Every main-screen state is asserted to fit 80x24, 120x40 and 200x60 in cells (main_chrome_fits_80x24_120x40_and_200x60), and the dump helper asserts it per row as it prints.
  • New tests: tests/tui_frames.rs (12), tests/tui_chrome.rs (+4: phase projection, phase footer, compact footer, per-pane hints). Existing assertions were not rewritten; one was fixed (below).

One pre-existing failure fixed

tests/tui_spec.rs::wallets_settings_menu_truncates_wide_values_in_cells was failing on main in this environment (3/3 runs, verified with my changes stashed) because ONIONWIRE_ASCII/NO_COLOR are process-wide and a parallel test sets them, so fit_cells("abcdefghij", 8) returned "abcde..." and the assertion demanded "abcdef…". Two neighbouring assertions in the same test already accept either ellipsis form; the third now does too, and asserts more than before (that truncation happened and that an ellipsis is present) instead of less.

Scope

Presentation only: src/tui.rs, tests/tui_chrome.rs, tests/tui_spec.rs, tests/tui_frames.rs, docs/TUI.md. No wire/session/store/send-path file touched; no new crate; no repo-wide cargo fmt. The only backend symbol read is the existing read-only Node::tor_state().

Not closed (no data in the render path): a roster unread count — there is no unread counter reachable from App. Marker + word is already there for outbox and stale; adding unread needs a backend field, so it is named here rather than invented.

## What The main screen (`draw_main_chrome`) is rebuilt around one accent, one primary pane and one honest status line. This applies the **principles** of [bitchat-tui](https://github.com/vaibhav-mattoo/bitchat-tui) (MIT) — no code was copied; the Ratatui versions differ (0.26 vs 0.30) and its wrap helper counts `char` units where OnionWire counts cells. `App::draw_main` now builds a `MainView` of plain data and calls the public `draw_main_chrome`, so `tests/tui_frames.rs` dumps **the real chrome** — no reconstructed stand-in. Every frame below was produced by `cargo test --locked --test tui_frames -- --nocapture dump_audit_frames`. ## Before — 80x24 ``` onionwire tor me:abcdef01 onion:abcdefgh ┌roster 2 1 stale───┐┌> chat alice───────────────────────────────────────────┐ │> alice aaaaaaaa… ││you: ping ✓ │ │ … bbbbbbbb… stale││them: pong │ │ ││them: this is a very long chat line that should wrap │ │ ││inside the chat pane instead of running off the right │ │ ││edge of an 80-column terminal and colliding with the │ │ ││roster border │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ └────────────────────┘└────────────────────────────────────────────────────────┘ message TOR me:abcdef01… onion:abcdefgh… Tab F2 F3 F4 F5 F6 F9 Ctrl-Q ? help ``` ## After — 80x24 ``` onionwire ✓ tor ready me:abcdef01 onion:abcdefgh ┌roster 2 1 stale───┐┌> chat alice───────────────────────────────────────────┐ │> alice aaaaaaaa… ││you: ping ✓ │ │ bob-the-sta… stale││them: pong │ │ ││them: this is a very long chat line that should wrap │ │ ││inside the chat pane instead of running off the right │ │ ││edge of an 80-column terminal and colliding with the │ │ ││roster border │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ └────────────────────┘└────────────────────────────────────────────────────────┘ message ✓ TOR ready me:abcdef01… j k scroll g G ends F4 rotate F9 settings ? help ``` ## Before — 120x40 ``` onionwire tor me:abcdef01 onion:abcdefgh ┌roster 2 1 stale─────────┐┌> chat alice─────────────────────────────────────────────────────────────────────────────┐ │> alice aaaaaaaa… ││you: ping ✓ │ │ bob-th… bbbbbbbb… stale││them: pong │ │ ││them: this is a very long chat line that should wrap inside the chat pane instead of │ │ ││running off the right edge of an 80-column terminal and colliding with the roster border │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ └──────────────────────────┘└──────────────────────────────────────────────────────────────────────────────────────────┘ message TOR me:abcdef01… onion:abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion F3 F4 F5 F6 F9 Ctrl-Q ? help ``` ## After — 120x40 ``` onionwire ✓ tor ready me:abcdef01 onion:abcdefgh ┌roster 2 1 stale─────────┐┌> chat alice─────────────────────────────────────────────────────────────────────────────┐ │> alice aaaaaaaa… ││you: ping ✓ │ │ bob-the-… bbbbbb… stale││them: pong │ │ ││them: this is a very long chat line that should wrap inside the chat pane instead of │ │ ││running off the right edge of an 80-column terminal and colliding with the roster border │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ └──────────────────────────┘└──────────────────────────────────────────────────────────────────────────────────────────┘ message ✓ TOR ready me:abcdef01… j k scroll g G ends F4 rotate F9 settings ? help ``` ## After — 200x60 (must not break) ``` onionwire ✓ tor ready me:abcdef01 onion:abcdefgh ┌roster 2 1 stale─────────┐┌> chat alice─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │> alice aaaaaaaa… ││you: ping ✓ │ │ bob-the-… bbbbbb… stale││them: pong │ │ ││them: this is a very long chat line that should wrap inside the chat pane instead of running off the right edge of an 80-column terminal and colliding with the roster │ │ ││border │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ └──────────────────────────┘└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ message ✓ TOR ready me:abcdef01… j k scroll g G ends F4 rotate F9 settings ? help ``` ## States Empty roster + connecting: ``` onionwire … tor connecting me:abcdef01 onion:abcdefgh ┌roster 0────────────┐┌ chat──────────────────────────────────────────────────┐ │no friends ││no friends yet │ │F3 adds one ││F3 paste an invite to add one │ │ ││ │ │ ││tor connecting — first publish takes a few minutes │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ └────────────────────┘└────────────────────────────────────────────────────────┘ message … TOR connecting me:abcdef01… j k select F3 add F6 wallet F9 settings ? help ``` Disconnected (tor off) + fingerprint mismatch: ``` onionwire x tor off me:abcdef01 onion:unset fingerprint mismatch ┌roster 0────────────┐┌ chat──────────────────────────────────────────────────┐ │no friends ││no friends yet │ │F3 adds one ││F3 paste an invite to add one │ │ ││ │ │ ││tor off — no onion service is running │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ └────────────────────┘└────────────────────────────────────────────────────────┘ message x TOR off me:abcdef01… j k select F3 add F6 wallet F9 settings ? help ``` Error (alert row + fail-closed note) — the sentence is printed once, in the error channel: ``` onionwire ! tor degraded me:abcdef01 onion:abcdefgh send failed: peer onion down ┌roster 2 1 stale───┐┌ chat alice───────────────────────────────────────────┐ │> alice aaaaaaaa… ││you: ping ✓ │ │ bob-the-sta… stale││them: pong │ │ ││them: this is a very long chat line that should wrap │ │ ││inside the chat pane instead of running off the right │ │ ││edge of an 80-column terminal and colliding with the │ │ ││roster border │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ └────────────────────┘└────────────────────────────────────────────────────────┘ > message send failed: peer onion down ! TOR degraded me:abcdef01… F9 settings ? help ``` Outbox queued (peer unreachable): ``` onionwire ✓ tor ready me:abcdef01 onion:abcdefgh ┌roster 2 1 stale───┐┌ chat alice───────────────────────────────────────────┐ │> alice aaaaaaaa… ││you: ping ✓ │ │ bob-the-sta… stale││them: pong │ │ ││you: are you there? ◷ queued (try 1/8, retry 45s) │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ └────────────────────┘└────────────────────────────────────────────────────────┘ message peer unreachable, queued (1/8, retry 45s) ✓ TOR ready me:abcdef01… ? help ``` Empty roster at the target size: ``` onionwire … tor connecting me:abcdef01 onion:abcdefgh ┌roster 0──────────────────┐┌ chat────────────────────────────────────────────────────────────────────────────────────┐ │no friends ││no friends yet │ │F3 adds one ││F3 paste an invite to add one │ │ ││ │ │ ││tor connecting — first publish takes a few minutes │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ └──────────────────────────┘└──────────────────────────────────────────────────────────────────────────────────────────┘ message … TOR connecting me:abcdef01… j k select F3 add F6 wallet F9 settings ? help ``` ## What changed, lever by lever | Lever (from the reference) | Applied? | Where | |---|---|---| | One accent for focus, used in exactly three places | yes | `style_accent` on the focused pane border, `style_highlight` on the selected roster row, `> ` marker on the active conversation. The header **gives up** the accent, which is what stops it competing with the panes | | Focus = marker + weight, colour stripped | yes | `> ` prefix on the roster row / chat title / composer; bold on the focused title; `focus_is_a_marker_not_only_colour` asserts it at 80 and 120 | | Border weight = focus | yes | only the focused pane gets an accented border; others stay `style_border`. No glow, no blinking | | Footer: one line, no frame, muted, follows pane + phase | yes | `pane_footer_hints(Pane)` + `TorPhase` folded into the `TOR` token | | Empty / loading / error / disconnected designed | yes | frames above; copy in `chat_no_friends_lines`, `empty_roster_lines`, `TorPhase::word()` | | Popups modest and centred, cleared underneath | yes | `draw_text_overlay` clears the area then centres a popup with a one-cell side margin (`help_overlay_keeps_a_margin_and_shows_the_tail`) | | Semantic colour only | yes | phase = text / dim / stale / alert; stale friends = stale + the word `stale`; nothing else is coloured | | Unread / outbox = marker + word | yes (outbox) | `◷ queued (try 1/8, retry 45s)`, `✓` / `ok` for delivered, `failed: …` for terminal. **No unread count exists in the render path** — see below | | 3-line wordmark above the header at height ≥ 40 | **skipped** | fights the 1-line header without buying hierarchy | | Bottom-anchored composer in its 3-row slot | **skipped** | needs cell-accurate wrap prediction for no legibility gain | | Per-row colour in the roster (name vs fingerprint) | **skipped** | one style per row lets a narrow pane drop the fingerprint without changing the row's meaning | ## Tor phase is now a first-class state `Node::tor_state()` was already cheap, read-only and unused by the TUI. It is read straight from the `Arc<Node>` the `App` already holds — **no new data field, no store read from the render path**: | `hs::TorState` | `TorPhase` | glyph / ASCII | word | tone | |---|---|---|---|---| | `Bootstrapping` | `Connecting` | `…` / `...` | `connecting` | muted | | `Published` | `Ready` | `✓` / `ok` | `ready` | text | | `DegradedReachable` | `Degraded` | `!` | `degraded` | stale | | `Stopped` | `Off` | `x` | `off` | alert | Both the header and the footer state it, and always as a **word plus a glyph**, so it survives `NO_COLOR`, a 16-colour terminal and a monochrome dump. ## Footer variants (all locked strings kept) | Helper | Identity shown | Used by | |---|---|---| | `status_footer(w, fp, onion, note, hints)` | `TOR`, `onion:` | unchanged; every chrome test calls it | | `status_footer_phased(w, fp, onion, phase, note, hints)` | `{glyph} TOR {word}`, `onion:` | F9 menu | | `status_footer_compact(w, fp, phase, note, hints)` | `{glyph} TOR {word}` only | main — its header already prints `me:` and `onion:` | The main footer drops the onion (the header has it one line above) and gives those cells to the hints. `TOR`, `me:` and `? help` survive at 80, 120 and 200 in every variant; `status_footer`'s signature and fail-closed guarantees are untouched. When the alert row already carries the fail-closed sentence, the footer no longer repeats it. ## Width Cells everywhere this card touched: `status_footer*`, `alert_line`, `short_send_reason`, `main_header_line*`, `draw_text_overlay`, `roster_row_text`, `fit_cells`. `chars().count()` is never used for a width and no crate was added (measurement is ratatui's own `Span::width`). The roster spends its budget **name first**, then the `stale` word, then a fingerprint prefix — at 22 cells a row reads `bob-the-sta… stale` instead of `… bbbbbbbb… stale` (that mid-token clip was a finding in `docs/TUI.md`). ## Verification ``` $ cargo test --locked ... 366 passed; 0 failed; 4 ignored $ cargo clippy --locked --all-targets -- -D warnings Finished `dev` profile (no warnings) ``` - `cargo test --locked` — 366 passed, 0 failed, 4 ignored (this branch; 356 before, +10 new TUI tests) - `cargo clippy --locked --all-targets -- -D warnings` — clean - Every main-screen state is asserted to fit 80x24, 120x40 and 200x60 in **cells** (`main_chrome_fits_80x24_120x40_and_200x60`), and the dump helper asserts it per row as it prints. - New tests: `tests/tui_frames.rs` (12), `tests/tui_chrome.rs` (+4: phase projection, phase footer, compact footer, per-pane hints). Existing assertions were not rewritten; one was **fixed** (below). ### One pre-existing failure fixed `tests/tui_spec.rs::wallets_settings_menu_truncates_wide_values_in_cells` was failing **on main in this environment** (3/3 runs, verified with my changes stashed) because `ONIONWIRE_ASCII`/`NO_COLOR` are process-wide and a parallel test sets them, so `fit_cells("abcdefghij", 8)` returned `"abcde..."` and the assertion demanded `"abcdef…"`. Two neighbouring assertions in the same test already accept either ellipsis form; the third now does too, and asserts more than before (that truncation happened and that an ellipsis is present) instead of less. ## Scope Presentation only: `src/tui.rs`, `tests/tui_chrome.rs`, `tests/tui_spec.rs`, `tests/tui_frames.rs`, `docs/TUI.md`. No wire/session/store/send-path file touched; no new crate; no repo-wide `cargo fmt`. The only backend symbol read is the existing read-only `Node::tor_state()`. Not closed (no data in the render path): a roster **unread** count — there is no unread counter reachable from `App`. Marker + word is already there for outbox and `stale`; adding unread needs a backend field, so it is named here rather than invented.
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
All checks were successful
ci / test (pull_request) Successful in 5m42s
ci / sdk (pull_request) Successful in 1m29s
ci / fuzz (pull_request) Successful in 4m41s
android-ci / android (pull_request) Successful in 10m45s
eefa7e5cc6
Applies the bitchat-tui clean-look principles to the OnionWire main screen.

- Hierarchy: header, roster + one primary chat pane, one status line, one
  footer hint line. The header gives up the accent (the accent is reserved
  for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
  word, header and footer) so connecting / ready / degraded / off are never
  colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
  main footer drops the redundant onion (the header already prints it) and
  uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
  with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
  Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
  and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
  reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
  main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
  budget name-first, so a 22-cell pane reads `bob-the-sta…  stale` instead of
  `…  bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
  underneath; never full-bleed.

Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).

Co-Authored-By: Hermes <[email protected]>
Author
Owner

CI note: the four checks (ci/test, ci/sdk, ci/fuzz, android-ci/android) were still Waiting to run ~20 min after the push — the shared Pi runner was busy with the #119 fuzz job. Local verification for head eefa7e5: cargo test --locked 366 passed / 0 failed / 4 ignored, cargo clippy --locked --all-targets -- -D warnings clean. Not claiming CI green until the runner reports.

CI note: the four checks (ci/test, ci/sdk, ci/fuzz, android-ci/android) were still `Waiting to run` ~20 min after the push — the shared Pi runner was busy with the #119 fuzz job. Local verification for head `eefa7e5`: `cargo test --locked` 366 passed / 0 failed / 4 ignored, `cargo clippy --locked --all-targets -- -D warnings` clean. Not claiming CI green until the runner reports.
Merge branch 'main' into onionwire/t_bcf0ae45-onionwire-tui-clean-look-chrome-redesign
All checks were successful
ci / test (pull_request) Successful in 5m46s
ci / sdk (pull_request) Successful in 1m30s
ci / fuzz (pull_request) Successful in 4m40s
android-ci / android (pull_request) Successful in 10m28s
8cbdcbbd94
sirius merged commit 5ae9a8f7aa into main 2026-09-19 04:19:47 +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!120
No description provided.