@@ -873,6 +873,7 @@ func (m *UI) appendSessionMessage(msg message.Message) tea.Cmd {
873func (m *UI) updateSessionMessage(msg message.Message) tea.Cmd {
873func (m *UI) updateSessionMessage(msg message.Message) tea.Cmd {
874 var cmds []tea.Cmd
874 var cmds []tea.Cmd
875 existingItem := m.chat.MessageItem(msg.ID)
875 existingItem := m.chat.MessageItem(msg.ID)
876+ atBottom := m.chat.list.AtBottom()
877 if existingItem != nil {
878 if existingItem != nil {
878 if assistantItem, ok := existingItem.(*chat.AssistantMessageItem); ok {
879 if assistantItem, ok := existingItem.(*chat.AssistantMessageItem); ok {
@@ -893,9 +894,6 @@ func (m *UI) updateSessionMessage(msg message.Message) tea.Cmd {
893 if infoItem := m.chat.MessageItem(chat.AssistantInfoID(msg.ID)); infoItem == nil {
894 if infoItem := m.chat.MessageItem(chat.AssistantInfoID(msg.ID)); infoItem == nil {
894 newInfoItem := chat.NewAssistantInfoItem(m.com.Styles, &msg, time.Unix(m.lastUserMessageTime, 0))
895 newInfoItem := chat.NewAssistantInfoItem(m.com.Styles, &msg, time.Unix(m.lastUserMessageTime, 0))
895 m.chat.AppendMessages(newInfoItem)
896 m.chat.AppendMessages(newInfoItem)
896− if cmd := m.chat.ScrollToBottomAndAnimate(); cmd != nil {
897− cmds = append(cmds, cmd)
@@ -922,9 +920,12 @@ func (m *UI) updateSessionMessage(msg message.Message) tea.Cmd {
925 m.chat.AppendMessages(items...)
924 m.chat.AppendMessages(items...)
926− if cmd := m.chat.ScrollToBottomAndAnimate(); cmd != nil {
926+ if cmd := m.chat.ScrollToBottomAndAnimate(); cmd != nil {
927− cmds = append(cmds, cmd)
927+ cmds = append(cmds, cmd)
930 return tea.Batch(cmds...)
931 return tea.Batch(cmds...)
@@ -934,6 +935,7 @@ func (m *UI) updateSessionMessage(msg message.Message) tea.Cmd {
934func (m *UI) handleChildSessionMessage(event pubsub.Event[message.Message]) tea.Cmd {
935func (m *UI) handleChildSessionMessage(event pubsub.Event[message.Message]) tea.Cmd {
935 var cmds []tea.Cmd
936 var cmds []tea.Cmd
938+ atBottom := m.chat.list.AtBottom()
937 // Only process messages with tool calls or results.
939 // Only process messages with tool calls or results.
938 if len(event.Payload.ToolCalls()) == 0 && len(event.Payload.ToolResults()) == 0 {
940 if len(event.Payload.ToolCalls()) == 0 && len(event.Payload.ToolResults()) == 0 {
939 return nil
941 return nil
@@ -1013,6 +1015,12 @@ func (m *UI) handleChildSessionMessage(event pubsub.Event[message.Message]) tea.
1013 // Update the chat so it updates the index map for animations to work as expected
1015 // Update the chat so it updates the index map for animations to work as expected
1014 m.chat.UpdateNestedToolIDs(toolCallID)
1016 m.chat.UpdateNestedToolIDs(toolCallID)
1019+ if cmd := m.chat.ScrollToBottomAndAnimate(); cmd != nil {
1020+ cmds = append(cmds, cmd)
1016 return tea.Batch(cmds...)
1024 return tea.Batch(cmds...)
@@ -2905,7 +2913,7 @@ func (m *UI) runMCPPrompt(clientID, promptID string, arguments map[string]string
2907func (m *UI) copyChatHighlight() tea.Cmd {
2915func (m *UI) copyChatHighlight() tea.Cmd {
2908− text := m.chat.HighlighContent()
2916+ text := m.chat.HighlightContent()
2909 return tea.Sequence(
2917 return tea.Sequence(
2910 tea.SetClipboard(text),
2918 tea.SetClipboard(text),
2911 func() tea.Msg {
2919 func() tea.Msg {