Compare commits
70 Commits
v2.3.99pre
...
v2.4.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d2b198403 | ||
|
|
5ea46cacb6 | ||
|
|
fd759d5ca3 | ||
|
|
f34c8fdc6b | ||
|
|
1cf9deb603 | ||
|
|
4e5ea18394 | ||
|
|
4e9b3687ba | ||
|
|
99d2358510 | ||
|
|
08a52c1dab | ||
|
|
ce48ca2223 | ||
|
|
2dc9cbefd3 | ||
|
|
0f7b99b433 | ||
|
|
057348e1da | ||
|
|
ab21161a69 | ||
|
|
d8b6dbfffe | ||
|
|
d5177059e8 | ||
|
|
a9647b0508 | ||
|
|
37fd348a1d | ||
|
|
2aac470cb9 | ||
|
|
25ce5f6759 | ||
|
|
5d0b267aaa | ||
|
|
c2ed8277c2 | ||
|
|
d7ade1f346 | ||
|
|
de53c53c6e | ||
|
|
5ac108188d | ||
|
|
e683e32c74 | ||
|
|
7fe830fd20 | ||
|
|
07e199ff0e | ||
|
|
6f2da6b9b2 | ||
|
|
14a9c8aa0b | ||
|
|
52d7d5f55a | ||
|
|
0b6d6f45d2 | ||
|
|
0a79c78e05 | ||
|
|
ad827a6aef | ||
|
|
41580848e3 | ||
|
|
b455fa3a16 | ||
|
|
ff4a457d82 | ||
|
|
eae9f282de | ||
|
|
e39cf37026 | ||
|
|
6440aa9e47 | ||
|
|
745fab8293 | ||
|
|
a37ebcf2f8 | ||
|
|
92142bed34 | ||
|
|
83ec9e7d50 | ||
|
|
a0a0556993 | ||
|
|
33ac317132 | ||
|
|
9007c58bdd | ||
|
|
2456dd2a85 | ||
|
|
a44cf41d37 | ||
|
|
76e7aaf514 | ||
|
|
cb776fad88 | ||
|
|
a4f28694c8 | ||
|
|
82d737ee6d | ||
|
|
138add24c8 | ||
|
|
532d55c8bd | ||
|
|
3345e3407d | ||
|
|
52d1c20973 | ||
|
|
6898c60ba6 | ||
|
|
69d26c35fb | ||
|
|
4d9b5e92b3 | ||
|
|
18a2edfb84 | ||
|
|
4e95ee9f6e | ||
|
|
79ff393dc2 | ||
|
|
03bcaf6067 | ||
|
|
5891c4a542 | ||
|
|
3131d0c48a | ||
|
|
336b0ecbca | ||
|
|
32e76c4386 | ||
|
|
7d77521794 | ||
|
|
7f61fa1b55 |
187
ChangeLog
187
ChangeLog
@@ -1,7 +1,186 @@
|
||||
GNU nano 2.3.99pre2 - 2015.02.27
|
||||
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
|
||||
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.
|
||||
* src/winio.c (edit_redraw): Do not center the current line when
|
||||
smooth scrolling is used. This fixes Savannah bug #42654.
|
||||
|
||||
2015-03-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_alt_speller): Remove some leftovers.
|
||||
* src/search.c: Place some comments better and unwrap some lines.
|
||||
|
||||
2015-03-21 Mark Majeres <mark@engine12.com>
|
||||
* src/text.c (do_alt_speller): Restore the positions of the mark
|
||||
and the cursor in a better way: to the columns where they were.
|
||||
This fixes Savannah bug #44542, reported by Benno Schulenberg.
|
||||
|
||||
2015-03-20 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/nano.c (finish_stdin_pager, cancel_stdin_pager, stdin_pager):
|
||||
Normalize the whitespace, remove an old comment, and place another
|
||||
one better.
|
||||
* src/text.c (do_undo): Make a message equal to another one. It
|
||||
was mistakenly changed in r4950. (This is translation-neutral.)
|
||||
* src/global.c (shortcut_init): Keep related items together in the
|
||||
^G help screen.
|
||||
|
||||
2015-03-17 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_alt_speller): Do not set the modified flag when
|
||||
an external spell checker didn't make any changes. This fixes
|
||||
Savannah bug #44320, reported by Cody A. Taylor.
|
||||
|
||||
2015-03-14 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_formatter): Fix a message plus a few comments.
|
||||
|
||||
2015-03-14 Mark Majeres <mark@engine12.com>
|
||||
* src/nano.c (renumber): Get out if there is nothing to renumber,
|
||||
to prevent do_undo() from falling over trying to renumber emptiness.
|
||||
This fixes Savannah bug #44488, reported by Dennis Decker Jensen.
|
||||
|
||||
2015-03-08 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/proto.h, src/nano.c: Fix compilation with --enable-tiny plus
|
||||
--enable-nanorc.
|
||||
* src/rcfile.c (parse_binding): Fix the rebinding of toggles.
|
||||
* doc/man/{nano.1,rnano.1,nanorc.5}, doc/texinfo/nano.texi: Update
|
||||
years and version numbers in the docs in anticipation of a release.
|
||||
* src/nano.c (version): Drop compile time from version information
|
||||
to enable a reproducible build. Proposed by Jérémy Bobbio and Jordi
|
||||
Mallach (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774388).
|
||||
|
||||
2015-03-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/man/nanorc.5, doc/texinfo/nano.texi: Add a note about the
|
||||
inherent imperfection of using regular expressions for syntax
|
||||
highlighting, as suggested by Mike Frysinger in bug #30962.
|
||||
* doc/man/nanorc.5: Improve the indentation of some lists.
|
||||
* doc/man/nanorc.5, doc/texinfo/nano.texi: Remove the mistaken
|
||||
square brackets around the arguments of "header" and "magic" --
|
||||
those arguments are not optional. Also add "formatter" to the
|
||||
texinfo document, and slightly improve its punctuation.
|
||||
|
||||
GNU nano 2.3.99pre3 - 2015.02.27
|
||||
2015-02-25 Chris Allegretta <chrisa@asty.org>
|
||||
* src/rcfile.c (parse_binding): Add exception for do_toggle as
|
||||
rebinding toggles broke with r5022.
|
||||
* src/rcfile.c (parse_binding): Add an exception for do_toggle() as
|
||||
rebinding toggles broke with r5022. (Fixed in r5134.)
|
||||
|
||||
2015-02-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* README: Fix the explanation of how to subscribe to a mailing list.
|
||||
@@ -46,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>
|
||||
|
||||
38
NEWS
38
NEWS
@@ -1,9 +1,31 @@
|
||||
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 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
|
||||
for issues reported since 2.2. Many sincere thanks
|
||||
to all of the bug reports, patches, well wishes and
|
||||
contributions from everyone who has continued to
|
||||
support us. Thank you for using nano!
|
||||
|
||||
|
||||
2015.02.27 - GNU nano 2.3.99pre3 "Ashley" is released. This is likely
|
||||
to be the last release before the nexy major (2.4.0)
|
||||
to be the last release before the next major (2.4.0)
|
||||
release. Please test it out and send us any feedback
|
||||
via the Savannah bug page for nano
|
||||
via the Savannah bug page for nano
|
||||
(https://savannah.gnu.org/bugs/?group=nano). This
|
||||
release includes fixes for rebinding toggles via
|
||||
release includes fixes for rebinding toggles via
|
||||
nanorc, several memory alignment fixes, and documentation
|
||||
and build updates. As always thank you for using
|
||||
nano - Share and Enjoy!
|
||||
@@ -12,15 +34,15 @@
|
||||
contains only fixes, including: a long-standing problem
|
||||
with cutting in nano-tiny, several memory alignment
|
||||
improvements, and issues with leftover file locks. Please
|
||||
keep reporting bugs so we can geta happy and healthy
|
||||
keep reporting bugs so we can get a happy and healthy
|
||||
2.4.0 soon. Thanks for using nano!
|
||||
|
||||
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 in this release include many syntax highlighting
|
||||
fixes and improvements, and documentation formatting updates.
|
||||
As always please report bugs via the Savannah bug page for
|
||||
nano (https://savannah.gnu.org/bugs/?group=nano), so we can
|
||||
@@ -58,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
|
||||
@@ -354,7 +376,7 @@
|
||||
2008.03.18 - GNU nano 2.1.0 "under old mismanagement" is released.
|
||||
This first release in the 2.1 development series
|
||||
introduces rebinadble keys for most actions inside
|
||||
the editor. Please see the nanorc(5) page for
|
||||
the editor. Please see the nanorc(5) page for
|
||||
more information on configuring key bindings. Please
|
||||
also report all keybinding bugs (crashes, missing
|
||||
menu functions) using the Savannah bug tracker URL,
|
||||
|
||||
31
README
31
README
@@ -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
142
THANKS
@@ -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$
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.3.99pre3], [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
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.3.7" "August 2014"
|
||||
.TH NANO 1 "version 2.4.0" "March 2015"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.\" $Id$
|
||||
.\"
|
||||
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
|
||||
.\" 2013, 2014 Free Software Foundation, Inc.
|
||||
.\" 2013, 2014, 2015 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -20,7 +20,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.3.5" "June 2014"
|
||||
.TH NANORC 5 "version 2.4.0" "March 2015"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -250,7 +250,14 @@ characters as parts of words.
|
||||
|
||||
.SH SYNTAX HIGHLIGHTING
|
||||
Coloring the different syntactic elements of a file
|
||||
can be defined via the following commands:
|
||||
is done via regular expressions (see the \fBcolor\fR command below).
|
||||
This is inherently imperfect, because regular expressions are not
|
||||
powerful enough to fully parse a file. Nevertheless, regular
|
||||
expressions can do a lot and are easy to make, so they are a
|
||||
good fit for a small editor like \fBnano\fR.
|
||||
.sp
|
||||
A separate syntax can be defined for each kind of file
|
||||
via the following commands:
|
||||
.TP
|
||||
.BR syntax " ""\fIstr\fR"" [""\fIfileregex\fR"" ...]"
|
||||
Defines a syntax named \fIstr\fP which can be activated via the
|
||||
@@ -272,15 +279,15 @@ defined).
|
||||
.TP
|
||||
.BI formatter " program " \fR[ "arg " \fR...]
|
||||
For the currently defined syntax, use the given \fIprogram\fR
|
||||
to automatically re-format text, useful in certain programming
|
||||
languages (e.g. go)
|
||||
to automatically reformat text. Useful in certain programming
|
||||
languages (e.g. go).
|
||||
.TP
|
||||
.BR header " [""\fIregex\fR"" ...]
|
||||
.BR header " \fIregex\fR " ...
|
||||
For the currently defined syntax, add one or more regexes which will
|
||||
be compared against the very first line of the file to be edited,
|
||||
to determine whether this syntax should be used for that file.
|
||||
.TP
|
||||
.BR magic " [""\fIregex\fR"" ...]
|
||||
.BR magic " \fIregex\fR " ...
|
||||
For the currently defined syntax, add one or more regexes which
|
||||
will be compared against the result of querying the \fBmagic\fP
|
||||
database about the file to be edited, to determine whether this
|
||||
@@ -340,7 +347,8 @@ menus where it exists by using \fBall\fP).
|
||||
|
||||
.TP
|
||||
The format of \fIkey\fP should be one of:
|
||||
.TP
|
||||
.RS 3
|
||||
.TP 3
|
||||
.B ^
|
||||
followed by an alpha character or the word "Space".
|
||||
Example: ^C
|
||||
@@ -352,10 +360,11 @@ Example: M-C
|
||||
.B F
|
||||
followed by a numeric value from 1 to 16.
|
||||
Example: F10
|
||||
.RE
|
||||
|
||||
.TP
|
||||
|
||||
Valid \fIfunction\fP names to be bound include:
|
||||
|
||||
.RS 3
|
||||
.TP 2
|
||||
.B help
|
||||
Invokes the help viewer.
|
||||
@@ -409,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
|
||||
@@ -617,10 +629,11 @@ Toggles automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.B suspendenable
|
||||
Toggles whether the suspend sequence (normally ^Z) will suspend the editor window.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
|
||||
Valid \fImenu\fP sections are:
|
||||
|
||||
.RS 3
|
||||
.TP 2
|
||||
.B main
|
||||
The main editor window where text is entered and edited.
|
||||
@@ -668,6 +681,7 @@ The 'go to directory' menu in the file browser.
|
||||
A special name that encompasses all menus.
|
||||
For \fBbind\fR it means all menus where the specified \fIfunction\fR exists;
|
||||
for \fBunbind\fR it means all menus where the specified \fIkey\fR exists.
|
||||
.RE
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 2.3.7" "August 2014"
|
||||
.TH RNANO 1 "version 2.4.0" "March 2015"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
|
||||
@@ -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:]]+$"
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)"
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
@c Run 'makeinfo' rather than 'texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.3
|
||||
@set VERSION 2.3.7
|
||||
@set UPDATED August 2014
|
||||
@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.3.7
|
||||
@subtitle version 2.4.1
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -34,7 +34,7 @@ editor.
|
||||
This manual is part of the GNU @code{nano} distribution.@*
|
||||
@sp 4
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
2009, 2014 Free Software Foundation, Inc.
|
||||
2009, 2014, 2015 Free Software Foundation, Inc.
|
||||
|
||||
This document is dual-licensed. You may distribute and/or modify it
|
||||
under the terms of either of the following licenses:
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -812,7 +815,14 @@ characters as part of a word.
|
||||
@node Syntax Highlighting
|
||||
@section Syntax Highlighting
|
||||
|
||||
Coloring the different syntactic elements of a file can be defined
|
||||
Coloring the different syntactic elements of a file
|
||||
is done via regular expressions (see the @code{color} command below).
|
||||
This is inherently imperfect, because regular expressions are not
|
||||
powerful enough to fully parse a file. Nevertheless, regular
|
||||
expressions can do a lot and are easy to make, so they are a
|
||||
good fit for a small editor like @code{nano}.
|
||||
|
||||
A separate syntax can be defined for each kind of file
|
||||
via the following commands in a nanorc file:
|
||||
|
||||
@table @code
|
||||
@@ -833,12 +843,16 @@ syntax's "fileregex".
|
||||
For the currently defined syntax, use the given program to invoke the
|
||||
linter (this overrides the speller function when defined).
|
||||
|
||||
@item formatter program [arg @dots{}]
|
||||
For the currently defined syntax, use the given program to automatically
|
||||
reformat text. Useful in certain programming languages (e.g. go).
|
||||
|
||||
@item header "regex" @dots{}
|
||||
For the currently defined syntax, add one or more regexes which will
|
||||
be compared against the very first line of the file to be edited,
|
||||
to determine whether this syntax should be used for that file.
|
||||
|
||||
@item magic ["regex" @dots{}]
|
||||
@item magic "regex" @dots{}
|
||||
For the currently defined syntax, add one or more regexes which will be
|
||||
compared against the result of querying the magic database about the file
|
||||
to be edited, to determine whether this syntax should be used for that
|
||||
|
||||
667
po/nano.pot
667
po/nano.pot
File diff suppressed because it is too large
Load Diff
720
po/pt_BR.po
720
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
675
po/zh_CN.po
675
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
675
po/zh_TW.po
675
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
221
src/browser.c
221
src/browser.c
@@ -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. */
|
||||
|
||||
10
src/chars.c
10
src/chars.c
@@ -484,12 +484,18 @@ 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 = 0, char_len = 0;
|
||||
size_t before, char_len = 0;
|
||||
|
||||
assert(buf != NULL && pos <= strlen(buf));
|
||||
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. Here is the naive, O(pos) way to do it. */
|
||||
* character. So we just start groping for one at the farthest
|
||||
* possible point. */
|
||||
if (mb_cur_max() > pos)
|
||||
before = 0;
|
||||
else
|
||||
before = pos - mb_cur_max();
|
||||
|
||||
while (before < pos) {
|
||||
char_len = parse_mbchar(buf + before, NULL, NULL);
|
||||
before += char_len;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
184
src/global.c
184
src/global.c
@@ -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. */
|
||||
@@ -735,9 +739,11 @@ void shortcut_init(void)
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
add_to_funcs(do_linter, MMAIN,
|
||||
N_("To Linter"), IFSCHELP(nano_lint_msg), BLANKAFTER, NOVIEW);
|
||||
N_("To Linter"), IFSCHELP(nano_lint_msg), TOGETHER, NOVIEW);
|
||||
#ifndef DISABLE_SPELLER
|
||||
add_to_funcs(do_formatter, MMAIN,
|
||||
N_("Formatter"), IFSCHELP(nano_formatter_msg), TOGETHER, NOVIEW);
|
||||
N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
45
src/nano.c
45
src/nano.c
@@ -178,7 +178,8 @@ void renumber(filestruct *fileptr)
|
||||
{
|
||||
ssize_t line;
|
||||
|
||||
assert(fileptr != NULL);
|
||||
if (fileptr == NULL)
|
||||
return;
|
||||
|
||||
line = (fileptr->prev == NULL) ? 0 : fileptr->prev->lineno;
|
||||
|
||||
@@ -365,8 +366,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
|
||||
/* Renumber starting with the line after the original
|
||||
* file_bot. */
|
||||
if (file_bot_save->next != NULL)
|
||||
renumber(file_bot_save->next);
|
||||
renumber(file_bot_save->next);
|
||||
}
|
||||
|
||||
/* Since the text has now been saved, remove it from the
|
||||
@@ -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);
|
||||
@@ -960,8 +960,7 @@ void usage(void)
|
||||
* it was compiled with. */
|
||||
void version(void)
|
||||
{
|
||||
printf(_(" GNU nano version %s (compiled %s, %s)\n"), VERSION,
|
||||
__TIME__, __DATE__);
|
||||
printf(_(" GNU nano, version %s\n"), VERSION);
|
||||
printf(" (C) 1999..2015 Free Software Foundation, Inc.\n");
|
||||
printf(
|
||||
_(" Email: nano@nano-editor.org Web: http://www.nano-editor.org/"));
|
||||
@@ -1146,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
|
||||
@@ -1181,20 +1180,20 @@ void finish_stdin_pager(void)
|
||||
|
||||
/* Read whatever we did get from stdin. */
|
||||
f = fopen("/dev/stdin", "rb");
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
|
||||
read_file(f, 0, "stdin", TRUE, FALSE);
|
||||
ttystdin = open("/dev/tty", O_RDONLY);
|
||||
if (!ttystdin)
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
|
||||
dup2(ttystdin,0);
|
||||
close(ttystdin);
|
||||
if (!pager_input_aborted)
|
||||
tcgetattr(0, &oldterm);
|
||||
if (!pager_sig_failed && sigaction(SIGINT, &pager_oldaction, NULL) == -1)
|
||||
nperror("sigaction");
|
||||
nperror("sigaction");
|
||||
terminal_init();
|
||||
doupdate();
|
||||
}
|
||||
@@ -1202,7 +1201,6 @@ void finish_stdin_pager(void)
|
||||
/* Cancel reading from stdin like a pager. */
|
||||
RETSIGTYPE cancel_stdin_pager(int signal)
|
||||
{
|
||||
/* Currently do nothing, just handle the intr silently. */
|
||||
pager_input_aborted = TRUE;
|
||||
}
|
||||
|
||||
@@ -1214,13 +1212,13 @@ void stdin_pager(void)
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
fprintf(stderr, _("Reading from stdin, ^C to abort\n"));
|
||||
|
||||
/* Set things up so that Ctrl-C will cancel the new process. */
|
||||
/* Enable interpretation of the special control keys so that
|
||||
* we get SIGINT when Ctrl-C is pressed. */
|
||||
#ifndef NANO_TINY
|
||||
enable_signals();
|
||||
#endif
|
||||
|
||||
/* Set things up so that SIGINT will cancel the new process. */
|
||||
if (sigaction(SIGINT, NULL, &pager_newaction) == -1) {
|
||||
pager_sig_failed = TRUE;
|
||||
nperror("sigaction");
|
||||
@@ -1284,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;
|
||||
}
|
||||
|
||||
@@ -1482,13 +1479,13 @@ void do_toggle(int flag)
|
||||
desc = (char *) _(flagtostr(flag));
|
||||
statusbar("%s %s", desc, enabled ? _("enabled") : _("disabled"));
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Bleh. */
|
||||
void do_toggle_void(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Disable extended input and output processing in our terminal
|
||||
* settings. */
|
||||
@@ -1806,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);
|
||||
@@ -2483,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
|
||||
@@ -2741,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))
|
||||
@@ -2826,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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
@@ -480,8 +480,8 @@ RETSIGTYPE do_continue(int signal);
|
||||
RETSIGTYPE handle_sigwinch(int signal);
|
||||
void allow_pending_sigwinch(bool allow);
|
||||
void do_toggle(int flag);
|
||||
void do_toggle_void(void);
|
||||
#endif
|
||||
void do_toggle_void(void);
|
||||
void disable_extended_io(void);
|
||||
#ifdef USE_SLANG
|
||||
void disable_signals(void);
|
||||
|
||||
35
src/rcfile.c
35
src/rcfile.c
@@ -505,7 +505,7 @@ void parse_binding(char *ptr, bool dobind)
|
||||
fprintf(stderr, "unbinding \"%s\" from menu %x\n", keycopy, menu);
|
||||
#endif
|
||||
|
||||
if (dobind && newsc->scfunc != do_toggle_void) {
|
||||
if (dobind) {
|
||||
subnfunc *f;
|
||||
int mask = 0;
|
||||
|
||||
@@ -514,6 +514,10 @@ void parse_binding(char *ptr, bool dobind)
|
||||
if (f->scfunc == newsc->scfunc)
|
||||
mask = mask | f->menus;
|
||||
|
||||
/* Handle the special case of the toggles. */
|
||||
if (newsc->scfunc == do_toggle_void)
|
||||
mask = MMAIN;
|
||||
|
||||
/* Now limit the given menu to those where the function exists. */
|
||||
if (is_universal(newsc->scfunc))
|
||||
menu = menu & MMOST;
|
||||
@@ -597,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)
|
||||
@@ -903,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);
|
||||
@@ -967,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);
|
||||
@@ -994,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);
|
||||
@@ -1019,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
|
||||
@@ -1147,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)
|
||||
@@ -1157,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);
|
||||
|
||||
122
src/search.c
122
src/search.c
@@ -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)
|
||||
@@ -161,8 +163,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
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);
|
||||
@@ -287,9 +288,9 @@ bool findnextstr(
|
||||
rev_start +=
|
||||
#ifndef NANO_TINY
|
||||
ISSET(BACKWARDS_SEARCH) ?
|
||||
openfile->current_x - 1 :
|
||||
((openfile->current_x == 0) ? -1 : move_mbleft(fileptr->data, openfile->current_x)) :
|
||||
#endif
|
||||
openfile->current_x + 1;
|
||||
move_mbright(fileptr->data, openfile->current_x);
|
||||
|
||||
/* Look for needle in the current line we're searching. */
|
||||
enable_nodelay();
|
||||
@@ -347,8 +348,8 @@ bool findnextstr(
|
||||
break;
|
||||
}
|
||||
|
||||
/* We've finished processing the file, so get out. */
|
||||
if (search_last_line) {
|
||||
/* We've finished processing the file, so get out. */
|
||||
not_found_msg(needle);
|
||||
disable_nodelay();
|
||||
return FALSE;
|
||||
@@ -367,9 +368,8 @@ bool findnextstr(
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We've reached the start or end of the buffer, so wrap
|
||||
* around. */
|
||||
if (fileptr == NULL) {
|
||||
/* We've reached the start or end of the buffer, so wrap around. */
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
fileptr = openfile->filebot;
|
||||
@@ -384,8 +384,8 @@ bool findnextstr(
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
|
||||
/* We've reached the original starting line. */
|
||||
if (fileptr == begin)
|
||||
/* We've reached the original starting line. */
|
||||
search_last_line = TRUE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
@@ -445,8 +445,7 @@ void do_search(void)
|
||||
i = search_init(FALSE, FALSE);
|
||||
|
||||
if (i == -1)
|
||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
||||
* failed. */
|
||||
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
|
||||
search_replace_abort();
|
||||
else if (i == -2)
|
||||
/* Replace. */
|
||||
@@ -491,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,
|
||||
@@ -557,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"));
|
||||
@@ -693,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 */
|
||||
|
||||
@@ -735,17 +735,27 @@ 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
|
||||
* after the search, it means that we've wrapped around, so
|
||||
* we're done. */
|
||||
if (bol_or_eol && begin_line && openfile->current ==
|
||||
real_current)
|
||||
if (bol_or_eol && begin_line && openfile->current == real_current)
|
||||
break;
|
||||
/* Otherwise, set the begin_line flag if we've found a match on
|
||||
* the beginning line, reset the bol_or_eol flag, and
|
||||
* continue. */
|
||||
* the beginning line, reset the bol_or_eol flag, and continue. */
|
||||
else {
|
||||
if (openfile->current == real_current)
|
||||
begin_line = TRUE;
|
||||
@@ -753,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;
|
||||
@@ -766,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);
|
||||
@@ -789,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
|
||||
|
||||
@@ -799,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
|
||||
@@ -821,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,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
|
||||
@@ -850,16 +857,19 @@ ssize_t do_replace_loop(
|
||||
#endif
|
||||
openfile->current_x += match_len + length_change - 1;
|
||||
|
||||
/* Cleanup. */
|
||||
/* Clean up. */
|
||||
openfile->totsize += mbstrlen(copy) -
|
||||
mbstrlen(openfile->current->data);
|
||||
free(openfile->current->data);
|
||||
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
|
||||
@@ -877,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
|
||||
@@ -913,8 +919,7 @@ void do_replace(void)
|
||||
|
||||
i = search_init(TRUE, FALSE);
|
||||
if (i == -1) {
|
||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
||||
* failed. */
|
||||
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
|
||||
search_replace_abort();
|
||||
return;
|
||||
} else if (i == -2) {
|
||||
@@ -951,8 +956,7 @@ void do_replace(void)
|
||||
edit_refresh, _("Replace with"));
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
/* Add this replace string to the replace history list. i == 0
|
||||
* means that the string is not "". */
|
||||
/* If the replace string is not "", add it to the replace history list. */
|
||||
if (i == 0)
|
||||
update_history(&replace_history, answer);
|
||||
#endif
|
||||
@@ -1085,7 +1089,6 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update) {
|
||||
edit_refresh();
|
||||
|
||||
display_main_list();
|
||||
}
|
||||
}
|
||||
@@ -1144,8 +1147,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
mbrevstrpbrk(fileptr->data, bracket_set, rev_start) :
|
||||
mbstrpbrk(rev_start, bracket_set));
|
||||
|
||||
/* We've found a potential match. */
|
||||
if (found != NULL)
|
||||
/* We've found a potential match. */
|
||||
break;
|
||||
|
||||
if (reverse) {
|
||||
@@ -1156,8 +1159,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
current_y_find++;
|
||||
}
|
||||
|
||||
/* We've reached the start or end of the buffer, so get out. */
|
||||
if (fileptr == NULL)
|
||||
/* We've reached the start or end of the buffer, so get out. */
|
||||
return FALSE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
@@ -1373,8 +1376,7 @@ void update_history(filestruct **h, const char *s)
|
||||
bar = p->next;
|
||||
unlink_node(foo);
|
||||
delete_node(foo);
|
||||
if (bar != NULL)
|
||||
renumber(bar);
|
||||
renumber(bar);
|
||||
}
|
||||
|
||||
/* If the history is full, delete the beginning entry to make room
|
||||
|
||||
129
src/text.c
129
src/text.c
@@ -442,7 +442,7 @@ void do_undo(void)
|
||||
|
||||
filestruct *f = fsfromline(u->mark_begin_lineno);
|
||||
if (!f) {
|
||||
statusbar(_("Internal error: can't match line %ld. Please save your work."), (long)u->mark_begin_lineno);
|
||||
statusbar(_("Internal error: can't match line %d. Please save your work."), u->mark_begin_lineno);
|
||||
return;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
@@ -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);
|
||||
@@ -2661,9 +2659,10 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
{
|
||||
int alt_spell_status;
|
||||
size_t current_x_save = openfile->current_x;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
ssize_t current_y_save = openfile->current_y;
|
||||
ssize_t lineno_save = openfile->current->lineno;
|
||||
struct stat spellfileinfo;
|
||||
time_t timestamp;
|
||||
pid_t pid_spell;
|
||||
char *ptr;
|
||||
static int arglen = 3;
|
||||
@@ -2672,11 +2671,9 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
bool old_mark_set = openfile->mark_set;
|
||||
bool added_magicline = FALSE;
|
||||
/* Whether we added a magicline after filebot. */
|
||||
bool right_side_up = FALSE;
|
||||
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
|
||||
* FALSE if (current, current_x) is. */
|
||||
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
|
||||
@@ -2685,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. */
|
||||
@@ -2694,14 +2701,9 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (openfile->totsize == 0) {
|
||||
statusbar(_("Finished checking spelling"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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 *));
|
||||
|
||||
@@ -2794,24 +2796,18 @@ 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. */
|
||||
if (!ISSET(NO_NEWLINES) && added_magicline)
|
||||
remove_magicline();
|
||||
|
||||
/* Put the beginning and the end of the mark at the beginning
|
||||
* and the end of the spell-checked text. */
|
||||
if (openfile->fileage == openfile->filebot)
|
||||
bot_x += top_x;
|
||||
if (right_side_up) {
|
||||
openfile->mark_begin_x = top_x;
|
||||
current_x_save = bot_x;
|
||||
} else {
|
||||
current_x_save = top_x;
|
||||
openfile->mark_begin_x = bot_x;
|
||||
}
|
||||
|
||||
/* Unpartition the filestruct so that it contains all the text
|
||||
* again. Note that we've replaced the marked text originally
|
||||
* in the partition with the spell-checked marked text in the
|
||||
@@ -2827,23 +2823,23 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
openfile->totsize = totsize_save;
|
||||
|
||||
/* Assign mark_begin to the line where the mark began before. */
|
||||
do_gotopos(mb_lineno_save, openfile->mark_begin_x,
|
||||
current_y_save, 0);
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Go back to the old position, and mark the file as modified. */
|
||||
do_gotopos(lineno_save, current_x_save, current_y_save, pww_save);
|
||||
set_modified();
|
||||
/* Go back to the old position. */
|
||||
goto_line_posx(lineno_save, current_x_save);
|
||||
openfile->current_y = current_y_save;
|
||||
edit_update(NONE);
|
||||
|
||||
/* Stat the temporary file again, and mark the buffer as modified only
|
||||
* if this file was changed since it was written. */
|
||||
stat(tempfile_name, &spellfileinfo);
|
||||
if (spellfileinfo.st_mtime != timestamp)
|
||||
set_modified();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Handle a pending SIGWINCH again. */
|
||||
@@ -2916,7 +2912,6 @@ void do_spell(void)
|
||||
/* Cleanup things to do after leaving the linter. */
|
||||
void lint_cleanup(void)
|
||||
{
|
||||
currmenu = MMAIN;
|
||||
display_main_list();
|
||||
}
|
||||
|
||||
@@ -2973,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 *));
|
||||
|
||||
@@ -2988,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)
|
||||
@@ -3028,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);
|
||||
@@ -3052,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') {
|
||||
@@ -3120,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);
|
||||
@@ -3131,7 +3128,6 @@ void do_linter(void)
|
||||
return;
|
||||
}
|
||||
|
||||
currmenu = MLINTER;
|
||||
bottombars(MLINTER);
|
||||
tmplint = NULL;
|
||||
curlint = lints;
|
||||
@@ -3226,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 mashuhp 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;
|
||||
@@ -3249,10 +3243,9 @@ void do_formatter(void)
|
||||
char *finalstatus = NULL;
|
||||
|
||||
/* Check whether we're using syntax highlighting
|
||||
* and formatter option it set
|
||||
*/
|
||||
* and the formatter option is set. */
|
||||
if (openfile->syntax == NULL || openfile->syntax->formatter == NULL) {
|
||||
statusbar(_("Error: no linter defined"));
|
||||
statusbar(_("Error: no formatter defined"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3266,7 +3259,7 @@ void do_formatter(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/* we're not supporting partial formatting, oi vey */
|
||||
/* We're not supporting partial formatting, oi vey. */
|
||||
openfile->mark_set = FALSE;
|
||||
status = write_file(temp, temp_file, TRUE, OVERWRITE, FALSE);
|
||||
|
||||
@@ -3287,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 *));
|
||||
|
||||
@@ -3304,10 +3297,10 @@ void do_formatter(void)
|
||||
|
||||
/* Start a new process for the formatter. */
|
||||
if ((pid_format = fork()) == 0) {
|
||||
/* Start alternate format program; we are using $PATH. */
|
||||
/* Start the formatting program; we are using $PATH. */
|
||||
execvp(formatargs[0], formatargs);
|
||||
|
||||
/* Should not be reached, if alternate formatter is found!!! */
|
||||
/* Should not be reached, if the formatter is found! */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -3350,9 +3343,7 @@ void do_formatter(void)
|
||||
sprintf(format_error, invoke_error, openfile->syntax->formatter);
|
||||
finalstatus = format_error;
|
||||
} else {
|
||||
|
||||
/* Replace the text of the current buffer with the format-checked
|
||||
* text. */
|
||||
/* Replace the text of the current buffer with the formatted text. */
|
||||
replace_buffer(temp);
|
||||
|
||||
/* Go back to the old position, and mark the file as modified. */
|
||||
@@ -3370,15 +3361,13 @@ void do_formatter(void)
|
||||
unlink(temp);
|
||||
free(temp);
|
||||
|
||||
currmenu = MMAIN;
|
||||
|
||||
/* If the spell-checker printed any error messages onscreen, make
|
||||
/* 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
|
||||
|
||||
@@ -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)
|
||||
|
||||
14
src/winio.c
14
src/winio.c
@@ -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;
|
||||
|
||||
@@ -3160,10 +3163,8 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Put edittop in range of current, get the difference in lines
|
||||
* between the original edittop and the current edittop, and
|
||||
* then restore the original edittop. */
|
||||
edit_update(CENTER);
|
||||
/* Make sure the current line is on the screen. */
|
||||
edit_update((ISSET(SMOOTH_SCROLL) && !focusing) ? NONE : CENTER);
|
||||
|
||||
/* Update old_current if we're not on the same page as
|
||||
* before. */
|
||||
@@ -3229,9 +3230,8 @@ void edit_refresh(void)
|
||||
(long)openfile->current->lineno, (long)openfile->edittop->lineno, maxrows);
|
||||
#endif
|
||||
|
||||
/* Put the top line of the edit window in range of the current
|
||||
* line. */
|
||||
edit_update(CENTER);
|
||||
/* Make sure the current line is on the screen. */
|
||||
edit_update(ISSET(SMOOTH_SCROLL) ? NONE : CENTER);
|
||||
}
|
||||
|
||||
foo = openfile->edittop;
|
||||
|
||||
Reference in New Issue
Block a user