[Git][reproducible-builds/diffoscope][master] 2 commits: Use the ProgressBar's idea of the terminal width instead
Chris Lamb
gitlab at salsa.debian.org
Sat Jul 7 13:43:59 CEST 2018
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
81e54147 by Paul Wise at 2018-07-07T13:43:14+02:00
Use the ProgressBar's idea of the terminal width instead
More likely to overwrite the correct number of characters.
Fixes: commit dfb0c190173dff953fe1481797486d0b3e09306e
- - - - -
a7d86bb5 by Paul Wise at 2018-07-07T13:43:18+02:00
Do not delete the current terminal line for every progress bar update
The progress bar already overwrites the entire line
so erasing it before that serves no purpose.
The erasure was also causing the progress bar to flicker
and wasn't portable to different types of terminals.
- - - - -
1 changed file:
- diffoscope/progress.py
Changes:
=====================================
diffoscope/progress.py
=====================================
--- a/diffoscope/progress.py
+++ b/diffoscope/progress.py
@@ -34,9 +34,6 @@ class ProgressLoggingHandler(logging.StreamHandler):
def emit(self, record):
try:
- # Delete the current line (i.e. the progress bar)
- self.stream.write("\r\033[K")
- self.flush()
super().emit(record)
if not self.progressbar.bar.finished:
self.progressbar.bar.update()
@@ -232,10 +229,8 @@ class ProgressBar(object):
if self.erase_to_eol:
self.fd.buffer.write(self.erase_to_eol)
elif self.fd.isatty():
- from shutil import get_terminal_size
- width = get_terminal_size().columns
print(end='\r', file=self.fd)
- print(' ' * width, end='', file=self.fd)
+ print(' ' * self.term_width, end='', file=self.fd)
else:
# Do not flush if nothing was written
return
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/dfb0c190173dff953fe1481797486d0b3e09306e...a7d86bb5b511b8ed0d63d0c7621c4acecc4774d6
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/dfb0c190173dff953fe1481797486d0b3e09306e...a7d86bb5b511b8ed0d63d0c7621c4acecc4774d6
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20180707/585f77ae/attachment.html>
More information about the rb-commits
mailing list