(s: str)
| 16 | |
| 17 | |
| 18 | def wlen(s: str) -> int: |
| 19 | if len(s) == 1 and s != '\x1a': |
| 20 | return str_width(s) |
| 21 | length = sum(str_width(i) for i in s) |
| 22 | # remove lengths of any escape sequences |
| 23 | sequence = ANSI_ESCAPE_SEQUENCE.findall(s) |
| 24 | ctrl_z_cnt = s.count('\x1a') |
| 25 | return length - sum(len(i) for i in sequence) + ctrl_z_cnt |
no test coverage detected