chore: rename isSpinning to spinning

Kujtim Hoxha created

Change summary

internal/ui/chat/agent.go |  4 ++--
internal/ui/chat/tools.go | 22 +++++++++++-----------
2 files changed, 13 insertions(+), 13 deletions(-)

Detailed changes

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

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.