From 8dca80032e6fab9d2e656d8980a805c9e44abbeb Mon Sep 17 00:00:00 2001 From: Johannes Thyssen Tishman 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 }