diff --git a/eris/eris/tools.py b/eris/eris/tools.py index 67ff6df..ccef2d1 100755 --- a/eris/eris/tools.py +++ b/eris/eris/tools.py @@ -739,24 +739,10 @@ def run_tool_no_error(path, tool): pygments.styles.get_style_by_name(os.environ["PYGMENT_STYLE"])) -def _convert_lscolor_code_to_charstyle(lscolor_code): - parts = lscolor_code.split(";") - if len(parts) == 1: - is_bold = parts[0] == "1" - fg_color = None - elif len(parts) == 2: - is_bold = False - fg_color = int(parts[1]) - else: - is_bold = len(parts) == 4 and parts[3] == "1" - fg_color = int(parts[2]) - return termstr.CharStyle(fg_color=fg_color, is_bold=is_bold) - - def _charstyle_of_path(path): color_code = lscolors.color_code_for_path(path, _LS_COLOR_CODES) - return (termstr.CharStyle() if color_code is None else - _convert_lscolor_code_to_charstyle(color_code)) + term_text = termstr.ESC + "[" + color_code + "m-" + return termstr.TermStr.from_term(term_text).style[0] @functools.lru_cache(maxsize=100)