mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 22:29:42 +03:00
input: interpret a keystroke as Meta only when an earlier escape was solo
This allows using <Esc> <Esc> <letter> in a macro as an alternative
for <Ctrl+letter>, but it does require that one does not type <Esc>
by accident when recording a macro as it might modify the subsequent
keystroke when the macro is replayed.
This fixes https://savannah.gnu.org/bugs/?58904.
Bug existed since version 3.0, commit ecc9211a
.
This commit is contained in:
parent
048ab0ee0b
commit
d96f296b8e
@ -889,6 +889,7 @@ int convert_to_control(int kbinput)
|
||||
* the function keys (F1-F12), and the numeric keypad with NumLock off. */
|
||||
int parse_kbinput(WINDOW *win)
|
||||
{
|
||||
static bool first_escape_was_alone = FALSE;
|
||||
static bool solitary = FALSE;
|
||||
static int escapes = 0;
|
||||
int keycode;
|
||||
@ -905,6 +906,7 @@ int parse_kbinput(WINDOW *win)
|
||||
/* Remember whether an Esc arrived by itself, and increment
|
||||
* its counter, rolling around on three escapes. */
|
||||
if (keycode == ESC_CODE) {
|
||||
first_escape_was_alone = solitary;
|
||||
solitary = (key_buffer_len == 0);
|
||||
if (digit_count > 0) {
|
||||
digit_count = 0;
|
||||
@ -998,7 +1000,7 @@ int parse_kbinput(WINDOW *win)
|
||||
} else if (digit_count == 0) {
|
||||
/* If the second escape did not arrive alone, it is a Meta
|
||||
* keystroke; otherwise, it is an "Esc Esc control". */
|
||||
if (!solitary) {
|
||||
if (first_escape_was_alone && !solitary) {
|
||||
if (!shifted_metas)
|
||||
keycode = tolower(keycode);
|
||||
meta_key = TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user