From 8743961301f82a200ee1c15fba9d611544952488 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Mon, 21 Jan 2019 13:59:36 -0800 Subject: [PATCH] Fix fish_config rendering brights as normal on prompt previews I noticed our default brgreen for fish_color_user was rendering as just unstyled white. --- share/tools/web_config/fishconfig.css | 1 + share/tools/web_config/webconfig.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/share/tools/web_config/fishconfig.css b/share/tools/web_config/fishconfig.css index ca74fa570..34eafd050 100644 --- a/share/tools/web_config/fishconfig.css +++ b/share/tools/web_config/fishconfig.css @@ -474,6 +474,7 @@ img.delete_icon { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + color: #c0c0c0; /* set_color normal, assume white (not brwhite) */ } .prompt_demo { diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index 5171d22f5..c6aa3a5ba 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -19,6 +19,7 @@ import socket import string import subprocess import sys +from itertools import chain FISH_BIN_PATH = False # will be set later IS_PY2 = sys.version_info[0] == 2 @@ -252,7 +253,6 @@ def get_special_ansi_escapes(): def append_html_for_ansi_escape(full_val, result, span_open): - # Strip off the initial \x1b[ and terminating m val = full_val[2:-1] @@ -269,10 +269,10 @@ def append_html_for_ansi_escape(full_val, result, span_open): result.append('') return True # span now open - # term8 foreground color - if val in [str(x) for x in range(30, 38)]: + # term16 foreground color + if val in (str(x) for x in chain(range(90, 97), range(30, 38))): close_span() - html_color = html_color_for_ansi_color_index(int(val) - 30) + html_color = html_color_for_ansi_color_index(int(val) - (30 if int(val) < 90 else 82)) result.append('') return True # span now open @@ -282,7 +282,7 @@ def append_html_for_ansi_escape(full_val, result, span_open): close_span() return False - # We don't handle bold or underline yet + # TODO We don't handle bold, underline, italics, dim, or reverse yet # Do nothing on failure return span_open