Fix: Autowrap deaktivieren verhindert Scrollback-Overflow

Beim Beschreiben der letzten Spalte der untersten Terminal-Zeile
löst automatischer Zeilenumbruch ein Scroll-Event aus. Bei 10 fps
füllt sich der Scrollback-Puffer kontinuierlich.

WRAP_OFF (ESC[?7l) beim Start, WRAP_ON (ESC[?7h) beim Beenden.
This commit is contained in:
rene 2026-03-29 11:07:16 +02:00
parent 46402b64f9
commit 7c1f401a9b

View file

@ -27,6 +27,8 @@ HIDE_CUR = "\033[?25l"
SHOW_CUR = "\033[?25h" SHOW_CUR = "\033[?25h"
ALT_ON = "\033[?1049h" ALT_ON = "\033[?1049h"
ALT_OFF = "\033[?1049l" ALT_OFF = "\033[?1049l"
WRAP_OFF = "\033[?7l" # disable auto-wrap (prevents scrollback on last-col write)
WRAP_ON = "\033[?7h" # re-enable auto-wrap
def _fg(r, g, b): return f"\033[38;2;{r};{g};{b}m" def _fg(r, g, b): return f"\033[38;2;{r};{g};{b}m"
def _go(row, col): return f"\033[{row+1};{col+1}H" def _go(row, col): return f"\033[{row+1};{col+1}H"
@ -1560,7 +1562,7 @@ def main():
signal.signal(signal.SIGWINCH, on_resize) signal.signal(signal.SIGWINCH, on_resize)
fd = sys.stdout.fileno() fd = sys.stdout.fileno()
os.write(fd, (ALT_ON + HIDE_CUR + "\033[2J\033[H").encode()) os.write(fd, (ALT_ON + HIDE_CUR + WRAP_OFF + "\033[2J\033[H").encode())
try: try:
TICK = 0.1 / cfg.speed TICK = 0.1 / cfg.speed
@ -1598,7 +1600,7 @@ def main():
pass pass
finally: finally:
inp.restore() inp.restore()
os.write(fd, (SHOW_CUR + ALT_OFF + RESET).encode()) os.write(fd, (SHOW_CUR + WRAP_ON + ALT_OFF + RESET).encode())
if __name__ == '__main__': if __name__ == '__main__':