aboutsummaryrefslogtreecommitdiff
path: root/app/ui/viewkit.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-28 04:45:29 -0400
committerhistoria <historiavg@proton.me>2026-08-28 04:45:29 -0400
commit5ed31309b6d0db94ccd566914653d367f4577c64 (patch)
treeb909445125629181eb8aa38e4805f672bdaf9c20 /app/ui/viewkit.py
parent0dda9a5921eafd03853d233e077138ff72d64e4d (diff)
downloadtts-audiobook-generator-5ed31309b6d0db94ccd566914653d367f4577c64.tar.gz
fix: japanese characters not truncated correctly in tui terminal output
Diffstat (limited to 'app/ui/viewkit.py')
-rw-r--r--app/ui/viewkit.py8
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: