Skip to content

[Super Editor][IME][Bug] - Fix: Tag deletion error when using Microsoft SwiftKey keyboard (Resolves #2975)#2976

Merged
matthew-carroll merged 1 commit into
mainfrom
2975_fix-tag-delete-for-microsoft-swiftkey-keyboard
Mar 10, 2026
Merged

[Super Editor][IME][Bug] - Fix: Tag deletion error when using Microsoft SwiftKey keyboard (Resolves #2975)#2976
matthew-carroll merged 1 commit into
mainfrom
2975_fix-tag-delete-for-microsoft-swiftkey-keyboard

Conversation

@matthew-carroll

Copy link
Copy Markdown
Contributor

[Super Editor][IME][Bug] - Fix: Tag deletion error when using Microsoft SwiftKey keyboard (Resolves #2975)

The behavior coming from the keyboard that caused us a problem was that when deleting a character in a tag, the SwiftKey keyboard would report the deletion along with a composing region that included the upstream word. The tag reaction would then delete the whole tag, making the composing region invalid. We would then send an update back to the IME with the entire tag deleted, and a composing region that exceeded the length of the text, which resulted in an IME error.

The root cause was two related things:

  1. We weren't ending the editor transaction before setting the composing region. In theory, it makes sense to change the composing region in the same transaction, but reactions only run after a transaction, which means the tag removal was running AFTER we updated the composing region.
  2. We weren't re-serializing the document after applying the deltas, but before checking the composing region. Because of this, when we checked the composing region's offsets, we were comparing to the text before the deletion, at which point the composing region was valid. Instead, we need to re-serialize the document, which includes the removal of the tag, and THEN check the composing region offsets. By doing that, we see that the composing region is invalid, and we null it out.

This nuanced composing region management seems like a mess. It would be nice if there were a more holistic way to deal with it, but I'm not sure what it is. There are cases where we definitely want to keep the composing region, e.g., when composing a compound character. So we can't just throw it out all the time.

@matthew-carroll matthew-carroll merged commit c242e2a into main Mar 10, 2026
23 checks passed
@matthew-carroll matthew-carroll deleted the 2975_fix-tag-delete-for-microsoft-swiftkey-keyboard branch March 10, 2026 23:59
github-actions Bot pushed a commit that referenced this pull request Mar 11, 2026
matthew-carroll added a commit that referenced this pull request Mar 11, 2026
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.

[Super Editor][IME][Bug] - Microsoft keyboard reports deletion that breaks input (similar to Samsung)

1 participant