From: Junio C Hamano <gitster@pobox.com>
To: Andy Koppe <andy.koppe@gmail.com>
Cc: git@vger.kernel.org, "Jeff King" <peff@peff.net>,
"René Scharfe" <l.s.r@web.de>
Subject: Re: [PATCH] pretty: fix lost and leaked colors at line breaks
Date: Mon, 16 Nov 2026 08:25:13 -0800 [thread overview]
Message-ID: <xmqq4idgn3py.fsf@gitster.g> (raw)
In-Reply-To: <2f9f835e3f99d7de5bbf51be2e8ef4dc0485a46e.1794778250.git.andy.koppe@gmail.com> (Andy Koppe's message of "Sun, 15 Nov 2026 21:35:03 +0000")
Andy Koppe <andy.koppe@gmail.com> writes:
> Colors in custom log formats remain in effect until reset, including
> across line breaks. Lines therefore don't necessarily set their own
> colors, nor reset them at their end, which leads to two problems.
>
> Firstly, lines that continue colors from preceding lines lose them when
> shown without that context. Notably, --graph and color-aware pagers such
> as less reset colors at line breaks, so for example "%C(bold)%w(72)%s"
> only makes the first line of a wrapped subject bold, and "%C(cyan)%b"
> only colors the first line of the message body.
And custom format writers have no way to control what happens at the
(artificial) line boundary that wrapping at 72 columns %w(72)
introduces, %b may include many lines but there is nothing for them
to say "at the end of each and every line, do this". And that is
why you decided that runtime detection is the only way to do this to
help custom formats?
OK. My initial reaction to the "let's do the same as the default
format output" was "isn't that the responsibility of those who write
their own custom format?", but there clearly is a gap in the custom
format feature that makes it impossible for them to do so.
> The same can happen to
> lines picked out by grepping colored output.
I am not sure if that is a problem.
> Secondly, colors that are still active at the end of a line can leak
> into what follows.
That somehow feels contradictory with the previous point, though.
next prev parent reply other threads:[~2026-11-16 16:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 21:35 [PATCH] pretty: fix lost and leaked colors at line breaks Andy Koppe
2026-11-16 16:25 ` Junio C Hamano [this message]
2026-11-17 0:12 ` Andy Koppe
2026-11-17 0:00 ` [PATCH v2] " Andy Koppe
2026-11-17 9:10 ` [PATCH v3] " Andy Koppe
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=xmqq4idgn3py.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=andy.koppe@gmail.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=peff@peff.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.