]> granicus.if.org Git - nethack/commitdiff
return correct ALT-key sequences with PDCurses
authornhmall <nhmall@nethack.org>
Tue, 28 Feb 2023 05:05:04 +0000 (00:05 -0500)
committernhmall <nhmall@nethack.org>
Tue, 28 Feb 2023 05:05:04 +0000 (00:05 -0500)
They weren't working at all because the values of ALT_A through ALT_Z
were out of the normal char range with PDCurses, and caught by the default
case in the switch, where reject got set.

/* use key as-is unless it's out of normal char range */
        reject = ((uchar) ret < 1 || ret > 255);

win/curses/cursmisc.c

index efc7ef8ee170041e94b5de2bedd7b601495b44fd..0b60a6797b8976bc5fe2f78939733e304ad5a2f7 100644 (file)
@@ -939,6 +939,35 @@ curses_convert_keys(int key)
         ret = iflags.num_pad ? '5' : 'g';
         break;
 #endif /* KEY_B2 */
+#ifdef PDCURSES
+    case ALT_A:
+    case ALT_B:
+    case ALT_C:
+    case ALT_D:
+    case ALT_E:
+    case ALT_F:
+    case ALT_G:
+    case ALT_I:
+    case ALT_J:
+    case ALT_K:
+    case ALT_L:
+    case ALT_M:
+    case ALT_N:
+    case ALT_O:
+    case ALT_P:
+    case ALT_Q:
+    case ALT_R:
+    case ALT_S:
+    case ALT_T:
+    case ALT_U:
+    case ALT_V:
+    case ALT_W:
+    case ALT_X:
+    case ALT_Y:
+    case ALT_Z:
+        ret = M((ret - ALT_A) + 'a');
+        break;
+#endif
     }
 
     /* phone layout is inverted, 123 on top and 789 on bottom; if player has