[libgxps] regtest: Do not store the current line in Printer but only its length
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] regtest: Do not store the current line in Printer but only its length
- Date: Tue, 23 Jun 2015 17:25:01 +0000 (UTC)
commit e6f6926e7e114e3854df1a85433b5fc463f944f3
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Tue Jun 23 18:24:30 2015 +0200
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.
regtest/Printer.py | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/regtest/Printer.py b/regtest/Printer.py
index 82848b2..ea5c252 100644
--- a/regtest/Printer.py
+++ b/regtest/Printer.py
@@ -31,19 +31,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'):
@@ -61,7 +61,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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]