diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2022-01-24 18:10:39 +0100 |
|---|---|---|
| committer | Johannes Altmanninger <aclopte@gmail.com> | 2022-01-25 14:15:01 +0100 |
| commit | bf239ba77afee503f5b9bd9cf392ca2ad0fd4f8f (patch) | |
| tree | a97e3970f232da3dfa85d6bc077779e27bfe4e49 /src | |
| parent | b84abd57de39facb8159b6a0f6f6390268ff54d0 (diff) | |
rc diff: introduce diff-jump, replacing git-diff-goto-source
git-diff-goto-source is specific to diffs produced by Git. This patch
generalizes the logic and moves it to a new diff-jump in diff.kak.
The main differences are:
- diff-jump handles plain file diffs (i.e. without the -r option). These
have no "diff" line. This means that it needs to parse +++/--- instead.
- diff-jump can go to the old file, not just the new one.
- diff-jump allows to override the base directory and the number of
directory components to strip.
git-diff-goto-source was implemented with several nested try/catch
blocks. Implementing the extra features would have added more
nesting, redundancy or hidden options. To avoid that, I ported the
parsing logic to Perl (which git.kak already depends on). Maybe
it's possible to do the same in awk.
Potential concerns:
- We could move diff-jump to a new rc/tools/diff.kak but then it's not
obvious where the "diff" module belongs to.
- Should diff "diff-jump -1" be spelled "diff-jump -p1"?
In future, the diff parser could be reused to implement a vimdiff-style
feature: given a diff and the "old" line number, we can compute the
corresponding "new" line number. Perhaps diff-jump should get a -client
argument.
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions
