diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-08-18 19:30:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-18 19:30:57 +0300 |
| commit | 0bd445020ea19e0cea13f42a28212db7b2df196d (patch) | |
| tree | cd3bc5940e4cfff1cf7977aa3eab3c99d3cad6f7 /src/terminal_modes.rs | |
| parent | 2d24950ad9a02096921bc764e2e3dcd8900c3366 (diff) | |
fix: preserve macOS IME commits in report-all mode (#2947)
Diffstat (limited to 'src/terminal_modes.rs')
| -rw-r--r-- | src/terminal_modes.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/terminal_modes.rs b/src/terminal_modes.rs index 90ec512b..5b6a5d3b 100644 --- a/src/terminal_modes.rs +++ b/src/terminal_modes.rs @@ -25,6 +25,11 @@ pub(crate) fn set_host_kitty_keyboard_report_all<W: Write>( let mut flags = crate::input::ime_compatible_keyboard_enhancement_flags(); if report_all_keys { flags |= crossterm::event::KeyboardEnhancementFlags::REPORT_ALL_KEYS_AS_ESCAPE_CODES; + // Report-all turns IME commits into CSI-u key events in terminals such + // as Ghostty. Ask the terminal to carry the committed text with them. + flags = crossterm::event::KeyboardEnhancementFlags::from_bits_retain( + flags.bits() | 0b0001_0000, + ); } // Older iTerm2 releases clear the keyboard stack on SET, so a later pop // cannot restore the host state. Replace only Herdr's top entry instead. @@ -54,7 +59,7 @@ mod tests { set_host_kitty_keyboard_report_all(&mut output, true).unwrap(); set_host_kitty_keyboard_report_all(&mut output, false).unwrap(); - assert_eq!(output, b"\x1b[<1u\x1b[>15u\x1b[<1u\x1b[>7u"); + assert_eq!(output, b"\x1b[<1u\x1b[>31u\x1b[<1u\x1b[>7u"); } #[test] |
