Re: [PATCH v2 3/3] for-each-ref: introduce %(color:...) for color

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]