diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 15:39:27 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | a898c0cce8377150417e7d8dda8f952ffdf241ab (patch) | |
| tree | 2197f55f9c58c80c5608b84f5510141ba6771cba /test | |
| parent | c04df904f2fa686cbe5ce0c078a96260af7b08bd (diff) | |
| download | pardes-a898c0cce8377150417e7d8dda8f952ffdf241ab.tar.gz pardes-a898c0cce8377150417e7d8dda8f952ffdf241ab.zip | |
A right click on a diff line opens the place it names: its file, the hunk's new line, the line itself
In a diff pane (a .diff/.patch file, or a command pane's diff output), the
look's own expansion, which its hover shows, takes a whole line for a
`diff --git`, `---`, `+++` or `@@` line wherever the pointer is on it,
markers included, and for a hunk line when the pointer is on its `+`, `-`
or space. Then the look opens the file (a/ b/ dropped, timestamps cut) at
the line from the hunk header and the lines above it: `@@` the hunk's
first new line, context and added lines their own, a removed line the new
line now where it was. `diff --git` and `+++` open the new file; `---` the
old one, unless the `+++` under it names another. On a hunk line's code
the expansion is its words, the prefix never one of them, and looks as
ever. Other panes are untouched.
Paths resolve in the repository (walking up to `.git` or `.jj` from the
diff's directory, or a command pane's), then that directory. A file not
here opens nothing and says `Look: b/x: no such file here`, or `deleted by
this diff`. A 9P look writing a whole line of the diff does the same.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test')
| -rw-r--r-- | test/snapshots/diffview.golden | 29 | ||||
| -rw-r--r-- | test/snapshots/diffview.snap | 14 |
2 files changed, 41 insertions, 2 deletions
diff --git a/test/snapshots/diffview.golden b/test/snapshots/diffview.golden index 2da9f6e3..9e171fd8 100644 --- a/test/snapshots/diffview.golden +++ b/test/snapshots/diffview.golden @@ -54,6 +54,21 @@ |28: 0-0 d,#608269, 1-99 d,#0d1410, |29: 0-0 d,#608269, 1-99 d,#0d1410, |30: 0-0 d,#608269, 1-99 d,#0d1410, +== snap look-added-line grid=100x31 cursor=55,22 +|16: /tmp/pardes-snap/diffview/cwd/src/shape.zig Save Tty Collapse Del TreeContext +|17: 1 const std = @import("std"); +|18: 2 +|19: 3 pub const Shape = union(enum) { +|20: 4 circle: f32, +|21: 5 square: f32, +|22: 6 triangle: struct { base: f32, height: f32 }, +|23: 7 +|24: 8 const note = +|25: 9 \\areas, defer +|26: 10 \\summed +|27: 11 ; +|28: 12 }; +|29: 13 == snap command-pane grid=100x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit | New Tty Find Grep Joincol Delcol @@ -117,3 +132,17 @@ |28: 0-0 d,#608269, 1-2 d,#0d1410, 3-99 #e5eee5,#0d1410, |29: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, |30: 0-0 d,#152019, 1-99 d,#0d1410, +== snap command-look grid=100x31 cursor=23,10 +|3: 1 cat change.diff +|5: /tmp/pardes-snap/diffview/cwd/src/shape.zig Save Tty Collapse Del TreeContext +|6: 1 const std = @import("std"); +|7: 2 +|8: 3 pub const Shape = union(enum) { +|9: 4 circle: f32, +|10: 5 square: f32, +|11: 6 triangle: struct { base: f32, height: f32 }, +|12: 7 +|13: 8 const note = +|14: 9 \\areas, defer +|15: 10 \\summed +|16: 11 ; diff --git a/test/snapshots/diffview.snap b/test/snapshots/diffview.snap index b5900db9..23d060b7 100644 --- a/test/snapshots/diffview.snap +++ b/test/snapshots/diffview.snap @@ -1,7 +1,9 @@ # A diff pane, for reviewing a change: each hunk's code coloured as Zig (a # multi-line string over three lines, `defer` inside it no keyword), added and # removed rows tinted to the pane's edge with their prefix in the tint's hue, -# headers muted. +# headers muted. Then a right click on an added line's `+` opens the new file +# at that line: the path is the repository's (a `.git` above the diff), b/ +# dropped. dirmk .git dirmk src file src/shape.zig const std = @import("std");\n\npub const Shape = union(enum) {\n circle: f32,\n square: f32,\n triangle: struct { base: f32, height: f32 },\n\n const note =\n \\\\areas, defer\n \\\\summed\n ;\n};\n @@ -11,9 +13,13 @@ wait 8000 Newcol Joincol stable 700 20000 snap diff-pane snapstyle diff-colours +press right 8 15 +release right 8 15 +stable 700 15000 +snap look-added-line # The same diff printed by a command (`git diff`, here `cat`) into a command # pane: its output is told for a diff and coloured the same, over the colours -# the program printed. +# the program printed, and a right click on a `+` there opens the file too. file cmds.txt cat change.diff\n start 31 100 cmds.txt wait 8000 cmds.txt @@ -25,3 +31,7 @@ wait 10000 exit 0 stable 700 15000 snap command-pane snapstyle command-colours +press right 3 21 +release right 3 21 +stable 700 15000 +snap command-look |
