fix: add reliable fader reorder keys

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; default, no-default-features, midir, and pulse checks.
This commit is contained in:
Dandaedre 2026-10-15 23:13:18 +02:00
parent ef917e1071
commit eeb69ae944
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
3 changed files with 37 additions and 9 deletions

View File

@ -69,10 +69,11 @@ upgrade was unavailable. The `validate` command remains read-only.
The mixer arrow keys follow its orientation. In Vertical mode, use Up/Down to
select a configured fader or separator and Left/Right to change its volume. In
Horizontal mode, use Left/Right to select and Up/Down to change volume. J/K
remain selection aliases in either mode, and Shift plus the selection arrows
reorders an entry. M toggles mute, Shift+H hides the selected fader, and `h` or
`?` opens detailed keyboard help. T cycles the profile's theme draft, and Q opens
the quit confirmation. Escape cancels the active editor or dialog and
remain selection aliases in either mode; Shift plus the selection arrows, or
Shift+J/K, reorders an entry. The J/K binding avoids terminals that do not
report Shift+Arrow distinctly. M toggles mute, Shift+H hides the selected fader,
and `h` or `?` opens detailed keyboard help. T cycles the profile's theme draft,
and Q opens the quit confirmation. Escape cancels the active editor or dialog and
does not quit from the main screen. Pass `--theme dracula`, `nord`,
`gruvbox-dark`, `catppuccin-mocha`, or `solarized-dark` to choose an initial
session theme. Save from Config to persist a theme selected with T. Offline

View File

@ -451,7 +451,8 @@ Arrow-key controls follow that spatial model: vertical mode selects entries
with Up/Down and changes volume with Left/Right, while horizontal mode selects
with Left/Right and changes volume with Up/Down. Holding Shift reorders entries
along the active selection axis; J/K remain orientation-independent selection
aliases.
aliases, and Shift+J/K provides an orientation-independent reorder path for
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.

View File

@ -1225,6 +1225,8 @@ impl<C: MixerClient> LiveTui<C> {
if key_event.modifiers.contains(KeyModifiers::SHIFT) {
match (horizontal, key_event.code) {
(_, KeyCode::Char('H' | 'h')) => self.toggle_selected_visibility(),
(_, KeyCode::Char('K' | 'k')) => self.move_selected_layout(-1),
(_, KeyCode::Char('J' | 'j')) => self.move_selected_layout(1),
(true, KeyCode::Left) | (false, KeyCode::Up) => {
self.move_selected_layout(-1);
}
@ -2281,7 +2283,7 @@ impl<C: MixerClient> Widget for &LiveTui<C> {
"config".fg(theme.secondary),
" Q ".fg(theme.foreground),
"quit".fg(theme.secondary),
" ⇧←→ ".fg(theme.foreground),
" ⇧←→/⇧JK ".fg(theme.foreground),
"move".fg(theme.secondary),
" A/E/D ".fg(theme.foreground),
"separator".fg(theme.secondary),
@ -2305,7 +2307,7 @@ impl<C: MixerClient> Widget for &LiveTui<C> {
"config".fg(theme.secondary),
" Q ".fg(theme.foreground),
"quit".fg(theme.secondary),
" ⇧↑↓ ".fg(theme.foreground),
" ⇧↑↓/⇧JK ".fg(theme.foreground),
"move".fg(theme.secondary),
" A/E/D ".fg(theme.foreground),
"separator".fg(theme.secondary),
@ -2935,8 +2937,10 @@ impl<C: MixerClient> LiveTui<C> {
fn render_help(&self, area: Rect, buf: &mut Buffer) {
let theme = self.theme.palette();
let (selection, volume, movement) = match self.snapshot.configuration.mixer_orientation {
MixerOrientation::Horizontal => ("Left/Right", "Up/Down", "Shift+Left/Right"),
MixerOrientation::Vertical => ("Up/Down", "Left/Right", "Shift+Up/Down"),
MixerOrientation::Horizontal => {
("Left/Right", "Up/Down", "Shift+Left/Right or Shift+J/K")
}
MixerOrientation::Vertical => ("Up/Down", "Left/Right", "Shift+Up/Down or Shift+J/K"),
};
let popup = centered_rect(area, 78, 22);
Clear.render(popup, buf);
@ -3829,6 +3833,28 @@ mod tests {
ConfigurationEdit::MoveLayoutEntry { id, position: 1 }
if id == "music-fader"
)));
assert_eq!(
app.mixer_rows()
.iter()
.map(|row| row.id())
.collect::<Vec<_>>(),
["browser-fader", "music-fader"]
);
app.handle_key_event(shift(KeyCode::Char('k')));
assert!(matches!(
edits.lock().unwrap().last(),
Some(ConfigurationEdit::MoveLayoutEntry { id, position: 0 })
if id == "music-fader"
));
assert_eq!(app.selected, 0);
assert_eq!(
app.mixer_rows()
.iter()
.map(|row| row.id())
.collect::<Vec<_>>(),
["music-fader", "browser-fader"]
);
}
#[test]