Skip to content

Commit

Permalink
snekde: Map return to newline in my_getch
Browse files Browse the repository at this point in the history
Allow either key

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Mar 4, 2019
1 parent 0016fd7 commit 79c3e2b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion snekde/snekde.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def my_getch(edit_win):
edit_win.set_cursor()
snek_lock.release()
c = edit_win.window.getch()
if c == ord('\r'):
c = ord('\n')
if c == 27:
c = edit_win.window.getch()
if c == ord('0'):
Expand Down Expand Up @@ -652,7 +654,7 @@ def dispatch(self, ch):
self.delete_to_eol()
elif ch == ord('z') & 0x1f:
self.pop_undo()
if ch == curses.KEY_LEFT or ch == ord('b') & 0x1f:
elif ch == curses.KEY_LEFT or ch == ord('b') & 0x1f:
self.left()
elif ch == curses.KEY_RIGHT or ch == ord('f') & 0x1f:
self.right()
Expand Down

0 comments on commit 79c3e2b

Please sign in to comment.