From 1515b7e44bde7c045eae12105d8fe6a168fb3152 Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Fri, 29 Jan 2021 12:57:03 -0700 Subject: [PATCH] ime: Reset terminal's IME state on text_input.leave To reproduce issue: - Launch an IME from inside foot - Type in some preedit text - Use Ctrl-C to close the IME - IME text stays in terminal until focus is changed --- CHANGELOG.md | 3 +++ ime.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e446bf5..f15380c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,8 @@ before sending the new dimensions to the client application. The timing can be tweaked, or completely disabled, by setting `resize-delay-ms` (https://codeberg.org/dnkl/foot/issues/301). +* The IME state no longer stays stuck in the terminal if the IME goes + away during preedit. ### Deprecated @@ -75,6 +77,7 @@ ### Contributors * [craigbarnes](https://codeberg.org/craigbarnes) +* [tdeo](https://codeberg.org/tdeo) ## 1.6.3 diff --git a/ime.c b/ime.c index 928a9769..63e8cb9f 100644 --- a/ime.c +++ b/ime.c @@ -39,6 +39,11 @@ leave(void *data, struct zwp_text_input_v3 *zwp_text_input_v3, { struct seat *seat = data; LOG_DBG("leave: seat=%s", seat->name); + + struct terminal *term = seat->kbd_focus; + if (term != NULL) + term_ime_reset(term); + ime_disable(seat); }