on main help sign in
fix(ui): toggle pills to follow scroll (#2218)
540deefAyman Bagabas
internal/ui/model/pills.go+6−5
@@ -139,11 +139,6 @@ func (m *UI) togglePillsExpanded() tea.Cmd {
139 if !m.hasSession() {
139 if !m.hasSession() {
140 return nil
140 return nil
141 }
141 }
142− if m.layout.pills.Dy() > 0 {
143− if cmd := m.chat.ScrollByAndAnimate(0); cmd != nil {
144− return cmd
145− }
146− }
147 hasPills := hasIncompleteTodos(m.session.Todos) || m.promptQueue > 0
142 hasPills := hasIncompleteTodos(m.session.Todos) || m.promptQueue > 0
148 if !hasPills {
143 if !hasPills {
149 return nil
144 return nil
@@ -157,6 +152,12 @@ func (m *UI) togglePillsExpanded() tea.Cmd {
157 }
152 }
158 }
153 }
159 m.updateLayoutAndSize()
154 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+
160 return nil
161 return nil
161}
162}
162
163