fix(tui): compute truncation budget from actual overhead, not magic numbers

Tags wrapped past pane edge when detail split narrowed the list.
Truncation used fixed constants that didn't account for real tag width.
Now measures everything-except-body and gives body exactly what remains.
This commit is contained in:
2026-05-20 18:49:38 -04:00
parent 3eb778f31b
commit 989aa86679
3 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -231,7 +231,8 @@ func renderEntity(e *db.Entity, maxWidth int) string {
line := fmt.Sprintf("%s %s%s", glyph, body, extraStr)
if maxWidth > 0 && len(stripAnsi(line)) > maxWidth {
body = truncate(body, maxWidth-6)
overhead := len(stripAnsi(line)) - len([]rune(body))
body = truncate(body, maxWidth-overhead)
line = fmt.Sprintf("%s %s%s", glyph, body, extraStr)
}