fix(tui): center rows per-line, fix footers per-context

This commit is contained in:
swanadiva
2026-06-23 18:04:11 +07:00
parent e5d32bd22e
commit 9b27388455
7 changed files with 14 additions and 20 deletions
+2 -6
View File
@@ -192,19 +192,15 @@ func (t *HostListTab) View() string {
const sidePad = 6
targetW := contentW + sidePad*2
// Uniform left shift for the row block
rowShift := (targetW - widestRow) / 2
var content strings.Builder
// Centered title
content.WriteString(lipgloss.PlaceHorizontal(targetW, lipgloss.Center, title))
content.WriteString("\n\n")
// Centered rows
shift := strings.Repeat(" ", rowShift)
// Center each row independently within the box
for _, r := range rows[:len(rows)-1] { // exclude footer, added below
line := lipgloss.PlaceHorizontal(targetW, lipgloss.Left, shift+r.text)
line := lipgloss.PlaceHorizontal(targetW, lipgloss.Center, r.text)
content.WriteString(line)
content.WriteString("\n")
}