Issue reported by jeremyhetzler: left and right arrows produced unexpected characters when trying to use them to edit text that is being entered. The curses interface converts arrow keys and function keys related to the keypad into movement keys (hjkl or 4286 depending on the number_pad setting). But it was doing that all the time, not just when nethack wanted movement keys. This extends the existing program_state.getting_a_command flag to getdir() so that it can be used for controlling that in addition to 'altmeta' support. Typing an arrow when interacting with the map (actual command or getpos, now getdir too) will still work. Typing one when making a wish or naming a pet will issue a beep and be treated as if '\0' had been typed, and that normally gets treated as if ESC had been typed. [Possible room for improvement there. Losing the whole text when trying to back up a character feels a bit harsh.] Treating left arrow as escape rather than as h or 4 will probably be enough to train players not to try to edit text with it after they get burned by that a time or two. Bonus fix: curses' keystroke conversion only supported traditional number_pad behavior, not the inverted phone number pad layout. Closes #987
30 KiB
30 KiB