From bbce33fb50e8b53e02c0d54453047b5789ea64af Mon Sep 17 00:00:00 2001 From: Kujtim Hoxha Date: Tue, 6 Jan 2026 19:15:31 +0100 Subject: [PATCH] chore: rename isSpinning to spinning --- internal/ui/chat/agent.go | 4 ++-- internal/ui/chat/tools.go | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/ui/chat/agent.go b/internal/ui/chat/agent.go index baa9633623be16fab85d5e0b7b190a4173f1be15..f13f9f03f69df57ac61406f69aa3fe30c22d8f07 100644 --- a/internal/ui/chat/agent.go +++ b/internal/ui/chat/agent.go @@ -46,7 +46,7 @@ func NewAgentToolMessageItem( t := &AgentToolMessageItem{} t.baseToolMessageItem = newBaseToolMessageItem(sty, toolCall, result, &AgentToolRenderContext{agent: t}, canceled) // For the agent tool we keep spinning until the tool call is finished. - t.isSpinningFn = func(state IsSpinningState) bool { + t.spinningFunc = func(state SpinningState) bool { return state.Result == nil && !state.Canceled } return t @@ -190,7 +190,7 @@ func NewAgenticFetchToolMessageItem( t := &AgenticFetchToolMessageItem{} t.baseToolMessageItem = newBaseToolMessageItem(sty, toolCall, result, &AgenticFetchToolRenderContext{fetch: t}, canceled) // For the agentic fetch tool we keep spinning until the tool call is finished. - t.isSpinningFn = func(state IsSpinningState) bool { + t.spinningFunc = func(state SpinningState) bool { return state.Result == nil && !state.Canceled } return t diff --git a/internal/ui/chat/tools.go b/internal/ui/chat/tools.go index abed4d12174f8e4b5b1c98d84fa92fbd7b7230c9..016fb1dc32ab81042623cf6750666eba1d42ecd9 100644 --- a/internal/ui/chat/tools.go +++ b/internal/ui/chat/tools.go @@ -50,16 +50,16 @@ type Compactable interface { SetCompact(compact bool) } -// IsSpinningState contains the state passed to IsSpinningFn for custom spinning logic. -type IsSpinningState struct { +// SpinningState contains the state passed to SpinningFunc for custom spinning logic. +type SpinningState struct { ToolCall message.ToolCall Result *message.ToolResult Canceled bool } -// IsSpinningFn is a function type for custom spinning logic. +// SpinningFunc is a function type for custom spinning logic. // Returns true if the tool should show the spinning animation. -type IsSpinningFn func(state IsSpinningState) bool +type SpinningFunc func(state SpinningState) bool // DefaultToolRenderContext implements the default [ToolRenderer] interface. type DefaultToolRenderContext struct{} @@ -130,9 +130,9 @@ type baseToolMessageItem struct { hasCappedWidth bool // isCompact indicates this tool should render in compact mode. isCompact bool - // isSpinningFn allows tools to override the default spinning logic. + // spinningFunc allows tools to override the default spinning logic. // If nil, uses the default: !toolCall.Finished && !canceled. - isSpinningFn IsSpinningFn + spinningFunc SpinningFunc sty *styles.Styles anim *anim.Anim @@ -349,8 +349,8 @@ func (t *baseToolMessageItem) SetPermissionGranted(granted bool) { // isSpinning returns true if the tool should show animation. func (t *baseToolMessageItem) isSpinning() bool { - if t.isSpinningFn != nil { - return t.isSpinningFn(IsSpinningState{ + if t.spinningFunc != nil { + return t.spinningFunc(SpinningState{ ToolCall: t.toolCall, Result: t.result, Canceled: t.canceled, @@ -359,9 +359,9 @@ func (t *baseToolMessageItem) isSpinning() bool { return !t.toolCall.Finished && !t.canceled } -// SetIsSpinningFn sets a custom function to determine if the tool should spin. -func (t *baseToolMessageItem) SetIsSpinningFn(fn IsSpinningFn) { - t.isSpinningFn = fn +// SetSpinningFunc sets a custom function to determine if the tool should spin. +func (t *baseToolMessageItem) SetSpinningFunc(fn SpinningFunc) { + t.spinningFunc = fn } // ToggleExpanded toggles the expanded state of the thinking box.