pager sizing fix
This commit is contained in:
+4
-4
@@ -14,6 +14,7 @@ except:
|
||||
pass
|
||||
|
||||
# additional constants
|
||||
REAL_TERM_COLS = TERM_COLS - 1 # for the line ending character
|
||||
REAL_TERM_ROWS = TERM_ROWS - 1 # for the "press Enter" message
|
||||
CONT_MSG = '--- Press Enter ---'
|
||||
|
||||
@@ -27,8 +28,8 @@ def reflow(text):
|
||||
for line in text.split('\n'):
|
||||
line = line.rstrip()
|
||||
while len(line) > 0:
|
||||
out.append(line[0:TERM_COLS])
|
||||
line = line[TERM_COLS:]
|
||||
out.append(line[0:REAL_TERM_COLS])
|
||||
line = line[REAL_TERM_COLS:]
|
||||
return out
|
||||
|
||||
def print_paged(text):
|
||||
@@ -37,7 +38,6 @@ def print_paged(text):
|
||||
ll = len(lines)
|
||||
for i in range(0, ll, REAL_TERM_ROWS):
|
||||
chunk = lines[i:i + REAL_TERM_ROWS]
|
||||
for line in chunk: print(line, end='')
|
||||
for line in chunk: print(line)
|
||||
if i + REAL_TERM_ROWS < ll:
|
||||
input(CONT_MSG)
|
||||
print()
|
||||
|
||||
Reference in New Issue
Block a user