chelnak / ysmrr

YSMRR is a package that provides simple multi-line compatible spinners for Go applications.
MIT License
76 stars 6 forks source link

screen is broken for multipe SpinnerManager #66

Open arturrez opened 6 months ago

arturrez commented 6 months ago

when using multiple SpinnerManager on a screen which works fine except a situation when one of the SpinnerManager spinners is pushed out of the screen with other outoput. Once spinner is out of the view screen keeps going back and forth which breaks UX. Is there any way to stop rendering spinners when they out of the view?

chelnak commented 6 months ago

Hey @arturrez !

I think I understand your issue.

At the moment I don't think there is a way to stop something rendering if it is out of bounds.. it could be possible though (I think).

Can you post a small repro? It would help me debug the issue.

arturrez commented 6 months ago

thank you. You are correct - this is the issue. I don't think I can provide repro case unless you want to use avalanche-cli:) ./bin/avalanche node create p25 --use-static-ip=false --latest-avalanchego-version=true --aws --region us-east-1 --num-validators=25 --fuji --node-type=default will show the issue. You might need to setup some dependencies like AWS account

chelnak commented 6 months ago

Ok got it. I'll work something out.

Thanks!

chelnak commented 2 weeks ago

👋 Hey, I've tried to reproduce this issue a couple times now and have had little success.

Here is my latest attempt. The spinners seem to render OK in my terminal.. however I appreciate that there are a ton of configurations out there.

func main() {
    sm := ysmrr.NewSpinnerManager()
    sm.Start()
    defer sm.Stop()
    waitGroup := sync.WaitGroup{}
    for i := 0; i < 50; i++ {
        waitGroup.Add(1)
        go func(i int) {
            defer waitGroup.Done()
            s := sm.AddSpinner("Downloading... " + strconv.Itoa(i))
            time.Sleep(2 * time.Second)
            s.Complete()
        }(i)
    }
    waitGroup.Wait()
}

What terminal setup do you have currently?