Show More
@@ -186,30 +186,6 b' command = cmdutil.command(cmdtable)' | |||||
186 | # leave the attribute unspecified. |
|
186 | # leave the attribute unspecified. | |
187 | testedwith = 'ships-with-hg-core' |
|
187 | testedwith = 'ships-with-hg-core' | |
188 |
|
188 | |||
189 | # start and stop parameters for effects |
|
|||
190 | _effects = {'none': 0, |
|
|||
191 | 'black': 30, |
|
|||
192 | 'red': 31, |
|
|||
193 | 'green': 32, |
|
|||
194 | 'yellow': 33, |
|
|||
195 | 'blue': 34, |
|
|||
196 | 'magenta': 35, |
|
|||
197 | 'cyan': 36, |
|
|||
198 | 'white': 37, |
|
|||
199 | 'bold': 1, |
|
|||
200 | 'italic': 3, |
|
|||
201 | 'underline': 4, |
|
|||
202 | 'inverse': 7, |
|
|||
203 | 'dim': 2, |
|
|||
204 | 'black_background': 40, |
|
|||
205 | 'red_background': 41, |
|
|||
206 | 'green_background': 42, |
|
|||
207 | 'yellow_background': 43, |
|
|||
208 | 'blue_background': 44, |
|
|||
209 | 'purple_background': 45, |
|
|||
210 | 'cyan_background': 46, |
|
|||
211 | 'white_background': 47} |
|
|||
212 |
|
||||
213 | def _terminfosetup(ui, mode): |
|
189 | def _terminfosetup(ui, mode): | |
214 | '''Initialize terminfo data and the terminal if we're in terminfo mode.''' |
|
190 | '''Initialize terminfo data and the terminal if we're in terminfo mode.''' | |
215 |
|
191 | |||
@@ -298,7 +274,7 b' def _modesetup(ui, coloropt):' | |||||
298 | if not w32effects: |
|
274 | if not w32effects: | |
299 | modewarn() |
|
275 | modewarn() | |
300 | return None |
|
276 | return None | |
301 | _effects.update(w32effects) |
|
277 | color._effects.update(w32effects) | |
302 | elif realmode == 'ansi': |
|
278 | elif realmode == 'ansi': | |
303 | _terminfo_params.clear() |
|
279 | _terminfo_params.clear() | |
304 | elif realmode == 'terminfo': |
|
280 | elif realmode == 'terminfo': | |
@@ -365,9 +341,9 b' def render_effects(text, effects):' | |||||
365 | if not text: |
|
341 | if not text: | |
366 | return text |
|
342 | return text | |
367 | if not _terminfo_params: |
|
343 | if not _terminfo_params: | |
368 | start = [str(_effects[e]) for e in ['none'] + effects.split()] |
|
344 | start = [str(color._effects[e]) for e in ['none'] + effects.split()] | |
369 | start = '\033[' + ';'.join(start) + 'm' |
|
345 | start = '\033[' + ';'.join(start) + 'm' | |
370 | stop = '\033[' + str(_effects['none']) + 'm' |
|
346 | stop = '\033[' + str(color._effects['none']) + 'm' | |
371 | else: |
|
347 | else: | |
372 | start = ''.join(_effect_str(effect) |
|
348 | start = ''.join(_effect_str(effect) | |
373 | for effect in ['none'] + effects.split()) |
|
349 | for effect in ['none'] + effects.split()) | |
@@ -377,7 +353,7 b' def render_effects(text, effects):' | |||||
377 | def valideffect(effect): |
|
353 | def valideffect(effect): | |
378 | 'Determine if the effect is valid or not.' |
|
354 | 'Determine if the effect is valid or not.' | |
379 | good = False |
|
355 | good = False | |
380 | if not _terminfo_params and effect in _effects: |
|
356 | if not _terminfo_params and effect in color._effects: | |
381 | good = True |
|
357 | good = True | |
382 | elif effect in _terminfo_params or effect[:-11] in _terminfo_params: |
|
358 | elif effect in _terminfo_params or effect[:-11] in _terminfo_params: | |
383 | good = True |
|
359 | good = True | |
@@ -505,7 +481,7 b' def _debugdisplaycolor(ui):' | |||||
505 | oldstyle = color._styles.copy() |
|
481 | oldstyle = color._styles.copy() | |
506 | try: |
|
482 | try: | |
507 | color._styles.clear() |
|
483 | color._styles.clear() | |
508 | for effect in _effects.keys(): |
|
484 | for effect in color._effects.keys(): | |
509 | color._styles[effect] = effect |
|
485 | color._styles[effect] = effect | |
510 | if _terminfo_params: |
|
486 | if _terminfo_params: | |
511 | for k, v in ui.configitems('color'): |
|
487 | for k, v in ui.configitems('color'): |
@@ -7,6 +7,30 b'' | |||||
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
|
10 | # start and stop parameters for effects | |||
|
11 | _effects = {'none': 0, | |||
|
12 | 'black': 30, | |||
|
13 | 'red': 31, | |||
|
14 | 'green': 32, | |||
|
15 | 'yellow': 33, | |||
|
16 | 'blue': 34, | |||
|
17 | 'magenta': 35, | |||
|
18 | 'cyan': 36, | |||
|
19 | 'white': 37, | |||
|
20 | 'bold': 1, | |||
|
21 | 'italic': 3, | |||
|
22 | 'underline': 4, | |||
|
23 | 'inverse': 7, | |||
|
24 | 'dim': 2, | |||
|
25 | 'black_background': 40, | |||
|
26 | 'red_background': 41, | |||
|
27 | 'green_background': 42, | |||
|
28 | 'yellow_background': 43, | |||
|
29 | 'blue_background': 44, | |||
|
30 | 'purple_background': 45, | |||
|
31 | 'cyan_background': 46, | |||
|
32 | 'white_background': 47} | |||
|
33 | ||||
10 | _styles = {'grep.match': 'red bold', |
|
34 | _styles = {'grep.match': 'red bold', | |
11 | 'grep.linenumber': 'green', |
|
35 | 'grep.linenumber': 'green', | |
12 | 'grep.rev': 'green', |
|
36 | 'grep.rev': 'green', |
General Comments 0
You need to be logged in to leave comments.
Login now