Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd8ce7af8e | ||
|
|
c5a0c9b6b2 | ||
|
|
6520aa0079 | ||
|
|
3d8b9895b8 | ||
|
|
9026e04c73 | ||
|
|
92befae93d | ||
|
|
dbbc14e0ac | ||
|
|
8b80ec3e1a | ||
|
|
a71a2f9a0c | ||
|
|
56ce5f2ba8 | ||
|
|
5ebdd3fe6e | ||
|
|
426e6d37c5 | ||
|
|
4dd9aadf8a | ||
|
|
5ecd81bd19 | ||
|
|
b4a955512e | ||
|
|
33c7a4ca95 | ||
|
|
40d34862fd | ||
|
|
bee670424e | ||
|
|
8dffb00fd9 | ||
|
|
403e87c0a0 | ||
|
|
942bb39547 | ||
|
|
52b7a41ea4 | ||
|
|
6807e06a74 | ||
|
|
84cd0abd6f | ||
|
|
6a70d2b6e2 | ||
|
|
16482f99b8 | ||
|
|
621eb904b3 | ||
|
|
84ff9ebb91 | ||
|
|
a2038a9b2b | ||
|
|
a969adf804 | ||
|
|
59b0f81bfa | ||
|
|
6ad3d3d6c0 | ||
|
|
ca70885564 | ||
|
|
cfa20c3f42 | ||
|
|
4781d4d351 | ||
|
|
ef1a3b08ae | ||
|
|
4063fce6a0 |
41
ChangeLog
41
ChangeLog
@@ -1,3 +1,44 @@
|
||||
Changes between v2.8.4 and v2.8.5:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (35):
|
||||
bindings: in the tiny version exclude word jumping from the prompts
|
||||
bump version numbers and add a news item for the 2.8.5 release
|
||||
display: don't let a SIGCONT write anything to the screen
|
||||
display: don't show the cursor while we are busy calculating its position
|
||||
display: redraw title bar and edit window only when needed
|
||||
display: show the cursor position also when searching took a while
|
||||
docs: avoid a double "see" for cross references in the HTML manual
|
||||
docs: spell "title bar" and "status bar" correctly
|
||||
gnulib: update to its current state
|
||||
input: give an appropriate message when there are too many errors
|
||||
startup: allow negative line and column numbers on the command line
|
||||
startup: allow positioning the cursor also when reading standard input
|
||||
startup: always open with the file that was mentioned first
|
||||
startup: don't crash when opening standard input would fail
|
||||
startup: don't mark the buffer as modified when in view mode
|
||||
startup: don't mark the buffer as modified when nothing was read
|
||||
startup: don't try placing the cursor when reading standard input failed
|
||||
startup: don't use position history when reading from standard input
|
||||
suspension: fake a SIGWINCH when coming back out of the background
|
||||
suspension: remove a duplicate setting of the HUP and TERM handler
|
||||
syntax: default: allow leading whitespace before a hash comment
|
||||
tweaks: adjust indentation after preceding changes
|
||||
tweaks: avoid compiler warning about implicit type
|
||||
tweaks: be consistent in the spelling of title bar and status bar
|
||||
tweaks: don't bother calculating the position when we won't show it
|
||||
tweaks: elide a function that should not be a separate one
|
||||
tweaks: elide a variable
|
||||
tweaks: frob a few comments, and elide and #ifndef
|
||||
tweaks: reduce the scope of three variables, and rename them besides
|
||||
tweaks: reduce the scope of two variables, and rename them too
|
||||
tweaks: rename a function and a variable, to better match what they do
|
||||
tweaks: rename a variable, and frob a couple of comments
|
||||
tweaks: rename two functions and a variable, and invert its logic
|
||||
tweaks: reshuffle some stuff, to put related things closer together
|
||||
tweaks: unglobalize the nodelay_mode variable
|
||||
|
||||
|
||||
Changes between v2.8.3 and v2.8.4:
|
||||
----------------------------------
|
||||
|
||||
|
||||
11
NEWS
11
NEWS
@@ -1,4 +1,13 @@
|
||||
2017.05.21 - GNU nano 2.8.4 includes the nanorc man page again.
|
||||
2017.06.25 - GNU nano 2.8.5 "Farouche" avoids a crash when waking from
|
||||
a suspension that was induced from the outside, allows
|
||||
negative line and column numbers on the command line,
|
||||
avoids some flickering when resizing the screen while
|
||||
in the file browser, opens files in the order they were
|
||||
mentioned on the command line, and does not pretend to
|
||||
have woken from suspension when receiving a SIGCONT.
|
||||
|
||||
2017.05.21 - GNU nano 2.8.4 "Our Version of Events" includes the nanorc
|
||||
man page again.
|
||||
|
||||
2017.05.18 - GNU nano 2.8.3 "Hirsch" fixes a misplacement of the spotlight
|
||||
during interactive replacing, avoids build failures on AIX
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Generate configure & friends for GIT users.
|
||||
|
||||
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
||||
gnulib_hash="4be488081b917f98a2fd3e2766324043649cca6e"
|
||||
gnulib_hash="736844e30bb369d203d45503a7cab9f560113cab"
|
||||
|
||||
modules="
|
||||
futimens
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
AC_INIT([GNU nano], [2.8.4], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.8.5], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE([1.14])
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<h2><a name="1.3"></a>1.3. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.4"></a>1.4. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>2.8.4</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>2.8.5</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="https://nano-editor.org/dist/latest/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
@@ -161,7 +161,7 @@
|
||||
<blockquote><p>To use multiple file buffers, you must not have configured nano with <b>--disable-multibuffer</b> nor with <b>--enable-tiny</b> (use <b>nano -V</b> to check the compilation options). Then when you want to insert a file into its own buffer instead of into the current file, just hit <b>Meta-F</b> after typing <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<p>You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b> keys, or more easily without holding Shift: <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the normal "Exit" when only one buffer is open.</p></blockquote>
|
||||
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
|
||||
<blockquote><p>When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message "Verbatim Input" on the statusbar), then press the key(s) that generate the character you want.</p>
|
||||
<blockquote><p>When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message "Verbatim Input" on the status bar), then press the key(s) that generate the character you want.</p>
|
||||
<p>Alternatively, if you've enabled Unicode support (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code (from 000000 to 10FFFF, case-insensitive), and the character with the corresponding value will be inserted. The statubar will change to "Unicode Input: ......" when you do this.</p></blockquote>
|
||||
<h2><a name="3.9a"></a>3.9a. How do I make a .nanorc file that will be read when I start nano?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your nano must <b>not</b> have been compiled with <b>--disable-nanorc</b>. Then simply copy the <b>sample.nanorc</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax of the file is simple. Flags are turned on and off by using the words <b>set</b> and <b>unset</b> plus the long option name for the feature. For example, "set nowrap" or "set smarthome".</p></blockquote>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.8.4" "May 2017"
|
||||
.TH NANO 1 "version 2.8.5" "June 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
@@ -113,7 +113,7 @@ Don't add newlines to the ends of files.
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.BR \-O ", " \-\-morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
.TP
|
||||
.BR \-P ", " \-\-positionlog
|
||||
For the 200 most recent files, log the last position of the cursor,
|
||||
@@ -144,7 +144,7 @@ Set the size (width) of a tab to \fInumber\fP columns. The value of
|
||||
\fInumber\fP must be greater than 0. The default value is 8.
|
||||
.TP
|
||||
.BR \-U ", " \-\-quickblank
|
||||
Do quick statusbar blanking: statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25. Note that \fB\-c\fP overrides this.
|
||||
.TP
|
||||
.BR \-V ", " \-\-version
|
||||
@@ -164,7 +164,7 @@ Specify the name of the syntax highlighting to use from among the ones
|
||||
defined in the \fInanorc\fP files.
|
||||
.TP
|
||||
.BR \-c ", " \-\-constantshow
|
||||
Constantly show the cursor position on the statusbar.
|
||||
Constantly show the cursor position on the status bar.
|
||||
Note that this overrides \fB\-U\fP.
|
||||
.TP
|
||||
.BR \-d ", " \-\-rebinddelete
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
@smallbook
|
||||
@set EDITION 0.4
|
||||
@set VERSION 2.8.4
|
||||
@set UPDATED May 2017
|
||||
@set VERSION 2.8.5
|
||||
@set UPDATED June 2017
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -21,7 +21,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor
|
||||
@subtitle version 2.8.4
|
||||
@subtitle version 2.8.5
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -81,8 +81,9 @@ file locking, backup files, and internationalization support.
|
||||
|
||||
The original goal for @code{nano} was to be a complete bug-for-bug
|
||||
emulation of Pico. But currently the goal is to be as compatible
|
||||
as possible while offering a superset of Pico's functionality. See
|
||||
@xref{Pico Compatibility}, for more info.
|
||||
as possible while offering a superset of Pico's functionality.
|
||||
@xref{Pico Compatibility} for more details on how @code{nano} and
|
||||
Pico differ.
|
||||
|
||||
Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}.
|
||||
|
||||
@@ -107,7 +108,7 @@ adding it with a comma. So a more complete command synopsis is:
|
||||
@end quotation
|
||||
|
||||
Normally, however, you set your preferred options in a @file{.nanorc}
|
||||
file (see @xref{Nanorc Files}). And when using @code{set positionlog}
|
||||
file (@pxref{Nanorc Files}). And when using @code{set positionlog}
|
||||
(making @code{nano} remember the cursor position when you close a file),
|
||||
you will rarely need to specify a line number.
|
||||
|
||||
@@ -182,7 +183,7 @@ Disable automatic conversion of files from DOS/Mac format.
|
||||
|
||||
@item -O
|
||||
@itemx --morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
|
||||
@item -P
|
||||
@itemx --positionlog
|
||||
@@ -219,7 +220,7 @@ Set the displayed tab length to @var{number} columns. The value of
|
||||
|
||||
@item -U
|
||||
@itemx --quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25. Note that option @option{-c}
|
||||
(@option{--constantshow}) overrides this.
|
||||
|
||||
@@ -240,12 +241,13 @@ should be considered as parts of words. This overrides option
|
||||
|
||||
@item -Y @var{name}
|
||||
@itemx --syntax=@var{name}
|
||||
Specify a specific syntax from the nanorc files to use for highlighting.
|
||||
See @xref{Syntax Highlighting}, for more info.
|
||||
Specify the syntax to be used for highlighting.
|
||||
@xref{Syntax Highlighting} for more info.
|
||||
|
||||
@item -c
|
||||
@itemx --constantshow
|
||||
Constantly display the cursor position and line number on the statusbar.
|
||||
Constantly display the cursor position (line number, column number,
|
||||
and character number) on the status bar.
|
||||
Note that this overrides option @option{-U} (@option{--quickblank}).
|
||||
|
||||
@item -d
|
||||
@@ -351,7 +353,7 @@ Don't hard-wrap long lines at any length. This option conflicts with
|
||||
@item -x
|
||||
@itemx --nohelp
|
||||
Expert Mode: don't show the Shortcut List at the bottom of the screen.
|
||||
This affects the location of the statusbar as well, as in Expert Mode it
|
||||
This affects the location of the status bar as well, as in Expert Mode it
|
||||
is located at the very bottom of the editor.
|
||||
|
||||
Note: When accessing the help system, Expert Mode is temporarily
|
||||
@@ -475,21 +477,21 @@ If necessary, it can be toggled off manually with another ^6 or M-A.
|
||||
@section Screen Layout
|
||||
|
||||
The default screen of nano consists of five areas. From top to bottom
|
||||
these are: the titlebar, a blank line, the edit window, the statusbar,
|
||||
these are: the title bar, a blank line, the edit window, the status bar,
|
||||
and two help lines.
|
||||
|
||||
The titlebar consists of
|
||||
The title bar consists of
|
||||
three sections: left, center and right. The section on the left
|
||||
displays the version of @code{nano} being used. The center section
|
||||
displays the current filename, or "New Buffer" if the file has not yet
|
||||
been named. The section on the right displays "Modified" if the
|
||||
file has been modified since it was last saved or opened.
|
||||
|
||||
The statusbar is the third line from the bottom of the screen. It
|
||||
The status bar is the third line from the bottom of the screen. It
|
||||
shows important and informational messages. Any error messages that
|
||||
occur from using the editor will appear on the statusbar. Any questions
|
||||
that are asked of the user will be asked on the statusbar, and any user
|
||||
input (search strings, filenames, etc.) will be input on the statusbar.
|
||||
occur from using the editor will appear on the status bar. Any questions
|
||||
that are asked of the user will be asked on the status bar, and any user
|
||||
input (search strings, filenames, etc.) will be input on the status bar.
|
||||
|
||||
The two help lines at the bottom of the screen show some of the most
|
||||
essential functions of the editor. These two lines are called the
|
||||
@@ -545,7 +547,7 @@ and ^V (Page Down) keys. ^X exits the help system.
|
||||
|
||||
Toggles allow you to change on-the-fly certain aspects of the editor
|
||||
which would normally be specified via command-line options. They are
|
||||
invoked via Meta-key sequences (see @xref{Commands}, for more info).
|
||||
invoked via Meta-key sequences (@pxref{Commands} for more info).
|
||||
The following global toggles are available:
|
||||
|
||||
@table @code
|
||||
@@ -581,8 +583,7 @@ toggles the @code{-N} (@code{--noconvert}) command-line option.
|
||||
toggles the @code{-O} (@code{--morespace}) command-line option.
|
||||
|
||||
@item Whitespace Display Toggle (Meta-P)
|
||||
toggles the whitespace-display mode.
|
||||
See @xref{Whitespace}, for more info.
|
||||
toggles the whitespace-display mode (@pxref{Whitespace}).
|
||||
|
||||
@item Tabs to Spaces Toggle (Meta-Q)
|
||||
toggles the @code{-E} (@code{--tabstospaces}) command-line option.
|
||||
@@ -594,8 +595,8 @@ toggles the @code{-S} (@code{--smooth}) command-line option.
|
||||
toggles the @code{-x} (@code{--nohelp}) command-line option.
|
||||
|
||||
@item Color Syntax Highlighting Toggle (Meta-Y)
|
||||
toggles color syntax highlighting if you have color syntaxes in your
|
||||
nanorc. See @xref{Syntax Highlighting}, for more info.
|
||||
toggles color syntax highlighting (if your nanorc defines syntaxes
|
||||
--- @pxref{Syntax Highlighting}).
|
||||
|
||||
@item Suspension Toggle (Meta-Z)
|
||||
toggles the @code{-z} (@code{--suspend}) command-line option.
|
||||
@@ -621,7 +622,7 @@ from @file{~/.nanorc}.
|
||||
A nanorc file accepts a series of "set" and "unset" commands, which can
|
||||
be used to configure @code{nano} on startup without using command-line
|
||||
options. Additionally, there are some commands to define syntax highlighting
|
||||
and to rebind keys --- @xref{Syntax Highlighting}, and @xref{Rebinding Keys}.
|
||||
and to rebind keys --- @pxref{Syntax Highlighting} and @ref{Rebinding Keys}.
|
||||
@code{nano} will read one command per line.
|
||||
|
||||
Options in nanorc files take precedence over @code{nano}'s defaults, and
|
||||
@@ -671,7 +672,7 @@ The uniquely numbered files are stored in the specified directory.
|
||||
Do backwards searches by default.
|
||||
|
||||
@item set boldtext
|
||||
Use bold instead of reverse video for the titlebar, statusbar, key combos,
|
||||
Use bold instead of reverse video for the title bar, status bar, key combos,
|
||||
line numbers, and selected text. This can be overridden for the first four
|
||||
by setting the options @code{titlecolor}, @code{statuscolor}, @code{keycolor},
|
||||
and @code{numbercolor}.
|
||||
@@ -687,7 +688,7 @@ closing brackets, can end sentences. The default value is
|
||||
Do case-sensitive searches by default.
|
||||
|
||||
@item set constantshow
|
||||
Constantly display the cursor position in the status bar.
|
||||
Constantly display the cursor position on the status bar.
|
||||
(The old form of this option, @code{set const}, is deprecated.)
|
||||
|
||||
@item set cut
|
||||
@@ -728,7 +729,7 @@ come before the closing set, and the two sets must be in the same order.
|
||||
The default value is @t{"(<[@{)>]@}"}.
|
||||
|
||||
@item set morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
|
||||
@item set mouse
|
||||
Enable mouse support, so that mouse clicks can be used to place the
|
||||
@@ -779,7 +780,7 @@ specified closing punctuation, optionally followed by closing brackets
|
||||
The default value is @t{"!.?"}.
|
||||
|
||||
@item set quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
|
||||
@item set quiet
|
||||
@@ -830,7 +831,7 @@ Use spelling checker "spellprog" instead of the built-in one, which
|
||||
calls "spell".
|
||||
|
||||
@item set statuscolor @var{fgcolor},@var{bgcolor}
|
||||
Specify the color combination to use for the statusbar.
|
||||
Specify the color combination to use for the status bar.
|
||||
See @code{set titlecolor} for more details.
|
||||
|
||||
@item set suspend
|
||||
@@ -847,7 +848,7 @@ Convert typed tabs to spaces.
|
||||
Save automatically on exit, don't prompt.
|
||||
|
||||
@item set titlecolor @var{fgcolor},@var{bgcolor}
|
||||
Specify the color combination to use for the titlebar.
|
||||
Specify the color combination to use for the title bar.
|
||||
Valid color names for foreground and background are:
|
||||
white, black, blue, green, red, cyan, yellow, and magenta.
|
||||
The name of the foreground color may be prefixed with 'bright'.
|
||||
@@ -1271,7 +1272,7 @@ Toggles the presence of the two-line list of key bindings at the bottom of the s
|
||||
Toggles the constant display of the current line, column, and character positions.
|
||||
|
||||
@item morespace
|
||||
Toggles the presence of the blank line which 'separates' the titlebar from the file text.
|
||||
Toggles the presence of the blank line that 'separates' the title bar from the file text.
|
||||
|
||||
@item smoothscroll
|
||||
Toggles smooth scrolling (when moving around with the arrow keys).
|
||||
@@ -1387,7 +1388,7 @@ searching via ^W (or 'w') and changing directories via ^_ (or 'g'). The
|
||||
behavior of the Enter (or 's') key varies by what is currently selected.
|
||||
If the currently selected object is a directory, the file browser will
|
||||
enter and display the contents of the directory. If the object is a
|
||||
file, this filename and path are copied to the statusbar, and the file
|
||||
file, this filename and path are copied to the status bar, and the file
|
||||
browser exits.
|
||||
|
||||
|
||||
@@ -1454,8 +1455,8 @@ browser is just a file browser, not a file manager.
|
||||
Many options which alter the functionality of the program can be
|
||||
"toggled" on or off using Meta key sequences, meaning the program does
|
||||
not have to be restarted to turn a particular feature on or off.
|
||||
See the internal help function (^G) for a list of features that
|
||||
can be toggled. Or see @xref{Feature Toggles} instead.
|
||||
@xref{Feature Toggles} for a list of options that can be toggled.
|
||||
Or see the list at the end the main internal help text (^G) instead.
|
||||
|
||||
@end table
|
||||
|
||||
@@ -1530,7 +1531,7 @@ option, which causes a file to be read into a separate buffer by default.
|
||||
Disable support for reading the nanorc files at startup. With such
|
||||
support, you can store custom settings in a system-wide and a per-user
|
||||
nanorc file rather than having to pass command-line options to get
|
||||
the desired behavior. See @xref{Nanorc Files}, for more info.
|
||||
the desired behavior. @xref{Nanorc Files} for more info.
|
||||
Disabling this also eliminates the @code{-I} and @code{-q} command-line
|
||||
options; the first inhibits the reading of nanorcfiles, and the second
|
||||
suppresses warnings about errors in those files.
|
||||
|
||||
14
doc/nanorc.5
14
doc/nanorc.5
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.8.4" "May 2017"
|
||||
.TH NANORC 5 "version 2.8.5" "June 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
@@ -74,7 +74,7 @@ The uniquely numbered files are stored in the specified \fIdirectory\fR.
|
||||
Do backwards searches by default.
|
||||
.TP
|
||||
.B set boldtext
|
||||
Use bold instead of reverse video for the titlebar, statusbar, key combos,
|
||||
Use bold instead of reverse video for the title bar, status bar, key combos,
|
||||
line numbers, and selected text. This can be overridden for the first four
|
||||
by setting the options \fBtitlecolor\fP, \fBstatuscolor\fP, \fBkeycolor\fP,
|
||||
and \fBnumbercolor\fP.
|
||||
@@ -130,7 +130,7 @@ come before the closing set, and the two sets must be in the same order.
|
||||
The default value is "\fB(<[{)>]}\fP".
|
||||
.TP
|
||||
.B set morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
.TP
|
||||
.B set mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
@@ -183,7 +183,7 @@ specfified closing punctuation, optionally followed by closing brackets
|
||||
(see \fBbrackets\fP), can end sentences. The default value is "\fB!.?\fP".
|
||||
.TP
|
||||
.B set quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
.TP
|
||||
.B set quiet
|
||||
@@ -234,7 +234,7 @@ Use spelling checker \fIspellprog\fP instead of the built-in one, which
|
||||
calls \fIspell\fP.
|
||||
.TP
|
||||
.B set statuscolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the statusbar.
|
||||
Specify the color combination to use for the status bar.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set suspend
|
||||
@@ -251,7 +251,7 @@ Convert typed tabs to spaces.
|
||||
Save automatically on exit, don't prompt.
|
||||
.TP
|
||||
.B set titlecolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the titlebar.
|
||||
Specify the color combination to use for the title bar.
|
||||
Valid names for the foreground and background colors are:
|
||||
.BR white ", " black ", " blue ", " green ", " red ", " cyan ", " yellow ", and " magenta .
|
||||
The name of the foreground color may be prefixed with \fBbright\fR.
|
||||
@@ -666,7 +666,7 @@ Toggles the presence of the two-line list of key bindings at the bottom of the s
|
||||
Toggles the constant display of the current line, column, and character positions.
|
||||
.TP
|
||||
.B morespace
|
||||
Toggles the presence of the blank line which 'separates' the titlebar from the file text.
|
||||
Toggles the presence of the blank line that 'separates' the title bar from the file text.
|
||||
.TP
|
||||
.B smoothscroll
|
||||
Toggles smooth scrolling (when moving around with the arrow keys).
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 2.8.4" "May 2017"
|
||||
.TH RNANO 1 "version 2.8.5" "June 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
## Do case-sensitive searches by default.
|
||||
# set casesensitive
|
||||
|
||||
## Constantly display the cursor position in the statusbar. Note that
|
||||
## Constantly display the cursor position in the status bar. Note that
|
||||
## this overrides "quickblank".
|
||||
# set constantshow
|
||||
## (The old form, 'const', is deprecated.)
|
||||
@@ -76,7 +76,7 @@
|
||||
## come before the latter set, and both must be in the same order.
|
||||
# set matchbrackets "(<[{)>]}"
|
||||
|
||||
## Use the blank line below the titlebar as extra editing space.
|
||||
## Use the blank line below the title bar as extra editing space.
|
||||
# set morespace
|
||||
|
||||
## Enable mouse support, if available for your system. When enabled,
|
||||
@@ -124,7 +124,7 @@
|
||||
## sentences.
|
||||
# set punct "!.?"
|
||||
|
||||
## Do quick statusbar blanking. Statusbar messages will disappear after
|
||||
## Do quick status-bar blanking. Status-bar messages will disappear after
|
||||
## 1 keystroke instead of 26. Note that "const" overrides this.
|
||||
# set quickblank
|
||||
|
||||
|
||||
419
po/nano.pot
419
po/nano.pot
File diff suppressed because it is too large
Load Diff
411
po/pt_BR.po
411
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
411
po/zh_CN.po
411
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
411
po/zh_TW.po
411
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
14
src/global.c
14
src/global.c
@@ -57,6 +57,9 @@ bool have_palette = FALSE;
|
||||
/* Whether the colors for the current syntax have been initialized. */
|
||||
#endif
|
||||
|
||||
bool suppress_cursorpos = FALSE;
|
||||
/* Should we skip constant position display for current keystroke? */
|
||||
|
||||
message_type lastmessage = HUSH;
|
||||
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
|
||||
|
||||
@@ -146,9 +149,6 @@ char *quoteerr = NULL;
|
||||
char *word_chars = NULL;
|
||||
/* Nonalphanumeric characters that also form words. */
|
||||
|
||||
bool nodelay_mode = FALSE;
|
||||
/* Are we checking for a cancel wile doing something? */
|
||||
|
||||
char *answer = NULL;
|
||||
/* The answer string used by the statusbar prompt. */
|
||||
|
||||
@@ -1122,15 +1122,15 @@ void shortcut_init(void)
|
||||
if (using_utf8()) {
|
||||
add_to_sclist(MMOST, "\xE2\x86\x90", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "\xE2\x86\x92", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MMOST, "^\xE2\x86\x90", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^\xE2\x86\x92", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
add_to_sclist(MSOME, "^\xE2\x86\x90", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MSOME, "^\xE2\x86\x92", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
add_to_sclist(MMOST, "Left", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "Right", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MMOST, "^Left", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^Right", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
add_to_sclist(MSOME, "^Left", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MSOME, "^Right", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
}
|
||||
add_to_sclist(MMOST, "M-Space", 0, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^Space", 0, do_next_word_void, 0);
|
||||
|
||||
306
src/nano.c
306
src/nano.c
@@ -59,6 +59,9 @@ static struct termios oldterm;
|
||||
static struct sigaction act;
|
||||
/* Used to set up all our fun signal handlers. */
|
||||
|
||||
static bool input_was_aborted = FALSE;
|
||||
/* Whether reading from standard input was aborted via ^C. */
|
||||
|
||||
/* Create a new linestruct node. Note that we do not set prevnode->next
|
||||
* to the new line. */
|
||||
filestruct *make_new_node(filestruct *prevnode)
|
||||
@@ -1100,54 +1103,26 @@ void do_cancel(void)
|
||||
;
|
||||
}
|
||||
|
||||
static struct sigaction pager_oldaction, pager_newaction;
|
||||
/* Make a note that reading from stdin was concluded with ^C. */
|
||||
RETSIGTYPE make_a_note(int signal)
|
||||
{
|
||||
input_was_aborted = TRUE;
|
||||
}
|
||||
|
||||
/* Read whatever comes from standard input into a new buffer. */
|
||||
bool scoop_stdin(void)
|
||||
{
|
||||
struct sigaction oldaction, newaction;
|
||||
/* Original and temporary handlers for SIGINT. */
|
||||
static bool pager_sig_failed = FALSE;
|
||||
/* Did sigaction() fail without changing the signal handlers? */
|
||||
static bool pager_input_aborted = FALSE;
|
||||
/* Did someone invoke the pager and abort it via ^C? */
|
||||
bool setup_failed = FALSE;
|
||||
/* Whether setting up the SIGINT handler failed. */
|
||||
FILE *stream;
|
||||
int thetty;
|
||||
|
||||
/* Things which need to be run regardless of whether
|
||||
* we finished the stdin pipe correctly or not. */
|
||||
void finish_stdin_pager(void)
|
||||
{
|
||||
FILE *f;
|
||||
int ttystdin;
|
||||
|
||||
/* Read whatever we did get from stdin. */
|
||||
f = fopen("/dev/stdin", "rb");
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
|
||||
read_file(f, 0, "stdin", TRUE, FALSE);
|
||||
openfile->edittop = openfile->fileage;
|
||||
|
||||
ttystdin = open("/dev/tty", O_RDONLY);
|
||||
if (!ttystdin)
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
|
||||
dup2(ttystdin,0);
|
||||
close(ttystdin);
|
||||
if (!pager_input_aborted)
|
||||
tcgetattr(0, &oldterm);
|
||||
if (!pager_sig_failed && sigaction(SIGINT, &pager_oldaction, NULL) == -1)
|
||||
nperror("sigaction");
|
||||
terminal_init();
|
||||
doupdate();
|
||||
}
|
||||
|
||||
/* Cancel reading from stdin like a pager. */
|
||||
RETSIGTYPE cancel_stdin_pager(int signal)
|
||||
{
|
||||
pager_input_aborted = TRUE;
|
||||
}
|
||||
|
||||
/* Let nano read stdin for the first file at least. */
|
||||
void stdin_pager(void)
|
||||
{
|
||||
/* Exit from curses mode and put the terminal into its original state. */
|
||||
endwin();
|
||||
if (!pager_input_aborted)
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
|
||||
fprintf(stderr, _("Reading from stdin, ^C to abort\n"));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -1156,23 +1131,59 @@ void stdin_pager(void)
|
||||
enable_signals();
|
||||
#endif
|
||||
|
||||
/* Set things up so that SIGINT will cancel the new process. */
|
||||
if (sigaction(SIGINT, NULL, &pager_newaction) == -1) {
|
||||
pager_sig_failed = TRUE;
|
||||
/* Set things up so that SIGINT will cancel the reading. */
|
||||
if (sigaction(SIGINT, NULL, &newaction) == -1) {
|
||||
setup_failed = TRUE;
|
||||
nperror("sigaction");
|
||||
} else {
|
||||
pager_newaction.sa_handler = cancel_stdin_pager;
|
||||
if (sigaction(SIGINT, &pager_newaction, &pager_oldaction) == -1) {
|
||||
pager_sig_failed = TRUE;
|
||||
newaction.sa_handler = make_a_note;
|
||||
if (sigaction(SIGINT, &newaction, &oldaction) == -1) {
|
||||
setup_failed = TRUE;
|
||||
nperror("sigaction");
|
||||
}
|
||||
}
|
||||
|
||||
/* Open standard input. */
|
||||
stream = fopen("/dev/stdin", "rb");
|
||||
if (stream == NULL) {
|
||||
int errnumber = errno;
|
||||
|
||||
terminal_init();
|
||||
doupdate();
|
||||
statusline(ALERT, _("Failed to open stdin: %s"), strerror(errnumber));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Read the input into a new buffer. */
|
||||
open_buffer("", FALSE);
|
||||
finish_stdin_pager();
|
||||
read_file(stream, 0, "stdin", TRUE, FALSE);
|
||||
openfile->edittop = openfile->fileage;
|
||||
|
||||
/* Reconnect the tty as the input source. */
|
||||
thetty = open("/dev/tty", O_RDONLY);
|
||||
if (!thetty)
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
dup2(thetty, 0);
|
||||
close(thetty);
|
||||
|
||||
/* If things went well, store the current state of the terminal. */
|
||||
if (!input_was_aborted)
|
||||
tcgetattr(0, &oldterm);
|
||||
|
||||
/* If it was changed, restore the handler for SIGINT. */
|
||||
if (!setup_failed && sigaction(SIGINT, &oldaction, NULL) == -1)
|
||||
nperror("sigaction");
|
||||
|
||||
terminal_init();
|
||||
doupdate();
|
||||
|
||||
if (!ISSET(VIEW_MODE) && openfile->totsize > 0)
|
||||
set_modified();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Initialize the signal handlers. */
|
||||
/* Register half a dozen signal handlers. */
|
||||
void signal_init(void)
|
||||
{
|
||||
/* Trap SIGINT and SIGQUIT because we want them to do useful things. */
|
||||
@@ -1196,25 +1207,23 @@ void signal_init(void)
|
||||
sigaction(SIGWINCH, &act, NULL);
|
||||
#endif
|
||||
|
||||
/* Trap normal suspend (^Z) so we can handle it ourselves. */
|
||||
if (!ISSET(SUSPEND)) {
|
||||
act.sa_handler = SIG_IGN;
|
||||
#ifdef SIGTSTP
|
||||
sigaction(SIGTSTP, &act, NULL);
|
||||
#endif
|
||||
} else {
|
||||
if (ISSET(SUSPEND)) {
|
||||
/* Block all other signals in the suspend and continue handlers.
|
||||
* If we don't do this, other stuff interrupts them! */
|
||||
sigfillset(&act.sa_mask);
|
||||
|
||||
act.sa_handler = do_suspend;
|
||||
#ifdef SIGTSTP
|
||||
/* Trap a normal suspend (^Z) so we can handle it ourselves. */
|
||||
act.sa_handler = do_suspend;
|
||||
sigaction(SIGTSTP, &act, NULL);
|
||||
#endif
|
||||
|
||||
act.sa_handler = do_continue;
|
||||
#ifdef SIGCONT
|
||||
act.sa_handler = do_continue;
|
||||
sigaction(SIGCONT, &act, NULL);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef SIGTSTP
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigaction(SIGTSTP, &act, NULL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1243,21 +1252,13 @@ RETSIGTYPE do_suspend(int signal)
|
||||
/* Restore the old terminal settings. */
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
|
||||
/* Trap SIGHUP and SIGTERM so we can properly deal with them while
|
||||
* suspended. */
|
||||
act.sa_handler = handle_hupterm;
|
||||
#ifdef SIGHUP
|
||||
sigaction(SIGHUP, &act, NULL);
|
||||
#endif
|
||||
sigaction(SIGTERM, &act, NULL);
|
||||
|
||||
/* Do what mutt does: send ourselves a SIGSTOP. */
|
||||
#ifdef SIGSTOP
|
||||
/* Do what mutt does: send ourselves a SIGSTOP. */
|
||||
kill(0, SIGSTOP);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* The version of above function that is bound to a key. */
|
||||
/* Put nano to sleep (if suspension is enabled). */
|
||||
void do_suspend_void(void)
|
||||
{
|
||||
if (ISSET(SUSPEND))
|
||||
@@ -1277,14 +1278,14 @@ RETSIGTYPE do_continue(int signal)
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Perhaps the user resized the window while we slept. So act as if,
|
||||
* and restore the terminal to its previous state in the process. */
|
||||
regenerate_screen();
|
||||
/* Perhaps the user resized the window while we slept. */
|
||||
the_window_resized = TRUE;
|
||||
#else
|
||||
/* Restore the state of the terminal and redraw the whole screen. */
|
||||
/* Put the terminal in the desired state again. */
|
||||
terminal_init();
|
||||
total_refresh();
|
||||
#endif
|
||||
/* Tickle the input routine so it will update the screen. */
|
||||
ungetch(KEY_F0);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -1336,21 +1337,16 @@ void regenerate_screen(void)
|
||||
SLsmg_reset_smg();
|
||||
SLsmg_init_smg();
|
||||
#else
|
||||
/* Do the equivalent of what Minimum Profit does: Leave and
|
||||
* immediately reenter curses mode. */
|
||||
/* Do the equivalent of what Minimum Profit does: leave and immediately
|
||||
* reenter curses mode. */
|
||||
endwin();
|
||||
doupdate();
|
||||
#endif
|
||||
|
||||
/* Restore the terminal to its previous state. */
|
||||
/* Put the terminal in the desired state again, recreate the subwindows
|
||||
* with their (new) sizes, and redraw the contents of these windows. */
|
||||
terminal_init();
|
||||
|
||||
/* Do the equivalent of what both mutt and Minimum Profit do:
|
||||
* Reinitialize all the windows based on the new screen
|
||||
* dimensions. */
|
||||
window_init();
|
||||
|
||||
/* Redraw the contents of the windows that need it. */
|
||||
total_refresh();
|
||||
}
|
||||
|
||||
@@ -1364,9 +1360,7 @@ void allow_sigwinch(bool allow)
|
||||
sigaddset(&winch, SIGWINCH);
|
||||
sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Handle the global toggle specified in flag. */
|
||||
void do_toggle(int flag)
|
||||
{
|
||||
@@ -1900,8 +1894,6 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int optchr;
|
||||
ssize_t startline = 0, startcol = 0;
|
||||
/* Target line and column when specified on the command line. */
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
bool fill_used = FALSE;
|
||||
/* Was the fill option used on the command line? */
|
||||
@@ -1911,9 +1903,9 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
bool old_multibuffer;
|
||||
/* The old value of the multibuffer option, restored after we
|
||||
* load all files on the command line. */
|
||||
bool is_multibuffer;
|
||||
/* The actual value of the multibuffer option, restored after
|
||||
* we've loaded all files given on the command line. */
|
||||
#endif
|
||||
const struct option long_options[] = {
|
||||
{"boldtext", 0, NULL, 'D'},
|
||||
@@ -2436,13 +2428,12 @@ int main(int argc, char **argv)
|
||||
if (matchbrackets == NULL)
|
||||
matchbrackets = mallocstrcpy(NULL, "(<[{)>]}");
|
||||
|
||||
/* If whitespace wasn't specified, set its default value. If we're
|
||||
* using UTF-8, it's Unicode 00BB (Right-Pointing Double Angle
|
||||
* Quotation Mark) and Unicode 00B7 (Middle Dot). Otherwise, it's
|
||||
* ">" and ".". */
|
||||
/* If the whitespace option wasn't specified, set its default value. */
|
||||
if (whitespace == NULL) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
/* A tab is shown as a Right-Pointing Double Angle Quotation Mark
|
||||
* (U+00BB), and a space as a Middle Dot (U+00B7). */
|
||||
whitespace = mallocstrcpy(NULL, "\xC2\xBB\xC2\xB7");
|
||||
whitespace_len[0] = 2;
|
||||
whitespace_len[1] = 2;
|
||||
@@ -2479,8 +2470,7 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, "Main: set up windows\n");
|
||||
#endif
|
||||
|
||||
/* Initialize all the windows based on the current screen
|
||||
* dimensions. */
|
||||
/* Create the three subwindows, based on the current screen dimensions. */
|
||||
window_init();
|
||||
|
||||
editwincols = COLS;
|
||||
@@ -2536,90 +2526,58 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, "Main: open file\n");
|
||||
#endif
|
||||
|
||||
/* If there's a +LINE or +LINE,COLUMN flag here, it is the first
|
||||
* non-option argument, and it is followed by at least one other
|
||||
* argument, the filename it applies to. */
|
||||
if (0 < optind && optind < argc - 1 && argv[optind][0] == '+') {
|
||||
if (!parse_line_column(&argv[optind][1], &startline, &startcol))
|
||||
statusline(ALERT, _("Invalid line or column number"));
|
||||
optind++;
|
||||
}
|
||||
|
||||
/* If one of the arguments is a dash, read text from standard input. */
|
||||
if (optind < argc && !strcmp(argv[optind], "-")) {
|
||||
stdin_pager();
|
||||
set_modified();
|
||||
optind++;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
old_multibuffer = ISSET(MULTIBUFFER);
|
||||
is_multibuffer = ISSET(MULTIBUFFER);
|
||||
SET(MULTIBUFFER);
|
||||
|
||||
/* Read all the files after the first one on the command line into
|
||||
* new buffers. */
|
||||
{
|
||||
int i = optind + 1;
|
||||
ssize_t iline = 0, icol = 0;
|
||||
|
||||
for (; i < argc; i++) {
|
||||
/* If there's a +LINE or +LINE,COLUMN flag here, it is followed
|
||||
* by at least one other argument: the filename it applies to. */
|
||||
if (i < argc - 1 && argv[i][0] == '+') {
|
||||
if (!parse_line_column(&argv[i][1], &iline, &icol))
|
||||
statusline(ALERT, _("Invalid line or column number"));
|
||||
} else {
|
||||
/* If opening fails, don't try to position the cursor. */
|
||||
if (!open_buffer(argv[i], FALSE))
|
||||
continue;
|
||||
|
||||
/* If a position was given on the command line, go there. */
|
||||
if (iline > 0 || icol > 0) {
|
||||
do_gotolinecolumn(iline, icol, FALSE, FALSE);
|
||||
iline = 0;
|
||||
icol = 0;
|
||||
}
|
||||
#ifndef DISABLE_HISTORIES
|
||||
else if (ISSET(POS_HISTORY)) {
|
||||
ssize_t savedposline, savedposcol;
|
||||
/* If edited before, restore the last cursor position. */
|
||||
if (has_old_position(argv[i], &savedposline, &savedposcol))
|
||||
do_gotolinecolumn(savedposline, savedposcol,
|
||||
FALSE, FALSE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Read the files mentioned on the command line into new buffers. */
|
||||
while (optind < argc && (!openfile || ISSET(MULTIBUFFER))) {
|
||||
ssize_t givenline = 0, givencol = 0;
|
||||
bool dash = FALSE;
|
||||
|
||||
/* If there's a +LINE[,COLUMN] argument here, eat it up. */
|
||||
if (optind < argc - 1 && argv[optind][0] == '+') {
|
||||
if (!parse_line_column(&argv[optind++][1], &givenline, &givencol))
|
||||
statusline(ALERT, _("Invalid line or column number"));
|
||||
}
|
||||
|
||||
/* If the filename is a dash, read from standard input; otherwise,
|
||||
* open the file; skip positioning the cursor if either failed. */
|
||||
if (strcmp(argv[optind], "-") == 0) {
|
||||
if (!scoop_stdin())
|
||||
continue;
|
||||
dash = TRUE;
|
||||
optind++;
|
||||
} else if (!open_buffer(argv[optind++], FALSE))
|
||||
continue;
|
||||
|
||||
/* If a position was given on the command line, go there. */
|
||||
if (givenline != 0 || givencol != 0)
|
||||
do_gotolinecolumn(givenline, givencol, FALSE, FALSE);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
else if (ISSET(POS_HISTORY) && !dash) {
|
||||
ssize_t savedline, savedcol;
|
||||
/* If edited before, restore the last cursor position. */
|
||||
if (has_old_position(argv[optind - 1], &savedline, &savedcol))
|
||||
do_gotolinecolumn(savedline, savedcol, FALSE, FALSE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* ENABLE_MULTIBUFFER */
|
||||
|
||||
/* Now read the first file on the command line into a new buffer. */
|
||||
if (optind < argc)
|
||||
open_buffer(argv[optind], FALSE);
|
||||
|
||||
/* If all the command-line arguments were invalid files like directories,
|
||||
* or if there were no filenames given, we didn't open any file. In this
|
||||
* case, load a blank buffer. Also, unset view mode to allow editing. */
|
||||
/* If no filenames were given, or all of them were invalid things like
|
||||
* directories, then open a blank buffer and allow editing. Otherwise,
|
||||
* switch from the last opened file to the next, that is: the first. */
|
||||
if (openfile == NULL) {
|
||||
open_buffer("", FALSE);
|
||||
UNSET(VIEW_MODE);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (!old_multibuffer)
|
||||
UNSET(MULTIBUFFER);
|
||||
#endif
|
||||
else
|
||||
openfile = openfile->next;
|
||||
|
||||
/* If a starting position was given on the command line, go there. */
|
||||
if (startline > 0 || startcol > 0)
|
||||
do_gotolinecolumn(startline, startcol, FALSE, FALSE);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
else if (ISSET(POS_HISTORY)) {
|
||||
ssize_t savedposline, savedposcol;
|
||||
/* If the file was edited before, restore the last cursor position. */
|
||||
if (has_old_position(argv[optind], &savedposline, &savedposcol))
|
||||
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE);
|
||||
}
|
||||
if (!is_multibuffer)
|
||||
UNSET(MULTIBUFFER);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -2632,7 +2590,7 @@ int main(int argc, char **argv)
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
int needed_margin = digits(openfile->filebot->lineno) + 1;
|
||||
|
||||
/* Only enable line numbers when there is enough room for them. */
|
||||
/* Suppress line numbers when there is not enough room for them. */
|
||||
if (!ISSET(LINE_NUMBERS) || needed_margin > COLS - 4)
|
||||
needed_margin = 0;
|
||||
|
||||
|
||||
@@ -542,6 +542,11 @@ enum
|
||||
/* This is an abbreviation for all menus except Help and YesNo. */
|
||||
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
|
||||
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
|
||||
#ifndef NANO_TINY
|
||||
#define MSOME MMOST
|
||||
#else
|
||||
#define MSOME MMAIN|MBROWSER
|
||||
#endif
|
||||
|
||||
/* Basic control codes. */
|
||||
#define TAB_CODE 0x09
|
||||
|
||||
@@ -47,6 +47,8 @@ extern int editwincols;
|
||||
extern bool have_palette;
|
||||
#endif
|
||||
|
||||
extern bool suppress_cursorpos;
|
||||
|
||||
extern message_type lastmessage;
|
||||
|
||||
extern filestruct *pletion_line;
|
||||
@@ -119,8 +121,6 @@ extern char *quoteerr;
|
||||
|
||||
extern char *word_chars;
|
||||
|
||||
extern bool nodelay_mode;
|
||||
|
||||
extern char *answer;
|
||||
|
||||
extern ssize_t tabsize;
|
||||
@@ -677,8 +677,8 @@ void spotlight(bool active, const char *word);
|
||||
void xon_complaint(void);
|
||||
void xoff_complaint(void);
|
||||
void do_suspend_void(void);
|
||||
void enable_nodelay(void);
|
||||
void disable_nodelay(void);
|
||||
void disable_waiting(void);
|
||||
void enable_waiting(void);
|
||||
#ifndef DISABLE_EXTRA
|
||||
void do_credits(void);
|
||||
#endif
|
||||
|
||||
@@ -350,7 +350,9 @@ bool is_universal(void (*func))
|
||||
{
|
||||
if (func == do_left || func == do_right ||
|
||||
func == do_home_void || func == do_end_void ||
|
||||
#ifndef NANO_TINY
|
||||
func == do_prev_word_void || func == do_next_word_void ||
|
||||
#endif
|
||||
func == do_verbatim_input || func == do_cut_text_void ||
|
||||
func == do_delete || func == do_backspace ||
|
||||
func == do_tab || func == do_enter)
|
||||
|
||||
24
src/search.c
24
src/search.c
@@ -234,8 +234,10 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
size_t found_x;
|
||||
/* The x coordinate of a found occurrence. */
|
||||
time_t lastkbcheck = time(NULL);
|
||||
/* The time we last looked at the keyboard. */
|
||||
|
||||
enable_nodelay();
|
||||
/* Set non-blocking input so that we can just peek for a Cancel. */
|
||||
disable_waiting();
|
||||
|
||||
if (begin == NULL)
|
||||
came_full_circle = FALSE;
|
||||
@@ -252,7 +254,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
while (input) {
|
||||
if (func_from_key(&input) == do_cancel) {
|
||||
statusbar(_("Cancelled"));
|
||||
disable_nodelay();
|
||||
enable_waiting();
|
||||
return -2;
|
||||
}
|
||||
input = parse_kbinput(NULL);
|
||||
@@ -303,7 +305,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
/* If we're back at the beginning, then there is no needle. */
|
||||
if (came_full_circle) {
|
||||
not_found_msg(needle);
|
||||
disable_nodelay();
|
||||
enable_waiting();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -317,7 +319,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
* but stop when spell-checking or replacing in a region. */
|
||||
if (line == NULL) {
|
||||
if (whole_word_only || have_region) {
|
||||
disable_nodelay();
|
||||
enable_waiting();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -343,16 +345,15 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
|
||||
found_x = found - line->data;
|
||||
|
||||
enable_waiting();
|
||||
|
||||
/* Ensure that the found occurrence is not beyond the starting x. */
|
||||
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && found_x > begin_x) ||
|
||||
(ISSET(BACKWARDS_SEARCH) && found_x < begin_x))) {
|
||||
not_found_msg(needle);
|
||||
disable_nodelay();
|
||||
return 0;
|
||||
}
|
||||
|
||||
disable_nodelay();
|
||||
|
||||
/* Set the current position to point at what we found. */
|
||||
openfile->current = line;
|
||||
openfile->current_x = found_x;
|
||||
@@ -361,8 +362,11 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
if (match_len != NULL)
|
||||
*match_len = found_len;
|
||||
|
||||
if (feedback > 0)
|
||||
/* Wipe the "Searching..." message and unset the suppression flag. */
|
||||
if (feedback > 0) {
|
||||
blank_statusbar();
|
||||
suppress_cursorpos = FALSE;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -855,10 +859,10 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (line < 1)
|
||||
if (line == 0)
|
||||
line = openfile->current->lineno;
|
||||
|
||||
if (column < 1)
|
||||
if (column == 0)
|
||||
column = openfile->placewewant + 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -2448,10 +2448,8 @@ void do_justify(bool full_justify)
|
||||
} while (kbinput == KEY_WINCH);
|
||||
#endif
|
||||
|
||||
/* If needed, unset the cursor-position suppression flag, so the cursor
|
||||
* position /will/ be displayed upon a return to the main loop. */
|
||||
if (ISSET(CONSTANT_SHOW))
|
||||
do_cursorpos(FALSE);
|
||||
/* Unset the suppression flag after showing the Unjustify message. */
|
||||
suppress_cursorpos = FALSE;
|
||||
|
||||
func = func_from_key(&kbinput);
|
||||
|
||||
@@ -3568,7 +3566,7 @@ void do_verbatim_input(void)
|
||||
|
||||
/* Unsuppress cursor-position display or blank the statusbar. */
|
||||
if (ISSET(CONSTANT_SHOW))
|
||||
do_cursorpos(FALSE);
|
||||
suppress_cursorpos = FALSE;
|
||||
else {
|
||||
blank_statusbar();
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
46
src/winio.c
46
src/winio.c
@@ -45,10 +45,10 @@ static size_t key_buffer_len = 0;
|
||||
/* The length of the keystroke buffer. */
|
||||
static bool solitary = FALSE;
|
||||
/* Whether an Esc arrived by itself -- not as leader of a sequence. */
|
||||
static bool waiting_mode = TRUE;
|
||||
/* Whether getting a character will wait for a key to be pressed. */
|
||||
static int statusblank = 0;
|
||||
/* The number of keystrokes left before we blank the statusbar. */
|
||||
static bool suppress_cursorpos = FALSE;
|
||||
/* Should we skip constant position display for one keystroke? */
|
||||
#ifdef USING_OLD_NCURSES
|
||||
static bool seen_wide = FALSE;
|
||||
/* Whether we've seen a multicolumn character in the current line. */
|
||||
@@ -135,7 +135,7 @@ void get_key_buffer(WINDOW *win)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (input == ERR && nodelay_mode)
|
||||
if (input == ERR && !waiting_mode)
|
||||
return;
|
||||
|
||||
while (input == ERR) {
|
||||
@@ -144,7 +144,7 @@ void get_key_buffer(WINDOW *win)
|
||||
* check if errno is set to EIO ("Input/output error") and die in
|
||||
* that case, but it's not always set properly. Argh. */
|
||||
if (++errcount == MAX_BUF_SIZE)
|
||||
handle_hupterm(0);
|
||||
die(_("Too many errors from stdin"));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (the_window_resized) {
|
||||
@@ -188,7 +188,7 @@ void get_key_buffer(WINDOW *win)
|
||||
}
|
||||
|
||||
/* Restore waiting mode if it was on. */
|
||||
if (!nodelay_mode)
|
||||
if (waiting_mode)
|
||||
nodelay(win, FALSE);
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -327,7 +327,7 @@ int parse_kbinput(WINDOW *win)
|
||||
/* Read in a character. */
|
||||
kbinput = get_input(win, 1);
|
||||
|
||||
if (kbinput == NULL && nodelay_mode)
|
||||
if (kbinput == NULL && !waiting_mode)
|
||||
return 0;
|
||||
|
||||
while (kbinput == NULL)
|
||||
@@ -703,8 +703,9 @@ int parse_kbinput(WINDOW *win)
|
||||
#ifdef KEY_RESIZE
|
||||
/* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */
|
||||
case KEY_RESIZE:
|
||||
return ERR;
|
||||
#endif
|
||||
case KEY_F0:
|
||||
return ERR;
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -3142,17 +3143,19 @@ void total_redraw(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Unconditionally redraw the entire screen, and then refresh it using
|
||||
* the current file. */
|
||||
/* Redraw the entire screen, then refresh the title bar and the content of
|
||||
* the edit window (when not in the file browser), and the bottom bars. */
|
||||
void total_refresh(void)
|
||||
{
|
||||
total_redraw();
|
||||
titlebar(title);
|
||||
if (currmenu != MBROWSER && currmenu != MWHEREISFILE && currmenu != MGOTODIR)
|
||||
titlebar(title);
|
||||
#ifdef ENABLE_HELP
|
||||
if (inhelp)
|
||||
wrap_the_help_text(TRUE);
|
||||
else
|
||||
#endif
|
||||
if (currmenu != MBROWSER && currmenu != MWHEREISFILE && currmenu != MGOTODIR)
|
||||
edit_refresh();
|
||||
bottombars(currmenu);
|
||||
}
|
||||
@@ -3182,7 +3185,14 @@ void do_cursorpos(bool force)
|
||||
size_t cur_lenpt = strlenpt(openfile->current->data) + 1;
|
||||
int linepct, colpct, charpct;
|
||||
|
||||
assert(openfile->fileage != NULL && openfile->current != NULL);
|
||||
/* If the showing needs to be suppressed, don't suppress it next time. */
|
||||
if (suppress_cursorpos && !force) {
|
||||
suppress_cursorpos = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Hide the cursor while we are calculating. */
|
||||
curs_set(0);
|
||||
|
||||
/* Determine the size of the file up to the cursor. */
|
||||
saved_byte = openfile->current->data[openfile->current_x];
|
||||
@@ -3196,12 +3206,6 @@ void do_cursorpos(bool force)
|
||||
if (openfile->current != openfile->filebot)
|
||||
sum--;
|
||||
|
||||
/* If the showing needs to be suppressed, don't suppress it next time. */
|
||||
if (suppress_cursorpos && !force) {
|
||||
suppress_cursorpos = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Display the current cursor position on the statusbar. */
|
||||
linepct = 100 * openfile->current->lineno / openfile->filebot->lineno;
|
||||
colpct = 100 * cur_xpt / cur_lenpt;
|
||||
@@ -3224,15 +3228,15 @@ void do_cursorpos_void(void)
|
||||
do_cursorpos(TRUE);
|
||||
}
|
||||
|
||||
void enable_nodelay(void)
|
||||
void disable_waiting(void)
|
||||
{
|
||||
nodelay_mode = TRUE;
|
||||
waiting_mode = FALSE;
|
||||
nodelay(edit, TRUE);
|
||||
}
|
||||
|
||||
void disable_nodelay(void)
|
||||
void enable_waiting(void)
|
||||
{
|
||||
nodelay_mode = FALSE;
|
||||
waiting_mode = TRUE;
|
||||
nodelay(edit, FALSE);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ syntax "default"
|
||||
comment "#"
|
||||
|
||||
# Comments.
|
||||
color cyan "^#.*"
|
||||
color cyan "^[[:space:]]*#.*"
|
||||
|
||||
# Spaces in front of tabs.
|
||||
color ,red " + +"
|
||||
|
||||
Reference in New Issue
Block a user