]> granicus.if.org Git - nethack/commitdiff
Fix: get_count and altmeta
authorMichael Meyer <me@entrez.cc>
Thu, 4 Aug 2022 17:34:06 +0000 (13:34 -0400)
committerPasi Kallinen <paxed@alt.org>
Sat, 6 Aug 2022 13:42:17 +0000 (16:42 +0300)
M-<key> shortcuts with altmeta enabled weren't working when preceded by
a count (e.g. 2 M-j for "jump twice"): g.program_state.getting_a_command
determined whether <esc> should be read as staring a potential meta key
combination, and was being reset by readchar on the first digit entered
without being reactivated for subsequent input.  As a result, by the
time the player entered the actual command to be modified by the count,
readchar wasn't bothering to look for M-<key> sequences.

src/cmd.c

index be1da5423edb2903809fbbae82a4a34ea8cb087e..fe8a42c40c4a2fd0657df4e76159a0716ddb77c8 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -5805,8 +5805,11 @@ get_count(
         if (inkey) {
             key = inkey;
             inkey = '\0';
-        } else
+        } else {
+            g.program_state.getting_a_command = 1; /* readchar altmeta
+                                                    * compatibility */
             key = readchar();
+        }
 
         if (digit(key)) {
             cnt = 10L * cnt + (long) (key - '0');