progress: force a repaint of a printed progress bar after a clear()
authorAugie Fackler <augie@google.com>
Sat, 26 Sep 2015 00:10:48 -0400
changeset 26407 72bccc1f26b1
parent 26406 2cac6126329f
child 26408 2b31d8636f25
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.
mercurial/progress.py
--- 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):