on main help sign in
fix(ui): toggle pills to follow scroll (#2218)

This change ensures that when toggling the pills (e.g., to-dos) in the UI, if the scroll follow mode is enabled, the chat will automatically scroll to the bottom. This prevents the user from losing their place in the chat when they expand or collapse the pills section.

commit540deef219de0646cf531fd4874d09f7c01cffa1 authorAyman Bagabas <ayman.bagabas@gmail.com> dateWed 18 Feb 2026, 17:22 (8 months ago) parentab475a4
1 file changed+6−5
internal/ui/model/pills.go+6−5
internal/ui/model/pills.go+6−5
@@ -139,11 +139,6 @@ func (m *UI) togglePillsExpanded() tea.Cmd {
139139 if !m.hasSession() {
140140 return nil
141141 }
142− if m.layout.pills.Dy() > 0 {
143− if cmd := m.chat.ScrollByAndAnimate(0); cmd != nil {
144− return cmd
145− }
146− }
147142 hasPills := hasIncompleteTodos(m.session.Todos) || m.promptQueue > 0
148143 if !hasPills {
149144 return nil
@@ -157,6 +152,12 @@ func (m *UI) togglePillsExpanded() tea.Cmd {
157152 }
158153 }
159154 m.updateLayoutAndSize()
155+
156+ // Make sure to follow scroll if follow is enabled when toggling pills.
157+ if m.chat.Follow() {
158+ m.chat.ScrollToBottom()
159+ }
160+
160161 return nil
161162}
162163