diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 721aa16a1..4aa08785c 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1418,6 +1418,10 @@ only honor DEBUGFILES (for activating debugpline() calls) when in wizard mode if hero is on scroll of scare monster or Elbereth, werecreature switching from human to beast form or general monster polymorphing into a susceptible form will become scared right away instead on its next move +'altmeta' option didn't work as intended when 'number_pad' was On; typing + "n ESC c" wasn't treated as "n M-c" because reading + the 'n' changed program_state.input_state from commandInp to otherInp, + preventing special ESC handling; not an issue when number_pad was Off Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/cmd.c b/src/cmd.c index af69e19e5..70c5c89e1 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -4716,7 +4716,9 @@ get_count( return key; } - +/* main command input routine when not repeating and not executing canned + commands; input comes via get_count() which collects repeat count if one + is present and returns next non-digit to us */ staticfn int parse(void) { @@ -4728,9 +4730,17 @@ parse(void) flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */ /* affects readchar() behavior for ESC iff 'altmeta' option is On; - reset to 0 by readchar() */ + is always reset to otherInp by readchar() */ gp.program_state.input_state = commandInp; + if (!gc.Cmd.num_pad || (foo = readchar()) == gc.Cmd.spkeys[NHKF_COUNT]) { + /* if 'num_pad' is On then readchar() has just reset input_state; + set it back to commandInp, so that get_count() supports 'altmeta'; + otherwise "nESC" becomes "nESC" (with + not read from keyboard yet) rather than intended count + and meta keystroke "nM-" */ + gp.program_state.input_state = commandInp; + foo = get_count((char *) 0, '\0', LARGEST_INT, &gc.command_count, GC_NOFLAGS); gl.last_command_count = gc.command_count;