feat(ui): respect current line when opening in $EDITOR - #713
Conversation
|
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. |
46baa3f to
51c2cb6
Compare
| 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; |
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
There was a problem hiding this comment.
It seems to be handled gracefully by every editor that supports this feature, and all other editors don't get a line reported anyways.
I might be wrong on that, but I think we would need the true file count, which we can only reliably get with isPartial: false, or when reading the file content (e.g. via readFileSync). So given the target editors already handle it, I'd rather not change it.
But if you still want me to tackle it, I can do so.
Make opening a file in $EDITOR respect the line number of the current cursor instead of opening at the start of the selected hunk.
51c2cb6 to
f07fa83
Compare
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.