diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index b597dfb778..c36cdf7fe6 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -278,6 +278,18 @@ unsafe fn build_classes() { pub struct Window(Rc>); +///Used to track what the IME does when we send it a keystroke. +///This is only used to handle the case where the IME mysteriously +///swallows certain keys. +/// +///Basically a direct copy of the approach that WezTerm uses in: +///github.com/wez/wezterm : d5755f3e : window/src/os/macos/window.rs +enum ImeState { + Continue, + Acted, + None, +} + struct WindowState { id: usize, native_window: id, @@ -299,6 +311,10 @@ struct WindowState { layer: id, traffic_light_position: Option, previous_modifiers_changed_event: Option, + //State tracking what the IME did after the last request + ime_state: ImeState, + //Retains the last IME keystroke that was in the 'Acted' state + last_ime_key: Option, } struct InsertText {