Skip to content

Spinner overwrites the previous line if it is not ended with "\n" #157

@medyagh

Description

@medyagh

Hello a few years ago we created this issue #121 and this PR #108

and we been using a fork of spinner for the issue that we have, however I would love to use the main repo,
admittedly at that time we didnt explain the issue Outside minikube context and here is my second attempt hopefully this time makes better sense :)

here is a simple code using the spanner

package main

import (
	"fmt"
	"os"
	"time"

	"github.com/briandowns/spinner"
)

func main() {
	_, err := fmt.Fprintf(os.Stdout, "Hello time world is %d:%d", 3, 4)
	if err != nil {
		fmt.Println("Error !")
	}
	s := spinner.New(spinner.CharSets[9], 100*time.Millisecond)
	s.Color("green")                                            
	s.Start()                   
	time.Sleep(4 * time.Second)
	s.Stop()                   

}

Output

(spinning without any text)

The Expected Output

Hello world time is 3:4 (Spinning)

Note that the spinner library is Overwriting the Hello...text, since it did NOT end with a "\n"

I also tried the Prefix

	s.Prefix = fmt.Sprintf("Hello world time is %d:%d", 3, 4)

,But whole text will vanish after the spinning is done. we want the "Hello world" text to stay after the spinning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions