deno-library / progress

ProgressBar in terminal for deno
MIT License
60 stars 9 forks source link

MultiProgressBar misses a '\n' for the last progress bar #23

Closed bjesuiter closed 1 year ago

bjesuiter commented 1 year ago
Bildschirm­foto 2023-02-24 um 14 23 19

When you look at the image, you see the percent sign behind the last progress row. Thats my prompt sign which is on the wrong line.

You can also see this in the following screenshots from running the MultiProgressBar in a deno test:

Bildschirm­foto 2023-02-24 um 14 25 38

I'll add a small PR for this.

fuxingZhang commented 1 year ago

My test is ok.

image

bjesuiter commented 1 year ago

Hmm, I'm currently analyzing what problem there is with drawing the progress bars.

Try to put 3 progress bars in the test. You should see that it is broken now, as it is for me. The third progress bar does not render while 1 &2 are, despite the data being in the array. also, after rendering of all three bars is complete, the next prompt will be on the same line as the 3rd progress bar, which appears in one complete rendering at the end.

Maybe this is an issue with ANSI escape sequences used while drawing, I experimented with this on the weekend and tried to refactor it completely and it is another kind of complicated sometimes.

I now have a solution, which is able to render 3 progress bars independently of one another from 1 readable stream for each bar, containing the completed prgress, however, Since my test uses fast-firing timers the rendering is sometimes a bit laggy.

Also, printing console logs messes up the rendering of the bars, so this has to still be adjusted.

If you're interested at looking into my refactoring, I can give you a WIP PR, if you want :)

fuxingZhang commented 1 year ago

Three progress bars is ok. Maybe you can try another computer image image