Github messages for mblaze
 help / color / mirror / Atom feed
From: thyssentishman <thyssentishman@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] mcolor: Add coloring support for diffs
Date: Thu, 05 Oct 2023 17:24:11 +0200	[thread overview]
Message-ID: <20231005152411.5IBmuovpVTQ7DULUECPCdrJbZpRjMlpVIEjYS49Ol8A@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-249@inbox.vuxu.org>

[-- 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 }

  parent reply	other threads:[~2023-10-05 15:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05 13:59 [PR PATCH] " thyssentishman
2023-10-05 14:33 ` leahneukirchen
2023-10-05 14:36 ` leahneukirchen
2023-10-05 14:38 ` leahneukirchen
2023-10-05 15:24 ` thyssentishman [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231005152411.5IBmuovpVTQ7DULUECPCdrJbZpRjMlpVIEjYS49Ol8A@z \
    --to=thyssentishman@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).