Skip to content

feat(review): add go-to-line prompt - #808

Draft
IAMLEIzZ wants to merge 1 commit into
modem-dev:mainfrom
IAMLEIzZ:feat/goto-line
Draft

feat(review): add go-to-line prompt#808
IAMLEIzZ wants to merge 1 commit into
modem-dev:mainfrom
IAMLEIzZ:feat/goto-line

Conversation

@IAMLEIzZ

Copy link
Copy Markdown
Contributor

Closes #805

Summary

Adds a go-to-line flow to the review UI: : opens a small line-number prompt in the status bar (the same inline-input pattern as the / file filter), and Enter jumps the current-line cursor to that line in the selected file so c can annotate it directly. A bare number uses the current file's numbering (the R side the note labels use); an l prefix such as :l42 targets the source file's numbering (the L side). Escape cancels, and a line that is not part of the diff reports a transient notice naming the side instead of jumping silently.

The jump resolves through the existing shared revealLine path that the session navigate command uses, so scrolling, selection, and note targeting all land consistently. Line-level navigation is also decoupled from the cursor_line display option: when the marker is off, the target cursor is synthesized on demand from the render plan (no full stop-list rebuild), so jumping and annotating stay precise instead of degrading to the hunk.

Notes

  • hunk.review.gotoLine is registered in the shared command catalog with : as the default chord, is remappable via [keybindings], and closes an open menu when triggered.
  • The bundled vim-navigation example moves its command line from : to ;, since built-in chords shadow extension chords by design.
  • Failure paths are explicit: lines outside the diff, hunk-only degraded targets, and an empty file selection each report a transient notice, and notices now outrank the filter=… summary so they stay visible while a file filter is active.

Testing

  • AppHost interaction coverage: prompt opening without key leakage, same-chunk :2 delivery, non-digit stripping, Escape cancel, new/old side targeting, closing an open menu, cursor_line = "off" jump and annotate precision, selected-file targeting, and the two-stage filter Escape.
  • One real-PTY end-to-end test: jump to line 62 across hunks and anchor a note at R62.
  • useTerminalReview contract tests updated for the synthesized-cursor reveal; vim example unit tests and PTY updated for the move to ;.
  • Full unit suite, typecheck, lint, and format checks pass locally.

Add a go-to-line flow: `:` opens a line-number prompt in the status bar,
and Enter jumps the current-line cursor to that line in the selected file
so `c` can annotate it directly. Bare numbers use the current file's
numbering (the note labels' `R` side); an `l` prefix targets the source
file's numbering (the `L` side). The jump resolves through the shared
revealLine path, and line-level navigation no longer depends on the
cursor_line display option: with the marker off, the target cursor is
synthesized on demand instead of falling back to the hunk.

The command closes an open menu when triggered, reports failures as
transient notices (which now outrank the filter summary), and the bundled
vim-navigation example's command line moves from `:` to `;` since
built-ins shadow extension chords by design.
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@IAMLEIzZ is attempting to deploy a commit to the Modem Team on Vercel.

A member of the Team first needs to authorize it.

@benvinegar

Copy link
Copy Markdown
Member

@IAMLEIzZ Any reason this is a draft? Should I take a look?

@IAMLEIzZ

Copy link
Copy Markdown
Contributor Author

@IAMLEIzZ Any reason this is a draft? Should I take a look?

Sorry for the delay — this week has been extremely busy and I haven't had a chance to review the latest version yet. I'll need to go through it properly before we proceed. I'll remove the draft status once it's ready for review.

@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.

Should we add : to the in-app help as well? It feels like a primary navigation shortcut.

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

return "none";
}

// An empty list means line-level navigation is hidden (`cursor_line = "off"`), not

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.

An empty cursor list doesn’t always mean cursor_line is off—it can also happen with extension file views. In that case we may return "line" even though there are no bounds to scroll to.

Could we only synthesize the cursor when we know the raw diff is being rendered? Otherwise, we should fall back to the hunk.

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

// An empty list means line-level navigation is hidden (`cursor_line = "off"`), not
// that the target row is missing: synthesize the line's cursor and reveal it exactly.
if (cursors.length === 0) {
revealLineCursor(lineCursorAt(cursors, fileId, hunkIndex, { side, line }), "reveal");

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.

This also breaks on zero-count sides. For example, :lN on a pure insertion can target an old-side row that doesn’t exist, but we still report a successful jump and allow a comment there.

Could we check that the target has a real rendered line first? A pure insertion/deletion test would be useful too.

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.

feat(review): add go-to-line prompt

2 participants