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:
@@ -340,7 +340,8 @@ func renderCard(e *db.Entity, maxWidth int) string {
|
||||
line := fmt.Sprintf("%s %s%s%s%s", glyph, body, affordStr, extraStr, useStr)
|
||||
|
||||
if maxWidth > 0 && len(stripAnsi(line)) > maxWidth {
|
||||
body = truncate(body, maxWidth-8)
|
||||
overhead := len(stripAnsi(line)) - len([]rune(body))
|
||||
body = truncate(body, maxWidth-overhead)
|
||||
line = fmt.Sprintf("%s %s%s%s%s", glyph, body, affordStr, extraStr, useStr)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user