git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] for-each-ref: introduce %(color:...) for color
Date: Mon, 18 Nov 2013 22:15:30 +0530	[thread overview]
Message-ID: <CALkWK0ngKTkFbaq7NzCW7T3KyfmWxpDEv8TLj05LoThob1fpFg@mail.gmail.com> (raw)
In-Reply-To: <xmqq4n79d6f1.fsf@gitster.dls.corp.google.com>

Junio C Hamano wrote:
> If you are saying, by after each token, that
>
>         --format='%(color:blue)%(A)literal string%(B)'
>
> should result in
>
>         <color blue> <value for A> <color reset> "literal string" <value for B>
>
> then I would disagree.

Hm, I didn't think it was a bad idea to reset after each token. The
whole point of having color is to make sure that two consecutive
tokens don't have the same color, no? Then again, my scheme would
result in extra unnecessary resets like

  %(color:blue)%(A)%(color:green)%(B)

being turned into:

  %(color:blue)%(A)%(color:reset)%(color:green)%(B)%(color:reset)

Here, the first %(color:reset) is completely unnecessary.

> I was suggesting it to instead produce
>
>         <color blue> <value for A> "literal string" <value for B> <color reset>
>
> where the <color reset> always comes when some color is used and we
> hit the end of the format string. A bonus point if we can make it so
> that we emit the final reset only when the last "%(color:some)" is
> not "%(color:reset)", but unconditional "reset if we ever used
> color" is fine.

Okay, a simple don't-leak-color. I'll submit another iteration soon.

Thanks.

      reply	other threads:[~2013-11-18 16:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-13  9:36 [PATCH v2 0/3] Minor f-e-r enhacements Ramkumar Ramachandra
2013-11-13  9:36 ` [PATCH v2 1/3] for-each-ref: introduce %(HEAD) asterisk marker Ramkumar Ramachandra
2013-11-13  9:36 ` [PATCH v2 2/3] for-each-ref: introduce %(upstream:track[short]) Ramkumar Ramachandra
2013-11-13 19:42   ` Junio C Hamano
2013-11-13 19:44     ` Junio C Hamano
2013-11-14  6:53     ` Ramkumar Ramachandra
2013-11-13  9:36 ` [PATCH v2 3/3] for-each-ref: introduce %(color:...) for color Ramkumar Ramachandra
2013-11-13 20:01   ` Junio C Hamano
2013-11-13 20:19     ` Junio C Hamano
2013-11-14  7:03       ` Ramkumar Ramachandra
2013-11-18 16:24         ` Junio C Hamano
2013-11-18 16:45           ` Ramkumar Ramachandra [this message]

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=CALkWK0ngKTkFbaq7NzCW7T3KyfmWxpDEv8TLj05LoThob1fpFg@mail.gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).