You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(diff): open diff view at file:line on either side
Both entry points for the two-file diff view (CLI `--diff` and the
`:diff-open` command) already parsed the optional `file:line` or
`file:line:col` suffix via `parse_file`, but discarded the position.
Opening `hx --diff a.rs:42 b.rs:58` landed both panes at line 1.
Keep the position and apply it after each `editor.open`, using the same
pos_at_coords + set_selection + align_view pattern that the non-diff
file-open loop uses. In application.rs the work goes through a small
`apply_diff_positions` helper so both sides share one code path.
Integration tests cover the four cases that matter:
- `:diff-open a:3 b:5` positions both panes
- `:diff-open a:3 b` positions one pane, leaves the other at the top
- `:diff-open a b` with no suffixes keeps both at line 1 (regression guard)
- `hx --diff a:3 b:5` via `AppBuilder::with_diff` proves the CLI branch
lands each cursor in its own pane
The CLI test was mutation-checked by commenting out both
`apply_diff_positions` calls and confirming the assertion fails.
Copy file name to clipboardExpand all lines: book/src/generated/typable-cmd.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,7 @@
87
87
|`:pipe`, `:\|`| Pipe each selection to the shell command. |
88
88
|`:pipe-to`| Pipe each selection to the shell command, ignoring output. |
89
89
|`:run-shell-command`, `:sh`, `:!`| Run a shell command |
90
-
|`:diff-open`, `:diffs`| Open two files side-by-side in diff mode with aligned hunks. |
90
+
|`:diff-open`, `:diffs`| Open two files side-by-side in diff mode with aligned hunks. Each path accepts a file:line or file:line:col suffix. |
91
91
|`:reset-diff-change`, `:diffget`, `:diffg`| In a diff session: pull changes from the partner buffer. Outside a diff session: reset the diff change at the cursor position to the VCS base. |
92
92
|`:diff-put`, `:diffput`, `:diffp`| In a diff session: push changes from the current buffer to the partner buffer at the cursor position. |
93
93
|`:diff-off`, `:diffoff`| End the diff session for the current view. Both views continue as independent buffers. |
0 commit comments