comparison mercurial/progress.py @ 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 1139d7cf9405
children 1aee2ab0f902
comparison
equal deleted inserted replaced
26406:2cac6126329f 26407:72bccc1f26b1
164 164
165 def clear(self): 165 def clear(self):
166 if not shouldprint(self.ui): 166 if not shouldprint(self.ui):
167 return 167 return
168 sys.stderr.write('\r%s\r' % (' ' * self.width())) 168 sys.stderr.write('\r%s\r' % (' ' * self.width()))
169 if self.printed:
170 # force immediate re-paint of progress bar
171 self.lastprint = 0
169 172
170 def complete(self): 173 def complete(self):
171 if not shouldprint(self.ui): 174 if not shouldprint(self.ui):
172 return 175 return
173 if self.ui.configbool('progress', 'clear-complete', default=True): 176 if self.ui.configbool('progress', 'clear-complete', default=True):