comparison hgext/color.py @ 30174:5d777fe4615d

color: ignore effects missing from terminfo If terminfo mode is in effect, and an effect is used which is missing from the terminfo database, simply silently ignore the request, leaving the output unaffected rather than causing a crash.
author Danek Duvall <danek.duvall@oracle.com>
date Thu, 13 Oct 2016 12:01:41 -0700
parents f34a8cff51d9
children 8915c68f3eba
comparison
equal deleted inserted replaced
30173:f34a8cff51d9 30174:5d777fe4615d
376 376
377 bg = False 377 bg = False
378 if effect.endswith('_background'): 378 if effect.endswith('_background'):
379 bg = True 379 bg = True
380 effect = effect[:-11] 380 effect = effect[:-11]
381 attr, val, termcode = _terminfo_params[effect] 381 try:
382 attr, val, termcode = _terminfo_params[effect]
383 except KeyError:
384 return ''
382 if attr: 385 if attr:
383 if termcode: 386 if termcode:
384 return termcode 387 return termcode
385 else: 388 else:
386 return curses.tigetstr(val) 389 return curses.tigetstr(val)