Repository navigation
Preserve selection direction across editor edits - #390
Merged
jserv merged 1 commit intoOct 21, 2026
Merged
Conversation
jserv
force-pushed
the
preserve-editor-selection-direction
branch
2 times, most recently
from
October 20, 2026 15:44
71c7019 to
a258cd0
Compare
jserv
reviewed
Oct 20, 2026
ColtenOuO
reviewed
Oct 21, 2026
ColtenOuO
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, but please squash your commits.
1 task done
Editor commands lose the candidate's active selection end when they restore a range after editing. Keep its original direction so later Shift+Arrow adjustments continue from the same end, including when outdenting leaves the text unchanged. Cover both directions, comment toggles, collapsed replacement, and native undo in browser regressions. Accept either none or forward for the collapsed caret, which Chromium reports differently across platforms. The eight direction cases fail before the fix. Closes sysprog21#385
itisJoshuaTseng
force-pushed
the
preserve-editor-selection-direction
branch
from
October 21, 2026 06:38
1a2b296 to
92213a7
Compare
Contributor
|
Thank @itisJoshuaTseng for contributing! |
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.
Preserve the selection direction across indentation, outdentation, and comment toggling so Shift+ArrowRight continues adjusting the original active end. Restore the direction for noncollapsed ranges in both shared edit paths, including edits that leave the text unchanged, while retaining collapsed-caret behavior and native undo.
Add browser regressions for forward and backward selections, subsequent selection adjustment, comment removal, one-step undo, and replacement with a collapsed caret. The eight direction cases fail before the fix.
Validation:
RUST_TEST_THREADS=2 ./scripts/test.sh: passed; 1,738 Rust tests passed (21 ignored), 1,289 static Node tests and 3 server-backed Node tests passed, and 49 hook checks passed.arybecomesaryxafter Tab and Shift+ArrowRight on the original code, and correctly shrinks torywith the fix.make build: passed.The initial full gate encountered a signal-terminated CLI child process; the isolated retest and complete run with reduced Rust test concurrency passed. Optional commentflow, ruff, shfmt, cargo-audit, actionlint, and shellcheck lanes were unavailable locally. The Linux-only Clang-fetch Python case was skipped on macOS.
Closes #385
Summary by cubic
Preserves the selection direction across indentation, outdentation, and comment toggling so Shift+ArrowRight keeps adjusting from the original active end. The direction is restored for noncollapsed ranges in both shared edit paths, including edits that leave the text unchanged; collapsed selections drop the previous direction and native undo behavior stays the same. Closes #385.
Written for commit 92213a7. Summary will update on new commits.