Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain selection and composition during updateText() #115

Draft
wants to merge 3 commits into
base: gh-pages
Choose a base branch
from

Conversation

dandclark
Copy link
Contributor

Make the following changes to keep the selection and composition in a consistent state after updateText()/updateSelection() calls.

  • For each selection bondary point, updateText() sets the boundary point to boundaryPoint + text.length - (rangeEnd - rangeStart) when boundaryPoint >= rangeEnd, or to rangeStart + text.length when boundaryPoint > rangeStart && boundaryPoint< rangeEnd.
  • When a composition is active during an updateText() call,
    • If the updated range does not overlap with the composed range, move the composition position in the same way as for selection.
    • If it does overlap, abort the composition.
  • When a composition is active when updateSelection() is called with a selection that differs from the current selection, abort the composition.

Resolves #111.

For normative changes, the following tasks have been completed:

@marijnh
Copy link

marijnh commented Mar 13, 2025

Thanks. These changes would solve the issues I've been running into.

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.

The interaction between composition and updateText/updateSelection should be more clearly defined
2 participants