fix(tui): pin footer to bottom of terminal
Replace string concatenation layout with lipgloss.JoinVertical and fixed-height content area. Footer now stays at the same vertical position regardless of tab content height. Uses lipgloss.Height() to dynamically measure header/footer and fill remaining space.
This commit is contained in:
@@ -173,11 +173,20 @@ func (m Model) viewDashboard() string {
|
||||
|
||||
footer := m.renderFooter(stats)
|
||||
|
||||
s := lipgloss.NewStyle().Padding(1, 2)
|
||||
if m.termHeight > 0 {
|
||||
s = s.MaxHeight(m.termHeight)
|
||||
outerPad := lipgloss.NewStyle().Padding(1, 2)
|
||||
_, frameV := outerPad.GetFrameSize()
|
||||
availHeight := m.termHeight - frameV
|
||||
if availHeight < 5 {
|
||||
availHeight = 5
|
||||
}
|
||||
return s.Render(header + "\n" + content + "\n" + footer)
|
||||
|
||||
contentHeight := availHeight - lipgloss.Height(header) - lipgloss.Height(footer) - 2
|
||||
if contentHeight < 1 {
|
||||
contentHeight = 1
|
||||
}
|
||||
paddedContent := lipgloss.NewStyle().Height(contentHeight).Render(content)
|
||||
|
||||
return outerPad.Render(lipgloss.JoinVertical(lipgloss.Top, header, paddedContent, footer))
|
||||
}
|
||||
|
||||
func (m Model) renderTabBar(stats dashboardStats) string {
|
||||
|
||||
Reference in New Issue
Block a user