Paul Janzen reported that if you try to resize an xterm while
canfield is running, canfield suspends itself. This is due to the
curses getch() function returning KEY_RESIZE.  However, canfield
only expects to read 7-bit ascii characters and so uses a mask of
0x7f.  Since KEY_RESIZE & 0x7f == 0x1a (^Z), resizing the window
causes canfield to suspend itself.

We should just ignore any of the special curses keys returned by
getch() since canfield is not prepared to deal with them.

 - todd

Index: games/canfield/canfield/canfield.c
===================================================================
RCS file: /cvs/src/games/canfield/canfield/canfield.c,v
retrieving revision 1.28
diff -u -p -u -r1.28 canfield.c
--- games/canfield/canfield/canfield.c  24 Aug 2018 11:14:49 -0000      1.28
+++ games/canfield/canfield/canfield.c  21 Jan 2021 02:50:36 -0000
@@ -1332,7 +1332,8 @@ getcmd(int row, int col, const char *cp)
        do {
                if ((ch = getch()) == ERR)
                        cleanup(0);
-               ch &= 0177;
+               if (ch >= KEY_MIN)
+                       continue;
                if (ch >= 'A' && ch <= 'Z')
                        ch += ('a' - 'A');
                if (ch == '\f') {

Reply via email to