From 868455f9782a50c2ed05c7a25a52f41bfc8f9f4d Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Mon, 15 Jul 2024 12:07:19 -0600 Subject: [PATCH] linux: Fix IME on fcitx5 (#14508) Release Notes: - linux: Fix IME under fcitx5 (#14192) --- crates/gpui/src/platform/linux/x11/client.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/gpui/src/platform/linux/x11/client.rs b/crates/gpui/src/platform/linux/x11/client.rs index 5ca731a154e3d67908aa387f72b5a16a7382af47..dfa7d1b150f8f7e7243fb19f12a00441b727c5c3 100644 --- a/crates/gpui/src/platform/linux/x11/client.rs +++ b/crates/gpui/src/platform/linux/x11/client.rs @@ -990,18 +990,16 @@ impl X11Client { fn xim_handle_commit(&self, window: xproto::Window, text: String) -> Option<()> { let window = self.get_window(window).unwrap(); let mut state = self.0.borrow_mut(); - if !state.composing { - if let Some(keystroke) = state.pre_ime_key_down.take() { - drop(state); - window.handle_input(PlatformInput::KeyDown(crate::KeyDownEvent { - keystroke, - is_held: false, - })); - return Some(()); - } - } + let keystroke = state.pre_ime_key_down.take(); state.composing = false; drop(state); + if let Some(mut keystroke) = keystroke { + keystroke.ime_key = Some(text.clone()); + window.handle_input(PlatformInput::KeyDown(crate::KeyDownEvent { + keystroke, + is_held: false, + })); + } window.handle_ime_commit(text); Some(())