Fix pane border overflow

This commit is contained in:
Philip Henning 2025-08-13 16:16:53 +02:00
parent a24041d664
commit 0bcb821c33
2 changed files with 44 additions and 6 deletions

View file

@ -42,9 +42,27 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case tea.WindowSizeMsg:
m.width = msg.Width
m.height = msg.Height - 1
m.list.SetSize(msg.Width/2, m.height)
m.detail.Width = msg.Width - msg.Width/2
m.detail.Height = m.height
leftWidth := msg.Width / 2
rightWidth := msg.Width - leftWidth
leftHeight := m.height
rightHeight := m.height
if m.focus == listPane {
leftWidth -= 2
leftHeight -= 2
} else {
rightWidth -= 2
rightHeight -= 2
}
leftWidth -= 2
rightWidth -= 2
m.list.SetSize(leftWidth, leftHeight)
m.detail.Width = rightWidth
m.detail.Height = rightHeight
if m.focus == listPane {
m.list, cmd = m.list.Update(msg)
}