on main help sign in
chore: integrate overhauled spinner
b1df347Christian Rocha
internal/tui/components/chat/messages/messages.go+2−3
@@ -6,7 +6,6 @@ import (
6 "strings"
6 "strings"
7 "time"
7 "time"
8
8
9− "github.com/charmbracelet/bubbles/v2/spinner"
10 tea "github.com/charmbracelet/bubbletea/v2"
9 tea "github.com/charmbracelet/bubbletea/v2"
11 "github.com/charmbracelet/lipgloss/v2"
10 "github.com/charmbracelet/lipgloss/v2"
12
11
@@ -52,7 +51,7 @@ var focusedMessageBorder = lipgloss.Border{
52func NewMessageCmp(msg message.Message) MessageCmp {
51func NewMessageCmp(msg message.Message) MessageCmp {
53 m := &messageCmp{
52 m := &messageCmp{
54 message: msg,
53 message: msg,
55− anim: anim.New(15, ""),
54+ anim: anim.New(15, "", styles.CurrentTheme()),
56 }
55 }
57 return m
56 return m
58}
57}
@@ -71,7 +70,7 @@ func (m *messageCmp) Init() tea.Cmd {
71// Manages animation updates for spinning messages and stops animation when appropriate.
70// Manages animation updates for spinning messages and stops animation when appropriate.
72func (m *messageCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
71func (m *messageCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
73 switch msg := msg.(type) {
72 switch msg := msg.(type) {
74− case anim.ColorCycleMsg, anim.StepCharsMsg, spinner.TickMsg:
73+ case anim.StepMsg:
75 m.spinning = m.shouldSpin()
74 m.spinning = m.shouldSpin()
76 if m.spinning {
75 if m.spinning {
77 u, cmd := m.anim.Update(msg)
76 u, cmd := m.anim.Update(msg)
internal/tui/components/chat/messages/tool.go+4−4
@@ -3,7 +3,6 @@ package messages
3import (
3import (
4 "fmt"
4 "fmt"
5
5
6− "github.com/charmbracelet/bubbles/v2/spinner"
7 tea "github.com/charmbracelet/bubbletea/v2"
6 tea "github.com/charmbracelet/bubbletea/v2"
8 "github.com/charmbracelet/crush/internal/message"
7 "github.com/charmbracelet/crush/internal/message"
9 "github.com/charmbracelet/crush/internal/tui/components/anim"
8 "github.com/charmbracelet/crush/internal/tui/components/anim"
@@ -91,9 +90,10 @@ func NewToolCallCmp(parentMessageID string, tc message.ToolCall, opts ...ToolCal
91 for _, opt := range opts {
90 for _, opt := range opts {
92 opt(m)
91 opt(m)
93 }
92 }
93+ t := styles.CurrentTheme()
94− m.anim = anim.New(15, "Working")
94+ m.anim = anim.New(15, "Working", t)
95 if m.isNested {
95 if m.isNested {
96− m.anim = anim.New(10, "")
96+ m.anim = anim.New(10, "", t)
97 }
97 }
98 return m
98 return m
99}
99}
@@ -112,7 +112,7 @@ func (m *toolCallCmp) Init() tea.Cmd {
112// Manages animation updates for pending tool calls.
112// Manages animation updates for pending tool calls.
113func (m *toolCallCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
113func (m *toolCallCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
114 switch msg := msg.(type) {
114 switch msg := msg.(type) {
115− case anim.ColorCycleMsg, anim.StepCharsMsg, spinner.TickMsg:
115+ case anim.StepMsg:
116 var cmds []tea.Cmd
116 var cmds []tea.Cmd
117 for i, nested := range m.nestedToolCalls {
117 for i, nested := range m.nestedToolCalls {
118 if nested.Spinning() {
118 if nested.Spinning() {
internal/tui/components/core/list/list.go+1−2
@@ -7,7 +7,6 @@ import (
7
7
8 "github.com/charmbracelet/bubbles/v2/help"
8 "github.com/charmbracelet/bubbles/v2/help"
9 "github.com/charmbracelet/bubbles/v2/key"
9 "github.com/charmbracelet/bubbles/v2/key"
10− "github.com/charmbracelet/bubbles/v2/spinner"
11 "github.com/charmbracelet/bubbles/v2/textinput"
10 "github.com/charmbracelet/bubbles/v2/textinput"
12 tea "github.com/charmbracelet/bubbletea/v2"
11 tea "github.com/charmbracelet/bubbletea/v2"
13 "github.com/charmbracelet/crush/internal/tui/components/anim"
12 "github.com/charmbracelet/crush/internal/tui/components/anim"
@@ -271,7 +270,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
271 switch msg := msg.(type) {
270 switch msg := msg.(type) {
272 case tea.KeyPressMsg:
271 case tea.KeyPressMsg:
273 return m.handleKeyPress(msg)
272 return m.handleKeyPress(msg)
274− case anim.ColorCycleMsg, anim.StepCharsMsg, spinner.TickMsg:
273+ case anim.StepMsg:
275 return m.handleAnimationMsg(msg)
274 return m.handleAnimationMsg(msg)
276 }
275 }
277 if m.selectionState.isValidIndex(len(m.filteredItems)) {
276 if m.selectionState.isValidIndex(len(m.filteredItems)) {