From 8a32c5c5c1c1fb5bef33c2e194b3967740a8052f 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 | 7 +++++++ ime.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1376197b..339a9835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,12 +25,19 @@ ## 1.6.4 ### Added ### Changed + +* The IME state no longer stays stuck in the terminal if the IME goes + away during preedit. + + ### Deprecated ### Removed ### Fixed ### Security ### Contributors +* [tdeo](https://codeberg.org/tdeo) + ## 1.6.3 diff --git a/ime.c b/ime.c index d420fc9f..d851c26f 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); }