tui: Error handling tweak
Moved errors to bottom of screen, fix infinite loop by typing errors properly
This commit is contained in:
@@ -91,7 +91,8 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
m.activeView = shared.View(msg)
|
||||
return m, tea.Batch(tea.WindowSize(), shared.ViewEnter())
|
||||
case shared.MsgError:
|
||||
m.errs = append(m.errs, msg)
|
||||
m.errs = append(m.errs, msg.Err)
|
||||
return m, nil
|
||||
}
|
||||
|
||||
view, cmd := m.views[m.activeView].Update(msg)
|
||||
@@ -124,12 +125,12 @@ func (m *Model) View() string {
|
||||
if content != "" {
|
||||
sections = append(sections, content)
|
||||
}
|
||||
if len(errBanners) > 0 {
|
||||
sections = append(sections, lipgloss.JoinVertical(lipgloss.Left, errBanners...))
|
||||
}
|
||||
if footer != "" {
|
||||
sections = append(sections, footer)
|
||||
}
|
||||
for _, errBanner := range errBanners {
|
||||
sections = append(sections, errBanner)
|
||||
}
|
||||
return lipgloss.JoinVertical(lipgloss.Left, sections...)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user