Fix: Allow triple-click selection in table cells by clamping to cell boundaries#6344
Merged
nathanlesage merged 2 commits intoJun 3, 2026
Merged
Conversation
5 tasks
|
I performed the operation locally: triple-click text selection inside table cells. The result showed that the selection was successfully confined to the table cell boundaries. The original bug has been successfully resolved, and the Tested on: macOS |
Member
|
Looks good, thank you! |
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.
Description
This PR fixes triple-click text selection inside table cells. Previously, a triple-click would attempt to select the entire line (which exceeds the cell's subview boundaries), causing the transaction to be outright disallowed — leaving the user unable to select all text in a cell with a triple-click.
The fix changes the boundary enforcement logic in
ensureBoundariesFilter(insubview.ts) from disallowing out-of-bounds selection transactions to clamping them to the cell's boundaries instead. This allows triple-click select-all to work correctly within the cell.Changes
source/common/modules/markdown-editor/table-editor/subview.tsif any selection range exceeds the cell boundaries, all ranges are clamped to the cell
rather than the transaction being rejected.
wasDeletedguard is preserved — transactions that would delete the cellitself are still disallowed.
No breaking changes to public APIs or UX beyond the intended fix.
Additional information
This fix was discussed in issue #6100.
A "check-then-clamp" strategy was chosen over "always-clamp" after benchmarking. The guard avoids allocating new EditorSelection objects on every transaction during normal editing (the common case), where selections are already within bounds.
AI Disclosure Statement
No AI was used in the development of this PR.
Tested on: Windows 11