diff --git a/src/nano.c b/src/nano.c index ff4b9a27fa887e1d1b0107a2b9a89f374c4797ae..263045bc7260deba288f897d1cdcee1f90ed96a2 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1568,7 +1568,9 @@ void unbound_key(int code) statusline(ALERT, _("Unbindable key: M-[")); else statusline(ALERT, _("Unbound key: M-%c"), toupper(code)); - } else if (code < 0x20) + } else if (code == ESC_CODE) + statusline(ALERT, _("Unbindable key: ^[")); + else if (code < 0x20) statusline(ALERT, _("Unbound key: ^%c"), code + 0x40); else statusline(ALERT, _("Unbound key: %c"), code); diff --git a/src/rcfile.c b/src/rcfile.c index f588b7a385447391d047d5e51de6ec504a992d96..581bae8036ba20d859c2cdc45a934b141130f64e 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -464,9 +464,10 @@ void parse_binding(char *ptr, bool dobind) newsc->menus = menu; assign_keyinfo(newsc, keycopy, 0); - /* Do not allow rebinding a frequent escape-sequence starter: Esc [. */ - if (newsc->meta && newsc->keycode == 91) { - rcfile_error(N_("Sorry, keystroke \"%s\" may not be rebound"), newsc->keystr); + /* Disallow rebinding ^[ and frequent escape-sequence starter "Esc [". */ + if ((!newsc->meta && newsc->keycode == ESC_CODE) || + (newsc->meta && newsc->keycode == '[')) { + rcfile_error(N_("Keystroke %s may not be rebound"), keycopy); free_things: free(keycopy); free(newsc);