Merge pull request #1131 from mitchellh/chinese-quotes

apprt/gtk: only reset IME state if key consuming while IME composing
This commit is contained in:
Mitchell Hashimoto
2023-12-19 22:10:13 -08:00
committed by GitHub

View File

@ -1482,10 +1482,15 @@ fn keyEvent(
.closed => return true, .closed => return true,
.ignored => {}, .ignored => {},
.consumed => if (action == .press or action == .repeat) { .consumed => if (action == .press or action == .repeat) {
// If we consume the key then we want to reset the dead key // If we were in the composing state then we reset our context.
// state. // We do NOT want to reset if we're not in the composing state
c.gtk_im_context_reset(self.im_context); // because there is other IME state that we want to preserve,
self.core_surface.preeditCallback(null) catch {}; // such as quotation mark ordering for Chinese input.
if (self.im_composing) {
c.gtk_im_context_reset(self.im_context);
self.core_surface.preeditCallback(null) catch {};
}
return true; return true;
}, },
} }