From 18dc12218fb7157aa7a4175416000cd509639483 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Tue, 16 Aug 2022 13:01:35 -0700 Subject: [PATCH] Begin work on IME changes --- crates/gpui/src/platform/mac/window.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 {