aboutsummaryrefslogtreecommitdiff
path: root/src/app/input/navigate.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-24 02:57:03 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-24 02:59:39 +0300
commit80a314a9089b28c1bfdc2cdf5196e9a2eb9f11ba (patch)
treefca593cafa027f4283adcec80c2f8908ef79708e /src/app/input/navigate.rs
parenta132a7c3b9ade3ad4636e03b1f0930b5fa711766 (diff)
feat: add session navigator
refs #157
Diffstat (limited to 'src/app/input/navigate.rs')
-rw-r--r--src/app/input/navigate.rs27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/app/input/navigate.rs b/src/app/input/navigate.rs
index da3d49bf..4e8a50b3 100644
--- a/src/app/input/navigate.rs
+++ b/src/app/input/navigate.rs
@@ -490,6 +490,7 @@ pub(crate) enum NavigateAction {
ReloadConfig,
OpenNotificationTarget,
Detach,
+ OpenNavigator,
}
fn indexed_navigation_action(
@@ -588,6 +589,7 @@ fn action_for_key(
NavigateAction::OpenNotificationTarget,
),
(&kb.detach, NavigateAction::Detach),
+ (&kb.goto, NavigateAction::OpenNavigator),
] {
if action_matches(bindings, key, dispatch) {
return Some(action);
@@ -780,6 +782,7 @@ pub(super) fn execute_navigate_action_in_context(
super::modal::request_detach(state);
leave_navigate_mode(state);
}
+ NavigateAction::OpenNavigator => state.open_navigator(),
}
finish_action_context(state, context, previous_mode);
@@ -930,6 +933,18 @@ mod tests {
}
#[test]
+ fn default_goto_key_opens_navigator() {
+ let mut state = state_with_workspaces(&["test"]);
+
+ handle_navigate_key(
+ &mut state,
+ KeyEvent::new(KeyCode::Char('g'), KeyModifiers::empty()),
+ );
+
+ assert_eq!(state.mode, Mode::Navigator);
+ }
+
+ #[test]
fn custom_rename_key_enters_rename_mode() {
let mut state = state_with_workspaces(&["test"]);
state.keybinds.rename_workspace = crate::config::ActionKeybinds::prefix("g");
@@ -1502,8 +1517,8 @@ mod tests {
output_path.display()
);
app.state.keybinds.custom_commands = vec![crate::config::CustomCommandKeybind {
- bindings: crate::config::ActionKeybinds::prefix("g"),
- label: "prefix+g".into(),
+ bindings: crate::config::ActionKeybinds::prefix("m"),
+ label: "prefix+m".into(),
command,
action: crate::config::CustomCommandAction::Shell,
}];
@@ -1515,7 +1530,7 @@ mod tests {
.await;
assert_eq!(app.state.mode, Mode::Prefix);
- app.handle_key(TerminalKey::new(KeyCode::Char('g'), KeyModifiers::empty()))
+ app.handle_key(TerminalKey::new(KeyCode::Char('m'), KeyModifiers::empty()))
.await;
let content = wait_for_file(&output_path);
@@ -1561,8 +1576,8 @@ mod tests {
let output_path = unique_temp_path("custom-pane-command");
let command = format!("printf done > '{}'", output_path.display());
app.state.keybinds.custom_commands = vec![crate::config::CustomCommandKeybind {
- bindings: crate::config::ActionKeybinds::prefix("g"),
- label: "prefix+g".into(),
+ bindings: crate::config::ActionKeybinds::prefix("m"),
+ label: "prefix+m".into(),
command,
action: crate::config::CustomCommandAction::Pane,
}];
@@ -1572,7 +1587,7 @@ mod tests {
app.state.prefix_mods,
))
.await;
- app.handle_key(TerminalKey::new(KeyCode::Char('g'), KeyModifiers::empty()))
+ app.handle_key(TerminalKey::new(KeyCode::Char('m'), KeyModifiers::empty()))
.await;
assert_eq!(app.state.workspaces[0].tabs[0].layout.pane_count(), 2);