Compare commits

..

49 Commits

Author SHA1 Message Date
Benno Schulenberg
3db2beefd3 po: regenerate POT file and PO files 2017-05-21 10:57:12 +02:00
Benno Schulenberg
5907f8801b bump version numbers and add a news item for the 2.8.4 release 2017-05-21 10:21:03 +02:00
Benno Schulenberg
c68398f18f syntax: php: color "static" again as "function", like it used to be 2017-05-21 10:11:42 +02:00
Benno Schulenberg
d653aeab93 syntax: default: color also hash comments and email addresses 2017-05-19 21:09:15 +02:00
Benno Schulenberg
491e02f532 tweaks: reorder three items in the Info document 2017-05-19 21:09:02 +02:00
Benno Schulenberg
f1a47a2aae tweaks: reshuffle a few things to reduce duplication
It is no longer necessary to assign up() and down() separately for
the help viewer because by now the movement keys have been sorted
in order of ascending stride also in the main menu.

The two string definitions are relocated just to reduce the number
of #ifdefs.
2017-05-19 17:57:39 +02:00
Benno Schulenberg
7b23878b42 tweaks: do actual screen refreshes in a single call, when possible 2017-05-19 16:31:08 +02:00
Benno Schulenberg
5cdadc3eb1 tweaks: avoid an unused-variable warning when using --disable-comment 2017-05-19 11:55:37 +02:00
Benno Schulenberg
8f89e23adb tweaks: adjust the indentation after the preceding change
Also, change two error messages a bit.
2017-05-19 11:47:13 +02:00
Benno Schulenberg
8302ff700b tweaks: remove the no-op x$disable tests 2017-05-19 11:47:13 +02:00
Benno Schulenberg
a32d21c759 build: correct the inverted logic for the nanorc man page
All this "not is no" has me turning around in circles
at least ten times before I know which side is which.

This fixes https://savannah.gnu.org/bugs/?51061
Reported-by: Vicente Olivert Riera <vincent.riera@imgtec.com>
2017-05-19 11:46:18 +02:00
Benno Schulenberg
f8214440c2 gnulib: update to its current state 2017-05-18 20:09:04 +02:00
Benno Schulenberg
c1b08302df po: update translations and regenerate POT file and PO files 2017-05-18 14:27:00 +02:00
Benno Schulenberg
afd8a4e804 bump version numbers and add a news item for the 2.8.3 release 2017-05-18 11:53:19 +02:00
Benno Schulenberg
88b740179a tweaks: rewrap a couple of old items in NEWS, and fix an article
Also fix a URL that mistaken points to a specific bug.
2017-05-18 11:02:16 +02:00
Benno Schulenberg
9ce41543ed startup: don't call delwin() with NULL, to avoid crashing on Solaris
Apparently the curses on SunOS is less forgiving than the one on GNU.
Or rather: delwin(NULL) should just return an error, it shouldn't crash.

This fixes https://savannah.gnu.org/bugs/?51053.
Reported-by: John Wiersba <jrw32982@yahoo.com>
Solved-by: John Wiersba <jrw32982@yahoo.com>
2017-05-18 10:26:11 +02:00
Benno Schulenberg
e4775c2060 syntax: php: color also variable names, and color more reserved words
Most of the keywords listed on the following URL are now highlighted:
  http://php.net/manual/en/reserved.keywords.php

Also color single-quoted strings, and require that //-type comments
are preceded by whitespace or are alone on a line.

With-feedback-from: M <taur@mail.com>
2017-05-18 10:03:43 +02:00
Benno Schulenberg
cd7c3483b4 build: for Solaris, tell the linker where to find clock_gettime()
This fixes https://savannah.gnu.org/bugs/?50972.
Reported-by: John Wiersba <jrw32982@yahoo.com>
2017-05-17 10:53:21 +02:00
Benno Schulenberg
8075e454a9 history: don't save the cursor position for temporary help files
It's useless, because the position doesn't get restored, and it
cannot be restored because the name is different every time.
2017-05-17 10:48:04 +02:00
Benno Schulenberg
93b1c1bea6 files: don't ask "save anyway" when user orders to discard the buffer
This extra question was included upon Chris' request, but I find it
confusing and angering.
2017-05-16 22:14:45 +02:00
Benno Schulenberg
aa14526cb3 tweaks: exclude from the tiny version five error-betraying messages 2017-05-16 22:13:10 +02:00
Benno Schulenberg
d29d49aece tweaks: remove an old fault-catching message 2017-05-16 20:09:03 +02:00
Benno Schulenberg
e8f90789e9 tweaks: exclude from the tiny version two messages that will never occur 2017-05-16 20:00:42 +02:00
Benno Schulenberg
c830b8f51c syntax: php: recognize also the .phtml and .php7 extensions
(And in the bargain sort or group some of the keywords.)

This addresses https://savannah.gnu.org/patch/?9342.
Suggested-by: M <taur@mail.com>
2017-05-15 10:57:57 +02:00
Benno Schulenberg
28beb3f9c5 replacing: don't let placewewant influence the placement of the cursor
When spotlighting the string to be replaced, placewewant isn't valid,
so tell place_the_cursor() to ignore its value to avoid the cursor
getting mistakenly placed at the beginning of the next row.

This fixes https://savannah.gnu.org/bugs/?50997.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-05-11 22:28:34 +02:00
Benno Schulenberg
08fd5b349b moving: limit the target column when it is beyond the last chunk
When the column given in gotoline() is beyond the last available
column in the row of the last chunk, then set placewewant to the
actual end of the chunk, to prevent surprising jumps to the left
when moving up or down from there.

This fixes https://savannah.gnu.org/bugs/?50995.
2017-05-11 21:00:37 +02:00
Benno Schulenberg
6971db773b tweaks: swap a comparison, to be clearer 2017-05-11 10:28:43 +02:00
Benno Schulenberg
c620fc6aa9 build: use backticks to avoid a warning during autoreconf 2017-05-09 20:23:04 +02:00
Benno Schulenberg
7e09f2c64a syntax: makefile: color comments only at start of line or after whitespace 2017-05-09 17:37:05 +02:00
Benno Schulenberg
968c07fc81 build: use the "force" mechanism to always run the revision rule
Whenever 'make' is run, it should check whether the revision has
changed, and if so, it should update src/revision.h.

This portable FORCE mechanism should have been the replacement for
the phony target that was removed in a33a4f00, five commits ago.

This fixes https://savannah.gnu.org/bugs/?50956 in a better way.
2017-05-09 17:30:49 +02:00
Benno Schulenberg
858e75e4cf tweaks: transform the token DISABLE_NANORC to ENABLE_NANORC
Also, allow rebinding the word and block jumping functions
in the tiny version when nanorc files are reenabled.
2017-05-09 11:59:34 +02:00
Benno Schulenberg
a05180ed2d tweaks: transform the token DISABLE_TABCOMP to ENABLE_TABCOMP 2017-05-09 11:31:54 +02:00
Benno Schulenberg
00533854c0 tweaks: fix compilation with --enable-tiny ...-help and ...-multibuffer
(This should have been part of 9ea5eef2, four commits ago.)
2017-05-08 22:01:34 +02:00
Benno Schulenberg
dc3610fc8e tweaks: transform the token DISABLE_BROWSER to ENABLE_BROWSER
Also, allow Ctrl+Left/Right with --enable-tiny --enable-browser.
2017-05-08 21:56:50 +02:00
Benno Schulenberg
a33a4f00e5 build: don't use a dummy dependency, as it breaks non-GNU makes
This fixes https://savannah.gnu.org/bugs/?50956.
Reported-by: John Wiersba <jrw32982@yahoo.com>
2017-05-08 21:27:07 +02:00
Benno Schulenberg
509b091c47 tweaks: rename three empty functions, and reshuffle some others
Also remove a superfluous check for 'do_replace' -- it never gets
bound in the Search/Replace menus.
2017-05-08 14:33:18 +02:00
Benno Schulenberg
9ea5eef200 bindings: allow toggling a new buffer when multiple buffers are enabled
When configured with --enable-tiny --enable-multibuffer,
/do/ include the new-buffer toggle in the Read-File menu.
2017-05-08 13:36:57 +02:00
Benno Schulenberg
e701bb01aa tweaks: remove five dummy function definitions from the tiny version 2017-05-08 13:04:26 +02:00
Benno Schulenberg
a3102cd4cf syntax: xml: recognize an XML file also by its first line
Some .rdf files are XML, but the .rdf extension seems to be used
also for other things.  So... use the 'header' mechanism.
2017-05-07 20:02:20 +02:00
Benno Schulenberg
da67883508 syntax: nanohelp: color also ^6 as a shortcut keystroke
(Hadn't seen that one because of my additional bindings.)
2017-05-07 20:00:52 +02:00
David Lawrence Ramsey
03c3e2b7c0 tweaks: fix several whitespace irregularities
Add missing spaces, remove excess spaces, and
replace groups of indentation spaces with tabs.
2017-05-07 18:20:01 +02:00
Benno Schulenberg
4953dcec20 tweaks: add another warning for an impossible condition 2017-05-05 22:00:04 +02:00
Benno Schulenberg
f5155786e1 tweaks: adjust whitespace and comments after the preceding change 2017-05-05 21:54:23 +02:00
Benno Schulenberg
a9abc3d95f chars: optimize moving a character left in the non-UTF-8 case
When not in a UTF-8 locale, each character is just a single byte.
2017-05-05 21:40:00 +02:00
Benno Schulenberg
09cabcad5d chars: probe for a valid UTF-8 starter byte, instead of overstepping
Instead of always stepping back four bytes and then tentatively
moving forward again (which is wasteful when most codes are just
one or two bytes long), inspect the preceding bytes one by one
and begin the move forward at the first valid starter byte.

This reduces the backwards searching time by close to 40 percent.
2017-05-05 21:36:45 +02:00
Benno Schulenberg
f162a6a2ab chars: valid UTF-8 codes are at most 4 bytes long, so look only that far
This reduces the backwards searching time by a good 20 percent.
2017-05-05 21:34:23 +02:00
Benno Schulenberg
5a3de7f117 tweaks: avoid an empty function call in tiny version with line numbers 2017-05-05 12:39:20 +02:00
Benno Schulenberg
7b5cc1dcda display: keep the cursor put, also when toggling nohelp or morespace
Also when toggling the help lines back on or the extra editing space
back off, keep the cursor near the bottom of the screen if it /was/
there, instead of centering it -- if smooth scrolling is on, that is.

This supplements the fix for https://savannah.gnu.org/bugs/?50933.
2017-05-05 12:37:45 +02:00
David Lawrence Ramsey
2b38547875 display: ensure smooth scrolling when the edit window is resized
When the editing space gets narrower, either by toggling line numbers on
or making nano's window smaller, and when the cursor is near the bottom,
it can be pushed offscreen.  In that case, don't get it back onscreen by
centering the current line but by putting it on the bottom row.  This
makes for a smoother experience.

This fixes http://savannah.gnu.org/bugs/?50933.
2017-05-05 12:31:02 +02:00
65 changed files with 13520 additions and 13488 deletions

View File

@@ -1,3 +1,64 @@
Changes between v2.8.3 and v2.8.4:
----------------------------------
Benno Schulenberg (11):
build: correct the inverted logic for the nanorc man page
bump version numbers and add a news item for the 2.8.4 release
gnulib: update to its current state
syntax: default: color also hash comments and email addresses
syntax: php: color "static" again as "function", like it used to be
tweaks: adjust the indentation after the preceding change
tweaks: avoid an unused-variable warning when using --disable-comment
tweaks: do actual screen refreshes in a single call, when possible
tweaks: remove the no-op x$disable tests
tweaks: reorder three items in the Info document
tweaks: reshuffle a few things to reduce duplication
Changes between v2.8.2 and v2.8.3:
----------------------------------
Benno Schulenberg (34):
bindings: allow toggling a new buffer when multiple buffers are enabled
build: don't use a dummy dependency, as it breaks non-GNU makes
build: for Solaris, tell the linker where to find clock_gettime()
build: use backticks to avoid a warning during autoreconf
build: use the "force" mechanism to always run the revision rule
bump version numbers and add a news item for the 2.8.3 release
chars: optimize moving a character left in the non-UTF-8 case
chars: probe for a valid UTF-8 starter byte, instead of overstepping
chars: valid UTF-8 codes are at most 4 bytes long, so look only that far
display: keep the cursor put, also when toggling nohelp or morespace
files: don't ask "save anyway" when user orders to discard the buffer
history: don't save the cursor position for temporary help files
moving: limit the target column when it is beyond the last chunk
replacing: don't let placewewant influence the placement of the cursor
startup: don't call delwin() with NULL, to avoid crashing on Solaris
syntax: makefile: color comments only at start of line or after whitespace
syntax: nanohelp: color also ^6 as a shortcut keystroke
syntax: php: color also variable names, and color more reserved words
syntax: php: recognize also the .phtml and .php7 extensions
syntax: xml: recognize an XML file also by its first line
tweaks: add another warning for an impossible condition
tweaks: adjust whitespace and comments after the preceding change
tweaks: avoid an empty function call in tiny version with line numbers
tweaks: exclude from the tiny version five error-betraying messages
tweaks: exclude from the tiny version two messages that will never occur
tweaks: fix compilation with --enable-tiny ...-help and ...-multibuffer
tweaks: remove an old fault-catching message
tweaks: remove five dummy function definitions from the tiny version
tweaks: rename three empty functions, and reshuffle some others
tweaks: rewrap a couple of old items in NEWS, and fix an article
tweaks: swap a comparison, to be clearer
tweaks: transform the token DISABLE_BROWSER to ENABLE_BROWSER
tweaks: transform the token DISABLE_NANORC to ENABLE_NANORC
tweaks: transform the token DISABLE_TABCOMP to ENABLE_TABCOMP
David Lawrence Ramsey (2):
display: ensure smooth scrolling when the edit window is resized
tweaks: fix several whitespace irregularities
Changes between v2.8.1 and v2.8.2:
----------------------------------

60
NEWS
View File

@@ -1,3 +1,11 @@
2017.05.21 - GNU nano 2.8.4 includes the nanorc man page again.
2017.05.18 - GNU nano 2.8.3 "Hirsch" fixes a misplacement of the spotlight
during interactive replacing, avoids build failures on AIX
and Solaris, fixes a crash on Solaris, speeds up backwards
searching, improves PHP syntax highlighting, and no longer
asks “save anyway?” when the user ^Q discards the buffer.
2017.05.04 - GNU nano 2.8.2 "Krats" adds another new feature: it makes
the ^G help texts searchable with ^W. Apart from that,
it fixes a crash when resizing the window in the middle
@@ -266,13 +274,12 @@
handling of --tempfile mode, and better handling of
command line arguments when also attempting to specify
+<line number>. As always, please file any bugs you
find at the Savannah page for nano, at
https://savannah.gnu.org/bugs/index.php?42639 and
thanks for using nano.
find via https://savannah.gnu.org/bugs/?group=nano
and thanks for using nano.
2014.06.02 - GNU nano 2.3.4 won't leave you high, won't leave you dry. This
release contains only a small number of fixes, but in
particular allows nano to compile on non-UTF-8 curses
2014.06.02 - GNU nano 2.3.4 won't leave you high, won't leave you dry.
This release contains only a small number of fixes, but
in particular allows nano to compile on non-UTF-8 curses
implementations (i.e. libncursesw). Other small fixes to
the undo implementation and the default syntax config are
also included. As always, Share and Enjoy!
@@ -532,16 +539,16 @@
an internal error occurs in the undo code, and fixes for
various combinations of configure-time options and
compiler flags. Also included is new support for
changing the rc file name at configure time, and
using GNU-style regexes for word-boundaries on systems
which do not support them natively, as well as the ever
popular translation updates. Rock the tarball.
changing the rc file name at configure time, and using
GNU-style regexes for word-boundaries on systems which
do not support them natively, as well as the ever popular
translation updates. Rock the tarball.
2008.08.09 - GNU nano 2.1.4 "I told you so!" is released. This release
includes fixes for several severe issues with the new
undo/redo code. Also the behavior of writing
files when using backup mode has changed as well: if writing
the backup file fails, nano will not attempt to write the
undo/redo code. Also the behavior of writing files when
using backup mode has changed as well: if writing the
backup file fails, nano will not attempt to write the
current file. This should help folks who enjoy "extreme
text editing", i.e. editing files on file systems which
are likely to run out of space; see Savannah bug #24000.
@@ -1247,28 +1254,27 @@
Have fun with it.
2001.03.22 - GNU Nano 1.0 is released! The autoindent wrapping bug
has been fixed, as well as strange bug when using Pico
has been fixed, as well as a strange bug when using Pico
mode and regex search. There have also been some minor
spelling and documentation updates. As stated on the
website, there are currently no known bugs with nano,
but some will pop up eventually and they will be
addressed in subsequent releases. We hope you enjoy
this first stable release of nano, and as always,
feedback is welcome! nano@nano-editor.org.
feedback is welcome! <nano@nano-editor.org>
2001.02.19 - Nano 0.9.99pre3 brings a lot of changes! The most
important being that nano is now officially a GNU
program. Some changes have been made for GNU
compatibility (like the default list of shortcuts, "^G
Get Help" is now listed and "^_ Goto Line" is not). The
Yes/No/All keys have finally been internationalized
also. All in all, quite a few changes, considering nano
is supposed to be in a code freeze. But there are the
usual helping of bugfixes, a nasty bug when cutting text
in -k mode and some compatibility issues with older
ncurses libraries have also been fixed. All in all, a
lot to see.
2001.02.19 - Nano 0.9.99pre3 brings a lot of changes! The most important
being that nano is now officially a GNU program. Some
changes have been made for GNU compatibility (like in the
default list of shortcuts: "^G Get Help" is now listed
and "^_ Goto Line" is not). The Yes/No/All keys have
finally been internationalized also. All in all, quite
a few changes, considering nano is supposed to be in
a code freeze. But there are the usual helping of
bugfixes, a nasty bug when cutting text in -k mode and
some compatibility issues with older ncurses libraries
have also been fixed. All in all, a lot to see.
2001.01.31 - Nano 0.9.99pre2 is released. Not surprisingly, all that is
new is bugfixes, bugfixes, bugfixes. There were a few

View File

@@ -2,7 +2,7 @@
# Generate configure & friends for GIT users.
gnulib_url="git://git.sv.gnu.org/gnulib.git"
gnulib_hash="3eee3a1e3c5b8883e0d4934bfc1326ee605cb7c1"
gnulib_hash="4be488081b917f98a2fd3e2766324043649cca6e"
modules="
futimens

View File

@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
AC_INIT([GNU nano], [2.8.2], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [2.8.4], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.14])
@@ -64,8 +64,13 @@ dnl Checks for options.
AC_ARG_ENABLE(browser,
AS_HELP_STRING([--disable-browser], [Disable the built-in file browser]))
if test "x$enable_browser" = xno; then
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
if test "x$enable_tiny" = xyes; then
if test "x$enable_browser" != xyes; then
enable_browser=no
fi
fi
if test "x$enable_browser" != xno; then
AC_DEFINE(ENABLE_BROWSER, 1, [Define this to enable the built-in file browser.])
fi
AC_ARG_ENABLE(color,
@@ -93,10 +98,8 @@ if test "x$enable_tiny" = xyes; then
enable_comment=no
fi
fi
if test "x$disable_comment" != xyes; then
if test "x$enable_comment" != xno; then
AC_DEFINE(ENABLE_COMMENT, 1, [Define this to enable the comment/uncomment function.])
fi
if test "x$enable_comment" != xno; then
AC_DEFINE(ENABLE_COMMENT, 1, [Define this to enable the comment/uncomment function.])
fi
AC_ARG_ENABLE(extra,
@@ -110,7 +113,7 @@ AS_HELP_STRING([--disable-help], [Disable the built-in help texts]))
if test "x$enable_tiny" = xyes; then
if test "x$enable_help" = xyes; then
if test "x$enable_multibuffer" != xyes; then
AC_MSG_ERROR([--enable-help cannot work without --enable-multibuffer])
AC_MSG_ERROR([--enable-help needs --enable-multibuffer to work])
fi
else
enable_help=no
@@ -124,10 +127,8 @@ if test "x$enable_multibuffer" = xno; then
enable_help=no
fi
fi
if test "x$disable_help" != xyes; then
if test "x$enable_help" != xno; then
AC_DEFINE(ENABLE_HELP, 1, [Define this to enable the Ctrl+G help texts.])
fi
if test "x$enable_help" != xno; then
AC_DEFINE(ENABLE_HELP, 1, [Define this to enable the Ctrl+G help texts.])
fi
AC_ARG_ENABLE(histories,
@@ -152,10 +153,8 @@ if test "x$enable_tiny" = xyes; then
enable_linenumbers=no
fi
fi
if test "x$disable_linenumbers" != xyes; then
if test "x$enable_linenumbers" != xno; then
AC_DEFINE(ENABLE_LINENUMBERS, 1, [Define this to enable line numbering.])
fi
if test "x$enable_linenumbers" != xno; then
AC_DEFINE(ENABLE_LINENUMBERS, 1, [Define this to enable line numbering.])
fi
AC_ARG_ENABLE(mouse,
@@ -165,10 +164,8 @@ if test "x$enable_tiny" = xyes; then
enable_mouse=no
fi
fi
if test "x$disable_mouse" != xyes; then
if test "x$enable_mouse" != xno; then
AC_DEFINE(ENABLE_MOUSE, 1, [Define this to enable mouse support.])
fi
if test "x$enable_mouse" != xno; then
AC_DEFINE(ENABLE_MOUSE, 1, [Define this to enable mouse support.])
fi
AC_ARG_ENABLE(multibuffer,
@@ -178,17 +175,19 @@ if test "x$enable_tiny" = xyes; then
enable_multibuffer=no
fi
fi
if test "x$disable_multibuffer" != xyes; then
if test "x$enable_multibuffer" != xno; then
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.])
fi
if test "x$enable_multibuffer" != xno; then
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.])
fi
AC_ARG_ENABLE(nanorc,
AS_HELP_STRING([--disable-nanorc], [Disable the use of .nanorc files]))
if test "x$enable_nanorc" = xno; then
AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
else
if test "x$enable_tiny" = xyes; then
if test "x$enable_nanorc" != xyes; then
enable_nanorc=no
fi
fi
if test "x$enable_nanorc" != xno; then
AC_DEFINE(ENABLE_NANORC, 1, [Define this to enable the use of .nanorc files.])
nanorc_support=yes
fi
@@ -206,8 +205,13 @@ fi
AC_ARG_ENABLE(tabcomp,
AS_HELP_STRING([--disable-tabcomp], [Disable the tab-completion functions]))
if test "x$enable_tabcomp" = xno; then
AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab-completion functions for filenames and search strings.])
if test "x$enable_tiny" = xyes; then
if test "x$enable_tabcomp" != xyes; then
enable_tabcomp=no
fi
fi
if test "x$enable_tabcomp" != xno; then
AC_DEFINE(ENABLE_TABCOMP, 1, [Define this to have tab completion for filenames and search strings.])
fi
AC_ARG_ENABLE(wordcomp,
@@ -219,10 +223,8 @@ if test "x$enable_tiny" = xyes; then
enable_wordcomp=no
fi
fi
if test "x$disable_wordcomp" != xyes; then
if test "x$enable_wordcomp" != xno; then
AC_DEFINE(ENABLE_WORDCOMPLETION, 1, [Define this to enable the word-completion function.])
fi
if test "x$enable_wordcomp" != xno; then
AC_DEFINE(ENABLE_WORDCOMPLETION, 1, [Define this to enable the word-completion function.])
fi
AC_ARG_ENABLE(wrapping,
@@ -249,15 +251,12 @@ AC_ARG_ENABLE(tiny,
AS_HELP_STRING([--enable-tiny], [Disable features for the sake of size]))
if test "x$enable_tiny" = xyes; then
AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.])
if test "x$enable_browser" != xyes; then
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
fi
if test "x$enable_color" != xyes; then
AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.])
color_support=no
else
if test "x$enable_nanorc" != xyes; then
AC_MSG_ERROR([--enable-color with --enable-tiny cannot work without --enable-nanorc])
AC_MSG_ERROR([--enable-color needs --enable-nanorc to work])
fi
fi
if test "x$enable_extra" != xyes; then
@@ -272,18 +271,12 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_libmagic" != xyes; then
enable_libmagic=no
fi
if test "x$enable_nanorc" != xyes; then
AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
fi
if test "x$enable_operatingdir" != xyes; then
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of an operating directory (a chroot of sorts).])
fi
if test "x$enable_speller" != xyes; then
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell-checker functions.])
fi
if test "x$enable_tabcomp" != xyes; then
AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab-completion functions for files and search strings.])
fi
if test "x$enable_wrapping" != xyes; then
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
fi

View File

@@ -83,7 +83,7 @@
<h2><a name="1.3"></a>1.3. Why the name change from TIP?</h2>
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program &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.8.2</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<blockquote><p>The current version of nano <i>should</i> be <b>2.8.4</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<h2><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h2>
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="https://nano-editor.org/dist/latest/nano.1.html">here</a>.</p></blockquote>
<hr width="100%">

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.8.2" "May 2017"
.TH NANO 1 "version 2.8.4" "May 2017"
.\" Please adjust this date whenever revising the manpage.
.SH NAME

View File

@@ -6,7 +6,7 @@
@smallbook
@set EDITION 0.4
@set VERSION 2.8.2
@set VERSION 2.8.4
@set UPDATED May 2017
@dircategory Editors
@@ -21,7 +21,7 @@
@titlepage
@title GNU @code{nano}
@subtitle a small and friendly text editor
@subtitle version 2.8.2
@subtitle version 2.8.4
@author Chris Allegretta
@page
@@ -600,12 +600,12 @@ nanorc. See @xref{Syntax Highlighting}, for more info.
@item Suspension Toggle (Meta-Z)
toggles the @code{-z} (@code{--suspend}) command-line option.
@item Soft Wrapping Toggle (Meta-$)
toggles the @code{-$} (@code{--softwrap}) command-line option.
@item Line Numbers Toggle (Meta-#)
toggles the @code{-l} (@code{--linenumbers}) command-line option.
@item Soft Wrapping Toggle (Meta-$)
toggles the @code{-$} (@code{--softwrap}) command-line option.
@end table
@@ -1419,6 +1419,16 @@ the .nanorc file), @code{nano} will store the position of the cursor
when you close a file, and will place the cursor in that position
again when you later reopen the file.
@item Current Cursor Position
The output of the "Display Cursor Position" command (^C) displays
not only the current line and character position of the cursor,
but also (between the two) the current column position.
@item Spell Checking
In the internal spell checker misspelled words are sorted alphabetically
and trimmed for uniqueness, such that the words 'apple' and 'Apple' will
be prompted for correction separately.
@item Writing Selected Text to Files
When using the Write-Out key (^O), text that has been selected using the
marking key (^^) can not just be written out to a new (or existing) file,
@@ -1447,16 +1457,6 @@ not have to be restarted to turn a particular feature on or off.
See the internal help function (^G) for a list of features that
can be toggled. Or see @xref{Feature Toggles} instead.
@item Current Cursor Position
The output of the "Display Cursor Position" command (^C) displays
not only the current line and character position of the cursor,
but also (between the two) the current column position.
@item Spell Checking
In the internal spell checker misspelled words are sorted alphabetically
and trimmed for uniqueness, such that the words 'apple' and 'Apple' will
be prompted for correction separately.
@end table

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.8.2" "May 2017"
.TH NANORC 5 "version 2.8.4" "May 2017"
.\" Please adjust this date whenever revising the manpage.
.SH NAME

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.8.2" "May 2017"
.TH RNANO 1 "version 2.8.4" "May 2017"
.\" Please adjust this date whenever revising the manpage.
.SH NAME

774
po/bg.po

File diff suppressed because it is too large Load Diff

767
po/ca.po

File diff suppressed because it is too large Load Diff

769
po/cs.po

File diff suppressed because it is too large Load Diff

763
po/da.po

File diff suppressed because it is too large Load Diff

763
po/de.po

File diff suppressed because it is too large Load Diff

763
po/eo.po

File diff suppressed because it is too large Load Diff

763
po/es.po

File diff suppressed because it is too large Load Diff

774
po/eu.po

File diff suppressed because it is too large Load Diff

777
po/fi.po

File diff suppressed because it is too large Load Diff

779
po/fr.po

File diff suppressed because it is too large Load Diff

763
po/ga.po

File diff suppressed because it is too large Load Diff

769
po/gl.po

File diff suppressed because it is too large Load Diff

763
po/hr.po

File diff suppressed because it is too large Load Diff

763
po/hu.po

File diff suppressed because it is too large Load Diff

774
po/id.po

File diff suppressed because it is too large Load Diff

769
po/it.po

File diff suppressed because it is too large Load Diff

763
po/ja.po

File diff suppressed because it is too large Load Diff

776
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

763
po/nb.po

File diff suppressed because it is too large Load Diff

767
po/nl.po

File diff suppressed because it is too large Load Diff

774
po/nn.po

File diff suppressed because it is too large Load Diff

769
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

763
po/ro.po

File diff suppressed because it is too large Load Diff

775
po/ru.po

File diff suppressed because it is too large Load Diff

774
po/sl.po

File diff suppressed because it is too large Load Diff

823
po/sr.po

File diff suppressed because it is too large Load Diff

769
po/sv.po

File diff suppressed because it is too large Load Diff

783
po/tr.po

File diff suppressed because it is too large Load Diff

763
po/uk.po

File diff suppressed because it is too large Load Diff

763
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

@@ -4,7 +4,7 @@ AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\" \
CLEANFILES = revision.h
if BUILDING_FROM_GIT
SOMETHING = "REVISION \"$(shell git describe --tags 2>/dev/null)\""
SOMETHING = "REVISION \"`git describe --tags 2>/dev/null`\""
else
SOMETHING = "NOTHING \"from tarball\""
endif
@@ -12,12 +12,13 @@ endif
nano.o: revision.h
winio.o: revision.h
revision.h: update_revision
# Always run the commands in this rule. But update the target
# only when the revision actually changed.
revision.h: FORCE
@[ -f $@ ] || touch $@
@echo "#define $(SOMETHING)" | cmp -s $@ - || \
echo "#define $(SOMETHING)" > $@
.PHONY: update_revision
echo "#define $(SOMETHING)" > $@
FORCE:
bin_PROGRAMS = nano
nano_SOURCES = browser.c \
@@ -38,7 +39,7 @@ nano_SOURCES = browser.c \
utils.c \
winio.c
nano_LDADD = @LIBINTL@ $(top_builddir)/lib/libgnu.a
nano_LDADD = @LIBINTL@ $(top_builddir)/lib/libgnu.a $(LIB_CLOCK_GETTIME)
install-exec-hook:
cd $(DESTDIR)$(bindir) && rm -f rnano && $(LN_S) nano rnano

View File

@@ -27,7 +27,7 @@
#include <unistd.h>
#include <errno.h>
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
static char **filelist = NULL;
/* The list of files to display in the file browser. */
@@ -183,14 +183,12 @@ char *do_browser(char *path)
} else if (func == do_right) {
if (selected < filelist_len - 1)
selected++;
#ifndef NANO_TINY
} else if (func == do_prev_word_void) {
selected -= (selected % width);
} else if (func == do_next_word_void) {
selected += width - 1 - (selected % width);
if (selected >= filelist_len)
selected = filelist_len - 1;
#endif
} else if (func == do_up_void) {
if (selected >= width)
selected -= width;
@@ -812,4 +810,4 @@ char *strip_last_component(const char *path)
return copy;
}
#endif /* !DISABLE_BROWSER */
#endif /* ENABLE_BROWSER */

View File

@@ -374,24 +374,39 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
* before the one at pos. */
size_t move_mbleft(const char *buf, size_t pos)
{
size_t before, char_len = 0;
#ifdef ENABLE_UTF8
if (use_utf8) {
size_t before, char_len = 0;
assert(pos <= strlen(buf));
if (pos < 4)
before = 0;
else {
const char *ptr = buf + pos;
/* There is no library function to move backward one multibyte
* character. So we just start groping for one at the farthest
* possible point. */
if (pos < MAXCHARLEN)
before = 0;
else
before = pos - MAXCHARLEN;
/* Probe for a valid starter byte in the preceding four bytes. */
if ((signed char)*(--ptr) > -65)
before = pos - 1;
else if ((signed char)*(--ptr) > -65)
before = pos - 2;
else if ((signed char)*(--ptr) > -65)
before = pos - 3;
else if ((signed char)*(--ptr) > -65)
before = pos - 4;
else
before = pos - 1;
}
while (before < pos) {
char_len = parse_mbchar(buf + before, NULL, NULL);
before += char_len;
}
/* Move forward again until we reach the original character,
* so we know the length of its preceding the character. */
while (before < pos) {
char_len = parse_mbchar(buf + before, NULL, NULL);
before += char_len;
}
return before - char_len;
return before - char_len;
} else
#endif
return (pos == 0 ? 0 : pos - 1);
}
/* Return the index in buf of the beginning of the multibyte character
@@ -671,7 +686,7 @@ char *mbrevstrpbrk(const char *head, const char *accept, const char *pointer)
}
#endif /* !NANO_TINY */
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
/* Return TRUE if the string s contains one or more blank characters,
* and FALSE otherwise. */
bool has_blank_chars(const char *s)
@@ -704,7 +719,7 @@ bool has_blank_mbchars(const char *s)
#endif
return has_blank_chars(s);
}
#endif /* !DISABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */
#endif /* ENABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */
#ifdef ENABLE_UTF8
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
@@ -717,7 +732,7 @@ bool is_valid_unicode(wchar_t wc)
}
#endif
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
/* Check if the string s is a valid multibyte string. Return TRUE if it
* is, and FALSE otherwise. */
bool is_valid_mbstring(const char *s)
@@ -729,4 +744,4 @@ bool is_valid_mbstring(const char *s)
#endif
return TRUE;
}
#endif /* !DISABLE_NANORC */
#endif /* ENABLE_NANORC */

View File

@@ -292,7 +292,7 @@ void do_uncut_text(void)
set_modified();
/* Update current_y to account for the inserted lines. */
place_the_cursor();
place_the_cursor(TRUE);
refresh_needed = TRUE;

View File

@@ -1106,14 +1106,13 @@ void do_insertfile(void)
} else {
ssize_t was_current_lineno = openfile->current->lineno;
size_t was_current_x = openfile->current_x;
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
#if !defined(NANO_TINY) || defined(ENABLE_BROWSER) || defined(ENABLE_MULTIBUFFER)
functionptrtype func = func_from_key(&i);
#endif
given = mallocstrcpy(given, answer);
#ifndef NANO_TINY
#ifdef ENABLE_MULTIBUFFER
if (func == new_buffer_void) {
if (func == flip_newbuffer) {
/* Don't allow toggling when in view mode. */
if (!ISSET(VIEW_MODE))
TOGGLE(MULTIBUFFER);
@@ -1122,13 +1121,13 @@ void do_insertfile(void)
continue;
}
#endif
if (func == flip_execute_void) {
#ifndef NANO_TINY
if (func == flip_execute) {
execute = !execute;
continue;
}
#endif /* !NANO_TINY */
#ifndef DISABLE_BROWSER
#endif
#ifdef ENABLE_BROWSER
if (func == to_files_void) {
char *chosen = do_browse_from(answer);
@@ -1199,7 +1198,7 @@ void do_insertfile(void)
set_modified();
/* Update current_y to account for inserted lines. */
place_the_cursor();
place_the_cursor(TRUE);
refresh_needed = TRUE;
}
@@ -2128,11 +2127,12 @@ int do_writeout(bool exiting)
msg = (method == PREPEND) ? _("Prepend Selection to File") :
(method == APPEND) ? _("Append Selection to File") :
_("Write Selection to File");
else if (method != OVERWRITE)
msg = (method == PREPEND) ? _("File Name to Prepend to") :
_("File Name to Append to");
else
#endif /* !NANO_TINY */
msg = (method == PREPEND) ? _("File Name to Prepend to") :
(method == APPEND) ? _("File Name to Append to") :
_("File Name to Write");
msg = _("File Name to Write");
present_path = mallocstrcpy(present_path, "./");
@@ -2157,24 +2157,15 @@ int do_writeout(bool exiting)
} else {
functionptrtype func = func_from_key(&i);
/* Upon request, abandon the buffer, if user is sure. */
/* Upon request, abandon the buffer. */
if (func == discard_buffer) {
if (openfile->modified)
i = do_yesno_prompt(FALSE,
_("Save modified buffer anyway? "));
else
i = 0;
if (i == 0) {
free(given);
return 2; /* Yes, discard the buffer. */
} else
continue; /* Go back to the filename prompt. */
free(given);
return 2;
}
given = mallocstrcpy(given, answer);
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
if (func == to_files_void) {
char *chosen = do_browse_from(answer);
@@ -2185,7 +2176,7 @@ int do_writeout(bool exiting)
free(answer);
answer = chosen;
} else
#endif /* !DISABLE_BROWSER */
#endif
#ifndef NANO_TINY
if (func == dos_format_void) {
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
@@ -2386,7 +2377,7 @@ char *real_dir_from_tilde(const char *buf)
return retval;
}
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
/* Our sort routine for file listings. Sort alphabetically and
* case-insensitively, and sort directories before filenames. */
int diralphasort(const void *va, const void *vb)
@@ -2423,7 +2414,7 @@ void free_chararray(char **array, size_t len)
}
#endif
#ifndef DISABLE_TABCOMP
#ifdef ENABLE_TABCOMP
/* Is the given path a directory? */
bool is_dir(const char *buf)
{
@@ -2747,7 +2738,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
return buf;
}
#endif /* !DISABLE_TABCOMP */
#endif /* ENABLE_TABCOMP */
/* Return the filename part of the given path. */
const char *tail(const char *path)
@@ -3003,7 +2994,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
poshiststruct *posptr, *theone, *posprev = NULL;
char *fullpath = get_full_path(filename);
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/') {
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/' || inhelp) {
free(fullpath);
return;
}
@@ -3075,7 +3066,7 @@ bool has_old_position(const char *file, ssize_t *line, ssize_t *column)
free(fullpath);
if (posptr == NULL)
return FALSE;
return FALSE;
*line = posptr->lineno;
*column = posptr->xno;

View File

@@ -95,14 +95,14 @@ char *present_path = NULL;
unsigned flags[4] = {0, 0, 0, 0};
/* Our flag containing the states of all global options. */
WINDOW *topwin;
WINDOW *topwin = NULL;
/* The top portion of the window, where we display the version
* number of nano, the name of the current file, and whether the
* current file has been modified. */
WINDOW *edit;
WINDOW *edit = NULL;
/* The middle portion of the window, i.e. the edit window, where
* we display the current file we're editing. */
WINDOW *bottomwin;
WINDOW *bottomwin = NULL;
/* The bottom portion of the window, where we display statusbar
* messages, the statusbar prompt, and a list of shortcuts. */
int editwinrows = 0;
@@ -266,10 +266,13 @@ void regexp_void(void)
void backwards_void(void)
{
}
void flip_replace(void)
{
}
void gototext_void(void)
{
}
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
void to_files_void(void)
{
}
@@ -277,6 +280,7 @@ void goto_dir_void(void)
{
}
#endif
#ifndef NANO_TINY
void dos_format_void(void)
{
}
@@ -292,18 +296,18 @@ void prepend_void(void)
void backup_file_void(void)
{
}
void flip_execute(void)
{
}
#endif
#ifdef ENABLE_MULTIBUFFER
void flip_newbuffer(void)
{
}
#endif
void discard_buffer(void)
{
}
void new_buffer_void(void)
{
}
void flip_replace_void(void)
{
}
void flip_execute_void(void)
{
}
/* Add a function to the function list. */
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
@@ -489,11 +493,8 @@ void shortcut_init(void)
const char *whereis_next_tag = N_("WhereIs Next");
#ifdef ENABLE_HELP
#ifndef DISABLE_JUSTIFY
/* TRANSLATORS: The next long series of strings are shortcut descriptions;
* they are best kept shorter than 56 characters, but may be longer. */
const char *nano_justify_msg = N_("Justify the current paragraph");
#endif
const char *nano_cancel_msg = N_("Cancel the current function");
const char *nano_help_msg = N_("Display this help text");
const char *nano_exit_msg =
@@ -509,7 +510,7 @@ void shortcut_init(void)
N_("Insert another file into the current one");
const char *nano_whereis_msg =
N_("Search for a string or a regular expression");
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
const char *nano_browser_whereis_msg = N_("Search for a string");
const char *nano_browser_refresh_msg = N_("Refresh the file list");
#ifndef NANO_TINY
@@ -585,6 +586,7 @@ void shortcut_init(void)
N_("Cut from the cursor position to the end of the file");
#endif
#ifndef DISABLE_JUSTIFY
const char *nano_justify_msg = N_("Justify the current paragraph");
const char *nano_fulljustify_msg = N_("Justify the entire file");
#endif
#ifndef NANO_TINY
@@ -619,9 +621,6 @@ void shortcut_init(void)
const char *nano_next_history_msg =
N_("Recall the next search/replace string");
#endif
#ifndef DISABLE_BROWSER
const char *nano_tofiles_msg = N_("Go to file browser");
#endif
#ifndef NANO_TINY
const char *nano_dos_msg = N_("Toggle the use of DOS format");
const char *nano_mac_msg = N_("Toggle the use of Mac format");
@@ -629,12 +628,13 @@ void shortcut_init(void)
const char *nano_prepend_msg = N_("Toggle prepending");
const char *nano_backup_msg = N_("Toggle backing up of the original file");
const char *nano_execute_msg = N_("Execute external command");
#endif
#ifdef ENABLE_MULTIBUFFER
const char *nano_newbuffer_msg = N_("Toggle the use of a new buffer");
#endif
#endif
const char *nano_discard_buffer_msg = N_("Close buffer without saving it");
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
const char *nano_tofiles_msg = N_("Go to file browser");
const char *nano_exitbrowser_msg = N_("Exit from the file browser");
const char *nano_firstfile_msg = N_("Go to the first file in the list");
const char *nano_lastfile_msg = N_("Go to the last file in the list");
@@ -667,12 +667,12 @@ void shortcut_init(void)
add_to_funcs(do_cancel, ((MMOST & ~MMAIN & ~MBROWSER) | MYESNO),
N_("Cancel"), IFSCHELP(nano_cancel_msg), BLANKAFTER, VIEW);
add_to_funcs(do_exit, MMAIN,
add_to_funcs(do_exit, MMAIN|MHELP,
exit_tag, IFSCHELP(nano_exit_msg), TOGETHER, VIEW);
/* Remember the entry for Exit, to be able to replace it with Close. */
exitfunc = tailfunc;
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
add_to_funcs(do_exit, MBROWSER,
exit_tag, IFSCHELP(nano_exitbrowser_msg), TOGETHER, VIEW);
#endif
@@ -709,7 +709,7 @@ void shortcut_init(void)
add_to_funcs(do_replace, MMAIN,
replace_tag, IFSCHELP(nano_replace_msg), TOGETHER, NOVIEW);
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
add_to_funcs(do_search, MBROWSER,
whereis_tag, IFSCHELP(nano_browser_whereis_msg), TOGETHER, VIEW);
@@ -720,15 +720,10 @@ void shortcut_init(void)
#ifdef ENABLE_HELP
/* The description ("x") and blank_after (0) are irrelevant,
* because the help viewer does not have a help text. */
add_to_funcs(do_exit, MHELP, exit_tag, "x", 0, VIEW);
add_to_funcs(total_refresh, MHELP, refresh_tag, "x", 0, VIEW);
add_to_funcs(do_search, MHELP, whereis_tag, "x", 0, VIEW);
add_to_funcs(do_research, MHELP, whereis_next_tag, "x", 0, VIEW);
add_to_funcs(do_up_void, MHELP, prev_line_tag, "x", 0, VIEW);
add_to_funcs(do_down_void, MHELP, next_line_tag, "x" , 0, VIEW);
#endif
add_to_funcs(do_cut_text_void, MMAIN,
@@ -789,10 +784,10 @@ void shortcut_init(void)
add_to_funcs(backwards_void, MWHEREIS|MREPLACE,
N_("Backwards"), IFSCHELP(nano_reverse_msg), TOGETHER, VIEW);
add_to_funcs(flip_replace_void, MWHEREIS,
add_to_funcs(flip_replace, MWHEREIS,
replace_tag, IFSCHELP(nano_replace_msg), BLANKAFTER, VIEW);
add_to_funcs(flip_replace_void, MREPLACE,
add_to_funcs(flip_replace, MREPLACE,
N_("No Replace"), IFSCHELP(nano_whereis_msg), BLANKAFTER, VIEW);
#ifndef DISABLE_JUSTIFY
@@ -820,7 +815,7 @@ void shortcut_init(void)
N_("Back"), IFSCHELP(nano_back_msg), TOGETHER, VIEW);
add_to_funcs(do_right, MMAIN,
N_("Forward"), IFSCHELP(nano_forward_msg), TOGETHER, VIEW);
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
add_to_funcs(do_left, MBROWSER,
N_("Back"), IFSCHELP(nano_backfile_msg), TOGETHER, VIEW);
add_to_funcs(do_right, MBROWSER,
@@ -837,9 +832,9 @@ void shortcut_init(void)
add_to_funcs(do_end_void, MMAIN,
N_("End"), IFSCHELP(nano_end_msg), BLANKAFTER, VIEW);
add_to_funcs(do_up_void, MMAIN|MBROWSER,
add_to_funcs(do_up_void, MMAIN|MHELP|MBROWSER,
prev_line_tag, IFSCHELP(nano_prevline_msg), TOGETHER, VIEW);
add_to_funcs(do_down_void, MMAIN|MBROWSER,
add_to_funcs(do_down_void, MMAIN|MHELP|MBROWSER,
next_line_tag, IFSCHELP(nano_nextline_msg), TOGETHER, VIEW);
#ifndef NANO_TINY
add_to_funcs(do_scroll_up, MMAIN,
@@ -992,20 +987,20 @@ void shortcut_init(void)
/* If we're using restricted mode, file insertion is disabled, and
* thus command execution and the multibuffer toggle have no place. */
if (!ISSET(RESTRICTED)) {
add_to_funcs(flip_execute_void, MINSERTFILE,
add_to_funcs(flip_execute, MINSERTFILE,
N_("Execute Command"), IFSCHELP(nano_execute_msg), TOGETHER, NOVIEW);
add_to_funcs(flip_execute_void, MEXTCMD,
add_to_funcs(flip_execute, MEXTCMD,
read_file_tag, IFSCHELP(nano_insert_msg), TOGETHER, NOVIEW);
#ifdef ENABLE_MULTIBUFFER
add_to_funcs(new_buffer_void, MINSERTFILE|MEXTCMD,
N_("New Buffer"), IFSCHELP(nano_newbuffer_msg), TOGETHER, NOVIEW);
#endif
}
#endif /* !NANO_TINY */
#ifdef ENABLE_MULTIBUFFER
if (!ISSET(RESTRICTED))
add_to_funcs(flip_newbuffer, MINSERTFILE|MEXTCMD,
N_("New Buffer"), IFSCHELP(nano_newbuffer_msg), TOGETHER, NOVIEW);
#endif
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
if (!ISSET(RESTRICTED))
add_to_funcs(to_files_void, MWRITEFILE|MINSERTFILE,
N_("To Files"), IFSCHELP(nano_tofiles_msg), TOGETHER, VIEW);
@@ -1024,7 +1019,7 @@ void shortcut_init(void)
add_to_funcs(discard_buffer, MWRITEFILE,
N_("Discard buffer"), IFSCHELP(nano_discard_buffer_msg), BLANKAFTER, NOVIEW);
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
add_to_funcs(do_research, MBROWSER,
whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
add_to_funcs(total_refresh, MBROWSER,
@@ -1234,7 +1229,7 @@ void shortcut_init(void)
add_to_sclist(MWHEREIS|MREPLACE, "M-C", 0, case_sens_void, 0);
add_to_sclist(MWHEREIS|MREPLACE, "M-R", 0, regexp_void, 0);
add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0);
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace_void, 0);
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^Y", 0, do_first_line, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^V", 0, do_last_line, 0);
#ifndef DISABLE_JUSTIFY
@@ -1257,7 +1252,7 @@ void shortcut_init(void)
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "Down", KEY_DOWN, get_history_newer_void, 0);
}
#endif
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
add_to_sclist(MWHEREISFILE, "^Y", 0, do_first_file, 0);
add_to_sclist(MWHEREISFILE, "^V", 0, do_last_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", 0, do_first_file, 0);
@@ -1284,11 +1279,14 @@ void shortcut_init(void)
add_to_sclist(MWRITEFILE, "M-A", 0, append_void, 0);
add_to_sclist(MWRITEFILE, "M-P", 0, prepend_void, 0);
add_to_sclist(MWRITEFILE, "M-B", 0, backup_file_void, 0);
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", 0, flip_execute_void, 0);
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, new_buffer_void, 0);
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", 0, flip_execute, 0);
}
#endif
#ifndef DISABLE_BROWSER
#ifdef ENABLE_MULTIBUFFER
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. */
if (!ISSET(RESTRICTED))
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files_void, 0);
@@ -1296,7 +1294,7 @@ void shortcut_init(void)
add_to_sclist(MHELP|MBROWSER, "^C", 0, do_exit, 0);
/* Allow exiting from the file browser and the help viewer with
* the same key as they were entered. */
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
add_to_sclist(MBROWSER, "^T", 0, do_exit, 0);
#endif
#ifdef ENABLE_HELP
@@ -1401,7 +1399,7 @@ const char *flagtostr(int flag)
}
#endif /* !NANO_TINY */
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
/* Interpret a function string given in the rc file, and return a
* shortcut struct with the corresponding function filled in. */
sc *strtosc(const char *input)
@@ -1497,18 +1495,10 @@ sc *strtosc(const char *input)
s->scfunc = do_scroll_up;
else if (!strcasecmp(input, "scrolldown"))
s->scfunc = do_scroll_down;
else if (!strcasecmp(input, "prevword"))
s->scfunc = do_prev_word_void;
else if (!strcasecmp(input, "nextword"))
s->scfunc = do_next_word_void;
else if (!strcasecmp(input, "cutwordleft"))
s->scfunc = do_cut_prev_word;
else if (!strcasecmp(input, "cutwordright"))
s->scfunc = do_cut_next_word;
else if (!strcasecmp(input, "prevblock"))
s->scfunc = do_prev_block;
else if (!strcasecmp(input, "nextblock"))
s->scfunc = do_next_block;
else if (!strcasecmp(input, "findbracket"))
s->scfunc = do_find_bracket;
else if (!strcasecmp(input, "wordcount"))
@@ -1530,10 +1520,18 @@ sc *strtosc(const char *input)
else if (!strcasecmp(input, "down") ||
!strcasecmp(input, "nextline"))
s->scfunc = do_down_void;
else if (!strcasecmp(input, "prevword"))
s->scfunc = do_prev_word_void;
else if (!strcasecmp(input, "nextword"))
s->scfunc = do_next_word_void;
else if (!strcasecmp(input, "home"))
s->scfunc = do_home_void;
else if (!strcasecmp(input, "end"))
s->scfunc = do_end_void;
else if (!strcasecmp(input, "prevblock"))
s->scfunc = do_prev_block;
else if (!strcasecmp(input, "nextblock"))
s->scfunc = do_next_block;
else if (!strcasecmp(input, "pageup") ||
!strcasecmp(input, "prevpage"))
s->scfunc = do_page_up;
@@ -1573,7 +1571,7 @@ sc *strtosc(const char *input)
s->scfunc = backwards_void;
else if (!strcasecmp(input, "flipreplace") ||
!strcasecmp(input, "dontreplace")) /* Deprecated. Remove in 2018. */
s->scfunc = flip_replace_void;
s->scfunc = flip_replace;
else if (!strcasecmp(input, "gototext"))
s->scfunc = gototext_void;
#ifndef DISABLE_HISTORIES
@@ -1594,14 +1592,14 @@ sc *strtosc(const char *input)
else if (!strcasecmp(input, "backup"))
s->scfunc = backup_file_void;
else if (!strcasecmp(input, "flipexecute"))
s->scfunc = flip_execute_void;
s->scfunc = flip_execute;
#endif
#ifdef ENABLE_MULTIBUFFER
else if (!strcasecmp(input, "flipnewbuffer") ||
!strcasecmp(input, "newbuffer")) /* Deprecated. Remove in 2018. */
s->scfunc = new_buffer_void;
s->scfunc = flip_newbuffer;
#endif
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
else if (!strcasecmp(input, "tofiles") ||
!strcasecmp(input, "browser"))
s->scfunc = to_files_void;
@@ -1700,7 +1698,7 @@ int strtomenu(const char *input)
#endif
else if (!strcasecmp(input, "linter"))
return MLINTER;
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
else if (!strcasecmp(input, "browser"))
return MBROWSER;
else if (!strcasecmp(input, "whereisfile"))
@@ -1710,7 +1708,7 @@ int strtomenu(const char *input)
#endif
return -1;
}
#endif /* !DISABLE_NANORC */
#endif /* ENABLE_NANORC */
#ifdef DEBUG
@@ -1721,7 +1719,8 @@ int strtomenu(const char *input)
* function unless debugging is turned on. */
void thanks_for_all_the_fish(void)
{
delwin(topwin);
if (topwin != NULL)
delwin(topwin);
delwin(edit);
delwin(bottomwin);
@@ -1816,7 +1815,7 @@ void thanks_for_all_the_fish(void)
sclist = sclist->next;
free(s);
}
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
free(homedir);
#endif
}

View File

@@ -271,7 +271,7 @@ void do_help(void)
title = NULL;
inhelp = FALSE;
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
browser_refresh();
else
@@ -353,7 +353,7 @@ void help_init(void)
htx[1] = NULL;
htx[2] = NULL;
}
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
else if (currmenu == MBROWSER) {
htx[0] = N_("File Browser Help Text\n\n "
"The file browser is used to visually browse the "
@@ -391,7 +391,7 @@ void help_init(void)
htx[1] = NULL;
htx[2] = NULL;
}
#endif /* !DISABLE_BROWSER */
#endif /* ENABLE_BROWSER */
#ifndef DISABLE_SPELLER
else if (currmenu == MSPELL) {
htx[0] = N_("Spell Check Help Text\n\n "

View File

@@ -55,7 +55,7 @@ void get_edge_and_target(size_t *leftedge, size_t *target_column)
if (ISSET(SOFTWRAP)) {
size_t realspan = strlenpt(openfile->current->data);
if (openfile->placewewant < realspan)
if (realspan > openfile->placewewant)
realspan = openfile->placewewant;
*leftedge = (realspan / editwincols) * editwincols;

View File

@@ -45,7 +45,7 @@
static int oldinterval = -1;
/* Used to store the user's original mouse click interval. */
#endif
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
static bool no_rcfiles = FALSE;
/* Should we ignore all rcfiles? */
#endif
@@ -677,14 +677,17 @@ void die_save_file(const char *die_filename, struct stat *die_stat)
/* Initialize the three window portions nano uses. */
void window_init(void)
{
/* First delete existing windows, in case of resizing. */
delwin(topwin);
topwin = NULL;
delwin(edit);
delwin(bottomwin);
/* When resizing, first delete the existing windows. */
if (edit != NULL) {
if (topwin != NULL)
delwin(topwin);
delwin(edit);
delwin(bottomwin);
}
/* If the terminal is very flat, don't set up a titlebar. */
if (LINES < 3) {
topwin = NULL;
editwinrows = 1;
/* Set up two subwindows. If the terminal is just one line,
* edit window and statusbar window will cover each other. */
@@ -804,7 +807,7 @@ void usage(void)
print_opt("-H", "--historylog",
N_("Log & read search/replace string history"));
#endif
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
if (!ISSET(RESTRICTED))
print_opt("-I", "--ignorercfiles", N_("Don't look at nanorc files"));
#endif
@@ -848,7 +851,7 @@ void usage(void)
print_opt("-c", "--constantshow", N_("Constantly show cursor position"));
print_opt("-d", "--rebinddelete",
N_("Fix Backspace/Delete confusion problem"));
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
if (!ISSET(RESTRICTED))
print_opt("-g", "--showcursor", N_("Show cursor in file browser"));
#endif
@@ -869,7 +872,7 @@ void usage(void)
N_("Set operating directory"));
#endif
print_opt("-p", "--preserve", N_("Preserve XON (^Q) and XOFF (^S) keys"));
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
if (!ISSET(RESTRICTED))
print_opt("-q", "--quiet",
N_("Silently ignore startup issues like rc file errors"));
@@ -916,7 +919,7 @@ void version(void)
#ifdef NANO_TINY
printf(" --enable-tiny");
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
printf(" --enable-browser");
#endif
#ifndef DISABLE_COLOR
@@ -943,7 +946,7 @@ void version(void)
#ifdef ENABLE_MOUSE
printf(" --enable-mouse");
#endif
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
printf(" --enable-nanorc");
#endif
#ifdef ENABLE_MULTIBUFFER
@@ -955,14 +958,14 @@ void version(void)
#ifndef DISABLE_SPELLER
printf(" --enable-speller");
#endif
#ifndef DISABLE_TABCOMP
#ifdef ENABLE_TABCOMP
printf(" --enable-tabcomp");
#endif
#ifndef DISABLE_WRAPPING
printf(" --enable-wrapping");
#endif
#else /* !NANO_TINY */
#ifdef DISABLE_BROWSER
#ifndef ENABLE_BROWSER
printf(" --disable-browser");
#endif
#ifdef DISABLE_COLOR
@@ -995,7 +998,7 @@ void version(void)
#ifndef ENABLE_MULTIBUFFER
printf(" --disable-multibuffer");
#endif
#ifdef DISABLE_NANORC
#ifndef ENABLE_NANORC
printf(" --disable-nanorc");
#endif
#ifdef DISABLE_OPERATINGDIR
@@ -1004,7 +1007,7 @@ void version(void)
#ifdef DISABLE_SPELLER
printf(" --disable-speller");
#endif
#ifdef DISABLE_TABCOMP
#ifndef ENABLE_TABCOMP
printf(" --disable-tabcomp");
#endif
#ifndef ENABLE_WORDCOMPLETION
@@ -1386,6 +1389,7 @@ void do_toggle(int flag)
case MORE_SPACE:
case NO_HELP:
window_init();
focusing = FALSE;
total_refresh();
break;
case SUSPEND:
@@ -1619,7 +1623,7 @@ int do_input(bool allow_funcs)
/* If the keystroke isn't a shortcut nor a toggle, it's a normal text
* character: add the character to the input buffer -- or display a
* warning when we're in view mode. */
if (input != ERR && !have_shortcut) {
if (input != ERR && !have_shortcut) {
if (ISSET(VIEW_MODE))
print_view_warning();
else {
@@ -1916,7 +1920,7 @@ int main(int argc, char **argv)
#ifdef ENABLE_MULTIBUFFER
{"multibuffer", 0, NULL, 'F'},
#endif
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
{"ignorercfiles", 0, NULL, 'I'},
#endif
{"rebindkeypad", 0, NULL, 'K'},
@@ -1934,7 +1938,7 @@ int main(int argc, char **argv)
#endif
{"constantshow", 0, NULL, 'c'},
{"rebinddelete", 0, NULL, 'd'},
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
{"showcursor", 0, NULL, 'g'},
#endif
{"help", 0, NULL, 'h'},
@@ -2006,13 +2010,13 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
#endif
#ifdef ENABLE_UTF8
#if defined(ENABLE_UTF8) && !defined(NANO_TINY)
if (MB_CUR_MAX > MAXCHARLEN)
fprintf(stderr, "Unexpected large character size: %i bytes"
" -- please report a bug\n", (int)MB_CUR_MAX);
#endif
#if defined(DISABLE_NANORC) && defined(DISABLE_ROOTWRAPPING)
#if !defined(ENABLE_NANORC) && defined(DISABLE_ROOTWRAPPING)
/* If we don't have rcfile support, --disable-wrapping-as-root is
* used, and we're root, turn wrapping off. */
if (geteuid() == NANO_ROOT_UID)
@@ -2069,7 +2073,7 @@ int main(int argc, char **argv)
SET(HISTORYLOG);
break;
#endif
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
case 'I':
no_rcfiles = TRUE;
break;
@@ -2165,7 +2169,7 @@ int main(int argc, char **argv)
case 'p':
SET(PRESERVE);
break;
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
case 'q':
SET(QUIET);
break;
@@ -2238,7 +2242,7 @@ int main(int argc, char **argv)
if (ISSET(RESTRICTED)) {
UNSET(SUSPEND);
UNSET(BACKUP_FILE);
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
no_rcfiles = TRUE;
UNSET(HISTORYLOG);
UNSET(POS_HISTORY);
@@ -2249,11 +2253,9 @@ int main(int argc, char **argv)
* before reading the rcfile, to be able to rebind/unbind keys. */
shortcut_init();
/* We've read through the command line options. Now back up the flags
* and values that are set, and read the rcfile(s). If the values
* haven't changed afterward, restore the backed-up values. */
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
if (!no_rcfiles) {
/* Back up the command-line options, then read the rcfile(s). */
#ifndef DISABLE_OPERATINGDIR
char *operating_dir_cpy = operating_dir;
#endif
@@ -2297,6 +2299,7 @@ int main(int argc, char **argv)
print_sclist();
#endif
/* If the backed-up command-line options have a value, restore them. */
#ifndef DISABLE_OPERATINGDIR
if (operating_dir_cpy != NULL) {
free(operating_dir);
@@ -2332,6 +2335,7 @@ int main(int argc, char **argv)
if (tabsize_cpy != -1)
tabsize = tabsize_cpy;
/* Simply OR the boolean flags from rcfile and command line. */
for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++)
flags[i] |= flags_cpy[i];
}
@@ -2341,7 +2345,7 @@ int main(int argc, char **argv)
else if (geteuid() == NANO_ROOT_UID)
SET(NO_WRAP);
#endif
#endif /* !DISABLE_NANORC */
#endif /* ENABLE_NANORC */
#ifndef DISABLE_WRAPPING
/* Override a "set nowrap" in an rcfile (or a --disable-wrapping-as-root)
@@ -2636,9 +2640,10 @@ int main(int argc, char **argv)
margin = needed_margin;
editwincols = COLS - margin;
#ifndef NANO_TINY
/* Ensure that firstcolumn is the starting column of its chunk. */
ensure_firstcolumn_is_aligned();
#endif
/* The margin has changed -- schedule a full refresh. */
refresh_needed = TRUE;
}
@@ -2657,7 +2662,7 @@ int main(int argc, char **argv)
/* Refresh just the cursor position or the entire edit window. */
if (!refresh_needed) {
place_the_cursor();
place_the_cursor(TRUE);
wnoutrefresh(edit);
} else
edit_refresh();

View File

@@ -404,7 +404,7 @@ typedef struct openfilestruct {
/* The preceding open file, if any. */
} openfilestruct;
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
typedef struct rcoption {
const char *name;
/* The name of the rcfile option. */

View File

@@ -95,7 +95,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
kbinput = (int *)nrealloc(kbinput, kbinput_len * sizeof(int));
kbinput[kbinput_len - 1] = input;
}
}
}
/* If we got a shortcut, or if there aren't any other keystrokes waiting
* after the one we read in, we need to insert all the characters in the
@@ -411,8 +411,7 @@ void update_the_statusbar(void)
/* Work around a cursor-misplacement bug in VTEs. */
wmove(bottomwin, 0, 0);
wnoutrefresh(bottomwin);
doupdate();
wrefresh(bottomwin);
/* Place the cursor at statusbar_x in the answer. */
column = base + statusbar_xplustabs();
@@ -431,7 +430,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
int kbinput = ERR;
bool ran_func, finished;
functionptrtype func;
#ifndef DISABLE_TABCOMP
#ifdef ENABLE_TABCOMP
bool tabbed = FALSE;
/* Whether we've pressed Tab. */
#endif
@@ -441,7 +440,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
char *magichistory = NULL;
/* The temporary string typed at the bottom of the history, if
* any. */
#ifndef DISABLE_TABCOMP
#ifdef ENABLE_TABCOMP
int last_kbinput = ERR;
/* The key we pressed before the current key. */
size_t complete_len = 0;
@@ -482,7 +481,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
if (func == do_cancel || func == do_enter)
break;
#ifndef DISABLE_TABCOMP
#ifdef ENABLE_TABCOMP
if (func != do_tab)
tabbed = FALSE;
@@ -503,7 +502,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
answer = input_tab(answer, allow_files, &statusbar_x,
&tabbed, refresh_func, listed);
} else
#endif /* !DISABLE_TABCOMP */
#endif /* ENABLE_TABCOMP */
#ifndef DISABLE_HISTORIES
if (func == get_history_older_void) {
if (history_list != NULL) {
@@ -567,7 +566,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
update_the_statusbar();
#if !defined(DISABLE_HISTORIES) && !defined(DISABLE_TABCOMP)
#if !defined(DISABLE_HISTORIES) && defined(ENABLE_TABCOMP)
last_kbinput = kbinput;
#endif
}
@@ -658,7 +657,7 @@ int do_prompt(bool allow_tabs, bool allow_files,
fprintf(stderr, "answer = \"%s\"\n", answer);
#endif
#ifndef DISABLE_TABCOMP
#ifdef ENABLE_TABCOMP
/* If we've done tab completion, there might still be a list of
* filename matches on the edit window. Clear them off. */
if (listed)

View File

@@ -176,7 +176,7 @@ extern char *homedir;
typedef void (*functionptrtype)(void);
/* Most functions in browser.c. */
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
char *do_browse_from(const char *inpath);
void read_the_list(const char *path, DIR *dir);
functionptrtype parse_browser_input(int *kbinput);
@@ -225,13 +225,13 @@ char *mbstrpbrk(const char *s, const char *accept);
char *revstrpbrk(const char *head, const char *accept, const char *index);
char *mbrevstrpbrk(const char *head, const char *accept, const char *index);
#endif
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
bool has_blank_mbchars(const char *s);
#endif
#ifdef ENABLE_UTF8
bool is_valid_unicode(wchar_t wc);
#endif
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
bool is_valid_mbstring(const char *s);
#endif
@@ -304,11 +304,11 @@ void do_writeout_void(void);
void do_savefile(void);
#endif
char *real_dir_from_tilde(const char *buf);
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
int diralphasort(const void *va, const void *vb);
void free_chararray(char **array, size_t len);
#endif
#ifndef DISABLE_TABCOMP
#ifdef ENABLE_TABCOMP
char *input_tab(char *buf, bool allow_files, size_t *place,
bool *lastwastab, void (*refresh_func)(void), bool *listed);
#endif
@@ -466,14 +466,14 @@ int do_prompt(bool allow_tabs, bool allow_files,
int do_yesno_prompt(bool all, const char *msg);
/* Most functions in rcfile.c. */
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
#ifndef DISABLE_COLOR
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
#endif
void parse_rcfile(FILE *rcstream, bool syntax_only);
void do_rcfiles(void);
#endif /* !DISABLE_NANORC */
#endif /* ENABLE_NANORC */
/* Most functions in search.c. */
void not_found_msg(const char *str);
@@ -496,7 +496,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
void do_gotolinecolumn_void(void);
#ifndef NANO_TINY
void do_find_bracket(void);
#ifndef DISABLE_TABCOMP
#ifdef ENABLE_TABCOMP
char *get_history_completion(filestruct **h, char *s, size_t len);
#endif
#endif
@@ -650,7 +650,7 @@ void warn_and_shortly_pause(const char *msg);
void statusline(message_type importance, const char *msg, ...);
void bottombars(int menu);
void onekey(const char *keystroke, const char *desc, int length);
void place_the_cursor(void);
void place_the_cursor(bool forreal);
void edit_draw(filestruct *fileptr, const char *converted,
int line, size_t from_col);
int update_line(filestruct *fileptr, size_t index);
@@ -662,7 +662,9 @@ 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(scroll_dir direction, int nrows);
#ifndef NANO_TINY
void ensure_firstcolumn_is_aligned(void);
#endif
void edit_redraw(filestruct *old_current);
void edit_refresh(void);
void adjust_viewport(update_type location);
@@ -681,22 +683,28 @@ void disable_nodelay(void);
void do_credits(void);
#endif
/* May as well throw these here, since they are just placeholders. */
/* These are just name definitions. */
void do_cancel(void);
void case_sens_void(void);
void regexp_void(void);
void backwards_void(void);
void flip_replace(void);
void gototext_void(void);
#ifdef ENABLE_BROWSER
void to_files_void(void);
void goto_dir_void(void);
#endif
#ifndef NANO_TINY
void dos_format_void(void);
void mac_format_void(void);
void append_void(void);
void prepend_void(void);
void backup_file_void(void);
void flip_execute(void);
#endif
#ifdef ENABLE_MULTIBUFFER
void flip_newbuffer(void);
#endif
void discard_buffer(void);
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);
void flip_replace_void(void);
void flip_execute_void(void);
#endif /* !PROTO_H */

View File

@@ -30,7 +30,7 @@
#include <unistd.h>
#include <ctype.h>
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
#ifndef RCFILE_NAME
#define RCFILE_NAME ".nanorc"
@@ -159,9 +159,9 @@ void rcfile_error(const char *msg, ...)
fprintf(stderr, "\n");
}
#endif /* !DISABLE_NANORC */
#endif /* ENABLE_NANORC */
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
#if defined(ENABLE_NANORC) || !defined(DISABLE_HISTORIES)
/* Parse the next word from the string, null-terminate it, and return
* a pointer to the first character after the null terminator. The
* returned pointer will point to '\0' if we hit the end of the line. */
@@ -181,9 +181,9 @@ char *parse_next_word(char *ptr)
return ptr;
}
#endif /* !DISABLE_NANORC || !DISABLE_HISTORIES */
#endif /* ENABLE_NANORC || !DISABLE_HISTORIES */
#ifndef DISABLE_NANORC
#ifdef ENABLE_NANORC
/* Parse an argument, with optional quotes, after a keyword that takes
* one. If the next word starts with a ", we say that it ends with the
* last " of the line. Otherwise, we interpret it as usual, so that the
@@ -1300,4 +1300,4 @@ void do_rcfiles(void)
}
}
#endif /* !DISABLE_NANORC */
#endif /* ENABLE_NANORC */

View File

@@ -202,7 +202,7 @@ int search_init(bool replacing, bool use_answer)
TOGGLE(USE_REGEXP);
backupstring = mallocstrcpy(backupstring, answer);
return 1;
} else if (func == do_replace || func == flip_replace_void) {
} else if (func == flip_replace) {
backupstring = mallocstrcpy(backupstring, answer);
return -2; /* Call the opposite search function. */
} else if (func == do_gotolinecolumn_void) {
@@ -883,6 +883,12 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
openfile->current_x = actual_x(openfile->current->data, column - 1);
openfile->placewewant = column - 1;
#ifndef NANO_TINY
if (ISSET(SOFTWRAP) && openfile->placewewant / editwincols >
strlenpt(openfile->current->data) / editwincols)
openfile->placewewant = strlenpt(openfile->current->data);
#endif
/* When the position was manually given, center the target line. */
if (interactive) {
adjust_viewport(CENTERING);
@@ -1224,7 +1230,7 @@ void get_history_older_void(void)
;
}
#ifndef DISABLE_TABCOMP
#ifdef ENABLE_TABCOMP
/* Move h to the next string that's a tab completion of the string s,
* looking at only the first len characters of s, and return that
* string. If there isn't one, or if len is 0, don't move h and return
@@ -1277,5 +1283,5 @@ char *get_history_completion(filestruct **h, char *s, size_t len)
* match, or len is 0. Return s. */
return (char *)s;
}
#endif /* !DISABLE_TABCOMP */
#endif /* ENSABLE_TABCOMP */
#endif /* !DISABLE_HISTORIES */

View File

@@ -1140,7 +1140,9 @@ bool execute_command(const char *command)
void discard_until(const undo *thisitem, openfilestruct *thefile)
{
undo *dropit = thefile->undotop;
#ifdef ENABLE_COMMENT
undo_group *group;
#endif
while (dropit != NULL && dropit != thisitem) {
thefile->undotop = dropit->next;
@@ -2439,7 +2441,7 @@ void do_justify(bool full_justify)
do {
#endif
statusbar(_("Can now UnJustify!"));
place_the_cursor();
place_the_cursor(TRUE);
curs_set(1);
kbinput = do_input(FALSE);
#ifndef NANO_TINY
@@ -3311,7 +3313,7 @@ void do_linter(void)
}
/* Place and show the cursor to indicate the affected line. */
place_the_cursor();
place_the_cursor(TRUE);
wnoutrefresh(edit);
curs_set(1);
@@ -3558,7 +3560,7 @@ void do_verbatim_input(void)
/* TRANSLATORS: This is displayed when the next keystroke will be
* inserted verbatim. */
statusbar(_("Verbatim Input"));
place_the_cursor();
place_the_cursor(TRUE);
curs_set(1);
/* Read in all the verbatim characters. */

View File

@@ -60,30 +60,29 @@ void get_homedir(void)
int digits(ssize_t n)
{
if (n < 100000) {
if (n < 1000) {
if (n < 100)
return 2;
else
return 3;
} else {
if (n < 10000)
return 4;
else
return 5;
}
if (n < 1000) {
if (n < 100)
return 2;
else
return 3;
} else {
if (n < 10000)
return 4;
else
return 5;
}
} else {
if (n < 10000000) {
if (n < 1000000)
return 6;
else
return 7;
}
else {
if (n < 100000000)
return 8;
else
return 9;
}
if (n < 10000000) {
if (n < 1000000)
return 6;
else
return 7;
} else {
if (n < 100000000)
return 8;
else
return 9;
}
}
}
#endif
@@ -117,7 +116,7 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
const char *comma;
while (*str == ' ')
str++;
str++;
comma = strpbrk(str, "m,. /;");
@@ -237,9 +236,12 @@ bool is_separate_word(size_t position, size_t length, const char *buf)
const char *strstrwrapper(const char *haystack, const char *needle,
const char *start)
{
/* Just in case we search for an empty needle. :/ */
if (*needle == '\0')
if (*needle == '\0') {
#ifndef NANO_TINY
statusline(ALERT, "Searching for nothing -- please report a bug");
#endif
return (char *)start;
}
if (ISSET(USE_REGEXP)) {
if (ISSET(BACKWARDS_SEARCH)) {
@@ -279,7 +281,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
regmatches[0].rm_eo = far_end;
if (regexec(&search_regexp, haystack, 10, regmatches,
REG_STARTEND) != 0)
statusline(ALERT, "BAD: failed to refind the match!");
return NULL;
return haystack + regmatches[0].rm_so;
}

View File

@@ -1235,7 +1235,7 @@ int parse_escape_sequence(WINDOW *win, int kbinput)
suppress_cursorpos = FALSE;
lastmessage = HUSH;
if (currmenu == MMAIN) {
place_the_cursor();
place_the_cursor(TRUE);
curs_set(1);
}
}
@@ -1989,7 +1989,7 @@ void titlebar(const char *path)
/* Figure out the path, prefix and state strings. */
if (inhelp)
branding = "";
#ifndef DISABLE_BROWSER
#ifdef ENABLE_BROWSER
else if (path != NULL)
prefix = _("DIR:");
#endif
@@ -2014,7 +2014,7 @@ void titlebar(const char *path)
prefixlen = strlenpt(prefix);
if (prefixlen > 0)
prefixlen++;
pathlen= strlenpt(path);
pathlen = strlenpt(path);
statelen = strlenpt(state) + 2;
if (statelen > 2) {
pathlen++;
@@ -2070,8 +2070,7 @@ void titlebar(const char *path)
wattroff(topwin, interface_color_pair[TITLE_BAR]);
wnoutrefresh(topwin);
doupdate();
wrefresh(topwin);
}
/* Display a normal message on the statusbar, quietly. */
@@ -2163,8 +2162,7 @@ void statusline(message_type importance, const char *msg, ...)
wattroff(bottomwin, interface_color_pair[STATUS_BAR]);
/* Push the message to the screen straightaway. */
wnoutrefresh(bottomwin);
doupdate();
wrefresh(bottomwin);
suppress_cursorpos = TRUE;
@@ -2242,8 +2240,7 @@ void bottombars(int menu)
/* Defeat a VTE bug by moving the cursor and forcing a screen update. */
wmove(bottomwin, 0, 0);
wnoutrefresh(bottomwin);
doupdate();
wrefresh(bottomwin);
}
/* Write a shortcut key to the help area at the bottom of the window.
@@ -2271,7 +2268,7 @@ void onekey(const char *keystroke, const char *desc, int length)
/* Redetermine current_y from the position of current relative to edittop,
* and put the cursor in the edit window at (current_y, "current_x"). */
void place_the_cursor(void)
void place_the_cursor(bool forreal)
{
ssize_t row = 0;
size_t col, xpt = xplustabs();
@@ -2293,7 +2290,7 @@ void place_the_cursor(void)
col = xpt % editwincols;
/* If the cursor ought to be in column zero, nudge it there. */
if (openfile->placewewant % editwincols == 0 && col != 0) {
if (forreal && openfile->placewewant % editwincols == 0 && col != 0) {
row++;
col = 0;
}
@@ -2307,7 +2304,8 @@ void place_the_cursor(void)
if (row < editwinrows)
wmove(edit, row, margin + col);
openfile->current_y = row;
if (forreal)
openfile->current_y = row;
}
/* edit_draw() takes care of the job of actually painting a line into
@@ -2686,8 +2684,10 @@ int update_line(filestruct *fileptr, size_t index)
/* If the line is offscreen, don't even try to display it. */
if (row < 0 || row >= editwinrows) {
#ifndef NANO_TINY
statusline(ALERT, "Badness: tried to display a line on row %i"
" -- please report a bug", row);
#endif
return 0;
}
@@ -2902,12 +2902,16 @@ void edit_scroll(scroll_dir direction, int nrows)
/* Don't bother scrolling zero rows, nor more than the window can hold. */
if (nrows == 0) {
#ifndef NANO_TINY
statusline(ALERT, "Underscrolling -- 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;
}
@@ -2951,16 +2955,19 @@ void edit_scroll(scroll_dir direction, int nrows)
}
}
#ifndef NANO_TINY
/* Ensure that firstcolumn is at the starting column of the softwrapped chunk
* it's on. We need to do this when the number of columns of the edit window
* has changed, because then the width of softwrapped chunks has changed. */
void ensure_firstcolumn_is_aligned(void)
{
#ifndef NANO_TINY
if (openfile->firstcolumn % editwincols != 0)
openfile->firstcolumn -= (openfile->firstcolumn % editwincols);
#endif
/* If smooth scrolling is on, make sure the viewport doesn't center. */
focusing = FALSE;
}
#endif
/* Return TRUE if current[current_x] is above the top of the screen, and FALSE
* otherwise. */
@@ -3086,7 +3093,7 @@ void edit_refresh(void)
while (row < editwinrows)
blank_row(edit, row++, 0, COLS);
place_the_cursor();
place_the_cursor(TRUE);
wnoutrefresh(edit);
refresh_needed = FALSE;
@@ -3245,7 +3252,7 @@ void spotlight(bool active, const char *word)
room--;
}
place_the_cursor();
place_the_cursor(FALSE);
if (active)
wattron(edit, hilite_attribute);

View File

@@ -1,11 +1,17 @@
## A default syntax, which is used
## for files that do not match any other syntax.
## An example of a default syntax. The default syntax is used for
## files that do not match any other syntax.
syntax "default"
comment "#"
# Comments.
color cyan "^#.*"
# Spaces in front of tabs.
color ,red " + +"
# Nano's name, including version.
color brightred "(GNU )?nano [1-9]\.[0-9]\.[^[:space:][:punct:]]+"
# Email addresses.
color yellow "<[[:alnum:].%_+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,}>"

View File

@@ -7,7 +7,7 @@ color red "[:=]"
color magenta "\<(if|ifeq|else|endif)\>"
color blue "\$+[{(][a-zA-Z0-9_-]+[})]"
color brightblue "^[^ ]+:"
color green "#.*$"
color green "(^|[[:space:]]+)#.*"
## Trailing whitespace.
color ,green "[[:space:]]+$"

View File

@@ -4,7 +4,7 @@
syntax "nanohelp"
# Key combos:
color cyan "\^([]A-Z^\_←→↑↓]|Home|End)" "[←→↑↓]"
color cyan "\^([]4-8A-Z^\_←→↑↓]|Home|End)" "[←→↑↓]"
color cyan "\<(Tab|Enter|Home|End|Ins|Del|Bsp|PgUp|PgDn)\>"
color cyan "\<M-." "\<F1?[0-9]" "(\^|M-)Space"

View File

@@ -1,32 +1,35 @@
## Here is an example for PHP.
syntax "php" "\.php[2345s~]?$"
syntax "php" "\.ph(p[23457s~]?|tml)$"
magic "PHP script text"
comment "//"
# PHP markings.
color brightgreen "(<\?(php)?|\?>)"
# Functions.
# Function names.
color white "\<[a-z_]*\("
# Variable names.
color cyan "\$[a-z_]+"
# Types.
color green "\<(var|float|global|double|bool|char|int|enum|const)\>"
color green "\<(array|bool|callable|const|float|global|int|object|string|var)\>"
# Structure.
color brightyellow "\<(class|new|private|public|function|for|foreach|if|while|do|else|elseif|case|default|switch)\>"
# Directives and structure.
color brightyellow "\<(abstract|as|class|clone|(end)?declare|extends|function|implements|include(_once)?|inst(ance|ead)of|interface|namespace|new|private|protected|public|require(_once)?|static|trait|use|yield)\>"
color brightyellow "\<(case|catch|default|do|echo|else(if)?|end(for(each)?|if|switch|while)|final(ly)?|for(each)?|if|print|switch|throw|try|while)\>"
# Operators.
color brightyellow "\<(and|or|xor)\>"
# Control flow.
color magenta "\<(goto|continue|break|return)\>"
color magenta "\<(break|continue|goto|return)\>"
# Strings.
color brightyellow "<[^= ]*>" ""(\.|[^"])*""
color brightyellow ""(\.|[^"])*"" "'(\.|[^'])*'"
# Comments.
color brightblue "//.*"
color brightblue "(^|[[:space:]]+)//.*"
color brightblue start="/\*" end="\*/"
##color blue start="<" end=">"
##color red "&[^;[:space:]]*;"
# Trailing whitespace.
color ,green "[[:space:]]+$"

View File

@@ -1,6 +1,7 @@
## Here is an example for XML files.
syntax "xml" "\.([jrsx]html?|jnlp|mml|pom|rng|sgml?|svg|w[as]dl|wsdd|xjb|xml|xs(d|lt?)|xul)$"
header "<\?xml.*version=.*\?>"
magic "(XML|SGML) (sub)?document text"
comment "<!--|-->"