[diffs/editor] Support moveLineUp and moveLineDown commands#936
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16ea0af81d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| end: { | ||
| line: selection.end.line + direction, | ||
| character: selection.end.character, |
There was a problem hiding this comment.
When a non-empty selection ends at column 0 of the following line, getSelectedLineBlocks deliberately treats that following line as excluded, so moving the block down can be allowed even when the raw selection.end.line is already the last line index. In a file without a trailing newline, selecting line N as {start: N, end: N+1 character 0} and pressing Alt+Down moves the text to the final line but this code sets end.line to lineCount, leaving #selections out of bounds; subsequent rendering/scrolling can't place the caret and later edits normalize the invalid end back onto the last line, collapsing or corrupting the selection.
Useful? React with 👍 / 👎.
* [diffs/editor] Support `moveLineUp` and `moveLineDown` commands * fix "Clamp moved selections at EOF" * fix performance: 60ms -> 0.3ms (m4 pro)
moveLineUpandmoveLineDowneditor commandsAlt + ↑/Alt +↓Alt + Ctrl + P/Alt + Ctrl + Non macOS and Linux