# HG changeset patch
# User Danek Duvall <danek.duv...@oracle.com>
# Date 1476385301 25200
#      Thu Oct 13 12:01:41 2016 -0700
# Node ID 333e875ce30da3760c8655e303d9bea554efe7e4
# Parent  61e74a19770c2ce80c0cedc429915112261e5c1b
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.

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -369,7 +369,10 @@ def _effect_str(effect):
     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
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to