tui: drop the F9 menu that restates F6 and F7
The Wallets & Settings screen only named keys that already work. F6 is the wallet, F7 is the node, and p on the roster or chat opens peer payments. Profile, backup and wipe stay composer commands, named in help.
This commit is contained in:
parent
c550a197ac
commit
4e13242a44
5 changed files with 391 additions and 1147 deletions
|
|
@ -49,8 +49,9 @@ fn help_overlay_lists_core_bindings() {
|
|||
"F4",
|
||||
"F5",
|
||||
"F6",
|
||||
"F7",
|
||||
"F8",
|
||||
"F9",
|
||||
"p",
|
||||
"send chat",
|
||||
"/profile",
|
||||
"/pay",
|
||||
|
|
@ -61,7 +62,6 @@ fn help_overlay_lists_core_bindings() {
|
|||
"/backup",
|
||||
"/restore",
|
||||
"/wipe-all",
|
||||
"/settings",
|
||||
"Ctrl-Q",
|
||||
"?",
|
||||
] {
|
||||
|
|
@ -182,29 +182,36 @@ fn pane_focus_cycles_roster_chat_composer() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn menu_key_is_listed_in_help_and_in_the_main_footer() {
|
||||
// Discoverability: the WALLETS & SETTINGS menu has to be findable from the
|
||||
// help overlay *and* from the main footer, or F9 is a secret.
|
||||
fn wallet_and_node_keys_are_listed_and_the_menu_key_is_not() {
|
||||
// F6 is the wallet and F7 is the node. There is no second menu, so F9 and
|
||||
// `/settings` must not be printed — a key that no longer exists is worse
|
||||
// than a missing one.
|
||||
let help = help_overlay_text();
|
||||
assert!(help.contains("F9"), "F9 missing from help:\n{help}");
|
||||
assert!(help.contains("F6"), "F6 missing from help:\n{help}");
|
||||
assert!(help.contains("F7"), "F7 missing from help:\n{help}");
|
||||
assert!(
|
||||
help.contains("/settings"),
|
||||
"/settings missing from help:\n{help}"
|
||||
!help.contains("F9"),
|
||||
"F9 is still a printed key:\n{help}"
|
||||
);
|
||||
assert!(
|
||||
!help.contains("/settings"),
|
||||
"/settings is still a printed command:\n{help}"
|
||||
);
|
||||
let hints = main_footer_hints();
|
||||
assert!(
|
||||
hints.contains("F9"),
|
||||
"F9 missing from footer hints: {hints:?}"
|
||||
);
|
||||
assert!(hints.contains("F6"), "F6 missing from footer hints: {hints:?}");
|
||||
assert!(hints.contains("F7"), "F7 missing from footer hints: {hints:?}");
|
||||
assert!(!hints.contains("F9"), "F9 still in footer hints: {hints:?}");
|
||||
let fp = "abcdef0123456789deadbeef";
|
||||
let onion = "abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion";
|
||||
for w in [80u16, 120, 200] {
|
||||
let line = status_footer(w, fp, onion, None, hints);
|
||||
assert!(line.contains("F9"), "F9 dropped at {w}: {line:?}");
|
||||
assert!(line.contains("F6"), "F6 dropped at {w}: {line:?}");
|
||||
assert!(line.contains("F7"), "F7 dropped at {w}: {line:?}");
|
||||
assert!(!line.contains("F9"), "F9 still rendered at {w}: {line:?}");
|
||||
assert!(line.contains("? help"), "? help dropped at {w}: {line:?}");
|
||||
assert!(line.contains("TOR"), "TOR dropped at {w}: {line:?}");
|
||||
assert!(
|
||||
line.chars().count() <= w as usize,
|
||||
onionwire::tui::cell_width(&line) <= w as usize,
|
||||
"footer wider than {w}: {line:?}"
|
||||
);
|
||||
}
|
||||
|
|
@ -281,29 +288,38 @@ fn compact_footer_drops_the_onion_and_keeps_the_rest() {
|
|||
assert!(compact.contains("TOR"), "{compact:?}");
|
||||
assert!(compact.contains("me:"), "{compact:?}");
|
||||
assert!(compact.contains("? help"), "{compact:?}");
|
||||
assert!(compact.chars().count() <= 80, "{compact:?}");
|
||||
// The cells the onion gave up go to the hints.
|
||||
assert!(
|
||||
compact.chars().count() > 0 && compact.contains("F9"),
|
||||
"compact footer lost the menu key: {compact:?}"
|
||||
onionwire::tui::cell_width(&compact) <= 80,
|
||||
"{compact:?}"
|
||||
);
|
||||
// The cells the onion gave up go to the wallet and node keys.
|
||||
assert!(compact.contains("F6"), "compact footer lost F6: {compact:?}");
|
||||
assert!(compact.contains("F7"), "compact footer lost F7: {compact:?}");
|
||||
assert!(!compact.contains("F9"), "compact footer still prints F9: {compact:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pane_footer_hints_keep_the_menu_and_help_on_every_pane() {
|
||||
fn pane_footer_hints_name_the_wallet_and_the_node_not_a_menu() {
|
||||
let fp = "abcdef0123456789deadbeef";
|
||||
for pane in [Pane::Roster, Pane::Chat, Pane::Composer] {
|
||||
let hints = pane_footer_hints(pane);
|
||||
assert!(hints.contains("F9"), "{pane:?} lost the menu key: {hints:?}");
|
||||
assert!(hints.contains("F6"), "{pane:?} lost the wallet key: {hints:?}");
|
||||
assert!(hints.contains("F7"), "{pane:?} lost the node key: {hints:?}");
|
||||
assert!(!hints.contains("F9"), "{pane:?} still prints the menu key: {hints:?}");
|
||||
assert!(hints.contains("? help"), "{pane:?} lost ? help: {hints:?}");
|
||||
for w in [80u16, 120, 200] {
|
||||
let line = status_footer_compact(w, fp, Some(TorPhase::Ready), None, hints);
|
||||
assert!(line.contains("F9"), "{pane:?} at {w} lost F9: {line:?}");
|
||||
assert!(line.contains("F6"), "{pane:?} at {w} lost F6: {line:?}");
|
||||
assert!(line.contains("F7"), "{pane:?} at {w} lost F7: {line:?}");
|
||||
assert!(!line.contains("F9"), "{pane:?} at {w} still prints F9: {line:?}");
|
||||
assert!(
|
||||
line.contains("? help"),
|
||||
"{pane:?} at {w} lost ? help: {line:?}"
|
||||
);
|
||||
assert!(line.chars().count() <= w as usize, "{pane:?} at {w}: {line:?}");
|
||||
assert!(
|
||||
onionwire::tui::cell_width(&line) <= w as usize,
|
||||
"{pane:?} at {w}: {line:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
// The hints actually change with the pane — that is the point of the lever.
|
||||
|
|
|
|||
Loading…
Reference in a new issue