commit 1ee74172c234ee3d0d0da65aed52f895ed6f13ca
parent 121dd596d940308d64213e3a8d7ffbc3904c945e
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 31 Jul 2025 16:12:42 +0200
rcfile: accept also {}} in a string bind, for symmetry with {{}
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -352,11 +352,14 @@ int get_code_from_plantation(void)
if (!closing)
return MISSING_BRACE;
- if (plants_pointer[1] == '{' && plants_pointer[2] == '}') {
+ /* Handle the {{} sequence, and for symmetry accept {}} too. */
+ if (plants_pointer[1] == '{' || plants_pointer[1] == '}') {
+ if (plants_pointer[2] != '}')
+ return MISSING_BRACE;
plants_pointer += 3;
if (*plants_pointer != '\0')
put_back(MORE_PLANTS);
- return '{';
+ return *(plants_pointer - 2);
}
free(commandname);
diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc
@@ -33,7 +33,7 @@ color crimson "\{(left|right|up|down|home|end|(scroll|page)(up|down)|(top|bottom
color crimson "\{(tab|enter|delete|backspace|verbatim|refresh|suspend|casesens|regexp|backwards|older|newer|(dos|mac)format)\}"
color crimson "\{(append|prepend|backup|flip(goto|replace|execute|pipe|convert|newbuffer)|browser|gotodir|(first|last)(file|line))\}"
color crimson "\{(nohelp|constantshow|softwrap|linenumbers|whitespacedisplay|nosyntax|zero)\}"
-color crimson "\{(smarthome|autoindent|cutfromcursor|breaklonglines|tabstospaces|mouse|\{)\}"
+color crimson "\{(smarthome|autoindent|cutfromcursor|breaklonglines|tabstospaces|mouse|\{|\})\}"
# Commands
color green "^[[:blank:]]*((un)?(bind|set)|include|syntax|header|magic|comment|formatter|linter|tabgives|extendsyntax)\>"