mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 04:41:21 +03:00
rcfile: allow to bind M-[ (even though it is an escape-sequence starter)
The user had better avoid using the keystroke in a macro, but when typing directly at a responsive machine there is no problem, M-[ is a perfectly valid and recognizable keystroke. This fulfills https://savannah.gnu.org/bugs/?58820.
This commit is contained in:
parent
65da6341ba
commit
8b2114a25f
@ -1280,17 +1280,16 @@ void unbound_key(int code)
|
||||
else if (code > 0x7F)
|
||||
statusline(ALERT, _("Unbound key"));
|
||||
else if (meta_key) {
|
||||
if (code == '[')
|
||||
statusline(ALERT, _("Unbindable key: M-["));
|
||||
#ifndef NANO_TINY
|
||||
else if (code < 0x20)
|
||||
if (code < 0x20)
|
||||
statusline(ALERT, _("Unbindable key: M-^%c"), code + 0x40);
|
||||
else
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
else if (shifted_metas && 'A' <= code && code <= 'Z')
|
||||
if (shifted_metas && 'A' <= code && code <= 'Z')
|
||||
statusline(ALERT, _("Unbound key: Sh-M-%c"), code);
|
||||
#endif
|
||||
else
|
||||
#endif
|
||||
statusline(ALERT, _("Unbound key: M-%c"), toupper(code));
|
||||
} else if (code == ESC_CODE)
|
||||
statusline(ALERT, _("Unbindable key: ^["));
|
||||
|
@ -853,8 +853,8 @@ void parse_binding(char *ptr, bool dobind)
|
||||
newsc->keystr = keycopy;
|
||||
newsc->keycode = keycode;
|
||||
|
||||
/* Disallow rebinding ^[ and frequent escape-sequence starter "Esc [". */
|
||||
if (newsc->keycode == ESC_CODE || newsc->keycode == '[') {
|
||||
/* Disallow rebinding <Esc> (^[). */
|
||||
if (newsc->keycode == ESC_CODE) {
|
||||
jot_error(N_("Keystroke %s may not be rebound"), keycopy);
|
||||
free_things:
|
||||
free(keycopy);
|
||||
|
@ -11,8 +11,8 @@ color brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure
|
||||
color yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|stripe|title)color)[[:space:]]+(bold,)?(italic,)?(bright|light)?(white|black|red|blue|green|yellow|magenta|cyan|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte)?(,(light)?(white|black|red|blue|green|yellow|magenta|cyan|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte))?\>"
|
||||
color brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|stripecolor|titlecolor|whitespace|wordchars)[[:space:]]+"
|
||||
color brightgreen "^[[:space:]]*set[[:space:]]+(fill[[:space:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:space:]]+[1-9][0-9]*)\>"
|
||||
color brightgreen "^[[:space:]]*bind[[:space:]]+((\^([A-Za-z]|[]/@\^_`]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+([a-z]+|".*")[[:space:]]+(main|help|search|replace(with)?|yesno|gotoline|writeout|insert|browser|whereisfile|gotodir|execute|spell|linter|all)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([A-Za-z]|[]/@\^_`]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*bind[[:space:]]+((\^([A-Za-z]|[]/@\^_`]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([][!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+([a-z]+|".*")[[:space:]]+(main|help|search|replace(with)?|yesno|gotoline|writeout|insert|browser|whereisfile|gotodir|execute|spell|linter|all)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([A-Za-z]|[]/@\^_`]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([][!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|formatter|linter|tabgives)[[:space:]]+.*"
|
||||
color brightgreen "^[[:space:]]*(syntax[[:space:]]+[^[:blank:]]+|(formatter|linter)[[:space:]]+.+)"
|
||||
color green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|formatter|linter|tabgives|extendsyntax)\>"
|
||||
|
Loading…
Reference in New Issue
Block a user