pager sizing fix
This commit is contained in:
+8
-5
@@ -27,6 +27,9 @@ def reflow(text):
|
||||
out = []
|
||||
for line in text.split('\n'):
|
||||
line = line.rstrip()
|
||||
if len(line) == 0: # also handle effectively empty lines
|
||||
out.append('')
|
||||
else:
|
||||
while len(line) > 0:
|
||||
out.append(line[0:REAL_TERM_COLS])
|
||||
line = line[REAL_TERM_COLS:]
|
||||
@@ -35,9 +38,9 @@ def reflow(text):
|
||||
def print_paged(text):
|
||||
"""Reflow and print the text in a paginated manner"""
|
||||
lines = reflow(text)
|
||||
ll = len(lines)
|
||||
for i in range(0, ll, REAL_TERM_ROWS):
|
||||
chunk = lines[i:i + REAL_TERM_ROWS]
|
||||
while True:
|
||||
chunk = lines[0:REAL_TERM_ROWS]
|
||||
for line in chunk: print(line)
|
||||
if i + REAL_TERM_ROWS < ll:
|
||||
input(CONT_MSG)
|
||||
lines = lines[REAL_TERM_ROWS:]
|
||||
if len(lines) > 0: input(CONT_MSG)
|
||||
else: break
|
||||
|
||||
Reference in New Issue
Block a user