so-fancy / diff-so-fancy

Good-lookin' diffs. Actually… nah… The best-lookin' diffs. :tada:
MIT License
17.36k stars 335 forks source link

Only-added/only-removed lines aren't highlighted #490

Open AndiDog opened 6 months ago

AndiDog commented 6 months ago

When lines are changed (removal+insertion), there's red/green color highlighting

Screenshot 2024-05-05 at 18 23 30
$ diff -u <(printf 'a\n') <(printf 'a\nb\nc\nd\n') | diff-so-fancy --color always | hexdump -C | tail -n 5
000003d0  31 6d 1b 5b 33 38 3b 35  3b 31 33 6d 40 20 2f 64  |1m.[38;5;13m@ /d|
000003e0  65 76 2f 66 64 2f 36 32  3a 32 20 40 1b 5b 30 6d  |ev/fd/62:2 @.[0m|
000003f0  1b 5b 30 6d 0a 20 61 0a  2b 62 0a 2b 63 0a 2b 64  |.[0m. a.+b.+c.+d|
00000400  0a                                                |.|
00000401

This only works fine (3 lines marked in green) for me when using diff-so-fancy as git diff tool.