fix(tui): size NAME column to actual content, surplus goes to sparkline
Compute max monitor name length and cap NAME column to that + 4 (icon/padding). Extra space goes to HISTORY sparkline instead of dead whitespace.
This commit is contained in:
@@ -374,8 +374,19 @@ func (m Model) computeLayout() tableLayout {
|
||||
fixedMin += c.minWidth
|
||||
}
|
||||
|
||||
maxName := 0
|
||||
for _, s := range m.sites {
|
||||
if n := len([]rune(s.Name)); n > maxName {
|
||||
maxName = n
|
||||
}
|
||||
}
|
||||
maxName += 4 // icon + padding + error preview room
|
||||
|
||||
avail := usable - fixedMin
|
||||
nameW := avail / 2
|
||||
if nameW > maxName {
|
||||
nameW = maxName
|
||||
}
|
||||
sparkW := avail - nameW - 2
|
||||
|
||||
if nameW < 13 {
|
||||
|
||||
Reference in New Issue
Block a user