Show More
@@ -332,22 +332,6 b' def render_effects(text, effects):' | |||
|
332 | 332 | stop = _effect_str('none') |
|
333 | 333 | return ''.join([start, text, stop]) |
|
334 | 334 | |
|
335 | def configstyles(ui): | |
|
336 | for status, cfgeffects in ui.configitems('color'): | |
|
337 | if '.' not in status or status.startswith(('color.', 'terminfo.')): | |
|
338 | continue | |
|
339 | cfgeffects = ui.configlist('color', status) | |
|
340 | if cfgeffects: | |
|
341 | good = [] | |
|
342 | for e in cfgeffects: | |
|
343 | if color.valideffect(e): | |
|
344 | good.append(e) | |
|
345 | else: | |
|
346 | ui.warn(_("ignoring unknown color/effect %r " | |
|
347 | "(configured in color.%s)\n") | |
|
348 | % (e, status)) | |
|
349 | color._styles[status] = ' '.join(good) | |
|
350 | ||
|
351 | 335 | class colorui(uimod.ui): |
|
352 | 336 | _colormode = 'ansi' |
|
353 | 337 | def write(self, *args, **opts): |
@@ -420,7 +404,7 b' def uisetup(ui):' | |||
|
420 | 404 | mode = _modesetup(ui_, opts['color']) |
|
421 | 405 | colorui._colormode = mode |
|
422 | 406 | if mode and mode != 'debug': |
|
423 | configstyles(ui_) | |
|
407 | color.configstyles(ui_) | |
|
424 | 408 | return orig(ui_, opts, cmd, cmdfunc) |
|
425 | 409 | def colorgit(orig, gitsub, commands, env=None, stream=False, cwd=None): |
|
426 | 410 | if gitsub.ui._colormode and len(commands) and commands[0] == "diff": |
@@ -7,6 +7,8 b'' | |||
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | from .i18n import _ | |
|
11 | ||
|
10 | 12 | try: |
|
11 | 13 | import curses |
|
12 | 14 | # Mapping from effect name to terminfo attribute name (or raw code) or |
@@ -114,6 +116,22 b' except ImportError:' | |||
|
114 | 116 | def loadcolortable(ui, extname, colortable): |
|
115 | 117 | _styles.update(colortable) |
|
116 | 118 | |
|
119 | def configstyles(ui): | |
|
120 | for status, cfgeffects in ui.configitems('color'): | |
|
121 | if '.' not in status or status.startswith(('color.', 'terminfo.')): | |
|
122 | continue | |
|
123 | cfgeffects = ui.configlist('color', status) | |
|
124 | if cfgeffects: | |
|
125 | good = [] | |
|
126 | for e in cfgeffects: | |
|
127 | if valideffect(e): | |
|
128 | good.append(e) | |
|
129 | else: | |
|
130 | ui.warn(_("ignoring unknown color/effect %r " | |
|
131 | "(configured in color.%s)\n") | |
|
132 | % (e, status)) | |
|
133 | _styles[status] = ' '.join(good) | |
|
134 | ||
|
117 | 135 | def valideffect(effect): |
|
118 | 136 | 'Determine if the effect is valid or not.' |
|
119 | 137 | return ((not _terminfo_params and effect in _effects) |
General Comments 0
You need to be logged in to leave comments.
Login now