fix(tui): correct viewport sizing and dynamic chrome calculation
Replace hardcoded row offset with counted chrome lines, account for filter bar, and fix log viewport dimensions.
This commit is contained in:
+8
-3
@@ -186,12 +186,17 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
case tea.WindowSizeMsg:
|
case tea.WindowSizeMsg:
|
||||||
m.termWidth = msg.Width
|
m.termWidth = msg.Width
|
||||||
m.termHeight = msg.Height
|
m.termHeight = msg.Height
|
||||||
m.maxTableRows = msg.Height - 12
|
// Chrome: 1 top pad + 1 tabs + 2 newlines + 3 table borders + 1 table header + 1 footer + 1 bottom pad = 10
|
||||||
|
chrome := 10
|
||||||
|
if m.filterText != "" {
|
||||||
|
chrome++
|
||||||
|
}
|
||||||
|
m.maxTableRows = msg.Height - chrome
|
||||||
if m.maxTableRows < 1 {
|
if m.maxTableRows < 1 {
|
||||||
m.maxTableRows = 1
|
m.maxTableRows = 1
|
||||||
}
|
}
|
||||||
m.logViewport.Width = msg.Width
|
m.logViewport.Width = msg.Width - 4
|
||||||
m.logViewport.Height = msg.Height - 6
|
m.logViewport.Height = msg.Height - 8
|
||||||
return m, tea.ClearScreen
|
return m, tea.ClearScreen
|
||||||
|
|
||||||
case time.Time:
|
case time.Time:
|
||||||
|
|||||||
Reference in New Issue
Block a user