diff options
| author | adamdottv <[email protected]> | 2025-06-20 11:25:21 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-06-20 11:25:21 -0500 |
| commit | 9ea0d71e8df92a168d9b922043e3da161bb7d613 (patch) | |
| tree | c5b069a52a0add76b53444549e6a26f5be4f5e08 | |
| parent | b1a3599017893cff4720a6daca2f95ad9f869130 (diff) | |
| download | opencode-9ea0d71e8df92a168d9b922043e3da161bb7d613.tar.gz opencode-9ea0d71e8df92a168d9b922043e3da161bb7d613.zip | |
fix(tui): async load messages on theme/session switch
| -rw-r--r-- | packages/tui/internal/components/chat/messages.go | 12 | ||||
| -rw-r--r-- | packages/tui/internal/components/commands/commands.go | 5 |
2 files changed, 10 insertions, 7 deletions
diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.go index 6130ce090..3c5e88c20 100644 --- a/packages/tui/internal/components/chat/messages.go +++ b/packages/tui/internal/components/chat/messages.go @@ -60,17 +60,14 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, nil case dialog.ThemeSelectedMsg: m.cache.Clear() - m.renderView() - return m, nil + return m, m.Reload() case ToggleToolDetailsMsg: m.showToolDetails = !m.showToolDetails - m.renderView() - return m, nil + return m, m.Reload() case app.SessionSelectedMsg: m.cache.Clear() - cmd := m.Reload() - m.viewport.GotoBottom() - return m, cmd + m.tail = true + return m, m.Reload() case app.SessionClearedMsg: m.cache.Clear() cmd := m.Reload() @@ -346,6 +343,7 @@ func (m *messagesComponent) home() string { logoAndVersion, lipgloss.WithWhitespaceStyle(lipgloss.NewStyle().Background(t.Background())), ) + m.commands.SetBackgroundColor(t.Background()) commands := lipgloss.PlaceHorizontal( m.width, lipgloss.Center, diff --git a/packages/tui/internal/components/commands/commands.go b/packages/tui/internal/components/commands/commands.go index 75b27779b..e7b1771f8 100644 --- a/packages/tui/internal/components/commands/commands.go +++ b/packages/tui/internal/components/commands/commands.go @@ -18,6 +18,7 @@ type CommandsComponent interface { tea.Model tea.ViewModel layout.Sizeable + SetBackgroundColor(color compat.AdaptiveColor) } type commandsComponent struct { @@ -38,6 +39,10 @@ func (c *commandsComponent) GetSize() (int, int) { return c.width, c.height } +func (c *commandsComponent) SetBackgroundColor(color compat.AdaptiveColor) { + c.background = &color +} + func (c *commandsComponent) Init() tea.Cmd { return nil } |
