From 5ed31309b6d0db94ccd566914653d367f4577c64 Mon Sep 17 00:00:00 2001 From: historia Date: Fri, 28 Aug 2026 04:45:29 -0400 Subject: fix: japanese characters not truncated correctly in tui terminal output --- app/ui/viewkit.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'app/ui/viewkit.py') 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: -- cgit v1.2.3