From 6f471ca6b1f83a7b9e0f653e1f73fa428596cb00 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Sat, 31 Oct 2026 16:27:47 +0100 Subject: [PATCH] fix(text-input): a disable ends the composition like a leave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The window's record of the composing text it was last told (TextStrings().shown) was cleared only by the compositor's leave. An app that disables and enables the text input to reset the input method — after it committed the composing word itself — then never heard of a later composition equal to that word: the done handler reports a preedit only when it differs from the record. The disable path clears the record and the pending flags now, as the leave does, so the first composition after an enable is reported whatever it is. --- implementations/Crafter.Graphics-Device.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/implementations/Crafter.Graphics-Device.cpp b/implementations/Crafter.Graphics-Device.cpp index 0142585..9abc596 100644 --- a/implementations/Crafter.Graphics-Device.cpp +++ b/implementations/Crafter.Graphics-Device.cpp @@ -455,6 +455,12 @@ void Device::ApplyTextInput(Window* window) { if (!window->textInputEnabled_) return; window->textInputEnabled_ = false; zwp_text_input_v3_disable(textInput); + // The disable ends the composition as a leave does: the next enable + // starts afresh, so the record of what the window was last told goes + // with it (a composition equal to it after the enable is new). + textInputHasPreedit = textInputHasCommit = textInputHasDelete = false; + TextStrings().preedit.clear(); + TextStrings().shown.clear(); } zwp_text_input_v3_commit(textInput); wl_display_flush(display);