Repository navigation
fix: clear spinner output on Windows - #249
Open
JimmyLiuJia wants to merge 1 commit into
Open
JimmyLiuJia wants to merge 1 commit into
JimmyLiuJia wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OptionClearOnFinishleft 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
TestSpinnerClearOnFinishto 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 .andgit diff --checkpassed.go test ./... -count=1still fails inTestStateBeforeStart(instant elapsed time and rate are zero) andTestOptionShowTotalFalseDeterminate(the rendered statistics omit the expected comma). These assertions do not exercise the changed clear path.go vet ./...reports the existingexamples/download-unknown/main.go:14use ofrespbefore checkingerr.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.