Get the cell length of a string (length as it appears in the terminal). Args: text: String to measure. unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version. Returns: Length of string in terminal cells.
(text: str, unicode_version: str = "auto")
| 96 | |
| 97 | |
| 98 | def cell_len(text: str, unicode_version: str = "auto") -> int: |
| 99 | """Get the cell length of a string (length as it appears in the terminal). |
| 100 | |
| 101 | Args: |
| 102 | text: String to measure. |
| 103 | unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version. |
| 104 | |
| 105 | Returns: |
| 106 | Length of string in terminal cells. |
| 107 | """ |
| 108 | if len(text) < 512: |
| 109 | return cached_cell_len(text, unicode_version) |
| 110 | return _cell_len(text, unicode_version) |
| 111 | |
| 112 | |
| 113 | def _cell_len(text: str, unicode_version: str) -> int: |