aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/input.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2022-08-29 16:29:13 +0300
committerGitHub <noreply@github.com>2022-08-29 16:29:13 +0300
commit18f9c2793924aec91c80a69ccb45f529adaffae5 (patch)
tree63cda75c8203c39a7437bd1812653f74494f878f /alacritty/src/input.rs
parent791f79a02a4bbb509c257af2849e411d32f4c18b (diff)
downloadr-alacritty-18f9c2793924aec91c80a69ccb45f529adaffae5.tar.gz
r-alacritty-18f9c2793924aec91c80a69ccb45f529adaffae5.tar.bz2
r-alacritty-18f9c2793924aec91c80a69ccb45f529adaffae5.zip
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.
Diffstat (limited to 'alacritty/src/input.rs')
-rw-r--r--alacritty/src/input.rs10
1 files changed, 10 insertions, 0 deletions
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<T: EventListener, A: ActionContext<T>> Processor<T, A> {
/// 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<T: EventListener, A: ActionContext<T>> Processor<T, A> {
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);