diff options
author | Johannes Thyssen Tishman <johannes@thyssentishman.com> | 2023-10-05 15:39:46 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2023-10-05 17:42:59 +0200 |
commit | 5310c4ea38a99e99c2c6c944e651bbc8e72a3d92 (patch) | |
tree | dd8a7c740f494a639da61bed2271540c902dacdb /mcolor | |
parent | 59ee2e0ab9f6721ffb6e0b686582d1d121b7a6cf (diff) | |
download | mblaze-5310c4ea38a99e99c2c6c944e651bbc8e72a3d92.tar.gz mblaze-5310c4ea38a99e99c2c6c944e651bbc8e72a3d92.tar.xz mblaze-5310c4ea38a99e99c2c6c944e651bbc8e72a3d92.zip |
mcolor: Add coloring support for diffs
Closes: #249 [via git-merge-pr]
Diffstat (limited to 'mcolor')
-rwxr-xr-x | mcolor | 6 |
1 files changed, 5 insertions, 1 deletions
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 } |