on main help sign in
chore(chat): rename funcs
commitb0dd9830ad278754699406aff3c44b97d01fb8be authorKujtim Hoxha <kujtimii.h@gmail.com> dateThu 18 Dec 2025, 17:30 (1 year ago) parent4316ef3
2 files changed+30−30
internal/ui/model/chat.go+8−8 internal/ui/model/ui.go+22−22
internal/ui/model/chat.go+8−8
@@ -169,30 +169,30 @@ func (m *Chat) Blur() {
169169 m.list.Blur()
170170}
171171
172−// ScrollToTop scrolls the chat view to the top and returns a command to restart
172+// ScrollToTopAndAnimate scrolls the chat view to the top and returns a command to restart
173173// any paused animations that are now visible.
174−func (m *Chat) ScrollToTop() tea.Cmd {
174+func (m *Chat) ScrollToTopAndAnimate() tea.Cmd {
175175 m.list.ScrollToTop()
176176 return m.RestartPausedVisibleAnimations()
177177}
178178
179−// ScrollToBottom scrolls the chat view to the bottom and returns a command to
179+// ScrollToBottomAndAnimate scrolls the chat view to the bottom and returns a command to
180180// restart any paused animations that are now visible.
181−func (m *Chat) ScrollToBottom() tea.Cmd {
181+func (m *Chat) ScrollToBottomAndAnimate() tea.Cmd {
182182 m.list.ScrollToBottom()
183183 return m.RestartPausedVisibleAnimations()
184184}
185185
186−// ScrollBy scrolls the chat view by the given number of line deltas and returns
186+// ScrollByAndAnimate scrolls the chat view by the given number of line deltas and returns
187187// a command to restart any paused animations that are now visible.
188−func (m *Chat) ScrollBy(lines int) tea.Cmd {
188+func (m *Chat) ScrollByAndAnimate(lines int) tea.Cmd {
189189 m.list.ScrollBy(lines)
190190 return m.RestartPausedVisibleAnimations()
191191}
192192
193−// ScrollToSelected scrolls the chat view to the selected item and returns a
193+// ScrollToSelectedAndAnimate scrolls the chat view to the selected item and returns a
194194// command to restart any paused animations that are now visible.
195−func (m *Chat) ScrollToSelected() tea.Cmd {
195+func (m *Chat) ScrollToSelectedAndAnimate() tea.Cmd {
196196 m.list.ScrollToSelected()
197197 return m.RestartPausedVisibleAnimations()
198198}
internal/ui/model/ui.go+22−22
@@ -268,22 +268,22 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
268268 switch m.state {
269269 case uiChat:
270270 if msg.Y <= 0 {
271− if cmd := m.chat.ScrollBy(-1); cmd != nil {
271+ if cmd := m.chat.ScrollByAndAnimate(-1); cmd != nil {
272272 cmds = append(cmds, cmd)
273273 }
274274 if !m.chat.SelectedItemInView() {
275275 m.chat.SelectPrev()
276− if cmd := m.chat.ScrollToSelected(); cmd != nil {
276+ if cmd := m.chat.ScrollToSelectedAndAnimate(); cmd != nil {
277277 cmds = append(cmds, cmd)
278278 }
279279 }
280280 } else if msg.Y >= m.chat.Height()-1 {
281− if cmd := m.chat.ScrollBy(1); cmd != nil {
281+ if cmd := m.chat.ScrollByAndAnimate(1); cmd != nil {
282282 cmds = append(cmds, cmd)
283283 }
284284 if !m.chat.SelectedItemInView() {
285285 m.chat.SelectNext()
286− if cmd := m.chat.ScrollToSelected(); cmd != nil {
286+ if cmd := m.chat.ScrollToSelectedAndAnimate(); cmd != nil {
287287 cmds = append(cmds, cmd)
288288 }
289289 }
@@ -310,22 +310,22 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
310310 case uiChat:
311311 switch msg.Button {
312312 case tea.MouseWheelUp:
313− if cmd := m.chat.ScrollBy(-5); cmd != nil {
313+ if cmd := m.chat.ScrollByAndAnimate(-5); cmd != nil {
314314 cmds = append(cmds, cmd)
315315 }
316316 if !m.chat.SelectedItemInView() {
317317 m.chat.SelectPrev()
318− if cmd := m.chat.ScrollToSelected(); cmd != nil {
318+ if cmd := m.chat.ScrollToSelectedAndAnimate(); cmd != nil {
319319 cmds = append(cmds, cmd)
320320 }
321321 }
322322 case tea.MouseWheelDown:
323− if cmd := m.chat.ScrollBy(5); cmd != nil {
323+ if cmd := m.chat.ScrollByAndAnimate(5); cmd != nil {
324324 cmds = append(cmds, cmd)
325325 }
326326 if !m.chat.SelectedItemInView() {
327327 m.chat.SelectNext()
328− if cmd := m.chat.ScrollToSelected(); cmd != nil {
328+ if cmd := m.chat.ScrollToSelectedAndAnimate(); cmd != nil {
329329 cmds = append(cmds, cmd)
330330 }
331331 }
@@ -395,7 +395,7 @@ func (m *UI) setSessionMessages(msgs []message.Message) tea.Cmd {
395395 }
396396
397397 m.chat.SetMessages(items...)
398− if cmd := m.chat.ScrollToBottom(); cmd != nil {
398+ if cmd := m.chat.ScrollToBottomAndAnimate(); cmd != nil {
399399 cmds = append(cmds, cmd)
400400 }
401401 m.chat.SelectLast()
@@ -414,7 +414,7 @@ func (m *UI) appendSessionMessage(msg message.Message) tea.Cmd {
414414 }
415415 }
416416 m.chat.AppendMessages(items...)
417− if cmd := m.chat.ScrollToBottom(); cmd != nil {
417+ if cmd := m.chat.ScrollToBottomAndAnimate(); cmd != nil {
418418 cmds = append(cmds, cmd)
419419 }
420420 return tea.Batch(cmds...)
@@ -580,62 +580,62 @@ func (m *UI) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
580580 case key.Matches(msg, m.keyMap.Chat.Expand):
581581 m.chat.ToggleExpandedSelectedItem()
582582 case key.Matches(msg, m.keyMap.Chat.Up):
583− if cmd := m.chat.ScrollBy(-1); cmd != nil {
583+ if cmd := m.chat.ScrollByAndAnimate(-1); cmd != nil {
584584 cmds = append(cmds, cmd)
585585 }
586586 if !m.chat.SelectedItemInView() {
587587 m.chat.SelectPrev()
588− if cmd := m.chat.ScrollToSelected(); cmd != nil {
588+ if cmd := m.chat.ScrollToSelectedAndAnimate(); cmd != nil {
589589 cmds = append(cmds, cmd)
590590 }
591591 }
592592 case key.Matches(msg, m.keyMap.Chat.Down):
593− if cmd := m.chat.ScrollBy(1); cmd != nil {
593+ if cmd := m.chat.ScrollByAndAnimate(1); cmd != nil {
594594 cmds = append(cmds, cmd)
595595 }
596596 if !m.chat.SelectedItemInView() {
597597 m.chat.SelectNext()
598− if cmd := m.chat.ScrollToSelected(); cmd != nil {
598+ if cmd := m.chat.ScrollToSelectedAndAnimate(); cmd != nil {
599599 cmds = append(cmds, cmd)
600600 }
601601 }
602602 case key.Matches(msg, m.keyMap.Chat.UpOneItem):
603603 m.chat.SelectPrev()
604− if cmd := m.chat.ScrollToSelected(); cmd != nil {
604+ if cmd := m.chat.ScrollToSelectedAndAnimate(); cmd != nil {
605605 cmds = append(cmds, cmd)
606606 }
607607 case key.Matches(msg, m.keyMap.Chat.DownOneItem):
608608 m.chat.SelectNext()
609− if cmd := m.chat.ScrollToSelected(); cmd != nil {
609+ if cmd := m.chat.ScrollToSelectedAndAnimate(); cmd != nil {
610610 cmds = append(cmds, cmd)
611611 }
612612 case key.Matches(msg, m.keyMap.Chat.HalfPageUp):
613− if cmd := m.chat.ScrollBy(-m.chat.Height() / 2); cmd != nil {
613+ if cmd := m.chat.ScrollByAndAnimate(-m.chat.Height() / 2); cmd != nil {
614614 cmds = append(cmds, cmd)
615615 }
616616 m.chat.SelectFirstInView()
617617 case key.Matches(msg, m.keyMap.Chat.HalfPageDown):
618− if cmd := m.chat.ScrollBy(m.chat.Height() / 2); cmd != nil {
618+ if cmd := m.chat.ScrollByAndAnimate(m.chat.Height() / 2); cmd != nil {
619619 cmds = append(cmds, cmd)
620620 }
621621 m.chat.SelectLastInView()
622622 case key.Matches(msg, m.keyMap.Chat.PageUp):
623− if cmd := m.chat.ScrollBy(-m.chat.Height()); cmd != nil {
623+ if cmd := m.chat.ScrollByAndAnimate(-m.chat.Height()); cmd != nil {
624624 cmds = append(cmds, cmd)
625625 }
626626 m.chat.SelectFirstInView()
627627 case key.Matches(msg, m.keyMap.Chat.PageDown):
628− if cmd := m.chat.ScrollBy(m.chat.Height()); cmd != nil {
628+ if cmd := m.chat.ScrollByAndAnimate(m.chat.Height()); cmd != nil {
629629 cmds = append(cmds, cmd)
630630 }
631631 m.chat.SelectLastInView()
632632 case key.Matches(msg, m.keyMap.Chat.Home):
633− if cmd := m.chat.ScrollToTop(); cmd != nil {
633+ if cmd := m.chat.ScrollToTopAndAnimate(); cmd != nil {
634634 cmds = append(cmds, cmd)
635635 }
636636 m.chat.SelectFirst()
637637 case key.Matches(msg, m.keyMap.Chat.End):
638− if cmd := m.chat.ScrollToBottom(); cmd != nil {
638+ if cmd := m.chat.ScrollToBottomAndAnimate(); cmd != nil {
639639 cmds = append(cmds, cmd)
640640 }
641641 m.chat.SelectLast()