From a827431b9633f0083bf8dc1b290817d12da0c2cc Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Fri, 16 Nov 2018 09:21:53 -0500 Subject: Renamed display_width to ansi_safe_wcswidth --- cmd2/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmd2/utils.py') 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 -- cgit v1.2.1