diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-11-16 09:21:53 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-11-16 09:21:53 -0500 |
commit | a827431b9633f0083bf8dc1b290817d12da0c2cc (patch) | |
tree | 7e6393c393bd10b81dc4a12747323f215adb1101 /cmd2/utils.py | |
parent | 61da7e5f7887f0d163c5d41abcae1209d3ad3580 (diff) | |
download | cmd2-git-a827431b9633f0083bf8dc1b290817d12da0c2cc.tar.gz |
Renamed display_width to ansi_safe_wcswidth
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r-- | cmd2/utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py index 909332ae..a09e8785 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -22,9 +22,10 @@ def strip_ansi(text: str) -> str: return constants.ANSI_ESCAPE_RE.sub('', text) -def display_width(text: str) -> int: +def ansi_safe_wcswidth(text: str) -> int: """ - Return the printable length of a string. This can be different than character count in unicode strings. + Wraps wcswidth to make it compatible with colored strings + :param text: the string being measured """ # Strip ANSI escape codes since they cause wcswidth to return -1 |