Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d6b5c13281 | |||
|
|
ef35ea72cf | ||
|
|
8804b6dcd4 | ||
|
|
86b8388889 | ||
|
|
812c48dde4 | ||
|
|
f0f1c94afa | ||
|
|
75b312ded1 | ||
|
|
e65b0ba654 | ||
|
|
d3dd403dc7 | ||
|
|
7f4c2c6a25 | ||
| 4fefb91028 | |||
|
|
cb1b3a28ab | ||
|
|
f7d8735b6b | ||
|
|
fc42ab9b46 | ||
|
|
7f17777a4b | ||
|
|
bcdb27416c | ||
|
|
15c6396d42 | ||
|
|
2c19345e58 | ||
|
|
69a7dd86ec | ||
| 1c4bfb6446 | |||
| 070b784a49 | |||
| 18eb6bae01 | |||
| b5809f3793 | |||
| 9980a98607 | |||
| 442bd49137 | |||
| 263c7fefbf | |||
| 02249f1655 | |||
| ac58a97a92 | |||
| 140f2d72cb | |||
| b81dca5014 | |||
| 0ac593a9ce | |||
| 8daf175b09 | |||
| 49935c0456 | |||
| b145ce016b | |||
| 226108a59f | |||
| 01b30a5a0e | |||
| 05fa7110ec |
@ -222,10 +222,10 @@
|
|||||||
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
|
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
|
||||||
<h3><a name="4.6"></a>4.6. When I paste text into a document, each line gets indented further than the last. Why? And how can I stop this?</h3>
|
<h3><a name="4.6"></a>4.6. When I paste text into a document, each line gets indented further than the last. Why? And how can I stop this?</h3>
|
||||||
<blockquote><p>You have the <i>autoindent</i> feature turned on. Hit <b>Meta-I</b> to turn it off, paste your text, and then hit <b>Meta-I</b> again to turn it back on.</p>
|
<blockquote><p>You have the <i>autoindent</i> feature turned on. Hit <b>Meta-I</b> to turn it off, paste your text, and then hit <b>Meta-I</b> again to turn it back on.</p>
|
||||||
<p><i>Update:</i> Since version 4.8, nano will suppress auto-indentation during a paste, so you no longer need to toggle it off and on manually.</p></blockquote>
|
<p><i>Update:</i> Since version 4.8, nano will suppress auto-indentation during a paste (when your terminal understands <a href="https://en.wikipedia.org/wiki/Bracketed-paste">bracketed pastes</a>), so you no longer need to toggle it off and on manually.</p></blockquote>
|
||||||
<h3><a name="4.7"></a>4.7. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?</h3>
|
<h3><a name="4.7"></a>4.7. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?</h3>
|
||||||
<blockquote><p>When pasting from Windows, in some situations linefeeds are sent instead of carriage returns (Enters). And linefeeds are <b>^J</b>s, which make nano justify (rewrap) the current paragraph. To prevent these linefeeds from causing these unwanted justifications, add this line to your .nanorc on the remote Linux box: <b>unbind ^J main</b> or <b>bind ^J enter main</b>, depending on whether the paste contains CR + LF or only LF.</p>
|
<blockquote><p>When pasting from Windows, in some situations linefeeds are sent instead of carriage returns (Enters). And linefeeds are <b>^J</b>s, which make nano justify (rewrap) the current paragraph. To prevent these linefeeds from causing these unwanted justifications, add this line to your .nanorc on the remote Linux box: <b>unbind ^J main</b> or <b>bind ^J enter main</b>, depending on whether the paste contains CR + LF or only LF.</p>
|
||||||
<p><i>Update:</i> Since version 4.8, nano will ignore linefeed characters in a paste, so you no longer need the above workaround.</p></blockquote>
|
<p><i>Update:</i> Since version 4.8, nano will ignore linefeed characters in a paste (when your terminal understands <a href="https://en.wikipedia.org/wiki/Bracketed-paste">bracketed pastes</a>), so you no longer need the above workaround.</p></blockquote>
|
||||||
<h3><a name="4.8"></a>4.8. I've compiled nano with color support, but I don't see any color when I run it!</h3>
|
<h3><a name="4.8"></a>4.8. I've compiled nano with color support, but I don't see any color when I run it!</h3>
|
||||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Several example configurations are in the <b>syntax/</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano/</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9">3.9</a>.</p></blockquote>
|
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Several example configurations are in the <b>syntax/</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano/</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9">3.9</a>.</p></blockquote>
|
||||||
<h3><a name="4.9"></a>4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</h3>
|
<h3><a name="4.9"></a>4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</h3>
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
.TH NANO 1 "version 7.2" "January 2023"
|
.TH NANO 1 "version 7.2" "January 2023"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
nano \- Nano's ANOther editor, inspired by Pico
|
nano \- Nano's ANOther text editor, inspired by Pico
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B nano
|
.B nano
|
||||||
@ -28,10 +28,10 @@ nano \- Nano's ANOther editor, inspired by Pico
|
|||||||
.B nano
|
.B nano
|
||||||
.RI [ options "] [" file [\fB: line [\fB: column "]]]..."
|
.RI [ options "] [" file [\fB: line [\fB: column "]]]..."
|
||||||
.sp
|
.sp
|
||||||
.BR nano " [" \fIoptions "] [[" + [ crCR ]( / | ? ) \fIstring "] " \fIfile ]...
|
.BR nano " [" \fIoptions "] [[" + [ crCR ]{ / | ? } \fIstring "] " \fIfile ]...
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fBnano\fP is a small and friendly editor. It copies the look and feel
|
\fBnano\fP is a small and friendly text editor. It copies the look and feel
|
||||||
of Pico, but is free software, and implements several features that Pico
|
of Pico, but is free software, and implements several features that Pico
|
||||||
lacks, such as: opening multiple files, scrolling per line, undo/redo,
|
lacks, such as: opening multiple files, scrolling per line, undo/redo,
|
||||||
syntax coloring, line numbering, and soft-wrapping overlong lines.
|
syntax coloring, line numbering, and soft-wrapping overlong lines.
|
||||||
|
|||||||
@ -35,7 +35,7 @@ The complete manual for the GNU nano text editor.
|
|||||||
|
|
||||||
@page
|
@page
|
||||||
|
|
||||||
This manual documents the GNU @command{nano} editor.
|
This manual documents the GNU @command{nano} text editor.
|
||||||
@sp 1
|
@sp 1
|
||||||
The contents of this manual are part of the GNU @command{nano} distribution.
|
The contents of this manual are part of the GNU @command{nano} distribution.
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ A more complete command synopsis thus is:
|
|||||||
|
|
||||||
@blankline
|
@blankline
|
||||||
@example
|
@example
|
||||||
@code{nano [OPTION]@dots{} [[+LINE[,COLUMN]|+[crCR](/|?)STRING] FILE]@dots{}}
|
@code{nano [OPTION]@dots{} [[+LINE[,COLUMN]|+[crCR]@{/|?@}STRING] FILE]@dots{}}
|
||||||
@end example
|
@end example
|
||||||
@blankline
|
@blankline
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ nanorc \- GNU nano's configuration file
|
|||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The \fInanorc\fP files contain the default settings for \fBnano\fP,
|
The \fInanorc\fP files contain the default settings for \fBnano\fP,
|
||||||
a small and friendly editor. During startup, if \fB\-\-rcfile\fR
|
a small and friendly text editor. During startup, if \fB\-\-rcfile\fR
|
||||||
is not given, \fBnano\fR will read two files: first the
|
is not given, \fBnano\fR will read two files: first the
|
||||||
system-wide settings, from \fI/etc/nanorc\fP (the exact path might be
|
system-wide settings, from \fI/etc/nanorc\fP (the exact path might be
|
||||||
different on your system), and then the user-specific settings, either
|
different on your system), and then the user-specific settings, either
|
||||||
|
|||||||
10
doc/rnano.1
10
doc/rnano.1
@ -32,15 +32,19 @@ access to the filesystem nor to a command shell.
|
|||||||
.sp
|
.sp
|
||||||
In restricted mode, \fBnano\fR will:
|
In restricted mode, \fBnano\fR will:
|
||||||
.IP \[bu] 2
|
.IP \[bu] 2
|
||||||
|
not make backups;
|
||||||
|
.IP \[bu]
|
||||||
not allow suspending;
|
not allow suspending;
|
||||||
.IP \[bu]
|
.IP \[bu]
|
||||||
|
not allow spell checking;
|
||||||
|
.IP \[bu]
|
||||||
|
not read nor write the history files;
|
||||||
|
.IP \[bu]
|
||||||
not allow saving the current buffer under a different name;
|
not allow saving the current buffer under a different name;
|
||||||
.IP \[bu]
|
.IP \[bu]
|
||||||
not allow inserting another file or opening a new buffer;
|
not allow inserting another file or opening a new buffer;
|
||||||
.IP \[bu]
|
.IP \[bu]
|
||||||
not allow appending or prepending to any file;
|
not allow appending or prepending to any file.
|
||||||
.IP \[bu]
|
|
||||||
not make backup files nor do spell checking.
|
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
@ -436,7 +436,10 @@ char *browse(char *path)
|
|||||||
|
|
||||||
titlebar(path);
|
titlebar(path);
|
||||||
|
|
||||||
while (TRUE) {
|
if (list_length == 0) {
|
||||||
|
statusline(ALERT, _("No entries"));
|
||||||
|
napms(1200);
|
||||||
|
} else while (TRUE) {
|
||||||
functionptrtype function;
|
functionptrtype function;
|
||||||
int kbinput;
|
int kbinput;
|
||||||
|
|
||||||
|
|||||||
17
src/cut.c
17
src/cut.c
@ -268,12 +268,19 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
|
|||||||
if (top == bot && top_x == bot_x)
|
if (top == bot && top_x == bot_x)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (top != bot) {
|
/* In case bot is the start of a folded segment.
|
||||||
UNFOLD_SEGMENT(top);
|
* Folds within [top, bot] are taken care of in the following loop */
|
||||||
for (linestruct *line = top->next; line != bot->next; line = line->next) {
|
UNFOLD_SEGMENT(bot);
|
||||||
UNFOLD_SEGMENT(line);
|
|
||||||
|
if (top != bot)
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
top->folded = FALSE;
|
||||||
|
#endif
|
||||||
|
for (linestruct *line = top->next; line != bot->next; line = line->next){
|
||||||
had_anchor |= line->has_anchor;
|
had_anchor |= line->has_anchor;
|
||||||
}
|
#ifdef ENABLE_FOLDING
|
||||||
|
line->folded = FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -214,12 +214,15 @@
|
|||||||
#define SHIFT_DELETE 0x45D
|
#define SHIFT_DELETE 0x45D
|
||||||
#define SHIFT_TAB 0x45F
|
#define SHIFT_TAB 0x45F
|
||||||
|
|
||||||
|
#define FOCUS_IN 0x491
|
||||||
|
#define FOCUS_OUT 0x499
|
||||||
|
|
||||||
/* Special keycodes for when a string bind has been partially implanted
|
/* Special keycodes for when a string bind has been partially implanted
|
||||||
* or has an unpaired opening brace, or when a function in a string bind
|
* or has an unpaired opening brace, or when a function in a string bind
|
||||||
* needs execution or a specified function name is invalid. */
|
* needs execution or a specified function name is invalid. */
|
||||||
#define MORE_PLANTS 0x4EA
|
#define MORE_PLANTS 0x4EA
|
||||||
#define MISSING_BRACE 0x4EB
|
#define MISSING_BRACE 0x4EB
|
||||||
#define PLANTED_COMMAND 0x4EC
|
#define PLANTED_A_COMMAND 0x4EC
|
||||||
#define NO_SUCH_FUNCTION 0x4EF
|
#define NO_SUCH_FUNCTION 0x4EF
|
||||||
|
|
||||||
/* A special keycode for when <Tab> is pressed while the mark is on. */
|
/* A special keycode for when <Tab> is pressed while the mark is on. */
|
||||||
|
|||||||
@ -535,7 +535,8 @@ void mention_name_and_linecount(void)
|
|||||||
if (ISSET(MINIBAR)) {
|
if (ISSET(MINIBAR)) {
|
||||||
report_size = TRUE;
|
report_size = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
} else if (ISSET(ZERO))
|
||||||
|
return;
|
||||||
|
|
||||||
if (openfile->fmt > NIX_FILE)
|
if (openfile->fmt > NIX_FILE)
|
||||||
/* TRANSLATORS: First %s is file name, second %s is file format. */
|
/* TRANSLATORS: First %s is file name, second %s is file format. */
|
||||||
|
|||||||
38
src/global.c
38
src/global.c
@ -107,6 +107,7 @@ int altpageup, altpagedown;
|
|||||||
int altinsert, altdelete;
|
int altinsert, altdelete;
|
||||||
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
||||||
#endif
|
#endif
|
||||||
|
int mousefocusin, mousefocusout;
|
||||||
|
|
||||||
#ifdef ENABLED_WRAPORJUSTIFY
|
#ifdef ENABLED_WRAPORJUSTIFY
|
||||||
ssize_t fill = -COLUMNS_FROM_EOL;
|
ssize_t fill = -COLUMNS_FROM_EOL;
|
||||||
@ -266,9 +267,12 @@ char *startup_problem = NULL;
|
|||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
char *custom_nanorc = NULL;
|
char *custom_nanorc = NULL;
|
||||||
|
/* The argument of the --rcfile option, when given. */
|
||||||
|
|
||||||
char *commandname = NULL;
|
char *commandname = NULL;
|
||||||
|
/* The name (of a function) between braces in a string bind. */
|
||||||
keystruct *planted_shortcut = NULL;
|
keystruct *planted_shortcut = NULL;
|
||||||
|
/* The function that the above name resolves to, if any. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool spotlighted = FALSE;
|
bool spotlighted = FALSE;
|
||||||
@ -464,7 +468,7 @@ const keystruct *get_shortcut(const int keycode)
|
|||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
if (keycode == PLANTED_COMMAND)
|
if (keycode == PLANTED_A_COMMAND)
|
||||||
return planted_shortcut;
|
return planted_shortcut;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -981,7 +985,10 @@ void shortcut_init(void)
|
|||||||
add_to_funcs(do_verbatim_input, MMAIN,
|
add_to_funcs(do_verbatim_input, MMAIN,
|
||||||
N_("Verbatim"), WHENHELP(verbatim_gist), BLANKAFTER);
|
N_("Verbatim"), WHENHELP(verbatim_gist), BLANKAFTER);
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifdef NANO_TINY
|
||||||
|
add_to_funcs(do_search_backward, MMAIN,
|
||||||
|
N_("Where Was"), WHENHELP(wherewas_gist), BLANKAFTER);
|
||||||
|
#else
|
||||||
add_to_funcs(do_indent, MMAIN,
|
add_to_funcs(do_indent, MMAIN,
|
||||||
N_("Indent"), WHENHELP(indent_gist), TOGETHER);
|
N_("Indent"), WHENHELP(indent_gist), TOGETHER);
|
||||||
add_to_funcs(do_unindent, MMAIN,
|
add_to_funcs(do_unindent, MMAIN,
|
||||||
@ -1020,7 +1027,6 @@ void shortcut_init(void)
|
|||||||
add_to_funcs(to_next_anchor, MMAIN,
|
add_to_funcs(to_next_anchor, MMAIN,
|
||||||
N_("Down to anchor"), WHENHELP(nextanchor_gist), BLANKAFTER);
|
N_("Down to anchor"), WHENHELP(nextanchor_gist), BLANKAFTER);
|
||||||
|
|
||||||
if (!ISSET(RESTRICTED)) {
|
|
||||||
#ifdef ENABLE_SPELLER
|
#ifdef ENABLE_SPELLER
|
||||||
add_to_funcs(do_spell, MMAIN,
|
add_to_funcs(do_spell, MMAIN,
|
||||||
N_("Spell Check"), WHENHELP(spell_gist), TOGETHER);
|
N_("Spell Check"), WHENHELP(spell_gist), TOGETHER);
|
||||||
@ -1033,16 +1039,15 @@ void shortcut_init(void)
|
|||||||
add_to_funcs(do_formatter, MMAIN,
|
add_to_funcs(do_formatter, MMAIN,
|
||||||
N_("Formatter"), WHENHELP(formatter_gist), BLANKAFTER);
|
N_("Formatter"), WHENHELP(formatter_gist), BLANKAFTER);
|
||||||
#endif
|
#endif
|
||||||
}
|
/* Although not allowed in restricted mode, keep execution rebindable. */
|
||||||
#endif /* !NANO_TINY */
|
if (ISSET(RESTRICTED))
|
||||||
|
add_to_funcs(do_execute, MMAIN,
|
||||||
|
N_("Execute"), WHENHELP(execute_gist), TOGETHER);
|
||||||
|
|
||||||
#ifdef NANO_TINY
|
|
||||||
add_to_funcs(do_search_backward, MMAIN,
|
|
||||||
N_("Where Was"), WHENHELP(wherewas_gist), BLANKAFTER);
|
|
||||||
#else
|
|
||||||
add_to_funcs(do_suspend, MMAIN,
|
add_to_funcs(do_suspend, MMAIN,
|
||||||
N_("Suspend"), WHENHELP(suspend_gist), TOGETHER);
|
N_("Suspend"), WHENHELP(suspend_gist), TOGETHER);
|
||||||
#endif
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
#ifdef ENABLE_HELP
|
#ifdef ENABLE_HELP
|
||||||
add_to_funcs(full_refresh, MMAIN,
|
add_to_funcs(full_refresh, MMAIN,
|
||||||
N_("Refresh"), WHENHELP(refresh_gist), TOGETHER);
|
N_("Refresh"), WHENHELP(refresh_gist), TOGETHER);
|
||||||
@ -1113,7 +1118,7 @@ void shortcut_init(void)
|
|||||||
N_("No Conversion"), WHENHELP(convert_gist), BLANKAFTER);
|
N_("No Conversion"), WHENHELP(convert_gist), BLANKAFTER);
|
||||||
|
|
||||||
/* Command execution is only available when not in restricted mode. */
|
/* Command execution is only available when not in restricted mode. */
|
||||||
if (!ISSET(RESTRICTED) && !ISSET(VIEW_MODE)) {
|
if (!ISSET(RESTRICTED) && !ISSET(VIEW_MODE))
|
||||||
add_to_funcs(flip_execute, MINSERTFILE,
|
add_to_funcs(flip_execute, MINSERTFILE,
|
||||||
N_("Execute Command"), WHENHELP(execute_gist), BLANKAFTER);
|
N_("Execute Command"), WHENHELP(execute_gist), BLANKAFTER);
|
||||||
|
|
||||||
@ -1122,7 +1127,6 @@ void shortcut_init(void)
|
|||||||
|
|
||||||
add_to_funcs(do_suspend, MEXECUTE,
|
add_to_funcs(do_suspend, MEXECUTE,
|
||||||
N_("Suspend"), WHENHELP(suspend_gist), BLANKAFTER);
|
N_("Suspend"), WHENHELP(suspend_gist), BLANKAFTER);
|
||||||
}
|
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
#ifdef ENABLE_BROWSER
|
#ifdef ENABLE_BROWSER
|
||||||
@ -1475,24 +1479,22 @@ void shortcut_init(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
add_to_sclist(MBROWSER|MHELP, "^C", 0, do_exit, 0);
|
||||||
#ifdef ENABLE_BROWSER
|
#ifdef ENABLE_BROWSER
|
||||||
/* Only when not in restricted mode, allow entering the file browser. */
|
/* Only when not in restricted mode, allow entering the file browser. */
|
||||||
if (!ISSET(RESTRICTED))
|
if (!ISSET(RESTRICTED))
|
||||||
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files, 0);
|
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files, 0);
|
||||||
#endif
|
/* Allow exiting the file browser with the same key as used for entry. */
|
||||||
add_to_sclist(MBROWSER|MHELP, "^C", 0, do_exit, 0);
|
|
||||||
/* Allow exiting from the file browser and the help viewer with
|
|
||||||
* the same key as they were entered. */
|
|
||||||
#ifdef ENABLE_BROWSER
|
|
||||||
add_to_sclist(MBROWSER, "^T", 0, do_exit, 0);
|
add_to_sclist(MBROWSER, "^T", 0, do_exit, 0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_HELP
|
#ifdef ENABLE_HELP
|
||||||
|
/* Allow exiting the help viewer with the same keys as used for entry. */
|
||||||
add_to_sclist(MHELP, "^G", 0, do_exit, 0);
|
add_to_sclist(MHELP, "^G", 0, do_exit, 0);
|
||||||
add_to_sclist(MHELP, "F1", KEY_F(1), do_exit, 0);
|
add_to_sclist(MHELP, "F1", KEY_F(1), do_exit, 0);
|
||||||
add_to_sclist(MHELP, "Home", KEY_HOME, to_first_line, 0);
|
add_to_sclist(MHELP, "Home", KEY_HOME, to_first_line, 0);
|
||||||
add_to_sclist(MHELP, "End", KEY_END, to_last_line, 0);
|
add_to_sclist(MHELP, "End", KEY_END, to_last_line, 0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_LINTER
|
||||||
add_to_sclist(MLINTER, "^X", 0, do_cancel, 0);
|
add_to_sclist(MLINTER, "^X", 0, do_cancel, 0);
|
||||||
#endif
|
#endif
|
||||||
add_to_sclist(MMOST & ~MFINDINHELP, "F1", KEY_F(1), do_help, 0);
|
add_to_sclist(MMOST & ~MFINDINHELP, "F1", KEY_F(1), do_help, 0);
|
||||||
|
|||||||
11
src/move.c
11
src/move.c
@ -258,7 +258,6 @@ void to_prev_block(void)
|
|||||||
openfile->current = line_step;
|
openfile->current = line_step;
|
||||||
line_step = get_prev_visible_line(line_step);
|
line_step = get_prev_visible_line(line_step);
|
||||||
#ifdef ENABLE_FOLDING
|
#ifdef ENABLE_FOLDING
|
||||||
/* Skip over the visibly drawn line of the folded segment */
|
|
||||||
if (openfile->current->folded)
|
if (openfile->current->folded)
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
@ -291,7 +290,6 @@ void to_next_block(void)
|
|||||||
openfile->current = line_step;
|
openfile->current = line_step;
|
||||||
line_step = get_next_visible_line(line_step);
|
line_step = get_next_visible_line(line_step);
|
||||||
#ifdef ENABLE_FOLDING
|
#ifdef ENABLE_FOLDING
|
||||||
/* Skip over the visibly drawn line of the folded segment */
|
|
||||||
if (openfile->current->folded)
|
if (openfile->current->folded)
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
@ -307,14 +305,13 @@ void to_next_block(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Move to the previous word.
|
/* Move to the previous word.
|
||||||
* when allow_folded is true, will move to previous word even if inside
|
* when allow_folded as true, will move to previous word even if inside
|
||||||
* a folded segment */
|
* a folded segment */
|
||||||
void do_prev_word(bool allow_folded)
|
void do_prev_word(bool allow_folded)
|
||||||
{
|
{
|
||||||
bool punctuation_as_letters = ISSET(WORD_BOUNDS);
|
bool punctuation_as_letters = ISSET(WORD_BOUNDS);
|
||||||
bool seen_a_word = FALSE, step_forward = FALSE;
|
bool seen_a_word = FALSE, step_forward = FALSE;
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_FOLDING
|
#ifdef ENABLE_FOLDING
|
||||||
if (!allow_folded && openfile->current->folded) {
|
if (!allow_folded && openfile->current->folded) {
|
||||||
openfile->current = get_prev_visible_line(openfile->current);
|
openfile->current = get_prev_visible_line(openfile->current);
|
||||||
@ -368,7 +365,8 @@ void do_prev_word(bool allow_folded)
|
|||||||
|
|
||||||
/* Move to the next word. If after_ends is TRUE, stop at the ends of words
|
/* Move to the next word. If after_ends is TRUE, stop at the ends of words
|
||||||
* instead of at their beginnings. If allow_folded is true, go to next word
|
* instead of at their beginnings. If allow_folded is true, go to next word
|
||||||
* even if it's inside a folded segment. Return TRUE if we started on a word. */
|
* even if it's inside a folded segment.
|
||||||
|
* Return TRUE if we started on a word. */
|
||||||
bool do_next_word(bool after_ends, bool allow_folded)
|
bool do_next_word(bool after_ends, bool allow_folded)
|
||||||
{
|
{
|
||||||
bool punctuation_as_letters = ISSET(WORD_BOUNDS);
|
bool punctuation_as_letters = ISSET(WORD_BOUNDS);
|
||||||
@ -396,8 +394,7 @@ bool do_next_word(bool after_ends, bool allow_folded)
|
|||||||
if (!allow_folded) {
|
if (!allow_folded) {
|
||||||
openfile->current = get_next_visible_line(openfile->current);
|
openfile->current = get_next_visible_line(openfile->current);
|
||||||
if (openfile->current->folded) {
|
if (openfile->current->folded) {
|
||||||
/* get_next_visible_line() gives the start of a folded segment,
|
/* get_next_visible_line() gives the start of a segment, so skip to the end */
|
||||||
* so skip to the end */
|
|
||||||
openfile->current = get_end_of_folded_segment(openfile->current);
|
openfile->current = get_end_of_folded_segment(openfile->current);
|
||||||
openfile->current = openfile->current->next;
|
openfile->current = openfile->current->next;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2434,6 +2434,8 @@ int main(int argc, char **argv)
|
|||||||
shiftaltup = get_keycode("kUP4", SHIFT_ALT_UP);
|
shiftaltup = get_keycode("kUP4", SHIFT_ALT_UP);
|
||||||
shiftaltdown = get_keycode("kDN4", SHIFT_ALT_DOWN);
|
shiftaltdown = get_keycode("kDN4", SHIFT_ALT_DOWN);
|
||||||
#endif
|
#endif
|
||||||
|
mousefocusin = get_keycode("kxIN", FOCUS_IN);
|
||||||
|
mousefocusout = get_keycode("kxOUT", FOCUS_OUT);
|
||||||
|
|
||||||
#ifdef HAVE_SET_ESCDELAY
|
#ifdef HAVE_SET_ESCDELAY
|
||||||
/* Tell ncurses to pass the Esc key quickly. */
|
/* Tell ncurses to pass the Esc key quickly. */
|
||||||
|
|||||||
@ -80,6 +80,7 @@ extern int altinsert, altdelete;
|
|||||||
extern int shiftaltleft, shiftaltright;
|
extern int shiftaltleft, shiftaltright;
|
||||||
extern int shiftaltup, shiftaltdown;
|
extern int shiftaltup, shiftaltdown;
|
||||||
#endif
|
#endif
|
||||||
|
extern int mousefocusin, mousefocusout;
|
||||||
|
|
||||||
#ifdef ENABLED_WRAPORJUSTIFY
|
#ifdef ENABLED_WRAPORJUSTIFY
|
||||||
extern ssize_t fill;
|
extern ssize_t fill;
|
||||||
|
|||||||
16
src/rcfile.c
16
src/rcfile.c
@ -991,16 +991,22 @@ void parse_includes(char *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return the index of the color that is closest to the given RGB levels,
|
/* Return the index of the color that is closest to the given RGB levels,
|
||||||
* assuming that the terminal uses the 6x6x6 color cube of xterm-256color. */
|
* assuming that the terminal uses the 6x6x6 color cube of xterm-256color.
|
||||||
|
* When red == green == blue, return an index in the xterm gray scale. */
|
||||||
short closest_index_color(short red, short green, short blue)
|
short closest_index_color(short red, short green, short blue)
|
||||||
{
|
{
|
||||||
/* Translation table, from 16 intended levels to 6 available levels. */
|
/* Translation table, from 16 intended color levels to 6 available levels. */
|
||||||
static const short level[] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 };
|
static const short level[] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 };
|
||||||
|
|
||||||
if (COLORS == 256)
|
/* Translation table, from 14 intended gray levels to 24 available levels. */
|
||||||
return (36 * level[red] + 6 * level[green] + level[blue] + 16);
|
static const short gray[] = { 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 15, 18, 21, 23 };
|
||||||
else
|
|
||||||
|
if (COLORS != 256)
|
||||||
return THE_DEFAULT;
|
return THE_DEFAULT;
|
||||||
|
else if (red == green && green == blue && 0 < red && red < 0xF)
|
||||||
|
return 232 + gray[red - 1];
|
||||||
|
else
|
||||||
|
return (36 * level[red] + 6 * level[green] + level[blue] + 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COLORCOUNT 34
|
#define COLORCOUNT 34
|
||||||
|
|||||||
@ -811,18 +811,16 @@ void goto_line_and_column(ssize_t line, ssize_t column, bool retain_answer,
|
|||||||
line = 1;
|
line = 1;
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
#ifdef ENABLE_FOLDING
|
#ifndef NANO_TINY
|
||||||
linestruct *edit_bottom = openfile->edittop;
|
linestruct *edit_bottom = openfile->edittop;
|
||||||
for (int i = 0;edit_bottom != openfile->filebot && i < editwinrows;++i)
|
for (int i = 0;edit_bottom != openfile->filebot && i < editwinrows;++i)
|
||||||
edit_bottom = get_next_visible_line(edit_bottom);
|
edit_bottom = get_next_visible_line(edit_bottom);
|
||||||
if (line > edit_bottom->lineno ||
|
if (line > edit_bottom->lineno ||
|
||||||
(ISSET(SOFTWRAP) && line > openfile->current->lineno))
|
(ISSET(SOFTWRAP) && line > openfile->current->lineno))
|
||||||
recook |= perturbed;
|
|
||||||
#else
|
#else
|
||||||
if (line > openfile->edittop->lineno + editwinrows ||
|
if (line > openfile->edittop->lineno + editwinrows)
|
||||||
(ISSET(SOFTWRAP) && line > openfile->current->lineno))
|
#endif
|
||||||
recook |= perturbed;
|
recook |= perturbed;
|
||||||
#endif /* ENABLE_FOLDING */
|
|
||||||
#endif /* ENABLE_COLOR */
|
#endif /* ENABLE_COLOR */
|
||||||
|
|
||||||
/* Iterate to the requested line. */
|
/* Iterate to the requested line. */
|
||||||
|
|||||||
@ -422,8 +422,9 @@ void do_comment(void)
|
|||||||
/* Comment/uncomment each of the selected lines when possible, and
|
/* Comment/uncomment each of the selected lines when possible, and
|
||||||
* store undo data when a line changed. */
|
* store undo data when a line changed. */
|
||||||
for (line = top; line != bot->next; line = line->next)
|
for (line = top; line != bot->next; line = line->next)
|
||||||
if (comment_line(action, line, comment_seq))
|
if (comment_line(action, line, comment_seq)) {
|
||||||
update_multiline_undo(line->lineno, "");
|
update_multiline_undo(line->lineno, "");
|
||||||
|
}
|
||||||
|
|
||||||
set_modified();
|
set_modified();
|
||||||
ensure_firstcolumn_is_aligned();
|
ensure_firstcolumn_is_aligned();
|
||||||
@ -865,6 +866,7 @@ void do_enter(void)
|
|||||||
{
|
{
|
||||||
linestruct *newnode = make_new_node(openfile->current);
|
linestruct *newnode = make_new_node(openfile->current);
|
||||||
size_t extra = 0;
|
size_t extra = 0;
|
||||||
|
|
||||||
#ifdef ENABLE_FOLDING
|
#ifdef ENABLE_FOLDING
|
||||||
if (openfile->current->folded) {
|
if (openfile->current->folded) {
|
||||||
newnode->folded = TRUE;
|
newnode->folded = TRUE;
|
||||||
|
|||||||
@ -429,7 +429,7 @@ int get_code_from_plantation(void)
|
|||||||
if (*plants_pointer != '\0')
|
if (*plants_pointer != '\0')
|
||||||
put_back(MORE_PLANTS);
|
put_back(MORE_PLANTS);
|
||||||
|
|
||||||
return PLANTED_COMMAND;
|
return PLANTED_A_COMMAND;
|
||||||
} else {
|
} else {
|
||||||
char *opening = strchr(plants_pointer, '{');
|
char *opening = strchr(plants_pointer, '{');
|
||||||
char firstbyte = *plants_pointer;
|
char firstbyte = *plants_pointer;
|
||||||
@ -1294,6 +1294,10 @@ int parse_kbinput(WINDOW *frame)
|
|||||||
return INDENT_KEY;
|
return INDENT_KEY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Spurious codes from VTE -- see https://sv.gnu.org/bugs/?64578. */
|
||||||
|
if (keycode == mousefocusin || keycode == mousefocusout)
|
||||||
|
return ERR;
|
||||||
|
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case KEY_SLEFT:
|
case KEY_SLEFT:
|
||||||
shift_held = TRUE;
|
shift_held = TRUE;
|
||||||
@ -3183,8 +3187,8 @@ bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge)
|
|||||||
/* Draw a scroll bar on the righthand side of the screen. */
|
/* Draw a scroll bar on the righthand side of the screen. */
|
||||||
void draw_scrollbar(void)
|
void draw_scrollbar(void)
|
||||||
{
|
{
|
||||||
int fromline = openfile->edittop->lineno - 1;
|
|
||||||
int totallines = openfile->filebot->lineno;
|
int totallines = openfile->filebot->lineno;
|
||||||
|
int fromline = openfile->edittop->lineno - 1;
|
||||||
int coveredlines = 0;
|
int coveredlines = 0;
|
||||||
linestruct *line = openfile->edittop;
|
linestruct *line = openfile->edittop;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user