aboutsummaryrefslogtreecommitdiff
path: root/src/pane/terminal.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-08-04 05:19:40 +0300
committerGitHub <noreply@github.com>2026-08-04 05:19:40 +0300
commitadb50cba9b15583db019bb655119915869e8c44e (patch)
tree910180a20322a581436b8d8e88b1279f40e1500e /src/pane/terminal.rs
parentcffc6c4b50178d404fbb939346dab7a33e5ed8d4 (diff)
fix(input): preserve shift-tab in pane automation (#2259)
refs #1561
Diffstat (limited to 'src/pane/terminal.rs')
-rw-r--r--src/pane/terminal.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs
index b90c63f1..d4f167a9 100644
--- a/src/pane/terminal.rs
+++ b/src/pane/terminal.rs
@@ -3857,6 +3857,45 @@ mod tests {
}
#[test]
+ fn ghostty_backtab_preserves_shift_across_keyboard_protocols() {
+ for (kitty_flags, expected) in [
+ (None, b"\x1b[Z".as_slice()),
+ (Some(1), b"\x1b[9;2u".as_slice()),
+ ] {
+ let (tx, _rx) = mpsc::channel(4);
+ let mut terminal = crate::ghostty::Terminal::new(80, 24, 0).unwrap();
+ if let Some(flags) = kitty_flags {
+ terminal.write(format!("\x1b[>{flags}u").as_bytes());
+ }
+ let pane = GhosttyPaneTerminal::new(terminal, tx).unwrap();
+ let protocol = pane.keyboard_protocol().unwrap();
+
+ for modifiers in [
+ crossterm::event::KeyModifiers::empty(),
+ crossterm::event::KeyModifiers::SHIFT,
+ ] {
+ let encoded = pane.encode_terminal_key(
+ crate::input::TerminalKey::new(crossterm::event::KeyCode::BackTab, modifiers),
+ protocol,
+ );
+ assert_eq!(encoded, expected, "backtab with modifiers {modifiers:?}");
+ }
+ }
+
+ let (tx, _rx) = mpsc::channel(4);
+ let terminal = crate::ghostty::Terminal::new(80, 24, 0).unwrap();
+ let pane = GhosttyPaneTerminal::new(terminal, tx).unwrap();
+ let encoded = pane.encode_terminal_key(
+ crate::input::TerminalKey::new(
+ crossterm::event::KeyCode::Tab,
+ crossterm::event::KeyModifiers::empty(),
+ ),
+ crate::input::KeyboardProtocol::Legacy,
+ );
+ assert_eq!(encoded, b"\t");
+ }
+
+ #[test]
fn ghostty_enter_backspace_release_in_legacy_pane_emits_nothing() {
let (tx, _rx) = mpsc::channel(4);
let terminal = crate::ghostty::Terminal::new(80, 24, 0).unwrap();