feat(ui): respect current line when opening in $EDITOR - #713
Open
JammingBen wants to merge 1 commit into
Open
Conversation
Contributor
|
PR author is not in the allowed authors list. |
|
@JammingBen is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
Make opening a file in $EDITOR respect the line number of the current cursor instead of opening at the start of the selected hunk.
JammingBen
force-pushed
the
feat/line-number-external-editors
branch
from
August 11, 2026 18:26
46baa3f to
51c2cb6
Compare
benvinegar
reviewed
Aug 12, 2026
| } | ||
|
|
||
| if (deletionLine < deletionCursor + content.deletions) { | ||
| return additionCursor; |
Member
There was a problem hiding this comment.
When the cursor is on the second deleted line of a multi-line replacement, this currently opens the first added line. Could we preserve the line's offset within the replacement block?
This comment was generated by Pi using gpt-5.6-sol
| function deletionLineToFileLine(hunk: DiffHunk, deletionLine: number) { | ||
| let deletionCursor = hunk.deletionStart; | ||
| // A zero-count side names the line before the change, so step past it to land inside the file. | ||
| let additionCursor = hunk.additionCount === 0 ? hunk.additionStart + 1 : hunk.additionStart; |
Member
There was a problem hiding this comment.
For a deletion at EOF, this can request a line past the end of the resulting file. Should we clamp it to the final line?
This comment was generated by Pi using gpt-5.6-sol
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.
Make opening a file in
$EDITORrespect the line number of the current cursor instead of opening at the start of the selected hunk.Also move the
AppHost edit-selected-file shortcuttests into a dedicated file, since I figured they don't really belong insrc/ui/AppHost.sidebar-resize.test.tsx.