changeset 26407:72bccc1f26b1

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.
author Augie Fackler <augie@google.com>
date Sat, 26 Sep 2015 00:10:48 -0400
parents 2cac6126329f
children 2b31d8636f25
files mercurial/progress.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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):