Skip to content

Harden input editor: grapheme-safe selection, cursor boundaries, and paste#70

Merged
RtlZeroMemory merged 3 commits into
mainfrom
input-editor-hardening
Feb 18, 2026
Merged

Harden input editor: grapheme-safe selection, cursor boundaries, and paste#70
RtlZeroMemory merged 3 commits into
mainfrom
input-editor-hardening

Conversation

@RtlZeroMemory

Copy link
Copy Markdown
Owner

Summary

  • Hardened applyInputEditEvent for grapheme-safe cursoring and editing, including word-wise movement (Ctrl+Left/Right) and stricter boundary normalization.
  • Added single-line text selection support for input editing:
    • Shift+Left/Right/Home/End
    • Shift+Ctrl+Left/Right
    • Ctrl+A
    • non-shift movement collapse behavior
    • type/backspace/delete/paste replacement of active selections (forward and backward ranges)
  • Wired selection state through WidgetRenderer so focused input instances persist normalized selection alongside cursor state.
  • Added deterministic runtime test coverage for unicode behavior, cursor boundaries, paste handling, selection flows, and state invariants.
  • Updated input/focus docs to document unicode behavior, movement rules, paste semantics, and renderer-facing selection state.

Tests

  • npm run build
  • npm run typecheck
  • npm run lint
  • node scripts/run-tests.mjs

All commands pass locally.

@RtlZeroMemory
RtlZeroMemory merged commit a6c8643 into main Feb 18, 2026
18 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +344 to +346
while (position > 0) {
const start = prevBoundary(value, position);
const cls = classifyCluster(value.slice(start, position));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

1 participant