Compare commits

...

72 Commits

Author SHA1 Message Date
Benno Schulenberg
78dc7b8f0a po: update translations and regenerate POT file and PO files 2018-06-02 10:26:36 +02:00
Benno Schulenberg
1057ca7a16 bump version numbers and add a news item for the 2.9.8 release 2018-06-02 09:51:16 +02:00
Benno Schulenberg
5550d15418 tweaks: improve a couple of comments, and reshuffle a group of lines 2018-06-01 16:56:56 +02:00
Benno Schulenberg
54cab02030 docs: improve the description of --nonewlines, and properly sort it 2018-06-01 15:54:08 +02:00
Benno Schulenberg
2633114b8e docs: add a missing double quote in the default brackets string
It was accidentally lost three years ago, in commit 7e1bc82d.

Also improve the description of this option in the other documents.
2018-06-01 15:53:57 +02:00
Benno Schulenberg
2e1e157967 copyright: update the years for significantly changed files 2018-06-01 10:18:32 +02:00
Benno Schulenberg
6df30a634e docs: register Marco as the author of the filtering feature
The macro stuff, however, is basically my code: I told him exactly
how to do it, and I changed most of the patch before applying it.

Also, put myself in second place, as I've just about overtaken David
in the duration of maintainership.
2018-06-01 10:00:08 +02:00
Benno Schulenberg
856322b01e main: interpret only a double slash (//) as quoting, not a single one
Otherwise the first line of a multiline /*...*/-comment would be
seen as quoted and thus *not* as the first line of a paragraph.

In the code, use "/{2}" to prevent the remainder of the line
getting colored as a comment.
2018-06-01 09:21:03 +02:00
Benno Schulenberg
ad5d0f7530 wrapping: use "smart" autoindenting only when hard-wrapping is enabled
The paragraph-aware indenting is needed only when automatic long-line
wrapping is on (that is, when not using 'nowrap': when writing prose).
When writing code, the user most likely uses --nowrap, which will make
nano indent a new line always to the same amount as the preceding line
-- when --autoindent is in effect, of course.
2018-06-01 08:45:25 +02:00
Benno Schulenberg
0f2b0ffbd3 tweaks: reshuffle a condition, and adjust a comment and some indentation 2018-05-31 16:27:13 +02:00
Benno Schulenberg
f2f901c895 files: give feedback during writeout also when prepending or appending
The only time that feedback about the number of lines written is *not*
wanted is when writing a temporary file.

This fixes https://savannah.gnu.org/bugs/?54025.
2018-05-31 16:08:16 +02:00
Benno Schulenberg
a4e353799b docs: make quotes around regexes bold, as they are part of the command 2018-05-31 12:07:12 +02:00
Benno Schulenberg
64f28515fd docs: remove quotes around the name of a syntax -- they are not needed 2018-05-31 11:25:21 +02:00
Benno Schulenberg
b84dea9898 docs: improve description of 'speller' and related bindable functions 2018-05-30 20:38:27 +02:00
Benno Schulenberg
8492de53f7 syntax: makefile: color all keywords that GNU make recognizes
Plus one that automake recognizes: if.  Color them only at the start
of a line.  Also color all possible assignment sequences (surrounded
by spaces to not color the ones in shell fragments), and add some
comments.
2018-05-30 11:29:08 +02:00
Benno Schulenberg
a1dc1376be docs: describe what constitutes a paragraph
Also fix a typo.
2018-05-30 10:32:26 +02:00
Benno Schulenberg
6fe132194c docs: improve the description of the --autoindent option 2018-05-30 10:29:31 +02:00
Benno Schulenberg
0ea434b006 tweaks: reduce the abundance of the word 'toggle' in the Info manual 2018-05-30 10:01:45 +02:00
Benno Schulenberg
d430934f09 gnulib: update to its current upstream state 2018-05-29 11:08:55 +02:00
Benno Schulenberg
dc3261b685 tweaks: avoid a warning with --enable-{tiny,help,multibuffer}
This also places the Pipe toggle among the other, similar togglles,
which makes more sense.
2018-05-29 09:07:39 +02:00
David Lawrence Ramsey
dc4146f077 tweaks: avoid an unused variable warning with --enable-tiny
This fixes https://savannah.gnu.org/bugs/?53998.
2018-05-29 09:00:08 +02:00
Benno Schulenberg
59eb01b403 build: fix compilation with --enable-{tiny,help,multibuffer} 2018-05-28 11:31:30 +02:00
Benno Schulenberg
738487f13d tweaks: make better use of an existing variable 2018-05-28 10:39:47 +02:00
Benno Schulenberg
c8a9a96578 build: fix compilation when configured with --disable-justify 2018-05-28 09:57:24 +02:00
Benno Schulenberg
cd8e932c65 main: add "/" to the quoting regex, to allow justifying //-comments
And adjust the documentation accordingly.
2018-05-27 20:29:52 +02:00
David Lawrence Ramsey
fce54a724d tweaks: fix some grammar plus a typo in the comments 2018-05-27 20:19:46 +02:00
Benno Schulenberg
4ae1b99c92 docs: mark the filtering of text through an external command as done 2018-05-27 19:33:04 +02:00
Benno Schulenberg
ebdb647450 tweaks: adjust a translator hint 2018-05-27 17:53:36 +02:00
Benno Schulenberg
0c2aac5ff8 tweaks: reshuffle a couple of assignments 2018-05-27 17:45:51 +02:00
Benno Schulenberg
7952d68830 tweaks: frob a couple of comments 2018-05-27 17:27:07 +02:00
Benno Schulenberg
5cb4485fa5 tweaks: remove a superfluous assignment -- the lead length never changes 2018-05-27 17:16:04 +02:00
Benno Schulenberg
d7c1ab8e80 tweaks: rename two variables, to better fit their tasks 2018-05-27 17:11:18 +02:00
Benno Schulenberg
1881db099d tweaks: make better use of an intermediate variable 2018-05-27 16:41:55 +02:00
Benno Schulenberg
36c83d92dd tweaks: stop decreasing both the iterator and the limit of a loop 2018-05-27 16:34:20 +02:00
Benno Schulenberg
9021725d53 justification: limit the amount of recursion to prevent a stack overflow 2018-05-27 16:09:53 +02:00
Benno Schulenberg
d00ab406bc wrapping: when autoindenting, use indentation of next line as example
When doing autoindentation, and the next line is not the start of
a new paragraph, then use the indentation of that line for the new
line, as it is more likely to have the desired indentation -- the
current line might be the start of the paragraph and thus could
have a deviant indentation.
2018-05-27 16:09:53 +02:00
Benno Schulenberg
d63d79b067 tweaks: elide another function that is called just once 2018-05-27 16:09:53 +02:00
Benno Schulenberg
446c7d5fff tweaks: elide a function that is called just once 2018-05-27 16:09:53 +02:00
Benno Schulenberg
52efac535b tweaks: rename a variable, to give it some meaning 2018-05-27 16:09:53 +02:00
Benno Schulenberg
45c36f93e5 tweaks: simplify the determining of the prefix for justified lines 2018-05-27 16:09:53 +02:00
Benno Schulenberg
432a7d7729 justification: find the beginning of a paragraph in a better way
Any line whose indentation differs from that of a pair of adjacent lines
is the beginning of a paragraph, also when its indentation is smaller.

This fulfills https://savannah.gnu.org/bugs/?53932,
and fixes point 2) of https://savannah.gnu.org/bugs/?53933.
2018-05-27 16:09:53 +02:00
Benno Schulenberg
d7fe5a7db3 justification: recognize indented paragraphs also without --autoindent
Pico does not require any option to do this, so nano should neither.

This fixes point 1) of https://savannah.gnu.org/bugs/?53933.
2018-05-27 16:09:53 +02:00
David Lawrence Ramsey
a6c0212158 bindings: add the "flippipe" bindable function
So the toggle for piping to an external command can be rebound.

This fixes https://savannah.gnu.org/bugs/?53987.
2018-05-27 10:36:33 +02:00
Benno Schulenberg
a832f33291 justification: when leading whitespace exceeds fill width, wrap anyway
Pico wraps at the last blank character before or on the target column;
if there is no such blank, then it will wrap at the first blank *after*
the target column -- when it can wrap, it will wrap.  Nano should do
the same (and judging from the comments, it intended to do the same),
instead of turning the paragraph into a single unwrapped line.

This fixes https://savannah.gnu.org/bugs/?53986.
2018-05-27 10:24:02 +02:00
Benno Schulenberg
b9f533a69e tweaks: rename a function, for more aptness and extra contrast 2018-05-25 20:09:24 +02:00
Benno Schulenberg
ac31669ec3 linter: don't try to access absent stat info, as that gives a crash
This fixes https://savannah.gnu.org/bugs/?53981.
2018-05-25 19:25:11 +02:00
Benno Schulenberg
86c08560ad linter: make sure that the margin is updated before displaying a buffer
This fixes https://savannah.gnu.org/bugs/?53977.
Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2018-05-25 17:58:25 +02:00
Benno Schulenberg
119a6f0de3 rcfile: don't crash when a bind to a string lacks the closing quote
This fixes https://savannah.gnu.org/bugs/?53972.
Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2018-05-25 13:15:52 +02:00
Benno Schulenberg
3757683e3f build: fix compilation when configured with --disable-multibuffer 2018-05-24 21:09:14 +02:00
Benno Schulenberg
c07586d9f3 tweaks: condense some repetitious comments, and check before assigning
Check that the option argument is okay (contains no blank characters),
before assigning it to the relevant variable.
2018-05-24 20:49:29 +02:00
Benno Schulenberg
3e9ef3032f tweaks: use a more meaningful variable name, and avoid a distant 'else'
Also, indent a continuation line better.
2018-05-24 19:40:52 +02:00
Benno Schulenberg
6fb1509817 tweaks: condense two statements into one, and elide a 'break' 2018-05-24 18:17:58 +02:00
Benno Schulenberg
07ddf25cc0 tweaks: exclude an unneeded 'if' from the single-buffer version 2018-05-24 18:14:35 +02:00
Marco Diego Aurélio Mesquita
73d397c64b linter: check all open buffers, instead of just the next one
First step to the next buffer, and then iterate until we either
find a match or are back at the buffer where we started.

This fixes https://savannah.gnu.org/bugs/?53970.

Signed-off-by: Marco Diego Aurélio Mesquita <address@hidden>
2018-05-24 18:10:52 +02:00
Benno Schulenberg
e0c7ff2a7e linter: make sure the shortcuts bar will redrawn when exiting early
The two help lines will be redrawn in main() only when the current
menu is not MMAIN.  So, set it to MLINTER as soon as the help lines
are cleared, just before preparing to invoke the linter.

This fixes https://savannah.gnu.org/bugs/?53967.
Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2018-05-24 11:37:14 +02:00
Benno Schulenberg
84f8df2df8 tweaks: avoid an unused-variable warning with --enable-tiny 2018-05-23 12:00:43 +02:00
Benno Schulenberg
408d9b8708 build: fix compilation failure when configured with --enable-tiny 2018-05-23 11:57:55 +02:00
Brand Huntsman
b5427ebb98 tweaks: avoid two unused variable warnings when NLS is disabled
Signed-off-by: Brand Huntsman <alpha@qzx.com>
2018-05-23 11:54:45 +02:00
Cristian Caloghera
22663f8a2e syntax: makefile: recognize also an all-lowercase makefile name
Recognize not just "Makefile" but also "makefile" and "GNUmakefile".
And recognize these only when they are the full filenames, not when
they are the tail part of a longer name.

Signed-off-by: Cristian Caloghera <cristi.caloghera@gmail.com>
2018-05-22 20:41:43 +02:00
Benno Schulenberg
5d02ee64b6 filtering: pair the cut and the insert, so they can be undone together
When executing a command in the current buffer and piping this buffer
(or marked region) to that command, then the cutting of the existing
text and the insertion of the new text should be undone and redone
together, as to the user they appear as a single operation.

With-help-from: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2018-05-22 19:36:21 +02:00
Benno Schulenberg
5ffd8d96ae tweaks: rename a variable, for contrast, and improve two comments 2018-05-22 19:36:21 +02:00
Marco Diego Aurélio Mesquita
f304b9aee1 new feature: allow piping (selected) text to an external command
When executing a command, it is now possible to pipe the entire buffer
(or the marked region, if anything is marked) to the external command.
The output from the command replaces the buffer (or the marked region),
or goes to a new buffer.

This fulfills https://savannah.gnu.org/bugs/?28993,
and fulfills https://savannah.gnu.org/bugs/?53041.

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-05-22 19:36:21 +02:00
Benno Schulenberg
299e710845 docs, usage: make it clear that the argument of --quotestr is a regex
In the past, the argument could be either a regex or a literal string,
so the wording was kind of vague.  But nowadays we can count on having
regex support (through gnulib), so be more precise in the description.
2018-05-22 18:45:58 +02:00
Benno Schulenberg
d9ba6c10d2 tweaks: give some continuation lines a more obvious indentation
Also, put a translator hint in a better place: not in the middle
of a function call.
2018-05-22 18:07:50 +02:00
Benno Schulenberg
03c184d7f2 tweaks: condense a comment, and elide an unneeded 'if' 2018-05-22 18:01:15 +02:00
Benno Schulenberg
4ec19847a3 startup: provide a hint for people unfamiliar with the ^char convention
But give this hint only when nano was started without any file arguments.
2018-05-22 11:53:17 +02:00
Benno Schulenberg
3628863f90 docs: remove mention of the quotestr for when regex support is lacking
Since version 2.8.0, nano will use (wnen needed) the regex routines
from gnulib, so mentioning the quotestr for when regex support is
lacking, has been obsolete and pointless for more than a year.

Also, remove some superfluous backslashes, use a non-breaking space
in the texinfo document, and order the regex consistently.
2018-05-21 20:08:19 +02:00
Benno Schulenberg
9d6621afd0 tweaks: remove two superfluous checks, after making one of them so 2018-05-21 09:44:06 +02:00
Benno Schulenberg
cdd637d69f syntaxes: condense and/or correct some extension regexes 2018-05-18 20:40:08 +02:00
Benno Schulenberg
4d232a4aef tweaks: frob some comments, and rename two parameters to make sense 2018-05-18 13:24:07 +02:00
Benno Schulenberg
455899fe27 credits: sort the names roughly according to amount of influence
And spell-fix a name.
2018-05-16 12:05:40 +02:00
Benno Schulenberg
6aef1fa905 docs: thank Kamil for his bug fixes, and update an email address 2018-05-16 09:57:02 +02:00
68 changed files with 16429 additions and 18532 deletions

11
AUTHORS
View File

@@ -5,6 +5,11 @@ nano editor. Please see the ChangeLog for specific changes by author.
Chris Allegretta <chrisa@asty.org>
* Original program author and long-time maintainer.
Benno Schulenberg <bensberg@telfort.nl>
* An array of small bug fixes, the cut-word and block-jump
routines, text selection by holding Shift, macro recording
and replay, plus some key bindings. Current maintainer.
David Lawrence Ramsey <pooka109@gmail.com>
* Former stable series maintainer. Multiple buffer support,
operating dir (-o) option, bug fixes for display routines,
@@ -60,7 +65,5 @@ Sumedh Pendurkar <sumedh.pendurkar@gmail.com>
Rishabh Dave <rishabhddave@gmail.com>
* Searchable help.
Benno Schulenberg <bensberg@justemail.net>
* An array of small bug fixes, the cut-word and block-jump
routines, text selection by holding Shift, and some extra
key bindings. Current maintainer.
Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
* Filtering text through an external command.

View File

@@ -1,3 +1,88 @@
Changes between v2.9.7 and v2.9.8:
----------------------------------
Benno Schulenberg (64):
build: fix compilation failure when configured with --enable-tiny
build: fix compilation when configured with --disable-justify
build: fix compilation when configured with --disable-multibuffer
build: fix compilation with --enable-{tiny,help,multibuffer}
bump version numbers and add a news item for the 2.9.8 release
copyright: update the years for significantly changed files
credits: sort the names roughly according to amount of influence
docs: add a missing double quote in the default brackets string
docs: describe what constitutes a paragraph
docs: improve description of 'speller' and related bindable functions
docs: improve the description of --nonewlines, and properly sort it
docs: improve the description of the --autoindent option
docs: make quotes around regexes bold, as they are part of the command
docs: mark the filtering of text through an external command as done
docs: register Marco as the author of the filtering feature
docs: remove mention of the quotestr for when regex support is lacking
docs: remove quotes around the name of a syntax -- they are not needed
docs: thank Kamil for his bug fixes, and update an email address
docs, usage: make it clear that the argument of --quotestr is a regex
files: give feedback during writeout also when prepending or appending
filtering: pair the cut and the insert, so they can be undone together
gnulib: update to its current upstream state
justification: find the beginning of a paragraph in a better way
justification: limit the amount of recursion to prevent a stack overflow
justification: recognize indented paragraphs also without --autoindent
justification: when leading whitespace exceeds fill width, wrap anyway
linter: don't try to access absent stat info, as that gives a crash
linter: make sure that the margin is updated before displaying a buffer
linter: make sure the shortcuts bar will redrawn when exiting early
main: add "/" to the quoting regex, to allow justifying //-comments
main: interpret only a double slash (//) as quoting, not a single one
rcfile: don't crash when a bind to a string lacks the closing quote
startup: provide a hint for people unfamiliar with the ^char convention
syntaxes: condense and/or correct some extension regexes
syntax: makefile: color all keywords that GNU make recognizes
tweaks: adjust a translator hint
tweaks: avoid an unused-variable warning with --enable-tiny
tweaks: avoid a warning with --enable-{tiny,help,multibuffer}
tweaks: condense a comment, and elide an unneeded 'if'
tweaks: condense some repetitious comments, and check before assigning
tweaks: condense two statements into one, and elide a 'break'
tweaks: elide a function that is called just once
tweaks: elide another function that is called just once
tweaks: exclude an unneeded 'if' from the single-buffer version
tweaks: frob a couple of comments
tweaks: frob some comments, and rename two parameters to make sense
tweaks: give some continuation lines a more obvious indentation
tweaks: improve a couple of comments, and reshuffle a group of lines
tweaks: make better use of an existing variable
tweaks: make better use of an intermediate variable
tweaks: reduce the abundance of the word 'toggle' in the Info manual
tweaks: remove a superfluous assignment -- the lead length never changes
tweaks: remove two superfluous checks, after making one of them so
tweaks: rename a function, for more aptness and extra contrast
tweaks: rename a variable, for contrast, and improve two comments
tweaks: rename a variable, to give it some meaning
tweaks: rename two variables, to better fit their tasks
tweaks: reshuffle a condition, and adjust a comment and some indentation
tweaks: reshuffle a couple of assignments
tweaks: simplify the determining of the prefix for justified lines
tweaks: stop decreasing both the iterator and the limit of a loop
tweaks: use a more meaningful variable name, and avoid a distant 'else'
wrapping: use "smart" autoindenting only when hard-wrapping is enabled
wrapping: when autoindenting, use indentation of next line as example
Brand Huntsman (1):
tweaks: avoid two unused variable warnings when NLS is disabled
Cristian Caloghera (1):
syntax: makefile: recognize also an all-lowercase makefile name
David Lawrence Ramsey (3):
bindings: add the "flippipe" bindable function
tweaks: avoid an unused variable warning with --enable-tiny
tweaks: fix some grammar plus a typo in the comments
Marco Diego Aurélio Mesquita (2):
linter: check all open buffers, instead of just the next one
new feature: allow piping (selected) text to an external command
Changes between v2.9.6 and v2.9.7:
----------------------------------

View File

@@ -8278,7 +8278,7 @@ nano 0.7.6 - 2000.01.15
having a newline at the end doesn't get read, bugfix in do_replace
with replace all, more/better comments. (Robert Siemborski)
0.7.2 Our first patch accepted into the source! configure fixes
and optimizations (Erik Anderson). Added missing stdarg.h to winio.c.
and optimizations (Erik Andersen). Added missing stdarg.h to winio.c.
Bug fix in update_line for editing long lines. Fixed arguments
being put into the filename when none is specified. Preliminary
+line command argument function.

View File

@@ -2,6 +2,8 @@ Improvements in GNU nano
========================
Since 2.9.0:
- The ability to filter text through an external command.
- Better detection of paragraphs, allowing a less indented beginning.
- Option 'set afterends' for making Ctrl+Right stop at word ends.
- A crash handler that saves changed buffers in case of a crash.
- Addition of the color name "normal", meaning the default color.

9
NEWS
View File

@@ -1,3 +1,12 @@
2018.06.02 - GNU nano 2.9.8 "Espresso" brings the ability to filter the
buffer (or the marked region) through an external command
(^R^X and prefix the command with the pipe symbol, "|"), is
better at detecting and maintaining paragraphs, is able to
justify //-style comments, fixes a crash when the binding
of a key to a string lacks a closing quote, gives feedback
about the number of lines written also when prepending or
appending, and fixes a couple of bugs with the linter.
2018.05.15 - GNU nano 2.9.7 "Hvide Sande" adds the option '--afterends'
for making Ctrl+Right (the nextword function) stop at word
ends instead of beginnings, accepts multibyte letters for

1
THANKS
View File

@@ -87,6 +87,7 @@ Other stuff:
===========
Ben Armstrong <synrg@sanctuary.nslug.ns.ca> Negative -r value idea, code
Thomas Dickey <dickey@herndon4.his.com> Curses help and advice
Kamil Dudka <kdudka@redhat.com> Several small bug fixes
Sven Guckes <guckes@math.fu-berlin.de> Advice and advocacy
Thijs Kinkhorst <thijs@kinkhorst.com> rnano.1 manpage
Jim Knoble <jmknoble@pobox.com> Pico compat for browser

7
TODO
View File

@@ -8,9 +8,6 @@ Somewhat urgent:
- Allow color syntaxes to apply to more than just color, so that we can
e.g. specify a different alternate spell checker depending on which
file type we have open.
- Allow piping marked text to an external command and replacing it with
the command's output -- that is: generalize the spell-check flow.
See also https://savannah.gnu.org/bugs/?28993.
Vague musings:
- Add support for right-to-left text (RTL), through FriBidi?
@@ -21,8 +18,10 @@ Vague musings:
brackets inside comments?
For version 2.9:
- Make undo/redo work also for indenting. [DONE]
- Allow piping (marked) text to an external command and replacing it with
the command's output. That is: implement filtering. [DONE]
- Allow to record and replay a macro: a stored series of keystrokes. [DONE]
- Make undo/redo work also for indenting. [DONE]
For version 2.8:
- Allow text searches in the help viewer. [DONE]

View File

@@ -2,7 +2,7 @@
# Generate configure & friends for GIT users.
gnulib_url="git://git.sv.gnu.org/gnulib.git"
gnulib_hash="214bf852d8dab02bf62900e61facef2c9f48f2f4"
gnulib_hash="90f289f249a266b1afb9c63e182f5d979d17df5f"
modules="
futimens

View File

@@ -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.9.7], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [2.9.8], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.14])

View File

@@ -91,7 +91,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 &quot;establishes a full duplex terminal connection to a remote host&quot;, 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>2.9.7</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.9.8</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%">

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH NANO 1 "version 2.9.7" "May 2018"
.TH NANO 1 "version 2.9.8" "June 2018"
.SH NAME
nano \- Nano's ANOther editor, an enhanced free Pico clone
@@ -106,7 +106,7 @@ should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
.TP
.BR \-L ", " \-\-nonewlines
Don't add newlines to the ends of files.
Don't automatically add a newline when a file does not end with one.
.TP
.BR \-M ", " \-\-trimblanks
Snip trailing whitespace from the wrapped line when automatic
@@ -122,11 +122,11 @@ Use the blank line below the title bar as extra editing space.
For the 200 most recent files, log the last position of the cursor,
and place it at that position again upon reopening such a file.
.TP
.BR "\-Q ""\fIcharacters\fB""" ", " "\-\-quotestr=""" \fIcharacters """
Set the quoting string for justifying. The default is
\fB"^([\ \\t]*[#:>\\|}])+"\fP if extended regular expression support is
available, or \fB">\ "\fP otherwise. Note that \fB\\t\fP stands for a
Tab.
.BR "\-Q ""\fIregex\fB""" ", " "\-\-quotestr=""" \fIregex """
Set the regular expression for matching the quoting part of a line.
This is used when justifying.
The default value is \fB"^([\ \\t]*([#:>|}]|//))+"\fP.
Note that \fB\\t\fP stands for an actual Tab.
.TP
.BR \-R ", " \-\-restricted
Restricted mode: don't read or write to any file not specified on the
@@ -187,8 +187,9 @@ highlighted item. Useful for braille users.
Show a summary of the available command-line options and exit.
.TP
.BR \-i ", " \-\-autoindent
Indent new lines to the previous line's indentation. Useful when
editing source code.
Automatically indent a newly created line to the same number of tabs
and/or spaces as the previous line (or as the next line if the previous
line is the beginning of a paragraph).
.TP
.BR \-k ", " \-\-cutfromcursor
Make the 'Cut Text' command (normally \fB^K\fR) cut from the current cursor

View File

@@ -8,8 +8,8 @@
@smallbook
@set EDITION 0.5
@set VERSION 2.9.7
@set UPDATED May 2018
@set VERSION 2.9.8
@set UPDATED June 2018
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @command{nano}
@subtitle a small and friendly text editor
@subtitle version 2.9.7
@subtitle version 2.9.8
@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 2.9.7.
This manual documents the GNU @command{nano} editor, version 2.9.8.
@menu
* Introduction::
@@ -198,7 +198,7 @@ won't work properly with this option enabled.
@item -L
@itemx --nonewlines
Don't add newlines to the ends of files.
Don't automatically add a newline when a file does not end with one.
@item -M
@itemx --trimblanks
@@ -218,11 +218,10 @@ Use the blank line below the title bar as extra editing space.
For the 200 most recent files, log the last position of the cursor,
and place it at that position again upon reopening such a file.
@item -Q "@var{characters}"
@itemx --quotestr="@var{characters}"
Set the quoting string for justifying. The default value is
@t{"^([ \t]*[|>:@}#])+"} if extended regular expression support
is available, and @t{"> "} otherwise.
@item -Q "@var{regex}"
@itemx --quotestr="@var{regex}"
Set the regular expression for matching the quoting part of a line, used
when justifying. The default value is @t{"^([@w{ }\t]*([#:>|@}]|//))+"}.
Note that @code{\t} stands for a literal Tab character.
@item -R
@@ -299,8 +298,9 @@ Show a summary of command-line options and exit.
@item -i
@itemx --autoindent
Automatically indent new lines to the same number of spaces and tabs as
the previous line.
Automatically indent a newly created line to the same number of tabs
and/or spaces as the previous line (or as the next line if the previous
line is the beginning of a paragraph).
@item -k
@itemx --cutfromcursor
@@ -355,7 +355,7 @@ The default value is @t{-8}. This option conflicts with @option{-w}
@itemx --speller=@var{program}
Use the given program to do spell checking and correcting. By default,
@command{nano} uses the command specified in the @env{SPELL} environment
variable for this. If @env{SPELL} is not set, and @option{--speller} is
variable. If @env{SPELL} is not set, and @option{--speller} is
not specified either, then @command{nano} uses its own interactive spell
corrector, which requires the GNU @command{spell} program to be installed.
@@ -595,59 +595,59 @@ The following global toggles are available:
@table @code
@item Backup Files toggle
@item Backup Files
@kbd{Meta-B} toggles the @option{-B} (@option{--backup}) command-line option.
@item Constant Cursor Position Display toggle
@item Constant Cursor Position Display
@kbd{Meta-C} toggles the @option{-c} (@option{--constantshow}) command-line option.
@item Multiple File Buffers toggle
@item Multiple File Buffers
@kbd{Meta-F} toggles the @option{-F} (@option{--multibuffer}) command-line option.
@item Smart Home Key toggle
@item Smart Home Key
@kbd{Meta-H} toggles the @option{-A} (@option{--smarthome}) command-line option.
@item Auto Indent toggle
@item Auto Indent
@kbd{Meta-I} toggles the @option{-i} (@option{--autoindent}) command-line option.
@item Cut From Cursor To End-of-Line toggle
@item Cut From Cursor To End-of-Line
@kbd{Meta-K} toggles the @option{-k} (@option{--cutfromcursor}) command-line option.
@item Long-Line Wrapping toggle
@item Long-Line Wrapping
@kbd{Meta-L} toggles the @option{-w} (@option{--nowrap}) command-line option.
@item Mouse Support toggle
@item Mouse Support
@kbd{Meta-M} toggles the @option{-m} (@option{--mouse}) command-line option.
@item No Conversion From DOS/Mac Format toggle
@item No Conversion From DOS/Mac Format
@kbd{Meta-N} toggles the @option{-N} (@option{--noconvert}) command-line option.
@item More Space For Editing toggle
@item More Space For Editing
@kbd{Meta-O} toggles the @option{-O} (@option{--morespace}) command-line option.
@item Whitespace Display toggle
@kbd{Meta-P} toggles the whitespace-display mode (@pxref{Whitespace}).
@item Whitespace Display
@kbd{Meta-P} toggles the displaying of whitespace (@pxref{Whitespace}).
@item Tabs To Spaces toggle
@item Tabs To Spaces
@kbd{Meta-Q} toggles the @option{-E} (@option{--tabstospaces}) command-line option.
@item Smooth Scrolling toggle
@item Smooth Scrolling
@kbd{Meta-S} toggles the @option{-S} (@option{--smooth}) command-line option.
@item Expert/No Help toggle
@item Expert/No Help
@kbd{Meta-X} toggles the @option{-x} (@option{--nohelp}) command-line option.
@item Color Syntax Highlighting toggle
@item Color Syntax Highlighting
@kbd{Meta-Y} toggles color syntax highlighting (if your nanorc defines syntaxes
--- @pxref{Syntax Highlighting}).
@item Suspension toggle
@item Suspension
@kbd{Meta-Z} toggles the @option{-z} (@option{--suspend}) command-line option.
@item Line Numbers toggle
@item Line Numbers
@kbd{Meta-#} toggles the @option{-l} (@option{--linenumbers}) command-line option.
@item Soft Wrapping toggle
@item Soft Wrapping
@kbd{Meta-$} toggles the @option{-$} (@option{--softwrap}) command-line option.
@end table
@@ -706,7 +706,9 @@ When soft line wrapping is enabled, make it wrap lines at blank characters
(tabs and spaces) instead of always at the edge of the screen.
@item set autoindent
Use auto-indentation.
Automatically indent a newly created line to the same number of tabs
and/or spaces as the previous line (or as the next line if the previous
line is the beginning of a paragraph).
@item set backup
When saving a file, back up the previous version of it, using the current
@@ -733,7 +735,7 @@ Set the characters treated as closing brackets when justifying
paragraphs. This may not include blank characters. Only closing
punctuation (see @code{set punct}), optionally followed by the specified
closing brackets, can end sentences. The default value is
@t{"')>]@}"}.
@t{""')>]@}"}.
@item set casesensitive
Do case-sensitive searches by default.
@@ -804,13 +806,13 @@ Don't convert files from DOS/Mac format.
@item set nohelp
Don't display the help lists at the bottom of the screen.
@item set nonewlines
When a file does not end with a newline, don't automatically add one.
@item set nopauses
Don't pause between warnings at startup. This means that only
the last one will be visible (when there are multiple ones).
@item set nonewlines
Don't add newlines to the ends of files.
@item set nowrap
Don't hard-wrap text at all. This option conflicts with
@option{fill}; the last one given takes effect.
@@ -846,12 +848,10 @@ keystroke instead of 25. Note that @option{constantshow} overrides this.
@item set quiet
Obsolete option. Recognized but ignored.
@item set quotestr "@var{string}"
@item set quotestr "@var{regex}"
The email-quote string, used to justify email-quoted paragraphs. This
is an extended regular expression if your system supports them,
otherwise a literal string. The default value is
@t{"^([ \\t]*[#:>\\|@}])+"} if you have extended regular expression
support, and @t{"> "} otherwise.
is an extended regular expression. The default value is
@t{"^([@w{ }\t]*([#:>|@}]|//))+"}.
Note that @code{\t} stands for a literal Tab character.
@item set rebinddelete
@@ -958,7 +958,7 @@ via the following commands in a nanorc file:
@table @code
@item syntax "@var{name}" ["@var{fileregex}" @dots{}]
@item syntax @var{name} ["@var{fileregex}" @dots{}]
Start the definition of a syntax with this @var{name}.
All subsequent @code{color} and other such commands
will be added to this syntax, until a new @code{syntax}
@@ -989,12 +989,12 @@ file, to determine whether this syntax should be used for it.
on the system and will be silently ignored otherwise.)
@item linter @var{program} [@var{arg} @dots{}]
Use the given @var{program} to do a syntax check on the current file.
Use the given @var{program} to do a syntax check on the current buffer.
(This overrides the speller function.)
@item formatter @var{program} [@var{arg} @dots{}]
Use the given @var{program} to automatically reformat text ---
useful for a programming language like Go.
Use the given @var{program} to automatically reformat the text in
the current buffer --- useful for a programming language like Go.
(This overrides the speller and linter functions.)
@item comment "@var{string}"
@@ -1161,11 +1161,14 @@ Shows the current cursor position: the line, column, and character positions.
Counts the number of words, lines and characters in the current buffer.
@item speller
Invokes a spell-checking program (or a linting program, if the current
syntax highlighting defines one).
Invokes a spell-checking program (or linting program, or formatter program,
if the active syntax defines such a thing).
@item justify
Justifies the current paragraph.
Justifies the current paragraph. A paragraph is a group of contiguous lines
that, apart from possibly the first line, all have the same indentation. The
beginning of a paragraph is detected by either this lone line with a differing
indentation or by a preceding blank line.
@item fulljustify
Justifies the entire current buffer.
@@ -1315,6 +1318,10 @@ Toggles between searching for text and targeting a line number.
@item flipexecute
Toggles between inserting a file and executing a command.
@item flippipe
When executing a command, toggles whether the current buffer (or marked
region) is piped to the command.
@item flipnewbuffer
Toggles between inserting into the current buffer and into a new
empty buffer.
@@ -1381,7 +1388,9 @@ Toggles syntax highlighting.
Toggles the smartness of the Home key.
@item autoindent
Toggles whether new lines will contain the same amount of whitespace as the preceding line.
Toggles whether a newly created line will contain the same amount of leading
whitespace as the preceding line --- or as the next line if the preceding line
is the beginning of a paragraph.
@item cutfromcursor
Toggles whether cutting text will cut the whole line or just from the current cursor
@@ -1477,7 +1486,7 @@ 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
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

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH NANORC 5 "version 2.9.7" "May 2018"
.TH NANORC 5 "version 2.9.8" "June 2018"
.SH NAME
nanorc \- GNU nano's configuration file
@@ -66,7 +66,9 @@ When soft line wrapping is enabled, make it wrap lines at blank characters
(tabs and spaces) instead of always at the edge of the screen.
.TP
.B set autoindent
Use auto-indentation.
Automatically indent a newly created line to the same number of tabs
and/or spaces as the previous line (or as the next line if the previous
line is the beginning of a paragraph).
.TP
.B set backup
When saving a file, create a backup file by adding a tilde (\fB~\fP) to
@@ -91,7 +93,7 @@ setting the options \fBtitlecolor\fP, \fBstatuscolor\fP, \fBkeycolor\fP,
.B set brackets "\fIstring\fP"
Set the characters treated as closing brackets when justifying
paragraphs. This may not include blank characters. Only closing
punctuation (see \fBpunct\fP), optionally followed by the specified
punctuation (see \fBset punct\fP), optionally followed by the specified
closing brackets, can end sentences. The default value is "\fB"')>]}\fP".
.TP
.B set casesensitive
@@ -161,7 +163,7 @@ Don't convert files from DOS/Mac format.
Don't display the two help lines at the bottom of the screen.
.TP
.B set nonewlines
Don't automatically add a newline to the ends of files.
When a file does not end with a newline, don't automatically add one.
.TP
.B set nopauses
Don't pause between warnings at startup. This means that only
@@ -201,12 +203,10 @@ keystroke instead of 25. The option \fBconstantshow\fR overrides this.
.B set quiet
Obsolete option. Recognized but ignored.
.TP
.B set quotestr "\fIstring\fP"
.B set quotestr "\fIregex\fP"
The email-quote string, used to justify email-quoted paragraphs. This
is an extended regular expression if your system supports them,
otherwise a literal string. The default value is
"\fB^([\ \\t]*[#:>\\|}])+\fP" if you have extended regular expression
support, and "\fB>\ \fP" otherwise. Note that '\\t' stands for a literal
is an extended regular expression. The default value is
"\fB^([\ \\t]*([#:>|}]|//))+\fP". Note that \fB\\t\fR stands for an actual
Tab character.
.TP
.B set rebinddelete
@@ -243,9 +243,9 @@ Use smooth scrolling by default.
.B set softwrap
Enable soft line wrapping for easier viewing of very long lines.
.TP
.B set speller "\fIspellprog\fP"
Use spelling checker \fIspellprog\fP instead of the built-in one, which
calls \fIspell\fP.
.B set speller "\fIprogram\fP"
Use the given \fIprogram\fR to do spell checking and correcting,
instead of the built-in corrector that calls \fBspell\fR.
.TP
.B set statuscolor \fIfgcolor\fR,\fIbgcolor\fR
Specify the color combination to use for the status bar.
@@ -311,7 +311,7 @@ good fit for a small editor like \fBnano\fR.
For each kind of file a separate syntax can be defined
via the following commands:
.TP
.BR syntax " ""\fIname\fR"" [""\fIfileregex\fR"" ...]"
.BI syntax " name \fR[" """" fileregex """ " \fR...]
Start the definition of a syntax with this \fIname\fR.
All subsequent \fBcolor\fR and other such commands
will be added to this syntax, until a new \fBsyntax\fR
@@ -323,17 +323,17 @@ expression \fIfileregex\fR. Or the syntax can be explicitly
activated by using the \fB-Y\fR or \fB\-\-syntax\fR
command-line option followed by the \fIname\fR.
The syntax "\fBdefault\fP" is special: it takes no \fIfileregex\fR,
The syntax \fBdefault\fP is special: it takes no \fIfileregex\fR,
and applies to files that don't match any syntax's regexes.
The syntax "\fBnone\fP" is reserved; specifying it on the command line
The syntax \fBnone\fP is reserved; specifying it on the command line
is the same as not having a syntax at all.
.TP
.BR header " ""\fIregex\fR"" " ...
.BI "header """ regex """ \fR...
If from all defined syntaxes no \fIfileregex\fR matched, then compare
this \fIregex\fR (or regexes) against the first line of the current file,
to determine whether this syntax should be used for it.
.TP
.BR magic " ""\fIregex\fR"" " ...
.BI "magic """ regex """ \fR...
If no \fIfileregex\fR matched and no \fBheader\fR regex matched
either, then compare this \fIregex\fR (or regexes) against the
result of querying the \fBmagic\fP database about the current
@@ -342,16 +342,16 @@ file, to determine whether this syntax should be used for it.
system and will be silently ignored otherwise.)
.TP
.BI linter " program " \fR[ "arg " \fR...]
Use the given \fIprogram\fR to run a syntax check on the current file.
Use the given \fIprogram\fR to run a syntax check on the current buffer.
(This overrides the speller function.)
.TP
.BI formatter " program " \fR[ "arg " \fR...]
Use the given \fIprogram\fR to automatically reformat text --
useful in a programming language like Go.
Use the given \fIprogram\fR to automatically reformat the text in
the current buffer -- useful in a programming language like Go.
(This overrides the speller and linter functions.)
.TP
.BR comment " ""\fIstring\fR"""
Use the given string for commenting and uncommenting lines.
.BI "comment """ string """
Use the given \fIstring\fR for commenting and uncommenting lines.
If the string contains a vertical bar or pipe character (\fB|\fR),
this designates bracket-style comments; for example, "\fB/*|*/\fR" for
CSS files. The characters before the pipe are prepended to the line and the
@@ -361,7 +361,7 @@ for Python files. If empty double quotes are specified, the comment/uncomment
function is disabled; for example, "" for JSON.
The default value is "\fB#\fP".
.TP
.B color \fIfgcolor\fR,\fIbgcolor\fR """\fIregex\fR""" ...
.BI "color " fgcolor , bgcolor " """ regex """ " \fR...
Display all pieces of text that match
the extended regular expression \fIregex\fP with foreground color
\fIfgcolor\fP and background color \fIbgcolor\fP, at least one of which
@@ -372,10 +372,10 @@ foreground. If your terminal supports transparency, not specifying a
\fIbgcolor\fP tells \fBnano\fP to attempt to use a transparent
background.
.TP
.B icolor \fIfgcolor\fR,\fIbgcolor\fR """\fIregex\fR""" ...
.BI "icolor " fgcolor , bgcolor " """ regex """ " \fR...
Same as above, except that the matching is case insensitive.
.TP
.BR color " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIfromrx\fR"" " end= """\fItorx\fR""
.BI "color " fgcolor , bgcolor " start=""" fromrx """ end=""" torx """
Display all pieces of text whose start matches extended regular expression
\fIfromrx\fP and whose end matches extended regular expression \fItorx\fP with
foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
@@ -384,10 +384,10 @@ initial instance of \fIfromrx\fP, all text until the first instance of
\fItorx\fP will be colored. This allows syntax highlighting to span
multiple lines.
.TP
.BR icolor " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIfromrx\fR"" " end= """\fItorx\fR""
.BI "icolor " fgcolor , bgcolor " start=""" fromrx """ end=""" torx """
Same as above, except that the matching is case insensitive.
.TP
.BR include " ""\fIsyntaxfile\fR"""
.BI "include """ syntaxfile """
Read in self-contained color syntaxes from \fIsyntaxfile\fP. Note that
\fIsyntaxfile\fP may contain only the above commands, from \fBsyntax\fP
to \fBicolor\fP.
@@ -510,14 +510,17 @@ Shows the current cursor position: the line, column, and character positions.
Counts the number of words, lines and characters in the current buffer.
.TP
.B speller
Invokes a spell-checking program (or a linting program, if the current
syntax highlighting defines one).
Invokes a spell-checking program (or linting program, or formatter program,
if the active syntax defines such a thing).
.TP
.B linter
A synonym of \fBspeller\fR (for when the speller has not been configured).
.TP
.B justify
Justifies the current paragraph.
Justifies the current paragraph. A paragraph is a group of contiguous lines
that, apart from possibly the first line, all have the same indentation. The
beginning of a paragraph is detected by either this lone line with a differing
indentation or by a preceding blank line.
.TP
.B fulljustify
Justifies the entire current buffer.
@@ -667,6 +670,10 @@ Toggles between searching for text and targeting a line number.
.B flipexecute
Toggles between inserting a file and executing a command.
.TP
.B flippipe
When executing a command, toggles whether the current buffer (or marked
region) is piped to the command.
.TP
.B flipnewbuffer
Toggles between inserting into the current buffer and into a new
empty buffer.
@@ -733,7 +740,9 @@ Toggles syntax highlighting.
Toggles the smartness of the Home key.
.TP
.B autoindent
Toggles whether new lines will contain the same amount of whitespace as the preceding line.
Toggles whether a newly created line will contain the same amount of leading
whitespace as the preceding line -- or as the next line if the preceding line
is the beginning of a paragraph.
.TP
.B cutfromcursor
Toggles whether cutting text will cut the whole line or just from the current cursor

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH RNANO 1 "version 2.9.7" "May 2018"
.TH RNANO 1 "version 2.9.8" "June 2018"
.SH NAME
rnano \- a restricted nano

View File

@@ -23,7 +23,9 @@
## (tabs and spaces) instead of always at the edge of the screen.
# set atblanks
## Use auto-indentation.
## Automatically indent a newly created line to the same number of
## tabs and/or spaces as the preceding line -- or as the next line
## if the preceding line is the beginning of a paragraph.
# set autoindent
## Back up files to the current filename plus a tilde.
@@ -35,10 +37,9 @@
## Use bold text instead of reverse video text.
# set boldtext
## The characters treated as closing brackets when justifying
## paragraphs. They cannot contain blank characters. Only closing
## punctuation, optionally followed by closing brackets, can end
## sentences.
## The characters treated as closing brackets when justifying paragraphs.
## This may not include any blank characters. Only closing punctuation,
## optionally followed by these closing brackets, can end sentences.
# set brackets ""')>]}"
## Do case-sensitive searches by default.
@@ -92,13 +93,13 @@
## Don't display the helpful shortcut lists at the bottom of the screen.
# set nohelp
## Don't automatically add a newline when a file does not end with one.
# set nonewlines
## Don't pause between warnings at startup. Which means that only the
## last one will be readable (when there are multiple ones).
# set nopauses
## Don't add newlines to the ends of files.
# set nonewlines
## Don't wrap text at all.
# set nowrap
@@ -125,12 +126,8 @@
# set quickblank
## The email-quote string, used to justify email-quoted paragraphs.
## This is an extended regular expression if your system supports them,
## otherwise a literal string.
## If you have extended regular expression support, the default is:
# set quotestr "^([ ]*[#:>\|}])+"
## Otherwise:
# set quotestr "> "
## This is an extended regular expression. The default is:
# set quotestr "^([ ]*([#:>|}]|//))+"
## Fix Backspace/Delete confusion problem.
# set rebinddelete

875
po/bg.po

File diff suppressed because it is too large Load Diff

1040
po/ca.po

File diff suppressed because it is too large Load Diff

916
po/cs.po

File diff suppressed because it is too large Load Diff

1056
po/da.po

File diff suppressed because it is too large Load Diff

874
po/de.po

File diff suppressed because it is too large Load Diff

945
po/eo.po

File diff suppressed because it is too large Load Diff

932
po/es.po

File diff suppressed because it is too large Load Diff

1050
po/eu.po

File diff suppressed because it is too large Load Diff

927
po/fi.po

File diff suppressed because it is too large Load Diff

2371
po/fr.po

File diff suppressed because it is too large Load Diff

876
po/ga.po

File diff suppressed because it is too large Load Diff

872
po/gl.po

File diff suppressed because it is too large Load Diff

994
po/hr.po

File diff suppressed because it is too large Load Diff

873
po/hu.po

File diff suppressed because it is too large Load Diff

978
po/id.po

File diff suppressed because it is too large Load Diff

885
po/it.po

File diff suppressed because it is too large Load Diff

910
po/ja.po

File diff suppressed because it is too large Load Diff

872
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

927
po/nb.po

File diff suppressed because it is too large Load Diff

940
po/nl.po

File diff suppressed because it is too large Load Diff

933
po/nn.po

File diff suppressed because it is too large Load Diff

873
po/pl.po

File diff suppressed because it is too large Load Diff

877
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

876
po/ro.po

File diff suppressed because it is too large Load Diff

872
po/ru.po

File diff suppressed because it is too large Load Diff

872
po/sl.po

File diff suppressed because it is too large Load Diff

928
po/sr.po

File diff suppressed because it is too large Load Diff

968
po/sv.po

File diff suppressed because it is too large Load Diff

985
po/tr.po

File diff suppressed because it is too large Load Diff

932
po/uk.po

File diff suppressed because it is too large Load Diff

913
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
* files.c -- This file is part of GNU nano. *
* *
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
* Copyright (C) 2015-2017 Benno Schulenberg *
* Copyright (C) 2015-2018 Benno Schulenberg *
* *
* GNU nano is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
@@ -1109,6 +1109,24 @@ void do_insertfile(void)
answer = chosen;
i = 0;
}
#endif
#ifndef NANO_TINY
if (func == flip_pipe) {
/* Remove or add the pipe character at the answer's head. */
if (answer[0] == '|') {
charmove(answer, answer + 1, strlen(answer) + 1);
if (statusbar_x > 0)
statusbar_x--;
} else {
answer = charealloc(answer, strlen(answer) + 2);
charmove(answer + 1, answer, strlen(answer) + 1);
answer[0] = '|';
statusbar_x++;
}
given = mallocstrcpy(given, answer);
continue;
}
#endif
/* If we don't have a file yet, go back to the prompt. */
if (i != 0 && (!ISSET(MULTIBUFFER) || i != -2))
@@ -1915,16 +1933,16 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
goto cleanup_and_exit;
}
if (method == OVERWRITE && !tmp) {
/* If we must set the filename, and it changed, adjust things. */
if (fullbuffer && strcmp(openfile->filename, realname) != 0) {
/* When having written an entire buffer, update some administrivia. */
if (fullbuffer && method == OVERWRITE && !tmp) {
/* If the filename was changed, check if this means a new syntax. */
if (strcmp(openfile->filename, realname) != 0) {
#ifdef ENABLE_COLOR
const char *oldname, *newname;
oldname = openfile->syntax ? openfile->syntax->name : "";
#endif
openfile->filename = mallocstrcpy(openfile->filename, realname);
#ifdef ENABLE_COLOR
/* See if the applicable syntax has changed. */
color_update();
@@ -1941,29 +1959,27 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
line->multidata = NULL;
line = line->next;
}
precalc_multicolorinfo();
refresh_needed = TRUE;
}
#endif
}
if (fullbuffer) {
#ifndef NANO_TINY
/* Get or update the stat info to reflect the current state. */
stat_with_alloc(realname, &openfile->current_stat);
/* Get or update the stat info to reflect the current state. */
stat_with_alloc(realname, &openfile->current_stat);
/* Record at which point in the undo stack the file was saved. */
openfile->last_saved = openfile->current_undo;
openfile->last_action = OTHER;
/* Record at which point in the undo stack the file was saved. */
openfile->last_saved = openfile->current_undo;
openfile->last_action = OTHER;
#endif
openfile->modified = FALSE;
titlebar(NULL);
}
statusline(HUSH, P_("Wrote %zu line", "Wrote %zu lines",
lineswritten), lineswritten);
openfile->modified = FALSE;
titlebar(NULL);
}
if (!tmp)
statusline(HUSH, P_("Wrote %zu line", "Wrote %zu lines",
lineswritten), lineswritten);
retval = TRUE;
cleanup_and_exit:

View File

@@ -2,7 +2,7 @@
* global.c -- This file is part of GNU nano. *
* *
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
* Copyright (C) 2014-2017 Benno Schulenberg *
* Copyright (C) 2014-2018 Benno Schulenberg *
* *
* GNU nano is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
@@ -152,6 +152,8 @@ char *word_chars = NULL;
char *answer = NULL;
/* The answer string used by the statusbar prompt. */
size_t statusbar_x = HIGHEST_POSITIVE;
/* The cursor position in answer. */
ssize_t tabsize = -1;
/* The width of a tab in spaces. The default is set in main(). */
@@ -311,6 +313,9 @@ void backup_file_void(void)
void flip_execute(void)
{
}
void flip_pipe(void)
{
}
#endif
#ifdef ENABLE_MULTIBUFFER
void flip_newbuffer(void)
@@ -650,6 +655,8 @@ void shortcut_init(void)
const char *prepend_gist = N_("Toggle prepending");
const char *backup_gist = N_("Toggle backing up of the original file");
const char *execute_gist = N_("Execute external command");
const char *pipe_gist =
N_("Pipe the current buffer (or marked region) to the command");
#endif
#ifdef ENABLE_MULTIBUFFER
const char *newbuffer_gist = N_("Toggle the use of a new buffer");
@@ -1034,7 +1041,11 @@ void shortcut_init(void)
add_to_funcs(flip_newbuffer, MINSERTFILE|MEXTCMD,
N_("New Buffer"), WITHORSANS(newbuffer_gist), TOGETHER, NOVIEW);
#endif
#ifndef NANO_TINY
if (!ISSET(RESTRICTED))
add_to_funcs(flip_pipe, MEXTCMD,
N_("Pipe Text"), WITHORSANS(pipe_gist), TOGETHER, NOVIEW);
#endif
#ifdef ENABLE_BROWSER
/* The file browser is only available when not in restricted mode. */
if (!ISSET(RESTRICTED))
@@ -1329,8 +1340,12 @@ void shortcut_init(void)
#endif
#ifdef ENABLE_MULTIBUFFER
/* Only when not in restricted mode, allow multiple buffers. */
if (!ISSET(RESTRICTED))
if (!ISSET(RESTRICTED)) {
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, flip_newbuffer, 0);
#ifndef NANO_TINY
add_to_sclist(MEXTCMD, "M-\\", 0, flip_pipe, 0);
#endif
}
#endif
#ifdef ENABLE_BROWSER
/* Only when not in restricted mode, allow entering the file browser. */
@@ -1638,6 +1653,8 @@ sc *strtosc(const char *input)
s->func = backup_file_void;
else if (!strcasecmp(input, "flipexecute"))
s->func = flip_execute;
else if (!strcasecmp(input, "flippipe"))
s->func = flip_pipe;
#endif
#ifdef ENABLE_MULTIBUFFER
else if (!strcasecmp(input, "flipnewbuffer"))

View File

@@ -2,7 +2,7 @@
* move.c -- This file is part of GNU nano. *
* *
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
* Copyright (C) 2014-2017 Benno Schulenberg *
* Copyright (C) 2014-2018 Benno Schulenberg *
* *
* GNU nano is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
@@ -179,7 +179,7 @@ void do_para_begin(bool update_screen)
if (openfile->current != openfile->fileage)
openfile->current = openfile->current->prev;
while (!begpar(openfile->current))
while (!begpar(openfile->current, 0))
openfile->current = openfile->current->prev;
openfile->current_x = 0;
@@ -204,7 +204,7 @@ void do_para_end(bool update_screen)
while (openfile->current != openfile->filebot &&
inpar(openfile->current->next) &&
!begpar(openfile->current->next)) {
!begpar(openfile->current->next, 0)) {
openfile->current = openfile->current->next;
}
@@ -324,7 +324,9 @@ bool do_next_word(bool after_ends, bool allow_punct, bool update_screen)
bool started_on_word = is_word_mbchar(openfile->current->data +
openfile->current_x, allow_punct);
bool seen_space = !started_on_word;
#ifndef NANO_TINY
bool seen_word = started_on_word;
#endif
/* Move forward until we reach the start of a word. */
while (TRUE) {

View File

@@ -2,7 +2,7 @@
* nano.c -- This file is part of GNU nano. *
* *
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
* Copyright (C) 2014-2017 Benno Schulenberg *
* Copyright (C) 2014-2018 Benno Schulenberg *
* *
* GNU nano is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
@@ -742,9 +742,7 @@ void mouse_init(void)
}
#endif /* ENABLE_MOUSE */
/* Print one usage string to the screen. This cuts down on duplicate
* strings to translate, and leaves out the parts that shouldn't be
* translatable (i.e. the flag names). */
/* Print the usage line for the given option to the screen. */
void print_opt(const char *shortflag, const char *longflag, const char *desc)
{
printf(" %s\t", shortflag);
@@ -757,9 +755,7 @@ void print_opt(const char *shortflag, const char *longflag, const char *desc)
else if (strlenpt(longflag) < 16)
printf("\t");
if (desc != NULL)
printf("%s", _(desc));
printf("\n");
printf("%s\n", _(desc));
}
/* Explain how to properly use nano and its command-line options. */
@@ -773,14 +769,13 @@ void usage(void)
printf(_("When a filename is '-', nano reads data from standard input.\n\n"));
printf(_("Option\t\tGNU long option\t\tMeaning\n"));
#ifndef NANO_TINY
print_opt("-A", "--smarthome",
/* TRANSLATORS: The next forty or so strings are option descriptions
* for the --help output. Try to keep them at most 40 characters. */
N_("Enable smart home key"));
/* TRANSLATORS: The next forty or so strings are option descriptions
* for the --help output. Try to keep them at most 40 characters. */
print_opt("-A", "--smarthome", N_("Enable smart home key"));
if (!ISSET(RESTRICTED)) {
print_opt("-B", "--backup", N_("Save backups of existing files"));
print_opt(_("-C <dir>"), _("--backupdir=<dir>"),
N_("Directory for saving unique backup files"));
N_("Directory for saving unique backup files"));
}
#endif
print_opt("-D", "--boldtext", N_("Use bold instead of reverse video text"));
@@ -790,7 +785,7 @@ void usage(void)
#ifdef ENABLE_MULTIBUFFER
if (!ISSET(RESTRICTED))
print_opt("-F", "--multibuffer",
N_("Read a file into a new buffer by default"));
N_("Read a file into a new buffer by default"));
#endif
#ifndef NANO_TINY
print_opt("-G", "--locking", N_("Use (vim-style) lock files"));
@@ -798,32 +793,33 @@ void usage(void)
#ifdef ENABLE_HISTORIES
if (!ISSET(RESTRICTED))
print_opt("-H", "--historylog",
N_("Log & read search/replace string history"));
N_("Log & read search/replace string history"));
#endif
#ifdef ENABLE_NANORC
if (!ISSET(RESTRICTED))
print_opt("-I", "--ignorercfiles", N_("Don't look at nanorc files"));
#endif
print_opt("-K", "--rebindkeypad",
N_("Fix numeric keypad key confusion problem"));
N_("Fix numeric keypad key confusion problem"));
print_opt("-L", "--nonewlines",
N_("Don't add newlines to the ends of files"));
N_("Don't add newlines to the ends of files"));
#ifdef ENABLED_WRAPORJUSTIFY
print_opt("-M", "--trimblanks",
N_("Trim tail spaces when hard-wrapping"));
N_("Trim tail spaces when hard-wrapping"));
#endif
#ifndef NANO_TINY
print_opt("-N", "--noconvert",
N_("Don't convert files from DOS/Mac format"));
N_("Don't convert files from DOS/Mac format"));
#endif
print_opt("-O", "--morespace", N_("Use one more line for editing"));
#ifdef ENABLE_HISTORIES
if (!ISSET(RESTRICTED))
print_opt("-P", "--positionlog",
N_("Log & read location of cursor position"));
N_("Log & read location of cursor position"));
#endif
#ifdef ENABLE_JUSTIFY
print_opt(_("-Q <str>"), _("--quotestr=<str>"), N_("Quoting string"));
print_opt(_("-Q <regex>"), _("--quotestr=<regex>"),
N_("Regular expression to match quoting"));
#endif
if (!ISSET(RESTRICTED))
print_opt("-R", "--restricted", N_("Restricted mode"));
@@ -831,26 +827,26 @@ void usage(void)
print_opt("-S", "--smooth", N_("Scroll by line instead of half-screen"));
#endif
print_opt(_("-T <#cols>"), _("--tabsize=<#cols>"),
N_("Set width of a tab to #cols columns"));
N_("Set width of a tab to #cols columns"));
print_opt("-U", "--quickblank", N_("Do quick statusbar blanking"));
print_opt("-V", "--version", N_("Print version information and exit"));
#ifndef NANO_TINY
print_opt("-W", "--wordbounds",
N_("Detect word boundaries more accurately"));
N_("Detect word boundaries more accurately"));
print_opt(_("-X <str>"), _("--wordchars=<str>"),
N_("Which other characters are word parts"));
N_("Which other characters are word parts"));
#endif
#ifdef ENABLE_COLOR
if (!ISSET(RESTRICTED))
print_opt(_("-Y <name>"), _("--syntax=<name>"),
N_("Syntax definition to use for coloring"));
N_("Syntax definition to use for coloring"));
#endif
#ifndef NANO_TINY
print_opt("-a", "--atblanks", N_("When soft-wrapping, do it at whitespace"));
#endif
print_opt("-c", "--constantshow", N_("Constantly show cursor position"));
print_opt("-d", "--rebinddelete",
N_("Fix Backspace/Delete confusion problem"));
N_("Fix Backspace/Delete confusion problem"));
#ifdef ENABLE_BROWSER
if (!ISSET(RESTRICTED))
print_opt("-g", "--showcursor", N_("Show cursor in file browser"));
@@ -869,17 +865,17 @@ void usage(void)
print_opt("-n", "--noread", N_("Do not read the file (only write it)"));
#ifdef ENABLE_OPERATINGDIR
print_opt(_("-o <dir>"), _("--operatingdir=<dir>"),
N_("Set operating directory"));
N_("Set operating directory"));
#endif
print_opt("-p", "--preserve", N_("Preserve XON (^Q) and XOFF (^S) keys"));
#ifdef ENABLED_WRAPORJUSTIFY
print_opt(_("-r <#cols>"), _("--fill=<#cols>"),
N_("Set hard-wrapping point at column #cols"));
N_("Set hard-wrapping point at column #cols"));
#endif
#ifdef ENABLE_SPELLER
if (!ISSET(RESTRICTED))
print_opt(_("-s <prog>"), _("--speller=<prog>"),
N_("Enable alternate speller"));
N_("Enable alternate speller"));
#endif
print_opt("-t", "--tempfile", N_("Auto save on exit, don't prompt"));
#ifndef NANO_TINY
@@ -1545,6 +1541,30 @@ int get_keycode(const char *keyname, const int standard)
return standard;
}
#ifdef ENABLE_LINENUMBERS
/* Ensure that the margin can accomodate the buffer's highest line number. */
void confirm_margin(void)
{
int needed_margin = digits(openfile->filebot->lineno) + 1;
/* When not requested or space is too tight, suppress line numbers. */
if (!ISSET(LINE_NUMBERS) || needed_margin > COLS - 4)
needed_margin = 0;
if (needed_margin != margin) {
margin = needed_margin;
editwincols = COLS - margin;
#ifndef NANO_TINY
/* Ensure that firstcolumn is the starting column of its chunk. */
ensure_firstcolumn_is_aligned();
#endif
/* The margin has changed -- schedule a full refresh. */
refresh_needed = TRUE;
}
}
#endif /* ENABLE_LINENUMBERS */
/* Say that an unbound key was struck, and if possible which one. */
void unbound_key(int code)
{
@@ -2444,21 +2464,18 @@ int main(int argc, char **argv)
#endif
#ifdef ENABLE_JUSTIFY
/* If punct wasn't specified, set its default value. */
/* Set the default value for things that weren't specified. */
if (punct == NULL)
punct = mallocstrcpy(NULL, "!.?");
/* If brackets wasn't specified, set its default value. */
if (brackets == NULL)
brackets = mallocstrcpy(NULL, "\"')>]}");
/* If quotestr wasn't specified, set its default value. */
if (quotestr == NULL)
quotestr = mallocstrcpy(NULL, "^([ \t]*[#:>|}])+");
quoterc = regcomp(&quotereg, quotestr, NANO_REG_EXTENDED);
quotestr = mallocstrcpy(NULL, "^([ \t]*([#:>|}]|/{2}))+");
/* Compile the quoting regex, and free it when it's good; otherwise,
* retrieve and store the error message, to be shown when justifying. */
quoterc = regcomp(&quotereg, quotestr, NANO_REG_EXTENDED);
if (quoterc == 0) {
/* We no longer need quotestr, just quotereg. */
free(quotestr);
quotestr = NULL;
} else {
@@ -2642,25 +2659,15 @@ int main(int argc, char **argv)
if (rcfile_with_errors != NULL)
statusline(ALERT, _("Mistakes in '%s'"), rcfile_with_errors);
#ifdef ENABLE_HELP
if (*openfile->filename == '\0' && openfile->totsize == 0 &&
openfile->next == openfile && !ISSET(NO_HELP))
statusbar(_("Welcome to nano. For basic help, type Ctrl+G."));
#endif
while (TRUE) {
#ifdef ENABLE_LINENUMBERS
int needed_margin = digits(openfile->filebot->lineno) + 1;
/* Suppress line numbers when there is not enough room for them. */
if (!ISSET(LINE_NUMBERS) || needed_margin > COLS - 4)
needed_margin = 0;
if (needed_margin != margin) {
margin = needed_margin;
editwincols = COLS - margin;
#ifndef NANO_TINY
/* Ensure that firstcolumn is the starting column of its chunk. */
ensure_firstcolumn_is_aligned();
#endif
/* The margin has changed -- schedule a full refresh. */
refresh_needed = TRUE;
}
confirm_margin();
#endif
if (currmenu != MMAIN)
display_main_list();

View File

@@ -178,7 +178,7 @@ typedef enum {
#ifdef ENABLE_COMMENT
COMMENT, UNCOMMENT, PREFLIGHT,
#endif
CUT, CUT_TO_EOF, PASTE, INSERT, OTHER
CUT, CUT_TO_EOF, PASTE, INSERT, COUPLE_BEGIN, COUPLE_END, OTHER
} undo_type;
/* Structure types. */

View File

@@ -2,7 +2,7 @@
* prompt.c -- This file is part of GNU nano. *
* *
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
* Copyright (C) 2016 Benno Schulenberg *
* Copyright (C) 2016, 2018 Benno Schulenberg *
* *
* GNU nano is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
@@ -25,8 +25,6 @@
static char *prompt = NULL;
/* The prompt string used for statusbar questions. */
static size_t statusbar_x = HIGHEST_POSITIVE;
/* The cursor position in answer. */
#ifdef ENABLE_MOUSE
/* Handle a mouse click on the statusbar prompt or the shortcut list. */
@@ -678,8 +676,11 @@ int do_yesno_prompt(bool all, const char *msg)
const char *allstr = _("Aa");
while (response == -2) {
#ifdef ENABLE_NLS
char letter[MAXCHARLEN + 1];
int kbinput, index = 0;
int index = 0;
#endif
int kbinput;
if (!ISSET(NO_HELP)) {
char shortstr[MAXCHARLEN + 2];

View File

@@ -124,6 +124,7 @@ extern char *quoteerr;
extern char *word_chars;
extern char *answer;
extern size_t statusbar_x;
extern ssize_t tabsize;
@@ -441,6 +442,9 @@ void enable_signals(void);
void disable_flow_control(void);
void enable_flow_control(void);
void terminal_init(void);
#ifdef ENABLE_LINENUMBERS
void confirm_margin(void);
#endif
void unbound_key(int code);
bool okay_for_view(const sc *shortcut);
int do_input(bool allow_funcs);
@@ -547,7 +551,7 @@ size_t indent_length(const char *line);
#endif
#ifdef ENABLE_JUSTIFY
void justify_format(filestruct *paragraph, size_t skip);
bool begpar(const filestruct *const foo);
bool begpar(const filestruct *const foo, int depth);
bool inpar(const filestruct *const foo);
void do_justify(bool full_justify);
void do_justify_void(void);
@@ -709,6 +713,7 @@ void append_void(void);
void prepend_void(void);
void backup_file_void(void);
void flip_execute(void);
void flip_pipe(void);
#endif
#ifdef ENABLE_MULTIBUFFER
void flip_newbuffer(void);

View File

@@ -3,7 +3,7 @@
* *
* Copyright (C) 2001-2011, 2013-2018 Free Software Foundation, Inc. *
* Copyright (C) 2014 Mike Frysinger *
* Copyright (C) 2014-2017 Benno Schulenberg *
* Copyright (C) 2014-2018 Benno Schulenberg *
* *
* GNU nano is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
@@ -400,7 +400,8 @@ void parse_binding(char *ptr, bool dobind)
if (funcptr[0] == '\0') {
rcfile_error(N_("Must specify a function to bind the key to"));
goto free_things;
}
} else if (ptr == NULL)
goto free_things;
}
menuptr = ptr;
@@ -510,7 +511,7 @@ bool is_good_file(char *file)
if (access(file, R_OK) != 0)
return FALSE;
/* If the thing exists, it may not be a directory nor a device. */
/* If the thing exists, it may be neither a directory nor a device. */
if (stat(file, &rcinfo) != -1 && (S_ISDIR(rcinfo.st_mode) ||
S_ISCHR(rcinfo.st_mode) || S_ISBLK(rcinfo.st_mode))) {
rcfile_error(S_ISDIR(rcinfo.st_mode) ? _("\"%s\" is a directory") :
@@ -1146,19 +1147,17 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
#endif
#ifdef ENABLE_JUSTIFY
if (strcasecmp(rcopts[i].name, "punct") == 0) {
punct = option;
if (has_blank_mbchars(punct)) {
if (has_blank_mbchars(option)) {
rcfile_error(N_("Non-blank characters required"));
free(punct);
punct = NULL;
}
free(option);
} else
punct = option;
} else if (strcasecmp(rcopts[i].name, "brackets") == 0) {
brackets = option;
if (has_blank_mbchars(brackets)) {
if (has_blank_mbchars(option)) {
rcfile_error(N_("Non-blank characters required"));
free(brackets);
brackets = NULL;
}
free(option);
} else
brackets = option;
} else if (strcasecmp(rcopts[i].name, "quotestr") == 0)
quotestr = option;
else

View File

@@ -2,7 +2,7 @@
* search.c -- This file is part of GNU nano. *
* *
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
* Copyright (C) 2015-2017 Benno Schulenberg *
* Copyright (C) 2015-2018 Benno Schulenberg *
* *
* GNU nano is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *

View File

@@ -5,7 +5,8 @@
* Copyright (C) 2014-2015 Mark Majeres *
* Copyright (C) 2016 Mike Scalora *
* Copyright (C) 2016 Sumedh Pendurkar *
* Copyright (C) 2015-2017 Benno Schulenberg *
* Copyright (C) 2018 Marco Diego Aurélio Mesquita *
* Copyright (C) 2015-2018 Benno Schulenberg *
* *
* GNU nano is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
@@ -699,8 +700,8 @@ void do_undo(void)
openfile->current_x = u->begin;
switch (u->type) {
case ADD:
/* TRANSLATORS: The next twelve strings describe actions
* that are undone or redone. It are all nouns, not verbs. */
/* TRANSLATORS: The next thirteen strings describe actions
* that are undone or redone. They are all nouns, not verbs. */
undidmsg = _("text add");
if (u->xflags == WAS_FINAL_LINE && !ISSET(NO_NEWLINES))
remove_magicline();
@@ -800,6 +801,15 @@ void do_undo(void)
cutbuffer = oldcutbuffer;
cutbottom = oldcutbottom;
break;
case COUPLE_BEGIN:
undidmsg = _("filtering");
break;
case COUPLE_END:
openfile->current_undo = openfile->current_undo->next;
do_undo();
do_undo();
do_undo();
return;
case INDENT:
handle_indent_action(u, TRUE, TRUE);
undidmsg = _("indent");
@@ -962,6 +972,15 @@ void do_redo(void)
free_filestruct(u->cutbuffer);
u->cutbuffer = NULL;
break;
case COUPLE_BEGIN:
openfile->current_undo = u;
do_redo();
do_redo();
do_redo();
return;
case COUPLE_END:
redidmsg = _("filtering");
break;
case INDENT:
handle_indent_action(u, FALSE, TRUE);
redidmsg = _("indent");
@@ -1010,27 +1029,34 @@ void do_enter(void)
filestruct *newnode = make_new_node(openfile->current);
size_t extra = 0;
#ifndef NANO_TINY
filestruct *sampleline = openfile->current;
bool allblanks = FALSE;
if (ISSET(AUTOINDENT)) {
extra = indent_length(openfile->current->data);
#ifdef ENABLE_JUSTIFY
/* When doing automatic long-line wrapping and the next line is
* in this same paragraph, use its indentation as the model. */
if (!ISSET(NO_WRAP) && sampleline->next != NULL &&
inpar(sampleline->next) && !begpar(sampleline->next, 0))
sampleline = sampleline->next;
#endif
extra = indent_length(sampleline->data);
/* If we are breaking the line in the indentation, limit the new
* indentation to the current x position. */
/* When breaking in the indentation, limit the automatic one. */
if (extra > openfile->current_x)
extra = openfile->current_x;
else if (extra == openfile->current_x)
allblanks = TRUE;
}
#endif
#endif /* NANO_TINY */
newnode->data = charalloc(strlen(openfile->current->data +
openfile->current_x) + extra + 1);
strcpy(&newnode->data[extra], openfile->current->data +
openfile->current_x);
#ifndef NANO_TINY
if (ISSET(AUTOINDENT)) {
/* Copy the whitespace from the current line to the new one. */
strncpy(newnode->data, openfile->current->data, extra);
/* Copy the whitespace from the sample line to the new one. */
strncpy(newnode->data, sampleline->data, extra);
/* If there were only blanks before the cursor, trim them. */
if (allblanks)
openfile->current_x = 0;
@@ -1052,9 +1078,11 @@ void do_enter(void)
}
#endif
/* Insert the newly created line after the current one and renumber. */
splice_node(openfile->current, newnode);
renumber(newnode);
/* Put the cursor on the new line, after any automatic whitespace. */
openfile->current = newnode;
openfile->current_x = extra;
openfile->placewewant = xplustabs();
@@ -1079,10 +1107,29 @@ RETSIGTYPE cancel_command(int signal)
nperror("kill");
}
/* Execute command in a shell. Return TRUE on success. */
/* Send the text that starts at the given line to file descriptor fd. */
void send_data(const filestruct *line, int fd)
{
FILE *tube = fdopen(fd, "w");
if (tube == NULL)
return;
/* Send each line, except a final empty line. */
while (line != NULL && (line->next != NULL || line->data[0] != '\0')) {
fprintf(tube, "%s%s", line->data, line->next == NULL ? "" : "\n");
line = line->next;
}
fclose(tube);
}
/* Execute the given command in a shell. Return TRUE on success. */
bool execute_command(const char *command)
{
int fd[2];
int from_fd[2], to_fd[2];
/* The pipes through which text will written and read. */
const bool should_pipe = (command[0] == '|');
FILE *stream;
const char *shellenv;
struct sigaction oldaction, newaction;
@@ -1090,8 +1137,9 @@ bool execute_command(const char *command)
bool setup_failed = FALSE;
/* Whether setting up the temporary SIGINT handler failed. */
/* Create a pipe to read the command's output from. */
if (pipe(fd) == -1) {
/* 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)) {
statusbar(_("Could not create pipe"));
return FALSE;
}
@@ -1103,29 +1151,77 @@ bool execute_command(const char *command)
/* Fork a child process to run the command in. */
if ((pid = fork()) == 0) {
/* Child: close the unused read end of the pipe. */
close(fd[0]);
/* Child: close the unused read end of the output pipe. */
close(from_fd[0]);
/* Connect the write end of the pipe to the process' output streams. */
dup2(fd[1], fileno(stdout));
dup2(fd[1], fileno(stderr));
/* Connect the write end of the output pipe to the process' output streams. */
dup2(from_fd[1], fileno(stdout));
dup2(from_fd[1], fileno(stderr));
/* If the parent sends text, connect the read end of the
* feeding pipe to the child's input stream. */
if (should_pipe) {
dup2(to_fd[0], fileno(stdin));
close(to_fd[1]);
}
/* Run the given command inside the preferred shell. */
execl(shellenv, tail(shellenv), "-c", command, NULL);
execl(shellenv, tail(shellenv), "-c", should_pipe ? &command[1] : command, NULL);
/* If the exec call returns, there was an error. */
exit(1);
}
/* Parent: close the unused write end of the pipe. */
close(fd[1]);
close(from_fd[1]);
if (pid == -1) {
statusbar(_("Could not fork"));
close(fd[0]);
close(from_fd[0]);
return FALSE;
}
/* If the command starts with "|", pipe buffer or region to the command. */
if (should_pipe) {
filestruct *was_cutbuffer = cutbuffer;
cutbuffer = NULL;
#ifdef ENABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER)) {
switch_to_prev_buffer();
if (openfile->mark)
do_cut_text(TRUE, FALSE);
} else
#endif
{
add_undo(COUPLE_BEGIN);
if (openfile->mark == NULL) {
openfile->current = openfile->fileage;
openfile->current_x = 0;
}
add_undo(CUT);
do_cut_text(FALSE, openfile->mark == NULL);
update_undo(CUT);
}
if (fork() == 0) {
close(to_fd[0]);
send_data(cutbuffer != NULL ? cutbuffer : openfile->fileage, to_fd[1]);
close(to_fd[1]);
exit(0);
}
close(to_fd[0]);
close(to_fd[1]);
#ifdef ENABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER))
switch_to_next_buffer();
#endif
free_filestruct(cutbuffer);
cutbuffer = was_cutbuffer;
}
/* Re-enable interpretation of the special control keys so that we get
* SIGINT when Ctrl-C is pressed. */
enable_signals();
@@ -1142,12 +1238,15 @@ bool execute_command(const char *command)
}
}
stream = fdopen(fd[0], "rb");
stream = fdopen(from_fd[0], "rb");
if (stream == NULL)
statusline(ALERT, _("Failed to open pipe: %s"), strerror(errno));
else
read_file(stream, 0, "pipe", TRUE);
if (should_pipe && !ISSET(MULTIBUFFER))
add_undo(COUPLE_END);
if (wait(NULL) == -1)
nperror("wait");
@@ -1197,7 +1296,7 @@ void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep)
thefile->last_saved = (undo *)0xbeeb;
}
/* Add a new undo struct to the top of the current pile. */
/* Add a new undo struct of the given type to the top of the current pile. */
void add_undo(undo_type action)
{
undo *u = openfile->current_undo;
@@ -1217,23 +1316,9 @@ void add_undo(undo_type action)
fprintf(stderr, " >> Adding an undo... action = %d\n", action);
#endif
/* Allocate and initialize a new undo type. */
/* Allocate and initialize a new undo item. */
u = (undo *) nmalloc(sizeof(undo));
u->type = action;
#ifdef ENABLE_WRAPPING
if (u->type == SPLIT_BEGIN) {
/* Some action, most likely an ADD, was performed that invoked
* do_wrap(). Rearrange the undo order so that this previous
* action is after the SPLIT_BEGIN undo. */
u->next = openfile->undotop->next;
openfile->undotop->next = u;
} else
#endif
{
u->next = openfile->undotop;
openfile->undotop = u;
openfile->current_undo = u;
}
u->strdata = NULL;
u->cutbuffer = NULL;
u->cutbottom = NULL;
@@ -1245,9 +1330,23 @@ void add_undo(undo_type action)
u->xflags = 0;
u->grouping = NULL;
#ifdef ENABLE_WRAPPING
/* If some action caused automatic long-line wrapping, insert the
* SPLIT_BEGIN item underneath that action's undo item. Otherwise,
* just add the new item to the top of the undo stack. */
if (u->type == SPLIT_BEGIN) {
u->next = openfile->undotop->next;
openfile->undotop->next = u;
} else
#endif
{
u->next = openfile->undotop;
openfile->undotop = u;
openfile->current_undo = u;
}
/* Record the info needed to be able to undo each possible action. */
switch (u->type) {
/* We need to start copying data into the undo buffer
* or we won't be able to restore it later. */
case ADD:
/* If a new magic line will be added, an undo should remove it. */
if (openfile->current == openfile->filebot)
@@ -1263,6 +1362,8 @@ void add_undo(undo_type action)
openfile->current->data[0] != '\0')
u->xflags = WAS_FINAL_BACKSPACE;
case DEL:
/* When not at the end of a line, store the deleted character,
* else purposely fall into the line-joining code. */
if (openfile->current->data[openfile->current_x] != '\0') {
char *char_buf = charalloc(MAXCHARLEN + 1);
int char_len = parse_mbchar(&openfile->current->data[u->begin],
@@ -1273,7 +1374,6 @@ void add_undo(undo_type action)
u->mark_begin_x += char_len;
break;
}
/* Else purposely fall into the line-joining code. */
case JOIN:
if (openfile->current->next) {
if (u->type == BACK) {
@@ -1314,6 +1414,8 @@ void add_undo(undo_type action)
u->lineno += cutbottom->lineno - cutbuffer->lineno;
break;
case INSERT:
case COUPLE_BEGIN:
case COUPLE_END:
break;
case INDENT:
case UNINDENT:
@@ -1474,6 +1576,8 @@ fprintf(stderr, " >> Updating an undo... action = %d\n", action);
case INSERT:
u->mark_begin_lineno = openfile->current->lineno;
u->mark_begin_x = openfile->current_x;
case COUPLE_BEGIN:
case COUPLE_END:
break;
default:
statusline(ALERT, "Wrong undo update type -- please report a bug");
@@ -1645,7 +1749,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
/* The length of the current character, in bytes. */
/* Find the last blank that does not overshoot the target column. */
while (*line != '\0' && column <= goal) {
while (*line != '\0' && ((ssize_t)column <= goal)) {
if (is_blank_mbchar(line) || (snap_at_nl && *line == '\n')) {
lastblank = index;
@@ -1659,7 +1763,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
}
/* If the whole line displays shorter than goal, we're done. */
if (column <= goal)
if ((ssize_t)column <= goal)
return index;
#ifdef ENABLE_HELP
@@ -1883,92 +1987,58 @@ size_t quote_length(const char *line)
return matches.rm_eo;
}
/* a_line and b_line are lines of text. The quotation part of a_line is
* the first a_quote characters. Check that the quotation part of
* b_line is the same. */
bool quotes_match(const char *a_line, size_t a_quote, const char *b_line)
/* The maximum depth of recursion. This must be an even number. */
#define RECURSION_LIMIT 222
/* Return TRUE when the given line is the beginning of a paragraph (BOP). */
bool begpar(const filestruct *const line, int depth)
{
return (a_quote == quote_length(b_line) &&
strncmp(a_line, b_line, a_quote) == 0);
}
size_t quote_len, indent_len, prev_dent_len;
/* We assume a_line and b_line have no quote part. Then, we return
* whether b_line could follow a_line in a paragraph. */
bool indents_match(const char *a_line, size_t a_indent, const char
*b_line, size_t b_indent)
{
return (b_indent <= a_indent && strncmp(a_line, b_line, b_indent) == 0);
}
/* Is foo the beginning of a paragraph?
*
* A line of text consists of a "quote part", followed by an
* "indentation part", followed by text. The functions quote_length()
* and indent_length() calculate these parts.
*
* A line is "part of a paragraph" if it has a part not in the quote
* part or the indentation.
*
* A line is "the beginning of a paragraph" if it is part of a
* paragraph and
* 1) it is the top line of the file, or
* 2) the line above it is not part of a paragraph, or
* 3) the line above it does not have precisely the same quote
* part, or
* 4) the indentation of this line is not an initial substring of
* the indentation of the previous line, or
* 5) this line has no quote part and some indentation, and
* autoindent isn't turned on.
* The reason for number 5) is that if autoindent isn't turned on,
* then an indented line is expected to start a paragraph, as in
* books. Thus, nano can justify an indented paragraph only if
* autoindent is turned on. */
bool begpar(const filestruct *const foo)
{
size_t quote_len, indent_len, temp_id_len;
if (foo == NULL)
return FALSE;
/* Case 1). */
if (foo == openfile->fileage)
/* If this is the very first line of the buffer, it counts as a BOP
* even when it contains no text. */
if (line == openfile->fileage)
return TRUE;
quote_len = quote_length(foo->data);
indent_len = indent_length(foo->data + quote_len);
/* Not part of a paragraph. */
if (foo->data[quote_len + indent_len] == '\0')
/* If recursion is going too deep, just say it's not a BOP. */
if (depth > RECURSION_LIMIT)
return FALSE;
/* Case 3). */
if (!quotes_match(foo->data, quote_len, foo->prev->data))
quote_len = quote_length(line->data);
indent_len = indent_length(line->data + quote_len);
/* If this line contains no text, it is not a BOP. */
if (line->data[quote_len + indent_len] == '\0')
return FALSE;
/* If the quote part of the preceding line differs, this is a BOP. */
if (quote_len != quote_length(line->prev->data) ||
strncmp(line->data, line->prev->data, quote_len) != 0)
return TRUE;
temp_id_len = indent_length(foo->prev->data + quote_len);
prev_dent_len = indent_length(line->prev->data + quote_len);
/* Case 2) or 5) or 4). */
if (foo->prev->data[quote_len + temp_id_len] == '\0' ||
(quote_len == 0 && indent_len > 0 && !ISSET(AUTOINDENT)) ||
!indents_match(foo->prev->data + quote_len, temp_id_len,
foo->data + quote_len, indent_len))
/* If the preceding line contains no text, this is a BOP. */
if (line->prev->data[quote_len + prev_dent_len] == '\0')
return TRUE;
return FALSE;
/* If the indentation of the preceding line equals the indentation
* of this line, this is not a BOP. */
if (prev_dent_len == indent_len && strncmp(line->prev->data + quote_len,
line->data + quote_len, indent_len) == 0)
return FALSE;
/* Otherwise, this is a BOP if the preceding line is not. */
return !begpar(line->prev, depth + 1);
}
/* Is foo inside a paragraph? */
bool inpar(const filestruct *const foo)
/* Return TRUE when the given line is part of a paragraph. */
bool inpar(const filestruct *const line)
{
size_t quote_len;
size_t quote_len = quote_length(line->data);
if (foo == NULL)
return FALSE;
quote_len = quote_length(foo->data);
return (foo->data[quote_len + indent_length(foo->data +
quote_len)] != '\0');
return (line->data[quote_len +
indent_length(line->data + quote_len)] != '\0');
}
/* Move the next par_len lines, starting with first_line, into the
@@ -2045,15 +2115,11 @@ void backup_lines(filestruct *first_line, size_t par_len)
* beginning of the next paragraph if we're not. Afterwards, save the
* quote length and paragraph length in *quote and *par. Return TRUE if
* we found a paragraph, and FALSE if there was an error or we didn't
* find a paragraph.
*
* See the comment at begpar() for more about when a line is the
* beginning of a paragraph. */
* find a paragraph. */
bool find_paragraph(size_t *const quote, size_t *const par)
{
size_t quote_len;
/* Length of the initial quotation of the paragraph we search
* for. */
/* Length of the initial quotation of the paragraph we search for. */
size_t par_len;
/* Number of lines in the paragraph we search for. */
filestruct *current_save;
@@ -2085,7 +2151,7 @@ bool find_paragraph(size_t *const quote, size_t *const par)
* paragraph, in which case we should move back to the last line
* of the next paragraph. */
if (openfile->current_x == 0) {
if (!inpar(openfile->current->prev))
if (!openfile->current->prev || !inpar(openfile->current->prev))
return FALSE;
if (openfile->current != openfile->fileage)
openfile->current = openfile->current->prev;
@@ -2094,7 +2160,7 @@ bool find_paragraph(size_t *const quote, size_t *const par)
/* If the current line isn't the first line of the paragraph, move
* back to the first line of the paragraph. */
if (!begpar(openfile->current))
if (!begpar(openfile->current, 0))
do_para_begin(FALSE);
/* Now current is the first line of the paragraph. Set quote_len to
@@ -2119,8 +2185,8 @@ bool find_paragraph(size_t *const quote, size_t *const par)
return TRUE;
}
/* If full_justify is TRUE, justify the entire file. Otherwise, justify
* the current paragraph. */
/* Justify the current paragraph, and justify the entire file when
* full_justify is TRUE. */
void do_justify(bool full_justify)
{
filestruct *first_par_line = NULL;
@@ -2157,27 +2223,21 @@ void do_justify(bool full_justify)
openfile->current = openfile->fileage;
while (TRUE) {
size_t i;
/* Generic loop variable. */
filestruct *curr_first_par_line;
filestruct *firstline;
/* The first line of the current paragraph. */
filestruct *sampleline;
/* The line from which the indentation is copied -- either
* the first and only or the second line of the paragraph. */
size_t quote_len;
/* Length of the initial quotation of the current paragraph. */
size_t indent_len;
/* Length of the initial indentation of the current paragraph. */
/* Length of the quote part of the current paragraph. */
size_t lead_len;
/* Length of the quote part plus the indentation part. */
size_t par_len;
/* Number of lines in the current paragraph. */
ssize_t break_pos;
/* Where we will break lines. */
char *indent_string;
/* The first indentation that doesn't match the initial
* indentation of the current paragraph. This is put at the
* beginning of every line broken off the first justified
* line of the paragraph. Note that this works because a
* paragraph can only contain two indentations at most: the
* initial one, and a different one starting on a line after
* the first. See the comment at begpar() for more about
* when a line is part of a paragraph. */
char *lead_string;
/* The quote+indent stuff that is copied from the sample line. */
/* Find the first line of the paragraph to be justified. That
* is the start of this paragraph if we're in one, or the start
@@ -2219,74 +2279,45 @@ void do_justify(bool full_justify)
first_par_line = openfile->current;
}
/* Set curr_first_par_line to the first line of the current
* paragraph. */
curr_first_par_line = openfile->current;
/* Remember the first line of the current paragraph. */
firstline = openfile->current;
/* Initialize indent_string to a blank string. */
indent_string = mallocstrcpy(NULL, "");
/* The sample line is either the only line or the second line. */
sampleline = (par_len == 1 ? firstline : firstline->next);
/* Find the first indentation in the paragraph that doesn't
* match the indentation of the first line, and save it in
* indent_string. If all the indentations are the same, save
* the indentation of the first line in indent_string. */
{
const filestruct *indent_line = openfile->current;
bool past_first_line = FALSE;
for (i = 0; i < par_len; i++) {
indent_len = quote_len +
indent_length(indent_line->data + quote_len);
if (indent_len != strlen(indent_string)) {
indent_string = mallocstrncpy(indent_string,
indent_line->data, indent_len + 1);
indent_string[indent_len] = '\0';
if (past_first_line)
break;
}
if (indent_line == openfile->current)
past_first_line = TRUE;
indent_line = indent_line->next;
}
}
/* Copy the leading part (quoting + indentation) of the sample line. */
lead_len = quote_len + indent_length(sampleline->data + quote_len);
lead_string = mallocstrncpy(NULL, sampleline->data, lead_len + 1);
lead_string[lead_len] = '\0';
/* Now tack all the lines of the paragraph together, skipping
* the quoting and indentation on all lines after the first. */
for (i = 0; i < par_len - 1; i++) {
while (par_len > 1) {
filestruct *next_line = openfile->current->next;
size_t line_len = strlen(openfile->current->data);
size_t next_line_len = strlen(openfile->current->next->data);
size_t next_line_len = strlen(next_line->data);
indent_len = quote_len +
indent_length(openfile->current->next->data + quote_len);
next_line_len -= indent_len;
openfile->totsize -= indent_len;
lead_len = quote_len + indent_length(next_line->data + quote_len);
/* We're just about to tack the next line onto this one. If
* this line isn't empty, make sure it ends in a space. */
if (line_len > 0 && openfile->current->data[line_len - 1] != ' ') {
line_len++;
openfile->current->data =
charealloc(openfile->current->data, line_len + 1);
openfile->current->data[line_len - 1] = ' ';
charealloc(openfile->current->data, line_len + 2);
openfile->current->data[line_len++] = ' ';
openfile->current->data[line_len] = '\0';
openfile->totsize++;
}
openfile->current->data = charealloc(openfile->current->data,
line_len + next_line_len + 1);
strcat(openfile->current->data, next_line->data + indent_len);
line_len + next_line_len - lead_len + 1);
strcat(openfile->current->data, next_line->data + lead_len);
#ifndef NANO_TINY
/* If needed, adjust the coordinates of the mark. */
if (openfile->mark == next_line) {
openfile->mark = openfile->current;
openfile->mark_x += line_len - indent_len;
openfile->mark_x += line_len - lead_len;
}
#endif
/* Don't destroy edittop! */
@@ -2294,12 +2325,7 @@ void do_justify(bool full_justify)
openfile->edittop = openfile->current;
unlink_node(next_line);
/* If we've removed the next line, we need to go through
* this line again. */
i--;
openfile->totsize--;
openfile->totsize -= lead_len + 1;
par_len--;
}
@@ -2311,49 +2337,40 @@ void do_justify(bool full_justify)
while (par_len > 0 && strlenpt(openfile->current->data) > fill) {
size_t line_len = strlen(openfile->current->data);
indent_len = strlen(indent_string);
/* If this line is too long, try to wrap it to the next line
* to make it short enough. */
break_pos = break_line(openfile->current->data + indent_len,
fill - strnlenpt(openfile->current->data, indent_len), FALSE);
break_pos = break_line(openfile->current->data + lead_len,
fill - strnlenpt(openfile->current->data, lead_len), FALSE);
/* We can't break the line, or don't need to, so get out. */
if (break_pos == -1 || break_pos + indent_len == line_len)
/* If we can't break the line, or don't need to, we're done. */
if (break_pos == -1 || break_pos + lead_len == line_len)
break;
/* Move forward to the character after the indentation and
* just after the space. */
break_pos += indent_len + 1;
/* Adjust the breaking position for the leading part and
* move it beyond the found whitespace character. */
break_pos += lead_len + 1;
/* If this paragraph is non-quoted, and autoindent isn't
* turned on, set the indentation length to zero so that the
* indentation is treated as part of the line. */
if (quote_len == 0 && !ISSET(AUTOINDENT))
indent_len = 0;
/* Insert a new line after the current one. */
/* Insert a new line after the current one and allocate it. */
splice_node(openfile->current, make_new_node(openfile->current));
openfile->current->next->data = charalloc(lead_len + 1 +
line_len - break_pos);
/* Copy the text after where we're going to break the
* current line to the next line. */
openfile->current->next->data = charalloc(indent_len + 1 +
line_len - break_pos);
strncpy(openfile->current->next->data, indent_string,
indent_len);
strcpy(openfile->current->next->data + indent_len,
openfile->current->data + break_pos);
/* Copy the leading part and the text after the breaking point
* into the next line. */
strncpy(openfile->current->next->data, lead_string, lead_len);
strcpy(openfile->current->next->data + lead_len,
openfile->current->data + break_pos);
openfile->totsize += indent_len + 1;
openfile->totsize += lead_len + 1;
par_len++;
#ifndef NANO_TINY
/* Adjust the mark coordinates to compensate for the change
/* If needed, compensate the mark coordinates for the change
* in the current line. */
if (openfile->mark == openfile->current &&
openfile->mark_x > break_pos) {
openfile->mark = openfile->current->next;
openfile->mark_x -= break_pos - indent_len;
openfile->mark_x -= break_pos - lead_len;
}
#endif
/* When requested, snip all trailing blanks. */
@@ -2373,7 +2390,7 @@ void do_justify(bool full_justify)
par_len--;
}
free(indent_string);
free(lead_string);
/* Go to the next line, if possible. If there is no next line,
* move to the end of the current line. */
@@ -2384,7 +2401,7 @@ void do_justify(bool full_justify)
/* Renumber the now-justified paragraph, since both refreshing the
* edit window and finding a paragraph need correct line numbers. */
renumber(curr_first_par_line);
renumber(firstline);
/* We've just finished justifying the paragraph. If we're not
* justifying the entire file, break out of the loop.
@@ -3043,6 +3060,7 @@ void do_linter(void)
}
blank_bottombars();
currmenu = MLINTER;
statusbar(_("Invoking linter, please wait"));
construct_argument_list(&lintargs, openfile->syntax->linter, openfile->filename);
@@ -3190,18 +3208,18 @@ void do_linter(void)
struct stat lintfileinfo;
if (stat(curlint->filename, &lintfileinfo) != -1 &&
openfile->current_stat->st_ino != lintfileinfo.st_ino) {
openfilestruct *tmpof = openfile;
(openfile->current_stat == NULL ||
openfile->current_stat->st_ino != lintfileinfo.st_ino)) {
#ifdef ENABLE_MULTIBUFFER
const openfilestruct *started_at = openfile;
#ifdef ENABLE_MULTIBUFFER
while (tmpof != openfile->next) {
if (tmpof->current_stat->st_ino == lintfileinfo.st_ino)
break;
tmpof = tmpof->next;
}
#endif
if (tmpof->current_stat->st_ino != lintfileinfo.st_ino) {
#ifdef ENABLE_MULTIBUFFER
openfile = openfile->next;
while (openfile != started_at && (openfile->current_stat == NULL ||
openfile->current_stat->st_ino != lintfileinfo.st_ino))
openfile = openfile->next;
if (openfile->current_stat == NULL ||
openfile->current_stat->st_ino != lintfileinfo.st_ino) {
char *msg = charalloc(1024 + strlen(curlint->filename));
int i;
@@ -3250,10 +3268,9 @@ void do_linter(void)
}
free(dontwantfile);
}
#ifdef ENABLE_MULTIBUFFER
} else
openfile = tmpof;
}
}
#endif
}
@@ -3261,6 +3278,9 @@ void do_linter(void)
goto_line_posx(curlint->lineno, curlint->colno - 1);
titlebar(NULL);
adjust_viewport(CENTERING);
#ifdef ENABLE_LINENUMBERS
confirm_margin();
#endif
edit_refresh();
statusbar(curlint->msg);
bottombars(MLINTER);

View File

@@ -984,7 +984,7 @@ int convert_sequence(const int *seq, size_t length, int *consumed)
}
break;
#ifndef NANO_TINY
case '9': /* To accomodate iTerm2 in "xterm mode". */
case '9': /* To accommodate iTerm2 in "xterm mode". */
case '3':
switch (seq[4]) {
case 'A': /* Esc [ 1 ; 3 A == Alt-Up on xterm. */
@@ -3503,15 +3503,15 @@ void do_credits(void)
"",
NULL, /* "Brought to you by:" */
"Chris Allegretta",
"Benno Schulenberg",
"David Lawrence Ramsey",
"Jordi Mallach",
"David Benbennick",
"Rocco Corsi",
"Mike Frysinger",
"Adam Rogoyski",
"Rob Siemborski",
"Rocco Corsi",
"David Lawrence Ramsey",
"David Benbennick",
"Mark Majeres",
"Mike Frysinger",
"Benno Schulenberg",
"Ken Tyler",
"Sven Guckes",
"Bill Soudan",

View File

@@ -1,6 +1,6 @@
## Here is an example for C/C++.
syntax c "\.(c(c|pp|xx|\+\+)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$"
syntax c "\.([ch](pp|xx)?|C|cc|c\+\+|H|hh|ii?)$"
magic "^(C|C\+\+) (source|program)"
comment "//"

View File

@@ -1,6 +1,6 @@
## Colouring for Changelogs.
syntax changelog "Change[Ll]og.*"
syntax changelog "Change[Ll]og[^/]*$"
# Author lines.
color green "^(19|20).*$"

View File

@@ -1,6 +1,6 @@
## Here is an example for apt's sources.list.
syntax sources.list "sources\.list(~|\.old|\.save)?$" "sources\.list\.d/.*\.list(~|\.old|\.save)?$"
syntax sources.list "sources\.list(\.d/.*\.list)?(~|\.old|\.save)?$"
comment "#"
# Coloring the deb lines, working from tail to head. First the

View File

@@ -1,6 +1,6 @@
## Here is an example for groff.
syntax groff "\.m[ems]$" "\.rof" "\.tmac$" "^tmac."
syntax groff "(/tmac\.[^/]+$|\.(m[ems]|rof|tmac)$)"
comment ".\""
# The argument of .ds or .nr

View File

@@ -1,14 +1,24 @@
## Here is an example for Makefiles.
syntax makefile "Makefile[^/]*$" "\.(make|mk)$"
syntax makefile "(/((GNU)?m|M)akefile[^/]*$|\.(make|mk)$)"
magic "makefile script"
comment "#"
color red "[:=]"
color magenta "\<(if|ifeq|else|endif)\>"
# Assignments.
color red " (:?:|\+|\?)?= "
# Keywords.
color magenta "^(if|ifn?def|ifn?eq|else|endif|(-|s)?include)\>"
color magenta "^((override +)?(un)?define|endef|(un)?export|private|vpath)\>"
# Variable expansions.
color blue "\$+[{(][a-zA-Z0-9_-]+[})]"
# Targets.
color brightblue "^[^ ]+:"
# Comments.
color green "(^|[[:space:]]+)#.*"
## Trailing whitespace.
# Trailing whitespace.
color ,green "[[:space:]]+$"

View File

@@ -4,7 +4,7 @@
## NOTE: Rules are applied in order: later rules re-colorize matching text.
syntax rust "\.rs"
syntax rust "\.(rlib|rs)$"
comment "//"
# Function definitions

View File

@@ -1,6 +1,6 @@
## Syntax highlighting for RPM spec files.
syntax spec "\.(spec$|spec\.*)"
syntax spec "\.spec(\.[^/]+)?$"
comment "#"
# Main tags.