mirror of
https://github.com/verigak/progress.git
synced 2025-12-08 19:33:24 +00:00
Implement write using \r instead of \b
This is to appease PyCharm that doesn't implement \b.
This commit is contained in:
@@ -37,9 +37,8 @@ class WriteMixin(object):
|
|||||||
|
|
||||||
def write(self, s):
|
def write(self, s):
|
||||||
if self.file and self.is_tty():
|
if self.file and self.is_tty():
|
||||||
b = '\b' * self._width
|
line = self.message + s.ljust(self._width)
|
||||||
c = s.ljust(self._width)
|
print('\r' + line, end='', file=self.file)
|
||||||
print(b + c, end='', file=self.file)
|
|
||||||
self._width = max(self._width, len(s))
|
self._width = max(self._width, len(s))
|
||||||
self.file.flush()
|
self.file.flush()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user