Mercurial > hg
changeset 31069:cf2bc3792ef4
color: minor simplification of some terminfo setup code
No logic change is introduced. The previous code were using a 'dict.update' with
a complex generator. That was a bit confusing to read and not so compact.
Instead we now use an explicit loop and conditional for the sake of clarity.
This also allow for more simplification coming in the next changeset.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 22 Dec 2016 13:06:53 +0100 |
parents | 27d3bc0c9093 |
children | ebd14a4b03fc |
files | hgext/color.py |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/color.py Thu Dec 22 06:17:40 2016 +0100 +++ b/hgext/color.py Thu Dec 22 13:06:53 2016 +0100 @@ -202,14 +202,15 @@ if mode not in ('auto', 'terminfo'): return - color._terminfo_params.update((key[6:], (False, int(val), '')) - for key, val in ui.configitems('color') - if key.startswith('color.')) - color._terminfo_params.update((key[9:], - (True, '', val.replace('\\E', '\x1b'))) - for key, val in ui.configitems('color') - if key.startswith('terminfo.')) + for key, val in ui.configitems('color'): + if key.startswith('color.'): + newval = (False, int(val), '') + color._terminfo_params[key[6:]] = newval + for key, val in ui.configitems('color'): + if key.startswith('terminfo.'): + newval = (True, '', val.replace('\\E', '\x1b')) + color._terminfo_params[key[9:]] = newval try: curses.setupterm() except curses.error as e: