Harden input editor: grapheme-safe selection, cursor boundaries, and paste#70
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 339dd869b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| while (position > 0) { | ||
| const start = prevBoundary(value, position); | ||
| const cls = classifyCluster(value.slice(start, position)); |
There was a problem hiding this comment.
Make Ctrl+Left word movement linear-time
prevWordBoundary repeatedly calls prevBoundary inside loops, but prevBoundary scans from offset 0 to position each time, so a single Ctrl+Left (and Shift+Ctrl+Left) over long word runs becomes quadratic in input length. On large pasted inputs this can cause noticeable key-handling lag because each word-step recomputes earlier boundaries from scratch instead of reusing a single pass.
Useful? React with 👍 / 👎.
Summary
applyInputEditEventfor grapheme-safe cursoring and editing, including word-wise movement (Ctrl+Left/Right) and stricter boundary normalization.Shift+Left/Right/Home/EndShift+Ctrl+Left/RightCtrl+AWidgetRendererso focused input instances persist normalized selection alongside cursor state.Tests
npm run buildnpm run typechecknpm run lintnode scripts/run-tests.mjsAll commands pass locally.