feedback: beep also at a prompt when receiving an unknown escape sequence
Nano would beep (and report "Unknown sequence") only when in the main edit window, in the help viewer, or in the file browser. But the same keystroke at a prompt would be enigmatically silent. Also, in the file browser, nano would leave the cursor at the end of the "Unknown sequence" message when --showcursor was used. This fixes https://savannah.gnu.org/bugs/?58490. Bug existed (in this form) since around version 2.7.4, and in a worse form since around version 2.3.5.master
parent
da43cc0959
commit
c5b0e1958a
|
@ -1261,7 +1261,11 @@ void confirm_margin(void)
|
|||
/* Say that an unbound key was struck, and if possible which one. */
|
||||
void unbound_key(int code)
|
||||
{
|
||||
if (code > 0x7F)
|
||||
if (code == FOREIGN_SEQUENCE)
|
||||
/* TRANSLATORS: This refers to a sequence of escape codes
|
||||
* (from the keyboard) that nano does not recognize. */
|
||||
statusline(ALERT, _("Unknown sequence"));
|
||||
else if (code > 0x7F)
|
||||
statusline(ALERT, _("Unbound key"));
|
||||
else if (meta_key) {
|
||||
if (code == '[')
|
||||
|
|
|
@ -615,6 +615,9 @@ enum
|
|||
/* A special keycode to signal the beginning and end of a bracketed paste. */
|
||||
#define BRACKETED_PASTE_MARKER 0x4FB
|
||||
|
||||
/* A special keycode for when a key produces an unknown escape sequence. */
|
||||
#define FOREIGN_SEQUENCE 0x4FC
|
||||
|
||||
#ifdef USE_SLANG
|
||||
#ifdef ENABLE_UTF8
|
||||
#define KEY_BAD 0xFF /* Clipped error code. */
|
||||
|
|
13
src/winio.c
13
src/winio.c
|
@ -805,7 +805,7 @@ int convert_sequence(const int *seq, size_t length, int *consumed)
|
|||
}
|
||||
}
|
||||
|
||||
return ERR;
|
||||
return FOREIGN_SEQUENCE;
|
||||
}
|
||||
|
||||
/* Interpret the escape sequence in the keystroke buffer, the first
|
||||
|
@ -829,17 +829,6 @@ int parse_escape_sequence(WINDOW *win, int kbinput)
|
|||
|
||||
free(sequence);
|
||||
|
||||
/* If we got an unrecognized escape sequence, notify the user. */
|
||||
if (retval == ERR && win == edit) {
|
||||
/* TRANSLATORS: This refers to a sequence of escape codes
|
||||
* (from the keyboard) that nano does not recognize. */
|
||||
statusline(ALERT, _("Unknown sequence"));
|
||||
suppress_cursorpos = FALSE;
|
||||
lastmessage = HUSH;
|
||||
if (currmenu == MMAIN || currmenu == MHELP)
|
||||
place_the_cursor();
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue