From 7843a2333b1433dfd6486f51ee1b33f4678dc77f Mon Sep 17 00:00:00 2001 From: xfnw Date: Wed, 22 Jul 2020 17:12:37 +0000 Subject: [PATCH] enter and backspacing now work, so it is easier to type normal text --- nboard | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nboard b/nboard index a8c3182..930fecb 100755 --- a/nboard +++ b/nboard @@ -13,7 +13,7 @@ def main(stdscr): stdscr.refresh() k='NOU' height, width = stdscr.getmaxyx() - vx = vy = tx = ty = 0 + vx = vy = tx = ty = nl = 0 cx = width // 2 cy = height // 2 @@ -31,12 +31,21 @@ def main(stdscr): # detect where to move cursor if k == 'KEY_UP': vy += -1 + nl = vx if k == 'KEY_DOWN': vy += 1 + nl = vx if k == 'KEY_LEFT': vx += -1 + nl = vx if k == 'KEY_RIGHT': vx += 1 + nl = vx + if k == '\n': + vx = nl + vy += 1 + if k == 'KEY_BACKSPACE': + vx += -1 # make sure the cursor is on the screen # this is not nessesary for the view as it is infinite