fix: Update detailsViewport dimensions in Update loop to ensure scrollability
This commit is contained in:
@@ -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...)
|
||||
|
||||
Reference in New Issue
Block a user