From c9fe59237bac4644a9944e845236439b4d1071e9 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 16 Jan 2019 10:23:53 +0100 Subject: [PATCH] webconfig: Allow \co sgr0 in one more place Some $TERMs like tmux and linux use an sgr0 ("reset") value that ends in \co instead of "m". We need to adjust our regex here to catch that, or we'd miscount lines with it. --- share/tools/web_config/webconfig.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index 7703532e7..5171d22f5 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -290,9 +290,9 @@ def append_html_for_ansi_escape(full_val, result, span_open): def strip_ansi(val): # Make a half-assed effort to strip ANSI control sequences - # We assume that all such sequences start with 0x1b and end with m, + # We assume that all such sequences start with 0x1b and end with m or ctrl-o, # which catches most cases - return re.sub("\x1b[^m]*m", '', val) + return re.sub("\x1b[^m]*m\x0f?", '', val) def ansi_prompt_line_width(val):