mirror of
https://github.com/shokinn/hosts-go.git
synced 2025-08-23 16:43:02 +00:00
Fix pane border overflow
This commit is contained in:
parent
a24041d664
commit
0bcb821c33
2 changed files with 44 additions and 6 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue