fix(tui): use panel width for table layout in split-pane mode
Table columns were computed from terminal width, causing row wrapping when the monitors panel only gets 70% of the space. Introduced contentWidth field set per-tab in viewDashboard. computeLayout, isWide, and renderTable now use contentWidth for column visibility, available space, and max table width calculations. Columns gracefully hide (SSL, RETRIES, TYPE, UPTIME) when the panel is narrower, matching the existing responsive breakpoint behavior.
This commit is contained in:
@@ -13,7 +13,11 @@ const (
|
||||
)
|
||||
|
||||
func (m Model) isWide() bool {
|
||||
return m.termWidth >= wideBreakpoint
|
||||
w := m.contentWidth
|
||||
if w == 0 {
|
||||
w = m.termWidth
|
||||
}
|
||||
return w >= wideBreakpoint
|
||||
}
|
||||
|
||||
func (m Model) renderTable(headers []string, items int, buildRows func(start, end int) [][]string, colWidths []int, styleOverride StyleOverride) string {
|
||||
@@ -35,7 +39,11 @@ func (m Model) renderTable(headers []string, items int, buildRows func(start, en
|
||||
}
|
||||
borderOverhead := 2 + len(colWidths) - 1
|
||||
tableWidth := colTotal + borderOverhead
|
||||
maxWidth := m.termWidth - chromePadH - 2
|
||||
cw := m.contentWidth
|
||||
if cw == 0 {
|
||||
cw = m.termWidth
|
||||
}
|
||||
maxWidth := cw - chromePadH - 2
|
||||
if tableWidth > maxWidth {
|
||||
tableWidth = maxWidth
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user