From f5a2730bc338ad68d9410c02ed1e62dfc6643af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Luis=20Monta=C3=B1es=20Ojados?= Date: Mon, 19 Jan 2026 17:06:09 +0100 Subject: [PATCH] fix: Update detailsViewport dimensions in Update loop to ensure scrollability --- internal/tui/model.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) 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...)