Compare commits

..

49 Commits

Author SHA1 Message Date
Benno Schulenberg
9fcfee18e8 po: update translations and regenerate POT file and PO files 2018-03-29 10:17:00 +02:00
Benno Schulenberg
27eccbec23 bump version numbers and add a news item for the 2.9.5 release 2018-03-29 09:59:13 +02:00
Benno Schulenberg
0bce5ba4d9 syntax: sh: color options distinctively, and color also long options
Also add some comments, and accept hyphens in function names.
2018-03-29 09:51:39 +02:00
Benno Schulenberg
f9415e347a docs: clarify how the Linux console is deficient: in the arrow keys 2018-03-28 19:34:26 +02:00
Benno Schulenberg
f3c4dadcf6 build: fix compilation with --enable-{tiny,help,multibuffer} 2018-03-28 16:37:47 +02:00
Benno Schulenberg
20d1823d90 syntax: sh: uncolor "tar" when it's part of a filename 2018-03-28 14:04:00 +02:00
Benno Schulenberg
e01bcddf16 docs: document the newly added color name "normal" 2018-03-28 14:03:52 +02:00
Benno Schulenberg
570fb6c606 small addition: understand color name "normal" to mean the default color
This allows a syntax to remove the color from things that were colored
overeagerly by earlier regexes.
2018-03-28 14:03:22 +02:00
Benno Schulenberg
1de3667555 syntax: sh: color also the 'cut', 'head', 'tail', and 'sort' commands 2018-03-27 14:09:38 +02:00
Benno Schulenberg
5726514869 linting: drop messages for other files when configured for one buffer
This fixes https://savannah.gnu.org/bugs/?53445.
2018-03-26 08:56:03 +02:00
Benno Schulenberg
88234c90bc tweaks: adjust the indentation after the previous changes 2018-03-26 08:53:06 +02:00
Benno Schulenberg
02719ec4bf tweaks: fuse two ifs into one 2018-03-26 08:52:51 +02:00
Benno Schulenberg
415bf82690 tweaks: move an 'if' and then remove an unneeded label 2018-03-26 08:52:04 +02:00
Benno Schulenberg
9bce8bfeb3 build: fix compilation when configured with --disable-multibuffer 2018-03-23 19:14:56 +01:00
Benno Schulenberg
2c024a74a9 tweaks: adjust or correct some comments, and rename a function
Also, reshuffle a condition so it takes up less space.
2018-03-23 17:54:06 +01:00
Benno Schulenberg
ab8698df47 tweaks: condense some code, to remove a bit of duplication 2018-03-23 17:14:39 +01:00
Benno Schulenberg
206d89b739 tweaks: revert commit c88a2fd9 -- the extra variable is needed
This variable will be modified by go_forward_chunks(), but the value
of openfile->current itself should be maintained.
2018-03-23 11:31:08 +01:00
Benno Schulenberg
eff2e0e291 help: describe the Scroll-Up and Scroll-Down commands more precisely
An "if possible" would have been nice, but there is no room for that.
2018-03-23 11:10:19 +01:00
Benno Schulenberg
c5e20164c3 tweaks: rewrap and amend some lines in the NEWS file 2018-03-23 11:09:59 +01:00
Benno Schulenberg
0f1f53a441 tweaks: drop a handful of unhelpful asserts 2018-03-23 11:09:56 +01:00
Benno Schulenberg
bf1a080923 build: exclude more things when configured with --disable-multibuffer
This will make the tiny version slightly smaller.
2018-03-23 11:09:37 +01:00
Benno Schulenberg
b7f8d4819b tweaks: frob some comments plus miscellaneous other stuff 2018-03-22 19:54:20 +01:00
Benno Schulenberg
30fc197b66 tweaks: adjust a couple of types, to reduce the number of warnings
This avoids eleven warnings of the kind "comparison between signed
and unsigned integer expressions [-Wsign-compare]".
2018-03-22 19:33:22 +01:00
Benno Schulenberg
c88a2fd9ca tweaks: elide an unneeded and shadowing variable 2018-03-22 15:20:05 +01:00
Benno Schulenberg
b9de5525c4 tweaks: elide a parameter, as it's always the inverse of another 2018-03-22 12:52:28 +01:00
Benno Schulenberg
f4d1ef1c4e tweaks: remove unneeded settings and unsettings of MULTIBUFFER
In the preceding commit, open_buffer() was changed so that it gets
told whether to load into a new buffer or not, so it is no longer
needed to convey this information through a flag.
2018-03-22 12:50:48 +01:00
Benno Schulenberg
dd157f1494 tweaks: change a parameter of open_buffer() and invert its logic 2018-03-22 12:35:50 +01:00
Benno Schulenberg
624918800b tweaks: bundle some settings for a new buffer 2018-03-22 12:27:04 +01:00
Benno Schulenberg
8b8c6bb818 tweaks: factor out the check for 'viewok' into its own function
And also prevent a theoretical crash for restricted prompt functions.
2018-03-20 20:10:08 +01:00
Kamil Dudka
b830a7dd38 input: do not crash if sctofunc() returns NULL
This fixes a regression introduced by commit 54103d8e: a crash that
can be triggered by running 'nano --restrict' and pressing <Insert>.

This addresses https://bugzilla.redhat.com/1558532.
2018-03-20 19:36:55 +01:00
Benno Schulenberg
3e5b0ea5fd files: prevent an infinite loop when reading from standard input fails 2018-03-20 11:25:16 +01:00
Benno Schulenberg
a1132c81a1 files: prevent the undo of reading a file into a new buffer
When the file has just been read, it is in the state that it has
on disk, so there is nothing to undo.

This fixes https://savannah.gnu.org/bugs/?53387.
2018-03-20 11:14:55 +01:00
Liu Hao
0496aed4ab build: fix compilation error when configured with --disable-justify
Signed-off-by: Liu Hao <lh_mouse@126.com>
2018-03-19 13:39:15 +01:00
Benno Schulenberg
373e3b880f scrolling: first move the cursor before pushing current chunk offscreen
When the cursor is on the first or last row of the edit window, and
thus Scroll-Down or Scroll-Up would push it offscreen, first move
the cursor away from the edge row and then scroll.

This fixes https://savannah.gnu.org/bugs/?53376.
2018-03-18 20:06:29 +01:00
David Lawrence Ramsey
7b1f3f4fe7 tweaks: correct several parameter types
This avoids a bunch of warnings when compiled with -pedantic:

	ISO C forbids comparison of ‘void *’ with function pointer
2018-03-18 20:01:25 +01:00
Benno Schulenberg
9517972b58 build: fix compilation again when configured with --enable-tiny 2018-03-18 16:33:21 +01:00
Benno Schulenberg
95989e7dfe selecting: don't cancel a softmark when just scrolling the screen
As, since commit 0e30177d, the scrollup and scrolldown commands
no longer intend to move the cursor, they should not be seen as
movement functions.

Also, it is not guaranteed that functions are ordered in the same
way in the binary as in the source code, so an ordered comparison
of function pointers will not always work.

This fixes https://savannah.gnu.org/bugs/?53333.
2018-03-18 13:55:29 +01:00
Benno Schulenberg
dcda98fb73 tweaks: remove an inconsistent space from two pointer declarations
Reported-by: Brand Huntsman <alpha@qzx.com>
2018-03-17 15:53:22 +01:00
Benno Schulenberg
336fa40055 docs: clarify what the scrollup and scrolldown bindable functions do 2018-03-17 14:27:23 +01:00
Benno Schulenberg
93318b972d tweaks: elide two parameters and thus a pair of wrapper functions
When just scrolling and the cursor does not need to change position
(that is: it is not on the first or last row of the edit window),
then edit_scroll() has handled everything and there is no need to
additionally redraw anything or update 'placewewant'.
2018-03-17 14:07:42 +01:00
Benno Schulenberg
8656f160d7 tweaks: reshuffle some movement code, to reduce the number of conditions
Also, rename a parameter and invert its logic.
2018-03-17 14:02:55 +01:00
Benno Schulenberg
0e30177db7 scrolling: let Scroll-Up/Down keep the cursor in the same text position
Instead of keeping the cursor in the same spot on the screen,
let the cursor move with the text (whenever possible).

This makes these functions behave the same as in Vim and Emacs.
2018-03-17 14:00:00 +01:00
Benno Schulenberg
3089a98169 tweaks: fix a typo and adjust some wording and formatting in the FAQ 2018-03-12 11:43:43 +01:00
Benno Schulenberg
1b704e7c8c tweaks: reduce the font size of the questions in the FAQ
Make them smaller to make them sound less like shouting.
2018-03-12 11:25:03 +01:00
Benno Schulenberg
efb9192ee5 docs: mention in the FAQ that <Shift+Insert> pastes from the clipboard
This kind of addresses https://savannah.gnu.org/bugs/?53310.
2018-03-12 11:21:26 +01:00
Benno Schulenberg
f0734dae3e cut: avoid calling renumber() on what might be NULL
This fixes https://savannah.gnu.org/bugs/?53317.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2018-03-12 10:46:02 +01:00
Benno Schulenberg
e8505b2d3e memory: plug a leak, by actually freeing a discarded undo struct
This fixes https://savannah.gnu.org/bugs/?53269.
Reported-by: Ashish Kunwar <dorkerdevil280@gmail.com>

The leak was mistakenly introduced by commit dc3618a1
-- probably as a leftover of testing things.
2018-03-11 20:16:09 +01:00
Benno Schulenberg
1ebb1da382 tweaks: elide a parameter that is always 1
And adjust the comments accordingly.
2018-03-10 12:43:33 +01:00
Benno Schulenberg
1fb3218a14 help: do not reserve space for line numbers, as they are absent
Help texts are shown without any line numbers, so the full width
of the screen should be used to display the text.

This fixes https://savannah.gnu.org/bugs/?53308.
2018-03-09 12:03:48 +01:00
60 changed files with 11218 additions and 11360 deletions

View File

@@ -1,3 +1,63 @@
Changes between v2.9.4 and v2.9.5:
----------------------------------
Benno Schulenberg (45):
build: exclude more things when configured with --disable-multibuffer
build: fix compilation again when configured with --enable-tiny
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.5 release
cut: avoid calling renumber() on what might be NULL
docs: clarify how the Linux console is deficient: in the arrow keys
docs: clarify what the scrollup and scrolldown bindable functions do
docs: document the newly added color name "normal"
docs: mention in the FAQ that <Shift+Insert> pastes from the clipboard
files: prevent an infinite loop when reading from standard input fails
files: prevent the undo of reading a file into a new buffer
help: describe the Scroll-Up and Scroll-Down commands more precisely
help: do not reserve space for line numbers, as they are absent
linting: drop messages for other files when configured for one buffer
memory: plug a leak, by actually freeing a discarded undo struct
scrolling: first move the cursor before pushing current chunk offscreen
scrolling: let Scroll-Up/Down keep the cursor in the same text position
selecting: don't cancel a softmark when just scrolling the screen
small addition: understand color name "normal" to mean the default color
syntax: sh: color also the 'cut', 'head', 'tail', and 'sort' commands
syntax: sh: color options distinctively, and color also long options
syntax: sh: uncolor "tar" when it's part of a filename
tweaks: adjust a couple of types, to reduce the number of warnings
tweaks: adjust or correct some comments, and rename a function
tweaks: adjust the indentation after the previous changes
tweaks: bundle some settings for a new buffer
tweaks: change a parameter of open_buffer() and invert its logic
tweaks: condense some code, to remove a bit of duplication
tweaks: drop a handful of unhelpful asserts
tweaks: elide an unneeded and shadowing variable
tweaks: elide a parameter, as it's always the inverse of another
tweaks: elide a parameter that is always 1
tweaks: elide two parameters and thus a pair of wrapper functions
tweaks: factor out the check for 'viewok' into its own function
tweaks: fix a typo and adjust some wording and formatting in the FAQ
tweaks: frob some comments plus miscellaneous other stuff
tweaks: fuse two ifs into one
tweaks: move an 'if' and then remove an unneeded label
tweaks: reduce the font size of the questions in the FAQ
tweaks: remove an inconsistent space from two pointer declarations
tweaks: remove unneeded settings and unsettings of MULTIBUFFER
tweaks: reshuffle some movement code, to reduce the number of conditions
tweaks: revert commit c88a2fd9 -- the extra variable is needed
tweaks: rewrap and amend some lines in the NEWS file
David Lawrence Ramsey (1):
tweaks: correct several parameter types
Kamil Dudka (1):
input: do not crash if sctofunc() returns NULL
Liu Hao (1):
build: fix compilation error when configured with --disable-justify
Changes between v2.9.3 and v2.9.4:
----------------------------------

View File

@@ -2,6 +2,7 @@ Improvements in GNU nano
========================
Since 2.9.0:
- Addition of the color name "normal", meaning the default color.
- A key can be bound to a string -- any mix of text and commands.
- Error messages are shown by default in bright white on red.
- <Tab> and <Shift+Tab> can be used to indent/unindent a marked region.

84
NEWS
View File

@@ -1,3 +1,17 @@
2018.03.29 - GNU nano 2.9.5 "Kiša pada" changes the way the Scroll-Up
and Scroll-Down commands work (M-- and M-+): instead of
keeping the cursor in the same screen position they now
keep the cursor in the same text position (if possible).
This version further adds a new color name, "normal",
which gives the default foreground or background color,
which is useful when you want to undo some overzealous
painting by earlier syntax regexes. Bug fixes include:
a segfault when trying to insert a file in restricted
mode, the reading in of a new file being "undoable", a
slight miswrapping of help texts when --linenumbers was
used, and the shell syntax coloring the word "tar" in
file names.
2018.03.08 - GNU nano 2.9.4 "Isabel" allows binding a key to a string
(any piece of text and/or commands), permits customizing
the color of error messages with 'set errorcolor', colors
@@ -192,7 +206,7 @@
option 'set numbercolor'. This release furthermore fixes
some bugs with scrolling in softwrap mode, is more strict
in the parsing of key rebindings, and marks a new buffer
as modified when the output of a command (^R ^X) has been
as modified when the output of a command (^R^X) has been
read into it. Come and check it out!
2016.09.01 - GNU nano 2.7.0 "Suni" adds a new feature: allowing text to
@@ -526,7 +540,7 @@
history. On the features front, nano will now attempt to
retain the proper ownership and permissions when trying
to create a .save file due to receiving a signal. Nano
can also now unbind keys from one or more menus via the
can now also unbind keys from one or more menus via the
'unbind' keyword. Finally, passing --fill or --nowrap on
the command line will now override any related .nanorc
entries. Speak now or forever hold your bugs!
@@ -601,9 +615,9 @@
This release includes a new check for external
modifications when saving a file, some code and
documentation cleanups, and more bug fixes for
the new undo code (but we continue to welcome your bug
reports via the Savannah bug page at
http://savannah.gnu.org/bugs/?func=additem&group=nano.
the new undo code (but we continue to welcome
your bug reports via the Savannah bug page at
http://savannah.gnu.org/bugs/?func=additem&group=nano).
Come get some.
2008.10.03 - GNU nano 2.1.6 was for new features before it was against
@@ -1228,18 +1242,18 @@
with it.
2002.01.05 - GNU nano 1.1.5 is out. The main new feature in this
release is the changed behavior of the keypad. Nano now
does the Right Thing and used keypad() by default. If
you wish to use the keypad arrow keys in certain
terminals, you may use the -K or --keypad flag to use
release is the changed behavior of the keypad. Nano
now does the Right Thing and uses keypad() by default.
If you wish to use the keypad arrow keys in certain
terminals, you may use the -K or --keypad flag to get
the old behavior. Users of other OSes should see better
handling of their non-keypad keys in this release.
Other changes include more Hurd fixes, fixes parsing
the .nanorc, display fixes for the color syntax
highlighting, gettext stabilization and many translation
updates. This is almost like a stable release, much
like in the 0.9.x series when every other release was
the most stable one :) Have fun!
Other changes include more Hurd fixes, fixes parsing the
.nanorc, display fixes for the color syntax highlighting,
gettext stabilization and many translation updates.
This is almost like a stable release, much like in the
0.9.x series when every other release was the most stable
one :) Have fun!
2001.12.11 - GNU nano 1.1.4 is released. This release contains
rudimentary color syntax support (but it's still
@@ -1252,7 +1266,7 @@
2001.10.26 - GNU nano 1.1.3 is released. As far as new features go,
the help system is now available for all functions in
the editor. Also, nano will also now print a message on
the editor. Also, nano will now also print a message on
the status bar when it automatically converts a file
from Mac or DOS format, and trying to load a file that
has already been loaded in multibuffer mode will now
@@ -1382,11 +1396,10 @@
code freeze for nano 1.0. Don't expect (or request) any
new features between now and nano 1.0, only bugfixes,
optimizations and doc/translation updates. For fixes, a
nasty segfault when trying to insert one's home
directory (~), some checks for the NumLock key making
the keypad go awry, window size sanity checks, many
autoconf fixes, and support for the KDE Konsole keypad
layout. Have fun.
nasty segfault when trying to insert one's home directory
(~), some checks for the NumLock key making the keypad go
awry, window size sanity checks, many autoconf fixes, and
support for the KDE Konsole keypad layout. Have fun.
2001.01.07 - Nano 0.9.25 is the "Just one more feature I swear!"
release. It includes one new feature that Pico has had
@@ -1397,13 +1410,13 @@
for crashes when tab completion in certain instances.
Have fun and Happy New Year!
2000.12.18 - Nano 0.9.24 is released. This version contains the last of
the security fixes for writing files, as well as for a
nasty segfault when nano is unable to open a file for
reading, among other fixes. Nano also now cowardly
2000.12.18 - Nano 0.9.24 is released. This version contains the last
of the security fixes for writing files, as well as for
a nasty segfault when nano is unable to open a file for
reading, among other fixes. Nano now also cowardly
refuses to open device files, to stop silly things like
trying to open /dev/zero. New features include being
Able to use Meta-Meta-<key> as Control-<key>, better
able to use Meta-Meta-<key> as Control-<key>, better
HURD support, and some new flags have been added for
Pico compatibility. Upgrading to this version is highly
recommended.
@@ -1495,15 +1508,14 @@
of the curses library used. Yay.
2000.07.27 - Nano 0.9.14 is officially the "13 is so unlucky it should
be skipped as a version number" release. One typo
caused unending problems (calling nano with either -t or
-k caused both flags to be used). The -k code is also
now closer in functionality to Pico's -k mode; please
note that this code is not finished yet. Working on
this code has made me realize that there is not enough
abstraction in the code, and I will be working on that
for the next release. Until then, have fun with this
version.
be skipped as a version number" release. One typo caused
unending problems (calling nano with either -t or -k
caused both flags to be used). The -k code is now also
closer in functionality to Pico's -k mode; please note
that this code is not finished yet. Working on this code
has made me realize that there is not enough abstraction
in the code, and I will be working on that for the next
release. Until then, have fun with this version.
2000.07.23 - Nano 0.9.13 has a few new bits and bobs, most notably the
-k option from Pico (cut to end of line). The majority
@@ -1584,7 +1596,7 @@
concerned with being on the bleeding edge.
2000.04.25 - Nano 0.9.4 fixes some problems in 0.9.3 with the last
line code and related segfaults. It also now has much
line code and related segfaults. It now also has much
better handling for 8-bit characters. The --enable-tiny
code also produces a smaller executable.

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

View File

@@ -7,8 +7,8 @@
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
<h1>The GNU nano editor FAQ</h1>
<h2>Table of Contents</h2>
<h2><a href="#1">1. General</a></h2>
<h3>Table of Contents</h3>
<h3><a href="#1">1. General</a></h3>
<blockquote><p>
<a href="#1.1">1.1. What is GNU nano?</a><br>
<a href="#1.2">1.2. What is the history behind nano?</a><br>
@@ -16,14 +16,14 @@
<a href="#1.4">1.4. What is the current version of nano?</a><br>
<a href="#1.5">1.5. I want to read the manpage without having to download the program!</a>
</p></blockquote>
<h2><a href="#2">2. Where to get GNU nano.</a></h2>
<h3><a href="#2">2. Where to get GNU nano.</a></h3>
<blockquote><p>
<a href="#2.1">2.1. FTP and WWW sites that carry nano.</a><br>
<a href="#2.2">2.2. RedHat and derivatives (.rpm) packages.</a><br>
<a href="#2.3">2.3. Debian (.deb) packages.</a><br>
<a href="#2.4">2.4. By GIT (for the brave).</a>
</p></blockquote>
<h2><a href="#3">3. Installation and Configuration</a></h2>
<h3><a href="#3">3. Installation and Configuration</a></h3>
<blockquote><p>
<a href="#3.1">3.1. How do I install the RPM or DEB package?</a><br>
<a href="#3.2">3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</a><br>
@@ -35,36 +35,37 @@
<a href="#3.9a">3.9a. How do I make a .nanorc file that nano will read when I start it?</a><br>
<a href="#3.9b">3.9b. How about in Win32?</a>
</p></blockquote>
<h2><a href="#4">4. Running</a></h2>
<h3><a href="#4">4. Running</a></h3>
<blockquote><p>
<a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
<a href="#4.2">4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</a><br>
<a href="#4.3">4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</a><br>
<a href="#4.4">4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</a><br>
<a href="#4.5">4.5. How do I type the F13-F16 keys listed in the help viewer? My keyboard only has F1-F12!</a><br>
<a href="#4.6">4.6. nano crashes when I type &lt;insert keystroke here&gt;!</a><br>
<a href="#4.6">4.6. nano crashes when I type &lt;insert keystrokes here&gt;!</a><br>
<a href="#4.7">4.7. nano crashes when I resize my window. How can I fix that?</a><br>
<a href="#4.8a">4.8a. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</a><br>
<a href="#4.8b">4.8b. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?<a><br>
<a href="#4.8a">4.8a. With what keystroke can I paste text from the clipboard into nano?</a><br>
<a href="#4.8b">4.8b. When I paste text into a document, each line gets indented further than the last. Why? And how can I stop this?</a><br>
<a href="#4.8c">4.8c. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?<a><br>
<a href="#4.9">4.9. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
<a href="#4.10">4.10. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
<a href="#4.11">4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a><br>
<a href="#4.12">4.12. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</a>
</p></blockquote>
<h2><a href="#5">5. Internationalization</a></h2>
<h3><a href="#5">5. Internationalization</a></h3>
<blockquote><p>
<a href="#5.1">5.1. There's no translation for my language!</a><br>
<a href="#5.2">5.2. I don't like the translation for &lt;x&gt; in my language. How can I fix it?</a><br>
<a href="#5.3">5.3. What is the status of Unicode support?</a>
</p></blockquote>
<h2><a href="#6">6. Advocacy and Licensing</a></h2>
<h3><a href="#6">6. Advocacy and Licensing</a></h3>
<blockquote><p>
<a href="#6.1">6.1. Why should I use nano instead of Pico?</a><br>
<a href="#6.2">6.2. Why should I use Pico instead of nano?</a><br>
<a href="#6.3">6.3. What is so bad about the older Pine license?</a><br>
<a href="#6.4">6.4. Okay, well, what mail program should I use then?</a>
</p></blockquote>
<h2><a href="#7">7. Miscellaneous</a></h2>
<h3><a href="#7">7. Miscellaneous</a></h3>
<blockquote><p>
<a href="#7.1">7.1. Where can I ask questions or send suggestions?</a><br>
<a href="#7.2">7.2. How do I submit a bug report or patch?</a><br>
@@ -75,9 +76,9 @@
<hr width="100%">
<h1><a name="1"></a>1. General</h1>
<h2><a name="1.1"></a>1.1. What is GNU nano?</h2>
<h3><a name="1.1"></a>1.1. What is GNU nano?</h3>
<blockquote><p>GNU nano is designed to be a free replacement for the Pico text editor, part of the Pine email suite from <a href="http://www.washington.edu/pine/">The University of Washington</a>. It aims to &quot;emulate Pico as closely as possible and then include extra functionality&quot;.</p></blockquote>
<h2><a name="1.2"></a>1.2. What is the history behind nano?</h2>
<h3><a name="1.2"></a>1.2. What is the history behind nano?</h3>
<blockquote><p>Funny you should ask!</p>
<p><b>In the beginning...</b></p>
<p>For years Pine was THE program used to read email on a Unix system. The Pico text editor is the portion of the program one would use to compose his or her mail messages. Many beginners to Unix flocked to Pico and Pine because of their well organized, easy to use interfaces. With the proliferation of GNU/Linux in the mid to late 90's, many University students became intimately familiar with the strengths (and weaknesses) of Pine and Pico.</p>
@@ -87,30 +88,30 @@
<p>It was in late 1999 when Chris Allegretta (our hero) was yet again complaining to himself about the less-than-perfect license Pico was distributed under, the 1000 makefiles that came with it and how just a few small improvements could make it the Best Editor in the World (TM). Having been a convert from Slackware to Debian, he missed having a simple binary package that included Pine and Pico, and had grown tired of downloading them himself.</p>
<p>Finally something snapped inside and Chris coded and hacked like a madman for many hours straight one weekend to make a (barely usable) Pico clone, at the time called TIP (Tip Isn't Pico). The program could not be invoked without a filename, could not save files, had no help text display, spell checker, and so forth. But over time it improved, and with the help of a few great coders it matured to the (hopefully) stable state it is in today.</p>
<p>In February 2001, nano was declared an official GNU program by Richard Stallman. nano also reached its first production release on March 22, 2001.</p></blockquote>
<h2><a name="1.3"></a>1.3. Why the name change from TIP?</h2>
<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>
<h2><a name="1.4"></a>1.4. What is the current version of nano?</h2>
<blockquote><p>The current version of nano <i>should</i> be <b>2.9.4</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<h2><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h2>
<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.5</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<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%">
<h1><a name="2"></a>2. Where to get GNU nano.</h1>
<h2><a name="2.1"></a>2.1. Web sites that carry nano.</h2>
<h3><a name="2.1"></a>2.1. Web sites that carry nano.</h3>
<blockquote><p>The nano source tarballs can be downloaded from the following web sites:</p>
<ul>
<li><a href="https://nano-editor.org/dist/">https://nano-editor.org/dist/</a></li>
<li><a href="https://ftp.gnu.org/gnu/nano/">https://ftp.gnu.org/gnu/nano/</a></li>
</ul>
</blockquote>
<h2><a name="2.2"></a>2.2. RPM packages (RedHat, OpenSuse, and derivatives).</h2>
<h3><a name="2.2"></a>2.2. RPM packages (RedHat, OpenSuse, and derivatives).</h3>
<blockquote>
<ul>
<li><a href="https://kojipkgs.fedoraproject.org//packages/nano/">https://kojipkgs.fedoraproject.org//packages/nano/</a></li>
<li><a href="https://software.opensuse.org/package/nano">https://software.opensuse.org/package/nano</a></li>
</ul>
</blockquote>
<h2><a name="2.3"></a>2.3. Deb packages (Debian and derivatives):</h2>
<h3><a name="2.3"></a>2.3. Deb packages (Debian and derivatives):</h3>
<blockquote><p>Debian users can check out the current nano packages for:</p>
<ul>
<li><a href="http://packages.debian.org/stable/editors/nano">stable</a></li>
@@ -119,14 +120,14 @@
</ul>
<p>You can also have a look at the <a href="ftp://ftp.debian.org/debian/pool/main/n/nano/">Package Pool</a> to see all the available binary and source packages.</p>
</blockquote>
<h2><a name="2.4"></a>2.4. By GIT (for the brave).</h2>
<h3><a name="2.4"></a>2.4. By GIT (for the brave).</h3>
<blockquote><p>For the 'bleeding edge' current version of nano, you can use GIT to download the current source code. <b>Note:</b> believe it or not, by downloading code that has not yet stabilized into an official release, there could quite possibly be bugs, in fact the code may not even compile! Anyway, see <a href="http://git.savannah.gnu.org/cgit/nano.git/tree/README.GIT">the nano GIT document</a> for info on anonymous GIT access to the nano source.</p></blockquote>
<hr width="100%">
<h1><a name="3"></a>3. Installation and Configuration</h1>
<h2><a name="3.1"></a>3.1. How do I install the RPM or DEB package?</h2>
<h3><a name="3.1"></a>3.1. How do I install the RPM or DEB package?</h3>
<blockquote><p>It's simple really! As root, type <b>rpm -Uvh nano-x.y.z-1.i386.rpm</b> if you have a RedHat-ish system or <b>dpkg -i nano_x.y.z-1.deb</b> if you have a Debian-ish system, where <b>x.y.z</b> is the release of nano. There are other programs to install packages, and if you wish to use those, knock yourself out.</p></blockquote>
<h2><a name="3.2"></a>3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</h2>
<h3><a name="3.2"></a>3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</h3>
<blockquote><p>Okay, take a deep breath, this really isn't hard. Unpack the nano source with a command like:</p>
<p><b>tar -xvf nano-x.y.z.tar.gz</b></p>
<p>Then you need to run <b>configure</b> with any options you might want (if any).</p>
@@ -135,13 +136,13 @@
<b>./configure</b><br>
<b>make</b><br>
<b>make install</b> (as root, of course)</p></blockquote>
<h2><a name="3.3"></a>3.3. Why does everything go into /usr/local?</h2>
<h3><a name="3.3"></a>3.3. Why does everything go into /usr/local?</h3>
<blockquote><p>Well, that's what the <b>configure</b> script defaults to. If you wish to change this, simply do this:</p>
<p><b>./configure --prefix=/usr</b></p>
<p>to put nano into /usr/bin when you run <b>make install</b>.</p></blockquote>
<h2><a name="3.5"></a>3.5. nano should automatically run strip on the binary when installing it!</h2>
<h3><a name="3.5"></a>3.5. nano should automatically run strip on the binary when installing it!</h3>
<blockquote><p>Actually, it does, but you have to use <b>make install-strip</b>. The default make install does not, and will not, run strip automatically.</p></blockquote>
<h2><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h2>
<h3><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h3>
<blockquote><p>Actually, there are several parts of the editor that can be disabled. You can pass arguments to the <b>configure</b> script that disable certain features. Here's a brief list:</p>
<pre>
<b>--disable-browser</b> Disable the built-in file browser
@@ -164,49 +165,51 @@
<p>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the marker code that you use with Control-^ to select text). Also, if you know you aren't going to be using other languages, you can use <b>--disable-nls</b> to disable internationalization and save a few K to a few dozen K depending on whether you have locale support on your system. And finally, there's always good old <b>strip</b> to strip all debugging code and code that exists in libraries on your system.</p>
<p>With <b>--disable-wrapping-as-root</b> you can disable any hard-wrapping by default when the user is root, useful to prevent accidentally changing long lines in system configuration files.</p>
</blockquote>
<h2><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h2>
<blockquote><p>To use multiple file buffers, you must not have configured nano with <b>--disable-multibuffer</b> nor with <b>--enable-tiny</b> (use <b>nano -V</b> to check the compilation options). Then when you want to insert a file into its own buffer instead of into the current file, just hit <b>Meta-F</b> after typing <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
<p>You can move between the buffers you have open with the <b>Meta-&lt;</b> and <b>Meta-&gt;</b> keys, or more easily without holding Shift: <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say &quot;Close&quot;, instead of the normal &quot;Exit&quot; when only one buffer is open.</p></blockquote>
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
<h3><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h3>
<blockquote><p>To use multiple file buffers, you must not have configured nano with <b>--disable-multibuffer</b> nor with <b>--enable-tiny</b> (use <b>nano -V</b> to check the compilation options). Then when you want to insert a file into its own buffer instead of into the current file, just hit <b>Meta-F</b> after typing <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>-F</b> or <b>--multibuffer</b> flag when you invoke nano, or add <b>set multibuffer</b> to your .nanorc file.</p>
<p>You can move between the buffers you have open with the <b>Meta-&lt;</b> and <b>Meta-&gt;</b> keys, or more easily without holding Shift: <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one buffer open, the ^X shortcut will say &quot;Close&quot;, instead of &quot;Exit&quot;.</p></blockquote>
<h3><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h3>
<blockquote><p>When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message &quot;Verbatim Input&quot; on the status bar), then press the key(s) that generate the character you want.</p>
<p>Alternatively, if you've enabled Unicode support (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code (from 000000 to 10FFFF, case-insensitive), and the character with the corresponding value will be inserted. The statubar will change to &quot;Unicode Input: ......&quot; when you do this.</p></blockquote>
<h2><a name="3.9a"></a>3.9a. How do I make a .nanorc file that will be read when I start nano?</h2>
<p>Alternatively, if Unicode support is enabled (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code (from 000000 to 10FFFF, case-insensitive), and the character with the corresponding value will be inserted. The status bar will change to &quot;Unicode Input: ......&quot; when you do this.</p></blockquote>
<h3><a name="3.9a"></a>3.9a. How do I make a .nanorc file that will be read when I start nano?</h3>
<blockquote><p>It's not hard at all! But, your nano must <b>not</b> have been compiled with <b>--disable-nanorc</b>. Then simply copy the <b>sample.nanorc</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax of the file is simple. Flags are turned on and off by using the words <b>set</b> and <b>unset</b> plus the long option name for the feature. For example, &quot;set nowrap&quot; or &quot;set smarthome&quot;.</p></blockquote>
<h2><a name="3.9b"></a>3.9b. How about in Win32?</h2>
<h3><a name="3.9b"></a>3.9b. How about in Win32?</h3>
<blockquote><p>If you're using the official nano .zip file and have extracted all the files, you should take the file nano.rc and place it somewhere on your Win32 system (for example, if you have write permission to do so, at the top of C:\). Then you must create an Environment variable called HOME which points to the directory where you put nano.rc. In Windows XP, you can get to Environment variables by right-clicking "My Computer" either on the desktop or in the Start Menu, and selecting Properties. This should bring up the System Properties panel. Then click the Advanced Tab, and there should be a button called Environment Variables. Click that to bring up the Environment Variables section. Now, under User Variables you should be able to click the New button, and make a new Variables Name called HOME, with the Variable Value of whatever path you copied nano.rc into (just the directory name; don't add nano.rc onto the end).</p>
<p>We're still working on documentation for enabling syntax highlighting on Win32; please bear with us.</p>
<p>Note that the nano.rc file must remain Unix-formatted in order for nano to understand it. In other words, you should probably use only nano to edit its config file. Other programs like Wordpad and Notepad will convert the file to DOS format when saving, and the latter does not even properly read Unix-formatted files to begin with.</p></blockquote>
<hr width="100%">
<h1><a name="4"></a>4. Running</h1>
<h2><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h2>
<h3><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h3>
<blockquote><p>If a command-line option that begins with '+' is followed by another option, the former is always treated as a starting line and column number, and the latter is always treated as a filename. If a command-line option that begins with '+' isn't followed by another option, it's always treated as a filename. Examples:</p>
<p>To open '+filename.txt' starting on line 1: <b>nano +filename.txt</b><br>
To open '+filename.txt' starting on line 10: <b>nano +10 +filename.txt</b><br>
To open '+filename.txt' starting on line 1, column 20: <b>nano +,20 +filename.txt</b><br>
To open '+filename.txt' starting on line 10, column 20: <b>nano +10,20 +filename.txt</b><br>
To open '+filename.txt' starting on line 1 and 'filename.txt' starting on line 40 (if nano has been compiled with multibuffer support): <b>nano +1 +filename.txt +40 filename.txt</b></p></blockquote>
<h2><a name="4.2"></a>4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</h2>
<h3><a name="4.2"></a>4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</h3>
<blockquote><p>Try setting your $TERM variable to 'vt100'. nano doesn't yet support every term entry under the sun.</p>
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
<h2><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h2>
<h3><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h3>
<blockquote><p>You can use the <b>-K</b> or <b>--rebindkeypad</b> option on the command line, or add the line <b>set rebindkeypad</b> to your .nanorc. However, nano's mouse support won't work properly if you do any of these things.</p></blockquote>
<h2><a name="4.4"></a>4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</h2>
<h3><a name="4.4"></a>4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</h3>
<blockquote><p>This was a bug in how nano handled consecutive escape sequences. It should be fixed since version 2.6.0.</p></blockquote>
<h2><a name="4.5"></a>4.5. How do I type the F13-F16 keys listed in the help viewer? My keyboard only has F1-F12!</h2>
<h3><a name="4.5"></a>4.5. How do I type the F13-F16 keys listed in the help viewer? My keyboard only has F1-F12!</h3>
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, and Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
<h2><a name="4.6"></a>4.6. nano crashes when I type &lt;insert keystroke here&gt;!</h2>
<h3><a name="4.6"></a>4.6. nano crashes when I type &lt;insert keystrokes here&gt;!</h3>
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or in the <a href="https://savannah.gnu.org/bugs/?group=nano">bug tracker</a> on Savannah.</p></blockquote>
<h2><a name="4.7"></a>4.7. nano crashes when I resize my window. How can I fix that?</h2>
<h3><a name="4.7"></a>4.7. nano crashes when I resize my window. How can I fix that?</h3>
<blockquote><p>Older versions of nano had this problem. Please upgrade to version 2.7.0 or newer.</p></blockquote>
<h2><a name="4.8a"></a>4.8a. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</h2>
<blockquote><p>You have the autoindent feature turned on. Hit Meta-I to turn it off, paste your text, and then hit Meta-I again to turn it back on.</p></blockquote>
<h2><a name="4.8b"></a>4.8b. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?</h2>
<h3><a name="4.8a"></a>4.8a. With what keystroke can I paste text from the clipboard into nano?</h3>
<blockquote><p>In most desktop environments <b>Shift+Insert</b> will paste the contents of the clipboard.</p></blockquote>
<h3><a name="4.8b"></a>4.8b. When I paste text into a document, each line gets indented further than the last. Why? And how can I stop this?</h3>
<blockquote><p>You have the <i>autoindent</i> feature turned on. Hit <b>Meta-I</b> to turn it off, paste your text, and then hit <b>Meta-I</b> again to turn it back on.</p></blockquote>
<h3><a name="4.8c"></a>4.8c. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?</h3>
<blockquote><p>When pasting from Windows, in some situations linefeeds are sent instead of carriage returns (Enters). And linefeeds are <b>^J</b>s, which make nano justify (rewrap) the current paragraph. To prevent these linefeeds from causing these unwanted justifications, add this line to your .nanorc on the remote Linux box: <b>unbind ^J main</b> or <b>bind ^J enter main</b>, depending on whether the paste contains CR + LF or only LF.</p></blockquote>
<h2><a name="4.9"></a>4.9. I've compiled nano with color support, but I don't see any color when I run it!</h2>
<h3><a name="4.9"></a>4.9. I've compiled nano with color support, but I don't see any color when I run it!</h3>
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Several example configurations are in the <b>syntax/</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano/</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9a">3.9a</a>.</p></blockquote>
<h2><a name="4.10"></a>4.10. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
<h3><a name="4.10"></a>4.10. How do I make nano my default editor (in Pine, mutt, etc.)?</h3>
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
<p>or, if you use tcsh, put this in your <b>.cshrc</b> file:</p>
@@ -219,53 +222,53 @@
<p>If you're a mutt user, you should see an effect immediately the next time you log in. No further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
<h2><a name="4.11"></a>4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
<h3><a name="4.11"></a>4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h3>
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
<h2><a name="4.12"></a>4.12. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</h2>
<h3><a name="4.12"></a>4.12. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</h3>
<blockquote><p>In nano 2.3.0, cursor-position history was introduced, and both history files now reside in a .nano subdirectory in your home directory. A newer nano will move an existing search-history file to this new location so it can continue to be used. This means that if you then try and use an earlier version of nano, it will be unable to see your current search history. To fix this, run the following command:</p>
<p><b>ln -sf ~/.nano/search_history ~/.nano_history</b></p>
<p>The "migration service" (moving the search-history file to its new location) has been deleted from nano in late 2017, since version 2.9.0. The search-history and position-history files will now be looked for first in ~/.nano/ and, when not found there, then in ~/.local/share/nano/.</p></blockquote>
<hr width="100%">
<h1><a name="5"></a>5. Internationalization</h1>
<h2><a name="5.1"></a>5.1. There's no translation for my language!</h2>
<h3><a name="5.1"></a>5.1. There's no translation for my language!</h3>
<blockquote><p>In June 2001, GNU nano entered the <a href="http://translationproject.org/html/welcome.html">Translation Project</a> and since then, translations should be managed from there.</p>
<p>If there isn't a translation for your language, you could ask <a href="http://translationproject.org/team/">your language team</a> to translate nano, or better still, join that team and do it yourself. Joining a team is easy. You just need to ask the team leader to add you, and then send a <a href="http://translationproject.org/disclaim.txt">translation disclaimer to the FSF</a> (this is necessary as nano is an official GNU package, but it does <b>not</b> mean that you transfer the rights of your work to the FSF, it's just so the FSF can legally manage them).</p>
<p>In any case, translating nano is easy. Just grab the latest <b>nano.pot</b> file listed on <a href="http://translationproject.org/domain/nano.html">nano's page</a> at the TP, and translate each <b>msgid</b> line into your native language on the <b>msgstr</b> line. When you're done, you should send it to the TP's central PO-file repository.</p></blockquote>
<h2><a name="5.2"></a>5.2. I don't like the translation for &lt;x&gt; in my language. How can I fix it?</h2>
<h3><a name="5.2"></a>5.2. I don't like the translation for &lt;x&gt; in my language. How can I fix it?</h3>
<blockquote><p>The best way is to send an e-mail with your suggested corrections to the team's mailing list. The address is mentioned in the <code>Language-Team:</code> field in the relevant PO file. The team leader or the assigned translator can then make the changes reach the nano-devel list.</p></blockquote>
<h2><a name="5.3"></a>5.3. What is the status of Unicode support?</h2>
<h3><a name="5.3"></a>5.3. What is the status of Unicode support?</h3>
<blockquote><p>Unicode should be fully usable nowadays. When the encoding of your terminal is set to UTF-8, and your locale (mainly the LANG environment variable) is UTF-8 too, then you should be able to read, enter and save Unicode text.</p></blockquote>
<hr width="100%">
<h1><a name="6"></a>6. Advocacy and Licensing</h1>
<h2><a name="6.1"></a>6.1. Why should I use nano instead of Pico?</h2>
<h3><a name="6.1"></a>6.1. Why should I use nano instead of Pico?</h3>
<blockquote><p>There are many reasons to use nano instead of Pico. A more complete list can be found at the <a href="https://nano-editor.org/">nano homepage</a>.</p></blockquote>
<h2><a name="6.2"></a>6.2. Why should I use Pico instead of nano?</h2>
<h3><a name="6.2"></a>6.2. Why should I use Pico instead of nano?</h3>
<blockquote><p>Again, check out the <a href="https://nano-editor.org/">nano homepage</a> for a good summary of reasons. It really is a matter of personal preference as to which editor you should use. If you're the type of person who likes using the original version of a program, then Pico is the editor for you. If you don't mind sacrificing mailer integration with Pine, and are looking for a few more features, as well as a 'better' license in terms of adding your own changes, nano is the way to go.</p>
<p>Note that the last of these no longer applies to the new version of Pine, <a href="http://www.washington.edu/alpine/">Alpine</a>, which is under the Apache License, version 2.0.</p></blockquote>
<h2><a name="6.3"></a>6.3. What is so bad about the older Pine license?</h2>
<h3><a name="6.3"></a>6.3. What is so bad about the older Pine license?</h3>
<blockquote><p>The U of W license for older versions of Pine and Pico is not considered truly Free Software according to both the Free Software Foundation and the <a href="http://www.debian.org/social_contract#guidelines">Debian Free Software Guidelines</a>. The main problem regards the limitations on distributing derived works: according to UW, you can distribute their software, and you can modify it, but you can not do both, i.e. distribute modified binaries.</p></blockquote>
<h2><a name="6.4"></a>6.4. Okay, well, what mail program should I use then?</h2>
<h3><a name="6.4"></a>6.4. Okay, well, what mail program should I use then?</h3>
<blockquote><p>If you are looking to use a Free Software program similar to Pine, and Emacs is not your thing, you should definitely take a look at <a href="http://www.mutt.org/">mutt</a>. It is a full-screen, console based mail program that actually has a lot more flexibility than Pine, but has a keymap included in the distribution that allows you to use the same keystrokes as Pine would to send and receive mail. It's also under the GNU General Public License, version 2.0.</p>
<p>Of course, due to the license change you can now use the <a href="http://www.washington.edu/alpine/">Alpine distribution</a> of PINE as it is now considered Free Software, but you would be sacrificing many of nano's features to do so.</p></blockquote>
<hr width="100%">
<h1><a name="7"></a>7. Miscellaneous</h1>
<h2><a name="7.1"></a>7.1. Where can I ask questions or send suggestions?</h2>
<h3><a name="7.1"></a>7.1. Where can I ask questions or send suggestions?</h3>
<blockquote><p>There are three mailing lists for nano hosted at <a href="http://savannah.gnu.org/">Savannah</a>: info-nano, help-nano and nano-devel. info-nano is a very low traffic list where new versions of nano are announced (surprise!). help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
<p>info-nano - <a href="http://mail.gnu.org/mailman/listinfo/info-nano/">http://mail.gnu.org/mailman/listinfo/info-nano/</a><br>
help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
<h2><a name="7.2"></a>7.3. How do I submit a bug report or patch?</h2>
<h3><a name="7.2"></a>7.3. How do I submit a bug report or patch?</h3>
<blockquote>
<p>The best way to submit bugs is through the <a href="https://savannah.gnu.org/bugs/?group=nano">Savannah bug tracker</a>, as you can check whether the bug you are reporting has already been submitted, and it makes it easier for the maintainers to keep track of them.
<p>You can submit patches for nano via <a href="https://savannah.gnu.org/patch/?group=nano">Savannah's patch manager</a>.</p></blockquote>
<h2><a name="7.3"></a>7.3. I want to send the development team a big load of cash (or just a thank you).</h2>
<h3><a name="7.3"></a>7.3. I want to send the development team a big load of cash (or just a thank you).</h3>
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="https://savannah.gnu.org/bugs/?group=nano">bug</a> in the program or implement a <a href="https://nano-editor.org/dist/latest/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
<h2><a name="7.4"></a>7.4. How do I join the development team?</h2>
<h3><a name="7.4"></a>7.4. How do I join the development team?</h3>
<blockquote><p>The easiest way is to consistently send in good patches that add some needed functionality, fix a bug or two, and/or make the program more optimized/efficient. Then ask nicely and you will probably be added to the Savannah development list and be given write access after a while. There is a lot of responsibility that goes along with being a team member, so don't think it's just something to add to your resume.</p></blockquote>
<h2><a name="7.5"></a>7.5. Can I have write access to the git tree?</h2>
<h3><a name="7.5"></a>7.5. Can I have write access to the git tree?</h3>
<blockquote><p>Re-read section <a href="#7.4">7.4</a> and you should know the answer.</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.4" "March 2018"
.TH NANO 1 "version 2.9.5" "March 2018"
.SH NAME
nano \- Nano's ANOther editor, an enhanced free Pico clone
@@ -303,8 +303,8 @@ cannot be undone any more. The workaround is, of course, to exit without
saving.
.sp
The recording and playback of keyboard macros works correctly only on a
terminal emulator, not on a Linux console (VT), because the latter is a
deficient terminal.
terminal emulator, not on a Linux console (VT), because the latter does
not by default distinguish modified from unmodified arrow keys.
.sp
Please report any other bugs that you encounter via:
.br

View File

@@ -8,7 +8,7 @@
@smallbook
@set EDITION 0.5
@set VERSION 2.9.4
@set VERSION 2.9.5
@set UPDATED March 2018
@dircategory Editors
@@ -23,7 +23,7 @@
@titlepage
@title GNU @command{nano}
@subtitle a small and friendly text editor
@subtitle version 2.9.4
@subtitle version 2.9.5
@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.4.
This manual documents the GNU @command{nano} editor, version 2.9.5.
@menu
* Introduction::
@@ -569,8 +569,8 @@ cannot be undone any more. The workaround is, of course, to exit without
saving.
The recording and playback of keyboard macros works correctly only on a
terminal emulator, not on a Linux console (VT), because the latter is a
deficient terminal.
terminal emulator, not on a Linux console (VT), because the latter does
not by default distinguish modified from unmodified arrow keys.
@node Built-in Help
@chapter Built-in Help
@@ -755,7 +755,8 @@ Use this color combination for the concise function descriptions
in the two help lines at the bottom of the screen.
Valid names for foreground and background color are:
@code{white}, @code{black}, @code{blue}, @code{green},
@code{red}, @code{cyan}, @code{yellow}, and @code{magenta}.
@code{red}, @code{cyan}, @code{yellow}, @code{magenta}, and @code{normal}
--- where @code{normal} means the default foreground or background color.
The name of the foreground color may be prefixed with @code{bright}.
And either @var{fgcolor} or ,@var{bgcolor} may be left out.
@@ -1188,10 +1189,12 @@ Goes one line up (in the editor or browser).
Goes one line down (in the editor or browser).
@item scrollup
Scrolls up one line of text from the current position.
Scrolls the viewport up one row (meaning that the text slides down)
while keeping the cursor in the same text position, if possible.
@item scrolldown
Scrolls down one line of text from the current position.
Scrolls the viewport down one row (meaning that the text slides up)
while keeping the cursor in the same text position, if possible.
@item prevword
Moves the cursor to the beginning of the previous word.

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.4" "March 2018"
.TH NANORC 5 "version 2.9.5" "March 2018"
.SH NAME
nanorc \- GNU nano's configuration file
@@ -264,7 +264,9 @@ Save automatically on exit, don't prompt.
.B set titlecolor \fIfgcolor\fR,\fIbgcolor\fR
Specify the color combination to use for the title bar.
Valid names for the foreground and background colors are:
.BR white ", " black ", " blue ", " green ", " red ", " cyan ", " yellow ", and " magenta .
.BR white ", " black ", " blue ", " green ", " red ", "
.BR cyan ", " yellow ", " magenta ", and " normal
-- where \fBnormal\fR means the default foreground or background color.
The name of the foreground color may be prefixed with \fBbright\fR.
And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
.TP
@@ -543,10 +545,12 @@ Goes one line up (in the editor or browser).
Goes one line down (in the editor or browser).
.TP
.B scrollup
Scrolls up one line of text from the current position.
Scrolls the viewport up one row (meaning that the text slides down)
while keeping the cursor in the same text position, if possible.
.TP
.B scrolldown
Scrolls down one line of text from the current position.
Scrolls the viewport down one row (meaning that the text slides up)
while keeping the cursor in the same text position, if possible.
.TP
.B prevword
Moves the cursor to the beginning of the previous word.

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.4" "March 2018"
.TH RNANO 1 "version 2.9.5" "March 2018"
.SH NAME
rnano \- a restricted nano

566
po/bg.po

File diff suppressed because it is too large Load Diff

572
po/ca.po

File diff suppressed because it is too large Load Diff

566
po/cs.po

File diff suppressed because it is too large Load Diff

566
po/da.po

File diff suppressed because it is too large Load Diff

572
po/de.po

File diff suppressed because it is too large Load Diff

574
po/eo.po

File diff suppressed because it is too large Load Diff

572
po/es.po

File diff suppressed because it is too large Load Diff

566
po/eu.po

File diff suppressed because it is too large Load Diff

712
po/fi.po

File diff suppressed because it is too large Load Diff

572
po/fr.po

File diff suppressed because it is too large Load Diff

566
po/ga.po

File diff suppressed because it is too large Load Diff

566
po/gl.po

File diff suppressed because it is too large Load Diff

961
po/hr.po

File diff suppressed because it is too large Load Diff

604
po/hu.po

File diff suppressed because it is too large Load Diff

564
po/id.po

File diff suppressed because it is too large Load Diff

572
po/it.po

File diff suppressed because it is too large Load Diff

572
po/ja.po

File diff suppressed because it is too large Load Diff

566
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

582
po/nb.po

File diff suppressed because it is too large Load Diff

574
po/nl.po

File diff suppressed because it is too large Load Diff

564
po/nn.po

File diff suppressed because it is too large Load Diff

929
po/pl.po

File diff suppressed because it is too large Load Diff

572
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

592
po/ro.po

File diff suppressed because it is too large Load Diff

566
po/ru.po

File diff suppressed because it is too large Load Diff

566
po/sl.po

File diff suppressed because it is too large Load Diff

732
po/sr.po

File diff suppressed because it is too large Load Diff

566
po/sv.po

File diff suppressed because it is too large Load Diff

572
po/tr.po

File diff suppressed because it is too large Load Diff

568
po/uk.po

File diff suppressed because it is too large Load Diff

572
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

@@ -32,9 +32,9 @@ static char **filelist = NULL;
/* The list of files to display in the file browser. */
static size_t filelist_len = 0;
/* The number of files in the list. */
static int width = 0;
static size_t width = 0;
/* The number of files that we can display per screen row. */
static int longest = 0;
static size_t longest = 0;
/* The number of columns in the longest filename in the list. */
static size_t selected = 0;
/* The currently selected filename in the list; zero-based. */
@@ -187,10 +187,10 @@ char *do_browser(char *path)
selected += width - 1 - (selected % width);
if (selected >= filelist_len)
selected = filelist_len - 1;
} else if (func == do_up_void) {
} else if (func == do_up) {
if (selected >= width)
selected -= width;
} else if (func == do_down_void) {
} else if (func == do_down) {
if (selected + width <= filelist_len - 1)
selected += width;
} else if (func == do_prev_block) {
@@ -258,9 +258,9 @@ char *do_browser(char *path)
/* In case the specified directory cannot be entered, select it
* (if it is in the current list) so it will be highlighted. */
for (i = 0; i < filelist_len; i++)
if (strcmp(filelist[i], path) == 0)
selected = i;
for (size_t j = 0; j < filelist_len; j++)
if (strcmp(filelist[j], path) == 0)
selected = j;
/* Try opening and reading the specified directory. */
goto read_directory_contents;
@@ -304,7 +304,7 @@ char *do_browser(char *path)
path = mallocstrcpy(path, filelist[selected]);
goto read_directory_contents;
#ifdef ENABLE_NANORC
} else if (func == (void *)implant) {
} else if (func == (functionptrtype)implant) {
implant(first_sc_for(MBROWSER, func)->expansion);
#endif
} else if (func == do_exit) {
@@ -361,7 +361,7 @@ char *do_browse_from(const char *inpath)
path = free_and_assign(path, strip_last_component(path));
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
char * currentdir = charalloc(PATH_MAX + 1);
char *currentdir = charalloc(PATH_MAX + 1);
free(path);
path = getcwd(currentdir, PATH_MAX + 1);
@@ -525,7 +525,7 @@ void browser_refresh(void)
/* The length of the filename in columns. */
size_t infolen;
/* The length of the file information in columns. */
int infomaxlen = 7;
size_t infomaxlen = 7;
/* The maximum length of the file information in columns:
* normally seven, but will be twelve for "(parent dir)". */
bool dots = (COLS >= 15 && namelen >= longest - infomaxlen);

View File

@@ -66,16 +66,19 @@ void make_new_buffer(void)
if (openfile == NULL) {
/* Make the first open file the only element in the list. */
#ifdef ENABLE_MULTIBUFFER
newnode->prev = newnode;
newnode->next = newnode;
#endif
firstfile = newnode;
} else {
/* Add the new open file after the current one in the list. */
#ifdef ENABLE_MULTIBUFFER
newnode->prev = openfile;
newnode->next = openfile->next;
openfile->next->prev = newnode;
openfile->next = newnode;
#endif
/* There is more than one file open: show "Close" in help lines. */
exitfunc->desc = close_tag;
more_than_one = !inhelp || more_than_one;
@@ -406,13 +409,11 @@ void stat_with_alloc(const char *filename, struct stat **pstat)
}
#endif /* !NANO_TINY */
/* This does one of three things. If the filename is "", just create a new
* empty buffer. Otherwise, read the given file into the existing buffer,
* or into a new buffer when MULTIBUFFER is set or there is no buffer yet. */
bool open_buffer(const char *filename, bool undoable)
/* This does one of three things. If the filename is "", it just creates
* a new empty buffer. When the filename is not empty, it reads that file
* into a new buffer when requested, otherwise into the existing buffer. */
bool open_buffer(const char *filename, bool new_buffer)
{
bool new_buffer = (openfile == NULL || ISSET(MULTIBUFFER));
/* Whether we load into the current buffer or a new one. */
char *realname;
/* The filename after tilde expansion. */
FILE *f;
@@ -475,24 +476,20 @@ bool open_buffer(const char *filename, bool undoable)
rc = (filename[0] != '\0' && !ISSET(NOREAD_MODE)) ?
open_file(realname, new_buffer, inhelp, &f) : -2;
/* If we have a file, and we're loading into a new buffer, update
* the filename. */
if (rc != -1 && new_buffer)
openfile->filename = mallocstrcpy(openfile->filename, realname);
/* If we have a non-new file, read it in. Then, if the buffer has
* no stat, update the stat, if applicable. */
if (rc > 0) {
read_file(f, rc, realname, undoable, new_buffer);
read_file(f, rc, realname, !new_buffer);
#ifndef NANO_TINY
if (openfile->current_stat == NULL)
stat_with_alloc(realname, &openfile->current_stat);
#endif
}
/* If we have a file, and we're loading into a new buffer, move back
* to the beginning of the first line of the buffer. */
/* If we have a file, and we've loaded it into a new buffer, set
* the filename and put the cursor at the start of the buffer. */
if (rc != -1 && new_buffer) {
openfile->filename = mallocstrcpy(openfile->filename, realname);
openfile->current = openfile->fileage;
openfile->current_x = 0;
openfile->placewewant = 0;
@@ -528,7 +525,7 @@ void replace_buffer(const char *filename)
initialize_buffer_text();
/* Insert the processed file into its place. */
read_file(f, descriptor, filename, FALSE, TRUE);
read_file(f, descriptor, filename, FALSE);
/* Put current at a place that is certain to exist. */
openfile->current = openfile->fileage;
@@ -559,7 +556,7 @@ void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x,
* where the marked text was. */
extract_buffer(&trash_top, &trash_bot, top, top_x, bot, bot_x);
free_filestruct(trash_top);
read_file(f, descriptor, filename, FALSE, TRUE);
read_file(f, descriptor, filename, FALSE);
/* Restore the magicline behavior now that we're done fiddling. */
if (!old_no_newlines)
@@ -716,13 +713,10 @@ char *encode_data(char *buf, size_t buf_len)
return mallocstrcpy(NULL, buf);
}
/* Read an open file into the current buffer. f should be set to the
* open file, and filename should be set to the name of the file.
* undoable means do we want to create undo records to try and undo
* this. Will also attempt to check file writability if fd > 0 and
* checkwritable == TRUE. */
void read_file(FILE *f, int fd, const char *filename, bool undoable,
bool checkwritable)
/* Read the given open file f into the current buffer. filename should be
* set to the name of the file. undoable means that undo records should be
* created and that the file does not need to be checked for writability. */
void read_file(FILE *f, int fd, const char *filename, bool undoable)
{
ssize_t was_lineno = openfile->current->lineno;
/* The line number where we start the insertion. */
@@ -838,7 +832,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable,
if (ferror(f))
nperror(filename);
fclose(f);
if (fd > 0 && checkwritable) {
if (fd > 0 && !undoable) {
close(fd);
writable = is_file_writable(filename);
}
@@ -1125,7 +1119,7 @@ void do_insertfile(void)
#ifdef ENABLE_MULTIBUFFER
/* When in multibuffer mode, first open a blank buffer. */
if (ISSET(MULTIBUFFER))
open_buffer("", FALSE);
open_buffer("", TRUE);
#endif
/* If the command is not empty, execute it and read its output
* into the buffer, and add the command to the history list. */
@@ -1152,8 +1146,8 @@ void do_insertfile(void)
/* Make sure the specified path is tilde-expanded. */
answer = free_and_assign(answer, real_dir_from_tilde(answer));
/* Read the specified file into the current buffer. */
open_buffer(answer, TRUE);
/* Read the file into a new buffer or into current buffer. */
open_buffer(answer, ISSET(MULTIBUFFER));
}
#ifdef ENABLE_MULTIBUFFER
@@ -2429,8 +2423,8 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
/* We consider the first buf_len characters of buf for filename tab
* completion. */
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
*num_matches, size_t buf_len)
char **cwd_tab_completion(const char *buf, bool allow_files,
size_t *num_matches, size_t buf_len)
{
char *dirname = mallocstrcpy(NULL, buf);
char *slash, *filename;
@@ -2609,7 +2603,8 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
if (!*lastwastab)
*lastwastab = TRUE;
else if (num_matches > 1) {
int longest_name = 0, ncols, editline = 0;
size_t longest_name = 0, ncols;
int editline = 0;
/* Sort the list of available choices. */
qsort(matches, num_matches, sizeof(char *), diralphasort);

View File

@@ -577,9 +577,9 @@ void shortcut_init(void)
#ifndef NANO_TINY
const char *bracket_gist = N_("Go to the matching bracket");
const char *scrollup_gist =
N_("Scroll up one line without scrolling the cursor");
N_("Scroll up one line without moving the cursor textually");
const char *scrolldown_gist =
N_("Scroll down one line without scrolling the cursor");
N_("Scroll down one line without moving the cursor textually");
#endif
#ifdef ENABLE_MULTIBUFFER
const char *prevfile_gist = N_("Switch to the previous file buffer");
@@ -855,9 +855,9 @@ void shortcut_init(void)
add_to_funcs(do_end, MMAIN,
N_("End"), WITHORSANS(end_gist), BLANKAFTER, VIEW);
add_to_funcs(do_up_void, MMAIN|MHELP|MBROWSER,
add_to_funcs(do_up, MMAIN|MHELP|MBROWSER,
prevline_tag, WITHORSANS(prevline_gist), TOGETHER, VIEW);
add_to_funcs(do_down_void, MMAIN|MHELP|MBROWSER,
add_to_funcs(do_down, MMAIN|MHELP|MBROWSER,
nextline_tag, WITHORSANS(nextline_gist), TOGETHER, VIEW);
#ifndef NANO_TINY
add_to_funcs(do_scroll_up, MMAIN,
@@ -1013,8 +1013,7 @@ void shortcut_init(void)
N_("Backup File"), WITHORSANS(backup_gist), BLANKAFTER, NOVIEW);
}
/* If we're using restricted mode, file insertion is disabled, and
* thus command execution and the multibuffer toggle have no place. */
/* Command execution is only available when not in restricted mode. */
if (!ISSET(RESTRICTED)) {
add_to_funcs(flip_execute, MINSERTFILE,
N_("Execute Command"), WITHORSANS(execute_gist), TOGETHER, NOVIEW);
@@ -1024,12 +1023,14 @@ void shortcut_init(void)
}
#endif /* !NANO_TINY */
#ifdef ENABLE_MULTIBUFFER
/* Multiple buffers are only available when not in restricted mode. */
if (!ISSET(RESTRICTED))
add_to_funcs(flip_newbuffer, MINSERTFILE|MEXTCMD,
N_("New Buffer"), WITHORSANS(newbuffer_gist), TOGETHER, NOVIEW);
#endif
#ifdef ENABLE_BROWSER
/* The file browser is only available when not in restricted mode. */
if (!ISSET(RESTRICTED))
add_to_funcs(to_files_void, MWRITEFILE|MINSERTFILE,
N_("To Files"), WITHORSANS(tofiles_gist), TOGETHER, VIEW);
@@ -1181,19 +1182,19 @@ void shortcut_init(void)
add_to_sclist((MMOST & ~MBROWSER), "Home", KEY_HOME, do_home, 0);
add_to_sclist((MMOST & ~MBROWSER), "^E", 0, do_end, 0);
add_to_sclist((MMOST & ~MBROWSER), "End", KEY_END, do_end, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", 0, do_up_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", 0, do_down_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", 0, do_up, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", 0, do_down, 0);
#ifdef ENABLE_UTF8
if (using_utf8()) {
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x96\xb2", KEY_UP, do_up_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x96\xbc", KEY_DOWN, do_down_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x96\xb2", KEY_UP, do_up, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x96\xbc", KEY_DOWN, do_down, 0);
add_to_sclist(MMAIN|MBROWSER, "^\xE2\x96\xb2", CONTROL_UP, do_prev_block, 0);
add_to_sclist(MMAIN|MBROWSER, "^\xE2\x96\xbc", CONTROL_DOWN, do_next_block, 0);
} else
#endif
{
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", KEY_UP, do_up_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", KEY_DOWN, do_down_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", KEY_UP, do_up, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", KEY_DOWN, do_down, 0);
add_to_sclist(MMAIN|MBROWSER, "^Up", CONTROL_UP, do_prev_block, 0);
add_to_sclist(MMAIN|MBROWSER, "^Down", CONTROL_DOWN, do_next_block, 0);
}
@@ -1311,8 +1312,8 @@ void shortcut_init(void)
#ifndef NANO_TINY
add_to_sclist(MWRITEFILE, "M-D", 0, dos_format_void, 0);
add_to_sclist(MWRITEFILE, "M-M", 0, mac_format_void, 0);
/* In restricted mode, don't allow Appending, Prepending, nor making
* backups, nor executing a command, nor opening a new buffer. */
/* Only when not in restricted mode, allow Appending, Prepending,
* making backups, and executing a command. */
if (!ISSET(RESTRICTED)) {
add_to_sclist(MWRITEFILE, "M-A", 0, append_void, 0);
add_to_sclist(MWRITEFILE, "M-P", 0, prepend_void, 0);
@@ -1321,11 +1322,12 @@ void shortcut_init(void)
}
#endif
#ifdef ENABLE_MULTIBUFFER
/* Only when not in restricted mode, allow multiple buffers. */
if (!ISSET(RESTRICTED))
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, flip_newbuffer, 0);
#endif
#ifdef ENABLE_BROWSER
/* In restricted mode, don't allow entering the file browser. */
/* Only when not in restricted mode, allow entering the file browser. */
if (!ISSET(RESTRICTED))
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files_void, 0);
#endif
@@ -1553,10 +1555,10 @@ sc *strtosc(const char *input)
s->func = do_right;
else if (!strcasecmp(input, "up") ||
!strcasecmp(input, "prevline"))
s->func = do_up_void;
s->func = do_up;
else if (!strcasecmp(input, "down") ||
!strcasecmp(input, "nextline"))
s->func = do_down_void;
s->func = do_down;
else if (!strcasecmp(input, "prevword"))
s->func = do_prev_word_void;
else if (!strcasecmp(input, "nextword"))
@@ -1777,12 +1779,14 @@ void thanks_for_all_the_fish(void)
free(alt_speller);
#endif
free_filestruct(cutbuffer);
#ifdef ENABLE_MULTIBUFFER
/* Free the memory associated with each open file buffer. */
while (openfile != openfile->next) {
openfile = openfile->next;
delete_opennode(openfile->prev);
}
delete_opennode(openfile);
#endif
#ifdef ENABLE_COLOR
free(syntaxstr);
while (syntaxes != NULL) {

View File

@@ -46,7 +46,7 @@ char *tempfilename = NULL;
* read that file into a new buffer. */
void wrap_the_help_text(bool redisplaying)
{
int sum = 0;
size_t sum = 0;
const char *ptr = start_of_body;
FILE *tempfile = fopen(tempfilename, "w+b");
@@ -75,7 +75,7 @@ void wrap_the_help_text(bool redisplaying)
if (redisplaying)
close_buffer();
open_buffer(tempfilename, FALSE);
open_buffer(tempfilename, TRUE);
remove_magicline();
prepare_for_display();
@@ -142,10 +142,10 @@ void do_help(void)
UNSET(WHITESPACE_DISPLAY);
UNSET(NOREAD_MODE);
SET(MULTIBUFFER);
#ifdef ENABLE_LINENUMBERS
UNSET(LINE_NUMBERS);
editwincols = COLS;
margin = 0;
#endif
tabsize = 8;
@@ -191,12 +191,12 @@ void do_help(void)
if (func == total_refresh) {
total_redraw();
} else if (func == do_up_void) {
do_up(TRUE);
} else if (func == do_down_void) {
} else if (func == do_up) {
do_scroll_up();
} else if (func == do_down) {
if (openfile->edittop->lineno + editwinrows - 1 <
openfile->filebot->lineno)
do_down(TRUE);
do_scroll_down();
} else if (func == do_page_up) {
do_page_up();
} else if (func == do_page_down) {
@@ -216,7 +216,7 @@ void do_help(void)
} else if (func == do_findnext) {
do_findnext();
#ifdef ENABLE_NANORC
} else if (func == (void *)implant) {
} else if (func == (functionptrtype)implant) {
implant(first_sc_for(MHELP, func)->expansion);
#endif
} else if (kbinput == KEY_WINCH) {
@@ -253,6 +253,7 @@ void do_help(void)
#ifdef ENABLE_LINENUMBERS
margin = was_margin;
editwincols = COLS - margin;
#endif
tabsize = was_tabsize;
#ifdef ENABLE_COLOR

View File

@@ -481,18 +481,12 @@ void do_end(void)
update_line(openfile->current, openfile->current_x);
}
/* Move the cursor to the preceding line or chunk. If scroll_only is TRUE,
* also scroll the screen one row, so the cursor stays in the same spot. */
void do_up(bool scroll_only)
/* Move the cursor to the preceding line or chunk. */
void do_up(void)
{
filestruct *was_current = openfile->current;
size_t leftedge, target_column;
/* When just scrolling and the top of the file is onscreen, get out. */
if (scroll_only && openfile->edittop == openfile->fileage &&
openfile->firstcolumn == 0)
return;
get_edge_and_target(&leftedge, &target_column);
/* If we can't move up one line or chunk, we're at top of file. */
@@ -501,18 +495,14 @@ void do_up(bool scroll_only)
set_proper_index_and_pww(&leftedge, target_column, FALSE);
if (scroll_only)
edit_scroll(BACKWARD, 1);
edit_redraw(was_current, FLOWING);
/* <Up> should not change placewewant, so restore it. */
openfile->placewewant = leftedge + target_column;
}
/* Move the cursor to next line or chunk. If scroll_only is TRUE, also
* scroll the screen one row, so the cursor stays in the same spot. */
void do_down(bool scroll_only)
/* Move the cursor to next line or chunk. */
void do_down(void)
{
filestruct *was_current = openfile->current;
size_t leftedge, target_column;
@@ -525,38 +515,39 @@ void do_down(bool scroll_only)
set_proper_index_and_pww(&leftedge, target_column, TRUE);
if (scroll_only)
edit_scroll(FORWARD, 1);
edit_redraw(was_current, FLOWING);
/* <Down> should not change placewewant, so restore it. */
openfile->placewewant = leftedge + target_column;
}
/* Move up one line or chunk. */
void do_up_void(void)
{
do_up(FALSE);
}
/* Move down one line or chunk. */
void do_down_void(void)
{
do_down(FALSE);
}
#ifndef NANO_TINY
#ifdef ENABLE_HELP
/* Scroll up one line or chunk without scrolling the cursor. */
void do_scroll_up(void)
{
do_up(TRUE);
/* When the top of the file is onscreen, we can't scroll. */
if (openfile->edittop->prev == NULL && openfile->firstcolumn == 0)
return;
if (openfile->current_y == editwinrows - 1)
do_up();
edit_scroll(BACKWARD);
}
/* Scroll down one line or chunk without scrolling the cursor. */
void do_scroll_down(void)
{
do_down(TRUE);
if (openfile->current_y == 0)
do_down();
if (openfile->edittop->next != NULL
#ifndef NANO_TINY
|| chunk_for(openfile->firstcolumn, openfile->edittop) <
number_of_chunks_in(openfile->edittop)
#endif
)
edit_scroll(FORWARD);
}
#endif

View File

@@ -42,6 +42,12 @@
#include <sys/vt.h>
#endif
#ifdef ENABLE_MULTIBUFFER
#define read_them_all TRUE
#else
#define read_them_all FALSE
#endif
#ifdef ENABLE_MOUSE
static int oldinterval = -1;
/* Used to store the user's original mouse click interval. */
@@ -63,8 +69,7 @@ static struct sigaction act;
static bool input_was_aborted = FALSE;
/* Whether reading from standard input was aborted via ^C. */
/* Create a new linestruct node. Note that we do not set prevnode->next
* to the new line. */
/* Create a new linestruct node. Note that we do not set prevnode->next. */
filestruct *make_new_node(filestruct *prevnode)
{
filestruct *newnode = nmalloc(sizeof(filestruct));
@@ -199,12 +204,7 @@ void renumber(filestruct *line)
partition *partition_filestruct(filestruct *top, size_t top_x,
filestruct *bot, size_t bot_x)
{
partition *p;
assert(top != NULL && bot != NULL && openfile->fileage != NULL && openfile->filebot != NULL);
/* Initialize the partition. */
p = (partition *)nmalloc(sizeof(partition));
partition *p = nmalloc(sizeof(partition));
/* If the top and bottom of the partition are different from the top
* and bottom of the buffer, save the latter and then set them
@@ -247,8 +247,6 @@ partition *partition_filestruct(filestruct *top, size_t top_x,
* to (filebot, $) again. */
void unpartition_filestruct(partition **p)
{
assert(p != NULL && openfile->fileage != NULL && openfile->filebot != NULL);
/* Reattach the line above the top of the partition, and restore the
* text before top_x from top_data. Free top_data when we're done
* with it. */
@@ -299,8 +297,6 @@ void extract_buffer(filestruct **file_top, filestruct **file_bot,
bool same_line = FALSE;
#endif
assert(file_top != NULL && file_bot != NULL && top != NULL && bot != NULL);
/* If (top, top_x)-(bot, bot_x) doesn't cover any text, get out. */
if (top == bot && top_x == bot_x)
return;
@@ -357,8 +353,8 @@ void extract_buffer(filestruct **file_top, filestruct **file_bot,
delete_node(openfile->fileage);
/* Renumber, starting with the line after the original file_bot. */
renumber(file_bot_save->next);
/* Renumber, starting at the last line of the original buffer. */
renumber(file_bot_save);
}
/* Since the text has now been saved, remove it from the buffer. */
@@ -412,8 +408,6 @@ void ingraft_buffer(filestruct *somebuffer)
bool right_side_up = FALSE, single_line = FALSE;
#endif
assert(somebuffer != NULL);
#ifndef NANO_TINY
/* Keep track of whether the mark begins inside the partition and
* will need adjustment. */
@@ -507,17 +501,17 @@ openfilestruct *make_new_opennode(void)
return (openfilestruct *)nmalloc(sizeof(openfilestruct));
}
#ifdef ENABLE_MULTIBUFFER
/* Unlink a node from the rest of the circular list, and delete it. */
void unlink_opennode(openfilestruct *fileptr)
{
assert(fileptr != fileptr->prev && fileptr != fileptr->next);
#ifdef ENABLE_MULTIBUFFER
if (fileptr == firstfile)
firstfile = firstfile->next;
fileptr->prev->next = fileptr->next;
fileptr->next->prev = fileptr->prev;
#endif
delete_opennode(fileptr);
}
@@ -534,6 +528,7 @@ void delete_opennode(openfilestruct *fileptr)
#endif
free(fileptr);
}
#endif
/* Display a warning about a key disabled in view mode. */
void print_view_warning(void)
@@ -591,69 +586,56 @@ void finish(void)
void die(const char *msg, ...)
{
va_list ap;
openfilestruct *firstone = openfile;
/* Switch on the cursor and leave curses mode. */
curs_set(1);
endwin();
/* Restore the old terminal settings. */
tcsetattr(0, TCSANOW, &oldterm);
/* Display the dying message. */
va_start(ap, msg);
vfprintf(stderr, msg, ap);
va_end(ap);
while (openfile) {
#ifndef NANO_TINY
/* If the current buffer has a lockfile, remove it. */
if (openfile && ISSET(LOCKING) && openfile->lock_filename)
delete_lockfile(openfile->lock_filename);
/* If the current buffer has a lockfile, remove it. */
if (ISSET(LOCKING) && openfile->lock_filename)
delete_lockfile(openfile->lock_filename);
#endif
/* If the current buffer was modified, ensure it is unpartitioned,
* then save it. When in restricted mode, we don't save anything,
* because it would write files not mentioned on the command line. */
if (openfile->modified && !ISSET(RESTRICTED)) {
if (filepart != NULL)
unpartition_filestruct(&filepart);
/* If the current file buffer was modified, save it. */
if (openfile && openfile->modified) {
/* If the buffer is partitioned, unpartition it first. */
if (filepart != NULL)
unpartition_filestruct(&filepart);
die_save_file(openfile->filename, openfile->current_stat);
}
#ifdef ENABLE_MULTIBUFFER
/* Save all of the other modified file buffers, if any. */
if (openfile != NULL) {
openfilestruct *firstone = openfile;
while (openfile->next != firstone) {
openfile = openfile->next;
#ifndef NANO_TINY
if (ISSET(LOCKING) && openfile->lock_filename)
delete_lockfile(openfile->lock_filename);
#endif
if (openfile->modified)
die_save_file(openfile->filename, openfile->current_stat);
emergency_save(openfile->filename, openfile->current_stat);
}
}
filepart = NULL;
#ifdef ENABLE_MULTIBUFFER
openfile = openfile->next;
#endif
if (openfile == firstone)
break;
}
/* Abandon the building. */
exit(1);
}
/* Save the current file under the name specified in die_filename, which
* is modified to be unique if necessary. */
void die_save_file(const char *die_filename, struct stat *die_stat)
/* Save the current buffer under the given name.
* If necessary, the name is modified to be unique. */
void emergency_save(const char *die_filename, struct stat *die_stat)
{
char *targetname;
bool failed = TRUE;
/* If we're using restricted mode, don't write any emergency backup
* files, since that would allow reading from or writing to files
* not specified on the command line. */
if (ISSET(RESTRICTED))
return;
/* If we can't save, we have really bad problems, but we might as
* well try. */
/* If the buffer has no name, simply call it "nano". */
if (*die_filename == '\0')
die_filename = "nano";
@@ -672,9 +654,8 @@ void die_save_file(const char *die_filename, struct stat *die_stat)
_("Too many backup files?"));
#ifndef NANO_TINY
/* Try and chmod/chown the save file to the values of the original file,
* but don't worry if it fails because we're supposed to be bailing as
* fast as possible. */
/* Try to chmod/chown the saved file to the values of the original file,
* but ignore any failure as we are in a hurry to get out. */
if (die_stat) {
IGNORE_CALL_RESULT(chmod(targetname, die_stat->st_mode));
IGNORE_CALL_RESULT(chown(targetname, die_stat->st_uid,
@@ -1164,8 +1145,8 @@ bool scoop_stdin(void)
}
/* Read the input into a new buffer. */
open_buffer("", FALSE);
read_file(stream, 0, "stdin", TRUE, FALSE);
open_buffer("", TRUE);
read_file(stream, 0, "stdin", TRUE);
openfile->edittop = openfile->fileage;
/* Reconnect the tty as the input source. */
@@ -1621,6 +1602,29 @@ int do_mouse(void)
}
#endif /* ENABLE_MOUSE */
/* Return TRUE when the given function is a cursor-moving command. */
bool wanted_to_move(void (*func)(void))
{
return func == do_left || func == do_right ||
func == do_up || func == do_down ||
func == do_home || func == do_end ||
func == do_prev_word_void || func == do_next_word_void ||
#ifdef ENABLE_JUSTIFY
func == do_para_begin_void || func == do_para_end_void ||
#endif
func == do_prev_block || func == do_next_block ||
func == do_page_up || func == do_page_down ||
func == to_first_line || func == to_last_line;
}
/* Return TRUE when the given shortcut is valid in view mode. */
bool okay_for_view(const sc *shortcut)
{
const subnfunc *func = sctofunc(shortcut);
return (func != NULL && func->viewok);
}
/* Read in a keystroke. Act on the keystroke if it is a shortcut or a toggle;
* otherwise, insert it into the edit buffer. If allow_funcs is FALSE, don't
* do anything with the keystroke -- just return it. */
@@ -1712,7 +1716,7 @@ int do_input(bool allow_funcs)
if (shortcut == NULL)
pletion_line = NULL;
else {
if (ISSET(VIEW_MODE) && !sctofunc(shortcut)->viewok) {
if (ISSET(VIEW_MODE) && !okay_for_view(shortcut)) {
print_view_warning();
return ERR;
}
@@ -1732,7 +1736,7 @@ int do_input(bool allow_funcs)
pletion_line = NULL;
#endif
#ifdef ENABLE_NANORC
if (shortcut->func == (void *)implant) {
if (shortcut->func == (functionptrtype)implant) {
implant(shortcut->expansion);
return 42;
}
@@ -1770,8 +1774,7 @@ int do_input(bool allow_funcs)
if (!shift_held && openfile->kind_of_mark == SOFTMARK &&
(openfile->current != was_current ||
openfile->current_x != was_x ||
(shortcut->func >= to_first_line &&
shortcut->func <= do_right))) {
wanted_to_move(shortcut->func))) {
openfile->mark = NULL;
refresh_needed = TRUE;
} else if (openfile->current != was_current)
@@ -1787,7 +1790,7 @@ int do_input(bool allow_funcs)
wrap_reset();
#endif
#ifdef ENABLE_COLOR
if (!refresh_needed && !sctofunc(shortcut)->viewok)
if (!refresh_needed && !okay_for_view(shortcut))
check_the_multis(openfile->current);
#endif
if (!refresh_needed && (shortcut->func == do_delete ||
@@ -1920,11 +1923,6 @@ int main(int argc, char **argv)
#ifdef ENABLE_WRAPPING
bool forced_wrapping = FALSE;
/* Should long lines be automatically hard wrapped? */
#endif
#ifdef ENABLE_MULTIBUFFER
bool is_multibuffer;
/* The actual value of the multibuffer option, restored after
* we've loaded all files given on the command line. */
#endif
const struct option long_options[] = {
{"boldtext", 0, NULL, 'D'},
@@ -2573,13 +2571,8 @@ int main(int argc, char **argv)
fprintf(stderr, "Main: open file\n");
#endif
#ifdef ENABLE_MULTIBUFFER
is_multibuffer = ISSET(MULTIBUFFER);
SET(MULTIBUFFER);
#endif
/* Read the files mentioned on the command line into new buffers. */
while (optind < argc && (!openfile || ISSET(MULTIBUFFER))) {
while (optind < argc && (!openfile || read_them_all)) {
ssize_t givenline = 0, givencol = 0;
/* If there's a +LINE[,COLUMN] argument here, eat it up. */
@@ -2591,10 +2584,10 @@ int main(int argc, char **argv)
/* If the filename is a dash, read from standard input; otherwise,
* open the file; skip positioning the cursor if either failed. */
if (strcmp(argv[optind], "-") == 0) {
optind++;
if (!scoop_stdin())
continue;
optind++;
} else if (!open_buffer(argv[optind++], FALSE))
} else if (!open_buffer(argv[optind++], TRUE))
continue;
/* If a position was given on the command line, go there. */
@@ -2614,15 +2607,12 @@ int main(int argc, char **argv)
* directories, then open a blank buffer and allow editing. Otherwise,
* switch from the last opened file to the next, that is: the first. */
if (openfile == NULL) {
open_buffer("", FALSE);
open_buffer("", TRUE);
UNSET(VIEW_MODE);
}
#ifdef ENABLE_MULTIBUFFER
else
openfile = openfile->next;
if (!is_multibuffer)
UNSET(MULTIBUFFER);
#endif
#ifdef DEBUG

View File

@@ -408,10 +408,12 @@ typedef struct openfilestruct {
colortype *colorstrings;
/* The file's associated colors. */
#endif
#ifdef ENABLE_MULTIBUFFER
struct openfilestruct *next;
/* The next open file, if any. */
struct openfilestruct *prev;
/* The preceding open file, if any. */
#endif
} openfilestruct;
#ifdef ENABLE_NANORC

View File

@@ -153,7 +153,7 @@ int do_statusbar_input(bool *finished)
shortcut->func == do_backspace))
;
#ifdef ENABLE_NANORC
else if (shortcut->func == (void *)implant)
else if (shortcut->func == (functionptrtype)implant)
implant(shortcut->expansion);
#endif
else if (shortcut->func == do_verbatim_input)
@@ -171,7 +171,7 @@ int do_statusbar_input(bool *finished)
/* Handle any other shortcut in the current menu, setting finished
* to TRUE to indicate that we're done after running or trying to
* run its associated function. */
if (!ISSET(VIEW_MODE) || sctofunc(shortcut)->viewok)
if (!ISSET(VIEW_MODE) || okay_for_view(shortcut))
shortcut->func();
*finished = TRUE;
}
@@ -187,27 +187,25 @@ void do_statusbar_output(int *the_input, size_t input_len,
{
char *output = charalloc(input_len + 1);
char onechar[MAXCHARLEN];
int i, char_len;
size_t char_len, i, j = 0;
/* Copy the typed stuff so it can be treated. */
for (i = 0; i < input_len; i++)
output[i] = (char)the_input[i];
output[i] = '\0';
i = 0;
while (i < input_len) {
while (j < input_len) {
/* Encode any NUL byte as 0x0A. */
if (output[i] == '\0')
output[i] = '\n';
if (output[j] == '\0')
output[j] = '\n';
/* Interpret the next multibyte character. */
char_len = parse_mbchar(output + i, onechar, NULL);
char_len = parse_mbchar(output + j, onechar, NULL);
i += char_len;
j += char_len;
/* When filtering, skip any ASCII control character. */
if (filtering && is_ascii_cntrl_char(*(output + i - char_len)))
if (filtering && is_ascii_cntrl_char(*(output + j - char_len)))
continue;
/* Insert the typed character into the existing answer string. */

View File

@@ -267,7 +267,7 @@ void do_uncut_text(void);
/* Most functions in files.c. */
void initialize_buffer_text(void);
void set_modified(void);
bool open_buffer(const char *filename, bool undoable);
bool open_buffer(const char *filename, bool new_buffer);
#ifdef ENABLE_SPELLER
void replace_buffer(const char *filename);
#ifndef NANO_TINY
@@ -281,8 +281,7 @@ void switch_to_prev_buffer(void);
void switch_to_next_buffer(void);
bool close_buffer(void);
#endif
void read_file(FILE *f, int fd, const char *filename, bool undoable,
bool checkwritable);
void read_file(FILE *f, int fd, const char *filename, bool undoable);
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
char *get_next_filename(const char *name, const char *suffix);
void do_insertfile_void(void);
@@ -386,11 +385,9 @@ void do_prev_word_void(void);
void do_next_word_void(void);
void do_home(void);
void do_end(void);
void do_up(bool scroll_only);
void do_down(bool scroll_only);
void do_up_void(void);
void do_down_void(void);
#ifndef NANO_TINY
void do_up(void);
void do_down(void);
#ifdef ENABLE_HELP
void do_scroll_up(void);
void do_scroll_down(void);
#endif
@@ -413,8 +410,10 @@ void extract_buffer(filestruct **file_top, filestruct **file_bot,
void ingraft_buffer(filestruct *somebuffer);
void copy_from_buffer(filestruct *somebuffer);
openfilestruct *make_new_opennode(void);
#ifdef ENABLE_MULTIBUFFER
void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
#endif
void print_view_warning(void);
void show_restricted_warning(void);
#ifndef ENABLE_HELP
@@ -422,7 +421,7 @@ void say_there_is_no_help(void);
#endif
void finish(void);
void die(const char *msg, ...);
void die_save_file(const char *die_filename, struct stat *die_stat);
void emergency_save(const char *die_filename, struct stat *die_stat);
void window_init(void);
void do_exit(void);
void close_and_go(void);
@@ -441,6 +440,7 @@ void disable_flow_control(void);
void enable_flow_control(void);
void terminal_init(void);
void unbound_key(int code);
bool okay_for_view(const sc *shortcut);
int do_input(bool allow_funcs);
void do_output(char *output, size_t output_len, bool allow_cntrls);
@@ -661,7 +661,7 @@ bool line_needs_update(const size_t old_column, const size_t new_column);
int go_back_chunks(int nrows, filestruct **line, size_t *leftedge);
int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge);
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
void edit_scroll(bool direction, int nrows);
void edit_scroll(bool direction);
#ifndef NANO_TINY
size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
bool *end_of_line);

View File

@@ -413,7 +413,7 @@ void parse_binding(char *ptr, bool dobind)
* otherwise it is the name of a function. */
if (*funcptr == '"') {
newsc = nmalloc(sizeof(sc));
newsc->func = (void *)implant;
newsc->func = (functionptrtype)implant;
newsc->expansion = mallocstrcpy(NULL, funcptr + 1);
#ifndef NANO_TINY
newsc->toggle = 0;
@@ -449,7 +449,7 @@ void parse_binding(char *ptr, bool dobind)
#endif
#ifdef ENABLE_NANORC
/* Handle the special case of a key defined as a string. */
if (newsc->func == (void *)implant)
if (newsc->func == (functionptrtype)implant)
mask = MMOST | MHELP;
#endif
/* Now limit the given menu to those where the function exists. */
@@ -602,9 +602,11 @@ short color_to_short(const char *colorname, bool *bright)
return COLOR_MAGENTA;
else if (strcasecmp(colorname, "black") == 0)
return COLOR_BLACK;
else if (strcasecmp(colorname, "normal") == 0)
return -1;
rcfile_error(N_("Color \"%s\" not understood"), colorname);
return -1;
return -2;
}
/* Parse the color string in the line at ptr, and add it to the current
@@ -753,11 +755,14 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
*fg = color_to_short(combostr, bright);
/* If the specified foreground color is bad, ignore the regexes. */
if (*fg == -1)
if (*fg == -2)
return FALSE;
} else
*fg = -1;
if (*bg == -2)
*bg = -1;
return TRUE;
}

View File

@@ -840,11 +840,11 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
filestruct *line = openfile->current;
filestruct *currentline = openfile->current;
size_t leftedge = leftedge_for(xplustabs(), openfile->current);
rows_from_tail = (editwinrows / 2) -
go_forward_chunks(editwinrows / 2, &line, &leftedge);
rows_from_tail = (editwinrows / 2) - go_forward_chunks(
editwinrows / 2, &currentline, &leftedge);
} else
#endif
rows_from_tail = openfile->filebot->lineno -

View File

@@ -1149,7 +1149,7 @@ bool execute_command(const char *command)
if (f == NULL)
nperror("fdopen");
read_file(f, 0, "stdin", TRUE, FALSE);
read_file(f, 0, "stdin", TRUE);
if (wait(NULL) == -1)
nperror("wait");
@@ -1184,6 +1184,7 @@ void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep)
free(group);
group = next;
}
free(dropit);
dropit = thefile->undotop;
}
@@ -1505,7 +1506,7 @@ bool do_wrap(filestruct *line)
/* The length of the remainder. */
size_t old_x = openfile->current_x;
filestruct * old_line = openfile->current;
filestruct *old_line = openfile->current;
/* There are three steps. First, we decide where to wrap. Then, we
* create the new wrap line. Finally, we clean up. */
@@ -3197,75 +3198,77 @@ void do_linter(void)
while (TRUE) {
int kbinput;
functionptrtype func;
struct stat lintfileinfo;
if (stat(curlint->filename, &lintfileinfo) != -1 &&
openfile->current_stat->st_ino != lintfileinfo.st_ino) {
openfilestruct *tmpof = 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
char *msg = charalloc(1024 + strlen(curlint->filename));
int i;
sprintf(msg, _("This message is for unopened file %s,"
" open it in a new buffer?"), curlint->filename);
i = do_yesno_prompt(FALSE, msg);
free(msg);
if (i == -1) {
statusbar(_("Cancelled"));
goto free_lints_and_return;
} else if (i == 1) {
open_buffer(curlint->filename, TRUE);
} else {
#endif
char *dontwantfile = mallocstrcpy(NULL, curlint->filename);
lintstruct *restlint = NULL;
while (curlint != NULL) {
if (strcmp(curlint->filename, dontwantfile) == 0) {
if (curlint == lints)
lints = curlint->next;
else
curlint->prev->next = curlint->next;
if (curlint->next != NULL)
curlint->next->prev = curlint->prev;
tmplint = curlint;
curlint = curlint->next;
free(tmplint->msg);
free(tmplint->filename);
free(tmplint);
} else {
if (restlint == NULL)
restlint = curlint;
curlint = curlint->next;
}
}
if (restlint == NULL) {
statusbar(_("No more errors in unopened files, cancelling"));
napms(2400);
break;
} else {
curlint = restlint;
continue;
}
free(dontwantfile);
}
#ifdef ENABLE_MULTIBUFFER
} else
openfile = tmpof;
#endif
}
if (tmplint != curlint) {
#ifndef NANO_TINY
struct stat lintfileinfo;
new_lint_loop:
if (stat(curlint->filename, &lintfileinfo) != -1) {
if (openfile->current_stat->st_ino != lintfileinfo.st_ino) {
openfilestruct *tmpof = openfile;
while (tmpof != openfile->next) {
if (tmpof->current_stat->st_ino == lintfileinfo.st_ino)
break;
tmpof = tmpof->next;
}
if (tmpof->current_stat->st_ino != lintfileinfo.st_ino) {
char *msg = charalloc(1024 + strlen(curlint->filename));
int i;
sprintf(msg, _("This message is for unopened file %s,"
" open it in a new buffer?"),
curlint->filename);
i = do_yesno_prompt(FALSE, msg);
free(msg);
if (i == -1) {
statusbar(_("Cancelled"));
goto free_lints_and_return;
} else if (i == 1) {
SET(MULTIBUFFER);
open_buffer(curlint->filename, FALSE);
} else {
char *dontwantfile = mallocstrcpy(NULL, curlint->filename);
lintstruct *restlint = NULL;
while (curlint != NULL) {
if (strcmp(curlint->filename, dontwantfile) == 0) {
if (curlint == lints)
lints = curlint->next;
else
curlint->prev->next = curlint->next;
if (curlint->next != NULL)
curlint->next->prev = curlint->prev;
tmplint = curlint;
curlint = curlint->next;
free(tmplint->msg);
free(tmplint->filename);
free(tmplint);
} else {
if (restlint == NULL)
restlint = curlint;
curlint = curlint->next;
}
}
if (restlint == NULL) {
statusbar(_("No more errors in unopened files, cancelling"));
napms(2400);
break;
} else {
curlint = restlint;
goto new_lint_loop;
}
free(dontwantfile);
}
} else
openfile = tmpof;
}
}
#endif /* !NANO_TINY */
goto_line_posx(curlint->lineno, curlint->colno - 1);
titlebar(NULL);
adjust_viewport(CENTERING);
@@ -3307,7 +3310,7 @@ void do_linter(void)
wipe_statusbar();
#ifndef NANO_TINY
#ifdef ENABLE_MULTIBUFFER
free_lints_and_return:
#endif
for (curlint = lints; curlint != NULL;) {
@@ -3577,8 +3580,8 @@ char *copy_completion(char *check_line, int start)
void complete_a_word(void)
{
char *shard, *completion = NULL;
int start_of_shard, shard_length = 0;
int i = 0, j = 0;
size_t start_of_shard, shard_length = 0;
size_t i = 0, j = 0;
completion_word *some_word;
#ifdef ENABLE_WRAPPING
bool was_set_wrapping = !ISSET(NO_WRAP);

View File

@@ -456,7 +456,7 @@ size_t strnlenpt(const char *text, size_t maxlen)
return 0;
while (*text != '\0') {
int charlen = parse_mbchar(text, NULL, &width);
size_t charlen = parse_mbchar(text, NULL, &width);
if (maxlen <= charlen)
break;

View File

@@ -1973,6 +1973,7 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
return converted;
}
#ifdef ENABLE_MULTIBUFFER
/* Determine the sequence number of the given buffer in the circular list. */
int buffer_number(openfilestruct *buffer)
{
@@ -1985,6 +1986,7 @@ int buffer_number(openfilestruct *buffer)
return count;
}
#endif
/* If path is NULL, we're in normal editing mode, so display the current
* version of nano, the current filename, and whether the current file
@@ -2030,6 +2032,7 @@ void titlebar(const char *path)
else
#endif
if (!inhelp) {
#ifdef ENABLE_MULTIBUFFER
/* If there are/were multiple buffers, show which out of how many. */
if (more_than_one) {
indicator = charalloc(24);
@@ -2037,6 +2040,7 @@ void titlebar(const char *path)
buffer_number(firstfile->prev));
upperleft = indicator;
} else
#endif
upperleft = BRANDING;
if (openfile->filename[0] == '\0')
@@ -2912,57 +2916,42 @@ bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge)
return (openfile->current->lineno - was_lineno < editwinrows);
}
/* Scroll the edit window in the given direction and the given number of rows,
* and draw new lines on the blank lines left after the scrolling. */
void edit_scroll(bool direction, int nrows)
/* Scroll the edit window one row in the given direction, and
* draw the relevant content on the resultant blank row. */
void edit_scroll(bool direction)
{
filestruct *line;
size_t leftedge;
int remainder = 0, nrows = 1;
/* Part 1: nrows is the number of rows we're going to scroll the text of
* the edit window. */
/* Move the top line of the edit window the requested number of rows up or
* down, and reduce the number of rows with the amount we couldn't move. */
/* Move the top line of the edit window one row up or down. */
if (direction == BACKWARD)
nrows -= go_back_chunks(nrows, &openfile->edittop, &openfile->firstcolumn);
remainder = go_back_chunks(1, &openfile->edittop, &openfile->firstcolumn);
else
nrows -= go_forward_chunks(nrows, &openfile->edittop, &openfile->firstcolumn);
remainder = go_forward_chunks(1, &openfile->edittop, &openfile->firstcolumn);
/* Don't bother scrolling zero rows, nor more than the window can hold. */
if (nrows == 0) {
if (remainder > 0) {
#ifndef NANO_TINY
statusline(ALERT, "Underscrolling -- please report a bug");
statusline(ALERT, "Could not scroll -- please report a bug");
#endif
return;
}
if (nrows >= editwinrows) {
#ifndef NANO_TINY
if (editwinrows > 1)
statusline(ALERT, "Overscrolling -- please report a bug");
#endif
refresh_needed = TRUE;
return;
}
/* Scroll the text of the edit window a number of rows up or down. */
/* Actually scroll the text of the edit window one row up or down. */
scrollok(edit, TRUE);
wscrl(edit, (direction == BACKWARD) ? -nrows : nrows);
wscrl(edit, (direction == BACKWARD) ? -1 : 1);
scrollok(edit, FALSE);
/* Part 2: nrows is now the number of rows in the scrolled region of the
* edit window that we need to draw. */
/* If we're not on the first "page" (when not softwrapping), or the mark
* is on, the row next to the scrolled region needs to be redrawn too. */
if (line_needs_update(openfile->placewewant, 0) && nrows < editwinrows)
nrows++;
/* If we scrolled backward, start on the first line of the blank region. */
/* If we scrolled backward, the top row needs to be redrawn. */
line = openfile->edittop;
leftedge = openfile->firstcolumn;
/* If we scrolled forward, move down to the start of the blank region. */
/* If we scrolled forward, the bottom row needs to be redrawn. */
if (direction == FORWARD)
go_forward_chunks(editwinrows - nrows, &line, &leftedge);
@@ -2977,8 +2966,8 @@ void edit_scroll(bool direction, int nrows)
}
#endif
/* Draw new content on the blank rows inside the scrolled region
* (and on the bordering row too when it was deemed necessary). */
/* Draw new content on the blank row (and on the bordering row too
* when it was deemed necessary). */
while (nrows > 0 && line != NULL) {
nrows -= update_line(line, (line == openfile->current) ?
openfile->current_x : 0);

View File

@@ -8,7 +8,7 @@ icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comm
# Keywords
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|trimblanks|unix|view|wordbounds)\>"
icolor yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
icolor yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+"
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
@@ -20,7 +20,7 @@ icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|
color brightmagenta "".+"([[:space:]]|$)"
# Colors
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
# Comments

View File

@@ -6,13 +6,21 @@ magic "(POSIX|Bourne-Again) shell script.*text"
linter dash -n
comment "#"
icolor brightgreen "^[0-9A-Z_]+\(\)"
# Function declarations.
color brightgreen "^[A-Za-z0-9_-]+\(\)"
# Keywords, symbols, and comparisons.
color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"
color green "\<(declare|eval|exec|export|let|local)\>"
color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
color green "-[Ldefgruwx]\>"
color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|echo|env|grep|install|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|tar|touch|umask|unset)\>"
color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"
# Short and long options.
color brightmagenta "-[A-Za-z]\>" "--[A-Za-z-]+\>"
# Common commands.
color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|cut|echo|env|grep|head|install|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|sort|tail|tar|touch|umask|unset)\>"
color normal "[.-]tar\>"
# Basic variable names (no braces).
color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*"