aboutsummaryrefslogtreecommitdiff
path: root/src/app/input
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-08 01:00:24 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-08 01:00:24 +0300
commit4e3970ca312303bb20ea61641021b939d3ebe3eb (patch)
tree24ecdb04a066a0bfe56abdf71453d06f30873a08 /src/app/input
parentd6285aaa59e0f7908c2ece81314aff2b98847e31 (diff)
fix: restore workspace picker keyboard navigation
refs #1149
Diffstat (limited to 'src/app/input')
-rw-r--r--src/app/input/navigate.rs52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/app/input/navigate.rs b/src/app/input/navigate.rs
index 6accb22f..426864e6 100644
--- a/src/app/input/navigate.rs
+++ b/src/app/input/navigate.rs
@@ -101,6 +101,27 @@ impl App {
return;
}
+ if self
+ .state
+ .keybinds
+ .navigate
+ .workspace_up
+ .matches_direct_key(raw_key)
+ {
+ self.state.move_selected_workspace_by_visible_delta(-1);
+ return;
+ }
+ if self
+ .state
+ .keybinds
+ .navigate
+ .workspace_down
+ .matches_direct_key(raw_key)
+ {
+ self.state.move_selected_workspace_by_visible_delta(1);
+ return;
+ }
+
if let Some(action) = navigate_reserved_action_for_key(&self.state, raw_key) {
self.execute_tui_navigate_action(action, ActionContext::Navigate);
return;
@@ -2465,6 +2486,37 @@ last_pane = "prefix+tab"
assert_eq!(app.state.mode, Mode::RenamePane);
}
+ #[test]
+ fn app_navigate_mode_workspace_down_moves_selection() {
+ let mut app = app_with_test_workspaces(&["one", "two"]);
+ app.state.mode = Mode::Navigate;
+
+ app.handle_navigate_key(TerminalKey::new(KeyCode::Down, KeyModifiers::empty()));
+
+ assert_eq!(app.state.selected, 1);
+ assert_eq!(app.state.mode, Mode::Navigate);
+ }
+
+ #[test]
+ fn app_navigate_mode_workspace_keys_are_configurable() {
+ let mut app = app_with_test_workspaces(&["one", "two"]);
+ let config: Config = toml::from_str(
+ r#"
+[keys]
+navigate_workspace_down = "j"
+navigate_pane_down = "ctrl+j"
+"#,
+ )
+ .unwrap();
+ app.state.keybinds = config.keybinds();
+ app.state.mode = Mode::Navigate;
+
+ app.handle_navigate_key(TerminalKey::new(KeyCode::Char('j'), KeyModifiers::empty()));
+
+ assert_eq!(app.state.selected, 1);
+ assert_eq!(app.state.mode, Mode::Navigate);
+ }
+
#[tokio::test]
async fn prefix_focus_pane_is_one_shot_and_returns_to_terminal() {
let (_api_tx, api_rx) = tokio::sync::mpsc::unbounded_channel();