aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-26 14:43:48 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-26 14:43:48 +0300
commit19cd372f2544f56af9be1f24a67cb229e82bb63d (patch)
treebdf8150a8347518b53a39c96b0e294162b235f72 /src/app
parentcb2e17a4a56be1434a42532d37c99fe8d7b60407 (diff)
fix: preserve prefix mode for modifier events
refs #1870
Diffstat (limited to 'src/app')
-rw-r--r--src/app/input/navigate.rs30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/app/input/navigate.rs b/src/app/input/navigate.rs
index 6b578091..4cb2a4e1 100644
--- a/src/app/input/navigate.rs
+++ b/src/app/input/navigate.rs
@@ -61,6 +61,10 @@ impl App {
let key = raw_key.as_key_event();
self.state.update_dismissed = true;
+ if matches!(key.code, KeyCode::Modifier(_)) {
+ return;
+ }
+
if self.state.is_prefix_key(raw_key) {
if self.state.copy_mode_pane_is_focused() {
self.state.cancel_copy_mode(&self.terminal_runtimes);
@@ -1867,7 +1871,7 @@ mod tests {
#[cfg(unix)]
use std::time::Duration;
- use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
+ use crossterm::event::{KeyCode, KeyEvent, KeyModifiers, ModifierKeyCode};
use ratatui::layout::Direction;
#[cfg(unix)]
@@ -2622,6 +2626,30 @@ last_pane = "prefix+tab"
}
#[test]
+ fn prefix_shift_indexed_workspace_shortcut_survives_modifier_press() {
+ let mut app = app_with_test_workspaces(&["one", "two"]);
+ let config: Config =
+ toml::from_str("[keys]\nswitch_workspace = \"prefix+shift+1..9\"\n").unwrap();
+ app.state.keybinds.switch_workspace = config.keybinds().switch_workspace;
+ app.state.mode = Mode::Prefix;
+
+ app.handle_prefix_key(TerminalKey::new(
+ KeyCode::Modifier(ModifierKeyCode::LeftShift),
+ KeyModifiers::SHIFT,
+ ));
+
+ assert_eq!(app.state.mode, Mode::Prefix);
+
+ app.handle_prefix_key(
+ TerminalKey::new(KeyCode::Char('2'), KeyModifiers::SHIFT)
+ .with_shifted_codepoint('"' as u32),
+ );
+
+ assert_eq!(app.state.active, Some(1));
+ assert_eq!(app.state.mode, Mode::Terminal);
+ }
+
+ #[test]
fn prefix_unshifted_indexed_shortcut_maps_shifted_french_number_row() {
let mut state = state_with_workspaces(&["one"]);
let config: Config = toml::from_str("[keys]\nswitch_tab = \"prefix+1..9\"\n").unwrap();