Skip to content

armgit / herdr

Public Imported from GitHub
0

the runtime your coding agents live on

fix(input): ignore modified j/k/up/down in session navigator (#2377)

PISIT KOOLPLUKPOL4a8a8f9087cc
diff --git a/src/app/input/modal.rs b/src/app/input/modal.rs
index 7a9ffe464..343fa99c9 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
@@ -2002,6 +2002,30 @@ mod tests {
assert_eq!(state.mode, Mode::Terminal);
}
+ #[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"]);