nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit cf4901da2d8f72a99d8575fd6ac8b3a3687cf9ea
parent 9f20fadee1bc3eea7c26099b8b3427faeed0014e
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Mon,  7 Sep 2020 16:50:17 +0200

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.

Diffstat:
Msrc/definitions.h | 5+----
Msrc/winio.c | 5+----
2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/definitions.h b/src/definitions.h @@ -622,10 +622,7 @@ enum #define FOREIGN_SEQUENCE 0x4FC #ifdef USE_SLANG -#ifdef ENABLE_UTF8 -#define KEY_BAD 0xFF /* Clipped error code. */ -#endif -#define KEY_FLUSH 0x91 /* User-definable control code. */ +#define KEY_FLUSH 0xFF /* Clipped error code. */ #else #define KEY_FLUSH KEY_F0 /* Nonexistent function key. */ #endif diff --git a/src/winio.c b/src/winio.c @@ -918,7 +918,7 @@ int parse_kbinput(WINDOW *win) if (escapes == 0) { /* 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; } else if (escapes == 1) { escapes = 0; @@ -1248,9 +1248,6 @@ int parse_kbinput(WINDOW *win) #ifdef KEY_RESIZE /* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */ case KEY_RESIZE: #endif -#if defined(USE_SLANG) && defined(ENABLE_UTF8) - case KEY_BAD: -#endif case KEY_FLUSH: return ERR; /* Ignore this keystroke. */ }