Skip to content

fix(ime): only send set_surrounding_text to host when dirty - #32

Open
kkimdev wants to merge 1 commit into
google:virtwlfrom
kkimdev:wayland-ime-core-2-4-surrounding-dirty
Open

fix(ime): only send set_surrounding_text to host when dirty#32
kkimdev wants to merge 1 commit into
google:virtwlfrom
kkimdev:wayland-ime-core-2-4-surrounding-dirty

Conversation

@kkimdev

@kkimdev kkimdev commented Jul 10, 2026

Copy link
Copy Markdown

Split from #30 for easier review.

on_commit used state.surrounding_text.take() to consume the value, so if
on_commit was called twice without an intervening on_set_surrounding_text
(e.g. content_type and cursor_rect updates), the second commit would send
stale or empty surrounding text.

Fix

Replace .take() with a dedicated surrounding_text_dirty flag. The flag is
set when on_set_surrounding_text is received and cleared after forwarding
once.

Changes

  • New: TextInputState.surrounding_text_dirty: bool
  • on_set_surrounding_text: set dirty flag instead of relying on .take()
  • on_commit: check dirty flag, clear after send
  • 1 test verifying dirty/re-send semantics

@kkimdev
kkimdev marked this pull request as ready for review July 10, 2026 14:52
@InternetOfTofu
InternetOfTofu self-requested a review July 10, 2026 21:26
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.

2 participants