options: accept --solosidescroll and 'set solosidescroll'

These options activate the old, jerky, single-line sideways scrolling
instead of the new default smooth whole-window sideways scrolling.
This commit is contained in:
Benno Schulenberg 2026-01-11 16:17:52 +01:00
parent 7779a19903
commit a7e8dd7d6b
3 changed files with 8 additions and 2 deletions

View File

@ -654,6 +654,7 @@ void usage(void)
print_opt("-0", "--zero", N_("Hide all bars, use whole terminal"));
#endif
print_opt("-/", "--modernbindings", N_("Use better-known key bindings"));
print_opt("-1", "--solosidescroll", N_("Scroll only the current line sideways"));
}
/* Display the version number of this nano, a copyright notice, some contact
@ -1809,6 +1810,7 @@ int main(int argc, char **argv)
{"listsyntaxes", 0, NULL, 'z'},
#endif
{"modernbindings", 0, NULL, '/'},
{"solosidescroll", 0, NULL, '1'},
#ifndef NANO_TINY
{"smarthome", 0, NULL, 'A'},
{"backup", 0, NULL, 'B'},
@ -1886,7 +1888,7 @@ int main(int argc, char **argv)
SET(RESTRICTED);
while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z"
"abcdef:ghijklmno:pqr:s:tuvwxyz!@%_0/", long_options, NULL)) > 0) {
"abcdef:ghijklmno:pqr:s:tuvwxyz!@%_01/", long_options, NULL)) > 0) {
switch (optchr) {
#ifndef NANO_TINY
case 'A':
@ -2151,6 +2153,9 @@ int main(int argc, char **argv)
case '/':
SET(MODERN_BINDINGS);
break;
case '1':
SET(SOLO_SIDESCROLL);
break;
default:
printf(_("Type '%s -h' for a list of available options.\n"), argv[0]);
exit(1);

View File

@ -87,6 +87,7 @@ static const rcoption rcopts[] = {
{"rebinddelete", REBIND_DELETE},
{"regexp", USE_REGEXP},
{"saveonexit", SAVE_ON_EXIT},
{"solosidescroll", SOLO_SIDESCROLL},
#ifdef ENABLE_SPELLER
{"speller", 0},
#endif

View File

@ -14,7 +14,7 @@ color bold,purple "^[[:blank:]]*include[[:blank:]]+[^[:blank:]"]+"
color lime "^[[:blank:]]*extendsyntax[[:blank:]]+[[:alpha:]]+[[:blank:]]+(i?color|header|magic|comment|formatter|linter|tabgives)[[:blank:]]+.*"
# The arguments of commands
color brightgreen "^[[:blank:]]*(set|unset)[[:blank:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|boldtext|bookstyle|breaklonglines|casesensitive|colonparsing|constantshow|cutfromcursor|emptyline|historylog|indicator|jumpyscrolling|linenumbers|locking|magic|minibar|mouse|multibuffer|noconvert|nohelp|nonewlines|positionlog|preserve|quickblank|rawsequences|rebinddelete|regexp|saveonexit|showcursor|smarthome|softwrap|stateflags|tabstospaces|trimblanks|unix|whitespacedisplay|wordbounds|zap|zero)\>"
color brightgreen "^[[:blank:]]*(set|unset)[[:blank:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|boldtext|bookstyle|breaklonglines|casesensitive|colonparsing|constantshow|cutfromcursor|emptyline|historylog|indicator|jumpyscrolling|linenumbers|locking|magic|minibar|mouse|multibuffer|noconvert|nohelp|nonewlines|positionlog|preserve|quickblank|rawsequences|rebinddelete|regexp|saveonexit|showcursor|smarthome|softwrap|solosidescroll|stateflags|tabstospaces|trimblanks|unix|whitespacedisplay|wordbounds|zap|zero)\>"
color brightgreen "^[[:blank:]]*set[[:blank:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|minicolor|numbercolor|operatingdir|promptcolor|punct|quotestr|scrollercolor|selectedcolor|speller|spotlightcolor|statuscolor|stripecolor|titlecolor|whitespace|wordchars)[[:blank:]]+"
color brightgreen "^[[:blank:]]*set[[:blank:]]+(fill[[:blank:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:blank:]]+[1-9][0-9]*)\>"
color brightgreen "^[[:blank:]]*bind[[:blank:]]+((\^([[:alpha:]]|[]/@\^_`-]|Space)|([Ss][Hh]-)?[Mm]-[[:alpha:]]|[Mm]-([][!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:blank:]]+([[:lower:]]+|".*")[[:blank:]]+(main|help|search|replace(with)?|yesno|gotoline|writeout|insert|execute|browser|whereisfile|gotodir|spell|linter|all)\>"