From 0bd445020ea19e0cea13f42a28212db7b2df196d Mon Sep 17 00:00:00 2001 From: Can Celik Date: Tue, 18 Aug 2026 19:30:57 +0300 Subject: fix: preserve macOS IME commits in report-all mode (#2947) --- src/terminal_modes.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/terminal_modes.rs') 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( 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] -- cgit v1.2.3