fix(tui): account for cell padding in NAME column content limits
Group icons, tree prefixes (├/└), and regular names all need 2 extra chars margin for cell padding. Reduces truncation limits by 2 across all name rendering paths.
This commit is contained in:
@@ -438,7 +438,7 @@ func (m Model) viewSitesTab() string {
|
|||||||
icon := typeIcon("group", m.collapsed[site.ID])
|
icon := typeIcon("group", m.collapsed[site.ID])
|
||||||
rows = append(rows, []string{
|
rows = append(rows, []string{
|
||||||
strconv.Itoa(i + 1),
|
strconv.Itoa(i + 1),
|
||||||
m.zones.Mark(fmt.Sprintf("site-%d", i), icon+" "+limitStr(site.Name, nameW-2)),
|
m.zones.Mark(fmt.Sprintf("site-%d", i), icon+" "+limitStr(site.Name, nameW-4)),
|
||||||
"group",
|
"group",
|
||||||
fmtStatus(site.Status, site.Paused, m.isMonitorInMaintenance(site.ID)),
|
fmtStatus(site.Status, site.Paused, m.isMonitorInMaintenance(site.ID)),
|
||||||
subtleStyle.Render("—"),
|
subtleStyle.Render("—"),
|
||||||
@@ -456,14 +456,14 @@ func (m Model) viewSitesTab() string {
|
|||||||
if i+1 >= len(m.sites) || m.sites[i+1].ParentID != site.ParentID {
|
if i+1 >= len(m.sites) || m.sites[i+1].ParentID != site.ParentID {
|
||||||
prefix = "└"
|
prefix = "└"
|
||||||
}
|
}
|
||||||
name = prefix + " " + limitStr(name, nameW-2)
|
name = prefix + " " + limitStr(name, nameW-4)
|
||||||
} else {
|
} else {
|
||||||
name = limitStr(name, nameW)
|
name = limitStr(name, nameW-2)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (site.Status == "DOWN" || site.Status == "SSL EXP" || site.Status == "LATE") && site.LastError != "" {
|
if (site.Status == "DOWN" || site.Status == "SSL EXP" || site.Status == "LATE") && site.LastError != "" {
|
||||||
nameLen := len([]rune(name))
|
nameLen := len([]rune(name))
|
||||||
errSpace := nameW - nameLen - 1
|
errSpace := nameW - nameLen - 3
|
||||||
if errSpace > 10 {
|
if errSpace > 10 {
|
||||||
name = name + " " + subtleStyle.Render(limitStr(site.LastError, errSpace))
|
name = name + " " + subtleStyle.Render(limitStr(site.LastError, errSpace))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user