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

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]>
This commit is contained in:
agent 2026-09-18 23:13:12 -04:00
commit eefa7e5cc6
No known key found for this signature in database
5 changed files with 1344 additions and 471 deletions

View file

@ -259,6 +259,13 @@ fn alert_line_truncates_to_frame_width() {
!line.contains("roster on the next row"),
"alert still has overflow tail: {line:?}"
);
// Cells, not chars: a double-width peer error must not overflow the row.
let cjk = alert_line("接続がタイムアウトしました 接続がタイムアウトしました", 32);
assert!(
onionwire::tui::cell_width(&cjk) <= 32,
"alert wider than 32 cells: {} {cjk:?}",
onionwire::tui::cell_width(&cjk)
);
}
#[test]
@ -1133,10 +1140,19 @@ fn wallets_settings_menu_truncates_wide_values_in_cells() {
"no ellipsis: {cut:?}"
);
// ASCII chrome swaps the ellipsis and the section rule, never the width
// contract.
// contract. Either ellipsis form is accepted, like the two assertions above:
// `ONIONWIRE_ASCII` is process-wide, so this test cannot assume which form
// is active while other tests run in parallel.
let ascii = fit_cells("abcdefghij", 8);
assert!(cell_width(&ascii) <= 8, "{ascii:?}");
assert!(ascii.starts_with("abcdef"), "{ascii:?}");
assert!(
ascii.starts_with("abcde") && ascii != "abcdefghij",
"truncation kept the whole string or dropped too much: {ascii:?}"
);
assert!(
ascii.ends_with('…') || ascii.ends_with("..."),
"no ellipsis: {ascii:?}"
);
assert_eq!(cell_width("名"), 2);
assert_eq!(cell_width("abc"), 3);
}