dandavison / delta

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

🐛 Confused when using git-diff --color-words with a patch file #1551

Open mrjoel opened 11 months ago

mrjoel commented 11 months ago

When using git diff --color-words with a diff which itself contains a patch file being committed, delta appears to be confused by inner section markers. It seems likely that delta is only considering the text characters instead of also likely needing to consider color state to distinguish this case.

Tested using 0.16.5

delta: image

less:

image

raw text
diff --git c/CVE-2023-38545_7.78.0.patch i/CVE-2023-38545_7.78.0.patch
new file mode 100644
index 0000000..7609849
--- /dev/null
+++ i/CVE-2023-38545_7.78.0.patch
@@ -0,0 +1,137 @@
From e478fb5f5f2e26e2b060a51939dd2746041459ab Mon Sep 17 00:00:00 2001
From: Jay Satiro 
...

diff --git a/lib/socks.c b/lib/socks.c
index 91c4223..222660c 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -535,9 +535,9 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,

     /* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */
     if(!socks5_resolve_local && hostname_len > 255) {