[PATCH] color: bring back colors with pager

Christian Ebert blacktrash at gmx.net
Tue May 18 05:10:20 CDT 2010


* Yuya Nishihara on Tuesday, May 18, 2010 at 19:00:22 +0900
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1274176514 -32400
> # Node ID 7e30407ff76d2580db589021741c00d4fbd0ddee
> # Parent  c45a47bc41148b6037cd7337c4529a5e67b92222
> color: bring back colors with pager
> 
> It's introduced by 3c368a1c962d, but missing in merge changeset
> at a890cc501501.
> 
> diff --git a/hgext/color.py b/hgext/color.py
> --- a/hgext/color.py
> +++ b/hgext/color.py
> @@ -198,10 +198,14 @@ def uisetup(ui):
>         _effects.update(w32effects)
>     elif mode != 'ansi':
>         return
> +
> +    # check isatty() before anything else changes it (like pager)
> +    isatty = sys.__stdout__.isatty()
> +
>     def colorcmd(orig, ui_, opts, cmd, cmdfunc):
>         if (opts['color'] == 'always' or
>             (opts['color'] == 'auto' and (os.environ.get('TERM') != 'dumb'
> -                                          and sys.__stdout__.isatty()))):
> +                                          and isatty))):
>             global _buffers
>             _buffers = ui_._buffers
>             extensions.wrapfunction(ui_, 'popbuffer', popbuffer)

Yes, this fixes it. Thank you.

c
-- 
theatre - books - texts - movies
Black Trash Productions at home: http://www.blacktrash.org/
Black Trash Productions on Facebook:
http://www.facebook.com/blacktrashproductions


More information about the Mercurial-devel mailing list