From 36e57eb6382e6438e0812b609682892f6743b0d8 Mon Sep 17 00:00:00 2001 From: Danek Duvall Date: Thu, 13 Oct 2016 12:01:41 -0700 Subject: [PATCH] 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hgext/color.py b/hgext/color.py index 7cb41c8da1..798dbb903a 100644 --- a/hgext/color.py +++ b/hgext/color.py @@ -378,7 +378,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