summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-07-19 22:38:36 -0400
committerDax Raad <[email protected]>2025-07-19 22:38:36 -0400
commit6232e0fc580ccd55ce6ba60ca6d23825250d9132 (patch)
treeea49e355a0074917c0fbc667e016ad97190c49fd
parenta8b4aed446c0a249e1b51eb7a4164dc3c433fdb9 (diff)
downloadopencode-6232e0fc580ccd55ce6ba60ca6d23825250d9132.tar.gz
opencode-6232e0fc580ccd55ce6ba60ca6d23825250d9132.zip
fix bad layout on first render of chat history
-rw-r--r--packages/tui/internal/components/chat/messages.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.go
index 932fecf65..05836b25a 100644
--- a/packages/tui/internal/components/chat/messages.go
+++ b/packages/tui/internal/components/chat/messages.go
@@ -67,7 +67,7 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.height = msg.Height - 7
m.viewport.SetWidth(m.width)
m.loading = true
- return m, m.Reload()
+ return m, m.renderView()
case app.SendMsg:
m.viewport.GotoBottom()
m.tail = true
@@ -75,15 +75,15 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case dialog.ThemeSelectedMsg:
m.cache.Clear()
m.loading = true
- return m, m.Reload()
+ return m, m.renderView()
case ToggleToolDetailsMsg:
m.showToolDetails = !m.showToolDetails
- return m, m.Reload()
+ return m, m.renderView()
case app.SessionLoadedMsg, app.SessionClearedMsg:
m.cache.Clear()
m.tail = true
m.loading = true
- return m, m.Reload()
+ return m, m.renderView()
case opencode.EventListResponseEventSessionUpdated:
if msg.Properties.Info.ID == m.app.Session.ID {
@@ -404,7 +404,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
}
content := "\n" + strings.Join(blocks, "\n\n")
- viewport.SetHeight(m.height - lipgloss.Height(m.header))
+ viewport.SetHeight(m.height - lipgloss.Height(header))
viewport.SetContent(content)
if tail {
viewport.GotoBottom()
@@ -585,10 +585,6 @@ func (m *messagesComponent) View() string {
Render(m.header + "\n" + viewport)
}
-func (m *messagesComponent) Reload() tea.Cmd {
- return m.renderView()
-}
-
func (m *messagesComponent) PageUp() (tea.Model, tea.Cmd) {
m.viewport.ViewUp()
return m, nil