Closed josswright closed 3 years ago
Looking at the code, it seems that the normal update happens by prepending a \r
to the format string, so I'm doing that and it seems mainly to work. I'm not sure it's a perfect solution, though, and I can't work out why adding crayon colours is preventing that in the normal case.
You might want to try the progress bar facilities in the cli package: https://cli.r-lib.org/dev/reference/index.html#section-progress-bars
Oh, wow. That looks amazing, and I see you're also the author. Has this package been deprecated, then?
Very happy to move over if there's a new long-term package replacing this.
Yes, progress will be still available, many packages depend on it, but it will be superseded and new development happens in cli.
Thanks. It only took about fifteen minutes to swap my code over yesterday, and the progress bar is much more flexible, and far prettier. :)
Would it be possible to add a note on the main README.md here that progress
is superseded by cli
? It would have let me find this much earlier. I originally found progress
because it's suggested by some tidyverse
packages and pages as the way to do progress bars. It seems like it would be useful for people who are directed here to be immediately informed about cli
.
Thanks again.
Yes, I'll add this soon: #123 The progress bar support in cli is quite new. The tidyverse packages will switch to cli as well, slowly.
(Referencing issues #32 and #109.)
If I create a progress bar with the following (contrived) code it works fine:
However if I create a bar with:
... then each update to the bar with
pb$tick()
is printed after the previous bar output, without overwriting it:Note that this is not related to the existence of a
\n
anywhere in the format argument. The updates do not occur on separate lines, as in #109. I can (partially) hack around this by adding a\r
to the end of the format string, but that seems to cause some flickering on updates.