diff --git a/src/global.c b/src/global.c index 5dfc2b1c..913b44d6 100644 --- a/src/global.c +++ b/src/global.c @@ -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 and 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 && diff --git a/src/nano.h b/src/nano.h index 2011fcde..edfddf94 100644 --- a/src/nano.h +++ b/src/nano.h @@ -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