Alt Shift selections do not accumulate - #45
Merged
janglad merged 3 commits intoSep 16, 2026
Merged
Conversation
This update preserves the backward keyboard selection direction across repeated word-selection commands and allows word selections to extend across multiple blocks. Key changes include: - Updated selection validation logic in `syncEditorTextSelection` to ensure accurate range checks. - Introduced new tests to verify the correct behavior of backward word selection across blocks. These improvements aim to enhance user experience by providing more intuitive text selection capabilities.
Member
Author
|
bugbot run |
This update introduces the `ensureLineEdgeMeasure` function to improve line-edge measurement in the editor. Additionally, it modifies the handling of the Enter key to leave multi-block selections to the beforeinput event, ensuring more intuitive text editing behavior. Key changes include: - Added `ensureLineEdgeMeasure` function to `keyHandling.ts`. - Updated `ExpandedContentEditableBackend` to call `ensureLineEdgeMeasure` before dispatching key events. - Introduced tests to verify the new behavior for multi-block Enter key handling and line-edge measurement. These enhancements aim to refine user experience during text editing and selection in the editor.
Member
Author
|
bugbot run |
This update introduces the `ensureLineEdgeMeasure` function to enhance line-edge measurement capabilities in the editor. The function is now properly imported and utilized in `expandedContentEditableBackend.ts`, while redundant imports in `keyHandling.ts` have been removed. Key changes include: - Added `ensureLineEdgeMeasure` to `contenteditableDomHelpers.ts`. - Updated `expandedContentEditableBackend.ts` to import and use the new function. - Cleaned up imports in `keyHandling.ts` for better code organization. These modifications aim to improve the editor's functionality and maintainability.
Member
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 5aed96e. Configure here.
noudadrichem
approved these changes
Sep 16, 2026
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.
Summary
Fixes WEB-3962:
Test plan
Note
Medium Risk
Changes keyboard selection sync and expanded-mode key handling, which can affect caret/selection behavior across blocks; scope is limited to DOM field-editor paths with new tests.
Overview
Fixes backward Alt+Shift word selections so repeated word-select shortcuts keep the same anchor and keep extending the focus, instead of resetting direction after each keypress.
syncEditorTextSelectionnow treats a DOM range as equivalent to the editor selection when min/max offsets match, so backward selections are not mistaken for a different range and re-applied viaselectTextin a way that flips anchor/focus.Multi-block expanded contenteditable mode now runs the same keymap path as single-block editing (with Enter still deferred to
beforeinputfor multi-block ranges). That enables word selection and navigation commands—including Home with the visual line-edge measure—to work while a selection spans blocks.ensureLineEdgeMeasureis shared fromcontenteditableDomHelpersfor both code paths.Regression tests cover repeated Alt+Shift+ArrowLeft within a block, cross-block word extend, expanded-mode Enter/Home, and the line-edge seam before Home.
Reviewed by Cursor Bugbot for commit 5aed96e. Bugbot is set up for automated code reviews on this repo. Configure here.