altmeta vs number_pad
While testing a potential fix for issue #1250, I discovered that using the altmeta option, to simulate typing Alt+x to get M-x via typing 'ESC x', didn't work after a count prefixed by 'n' when in number_pad mode. It did work as intended for !number_pad when a repeat count prefix is entered via digits without 'n'. This doesn't solve #1250, which also occurs for number_pad but not for !number_pad.
This commit is contained in:
@@ -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 <count> ESC c" wasn't treated as "n <count> 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
|
||||
|
||||
14
src/cmd.c
14
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 "n<count>ESC<character>" becomes "n<count>ESC" (with
|
||||
<character> not read from keyboard yet) rather than intended count
|
||||
and meta keystroke "n<count>M-<character>" */
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user