delta
delta copied to clipboard
Incomplete diff.🐛
Delta 0.11.3. File a.lua, b.lua. See, first part is missing:
UPD: diff is alias for diff --color -Naurp0.
Thanks for the report and the test files @k4leg -- I see the same bug as you.
Incidentally, using delta a.lua b.lua does work on your files (under the hood this uses git diff --no-index instead of diff -u). But that doesn't change the fact that this is a bug with delta's handling of diff -u.
I assume it works with the git diff command because delta is requesting color? (Since that would prefix the "---" line by a color escape sequence.)
So, it looks like delta needs to start to interpret the counts on the "@@" lines so that it can ignore a "--- " prefix if it is in the middle of a hunk. One possibility is to stash off the @@ line and only interpret it if you run into a "--- " line before seeing a "diff " line (at which point the code would do some quick length calculations and see if it is in the hunk or not).
This is one of my big regrets looking back at when I invented unified diffs: I should have made the filename headers "@- file" and "@+ file" so that there could no confusion possible between a header line and a change line. Oh well.