From f813fd0f4da308b86c04435fc3cbb40a8aa78ace Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 7 Oct 2019 16:10:26 +0200 Subject: [PATCH] rcfile: allow binding also F17...F24 For historical reasons the rebinding code allows binding F13...F16, which on most terminals are typable with Shift plus F1...F4. But, at least on an Xfce Terminal, Shift plus F1...F12 produce F13...F24. On a Linux console, Shift plus F1...F8 produce F13...F20. So: allow to bind the full shifted F13...F24 range. It costs no extra code and makes things more rounded. --- doc/nano.texi | 4 +++- doc/nanorc.5 | 4 +++- src/global.c | 2 +- syntax/nanorc.nanorc | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/nano.texi b/doc/nano.texi index 9a1a1320..fab503b0 100644 --- a/doc/nano.texi +++ b/doc/nano.texi @@ -1164,8 +1164,10 @@ or the word "Space". Example: @code{M-C}. @item -@code{F@var{n}} ------ where @var{n} is a numeric value from 1 to 16. +@code{F@var{n}} ------ where @var{n} is a numeric value from 1 to 24. Example: @code{F10}. +(Often, @code{F13} to @code{F24} can be typed as @code{F1} to @code{F12} +with Shift.) @item @code{Ins} or @code{Del}. diff --git a/doc/nanorc.5 b/doc/nanorc.5 index 41584d0e..87d85713 100644 --- a/doc/nanorc.5 +++ b/doc/nanorc.5 @@ -495,8 +495,10 @@ where \fIX\fR is any ASCII character except [, or the word "Space". Example: M\-C. .TP .BI F N -where \fIN\fR is a numeric value from 1 to 16. +where \fIN\fR is a numeric value from 1 to 24. Example: F10. +(Often, \fBF13\fR to \fBF24\fR can be typed as \fBF1\fR to \fBF12\fR with Shift.) + .TP .BR Ins " or " Del . .RE diff --git a/src/global.c b/src/global.c index 000c894c..c8b01c7e 100644 --- a/src/global.c +++ b/src/global.c @@ -503,7 +503,7 @@ int keycode_from_string(const char *keystring) return -1; } else if (keystring[0] == 'F') { int fn = atoi(&keystring[1]); - if (fn < 1 || fn > 16) + if (fn < 1 || fn > 24) return -1; return KEY_F0 + fn; } else if (!strcasecmp(keystring, "Ins")) diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc index 82dcbc64..71820351 100644 --- a/syntax/nanorc.nanorc +++ b/syntax/nanorc.nanorc @@ -11,8 +11,8 @@ icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecur icolor yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|stripe|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>" icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|stripecolor|titlecolor|whitespace|wordchars)[[:space:]]+" icolor brightgreen "^[[:space:]]*set[[:space:]]+(fill[[:space:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:space:]]+[1-9][0-9]*)\>" -icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)" -icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)" +icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)" +icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./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:]]*$)" icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter|tabgives)[[:space:]]+.*" icolor brightgreen "^[[:space:]]*(syntax|linter)[[:space:]]+[^[:blank:]]+" icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|tabgives|extendsyntax)\>"