Alt- or shift-click a diff line to open it in your editor - #6041
Open
stefanhaller wants to merge 9 commits into
Open
stefanhaller wants to merge 9 commits into
stefanhaller wants to merge 9 commits into
Conversation
stefanhaller
added this pull request to stack #6027
September 20, 2026 18:13
stefanhaller
force-pushed
the
edit-diff-line-with-modified-click
branch
2 times, most recently
from
September 21, 2026 13:46
138e40d to
e3812b1
Compare
stefanhaller
force-pushed
the
edit-diff-line-with-modified-click
branch
3 times, most recently
from
September 27, 2026 10:41
2963608 to
887ab6d
Compare
stefanhaller
force-pushed
the
edit-diff-line-with-modified-click
branch
from
September 27, 2026 10:56
887ab6d to
c03184c
Compare
stefanhaller
force-pushed
the
edit-diff-line-with-modified-click
branch
from
September 27, 2026 16:27
c03184c to
020991c
Compare
These always returned nil. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
View.SetHighlight has no production callers.
A view can need repainting even when its cached wrapping is still valid. Track that state independently so content-only flushes do not overload tainted, whose only job is to request a viewLines rebuild.
Mouse events on views behind a popup are normally swallowed before their bindings can run. Add an explicit early-dispatch opt-in for actions that should remain live there, matching the phase where hyperlink clicks already run.
The selected-line keybinding and a modified click need the same path from a rendered diff row to the editor. Give that operation an explicit view-line argument before adding the mouse gesture.
Bindings match modifiers exactly, so a modified press must not turn into an unmodified drag or release halfway through the gesture. Capture the press-time modifiers once and carry them until the button is released. This also makes unbound modified clicks no-ops instead of silently invoking plain-click behavior.
Clickable renderer gutters are small and unavailable on some diff rows. Make the whole row an editor target without changing focus or selection, including while a popup is focused. Use both Alt and Shift because terminal mouse protocols do not deliver either modifier consistently across Ghostty, iTerm2, and VS Code.
Actions that hand control to another application need visible acknowledgement without moving a view's cursor or replacing renderer colors. Reverse the narrow selection bar independently of selection state, and clear transient flashes whenever the terminal UI suspends.
Non-suspending graphical editors can take a moment to reach the foreground, leaving a modified click with no visible response. Briefly reverse the clicked row's selection bar after launching the editor so the registered action is apparent. Arm the flash only for a resolved diff row, keep newer clicks safe from stale timers, and rely on suspension to clear the transient state before terminal editors take over.
stefanhaller
force-pushed
the
edit-diff-line-with-modified-click
branch
from
October 1, 2026 15:28
020991c to
e3f9bfa
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
10th PR in the stack of PRs towards staging hunks directly from the main view. This one is stacked on #6040.
Alt-click or shift-click a line of any diff and it opens in your editor at that line. It doesn't move the focus or change the selection, and it works while a popup has the focus, so you can read a diff behind a menu and jump into the code. This is especially useful while writing a commit message, when you want to copy a function name from the code that's showing behind the commit message editor.
Both modifier clicks are bound (alt and shift), because no single one works in Ghostty, iTerm2 and VS Code alike. Each of those swallows or rewrites a different one, so you have to test which one works in your terminal.
A 200 ms flash over the clicked row acknowledges the click. An editor can take a moment to appear, and until it does you are otherwise left wondering whether anything happened.