Re: 'git log' escape symbols shown as ESC[33 and ESC[m
- From
Jeff King <peff@peff.net>
- Date
- Feb 5, 2014, 01:33 UTC
- Message-ID
- <20140205013330.GB3923@sigill.intra.peff.net>
- In-Reply-To
- <52F192E7.1000301@rawbw.com>
On Tue, Feb 04, 2014 at 05:24:55PM -0800, Yuri wrote:
> I think the 'experimental' approach is simpler and better. > When the git command requiring pager is first run, git would run the > pager with some simple one line escape sequence, and see if sequence > is preserved.
See how? If less's stdout is not connected to a terminal, it simply passes through the output as-is. E.g., try:
foo() {
# blue foo
printf '\x1b[34mfoo\x1b[m'
}unset LESS foo | less
which has the problematic output. Now try:
foo | less | cat
which passes through the ANSI codes unscathed. I have no idea how other pagers behave. So I think this is going back down the road of hard-coding lots of pager-specific behaviors.
-Peff