mirror of
https://github.com/sst/opencode.git
synced 2025-08-04 13:30:52 +00:00
fix bad layout on first render of chat history
This commit is contained in:
parent
a8b4aed446
commit
6232e0fc58
1 changed files with 5 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue