progress: force a repaint of a printed progress bar after a clear()
This avoids some visual flickering of the progress bar in convert and
probably some other operations. Previously, a line of output would
erase the progress bar, and then it would wait `progress.refresh`
seconds (default of 0.1) before redrawing the progress bar. Now if
we've ever painted a progress bar, we schedule the progress bar for
immediate repainting on the next progress call, which helps lend the
illusion that the progress bar is "always" there. In practice, it's
merely there more of the time, but it ends up being a lot easier to
read during convert.
--- a/mercurial/progress.py Tue Sep 29 14:08:37 2015 -0500
+++ b/mercurial/progress.py Sat Sep 26 00:10:48 2015 -0400
@@ -166,6 +166,9 @@
if not shouldprint(self.ui):
return
sys.stderr.write('\r%s\r' % (' ' * self.width()))
+ if self.printed:
+ # force immediate re-paint of progress bar
+ self.lastprint = 0
def complete(self):
if not shouldprint(self.ui):