diff --git a/doc/fixes37.0 b/doc/fixes37.0 index ec45cb17b..e2b02d43b 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -755,6 +755,8 @@ using bhitpos in flooreffects to handle erosion damage broke its original use of tracking wand zaps if a teleportation zap hit an object; subsequent zap traversal was done from object's landing spot rather than from its zap hit spot, resulting in scrambled wand targetting +restore previous behavior of the 'altmeta' option (only wait for a second + character when getting a command keystroke, not other key input) curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/src/cmd.c b/src/cmd.c index 50d6b6c0f..9f58d2969 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -171,6 +171,9 @@ static const char unavailcmd[] = "Unavailable command '%s'."; /* for rejecting #if !SHELL, !SUSPEND */ static const char cmdnotavail[] = "'%s' command not available."; +/* only needed for #if ALTMETA config but present unconditionally */ +static boolean getting_cmd = FALSE; /* True when parse() gets next command */ + static int doprev_message(void) { @@ -4475,8 +4478,11 @@ parse(void) g.context.move = 1; flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */ + getting_cmd = TRUE; /* affects readchar() behavior if the 'altmeta' + * option is On; reset to False by readchar() */ if (!g.Cmd.num_pad || (foo = readchar()) == g.Cmd.spkeys[NHKF_COUNT]) { - foo = get_count((char *) 0, '\0', LARGEST_INT, &g.command_count, FALSE); + foo = get_count((char *) 0, '\0', LARGEST_INT, + &g.command_count, FALSE); g.last_command_count = g.command_count; } @@ -4621,8 +4627,9 @@ readchar_core(int *x, int *y, int *mod) #endif sym = '\033'; #ifdef ALTMETA - } else if (sym == '\033' && iflags.altmeta) { - /* iflags.altmeta: treat two character ``ESC c'' as single `M-c' */ + } else if (sym == '\033' && iflags.altmeta && getting_cmd) { + /* iflags.altmeta: treat two character ``ESC c'' as single `M-c' but + only when we're called by parse() [possibly via get_count()] */ sym = *readchar_queue ? *readchar_queue++ : pgetchar(); if (sym == EOF || sym == 0) sym = '\033'; @@ -4634,6 +4641,8 @@ readchar_core(int *x, int *y, int *mod) readchar_queue = click_to_cmd(*x, *y, *mod); sym = *readchar_queue++; } + getting_cmd = FALSE; /* next readchar() will be for an ordinary char + * unless parse() sets this back to True */ return (char) sym; }