Skip to content

Make movement and deletion grapheme-aware#44

Merged
sayanarijit merged 1 commit into
sayanarijit:mainfrom
cammeresi:20260414-grapheme
Apr 16, 2026
Merged

Make movement and deletion grapheme-aware#44
sayanarijit merged 1 commit into
sayanarijit:mainfrom
cammeresi:20260414-grapheme

Conversation

@cammeresi
Copy link
Copy Markdown
Contributor

GoToPrevChar, GoToNextChar, DeletePrevChar, and DeleteNextChar now step one grapheme at a time instead of one codepoint. This fixes backspace and arrow key behavior for combining marks, emoji with skin tone, ZWJ sequences, and national flags, where a single user-perceived character (grapheme) spans multiple codepoints.

cursor() still returns a codepoint count to preserve the public API, so a single backspace that deletes a multi-codepoint grapheme may decrease cursor position by more than one. Similarly, a single cursor movement command may move the cursor by more than one codepoint.

`GoToPrevChar`, `GoToNextChar`, `DeletePrevChar`, and `DeleteNextChar`
now step one grapheme at a time instead of one codepoint.  This fixes
backspace and arrow key behavior for combining marks, emoji with skin
tone, ZWJ sequences, and national flags, where a single user-perceived
character (grapheme) spans multiple codepoints.

`cursor()` still returns a codepoint count to preserve the public API,
so a single backspace that deletes a multi-codepoint grapheme may
decrease cursor position by more than one.  Similarly, a single cursor
movement command may move the cursor by more than one codepoint.
@sayanarijit
Copy link
Copy Markdown
Owner

Thank you...

@sayanarijit sayanarijit merged commit bf99413 into sayanarijit:main Apr 16, 2026
1 check passed
@cammeresi cammeresi deleted the 20260414-grapheme branch April 17, 2026 04:54
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