refactor: simplify TUI quick help
Keep the footer focused on non-obvious actions, split Add/Edit/Delete labels, and move Home/End guidance into the detailed keyboard popup. Tests: cargo fmt --all -- --check; cargo check --workspace --all-targets --all-features; cargo test --workspace --all-targets --all-features; cargo test --workspace --doc --all-features; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo build --workspace --release --all-features (all pass; real-daemon tests remain opt-in).
This commit is contained in:
parent
54149c3302
commit
db41daaaf8
|
|
@ -513,6 +513,9 @@ terminals that do not distinguish Shift+Arrow.
|
|||
Lowercase `h` and `?` open an orientation-aware keyboard-help popup with mixer,
|
||||
configuration, and global controls. Hiding is deliberately assigned to Shift+H
|
||||
so the common help key does not perform a destructive presentation edit.
|
||||
The always-visible quick-help footer omits intuitive navigation, volume, and
|
||||
alternative bindings; it keeps compact non-obvious actions with Add, Edit, and
|
||||
Delete shown separately. The detailed popup documents J/K, `?`, and Home/End.
|
||||
|
||||
The selected main-list entry can be moved directly, and separators can be
|
||||
added, renamed, moved, or removed. A centered separator dialog edits its name,
|
||||
|
|
|
|||
3
task.md
3
task.md
|
|
@ -457,6 +457,9 @@ Dependencies: M8, M2, M1.
|
|||
fader. MIDI-device status rows are selectable and open a details popup where
|
||||
the profile's default-controller assignment can be set or cleared. `h` and `?`
|
||||
open detailed keyboard help; Shift+H hides the selected mixer fader.
|
||||
Quick help now omits navigation, volume, Home/End, and alternate bindings,
|
||||
while showing Add, Edit, and Delete as separate actions; detailed help retains
|
||||
the complete bindings and explicitly documents Home/End.
|
||||
A confirmed Config action now resets only the active profile to the safe
|
||||
Master-output default. The server backs up the prior bytes as `.reset.bak`,
|
||||
atomically persists the replacement, and activates it without audio writes;
|
||||
|
|
|
|||
|
|
@ -2789,60 +2789,28 @@ impl<C: MixerClient> Widget for &LiveTui<C> {
|
|||
Tab::Configuration => self.render_configuration(inner, buf),
|
||||
}
|
||||
|
||||
let footer_line = match (self.tab, self.snapshot.configuration.mixer_orientation) {
|
||||
(Tab::Mixer, MixerOrientation::Horizontal) => Line::from(vec![
|
||||
" ←→/jk ".fg(theme.foreground),
|
||||
"select".fg(theme.secondary),
|
||||
" ↑↓ ".fg(theme.foreground),
|
||||
"volume".fg(theme.secondary),
|
||||
let footer_line = match self.tab {
|
||||
Tab::Mixer => Line::from(vec![
|
||||
" M ".fg(theme.foreground),
|
||||
"mute".fg(theme.secondary),
|
||||
" Home/End ".fg(theme.foreground),
|
||||
"0/100%".fg(theme.secondary),
|
||||
" A ".fg(theme.foreground),
|
||||
"add".fg(theme.secondary),
|
||||
" E ".fg(theme.foreground),
|
||||
"edit".fg(theme.secondary),
|
||||
" D ".fg(theme.foreground),
|
||||
"delete".fg(theme.secondary),
|
||||
" ⇧H ".fg(theme.foreground),
|
||||
"hide".fg(theme.secondary),
|
||||
" T ".fg(theme.foreground),
|
||||
"theme".fg(theme.secondary),
|
||||
" Tab ".fg(theme.foreground),
|
||||
"config".fg(theme.secondary),
|
||||
" Q ".fg(theme.foreground),
|
||||
"quit".fg(theme.secondary),
|
||||
" ⇧←→/⇧JK ".fg(theme.foreground),
|
||||
"move".fg(theme.secondary),
|
||||
" A/E/D ".fg(theme.foreground),
|
||||
"separator".fg(theme.secondary),
|
||||
" ⇧H ".fg(theme.foreground),
|
||||
"hide".fg(theme.secondary),
|
||||
" h/? ".fg(theme.foreground),
|
||||
" h ".fg(theme.foreground),
|
||||
"help".fg(theme.secondary),
|
||||
]),
|
||||
(Tab::Mixer, MixerOrientation::Vertical) => Line::from(vec![
|
||||
" ↑↓/jk ".fg(theme.foreground),
|
||||
"select".fg(theme.secondary),
|
||||
" ←→ ".fg(theme.foreground),
|
||||
"volume".fg(theme.secondary),
|
||||
" M ".fg(theme.foreground),
|
||||
"mute".fg(theme.secondary),
|
||||
" Home/End ".fg(theme.foreground),
|
||||
"0/100%".fg(theme.secondary),
|
||||
" T ".fg(theme.foreground),
|
||||
"theme".fg(theme.secondary),
|
||||
" Tab ".fg(theme.foreground),
|
||||
"config".fg(theme.secondary),
|
||||
" Q ".fg(theme.foreground),
|
||||
"quit".fg(theme.secondary),
|
||||
" ⇧↑↓/⇧JK ".fg(theme.foreground),
|
||||
"move".fg(theme.secondary),
|
||||
" A/E/D ".fg(theme.foreground),
|
||||
"separator".fg(theme.secondary),
|
||||
" ⇧H ".fg(theme.foreground),
|
||||
"hide".fg(theme.secondary),
|
||||
" h/? ".fg(theme.foreground),
|
||||
"help".fg(theme.secondary),
|
||||
]),
|
||||
(Tab::Configuration, _) => Line::from(vec![
|
||||
" ↑↓ ".fg(theme.foreground),
|
||||
"select".fg(theme.secondary),
|
||||
" ←→/Enter ".fg(theme.foreground),
|
||||
"change".fg(theme.secondary),
|
||||
Tab::Configuration => Line::from(vec![
|
||||
" S ".fg(theme.foreground),
|
||||
"save".fg(theme.secondary),
|
||||
" Tab ".fg(theme.foreground),
|
||||
|
|
@ -2851,7 +2819,7 @@ impl<C: MixerClient> Widget for &LiveTui<C> {
|
|||
"theme".fg(theme.secondary),
|
||||
" Q ".fg(theme.foreground),
|
||||
"quit".fg(theme.secondary),
|
||||
" h/? ".fg(theme.foreground),
|
||||
" h ".fg(theme.foreground),
|
||||
"help".fg(theme.secondary),
|
||||
]),
|
||||
};
|
||||
|
|
@ -3689,6 +3657,7 @@ impl<C: MixerClient> LiveTui<C> {
|
|||
Line::from("Mixer").fg(theme.accent).bold(),
|
||||
Line::from(format!(" {selection:<18} Select a fader or separator")),
|
||||
Line::from(format!(" {volume:<18} Change the selected fader volume")),
|
||||
Line::from(" Home/End Set the selected fader to 0%/100%"),
|
||||
Line::from(format!(" {movement:<18} Reorder the selected entry")),
|
||||
Line::from(" J/K Select next/previous in either orientation"),
|
||||
Line::from(" M Toggle mute"),
|
||||
|
|
@ -4635,16 +4604,6 @@ mod tests {
|
|||
app.handle_key_event(press(KeyCode::Down));
|
||||
assert!((app.snapshot.items[0].gain.unwrap_or_default() - 0.65).abs() < f64::EPSILON);
|
||||
|
||||
let area = Rect::new(0, 0, 200, 20);
|
||||
let mut buffer = Buffer::empty(area);
|
||||
(&app).render(area, &mut buffer);
|
||||
let rendered = buffer
|
||||
.content
|
||||
.iter()
|
||||
.map(|cell| cell.symbol())
|
||||
.collect::<String>();
|
||||
assert!(rendered.contains("←→/jk select ↑↓ volume"));
|
||||
|
||||
app.handle_key_event(shift(KeyCode::Right));
|
||||
assert!(edits.lock().unwrap().iter().any(|edit| matches!(
|
||||
edit,
|
||||
|
|
@ -4797,6 +4756,7 @@ mod tests {
|
|||
assert!(rendered.contains("Shift+H"));
|
||||
assert!(rendered.contains("Add a separator"));
|
||||
assert!(rendered.contains("Save the configuration"));
|
||||
assert!(rendered.contains("Home/End"));
|
||||
|
||||
app.handle_key_event(press(KeyCode::Esc));
|
||||
assert!(!app.exit);
|
||||
|
|
@ -4811,6 +4771,31 @@ mod tests {
|
|||
assert!(question_rendered.contains("Keyboard help"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn quick_help_keeps_only_distinct_non_obvious_actions() {
|
||||
let app = LiveTui::new(DemoClient::default()).unwrap();
|
||||
let area = Rect::new(0, 0, 160, 20);
|
||||
let mut buffer = Buffer::empty(area);
|
||||
|
||||
(&app).render(area, &mut buffer);
|
||||
|
||||
let rendered = buffer
|
||||
.content
|
||||
.iter()
|
||||
.map(|cell| cell.symbol())
|
||||
.collect::<String>();
|
||||
assert!(rendered.contains(" A add"));
|
||||
assert!(rendered.contains(" E edit"));
|
||||
assert!(rendered.contains(" D delete"));
|
||||
assert!(rendered.contains(" h help"));
|
||||
assert!(!rendered.contains("Home/End"));
|
||||
assert!(!rendered.contains("A/E/D"));
|
||||
assert!(!rendered.contains("/jk"));
|
||||
assert!(!rendered.contains("h/?"));
|
||||
assert!(!rendered.contains("volume"));
|
||||
assert!(!rendered.contains("move"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unnamed_separators_are_accepted_with_unique_ids() {
|
||||
let edits = Arc::new(Mutex::new(Vec::new()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue