wip: refactoring tui

This commit is contained in:
adamdottv 2025-05-30 06:47:44 -05:00
commit 189d0e5fb2
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75
5 changed files with 26 additions and 20 deletions

View file

@ -73,8 +73,8 @@ func (m *messagesCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmd := m.Reload()
return m, cmd
case state.SessionClearedMsg:
m.rendering = false
return m, nil
cmd := m.Reload()
return m, cmd
case tea.KeyMsg:
if key.Matches(msg, messageKeys.PageUp) || key.Matches(msg, messageKeys.PageDown) ||
key.Matches(msg, messageKeys.HalfPageUp) || key.Matches(msg, messageKeys.HalfPageDown) {

View file

@ -74,6 +74,9 @@ func (s *sessionDialogCmp) Init() tea.Cmd {
func (s *sessionDialogCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.WindowSizeMsg:
s.width = msg.Width
s.height = msg.Height
case tea.KeyMsg:
switch {
case key.Matches(msg, sessionKeys.Up) || key.Matches(msg, sessionKeys.K):
@ -98,9 +101,6 @@ func (s *sessionDialogCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case key.Matches(msg, sessionKeys.Escape):
return s, util.CmdHandler(CloseSessionDialogMsg{})
}
case tea.WindowSizeMsg:
s.width = msg.Width
s.height = msg.Height
}
return s, nil
}