aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPISIT KOOLPLUKPOL <pisit.koolplukpol@outlook.com>2026-08-11 03:02:21 +0700
committerGitHub <noreply@github.com>2026-08-10 23:02:21 +0300
commit4a8a8f9087cc2576ad643858d7483de46268f449 (patch)
tree86e80289e6ced2e81f46eadc873d7a2ccdfe9a45 /src
parent66835dba71ceefeaed3f608f1cc34748284e5023 (diff)
fix(input): ignore modified j/k/up/down in session navigator (#2377)
The Char('j')/Char('k')/Down/Up match arms in handle_navigator_key had no modifier guard, unlike every sibling arm in the same match block, so Ctrl+K, Alt+J, etc. also moved the navigator selection. refs #1981 Co-authored-by: Can Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/app/input/modal.rs28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/app/input/modal.rs b/src/app/input/modal.rs
index 7a9ffe46..343fa99c 100644
--- a/src/app/input/modal.rs
+++ b/src/app/input/modal.rs
@@ -241,10 +241,10 @@ pub(crate) fn handle_navigator_key(
state.navigator.state_filter = Some(NavigatorStateFilter::Done);
state.select_first_navigator_match_from(terminal_runtimes);
}
- KeyCode::Char('j') | KeyCode::Down => {
+ KeyCode::Char('j') | KeyCode::Down if key.modifiers.is_empty() => {
state.move_navigator_selection_from(terminal_runtimes, 1)
}
- KeyCode::Char('k') | KeyCode::Up => {
+ KeyCode::Char('k') | KeyCode::Up if key.modifiers.is_empty() => {
state.move_navigator_selection_from(terminal_runtimes, -1)
}
KeyCode::Char('d') if key.modifiers == KeyModifiers::CONTROL => state
@@ -2003,6 +2003,30 @@ mod tests {
}
#[test]
+ fn navigator_ignores_modified_j_and_k() {
+ let mut state = state_with_workspaces(&["alpha", "beta"]);
+ let terminal_runtimes = crate::terminal::TerminalRuntimeRegistry::new();
+ state.mode = Mode::Navigator;
+ state.navigator.selected = 1;
+
+ handle_navigator_key(
+ &mut state,
+ &terminal_runtimes,
+ KeyEvent::new(KeyCode::Char('k'), KeyModifiers::CONTROL),
+ );
+
+ assert_eq!(state.navigator.selected, 1);
+
+ handle_navigator_key(
+ &mut state,
+ &terminal_runtimes,
+ KeyEvent::new(KeyCode::Char('j'), KeyModifiers::CONTROL),
+ );
+
+ assert_eq!(state.navigator.selected, 1);
+ }
+
+ #[test]
fn open_rename_active_tab_can_prefill_default_new_tab_name() {
let mut state = state_with_workspaces(&["test"]);
state.workspaces[0].test_add_tab(None);