Preserve selection direction across editor edits
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:
- Both affected browser suites: 52 passed, no failures or skips.
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.- Visible Chrome 155 comparison: a backward selection of
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.
- Adds browser regressions for forward and backward selections across Tab, Shift+Tab, and comment toggles, plus an Enter replacement that checks a collapsed caret no longer reports the replaced direction.