Skip to content

feat(diff): open editor at cursor line#2952

Open
paaloeye wants to merge 3 commits into
gitui-org:masterfrom
paaloeye:feat/editor-goto
Open

feat(diff): open editor at cursor line#2952
paaloeye wants to merge 3 commits into
gitui-org:masterfrom
paaloeye:feat/editor-goto

Conversation

@paaloeye
Copy link
Copy Markdown

feat(diff): open editor at cursor line

  • extend OpenExternalEditor event to carry an optional line number
  • use the selection cursor index into the flat line list to find the
    exact line, using the same index space as selected_lines()
  • add editor_goto_style() to map editor name to the correct
    goto-line argument style (hx: file:line, code: --goto file:line,
    vi/vim/nvim/emacs/nano/etc: +line file)

I followed the checklist:

  • I added unittests
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

paaloeye and others added 3 commits May 17, 2026 19:51
- extend OpenExternalEditor event to carry an optional line number
- use the selection cursor index into the flat line list to find the
  exact line, using the same index space as selected_lines()
- add editor_goto_style() to map editor name to the correct
  goto-line argument style (hx: file:line, code: --goto file:line,
  vi/vim/nvim/emacs/nano/etc: +line file)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Code 2.1.143 (Claude Code)
Signed-Off-By: Paal Øye-Strømme <paal.o.eye@gmail.com>
- remove is_immutable guard from can_edit_file() so the edit_file
  keybinding works in Log -> Files -> Diff and other read-only views
- move the edit_item command info outside the !is_immutable block
- line number is passed via the existing goto logic; no extra change needed
- only mutating operations (stage, unstage, reset hunk) remain gated
  on is_immutable

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Code 2.1.143 (Claude Code)
Signed-Off-By: Paal Øye-Strømme <paal.o.eye@gmail.com>
- add diff_component_opens_editor_at_cursor_line verifying that
  OpenExternalEditor carries the new_lineno of the line the cursor
  is on, not the hunk start
- add changelog entry for the editor goto-line feature

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Code 2.1.143 (Claude Code)
Signed-Off-By: Paal Øye-Strømme <paal.o.eye@gmail.com>
@paaloeye paaloeye force-pushed the feat/editor-goto branch from ae90607 to 9026941 Compare May 17, 2026 19:01
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.

1 participant