From 375ec3c83e4043e9e1b4898d9c5299084b7a7d12 Mon Sep 17 00:00:00 2001 From: mecaneer23 Date: Thu, 18 Apr 2024 14:01:53 -0500 Subject: [PATCH] feat: move cursor to newline rather than getting stuck at the end of prev line --- src/acurses.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/acurses.py b/src/acurses.py index 7eefa8d..a97ff29 100644 --- a/src/acurses.py +++ b/src/acurses.py @@ -148,8 +148,10 @@ def addstr(self, *args: Any, **kwargs: Any) -> None: def _(self, text: str, attr: int = 0) -> None: ansi_attrs = self._parse_attrs(attr) stdout.write(ansi_attrs) - for char in text[:self._width]: + for index, char in enumerate(text[: self._width]): stdout.write(char) + if index + self._pos_x == self._width: + self.move(self._pos_y, 0) if ansi_attrs: stdout.write(_ANSI_RESET) stdout.flush()