Skip to content

fix: clear spinner output on Windows - #249

Open
JimmyLiuJia wants to merge 1 commit into
schollz:mainfrom
JimmyLiuJia:codex/fix-windows-spinner-clear
Open

JimmyLiuJia wants to merge 1 commit into
schollz:mainfrom
JimmyLiuJia:codex/fix-windows-spinner-clear

Conversation

@JimmyLiuJia

Copy link
Copy Markdown

Summary

OptionClearOnFinish left rendered spinner text behind on Windows. The non-ANSI clear path only wrote \r, which moves the cursor but does not erase the line. Use the existing space-fill clear path on Windows too.

Expand TestSpinnerClearOnFinish to cover the default spinner, a selected spinner type, and a custom spinner. The test checks the resulting virtual terminal screen rather than a platform-specific number of spaces.

Related to #107.

Validation

  • go test -run '^(TestSpinnerClearOnFinish|ExampleOptionClearOnFinish)$' -count=1 . passed on Windows with Go 1.25.0.
  • go vet . and git diff --check passed.
  • go test ./... -count=1 still fails in TestStateBeforeStart (instant elapsed time and rate are zero) and TestOptionShowTotalFalseDeterminate (the rendered statistics omit the expected comma). These assertions do not exercise the changed clear path.
  • go vet ./... reports the existing examples/download-unknown/main.go:14 use of resp before checking err.

AI assistance

OpenAI Codex prepared the change, test update, and this description. The focused tests and package vet were run locally; human review is welcome.

Replace the Windows carriage-return-only clear with the same space fill used on other platforms. Cover built-in and custom spinners when ClearOnFinish is enabled.

Co-authored-by: OpenAI Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant