Compare commits
90 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
070c9c60ec | ||
|
|
63ac050733 | ||
|
|
3ade8b29cc | ||
|
|
51a6d5897e | ||
|
|
785d28d5d1 | ||
|
|
4873cc26f2 | ||
|
|
0f8423eb4c | ||
|
|
b60fec5db3 | ||
|
|
7ffbf01607 | ||
|
|
f6b4c243d8 | ||
|
|
0287be7660 | ||
|
|
e6709d684b | ||
|
|
aa257ef58e | ||
|
|
8daa7cbda0 | ||
|
|
8a5449cebe | ||
|
|
9229834935 | ||
|
|
6469e9668b | ||
|
|
68d71f649e | ||
|
|
71752f47cb | ||
|
|
51f27d3f0c | ||
|
|
b38265cfb8 | ||
|
|
b5fb41e963 | ||
|
|
a14c894325 | ||
|
|
bc6b9bf955 | ||
|
|
4b6090ded3 | ||
|
|
fb98f0ced7 | ||
|
|
d09055db43 | ||
|
|
50b61bef6f | ||
|
|
3d0bfb0a00 | ||
|
|
3cb55c8b27 | ||
|
|
306906a8a7 | ||
|
|
6e2c245ecc | ||
|
|
74a0ffcbc5 | ||
|
|
b1a0f5e65a | ||
|
|
7e8b1ed420 | ||
|
|
b2ea7d29d0 | ||
|
|
e597ad4908 | ||
|
|
100747f56b | ||
|
|
d7b2b55bf5 | ||
|
|
9875252fd7 | ||
|
|
1551c1c771 | ||
|
|
8e226a9f28 | ||
|
|
be20383240 | ||
|
|
cf769bbd2f | ||
|
|
4ec96f9f2e | ||
|
|
bdc856812f | ||
|
|
96bb8149e9 | ||
|
|
07e69d54b2 | ||
|
|
aeb15e9549 | ||
|
|
435d9acb5c | ||
|
|
12fe0a3b29 | ||
|
|
c14e77ce9e | ||
|
|
2c8c061e67 | ||
|
|
5fab1e6754 | ||
|
|
b0e3767af5 | ||
|
|
4923119174 | ||
|
|
cdd6882541 | ||
|
|
5a6a74fe70 | ||
|
|
d7c2b98ead | ||
|
|
4c63ef204d | ||
|
|
4c6b6cad99 | ||
|
|
cc6d1d59a6 | ||
|
|
f80ce71d13 | ||
|
|
2bbbd85852 | ||
|
|
54238a5c46 | ||
|
|
8b2114a25f | ||
|
|
65da6341ba | ||
|
|
c8a87b4d2a | ||
|
|
551a971e16 | ||
|
|
c2b6eb01cd | ||
|
|
e9e26934ea | ||
|
|
5b56791aef | ||
|
|
71c0cde5ce | ||
|
|
18a4658d4f | ||
|
|
6fa81ca5b8 | ||
|
|
4940b02ae0 | ||
|
|
7942dab014 | ||
|
|
312bcebf44 | ||
|
|
eb57b10273 | ||
|
|
844f95e6df | ||
|
|
67d22f4cce | ||
|
|
59bbc0b858 | ||
|
|
731fd935ff | ||
|
|
0e1f7fe2ef | ||
|
|
3eff34b075 | ||
|
|
40b03162c3 | ||
|
|
34f4ceb77e | ||
|
|
d0ad1e42d9 | ||
|
|
59bdce9503 | ||
|
|
9517766aab |
106
ChangeLog
106
ChangeLog
@@ -1,3 +1,104 @@
|
||||
Changes between v5.1 and v5.2:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (30):
|
||||
build: stop distributing the README.GIT file
|
||||
build: stop mentioning Slang in two ./configure messages
|
||||
bump version numbers and add a news item for the 5.2 release
|
||||
display: restore the ability to resize the screen while searching
|
||||
docs: add a cross-reference from 'findbracket' to 'set matchbrackets'
|
||||
docs: adjust description of ^T in cheatsheet, and mention M-Bsp
|
||||
docs: mention in the FAQ how to change the escape sequences of urxvt
|
||||
docs: reshuffle the section about the file browser to a better place
|
||||
gnulib: back away from a commit that causes trouble when using clang
|
||||
gnulib: update to its current upstream state
|
||||
history: do not interpret a failing stat() as an error
|
||||
input: allow also a Meta keystroke to abort a Search command
|
||||
input: dawdle after an ESC also when --rawsequences is used
|
||||
input: discard any multibyte character when <Alt> is being held
|
||||
input: do not enter invalid bytes when holding down both Alt keys
|
||||
input: hold on to a shift-selected region when an unbound key is struck
|
||||
rcfile: make sure that "bright"/"light" are prefixes, not separate words
|
||||
replacing: do not try to wipe nonexistent multidata, to avoid crashing
|
||||
search: poll the input stream directly, not nano's own keystroke buffer
|
||||
search: retain the current answer when something is toggled
|
||||
tweaks: adjust a comment, and reshuffle the setting of a boolean
|
||||
tweaks: condense two declarations
|
||||
tweaks: condense two fragments of code, for compactness
|
||||
tweaks: elide an unneeded variable
|
||||
tweaks: improve three comments and an indentation
|
||||
tweaks: move the keyboard-checking code to the end of the search loop
|
||||
tweaks: remove a variable and two functions that have become redundant
|
||||
tweaks: rename a variable, to not seem to refer to the scrollbar
|
||||
tweaks: reshuffle four declarations, and rename two variables
|
||||
verbatim: reserve enough space for the result also in non-UTF-8 locales
|
||||
|
||||
|
||||
Changes between v5.0 and v5.1:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (55):
|
||||
anchor: in a UTF-8 locale, show an anchor as a diamond, for visibility
|
||||
anchor: show an anchor also when the line is horizontally scrolled
|
||||
bindings: make <Alt+Backspace> delete a word backwards, like in Bash
|
||||
build: fix compilation for --enable-tiny --enable-nanorc --enable-color
|
||||
build: fix compilation when configured with --enable-tiny
|
||||
build: stop distributing the two old Changelogs
|
||||
bump version numbers and add a news item for the 5.1 release
|
||||
display: show the cursor position also right after the screen is resized
|
||||
docs: fix a closing tag in the FAQ [tidy]
|
||||
docs: mention that anchors are visible when line numbers are shown
|
||||
feedback: add the reason to the error message when forking fails
|
||||
feedback: use three dots to indicate processing, like everywhere else
|
||||
feedback: when creating a pipe fails, report also the reason
|
||||
files: do not try writing to the status bar while not in curses mode
|
||||
formatter: force the mark off, to not crash by accessing empty cutbuffer
|
||||
gnulib: update to its current upstream state
|
||||
help: list again the keystroke for toggling the help lines (M-X)
|
||||
input: understand M-Bsp also when terminfo does not match the terminal
|
||||
moving: make <Ctrl+Up> go to the top when above the cursor all is blank
|
||||
rcfile: allow to bind M-[ (even though it is an escape-sequence starter)
|
||||
softwrap: initialize the 'extrarows' value for the magic line correctly
|
||||
speller: give proper feedback when the user tries to check emptiness
|
||||
speller: give startup feedback (relevant when running on a Linux console)
|
||||
speller: re-enter curses mode before trying to report an error
|
||||
syntax: css: differentiate pseudo-classes (now cyan) from comments (blue)
|
||||
syntax: default: colorize also "GNU nano 5.x"
|
||||
tweaks: adjust the indentation after the previous change
|
||||
tweaks: adjust the indentation after the previous change
|
||||
tweaks: avoid a maybe-uninitialized-variable warning from gcc
|
||||
tweaks: elide an unneeded variable, by transforming the key code directly
|
||||
tweaks: elide two variables that are no longer needed, and update comment
|
||||
tweaks: exclude old and mistaken "Esc O" sequences from the tiny version
|
||||
tweaks: make a few more direct returns, and reshuffle another bit of code
|
||||
tweaks: make a misplaced call of statusline() more obvious by crashing
|
||||
tweaks: normalize the indentation after the previous change
|
||||
tweaks: normalize the indentation, and regroup two lines
|
||||
tweaks: optimize for byte-range characters, and shorten some comments
|
||||
tweaks: parse the escape-sequence bytes without copying them first
|
||||
tweaks: pass first byte of sequence directly to the decoding function
|
||||
tweaks: print error message directly instead of passing it to the caller
|
||||
tweaks: read keycodes from the keystroke buffer without copying them
|
||||
tweaks: remove an unneeded beep, and reshuffle the lines for compactness
|
||||
tweaks: reshuffle a few lines, to condense the code, and improve comment
|
||||
tweaks: reshuffle four lines, for esthetics
|
||||
tweaks: reshuffle some fragments, to make the next change easier
|
||||
tweaks: reshuffle the zeroing of a counter, to allow some direct returns
|
||||
tweaks: simplify two functions, as they now return always NULL
|
||||
tweaks: split a function into two, one for "Esc O" and one for "Esc ["
|
||||
tweaks: stop using a 'switch' when there are just three possibilities
|
||||
verbatim: discard entire keystroke when it's not valid for Unicode Input
|
||||
verbatim: do not report "Invalid code" when a Unicode character is typed
|
||||
verbatim: do not report "Invalid code" when the terminal is resized
|
||||
verbatim: insert the full code sequence when <Alt+Backspace> is pressed
|
||||
verbatim: pause a little after an ESC, to not miss a succeeding code
|
||||
verbatim: report and ignore an invalid keystroke for Unicode input
|
||||
|
||||
Michalis Kokologiannakis (2):
|
||||
build: avoid compilation warnings by using memcpy() instead of strncpy()
|
||||
files: ignore only EPERM when fchmod() or fchown() fails
|
||||
|
||||
|
||||
Changes between v4.9 and v5.0:
|
||||
------------------------------
|
||||
|
||||
@@ -4089,3 +4190,8 @@ Mike Scalora (3):
|
||||
Rishabh Dave (2):
|
||||
browser: keep the same file selected when the directory contents change
|
||||
browser: move all openings and closings of a directory to the same function
|
||||
|
||||
|
||||
======================================================================
|
||||
For older changes, see in https://ftp.gnu.org/gnu/nano/nano-5.0.tar.xz
|
||||
======================================================================
|
||||
|
||||
@@ -2,6 +2,7 @@ Improvements in GNU nano
|
||||
========================
|
||||
|
||||
Since 5.0:
|
||||
- M-Bsp deletes a word leftward.
|
||||
- With --indicator a "scrollbar" is shown, indicating position+portion.
|
||||
- M-Ins places an anchor, M-PgUp/M-PgDn jump to the nearest anchor.
|
||||
- Toggling help lines (M-X) and Refresh (^L) work nearly everywhere.
|
||||
|
||||
@@ -6,8 +6,7 @@ if USE_COLOR
|
||||
SUBDIRS += syntax
|
||||
endif
|
||||
|
||||
EXTRA_DIST = ChangeLog.1999-2006 ChangeLog.2007-2015 \
|
||||
IMPROVEMENTS README.GIT
|
||||
EXTRA_DIST = IMPROVEMENTS
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
|
||||
16
NEWS
16
NEWS
@@ -1,3 +1,19 @@
|
||||
2020.08.24 - GNU nano 5.2 "Ranrapalca"
|
||||
• Making certain replacements after a large paste does not crash.
|
||||
• Hitting a toggle at the Search prompt does not clear the answer.
|
||||
• Using --positionlog does not complain at the first start.
|
||||
• A macro containing a Search command will not sometimes fail.
|
||||
|
||||
2020.08.12 - GNU nano 5.1 "Cantabria"
|
||||
• M-Bsp (Alt+Backspace) deletes a word backwards, like in Bash.
|
||||
• M-[ has become bindable. (Be careful, though: as it is the
|
||||
starting combination of many escape sequences, avoid gluing
|
||||
it together with other keystrokes, like in a macro.)
|
||||
• With --indicator and --softwrap, the first keystroke in an
|
||||
empty buffer does not crash.
|
||||
• Invoking the formatter while text is marked does not crash.
|
||||
• In UTF-8 locales, an anchor is shown as a diamond.
|
||||
|
||||
2020.07.29 - GNU nano 5.0 "Among the fields of barley"
|
||||
• With --indicator (or -q or 'set indicator') nano will show a kind
|
||||
of scrollbar on the righthand side of the screen to indicate where
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Generate configure & friends for GIT users.
|
||||
|
||||
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
||||
gnulib_hash="ac34618e85013bfec4650f02e8e79c5de6d80fb3"
|
||||
gnulib_hash="6a78706ae230ad24bc06d33d9eddca25806ffb2a"
|
||||
|
||||
modules="
|
||||
futimens
|
||||
|
||||
18
configure.ac
18
configure.ac
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
AC_INIT([GNU nano], [5.0], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [5.2], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE([1.14])
|
||||
@@ -628,18 +628,16 @@ if test "x$enable_utf8" != xno && \
|
||||
else
|
||||
if test "x$enable_utf8" = xyes; then
|
||||
AC_MSG_ERROR([
|
||||
*** UTF-8 support was requested, but insufficient UTF-8 support was
|
||||
*** detected in your curses and/or C libraries. Please verify that
|
||||
*** your Slang was built with UTF-8 support or your curses was built
|
||||
*** with wide-character support, and that your C library was built
|
||||
*** UTF-8 support was requested, but insufficient support was
|
||||
*** detected in your curses and/or C libraries. Please verify
|
||||
*** that both your curses library and your C library were built
|
||||
*** with wide-character support.])
|
||||
elif test "x$enable_utf8" != xno; then
|
||||
AC_MSG_WARN([
|
||||
*** Insufficient UTF-8 support was detected in your curses and/or C
|
||||
*** libraries. If you want UTF-8 support, please verify that your
|
||||
*** Slang was built with UTF-8 support or your curses was built with
|
||||
*** wide-character support, and that your C library was built with
|
||||
*** wide-character support.])
|
||||
*** Insufficient UTF-8 support was detected in your curses
|
||||
*** and/or C libraries. If you want UTF-8 support, please
|
||||
*** verify that both your curses library and your C library
|
||||
*** were built with wide-character support.])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -55,15 +55,15 @@
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+H</td><td>Delete character before cursor </td></tr>
|
||||
<tr><td>Ctrl+D</td><td>Delete character under cursor</td></tr>
|
||||
<tr><td>Ctrl+Shift+Del </td><td>Delete word to the left</td></tr>
|
||||
<tr><td>Ctrl+Del</td><td>Delete word to the right</td></tr>
|
||||
<tr><td>Alt+Bsp</td><td>Delete word to the left</td></tr>
|
||||
<tr><td>Ctrl+Del </td><td>Delete word to the right</td></tr>
|
||||
<tr><td>Alt+Del</td><td>Delete current line</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Operations</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+T </td><td>Run a spell check</td></tr>
|
||||
<tr><td>Ctrl+T </td><td>Execute some command</td></tr>
|
||||
<tr><td>Ctrl+J</td><td>Justify paragraph or region</td></tr>
|
||||
<tr><td>Alt+J</td><td>Justify entire buffer</td></tr>
|
||||
<tr><td>Alt+B</td><td>Run a syntax check</td></tr>
|
||||
|
||||
31
doc/faq.html
31
doc/faq.html
@@ -41,12 +41,12 @@
|
||||
<h3><a href="#4">4. Running</a></h3>
|
||||
<blockquote><p>
|
||||
<a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
|
||||
<a href="#4.2">4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</a><br>
|
||||
<a href="#4.2">4.2. How can I make Ctrl+Shift+Left/Right select words on urxvt?</a><br>
|
||||
<a href="#4.3">4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</a><br>
|
||||
<a href="#4.4">4.4. With what keystroke can I paste text from the clipboard into nano?</a><br>
|
||||
<a href="#4.5">4.5. How do I select text for or paste text from the clipboard when nano's mouse support is turned on?</a><br>
|
||||
<a href="#4.6">4.6. When I paste text into a document, each line gets indented further than the last. Why? And how can I stop this?</a><br>
|
||||
<a href="#4.7">4.7. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?<a><br>
|
||||
<a href="#4.7">4.7. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?</a><br>
|
||||
<a href="#4.8">4.8. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.9">4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
</p></blockquote>
|
||||
@@ -89,7 +89,7 @@
|
||||
<h3><a name="1.3"></a>1.3. Why the name change from TIP?</h3>
|
||||
<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>
|
||||
<h3><a name="1.4"></a>1.4. What is the current version of nano?</h3>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>5.0</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>5.2</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>
|
||||
<h3><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h3>
|
||||
<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%">
|
||||
@@ -182,10 +182,27 @@
|
||||
To open '+filename.txt' starting on line 1, column 20: <b>nano +,20 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 10, column 20: <b>nano +10,20 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 1 and 'filename.txt' starting on line 40: <b>nano +1 +filename.txt +40 filename.txt</b></p></blockquote>
|
||||
<h3><a name="4.2"></a>4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</h3>
|
||||
<blockquote><p>Try setting your $TERM variable to 'vt100'. nano doesn't yet support every term entry under the sun.</p>
|
||||
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
|
||||
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
|
||||
<h3><a name="4.2"></a>4.2. How can I make Ctrl+Shift+Left/Right select words on urxvt?</h3>
|
||||
<blockquote><p>The urxvt terminal emulator produces non-standard escape sequences for the modified cursor keys. These deviant sequences are not listed in the terminfo database, which means that ncurses does not recognize them. The easiest way around this is to tell urxvt to produce xterm-compatible escape sequences for the relevant keystrokes. To achieve this, add the following lines to your ~/.Xresources file:</p>
|
||||
<pre>
|
||||
URxvt.iso14755_52: False
|
||||
|
||||
URxvt.keysym.C-S-Up: \033[1;6A
|
||||
URxvt.keysym.C-S-Down: \033[1;6B
|
||||
URxvt.keysym.C-S-Right: \033[1;6C
|
||||
URxvt.keysym.C-S-Left: \033[1;6D
|
||||
|
||||
URxvt.keysym.M-Up: \033[1;3A
|
||||
URxvt.keysym.M-Down: \033[1;3B
|
||||
URxvt.keysym.M-Right: \033[1;3C
|
||||
URxvt.keysym.M-Left: \033[1;3D
|
||||
|
||||
URxvt.keysym.M-Insert: \033[2;3~
|
||||
URxvt.keysym.M-Delete: \033[3;3~
|
||||
|
||||
URxvt.keysym.M-Page_Up: \033[5;3~
|
||||
URxvt.keysym.M-Page_Down: \033[6;3~</pre>
|
||||
<p>Then run <b>xrdb ~/.Xresources</b> and restart your urxvt terminal. Now <b>Ctrl+Shift+Left</b> and <b>Ctrl+Shift+Right</b> will select words, <b>Alt+Up</b> and <b>Alt+Down</b> will scroll the text without moving the cursor, and several such things more.</p></blockquote>
|
||||
<h3><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h3>
|
||||
<blockquote><p>You can use the <b>-K</b> or <b>--rawsequences</b> option on the command line, or add the line <b>set rawsequences</b> to your .nanorc. However, nano's mouse support will be disabled if you do any of these things.</p></blockquote>
|
||||
<h3><a name="4.4"></a>4.4. With what keystroke can I paste text from the clipboard into nano?</h3>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 5.0" "July 2020"
|
||||
.TH NANO 1 "version 5.2" "August 2020"
|
||||
|
||||
.SH NAME
|
||||
nano \- Nano's ANOther editor, inspired by Pico
|
||||
@@ -261,6 +261,7 @@ position to the end of the line, instead of cutting the entire line.
|
||||
.TP
|
||||
.BR \-l ", " \-\-linenumbers
|
||||
Display line numbers to the left of the text area.
|
||||
(Any line with an anchor additionally gets a mark in the margin.)
|
||||
.TP
|
||||
.BR \-m ", " \-\-mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
@smallbook
|
||||
@set EDITION 0.5
|
||||
@set VERSION 5.0
|
||||
@set UPDATED July 2020
|
||||
@set VERSION 5.2
|
||||
@set UPDATED August 2020
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @command{nano}
|
||||
@subtitle a small and friendly text editor
|
||||
@subtitle version 5.0
|
||||
@subtitle version 5.2
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -63,7 +63,7 @@ e-mail: @email{chrisa@@asty.org}@*
|
||||
@node Top
|
||||
@top
|
||||
|
||||
This manual documents the GNU @command{nano} editor, version 5.0.
|
||||
This manual documents the GNU @command{nano} editor, version 5.2.
|
||||
|
||||
@menu
|
||||
* Introduction::
|
||||
@@ -71,9 +71,9 @@ This manual documents the GNU @command{nano} editor, version 5.0.
|
||||
* Command-line Options::
|
||||
* Editor Basics::
|
||||
* Built-in Help::
|
||||
* The File Browser::
|
||||
* Feature Toggles::
|
||||
* Nanorc Files::
|
||||
* The File Browser::
|
||||
* Pico Compatibility::
|
||||
* Building and Configure Options::
|
||||
@end menu
|
||||
@@ -370,6 +370,7 @@ position to the end of the line, instead of cutting the entire line.
|
||||
@item -l
|
||||
@itemx --linenumbers
|
||||
Display line numbers to the left of the text area.
|
||||
(Any line with an anchor additionally gets a mark in the margin.)
|
||||
|
||||
@item -m
|
||||
@itemx --mouse
|
||||
@@ -630,6 +631,8 @@ inherits the anchor. After performing an operation on the entire buffer
|
||||
spell check on it), any anchors that were present are gone. And when
|
||||
you close the buffer, all its anchors simply disappear; they are not saved.
|
||||
|
||||
Anchors are visualized in the margin when line numbers are activated.
|
||||
|
||||
@node Limitations
|
||||
@section Limitations
|
||||
|
||||
@@ -647,6 +650,25 @@ editor and the available keystrokes. Navigation is via the @kbd{^Y} (Page Up)
|
||||
and @kbd{^V} (Page Down) keys. @kbd{^X} exits from the help system.
|
||||
|
||||
|
||||
@node The File Browser
|
||||
@chapter The File Browser
|
||||
|
||||
When in the Read-File (@kbd{^R}) or Write-Out menu (@kbd{^O}),
|
||||
pressing @kbd{^T} will invoke the file browser.
|
||||
Here, one can navigate directories in a graphical manner in order to
|
||||
find the desired file.
|
||||
|
||||
Basic movement in the file browser is accomplished with the arrow and
|
||||
other cursor-movement keys. More targeted movement is accomplished by
|
||||
searching, via @kbd{^W} or @kbd{w}, or by changing directory, via
|
||||
@kbd{^_} or @kbd{g}. The behavior of the @kbd{Enter} key (or @kbd{s})
|
||||
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 status bar, and the file
|
||||
browser exits.
|
||||
|
||||
|
||||
@node Feature Toggles
|
||||
@chapter Feature Toggles
|
||||
|
||||
@@ -853,12 +875,14 @@ in the two help lines at the bottom of the screen.
|
||||
|
||||
@item set linenumbers
|
||||
Display line numbers to the left of the text area.
|
||||
(Any line with an anchor additionally gets a mark in the margin.)
|
||||
|
||||
@item set locking
|
||||
Enable vim-style lock-files for when editing files.
|
||||
|
||||
@anchor{@code{set matchbrackets}}
|
||||
@item set matchbrackets "@var{characters}"
|
||||
Set the opening and closing brackets that can be found by bracket
|
||||
Specify the opening and closing brackets that can be found by bracket
|
||||
searches. This may not include blank characters. The opening set must
|
||||
come before the closing set, and the two sets must be in the same order.
|
||||
The default value is @t{"(<[@{)>]@}"}.
|
||||
@@ -1419,11 +1443,12 @@ Goes to a specific line (and column if specified). Negative numbers count
|
||||
from the end of the file (and end of the line).
|
||||
|
||||
@item findbracket
|
||||
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
|
||||
(pairs) with the one under the cursor.
|
||||
Moves the cursor to the bracket (or brace or parenthesis, etc.) that matches
|
||||
(pairs) with the one under the cursor. @xref{@code{set matchbrackets}}.
|
||||
|
||||
@item anchor
|
||||
Places an anchor at the current line, or removes it when already present.
|
||||
(An anchor is visible when line numbers are activated.)
|
||||
|
||||
@item prevanchor
|
||||
Goes to the first anchor before the current line.
|
||||
@@ -1653,25 +1678,6 @@ it means all menus where the specified @code{key} exists.
|
||||
@end table
|
||||
|
||||
|
||||
@node The File Browser
|
||||
@chapter The File Browser
|
||||
|
||||
When in the Read-File (@kbd{^R}) or Write-Out menu (@kbd{^O}),
|
||||
pressing @kbd{^T} will invoke the file browser.
|
||||
Here, one can navigate directories in a graphical manner in order to
|
||||
find the desired file.
|
||||
|
||||
Basic movement in the file browser is accomplished with the arrow and
|
||||
other cursor-movement keys. More targeted movement is accomplished by
|
||||
searching, via @kbd{^W} or @kbd{w}, or by changing directory, via
|
||||
@kbd{^_} or @kbd{g}. The behavior of the @kbd{Enter} key (or @kbd{s})
|
||||
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 status bar, and the file
|
||||
browser exits.
|
||||
|
||||
|
||||
@node Pico Compatibility
|
||||
@chapter Pico Compatibility
|
||||
|
||||
|
||||
10
doc/nanorc.5
10
doc/nanorc.5
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 5.0" "July 2020"
|
||||
.TH NANORC 5 "version 5.2" "August 2020"
|
||||
|
||||
.SH NAME
|
||||
nanorc \- GNU nano's configuration file
|
||||
@@ -166,12 +166,13 @@ See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set linenumbers
|
||||
Display line numbers to the left of the text area.
|
||||
(Any line with an anchor additionally gets a mark in the margin.)
|
||||
.TP
|
||||
.B set locking
|
||||
Enable vim-style lock-files for when editing files.
|
||||
.TP
|
||||
.BI "set matchbrackets """ characters """
|
||||
Set the opening and closing brackets that can be found by bracket
|
||||
Specify the opening and closing brackets that can be found by bracket
|
||||
searches. This may not include blank characters. The opening set must
|
||||
come before the closing set, and the two sets must be in the same order.
|
||||
The default value is "\fB(<[{)>]}\fP".
|
||||
@@ -722,11 +723,12 @@ Goes to a specific line (and column if specified). Negative numbers count
|
||||
from the end of the file (and end of the line).
|
||||
.TP
|
||||
.B findbracket
|
||||
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
|
||||
(pairs) with the one under the cursor.
|
||||
Moves the cursor to the bracket (or brace or parenthesis, etc.) that matches
|
||||
(pairs) with the one under the cursor. See \fBset matchbrackets\fR.
|
||||
.TP
|
||||
.B anchor
|
||||
Places an anchor at the current line, or removes it when already present.
|
||||
(An anchor is visible when line numbers are activated.)
|
||||
.TP
|
||||
.B prevanchor
|
||||
Goes to the first anchor before the current line.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 5.0" "July 2020"
|
||||
.TH RNANO 1 "version 5.2" "August 2020"
|
||||
|
||||
.SH NAME
|
||||
rnano \- a restricted nano
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
## Scroll the buffer contents per half-screen instead of per line.
|
||||
# set jumpyscrolling
|
||||
|
||||
## Display line numbers to the left of the text.
|
||||
## Display line numbers to the left (and any anchors in the margin).
|
||||
# set linenumbers
|
||||
|
||||
## Enable vim-style lock-files. This is just to let a vim user know you
|
||||
|
||||
382
po/nano.pot
382
po/nano.pot
File diff suppressed because it is too large
Load Diff
390
po/pt_BR.po
390
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
390
po/zh_CN.po
390
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
394
po/zh_TW.po
394
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION="5.0"
|
||||
VERSION="5.2"
|
||||
|
||||
./configure -C --enable-tiny && make && ./configure -C &&
|
||||
|
||||
|
||||
31
src/files.c
31
src/files.c
@@ -658,10 +658,8 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
|
||||
while ((onevalue = getc_unlocked(f)) != EOF) {
|
||||
char input = (char)onevalue;
|
||||
|
||||
if (control_C_was_pressed) {
|
||||
statusline(ALERT, _("Interrupted"));
|
||||
if (control_C_was_pressed)
|
||||
break;
|
||||
}
|
||||
|
||||
/* When the byte before the current one is a CR and we're doing
|
||||
* format conversion, then strip this CR when it's before a LF
|
||||
@@ -735,6 +733,9 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
|
||||
if (ferror(f) && errornumber != EINTR && errornumber != 0)
|
||||
statusline(ALERT, strerror(errornumber));
|
||||
|
||||
if (control_C_was_pressed)
|
||||
statusline(ALERT, _("Interrupted"));
|
||||
|
||||
fclose(f);
|
||||
|
||||
if (fd > 0 && !undoable && !ISSET(VIEW_MODE))
|
||||
@@ -950,7 +951,7 @@ bool execute_command(const char *command)
|
||||
/* Create a pipe to read the command's output from, and, if needed,
|
||||
* a pipe to feed the command's input through. */
|
||||
if (pipe(from_fd) == -1 || (should_pipe && pipe(to_fd) == -1)) {
|
||||
statusline(ALERT, _("Could not create pipe"));
|
||||
statusline(ALERT, _("Could not create pipe: %s"), strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -986,7 +987,7 @@ bool execute_command(const char *command)
|
||||
close(from_fd[1]);
|
||||
|
||||
if (pid_of_command == -1) {
|
||||
statusline(ALERT, _("Could not fork"));
|
||||
statusline(ALERT, _("Could not fork: %s"), strerror(errno));
|
||||
close(from_fd[0]);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1619,14 +1620,20 @@ bool make_backup_of(char *realname)
|
||||
goto problem;
|
||||
|
||||
/* Try to change owner and group to those of the original file;
|
||||
* ignore errors, as a normal user cannot change the owner. */
|
||||
IGNORE_CALL_RESULT(fchown(descriptor, openfile->statinfo->st_uid,
|
||||
openfile->statinfo->st_gid));
|
||||
* ignore permission errors, as a normal user cannot change the owner. */
|
||||
if (fchown(descriptor, openfile->statinfo->st_uid,
|
||||
openfile->statinfo->st_gid) < 0 && errno != EPERM) {
|
||||
fclose(backup_file);
|
||||
goto problem;
|
||||
}
|
||||
|
||||
/* Set the backup's permissions to those of the original file.
|
||||
* It is not a security issue if this fails, as we have created
|
||||
* the file with just read and write permission for the owner. */
|
||||
IGNORE_CALL_RESULT(fchmod(descriptor, openfile->statinfo->st_mode));
|
||||
if (fchmod(descriptor, openfile->statinfo->st_mode) < 0 && errno != EPERM) {
|
||||
fclose(backup_file);
|
||||
goto problem;
|
||||
}
|
||||
|
||||
original = fopen(realname, "rb");
|
||||
|
||||
@@ -2059,11 +2066,9 @@ int do_writeout(bool exiting, bool withprompt)
|
||||
functionptrtype func;
|
||||
const char *msg;
|
||||
#ifndef NANO_TINY
|
||||
const char *formatstr, *backupstr;
|
||||
|
||||
formatstr = (openfile->fmt == DOS_FILE) ? _(" [DOS Format]") :
|
||||
const char *formatstr = (openfile->fmt == DOS_FILE) ? _(" [DOS Format]") :
|
||||
(openfile->fmt == MAC_FILE) ? _(" [Mac Format]") : "";
|
||||
backupstr = ISSET(MAKE_BACKUP) ? _(" [Backup]") : "";
|
||||
const char *backupstr = ISSET(MAKE_BACKUP) ? _(" [Backup]") : "";
|
||||
|
||||
/* When the mark is on, offer to write the selection to disk, but
|
||||
* not when in restricted mode, because it would allow writing to
|
||||
|
||||
@@ -1218,6 +1218,7 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "M-;", 0, run_macro, 0);
|
||||
add_to_sclist(MMAIN, "M-U", 0, do_undo, 0);
|
||||
add_to_sclist(MMAIN, "M-E", 0, do_redo, 0);
|
||||
add_to_sclist(MMAIN, "M-Bsp", CONTROL_SHIFT_DELETE, chop_previous_word, 0);
|
||||
add_to_sclist(MMAIN, "Sh-^Del", CONTROL_SHIFT_DELETE, chop_previous_word, 0);
|
||||
add_to_sclist(MMAIN, "^Del", CONTROL_DELETE, chop_next_word, 0);
|
||||
add_to_sclist(MMAIN, "M-Del", ALT_DELETE, zap_text, 0);
|
||||
|
||||
@@ -302,7 +302,7 @@ void help_init(void)
|
||||
counter++;
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->toggle && s->ordinal == counter) {
|
||||
ptr += sprintf(ptr, "%s\t\t %s %s\n", (s->menus == MMAIN ? s->keystr : ""),
|
||||
ptr += sprintf(ptr, "%s\t\t %s %s\n", (s->menus & MMAIN ? s->keystr : ""),
|
||||
_(flagtostr(s->toggle)), _("enable/disable"));
|
||||
if (s->toggle == NO_SYNTAX || s->toggle == TABS_TO_SPACES)
|
||||
ptr += sprintf(ptr, "\n");
|
||||
|
||||
@@ -447,9 +447,7 @@ void load_poshistory(void)
|
||||
|
||||
free(line);
|
||||
|
||||
if (stat(poshistname, &fileinfo) == -1)
|
||||
jot_error(N_("Error reading %s: %s\n"), poshistname, strerror(errno));
|
||||
else
|
||||
if (stat(poshistname, &fileinfo) == 0)
|
||||
latest_timestamp = fileinfo.st_mtime;
|
||||
}
|
||||
|
||||
@@ -493,9 +491,7 @@ void save_poshistory(void)
|
||||
if (fclose(histfile) == EOF)
|
||||
jot_error(N_("Error writing %s: %s\n"), poshistname, strerror(errno));
|
||||
|
||||
if (stat(poshistname, &fileinfo) == -1)
|
||||
jot_error(N_("Error writing %s: %s\n"), poshistname, strerror(errno));
|
||||
else
|
||||
if (stat(poshistname, &fileinfo) == 0)
|
||||
latest_timestamp = fileinfo.st_mtime;
|
||||
}
|
||||
|
||||
@@ -504,9 +500,7 @@ void reload_positions_if_needed(void)
|
||||
{
|
||||
struct stat fileinfo;
|
||||
|
||||
if (stat(poshistname, &fileinfo) == -1)
|
||||
jot_error(N_("Error reading %s: %s\n"), poshistname, strerror(errno));
|
||||
else if (fileinfo.st_mtime != latest_timestamp) {
|
||||
if (stat(poshistname, &fileinfo) == 0 && fileinfo.st_mtime != latest_timestamp) {
|
||||
poshiststruct *item, *nextone;
|
||||
|
||||
for (item = position_history; item != NULL; item = nextone) {
|
||||
|
||||
@@ -234,8 +234,8 @@ void to_prev_block(void)
|
||||
seen_text = seen_text || is_text;
|
||||
}
|
||||
|
||||
/* Step forward one line again if this one is blank. */
|
||||
if (openfile->current->next != NULL &&
|
||||
/* Step forward one line again if we passed text but this line is blank. */
|
||||
if (seen_text && openfile->current->next != NULL &&
|
||||
white_string(openfile->current->data))
|
||||
openfile->current = openfile->current->next;
|
||||
|
||||
|
||||
21
src/nano.c
21
src/nano.c
@@ -1280,17 +1280,16 @@ void unbound_key(int code)
|
||||
else if (code > 0x7F)
|
||||
statusline(ALERT, _("Unbound key"));
|
||||
else if (meta_key) {
|
||||
if (code == '[')
|
||||
statusline(ALERT, _("Unbindable key: M-["));
|
||||
#ifndef NANO_TINY
|
||||
else if (code < 0x20)
|
||||
if (code < 0x20)
|
||||
statusline(ALERT, _("Unbindable key: M-^%c"), code + 0x40);
|
||||
else
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
else if (shifted_metas && 'A' <= code && code <= 'Z')
|
||||
if (shifted_metas && 'A' <= code && code <= 'Z')
|
||||
statusline(ALERT, _("Unbound key: Sh-M-%c"), code);
|
||||
#endif
|
||||
else
|
||||
#endif
|
||||
statusline(ALERT, _("Unbound key: M-%c"), toupper(code));
|
||||
} else if (code == ESC_CODE)
|
||||
statusline(ALERT, _("Unbindable key: ^["));
|
||||
@@ -1553,16 +1552,16 @@ void process_a_keystroke(void)
|
||||
else if (ISSET(VIEW_MODE))
|
||||
print_view_warning();
|
||||
else {
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark && openfile->kind_of_mark == SOFTMARK) {
|
||||
openfile->mark = NULL;
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
#endif
|
||||
/* Store the byte, and leave room for a terminating zero. */
|
||||
puddle = charealloc(puddle, depth + 2);
|
||||
puddle[depth++] = (char)input;
|
||||
}
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark && openfile->kind_of_mark == SOFTMARK) {
|
||||
openfile->mark = NULL;
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If we have a command, or if there aren't any other key codes waiting,
|
||||
|
||||
@@ -195,14 +195,14 @@ void inject_into_answer(char *burst, size_t count)
|
||||
/* Get a verbatim keystroke and insert it into the answer. */
|
||||
void do_statusbar_verbatim_input(void)
|
||||
{
|
||||
size_t count = 1;
|
||||
char *bytes;
|
||||
size_t count;
|
||||
|
||||
bytes = get_verbatim_kbinput(bottomwin, &count);
|
||||
|
||||
if (count > 0)
|
||||
if (0 < count && count < 999)
|
||||
inject_into_answer(bytes, count);
|
||||
else
|
||||
else if (count == 0)
|
||||
beep();
|
||||
|
||||
free(bytes);
|
||||
|
||||
@@ -634,8 +634,6 @@ void spotlight(size_t from_col, size_t to_col);
|
||||
void spotlight_softwrapped(size_t from_col, size_t to_col);
|
||||
#endif
|
||||
void do_suspend_void(void);
|
||||
void disable_waiting(void);
|
||||
void enable_waiting(void);
|
||||
#ifdef ENABLE_EXTRA
|
||||
void do_credits(void);
|
||||
#endif
|
||||
|
||||
@@ -853,8 +853,8 @@ void parse_binding(char *ptr, bool dobind)
|
||||
newsc->keystr = keycopy;
|
||||
newsc->keycode = keycode;
|
||||
|
||||
/* Disallow rebinding ^[ and frequent escape-sequence starter "Esc [". */
|
||||
if (newsc->keycode == ESC_CODE || newsc->keycode == '[') {
|
||||
/* Disallow rebinding <Esc> (^[). */
|
||||
if (newsc->keycode == ESC_CODE) {
|
||||
jot_error(N_("Keystroke %s may not be rebound"), keycopy);
|
||||
free_things:
|
||||
free(keycopy);
|
||||
@@ -996,11 +996,12 @@ short indices[9] = { 204, 163, 134, 38, 48, 148, 215, 208, 137 };
|
||||
* vivid to TRUE for a lighter color, and thick for a heavier typeface. */
|
||||
short color_to_short(const char *colorname, bool *vivid, bool *thick)
|
||||
{
|
||||
if (strncmp(colorname, "bright", 6) == 0) { /* Deprecated; remove in 2023. */
|
||||
if (strncmp(colorname, "bright", 6) == 0 && colorname[6] != '\0') {
|
||||
/* Prefix "bright" is deprecated; remove in 2024. */
|
||||
*vivid = TRUE;
|
||||
*thick = TRUE;
|
||||
colorname += 6;
|
||||
} else if (strncmp(colorname, "light", 5) == 0) {
|
||||
} else if (strncmp(colorname, "light", 5) == 0 && colorname[5] != '\0') {
|
||||
*vivid = TRUE;
|
||||
*thick = FALSE;
|
||||
colorname += 5;
|
||||
|
||||
93
src/search.c
93
src/search.c
@@ -132,6 +132,8 @@ void search_init(bool replacing, bool retain_answer)
|
||||
break;
|
||||
}
|
||||
|
||||
retain_answer = TRUE;
|
||||
|
||||
func = func_from_key(&response);
|
||||
|
||||
/* If we're here, one of the five toggles was pressed, or
|
||||
@@ -183,35 +185,12 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
/* The time we last looked at the keyboard. */
|
||||
|
||||
/* Set non-blocking input so that we can just peek for a Cancel. */
|
||||
disable_waiting();
|
||||
nodelay(edit, TRUE);
|
||||
|
||||
if (begin == NULL)
|
||||
came_full_circle = FALSE;
|
||||
|
||||
/* Start searching through the lines, looking for the needle. */
|
||||
while (TRUE) {
|
||||
/* Glance at the keyboard once every second. */
|
||||
if (time(NULL) - lastkbcheck > 0) {
|
||||
int input = parse_kbinput(edit);
|
||||
|
||||
lastkbcheck = time(NULL);
|
||||
|
||||
/* Consume all waiting keystrokes until a Cancel. */
|
||||
while (input != ERR) {
|
||||
if (func_from_key(&input) == do_cancel) {
|
||||
statusbar(_("Cancelled"));
|
||||
enable_waiting();
|
||||
return -2;
|
||||
}
|
||||
input = parse_kbinput(NULL);
|
||||
}
|
||||
|
||||
if (++feedback > 0)
|
||||
/* TRANSLATORS: This is shown when searching takes
|
||||
* more than half a second. */
|
||||
statusbar(_("Searching..."));
|
||||
}
|
||||
|
||||
/* When starting a new search, skip the first character, then
|
||||
* (in either case) search for the needle in the current line. */
|
||||
if (skipone) {
|
||||
@@ -243,30 +222,32 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (the_window_resized) {
|
||||
regenerate_screen();
|
||||
nodelay(edit, TRUE);
|
||||
statusbar(_("Searching..."));
|
||||
feedback = 1;
|
||||
}
|
||||
#endif
|
||||
/* If we're back at the beginning, then there is no needle. */
|
||||
if (came_full_circle) {
|
||||
enable_waiting();
|
||||
nodelay(edit, FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Move to the previous or next line in the file. */
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
line = line->prev;
|
||||
else
|
||||
line = line->next;
|
||||
line = (ISSET(BACKWARDS_SEARCH)) ? line->prev : line->next;
|
||||
|
||||
/* If we've reached the start or end of the buffer, wrap around;
|
||||
* but stop when spell-checking or replacing in a region. */
|
||||
if (line == NULL) {
|
||||
if (whole_word_only || modus == INREGION) {
|
||||
enable_waiting();
|
||||
nodelay(edit, FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
line = openfile->filebot;
|
||||
else
|
||||
line = openfile->filetop;
|
||||
line = (ISSET(BACKWARDS_SEARCH)) ? openfile->filebot : openfile->filetop;
|
||||
|
||||
if (modus == JUSTFIND) {
|
||||
statusbar(_("Search Wrapped"));
|
||||
@@ -283,11 +264,48 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
from = line->data;
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
from += strlen(line->data);
|
||||
|
||||
/* Glance at the keyboard once every second, to check for a Cancel. */
|
||||
if (time(NULL) - lastkbcheck > 0) {
|
||||
int input = wgetch(edit);
|
||||
|
||||
lastkbcheck = time(NULL);
|
||||
|
||||
/* Consume any queued-up keystrokes, until a Cancel or nothing. */
|
||||
while (input != ERR) {
|
||||
if (input == ESC_CODE) {
|
||||
napms(20);
|
||||
input = wgetch(edit);
|
||||
meta_key = TRUE;
|
||||
} else
|
||||
meta_key = FALSE;
|
||||
|
||||
if (func_from_key(&input) == do_cancel) {
|
||||
#ifndef NANO_TINY
|
||||
if (the_window_resized)
|
||||
regenerate_screen();
|
||||
#endif
|
||||
statusbar(_("Cancelled"));
|
||||
/* Clear out the key buffer (in case a macro is running). */
|
||||
while (input != ERR)
|
||||
input = parse_kbinput(NULL);
|
||||
nodelay(edit, FALSE);
|
||||
return -2;
|
||||
}
|
||||
|
||||
input = wgetch(edit);
|
||||
}
|
||||
|
||||
if (++feedback > 0)
|
||||
/* TRANSLATORS: This is shown when searching takes
|
||||
* more than half a second. */
|
||||
statusbar(_("Searching..."));
|
||||
}
|
||||
}
|
||||
|
||||
found_x = found - line->data;
|
||||
|
||||
enable_waiting();
|
||||
nodelay(edit, FALSE);
|
||||
|
||||
/* Ensure that the found occurrence is not beyond the starting x. */
|
||||
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && (found_x > begin_x ||
|
||||
@@ -493,8 +511,9 @@ char *replace_line(const char *needle)
|
||||
void wipe_and_recalculate_colorinfo(void)
|
||||
{
|
||||
for (linestruct *line = openfile->filetop; line != NULL; line = line->next)
|
||||
for (short index = 0; index < openfile->syntax->nmultis; index++)
|
||||
line->multidata[index] = -1;
|
||||
if (line->multidata)
|
||||
for (short index = 0; index < openfile->syntax->nmultis; index++)
|
||||
line->multidata[index] = -1;
|
||||
|
||||
precalc_multicolorinfo();
|
||||
}
|
||||
|
||||
118
src/text.c
118
src/text.c
@@ -1761,8 +1761,6 @@ void do_justify(bool full_justify)
|
||||
linestruct *jusline;
|
||||
/* The line that we're justifying in the current cutbuffer. */
|
||||
#ifndef NANO_TINY
|
||||
bool right_side_up = (openfile->mark && mark_is_before_cursor());
|
||||
/* Whether the mark (if any) is before the cursor. */
|
||||
bool before_eol = FALSE;
|
||||
/* Whether the end of a marked region is before the end of its line. */
|
||||
char *primary_lead = NULL;
|
||||
@@ -1980,7 +1978,7 @@ void do_justify(bool full_justify)
|
||||
update_undo(PASTE);
|
||||
|
||||
/* After justifying a backward-marked text, swap mark and cursor. */
|
||||
if (openfile->mark && !right_side_up) {
|
||||
if (openfile->mark && !mark_is_before_cursor()) {
|
||||
linestruct *bottom = openfile->current;
|
||||
size_t bottom_x = openfile->current_x;
|
||||
|
||||
@@ -2087,7 +2085,7 @@ bool replace_buffer(const char *filename, undo_type action, const char *operatio
|
||||
}
|
||||
|
||||
/* Execute the given program, with the given temp file as last argument. */
|
||||
const char *treat(char *tempfile_name, char *theprogram, bool spelling)
|
||||
void treat(char *tempfile_name, char *theprogram, bool spelling)
|
||||
{
|
||||
ssize_t lineno_save = openfile->current->lineno;
|
||||
size_t current_x_save = openfile->current_x;
|
||||
@@ -2098,14 +2096,21 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
|
||||
long timestamp_nsec = 0;
|
||||
static char **arguments = NULL;
|
||||
pid_t thepid;
|
||||
int program_status;
|
||||
int program_status, errornumber;
|
||||
bool replaced = FALSE;
|
||||
|
||||
/* Stat the temporary file. If that succeeds and its size is zero,
|
||||
* there is nothing to do; otherwise, store its time of modification. */
|
||||
if (stat(tempfile_name, &fileinfo) == 0) {
|
||||
if (fileinfo.st_size == 0)
|
||||
return NULL;
|
||||
if (fileinfo.st_size == 0) {
|
||||
#ifndef NANO_TINY
|
||||
if (spelling && openfile->mark)
|
||||
statusline(ALERT, _("Selection is empty"));
|
||||
else
|
||||
#endif
|
||||
statusbar(_("Buffer is empty"));
|
||||
return;
|
||||
}
|
||||
|
||||
timestamp_sec = (long)fileinfo.st_mtim.tv_sec;
|
||||
timestamp_nsec = (long)fileinfo.st_mtim.tv_nsec;
|
||||
@@ -2122,22 +2127,26 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
|
||||
|
||||
/* Terminate the child if the program is not found. */
|
||||
exit(9);
|
||||
} else if (thepid < 0)
|
||||
return _("Could not fork");
|
||||
} else if (thepid > 0) {
|
||||
/* Block SIGWINCHes while waiting for the forked program to end,
|
||||
* so nano doesn't get pushed past the wait(). */
|
||||
block_sigwinch(TRUE);
|
||||
wait(&program_status);
|
||||
block_sigwinch(FALSE);
|
||||
}
|
||||
|
||||
/* Block SIGWINCHes while waiting for the program to end,
|
||||
* so nano doesn't get pushed past the wait(). */
|
||||
block_sigwinch(TRUE);
|
||||
wait(&program_status);
|
||||
block_sigwinch(FALSE);
|
||||
errornumber = errno;
|
||||
|
||||
/* Restore the terminal state and reenter curses mode. */
|
||||
terminal_init();
|
||||
doupdate();
|
||||
|
||||
if (!WIFEXITED(program_status) || WEXITSTATUS(program_status) > 2) {
|
||||
if (thepid < 0) {
|
||||
statusline(ALERT, _("Could not fork: %s"), strerror(errornumber));
|
||||
return;
|
||||
} else if (!WIFEXITED(program_status) || WEXITSTATUS(program_status) > 2) {
|
||||
statusline(ALERT, _("Error invoking '%s'"), arguments[0]);
|
||||
return NULL;
|
||||
return;
|
||||
} else if (WEXITSTATUS(program_status) != 0)
|
||||
statusline(ALERT, _("Program '%s' complained"), arguments[0]);
|
||||
|
||||
@@ -2146,7 +2155,7 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
|
||||
(long)fileinfo.st_mtim.tv_sec == timestamp_sec &&
|
||||
(long)fileinfo.st_mtim.tv_nsec == timestamp_nsec) {
|
||||
statusbar(_("Nothing changed"));
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -2196,8 +2205,6 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
|
||||
statusbar(_("Finished checking spelling"));
|
||||
else
|
||||
statusbar(_("Buffer has been processed"));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif /* ENABLE_SPELLER || ENABLE_COLOR */
|
||||
|
||||
@@ -2321,8 +2328,8 @@ bool fix_spello(const char *word)
|
||||
/* Run a spell-check on the given file, using 'spell' to produce a list of all
|
||||
* misspelled words, then feeding those through 'sort' and 'uniq' to obtain an
|
||||
* alphabetical list, which words are then offered one by one to the user for
|
||||
* correction. Return NULL when okay, and the error string otherwise. */
|
||||
const char *do_int_speller(const char *tempfile_name)
|
||||
* correction. */
|
||||
void do_int_speller(const char *tempfile_name)
|
||||
{
|
||||
char *misspellings, *pointer, *oneword;
|
||||
long pipesize;
|
||||
@@ -2332,8 +2339,12 @@ const char *do_int_speller(const char *tempfile_name)
|
||||
int spell_status, sort_status, uniq_status;
|
||||
|
||||
/* Create all three pipes up front. */
|
||||
if (pipe(spell_fd) == -1 || pipe(sort_fd) == -1 || pipe(uniq_fd) == -1)
|
||||
return _("Could not create pipe");
|
||||
if (pipe(spell_fd) == -1 || pipe(sort_fd) == -1 || pipe(uniq_fd) == -1) {
|
||||
statusline(ALERT, _("Could not create pipe: %s"), strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
statusbar(_("Invoking spell checker..."));
|
||||
|
||||
/* Fork a process to run spell in. */
|
||||
if ((pid_spell = fork()) == 0) {
|
||||
@@ -2409,16 +2420,18 @@ const char *do_int_speller(const char *tempfile_name)
|
||||
|
||||
/* When some child process was not forked successfully... */
|
||||
if (pid_spell < 0 || pid_sort < 0 || pid_uniq < 0) {
|
||||
statusline(ALERT, _("Could not fork: %s"), strerror(errno));
|
||||
close(uniq_fd[0]);
|
||||
return _("Could not fork");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the system pipe buffer size. */
|
||||
pipesize = fpathconf(uniq_fd[0], _PC_PIPE_BUF);
|
||||
|
||||
if (pipesize < 1) {
|
||||
statusline(ALERT, _("Could not get size of pipe buffer"));
|
||||
close(uniq_fd[0]);
|
||||
return _("Could not get size of pipe buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Leave curses mode so that error messages go to the original screen. */
|
||||
@@ -2484,17 +2497,13 @@ const char *do_int_speller(const char *tempfile_name)
|
||||
waitpid(pid_uniq, &uniq_status, 0);
|
||||
|
||||
if (WIFEXITED(uniq_status) == 0 || WEXITSTATUS(uniq_status))
|
||||
return _("Error invoking \"uniq\"");
|
||||
|
||||
if (WIFEXITED(sort_status) == 0 || WEXITSTATUS(sort_status))
|
||||
return _("Error invoking \"sort\"");
|
||||
|
||||
if (WIFEXITED(spell_status) == 0 || WEXITSTATUS(spell_status))
|
||||
return _("Error invoking \"spell\"");
|
||||
|
||||
/* When all went okay. */
|
||||
statusbar(_("Finished checking spelling"));
|
||||
return NULL;
|
||||
statusline(ALERT, _("Error invoking \"uniq\""));
|
||||
else if (WIFEXITED(sort_status) == 0 || WEXITSTATUS(sort_status))
|
||||
statusline(ALERT, _("Error invoking \"sort\""));
|
||||
else if (WIFEXITED(spell_status) == 0 || WEXITSTATUS(spell_status))
|
||||
statusline(ALERT, _("Error invoking \"spell\""));
|
||||
else
|
||||
statusbar(_("Finished checking spelling"));
|
||||
}
|
||||
|
||||
/* Spell check the current file. If an alternate spell checker is
|
||||
@@ -2504,7 +2513,6 @@ void do_spell(void)
|
||||
FILE *stream;
|
||||
char *temp_name;
|
||||
unsigned stash[sizeof(flags) / sizeof(flags[0])];
|
||||
const char *result_msg;
|
||||
bool okay;
|
||||
|
||||
ran_a_tool = TRUE;
|
||||
@@ -2541,9 +2549,9 @@ void do_spell(void)
|
||||
blank_bottombars();
|
||||
|
||||
if (alt_speller)
|
||||
result_msg = treat(temp_name, alt_speller, TRUE);
|
||||
treat(temp_name, alt_speller, TRUE);
|
||||
else
|
||||
result_msg = do_int_speller(temp_name);
|
||||
do_int_speller(temp_name);
|
||||
|
||||
unlink(temp_name);
|
||||
free(temp_name);
|
||||
@@ -2554,14 +2562,6 @@ void do_spell(void)
|
||||
/* Ensure the help lines will be redrawn and a selection is retained. */
|
||||
currmenu = MMOST;
|
||||
shift_held = TRUE;
|
||||
|
||||
if (result_msg != NULL) {
|
||||
/* Avoid giving a failure reason of "Success". */
|
||||
if (errno == 0)
|
||||
statusline(ALERT, result_msg);
|
||||
else
|
||||
statusline(ALERT, _("%s: %s"), result_msg, strerror(errno));
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_SPELLER */
|
||||
|
||||
@@ -2607,13 +2607,13 @@ void do_linter(void)
|
||||
|
||||
/* Create a pipe up front. */
|
||||
if (pipe(lint_fd) == -1) {
|
||||
statusline(ALERT, _("Could not create pipe"));
|
||||
statusline(ALERT, _("Could not create pipe: %s"), strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
blank_bottombars();
|
||||
currmenu = MLINTER;
|
||||
statusbar(_("Invoking linter, please wait"));
|
||||
statusbar(_("Invoking linter..."));
|
||||
|
||||
construct_argument_list(&lintargs, openfile->syntax->linter, openfile->filename);
|
||||
|
||||
@@ -2640,8 +2640,8 @@ void do_linter(void)
|
||||
|
||||
/* If the child process was not forked successfully... */
|
||||
if (pid_lint < 0) {
|
||||
statusline(ALERT, _("Could not fork: %s"), strerror(errno));
|
||||
close(lint_fd[0]);
|
||||
statusline(ALERT, _("Could not fork"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2649,8 +2649,8 @@ void do_linter(void)
|
||||
pipesize = fpathconf(lint_fd[0], _PC_PIPE_BUF);
|
||||
|
||||
if (pipesize < 1) {
|
||||
close(lint_fd[0]);
|
||||
statusline(ALERT, _("Could not get size of pipe buffer"));
|
||||
close(lint_fd[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2914,7 +2914,6 @@ void do_formatter(void)
|
||||
FILE *stream;
|
||||
char *temp_name;
|
||||
bool okay = FALSE;
|
||||
const char *result_msg;
|
||||
|
||||
ran_a_tool = TRUE;
|
||||
|
||||
@@ -2926,6 +2925,10 @@ void do_formatter(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark = NULL;
|
||||
#endif
|
||||
|
||||
temp_name = safe_tempfile(&stream);
|
||||
|
||||
if (temp_name != NULL)
|
||||
@@ -2937,10 +2940,7 @@ void do_formatter(void)
|
||||
return;
|
||||
}
|
||||
|
||||
result_msg = treat(temp_name, openfile->syntax->formatter, FALSE);
|
||||
|
||||
if (result_msg != NULL)
|
||||
statusline(ALERT, result_msg);
|
||||
treat(temp_name, openfile->syntax->formatter, FALSE);
|
||||
|
||||
unlink(temp_name);
|
||||
free(temp_name);
|
||||
@@ -3006,8 +3006,8 @@ void do_wordlinechar_count(void)
|
||||
/* Get verbatim input. */
|
||||
void do_verbatim_input(void)
|
||||
{
|
||||
size_t count = 1;
|
||||
char *bytes;
|
||||
size_t count;
|
||||
|
||||
/* TRANSLATORS: Shown when the next keystroke will be inserted verbatim. */
|
||||
statusbar(_("Verbatim Input"));
|
||||
@@ -3022,7 +3022,9 @@ void do_verbatim_input(void)
|
||||
if (ISSET(CONSTANT_SHOW))
|
||||
lastmessage = VACUUM;
|
||||
|
||||
inject(bytes, count);
|
||||
if (count < 999)
|
||||
inject(bytes, count);
|
||||
|
||||
wipe_statusbar();
|
||||
} else
|
||||
/* TRANSLATORS: An invalid verbatim Unicode code was typed. */
|
||||
|
||||
@@ -330,7 +330,7 @@ char *measured_copy(const char *string, size_t count)
|
||||
{
|
||||
char *thecopy = charalloc(count + 1);
|
||||
|
||||
strncpy(thecopy, string, count);
|
||||
memcpy(thecopy, string, count);
|
||||
thecopy[count] = '\0';
|
||||
|
||||
return thecopy;
|
||||
@@ -431,6 +431,9 @@ void new_magicline(void)
|
||||
openfile->filebot->next = make_new_node(openfile->filebot);
|
||||
openfile->filebot->next->data = copy_of("");
|
||||
openfile->filebot = openfile->filebot->next;
|
||||
#ifndef NANO_TINY
|
||||
openfile->filebot->extrarows = 0;
|
||||
#endif
|
||||
openfile->totsize++;
|
||||
}
|
||||
|
||||
|
||||
1444
src/winio.c
1444
src/winio.c
File diff suppressed because it is too large
Load Diff
@@ -3,9 +3,18 @@
|
||||
syntax css "\.css$"
|
||||
comment "/*|*/"
|
||||
|
||||
# First make everything red:
|
||||
color brightred "."
|
||||
# Then everything between braces yellow:
|
||||
color brightyellow start="\{" end="\}"
|
||||
color brightwhite start=":" end="([;^\{]|$)"
|
||||
color brightblue ":active|:focus|:hover|:link|:visited|:link|:after|:before"
|
||||
# Then everything after a colon white:
|
||||
color brightwhite start=":" end="([;^{]|$)"
|
||||
|
||||
# Pseudo-classes:
|
||||
color brightcyan ":(active|checked|focus|hover|link|visited|after|before)\>"
|
||||
|
||||
# Comments:
|
||||
color brightblue start="/\*" end="\*/"
|
||||
|
||||
# Syntactic characters:
|
||||
color green ";|:|\{|\}"
|
||||
|
||||
@@ -11,7 +11,7 @@ color cyan "^[[:space:]]*#.*"
|
||||
color ,red " + +"
|
||||
|
||||
# Nano's name, including version.
|
||||
color brightred "(GNU )?[Nn]ano [1-4]\.[0-9][-.[:alnum:]]*\>"
|
||||
color brightred "(GNU )?[Nn]ano [1-5]\.[0-9][-.[:alnum:]]*\>"
|
||||
|
||||
# Email addresses.
|
||||
color magenta "<[[:alnum:].%_+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,}>"
|
||||
|
||||
@@ -11,8 +11,8 @@ color brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure
|
||||
color yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|stripe|title)color)[[:space:]]+(bold,)?(italic,)?(bright|light)?(white|black|red|blue|green|yellow|magenta|cyan|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte)?(,(light)?(white|black|red|blue|green|yellow|magenta|cyan|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte))?\>"
|
||||
color brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|stripecolor|titlecolor|whitespace|wordchars)[[:space:]]+"
|
||||
color brightgreen "^[[:space:]]*set[[:space:]]+(fill[[:space:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:space:]]+[1-9][0-9]*)\>"
|
||||
color brightgreen "^[[:space:]]*bind[[:space:]]+((\^([A-Za-z]|[]/@\^_`]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+([a-z]+|".*")[[:space:]]+(main|help|search|replace(with)?|yesno|gotoline|writeout|insert|browser|whereisfile|gotodir|execute|spell|linter|all)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([A-Za-z]|[]/@\^_`]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*bind[[:space:]]+((\^([A-Za-z]|[]/@\^_`]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([][!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+([a-z]+|".*")[[:space:]]+(main|help|search|replace(with)?|yesno|gotoline|writeout|insert|browser|whereisfile|gotodir|execute|spell|linter|all)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([A-Za-z]|[]/@\^_`]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([][!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|formatter|linter|tabgives)[[:space:]]+.*"
|
||||
color brightgreen "^[[:space:]]*(syntax[[:space:]]+[^[:blank:]]+|(formatter|linter)[[:space:]]+.+)"
|
||||
color green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|formatter|linter|tabgives|extendsyntax)\>"
|
||||
|
||||
Reference in New Issue
Block a user