keypad handling with curses