diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-19 14:24:30 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-19 14:24:30 +0300 |
| commit | d616bcd6b86742762fec5f0696a5c13701fe717c (patch) | |
| tree | 44e20df741c3c587168a351e422a67ede524ca2d /src/pane | |
| parent | 6cbdba434fd15fc3818302a5843593da47db2eb4 (diff) | |
fix: preserve modified enter input
refs #168
Diffstat (limited to 'src/pane')
| -rw-r--r-- | src/pane/terminal.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs index fcbedeff..f25c70ef 100644 --- a/src/pane/terminal.rs +++ b/src/pane/terminal.rs @@ -1503,6 +1503,38 @@ mod tests { } #[test] + fn ghostty_kitty_pane_encodes_shift_enter_as_csi_u() { + let (tx, _rx) = mpsc::channel(4); + let terminal = crate::ghostty::Terminal::new(80, 24, 0).unwrap(); + let pane = GhosttyPaneTerminal::new(terminal, tx.clone()).unwrap(); + let pane_id = PaneId::from_raw(1); + pane.process_pty_bytes(pane_id, 0, b"\x1b[>5u", &tx); + + let key = crate::input::parse_terminal_key_sequence("\x1b[13;2u").unwrap(); + let encoded = pane.encode_terminal_key(key, crate::input::KeyboardProtocol::Legacy); + + assert_eq!( + pane.keyboard_protocol(), + Some(crate::input::KeyboardProtocol::Kitty { flags: 5 }) + ); + assert_eq!(encoded, b"\x1b[13;2u"); + } + + #[test] + fn ghostty_modify_other_keys_mode_one_preserves_shift_enter() { + let (tx, _rx) = mpsc::channel(4); + let terminal = crate::ghostty::Terminal::new(80, 24, 0).unwrap(); + let pane = GhosttyPaneTerminal::new(terminal, tx.clone()).unwrap(); + let pane_id = PaneId::from_raw(1); + pane.process_pty_bytes(pane_id, 0, b"\x1b[>4;1m", &tx); + + let key = crate::input::parse_terminal_key_sequence("\x1b[13;2u").unwrap(); + let encoded = pane.encode_terminal_key(key, crate::input::KeyboardProtocol::Legacy); + + assert_eq!(encoded, b"\x1b[27;2;13~"); + } + + #[test] fn ghostty_kitty_pane_encodes_parsed_legacy_alt_backspace_as_csi_u() { let (tx, _rx) = mpsc::channel(4); let terminal = crate::ghostty::Terminal::new(80, 24, 0).unwrap(); |
