diff options
Diffstat (limited to 'cursed.py')
| -rw-r--r-- | cursed.py | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -19,14 +19,23 @@ class Console(): curses.endwin() -async def start(c, on_str, on_tab): +async def start(c, on_str, on_tab, messages): string = "" + redraw(c.stdscr, messages) while True: char = await asyncio.to_thread(c.stdscr.getkey) - if char == '\n': + if char == '\n' and string != "": await on_str(string) + messages.append(string) + redraw(c.stdscr, messages) string = "" elif char == '\t': await on_tab() else: string += char + + +def redraw(stdscr, messages): + stdscr.clear() + for msg in messages: + stdscr.addstr(msg + '\n') |
