fix: Update detailsViewport dimensions in Update loop to ensure scrollability

This commit is contained in:
Jose Luis Montañes Ojados
2026-01-19 17:06:09 +01:00
parent a02b7533d5
commit f5a2730bc3

View File

@@ -397,6 +397,39 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.viewport.Width = m.width / 2 // Right pane width m.viewport.Width = m.width / 2 // Right pane width
m.viewport.Height = contentHeight m.viewport.Height = contentHeight
// Correctly calculate Split Layout Dimensions for Viewports
// Ideally we should share this logic or calculate it once
totalWidth := m.width
innerW := totalWidth - 2
leftW := innerW / 2
rightW := innerW - leftW
leftTotalH := m.height - 3
leftTopH := leftTotalH / 3
if leftTopH < 10 {
leftTopH = 10
}
leftBotH := leftTotalH - leftTopH
if leftBotH < 0 {
leftBotH = 0
}
// Update Flow Viewport (Right)
rvpHeight := (leftTotalH - 2) - 2 // -2 Borders, -2 Title
if rvpHeight < 0 {
rvpHeight = 0
}
m.viewport.Height = rvpHeight
m.viewport.Width = rightW - 4
// Update Details Viewport (Left Bottom)
vpHeight := (leftBotH - 2) - 2 // -2 Borders, -2 Title
if vpHeight < 0 {
vpHeight = 0
}
m.detailsViewport.Height = vpHeight
m.detailsViewport.Width = leftW - 4
} }
return m, tea.Batch(cmds...) return m, tea.Batch(cmds...)