aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-08-06 01:42:48 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-08-06 01:42:48 +0300
commitea047db8e47defc80aee2d1972cdccc3b61ad4e1 (patch)
treee5df9fa93dc7f38bc12b2ce71acc419480759f9a /src
parent8b7cd9f067d93a19fb9baa0dcc61aead01be67c9 (diff)
fix: avoid ctrl-tab escape sequences in legacy panes
refs #2296
Diffstat (limited to 'src')
-rw-r--r--src/pane/terminal.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs
index 4bd50669..58de71ce 100644
--- a/src/pane/terminal.rs
+++ b/src/pane/terminal.rs
@@ -1711,6 +1711,13 @@ impl GhosttyPaneTerminal {
key: crate::input::TerminalKey,
protocol: crate::input::KeyboardProtocol,
) -> Vec<u8> {
+ if matches!(protocol, crate::input::KeyboardProtocol::Legacy)
+ && key.code == crossterm::event::KeyCode::Tab
+ && key.modifiers == crossterm::event::KeyModifiers::CONTROL
+ {
+ return crate::input::encode_terminal_key(key, protocol);
+ }
+
if ghostty_prefers_herdr_text_encoding(&key) {
return crate::input::encode_terminal_key(key, protocol);
}
@@ -3910,6 +3917,30 @@ mod tests {
}
#[test]
+ fn ghostty_ctrl_tab_matches_the_pane_keyboard_protocol() {
+ let (tx, _rx) = mpsc::channel(4);
+ let terminal = crate::ghostty::Terminal::new(80, 24, 0).unwrap();
+ let legacy = GhosttyPaneTerminal::new(terminal, tx.clone()).unwrap();
+ let key = crate::input::TerminalKey::new(
+ crossterm::event::KeyCode::Tab,
+ crossterm::event::KeyModifiers::CONTROL,
+ );
+
+ assert_eq!(
+ legacy.encode_terminal_key(key.clone(), crate::input::KeyboardProtocol::Legacy),
+ b"\t"
+ );
+
+ let mut terminal = crate::ghostty::Terminal::new(80, 24, 0).unwrap();
+ terminal.write(b"\x1b[>3u");
+ let kitty = GhosttyPaneTerminal::new(terminal, tx).unwrap();
+ assert_eq!(
+ kitty.encode_terminal_key(key, crate::input::KeyboardProtocol::Kitty { flags: 3 }),
+ b"\x1b[9;5u"
+ );
+ }
+
+ #[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();