summaryrefslogtreecommitdiff
path: root/regtest
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2013-11-29 09:57:57 +0100
committerCarlos Garcia Campos <carlosgc@gnome.org>2013-11-29 09:57:57 +0100
commit5f825df417947c51943f1db327e1aa6c3faa15b0 (patch)
treed0b873892ce702c9e99e92e18617b40c70428b88 /regtest
parent1486d93f0f6418b37ccc57568717d9349a79935b (diff)
regtest: Do not store the current line in Printer but only its length
We are not using the line text anymore, but only the length.
Diffstat (limited to 'regtest')
-rw-r--r--regtest/Printer.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/regtest/Printer.py b/regtest/Printer.py
index 23dfd34e..1de693d4 100644
--- a/regtest/Printer.py
+++ b/regtest/Printer.py
@@ -32,19 +32,19 @@ class Printer:
self._verbose = Config().verbose
self._stream = sys.stdout
self._rewrite = self._stream.isatty() and not self._verbose
- self._current_line = None
+ self._current_line_len = 0
self._lock = RLock()
Printer.__single = self
def _erase_current_line(self):
- if self._current_line is None:
+ if not self._current_line_len:
return
- line_len = len(self._current_line)
+ line_len = self._current_line_len
self._stream.write('\b' * line_len + ' ' * line_len + '\b' * line_len)
- self._current_line = None
+ self._current_line_len = 0
def _ensure_new_line(self, msg):
if not msg.endswith('\n'):
@@ -62,7 +62,7 @@ class Printer:
with self._lock:
self._erase_current_line()
self._print(msg)
- self._current_line = msg[msg.rfind('\n') + 1:]
+ self._current_line_len = len(msg[msg.rfind('\n') + 1:])
def printout_ln(self, msg=''):
with self._lock: