on main help sign in
chore: integrate overhauled spinner
commitb1df347f4341795742c27cf194a6d3ca59bcfff1 authorChristian Rocha <christian@rocha.is> dateWed 2 Jul 2025, 12:19 (1 year ago) parent5df4167
3 files changed+7−9
internal/tui/components/chat/messages/messages.go+2−3 internal/tui/components/chat/messages/tool.go+4−4 internal/tui/components/core/list/list.go+1−2
internal/tui/components/chat/messages/messages.go+2−3
@@ -6,7 +6,6 @@ import (
66 "strings"
77 "time"
88
9− "github.com/charmbracelet/bubbles/v2/spinner"
109 tea "github.com/charmbracelet/bubbletea/v2"
1110 "github.com/charmbracelet/lipgloss/v2"
1211
@@ -52,7 +51,7 @@ var focusedMessageBorder = lipgloss.Border{
5251func NewMessageCmp(msg message.Message) MessageCmp {
5352 m := &messageCmp{
5453 message: msg,
55− anim: anim.New(15, ""),
54+ anim: anim.New(15, "", styles.CurrentTheme()),
5655 }
5756 return m
5857}
@@ -71,7 +70,7 @@ func (m *messageCmp) Init() tea.Cmd {
7170// Manages animation updates for spinning messages and stops animation when appropriate.
7271func (m *messageCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
7372 switch msg := msg.(type) {
74− case anim.ColorCycleMsg, anim.StepCharsMsg, spinner.TickMsg:
73+ case anim.StepMsg:
7574 m.spinning = m.shouldSpin()
7675 if m.spinning {
7776 u, cmd := m.anim.Update(msg)
internal/tui/components/chat/messages/tool.go+4−4
@@ -3,7 +3,6 @@ package messages
33import (
44 "fmt"
55
6− "github.com/charmbracelet/bubbles/v2/spinner"
76 tea "github.com/charmbracelet/bubbletea/v2"
87 "github.com/charmbracelet/crush/internal/message"
98 "github.com/charmbracelet/crush/internal/tui/components/anim"
@@ -91,9 +90,10 @@ func NewToolCallCmp(parentMessageID string, tc message.ToolCall, opts ...ToolCal
9190 for _, opt := range opts {
9291 opt(m)
9392 }
94− m.anim = anim.New(15, "Working")
93+ t := styles.CurrentTheme()
94+ m.anim = anim.New(15, "Working", t)
9595 if m.isNested {
96− m.anim = anim.New(10, "")
96+ m.anim = anim.New(10, "", t)
9797 }
9898 return m
9999}
@@ -112,7 +112,7 @@ func (m *toolCallCmp) Init() tea.Cmd {
112112// Manages animation updates for pending tool calls.
113113func (m *toolCallCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
114114 switch msg := msg.(type) {
115− case anim.ColorCycleMsg, anim.StepCharsMsg, spinner.TickMsg:
115+ case anim.StepMsg:
116116 var cmds []tea.Cmd
117117 for i, nested := range m.nestedToolCalls {
118118 if nested.Spinning() {
internal/tui/components/core/list/list.go+1−2
@@ -7,7 +7,6 @@ import (
77
88 "github.com/charmbracelet/bubbles/v2/help"
99 "github.com/charmbracelet/bubbles/v2/key"
10− "github.com/charmbracelet/bubbles/v2/spinner"
1110 "github.com/charmbracelet/bubbles/v2/textinput"
1211 tea "github.com/charmbracelet/bubbletea/v2"
1312 "github.com/charmbracelet/crush/internal/tui/components/anim"
@@ -271,7 +270,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
271270 switch msg := msg.(type) {
272271 case tea.KeyPressMsg:
273272 return m.handleKeyPress(msg)
274− case anim.ColorCycleMsg, anim.StepCharsMsg, spinner.TickMsg:
273+ case anim.StepMsg:
275274 return m.handleAnimationMsg(msg)
276275 }
277276 if m.selectionState.isValidIndex(len(m.filteredItems)) {