From 05d11e4c36d840433e36260c96556603260e11c7 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Wed, 10 Jun 2015 21:21:07 +0200 Subject: [PATCH] Revert "manage tty colummns while displaying text" This reverts commit 5852bd5ef9070b3deb3da8f25fdb48f816bdb6b5. --- weboob/tools/application/formatters/iformatter.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/weboob/tools/application/formatters/iformatter.py b/weboob/tools/application/formatters/iformatter.py index 84ebbd43..d22d7d04 100644 --- a/weboob/tools/application/formatters/iformatter.py +++ b/weboob/tools/application/formatters/iformatter.py @@ -48,8 +48,7 @@ else: def readch(): fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) - #tty.setraw(fd) - tty.setcbreak(fd) + tty.setraw(fd) try: c = sys.stdin.read(1) # XXX do not read magic number @@ -112,18 +111,12 @@ class IFormatter(object): (bufx, bufy, curx, cury, wattr, left, top, right, bottom, maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw) self.termrows = right - left + 1 - self.termcols = bottom - top + 1 else: self.termrows = 80 # can't determine actual size - return default values - self.termcols = 80 else: self.termrows = int( subprocess.Popen('stty size', shell=True, stdout=subprocess.PIPE).communicate()[0].split()[0] ) - self.termcols = int( - subprocess.Popen('stty size', shell=True, stdout=subprocess.PIPE).communicate()[0].split()[1] - ) - def output(self, formatted): if self.outfile != sys.stdout: @@ -141,10 +134,8 @@ class IFormatter(object): if isinstance(line, unicode): line = line.encode(guess_encoding(self.outfile), 'replace') - #self.outfile.write(line) print(line) - self.print_lines += int(len(line)/self.termcols) + 1 - #self.print_lines += 1 + self.print_lines += 1 def start_format(self, **kwargs): pass