From 18f9c2793924aec91c80a69ccb45f529adaffae5 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Mon, 29 Aug 2022 16:29:13 +0300 Subject: Add inline input method support This commit adds support for inline IME handling. It also makes the search bar use underline cursor instead of using '_' character. Fixes #1613. --- alacritty/src/input.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'alacritty/src/input.rs') diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index 35aaedda..a612db12 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -754,6 +754,11 @@ impl> Processor { /// Process key input. pub fn key_input(&mut self, input: KeyboardInput) { + // IME input will be applied on commit and shouldn't trigger key bindings. + if self.ctx.display().ime.preedit().is_some() { + return; + } + // All key bindings are disabled while a hint is being selected. if self.ctx.display().hint_state.active() { *self.ctx.suppress_chars() = false; @@ -801,6 +806,11 @@ impl> Processor { pub fn received_char(&mut self, c: char) { let suppress_chars = *self.ctx.suppress_chars(); + // Don't insert chars when we have IME running. + if self.ctx.display().ime.preedit().is_some() { + return; + } + // Handle hint selection over anything else. if self.ctx.display().hint_state.active() && !suppress_chars { self.ctx.hint_input(c); -- cgit