on main help sign in
fix(scrollbar): only show on human scroll
ff12fa0Kieran Klukas
internal/ui/model/chat.go+7−3
@@ -302,6 +302,7 @@ func (m *Chat) InvalidateRenderCaches() {
302func (m *Chat) SetMessages(msgs ...chat.MessageItem) tea.Cmd {
302func (m *Chat) SetMessages(msgs ...chat.MessageItem) tea.Cmd {
303 m.idInxMap = make(map[string]int)
303 m.idInxMap = make(map[string]int)
304 m.pausedAnimations = make(map[string]struct{})
304 m.pausedAnimations = make(map[string]struct{})
305+ m.scrollbarVisible = false // Reset scrollbar visibility on new session load
305
306
306 items := make([]list.Item, len(msgs))
307 items := make([]list.Item, len(msgs))
307 for i, msg := range msgs {
308 for i, msg := range msgs {
@@ -315,7 +316,8 @@ func (m *Chat) SetMessages(msgs ...chat.MessageItem) tea.Cmd {
315 items[i] = msg
316 items[i] = msg
316 }
317 }
317 m.list.SetItems(items...)
318 m.list.SetItems(items...)
318− return m.ScrollToBottom()
319+ m.ScrollToBottom()
320+ return nil
319}
321}
320
322
321// AppendMessages appends a new message item to the chat list.
323// AppendMessages appends a new message item to the chat list.
@@ -446,10 +448,11 @@ func (m *Chat) Follow() bool {
446}
448}
447
449
448// ScrollToBottom scrolls the chat view to the bottom.
450// ScrollToBottom scrolls the chat view to the bottom.
451+// Does not trigger scrollbar visibility (auto-scroll to show new content).
449func (m *Chat) ScrollToBottom() tea.Cmd {
452func (m *Chat) ScrollToBottom() tea.Cmd {
450 m.list.ScrollToBottom()
453 m.list.ScrollToBottom()
451− m.follow = true // Enable follow mode when user scrolls to bottom
454+ m.follow = true
452− return m.showScrollbar()
455+ return nil
453}
456}
454
457
455// ScrollToTop scrolls the chat view to the top.
458// ScrollToTop scrolls the chat view to the top.
@@ -652,6 +655,7 @@ func (m *Chat) SelectLastInView() {
652func (m *Chat) ClearMessages() {
655func (m *Chat) ClearMessages() {
653 m.idInxMap = make(map[string]int)
656 m.idInxMap = make(map[string]int)
654 m.pausedAnimations = make(map[string]struct{})
657 m.pausedAnimations = make(map[string]struct{})
658+ m.scrollbarVisible = false
655 m.list.SetItems()
659 m.list.SetItems()
656 m.ClearMouse()
660 m.ClearMouse()
657}
661}
internal/ui/model/pills.go+2
@@ -192,6 +192,8 @@ func (m *UI) togglePillsExpanded() tea.Cmd {
192 m.updateLayoutAndSize()
192 m.updateLayoutAndSize()
193
193
194 // Make sure to follow scroll if follow is enabled when toggling pills.
194 // Make sure to follow scroll if follow is enabled when toggling pills.
195+ // Note: uses ScrollToBottom (no scrollbar) since this is layout adjustment,
196+ // not user-initiated scrolling.
195 if m.chat.Follow() {
197 if m.chat.Follow() {
196 m.chat.ScrollToBottom()
198 m.chat.ScrollToBottom()
197 }
199 }