Skip to content

fix: merge overlapping multi-cursor selections after Shift+Arrow#751

Merged
xiaolai merged 1 commit intomainfrom
fix/audit-692
Apr 8, 2026
Merged

fix: merge overlapping multi-cursor selections after Shift+Arrow#751
xiaolai merged 1 commit intomainfrom
fix/audit-692

Conversation

@xiaolai
Copy link
Copy Markdown
Owner

@xiaolai xiaolai commented Apr 8, 2026

Closes #692

Summary

  • Pass merge=true to normalizeRangesWithPrimary() when extend=true in both horizontalMovement.ts and inputHandling.ts (vertical arrow handler)
  • Overlapping selections from Shift+Arrow are now merged immediately, matching VS Code/Sublime Text behavior
  • Prevents incorrect text insertion/deletion when typing with overlapping ranges

Test plan

  • New tests: overlapping selections merge after Shift+Right extend
  • New tests: adjacent selections merge when they grow to overlap
  • New tests: non-overlapping selections remain separate
  • New tests: end-to-end Shift+Arrow then type produces correct text
  • All 17,758 existing tests pass
  • Lint clean, build passes

🤖 Generated with Claude Code

 #692)

Pass merge=true to normalizeRangesWithPrimary when extending selections
via Shift+Arrow, so overlapping ranges are merged immediately — matching
VS Code and Sublime Text behavior. Without this, overlapping ranges
caused incorrect text insertion/deletion on subsequent input.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@xiaolai xiaolai added the audit Codebase audit finding label Apr 8, 2026
@xiaolai
Copy link
Copy Markdown
Owner Author

xiaolai commented Apr 8, 2026

VERIFIED — The fix passes extend (true when Shift is held) as the merge parameter to normalizeRangesWithPrimary() in both horizontalMovement.ts:117 and inputHandling.ts:284, which is exactly option (a) from the audit finding — overlapping selections are now merged immediately after Shift+Arrow movement, preventing stale-position edits.

@xiaolai xiaolai enabled auto-merge (squash) April 8, 2026 15:28
@xiaolai xiaolai merged commit 333c9e2 into main Apr 8, 2026
8 checks passed
@xiaolai xiaolai deleted the fix/audit-692 branch April 8, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audit Codebase audit finding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[audit] multi-cursor: overlapping selections not merged after Shift+Arrow, causing incorrect edits on input

1 participant