Enhance cursor-ime example with cursor movement and editing#876
Open
subinium wants to merge 3 commits intovadimdemedes:masterfrom
Open
Enhance cursor-ime example with cursor movement and editing#876subinium wants to merge 3 commits intovadimdemedes:masterfrom
subinium wants to merge 3 commits intovadimdemedes:masterfrom
Conversation
The previous example was append-only with no cursor movement. Replace it with a comprehensive TextInput demonstrating middle insertion, arrow-key navigation, backspace at cursor position, and submit with history. Add a readme explaining why CJK input needs useCursor + stringWidth (Hangul composition, fullwidth columns, fake-cursor issue). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove readme.md (no other example has one) - Trim JSDoc block to a minimal 2-line comment - Guard upArrow/downArrow from inserting text Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
// @juniqlim |
Replace `before.slice(0, -1)` (UTF-16) with `splitAt` + `charCount` to correctly handle surrogate pairs (emoji) in backspace, consistent with the rest of the codepoint-aware logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
Found a few things:
|
Contributor
|
@subinium I built something similar and both issues are already solved there, for reference:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrade the
cursor-imeexample from an append-only demo into a minimal TextInput with cursor movement, middle insertion, backspace, and submit.Changes
stringWidthfor correct CJK column offsetcharCountvia[...str].lengthfor correct codepoint counting