Private
Public Access
1
0

tui: call handleResize on states before transitioning

This commit is contained in:
2024-04-01 17:05:36 +00:00
parent 9e6d41a3ff
commit 1404cae6a7
3 changed files with 24 additions and 11 deletions

View File

@@ -125,12 +125,15 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, cmd
}
case msgChangeState:
switch msg {
case stateChat:
m.chat.handleResize(m.width, m.height)
case stateConversations:
m.conversations.handleResize(m.width, m.height)
}
m.state = state(msg)
case tea.WindowSizeMsg:
w, h := msg.Width, msg.Height
m.width, m.height = w, h
m.chat.width, m.chat.height = w, h
m.conversations.width, m.conversations.height = w, h
m.width, m.height = msg.Width, msg.Height
case msgError:
m.err = msg
}