diff --git a/internal/tui/model.go b/internal/tui/model.go index a29b6b5..a921b01 100644 --- a/internal/tui/model.go +++ b/internal/tui/model.go @@ -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.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...)