From de567222c0386957d47bf824007f90a58e7bcfa7 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 11 Apr 2022 14:11:23 -0600 Subject: [PATCH] Revert failed attempt to fix bash prompt when using colors --- lib/spack/llnl/util/tty/color.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/spack/llnl/util/tty/color.py b/lib/spack/llnl/util/tty/color.py index ebd1a0bbf7629a..99c0a5c7ac71a8 100644 --- a/lib/spack/llnl/util/tty/color.py +++ b/lib/spack/llnl/util/tty/color.py @@ -153,7 +153,7 @@ def __init__(self, color=True): def escape(self, s): """Returns a TTY escape sequence for a color""" if self.color: - return "\[\033[%sm\]" % s + return "\033[%sm" % s else: return '' @@ -207,12 +207,12 @@ def colorize(string, **kwargs): def clen(string): """Return the length of a string, excluding ansi color sequences.""" - return len(re.sub(r'\[\033[^m]*m\]', '', string)) + return len(re.sub(r'\033[^m]*m', '', string)) def cextra(string): """Length of extra color characters in a string""" - return len(''.join(re.findall(r'\[\033[^m]*m\]', string))) + return len(''.join(re.findall(r'\033[^m]*m', string))) def cwrite(string, stream=None, color=None):