tweaks: condense a fragment of code

master
Benno Schulenberg 2020-01-12 12:32:20 +01:00
parent 7b0b9a12ea
commit 99f0265d34
2 changed files with 7 additions and 9 deletions

View File

@ -454,15 +454,12 @@ const keystruct *get_shortcut(int *kbinput)
(*kbinput >= 0xA0 && *kbinput <= 0xFF)))
return NULL;
if (bracketed_paste && *kbinput != BRACKETED_PASTE_MARKER) {
/* Beep and ignore all non-printable characters in prompts. */
if (currmenu != MMAIN)
return NULL;
/* Beep and ignore most non-printable characters in buffer. */
if (*kbinput != 0x09 && *kbinput != 0xD)
return NULL;
}
/* During a paste, ignore all command keycodes at a prompt, and
* allow only <Tab> and <Enter> to pass into the edit window. */
if (bracketed_paste && *kbinput != BRACKETED_PASTE_MARKER &&
(currmenu != MMAIN ||
(*kbinput != TAB_CODE && *kbinput != CR_CODE)))
return NULL;
for (keystruct *s = sclist; s != NULL; s = s->next) {
if ((s->menus & currmenu) && *kbinput == s->keycode &&

View File

@ -569,6 +569,7 @@ enum
/* Basic control codes. */
#define BS_CODE 0x08
#define TAB_CODE 0x09
#define CR_CODE 0x0D
#define ESC_CODE 0x1B
#define DEL_CODE 0x7F