Skip to content

Add jump to line number in preview#233

Merged
jongio merged 2 commits into
mainfrom
idea/preview-goto-line
Jul 7, 2026
Merged

Add jump to line number in preview#233
jongio merged 2 commits into
mainfrom
idea/preview-goto-line

Conversation

@jongio

@jongio jongio commented Jul 2, 2026

Copy link
Copy Markdown
Owner

What

Adds a jump to line number feature to the preview panel. Press L to open a prompt, type a line number, and press Enter to jump straight there. The target line is centered in the viewport when there is room.

Why

Scrolling to a specific line in a long file or diff is slow. When a build error or review comment points at a line number, you want to go there directly instead of paging through the file.

How

  • L opens an inline prompt at the bottom of the preview (Go to line: ).
  • Digits build the number, Backspace edits, Enter jumps, Esc cancels.
  • The jump indexes source lines, so it lands on the right line whether word wrap or line numbers are on or off, and in file, diff, or blame views.
  • While the prompt is open, all keys route to the preview so digits are captured as input rather than triggering panel focus shortcuts.

Testing

  • New gotoline_test.go covers clamping, centering offset, prompt open/type/commit, escape cancel, empty and non-digit rejection, and prompt rendering.
  • go build ./..., go vet ./..., preview and keybindings packages pass, gofumpt clean.

Closes #223

Adds an L keybinding in the preview panel that opens a prompt to type a
line number and jump straight to it. The target line is centered in the
viewport when possible. Works in file, diff, and blame views, and with
word wrap or line numbers on or off since it indexes source lines.

Closes #223

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jongio jongio self-assigned this Jul 2, 2026
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 2, 2026
Replace the repeated 'esc'/'escape' key-name literals in the edit,
selection, and go-to-line handlers with keyEsc/keyEscape constants so
goconst passes, matching the existing keyDown convention.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jongio jongio merged commit e7ba596 into main Jul 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jump to a line number in the preview panel

1 participant