color: ignore effects missing from terminfo
authorDanek Duvall <danek.duvall@oracle.com>
Thu, 13 Oct 2016 12:01:41 -0700
changeset 30174 5d777fe4615d
parent 30173 f34a8cff51d9
child 30175 8915c68f3eba
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.
hgext/color.py
--- 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