diff options
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/input/modal.rs | 28 |
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); |
