Compare commits

..

46 Commits

Author SHA1 Message Date
Chris Allegretta
4d2b198403 GNU nano 2.4.1 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5197 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-14 18:03:44 +00:00
Chris Allegretta
5ea46cacb6 Go even farther on the bug report front in README and only mention
about the Savannah page, based on Benno's excellent suggestion.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5196 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-14 16:07:23 +00:00
Benno Schulenberg
fd759d5ca3 Fixing compilation with --enable-tiny (oops), and mentioning
also the Savannah page as a place for reporting bugs.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5195 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-13 10:59:12 +00:00
Benno Schulenberg
f34c8fdc6b Oops. Correcting an oversight in the Changelog:
the original recent undo fix was by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5194 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 11:29:35 +00:00
Benno Schulenberg
1cf9deb603 Using mallocstrcpy() in a correct manner and
not letting it free an unrelated string.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5193 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 11:15:57 +00:00
Benno Schulenberg
4e5ea18394 Removing an unused variable, and adjusting the introductory comment
for the recently tweaked logic.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5192 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 09:04:30 +00:00
Benno Schulenberg
4e9b3687ba Rebinding ^Y and ^V in the WhereisFile menu
to the effective and consistent first_file() and last_file().


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5191 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 08:44:37 +00:00
Benno Schulenberg
99d2358510 Stopping M-\ and M-/ in the WhereisFile menu from doing also an
unrequested search after having performed their function.
Fixes Savannah bug #44790.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5190 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 08:31:53 +00:00
Benno Schulenberg
08a52c1dab Not splitting off the marked region into a separate partition, but
doing the replacings in situ in the current one, to fix an undo bug.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5189 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-11 15:21:08 +00:00
Benno Schulenberg
ce48ca2223 Correcting and adjusting some comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5188 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-08 19:57:31 +00:00
Benno Schulenberg
2dc9cbefd3 Renaming some things, for more contrast or to be more fitting.
And condensing the renamed function, and making it void because
the result isn't used anyway.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5187 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-08 18:40:40 +00:00
Benno Schulenberg
0f7b99b433 Giving the file a neater layout, plus two table headers.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5186 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 15:37:07 +00:00
Benno Schulenberg
057348e1da Adding the names of recent translators, and sorting them.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5185 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 15:23:12 +00:00
Benno Schulenberg
ab21161a69 Eliding another miniscule function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5184 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 14:24:18 +00:00
Benno Schulenberg
d8b6dbfffe Letting bottombars() set the global variable 'currmenu'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5183 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 14:16:07 +00:00
Benno Schulenberg
d5177059e8 Greatly simplifying the searching for the next matching filename.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5182 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 13:34:12 +00:00
Benno Schulenberg
a9647b0508 Avoiding to set 'focusing' when searching for filenames;
it should be set only when searching/replacing text.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5181 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 11:04:32 +00:00
Benno Schulenberg
37fd348a1d Eliding a miniscule function, and renaming a variable for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5180 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 10:41:00 +00:00
Benno Schulenberg
2aac470cb9 Consistently using the appropriate variable in the appropriate function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5179 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 08:44:24 +00:00
Benno Schulenberg
25ce5f6759 Removing an unfitting comment and tweaking some others.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5178 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 08:23:52 +00:00
Benno Schulenberg
5d0b267aaa Not searching for the empty string when nothing was sought yet
in the file browser (when historylig is set).


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5177 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 08:19:04 +00:00
Benno Schulenberg
c2ed8277c2 Expanding on nano's features, and condensing the synopsis,
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5176 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-05 09:14:13 +00:00
Benno Schulenberg
d7ade1f346 Ignoring magic without libmagic, and ignoring formatter without spell checking.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5175 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-03 17:28:30 +00:00
Benno Schulenberg
de53c53c6e Removing two superfluous #ifndefs.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5174 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-03 15:57:22 +00:00
Benno Schulenberg
5ac108188d Updating the README text to the fifth milestone: 2.4.x.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5173 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-03 15:48:57 +00:00
Benno Schulenberg
e683e32c74 Also colouring a series of changed files that spans more than one line.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5172 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-28 19:56:41 +00:00
Benno Schulenberg
7fe830fd20 Only scrolling the required number of lines
when pasting lines onto the bottom line.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5171 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-28 17:11:28 +00:00
Benno Schulenberg
07e199ff0e When searching, put a found off-screen string on the center line
instead of at the bottom or top, to show it in context.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5170 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-28 17:01:46 +00:00
Benno Schulenberg
6f2da6b9b2 Adjusting the end point of the marked region to compensate
for any change in length of the region's last line.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5169 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 20:16:36 +00:00
Benno Schulenberg
14a9c8aa0b Treating the formatter like a speller,
to fix compilation with --disable-speller.
This fixes Savannah bug #44607.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5168 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 16:55:49 +00:00
Benno Schulenberg
52d7d5f55a The linter is only available when colour is.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5167 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 15:34:41 +00:00
Benno Schulenberg
0b6d6f45d2 Normalizing some whitespace.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5166 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 13:46:50 +00:00
Benno Schulenberg
0a79c78e05 Removing two unneeded calls to edit_refresh(), to greatly speed up nano
when doing a Replace All with *lots* of occurrences.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5165 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 11:29:23 +00:00
Benno Schulenberg
ad827a6aef Adjusting some whitespace and wrapping.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5164 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 10:49:19 +00:00
Benno Schulenberg
41580848e3 Recognizing also Debian package diffs.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5163 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 09:14:21 +00:00
Benno Schulenberg
b455fa3a16 Allowing to rebind the linter when nano was configured with --disable-speller.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5162 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-25 19:33:00 +00:00
Benno Schulenberg
ff4a457d82 Removing unneeded statement -- nothing has changed the value of 'currmenu'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5161 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-25 16:23:45 +00:00
Benno Schulenberg
eae9f282de Removing a mistaken menu name -- as the formatter allows no interaction
it needs no associated menu.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5160 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-25 16:20:45 +00:00
Benno Schulenberg
e39cf37026 Not letting hashes inside triple-quoted strings cause comment colouring.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5159 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-25 13:50:12 +00:00
Benno Schulenberg
6440aa9e47 Slightly widening and relaxing the header regex.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5158 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-25 13:42:40 +00:00
Benno Schulenberg
745fab8293 Correcting the description of option --noread,
allowing writing to named pipes.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5157 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 18:16:37 +00:00
Benno Schulenberg
a37ebcf2f8 Not unsetting the mark before the possible bailout for zero size.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5156 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 17:12:49 +00:00
Benno Schulenberg
92142bed34 Avoiding a spell-check error when the marked region is zero bytes long.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5155 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 17:01:25 +00:00
Benno Schulenberg
83ec9e7d50 Three tiny Changelog fixes.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5154 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 13:06:07 +00:00
Chris Allegretta
a0a0556993 2015-02-25 Chris Allegretta <chrisa@asty.org>
* src/text.c (do_alt_speller): timestamp can just be a __time_t.
        Fixes compilation on win32.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5153 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 04:32:45 +00:00
Chris Allegretta
33ac317132 Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5152 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 04:23:32 +00:00
57 changed files with 11351 additions and 11321 deletions

122
ChangeLog
View File

@@ -1,9 +1,125 @@
2015-04-13 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_replace_loop): Fix compilation with --enable-tiny.
* README: Mention also the Savannah page for reporting bugs.
2015-04-12 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (filesearch_init): Stop M-\ and M-/ in WhereisFile
menu (reached via ^R ^T ^W) from doing also an unrequested search
after having performed their function. Fixes Savannah bug #44790.
* src/global.c (shortcut_init): Rebind ^Y and ^V in the WhereisFile
menu from the pointless page_up() and page_down() to the effective
first_file() and last_file(). Also unbind some other useless keys.
* src/browser.c (filesearch_init): Remove an unused variable, and
adjust the introductory comment for the recently tweaked logic.
* src/rcfile.c (parse_linter, parse_formatter): Use mallocstrcpy()
in a correct manner; don't let it free an unrelated string.
2015-04-11 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_replace_loop): Do not split off the marked region
into a separate partition, but do the replacings in the current one,
taking good care to stay within the boundaries of the region. This
fixes an undo bug where the first part of a line would disappear if
the region started in the middle of a line. Bug was reported here:
https://lists.gnu.org/archive/html/nano-devel/2015-03/msg00077.html.
Original idea and patch were by Mark Majeres.
2015-04-08 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (browser_select_dirname, findnextfile): Rename
'currselected' to 'looking_at', for more contrast with 'selected',
and rename browser_select_filename() to browser_select_dirname().
* src/text.c: Correct and adjust some comments.
2015-04-07 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (do_fileresearch): Don't search for the empty string
when nothing was sought yet (when historylog is set).
* src/browser.c (filesearch_init): Remove an unfitting comment
(there are no toggles here) and tweak some others.
* src/search.c (do_search, do_research): Use the same variable as
in the surrounding code, for consistency.
* src/browser.c (findnextfile_wrap_reset): Elide this function,
and rename 'search_last_file' to 'came_full_circle'.
* src/browser.c (filesearch_init, do_fileresearch): Avoid setting
'focusing' when searching only for filenames.
* src/browser.c (findnextfile, do_filesearch, do_fileresearch):
Greatly simplify the searching for the next matching filename.
* src/{browser,files,help,prompt,text,winio}.c: Let the function
bottombars() set the global variable 'currmenu' -- the displayed
menu must necessarily be the active one.
* src/browser.c (filesearch_abort): Elide this tiny function.
* THANKS: Add the names of recent translators, and sort the list.
* THANKS: A neater layout, plus two table headers.
2015-04-05 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Expand on nano's features, condense the
synopsis, and "online" means something else to most people.
2015-04-03 Benno Schulenberg <bensberg@justemail.net>
* README: Update text to the fifth milestone, 2.4.x, plus tweaks.
* src/rcfile.c: Remove two superfluous (because nested) #ifndefs.
* src/rcfile.c (parse_rcfile): Ignore any magic when libmagic was
disabled, and ignore a formatter when spell checking was disabled.
2015-03-28 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (search_init_globals, search_replace_abort),
src/winio.c (edit_redraw), src/proto.h, src/global.c: When finding
an off-screen string, put it on the center line of the screen and
not on the bottom or top line. This restores the old behaviour
that was unintentionally changed in r5149 six days ago.
* src/winio.c (edit_refresh): When pasting lines on the bottom line,
only scroll the required number of lines and not half a screen --
that is, when smooth scrolling is enabled.
* doc/syntax/changelog.nanorc: Also colour a series of changed files
that spans more than one line.
2015-03-27 Mark Majeres <mark@engine12.com>
* src/text.c (do_alt_speller): Adjust the end point of the marked
region for any change in length of the region's last line.
2015-03-27 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/patch.nanorc: Recognize also Debian package diffs.
Fixes https://bugs.launchpad.net/ubuntu/+source/nano/+bug/1300565
requested by Rolf Leggewie.
* src/search.c (do_replace_loop): Adjust some whitespace and wrapping.
* src/search.c (do_replace_loop): Place a call to edit_refresh better,
and remove two unneeded ones. This greatly speeds up nano when doing
a Replace All with *lots* of occurrences.
* src/{color,global,nano,text,utils}.c: Normalize some whitespace.
* src/global.c (strtosc): The linter is only available when colour is.
* src/global.c, src/text.c: Treat the formatter like a speller, to fix
compilation with --disable-speller. Fixes Savannah bug #44607.
2015-03-25 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/debian.nanorc: Slightly widen and relax the header regex.
* doc/syntax/python.nanorc: Hashes inside triple-quoted strings should
not cause comment colouring. (Inside single-qouted strings neither,
but then quotes in comments will be coloured like strings.) This
solves https://bugs.launchpad.net/ubuntu/+source/nano/+bug/481363.
* src/global.c (strtomenu): Remove mistaken menu name -- as the
formatter allows no interaction it needs no associated menu.
* src/text.c (do_formatter): Remove unneeded statement -- nothing
has changed the value of 'currmenu'.
* src/global.c (strtosc), doc/man/nanorc.5: Allow rebinding the
linter when nano was configured with --disable-speller.
2015-03-23 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_alt_speller): Avoid the spell checker reporting
an error when the marked region is zero bytes long. The message
is not needed -- it gets printed by the caller. This generalizes
the fix for Savannah bug #29393.
* src/text.c (do_alt_speller): Do not unset the mark before the
possible bailout because of a zero-sized region.
* NEWS: Option --noread allows writing, not reading, to named pipes.
2015-03-22 Chris Allegretta <chrisa@asty.org>
* src/text.c (do_alt_speller): timestamp can just be a time_t.
Fixes compilation on win32 and macOS.
GNU nano 2.4.0 - 2015.03.22
2015-03-22 Benno Schulenberg <bensberg@justemail.net>
* src/chars.c (move_mbleft): Start looking for a multibyte char
not at the start of the string, but only as far back as such a
char can possibly be. Change suggested by Mark Majeres.
* src/search.c (findnextstr): Step backward or forward not simply
* src/search.c (findnextstr): Step backward or forward not simply
one byte but one character (possibly multibyte). Fixes Savannah
bug #42175, reported by myself, and the finding of ghosts seen in
https://lists.gnu.org/archive/html/nano-devel/2015-03/msg00055.html.
@@ -61,7 +177,7 @@ GNU nano 2.4.0 - 2015.03.22
those arguments are not optional. Also add "formatter" to the
texinfo document, and slightly improve its punctuation.
GNU nano 2.3.99pre2 - 2015.02.27
GNU nano 2.3.99pre3 - 2015.02.27
2015-02-25 Chris Allegretta <chrisa@asty.org>
* src/rcfile.c (parse_binding): Add an exception for do_toggle() as
rebinding toggles broke with r5022. (Fixed in r5134.)
@@ -109,7 +225,7 @@ GNU nano 2.3.99pre2 - 2015.02.06
2015-01-13 Chris Allegretta <chrisa@asty.org>
* src/files.c (open_buffer): Check here for locking and properly
handle choosing to not open a file when locked instead of in
open_file(). Fixes Savannah bug 42373 reported by Benno Schulenberg.
open_file(). Fixes Savannah bug #42373 reported by Benno Schulenberg.
GNU nano 2.3.99pre1 - 2015.01.06
2015-01-03 Chris Allegretta <chrisa@asty.org>

18
NEWS
View File

@@ -1,6 +1,16 @@
2015.04.14 - GNU nano 2.4.1 "Glitch Gremlin" is released. This release
includes several fixes for issues with the file browser
menu, linter and formatter functions, spell checker,
undo/redo with some specific marked-cutting situations,
and some small improvements to the color syntax
highlighting definitions. There are also various
documentation and code comment updates included, and
finally, fixes for compilation on non-GNU/Linux systems
and certain configure combinations. Toasters!
2015.03.22 - GNU nano 2.4.0 "lizf" is released. This is the first
stable release in many years, and brinds together many
new features from the 2.3 series: including:
stable release in many years, and brings together many
new features from the 2.3 series, including:
a fully functional undo system (now enabled by default),
vim-compatible file locking, linter support, formatter
support, syntax highlighting flexibility, and many fixes
@@ -30,7 +40,7 @@
2015.01.06 - GNU nano 2.3.99pre1 "Junior" is released. As the first
2.4 release candidate there will be fewer new features
but many bugfixes going forward. This release contains
new support for language reformatters like go's gofmt
new support for language reformatters like Go's gofmt
command which takes the place of the spelling checker.
Fixes in this release include many syntax highlighting
fixes and improvements, and documentation formatting updates.
@@ -70,7 +80,7 @@
substantial improvements to the undo/redo code, UTF-8
handling, the configure script, and display of shortcuts
on very wide terminals, New features include the
ability to read named pipes (--noread), as well as
ability to write to named pipes (--noread), as well as
linter support (see the nanorc man page for details). Also
included are much improved syntax highlighting code, and
configurations for JSON, texinfo, Go, and a default syntax

31
README
View File

@@ -6,20 +6,19 @@ Overview
The nano project was started because of a few "problems" with the
wonderfully easy-to-use and friendly Pico text editor.
First and foremost is its license: the Pine suite does not use the
GPL or a GPL-friendly license, and has unclear restrictions on
First and foremost was its license: the Pine suite does not use
the GPL or a GPL-friendly license, and has unclear restrictions on
redistribution. Because of this, Pine and Pico are not included
with many GNU/Linux distributions. Also, other features (like go
to line number or search and replace) were unavailable until
recently or require a command line flag. Yuck.
with many GNU/Linux distributions. Also, other features (like
go-to-line-number or search-and-replace) were unavailable until
recently or require a command-line flag. Yuck.
nano aims to solve these problems by emulating the functionality of
Pico as closely as possible while addressing the problems above and
perhaps providing other extra functionality.
providing other extra functionality.
The nano editor is now an official GNU package. For more
information on GNU and the Free Software Foundation, please see
http://www.gnu.org/.
The nano editor is an official GNU package. For more information on
GNU and the Free Software Foundation, please see http://www.gnu.org/.
How to compile and install nano
@@ -60,11 +59,15 @@ Mailing Lists and Bug Reports
subject of "subscribe", where <name> is the list you want to
subscribe to.
For general bug reports, send a description of the problem to
nano@nano-editor.org or directly to the development list.
For general bug reports, please file a description of the problem
on the Savannah bug tracker page for nano
(https://savannah.gnu.org/bugs/?group=nano). The issue may have
already been reported, and we are better able to track the state
of the issue and whom to notify when fixed, the more the bug
tracker is used.
Current Status
GNU nano has reached its fourth stable milestone, 2.2.x.
Development of new features continues in the 2.3.x branch, while
2.2.x versions are dedicated to bug-fixing and polishing.
GNU nano has reached its fifth stable milestone, 2.4.x.
Development of new features will continue in the 2.5.x branch,
while 2.4.x versions are dedicated to bug-fixing and polishing.

142
THANKS
View File

@@ -2,82 +2,87 @@ The following people have helped GNU nano in some way or another.
If we missed you here, let us know!
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com>
Malay translator
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian translator
CHAO Wei-Lun <chaoweilun@pcmail.com.tw> Chinese (traditional) translator
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish translator
Marco Colombo <magicdice@inwind.it> Italian translator
Yavor Doganov <yavor@doganov.org> Bulgarian translator
Karl Eichwalder <keichwa@gmx.net> German translator
Doruk Fisek <dfisek@fisek.com.tr> Turkish translator
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net>
French translator
Geir Helland <pjallabais@users.sourceforge.net> Norwegian Bokmål translator
Tedi Heriyanto <tedi_h@gmx.net> Indonesian translator
Václav Haisman <V.Haisman@sh.cvut.cz> Czech translator
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu>
Hungarian translator
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish translator
Eivind Kjørstad <ekj@vestdata.no> Norwegian Nynorsk translator
Florian König <floki@bigfoot.com> German translator
Wojciech Kotwica <wkotwica@post.pl> Polish translator
Clement Laforet <clem_laf@wanadoo.fr> French translator
Daniele Medri <madrid@linux.it> Italian translator
Gergely Nagy <algernon@debian.org> Hungarian translator
Kalle Olavi Niemitalo <kon@iki.fi> Finnish translator
A. Murat EREN <meren@comu.edu.tr> Turkish translator
Claudio Neves <cneves@nextis.com> Brazilian Portuguese translator
Daniel Nylander <po@danielnylander.se> Swedish translator
Michael Piefel <piefel@informatik.hu-berlin.de> German translator
Sergey A. Ribalchenko <fisher@obu.ck.ua> Ukrainian and Russian translator
Michel Robitaille <robitail@IRO.UMontreal.CA> French translator
Christian Rose <menthos@menthos.com> Swedish translator
Stig E Sandø <stig@ii.uib.no> Norwegian Bokmål translator
Benno Schulenberg <benno@vertaalt.nl> Dutch and Esperanto translator
Danilo Segan <dsegan@gmx.net> Serbian translator
Keld Simonsen <keld@dkuug.dk> Danish translator
Guus Sliepen <guus@nl.linux.org> Dutch translator
Cezary Sliwa <sliwa@cft.edu.pl> Polish translator
Pierre Tane <tanep@bigfoot.com> French translator
Jacobo Tarrío <jtarrio@trasno.net> Galician translator
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian Nynorsk translator
Miquel Vidal <miquel@sindominio.net> Catalan translator
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese translator
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish translator
Peio Ziarsolo <peio@sindominio.net> Basque translator
Anton Zinoviev <zinoviev@debian.org> Bulgarian translator
João Victor Duarte Martins <jvdm@sdf.lonestar.org>
Brazilian Portuguese translator
Kevin Patrick Scannell <kscanne@gmail.com> Irish translator
Gabor Kelemen <kelemeng@gnome.hu> Hungarian translator
Francisco Javier Tsao Santín <tsao@members.fsf.org>
Galician translator
Dimitriy Ryazantcev <DJm00n@mail.ru> Russian translator
Clytie Siddall <clytie@riverland.net.au> Vietnamese translator
LI Daobing <lidaobing@gmail.com> Chinese (simplified) translator
Jorma Karvonen <karvonen.jorma@gmail.com> Finnish translator
Aron Xu <happyaron.xu@gmail.com> Chinese (simplified) translator
Pavel Fric <pavelfric@seznam.cz> Czech translator
Pavel Maryanov <acid@jack.kiev.ua> Russian translator
Sergey Poznyakoff <gray@gnu.org> Polish translator
Ask Hjorth Larsen <asklarsen@gmail.com> Danish translator
Trần Ngọc Quân <vnwildman@gmail.com> Vietnamese translator
Klemen Košir <klemen913@gmail.com> Slovenian translator
Yasuaki Taniguchi <yasuakit@gmail.com> Japanese translator
Jorge González <aloriel@gmail.com> Spanish translator
Johnny A. Solbu <johnny@solbu.net> Norwegian Bokmål translator
Мирослав Николић <miroslavnikolic@rocketmail.com>
Serbian translator
Translations:
============
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com> Malay
Josef Andersson <josef.andersson@fripost.org> Swedish
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian
Mario Blättermann <mario.blaettermann@gmail.com> German
Wei-Lun CHAO <chaoweilun@pcmail.com.tw> Chinese (traditional)
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish
Yuri Chornoivan <yurchor@ukr.net> Ukrainian
Mihai Cristescu <mihai.cristescu@archlinux.info> Romanian
Marco Colombo <magicdice@inwind.it> Italian
Yavor Doganov <yavor@doganov.org> Bulgarian
Karl Eichwalder <keichwa@gmx.net> German
A. Murat EREN <meren@comu.edu.tr> Turkish
Rafael Ferreira <rafael.f.f1@gmail.com> Brazilian Portuguese
Doruk Fisek <dfisek@fisek.com.tr> Turkish
Pavel Fric <pavelfric@seznam.cz> Czech
Jorge González <aloriel@gmail.com> Spanish
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net> French
Geir Helland <pjallabais@users.sourceforge.net> Norwegian Bokmål
Tedi Heriyanto <tedi_h@gmx.net> Indonesian
Václav Haisman <V.Haisman@sh.cvut.cz> Czech
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian Nynorsk
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu> Hungarian
Jorma Karvonen <karvonen.jorma@gmail.com> Finnish
Gabor Kelemen <kelemeng@gnome.hu> Hungarian
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish
Eivind Kjørstad <ekj@vestdata.no> Norwegian Nynorsk
Florian König <floki@bigfoot.com> German
Klemen Košir <klemen913@gmail.com> Slovenian
Wojciech Kotwica <wkotwica@post.pl> Polish
Ask Hjorth Larsen <asklarsen@gmail.com> Danish
Clement Laforet <clem_laf@wanadoo.fr> French
LI Daobing <lidaobing@gmail.com> Chinese (simplified)
João Victor Duarte Martins <jvdm@sdf.lonestar.org> Brazilian Portuguese
Pavel Maryanov <acid@jack.kiev.ua> Russian
Daniele Medri <madrid@linux.it> Italian
Gergely Nagy <algernon@debian.org> Hungarian
Kalle Olavi Niemitalo <kon@iki.fi> Finnish
Мирослав Николић <miroslavnikolic@rocketmail.com> Serbian
Claudio Neves <cneves@nextis.com> Brazilian Portuguese
Daniel Nylander <po@danielnylander.se> Swedish
Mikel Olasagasti <hey_neken@mundurat.net> Basque
Michael Piefel <piefel@informatik.hu-berlin.de> German
Sergey Poznyakoff <gray@gnu.org> Polish
Trần Ngọc Quân <vnwildman@gmail.com> Vietnamese
Sergey A. Ribalchenko <fisher@obu.ck.ua> Ukrainian and Russian
Michel Robitaille <robitail@IRO.UMontreal.CA> French
Christian Rose <menthos@menthos.com> Swedish
Dimitriy Ryazantcev <DJm00n@mail.ru> Russian
Stig E Sandø <stig@ii.uib.no> Norwegian Bokmål
Kevin Patrick Scannell <kscanne@gmail.com> Irish
Benno Schulenberg <benno@vertaalt.nl> Dutch and Esperanto
Danilo Segan <dsegan@gmx.net> Serbian
Clytie Siddall <clytie@riverland.net.au> Vietnamese
Keld Simonsen <keld@dkuug.dk> Danish
Guus Sliepen <guus@nl.linux.org> Dutch
Cezary Sliwa <sliwa@cft.edu.pl> Polish
Johnny A. Solbu <johnny@solbu.net> Norwegian Bokmål
Pierre Tane <tanep@bigfoot.com> French
Yasuaki Taniguchi <yasuakit@gmail.com> Japanese
Jacobo Tarrío <jtarrio@trasno.net> Galician
Francisco Javier Tsao Santín <tsao@members.fsf.org> Galician
Miquel Vidal <miquel@sindominio.net> Catalan
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish
Aron Xu <happyaron.xu@gmail.com> Chinese (simplified)
Peio Ziarsolo <peio@sindominio.net> Basque
Anton Zinoviev <zinoviev@debian.org> Bulgarian
Other stuff:
===========
Ben Armstrong <synrg@sanctuary.nslug.ns.ca> Negative -r value idea, code
Thomas Dickey <dickey@herndon4.his.com> Curses help and advice
Sven Guckes <guckes@math.fu-berlin.de> Advice and Advocacy
Sven Guckes <guckes@math.fu-berlin.de> Advice and advocacy
Thijs Kinkhorst <thijs@kinkhorst.com> rnano.1 manpage
Jim Knoble <jmknoble@pobox.com> Pico compat for browser
Ryan Krebs <fluffy@highwire.stanford.edu> Many bug fixes and testing
Roy Lanek <lanek@ranahminang.net> Advice and advocacy
Mark Majeres <mark@engine12.com> Working undo/redo code
Chuck Mead <csm@MoonGroup.com> Feedback and RPM stuff
Mike Melanson <melanson@pcisys.net> Bugs
Neil Parks <nparks@acsmail.com> Bug reports and fixes
@@ -85,4 +90,5 @@ Jeremy Robichaud <robicj@yahoo.com> Beta tester
Bill Soudan <wes0472@rit.edu> Regex code, etc
Ken Tyler <kent@werple.net.au> Search fixes and more
$Id$

View File

@@ -20,7 +20,7 @@
#
# $Id$
AC_INIT([GNU nano], [2.4.0], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [2.4.1], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE

View File

@@ -418,6 +418,9 @@ Counts the number of words, lines and characters in the current buffer.
Invokes a spell-checking program (or a linting program, if the current
syntax highlighting defines one).
.TP
.B linter
A synonym of \fBspeller\fR (for when the speller has not been configured).
.TP
.B justify
Justifies the current paragraph.
.TP

View File

@@ -9,17 +9,17 @@ color red "^(19|20)[0-9-]{8}"
# Email addresses.
color yellow "<[^>]*@[^>]*>"
# Changed files.
color magenta "[[:space:]]\*[[:space:]].*:"
# Command-line options.
color cyan "[[:space:]]-[a-zA-Z\$]" "--[8a-z-]+"
# Bug numbers.
color cyan "bug #[0-9]{5}"
# Bug and patch numbers.
color cyan "bug #[0-9]{5,6}" "patch #[0-9]{4,5}"
# Probable variables, for variety.
color brightred "\<[A-Z_][0-9A-Z_]+\>"
# Key sequences.
color brightblue "\^[A-Z]" "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
# Changed files.
color magenta start="^( | {8})\* " end=":( |$)"
# Trailing whitespace.
color ,green "[[:space:]]+$"

View File

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

View File

@@ -1,6 +1,6 @@
## Here is an example for patch files.
syntax "patch" "\.(patch|diff)$"
syntax "patch" "\.(patch|diff|debdiff)$"
magic "diff output text"
# Added lines.

View File

@@ -12,12 +12,12 @@ color brightcyan "\<(global|if|import|in|is|lambda|not|or|pass|print|raise|retur
# Strings.
color brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
# Comments.
color brightred "(^|[[:blank:]])#.*$"
# Multiline strings.
color brightgreen start="\"\"\"([^"),]|$)" end="(^|[^(])\"\"\""
color brightgreen start="'''([^'),]|$)" end="(^|[^(])'''"
# Comments.
color brightred "(^|[[:blank:]])#.*$"
# Reminders.
color ,yellow "(FIXME|TODO|XXX)"

View File

@@ -8,8 +8,8 @@
@c Run 'makeinfo' rather than 'texinfo-format-buffer'.
@smallbook
@set EDITION 0.3
@set VERSION 2.4.0
@set UPDATED March 2015
@set VERSION 2.4.1
@set UPDATED April 2015
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @code{nano}
@subtitle a small and friendly text editor.
@subtitle version 2.4.0
@subtitle version 2.4.1
@author Chris Allegretta
@page
@@ -64,7 +64,7 @@ editor.
@menu
* Introduction::
* Editor Basics::
* Online Help::
* Built-in Help::
* Feature Toggles::
* Nanorc Files::
* The File Browser::
@@ -77,10 +77,10 @@ editor.
@chapter Introduction
GNU @code{nano} is a small and friendly text editor. Besides basic text
editing, @code{nano} offers many extra features, like an interactive
search-and-replace, go-to-line-and-column-number, auto-indentation,
feature toggles, internationalization support, and filename tab
completion.
editing, @code{nano} offers many extra features, such as an interactive
search-and-replace, undo/redo, syntax coloring, smooth scrolling,
auto-indentation, go-to-line-and-column-number, feature toggles,
file locking, backup files, and internationalization support.
@menu
* Overview::
@@ -98,23 +98,26 @@ as possible while offering a superset of Pico's functionality. See
The usual way to invoke @code{nano} is:
@quotation
@code{nano [OPTION]@dots{} [FILE]}
@code{nano [FILE]}
@end quotation
But it is also possible to edit several files in a row. Additionally,
the cursor can be put on a desired line number by adding this number
with a plus sign before any filename, and even in a desired column by
adding it with a comma. So the complete synopsis is:
But it is also possible to specify one or more options, and to edit
several files in a row. Additionally, the cursor can be put on a
specific line of a file by adding the line number
with a plus sign before the filename, and even in a specific column by
adding it with a comma. So the complete command synopsis is:
@quotation
@code{nano [OPTION]@dots{} [[+LINE] FILE]@dots{}}
@code{nano [OPTION]@dots{} [[+,COLUMN] FILE]@dots{}}
@code{nano [OPTION]@dots{} [[+LINE,COLUMN] FILE]@dots{}}
@code{nano [OPTION]@dots{} [[+LINE[,COLUMN]|+,COLUMN] FILE]@dots{}}
@end quotation
Email bug reports to @email{nano@@nano-editor.org}.
But normallly you would set your preferred options in your
@file{.nanorc} file. And when the @code{poslog} option is set
(making @code{nano} remember the cursor position), you will rarely
need to specify a line number.
Please email any bug reports to @email{nano@@nano-editor.org}.
Or file them at @url{https://savannah.gnu.org/bugs/?group=nano}.
@node Command Line Options
@section Command Line Options
@@ -487,12 +490,12 @@ The mouse will work in the X Window System, and on the console when gpm
is running.
@node Online Help
@chapter Online Help
@node Built-in Help
@chapter Built-in Help
The online help system in @code{nano} is available by pressing ^G.
It is fairly self-explanatory, documenting the various parts of the
editor and available keystrokes. Navigation is via the ^Y (Page Up)
The built-in help system in @code{nano} is available by pressing ^G.
It is fairly self-explanatory. It documents the various parts of the
editor and the available keystrokes. Navigation is via the ^Y (Page Up)
and ^V (Page Down) keys. ^X exits the help system.

644
po/bg.po

File diff suppressed because it is too large Load Diff

644
po/ca.po

File diff suppressed because it is too large Load Diff

644
po/cs.po

File diff suppressed because it is too large Load Diff

916
po/da.po

File diff suppressed because it is too large Load Diff

644
po/de.po

File diff suppressed because it is too large Load Diff

644
po/eo.po

File diff suppressed because it is too large Load Diff

644
po/es.po

File diff suppressed because it is too large Load Diff

644
po/eu.po

File diff suppressed because it is too large Load Diff

644
po/fi.po

File diff suppressed because it is too large Load Diff

664
po/fr.po

File diff suppressed because it is too large Load Diff

650
po/ga.po

File diff suppressed because it is too large Load Diff

644
po/gl.po

File diff suppressed because it is too large Load Diff

650
po/hu.po

File diff suppressed because it is too large Load Diff

644
po/id.po

File diff suppressed because it is too large Load Diff

644
po/it.po

File diff suppressed because it is too large Load Diff

650
po/ja.po

File diff suppressed because it is too large Load Diff

650
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

644
po/nb.po

File diff suppressed because it is too large Load Diff

644
po/nl.po

File diff suppressed because it is too large Load Diff

644
po/nn.po

File diff suppressed because it is too large Load Diff

644
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

644
po/ro.po

File diff suppressed because it is too large Load Diff

644
po/ru.po

File diff suppressed because it is too large Load Diff

650
po/sl.po

File diff suppressed because it is too large Load Diff

683
po/sr.po

File diff suppressed because it is too large Load Diff

644
po/sv.po

File diff suppressed because it is too large Load Diff

644
po/tr.po

File diff suppressed because it is too large Load Diff

646
po/uk.po

File diff suppressed because it is too large Load Diff

644
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

@@ -3,7 +3,8 @@
* browser.c *
* *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
* 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
* 2010, 2011, 2013, 2014, 2015 Free Software Foundation, Inc. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -39,10 +40,7 @@ static int width = 0;
static int 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. This variable
* is zero-based. */
static bool search_last_file = FALSE;
/* Have we gone past the last file while searching? */
/* The currently selected filename in the list; zero-based. */
/* Our main file browser function. path is the tilde-expanded path we
* start browsing from. */
@@ -52,8 +50,7 @@ char *do_browser(char *path, DIR *dir)
int kbinput;
bool old_const_update = ISSET(CONST_UPDATE);
char *prev_dir = NULL;
/* The directory we were in, if any, before backing up via
* browsing to "..". */
/* The directory we were in before backing up to "..". */
char *ans = NULL;
/* The last answer the user typed at the statusbar prompt. */
size_t old_selected;
@@ -63,7 +60,6 @@ char *do_browser(char *path, DIR *dir)
curs_set(0);
blank_statusbar();
currmenu = MBROWSER;
bottombars(MBROWSER);
wnoutrefresh(bottomwin);
@@ -92,7 +88,7 @@ char *do_browser(char *path, DIR *dir)
/* If prev_dir isn't NULL, select the directory saved in it, and
* then blow it away. */
if (prev_dir != NULL) {
browser_select_filename(prev_dir);
browser_select_dirname(prev_dir);
free(prev_dir);
prev_dir = NULL;
@@ -137,19 +133,16 @@ char *do_browser(char *path, DIR *dir)
width) + (mouse_x / (longest + 2));
/* If they clicked beyond the end of a row,
* select the filename at the end of that
* row. */
* select the last filename in that row. */
if (mouse_x > width * (longest + 2))
selected--;
/* If we're off the screen, select the last
* filename. */
/* If we're off the screen, select the last filename. */
if (selected > filelist_len - 1)
selected = filelist_len - 1;
/* If we selected the same filename as last
* time, put back the Enter key so that it's
* read in. */
/* If we selected the same filename as last time,
* put back the Enter key so that it's read in. */
if (old_selected == selected)
unget_kbinput(sc_seq_or(do_enter_void, 0), FALSE, FALSE);
}
@@ -203,7 +196,6 @@ char *do_browser(char *path, DIR *dir)
browser_refresh, _("Go To Directory"));
curs_set(0);
currmenu = MBROWSER;
bottombars(MBROWSER);
/* If the directory begins with a newline (i.e. an
@@ -691,56 +683,37 @@ void browser_refresh(void)
wnoutrefresh(edit);
}
/* Look for needle. If we find it, set selected to its location. Note
* that needle must be an exact match for a file in the list. The
* return value specifies whether we found anything. */
bool browser_select_filename(const char *needle)
/* Look for needle. If we find it, set selected to its location.
* Note that needle must be an exact match for a file in the list. */
void browser_select_dirname(const char *needle)
{
size_t currselected;
bool found = FALSE;
size_t looking_at = 0;
for (currselected = 0; currselected < filelist_len;
currselected++) {
if (strcmp(filelist[currselected], needle) == 0) {
found = TRUE;
for (; looking_at < filelist_len; looking_at++) {
if (strcmp(filelist[looking_at], needle) == 0) {
selected = looking_at;
break;
}
}
if (found)
selected = currselected;
return found;
}
/* Set up the system variables for a filename search. Return -1 if the
* search should be canceled (due to Cancel, a blank search string, or a
* failed regcomp()), return 0 on success, and return 1 on rerun calling
* program. */
/* Set up the system variables for a filename search. Return -1 or -2 if
* the search should be canceled (due to Cancel or a blank search string),
* return 0 when we have a string, and return a positive value when some
* function was run. */
int filesearch_init(void)
{
int i = 0;
int input;
char *buf;
static char *backupstring = NULL;
/* The search string we'll be using. */
/* If backupstring doesn't exist, initialize it to "". */
if (backupstring == NULL)
backupstring = mallocstrcpy(NULL, "");
/* We display the search prompt below. If the user types a partial
* search string and then Replace or a toggle, we will return to
* do_search() or do_replace() and be called again. In that case,
* we should put the same search string back up. */
search_init_globals();
if (last_search == NULL)
last_search = mallocstrcpy(NULL, "");
if (last_search[0] != '\0') {
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
buf = charalloc(strlen(disp) + 7);
/* We use (COLS / 3) here because we need to see more on the
* line. */
/* We use (COLS / 3) here because we need to see more on the line. */
sprintf(buf, " [%s%s]", disp,
(strlenpt(last_search) > COLS / 3) ? "..." : "");
free(disp);
@@ -748,11 +721,11 @@ int filesearch_init(void)
buf = mallocstrcpy(NULL, "");
/* This is now one simple call. It just does a lot. */
i = do_prompt(FALSE,
input = do_prompt(FALSE,
#ifndef DISABLE_TABCOMP
TRUE,
#endif
MWHEREISFILE, backupstring,
MWHEREISFILE, NULL,
#ifndef DISABLE_HISTORIES
&search_history,
#endif
@@ -761,100 +734,83 @@ int filesearch_init(void)
/* Release buf now that we don't need it anymore. */
free(buf);
free(backupstring);
backupstring = NULL;
/* If only Enter was pressed but we have a previous string, it's okay. */
if (input == -2 && *last_search != '\0')
return 0;
/* Cancel any search, or just return with no previous search. */
if (i == -1 || (i < 0 && *last_search == '\0') || (i == 0 &&
*answer == '\0')) {
/* Otherwise negative inputs are a bailout. */
if (input < 0)
statusbar(_("Cancelled"));
return -1;
}
return 0;
return input;
}
/* Look for needle. If no_sameline is TRUE, skip over selected when
* looking for needle. begin is the location of the filename where we
* first started searching. The return value specifies whether we found
* anything. */
bool findnextfile(bool no_sameline, size_t begin, const char *needle)
/* Look for the given needle in the list of files. */
void findnextfile(const char *needle)
{
size_t currselected = selected;
/* The location in the current file list of the match we
* find. */
const char *filetail = tail(filelist[currselected]);
size_t looking_at = selected;
/* The location in the file list of the filename we're looking at. */
bool came_full_circle = FALSE;
/* Have we reached the starting file again? */
const char *filetail = tail(filelist[looking_at]);
/* The filename we display, minus the path. */
const char *rev_start = filetail, *found = NULL;
/* Look for needle in the current filename we're searching. */
/* Step through each filename in the list until a match is found or
* we've come back to the point where we started. */
while (TRUE) {
found = strstrwrapper(filetail, needle, rev_start);
/* We've found a potential match. If we're not allowed to find
* a match on the same filename we started on and this potential
* match is on that line, continue searching. */
if (found != NULL && (!no_sameline || currselected != begin))
/* If we've found a match and it's not the same filename where
* we started, then we're done. */
if (found != NULL && looking_at != selected)
break;
/* We've finished processing the filenames, so get out. */
if (search_last_file) {
/* If we've found a match and we're back at the beginning, then
* it's the only occurrence. */
if (found != NULL && came_full_circle) {
statusbar(_("This is the only occurrence"));
break;
}
if (came_full_circle) {
/* We're back at the beginning and didn't find anything. */
not_found_msg(needle);
return FALSE;
return;
}
/* Move to the next filename in the list. If we've reached the
* end of the list, wrap around. */
if (currselected < filelist_len - 1)
currselected++;
if (looking_at < filelist_len - 1)
looking_at++;
else {
currselected = 0;
looking_at = 0;
statusbar(_("Search Wrapped"));
}
/* We've reached the original starting file. */
if (currselected == begin)
search_last_file = TRUE;
if (looking_at == selected)
/* We've reached the original starting file. */
came_full_circle = TRUE;
filetail = tail(filelist[currselected]);
filetail = tail(filelist[looking_at]);
rev_start = filetail;
}
/* We've definitely found something. */
selected = currselected;
return TRUE;
}
/* Clear the flag indicating that a search reached the last file in the
* list. We need to do this just before a new search. */
void findnextfile_wrap_reset(void)
{
search_last_file = FALSE;
}
/* Abort the current filename search. Clean up by setting the current
* shortcut list to the browser shortcut list, and displaying it. */
void filesearch_abort(void)
{
currmenu = MBROWSER;
bottombars(MBROWSER);
/* Select the one we've found. */
selected = looking_at;
}
/* Search for a filename. */
void do_filesearch(void)
{
size_t begin = selected;
bool didfind;
UNSET(CASE_SENSITIVE);
UNSET(USE_REGEXP);
UNSET(BACKWARDS_SEARCH);
if (filesearch_init() != 0) {
/* Cancelled or a blank search string. */
filesearch_abort();
/* Cancelled, or a blank search string, or done something. */
bottombars(MBROWSER);
return;
}
@@ -871,50 +827,21 @@ void do_filesearch(void)
update_history(&search_history, answer);
#endif
findnextfile_wrap_reset();
didfind = findnextfile(FALSE, begin, answer);
findnextfile(answer);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
if (selected == begin && didfind) {
/* Do the search again, skipping over the current line. We
* should only end up back at the same position if the string
* isn't found again, in which case it's the only occurrence. */
didfind = findnextfile(TRUE, begin, answer);
if (selected == begin && !didfind)
statusbar(_("This is the only occurrence"));
}
filesearch_abort();
bottombars(MBROWSER);
}
/* Search for the last filename without prompting. */
/* Search for the last given filename again without prompting. */
void do_fileresearch(void)
{
size_t begin = selected;
bool didfind;
if (last_search == NULL)
last_search = mallocstrcpy(NULL, "");
search_init_globals();
if (last_search[0] != '\0') {
findnextfile_wrap_reset();
didfind = findnextfile(FALSE, begin, answer);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
if (selected == begin && didfind) {
/* Do the search again, skipping over the current line. We
* should only end up back at the same position if the
* string isn't found again, in which case it's the only
* occurrence. */
didfind = findnextfile(TRUE, begin, answer);
if (selected == begin && !didfind)
statusbar(_("This is the only occurrence"));
}
} else
statusbar(_("No current search pattern"));
filesearch_abort();
if (last_search[0] == '\0')
statusbar(_("No current search pattern"));
else
findnextfile(last_search);
}
/* Select the first file in the list. */

View File

@@ -269,9 +269,9 @@ void color_update(void)
/* Open the magic database and get a diagnosis of the file. */
cookie = magic_open(MAGIC_SYMLINK |
#ifdef DEBUG
MAGIC_DEBUG | MAGIC_CHECK |
MAGIC_DEBUG | MAGIC_CHECK |
#endif
MAGIC_ERROR);
MAGIC_ERROR);
if (cookie == NULL || magic_load(cookie, NULL) < 0)
statusbar(_("magic_load() failed: %s"), strerror(errno));
else {

View File

@@ -1049,8 +1049,6 @@ void do_insertfile(
bool right_side_up = FALSE, single_line = FALSE;
#endif
currmenu = MINSERTFILE;
while (TRUE) {
#ifndef NANO_TINY
if (execute) {
@@ -2252,8 +2250,6 @@ bool do_writeout(bool exiting)
#endif
bool retval = FALSE;
currmenu = MWRITEFILE;
if (exiting && openfile->filename[0] != '\0' && ISSET(TEMP_FILE)) {
retval = write_file(openfile->filename, NULL, FALSE, OVERWRITE,
FALSE);

View File

@@ -42,6 +42,8 @@ bool meta_key;
/* Whether the current keystroke is a Meta key. */
bool func_key;
/* Whether the current keystroke is an extended keypad value. */
bool focusing = FALSE;
/* Whether an update of the edit window should center the cursor. */
#ifndef DISABLE_WRAPJUSTIFY
ssize_t fill = 0;
@@ -137,9 +139,9 @@ char *backup_dir = NULL;
/* The directory where we store backup files. */
const char *locking_prefix = ".";
/* Prefix of how to store the vim-style lock file. */
/* Prefix of how to store the vim-style lock file. */
const char *locking_suffix = ".swp";
/* Suffix of the vim-style lock file. */
/* Suffix of the vim-style lock file. */
#endif
#ifndef DISABLE_OPERATINGDIR
char *operating_dir = NULL;
@@ -223,7 +225,7 @@ size_t length_of_list(int menu)
size_t i = 0;
for (f = allfuncs; f != NULL; f = f->next)
if ((f->menus & menu) != 0
if ((f->menus & menu) != 0
#ifndef DISABLE_HELP
&& strlen(f->help) > 0
#endif
@@ -374,7 +376,7 @@ int sc_seq_or(void (*func)(void), int defaultval)
if (s) {
meta_key = (s->type == META);
return s->seq;
return s->seq;
}
/* else */
return defaultval;
@@ -409,16 +411,16 @@ key_type strtokeytype(const char *str)
void assign_keyinfo(sc *s)
{
if (s->type == CONTROL) {
assert(strlen(s->keystr) > 1);
s->seq = s->keystr[1] - 64;
assert(strlen(s->keystr) > 1);
s->seq = s->keystr[1] - 64;
} else if (s->type == META) {
assert(strlen(s->keystr) > 2);
s->seq = tolower((int) s->keystr[2]);
assert(strlen(s->keystr) > 2);
s->seq = tolower((int) s->keystr[2]);
} else if (s->type == FKEY) {
assert(strlen(s->keystr) > 1);
s->seq = KEY_F0 + atoi(&s->keystr[1]);
assert(strlen(s->keystr) > 1);
s->seq = KEY_F0 + atoi(&s->keystr[1]);
} else /* RAWINPUT */
s->seq = (int) s->keystr[0];
s->seq = (int) s->keystr[0];
/* Override some keys which don't bind as easily as we'd like. */
if (s->type == CONTROL && (!strcasecmp(&s->keystr[1], "space")))
@@ -639,8 +641,10 @@ void shortcut_init(void)
const char *nano_lint_msg = N_("Invoke the linter, if available");
const char *nano_prevlint_msg = N_("Go to previous linter msg");
const char *nano_nextlint_msg = N_("Go to next linter msg");
#ifndef DISABLE_SPELLER
const char *nano_formatter_msg = N_("Invoke formatter, if available");
#endif
#endif
#endif /* !DISABLE_HELP */
#ifndef DISABLE_HELP
@@ -650,9 +654,9 @@ void shortcut_init(void)
#endif
while (allfuncs != NULL) {
subnfunc *f = allfuncs;
allfuncs = allfuncs->next;
free(f);
subnfunc *f = allfuncs;
allfuncs = allfuncs->next;
free(f);
}
/* Start populating the different menus with functions. */
@@ -736,9 +740,11 @@ void shortcut_init(void)
#ifndef DISABLE_COLOR
add_to_funcs(do_linter, MMAIN,
N_("To Linter"), IFSCHELP(nano_lint_msg), TOGETHER, NOVIEW);
#ifndef DISABLE_SPELLER
add_to_funcs(do_formatter, MMAIN,
N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, NOVIEW);
#endif
#endif
#ifndef NANO_TINY
add_to_funcs(case_sens_void, MWHEREIS|MREPLACE,
@@ -924,28 +930,28 @@ void shortcut_init(void)
* specified on the command line, and the fifth is useless since
* backups are disabled. */
if (!ISSET(RESTRICTED)) {
add_to_funcs(dos_format_void, MWRITEFILE,
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
add_to_funcs(dos_format_void, MWRITEFILE,
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
add_to_funcs(mac_format_void, MWRITEFILE,
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
add_to_funcs(mac_format_void, MWRITEFILE,
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
add_to_funcs(append_void, MWRITEFILE,
N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW);
add_to_funcs(prepend_void, MWRITEFILE,
N_("Prepend"), IFSCHELP(nano_prepend_msg), TOGETHER, NOVIEW);
add_to_funcs(append_void, MWRITEFILE,
N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW);
add_to_funcs(prepend_void, MWRITEFILE,
N_("Prepend"), IFSCHELP(nano_prepend_msg), TOGETHER, NOVIEW);
add_to_funcs(backup_file_void, MWRITEFILE,
N_("Backup File"), IFSCHELP(nano_backup_msg), TOGETHER, NOVIEW);
add_to_funcs(backup_file_void, MWRITEFILE,
N_("Backup File"), IFSCHELP(nano_backup_msg), TOGETHER, NOVIEW);
}
/* 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_void, MINSERTFILE,
N_("Execute Command"), IFSCHELP(nano_execute_msg), TOGETHER, NOVIEW);
add_to_funcs(flip_execute_void, MEXTCMD,
add_to_funcs(flip_execute_void, MEXTCMD,
read_file_tag, IFSCHELP(nano_insert_msg), TOGETHER, NOVIEW);
#ifndef DISABLE_MULTIBUFFER
@@ -1006,12 +1012,14 @@ void shortcut_init(void)
#ifndef DISABLE_SPELLER
add_to_sclist(MMAIN, "^T", do_spell, 0);
add_to_sclist(MMAIN, "F12", do_spell, 0);
#ifndef DISABLE_COLOR
add_to_sclist(MMAIN, "^T", do_formatter, 0);
add_to_sclist(MMAIN, "F12", do_formatter, 0);
#endif
#else
#ifndef DISABLE_COLOR
add_to_sclist(MMAIN, "^T", do_linter, 0);
add_to_sclist(MMAIN, "F12", do_linter, 0);
add_to_sclist(MMAIN, "^T", do_formatter, 0);
add_to_sclist(MMAIN, "F12", do_formatter, 0);
#endif
#endif
add_to_sclist(MMAIN, "^C", do_cursorpos_void, 0);
@@ -1019,12 +1027,12 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "^_", do_gotolinecolumn_void, 0);
add_to_sclist(MMAIN, "M-G", do_gotolinecolumn_void, 0);
add_to_sclist(MMAIN, "F13", do_gotolinecolumn_void, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "^Y", do_page_up, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "F7", do_page_up, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "PgUp", do_page_up, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "^V", do_page_down, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "F8", do_page_down, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "PgDn", do_page_down, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^Y", do_page_up, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F7", do_page_up, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgUp", do_page_up, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", do_page_down, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", do_page_down, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", do_page_down, 0);
add_to_sclist(MMAIN|MHELP, "M-\\", do_first_line, 0);
add_to_sclist(MMAIN|MHELP, "M-|", do_first_line, 0);
add_to_sclist(MMAIN|MHELP, "M-/", do_last_line, 0);
@@ -1149,11 +1157,13 @@ void shortcut_init(void)
#ifndef DISABLE_BROWSER
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", do_first_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", do_first_file, 0);
add_to_sclist(MWHEREISFILE, "^Y", do_first_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", do_last_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", do_last_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "^_", goto_dir_void, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-G", goto_dir_void, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "F13", goto_dir_void, 0);
add_to_sclist(MWHEREISFILE, "^V", do_last_file, 0);
add_to_sclist(MBROWSER, "^_", goto_dir_void, 0);
add_to_sclist(MBROWSER, "M-G", goto_dir_void, 0);
add_to_sclist(MBROWSER, "F13", goto_dir_void, 0);
#endif
add_to_sclist(MWRITEFILE, "M-D", dos_format_void, 0);
add_to_sclist(MWRITEFILE, "M-M", mac_format_void, 0);
@@ -1221,44 +1231,44 @@ const subnfunc *sctofunc(sc *s)
const char *flagtostr(int flag)
{
switch (flag) {
case NO_HELP:
/* TRANSLATORS: The next seventeen strings are toggle descriptions;
* they are best kept shorter than 40 characters, but may be longer. */
return N_("Help mode");
case CONST_UPDATE:
return N_("Constant cursor position display");
case MORE_SPACE:
return N_("Use of one more line for editing");
case SMOOTH_SCROLL:
return N_("Smooth scrolling");
case SOFTWRAP:
return N_("Soft wrapping of overlong lines");
case WHITESPACE_DISPLAY:
return N_("Whitespace display");
case NO_COLOR_SYNTAX:
return N_("Color syntax highlighting");
case SMART_HOME:
return N_("Smart home key");
case AUTOINDENT:
return N_("Auto indent");
case CUT_TO_END:
return N_("Cut to end");
case NO_WRAP:
return N_("Hard wrapping of overlong lines");
case TABS_TO_SPACES:
return N_("Conversion of typed tabs to spaces");
case BACKUP_FILE:
return N_("Backup files");
case MULTIBUFFER:
return N_("Multiple file buffers");
case USE_MOUSE:
return N_("Mouse support");
case NO_CONVERT:
return N_("No conversion from DOS/Mac format");
case SUSPEND:
return N_("Suspension");
default:
return "?????";
case NO_HELP:
/* TRANSLATORS: The next seventeen strings are toggle descriptions;
* they are best kept shorter than 40 characters, but may be longer. */
return N_("Help mode");
case CONST_UPDATE:
return N_("Constant cursor position display");
case MORE_SPACE:
return N_("Use of one more line for editing");
case SMOOTH_SCROLL:
return N_("Smooth scrolling");
case SOFTWRAP:
return N_("Soft wrapping of overlong lines");
case WHITESPACE_DISPLAY:
return N_("Whitespace display");
case NO_COLOR_SYNTAX:
return N_("Color syntax highlighting");
case SMART_HOME:
return N_("Smart home key");
case AUTOINDENT:
return N_("Auto indent");
case CUT_TO_END:
return N_("Cut to end");
case NO_WRAP:
return N_("Hard wrapping of overlong lines");
case TABS_TO_SPACES:
return N_("Conversion of typed tabs to spaces");
case BACKUP_FILE:
return N_("Backup files");
case MULTIBUFFER:
return N_("Multiple file buffers");
case USE_MOUSE:
return N_("Mouse support");
case NO_CONVERT:
return N_("No conversion from DOS/Mac format");
case SUSPEND:
return N_("Suspension");
default:
return "?????";
}
}
#endif /* !NANO_TINY */
@@ -1310,6 +1320,10 @@ sc *strtosc(char *input)
else if (!strcasecmp(input, "tospell") ||
!strcasecmp(input, "speller"))
s->scfunc = do_spell;
#endif
#ifndef DISABLE_COLOR
else if (!strcasecmp(input, "linter"))
s->scfunc = do_linter;
#endif
else if (!strcasecmp(input, "curpos") ||
!strcasecmp(input, "cursorpos"))
@@ -1528,7 +1542,7 @@ int strtomenu(char *input)
return MHELP;
#endif
#ifndef DISABLE_SPELLER
else if (!strcasecmp(input, "spell") || !strcasecmp(input, "formatter"))
else if (!strcasecmp(input, "spell"))
return MSPELL;
#endif
else if (!strcasecmp(input, "linter"))
@@ -1569,7 +1583,7 @@ void thanks_for_all_the_fish(void)
#endif
#ifndef NANO_TINY
if (backup_dir != NULL)
free(backup_dir);
free(backup_dir);
#endif
#ifndef DISABLE_OPERATINGDIR
if (operating_dir != NULL)
@@ -1663,14 +1677,14 @@ void thanks_for_all_the_fish(void)
#endif
/* Free the functions and shortcuts lists. */
while (allfuncs != NULL) {
subnfunc *f = allfuncs;
allfuncs = allfuncs->next;
free(f);
subnfunc *f = allfuncs;
allfuncs = allfuncs->next;
free(f);
}
while (sclist != NULL) {
sc *s = sclist;
sclist = sclist->next;
free(s);
sc *s = sclist;
sclist = sclist->next;
free(s);
}
#ifndef DISABLE_NANORC
if (homedir != NULL)

View File

@@ -62,10 +62,6 @@ void do_help(void (*refresh_func)(void))
assert(help_text != NULL);
/* Set currmenu to allow clicking on the help screen's shortcut
* list, after help_init() is called. */
currmenu = MHELP;
if (ISSET(NO_HELP)) {
/* Make sure that the help screen's shortcut list will actually
* be displayed. */
@@ -158,15 +154,14 @@ void do_help(void (*refresh_func)(void))
}
}
currmenu = oldmenu;
if (old_no_help) {
blank_bottombars();
wnoutrefresh(bottomwin);
currmenu = oldmenu;
SET(NO_HELP);
window_init();
} else
bottombars(currmenu);
bottombars(oldmenu);
curs_set(1);
refresh_func();

View File

@@ -719,9 +719,9 @@ void die_save_file(const char *die_filename
_("Too many backup files?"));
#ifndef NANO_TINY
/* Try and chmod/chown the save file to the values of the original file, but
dont worry if it fails because we're supposed to be bailing as fast
as possible. */
/* 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. */
if (die_stat) {
int shush;
shush = chmod(retval, die_stat->st_mode);
@@ -1145,8 +1145,8 @@ void do_exit(void)
if (i == 0 || (i == 1 && do_writeout(TRUE))) {
#ifndef NANO_TINY
if (ISSET(LOCKING) && openfile->lock_filename)
delete_lockfile(openfile->lock_filename);
if (ISSET(LOCKING) && openfile->lock_filename)
delete_lockfile(openfile->lock_filename);
#endif
#ifndef DISABLE_MULTIBUFFER
@@ -1282,9 +1282,8 @@ RETSIGTYPE handle_hupterm(int signal)
/* Handler for SIGTSTP (suspend). */
RETSIGTYPE do_suspend(int signal)
{
if (ISSET(RESTRICTED)) {
nano_disabled_msg();
nano_disabled_msg();
return;
}
@@ -1804,7 +1803,7 @@ int do_mouse(void)
mouse_x, (unsigned long)openfile->current_x);
#endif
} else {
openfile->current_x = actual_x(openfile->current->data, mouse_x);
openfile->current_x = actual_x(openfile->current->data, mouse_x);
#ifdef DEBUG
fprintf(stderr, "do_mouse(): i <= mouse_y, mouse_x = %d, setting current_x to = %lu\n",
mouse_x, (unsigned long)openfile->current_x);
@@ -2481,8 +2480,8 @@ int main(int argc, char **argv)
do_rcfile();
#ifdef DEBUG
fprintf(stderr, "After rebinding keys...\n");
print_sclist();
fprintf(stderr, "After rebinding keys...\n");
print_sclist();
#endif
#ifndef DISABLE_OPERATINGDIR
@@ -2739,7 +2738,7 @@ int main(int argc, char **argv)
icol = 1;
}
#ifndef DISABLE_HISTORIES
else {
else {
/* See if we have a POS history to use if we haven't overridden it. */
ssize_t savedposline, savedposcol;
if (check_poshistory(argv[i], &savedposline, &savedposcol))
@@ -2824,7 +2823,7 @@ int main(int argc, char **argv)
if (ISSET(CONST_UPDATE) && get_key_buffer_len() == 0)
do_cursorpos(TRUE);
currmenu = MMAIN;
currmenu = MMAIN;
/* Read in and interpret characters. */
do_input(TRUE);

View File

@@ -969,7 +969,6 @@ int do_prompt(bool allow_tabs,
prompt = charalloc(((COLS - 4) * mb_cur_max()) + 1);
currmenu = menu;
bottombars(menu);
va_start(ap, msg);

View File

@@ -34,6 +34,7 @@ extern bool jump_buf_main;
extern bool meta_key;
extern bool func_key;
extern bool focusing;
#ifndef DISABLE_WRAPJUSTIFY
extern ssize_t fill;
@@ -148,10 +149,9 @@ char *do_browse_from(const char *inpath);
void browser_init(const char *path, DIR *dir);
functionptrtype parse_browser_input(int *kbinput);
void browser_refresh(void);
bool browser_select_filename(const char *needle);
void browser_select_dirname(const char *needle);
int filesearch_init(void);
bool findnextfile(bool no_sameline, size_t begin, const char *needle);
void findnextfile_wrap_reset(void);
void findnextfile(const char *needle);
void filesearch_abort(void);
void do_filesearch(void);
void do_fileresearch(void);

View File

@@ -601,11 +601,7 @@ static void _parse_include(char *file)
fprintf(stderr, "Parsing file \"%s\"\n", file);
#endif
parse_rcfile(rcstream
#ifndef DISABLE_COLOR
, TRUE
#endif
);
parse_rcfile(rcstream, TRUE);
}
void parse_include(char *ptr)
@@ -907,11 +903,10 @@ void parse_header_exp(char *ptr)
}
}
#ifndef DISABLE_COLOR
#ifdef HAVE_LIBMAGIC
/* Parse the magic regexes that may influence the choice of syntax. */
void parse_magic_exp(char *ptr)
{
#ifdef HAVE_LIBMAGIC
regexlisttype *endmagic = NULL;
assert(ptr != NULL);
@@ -971,11 +966,10 @@ void parse_magic_exp(char *ptr)
} else
free(newmagic);
}
#endif /* HAVE_LIBMAGIC */
}
#endif /* !DISABLE_COLOR */
#endif /* HAVE_LIBMAGIC */
/* Parse the linter requested for this syntax. Simple? */
/* Parse the linter requested for this syntax. */
void parse_linter(char *ptr)
{
assert(ptr != NULL);
@@ -998,9 +992,11 @@ void parse_linter(char *ptr)
if (!strcmp(ptr, "\"\""))
endsyntax->linter = NULL;
else
endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr);
endsyntax->linter = mallocstrcpy(NULL, ptr);
}
#ifndef DISABLE_SPELLER
/* Parse the formatter requested for this syntax. */
void parse_formatter(char *ptr)
{
assert(ptr != NULL);
@@ -1023,8 +1019,9 @@ void parse_formatter(char *ptr)
if (!strcmp(ptr, "\"\""))
endsyntax->formatter = NULL;
else
endsyntax->formatter = mallocstrcpy(syntaxes->formatter, ptr);
endsyntax->formatter = mallocstrcpy(NULL, ptr);
}
#endif /* !DISABLE_SPELLER */
#endif /* !DISABLE_COLOR */
/* Check whether the user has unmapped every shortcut for a
@@ -1151,7 +1148,11 @@ void parse_rcfile(FILE *rcstream
parse_syntax(ptr);
}
else if (strcasecmp(keyword, "magic") == 0)
#ifdef HAVE_LIBMAGIC
parse_magic_exp(ptr);
#else
;
#endif
else if (strcasecmp(keyword, "header") == 0)
parse_header_exp(ptr);
else if (strcasecmp(keyword, "color") == 0)
@@ -1161,7 +1162,11 @@ void parse_rcfile(FILE *rcstream
else if (strcasecmp(keyword, "linter") == 0)
parse_linter(ptr);
else if (strcasecmp(keyword, "formatter") == 0)
#ifndef DISABLE_SPELLER
parse_formatter(ptr);
#else
;
#endif
#endif /* !DISABLE_COLOR */
else if (strcasecmp(keyword, "bind") == 0)
parse_binding(ptr, TRUE);

View File

@@ -106,6 +106,7 @@ void not_found_msg(const char *str)
void search_replace_abort(void)
{
display_main_list();
focusing = FALSE;
#ifndef NANO_TINY
if (openfile->mark_set)
edit_refresh();
@@ -118,6 +119,7 @@ void search_replace_abort(void)
/* Initialize the global search and replace strings. */
void search_init_globals(void)
{
focusing = TRUE;
if (last_search == NULL)
last_search = mallocstrcpy(NULL, "");
if (last_replace == NULL)
@@ -488,7 +490,7 @@ void do_search(void)
* back at the same position if the string isn't found again, in
* which case it's the only occurrence. */
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
last_search)) {
answer)) {
didfind = findnextstr(
#ifndef DISABLE_SPELLER
FALSE,
@@ -554,7 +556,7 @@ void do_research(void)
FALSE,
#endif
TRUE, openfile->current, openfile->current_x,
answer, NULL);
last_search, NULL);
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && !didfind)
statusbar(_("This is the only occurrence"));
@@ -690,25 +692,26 @@ ssize_t do_replace_loop(
#endif
#ifndef NANO_TINY
bool old_mark_set = openfile->mark_set;
filestruct *edittop_save = openfile->edittop, *top, *bot;
filestruct *top, *bot;
size_t top_x, bot_x;
bool right_side_up = FALSE;
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
* FALSE if (current, current_x) is. */
if (old_mark_set) {
/* If the mark is on, partition the filestruct so that it
* contains only the marked text, set edittop to the top of the
* partition, turn the mark off, and refresh the screen. */
/* If the mark is on, frame the region, and turn the mark off. */
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
filepart = partition_filestruct(top, top_x, bot, bot_x);
openfile->edittop = openfile->fileage;
openfile->mark_set = FALSE;
#ifndef DISABLE_COLOR
reset_multis(openfile->current, TRUE);
#endif
edit_refresh();
/* Start either at the top or the bottom of the marked region. */
if (!ISSET(BACKWARDS_SEARCH)) {
openfile->current = top;
openfile->current_x = (top_x == 0 ? 0 : top_x - 1);
} else {
openfile->current = bot;
openfile->current_x = bot_x;
}
}
#endif /* !NANO_TINY */
@@ -732,6 +735,18 @@ ssize_t do_replace_loop(
, real_current, *real_current_x, needle, &match_len)) {
int i = 0;
#ifndef NANO_TINY
if (old_mark_set) {
/* When we've found an occurrence outside of the marked region,
* stop the fanfare. */
if (openfile->current->lineno > bot->lineno ||
openfile->current->lineno < top->lineno ||
(openfile->current == bot && openfile->current_x > bot_x) ||
(openfile->current == top && openfile->current_x < top_x))
break;
}
#endif
#ifdef HAVE_REGEX_H
/* If the bol_or_eol flag is set, we've found a match on the
* beginning line already, and we're still on the beginning line
@@ -748,9 +763,6 @@ ssize_t do_replace_loop(
}
#endif
if (!replaceall)
edit_refresh();
/* Indicate that we found the search string. */
if (numreplaced == -1)
numreplaced = 0;
@@ -761,6 +773,8 @@ ssize_t do_replace_loop(
xpt, strnlenpt(openfile->current->data,
openfile->current_x + match_len) - xpt, FALSE);
edit_refresh();
curs_set(0);
do_replace_highlight(TRUE, exp_word);
@@ -784,8 +798,7 @@ ssize_t do_replace_loop(
#ifdef HAVE_REGEX_H
/* Set the bol_or_eol flag if we're doing a bol and/or eol regex
* replace ("^", "$", or "^$"). */
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
needle))
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp, needle))
bol_or_eol = TRUE;
#endif
@@ -794,15 +807,14 @@ ssize_t do_replace_loop(
size_t length_change;
#ifndef NANO_TINY
update_undo(REPLACE);
add_undo(REPLACE);
#endif
if (i == 2)
replaceall = TRUE;
copy = replace_line(needle);
length_change = strlen(copy) -
strlen(openfile->current->data);
length_change = strlen(copy) - strlen(openfile->current->data);
#ifndef NANO_TINY
/* If the mark was on and (mark_begin, mark_begin_x) was the
@@ -816,6 +828,7 @@ ssize_t do_replace_loop(
openfile->mark_begin_x = openfile->current_x;
else
openfile->mark_begin_x += length_change;
bot_x = openfile->mark_begin_x;
}
}
@@ -826,15 +839,14 @@ ssize_t do_replace_loop(
/* Keep real_current_x in sync with the text changes. */
if (openfile->current == real_current &&
openfile->current_x <= *real_current_x) {
if (*real_current_x <
openfile->current_x + match_len)
*real_current_x = openfile->current_x +
match_len;
if (*real_current_x < openfile->current_x + match_len)
*real_current_x = openfile->current_x + match_len;
*real_current_x += length_change;
}
#ifndef NANO_TINY
}
bot_x = *real_current_x;
}
#endif
}
/* Set the cursor at the last character of the replacement
* text, so searching will resume after the replacement
@@ -852,9 +864,12 @@ ssize_t do_replace_loop(
openfile->current->data = copy;
#ifndef DISABLE_COLOR
reset_multis(openfile->current, TRUE);
/* Reset the precalculated multiline-regex hints only when
* the first replacement has been made. */
if (numreplaced == 0)
reset_multis(openfile->current, TRUE);
#endif
edit_refresh();
if (!replaceall) {
#ifndef DISABLE_COLOR
/* If color syntaxes are available and turned on, we
@@ -872,16 +887,12 @@ ssize_t do_replace_loop(
}
}
if (numreplaced == -1)
not_found_msg(needle);
#ifndef NANO_TINY
if (old_mark_set) {
/* If the mark was on, unpartition the filestruct so that it
* contains all the text again, set edittop back to what it was
* before, turn the mark back on, and refresh the screen. */
unpartition_filestruct(&filepart);
openfile->edittop = edittop_save;
if (old_mark_set)
openfile->mark_set = TRUE;
edit_refresh();
}
#endif
/* If the NO_NEWLINES flag isn't set, and text has been added to the

View File

@@ -2213,7 +2213,6 @@ void do_justify(bool full_justify)
/* Display the shortcut list with UnJustify. */
uncutfunc->desc = unjust_tag;
currmenu = MMAIN;
display_main_list();
/* Now get a keystroke and see if it's unjustify. If not, put back
@@ -2246,8 +2245,8 @@ void do_justify(bool full_justify)
* replaced with the unjustified paragraph. */
unpartition_filestruct(&filepart);
/* Renumber starting with the beginning line of the old
* partition. */
/* Renumber, starting with the beginning line of the old
* partition. */
renumber(top_save);
/* Restore the justify we just did (ungrateful user!). */
@@ -2523,7 +2522,7 @@ const char *do_int_speller(const char *tempfile_name)
/* A new process to run sort in. */
if ((pid_sort = fork()) == 0) {
/* Child continues (i.e. future spell process). Replace the
/* Child continues (i.e. future sort process). Replace the
* standard input with the standard output of the old pipe. */
if (dup2(spell_fd[0], STDIN_FILENO) != STDIN_FILENO)
goto close_pipes_and_exit;
@@ -2536,8 +2535,7 @@ const char *do_int_speller(const char *tempfile_name)
close(sort_fd[1]);
/* Start the sort program. Use -f to remove mixed case. If
* this isn't portable, let me know. */
/* Start the sort program. Use -f to ignore case. */
execlp("sort", "sort", "-f", NULL);
/* This should not be reached if sort is found. */
@@ -2626,7 +2624,7 @@ const char *do_int_speller(const char *tempfile_name)
search_replace_abort();
edit_refresh_needed = TRUE;
/* Process the end of the spell process. */
/* Process the end of the three processes. */
waitpid(pid_spell, &spell_status, 0);
waitpid(pid_sort, &sort_status, 0);
waitpid(pid_uniq, &uniq_status, 0);
@@ -2664,7 +2662,7 @@ const char *do_alt_speller(char *tempfile_name)
ssize_t current_y_save = openfile->current_y;
ssize_t lineno_save = openfile->current->lineno;
struct stat spellfileinfo;
__time_t timestamp;
time_t timestamp;
pid_t pid_spell;
char *ptr;
static int arglen = 3;
@@ -2675,6 +2673,7 @@ const char *do_alt_speller(char *tempfile_name)
/* Whether we added a magicline after filebot. */
filestruct *top, *bot;
size_t top_x, bot_x;
bool right_side_up = FALSE;
ssize_t mb_lineno_save = 0;
/* We're going to close the current file, and open the output of
* the alternate spell command. The line that mark_begin points
@@ -2683,7 +2682,17 @@ const char *do_alt_speller(char *tempfile_name)
size_t totsize_save = openfile->totsize;
/* Our saved value of totsize, used when we spell-check a marked
* selection. */
#endif
/* Get the timestamp and the size of the temporary file. */
stat(tempfile_name, &spellfileinfo);
timestamp = spellfileinfo.st_mtime;
/* If the number of bytes to check is zero, get out. */
if (spellfileinfo.st_size == 0)
return NULL;
#ifndef NANO_TINY
if (old_mark_set) {
/* If the mark is on, save the number of the line it starts on,
* and then turn the mark off. */
@@ -2692,18 +2701,9 @@ const char *do_alt_speller(char *tempfile_name)
}
#endif
if (openfile->totsize == 0) {
statusbar(_("Finished checking spelling"));
return NULL;
}
/* Get the timestamp of the temporary file. */
stat(tempfile_name, &spellfileinfo);
timestamp = spellfileinfo.st_mtime;
endwin();
/* Set up an argument list to pass execvp(). */
/* Set up an argument list to pass to execvp(). */
if (spellargs == NULL) {
spellargs = (char **)nmalloc(arglen * sizeof(char *));
@@ -2778,7 +2778,7 @@ const char *do_alt_speller(char *tempfile_name)
* added when we're done correcting misspelled words; and
* turn the mark off. */
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, NULL);
(const filestruct **)&bot, &bot_x, &right_side_up);
filepart = partition_filestruct(top, top_x, bot, bot_x);
if (!ISSET(NO_NEWLINES))
added_magicline = (openfile->filebot->data[0] != '\0');
@@ -2796,6 +2796,12 @@ const char *do_alt_speller(char *tempfile_name)
#ifndef NANO_TINY
if (old_mark_set) {
filestruct *top_save = openfile->fileage;
/* Adjust the end point of the marked region for any change in
length of the region's last line. */
if (right_side_up)
current_x_save = strlen(openfile->filebot->data);
else
openfile->mark_begin_x = strlen(openfile->filebot->data);
/* If the mark was on, the NO_NEWLINES flag isn't set, and we
* added a magicline, remove it now. */
@@ -2817,13 +2823,7 @@ const char *do_alt_speller(char *tempfile_name)
openfile->totsize = totsize_save;
/* Assign mark_begin to the line where the mark began before. */
goto_line_posx(mb_lineno_save, openfile->mark_begin_x);
openfile->mark_begin = openfile->current;
/* Assign mark_begin_x to the location in mark_begin where the
* mark began before, adjusted for any shortening of the
* line. */
openfile->mark_begin_x = openfile->current_x;
openfile->mark_begin = fsfromline(mb_lineno_save);
/* Turn the mark back on. */
openfile->mark_set = TRUE;
@@ -2912,7 +2912,6 @@ void do_spell(void)
/* Cleanup things to do after leaving the linter. */
void lint_cleanup(void)
{
currmenu = MMAIN;
display_main_list();
}
@@ -2969,7 +2968,7 @@ void do_linter(void)
statusbar(_("Invoking linter, please wait"));
doupdate();
/* Set up an argument list to pass execvp(). */
/* Set up an argument list to pass to execvp(). */
if (lintargs == NULL) {
lintargs = (char **)nmalloc(arglen * sizeof(char *));
@@ -2984,13 +2983,13 @@ void do_linter(void)
}
lintargs[arglen - 2] = openfile->filename;
/* A new process to run linter. */
/* A new process to run the linter in. */
if ((pid_lint = fork()) == 0) {
/* Child continues (i.e. future spell process). */
/* Child continues (i.e. future linting process). */
close(lint_fd[0]);
/* Send spell's standard output/err to the pipe. */
/* Send the linter's standard output + err to the pipe. */
if (dup2(lint_fd[1], STDOUT_FILENO) != STDOUT_FILENO)
exit(1);
if (dup2(lint_fd[1], STDERR_FILENO) != STDERR_FILENO)
@@ -3024,7 +3023,7 @@ void do_linter(void)
return;
}
/* Read in the returned spelling errors. */
/* Read in the returned syntax errors. */
read_buff_read = 0;
read_buff_size = pipe_buff_size + 1;
read_buff = read_buff_ptr = charalloc(read_buff_size);
@@ -3048,7 +3047,7 @@ void do_linter(void)
fprintf(stderr, "text.c:do_lint:Raw output: %s\n", read_buff);
#endif
/* Process output. */
/* Process the output. */
read_buff_word = read_buff_ptr = read_buff;
while (*read_buff_ptr != '\0') {
@@ -3116,7 +3115,9 @@ void do_linter(void)
read_buff_ptr++;
}
/* Process the end of the lint process. */
/* Process the end of the linting process.
* XXX: The return value should be checked.
* Will make an invocation-error routine. */
waitpid(pid_lint, &lint_status, 0);
free(read_buff);
@@ -3127,7 +3128,6 @@ void do_linter(void)
return;
}
currmenu = MLINTER;
bottombars(MLINTER);
tmplint = NULL;
curlint = lints;
@@ -3222,12 +3222,10 @@ free_lints_and_return:
lint_cleanup();
}
/* Run a formatter for the given syntax.
* Expects the formatter to be non-interactive and
* operate on a file in-place, which we'll pass it
* on the command line. Another mashup of the speller
* and alt_speller routines.
*/
#ifndef DISABLE_SPELLER
/* Run a formatter for the current syntax. This expects the formatter
* to be non-interactive and operate on a file in-place, which we'll
* pass it on the command line. */
void do_formatter(void)
{
bool status;
@@ -3282,7 +3280,7 @@ void do_formatter(void)
endwin();
/* Set up an argument list to pass execvp(). */
/* Set up an argument list to pass to execvp(). */
if (formatargs == NULL) {
formatargs = (char **)nmalloc(arglen * sizeof(char *));
@@ -3363,15 +3361,13 @@ void do_formatter(void)
unlink(temp);
free(temp);
currmenu = MMAIN;
/* If the formatter printed any error messages onscreen, make
* sure that they're cleared off. */
total_refresh();
statusbar(finalstatus);
}
#endif /* !DISABLE_SPELLER */
#endif /* !DISABLE_COLOR */
#ifndef NANO_TINY

View File

@@ -643,7 +643,7 @@ filestruct *fsfromline(ssize_t lineno)
for (; f->lineno != lineno && f != openfile->fileage; f = f->prev)
;
else
for (; f->lineno != lineno && f->next != NULL; f = f->next)
for (; f->lineno != lineno && f->next != NULL; f = f->next)
;
if (f->lineno != lineno)

View File

@@ -2344,6 +2344,9 @@ void bottombars(int menu)
subnfunc *f;
const sc *s;
/* Set the global variable to the given menu. */
currmenu = menu;
if (ISSET(NO_HELP))
return;
@@ -3161,10 +3164,7 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
#endif /* !NANO_TINY */
/* Make sure the current line is on the screen. */
if (ISSET(SMOOTH_SCROLL))
edit_update(NONE);
else
edit_update(CENTER);
edit_update((ISSET(SMOOTH_SCROLL) && !focusing) ? NONE : CENTER);
/* Update old_current if we're not on the same page as
* before. */
@@ -3231,7 +3231,7 @@ void edit_refresh(void)
#endif
/* Make sure the current line is on the screen. */
edit_update(CENTER);
edit_update(ISSET(SMOOTH_SCROLL) ? NONE : CENTER);
}
foo = openfile->edittop;