Merge branch 'master' of https://git.savannah.gnu.org/git/nano into line-folding

This commit is contained in:
2024-06-09 07:27:29 -07:00
32 changed files with 216 additions and 94 deletions

View File

@@ -208,6 +208,9 @@
URxvt.keysym.M-Right: \033[1;3C
URxvt.keysym.M-Left: \033[1;3D
URxvt.keysym.M-Home: \033[1;3H
URxvt.keysym.M-End: \033[1;3F
URxvt.keysym.M-Insert: \033[2;3~
URxvt.keysym.M-Delete: \033[3;3~

View File

@@ -25,9 +25,6 @@ nano \- Nano's ANOther text editor, inspired by Pico
.B nano
.RI [ options "] [[\fB+" line [\fB, column "]] " file ]...
.sp
.B nano
.RI [ options "] [" file [\fB: line [\fB: column "]]]..."
.sp
.BR nano " [" \fIoptions "] [[" + [ crCR ]{ / | ? } \fIstring "] " \fIfile ]...
.SH NOTICE
@@ -58,9 +55,6 @@ When giving a filename on the command line, the cursor can be put on a
specific line by adding the line number with a plus sign (\fB+\fR) before
the filename, and even in a specific column by adding it with a comma.
Negative numbers count from the end of the file or line.
The line and column numbers may also be specified by gluing them with colons
after the filename. (When a filename contains a colon followed by digits,
escape the colon by preceding it with a triple backslash.)
.sp
The cursor can be put on the first or last occurrence of a specific string
by specifying that string after \fB+/\fR or \fB+?\fR before the filename.
@@ -110,6 +104,9 @@ the built-in help (\fB^G\fR) lists all the available ones.
The default key bindings can be changed via a \fInanorc\fR file -- see
.BR nanorc (5).
.\" Never hyphenate these:
.hw ncurses terminfo
.SH OPTIONS
.TP
.BR \-A ", " \-\-smarthome
@@ -129,9 +126,10 @@ numbered one every time a file is saved -- when backups are enabled (\fB\-B\fR).
The uniquely numbered files are stored in the specified \fIdirectory\fR.
.TP
.BR \-D ", " \-\-boldtext
For the interface, use bold instead of reverse video. This will be overridden
by setting the options \fBtitlecolor\fP, \fBstatuscolor\fP, \fBkeycolor\fP,
\fBfunctioncolor\fP, \fBnumbercolor\fP, and/or \fBselectedcolor\fP in your
For the interface, use bold instead of reverse video.
This can be overridden for specific elements by setting the options
\fBtitlecolor\fP, \fBstatuscolor\fP, \fBpromptcolor\fP, \fBminicolor\fP,
\fBkeycolor\fP, \fBnumbercolor\fP, and/or \fBselectedcolor\fP in your
nanorc file. See \fBnanorc\fR(5).
.TP
.BR \-E ", " \-\-tabstospaces
@@ -160,7 +158,7 @@ in your \fInanorc\fR file.)
.BR \-K ", " \-\-rawsequences
Interpret escape sequences directly, instead of asking \fBncurses\fR
to translate them. (If you need this option to get some keys to work
properly, it means that the terminfo terminal description that is used
properly, it means that the \fBterminfo\fR terminal description that is used
does not fully match the actual behavior of your terminal. This can
happen when you ssh into a BSD machine, for example.)
Using this option disables \fBnano\fR's mouse support.
@@ -204,7 +202,6 @@ with any name beginning with 'r' (e.g. "rnano").
Display over multiple screen rows lines that exceed the screen's width.
(You can make this soft-wrapping occur at whitespace instead of rudely at
the screen's edge, by using also \fB\-\-atblanks\fR.)
(The old short option, \fB\-$\fR, is deprecated.)
.TP
.BR \-T\ \fInumber ", " \-\-tabsize= \fInumber
Set the size (width) of a tab to \fInumber\fP columns. The value of
@@ -350,10 +347,23 @@ Don't show the two help lines at the bottom of the screen.
.BR \-y ", " \-\-afterends
Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings.
.TP
.BR \-z ", " \-\-listsyntaxes
List the names of the available syntaxes and exit.
.TP
.BR \-! ", " \-\-magic
When neither the file's name nor its first line give a clue,
try using libmagic to determine the applicable syntax.
.TP
.BR \-@ ", " \-\-colonparsing
When a filename given on the command line ends in a colon plus digits
and this filename does not exist, then snip the colon plus digits and
understand the digits as a line number. If the trimmed filename does
not exist either, then repeat the process and understand the obtained
two numbers as line and column number. But if the doubly trimmed
filename does not exist either, then forget the trimming and accept
the original filename as is. To disable this colon parsing, use
something like \fB+1\fR before the filename.
.TP
.BR \-% ", " \-\-stateflags
Use the top-right corner of the screen for showing some state flags:
\fBI\fR when auto-indenting, \fBM\fR when the mark is on, \fBL\fR when
@@ -426,7 +436,6 @@ See \fI/usr/share/nano/\fR and \fI/usr/share/nano/extra/\fR
for available syntax-coloring definitions.
.SH NOTES
Option \fB\-z\fR (\fB\-\-suspendable\fR) has been removed.
Suspension is enabled by default, reachable via \fB^T^Z\fR.
(If you want a plain \fB^Z\fR to suspend nano, add
\fBbind ^Z suspend main\fR to your nanorc.)

View File

@@ -156,9 +156,6 @@ The cursor can be put on a specific line of a file by adding
the line number with a plus sign before the filename, and even
in a specific column by adding it with a comma.
Negative numbers count from the end of the file or line.
The line and column numbers may also be specified by gluing them with colons
after the filename. (When a filename contains a colon followed by digits,
escape the colon by preceding it with a triple backslash.)
The cursor can be put on the first or last occurrence of a specific string
by specifying that string after @code{+/} or @code{+?} before the filename.
@@ -430,9 +427,10 @@ The uniquely numbered files are stored in the specified directory.
@item -D
@itemx --boldtext
For the interface, use bold instead of reverse video. This will be overridden
For the interface, use bold instead of reverse video.
This can be overridden for specific elements
by setting the options @code{titlecolor}, @code{statuscolor},
@code{promptcolor}, @code{minicolor}, @code{keycolor}, @code{functioncolor},
@code{promptcolor}, @code{minicolor}, @code{keycolor},
@code{numbercolor}, and/or @code{selectedcolor} in your
nanorc file. @xref{@code{set keycolor}} for details.
@@ -521,7 +519,6 @@ any name beginning with @code{r} (e.g.@: @command{rnano}).
Display over multiple screen rows lines that exceed the screen's width.
(You can make this soft-wrapping occur at whitespace instead of rudely at
the screen's edge, by using also @code{--atblanks}.)
(The old short option, @code{-$}, is deprecated.)
@item -T @var{number}
@itemx --tabsize=@var{number}
@@ -715,11 +712,26 @@ disabled to display the help-system navigation keys.
Make @kbd{Ctrl+Right} and @kbd{Ctrl+Delete} stop at word ends
instead of beginnings.
@item -z
@itemx --listsyntaxes
List the names of the available syntaxes and exit.
@item -!
@itemx --magic
When neither the file's name nor its first line give a clue,
try using libmagic to determine the applicable syntax.
@item -@
@itemx --colonparsing
When a filename given on the command line ends in a colon plus digits
and this filename does not exist, then snip the colon plus digits and
understand the digits as a line number. If the trimmed filename does
not exist either, then repeat the process and understand the obtained
two numbers as line and column number. But if the doubly trimmed
filename does not exist either, then forget the trimming and accept
the original filename as is. To disable this colon parsing, use
something like @code{+1} before the filename.
@item -%
@itemx --stateflags
Use the top-right corner of the screen for showing some state flags:
@@ -773,7 +785,6 @@ Note that this overrides option @option{-p} (@option{--preserve}).
@end table
@sp 1
Option @code{-z} (@code{--suspendable}) has been removed.
Suspension is enabled by default, reachable via @kbd{^T^Z}.
(If you want a plain @kbd{^Z} to suspend nano, add
@code{bind ^Z suspend main} to your nanorc.)
@@ -907,10 +918,11 @@ with @code{set backup} or @option{--backup} or @option{-B}.
The uniquely numbered files are stored in the specified directory.
@item set boldtext
Use bold instead of reverse video for the title bar, status bar, key combos,
function tags, line numbers, and selected text. This is overridden by
setting the options @code{titlecolor}, @code{statuscolor}, @code{keycolor},
@code{functioncolor}, @code{numbercolor}, and/or @code{selectedcolor}.
Use bold instead of reverse video for the title bar, status bar,
prompt bar, mini bar, key combos, line numbers, and selected text.
This can be overridden by setting the options @code{titlecolor},
@code{statuscolor}, @code{promptcolor}, @code{minicolor},
@code{keycolor}, @code{numbercolor}, and/or @code{selectedcolor}.
@item set bookstyle
When justifying, treat any line that starts with whitespace as the
@@ -929,6 +941,16 @@ Automatically hard-wrap the current line when it becomes overlong.
@item set casesensitive
Do case-sensitive searches by default.
@item set colonparsing
When a filename given on the command line ends in a colon plus digits
and this filename does not exist, then snip the colon plus digits and
understand the digits as a line number. If the trimmed filename does
not exist either, then repeat the process and understand the obtained
two numbers as line and column number. But if the doubly trimmed
filename does not exist either, then forget the trimming and accept
the original filename as is. To disable this colon parsing, use
something like @code{+1} before the filename.
@item set constantshow
Constantly display the cursor position on the status bar.
Note that this overrides @option{quickblank}.
@@ -1834,7 +1856,6 @@ position to the end of the line.
@item breaklonglines
Toggles whether long lines will be hard-wrapped to the next line.
(The old name of this function, 'nowrap', is deprecated.)
@item tabstospaces
Toggles whether typed tabs will be converted to spaces.

View File

@@ -50,6 +50,9 @@ lines at the end of your \fInanorc\fR file:
.RE
.sp
.\" Never hyphenate these:
.hw ncurses terminfo
.SH OPTIONS
The configuration file accepts a series of \fBset\fP and \fBunset\fP
commands, which can be used to configure nano on startup without using
@@ -99,11 +102,10 @@ The uniquely numbered files are stored in the specified \fIdirectory\fR.
.TP
.B set boldtext
Use bold instead of reverse video for the title bar, status bar,
prompt bar, mini bar, key combos, function tags, line numbers,
prompt bar, mini bar, key combos, line numbers,
and selected text. This can be overridden by setting the options
\fBtitlecolor\fP, \fBstatuscolor\fP,
\fBpromptcolor\fP, \fBminicolor\fP, \fBkeycolor\fP, \fBfunctioncolor\fP,
\fBnumbercolor\fP, and/or \fBselectedcolor\fP.
\fBtitlecolor\fP, \fBstatuscolor\fP, \fBpromptcolor\fP, \fBminicolor\fP,
\fBkeycolor\fP, \fBnumbercolor\fP, and/or \fBselectedcolor\fP.
.TP
.B set bookstyle
When justifying, treat any line that starts with whitespace as the
@@ -121,6 +123,16 @@ Automatically hard-wrap the current line when it becomes overlong.
.B set casesensitive
Do case-sensitive searches by default.
.TP
.B set colonparsing
When a filename given on the command line ends in a colon plus digits
and this filename does not exist, then snip the colon plus digits and
understand the digits as a line number. If the trimmed filename does
not exist either, then repeat the process and understand the obtained
two numbers as line and column number. But if the doubly trimmed
filename does not exist either, then forget the trimming and accept
the original filename as is. To disable this colon parsing, use
something like \fB+1\fR before the filename.
.TP
.B set constantshow
Constantly display the cursor position in the status bar.
This overrides the option \fBquickblank\fR.
@@ -279,7 +291,7 @@ email, and to rewrap blocks of line comments when writing source code.
.B set rawsequences
Interpret escape sequences directly, instead of asking \fBncurses\fR
to translate them. (If you need this option to get some keys to work
properly, it means that the terminfo terminal description that is used
properly, it means that the \fBterminfo\fR terminal description that is used
does not fully match the actual behavior of your terminal. This can
happen when you ssh into a BSD machine, for example.)
Using this option disables \fBnano\fR's mouse support.
@@ -995,7 +1007,6 @@ position to the end of the line.
.TP
.B breaklonglines
Toggles whether long lines will be hard-wrapped to the next line.
(The old name of this function, 'nowrap', is deprecated.)
.TP
.B tabstospaces
Toggles whether typed tabs will be converted to spaces.

View File

@@ -383,6 +383,7 @@ enum {
EMPTY_LINE,
INDICATOR,
BOOKSTYLE,
COLON_PARSING,
STATEFLAGS,
USE_MAGIC,
MINIBAR,

View File

@@ -2197,7 +2197,7 @@ int write_it_out(bool exiting, bool withprompt)
given = mallocstrcpy(given, answer);
#ifdef ENABLE_BROWSER
if (function == to_files) {
if (function == to_files && !ISSET(RESTRICTED)) {
char *chosen = browse_in(answer);
if (chosen == NULL)
@@ -2214,10 +2214,10 @@ int write_it_out(bool exiting, bool withprompt)
} else if (function == mac_format) {
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE : MAC_FILE;
continue;
} else if (function == back_it_up) {
} else if (function == back_it_up && !ISSET(RESTRICTED)) {
TOGGLE(MAKE_BACKUP);
continue;
} else if (function == prepend_it || function == append_it) {
} else if ((function == prepend_it || function == append_it) && !ISSET(RESTRICTED)) {
if (function == prepend_it)
method = (method == PREPEND) ? OVERWRITE : PREPEND;
else

View File

@@ -580,6 +580,7 @@ void shortcut_init(void)
const char *replace_gist = N_("Replace a string or a regular expression");
const char *gotoline_gist = N_("Go to line and column number");
#ifndef NANO_TINY
const char *bracket_gist = N_("Go to the matching bracket");
const char *mark_gist = N_("Mark text starting from the cursor position");
const char *zap_gist = N_("Throw away the current line (or marked region)");
const char *indent_gist = N_("Indent the current line (or marked lines)");
@@ -606,20 +607,17 @@ void shortcut_init(void)
#ifndef NANO_TINY
const char *toprow_gist = N_("Go to first row in the viewport");
const char *bottomrow_gist = N_("Go to last row in the viewport");
const char *center_gist = N_("Center the line where the cursor is");
#endif
const char *prevpage_gist = N_("Go one screenful up");
const char *nextpage_gist = N_("Go one screenful down");
const char *firstline_gist = N_("Go to the first line of the file");
const char *lastline_gist = N_("Go to the last line of the file");
#ifndef NANO_TINY
const char *bracket_gist = N_("Go to the matching bracket");
#endif
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
const char *scrollup_gist =
N_("Scroll up one line without moving the cursor textually");
const char *scrolldown_gist =
N_("Scroll down one line without moving the cursor textually");
const char *center_gist = N_("Center the line where the cursor is");
#endif
#ifdef ENABLE_MULTIBUFFER
const char *prevfile_gist = N_("Switch to the previous file buffer");
@@ -1089,7 +1087,7 @@ void shortcut_init(void)
add_to_funcs(full_refresh, MMAIN,
N_("Refresh"), WHENHELP(refresh_gist), TOGETHER);
#endif
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
#ifndef NANO_TINY
add_to_funcs(do_center, MMAIN,
N_("Center"), WHENHELP(center_gist), BLANKAFTER);
#endif
@@ -1443,7 +1441,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-J", 0, do_full_justify, 0);
add_to_sclist(MEXECUTE, "^J", 0, do_full_justify, 0);
#endif
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
#ifndef NANO_TINY
add_to_sclist(MMAIN, "^L", 0, do_center, 0);
#endif
add_to_sclist(MMOST|MBROWSER|MHELP|MYESNO, "^L", 0, full_refresh, 0);

View File

@@ -222,7 +222,15 @@ void to_bottom_row(void)
place_the_cursor();
}
#endif
/* Scroll the line with the cursor to the center of the screen. */
void do_center(void)
{
adjust_viewport(CENTERING);
draw_all_subwindows();
full_refresh();
}
#endif /* !NANO_TINY */
#ifdef ENABLE_JUSTIFY
/* Move to the first beginning of a paragraph before the current line. */
@@ -699,14 +707,6 @@ void do_scroll_down(void)
))
edit_scroll(FORWARD);
}
/* Scroll the line with the cursor to the center of the screen. */
void do_center(void)
{
adjust_viewport(CENTERING);
draw_all_subwindows();
full_refresh();
}
#endif /* !NANO_TINY || ENABLE_HELP */
/* Move left one character. */

View File

@@ -581,8 +581,7 @@ void usage(void)
N_("Which other characters are word parts"));
#endif
#ifdef ENABLE_COLOR
if (!ISSET(RESTRICTED))
print_opt(_("-Y <name>"), _("--syntax=<name>"),
print_opt(_("-Y <name>"), _("--syntax=<name>"),
N_("Syntax definition to use for coloring"));
#endif
#ifndef NANO_TINY
@@ -649,10 +648,14 @@ void usage(void)
#ifndef NANO_TINY
print_opt("-y", "--afterends", N_("Make Ctrl+Right stop at word ends"));
#endif
#ifdef ENABLE_COLOR
print_opt("-z", "--listsyntaxes", N_("List the names of available syntaxes"));
#endif
#ifdef HAVE_LIBMAGIC
print_opt("-!", "--magic", N_("Also try magic to determine syntax"));
#endif
#ifndef NANO_TINY
print_opt("-@", "--colonparsing", N_("Accept 'filename:linenumber' notation"));
print_opt("-%", "--stateflags", N_("Show some states on the title bar"));
print_opt("-_", "--minibar", N_("Show a feedback bar at the bottom"));
print_opt("-0", "--zero", N_("Hide all bars, use whole terminal"));
@@ -802,6 +805,27 @@ void version(void)
printf("\n");
}
#ifdef ENABLE_COLOR
/* List the names of the available syntaxes. */
void list_syntax_names(void)
{
int width = 0;
printf(_("Available syntaxes:\n"));
for (syntaxtype *sntx = syntaxes; sntx != NULL; sntx = sntx->next) {
if (width > 45) {
printf("\n");
width = 0;
}
printf(" %s", sntx->name);
width += wideness(sntx->name, 45 * 4);
}
printf("\n");
}
#endif
/* Register that Ctrl+C was pressed during some system call. */
void make_a_note(int signal)
{
@@ -1780,6 +1804,9 @@ int main(int argc, char **argv)
{"nowrap", 0, NULL, 'w'},
#endif
{"nohelp", 0, NULL, 'x'},
#ifdef ENABLE_COLOR
{"listsyntaxes", 0, NULL, 'z'},
#endif
{"modernbindings", 0, NULL, '/'},
#ifndef NANO_TINY
{"smarthome", 0, NULL, 'A'},
@@ -1807,6 +1834,7 @@ int main(int argc, char **argv)
{"indicator", 0, NULL, 'q'},
{"unix", 0, NULL, 'u'},
{"afterends", 0, NULL, 'y'},
{"colonparsing", 0, NULL, '@'},
{"stateflags", 0, NULL, '%'},
{"minibar", 0, NULL, '_'},
{"zero", 0, NULL, '0'},
@@ -1854,11 +1882,9 @@ int main(int argc, char **argv)
/* If the executable's name starts with 'r', activate restricted mode. */
if (*(tail(argv[0])) == 'r')
SET(RESTRICTED);
else if (*(tail(argv[0])) == 'e')
SET(MODERN_BINDINGS);
while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RS$T:UVWX:Y:Z"
"abcdef:ghijklmno:pqr:s:tuvwxy!%_0/", long_options, NULL)) != -1) {
while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z"
"abcdef:ghijklmno:pqr:s:tuvwxyz!@%_0/", long_options, NULL)) > 0) {
switch (optchr) {
#ifndef NANO_TINY
case 'A':
@@ -1944,7 +1970,6 @@ int main(int argc, char **argv)
break;
#ifndef NANO_TINY
case 'S':
case '$': /* Deprecated; remove in 2024. */
SET(SOFTWRAP);
break;
case 'T':
@@ -2091,12 +2116,23 @@ int main(int argc, char **argv)
SET(AFTER_ENDS);
break;
#endif
#ifdef ENABLE_COLOR
case 'z':
if (!ignore_rcfiles)
do_rcfiles();
if (syntaxes)
list_syntax_names();
exit(0);
#endif
#ifdef HAVE_LIBMAGIC
case '!':
SET(USE_MAGIC);
break;
#endif
#ifndef NANO_TINY
case '@':
SET(COLON_PARSING);
break;
case '%':
SET(STATEFLAGS);
break;
@@ -2445,6 +2481,9 @@ int main(int argc, char **argv)
mousefocusin = get_keycode("kxIN", FOCUS_IN);
mousefocusout = get_keycode("kxOUT", FOCUS_OUT);
/* Disable the type-ahead checking that ncurses normally does. */
typeahead(-1);
#ifdef HAVE_SET_ESCDELAY
/* Tell ncurses to pass the Esc key quickly. */
set_escdelay(50);
@@ -2502,21 +2541,32 @@ int main(int argc, char **argv)
#endif
{
char *filename = argv[optind++];
char *colon = filename + (*filename ? 1 : 0);
#ifndef NANO_TINY
struct stat fileinfo;
/* Search the filename for a colon. If the colon is preceded by
* a backslash, elide the backslash and skip the colon. If there
* is a valid number after the colon, chop colon and number off.
/* If the filename contains a colon and this file does not exist,
* then check if the filename ends with digits preceded by a colon
* (possibly preceded by more digits and a colon). If there is or
* are such trailing numbers, chop the colons plus numbers off.
* The number is later used to place the cursor on that line. */
while ((colon = strchr(colon, ':'))) {
if (*(colon - 1) == '\\')
memmove(colon - 1, colon, strlen(colon) + 1);
else if (parse_line_column(colon + 1, &givenline, &givencol))
*colon = '\0';
else
++colon;
if (ISSET(COLON_PARSING) && !givenline && strchr(filename, ':') &&
!givencol && stat(filename, &fileinfo) < 0) {
char *coda = filename + strlen(filename);
maybe_two:
while (--coda > filename + 1 && ('0' <= *coda && *coda <= '9'))
;
if (*coda == ':' && ('0' <= *(coda + 1) && *(coda +1) <= '9')) {
*coda = '\0';
if (stat(filename, &fileinfo) < 0) {
*coda = ':';
/* If this was the first colon, look for a second one. */
if (!strchr(coda + 1, ':'))
goto maybe_two;
} else if (!parse_line_column(coda + 1, &givenline, &givencol))
die(_("Invalid number\n"));
}
}
#endif
if (!open_buffer(filename, TRUE))
continue;
}

View File

@@ -366,6 +366,7 @@ void do_page_down(void);
#ifndef NANO_TINY
void to_top_row(void);
void to_bottom_row(void);
void do_center(void);
#endif
#ifdef ENABLE_JUSTIFY
void do_para_begin(linestruct **line);
@@ -386,7 +387,6 @@ void do_down(void);
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
void do_scroll_up(void);
void do_scroll_down(void);
void do_center(void);
#endif
void do_left(void);
void do_right(void);

View File

@@ -69,7 +69,7 @@ static const rcoption rcopts[] = {
{"nohelp", NO_HELP},
{"nonewlines", NO_NEWLINES},
#ifdef ENABLE_WRAPPING
{"nowrap", NO_WRAP}, /* Deprecated; remove in 2024. */
{"nowrap", NO_WRAP}, /* Deprecated; remove in 2027. */
#endif
#ifdef ENABLE_OPERATINGDIR
{"operatingdir", 0},
@@ -98,6 +98,7 @@ static const rcoption rcopts[] = {
{"backup", MAKE_BACKUP},
{"backupdir", 0},
{"bookstyle", BOOKSTYLE},
{"colonparsing", COLON_PARSING},
{"cutfromcursor", CUT_FROM_CURSOR},
{"emptyline", EMPTY_LINE},
{"guidestripe", 0},
@@ -322,6 +323,8 @@ keystruct *strtosc(const char *input)
s->func = do_undo;
else if (!strcmp(input, "redo"))
s->func = do_redo;
else if (!strcmp(input, "suspend"))
s->func = do_suspend;
#endif
else if (!strcmp(input, "left") ||
!strcmp(input, "back"))
@@ -340,8 +343,6 @@ keystruct *strtosc(const char *input)
s->func = do_scroll_up;
else if (!strcmp(input, "scrolldown"))
s->func = do_scroll_down;
else if (!strcmp(input, "center"))
s->func = do_center;
#endif
else if (!strcmp(input, "prevword"))
s->func = to_prev_word;
@@ -360,6 +361,8 @@ keystruct *strtosc(const char *input)
s->func = to_top_row;
else if (!strcmp(input, "bottomrow"))
s->func = to_bottom_row;
else if (!strcmp(input, "center"))
s->func = do_center;
#endif
else if (!strcmp(input, "pageup") ||
!strcmp(input, "prevpage"))
@@ -389,10 +392,6 @@ keystruct *strtosc(const char *input)
s->func = do_backspace;
else if (!strcmp(input, "refresh"))
s->func = full_refresh;
#ifndef NANO_TINY
else if (!strcmp(input, "suspend"))
s->func = do_suspend;
#endif
else if (!strcmp(input, "casesens"))
s->func = case_sens_void;
else if (!strcmp(input, "regexp"))
@@ -470,8 +469,7 @@ keystruct *strtosc(const char *input)
else if (!strcmp(input, "cutfromcursor"))
s->toggle = CUT_FROM_CURSOR;
#ifdef ENABLE_WRAPPING
else if (!strcmp(input, "breaklonglines") ||
!strcmp(input, "nowrap")) /* Deprecated; remove in 2024. */
else if (!strcmp(input, "breaklonglines"))
s->toggle = BREAK_LONG_LINES;
#endif
else if (!strcmp(input, "tabstospaces"))
@@ -1049,7 +1047,7 @@ short indices[COLORCOUNT] = { COLOR_RED, COLOR_GREEN, COLOR_BLUE,
short color_to_short(const char *colorname, bool *vivid, bool *thick)
{
if (strncmp(colorname, "bright", 6) == 0 && colorname[6] != '\0') {
/* Prefix "bright" is deprecated; remove in 2024. */
/* Prefix "bright" is deprecated; remove in 2027. */
*vivid = TRUE;
*thick = TRUE;
colorname += 6;

View File

@@ -430,7 +430,7 @@ int get_code_from_plantation(void)
return PLANTED_A_COMMAND;
} else {
char *opening = strchr(plants_pointer, '{');
char firstbyte = *plants_pointer;
unsigned char firstbyte = *plants_pointer;
int length;
if (opening) {
@@ -458,7 +458,7 @@ int get_input(WINDOW *frame)
else if (frame)
read_keys_from(frame);
if (waiting_codes > 0) {
if (waiting_codes) {
waiting_codes--;
#ifdef ENABLE_NANORC
if (*nextcodes == MORE_PLANTS) {
@@ -878,8 +878,6 @@ int convert_CSI_sequence(const int *seq, size_t length, int *consumed)
#ifndef NANO_TINY
else if (length > 1 && seq[1] == '@')
return shiftcontrolhome;
else if (length > 1 && seq[1] == 0xFE)
return ALT_HOME;
#endif
break;
case '8': /* Esc [ 8 ~ == End on Eterm/rxvt;
@@ -895,8 +893,6 @@ int convert_CSI_sequence(const int *seq, size_t length, int *consumed)
#ifndef NANO_TINY
else if (length > 1 && seq[1] == '@')
return shiftcontrolend;
else if (length > 1 && seq[1] == 0xFE)
return ALT_END;
#endif
break;
case '9': /* Esc [ 9 == Delete on Mach console. */
@@ -1109,12 +1105,6 @@ int parse_kbinput(WINDOW *frame)
#endif
else if (keycode < 0x20 && !last_escape_was_alone)
meta_key = TRUE;
#ifndef NANO_TINY
else if (keycode == KEY_HOME)
return ALT_HOME;
else if (keycode == KEY_END)
return ALT_END;
#endif
} else if (waiting_codes == 0 || nextcodes[0] == ESC_CODE ||
(keycode != 'O' && keycode != '[')) {
if (!shifted_metas)

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for assembler.
## Original author: Mike Frysinger
syntax asm "\.(S|s|asm)$"
magic "assembler source"
comment "//"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for AWK scripts.
## Original author: Donnie Berkholz
syntax awk "\.awk$"
header "^#!.*awk"
magic "awk script"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for CMake files.
## Original author: Felipe Bugno
syntax cmake "(CMakeLists\.txt|\.cmake)$"
comment "#"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for CSS files.
## Original author: Simon Rupf
syntax css "\.css$"
comment "/*|*/"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for Emacs Lisp.
## Original author: Mark Oteiza
syntax elisp "\.el$"
magic "Lisp/Scheme program"
comment ";"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for Fortran 90/95.
## Original author: Pascal Gentil
syntax fortran "\.(f|for|f90|f95)$"
comment "!"
@@ -10,7 +12,7 @@ icolor green "\<(append|asis|assign|assignment|associated|character|common)\>"
icolor green "\<(complex|data|default|delim|dimension|double precision)\>"
icolor green "\<(elemental|epsilon|external|file|fmt|form|format|huge)\>"
icolor green "\<(implicit|include|index|inquire|integer|intent|interface)\>"
icolor green "\<(intrinsic|iostat|kind|logical|module|none|null|only)>"
icolor green "\<(intrinsic|iostat|kind|logical|module|none|null|only)\>"
icolor green "\<(operator|optional|pack|parameter|pointer|position|private)\>"
icolor green "\<(program|public|real|recl|recursive|selected_int_kind)\>"
icolor green "\<(selected_real_kind|subroutine|status)\>"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for POV-Ray files.
## Original author: Donnie Berkholz
syntax pov "\.(pov|POV|povray|POVRAY)$"
comment "//"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for RPM spec files.
## Original author: Asterios Dramis
syntax spec "\.spec(\.[^/]+)?$"
comment "#"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for groff.
## Original author: Robert D. Goulding
syntax groff "\.(m[ems]|rof|tmac)$|/tmac\.[^/]+$"
comment ".\""

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for Guile Scheme.
## Original author: Mark Oteiza
syntax guile "\.scm$"
header "^#!.*guile"
comment ";"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for man pages.
## Original author: Mike Frysinger
syntax man "\.[1-9]x?$"
magic "troff or preprocessor input"
comment ".\""
@@ -12,9 +14,12 @@ color brightred "^\.(B[IR]?|I[BR]?|R[BI]|S[BM]) .*"
color brightblue "^\.((B[IR]?|I[BR]?|R[BI]|S[BM]) |[LP]?P$)"
# Inline type faces.
color magenta "\\f[BIPR]"
# Hyphenation control.
color purple "\\[%:]"
color yellow "^\.(hc|hla|hlm|hw|hy)"
# Relative margins, hyperlinks, and various other stuff.
color yellow "^\.(RS|RE|UR|UE|PD|DT)"
color yellow "^\.(ad|bp|br|ce|de|ds|el|ie|if|fi|ft|hy|ig|in|na|ne|nf|nh|ps|so|sp|ti|tr)"
color yellow "^\.(ad|bp|br|ce|de|ds|el|ie|if|fi|ft|ig|in|na|ne|nf|nh|ps|so|sp|ti|tr)"
# Comments.
color cyan "(^\.)?\\".*"

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|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|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|stateflags|tabstospaces|trimblanks|unix|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:]]+((\^([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)[[:blank:]]+([a-z]+|".*")[[:blank:]]+(main|help|search|replace(with)?|yesno|gotoline|writeout|insert|execute|browser|whereisfile|gotodir|spell|linter|all)\>"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for C/C++/Obj-C files.
## Original author: Dave Geering
syntax m "\.m$"
magic "Objective-C source"
comment "//"

View File

@@ -1,6 +1,8 @@
## Syntax highlighting for patch and diff files.
syntax patch "\.(patch|diff|debdiff)$"
## Original author: Mike Frysinger
syntax patch "\.(patch|diff|debdiff|rej)$"
magic "diff output"
# There is no official support for comments in patch files.
comment ""

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for PHP.
## Original author: Mike Frysinger
syntax php "\.(php[23457s~]?|phtml|ctp)$"
magic "PHP script"
comment "//"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for Ruby.
## Original author: John M. Gabriele
syntax ruby "\.rb$"
header "^#!.*ruby"
magic "Ruby script"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for Bourne shell scripts.
## Original author: Mike Frysinger
syntax sh "(\.sh|(^|/|\.)(a|ba|c|da|k|mk|pdk|tc|z)sh(rc|_profile)?|(/etc/|(^|/)\.)profile)$"
header "^#!.*/(((env|busybox)[[:blank:]]+)?(a|ba|c|da|k|mk|pdk|tc|z)?sh|openrc-run|runscript)\>"
header "-\*-.*shell-script.*-\*-"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for (Postgres) SQL scripts.
## Original author: Devrim Gündüz
syntax sql "\.sql$"
comment "-- "

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for Tcl and Expect scripts.
## Original author: Mike Frysinger
syntax tcl "\.(tcl|exp)$"
magic "Tcl(/Tk)? script"
comment "#"

View File

@@ -1,5 +1,7 @@
## Syntax highlighting for XML files.
## Original author: Josef Schugt
syntax xml "\.([jrsx]html?|jnlp|mml|pom|rng|sgml?|svg|w[as]dl|wsdd|xjb|xml|xs(d|lt?)|xul)$"
header "<\?xml.*version=.*\?>"
magic "(XML|SGML) (sub)?document"