Skip to content

Settle composition state on focus change, reset, disable - #611

Open
EzeriumChristinal wants to merge 1 commit into
BambooEngine:masterfrom
EzeriumChristinal:audit/focus-lifecycle
Open

EzeriumChristinal wants to merge 1 commit into
BambooEngine:masterfrom
EzeriumChristinal:audit/focus-lifecycle

Conversation

@EzeriumChristinal

Copy link
Copy Markdown

Typing a half-finished word and switching windows committed the pending preedit into the new window: FocusOut did nothing, so the next FocusIn flushed the stale buffer wherever focus happened to be.

FocusOut now settles the buffer first — pending preedit goes to the window losing focus, and emoji/hex/input-mode popups close. Reset clears the buffer in backspace modes instead of only Preedit. Disable drops pending state so nothing leaks into the next Enable.

FocusIn and Enable set the one-shot surrounding-text gate before asking IBus; before, the gate stayed shut except after cursor moves, so the request did nothing. SetSurroundingText ignores an active selection, and the payload decode accepts the shapes godbus can deliver instead of indexing the variant blindly (which panicked on anything else). Home counts as a movement key, like End.

Tests: buffer Reset/FocusOut/Home tests, FocusOut-commits-to-loser, surrounding decode and rebuild (engine_regression_test.go). go vet clean, go test and go test -race pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant