print_paged QOL improvement

This commit is contained in:
Luxferre
2025-12-26 09:37:38 +02:00
parent 4718bd1844
commit a1ebcfcb4c
+4 -2
View File
@@ -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