From 540deef219de0646cf531fd4874d09f7c01cffa1 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Wed, 18 Feb 2026 17:22:43 +0300 Subject: [PATCH] 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. --- internal/ui/model/pills.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/ui/model/pills.go b/internal/ui/model/pills.go index fb3dcc1e3a86cb63d9e0a267476863a6260d0816..9b3307135aec89105adb895ef07bbe30484ec658 100644 --- a/internal/ui/model/pills.go +++ b/internal/ui/model/pills.go @@ -139,11 +139,6 @@ func (m *UI) togglePillsExpanded() tea.Cmd { if !m.hasSession() { return nil } - if m.layout.pills.Dy() > 0 { - if cmd := m.chat.ScrollByAndAnimate(0); cmd != nil { - return cmd - } - } hasPills := hasIncompleteTodos(m.session.Todos) || m.promptQueue > 0 if !hasPills { return nil @@ -157,6 +152,12 @@ func (m *UI) togglePillsExpanded() tea.Cmd { } } m.updateLayoutAndSize() + + // Make sure to follow scroll if follow is enabled when toggling pills. + if m.chat.Follow() { + m.chat.ScrollToBottom() + } + return nil }