Skip to content

feat(ui): respect current line when opening in $EDITOR - #713

Open
JammingBen wants to merge 1 commit into
modem-dev:mainfrom
JammingBen:feat/line-number-external-editors
Open

feat(ui): respect current line when opening in $EDITOR#713
JammingBen wants to merge 1 commit into
modem-dev:mainfrom
JammingBen:feat/line-number-external-editors

Conversation

@JammingBen

Copy link
Copy Markdown

Make opening a file in $EDITOR respect the line number of the current cursor instead of opening at the start of the selected hunk.

Also move the AppHost edit-selected-file shortcut tests into a dedicated file, since I figured they don't really belong in src/ui/AppHost.sidebar-resize.test.tsx.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

@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
JammingBen force-pushed the feat/line-number-external-editors branch from 46baa3f to 51c2cb6 Compare August 11, 2026 18:26

@benvinegar benvinegar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main behavior looks good. This just needs a rebase onto main; I left two old-side mapping edge cases inline.

This comment was generated by Pi using gpt-5.6-sol

}

if (deletionLine < deletionCursor + content.deletions) {
return additionCursor;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants