diff options
Diffstat (limited to 'app/ui/viewkit.py')
| -rw-r--r-- | app/ui/viewkit.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/app/ui/viewkit.py b/app/ui/viewkit.py index 301a0af..e54aada 100644 --- a/app/ui/viewkit.py +++ b/app/ui/viewkit.py @@ -217,11 +217,7 @@ def _sep(scr, curses, theme, y, width) -> None: def _fit(text: str, width: int) -> str: """Truncate TEXT to WIDTH columns, appending '~' when cut.""" - if width < 1: - return "" - if len(text) <= width: - return text - return text[: max(0, width - 1)] + "~" + return tui._fit(text, width) def _wrap(text: str, width: int) -> List[str]: @@ -230,7 +226,7 @@ def _wrap(text: str, width: int) -> List[str]: current = "" for word in text.split(): candidate = f"{current} {word}".strip() - if len(candidate) <= max(10, width): + if tui._disp_width(candidate) <= max(10, width): current = candidate else: if current: |
