suspension: do not enter an invalid byte upon resume (when using Slang)

Instead of stuffing 0x91 into the input stream, use 0xFF when built
with Slang -- the same code that Slang itself produces when resuming
from an externally induced suspension.  This byte is ignored.

In a UTF-8 locale, it should be safe to ignore the byte 0xFF coming
from the keyboard, as no valid UTF-8 sequence can contain 0xFF.

In an ISO8859 locale, this change prevents ÿ from being typed on the
keyboard -- it can still be entered with <Esc> <Esc> 255, though.
My apologies to the people of Pierre Louÿs and L'Haÿ-les-Roses.
master
Benno Schulenberg 2020-09-07 16:50:17 +02:00
parent 9f20fadee1
commit cf4901da2d
2 changed files with 2 additions and 8 deletions

View File

@ -622,10 +622,7 @@ enum
#define FOREIGN_SEQUENCE 0x4FC #define FOREIGN_SEQUENCE 0x4FC
#ifdef USE_SLANG #ifdef USE_SLANG
#ifdef ENABLE_UTF8 #define KEY_FLUSH 0xFF /* Clipped error code. */
#define KEY_BAD 0xFF /* Clipped error code. */
#endif
#define KEY_FLUSH 0x91 /* User-definable control code. */
#else #else
#define KEY_FLUSH KEY_F0 /* Nonexistent function key. */ #define KEY_FLUSH KEY_F0 /* Nonexistent function key. */
#endif #endif

View File

@ -918,7 +918,7 @@ int parse_kbinput(WINDOW *win)
if (escapes == 0) { if (escapes == 0) {
/* Most key codes in byte range cannot be special keys. */ /* Most key codes in byte range cannot be special keys. */
if (keycode <= 0xFF && keycode != '\t' && keycode != DEL_CODE) if (keycode < 0xFF && keycode != '\t' && keycode != DEL_CODE)
return keycode; return keycode;
} else if (escapes == 1) { } else if (escapes == 1) {
escapes = 0; escapes = 0;
@ -1247,9 +1247,6 @@ int parse_kbinput(WINDOW *win)
#endif #endif
#ifdef KEY_RESIZE /* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */ #ifdef KEY_RESIZE /* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */
case KEY_RESIZE: case KEY_RESIZE:
#endif
#if defined(USE_SLANG) && defined(ENABLE_UTF8)
case KEY_BAD:
#endif #endif
case KEY_FLUSH: case KEY_FLUSH:
return ERR; /* Ignore this keystroke. */ return ERR; /* Ignore this keystroke. */