[PATCH 2 of 4] color: stop mutating the default effects map

Matt Harbison mharbison72 at gmail.com
Sun Mar 26 13:27:57 EDT 2017


On Sun, 26 Mar 2017 10:35:34 -0400, Yuya Nishihara <yuya at tcha.org> wrote:

> On Sun, 26 Mar 2017 00:41:05 -0400, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison at yahoo.com>
>> # Date 1490464217 14400
>> #      Sat Mar 25 13:50:17 2017 -0400
>> # Node ID a263702b064a5a3ce1ca74b227e8e624e4b05874
>> # Parent  22533c3af63d5a67d9210596eafd4b99ab9c7904
>> color: stop mutating the default effects map
>
> I re-read the code, and noticed that both _effects and w32effects are  
> mostly
> constants. Perhaps we can simply switch them by ui._colormode.
>
>   if ui._colormode == 'win32':
>       activeeffects = w32neffects
>   else:
>       activeeffects = _effects
>   ... embed escape sequences by using activeeffects ...

Will we get into trouble with each ui instance having a _colormode, but  
the activeeffects map effectively being global?  I don't fully understand  
the purpose of all the separate ui objects.


More information about the Mercurial-devel mailing list