print_paged QOL improvement
This commit is contained in:
+4
-2
@@ -16,7 +16,7 @@ except:
|
|||||||
# additional constants
|
# additional constants
|
||||||
REAL_TERM_COLS = TERM_COLS - 1 # for the line ending character
|
REAL_TERM_COLS = TERM_COLS - 1 # for the line ending character
|
||||||
REAL_TERM_ROWS = TERM_ROWS - 1 # for the "press Enter" message
|
REAL_TERM_ROWS = TERM_ROWS - 1 # for the "press Enter" message
|
||||||
CONT_MSG = '--- Press Enter ---'
|
CONT_MSG = '--- Press Enter to continue, q+Enter to stop ---'
|
||||||
|
|
||||||
def term_size():
|
def term_size():
|
||||||
"""Return the detected terminal size (rows, columns)"""
|
"""Return the detected terminal size (rows, columns)"""
|
||||||
@@ -42,5 +42,7 @@ def print_paged(text):
|
|||||||
chunk = lines[0:REAL_TERM_ROWS]
|
chunk = lines[0:REAL_TERM_ROWS]
|
||||||
for line in chunk: print(line)
|
for line in chunk: print(line)
|
||||||
lines = lines[REAL_TERM_ROWS:]
|
lines = lines[REAL_TERM_ROWS:]
|
||||||
if len(lines) > 0: input(CONT_MSG)
|
if len(lines) > 0:
|
||||||
|
r = input(CONT_MSG)
|
||||||
|
if r == 'q' or r == 'Q': break
|
||||||
else: break
|
else: break
|
||||||
|
|||||||
Reference in New Issue
Block a user