mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
apprt/gtk: any preedit change should note a composing state
Fixes #6772 When typing Korean with the fcitx5-hangful input method, moving between graphemes does not trigger a preedit end/start cycle and instead just clears the preexisting preedit and reuses the started state. Every other input method we've tested up until now doesn't do this. We need to mark composing set to "false" in "commit" because some input methods on the contrary fail to ever call END. What is the point of start/end events if they are just ignored depending on the whim of the input method? Nothing. That's what. Its all a mess that GTK should be protecting us from but it doesn't and now its the app developer's problem. I'm frustrated because I feel like the point of an app framework is to mask this kind of complexity from the app developer and I'm playing whack-a-mole with input methods. Well, here's another whack. Let's see if it works.
This commit is contained in:
@ -1935,6 +1935,14 @@ fn gtkInputPreeditChanged(
|
|||||||
) callconv(.C) void {
|
) callconv(.C) void {
|
||||||
const self = userdataSelf(ud.?);
|
const self = userdataSelf(ud.?);
|
||||||
|
|
||||||
|
// Any preedit change should mark that we're composing. Its possible this
|
||||||
|
// is false using fcitx5-hangul and typing "dkssud<space>" ("안녕"). The
|
||||||
|
// second "s" results in a "commit" for "안" which sets composing to false,
|
||||||
|
// but then immediately sends a preedit change for the next symbol. With
|
||||||
|
// composing set to false we won't commit this text. Therefore, we must
|
||||||
|
// ensure it is set here.
|
||||||
|
self.im_composing = true;
|
||||||
|
|
||||||
// Get our pre-edit string that we'll use to show the user.
|
// Get our pre-edit string that we'll use to show the user.
|
||||||
var buf: [*c]u8 = undefined;
|
var buf: [*c]u8 = undefined;
|
||||||
_ = c.gtk_im_context_get_preedit_string(ctx, &buf, null, null);
|
_ = c.gtk_im_context_get_preedit_string(ctx, &buf, null, null);
|
||||||
|
Reference in New Issue
Block a user