diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-12-19 16:04:06 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-12-19 16:04:06 -0500 |
commit | 801bab847341fb9a35d10f1d0b4a629a4fc8f14c (patch) | |
tree | 889c2d21f0922e68b0c880a6c0c9b3e83c307cd1 /cmd2/utils.py | |
parent | e13fc34e6f7d9e67422595411b62ff12b8bf769b (diff) | |
download | cmd2-git-801bab847341fb9a35d10f1d0b4a629a4fc8f14c.tar.gz |
Changed allow_ansi to allow_style for accuracy in what types of ANSI escape sequences are handled
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r-- | cmd2/utils.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py index 9dd7a30b..ddb9f3b5 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -641,7 +641,7 @@ def align_text(text: str, alignment: TextAlignment, *, fill_char: str = ' ', width: Optional[int] = None, tab_width: int = 4) -> str: """ Align text for display within a given width. Supports characters with display widths greater than 1. - ANSI escape sequences are safely ignored and do not count toward the display width. This means colored text is + ANSI style sequences are safely ignored and do not count toward the display width. This means colored text is supported. If text has line breaks, then each line is aligned independently. There are convenience wrappers around this function: align_left(), align_center(), and align_right() @@ -688,7 +688,7 @@ def align_text(text: str, alignment: TextAlignment, *, fill_char: str = ' ', text_buf.write('\n') # Use ansi_safe_wcswidth to support characters with display widths - # greater than 1 as well as ANSI escape sequences + # greater than 1 as well as ANSI style sequences line_width = ansi.ansi_safe_wcswidth(line) if line_width == -1: raise(ValueError("Text to align contains an unprintable character")) @@ -728,7 +728,7 @@ def align_text(text: str, alignment: TextAlignment, *, fill_char: str = ' ', def align_left(text: str, *, fill_char: str = ' ', width: Optional[int] = None, tab_width: int = 4) -> str: """ Left align text for display within a given width. Supports characters with display widths greater than 1. - ANSI escape sequences are safely ignored and do not count toward the display width. This means colored text is + ANSI style sequences are safely ignored and do not count toward the display width. This means colored text is supported. If text has line breaks, then each line is aligned independently. :param text: text to left align (can contain multiple lines) @@ -746,7 +746,7 @@ def align_left(text: str, *, fill_char: str = ' ', width: Optional[int] = None, def align_center(text: str, *, fill_char: str = ' ', width: Optional[int] = None, tab_width: int = 4) -> str: """ Center text for display within a given width. Supports characters with display widths greater than 1. - ANSI escape sequences are safely ignored and do not count toward the display width. This means colored text is + ANSI style sequences are safely ignored and do not count toward the display width. This means colored text is supported. If text has line breaks, then each line is aligned independently. :param text: text to center (can contain multiple lines) @@ -764,7 +764,7 @@ def align_center(text: str, *, fill_char: str = ' ', width: Optional[int] = None def align_right(text: str, *, fill_char: str = ' ', width: Optional[int] = None, tab_width: int = 4) -> str: """ Right align text for display within a given width. Supports characters with display widths greater than 1. - ANSI escape sequences are safely ignored and do not count toward the display width. This means colored text is + ANSI style sequences are safely ignored and do not count toward the display width. This means colored text is supported. If text has line breaks, then each line is aligned independently. :param text: text to right align (can contain multiple lines) |