dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
22.5k stars 376 forks source link

🐛 No syntax highlighting if hunk includes added/removed newline at EOF #1812

Open injust opened 4 weeks ago

injust commented 4 weeks ago
diff --git i/test.json w/test.json
index d89de76..34d7810 100644
--- i/test.json
+++ w/test.json
@@ -1,4 +1,4 @@
 {
   "foo": "bar",
-  "baz": "qux"
-}
\ No newline at end of file
+  "baz": ""
+}
image
injust commented 4 weeks ago

This seems to happen if the \ No newline at end of file line appears between the old/new lines in the diff.

Syntax highlighting works in this case:

diff --git i/test.json w/test.json
index 41557a1..eb5fe05 100644
--- i/test.json
+++ w/test.json
@@ -1,4 +1,4 @@
 {
-    "foo": "bar",
+    "foo": "",
     "baz": "qux"
-}
\ No newline at end of file
+}
image