changeset 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
files hgext/color.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Thu Oct 13 11:48:17 2016 -0700
+++ b/hgext/color.py	Thu Oct 13 12:01:41 2016 -0700
@@ -378,7 +378,10 @@
     if effect.endswith('_background'):
         bg = True
         effect = effect[:-11]
-    attr, val, termcode = _terminfo_params[effect]
+    try:
+        attr, val, termcode = _terminfo_params[effect]
+    except KeyError:
+        return ''
     if attr:
         if termcode:
             return termcode