diff --git a/asciiquarium_ng.py b/asciiquarium_ng.py index aceef4d..0a9fa86 100755 --- a/asciiquarium_ng.py +++ b/asciiquarium_ng.py @@ -27,6 +27,8 @@ HIDE_CUR = "\033[?25l" SHOW_CUR = "\033[?25h" ALT_ON = "\033[?1049h" 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 _go(row, col): return f"\033[{row+1};{col+1}H" @@ -1560,7 +1562,7 @@ def main(): signal.signal(signal.SIGWINCH, on_resize) 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: TICK = 0.1 / cfg.speed @@ -1598,7 +1600,7 @@ def main(): pass finally: 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__':