enter and backspacing now work, so it is easier to type normal text

This commit is contained in:
xfnw 2020-07-22 17:12:37 +00:00
parent 779894e2a7
commit 7843a2333b

11
nboard
View file

@ -13,7 +13,7 @@ def main(stdscr):
stdscr.refresh() stdscr.refresh()
k='NOU' k='NOU'
height, width = stdscr.getmaxyx() height, width = stdscr.getmaxyx()
vx = vy = tx = ty = 0 vx = vy = tx = ty = nl = 0
cx = width // 2 cx = width // 2
cy = height // 2 cy = height // 2
@ -31,12 +31,21 @@ def main(stdscr):
# detect where to move cursor # detect where to move cursor
if k == 'KEY_UP': if k == 'KEY_UP':
vy += -1 vy += -1
nl = vx
if k == 'KEY_DOWN': if k == 'KEY_DOWN':
vy += 1 vy += 1
nl = vx
if k == 'KEY_LEFT': if k == 'KEY_LEFT':
vx += -1 vx += -1
nl = vx
if k == 'KEY_RIGHT': if k == 'KEY_RIGHT':
vx += 1 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 # make sure the cursor is on the screen
# this is not nessesary for the view as it is infinite # this is not nessesary for the view as it is infinite