mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-26 14:51:36 +03:00
suspension: prevent entering an invalid byte upon resume (with S-Lang)
For some reason, when returning from suspension, SLang will produce either a clipped error code (0xFF instead of 0xFFFF, when returning from an externally induced suspension), or it will clip the code of first subsequent keystroke to a single byte (when returning from a normal, in-editor suspension: ^Z). Side-step this by ignoring the clipped error code, and by using an undefined control code as the first fake keystroke. Ignoring the clipped error code is not possible when using a single-byte locale, otherwise the user would not be able to type the character with code 0xFF (although it could still be entered with Esc Esc 255). This fixes https://savannah.gnu.org/bugs/?51477.
This commit is contained in:
parent
e4a69f8b94
commit
43a5c87682
@ -1288,7 +1288,7 @@ RETSIGTYPE do_continue(int signal)
|
||||
terminal_init();
|
||||
#endif
|
||||
/* Tickle the input routine so it will update the screen. */
|
||||
ungetch(KEY_F0);
|
||||
ungetch(KEY_FLUSH);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
|
@ -576,6 +576,15 @@ enum
|
||||
#define SHIFT_HOME 0x40f
|
||||
#define SHIFT_END 0x410
|
||||
|
||||
#ifdef USE_SLANG
|
||||
#ifdef ENABLE_UTF8
|
||||
#define KEY_BAD 0xFF /* Clipped error code. */
|
||||
#endif
|
||||
#define KEY_FLUSH 0x91 /* User-definable control code. */
|
||||
#else
|
||||
#define KEY_FLUSH KEY_F0 /* Nonexistent function key. */
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* An imaginary key for when we get a SIGWINCH (window resize). */
|
||||
#define KEY_WINCH -2
|
||||
|
@ -704,7 +704,10 @@ int parse_kbinput(WINDOW *win)
|
||||
/* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */
|
||||
case KEY_RESIZE:
|
||||
#endif
|
||||
case KEY_F0:
|
||||
#if defined(USE_SLANG) && defined(ENABLE_UTF8)
|
||||
case KEY_BAD:
|
||||
#endif
|
||||
case KEY_FLUSH:
|
||||
return ERR;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user