fix(tui): center rows per-line, fix footers per-context
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user