on main help sign in
chore: rename isSpinning to spinning
commitbbce33fb50e8b53e02c0d54453047b5789ea64af authorKujtim Hoxha <kujtimii.h@gmail.com> dateTue 6 Jan 2026, 19:15 (1 year ago) parent614b0bc
2 files changed+13−13
internal/ui/chat/agent.go+2−2 internal/ui/chat/tools.go+11−11
internal/ui/chat/agent.go+2−2
@@ -46,7 +46,7 @@ func NewAgentToolMessageItem(
4646 t := &AgentToolMessageItem{}
4747 t.baseToolMessageItem = newBaseToolMessageItem(sty, toolCall, result, &AgentToolRenderContext{agent: t}, canceled)
4848 // For the agent tool we keep spinning until the tool call is finished.
49− t.isSpinningFn = func(state IsSpinningState) bool {
49+ t.spinningFunc = func(state SpinningState) bool {
5050 return state.Result == nil && !state.Canceled
5151 }
5252 return t
@@ -190,7 +190,7 @@ func NewAgenticFetchToolMessageItem(
190190 t := &AgenticFetchToolMessageItem{}
191191 t.baseToolMessageItem = newBaseToolMessageItem(sty, toolCall, result, &AgenticFetchToolRenderContext{fetch: t}, canceled)
192192 // For the agentic fetch tool we keep spinning until the tool call is finished.
193− t.isSpinningFn = func(state IsSpinningState) bool {
193+ t.spinningFunc = func(state SpinningState) bool {
194194 return state.Result == nil && !state.Canceled
195195 }
196196 return t
internal/ui/chat/tools.go+11−11
@@ -50,16 +50,16 @@ type Compactable interface {
5050 SetCompact(compact bool)
5151}
5252
53−// IsSpinningState contains the state passed to IsSpinningFn for custom spinning logic.
54−type IsSpinningState struct {
53+// SpinningState contains the state passed to SpinningFunc for custom spinning logic.
54+type SpinningState struct {
5555 ToolCall message.ToolCall
5656 Result *message.ToolResult
5757 Canceled bool
5858}
5959
60−// IsSpinningFn is a function type for custom spinning logic.
60+// SpinningFunc is a function type for custom spinning logic.
6161// Returns true if the tool should show the spinning animation.
62−type IsSpinningFn func(state IsSpinningState) bool
62+type SpinningFunc func(state SpinningState) bool
6363
6464// DefaultToolRenderContext implements the default [ToolRenderer] interface.
6565type DefaultToolRenderContext struct{}
@@ -130,9 +130,9 @@ type baseToolMessageItem struct {
130130 hasCappedWidth bool
131131 // isCompact indicates this tool should render in compact mode.
132132 isCompact bool
133− // isSpinningFn allows tools to override the default spinning logic.
133+ // spinningFunc allows tools to override the default spinning logic.
134134 // If nil, uses the default: !toolCall.Finished && !canceled.
135− isSpinningFn IsSpinningFn
135+ spinningFunc SpinningFunc
136136
137137 sty *styles.Styles
138138 anim *anim.Anim
@@ -349,8 +349,8 @@ func (t *baseToolMessageItem) SetPermissionGranted(granted bool) {
349349
350350// isSpinning returns true if the tool should show animation.
351351func (t *baseToolMessageItem) isSpinning() bool {
352− if t.isSpinningFn != nil {
353− return t.isSpinningFn(IsSpinningState{
352+ if t.spinningFunc != nil {
353+ return t.spinningFunc(SpinningState{
354354 ToolCall: t.toolCall,
355355 Result: t.result,
356356 Canceled: t.canceled,
@@ -359,9 +359,9 @@ func (t *baseToolMessageItem) isSpinning() bool {
359359 return !t.toolCall.Finished && !t.canceled
360360}
361361
362−// SetIsSpinningFn sets a custom function to determine if the tool should spin.
363−func (t *baseToolMessageItem) SetIsSpinningFn(fn IsSpinningFn) {
364− t.isSpinningFn = fn
362+// SetSpinningFunc sets a custom function to determine if the tool should spin.
363+func (t *baseToolMessageItem) SetSpinningFunc(fn SpinningFunc) {
364+ t.spinningFunc = fn
365365}
366366
367367// ToggleExpanded toggles the expanded state of the thinking box.