* [PR PATCH] mcolor: Add coloring support for diffs
@ 2023-10-05 13:59 thyssentishman
2023-10-05 14:33 ` leahneukirchen
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: thyssentishman @ 2023-10-05 13:59 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 701 bytes --]
There is a new pull request by thyssentishman against master on the mblaze repository
https://github.com/thyssentishman/mblaze master
https://github.com/leahneukirchen/mblaze/pull/249
mcolor: Add coloring support for diffs
Add coloring for diffs sent as part of the email body. This adds support for the following three ENV variables:
- **MCOLOR_DIFF_I**: For (I)nserted lines.
- **MCOLOR_DIFF_D**: For (D)eleted lines
- **MCOLOR_DIFF_R**: For file (R)anges
Since the default theme is quite bright, these default to bright colors as well (Green1, Red1 and Yellow1 from the 256 XTerm colors respectively).
A patch file from https://github.com/leahneukirchen/mblaze/pull/249.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-249.patch --]
[-- Type: text/x-diff, Size: 1256 bytes --]
From 8dca80032e6fab9d2e656d8980a805c9e44abbeb Mon Sep 17 00:00:00 2001
From: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Date: Thu, 5 Oct 2023 15:39:46 +0200
Subject: [PATCH] mcolor: Add coloring support for diffs
---
mcolor | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mcolor b/mcolor
index ba2c42c..9fff0c0 100755
--- a/mcolor
+++ b/mcolor
@@ -10,12 +10,16 @@ no_color { print; next }
/^\014$/ { nextmail = 1; print(fg(co("FF",232), $0)); next }
/^$/ { hdr = 0 }
/^-- $/ { ftr = 1 }
-/^--- .* ---/ { print fg(co("SEP",242), $0); ftr = 0; sig = 0; next }
+/^diff -/ { diff = 1 }
+/^--- .* ---/ { print fg(co("SEP",242), $0); ftr = 0; diff = 0; sig = 0; next }
/^-----BEGIN .* SIGNATURE-----/ { sig = 1 }
nextmail && /^From:/ { hdr = 1 }
hdr && /^From:/ { print so(fg(co("FROM",119), $0)); next }
hdr { print fg(co("HEADER",120), $0); next }
ftr { print fg(co("FOOTER",244), $0); next }
+diff && /^-/ { print fg(co("DIFF_D",196), $0); next }
+diff && /^\+/ { print fg(co("DIFF_I",46), $0); next }
+diff && /^@/ { print fg(co("DIFF_R",226), $0); next }
/^-----BEGIN .* MESSAGE-----/ ||
/^-----END .* SIGNATURE-----/ { print fg(co("SIG",244), $0); sig = 0; next }
sig { print fg(co("SIG",244), $0); next }
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mcolor: Add coloring support for diffs
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
@ 2023-10-05 14:33 ` leahneukirchen
2023-10-05 14:36 ` leahneukirchen
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: leahneukirchen @ 2023-10-05 14:33 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 330 bytes --]
New comment by leahneukirchen on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/249#issuecomment-1749034279
Comment:
Almost out of scope for mcolor, but it's a cute feature.
I think there are other ways to end a unified diff, probably any line not leading with space, -, + should be regarded as end of diff?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mcolor: Add coloring support for diffs
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
2023-10-05 14:33 ` leahneukirchen
@ 2023-10-05 14:36 ` leahneukirchen
2023-10-05 14:38 ` leahneukirchen
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: leahneukirchen @ 2023-10-05 14:36 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 171 bytes --]
New comment by leahneukirchen on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/249#issuecomment-1749038851
Comment:
hm, but git has the index lines...
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mcolor: Add coloring support for diffs
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
2023-10-05 14:33 ` leahneukirchen
2023-10-05 14:36 ` leahneukirchen
@ 2023-10-05 14:38 ` leahneukirchen
2023-10-05 15:24 ` [PR PATCH] [Updated] " thyssentishman
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: leahneukirchen @ 2023-10-05 14:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 190 bytes --]
New comment by leahneukirchen on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/249#issuecomment-1749043241
Comment:
I guess resetting diff on empty lines is good enough!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PR PATCH] [Updated] mcolor: Add coloring support for diffs
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
` (2 preceding siblings ...)
2023-10-05 14:38 ` leahneukirchen
@ 2023-10-05 15:24 ` thyssentishman
2023-10-05 15:24 ` thyssentishman
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: thyssentishman @ 2023-10-05 15:24 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 706 bytes --]
There is an updated pull request by thyssentishman against master on the mblaze repository
https://github.com/thyssentishman/mblaze master
https://github.com/leahneukirchen/mblaze/pull/249
mcolor: Add coloring support for diffs
Add coloring for diffs sent as part of the email body. This adds support for the following three ENV variables:
- **MCOLOR_DIFF_I**: For (I)nserted lines.
- **MCOLOR_DIFF_D**: For (D)eleted lines
- **MCOLOR_DIFF_R**: For file (R)anges
Since the default theme is quite bright, these default to bright colors as well (Green1, Red1 and Yellow1 from the 256 XTerm colors respectively).
A patch file from https://github.com/leahneukirchen/mblaze/pull/249.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-249.patch --]
[-- Type: text/x-diff, Size: 1309 bytes --]
From dfd1a02ee6898eff61ba291eddabc6c5d60fe4cf Mon Sep 17 00:00:00 2001
From: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Date: Thu, 5 Oct 2023 15:39:46 +0200
Subject: [PATCH] mcolor: Add coloring support for diffs
---
mcolor | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mcolor b/mcolor
index ba2c42c..4ed459b 100755
--- a/mcolor
+++ b/mcolor
@@ -8,14 +8,18 @@ BEGIN { hdr = 1; if ("NO_COLOR" in ENVIRON || match(ENVIRON["TERM"], "^(dumb|net
no_color { print; next }
/\r$/ { sub(/\r$/, "") }
/^\014$/ { nextmail = 1; print(fg(co("FF",232), $0)); next }
-/^$/ { hdr = 0 }
+/^$/ { hdr = 0; diff = 0 }
/^-- $/ { ftr = 1 }
+/^diff -/ { diff = 1 }
/^--- .* ---/ { print fg(co("SEP",242), $0); ftr = 0; sig = 0; next }
/^-----BEGIN .* SIGNATURE-----/ { sig = 1 }
nextmail && /^From:/ { hdr = 1 }
hdr && /^From:/ { print so(fg(co("FROM",119), $0)); next }
hdr { print fg(co("HEADER",120), $0); next }
ftr { print fg(co("FOOTER",244), $0); next }
+diff && /^-/ { print fg(co("DIFF_D",196), $0); next }
+diff && /^\+/ { print fg(co("DIFF_I",46), $0); next }
+diff && /^@/ { print fg(co("DIFF_R",226), $0); next }
/^-----BEGIN .* MESSAGE-----/ ||
/^-----END .* SIGNATURE-----/ { print fg(co("SIG",244), $0); sig = 0; next }
sig { print fg(co("SIG",244), $0); next }
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mcolor: Add coloring support for diffs
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
` (3 preceding siblings ...)
2023-10-05 15:24 ` [PR PATCH] [Updated] " thyssentishman
@ 2023-10-05 15:24 ` thyssentishman
2023-10-05 15:34 ` leahneukirchen
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: thyssentishman @ 2023-10-05 15:24 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 297 bytes --]
New comment by thyssentishman on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/249#issuecomment-1749128447
Comment:
> Almost out of scope for mcolor, but it's a cute feature.
Glad you like it :)
> I guess resetting diff on empty lines is good enough!
Updated, thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mcolor: Add coloring support for diffs
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
` (4 preceding siblings ...)
2023-10-05 15:24 ` thyssentishman
@ 2023-10-05 15:34 ` leahneukirchen
2023-10-05 15:40 ` [PR PATCH] [Updated] " thyssentishman
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: leahneukirchen @ 2023-10-05 15:34 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 191 bytes --]
New comment by leahneukirchen on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/249#issuecomment-1749147124
Comment:
I think less bright is better tho, make it 160 and 40.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PR PATCH] [Updated] mcolor: Add coloring support for diffs
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
` (5 preceding siblings ...)
2023-10-05 15:34 ` leahneukirchen
@ 2023-10-05 15:40 ` thyssentishman
2023-10-05 15:43 ` thyssentishman
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: thyssentishman @ 2023-10-05 15:40 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 706 bytes --]
There is an updated pull request by thyssentishman against master on the mblaze repository
https://github.com/thyssentishman/mblaze master
https://github.com/leahneukirchen/mblaze/pull/249
mcolor: Add coloring support for diffs
Add coloring for diffs sent as part of the email body. This adds support for the following three ENV variables:
- **MCOLOR_DIFF_I**: For (I)nserted lines.
- **MCOLOR_DIFF_D**: For (D)eleted lines
- **MCOLOR_DIFF_R**: For file (R)anges
Since the default theme is quite bright, these default to bright colors as well (Green1, Red1 and Yellow1 from the 256 XTerm colors respectively).
A patch file from https://github.com/leahneukirchen/mblaze/pull/249.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-249.patch --]
[-- Type: text/x-diff, Size: 1309 bytes --]
From 4744bfc55aac0ebd557ad6974d1793438ea75501 Mon Sep 17 00:00:00 2001
From: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Date: Thu, 5 Oct 2023 15:39:46 +0200
Subject: [PATCH] mcolor: Add coloring support for diffs
---
mcolor | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mcolor b/mcolor
index ba2c42c..6e3417f 100755
--- a/mcolor
+++ b/mcolor
@@ -8,14 +8,18 @@ BEGIN { hdr = 1; if ("NO_COLOR" in ENVIRON || match(ENVIRON["TERM"], "^(dumb|net
no_color { print; next }
/\r$/ { sub(/\r$/, "") }
/^\014$/ { nextmail = 1; print(fg(co("FF",232), $0)); next }
-/^$/ { hdr = 0 }
+/^$/ { hdr = 0; diff = 0 }
/^-- $/ { ftr = 1 }
+/^diff -/ { diff = 1 }
/^--- .* ---/ { print fg(co("SEP",242), $0); ftr = 0; sig = 0; next }
/^-----BEGIN .* SIGNATURE-----/ { sig = 1 }
nextmail && /^From:/ { hdr = 1 }
hdr && /^From:/ { print so(fg(co("FROM",119), $0)); next }
hdr { print fg(co("HEADER",120), $0); next }
ftr { print fg(co("FOOTER",244), $0); next }
+diff && /^-/ { print fg(co("DIFF_D",160), $0); next }
+diff && /^\+/ { print fg(co("DIFF_I",40), $0); next }
+diff && /^@/ { print fg(co("DIFF_R",226), $0); next }
/^-----BEGIN .* MESSAGE-----/ ||
/^-----END .* SIGNATURE-----/ { print fg(co("SIG",244), $0); sig = 0; next }
sig { print fg(co("SIG",244), $0); next }
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mcolor: Add coloring support for diffs
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
` (6 preceding siblings ...)
2023-10-05 15:40 ` [PR PATCH] [Updated] " thyssentishman
@ 2023-10-05 15:43 ` thyssentishman
2023-10-05 15:43 ` [PR PATCH] [Closed]: " leahneukirchen
2023-10-05 15:44 ` thyssentishman
9 siblings, 0 replies; 11+ messages in thread
From: thyssentishman @ 2023-10-05 15:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 229 bytes --]
New comment by thyssentishman on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/249#issuecomment-1749162761
Comment:
> I think less bright is better tho, make it 160 and 40.
Yeah that seems better. Updated.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PR PATCH] [Closed]: mcolor: Add coloring support for diffs
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
` (7 preceding siblings ...)
2023-10-05 15:43 ` thyssentishman
@ 2023-10-05 15:43 ` leahneukirchen
2023-10-05 15:44 ` thyssentishman
9 siblings, 0 replies; 11+ messages in thread
From: leahneukirchen @ 2023-10-05 15:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 549 bytes --]
There's a closed pull request on the mblaze repository
mcolor: Add coloring support for diffs
https://github.com/leahneukirchen/mblaze/pull/249
Description:
Add coloring for diffs sent as part of the email body. This adds support for the following three ENV variables:
- **MCOLOR_DIFF_I**: For (I)nserted lines.
- **MCOLOR_DIFF_D**: For (D)eleted lines
- **MCOLOR_DIFF_R**: For file (R)anges
Since the default theme is quite bright, these default to bright colors as well (Green1, Red1 and Yellow1 from the 256 XTerm colors respectively).
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mcolor: Add coloring support for diffs
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
` (8 preceding siblings ...)
2023-10-05 15:43 ` [PR PATCH] [Closed]: " leahneukirchen
@ 2023-10-05 15:44 ` thyssentishman
9 siblings, 0 replies; 11+ messages in thread
From: thyssentishman @ 2023-10-05 15:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 146 bytes --]
New comment by thyssentishman on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/249#issuecomment-1749165410
Comment:
Thanks :)
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-10-05 15:44 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
2023-10-05 14:33 ` leahneukirchen
2023-10-05 14:36 ` leahneukirchen
2023-10-05 14:38 ` leahneukirchen
2023-10-05 15:24 ` [PR PATCH] [Updated] " thyssentishman
2023-10-05 15:24 ` thyssentishman
2023-10-05 15:34 ` leahneukirchen
2023-10-05 15:40 ` [PR PATCH] [Updated] " thyssentishman
2023-10-05 15:43 ` thyssentishman
2023-10-05 15:43 ` [PR PATCH] [Closed]: " leahneukirchen
2023-10-05 15:44 ` thyssentishman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).