Re: [PATCH v2 3/3] for-each-ref: introduce %(color:...) for color
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Nov 18, 2013, 16:45 UTC
- Message-ID
- <CALkWK0ngKTkFbaq7NzCW7T3KyfmWxpDEv8TLj05LoThob1fpFg@mail.gmail.com>
- In-Reply-To
- <xmqq4n79d6f1.fsf@gitster.dls.corp.google.com>
Junio C Hamano wrote:
Show 9 quoted lines
> 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.
Show 9 quoted lines
> 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.