Skip to content

Commit

Permalink
apprt/gtk: when text is committed, end the preedit state
Browse files Browse the repository at this point in the history
Fixes #3567

ibus 1.5.29 doesn't trigger a preedit end state when text is committed.
This is fixed in ibus 1.5.30, but we need to handle this case for older
versions which are shipped on LTS distributions such as Ubuntu.

Every other input method engine I've tried thus far also triggers a
preedit end state when text is committed, and none would expect preedit
to continue after text is committed. So I think it's safe to assume that
this is the expected behavior.
  • Loading branch information
mitchellh committed Jan 23, 2025
1 parent eb21a58 commit d1e45ef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/apprt/gtk/Surface.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1961,6 +1961,12 @@ fn gtkInputCommit(
// Committing ends composing state
self.im_composing = false;

// End our preedit state. Well-behaved input methods do this for us
// by triggering a preedit-end event but some do not (ibus 1.5.29).
self.core_surface.preeditCallback(null) catch |err| {
log.err("error in preedit callback err={}", .{err});
};

// Send the text to the core surface, associated with no key (an
// invalid key, which should produce no PTY encoding).
_ = self.core_surface.keyCallback(.{
Expand Down

0 comments on commit d1e45ef

Please sign in to comment.