Custom len that gets console column width for wide and non-wide characters as well as ignores color codes
(item)
| 2747 | |
| 2748 | @staticmethod |
| 2749 | def _len(item): |
| 2750 | """Custom len that gets console column width for wide |
| 2751 | and non-wide characters as well as ignores color codes""" |
| 2752 | stripped = _strip_ansi(item) |
| 2753 | if wcwidth: |
| 2754 | return wcwidth.wcswidth(stripped) |
| 2755 | else: |
| 2756 | return len(stripped) |
| 2757 | |
| 2758 | def _update_lines(self, lines, new_line): |
| 2759 | """Adds a new line to the list of lines the text is being wrapped into |