From d16095c8560cbaae1020a8e84494b8877bfe36f5 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 13 Oct 2015 10:35:19 -0700 Subject: Add forgotten file from previous commit. --- lib/spack/llnl/util/tty/color.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/spack/llnl/util/tty/color.py') diff --git a/lib/spack/llnl/util/tty/color.py b/lib/spack/llnl/util/tty/color.py index 22080a7b37..0d09303da0 100644 --- a/lib/spack/llnl/util/tty/color.py +++ b/lib/spack/llnl/util/tty/color.py @@ -158,6 +158,11 @@ def clen(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))) + + def cwrite(string, stream=sys.stdout, color=None): """Replace all color expressions in string with ANSI control codes and write the result to the stream. If color is -- cgit v1.2.3-60-g2f50