Skip to content
Snippets Groups Projects
Commit d16095c8 authored by Todd Gamblin's avatar Todd Gamblin
Browse files

Add forgotten file from previous commit.

parent 2c818750
Branches
Tags
No related merge requests found
...@@ -158,6 +158,11 @@ def clen(string): ...@@ -158,6 +158,11 @@ def clen(string):
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)))
def cwrite(string, stream=sys.stdout, color=None): def cwrite(string, stream=sys.stdout, color=None):
"""Replace all color expressions in string with ANSI control """Replace all color expressions in string with ANSI control
codes and write the result to the stream. If color is codes and write the result to the stream. If color is
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment