Merge branch 'master' into rexy712

This commit is contained in:
rexy712 2023-02-28 15:34:34 -08:00
commit 070b784a49
9 changed files with 57 additions and 23 deletions

View File

@ -5,7 +5,7 @@
<title>The GNU nano editor FAQ</title> <title>The GNU nano editor FAQ</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="The genesis story of the nano editor, plus the solution to some common problems."> <meta name="description" content="The genesis story of the nano editor, plus the solution to some common problems.">
<style> <style type="text/css">
.indented { margin-left: 2em; font-family: courier; font-size: 110%; } .indented { margin-left: 2em; font-family: courier; font-size: 110%; }
</style> </style>
</head> </head>

View File

@ -112,6 +112,7 @@ nanorc file. See \fBnanorc\fR(5).
.BR \-E ", " \-\-tabstospaces .BR \-E ", " \-\-tabstospaces
Convert each typed tab to spaces -- to the number of spaces Convert each typed tab to spaces -- to the number of spaces
that a tab at that position would take up. that a tab at that position would take up.
(Note: pasted tabs are not converted.)
.TP .TP
.BR \-F ", " \-\-multibuffer .BR \-F ", " \-\-multibuffer
Read a file into a new buffer by default. Read a file into a new buffer by default.
@ -391,6 +392,9 @@ Suspension is enabled by default, reachable via \fB^T^Z\fR.
(If you want a plain \fB^Z\fR to suspend nano, add (If you want a plain \fB^Z\fR to suspend nano, add
\fBbind ^Z suspend main\fR to your nanorc.) \fBbind ^Z suspend main\fR to your nanorc.)
.sp .sp
When you want to copy marked text from \fBnano\fR to the system's clipboard,
see one of the examples in the \fBnanorc\fR(5) man page.
.sp
If no alternative spell checker command is specified on the command If no alternative spell checker command is specified on the command
line nor in one of the \fInanorc\fP files, \fBnano\fP will check the line nor in one of the \fInanorc\fP files, \fBnano\fP will check the
\fBSPELL\fP environment variable for one. \fBSPELL\fP environment variable for one.
@ -404,6 +408,9 @@ that name already exists in the current directory, it will add ".save"
plus a number (e.g.\& ".save.1") to the current filename in order to make plus a number (e.g.\& ".save.1") to the current filename in order to make
it unique. In multibuffer mode, \fBnano\fP will write all the open it unique. In multibuffer mode, \fBnano\fP will write all the open
buffers to their respective emergency files. buffers to their respective emergency files.
.sp
If you have any question about how to use \fBnano\fR in some specific
situation, you can ask on \fIhelp-nano@gnu.org\fR.
.SH BUGS .SH BUGS
The recording and playback of keyboard macros works correctly only on a The recording and playback of keyboard macros works correctly only on a

View File

@ -123,6 +123,9 @@ following options: @option{--breaklonglines},
@blankline @blankline
Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}. Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}.
@blankline
Questions about using nano you can ask at @email{help-nano@@gnu.org}.
@blankline @blankline
For background information see @url{https://nano-editor.org/}. For background information see @url{https://nano-editor.org/}.
@ -406,6 +409,7 @@ nanorc file. @xref{@code{set keycolor}} for details.
@itemx --tabstospaces @itemx --tabstospaces
Convert each typed tab to spaces --- to the number of spaces Convert each typed tab to spaces --- to the number of spaces
that a tab at that position would take up. that a tab at that position would take up.
(Note: pasted tabs are not converted.)
@item -F @item -F
@itemx --multibuffer @itemx --multibuffer
@ -1140,6 +1144,7 @@ greater than 0. The default value is @t{8}.
@item set tabstospaces @item set tabstospaces
Convert each typed tab to spaces --- to the number of spaces Convert each typed tab to spaces --- to the number of spaces
that a tab at that position would take up. that a tab at that position would take up.
(Note: pasted tabs are not converted.)
@item set titlecolor [bold,][italic,]@var{fgcolor},@var{bgcolor} @item set titlecolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
Use this color combination for the title bar. Use this color combination for the title bar.
@ -1230,9 +1235,10 @@ will be added to this syntax, until a new @code{syntax}
command is encountered. command is encountered.
When @command{nano} is run, this syntax will be automatically When @command{nano} is run, this syntax will be automatically
activated if the current filename matches the extended regular activated (for the relevant buffer) if the absolute filename
expression @var{fileregex}. Or the syntax can be explicitly matches the extended regular expression @var{fileregex}.
activated by using the @option{-Y} or @option{--syntax} Or the syntax can be explicitly activated (for all buffers)
by using the @option{-Y} or @option{--syntax}
command-line option followed by the @var{name}. command-line option followed by the @var{name}.
The @code{default} syntax is special: it takes no @var{fileregex}, The @code{default} syntax is special: it takes no @var{fileregex},

View File

@ -335,6 +335,7 @@ greater than 0. The default value is \fB8\fR.
.B set tabstospaces .B set tabstospaces
Convert each typed tab to spaces -- to the number of spaces Convert each typed tab to spaces -- to the number of spaces
that a tab at that position would take up. that a tab at that position would take up.
(Note: pasted tabs are not converted.)
.TP .TP
.B set titlecolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR .B set titlecolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
Use this color combination for the title bar. Use this color combination for the title bar.
@ -398,12 +399,6 @@ and disappears after 1.5 seconds or upon the next keystroke.
With \fBM\-Z\fR the title bar plus status bar can be toggled. With \fBM\-Z\fR the title bar plus status bar can be toggled.
With \fBM\-X\fR the help lines. With \fBM\-X\fR the help lines.
.SH NOTES
Option \fBset 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.)
.SH SYNTAX HIGHLIGHTING .SH SYNTAX HIGHLIGHTING
Coloring the different syntactic elements of a file Coloring the different syntactic elements of a file
is done via regular expressions (see the \fBcolor\fR command below). is done via regular expressions (see the \fBcolor\fR command below).
@ -444,9 +439,10 @@ will be added to this syntax, until a new \fBsyntax\fR
command is encountered. command is encountered.
.sp .sp
When \fBnano\fR is run, this syntax will be automatically When \fBnano\fR is run, this syntax will be automatically
activated if the current filename matches the extended regular activated (for the relevant buffer) if the absolute filename
expression \fIfileregex\fR. Or the syntax can be explicitly matches the extended regular expression \fIfileregex\fR.
activated by using the \fB\-Y\fR or \fB\-\-syntax\fR Or the syntax can be explicitly activated (for all buffers)
by using the \fB\-Y\fR or \fB\-\-syntax\fR
command-line option followed by the \fIname\fR. command-line option followed by the \fIname\fR.
.sp .sp
The syntax \fBdefault\fP is special: it takes no \fIfileregex\fR, The syntax \fBdefault\fP is special: it takes no \fIfileregex\fR,
@ -1038,6 +1034,20 @@ For \fBbind\fR it means all menus where the specified \fIfunction\fR exists;
for \fBunbind\fR it means all menus where the specified \fIkey\fR exists. for \fBunbind\fR it means all menus where the specified \fIkey\fR exists.
.RE .RE
.SH EXAMPLES
To make \fBCtrl+Z\fR suspend nano:
.sp
.RS
.B bind ^Z suspend main
.RE
.sp
To make \fBShift+Alt+C\fR copy the marked region to the system's clipboard:
.sp
.RS
.B bind Sh-M-C """{execute}| xsel -ib {enter}{undo}""" main
.RE
.sp
.SH FILES .SH FILES
.TP .TP
.I /etc/nanorc .I /etc/nanorc

View File

@ -1417,7 +1417,7 @@ void shortcut_init(void)
add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0); add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0);
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0); add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0);
add_to_sclist(MWHEREIS|MGOTOLINE, "^T", 0, flip_goto, 0); add_to_sclist(MWHEREIS|MGOTOLINE, "^T", 0, flip_goto, 0);
add_to_sclist(MWHEREIS|MGOTOLINE, "^/", 0, flip_goto, 0); add_to_sclist(MWHEREIS|MGOTOLINE, SLASH_OR_DASH, 0, flip_goto, 0);
#ifdef ENABLE_HISTORIES #ifdef ENABLE_HISTORIES
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^P", 0, get_older_item, 0); add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^P", 0, get_older_item, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^N", 0, get_newer_item, 0); add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^N", 0, get_newer_item, 0);

View File

@ -50,7 +50,7 @@ void help_init(void)
char *ptr; char *ptr;
/* First, set up the initial help text for the current function. */ /* First, set up the initial help text for the current function. */
if (currmenu & (MWHEREIS|MREPLACE|MREPLACEWITH)) { if (currmenu & (MWHEREIS|MREPLACE)) {
htx[0] = N_("Search Command Help Text\n\n " htx[0] = N_("Search Command Help Text\n\n "
"Enter the words or characters you would like to " "Enter the words or characters you would like to "
"search for, and then press Enter. If there is a " "search for, and then press Enter. If there is a "
@ -65,6 +65,13 @@ void help_init(void)
"will be replaced.\n\n The following function keys are " "will be replaced.\n\n The following function keys are "
"available in Search mode:\n\n"); "available in Search mode:\n\n");
htx[2] = NULL; htx[2] = NULL;
} else if (currmenu == MREPLACEWITH) {
htx[0] = N_("=== Replacement ===\n\n "
"Type the characters that should replace the characters that "
"you typed at the previous prompt, and press Enter.\n\n");
htx[1] = N_(" The following function keys "
"are available at this prompt:\n\n");
htx[2] = NULL;
} else if (currmenu == MGOTOLINE) { } else if (currmenu == MGOTOLINE) {
htx[0] = N_("Go To Line Help Text\n\n " htx[0] = N_("Go To Line Help Text\n\n "
"Enter the line number that you wish to go to and hit " "Enter the line number that you wish to go to and hit "
@ -126,8 +133,8 @@ void help_init(void)
"shown in brackets after the search prompt. Hitting " "shown in brackets after the search prompt. Hitting "
"Enter without entering any text will perform the " "Enter without entering any text will perform the "
"previous search.\n\n"); "previous search.\n\n");
htx[1] = N_(" The following function keys are available in " htx[1] = N_(" The following function keys "
"Browser Search mode:\n\n"); "are available at this prompt:\n\n");
htx[2] = NULL; htx[2] = NULL;
} else if (currmenu == MGOTODIR) { } else if (currmenu == MGOTODIR) {
htx[0] = N_("Browser Go To Directory Help Text\n\n " htx[0] = N_("Browser Go To Directory Help Text\n\n "
@ -167,8 +174,8 @@ void help_init(void)
htx[1] = N_("If you just need another blank buffer, do not enter any " htx[1] = N_("If you just need another blank buffer, do not enter any "
"command.\n\n You can also pick one of four tools, or cut a " "command.\n\n You can also pick one of four tools, or cut a "
"large piece of the buffer, or put the editor to sleep.\n\n"); "large piece of the buffer, or put the editor to sleep.\n\n");
htx[2] = N_(" The following function keys are " htx[2] = N_(" The following function keys "
"available in Execute Command mode:\n\n"); "are available at this prompt:\n\n");
} else if (currmenu == MLINTER) { } else if (currmenu == MLINTER) {
htx[0] = N_("=== Linter ===\n\n " htx[0] = N_("=== Linter ===\n\n "
"In this mode, the status bar shows an error message or " "In this mode, the status bar shows an error message or "

View File

@ -310,7 +310,7 @@ void do_exit(void)
/* When unmodified, simply close. Else, when doing automatic saving /* When unmodified, simply close. Else, when doing automatic saving
* and the file has a name, simply save. Otherwise, ask the user. */ * and the file has a name, simply save. Otherwise, ask the user. */
if (!openfile->modified) if (!openfile->modified || ISSET(VIEW_MODE))
choice = NO; choice = NO;
else if (ISSET(SAVE_ON_EXIT) && openfile->filename[0] != '\0') else if (ISSET(SAVE_ON_EXIT) && openfile->filename[0] != '\0')
choice = YES; choice = YES;

View File

@ -399,7 +399,7 @@ void implant(const char *string)
} }
/* Continue processing an expansion string. Returns either an error code, /* Continue processing an expansion string. Returns either an error code,
* a plain keycode, or a placeholder for a command shortcut. */ * a plain character byte, or a placeholder for a command shortcut. */
int get_code_from_plantation(void) int get_code_from_plantation(void)
{ {
if (*plants_pointer == '{') { if (*plants_pointer == '{') {
@ -432,6 +432,7 @@ int get_code_from_plantation(void)
return PLANTED_COMMAND; return PLANTED_COMMAND;
} else { } else {
char *opening = strchr(plants_pointer, '{'); char *opening = strchr(plants_pointer, '{');
char firstbyte = *plants_pointer;
int length; int length;
if (opening) { if (opening) {
@ -440,12 +441,12 @@ int get_code_from_plantation(void)
} else } else
length = strlen(plants_pointer); length = strlen(plants_pointer);
for (int index = length - 1; index >= 0; index--) for (int index = length - 1; index > 0; index--)
put_back((unsigned char)plants_pointer[index]); put_back((unsigned char)plants_pointer[index]);
plants_pointer += length; plants_pointer += length;
return ERR; return (firstbyte) ? firstbyte : ERR;
} }
} }
#endif #endif

View File

@ -24,6 +24,9 @@ color brightcyan "\<(exec|print)([[:blank:]]|$)"
# Special values. # Special values.
color brightmagenta "\<(False|None|True)\>" color brightmagenta "\<(False|None|True)\>"
# Decorators.
color cyan "@[[:alpha:]_][[:alnum:]_.]*"
# Mono-quoted strings. # Mono-quoted strings.
color brightgreen "'([^'\]|\\.)*'|"([^"\]|\\.)*"|'''|"""" color brightgreen "'([^'\]|\\.)*'|"([^"\]|\\.)*"|'''|""""
color normal "'''|"""" color normal "'''|""""