Compare commits

..

259 Commits

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



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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5153 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 04:32:45 +00:00
Chris Allegretta
33ac317132 Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5152 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 04:23:32 +00:00
Chris Allegretta
9007c58bdd GNU nano 2.4.0 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5150 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 03:49:37 +00:00
Benno Schulenberg
2456dd2a85 Not centering the current line when smooth scrolling is used.
This fixes Savannah bug #42654.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5149 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-22 13:23:42 +00:00
Benno Schulenberg
a44cf41d37 Stepping backward or forward not simply one byte
but one character (possibly multibyte).
This fixes Savannah bug #42175.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5148 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-22 11:42:29 +00:00
Benno Schulenberg
76e7aaf514 Starting to look for a multibyte character not at the start of the string,
but only as far back as such a character can possibly be.
Speedup suggested by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5147 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-22 11:20:02 +00:00
Benno Schulenberg
cb776fad88 Placing some comments better and unwrapping some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5146 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-21 21:40:56 +00:00
Benno Schulenberg
a4f28694c8 Removing some leftovers after Mark's patch.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5145 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-21 21:13:03 +00:00
Benno Schulenberg
82d737ee6d Restoring the positions of the mark and the cursor in a better way.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5144 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-21 21:02:13 +00:00
Benno Schulenberg
138add24c8 Keeping related items together in the ^G help screen.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5143 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-20 12:22:49 +00:00
Benno Schulenberg
532d55c8bd Making a message equal to another one.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5142 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-20 11:37:53 +00:00
Benno Schulenberg
3345e3407d Normalizing some whitespace, removing an old comment,
and placing another one better.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5141 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-20 11:18:22 +00:00
Benno Schulenberg
52d1c20973 Not setting the modified flag when an external spell checker
didn't make any changes.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5140 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-17 20:10:59 +00:00
Benno Schulenberg
6898c60ba6 Adding full name of bug reporter.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5139 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-15 19:48:50 +00:00
Benno Schulenberg
69d26c35fb Fixing a mistaken message plus a few comments too.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5138 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-14 20:17:21 +00:00
Benno Schulenberg
4d9b5e92b3 Getting out if there is nothing to renumber,
to prevent do_undo() from falling over when trying to renumber emptiness.
Patch basically by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5137 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-14 15:59:01 +00:00
Benno Schulenberg
18a2edfb84 Dropping compile time from version information to enable a reproducible
build.  Proposed by Jérémy Bobbio and Jordi Mallach.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5136 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-08 20:14:10 +00:00
Benno Schulenberg
4e95ee9f6e Updating years and version numbers in the docs
in anticipation of a release.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5135 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-08 15:59:15 +00:00
Benno Schulenberg
79ff393dc2 Fixing the rebinding of toggles.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5134 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-08 15:42:52 +00:00
Benno Schulenberg
03bcaf6067 Fixing compilation with --enable-tiny plus --enable-nanorc.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5133 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-08 12:10:52 +00:00
Benno Schulenberg
5891c4a542 Removing the mistaken square brackets around the arguments
of "header" and "magic" -- those regexes are not optional.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5132 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-07 22:11:56 +00:00
Benno Schulenberg
3131d0c48a Oops.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5131 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-07 21:51:01 +00:00
Benno Schulenberg
336b0ecbca Improving the indentation of some lists in the nanorc man page.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5130 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-07 21:48:15 +00:00
Benno Schulenberg
32e76c4386 Adding a note about the inherent imperfection of using regular expressions
for syntax highlighting, as suggested by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5129 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-07 21:30:36 +00:00
Benno Schulenberg
7d77521794 Typo fixing and whitespace adjusting of the NEWS file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5128 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-07 20:46:11 +00:00
Chris Allegretta
7f61fa1b55 Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5127 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-27 17:00:11 +00:00
Chris Allegretta
98485c96d8 GNU nano 2.3.99pre3 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5125 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-27 16:57:55 +00:00
Chris Allegretta
184cf609c0 2015-02-25 Chris Allegretta <chrisa@asty.org>
* src/rcfile.c (parse_binding): Add exception for do_toggle as
        rebinding toggles broke with r5022.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5124 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-25 19:04:53 +00:00
Benno Schulenberg
e73e02fe10 Oops -- created that typo myself.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5123 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-21 11:31:56 +00:00
Benno Schulenberg
ed2f0b349f Wrapping some overlong lines, and fixing a typo in the Java file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5122 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-21 10:34:15 +00:00
Benno Schulenberg
d4e1d31ea4 Fixing the explanation of how to subscribe to a mailing list.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5121 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-21 09:45:53 +00:00
Benno Schulenberg
bb4edd0136 Recognizing also dash, openrc and runscript as shell scripts.
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5120 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-18 20:01:30 +00:00
Benno Schulenberg
c9b3a71d02 Ignoring the autotools 'compile' file. Patch by Mike Frysinger.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5119 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-16 20:13:29 +00:00
Benno Schulenberg
1b65b19abd The user does the editing, not the editor. So rephrasing.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5118 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-15 16:28:08 +00:00
Benno Schulenberg
35cd49ec50 Also showing the name of the affected file when finding a lock file,
for when many files are opened at once.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5117 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-15 16:20:09 +00:00
Chris Allegretta
6c7764862b 2015-02-09 Chris Allegretta <chrisa@asty.org>
* nano.spec.in: Add dependency on texinfo, docdir files for
        RPM file creation.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5116 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-09 19:53:29 +00:00
Chris Allegretta
9c88cab78c Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5115 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-07 03:33:14 +00:00
Chris Allegretta
651bb5009f GNU nano 2.3.99pre2 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5113 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-07 00:26:43 +00:00
Chris Allegretta
86c6cd1725 2015-02-03 Alex Henrie <alexhenrie24@gmail.com>
* src/cut.c (do_cut_text): Make sure to set modified even when
        using --enable-tiny.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5112 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-03 22:49:57 +00:00
Benno Schulenberg
bd98ff02f6 Avoiding to trim the nano version number on the status bar.
Patch by Kamil Dudka.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5111 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 10:07:08 +00:00
Benno Schulenberg
057ef182cd Avoiding to print a wrong PID on the status bar.
Patch by Kamil Dudka.  Bug reported by Don Swaner.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5110 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 09:58:02 +00:00
Benno Schulenberg
67cdd5ee1e Making sure that 'lockprog' and 'lockuser' are properly terminated.
Patch by Kamil Dudka.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5109 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 09:48:50 +00:00
Benno Schulenberg
92896a708d Avoiding to write uninitialized bytes to the lock file.
Patch by Kamil Dudka.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5108 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 09:39:27 +00:00
Benno Schulenberg
57fa775f25 Updating the copyright years to include 2015.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5107 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 09:32:02 +00:00
Benno Schulenberg
8d53aa3ad2 Adding a general entry for all translators plus the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5106 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 09:19:58 +00:00
Chris Allegretta
5b1fb56a8f Take 2 at file locking fixes. New args to close_buffer() and
switch_to_prevnext_buffer() to support message passthrough
when trying to lock files using multibuffer.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5105 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-20 06:15:34 +00:00
Chris Allegretta
6948d2e779 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



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5104 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-14 02:36:30 +00:00
Chris Allegretta
69429ce274 Back to SVN version
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5103 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-06 15:28:02 +00:00
Chris Allegretta
170679294b GNU nano 2.3.99pre1 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5101 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-06 15:20:04 +00:00
Chris Allegretta
4b3f2771b5 2015-01-03 Chris Allegretta <chrisa@asty.org>
* New formatter code to support syntaxes like
        go which have tools to automatically lint and reformat the text for
        you (gofmt), which is lovely.  rcfile option formatter, function
        text.c:do_formatter() and some other calls.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5100 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-03 07:24:17 +00:00
Benno Schulenberg
a44def03a0 Adding Mark to the scroll.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5099 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-12-28 22:27:56 +00:00
Benno Schulenberg
9f1b1e2b14 Removing the names of past translators from the Easter-egg scroll.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5098 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-12-28 22:23:31 +00:00
Benno Schulenberg
e99f0b609b Gettextizing the "File being edited" prompt,
and improving its wording.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5097 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-12-28 21:58:27 +00:00
Benno Schulenberg
5bb10d25ef Colorizing the section headers %pretrans and %posttrans fully.
Original patch from Savannah patch #8573 by Daniel Vrátil.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5096 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-11-30 12:05:13 +00:00
Benno Schulenberg
edabd27cd8 Recognizing also header lines that use "/usr/bin/env" to call
the program, instead of just a direct call via "/bin/program".
Doing this for Shell scripts, and for Python, Perl and Ruby.
This fixes Savannah bug #43270 reported by Kitty.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5095 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-09-21 15:29:40 +00:00
Benno Schulenberg
97a5d1270a Replacing the old get_shortcut() wrapper with the new func_from_key().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5094 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-29 20:03:58 +00:00
Benno Schulenberg
f729c6dae5 Adding name of reporter.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5093 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-29 19:22:15 +00:00
Benno Schulenberg
a3cc4e6ecd Improving some wordings and formatting in the texinfo document.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5092 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-10 16:27:30 +00:00
Benno Schulenberg
2a9536c4e8 Removing a mistaken doubled-up | which causes
an 'empty (sub)expression' error on MacOS X.
This fixes Savannah bug #42929.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5091 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-07 20:27:21 +00:00
Benno Schulenberg
1f960f7e34 Improving some of the wordings and formatting of the nanorc manpage.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5090 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-03 20:57:15 +00:00
Benno Schulenberg
3f4389b968 Tweaking the formatting of the man pages a bit
so that po4a will create a nicer POT file.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5089 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-03 20:25:16 +00:00
Benno Schulenberg
700c43bd42 Standardizing the formatting of command-line options -- each one separately.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5088 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-02 20:47:35 +00:00
Benno Schulenberg
2ec70b6466 Separating short and long option by a customary comma
instead of putting the long one between parentheses.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5087 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-01 21:04:35 +00:00
Benno Schulenberg
cf9f32b009 Reordering a few things, and adjusting some whitespace.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5086 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-31 20:49:32 +00:00
Benno Schulenberg
fcd4468f90 Adjusting some indentation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5085 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-31 20:44:19 +00:00
Benno Schulenberg
7239fda971 Using still further the func_from_key() wrapper instead of get_shortcut().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5084 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 21:07:15 +00:00
Benno Schulenberg
47dffa483f Using still more the func_from_key() wrapper instead of get_shortcut().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5083 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 20:16:28 +00:00
Benno Schulenberg
266e0496ab Using the more direct func_from_key() wrapper instead of get_shortcut().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5082 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:32:03 +00:00
Benno Schulenberg
dbb5e7cd8e Moving first_sc_for() next to its sister function too.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5081 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:23:41 +00:00
Benno Schulenberg
80750632d0 Moving strtokeytype() next to its sister function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5080 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:18:00 +00:00
Benno Schulenberg
d23283e249 Removing the now unused and unneeded addition ability to the shortcut list.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5079 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:13:46 +00:00
Jordi Mallach
7ffc7b0438 * doc/texinfo/nano.texi, doc/man/nanorc.5: Typo fix.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5078 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-24 16:11:20 +00:00
Benno Schulenberg
1a8c90eec7 Removing 'undo' from the valid options, so it gets coloured brightred.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5077 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-22 08:17:20 +00:00
Jordi Mallach
ea40ebb648 * doc/nanorc.sample.in: Remove ‘undo’ section which is now obsolete.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5076 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-21 21:27:15 +00:00
Chris Allegretta
1c8cdfd174 Add release to ChangeLog and back to svn version
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5075 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-17 15:32:28 +00:00
Chris Allegretta
0dfd5f7f67 GNU nano 2.3.6 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5073 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-17 15:17:49 +00:00
Jordi Mallach
35cb2c8659 * doc/man/rnano.1: Additional printing formatting improvement from
Bjarni Ingi Gislason.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5072 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-17 06:27:08 +00:00
Jordi Mallach
3d5de0df51 * doc/man/fr/nano.1, doc/man/fr/rnano.1: Apply similar escaping fixes
to French manpages.
* doc/man/fr/nano.1, doc/man/fr/rnano.1, doc/man/fr/nanorc.5: Recode
as UTF-8.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5071 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-16 17:25:55 +00:00
Jordi Mallach
a3710f695f * doc/syntax/debian.nanorc: Add https, tor and spacewalk to supported
APT methods.
* doc/syntax/debian.nanorc: Apply the syntax to apt/sources.list.d/
entries as well, as reported by Rodolphe Pelloux-Prayer.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5070 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-16 11:22:02 +00:00
Jordi Mallach
18be89773c doc/man/nano.1, doc/man/rnano.1: Add some escaping and formatting
fixes as suggested Bjarni Ingi Gislason <bjarniig@rhi.hi.is> in
Debian bugs #662842 and #726956.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5069 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-16 11:07:08 +00:00
Benno Schulenberg
a9fdfd0799 Normalizing some tabbing.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5068 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-16 08:53:16 +00:00
Benno Schulenberg
2394e52ebc Making sure line renumbering starts far enough back after
undoing a cut or paste.  And fixing two memory leaks.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5067 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-16 08:46:42 +00:00
Chris Allegretta
ee7bbf4650 2014-07-13 David Lawrence Ramsey <pooka109@gmail.com>
* ChangeLog: Typo fix



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5066 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-13 19:46:32 +00:00
Benno Schulenberg
8914bd5b1a Not silencing the warning about datarootdir being ignored --
it is not merely a warning, it also activates a workaround.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5065 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-12 08:17:52 +00:00
Benno Schulenberg
5dde918e24 Not speaking of "line wrap" but of "text add" when undoing/redoing
text additions that caused automatic line breaks.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5064 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-11 19:14:25 +00:00
Benno Schulenberg
300e27745b Refixing a typo in a statusbar error message.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5063 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-11 18:35:08 +00:00
Chris Allegretta
cfc396c32e Add 2.3.5 to ChangeLog, and back to svn version
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5062 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-11 13:46:32 +00:00
Chris Allegretta
c45d5f4bb3 GNU nano 2.3.5 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5060 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-11 12:45:42 +00:00
Chris Allegretta
733ca94f8e 2014-07-11 Chris Allegretta <chrisa@asty.org>
* src/files.c (do_lockfile, open_file): If locking fails,
        allow the lock failure message to be preserved AND
        preserve the filename passed on the cmdline.  Fixes
        Savannah bug #42668.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5059 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-11 11:16:15 +00:00
Chris Allegretta
a9c3bbf8e0 files.c:do_lockfile(): Actually reference the variable we're using for the dir.
Also name it more appropriately.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5058 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-11 10:39:38 +00:00
Benno Schulenberg
be3e4404ee Tiny ChangeLog fixes, and marking the 2.2.6 release.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5057 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-07 18:46:47 +00:00
Chris Allegretta
6d5b2fd936 2014-07-02 Chris Allegretta <chrisa@asty.org>
* src/files.c (do_lockfile): Check whether the directory
          of the file we're trying to lock exists, and make the
          resulting error message more intuitive.  Fixes
          Savannah bug 42639 by bens.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5056 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-03 03:54:22 +00:00
Benno Schulenberg
637b76b582 Freeing the cutbuffer after use.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5055 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-02 20:52:27 +00:00
Benno Schulenberg
92213f9de8 Handling the cases of cutting-from-cursor-to-end-of-line
(that is, when CUT_TO_END is set) properly.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5054 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-02 20:29:57 +00:00
Benno Schulenberg
85ddc718f8 Properly excluding the --quiet option when --disable-nanorc was given.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5053 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-02 19:57:23 +00:00
Benno Schulenberg
6c86ee1a5b Deleting old wrapper 'getfuncfromkey()', and replacing its call
with a call of the new wrapper 'func_from_key()'.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5052 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-02 19:12:38 +00:00
Benno Schulenberg
6418ffa289 Making use of the new wrapper in the help viewer and the file browser.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5051 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-02 09:29:05 +00:00
Benno Schulenberg
3933a30c9e Adding a typedef for a pointer to a function: functionptrtype.
And starting to use this to make the code a bit cleaner.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5050 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-02 08:47:09 +00:00
Benno Schulenberg
e6a4a64619 Adding two defines to make the functions list clearer.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5049 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-01 18:52:21 +00:00
Benno Schulenberg
b095725429 Now delete these case-sensitive, regular-expressive and backwards
file-searching capabilities again and all provisions for them.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5048 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-01 16:24:01 +00:00
Benno Schulenberg
4947ad83cb Showing that it is possible to have case-sensitive, regular-expressive,
and backwards searching in the file browser.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5047 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-01 15:42:08 +00:00
Benno Schulenberg
ebcc68f51d Grouping the arguments better.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5046 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-01 11:50:35 +00:00
Benno Schulenberg
645841fd25 Not passing the menu but setting it earlier.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5045 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-01 11:42:28 +00:00
Benno Schulenberg
3cd3e32ec3 There are no tagless functions, so there is no need to check.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5044 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-01 10:52:07 +00:00
Benno Schulenberg
49816fed70 Now that 'currmenu' is really global, stop passing it around.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5043 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-01 10:41:10 +00:00
Benno Schulenberg
3b031b1bad Making sure to always set 'currmenu', so that we can rely on it.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5042 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-01 08:38:08 +00:00
Benno Schulenberg
95e77a9d5f Renaming '*cut_till_end' to '*cut_till_eof', to reduce
confusion with CUT_TO_END, which is about end-of-line.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5041 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-30 20:39:27 +00:00
Benno Schulenberg
776931a0b0 Fixing a bug where binding a movement function to a Meta key would make
the corresponding Arrow key stop working (producing a character instead).


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5040 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-30 18:20:32 +00:00
Benno Schulenberg
7e5324d164 Making 'meta_key' and 'func_key' into global variables, instead of
having them declared everywhere and passing them around endlessly.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5039 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-30 18:04:33 +00:00
Benno Schulenberg
eaf235f1e6 Moving some variables to a better place.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5038 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-30 17:49:53 +00:00
Benno Schulenberg
e94a00a26c When there are no syntaxes, for example with --ignorercfiles,
do not try to find one, because that would lead to the magic
database being searched, which slows down startup a lot.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5037 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-30 17:47:07 +00:00
Benno Schulenberg
09dd0a4acb Making Ctrl-Left and Ctrl-Right produce special codes,
and mapping these codes to Prevword and Nextword.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5036 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-29 20:53:00 +00:00
Benno Schulenberg
6f28d35eef Fixing compilation with --enable-tiny --enable-nanorc.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5035 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-29 09:33:51 +00:00
Benno Schulenberg
41e19a14f4 Tiny ChangeLog tweaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5034 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-29 09:32:04 +00:00
Benno Schulenberg
484a0be6e6 Updating the pointer to the bottom of the file
when undoing line deletions at file's end.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5033 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-29 08:49:06 +00:00
Benno Schulenberg
d48d84a3ba Now trimming the superfluous braces.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5032 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-28 15:34:10 +00:00
Benno Schulenberg
b71cf98ec7 Using a single assignment of do_toggle_void.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5031 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-28 15:22:41 +00:00
Benno Schulenberg
0a1e56ed3c Moving (the recognition of) the toggles to the end, like everywhere else.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5030 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-28 15:00:29 +00:00
Benno Schulenberg
d4623f3ca3 Eradicating the execute flag -- it is almost always TRUE, and when it's FALSE
then it's for a function that is an empty placeholder, so executing it will
not do anything anyway.  Handling the one exception (do_gotolinecolumn_void)
specially, just like the other one (do_cancel) already is.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5029 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-28 14:42:18 +00:00
Benno Schulenberg
b5895f0a51 Removing the useless parameters 'have_shortcut and 'allow_funcs'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5028 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-28 08:29:18 +00:00
Benno Schulenberg
4868f83874 Silencing a useless warning about seemingly ignoring a datarootdir setting.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5027 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-27 20:35:37 +00:00
Benno Schulenberg
607b226e4e Stopping to distribute the obsolete BUGS file, and removing it from SVN.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5026 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-27 20:20:14 +00:00
Benno Schulenberg
26de2dd843 Normalizing some indentation and whitespace.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5025 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-27 20:01:27 +00:00
Benno Schulenberg
29dfb68b6e Removing the ability to search for a matching bracket in a prompt input line.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5024 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-27 19:32:12 +00:00
Benno Schulenberg
64fd3b8d0e Updating the docs for the narrower meaning of 'all' when rebinding keys.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5023 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-27 16:27:52 +00:00
Benno Schulenberg
4651f49fca Allowing only those menus where the bound function is actually present,
when rebinding keys.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5022 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-27 16:14:52 +00:00
Benno Schulenberg
a8c13d79fe Adding default keybindings for Cut, PrevWord and NextWord in the prompt input lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5021 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-27 15:51:24 +00:00
Benno Schulenberg
40ae394b6a Allowing 'firstline' and 'lastline' to be rebound to Ctrl keys.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5020 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-25 09:17:38 +00:00
Benno Schulenberg
0c0fbd585c Allowing 'firstfile' and 'lastfile' to be rebound to Ctrl keys.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5019 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-25 09:05:55 +00:00
Benno Schulenberg
45417c76f3 Giving audible feedback when flipping the new buffer to off
is not allowed in view mode.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5018 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-23 20:30:23 +00:00
Benno Schulenberg
cfa1338fb0 Normalizing the indentation in do_help().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5017 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-23 20:22:42 +00:00
Benno Schulenberg
12ecfbbae8 Showing Ins and Del as valid rebindable keys in the nanorc syntax colouring.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5016 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-23 20:17:00 +00:00
Benno Schulenberg
ef16223661 Adding the bindable function 'gotodir', documenting it, and also
documenting 'tofiles' and 'flipnewbuffer', and correcting the
description of 'gototext' (not being about the file browser).


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5015 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-23 20:03:25 +00:00
Benno Schulenberg
a0f66c0691 Renaming 'no_replace_void()' to 'flip_replace_void()',
to show what it actually does.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5014 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-23 18:30:35 +00:00
Benno Schulenberg
ce0ea44596 Renaming UP_DIR and DOWN_DIR to UPWARD and DOWNWARD, for clarity,
to reduce the slight confusion with DIR meaning directory.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5013 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-23 18:20:12 +00:00
Benno Schulenberg
4cf39e4191 Renaming 'undidmsg' to 'redidmsg', to be apt.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5012 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-22 21:26:56 +00:00
Benno Schulenberg
64039e9337 Removing a superfluous abortion variable, and placing two comments better.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5011 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-22 21:21:00 +00:00
Benno Schulenberg
8ea830f79b When toggling softwrap, only the edit window needs to be refreshed,
not the entire screen.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5010 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-22 19:23:54 +00:00
Benno Schulenberg
cda06a9491 Removing two pointless calls of get_shortcut(), and adjusting the comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5009 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-22 19:17:02 +00:00
Benno Schulenberg
016669128b Fixing three leaks of the cutbuffer, shortening and regrouping some stuff,
and removing an unneeded iteration of cutbottom.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5008 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-22 11:03:49 +00:00
Benno Schulenberg
07f40612e1 When redoing a line join at the tail of the file,
make sure openfile->filebot is updated.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5007 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-22 10:14:48 +00:00
Benno Schulenberg
fb6c0cd20c When undoing a line break at the tail of the file,
make sure openfile->filebot is updated.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5006 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-21 19:40:30 +00:00
Benno Schulenberg
76e150b47f When undoing a cut-till-end-of-file, put the cursor back
where the cut started, and not at the bottom of the file.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5005 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-21 19:32:17 +00:00
Benno Schulenberg
f80dcb2b25 Miscellaneous whitespace fixes, one type fix, and one more #ifdef NANO_TINY.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5004 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-21 19:01:51 +00:00
Benno Schulenberg
3060ce36d3 Letting +1 and +,1 make nano start on line one column one, overriding
a position from history.  This fixes Savannah bug #42538.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5003 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 19:10:24 +00:00
Benno Schulenberg
b14fbf719f Explaining better what "all" means when rebinding keys.
This is a soft fix for Savannah bug #42552.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5002 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 18:40:34 +00:00
Benno Schulenberg
1930e8102d Fixing compilation with --enable-tiny --enable-mouse.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5001 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 18:06:22 +00:00
Benno Schulenberg
691689d2b3 Fixing compilation with --enable-tiny --enable-histories --enable-multibuffer.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5000 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 16:33:12 +00:00
Benno Schulenberg
3b47ff756e Fixing compilation with --enable-tiny --enable-wrapping.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4999 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 16:13:54 +00:00
Benno Schulenberg
cf8a296279 Fixing compilation with --enable-tiny --enable-histories --enable-nanorc.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4998 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 16:03:38 +00:00
Benno Schulenberg
c923fa7c61 History logging is no longer dependent upon nanorc support,
plus many other documentation tweaks.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4997 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 15:56:31 +00:00
Benno Schulenberg
b0555990c2 Fixing compilation with --enable-tiny --enable-browser.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4996 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 15:35:26 +00:00
Benno Schulenberg
492e9f605b Miscellaneous whitespace adjustments and comment tweaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4995 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 10:48:26 +00:00
Benno Schulenberg
ac6846a3e9 Wrapping long lines and actually reporting the name that is not a directory.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4994 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 10:39:31 +00:00
Benno Schulenberg
03f37add07 Another removal and more regrouping.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4993 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 10:34:52 +00:00
Benno Schulenberg
4147c5e0fc Removing two obsolete variables and regrouping some stuff.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4992 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-20 07:55:24 +00:00
Benno Schulenberg
3f816eeb58 Huh!? Why doesn't the build fail here without this change?
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4991 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-19 21:01:39 +00:00
Benno Schulenberg
ae2d300375 Pfff... Getting all iterations right is difficult.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4990 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-19 20:19:22 +00:00
Benno Schulenberg
b341f29cbd Transform many DISABLE_NANORC #ifdefs to the new DISABLE_HISTORIES.
This completes the fix for Savannah bug #42539.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4989 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-19 20:05:24 +00:00
Benno Schulenberg
0615acd739 Adding a --disable-histories flag, to disable the code for
the histories of search/replace strings and cursor positions.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4988 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-19 17:39:26 +00:00
Benno Schulenberg
fcb4c3fc6e Allowing --historylog and --poslog to function
also when --ignorercfiles is given.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4987 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-19 15:09:23 +00:00
Benno Schulenberg
d840302f28 Updating some comments to match the current state of affairs.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4986 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-19 13:08:23 +00:00
Benno Schulenberg
e7c690d577 Renaming 'no_more_space()' to 'more_space()' for consistency.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4985 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-19 11:58:11 +00:00
Benno Schulenberg
a81e141326 Removing a condition and a break that cancel each other.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4984 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-18 21:23:50 +00:00
Benno Schulenberg
336d1b8902 Renaming 'function_type' to 'key_type', for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4983 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-18 20:43:05 +00:00
Benno Schulenberg
45fe2adf72 Renaming the undo type UNSPLIT to JOIN, for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4982 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-18 20:11:52 +00:00
Benno Schulenberg
b39db7bc63 And eliding a totally unused 'strdata2'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4981 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-18 20:01:30 +00:00
Benno Schulenberg
3cf338aca8 Eliding the in fact unneeded 'to_eof'
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4980 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-18 19:59:12 +00:00
Benno Schulenberg
c55c0db2bb Renaming 'to_end' to 'to_eof', to lessen confusion with CUT_TO_END.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4979 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-18 19:46:35 +00:00
Benno Schulenberg
a872709ab4 Making sure the cutbuffer is cleared at the appropriate moments.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4978 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-18 19:04:35 +00:00
Benno Schulenberg
b439f55678 Replacing SYSCONFDIR with an absolute path or a circumlocution,
as suggested by Mike Frysinger, plus some other tweaks.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4977 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-17 20:30:59 +00:00
Benno Schulenberg
e96022b923 After an undo or redo, update the 'placewewant'.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4976 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-17 15:50:34 +00:00
Benno Schulenberg
38cb8fc328 Removing an obsolete boolean variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4975 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-17 15:37:34 +00:00
Benno Schulenberg
4f3f976030 Displaying "No file name" on the statusbar for two seconds
when --tempfile was given and the current buffer has no name.
This fixes Savannah bug #41750.  Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4974 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-16 20:44:34 +00:00
Benno Schulenberg
7152a4b544 Changing some wordings, to be more precise or clear.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4973 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-16 15:24:28 +00:00
Benno Schulenberg
73a8aa0a74 Updating the docs for the changed location of nano's search history.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4972 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-16 15:02:58 +00:00
Benno Schulenberg
d21649e906 Trimming the contents of EXTRA_DIST to what is beyond normal.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4971 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-16 12:54:06 +00:00
Benno Schulenberg
1f67c1244d Removing an "-I m4" flag; it is needed only at the top level.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4970 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-16 12:45:03 +00:00
Benno Schulenberg
0ec771009c Putting a common statement outside of the then/else branches.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4969 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-16 12:40:14 +00:00
Benno Schulenberg
99a649ddf6 Avoiding an "Unknown Command" on every cursor-positioning mouse click.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4968 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-16 12:30:35 +00:00
Benno Schulenberg
ca9abd8216 Making sure the compiler also links against libz, which is used by libmagic.
This fixes Savannah bug #38378, reported by Alan Hourihane.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4967 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-16 12:06:58 +00:00
Benno Schulenberg
948b8e9bcf Putting the cursor back in front of a backwards cut,
where it was when the cut was made.
Patch by Mark Majeres, edited by Benno Schulenberg.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4966 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-14 14:08:28 +00:00
Benno Schulenberg
c5c0d748c2 Removing the useless info dir file from the build directory,
plus some other tweaks of the spec file.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4965 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-13 20:52:39 +00:00
Benno Schulenberg
736fbf2e3f Removing the --undo option, having the undo functions always enabled.
If wished, the user can unbind them.  This fixes Savannah bug #42456.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4964 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-13 15:20:26 +00:00
Benno Schulenberg
cd59a646e6 Not treating the holding of both Control and Meta the same as only Control.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4963 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-13 14:58:02 +00:00
Benno Schulenberg
3af22aad8d Letting a toggle not break a series of ^Ks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4962 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-13 12:28:33 +00:00
Benno Schulenberg
1d06455ca5 Letting a click on titlebar or statusbar not break a series of ^Ks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4961 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-13 12:19:44 +00:00
Benno Schulenberg
454563c9dc Letting a mousal repositioning of the cursor break a series of ^Ks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4960 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-13 12:07:18 +00:00
Benno Schulenberg
62bb6e85fc Setting not just the meta_key but also the func_key boolean when a key is
reinserted into the keyboard buffer.  This fixes Savannah bug #42092.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4959 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-11 19:24:38 +00:00
Benno Schulenberg
8cc8b08dfc Removing a superfluous switch statement.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4958 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-11 18:34:35 +00:00
Benno Schulenberg
fc35e20052 Always accepting mouse events, also when just looking for Unjustify.
This fixes Savannah bug #42322.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4957 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-11 18:23:29 +00:00
Benno Schulenberg
a3f421ca2b Producing the correct return value for when a mouse event reinserted something
into the keyboard buffer.  And not continuing but getting out when there is a
spurious  mouse event.  Continuing would result in the cutbuffer being cleared
upon the next cut.  These two changes together fix Savannah bug #42326.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4956 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-11 18:04:36 +00:00
Benno Schulenberg
7d5f42ca08 Using the right type to avoid a compiler warning.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4955 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-10 19:50:44 +00:00
Benno Schulenberg
a8a23abc00 Making a couple of minimalistic whitespace adjustments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4954 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-10 19:12:14 +00:00
Benno Schulenberg
53435b0efc One more type fix and two tiny message tweaks.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4953 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-10 19:07:47 +00:00
Benno Schulenberg
6af5bdea27 A few more cosmetic tweaks and type fixes.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4952 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-09 20:41:15 +00:00
Benno Schulenberg
1102aaa374 Making tiny nano a bit tinier by preening out some soft-wrap stuff.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4951 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-09 20:26:54 +00:00
Benno Schulenberg
acda255b47 A bunch of type fixes, mostly in debugging messages --
line numbers are long, x positions unsigned long.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4950 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-09 15:08:59 +00:00
Benno Schulenberg
ed0086bde5 Eliding four function calls by not comparing with an
empty string but checking for the terminating '\0'.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4949 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-09 14:33:00 +00:00
Benno Schulenberg
505125e259 A few cosmetic tweaks of comments and whitespace.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4948 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-09 14:23:53 +00:00
Benno Schulenberg
c35eb5a16e Avoiding a compiler warning with --disable-wrapping.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4947 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-09 10:35:44 +00:00
Benno Schulenberg
9ac910e9d3 Removing two superfluous conditions.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4946 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-09 10:28:23 +00:00
Benno Schulenberg
be10c2a48c Rewriting the line-wrapping code to make use of the existing line-break code.
And undoing line wraps together with their causal text additions, and not as
separate actions because the user did not make them.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4945 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-09 10:01:54 +00:00
Benno Schulenberg
64896ba2ff Differentiating between undoing a Delete and undoing a Backspace -- the
cursor should be in a slightly but significantly different position.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4944 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-08 19:02:12 +00:00
Benno Schulenberg
5dfab51576 Putting back the "-svn" tag on the version number.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4943 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-05 08:20:54 +00:00
Benno Schulenberg
25df3ab995 Noting nano 2.3.3 and 2.3.4 in the Changelog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4942 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-05 07:57:04 +00:00
Benno Schulenberg
04a38da312 Allowing the toggle between Read File and Execute Command to be rebound.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4941 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-04 19:15:16 +00:00
Benno Schulenberg
95592ce5df Tiny ChangeLog tweaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4940 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-04 16:32:45 +00:00
Benno Schulenberg
1eb23d4988 Making use of the macros charalloc() and charealloc(), making use of
null_at(), adding a cast, and using an unsigned type for a length.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4939 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-04 16:30:11 +00:00
Benno Schulenberg
1de337de9c Normalizing whitespace, comments and interpunction, in various places.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4938 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-04 16:02:51 +00:00
Chris Allegretta
ac1508c49e GNU nano 2.3.4 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4936 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-02 15:17:35 +00:00
Chris Allegretta
0de8d0d63d 2014-06-02 Chris Allegretta <chrisa@asty.org>
* doc/syntax/default.nanorc: Can't do trailing spaces in the 
          default syntax or it will hilight the spaces as you type 
          them into a new file, which for non-programming is infuriating.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4935 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-06-02 14:35:21 +00:00
Benno Schulenberg
ff36b05cdb Differentiating (for the undo structure) between
deleting a newline and any other character.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4934 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-05-29 18:50:13 +00:00
Chris Allegretta
82a411077a 2014-05-29 Chris Allegretta <chrisa@asty.org>
* src/chars.c (addstrings): Needs to be available even on
          non-utf-8 sustems.
        * nano-regress: Added --disable-utf8 to regression check



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4933 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-05-29 18:30:23 +00:00
Chris Allegretta
cbc6e5197f Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4932 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-05-29 05:25:44 +00:00
82 changed files with 25004 additions and 23511 deletions

1
.gitignore vendored
View File

@@ -14,6 +14,7 @@ core
/INSTALL
/aclocal.m4
/autom4te.cache
/compile
/config.cache
/config.guess
/config.h

161
BUGS
View File

@@ -1,161 +0,0 @@
** Open BUGS **
** Fixed BUGS **
- Marked cutting sometimes leaves a newline in the file unintelligently,
such as when all of a line is selected but the mark doesn't proceed to
the new line. (8) [FIXED/IRRELEVANT]
- Certains are not lined up properly when there are tabs in them at
certain col values. (9) [FIXED]
- edit_refresh() and update_line() do not handle selecting text when the
cursor is beyond COLS (10) [FIXED]
- No way to do a replace with the empty string (11) [FIXED, yay!]
- Spelling support is not elegant like Pico's integration of the 'spell'
program. nano only uses ispell (for now) (12) [FIXED]
- Moving to the end of a line when close to a multiple of COLS and at
least COLS * 2 does not make the screen jump early like it would for
if we were around COLS (bugs in edit_refresh, update_line) (13)
[FIXED, mostly]
- When at the very bottom of the edit window, do_wrap() goes berserk and
puts the cursor somewhere bad; subsequent keystrokes crash the program
(14) [FIXED, mostly]
- Doing a replacement of a substring of the replace string (e.g.
replacing "ed" with "fred" causes an infinite loop). (15) [FIXED]
- Cutting a file with marked text and both marker ends on the same line
causes a random segfault (16) [FIXED]
- Cutting more than one line resets the KEEP_CUTBUFFER flag in 0.9.3.
Error is in bitwise assignment (nano.h). (17) [FIXED]
- The wrapping code does not work right for lines like the following:
* *
Error is in do_wrap, must be rewritten. (18) [FIXED]
- nano fails to follow symlinks, even though -l isn't being used (20).
[Bug in global flag init, FIXED]
- When using --help or --version, the SIGINT character gets lost. (21)
[FIXED]
- edit_refresh() and update_line() (and related functions) have
trouble when a tab is the character that is the boundary at COLS (23)
[FIXED]
- There is an off-by-one error in keeping track of totsize. It is
caused by the fact that we count the newline at the end when we read
in a file but we do not, in fact, display this newline. This should
go away implicitly when the "Magic Line" returns, but it is noted here
for documentation's sake. (24) [FIXED]
- In replace with completely adjacent strings, every other search string
will be missed (try replace ':' in a string like ':::::::::') (28)
[FIXED]
- If nano opens a read-only file with the --tempfile option, and a
change is made to the buffer, and a write is attempted, nano will not
give you a dialog about not being able to write the file, and it will
not let the user exit (29, discovered by Joshua Jensen) [FIXED]
- Using nano -k, marked text is not cut properly. (31) [FIXED]
- Invoking -t or -k has the effect of invoking both options. (32)
[FIXED]
- totsize becomes incorrect after word-wrapping (25) [FIXED]
- Wrapping a line with autoindent mode sometimes causes a segfault (19)
[FIXED]
- When inserting files, the display sometimes fails to display properly
until a pageup/down occurs (22) [FIXED]
- In search/replace code, there is too much refreshing in bottomwin (26)
[FIXED]
- In replace, there is no way to accept the default replace string. (27)
[FIXED]
- Using nano -t, user can not exit until a filename is given via ^O.
(30) [FIXED]
- totsize problems still abound in do_justify (33) [FIXED]
- Using -k, cut text is not pasted properly. (34) [FIXED].
- Using -k, pasted text is not updated properly if it goes beyond
editbot. (35) [FIXED]
- Doing a cut with -k can screw up the filestruct; fault is in cutting
code. (36) [FIXED]
- Hitting enter on the magic line makes new lines, but they are not
written out to disk when saved..... (37). [FIXED]
- Page up and page down do not work the same way as in Pico (# of
lines). (38) [FIXED]
- When doing a search and the marker is set, the screen does not always
properly update the inverted text (39). [FIXED]
- Searches for a string that only exists on one line multiple times will
fail after finding the last occurrence (discovered by Ken Tyler) (40).
[FIXED]
- Meta-Z is currently broken to toggle suspend. I guess I still don't
know signals very well =-) (41) [FIXED].
- Unable to cut the entire file using the marker (discovered by Ken
Tyler) (42). [FIXED]
- The keypad does not work when nano runs in the Gnome terminal (43).
[FIXED]
- When reading in a file, if the file is a directory, the contents of
the file being edited are blown away (discovered by Chris Pimlot)
(44). [FIXED]
- In certain terms, nano will leave a "ghost" of screen upon exit when
called from inside mutt (among other settings) (45). [FIXED]
- In replace, hitting the Goto line shortcut key does nothing after a
search string is entered (discovered by Rocco Corsi) (46) [FIXED].
- When typing in a string in search or replace and hitting
CASE_SENSITIVE or the other search string, the current string edit is
blown away in favor of the last stored search (47) [FIXED]
- If nano fails to open a file when it starts up, doing almost anything
causes a segfault (discovered by Ben Roberts) (48). [FIXED]
- In certain terminals, nano would not work properly with keypad().
Turned out to be the silly timeout(0) call, which is completely
unneeded, anyway. (49) [FIXED]
- With less than a page of text, doing a page down will move the current
line to the top of the screen, which it shouldn't do. (50) [FIXED]
- With PDCurses, running Meta-X turns off the keypad. (51) [FIXED]
- Resizing the window completely screws up the display if in any other
mode than normal editing (help screen, search and replace, file
browser...) (52) [FIXED]
- Alt speller argument (-s, --speller) does not take a string argument
of more than one word. (53) [FIXED].
- Cut to end cutting (-k) causes segfaults (try cutting "- Backup making
(filename~)?" line in TODO file) (discovered by
higuita@cadernoverde.com) (54) [FIXED].
- When using autoindent (-i), wrapped text does not get autoindented
(55, discovered by Mark Senior) [FIXED].
- When using -R (regex) and -p (Pico mode), subsequent searches after
the first fail if no string is entered (56) [FIXED].
- Page down on a file of editwinrows fails (again). Reported by Ryan
Krebs (57) [FIXED].
- File browser aborts on Solaris in qsort() call. (Reported by Matthias
Andree) (58) [FIXED].
- Can modify the current file in view mode with ^W^R (discovered by
Rocco Corsi) (58) [FIXED].
- When page up is used after two page downs, the screen doesn't update
properly (discovered by David Lawrence Ramsey) (59) [FIXED].
- On BSD systems, marked cutting and paste often screws up the last line
in the cutbuffer (discovered by Barry Pederson) (60) [FIXED]
- Blank lines are not kept when cutting with -k (discovered by Rocco)
(61) [FIXED].
- nano will not suspend properly inside of mutt (62) [FIXED].
- When switching from Pico mode to normal mode, the previous search is
not displayed until cancelling the search (63) [FIXED].
- If you change search options but don't change the search string in
normal mode, hitting Enter causes the search/replace to abort (64)
(Jordi Mallach) [FIXED].
- Cutting one line of text causes the screen to recenter the line
(reported and fixed by David Lawrence Ramsey) (65) [FIXED].
- When cutting marked text including the bottom of the file, a new
"magic line" is not created" (reported by David Lawrence Ramsey, fixed
by David Lawrence Ramsey & Chris) (66) [FIXED].
- ^C does not work after a suspend in tcsh (discovered by Trevor Cordes)
(68) [FIXED].
- Home and End control keys (^A, ^E) do not always work in filename
prompt (bug found by Ian Turner) (69) [1.0 series only] [FIXED].
- Trying to insert a file of 0 bytes will hang nano (70) [FIXED].
- Meta-space and ^Space are not yet handled in new backend code (77) [FIXED]
- F-keys do not work with new shortcut backend (72) [FIXED]
- Many menu items are probably missing from the new backend (73) [FIXED]
- Need a 'check-vitals-mapped' function to check that the end used didn't
unbind all the keys for exit or cancel before starting up the editor (74) [FIXED]
- Browser and prompt code still implement old switch on raw key input instead
of new if block for subnfunc values (75) [FIXED]
- New backend code probably does not compile under anything but default options,
if that (76) [FIXED]
- -enable-tiny does not work with new code (78) [FIXED]
- If a user only binds meta sequences to a function like left, right
page up/down, insert, and unbinds all other control and F keys for it,
nano will do the wrong thing when reading the key which is normally
assigned to it (79 - may not be worth fixing) [FIXED]
- Segfault editing at COLS presumably due to new color syntax
highlighting (80) [FIXED]
- Cutting the line at the top of the screen recenters to center (71) [FIXED]
$Id$

727
ChangeLog
View File

@@ -1,3 +1,699 @@
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 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.
* doc/syntax/{java,lua,python,ruby}.nanorc: Wrap some overlong lines.
2015-02-18 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/sh.nanorc: Recognize also dash, openrc and runscript.
2015-02-16 Mike Frysinger <vapier@gentoo.org>
* .gitignore: Ignore the autotools 'compile' file.
2015-02-15 Benno Schulenberg <bensberg@justemail.net>
* src/file.c (do_lockfile): Also show the name of the affected file
when finding a lock file, for when many files are opened at once.
* src/file.c (do_lockfile): The user does the editing, not the editor.
2015-02-09 Chris Allegretta <chrisa@asty.org>
* nano.spec.in: Add dependency on texinfo, docdir files for
RPM file creation.
GNU nano 2.3.99pre2 - 2015.02.06
2015-02-03 Alex Henrie <alexhenrie24@gmail.com>
* src/cut.c (do_cut_text): Make sure to set modified even when
using --enable-tiny.
2015-02-01 Kamil Dudka <kdudka@redhat.com>
* src/files.c (write_lockfile): Avoid writing uninitialized bytes to
the lock file -- a simple null_at() would not initialize the buffer.
* src/files.c (do_lockfile): Make sure that 'lockprog' and 'lockuser'
are terminated -- strncpy() does not guarantee that on its own.
* src/files.c (do_lockfile): Avoid printing a wrong PID on the status
bar due to treating serialized PID bytes as signed integers. This
addresses https://bugzilla.redhat.com/1186384 reported by Don Swaner.
* src/files.c (write_lockfile): Do not trim the nano version number
-- snprintf() counts the trailing zero into the size limit.
2015-02-01 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (do_credits): Add a general entry for all translators.
* src/nano.c (version), src/winio.c (do_credits): Update the copyright
years to include 2015.
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.
GNU nano 2.3.99pre1 - 2015.01.06
2015-01-03 Chris Allegretta <chrisa@asty.org>
* New formatter code to support syntaxes like
go which have tools to automatically lint and reformat the text for
you (gofmt), which is lovely. rcfile option formatter, function
text.c:do_formatter() and some other calls.
2014-12-28 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (do_lockfile): Gettextize the "File being edited"
prompt, and improve its wording.
* src/winio.c (do_credits): Remove the names of past translators
from the Easter-egg scroll.
* THANKS: Add a missing historical translator name.
* src/winio.c (do_credits): Add Mark to the scroll, for all his
undo work, colouring nano's interface, and other patches.
2014-11-30 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/spec.nanorc: Colorize %pretrans and %posttrans fully.
Original patch from Savannah patch #8573 by Daniel Vrátil.
2014-09-21 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/{perl,python,ruby,sh}.nanorc: Recognize also header
lines of the form "#!/usr/bin/env thing" besides "#!/bin/thing".
This fixes Savannah bug #43270 reported by Kitty.
2014-08-29 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_justify): Replace the old get_shortcut() wrapper
with the new func_from_key().
2014-08-10 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Improve some wordings and formatting.
2014-08-07 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/nanorc.nanorc: Remove a mistaken OR which causes a
'Bad regex, empty (sub)expression' error on some systems. This
fixes Savannah bug #42929 reported by Misty De Meo.
2014-08-03 Benno Schulenberg <bensberg@justemail.net>
* doc/man/nano.1, doc/man/rnano.1: Tweak the formatting a bit so that
po4a will create a nicer POT file.
* doc/man/nanorc.5: Improve some of the wordings and formatting.
2014-08-02 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Standardize the formatting of command-line
options -- each one separately. Also add some more markup.
2014-08-01 Benno Schulenberg <bensberg@justemail.net>
* doc/man/nano.1, doc/man/rnano.1: Separate short and long option
by a comma instead of putting the long one between parentheses.
And showing the required quotes around the argument of -Q.
2014-07-31 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (do_insertfile): Adjust some indentation.
* src/prompt.c (do_statusbar_input), src/browser.c (do_browser):
Reorder a few things, and adjust some whitespace.
2014-07-27 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (add_to_sclist): Remove the now unused and unneeded
addition ability from this builder function of the shortcut list.
* src/global.c (strtokeytype): Move this to a better place.
* src/global.c (first_sc_for): Move this too to a better place.
* src/prompt.c (do_yesno_prompt): Use the new and more direct
func_from_key() wrapper instead of get_shortcut().
* src/text.c (do_linter): Likewise.
* src/files.c (do_insertfile, do_writeout): Likewise.
2014-07-24 Jordi Mallach <jordi@gnu.org>
* doc/texinfo/nano.texi, doc/man/nanorc.5: Typo fix.
2014-07-22 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/nanorc.nanorc: Remove 'undo' from the valid options.
2014-07-21 Jordi Mallach <jordi@gnu.org>
* doc/nanorc.sample.in: Remove undo section which is now obsolete.
GNU nano 2.3.6 - 2014.07.17
2014-07-16 Jordi Mallach <jordi@gnu.org>
* doc/man/rnano.1: Additional printing formatting improvement from
Bjarni Ingi Gislason.
2014-07-16 Jordi Mallach <jordi@gnu.org>
* doc/man/fr/nano.1, doc/man/fr/rnano.1: Apply similar escaping fixes
to French manpages.
* doc/man/fr/nano.1, doc/man/fr/rnano.1, doc/man/fr/nanorc.5: Recode
as UTF-8.
2014-07-16 Jordi Mallach <jordi@gnu.org>
* doc/syntax/debian.nanorc: Add https, tor and spacewalk to supported
APT methods.
* doc/syntax/debian.nanorc: Apply the syntax to apt/sources.list.d/
entries as well, as reported by Rodolphe Pelloux-Prayer.
2014-07-16 Jordi Mallach <jordi@gnu.org>
* doc/man/nano.1, doc/man/rnano.1: Add some escaping and formatting
fixes as suggested Bjarni Ingi Gislason <bjarniig@rhi.hi.is> in
Debian bugs #662842 and #726956.
2014-07-16 Benno Schulenberg <bensberg@justemail.net>
* src/text.c: Normalize the tabbing.
2014-07-16 Mark Majeres <mark@engine12.com>
* src/text.c (do_undo): Make sure renumbering starts far enough back
after undoing a cut or paste. This fixes a segmentation fault when
undoing a repeated cutting and pasting of the first line of a file.
* src/nano.c (move_to_filestruct, copy_from_filestruct): Fix two leaks.
2014-07-13 David Lawrence Ramsey <pooka109@gmail.com>
* ChangeLog: Typo fix.
2014-07-12 Benno Schulenberg <bensberg@justemail.net>
* configure.ac: The warning about datarootdir being ignored is
not merely a warning, it also activates a workaround.
2014-07-11 Mark Majeres <mark@engine12.com>
* src/text.c (do_undo, do_redo): Do not speak of "line wrap"
but instead of "text add" when undoing/redoing text additions
that caused automatic line breaks.
2014-07-11 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (write_lockfile): Refix typo in error message.
GNU nano 2.3.5 - 2014.07.11
2014-07-11 Chris Allegretta <chrisa@asty.org>
* src/files.c (do_lockfile, open_file): If locking fails,
allow the lock failure message to be preserved AND
preserve the filename passed on the cmdline. Fixes
Savannah bug #42668.
2014-07-02 Chris Allegretta <chrisa@asty.org>
* src/files.c (do_lockfile): Check whether the directory
of the file we're trying to lock exists, and make the
resulting error message more intuitive. Fixes
Savannah bug #42639 reported by Benno Schulenberg.
2014-07-02 Mark Majeres <mark@engine12.com>
* src/text.c (undo_cut, redo_cut, update_undo): Handle the
cases of cutting-from-cursor-to-end-of-line correctly.
* src/nano.c (do_input): Don't preserve the cutbuffer when
CUT_TO_END is toggled -- it would intermix two cut types.
* src/text.c (redo_cut, do_undo, do_redo): Don't forget to
free the cutbuffer after use.
2014-07-02 Benno Schulenberg <bensberg@justemail.net>
* src/proto.h: Add a typedef for a pointer to a function.
* src/global.c (func_from_key): New wrapper.
* src/prompt.c (get_prompt_string, do_prompt): Use the new
wrapper to make the code a bit cleaner.
* src/help.c (do_help, parse_help_input): Use the wrapper.
* src/browser.c (do_browser, parse_browser_input): Likewise.
* src/search.c (search_init, do_gotolinecolumn): Likewise.
* src/search.c (findnextstr): Replace a call of old wrapper
'getfuncfromkey()' with a call of new 'func_from_key()'.
* src/winio.c (getfuncfromkey): Delete now unneeded wrapper.
* src/nano.c (usage, main), doc/texinfo/nano.texi: Properly
exclude the --quiet option when --disable-nanorc was given.
2014-07-01 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (do_browser), src/help.c (do_help): Make sure
to always set 'currmenu', so that we can rely on it.
* src/*.c (get_shortcut): Now that 'currmenu' is really global,
stop passing it around.
* src/help.c (help_init), src/winio.c (bottombars): There are
no tagless functions, so there is no need to check.
* src/prompt.c (do_prompt, get_prompt_string): Don't pass the
menu, just set it earlier.
* src/prompt.c (get_prompt_string): Group the arguments better.
* src/global.c (shortcut_init), src/browser.c (do_filesearch):
Show that it is possible to have backwards, regular-expressive
and case-sensitive searching in the file browser.
* src/browser.c (filesearch_init, do_filesearch): Now delete
these abilities again and all provisions for them.
* src/global.c (shortcut_init): Add two defines to make the
functions list clearer.
2014-06-30 Mark Majeres <mark@engine12.com>
* src/cut.c, src/global.c, src/nano.c: Rename 'cut_till_end' to
'cut_till_eof', and 'do_cut_till_end' to 'do_cut_till_eof', to
reduce confusion with CUT_TO_END, which is about end-of-line.
2014-06-30 Benno Schulenberg <bensberg@justemail.net>
* src/color.c (color_update): When there are no syntaxes, for example
with --ignorercfiles, do not try to find one, because that would lead
to the magic database being searched, which slows down startup a lot.
* src/color.c (color_update): Move some variables to a better place.
* src/*: Make 'meta_key' and 'func_key' into global variables, instead
of having them declared everywhere and passing them around endlessly.
* src/global.c (sc_seq_or): Now fix a bug introduced somewhere after
2.3.2 where binding a movement function to a Meta key would make the
corresponding Arrow key stop working (producing a character instead).
2014-06-29 Benno Schulenberg <bensberg@justemail.net>
* src/rcfile.c: Fix compilation with --enable-tiny --enable-nanorc.
* src/winio.c (parse_kbinput, get_escape_seq_kbinput): Make Ctrl-Left
and Ctrl-Right produce special codes, and map these codes to Prevword
and Nextword instead of reducing them to a plain Left and Right. The
codes 539 and 554 were so chosen because some terminals produce these.
2014-06-29 Mark Majeres <mark@engine12.com>
* src/text.c (do_undo): Update the pointer to the bottom of the file
when undoing line deletions at file's end.
2014-06-28 Benno Schulenberg <bensberg@justemail.net>
* src/prompt.c (do_statusbar_input): Remove the useless parameters
'have_shortcut and 'allow_funcs'; the latter is only ever TRUE.
* src/global.c (shortcut_init), src/prompt.c (do_statusbar_input):
Eradicate the execute flag -- it is only FALSE for functions that are
empty placeholders (so executing them will not do anything anyway) or
for functions ('total_refresh', 'do_suspend_void') that do not exist
in menus with a prompt. The only two exceptions are 'do_cancel' and
'do_gotolinecolumn_void'. The first is handled specially, so do that
too for the second and then get to drop 140 parameters.
* src/global.c (strtosc): Move recognition of the toggles to the end,
use a single assignment of do_toggle_void, trim the unneeded braces.
2014-06-27 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (shortcut_init): Add default keybindings for Cut,
PrevWord and NextWord in the prompt input lines; the code for those
special operations already exists, just the shortcuts were missing.
* src/rcfile.c (parse_binding): When binding keys, only allow those
menus where the bound function is actually present. This reduces
the meaning of 'all' to "all menus where the function exists".
* src/rcfile.c (is_universal): New function, returning TRUE for the
functions that are present in most menus but only listed in MMAIN.
* doc/man/nanorc.5, doc/texinfo/nano.texi: Update the docs for this.
* prompt.c (find_statusbar_bracket_match, do_statusbar_find_bracket):
Remove these functions and thus the ability to search for a matching
bracket in a prompt input line. The find_bracket function never had
a default keybinding outside MMAIN, so is unlikely to have been used.
* src/prompt.c (do_statusbar_input): Normalize the indentation.
* src/winio.c: Normalize some whitespace.
* Makefile.am, nano.spec.in: Stop distributing the BUGS file.
* BUGS: Remove obsolete file, as all the bugs in it have been fixed
long ago. Nowadays bugs are tracked on Savannah.
* configure.ac: Silence a useless warning about ignoring datarootdir.
2014-06-25 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (do_browser): Allow 'firstfile' and 'lastfile' to be
rebound to Ctrl keys -- checking meta_key is wrong, the function has
already been determined, that is all that matters.
* src/help.c (do_help): Same thing for 'firstline'/'lastline'.
2014-06-23 Benno Schulenberg <bensberg@justemail.net>
* src/nano.h, src/move.c (do_up, do_down), src/winio.c (edit_scroll):
Rename UP_DIR and DOWN_DIR to UPWARD and DOWNWARD, for clarity.
* src/proto.h, src/global.c, src/search.c: Rename 'no_replace_void()'
to 'flip_replace_void()', to show what it actually does.
* doc/man/nanorc.5, doc/texinfo/nano.texi: Update the docs for that.
* src/global.c (strtosc): Add the bindable function 'gotodir'.
* doc/man/nanorc.5, doc/texinfo/nano.texi: Document the bindable
functions 'tofiles','gotodir' and 'flipnewbuffer', and correct
the description of 'gototext' (not being about the file browser).
* doc/syntax/nanorc.nanorc: Show Ins and Del as valid rebindable keys.
* src/help.c (do_help): Normalize the indentation.
* src/files.c (do_insertfile): Give audible feedback when flipping
the new buffer to off is not allowed in view mode.
2014-06-22 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (parse_browser_input), src/help.c (parse_help_input):
Remove two pointless calls of get_shortcut(), and adjust the comments.
* src/nano.c (do_toggle): When toggling softwrap, only the edit window
needs to be refreshed, not the entire screen.
* src/browser.c (do_browser): Remove superfluous abortion variable,
and place two comments better.
* src/text.c (do_redo): Rename 'undidmsg' to 'redidmsg', to be apt.
2014-06-22 Mark Majeres <mark@engine12.com>
* src/text.c (do_redo): When redoing a line join at the tail
of the file, make sure openfile->filebot is updated.
* src/text.c (undo_cut, redo_cut, do_undo, add_undo, update_undo):
Fix three leaks of the cutbuffer, shorten and regroup some stuff,
and remove an unneeded iteration of cutbottom.
2014-06-21 Mark Majeres <mark@engine12.com>
* src/text.c (undo_cut, add_undo): When undoing a cut-till-eof,
put the cursor back where the cut started, and not at the end.
* src/text.c (do_undo): When undoing a line break at the tail
of the file, make sure openfile->filebot is updated.
2014-06-21 David Lawrence Ramsey <pooka109@gmail.com>
* src/move.c, src/nano.c: Miscellaneous whitespace fixes, one
type fix, and one more #ifdef NANO_TINY.
2014-06-20 Benno Schulenberg <bensberg@justemail.net>
* src/proto.h, src/global.c: Remove two obsolete variables and an
unneeded extern, and regroup some stuff.
* src/files.c (check_dotnano): Wrap long lines and actually report
the name that is not a directory.
* src/*: Miscellaneous whitespace adjustments and comment tweaks.
* src/files.c: Fix compilation with --enable-tiny --enable-browser.
* doc/man/nano.1, doc/texinfo/nano.texi: History logging no longer
depends upon nanorc support, plus many other tweaks.
* src/global.c (strtosc): Fix compilation with --enable-tiny
--enable-histories --enable-nanorc.
* src/text.c: Fix compilation with --enable-tiny --enable-wrapping.
* src/files.c (do_insertfile): Fix compilation with --enable-tiny
--enable-histories --enable-multibuffer.
* src/nano.c: Fix compilation with --enable-tiny --enable-mouse.
* doc/man/nanorc.5, doc/texinfo/nano.texi: Explain better what "all"
means when rebinding keys. This is a fix for Savannah bug #42552.
* src/nano.c (main): Make +1 and +,1 start on line one column one,
overriding a historical position. This fixes Savannah bug #42538.
2014-06-19 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (window_init): Rename 'no_more_space()' to 'more_space()'
for consistency, and tweak the related comments.
* src/files.c: Update some comments to match the current status.
* src/nano (finish, main): Allow -H/--historylog and -P/--poslog to
function also when -I/--ignorercfiles is given.
* configure.ac: Add a --disable-histories flag, to disable the code
for the histories of search/replace strings and cursor positions.
* doc/texinfo/nano.texi: Document the new configure flag.
* src/*: Transform many DISABLE_NANORC to the new DISABLE_HISTORIES.
This completes the fix for Savannah bug #42539.
2014-06-18 Benno Schulenberg <bensberg@justemail.net>
* src/text.c: Rename 'to_end' to 'to_eof', to lessen confusion
with CUT_TO_END (which is about cutting to end-of-line).
* src/text.c: Upon better thought, elide the unneeded 'to_eof'.
* src/text.c: And elide a totally unused 'strdata2'.
* src/text.c: Rename the undo type UNSPLIT to JOIN, for clarity.
* src/global.c, src/rcfile.c: Rename function_type to key_type.
* src/text.c (break_line): Remove a condition and a break that
cancel each other.
2014-06-18 Mark Majeres <mark@engine12.com>
* src/text.c (add_undo): Don't start a new undo for CUT when the
cutbuffer is being preserved, because then the cuts are contiguous
and will form a single undo item. And make sure the cutbuffer will
be cleared when a new undo item for CUT is created.
* src/cut.c (keeping_cutbuffer): New function, to access the status
of 'keep_cutbuffer' from the undo/redo code in src/text.c.
* src/cut.c (do_copy_text): Blow away the contents of the cutbuffer
if the mark is set or the cursor has moved between two copy commands.
2014-06-17 Mark Majeres <mark@engine12.com>
* src/text.c (do_undo, do_redo): After an undo or redo, update the
'placewewant' (the desired horizontal position of the cursor).
2014-06-17 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_undo, do_redo): Remove obsolete boolean variable.
* doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Replace
SYSCONFDIR with an absolute path or a circumlocution, as suggested
by Mike Frysinger, plus some other tweaks.
2014-06-16 David Lawrence Ramsey <pooka109@gmail.com>
* src/nano.c (do_exit): Display the message "No file name" on the
statusbar for two seconds when --tempfile was given and the current
buffer has no name. This fixes Savannah bug #41750.
2014-06-16 Benno Schulenberg <bensberg@justemail.net>
* configure.ac: For the sake of statically linked systems, make sure
the compiler also links against libz, which is used by libmagic.
This fixes Savannah bug #38378, reported by Alan Hourihane.
* src/nano.c (do_mouse, do_input): Don't bother returning zero when
the cursor moved, just reset the cutbuffer directly. This avoids an
"Unknown Command" message on every cursor-positioning mouse click.
* src/nano.c (do_mouse): Put a common statement outside of then/else.
* src/Makefile.am: Remove -I m4; it is needed only at the top level.
* Makefile.am: Trim the contents of EXTRA_DIST to what is required.
* doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Update
the docs for the changed location of nano's search history.
* doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Change
some wordings, triggered by Savannah bug #52539.
2014-06-14 Mark Majeres <mark@engine12.com>
* src/nano.h, src/text.c (undo_cut, update_undo): When undoing a
backwards cut, put the cursor back in front of it, where it was.
2014-06-13 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (do_input): Repositioning the cursor with the mouse
(result == 0) should break a series of ^Ks.
* src/nano.c (do_mouse): Clicking on the titlebar or the statusbar
should not break a series of ^Ks, thus result must not be zero.
* src/nano.c (do_input): A toggle should not break a series of ^Ks.
* src/winio.c (get_shortcut): Do not treat holding both Control and
Meta the same as holding only Control.
* src/global.c, src/rcfile.c, src/nano.h, src/nano.c, src/text.c:
Remove the --undo option, having the undo functions always enabled.
If wished, the user can unbind them. This fixes Savannah bug #42456.
* doc/man/{nano.1,nanorc.5}, doc/texinfo/nano.texi: Update the docs.
* nano.spec.in: Remove useless info dir file from the build directory,
don't clean this directory first, it's unnecessary, add a suggestion
for a pico symlink, and update the license and the source URL.
2014-06-11 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (get_mouseinput): Produce the correct return value for
when a mouse event reinserted something into the keyboard buffer.
* src/nano.c (do_input): Do not continue when there is a spurious
mouse event (a touch of the touchpad, for example) but get out.
Continuing would result in the cutbuffer being cleared upon the
next cut. These two changes together fix Savannah bug #42326.
* src/nano.c (do_input): Always accept mouse events, also when
just looking for Unjustify. This fixes Savannah bug #42322.
* src/nano.c (do_input): Remove a superfluous switch statement.
* src/winio.c (get_mouseinput): Set the type of a reinserted key,
also when it is a function key. This fixes Savannah bug #42092.
2014-06-10 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c, src/files.c, src/nano.c src/prompt.c, src/winio.c:
A few minimalistic whitespace adjustments.
* src/rcfile.c (check_bad_binding): Avoid a compiler warning.
2014-06-10 David Lawrence Ramsey <pooka109@gmail.com>
* src/winio.c: One more type fix and two tiny message tweaks.
2014-06-09 David Lawrence Ramsey <pooka109@gmail.com>
* src/*.c: Cosmetic tweaks of comments and whitespace.
* src/help.c, src/rcfile.c, src/winio.c: Elide a function call by
not comparing with an empty string but checking for the final \0.
* src/files.c, src/nano.c, src/text.c, src/winio.c: Type fixes in
debugging stuff -- line numbers are long, x positions unsigned long.
* src/files.c, src/move.c, src/nano.c, src/text.c, src/winio.c:
Make tiny nano a bit tinier by preening out some soft-wrap stuff.
* src/global.c, src/nano.c, src/winio.c: A few more cosmetic tweaks
(whitespace, order, braces, parentheses, and a typo) and type fixes.
2014-06-09 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (do_input): Remove two superfluous false conditions.
* src/nano.h, src/text.c (add_undo): Avoid a compiler warning with
--disable-wrapping.
2014-06-09 Mark Majeres <mark@engine12.com>
* src/text.c (do_undo, do_redo, add_undo, update_undo, do-wrap):
Rewrite the line-wrapping code to make use of the existing line-break
code. And undo line wraps together with their causal text additions,
and not as separate actions because the user did not make them.
2014-06-08 Mark Majeres <mark@engine12.com>
* src/text.c (do_delete, do_deletion, do_undo, do_redo, update_undo):
Differentiate between undoing a Delete and undoing a Backspace -- the
cursor should be in a slightly but significantly different position.
2014-06-04 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (shortcut_init), src/files.c (do_insertfile): Rename
'ext_cmd_void' to 'flip_execute_void' to better match what it does.
* src/global.c (strtosc), doc/man/nanorc.5, doc/texinfo/nano.texi:
Add function name 'flipexecute' to enable rebinding ^X in the menus
Read File and Execute Command.
2014-06-04 David Lawrence Ramsey <pooka109@gmail.com>
* src/*.c: Adjustments of whitespace and comments.
* doc/nanorc.sample.in: Interpunction tweaks.
* src/global.c (add_to_funcs): Add cast to subnfunc* for nmalloc().
* src/files.c (do_lockfile): Properly make the variable 'lockfilesize'
a size_t instead of a ssize_t, since it holds the result of strlen().
And use charalloc() instead of (char *)nmalloc().
* src/text.c (do_undo): Use charealloc() and not (char *)nrealloc().
* src/text.c (add_undo): Make use of null_at() to both null-terminate
the multibyte character and align it to use only the amount of memory
necessary.
GNU nano 2.3.4 - 2014.06.02
2014-06-02 Chris Allegretta <chrisa@asty.org>
* doc/syntax/default.nanorc: Can't do trailing spaces in the
default syntax or it will hilight the spaces as you type them
into a new file, which for non-programming is infuriating.
2014-05-29 Mark Majeres <mark@engine12.com>
* src/text.c (do_delete): For the undo structure, differentiate
between deleting a newline and any other character.
2014-05-29 Chris Allegretta <chrisa@asty.org>
* src/chars.c (addstrings): This function needs to be available even
on non-utf-8 systems.
* nano-regress: Added --disable-utf8 to regression check.
GNU nano 2.3.3 - 2014.05.29
2014-05-28 Chris Allegretta <chrisa@asty.org>
* doc/syntax/mutt.nanorc: Include Benno's awesome signature
matcher, modified slightly to also work for quoted sigs.
@@ -714,7 +1410,7 @@
* doc/syntax/makefile.nanorc: Highlight trailing whitespace.
2014-02-26 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (shortcut_init): Put PageUp and PageDown
* src/global.c (shortcut_init): Put PageUp and PageDown
and also WhereIs and WhereIsNext together in the help lines
of the file browser, and WriteOut and Readfile in the help
lines of the main window -- related stuff in one column.
@@ -974,6 +1670,7 @@ GNU nano 2.3.0 - 2011.02.26
with failing to write the backup file compared to 'allow_insecure_backup'.
* winio.c (edit_redraw): Removed unused variable.
GNU nano 2.2.6 - 2010.11.22
2010-11-15 Chris Allegretta <chrisa@asty.org>
* Add a section to the FAQ about using nanorc on Win32 systems.
@@ -1040,7 +1737,7 @@ GNU nano 2.2.4 - 2010.04.15
2010-03-21 Chris Allegretta <chrisa@asty.org>
* nano.c (page_stdin et al): Don't attempt to reset/reopen the terminal
settings when reading stdin if it was aborted with SIGINT. May fix
Savannah bug #29114 reported by Mike Frysinger.
Savannah bug #29114 reported by Mike Frysinger.
2010-03-21 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/c.nanorc: Add additional support for #include_next and #pragma.
@@ -1236,8 +1933,7 @@ GNU nano 2.1.99pre1 - 2009.11.15
writing the same file we originally opened.
2009-11-13 Chris Allegretta <chrisa@asty.org>
* winio.c: Add new static maxsize to be able to easier calculation with
softwrap.
* winio.c: Add new static maxsize for easier calculation with softwrap.
* nano.c (do_mouse): Fix mouse support not working with soft wrapping.
Fixes Savannah bug #27549 reported by Hannes Schueller.
@@ -1293,11 +1989,11 @@ GNU nano 2.1.11 - 2009.09.14
2009-08-29 Chris Allegretta <chrisa@asty.org>
* Fix more soft wrapping issues, particularly with scrolling,
discovered by Hannes <mr_creosote@mutantwatch.de>.
discovered by Hannes Schueller <mr_creosote@mutantwatch.de>.
2009-08-19 Chris Allegretta <chrisa@asty.org>
* Fix issue with soft wrapping not displaying the last character of each line,
fixed bug discovered by Hannes <mr_creosote@mutantwatch.de>.
fixed bug discovered by Hannes Schueller <mr_creosote@mutantwatch.de>.
2009-08-17 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/(gentoo|sh|tcl).nanorc: Fix problems with empty regexes on POSIX.
@@ -1307,6 +2003,7 @@ GNU nano 2.1.11 - 2009.09.14
* Initial soft line wrapping implementation. Command-line flags -$ or --softwrap.
* nano.c, text.c: Clean up some fprintf warnings in debug mode due to printing
a size_t without using the zd specifier.
2009-08-13 Chris Allegretta <chrisa@asty.org>
* New global flag implementation courtesy of Adam Wysocki <gophi@arcabit.pl>, allows
previous undo flag to be implemented consistent with other flags.
@@ -1317,9 +2014,9 @@ GNU nano 2.1.10 - 2009.07.28
Fixes crash on cutting last line discovered by Eitan Adler <eitanadlerlist@gmail.com>.
2009-07-11 Chris Allegretta <chrisa@asty.org>
* nano-regress: Small tweaks
* Change undo code to off unless enabled via a command line option (-u/--undo). Until this code
stabilizes this is the only responsible way to treat it.
* nano-regress: Small tweaks.
* Change undo code to off unless enabled via a command line option (-u/--undo).
Until this code stabilizes this is the only responsible way to treat it.
2009-03-08 Chris Allegretta <chrisa@asty.org>
* TODO: Break out some targets for various features into 2.2
@@ -1353,7 +2050,7 @@ GNU nano 2.1.9 - 2009.02.16
2009-02-14 Chris Allegretta <chrisa@asty.org>
* nano.c (precalc_multicolorinfo): Add debugging so we have a better clue if further
issues arise. Also start at the beginning of later lines when trying to match the
issues arise. Also start at the beginning of later lines when trying to match the
end of a multi-line regex. Fixes more overly aggressive highlighting found by
Mike Frysinger. Finally, advance to the match end for performance.
@@ -1367,7 +2064,7 @@ GNU nano 2.1.9 - 2009.02.16
errors about the rcfile and asking user to press enter. Also, nano should
now only ask for one enter press when there is an error when not using -q.
Based on discussion between Eitan Adler and Mike Frysinger.
* rcfile.c (parse_keybinding): Significant cleanups and fixes for
* rcfile.c (parse_keybinding): Significant cleanups and fixes for
detecting and reporting errors in key bindings code.
2009-02-08 Chris Allegretta <chrisa@asty.org>
@@ -1384,7 +2081,7 @@ GNU nano 2.1.8 - 2009.02.07
causes nano to segfault.
2009-02-05 Chris Allegretta <chrisa@asty.org>
* More color syntax speedups: Determine in reset_multis() whether we really need to call
* More color syntax speedups: Determine in reset_multis() whether we really need to call
edit_refresh(). Additional global var edit_refresh_needed() to hopefully reduce
repeated calls to the function. New helper funcs reset_multis_before() and
reset_multis_after().
@@ -1484,7 +2181,7 @@ GNU nano 2.1.5 - 2008.08.30
treating ^G the same as ^M.
2008-08-28 Chris Allegretta <chrisa@asty.org>
* configure.ac, rcfile.c: Add support for an alternate rcfilename at configure time. Maybe this
* configure.ac, rcfile.c: Add support for an alternate rcfilename at configure time. Maybe this
should become a command line option some day, but I don't see the need currently. Start of
fix for Savannah bug #24128: Add nanorc support to win32 platform.
@@ -1607,8 +2304,8 @@ GNU nano 2.1.1 - 2008.04.01
* winio.c: Fix shortcut labels not being translated.
2008-03-17 Mike Frysinger <vapier@gentoo.org>
* */.gitignore: Git ignore files for those running a local git
against SVN.
* */.gitignore: Git ignore files for those running a local git
against SVN.
2008-03-16 Benno Schulenberg <bensberg@justemail.net>
* src/help.c, src/global: Fix help strings no longer being

View File

@@ -3,9 +3,6 @@ AUTOMAKE_OPTIONS = gnu no-dependencies
SUBDIRS = doc m4 po src
EXTRA_DIST = ABOUT-NLS AUTHORS BUGS COPYING COPYING.DOC ChangeLog \
ChangeLog.pre-2.1 INSTALL NEWS README README.SVN \
THANKS TODO UPGRADE config.rpath install-sh missing \
mkinstalldirs nano.spec
EXTRA_DIST = ChangeLog.pre-2.1 README.SVN UPGRADE nano.spec
ACLOCAL_AMFLAGS = -I m4

81
NEWS
View File

@@ -1,9 +1,86 @@
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 next major (2.4.0)
release. Please test it out and send us any feedback
via the Savannah bug page for nano
(https://savannah.gnu.org/bugs/?group=nano). This
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!
2015.02.06 - GNU nano 2.3.99pre2 "Snowblind" is released. This release
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 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
command which takes the place of the spelling checker.
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
release a super awesome and bug-free 2.4.0 soon!
2014.07.17 - GNU nano 2.3.6 "Columbo" is released. This release
contains a fix for installing internationalization
files. Also included are scattered documentation
(in particular man page) fixes, and a few touch ups
to syntax highlighting definitions. Oh, just one
more thing, thanks for using nano!
2014.07.11 - GNU nano 2.3.5 "lucky day" is released. This release
contains many visible and under-the-hood fixes for
components such as file locking, more fixes to the
undo system, and you no longer have to explicitly ask
nano to have undo/redo support as it now defaults to
being enabled. Other notable fixes include a better
handling of --tempfile mode, and better handling of
command line arguments when also attempting to specify
+<line number>. As always, please file any bugs you
find at the Savannah page for nano, at
https://savannah.gnu.org/bugs/index.php?42639 and
thanks for using nano.
2014.06.02 - GNU nano 2.3.4 won't leave you high, won't leave you dry. This
release contains only a small number of fixes, but in
particular allows nano to compile on non-UTF8 curses
implementations (i.e. libncursesw). Other small fixes to
the undo implementation and the default syntax config are
also included. As always, Share and Enjoy!
2014.05.28 - GNU nano 2.3.3 is in its right place. This release contains
many many improvements to the core system, including
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
@@ -299,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,

63
README
View File

@@ -6,24 +6,24 @@ 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
Download the nano source code, then:
tar zxvf nano-x.y.z.tar.gz
cd nano-x.y.z
./configure
@@ -32,41 +32,42 @@ How to compile and install nano
It's that simple. Use --prefix with configure to override the
default installation directory of /usr/local.
If you configured with the "--enable-nanorc" option, after
installation you might copy the doc/nanorc.sample to your home
directory, rename it to ".nanorc", and then edit it according to
your taste.
If you haven't configured with the "--disable-nanorc" option, after
installation you may want to copy the doc/nanorc.sample to your
home directory, rename it to ".nanorc", and then edit it according
to your taste.
Web Page
http://www.nano-editor.org/
Mailing List and Bug Reports
Mailing Lists and Bug Reports
Savannah hosts all the nano-related mailing-lists.
+ info-nano@gnu.org is a very low traffic list
used to announce new nano versions or other important
information about the project.
+ info-nano@gnu.org is a very low traffic list used to announce
new nano versions or other important information about the
project.
+ help-nano@gnu.org is for those seeking to get help without
wanting to hear about the technical details of its
development.
+ nano-devel@gnu.org is the list used by the people
that make nano and a general development discussion list, with
moderate traffic.
wanting to hear about the technical details of its development.
+ nano-devel@gnu.org is the list used by the people that make
nano and a general development discussion list, with moderate
traffic.
To subscribe, send email to nano-<name>-request@gnu.org with a
To subscribe, send email to <name>-request@gnu.org with a
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.
$Id$
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.

141
THANKS
View File

@@ -2,81 +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
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
@@ -84,4 +90,5 @@ Jeremy Robichaud <robicj@yahoo.com> Beta tester
Bill Soudan <wes0472@rit.edu> Regex code, etc
Ken Tyler <kent@werple.net.au> Search fixes and more
$Id$

View File

@@ -20,7 +20,7 @@
#
# $Id$
AC_INIT([GNU nano], [2.3.3], [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
@@ -98,6 +98,12 @@ if test "x$enable_help" = xno; then
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
fi
AC_ARG_ENABLE(histories,
AS_HELP_STRING([--disable-histories], [Disable search and position histories]))
if test "x$enable_histories" = xno; then
AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.])
fi
AC_ARG_ENABLE(justify,
AS_HELP_STRING([--disable-justify], [Disable justify/unjustify functions]))
if test "x$enable_justify" = xno; then
@@ -186,6 +192,9 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_help" != xyes; then
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
fi
if test "x$enable_histories" != xyes; then
AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.])
fi
if test "x$enable_justify" != xyes; then
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
fi
@@ -649,6 +658,8 @@ AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling]))
AS_IF([test "x$enable_libmagic" != "xno"], [
AC_CHECK_HEADERS_ONCE([magic.h])
AC_CHECK_LIB(magic, magic_open)
AC_CHECK_HEADERS_ONCE([zlib.h])
AC_CHECK_LIB(z, inflate)
])
# Check for groff html support.

View File

@@ -2,14 +2,14 @@
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
.\" Free Software Foundation, Inc.
.\"
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
.\" Ce travail d'adaptation est dans le domaine public. Attention, la
.\" page traduite reste soumise au droit d'auteur de ses auteurs
.\" originaux.
.\"
.\" The French translation of this document is a public domain work of
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
.\" 2005, 2006 and 2007. The translated man page in itself is still
.\" subject to the copyright of its original authors.
.\"
@@ -29,20 +29,20 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.\" Ce document est publié sous une double licence. Vous pouvez
.\" Ce document est publié sous une double licence. Vous pouvez
.\" le distribuer et le modifier selon les termes de l'une des deux
.\" licences ci-dessous :
.\" licences ci-dessous :
.\"
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
.\" le cas, consultez <http://www.gnu.org/licenses/>.
.\"
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2 ou,
.\" à votre choix, supérieure, telle que publiée par la Free
.\" à votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation, sans section invariante, ni texte de
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" une copie de la Licence de documentation libre GNU avec ce
.\" programme. Si ce n'est pas le cas, consultez
.\" <http://www.gnu.org/licenses/>.
@@ -50,71 +50,71 @@
.\" $Id$
.TH NANO 1 "version 2.0.0" "29\ novembre\ 2007"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\"
.SH NOM
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
.SH SYNOPSIS
.B nano
.I [OPTIONS]\ [[\+LIGNE,COLONNE]\ FICHIER]...
.I [OPTIONS]\ [[+LIGNE,COLONNE]\ FICHIER]...
.br
.SH DESCRIPTION
Cette page de manuel décrit brièvement la commande \fBnano\fR.
Cette page de manuel décrit brièvement la commande \fBnano\fR.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
.\" respectively.
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à remplacer
Pico, l'éditeur par défaut du logiciel non libre Pine. \fBnano\fR ne se
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à remplacer
Pico, l'éditeur par défaut du logiciel non libre Pine. \fBnano\fR ne se
contentant pas de copier l'interface et l'ergonomie de Pico, il offre
également certaines fonctions manquantes (ou désactivées par défaut)
dans Pico. Ces fonctionnalités sont, par exemple, les fonctions de
recherche et de remplacement, et la possibilité de sauter directement à
une ligne et à une colonne précise.
également certaines fonctions manquantes (ou désactivées par défaut)
dans Pico. Ces fonctionnalités sont, par exemple, les fonctions de
recherche et de remplacement, et la possibilité de sauter directement à
une ligne et à une colonne précise.
.SH OPTIONS
.TP
.B \+\fILIGNE\fP,\fICOLONNE\fP
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
lieu de démarrer à la colonne\ 1, ligne\ 1.
.B +\fILIGNE\fP,\fICOLONNE\fP
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
lieu de démarrer à la colonne\ 1, ligne\ 1.
.TP
.B \-?
Identique à \fB-h (\-\-help)\fP.
Identique à \fB\-h (\-\-help)\fP.
.TP
.B \-A (\-\-smarthome)
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque l'on
appuie sur cette touche à n'importe quel endroit excepté au tout début
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
arrière). Si le curseur est déjà là, il se placera au vrai début de la
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque l'on
appuie sur cette touche à n'importe quel endroit excepté au tout début
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
arrière). Si le curseur est déjà là, il se placera au vrai début de la
ligne.
.TP
.B \-B (\-\-backup)
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
version précédente, en ajoutant un tilde (~) au nom du fichier.
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
version précédente, en ajoutant un tilde (~) au nom du fichier.
.TP
.B \-D (\-\-boldtext)
Utilise des caractères gras à la place de la vidéo inverse.
Utilise des caractères gras à la place de la vidéo inverse.
.TP
.B \-C \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
de sécurité uniques si celles-ci sont activées.
.B \-C \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
de sécurité uniques si celles-ci sont activées.
.TP
.B \-E (\-\-tabstospaces)
Convertit les tabulations clavier en espaces.
.TP
.B \-F (\-\-multibuffer)
Active le mode multi-espace, autorisant l'édition simultanée de
Active le mode multi-espace, autorisant l'édition simultanée de
plusieurs fichiers, si ce mode est disponible.
.TP
.B \-H (\-\-historylog)
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
remplacement dans le fichier \fI~/.nano_history\fR afin de permettre leur
réutilisation. Ceci n'est possible que si \fBnano\fR est configuré pour
réutilisation. Ceci n'est possible que si \fBnano\fR est configuré pour
utiliser les fichiers nanorc.
.TP
.B \-I (\-\-ignorercfiles)
@@ -122,63 +122,63 @@ Ne pas utiliser pas les fichiers \fISYSCONFDIR/nanorc\fR et
\fI~/.nanorc\fR (si \fBnano\fR est capable de les utiliser).
.TP
.B \-K (\-\-rebindkeypad)
Interprète les touches du pavé numérique afin qu'elles fonctionnent
Interprète les touches du pavé numérique afin qu'elles fonctionnent
toutes correctement. Vous ne devriez utiliser cette option que si ce
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
correctement lorsque cette option sera activée.
correctement lorsque cette option sera activée.
.TP
.B \-L (\-\-nonewlines)
Ne pas ajouter de passage à la ligne à la fin des fichiers.
Ne pas ajouter de passage à la ligne à la fin des fichiers.
.TP
.B \-N (\-\-noconvert)
Désactive la conversion automatique des fichiers depuis les formats Mac et
Désactive la conversion automatique des fichiers depuis les formats Mac et
DOS.
.TP
.B \-O (\-\-morespace)
Utiliser la ligne blanche située sous la ligne de titre comme
espace supplémentaire d'édition.
Utiliser la ligne blanche située sous la ligne de titre comme
espace supplémentaire d'édition.
.TP
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
pour réaliser une justification correcte des citations. Si nano est
capable d'utiliser des expressions rationnelles, le préfixe par défaut
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
pour réaliser une justification correcte des citations. Si nano est
capable d'utiliser des expressions rationnelles, le préfixe par défaut
sera "\fI^([\ \\t]*[#:>\\|}])+\fP", sinon, ce sera "\fI>\ \fP". Dans
l'expression rationnelle précédente, «\ \fI\\t\fP\ » représente une
l'expression rationnelle précédente, «\ \fI\\t\fP\ » représente une
tabulation.
.TP
.B \-R (\-\-restricted)
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
sur la ligne de commande, pas de lecture des fichiers nanorc,
interdiction de suspendre, interdiction d'ajouter au début, à la fin,
de sauvegarder un fichier ayant déjà un nom sous un nom différent,
d'utiliser une copie de sécurité ou le correcteur orthographique. Cette
option peut aussi être activée en appelant \fBnano\fP sous un nom
commençant par «\ r\ » (par exemple «\ rnano\ »).
interdiction de suspendre, interdiction d'ajouter au début, à la fin,
de sauvegarder un fichier ayant déjà un nom sous un nom différent,
d'utiliser une copie de sécurité ou le correcteur orthographique. Cette
option peut aussi être activée en appelant \fBnano\fP sous un nom
commençant par «\ r\ » (par exemple «\ rnano\ »).
.TP
.B \-S (\-\-smooth)
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
de défiler morceau-par-morceau.
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
de défiler morceau-par-morceau.
.TP
.B \-T \fInombre\fP (\-\-tabsize=\fInombre\fP)
Définit la taille (largeur) des tabulations en nombre de colonnes. Le
nombre indiqué doit être strictement supérieur à 0. La valeur par défaut
Définit la taille (largeur) des tabulations en nombre de colonnes. Le
nombre indiqué doit être strictement supérieur à 0. La valeur par défaut
est de 8.
.TP
.B \-U (\-\-quickblank)
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
d'état disparaîtront après une frappe clavier au lieu de 25. Notez que
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
d'état disparaîtront après une frappe clavier au lieu de 25. Notez que
l'option \fB-c\fP prend le pas sur cette option.
.TP
.B \-V (\-\-version)
Affiche la version, puis s'arrête.
Affiche la version, puis s'arrête.
.TP
.B \-W (\-\-wordbounds)
Détection plus précise des limites de mots, obtenue en considérant les
caractères de ponctuation comme faisant partie des mots.
Détection plus précise des limites de mots, obtenue en considérant les
caractères de ponctuation comme faisant partie des mots.
.TP
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
Indique quel mode de colorisation syntaxique adopter, parmi les modes
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
disponible.
.TP
.B \-c (\-\-const)
@@ -186,111 +186,111 @@ Affiche en permanence la position du curseur. Notez que cette option
prend le pas sur l'option \fB-U\fP.
.TP
.B \-d (\-\-rebinddelete)
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous ne devriez avoir besoin de cette option que si, sur votre système,
la touche «\ Effacement arrière\ » produit l'effet de la touche
«\ Supprimer\ ».
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous ne devriez avoir besoin de cette option que si, sur votre système,
la touche «\ Effacement arrière\ » produit l'effet de la touche
«\ Supprimer\ ».
.TP
.B \-h (\-\-help)
Affiche un résumé des options de lancement de nano, puis s'arrête.
Affiche un résumé des options de lancement de nano, puis s'arrête.
.TP
.B \-i (\-\-autoindent)
Indentation automatique. Commence chaque nouvelle ligne au même niveau que
la ligne précédente. Utile pour l'édition de code source.
Indentation automatique. Commence chaque nouvelle ligne au même niveau que
la ligne précédente. Utile pour l'édition de code source.
.TP
.B \-k (\-\-cut)
Coupe le texte du curseur à la fin de la ligne, au lieu de couper la
ligne entière.
Coupe le texte du curseur à la fin de la ligne, au lieu de couper la
ligne entière.
.TP
.B \-l (\-\-nofollow)
Si le fichier édité est un lien symbolique, au lieu de le suivre,
remplace le lien par le nouveau fichier. Sans doute utile pour éditer
Si le fichier édité est un lien symbolique, au lieu de le suivre,
remplace le lien par le nouveau fichier. Sans doute utile pour éditer
les fichiers de \fI/tmp\fR, non\ ?
.TP
.B \-m (\-\-mouse)
Active l'utilisation de la souris, si elle est disponible pour votre
système. Lorsque celle-ci est activée, il est possible d'utiliser la
système. Lorsque celle-ci est activée, il est possible d'utiliser la
souris pour positionner le curseur, pour marquer le texte (avec un
double-clic) et pour lancer les fonctions correspondant aux raccourcis.
Il est possible d'utiliser la souris sous X\ Window ou en mode console
avec gpm.
.TP
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
Définit le répertoire de travail. Demande à \fBnano\fP de mettre en place
quelque chose de similaire à un environnement d'exécution restreint
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
Définit le répertoire de travail. Demande à \fBnano\fP de mettre en place
quelque chose de similaire à un environnement d'exécution restreint
(\fIchroot\fR).
.TP
.B \-p (\-\-preserve)
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient reçues
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient reçues
par le terminal.
.TP
.B \-r \fIcolonne\fP (\-\-fill=\fIcolonne\fP)
Passe automatiquement à la ligne une fois arrivé à la colonne
\fIcolonne\fR. Si la valeur indiquée est de 0 ou moins, le point de
passage à la ligne aura lieu à la taille de l'écran moins \fIcolonne\fR.
Cela permet de faire varier le point de passage à la ligne lorsque l'on
change la taille de l'écran. La valeur par défaut est de \-8.
Passe automatiquement à la ligne une fois arrivé à la colonne
\fIcolonne\fR. Si la valeur indiquée est de 0 ou moins, le point de
passage à la ligne aura lieu à la taille de l'écran moins \fIcolonne\fR.
Cela permet de faire varier le point de passage à la ligne lorsque l'on
change la taille de l'écran. La valeur par défaut est de \-8.
.TP
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
Choix d'un correcteur orthographique de remplacement.
.TP
.B \-t (\-\-tempfile)
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
demande de confirmation. Identique à l'option \fB-t\fP de Pico.
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
demande de confirmation. Identique à l'option \fB-t\fP de Pico.
.TP
.B \-v (\-\-view)
Mode visualisation (lecture seule).
.TP
.B \-w (\-\-nowrap)
Désactive le passage automatique à la ligne.
Désactive le passage automatique à la ligne.
.TP
.B \-x (\-\-nohelp)
Désactive la barre d'aide affichée en bas de l'écran.
Désactive la barre d'aide affichée en bas de l'écran.
.TP
.B \-z (\-\-suspend)
Autorise à suspendre l'éditeur.
Autorise à suspendre l'éditeur.
.TP
.B \-a, \-b, \-e, \-f, \-g, \-j
Ignoré, pour être compatible avec Pico.
Ignoré, pour être compatible avec Pico.
.SH "FICHIERS D'INITIALISATION"
\fBnano\fR lit les fichiers d'initialisation dans l'ordre suivant\ :
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de
manuel de \fBnanorc(5)\fR et au fichier d'exemple \fInanorc.sample\fR,
qui devraient tous les deux être livrés avec \fBnano\fR.
qui devraient tous les deux être livrés avec \fBnano\fR.
.SH NOTES
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
ligne de commande ou dans l'un des fichiers nanorc, \fBnano\fR prendra
la commande indiquée par la variable d'environnement \fBSPELL\fR si
elle est définie.
la commande indiquée par la variable d'environnement \fBSPELL\fR si
elle est définie.
Dans certains cas, \fBnano\fR essaiera de sauvegarder le fichier en cours
d'édition dans un fichier de secours. Cela arrivera principalement si
\fBnano\fR reçoit un signal SIGHUP ou SIGTERM, ou bien se trouve à court de
mémoire. Le nom de ce fichier de secours sera \fInano.save\fR si le fichier en
cours n'avait pas encore de nom, ou sera composé du nom du fichier en cours
suivi du suffixe «\ .save\ ». Si un fichier de ce nom existe déjà dans
le répertoire, un «\ .save\ » et un nombre seront ajoutés à la fin du
d'édition dans un fichier de secours. Cela arrivera principalement si
\fBnano\fR reçoit un signal SIGHUP ou SIGTERM, ou bien se trouve à court de
mémoire. Le nom de ce fichier de secours sera \fInano.save\fR si le fichier en
cours n'avait pas encore de nom, ou sera composé du nom du fichier en cours
suivi du suffixe «\ .save\ ». Si un fichier de ce nom existe déjà dans
le répertoire, un «\ .save\ » et un nombre seront ajoutés à la fin du
nom du fichier en cours afin de le rendre unique (par exemple,
«\ .save.1\ »). En mode multi-espace, \fBnano\fR réalisera une
«\ .save.1\ »). En mode multi-espace, \fBnano\fR réalisera une
sauvegarde de tous les fichiers en cours dans leurs fichiers de secours
respectifs.
.SH BOGUES
Merci de nous faire parvenir vos commentaires et de nous signaler les
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
\fBnano-devel@gnu.org\fR.
Pour vous abonner, envoyez un courrier électronique à
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
Pour vous abonner, envoyez un courrier électronique à
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
N'hésitez pas également à envoyez vos commentaires, suggestions et
corrections relatives à l'adaptation française de cette page de manuel
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
N'hésitez pas également à envoyez vos commentaires, suggestions et
corrections relatives à l'adaptation française de cette page de manuel
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
.SH "SITE INTERNET"
http://www.nano-editor.org/
@@ -300,27 +300,27 @@ http://www.nano-editor.org/
.TP
\fBnanorc\fR(5)
.PP
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
.SH AUTEUR
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
\fIAUTHORS\fR et \fITHANKS\fR pour plus d'information). Cette page de
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
le système Debian (mais elle peut être utilisée par d'autres).
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
le système Debian (mais elle peut être utilisée par d'autres).
.SH TRADUCTION
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
de la version 1.54 du 11\ octobre\ 2007 de la page de manuel de nano
2.0.0. Cette page a été relue par Gérard Delafond.
2.0.0. Cette page a été relue par Gérard Delafond.
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
traducteur.
La version originale la plus à jour de ce document est toujours
La version originale la plus à jour de ce document est toujours
consultable via la commande\ :
LANGUAGE=en man nano

View File

@@ -2,14 +2,14 @@
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007
.\" Free Software Foundation, Inc.
.\"
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
.\" Ce travail d'adaptation est dans le domaine public. Attention, la
.\" page traduite reste soumise au droit d'auteur de ses auteurs
.\" originaux.
.\"
.\" The French translation of this document is a public domain work of
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
.\" 2005, 2006 and 2007. The translated man page in itself is still
.\" subject to the copyright of its original authors.
.\"
@@ -29,20 +29,20 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.\" Ce document est publié sous une double licence. Vous pouvez
.\" Ce document est publié sous une double licence. Vous pouvez
.\" le distribuer et le modifier selon les termes de l'une des deux
.\" licences ci-dessous :
.\" licences ci-dessous :
.\"
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est
.\" pas le cas, consultez <http://www.gnu.org/licenses/>.
.\"
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2
.\" ou, à votre choix, supérieure, telle que publiée par la Free
.\" ou, à votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation, sans section invariante, ni texte de
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" une copie de la Licence de documentation libre GNU avec ce
.\" programme. Si ce n'est pas le cas, consultez
.\" <http://www.gnu.org/licenses/>.
@@ -50,50 +50,50 @@
.\" $Id$
.TH NANORC 5 "version 2.0.0" "29\ novembre\ 2007"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.SH NOM
nanorc \- fichier de configuration de l'éditeur nano du projet GNU
nanorc \- fichier de configuration de l'éditeur nano du projet GNU
.SH DESCRIPTION
Cette page de manuel décrit brièvement le fichier de configuration de
l'éditeur \fBnano\fP GNU.
Cette page de manuel décrit brièvement le fichier de configuration de
l'éditeur \fBnano\fP GNU.
.PP
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
\fBnano\fP ne se contentant pas de copier l'interface et l'ergonomie de
Pico, il offre également certaines fonctionnalités manquantes (ou
désactivées par défaut) de Pico. Ces fonctionnalités sont, par exemple,
les fonctions de recherche et de remplacement et la possibilité de
sauter directement à une ligne et à une colonne précise.
Pico, il offre également certaines fonctionnalités manquantes (ou
désactivées par défaut) de Pico. Ces fonctionnalités sont, par exemple,
les fonctions de recherche et de remplacement et la possibilité de
sauter directement à une ligne et à une colonne précise.
.PP
Le fichier \fInanorc\fP contient les paramètres par défaut de
\fBnano\fP. Il ne doit pas être au format DOS ou Mac. Lors de son
démarrage, nano commencera par lire le fichier de configuration général
Le fichier \fInanorc\fP contient les paramètres par défaut de
\fBnano\fP. Il ne doit pas être au format DOS ou Mac. Lors de son
démarrage, nano commencera par lire le fichier de configuration général
\fISYSCONFDIR/nanorc\fP, puis lira le fichier de configuration personnel
de l'utilisateur \fI~/.nanorc\fP.
.SH OPTIONS
Le fichier de configuration accepte une série de commandes \fBset\fP
(activer) et \fBunset\fP (désactiver), qui permettent de définir le
paramétrage de nano au démarrage sans avoir à utiliser d'options de
Le fichier de configuration accepte une série de commandes \fBset\fP
(activer) et \fBunset\fP (désactiver), qui permettent de définir le
paramétrage de nano au démarrage sans avoir à utiliser d'options de
ligne de commande. De plus, les mots clefs \fBsyntax\fP (syntaxe),
\fBcolor\fP (couleur) et \fBicolor\fP (couleur insensible à la casse)
sont utilisés pour définir les règles de colorisation pour différents
\fBcolor\fP (couleur) et \fBicolor\fP (couleur insensible à la casse)
sont utilisés pour définir les règles de colorisation pour différents
motifs de texte. \fBnano\fP lit une commande par ligne.
Les options du fichier de configuration ont priorité sur les valeurs par
défaut utilisées par nano. Les options de la ligne de commande sont
Les options du fichier de configuration ont priorité sur les valeurs par
défaut utilisées par nano. Les options de la ligne de commande sont
prioritaires par rapport aux options du fichier de configuration. Les
options sont désactivées (unset) par défaut, sauf les options prenant un
options sont désactivées (unset) par défaut, sauf les options prenant un
argument.
Les apostrophes («\ \fI'\fP\ ») et les guillemets droits («\ \fI"\fP\ »)
présents dans des chaînes de caractères utilisées comme paramètres n'ont
pas besoin d'être précédées d'une barre oblique inversée
\ \fI\\\fP\ »). La chaîne sera terminée par le dernier guillemet
Les apostrophes («\ \fI'\fP\ ») et les guillemets droits («\ \fI"\fP\ »)
présents dans des chaînes de caractères utilisées comme paramètres n'ont
pas besoin d'être précédées d'une barre oblique inversée
\ \fI\\\fP\ »). La chaîne sera terminée par le dernier guillemet
droit. Par exemple, pour l'option \fBbrackets\fP, "\fI"')>]}\fP"
correspondra à \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP et \fI}\fP.
correspondra à \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP et \fI}\fP.
Les commandes et arguments reconnus sont\ :
@@ -102,69 +102,69 @@ Les commandes et arguments reconnus sont\ :
Active l'indentation automatique.
.TP
.B set/unset backup
Crée des copies de sécurité nommées
Crée des copies de sécurité nommées
.IR nom_du_fichier~ .
.TP
.B set backupdir "\fIrépertoire\fP"
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
de sécurité uniques, si l'enregistrement de copies de sécurité est
activé.
.B set backupdir "\fIrépertoire\fP"
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
de sécurité uniques, si l'enregistrement de copies de sécurité est
activé.
.TP
.B set/unset backwards
Par défaut, les recherches se font vers l'arrière.
Par défaut, les recherches se font vers l'arrière.
.TP
.B set/unset boldtext
Utilise des caractères gras à la place de la vidéo inverse.
Utilise des caractères gras à la place de la vidéo inverse.
.TP
.B set brackets "\fIchaîne\fP"
Définit les caractères considérés comme des crochets fermants lors de la
justification des paragraphes. Ces caractères ne doivent pas contenir
d'espaces. Seules les ponctuations terminales, éventuellement suivies
.B set brackets "\fIchaîne\fP"
Définit les caractères considérés comme des crochets fermants lors de la
justification des paragraphes. Ces caractères ne doivent pas contenir
d'espaces. Seules les ponctuations terminales, éventuellement suivies
de crochets fermants, peuvent terminer une phrase.
La valeur par défaut de cette option est\ : "\fI"')>]}\fP".
La valeur par défaut de cette option est\ : "\fI"')>]}\fP".
N.D.T.\ : reportez-vous au paragraphe sur l'option \fBpunct\fR pour
plus d'informations.
.TP
.B set/unset casesensitive
Par défaut, les recherches ne tiennent pas compte de la casse.
Par défaut, les recherches ne tiennent pas compte de la casse.
.TP
.B set/unset const
Affiche en permanence la position du curseur dans la ligne d'état.
Affiche en permanence la position du curseur dans la ligne d'état.
.TP
.B set/unset cut
Par défaut, coupe le texte du curseur à la fin de la ligne, au lieu de
couper la ligne entière.
Par défaut, coupe le texte du curseur à la fin de la ligne, au lieu de
couper la ligne entière.
.TP
.B set fill \fIn\fP
Passe automatiquement à la ligne une fois arrivé à la colonne
\fIn\fR. Si la valeur indiquée est de 0 ou moins, le point de passage à
la ligne aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de
faire varier le point de passage à la ligne lorsque l'on change la
taille de l'écran. La valeur par défaut est de \-8.
Passe automatiquement à la ligne une fois arrivé à la colonne
\fIn\fR. Si la valeur indiquée est de 0 ou moins, le point de passage à
la ligne aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de
faire varier le point de passage à la ligne lorsque l'on change la
taille de l'écran. La valeur par défaut est de \-8.
.TP
.B set/unset historylog
Active l'utilisation de
.I ~/.nano_history
pour enregistrer et relire les chaînes ayant fait l'objet d'une
pour enregistrer et relire les chaînes ayant fait l'objet d'une
recherche ou d'un remplacement.
.TP
.B set matchbrackets "\fIchaîne\fP"
Définit les crochets ouvrants et fermant pour la recherche de crochets
.B set matchbrackets "\fIchaîne\fP"
Définit les crochets ouvrants et fermant pour la recherche de crochets
correspondants. Cette liste ne doit pas contenir de blancs. L'ensemble
des crochets ouvrants doit être indiqué en premier, suivi de l'ensemble
des crochets fermant, qui doit être dans le même ordre. La valeur par
défaut de cette option est "\fI(<[{)>]}\fP".
des crochets ouvrants doit être indiqué en premier, suivi de l'ensemble
des crochets fermant, qui doit être dans le même ordre. La valeur par
défaut de cette option est "\fI(<[{)>]}\fP".
.TP
.B set/unset morespace
Utiliser la ligne blanche située sous la ligne de titre comme espace
supplémentaire d'édition.
Utiliser la ligne blanche située sous la ligne de titre comme espace
supplémentaire d'édition.
.TP
.B set/unset mouse
Active l'utilisation de la souris, si elle est disponible pour votre
système. Lorsque celle-ci est activée, il est possible d'utiliser la
système. Lorsque celle-ci est activée, il est possible d'utiliser la
souris pour positionner le curseur, pour marquer le texte (avec un
double-clic) et pour lancer les fonctions correspondant aux raccourcis.
Il est possible d'utiliser la souris sous X\ Window ou en mode console
@@ -178,167 +178,167 @@ espace.
Pas de conversion depuis les formats DOS et Mac.
.TP
.B set/unset nofollow
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
.TP
.B set/unset nohelp
Désactive les lignes d'aide affichée en bas de l'écran.
Désactive les lignes d'aide affichée en bas de l'écran.
.TP
.B set/unset nonewlines
Ne pas ajouter de passage à la ligne à la fin des fichiers.
Ne pas ajouter de passage à la ligne à la fin des fichiers.
.TP
.B set/unset nowrap
Désactive le passage automatique à la ligne.
Désactive le passage automatique à la ligne.
.TP
.B set operatingdir "\fIrépertoire\fP"
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
le répertoire courant, afin que les fichiers soient lus depuis ce
répertoire. Par défaut, cette fonction est désactivée.
.B set operatingdir "\fIrépertoire\fP"
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
le répertoire courant, afin que les fichiers soient lus depuis ce
répertoire. Par défaut, cette fonction est désactivée.
.TP
.B set/unset preserve
Préserve les séquences XON et XOFF (^Q et ^S).
Préserve les séquences XON et XOFF (^Q et ^S).
.TP
.B set punct "\fIchaîne\fP"
Définit les caractères interprétés comme des ponctuations terminales
lors de la justification des paragraphes. Ces caractères ne peuvent
inclure de blancs. Seules les ponctuations terminales, éventuellement
.B set punct "\fIchaîne\fP"
Définit les caractères interprétés comme des ponctuations terminales
lors de la justification des paragraphes. Ces caractères ne peuvent
inclure de blancs. Seules les ponctuations terminales, éventuellement
suivies de crochets fermants, peuvent terminer une phrase. La valeur par
défaut de cette option est "\fI!.?\fP".
défaut de cette option est "\fI!.?\fP".
N.D.T.\ : ce réglage permet, lors de la justification, de conserver
2\ espaces au lieu d'une derrière les ponctuations terminales, ce qui
N.D.T.\ : ce réglage permet, lors de la justification, de conserver
2\ espaces au lieu d'une derrière les ponctuations terminales, ce qui
correspond aux normes typographiques anglo-saxonnes, mais n'a pas lieu
d'être en français. Pour le français, le plus simple est d'indiquer,
dans le fichier nanorc, une chaîne vide pour ce paramètre.
d'être en français. Pour le français, le plus simple est d'indiquer,
dans le fichier nanorc, une chaîne vide pour ce paramètre.
.TP
.B set/unset quickblank
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
d'état disparaîtront après une frappe clavier au lieu de 25.
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
d'état disparaîtront après une frappe clavier au lieu de 25.
.TP
.B set quotestr "\fIchaîne\fP"
Définit le préfixe par défaut utilisé pour les citations dans les
courriers électroniques. Ce préfixe est utilisé pour réaliser une
justification correcte de ces citations. Il s'agira, si votre système le
permet, d'une expression rationnelle étendue. Dans le cas
contraire, il s'agira d'une chaîne de texte brut. Si vous disposez des
expressions rationnelles, la valeur par défaut de cette option sera
.B set quotestr "\fIchaîne\fP"
Définit le préfixe par défaut utilisé pour les citations dans les
courriers électroniques. Ce préfixe est utilisé pour réaliser une
justification correcte de ces citations. Il s'agira, si votre système le
permet, d'une expression rationnelle étendue. Dans le cas
contraire, il s'agira d'une chaîne de texte brut. Si vous disposez des
expressions rationnelles, la valeur par défaut de cette option sera
"\fI^([\ \\t]*[#:>\\|}])+\fP", sinon, ce sera ">\ ". Notez que le
«\ \\t\ » ci-dessus correspond à un caractère de tabulation.
«\ \\t\ » ci-dessus correspond à un caractère de tabulation.
.TP
.B set/unset rebinddelete
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous ne devriez avoir besoin de cette option que si, sur votre système,
la touche «\ Effacement arrière\ » produit l'effet de la touche «\
Supprimer\ ».
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous ne devriez avoir besoin de cette option que si, sur votre système,
la touche «\ Effacement arrière\ » produit l'effet de la touche «\
Supprimer\ ».
.TP
.B set/unset rebindkeypad
Interprète les touches du pavé numérique afin qu'elles fonctionnent
Interprète les touches du pavé numérique afin qu'elles fonctionnent
toutes correctement. Vous ne devriez utiliser cette option que si ce
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
correctement lorsque cette option sera activée.
correctement lorsque cette option sera activée.
.TP
.B set/unset regexp
Utilise par défaut des expressions rationnelles étendues pour les
Utilise par défaut des expressions rationnelles étendues pour les
recherches.
.TP
.B set/unset smarthome
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque
cette touche est pressée à n'importe quel endroit excepté au tout début
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
arrière). Si le curseur est déjà là, il se placera au vrai début de la
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque
cette touche est pressée à n'importe quel endroit excepté au tout début
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
arrière). Si le curseur est déjà là, il se placera au vrai début de la
ligne.
.TP
.B set/unset smooth
Active le défilement ligne-par-ligne du texte.
Active le défilement ligne-par-ligne du texte.
.TP
.B set speller "\fIprogramme\fP"
Utilise le correcteur orthographique \fIprogramme\fP au lieu du
correcteur intégré, qui s'appuie sur \fIspell\fP.
correcteur intégré, qui s'appuie sur \fIspell\fP.
.TP
.B set/unset suspend
Autorise à suspendre \fBnano\fP.
Autorise à suspendre \fBnano\fP.
.TP
.B set tabsize \fIn\fP
Utilise une taille de tabulation de \fIn\fP colonnes. Cette valeur doit
être strictement supérieure à 0. La valeur par défaut est de\ 8.
être strictement supérieure à 0. La valeur par défaut est de\ 8.
.TP
.B set/unset tabstospaces
Convertit les tabulations clavier en espaces.
.TP
.B set/unset tempfile
S'il a été modifié, le fichier sera sauvegardé automatiquement en
S'il a été modifié, le fichier sera sauvegardé automatiquement en
quittant, sans demande de confirmation.
.TP
.B set/unset view
Interdit de modifier les fichiers.
.TP
.B set whitespace "\fIchaîne\fP"
Définit les deux caractères utilisés pour afficher les premiers
caractères des tabulations et des espaces. Ces deux caractères doivent
être mono-colonne.
.B set whitespace "\fIchaîne\fP"
Définit les deux caractères utilisés pour afficher les premiers
caractères des tabulations et des espaces. Ces deux caractères doivent
être mono-colonne.
.TP
.B set/unset wordbounds
Détection plus précise des limites de mots, obtenue en considérant les
caractères de ponctuation comme faisant partie des mots.
Détection plus précise des limites de mots, obtenue en considérant les
caractères de ponctuation comme faisant partie des mots.
.TP
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
l'option \fB-Y\fP (ou \fB--syntax\fP) ou qui sera automatiquement
activée si le nom du fichier en cours correspond à l'expression
rationnelle étendue \fImotif_de_fichier\fP. Toutes les instructions
suivantes de colorisation \fBcolor\fP ou \fBicolor\fP s'appliqueront à
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
activée si le nom du fichier en cours correspond à l'expression
rationnelle étendue \fImotif_de_fichier\fP. Toutes les instructions
suivantes de colorisation \fBcolor\fP ou \fBicolor\fP s'appliqueront à
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
La syntaxe nommée \fInone\fP (aucune) est réservée\ ; si elle est
indiquée dans la ligne de commande, cela revient à ne définir aucune
syntaxe. La syntaxe nommée \fIdefault\fP (par défaut) est spéciale, elle
ne nécessite aucun motif de \fImotif_de_fichier\fP, et s'applique aux
fichiers ne correspondant à aucun des \fImotif_de_fichier\fP des autres
La syntaxe nommée \fInone\fP (aucune) est réservée\ ; si elle est
indiquée dans la ligne de commande, cela revient à ne définir aucune
syntaxe. La syntaxe nommée \fIdefault\fP (par défaut) est spéciale, elle
ne nécessite aucun motif de \fImotif_de_fichier\fP, et s'applique aux
fichiers ne correspondant à aucun des \fImotif_de_fichier\fP des autres
syntaxes.
.TP
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
l'expression rationnelle étendue \fImotif\fP en utilisant la couleur de
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
l'expression rationnelle étendue \fImotif\fP en utilisant la couleur de
texte \fIcouleur_texte\fP et la couleur de fond \fIcouleur_fond\fP,
l'une de ces deux couleurs au moins devant être définie. Les couleurs
acceptées par \fBnano\fP pour le texte et le fond sont\ : \fIwhite\fP
l'une de ces deux couleurs au moins devant être définie. Les couleurs
acceptées par \fBnano\fP pour le texte et le fond sont\ : \fIwhite\fP
(blanc), \fIblack\fP (noir), \fIred\fP (rouge), \fIblue\fP (bleu),
\fIgreen\fP (vert), \fIyellow\fP (jaune), \fImagenta\fP, et \fIcyan\fP.
Pour la couleur du texte, vous pouvez ajouter à ces couleurs le préfixe
Pour la couleur du texte, vous pouvez ajouter à ces couleurs le préfixe
\fIbright\fP (lumineux) pour obtenir une couleur plus lumineuse. Si
votre terminal est capable de gérer la transparence, ne pas spécifier de
\fIcouleur_fond\fP indique à \fBnano\fP d'essayer d'utiliser un fond
votre terminal est capable de gérer la transparence, ne pas spécifier de
\fIcouleur_fond\fP indique à \fBnano\fP d'essayer d'utiliser un fond
transparent.
.TP
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
compte de la casse.
.TP
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
Affiche les expressions commençant par l'expression rationnelle étendue
\fImotif_début\fP et se terminant par l'expression rationnelle étendue
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
Affiche les expressions commençant par l'expression rationnelle étendue
\fImotif_début\fP et se terminant par l'expression rationnelle étendue
\fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
et la couleur de fond \fIcouleur_fond\fP, l'une de ces deux couleurs au
moins devant être définie. Cela permet à la colorisation syntaxique de
s'étendre sur plusieurs lignes. Notez que toutes les occurrences
successives de \fImotif_début\fP après le \fImotif_début\fP initial
seront surlignées jusqu'à la prochaine instance de \fImotif_fin\fP.
moins devant être définie. Cela permet à la colorisation syntaxique de
s'étendre sur plusieurs lignes. Notez que toutes les occurrences
successives de \fImotif_début\fP après le \fImotif_début\fP initial
seront surlignées jusqu'à la prochaine instance de \fImotif_fin\fP.
.TP
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
compte de la casse.
.TP
.B include "\fIfichier_de_syntaxes\fP"
Lit le fichier \fIfichier_de_syntaxes\fP contenant une liste
autosuffisante de définitions de syntaxes. Ce fichier ne doit contenir
autosuffisante de définitions de syntaxes. Ce fichier ne doit contenir
que des commandes \fBsyntax\fP, \fBcolor\fP et \fBicolor\fP.
.SH FICHIERS
.TP
.I $SYSCONFDIR/nanorc
Fichier de configuration général
Fichier de configuration général
.TP
.I ~/.nanorc
Fichier de configuration personnel
@@ -348,29 +348,29 @@ Fichier de configuration personnel
.TP
\fBnano\fP(1)
.PP
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (ou son équivalent sur
votre système)
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (ou son équivalent sur
votre système)
.SH AUTEUR
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
\fIAUTHORS\fP et \fITHANKS\fP pour plus d'information). Cette page de
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
le système Debian (mais elle peut être utilisée par d'autres).
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
le système Debian (mais elle peut être utilisée par d'autres).
.SH TRADUCTION
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir de
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir de
la version 1.56 du 11\ octobre\ 2007 de la page de manuel de nanorc
(pour la version 2.0.0 de nano). Cette page a été relue par Gérard
(pour la version 2.0.0 de nano). Cette page a été relue par Gérard
Delafond.
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
traducteur.
La version originale la plus à jour de ce document est toujours
La version originale la plus à jour de ce document est toujours
consultable via la commande\ :
LANGUAGE=en man nano

View File

@@ -3,13 +3,13 @@
.\" Skeleton based on nano-tiny.1:
.\" Copyright (C) 2002 Free Software Foundation, Inc.
.\"
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2006 et 2007. Ce travail
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2006 et 2007. Ce travail
.\" d'adaptation est dans le domaine public. Attention, la page traduite
.\" reste soumise au droit d'auteur de ses auteurs originaux.
.\"
.\" The French translation of this document is a public domain work of
.\" Jean-Philippe Guérard. This translation work was made in 2006 and
.\" Jean-Philippe Guérard. This translation work was made in 2006 and
.\" 2007. The translated man page in itself is still subject to the
.\" copyright of its original authors.
.\"
@@ -29,20 +29,20 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.\" Ce document est publié sous une double licence. Vous pouvez
.\" Ce document est publié sous une double licence. Vous pouvez
.\" le distribuer et le modifier selon les termes de l'une des deux
.\" licences ci-dessous :
.\" licences ci-dessous :
.\"
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
.\" le cas, consultez <http://www.gnu.org/licenses/>.
.\"
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2 ou,
.\" à votre choix, supérieure, telle que publiée par la Free
.\" à votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation, sans section invariante, ni texte de
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" une copie de la Licence de documentation libre GNU avec ce
.\" programme. Si ce n'est pas le cas, consultez
.\" <http://www.gnu.org/licenses/>.
@@ -50,105 +50,105 @@
.\" $Id$
.TH RNANO 1 "version 2.0.0" "29\ novembre\ 20O7"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\"
.SH NOM
rnano \- Le mode restreint de NAno un NOuvel éditeur, un clone libre et
amélioré de Pico
rnano \- Le mode restreint de NAno un NOuvel éditeur, un clone libre et
amélioré de Pico
.SH SYNOPSIS
.B rnano
.I [OPTIONS]\ [[\+LIGNE,COLONNE]\ FICHIER]...
.I [OPTIONS]\ [[+LIGNE,COLONNE]\ FICHIER]...
.br
.SH DESCRIPTION
Cette page de manuel décrit brièvement la commande \fBrnano\fR.
Cette page de manuel décrit brièvement la commande \fBrnano\fR.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
.\" respectively.
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
\fBnano\fR ne se contentant pas de copier l'interface et l'ergonomie de
Pico, il offre également certaines fonctions manquantes (ou désactivées
par défaut) dans Pico. Ces fonctionnalités sont, par exemple, les
fonctions de recherche et de remplacement, et la possibilité de sauter
directement à une ligne et à une colonne précise..
Pico, il offre également certaines fonctions manquantes (ou désactivées
par défaut) dans Pico. Ces fonctionnalités sont, par exemple, les
fonctions de recherche et de remplacement, et la possibilité de sauter
directement à une ligne et à une colonne précise..
.PP
\fBrnano\fP est une version de \fBnano\fP fonctionnant en mode
restreint, qui ne permet d'éditer que les fichiers indiqués et qui
n'autorise pas l'utilisateur à accéder au système de fichier ou à un
interpréteur de commandes.
restreint, qui ne permet d'éditer que les fichiers indiqués et qui
n'autorise pas l'utilisateur à accéder au système de fichier ou à un
interpréteur de commandes.
.PP
En mode restreint, \fBnano\fP refusera\ :
.IP \[bu] 2
de lire ou d'écrire dans un fichier n'ayant pas été indiqué dans la
de lire ou d'écrire dans un fichier n'ayant pas été indiqué dans la
ligne de commande\ ;
.IP \[bu]
de lire un fichier nanorc\ ;
.IP \[bu]
de permettre de suspendre l'édition\ ;
de permettre de suspendre l'édition\ ;
.IP \[bu]
de permettre d'ajouter en début ou en fin d'un fichier, ou de
l'enregistrer sous un nom différent\ ;
de permettre d'ajouter en début ou en fin d'un fichier, ou de
l'enregistrer sous un nom différent\ ;
.IP \[bu]
l'utilisation de copies de sécurité ou de la correction orthographique.
l'utilisation de copies de sécurité ou de la correction orthographique.
.SH OPTIONS
.TP
.B \+\fILIGNE\fP,\fICOLONNE\fP
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
lieu de démarrer à la colonne\ 1, ligne\ 1.
.B +\fILIGNE\fP,\fICOLONNE\fP
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
lieu de démarrer à la colonne\ 1, ligne\ 1.
.TP
.B \-?
Identique à \fB-h (\-\-help)\fP.
Identique à \fB\-h (\-\-help)\fP.
.TP
.B \-h (\-\-help)
Affiche un résumé des options de lancement de nano, puis s'arrête.
Affiche un résumé des options de lancement de nano, puis s'arrête.
.TP
.B \-V (\-\-version)
Affiche la version, puis s'arrête.
Affiche la version, puis s'arrête.
.PP
Reportez-vous à la page de manuel \fBnano\fP(1) si vous souhaitez
consulter la documentation complète de \fBnano\fP.
Reportez-vous à la page de manuel \fBnano\fP(1) si vous souhaitez
consulter la documentation complète de \fBnano\fP.
.SH BOGUES
Merci de nous faire parvenir vos commentaires et de nous signaler les
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
\fBnano-devel@gnu.org\fR.
Pour vous abonner, envoyez un courrier électronique à
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
Pour vous abonner, envoyez un courrier électronique à
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
N'hésitez pas également à envoyez vos commentaires, suggestions et
corrections relatives à l'adaptation française de cette page de manuel
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
N'hésitez pas également à envoyez vos commentaires, suggestions et
corrections relatives à l'adaptation française de cette page de manuel
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
.SH "SITE INTERNET"
http://www.nano-editor.org/
.SH AUTEUR
Chris Allegretta <chrisa@asty.org> et d'autres (voir le fichier
\fIAUTHORS\fR). Cette page de manuel a été initialement rédigée par
Thijs Kinkhorst <thijs@kinkhorst.com>, pour le système GNU Debian (mais
elle peut être utilisée par d'autres).
\fIAUTHORS\fR). Cette page de manuel a été initialement rédigée par
Thijs Kinkhorst <thijs@kinkhorst.com>, pour le système GNU Debian (mais
elle peut être utilisée par d'autres).
.SH TRADUCTION
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
de la version 1.19 du 6\ novembre\ 2007 de la page de manuel de rnano
(pour la version 2.0.0 de nano).
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
traducteur.
La version originale la plus à jour de ce document est toujours
La version originale la plus à jour de ce document est toujours
consultable via la commande\ :
LANGUAGE=en man nano

View File

@@ -1,4 +1,6 @@
.\" Hey, EMACS: -*- nroff -*-
.\" $Id$
.\"
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
.\" 2009, 2010, 2013, 2014 Free Software Foundation, Inc.
.\"
@@ -18,8 +20,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.\" $Id$
.TH NANO 1 "version 2.3.3" "April 2014"
.TH NANO 1 "version 2.4.0" "March 2015"
.\" Please adjust this date whenever revising the manpage.
.\"
@@ -28,8 +29,7 @@ nano \- Nano's ANOther editor, an enhanced free Pico clone
.SH SYNOPSIS
.B nano
.RI [ options "] [[\+" line , column "]\ " file "]..."
.br
.RI [ options "] [[+" line , column "]\ " file "]..."
.SH DESCRIPTION
\fBnano\fP is a small, free and friendly editor which aims to replace
@@ -40,152 +40,152 @@ replace" and "go to line and column number".
.SH OPTIONS
.TP
.B \+\fIline\fP,\fIcolumn\fP
.B +\fIline\fP,\fIcolumn\fP
Places the cursor on line number \fIline\fP and at column number \fIcolumn\fP
(at least one of which must be specified) on startup, instead of the
default line 1, column 1.
.TP
.B \-A (\-\-smarthome)
.BR \-A ", " \-\-smarthome
Make the Home key smarter. When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will
jump to that beginning (either forwards or backwards). If the cursor is
already at that position, it will jump to the true beginning of the
line.
.TP
.B \-B (\-\-backup)
.BR \-B ", " \-\-backup
When saving a file, back up the previous version of it to the current
filename suffixed with a tilde (\fB~\fP).
.TP
.B \-C \fIdir\fP (\-\-backupdir=\fIdir\fP)
.BR \-C\ \fIdirectory\fR ", " \-\-backupdir= \fIdirectory
Set the directory where \fBnano\fP puts unique backup files, if file
backups are enabled.
.TP
.B \-D (\-\-boldtext)
.BR \-D ", " \-\-boldtext
Use bold text instead of reverse video text.
.TP
.B \-E (\-\-tabstospaces)
.BR \-E ", " \-\-tabstospaces
Convert typed tabs to spaces.
.TP
.B \-F (\-\-multibuffer)
Enable multiple file buffers, if available.
.BR \-F ", " \-\-multibuffer
Enable multiple file buffers (if support for them has been compiled in).
.TP
.B \-G (\-\-locking)
.BR \-G ", " \-\-locking
Enable vim-style file locking when editing files.
.TP
.B \-H (\-\-historylog)
Log search and replace strings to \fI~/.nano_history\fP, so they can be
retrieved in later sessions, if \fInanorc\fP support is available.
.BR \-H ", " \-\-historylog
Log search and replace strings to \fI~/.nano/search_history\fP, so they can be
retrieved in later sessions.
.TP
.B \-I (\-\-ignorercfiles)
Don't look at \fISYSCONFDIR/nanorc\fP or \fI~/.nanorc\fP, if
\fInanorc\fP support is available.
.BR \-I ", " \-\-ignorercfiles
Don't look at the system's \fBnanorc\fP nor at \fB~/.nanorc\fP.
.TP
.B \-K (\-\-rebindkeypad)
.BR \-K ", " \-\-rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
.TP
.B \-L (\-\-nonewlines)
.BR \-L ", " \-\-nonewlines
Don't add newlines to the ends of files.
.TP
.B \-N (\-\-noconvert)
.BR \-N ", " \-\-noconvert
Disable automatic conversion of files from DOS/Mac format.
.TP
.B \-O (\-\-morespace)
.BR \-O ", " \-\-morespace
Use the blank line below the titlebar as extra editing space.
.TP
.B \-P (\-\-poslog)
.BR \-P ", " \-\-poslog
Log and later read back the location of the cursor and place it there
again.
.TP
.B \-Q \fIstr\fP (\-\-quotestr=\fIstr\fP)
.BR "\-Q ""\fIcharacters\fB""" ", " "\-\-quotestr=""" \fIcharacters\fR """
Set the quoting string for justifying. The default is
"\fI^([\ \\t]*[#:>\\|}])+\fP" if extended regular expression support is
available, or "\fI>\ \fP" otherwise. Note that \fI\\t\fP stands for a
\fB"^([\ \\t]*[#:>\\|}])+"\fP if extended regular expression support is
available, or \fB">\ "\fP otherwise. Note that \fB\\t\fP stands for a
Tab.
.TP
.B \-R (\-\-restricted)
.BR \-R ", " \-\-restricted
Restricted mode: don't read or write to any file not specified on the
command line; don't read any \fInanorc\fP files; don't allow suspending;
command line; don't read any \fInanorc\fP files nor history files;
don't allow suspending nor spell checking;
don't allow a file to be appended to, prepended to, or saved under a
different name if it already has one; don't use backup files nor spell
checking. This restricted mode is also accessible by invoking \fBnano\fP
different name if it already has one; and don't use backup files.
This restricted mode is also accessible by invoking \fBnano\fP
with any name beginning with 'r' (e.g. "rnano").
.TP
.B \-S (\-\-smooth)
.BR \-S ", " \-\-smooth
Enable smooth scrolling. Text will scroll line-by-line, instead of the
usual chunk-by-chunk behavior.
.TP
.B \-T \fInumber\fP (\-\-tabsize=\fInumber\fP)
.BR \-T\ \fInumber\fR ", " \-\-tabsize= \fInumber
Set the size (width) of a tab to \fInumber\fP columns. The value of
\fInumber\fP must be greater than 0. The default value is 8.
.TP
.B \-U (\-\-quickblank)
.BR \-U ", " \-\-quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25. Note that \fB\-c\fP overrides this.
.TP
.B \-V (\-\-version)
.BR \-V ", " \-\-version
Show the current version number and exit.
.TP
.B \-W (\-\-wordbounds)
.BR \-W ", " \-\-wordbounds
Detect word boundaries more accurately by treating punctuation
characters as part of a word.
.TP
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
Specify a specific syntax highlighting from the \fInanorc\fP to use, if
available.
.BR \-Y\ \fIname\fR ", " \-\-syntax= \fIname
Specify the name of the syntax highlighting to use from among the ones
defined in the \fInanorc\fP files.
.TP
.B \-c (\-\-const)
.BR \-c ", " \-\-const
Constantly show the cursor position. Note that this overrides \fB\-U\fP.
.TP
.B \-d (\-\-rebinddelete)
.BR \-d ", " \-\-rebinddelete
Interpret the Delete key differently so that both Backspace and Delete
work properly. You should only need to use this option if Backspace
acts like Delete on your system.
.TP
.B \-h (\-\-help)
.BR \-h ", " \-\-help
Show a summary of the available command-line options and exit.
.TP
.B \-i (\-\-autoindent)
.BR \-i ", " \-\-autoindent
Indent new lines to the previous line's indentation. Useful when
editing source code.
.TP
.B \-k (\-\-cut)
.BR \-k ", " \-\-cut
Make the 'Cut Text' command (normally ^K) cut from the current cursor
position to the end of the line, instead of cutting the entire line.
.TP
.B \-l (\-\-nofollow)
.BR \-l ", " \-\-nofollow
If the file being edited is a symbolic link, replace the link with
a new file instead of following it. Good for editing files in
\fI/tmp\fP, perhaps?
.TP
.B \-m (\-\-mouse)
.BR \-m ", " \-\-mouse
Enable mouse support, if available for your system. When enabled, mouse
clicks can be used to place the cursor, set the mark (with a double
click), and execute shortcuts. The mouse will work in the X Window
System, and on the console when gpm is running. Text can still be
selected through dragging by holding down the Shift key.
.TP
.B \-n (\-\-noread)
.BR \-n ", " \-\-noread
Treat any name given on the command line as a new file. This allows
\fBnano\fR to write to named pipes: it will start with a blank buffer,
and will write to the pipe when the user saves the "file". This way
\fBnano\fR can be used as an editor in combination with for instance
\fBgpg\fR without having to write sensitive data to disk first.
.TP
.B \-o \fIdir\fP (\-\-operatingdir=\fIdir\fP)
Set operating directory. Makes \fBnano\fP set up something similar to a
chroot.
.BR \-o\ \fIdirectory\fR ", " \-\-operatingdir= \fIdirectory
Set the operating directory. This makes \fBnano\fP set up something
similar to a chroot.
.TP
.B \-p (\-\-preserve)
.BR \-p ", " \-\-preserve
Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
by the terminal.
.TP
.B \-q (\-\-quiet)
Do not report errors in the \fInanorc\fP file nor ask them to be
.BR \-q ", " \-\-quiet
Do not report errors in the \fInanorc\fP files nor ask them to be
acknowledged by pressing Enter at startup.
.TP
.B \-r \fInumber\fP (\-\-fill=\fInumber\fP)
.BR \-r\ \fInumber\fR ", " \-\-fill= \fInumber
Hard-wrap lines at column \fInumber\fP. If this value is 0 or less, wrapping
will occur at the width of the screen less \fInumber\fP columns, allowing
the wrap point to vary along with the width of the screen if the screen
@@ -193,51 +193,48 @@ is resized. The default value is \-8. This option conflicts with
.B \-w
-- the last one given takes effect.
.TP
.B \-s \fIprogram\fP (\-\-speller=\fIprogram\fP)
Enable alternative spell checker command.
.BR \-s\ \fIprogram\fR ", " \-\-speller= \fIprogram
Use this alternative spell checker command.
.TP
.B \-t (\-\-tempfile)
Always save changed buffer without prompting. Same as Pico's \fB\-t\fP
.BR \-t ", " \-\-tempfile
Always save a changed buffer without prompting. Same as Pico's \fB\-t\fP
option.
.TP
.B \-u (\-\-undo)
Enable the experimental generic-purpose undo/redo code. The default undo
and redo shortcuts are Meta-U and Meta-E, respectively.
.TP
.B \-v (\-\-view)
.BR \-v ", " \-\-view
View-file (read-only) mode.
.TP
.B \-w (\-\-nowrap)
.BR \-w ", " \-\-nowrap
Disable the hard-wrapping of long lines. This option conflicts with
.B \-r
-- the last one given takes effect.
.TP
.B \-x (\-\-nohelp)
.BR \-x ", " \-\-nohelp
Don't show the two help lines at the bottom of the screen.
.TP
.B \-z (\-\-suspend)
.BR \-z ", " \-\-suspend
Enable the suspend ability.
.TP
.B \-$ (\-\-softwrap)
.BR \-$ ", " \-\-softwrap
Enable 'soft wrapping'. This will make \fBnano\fP attempt to display the
entire contents of any line, even if it is longer than the screen width, by
continuing it over multiple screen lines. Since
\&'$' normally refers to a variable in the Unix shell, you should specify
this option last when using other options (e.g. 'nano \-wS$') or pass it
separately (e.g. 'nano \-wS \-$').
this option last when using other options (e.g.\& 'nano \-wS$') or pass it
separately (e.g.\& 'nano \-wS \-$').
.TP
.B \-a, \-b, \-e, \-f, \-g, \-j
.BR \-a ", " \-b ", " \-e ", " \-f ", " \-g ", " \-j
Ignored, for compatibility with Pico.
.SH INITIALIZATION FILE
\fBnano\fP will read initialization files in the following order:
\fISYSCONFDIR/nanorc\fP, then \fI~/.nanorc\fP. Please see
\fBnanorc(5)\fP and the example file \fBnanorc.sample\fP, both of which
should be provided with \fBnano\fP.
the system's \fBnanorc\fP (if it exists), and then the user's
\fB~/.nanorc\fP (if it exists). Please see
.BR nanorc (5)
for more information on the possible contents of those files.
.SH NOTES
If no alternative spell checker command is specified on the command
line or in one of the \fInanorc\fP files, \fBnano\fP will check the
line nor in one of the \fInanorc\fP files, \fBnano\fP will check the
\fBSPELL\fP environment variable for one.
In some cases \fBnano\fP will try to dump the buffer into an emergency
@@ -246,7 +243,7 @@ SIGTERM or runs out of memory. It will write the buffer into a file
named \fInano.save\fP if the buffer didn't have a name already, or will
add a ".save" suffix to the current filename. If an emergency file with
that name already exists in the current directory, it will add ".save"
plus a number (e.g. ".save.1") to the current filename in order to make
plus a number (e.g.\& ".save.1") to the current filename in order to make
it unique. In multibuffer mode, \fBnano\fP will write all the open
buffers to their respective emergency files.
@@ -269,7 +266,7 @@ http://www.nano-editor.org/
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
.SH AUTHOR
Chris Allegretta <chrisa@asty.org>, et al (see \fIAUTHORS\fP and
Chris Allegretta <chrisa@asty.org>, et al (see the files \fIAUTHORS\fP and
\fITHANKS\fP for details). This manual page was originally written by
Jordi Mallach <jordi@gnu.org>, for the Debian system (but may be used by
others).

View File

@@ -1,6 +1,8 @@
.\" Hey, EMACS: -*- nroff -*-
.\" $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:
@@ -18,8 +20,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.\" $Id$
.TH NANORC 5 "version 2.3.3" "May 2014"
.TH NANORC 5 "version 2.4.0" "March 2015"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -28,8 +29,8 @@ nanorc \- GNU nano's rcfile
The \fInanorc\fP file contains the default settings for \fBnano\fP, a
small and friendly editor. The file should be in Unix format, not in
DOS or Mac format. During startup, \fBnano\fP will first read the
system-wide settings, from \fBSYSCONFDIR/nanorc\fP, and then the
user-specific settings, from \fB~/.nanorc\fP.
system-wide settings, from \fB/etc/nanorc\fP (the exact path might be
different), and then the user-specific settings, from \fB~/.nanorc\fP.
.SH OPTIONS
The configuration file accepts a series of \fBset\fP and \fBunset\fP
@@ -37,38 +38,42 @@ commands, which can be used to configure nano on startup without using
command-line options. Additionally, there are some commands to define
syntax highlighting and to rebind keys -- see the two separate sections
on those. \fBnano\fP reads one command per line.
.PP
Options in \fInanorc\fP files take precedence over nano's defaults, and
command-line options override \fInanorc\fP settings. Also, options are
unset by default, except for those that take arguments.
Quotes inside string parameters don't have to be escaped with
command-line options override \fInanorc\fP settings. Also, options that
do not take an argument are unset by default. So using the \fBunset\fR
command is only needed when wanting to override a setting of the system's
\fInanorc\fR file in your own \fB~/.nanorc\fR. Options that take an
argument cannot be unset.
.PP
Below, the \fIstring\fR parameters need to be enclosed in double quotes.
Quotes inside these string parameters don't have to be escaped with
backslashes. The last double quote in the string will be treated as its
end. For example, for the \fBbrackets\fP option, "\fB"')>]}\fP" will
match \fB"\fP, \fB'\fP, \fB)\fP, \fB>\fP, \fB]\fP, and \fB}\fP.
.PP
The supported commands and arguments are:
.TP 3
.B set/unset allow_insecure_backup
.B set allow_insecure_backup
When backing up files, allow the backup to succeed even if its permissions
can't be (re)set due to special OS considerations. You should
can't be (re)set due to special OS considerations. You should
NOT enable this option unless you are sure you need it.
.TP
.B set/unset autoindent
.B set autoindent
Use auto-indentation.
.TP
.B set/unset backup
.B set backup
Create backup files by adding a tilde (\fB~\fP) to each file's name.
.TP
.B set backupdir "\fIdirectory\fP"
Set the directory where \fBnano\fP puts unique backup files, if file
backups are enabled.
.TP
.B set/unset backwards
.B set backwards
Do backwards searches by default.
.TP
.B set/unset boldtext
.B set boldtext
Use bold instead of reverse video for the titlebar, statusbar, key combos,
and selected text. This can be overridden for the first three by setting
the options \fBtitlecolor\fP, \fBstatuscolor\fP, and \fBkeycolor\fP.
@@ -79,27 +84,27 @@ paragraphs. This may not include blank characters. Only closing
punctuation (see \fBpunct\fP), optionally followed by the specified
closing brackets, can end sentences. The default value is "\fB"')>]}\fP".
.TP
.B set/unset casesensitive
.B set casesensitive
Do case-sensitive searches by default.
.TP
.B set/unset const
.B set const
Constantly display the cursor position in the status bar.
.TP
.B set/unset cut
.B set cut
Use cut-to-end-of-line by default, instead of cutting the whole line.
.TP
.B set fill \fIn\fP
Hard-wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the
maximum line length will be the screen width less \fIn\fP columns. The
default value is \-8.
.B set fill \fInumber\fR
Hard-wrap lines at column number \fInumber\fR. If \fInumber\fR is 0 or less,
the maximum line length will be the screen width less \fInumber\fP columns.
The default value is \fB\-8\fR.
.TP
.B set functioncolor \fIfgcolor\fR,\fIbgcolor\fR
Specify the color combination to use for the function descriptions
in the two help lines at the bottom of the screen.
See \fBset titlecolor\fR for more details.
.TP
.B set/unset historylog
Enable the use of \fB~/.nano_history\fP for saving and reading
.B set historylog
Enable the use of \fB~/.nano/search_history\fP for saving and reading
search/replace strings.
.TP
.B set keycolor \fIfgcolor\fR,\fIbgcolor\fR
@@ -107,7 +112,7 @@ Specify the color combination to use for the shortcut key combos
in the two help lines at the bottom of the screen.
See \fBset titlecolor\fR for more details.
.TP
.B set/unset locking
.B set locking
Enable vim-style lock-files for when editing files.
.TP
.B set matchbrackets "\fIstring\fP"
@@ -116,32 +121,32 @@ searches. This may not include blank characters. The opening set must
come before the closing set, and the two sets must be in the same order.
The default value is "\fB(<[{)>]}\fP".
.TP
.B set/unset morespace
.B set morespace
Use the blank line below the titlebar as extra editing space.
.TP
.B set/unset mouse
.B set mouse
Enable mouse support, if available for your system. When enabled, mouse
clicks can be used to place the cursor, set the mark (with a double
click), and execute shortcuts. The mouse will work in the X Window
System, and on the console when gpm is running. Text can still be
selected through dragging by holding down the Shift key.
.TP
.B set/unset multibuffer
.B set multibuffer
Allow inserting files into their own buffers.
.TP
.B set/unset noconvert
.B set noconvert
Don't convert files from DOS/Mac format.
.TP
.B set/unset nofollow
.B set nofollow
Don't follow symlinks when writing files.
.TP
.B set/unset nohelp
.B set nohelp
Don't display the two help lines at the bottom of the screen.
.TP
.B set/unset nonewlines
.B set nonewlines
Don't automatically add a newline to the ends of files.
.TP
.B set/unset nowrap
.B set nowrap
Don't hard-wrap text at all.
.TP
.B set operatingdir "\fIdirectory\fP"
@@ -150,10 +155,10 @@ subdirectories. Also, the current directory is changed to here, so
files are inserted from this directory. By default, the operating
directory feature is turned off.
.TP
.B set/unset poslog
.B set poslog
Save the cursor position of files between editing sessions.
.TP
.B set/unset preserve
.B set preserve
Preserve the XON and XOFF keys (^Q and ^S).
.TP
.B set punct "\fIstring\fP"
@@ -162,13 +167,13 @@ paragraphs. This may not include blank characters. Only the
specfified closing punctuation, optionally followed by closing brackets
(see \fBbrackets\fP), can end sentences. The default value is "\fB!.?\fP".
.TP
.B set/unset quickblank
.B set quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25.
.TP
.B set/unset quiet
.B set quiet
\fBnano\fP will not report errors in the \fInanorc\fP file nor ask them
to be acknowledged by pressing Enter at startup. If this is used it
to be acknowledged by pressing Enter at startup. If this is used, it
should be placed at the top of the file to be fully effective.
.TP
.B set quotestr "\fIstring\fP"
@@ -179,30 +184,30 @@ otherwise a literal string. The default value is
support, and "\fB>\ \fP" otherwise. Note that '\\t' stands for a literal
Tab character.
.TP
.B set/unset rebinddelete
.B set rebinddelete
Interpret the Delete key differently so that both Backspace and Delete
work properly. You should only need to use this option if Backspace
acts like Delete on your system.
.TP
.B set/unset rebindkeypad
.B set rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
.TP
.B set/unset regexp
.B set regexp
Do extended regular expression searches by default.
.TP
.B set/unset smarthome
.B set smarthome
Make the Home key smarter. When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will
jump to that beginning (either forwards or backwards). If the cursor is
already at that position, it will jump to the true beginning of the
line.
.TP
.B set/unset smooth
.B set smooth
Use smooth scrolling by default.
.TP
.B set/unset softwrap
.B set softwrap
Enable soft line wrapping for easier viewing of very long lines.
.TP
.B set speller "\fIspellprog\fP"
@@ -213,17 +218,17 @@ calls \fIspell\fP.
Specify the color combination to use for the statusbar.
See \fBset titlecolor\fR for more details.
.TP
.B set/unset suspend
.B set suspend
Allow \fBnano\fP to be suspended.
.TP
.B set tabsize \fIn\fP
Use a tab size of \fIn\fP columns. The value of \fIn\fP must be greater
than 0. The default value is 8.
.B set tabsize \fInumber\fR
Use a tab size of \fInumber\fR columns. The value of \fInumber\fP must be
greater than 0. The default value is \fB8\fR.
.TP
.B set/unset tabstospaces
.B set tabstospaces
Convert typed tabs to spaces.
.TP
.B set/unset tempfile
.B set tempfile
Save automatically on exit, don't prompt.
.TP
.B set titlecolor \fIfgcolor\fR,\fIbgcolor\fR
@@ -232,23 +237,27 @@ Valid color names for foreground and background are:
.BR white , \ black , \ red , \ blue , \ green , \ yellow , \ magenta ", and " cyan .
And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
.TP
.B set/unset undo
Enable the experimental generic-purpose undo/redo code.
.TP
.B set/unset view
.B set view
Disallow file modification.
.TP
.B set whitespace "\fIstring\fP"
Set the two characters used to indicate the presence of tabs and
spaces. They must be single-column characters.
.TP
.B set/unset wordbounds
.B set wordbounds
Detect word boundaries more accurately by treating punctuation
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
@@ -268,17 +277,22 @@ For the currently defined syntax, use the given \fIprogram\fR
to invoke the linter (this overrides the speller function when
defined).
.TP
.BR header " [""\fIregex\fR"" ...]
.BI formatter " program " \fR[ "arg " \fR...]
For the currently defined syntax, use the given \fIprogram\fR
to automatically reformat text. Useful in certain programming
languages (e.g. go).
.TP
.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"" ...]
For the currently defined syntax, add one or more regexes which
.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
syntax should be used for that file. This
functionality only works when \fBlibmagic\fP is installed on the
functionality only works when \fBlibmagic\fP is installed on the
system and will be silently ignored otherwise.
.TP
.B color \fIfgcolor\fR,\fIbgcolor\fR """\fIregex\fR""" ...
@@ -328,27 +342,29 @@ context of menu \fImenu\fP (or in all menus where the function exists
by using \fBall\fP).
.TP
.BI unbind " key menu"
Unbinds the key \fIkey\fP from the menu named \fImenu\fP (or from all
Unbinds the key \fIkey\fP from the menu named \fImenu\fP (or from all
menus where it exists by using \fBall\fP).
.TP
The format of \fIkey\fP should be one of:
.TP
.B ^
.RS 3
.TP 3
.B ^
followed by an alpha character or the word "Space".
Example: ^C
.TP
.B M-
.B M-
followed by a printable character or the word "Space".
Example: M-C
.TP
.B F
.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.
@@ -367,7 +383,8 @@ Inserts a file into the current buffer (or into a new buffer when multibuffer
is enabled).
.TP
.B whereis
Searches for text in the current buffer.
Searches for text in the current buffer -- or for filenames matching
a string in the current list in the file browser.
.TP
.B searchagain
Repeats the last search command.
@@ -401,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
@@ -464,6 +484,9 @@ Goes to the last line of the file.
.B gotoline
Goes to a specific line (and column if specified).
.TP
.B gototext
Switches from targeting a line number to searching for text.
.TP
.B findbracket
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
(pairs) with the one under the cursor.
@@ -517,11 +540,22 @@ Shows the previous history entry in the prompt menus (e.g. search).
.B nexthistory
Shows the next history entry in the prompt menus (e.g. search).
.TP
.B dontreplace
Switches back to searching instead of replacing.
.B flipreplace
Toggles between searching for something and replacing something.
.TP
.B gototext
Searches for files matching a string in the file browser (reading or writing files).
.B flipexecute
Toggles between inserting a file and executing a command.
.TP
.B flipnewbuffer
Toggles between inserting into the current buffer and into a new
empty buffer.
.TP
.B tofiles
Starts the file browser, allowing to select a file from a list.
.TP
.B gotodir
Goes to a directory to be specified, allowing to browse anywhere
in the filesystem.
.TP
.B dosformat
When writing a file, switches to writing a DOS format (CR/LF).
@@ -585,7 +619,7 @@ Toggles whether typed tabs will be converted to spaces.
Toggles whether a backup will be made of the file to be edited.
.TP
.B multibuffer
Toggles the use of multiple file buffers (if available).
Toggles the use of multiple file buffers (if support for them has been compiled in).
.TP
.B mouse
Toggles mouse support.
@@ -595,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.
@@ -643,15 +678,18 @@ The 'search for a file' menu in the file browser.
The 'go to directory' menu in the file browser.
.TP
.B all
A special name meaning: apply to all menus where this function exists.
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
.B SYSCONFDIR/nanorc
System-wide configuration file
.B /etc/nanorc
System-wide configuration file.
.TP
.B ~/.nanorc
Per-user configuration file
Per-user configuration file.
.SH SEE ALSO
.TP
\fBnano\fP(1)

View File

@@ -1,7 +1,7 @@
.\" Hey, EMACS: -*- nroff -*-
.\" Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
.\" Skeleton based on nano-tiny.1:
.\" Copyright (C) 2002 Free Software Foundation, Inc.
.\" $Id$
.\"
.\" Copyright (C) 2002, 2005, 2006, 2007, 2014 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:
@@ -19,8 +19,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.\" $Id$
.TH RNANO 1 "version 2.3.3" "April 2014"
.TH RNANO 1 "version 2.4.0" "March 2015"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -29,8 +28,7 @@ Pico clone
.SH SYNOPSIS
.B rnano
.RI [ options "] [[\+" line , column "]\ " file "]..."
.br
.RI [ options "] [[+" line , column "]\ " file "]..."
.SH DESCRIPTION
\fBnano\fP is a small, free and friendly editor which aims to replace
@@ -43,7 +41,7 @@ replace" and "go to line and column number".
specific files and doesn't allow the user access to the filesystem or a
command shell.
.PP
In restricted mode, \fBnano\fP will \fInot\fP:
In restricted mode, \fBnano\fP will \fInot\/\fP:
.IP \[bu] 2
read or write to any file not specified on the command line;
.IP \[bu]
@@ -58,14 +56,13 @@ use backup files or spell checking.
.SH OPTIONS
.TP
.B \-h (\-\-help)
Show a summary of command line options and exit.
.BR \-h ", " \-\-help
Show a summary of command-line options and exit.
.TP
.B \-V (\-\-version)
.BR \-V ", " \-\-version
Show the current version number and exit.
.PP
See the \fBnano\fP(1) manpage for the complete documentation of
\fBnano\fP.
See the \fBnano\fP(1) manpage for all of the possible options.
.SH BUGS
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
@@ -79,7 +76,7 @@ of "subscribe".
http://www.nano-editor.org/
.SH AUTHOR
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS for details).
Chris Allegretta <chrisa@asty.org>, et al (see the file AUTHORS for details).
This manual page was originally written by Thijs Kinkhorst
<thijs@kinkhorst.com>, for the Debian system (but may be used by
others).

View File

@@ -61,7 +61,7 @@
## Enable vim-style lock-files. This is just to let a vim user know you
## are editing a file [s]he is trying to edit and vice versa. There are
## no plans to implement vim-style undo state in these files
## no plans to implement vim-style undo state in these files.
# set locking
## The opening and closing brackets that can be found by bracket
@@ -162,13 +162,9 @@
## Convert typed tabs to spaces.
# set tabstospaces
## Save automatically on exit, don't prompt.
## Save automatically on exit; don't prompt.
# set tempfile
## Enable the new (EXPERIMENTAL) generic undo code, not just for line
## cuts.
# set undo
## Disallow file modification. Why would you want this in an rcfile? ;)
# set view
@@ -186,7 +182,7 @@
## Paint the interface elements of nano.
## This is an example, by default there are no colors.
## This is an example; by default there are no colors.
# set titlecolor brightwhite,blue
# set statuscolor brightwhite,green
# set keycolor green

View File

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

View File

@@ -1,14 +1,14 @@
## Here is an example for apt's sources.list.
syntax "apt/sources.list" "sources\.list(\.old|~)?$"
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.
color brightmagenta "^deb.*"
# Distribution -- well, everything, except the components.
color brightred "^deb(-src)? ((http|ftp|rsh|ssh|file|copy):/[^ ]+|cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/) [^ ]+"
color brightred "^deb(-src)? ((http(s)?|ftp|rsh|ssh|file|copy|tor|spacewalk):/[^ ]+|cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/) [^ ]+"
# URIs.
color brightgreen "(http|ftp|rsh|ssh|file|copy):/[^ ]+"
color brightgreen "(http(s)?|ftp|rsh|ssh|file|copy|tor|spacewalk):/[^ ]+"
# CDroms.
color brightgreen "cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/"
# And finally the initial deb tag.

View File

@@ -6,8 +6,5 @@ syntax "default"
# Spaces in front of tabs.
color ,red " + +"
# Trailing blanks.
color ,red "[[:blank:]]+$"
# Nano's name, including version.
color brightred "(GNU )?nano [1-9]\.[0-9]\.[^[:space:][:punct:]]+"

View File

@@ -40,3 +40,6 @@ color brightblue start="/\*" end="\*/"
# Trailing whitespace.
color ,green "[[:space:]]+$"
# Set up the formatter since spelling is probably useless...
formatter gofmt -w

View File

@@ -5,7 +5,8 @@ magic "Java "
color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native)\>"
color cyan "\<(package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
color red ""[^"]*""
color yellow "\<(true|false|null)\>"
color blue "//.*"

View File

@@ -15,18 +15,20 @@ color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|break)\>"
# Keywords
color brightyellow "\<(debug|string|math|table|io|coroutine|os)\>\."
color brightyellow "\<(io|math|os|string|table|coroutine|debug)\>\."
color brightyellow "\<(_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\("
# Standard library
color brightyellow "io\.\<(close|flush|input|lines|open|output|popen|read|tmpfile|type|write|stdin|stdout|stderr)\>"
color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log)\>"
color brightyellow "math\.\<(max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
color brightyellow "os\.\<(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>"
color brightyellow "package\.\<(cpath|loaded|loadlib|path|preload|seeall)\>"
color brightyellow "string\.\<(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)\>"
color brightyellow "table\.\<(concat|insert|maxn|remove|sort)\>"
color brightyellow "coroutine\.\<(create|resume|running|status|wrap|yield)\>"
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue)\>"
color brightyellow "debug\.\<(setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
# File handle methods
color brightyellow "\:\<(close|flush|lines|read|seek|setvbuf|write)\>"

View File

@@ -6,12 +6,12 @@ syntax "nanorc" "\.?nanorc$"
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|i?color|extendsyntax).*$"
# Keywords
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|poslog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|undo|view|wordbounds)\>"
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor||statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|poslog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|view|wordbounds)\>"
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor|statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace)[[:space:]]+"
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6]))[[:space:]]+[[:alpha:]]+[[:space:]]+[[:alpha:]]+[[:space:]]*$"
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6]))[[:space:]]+[[:alpha:]]+[[:space:]]*$"
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|linter)[[:space:]]+.*$"
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+[[:alpha:]]+[[:space:]]*$"
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]*$"
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|linter|formatter)[[:space:]]+.*$"
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|extendsyntax)\>"
# Colors

View File

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

View File

@@ -1,7 +1,7 @@
## Here is an example for Perl.
syntax "perl" "\.p[lm]$"
header "^#!.*/perl[-0-9._]*"
header "^#!.*perl[-0-9._]*"
magic "Perl script text"
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"

View File

@@ -1,22 +1,23 @@
## Here is an example for Python.
syntax "python" "\.py$"
header "^#!.*/python[-0-9._]*"
header "^#!.*python[-0-9._]*"
# Function definitions.
icolor brightblue "def [0-9A-Z_]+"
# Keywords.
color brightcyan "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
color brightcyan "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from)\>"
color brightcyan "\<(global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
# Strings.
color brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
# Comments.
color brightred "(^|[[:blank:]])#.*$"
# Multiline strings.
color brightgreen start="\"\"\"([^"),]|$)" end="(^|[^(])\"\"\""
color brightgreen start="'''([^'),]|$)" end="(^|[^(])'''"
# Comments.
color brightred "(^|[[:blank:]])#.*$"
# Reminders.
color ,yellow "(FIXME|TODO|XXX)"

View File

@@ -1,10 +1,11 @@
## Here is an example for Ruby.
syntax "ruby" "\.rb$"
header "^#!.*/ruby[-0-9._]*"
header "^#!.*ruby[-0-9._]*"
# Asciibetical list of reserved words.
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
# Reserved words.
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module)\>"
color yellow "\<(next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
# Constants.
color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
# Ruby "symbols".

View File

@@ -1,7 +1,7 @@
## Here is an example for Bourne shell scripts.
syntax "sh" "\.sh$"
header "^#!.*/(ba|k|pdk)?sh[-0-9_]*"
header "^#!.*((ba|da|k|pdk)?sh[-0-9_]*|openrc-run|runscript)"
magic "(POSIX|Bourne.*) shell script text"
icolor brightgreen "^[0-9A-Z_]+\(\)"

View File

@@ -24,8 +24,8 @@ color yellow start="%__" end="\ "
color magenta start="%\{" end="\}"
color yellow start="%\{__" end="\}"
# Sections.
color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|preun|post|postun)"
color red "^%(trigger|triggerin|triggerpostun|triggerun|verifyscript)"
color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|pretrans|preun)"
color red "^%(post|posttrans|postun|trigger|triggerin|triggerpostun|triggerun|verifyscript)"
# Conditionals and defines.
color brightred "%(if|else|endif|define|global|undefine)"

View File

@@ -7,9 +7,9 @@
@c This file has the new style title page commands.
@c Run 'makeinfo' rather than 'texinfo-format-buffer'.
@smallbook
@set EDITION 0.1
@set VERSION 2.3.3
@set UPDATED May 2014
@set EDITION 0.3
@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.3
@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,212 +98,250 @@ 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
@code{nano} takes the following options from the command line:
@command{nano} takes the following options from the command line:
@table @code
@item +<line>,<column>
Start at line number <line> and column number <column> (at least one of
@table @option
@item +@var{line},@var{column}
Start at line number @var{line} and column number @var{column} (at least one of
which must be specified) instead of the default of line 1, column 1.
@item -A, --smarthome
@item -A
@itemx --smarthome
Make the Home key smarter. When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will
jump to that beginning (either forwards or backwards). If the cursor is
already at that position, it will jump to the true beginning of the
line.
@item -B, --backup
@item -B
@itemx --backup
When saving a file, back up the previous version of it to the current
filename suffixed with a ~.
filename suffixed with a @samp{~}.
@item -C <dir>, --backupdir=<dir>
Set the directory where @code{nano} puts unique backup files if file
@item -C @var{directory}
@itemx --backupdir=@var{directory}
Set the directory where @command{nano} puts unique backup files if file
backups are enabled.
@item -D, --boldtext
@item -D
@itemx --boldtext
Use bold text instead of reverse video text.
@item -E, --tabstospaces
@item -E
@itemx --tabstospaces
Convert typed tabs to spaces.
@item -F, --multibuffer
Enable multiple file buffers, if available.
@item -F
@itemx --multibuffer
Enable multiple file buffers (if support for them has been compiled in).
@item -G, --locking
@item -G
@itemx --locking
Enable vim-style file locking when editing files.
@item -H, --historylog
Log search and replace strings to ~/.nano_history, so they can be
retrieved in later sessions, if nanorc support is available.
@item -H
@itemx --historylog
Log search and replace strings to @file{~/.nano/search_history},
so they can be retrieved in later sessions.
@item -I, --ignorercfiles
Don't look at SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
available.
@item -I
@itemx --ignorercfiles
Don't look at the system's nanorc file nor at the user's @file{~/.nanorc}.
@item -K, --rebindkeypad
@item -K
@itemx --rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
@item -L, --nonewlines
@item -L
@itemx --nonewlines
Don't add newlines to the ends of files.
@item -N, --noconvert
@item -N
@itemx --noconvert
Disable automatic conversion of files from DOS/Mac format.
@item -O, --morespace
@item -O
@itemx --morespace
Use the blank line below the titlebar as extra editing space.
@item -P, --poslog
Log and later read back the location of the cursor and place it
there again.
@item -P
@itemx --poslog
Log for each file the last location of the cursor, and read it
back upon reopening the file and place it there again.
@item -Q <str>, --quotestr=<str>
@item -Q "@var{characters}"
@itemx --quotestr="@var{characters}"
Set the quoting string for justifying. The default value is
@quotation
@code{^([ \t]*[|>:@}#])+}
"^([ \t]*[|>:@}#])+"
@end quotation
if extended regular expression support is available, or "> " otherwise.
if extended regular expression support is available, or @code{> } otherwise.
Note that @code{\t} above stands for a literal Tab character.
@item -R, --restricted
@item -R
@itemx --restricted
Restricted mode: don't read or write to any file not specified on the
command line; don't read any nanorc files; don't allow suspending; don't
command line; don't read any nanorc files nor history files; don't allow
suspending nor spell checking; don't
allow a file to be appended to, prepended to, or saved under a different
name if it already has one; don't use backup files nor spell checking.
This restricted mode is also accessible by invoking @code{nano} with
any name beginning with 'r' (e.g. "rnano").
name if it already has one; and don't use backup files.
This restricted mode is also accessible by invoking @command{nano} with
any name beginning with @samp{r} (e.g. @command{rnano}).
@item -S, --smooth
@item -S
@itemx --smooth
Enable smooth scrolling. Text will scroll line-by-line, instead of the
usual chunk-by-chunk behavior.
@item -T <number>, --tabsize=<number>
Set the displayed tab length to <number> columns. The value of <number>
must be greater than 0. The default value is 8.
@item -T @var{number}
@itemx --tabsize=@var{number}
Set the displayed tab length to @var{number} columns. The value of
@var{number} must be greater than 0. The default value is @samp{8}.
@item -U, --quickblank
@item -U
@itemx --quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25. Note that -c overrides this.
keystroke instead of 25. Note that @option{-c} overrides this.
@item -V, --version
@item -V
@itemx --version
Show the current version number and exit.
@item -W, --wordbounds
@item -W
@itemx --wordbounds
Detect word boundaries more accurately by treating punctuation
characters as parts of words.
@item -Y <str>, --syntax=<str>
Specify a specific syntax from the nanorc to use for highlighting, if
available. See @xref{Syntax Highlighting}, for more info.
@item -Y @var{name}
@itemx --syntax=@var{name}
Specify a specific syntax from the nanorc files to use for highlighting.
See @xref{Syntax Highlighting}, for more info.
@item -c, --const
@item -c
@itemx --const
Constantly display the cursor position and line number on the statusbar.
Note that this overrides -U.
Note that this overrides @option{-U}.
@item -d, --rebinddelete
@item -d
@itemx --rebinddelete
Interpret the Delete key differently so that both Backspace and Delete
work properly. You should only need to use this option if Backspace
acts like Delete on your system.
@item -h, --help
@item -h
@itemx --help
Show a summary of command-line options and exit.
@item -i, --autoindent
@item -i
@itemx --autoindent
Automatically indent new lines to the same number of spaces and tabs as
the previous line.
@item -k, --cut
@item -k
@itemx --cut
Make the 'Cut Text' command (normally ^K) cut from the current cursor
position to the end of the line, instead of cutting the entire line.
@item -l, --nofollow
@item -l
@itemx --nofollow
When writing files, if the given file is a symbolic link, it is removed
and a new file is created.
@item -m, --mouse
@item -m
@itemx --mouse
Enable mouse support, if available for your system. When enabled, mouse
clicks can be used to place the cursor, set the mark (with a double
click), and execute shortcuts. The mouse will work in the X Window
System, and on the console when gpm is running. Text can still be
selected through dragging by holding down the Shift key.
@item -n, --noread
@item -n
@itemx --noread
Treat any name given on the command line as a new file. This allows
@code{nano} to write to named pipes: it will start with a blank buffer,
@command{nano} to write to named pipes: it will start with a blank buffer,
and will write to the pipe when the user saves the "file". This way
@code{nano} can be used as an editor in combination with for instance
@code{gpg} without having to write sensitive data to disk first.
@command{nano} can be used as an editor in combination with for instance
@command{gpg} without having to write sensitive data to disk first.
@item -o <dir>, --operatingdir=<dir>
Set operating directory. Makes @code{nano} set up something similar to
a chroot.
@item -o @var{directory}
@itemx --operatingdir=@var{directory}
Set the operating directory. This makes @command{nano} set up something
similar to a chroot.
@item -p, --preserve
@item -p
@itemx --preserve
Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent to the
editor can be can be stopped and started.
editor can be stopped and started.
@item -q, --quiet
Do not report errors in the nanorc file and ask them to be acknowledged
@item -q
@itemx --quiet
Do not report errors in the nanorc file nor ask them to be acknowledged
by pressing Enter at startup.
@item -r <number>, --fill=<number>
Hard-wrap lines at column <number> (by inserting a newline character).
@item -r @var{number}
@itemx --fill=@var{number}
Hard-wrap lines at column @var{number} (by inserting a newline character).
If the given value is 0 or less, wrapping will occur at the width of
the screen minus the given amount, allowing the wrapping width to
vary along with the width of the screen if and when it is resized.
The default value is -8. This option conflicts with -w -- the last
one given takes effect.
The default value is @samp{-8}. This option conflicts with @option{-w}
-- the last one given takes effect.
@item -s <program>, --speller=<program>
Invoke the given program as the spell checker. By default, @code{nano}
uses the command specified in the SPELL environment variable, or, if
SPELL is not set, its own interactive spell checker that requires the
@code{spell} program to be installed on your system.
@item -s @var{program}
@itemx --speller=@var{program}
Invoke the given program as the spell checker. By default, @command{nano}
uses the command specified in the @env{SPELL} environment variable, or,
if @env{SPELL} is not set, its own interactive spell checker that requires
the @command{spell} program to be installed on your system.
@item -t, --tempfile
@item -t
@itemx --tempfile
Don't ask whether or not to save the current contents of the file when
exiting, assume yes. This is most useful when using @code{nano} as the
exiting, assume yes. This is most useful when using @command{nano} as the
composer of a mailer program.
@item -u, --undo
Enable the experimental generic-purpose undo/redo code. The default undo
and redo shortcuts are Meta-U and Meta-E, respectively.
@item -v, --view
@item -v
@itemx --view
Don't allow the contents of the file to be altered. Note that this
option should NOT be used in place of correct file permissions to
implement a read-only file.
@item -w, --nowrap
@item -w
@itemx --nowrap
Don't hard-wrap long lines at any length. This option conflicts with
-r -- the last one given takes effect.
@option{-r} -- the last one given takes effect.
@anchor{Expert Mode}
@item -x, --nohelp
@item -x
@itemx --nohelp
Expert Mode: don't show the Shortcut Lists at the bottom of the screen.
This affects the location of the statusbar as well, as in Expert Mode it
is located at the very bottom of the editor.
@@ -311,19 +349,26 @@ is located at the very bottom of the editor.
Note: When accessing the help system, Expert Mode is temporarily
disabled to display the help-system navigation keys.
@item -z, --suspend
Enable the ability to suspend @code{nano} using the system's suspend
@item -z
@itemx --suspend
Enable the ability to suspend @command{nano} using the system's suspend
keystroke (usually ^Z).
@item -$, --softwrap
Enable 'soft wrapping'. This will make @code{nano} attempt to display the
@item -$
@itemx --softwrap
Enable 'soft wrapping'. This will make @command{nano} attempt to display the
entire contents of any line, even if it is longer than the screen width, by
continuing it over multiple screen lines. Since
'$' normally refers to a variable in the Unix shell, you should specify
@samp{$} normally refers to a variable in the Unix shell, you should specify
this option last when using other options (e.g. @code{nano -wS$}) or pass it
separately (e.g. @code{nano -wS -$}).
@item -a, -b, -e, -f, -g, -j
@item -a
@itemx -b
@itemx -e
@itemx -f
@itemx -g
@itemx -j
Ignored, for compatibility with Pico.
@end table
@@ -445,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.
@@ -495,8 +540,8 @@ toggles the -N (@code{--noconvert}) command line option.
toggles the -O (@code{--morespace}) command line option.
@item Whitespace Display Toggle (Meta-P)
toggles whitespace display mode if you have a "whitespace" option in
your nanorc. See @xref{Whitespace}, for more info.
toggles whitespace-display mode.
See @xref{Whitespace}, for more info.
@item Tabs to Spaces Toggle (Meta-Q)
toggles the -E (@code{--tabstospaces}) command line option.
@@ -525,8 +570,9 @@ toggles the -$ (@code{--softwrap}) command line option.
The nanorc files contain the default settings for @code{nano}. They
should be in Unix format, not in DOS or Mac format. During startup,
@code{nano} will first read the system-wide settings, from /etc/nanorc,
and then the user-specific settings, from ~/.nanorc.
@code{nano} will first read the system-wide settings, from /etc/nanorc
(the exact path might be different), and then the user-specific settings,
from ~/.nanorc.
A nanorc file accepts a series of "set" and "unset" commands, which can
be used to configure @code{nano} on startup without using command-line
@@ -535,8 +581,11 @@ and to rebind keys -- @xref{Syntax Highlighting}, and @xref{Rebinding Keys}.
@code{nano} will read one command per line.
Options in nanorc files take precedence over @code{nano}'s defaults, and
command-line options override nanorc settings. Options are also unset
by default, except for those that take arguments.
command-line options override nanorc settings. Also, options that do not
take an argument are unset by default. So using the @code{unset} command
is only needed when wanting to override a setting of the system's nanorc
file in your own @file{~/.nanorc}. Options that take an argument cannot
be unset.
Quotes inside string parameters don't have to be escaped with
backslashes. The last double quote in the string will be treated as its
@@ -556,15 +605,15 @@ The supported settings in a nanorc file are:
@table @code
@item set/unset allow_insecure_backup
@item set allow_insecure_backup
When backing up files, allow the backup to succeed even if its
permissions can't be (re)set due to special OS considerations.
You should NOT enable this option unless you are sure you need it.
@item set/unset autoindent
@item set autoindent
Use auto-indentation.
@item set/unset backup
@item set backup
When saving a file, back up the previous version of it to the current
filename suffixed with a tilde (@code{~}).
@@ -572,87 +621,88 @@ filename suffixed with a tilde (@code{~}).
Set the directory where @code{nano} puts unique backup files, if file
backups are enabled.
@item set/unset backwards
@item set backwards
Do backwards searches by default.
@item set/unset boldtext
@item set boldtext
Use bold instead of reverse video for the titlebar, statusbar, key combos,
and selected text. This can be overridden for the first three by setting
the options "titlecolor", "statuscolor", and "keycolor".
@item set brackets "string"
@item set brackets "@var{string}"
Set the characters treated as closing brackets when justifying
paragraphs. This may not include blank characters. Only closing
punctuation (see "punct"), optionally followed by the specified
closing brackets, can end sentences. The default value is
@quotation
@code{""')>]@}"}
""')>]@}"
@end quotation
@item set/unset casesensitive
@item set casesensitive
Do case-sensitive searches by default.
@item set/unset const
@item set const
Constantly display the cursor position in the status bar.
@item set/unset cut
@item set cut
Use cut-to-end-of-line by default, instead of cutting the whole line.
@item set fill "n"
Hard-wrap lines at column number "n". If "n" is 0 or less, the maximum line
length will be the screen width less "n" columns. The default value is
-8.
@item set fill @var{number}
Hard-wrap lines at column number @var{number}. If @var{number} is 0 or less,
the maximum line length will be the screen width less @var{number} columns.
The default value is -8.
@item set functioncolor fgcolor,bgcolor
@item set functioncolor @var{fgcolor},@var{bgcolor}
Specify the color combination to use for the function descriptions
in the two help lines at the bottom of the screen.
See "set titlecolor" for more details.
See @code{set titlecolor} for more details.
@item set/unset historylog
Enable ~/.nano_history for saving and reading search/replace strings.
@item set historylog
Enable the use of @file{~/.nano/search_history} for saving and reading
search/replace strings.
@item set keycolor fgcolor,bgcolor
@item set keycolor @var{fgcolor},@var{bgcolor}
Specify the color combination to use for the shortcut key combos
in the two help lines at the bottom of the screen.
See "set titlecolor" for more details.
See @code{set titlecolor} for more details.
@item set/unset locking
@item set locking
Enable vim-style lock-files for when editing files.
@item set matchbrackets "string"
@item set matchbrackets "@var{string}"
Set the opening and closing brackets that can be found by bracket
searches. This may not include blank characters. The opening set must
come before the closing set, and the two sets must be in the same order.
The default value is
@quotation
@code{"(<[@{)>]@}"}
"(<[@{)>]@}"
@end quotation
@item set/unset morespace
@item set morespace
Use the blank line below the titlebar as extra editing space.
@item set/unset mouse
@item set mouse
Enable mouse support, so that mouse clicks can be used to place the
cursor, set the mark (with a double click), or execute shortcuts.
@item set/unset multibuffer
@item set multibuffer
Allow inserting files into their own buffers.
@item set/unset noconvert
@item set noconvert
Don't convert files from DOS/Mac format.
@item set/unset nofollow
@item set nofollow
Don't follow symlinks when writing files.
@item set/unset nohelp
@item set nohelp
Don't display the help lists at the bottom of the screen.
@item set/unset nonewlines
@item set nonewlines
Don't add newlines to the ends of files.
@item set/unset nowrap
@item set nowrap
Don't hard-wrap text at all.
@item set operatingdir "directory"
@@ -661,105 +711,102 @@ subdirectories. Also, the current directory is changed to here, so
files are inserted from this directory. By default, the operating
directory feature is turned off.
@item set/unset poslog
@item set poslog
Save the cursor position of files between editing sessions.
@item set/unset preserve
@item set preserve
Preserve the XON and XOFF keys (^Q and ^S).
@item set punct "string"
@item set punct "@var{string}"
Set the characters treated as closing punctuation when justifying
paragraphs. This may not include blank characters. Only the
specified closing punctuation, optionally followed by closing brackets
(see "brackets"), can end sentences. The default value is @code{"!.?"}.
(see "brackets"), can end sentences. The default value is "!.?".
@item set/unset quickblank
@item set quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25.
@item set/unset quiet
@item set quiet
When set, @code{nano} will not report errors in the nanorc file nor ask them
to be acknowledged by pressing Enter at startup. If this option is used, it
should be placed at the top of the file to be fully effective.
@item set quotestr "string"
@item set quotestr "@var{string}"
The email-quote string, used to justify email-quoted paragraphs. This
is an extended regular expression if your system supports them,
otherwise a literal string. The default value is
@quotation
@code{"^([ \\t]*[#:>\\|@}])+"}
"^([ \\t]*[#:>\\|@}])+"
@end quotation
if you have extended regular expression support, and "> " otherwise.
Note that '\\t' stands for a literal Tab character.
@item set/unset rebinddelete
@item set rebinddelete
Interpret the Delete key differently so that both Backspace and Delete
work properly. You should only need to use this option if Backspace
acts like Delete on your system.
@item set/unset rebindkeypad
@item set rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
@item set/unset regexp
@item set regexp
Do extended regular expression searches by default.
@item set/unset smarthome
@item set smarthome
Make the Home key smarter. When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will
jump to that beginning (either forwards or backwards). If the cursor is
already at that position, it will jump to the true beginning of the
line.
@item set/unset smooth
@item set smooth
Use smooth scrolling by default.
@item set/unset softwrap
@item set softwrap
Enable soft line wrapping for easier viewing of very long lines.
@item set speller "spellprog"
Use spelling checker "spellprog" instead of the built-in one, which
calls "spell".
@item set statuscolor fgcolor,bgcolor
@item set statuscolor @var{fgcolor},@var{bgcolor}
Specify the color combination to use for the statusbar.
See "set titlecolor" for more details.
See @code{set titlecolor} for more details.
@item set/unset suspend
@item set suspend
Allow @code{nano} to be suspended.
@item set tabsize "n"
Use a tab size of "n" columns. The value of "n" must be greater than 0.
The default value is 8.
@item set tabsize @var{number}
Use a tab size of @var{number} columns. The value of @var{number} must be
greater than 0. The default value is 8.
@item set/unset tabstospaces
@item set tabstospaces
Convert typed tabs to spaces.
@item set/unset tempfile
@item set tempfile
Save automatically on exit, don't prompt.
@item set titlecolor fgcolor,bgcolor
@item set titlecolor @var{fgcolor},@var{bgcolor}
Specify the color combination to use for the titlebar.
Valid color names for foreground and background are:
white, black, red, blue, green, yellow, magenta, and cyan.
And either "fgcolor" or ",bgcolor" may be left out.
And either @var{fgcolor} or @var{,bgcolor} may be left out.
@item set/unset undo
Enable the experimental generic-purpose undo/redo code.
@item set/unset view
@item set view
Disallow file modification.
@anchor{Whitespace}
@item set whitespace "string"
@item set whitespace "@var{string}"
Set the two characters used to indicate the presence of tabs and
spaces. They must be single-column characters. The default pair
for a UTF-8 locale is "»·", and for other locales ">.".
@item set/unset wordbounds
@item set wordbounds
Detect word boundaries more accurately by treating punctuation
characters as part of a word.
@@ -768,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
@@ -789,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
@@ -851,7 +909,7 @@ Rebinds @code{key} to @code{function} in the context of @code{menu}
(or in all menus where the function exists by using @code{all}).
@item unbind key menu
Unbinds @code{key} from the specified @code{menu}
Unbinds @code{key} from @code{menu}
(or from all menus where it exists by using @code{all}).
@end table
@@ -895,7 +953,8 @@ Inserts a file into the current buffer (or into a new buffer when multibuffer
is enabled).
@item whereis
Searches for text in the current buffer.
Searches for text in the current buffer -- or for filenames matching
a string in the current list in the file browser
@item searchagain
Repeats the last search command.
@@ -992,6 +1051,9 @@ Goes to the last line of the file.
@item gotoline
Goes to a specific line (and column if specified).
@item gototext
Switches from targeting a line number to searching for text.
@item findbracket
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
(pairs) with the one under the cursor.
@@ -1045,11 +1107,15 @@ Shows the previous history entry in the prompt menus (e.g. search).
@item nexthistory
Shows the next history entry in the prompt menus (e.g. search).
@item dontreplace
Switches back to searching instead of replacing.
@item flipreplace
Toggles between searching for something and replacing something.
@item gototext
Searches for files matching a string in the file browser (reading or writing files).
@item flipexecute
Toggles between inserting a file and executing a command.
@item flipnewbuffer
Toggles between inserting into the current buffer and into a new
empty buffer.
@item dosformat
When writing a file, switches to writing a DOS format (CR/LF).
@@ -1066,6 +1132,13 @@ When writing a file, 'prepends' (writes at the beginning) instead of overwriting
@item backup
When writing a file, creates a backup of the current file.
@item tofiles
Starts the file browser, allowing to select a file from a list.
@item gotodir
Goes to a directory to be specified, allowing to browse anywhere
in the filesystem.
@item firstfile
Goes to the first file when using the file browser (reading or writing files).
@@ -1173,7 +1246,9 @@ The 'search for a file' menu in the file browser.
The 'go to directory' menu in the file browser.
@item all
A special name meaning: apply to all menus where this function exists.
A special name that encompasses all menus. For @code{bind} it means
all menus where the specified @code{function} exists; for @code{unbind}
it means all menus where the specified @code{key} exists.
@end table
@@ -1269,7 +1344,8 @@ The possible options to @code{./configure} are:
Disable the mini file browser when reading or writing files.
@item --disable-color
Disable support for syntax coloring of files using the nanorc file.
Disable support for the syntax coloring of files. This also eliminates
the -Y command-line option, which chooses a specific syntax.
@item --disable-extra
Disable extra features. At the moment, this is just easter-egg-type
@@ -1280,6 +1356,13 @@ Disable the help function. Doing this makes the binary much smaller,
but makes it difficult for new users to learn more than very basic
things about using the editor.
@item --disable-histories
Disable the code for the handling of the history files: the search and
replace strings that were used, and the cursor position at which each
file was closed. This also eliminates the -H and -P command-line
options, which switch on the logging of search/replace strings and
cursor positions.
@item --disable-justify
Disable the justify and unjustify functions.
@@ -1294,13 +1377,17 @@ command-line option, which enables the mouse functionality.
@item --disable-multibuffer
Disable support for opening multiple files at a time and switching
between them on the fly.
between them on the fly. This also eliminates the -F command-line
option, which switches the use of multiple file buffers on.
@item --disable-nanorc
Disable support for reading the nanorc files at startup. With such
support, you can store custom settings in a system-wide and a per-user
nanorc file rather than having to pass command-line options to get
the desired behavior. See @xref{Nanorc Files}, for more info.
Disabling this also eliminates the -I and -q command-line options;
the first inhibits the reading of nanorcfiles, and the second
suppresses warnings about errors in those files.
@item --disable-operatingdir
Disable setting the operating directory. This also eliminates the -o
@@ -1320,14 +1407,16 @@ command-line option, which enables long-line wrapping.
@item --enable-tiny
This option disables all the above. It also disables some of the larger
internals of the editor, like the marking code and the cut-to-end-of-line
code. It also disables the function toggles.
code. It also disables the function toggles. By using the enabling
counterpart of the above options together with --enable-tiny, specific
features can be switched back on.
@item --enable-debug
Enable support for runtime debug output. This can get pretty messy, so
chances are you only want this feature when you're working on the nano source.
@item --disable-nls
Disables Native Language support. This will disable use of the
Disables Native Language support. This will disable the use of any
available GNU @code{nano} translations.
@item --disable-wrapping-as-root

View File

@@ -8,7 +8,7 @@ sub combinations {
return @rest, map { [$first, @$_] } @rest;
}
my @allargs=("--enable-debug", "--disable-wrapping", "--disable-justify", "--disable-extra", "--enable-tiny", "--disable-browser --disable-help --disable-mouse --disable-operatingdir --disable-speller", "--disable-multibuffer", "--disable-nanorc", "--with-slang");
my @allargs=("--enable-debug", "--disable-wrapping", "--disable-justify", "--disable-extra", "--enable-tiny", "--disable-utf8", "--disable-multibuffer", "--disable-nanorc", "--with-slang");
my @combos = combinations(@allargs);
my $i = 0;

View File

@@ -6,12 +6,12 @@ Summary : Pico editor clone with enhancements
Name : %{name}
Version : %{version}
Release : %{release}
License : GPL
License : GPLv3+
Group : Applications/Editors
URL : http://www.nano-editor.org/
Source : http://www.nano-editor.org/dist/v2.0/%{name}-%{version}.tar.gz
Source : http://www.nano-editor.org/dist/v2.3/%{name}-%{version}.tar.gz
BuildRoot : %{_tmppath}/%{name}-%{version}-root
BuildRequires : autoconf, automake, gettext-devel, ncurses-devel
BuildRequires : autoconf, automake, gettext-devel, ncurses-devel, texinfo
%description
GNU nano is a small and friendly text editor. It aims to emulate the
@@ -25,13 +25,15 @@ Pico text editor while also offering a few enhancements.
make
%install
rm -rf %{buildroot}
make DESTDIR="%{buildroot}" install
#ln -s nano %{buildroot}%{_bindir}/pico
rm -f %{buildroot}%{_infodir}/dir
%files
%defattr(-,root,root)
%doc AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README THANKS TODO doc/faq.html doc/nanorc.sample
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO doc/faq.html doc/nanorc.sample
%{_bindir}/*
%{_docdir}/nano/*
%{_mandir}/man*/*
%{_mandir}/fr/man*/*
%{_infodir}/nano.info*

1016
po/bg.po

File diff suppressed because it is too large Load Diff

1248
po/ca.po

File diff suppressed because it is too large Load Diff

1324
po/cs.po

File diff suppressed because it is too large Load Diff

1246
po/da.po

File diff suppressed because it is too large Load Diff

2007
po/de.po

File diff suppressed because it is too large Load Diff

1078
po/eo.po

File diff suppressed because it is too large Load Diff

1470
po/es.po

File diff suppressed because it is too large Load Diff

1016
po/eu.po

File diff suppressed because it is too large Load Diff

1058
po/fi.po

File diff suppressed because it is too large Load Diff

1109
po/fr.po

File diff suppressed because it is too large Load Diff

1016
po/ga.po

File diff suppressed because it is too large Load Diff

1241
po/gl.po

File diff suppressed because it is too large Load Diff

1021
po/hu.po

File diff suppressed because it is too large Load Diff

1015
po/id.po

File diff suppressed because it is too large Load Diff

1052
po/it.po

File diff suppressed because it is too large Load Diff

1024
po/ja.po

File diff suppressed because it is too large Load Diff

1016
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1180
po/nb.po

File diff suppressed because it is too large Load Diff

1067
po/nl.po

File diff suppressed because it is too large Load Diff

1050
po/nn.po

File diff suppressed because it is too large Load Diff

1261
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2699
po/ro.po

File diff suppressed because it is too large Load Diff

1027
po/ru.po

File diff suppressed because it is too large Load Diff

1025
po/sl.po

File diff suppressed because it is too large Load Diff

1256
po/sr.po

File diff suppressed because it is too large Load Diff

2190
po/sv.po

File diff suppressed because it is too large Load Diff

1015
po/tr.po

File diff suppressed because it is too large Load Diff

1042
po/uk.po

File diff suppressed because it is too large Load Diff

1128
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,5 @@
AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\"
ACLOCAL_AMFLAGS = -I m4
bin_PROGRAMS = nano
nano_SOURCES = browser.c \
chars.c \

View File

@@ -3,7 +3,8 @@
* browser.c *
* *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
* 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
* 2010, 2011, 2013, 2014, 2015 Free Software Foundation, Inc. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -39,10 +40,7 @@ static int width = 0;
static int longest = 0;
/* The number of columns in the longest filename in the list. */
static size_t selected = 0;
/* The currently selected filename in the list. This variable
* is zero-based. */
static bool search_last_file = FALSE;
/* Have we gone past the last file while searching? */
/* The currently selected filename in the list; zero-based. */
/* Our main file browser function. path is the tilde-expanded path we
* start browsing from. */
@@ -50,24 +48,18 @@ char *do_browser(char *path, DIR *dir)
{
char *retval = NULL;
int kbinput;
bool meta_key, func_key, old_const_update = ISSET(CONST_UPDATE);
bool abort = FALSE;
/* Whether we should abort the file browser. */
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;
/* The selected file we had before the current selected file. */
const sc *s;
const subnfunc *f;
functionptrtype func;
/* The function of the key the user typed in. */
curs_set(0);
blank_statusbar();
#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
currmenu = MBROWSER;
#endif
bottombars(MBROWSER);
wnoutrefresh(bottomwin);
@@ -96,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;
@@ -108,7 +100,7 @@ char *do_browser(char *path, DIR *dir)
titlebar(path);
while (!abort) {
while (TRUE) {
struct stat st;
int i;
size_t fileline = selected / width;
@@ -124,240 +116,216 @@ char *do_browser(char *path, DIR *dir)
old_selected = selected;
kbinput = get_kbinput(edit, &meta_key, &func_key);
kbinput = get_kbinput(edit);
#ifndef DISABLE_MOUSE
if (kbinput == KEY_MOUSE) {
if (kbinput == KEY_MOUSE) {
int mouse_x, mouse_y;
int mouse_x, mouse_y;
/* We can click on the edit window to select a
* filename. */
if (get_mouseinput(&mouse_x, &mouse_y, TRUE) == 0 &&
wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) {
/* longest is the width of each column. There
* are two spaces between each column. */
selected = (fileline / editwinrows) *
/* We can click on the edit window to select a
* filename. */
if (get_mouseinput(&mouse_x, &mouse_y, TRUE) == 0 &&
wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) {
/* longest is the width of each column. There
* are two spaces between each column. */
selected = (fileline / editwinrows) *
(editwinrows * width) + (mouse_y *
width) + (mouse_x / (longest + 2));
/* If they clicked beyond the end of a row,
* select the filename at the end of that
* row. */
if (mouse_x > width * (longest + 2))
selected--;
/* If they clicked beyond the end of a 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 (selected > filelist_len - 1)
selected = filelist_len - 1;
/* 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 (old_selected == selected)
unget_kbinput(sc_seq_or(do_enter_void, 0), FALSE, FALSE);
}
/* 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);
}
}
#endif /* !DISABLE_MOUSE */
parse_browser_input(&kbinput, &meta_key);
s = get_shortcut(MBROWSER, &kbinput, &meta_key);
if (!s)
continue;
f = sctofunc((sc *) s);
if (!f)
break;
func = parse_browser_input(&kbinput);
if (f->scfunc == total_refresh) {
total_redraw();
} else if (f->scfunc == do_help_void) {
if (func == total_refresh) {
total_redraw();
} else if (func == do_help_void) {
#ifndef DISABLE_HELP
do_help_void();
curs_set(0);
#else
nano_disabled_msg();
#endif
} else if (func == do_search) {
/* Search for a filename. */
} else if (f->scfunc == do_search) {
curs_set(1);
do_filesearch();
curs_set(0);
curs_set(1);
do_filesearch();
curs_set(0);
} else if (func == do_research) {
/* Search for another filename. */
} else if (f->scfunc == do_research) {
do_fileresearch();
} else if (f->scfunc == do_page_up) {
if (selected >= (editwinrows + fileline % editwinrows) *
width)
selected -= (editwinrows + fileline % editwinrows) *
width;
else
selected = 0;
} else if (f->scfunc == do_page_down) {
selected += (editwinrows - fileline % editwinrows) *
width;
if (selected > filelist_len - 1)
selected = filelist_len - 1;
} else if (f->scfunc == do_first_file) {
if (meta_key)
selected = 0;
} else if (f->scfunc == do_last_file) {
if (meta_key)
selected = filelist_len - 1;
do_fileresearch();
} else if (func == do_page_up) {
if (selected >= (editwinrows + fileline % editwinrows) * width)
selected -= (editwinrows + fileline % editwinrows) * width;
else
selected = 0;
} else if (func == do_page_down) {
selected += (editwinrows - fileline % editwinrows) * width;
if (selected > filelist_len - 1)
selected = filelist_len - 1;
} else if (func == do_first_file) {
selected = 0;
} else if (func == do_last_file) {
selected = filelist_len - 1;
} else if (func == goto_dir_void) {
/* Go to a specific directory. */
} else if (f->scfunc == goto_dir_void) {
curs_set(1);
i = do_prompt(TRUE,
curs_set(1);
i = do_prompt(TRUE,
#ifndef DISABLE_TABCOMP
FALSE,
#endif
MGOTODIR, ans,
&meta_key, &func_key,
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
NULL,
#endif
/* TRANSLATORS: This is a prompt. */
browser_refresh, _("Go To Directory"));
curs_set(0);
#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
currmenu = MBROWSER;
#endif
bottombars(MBROWSER);
curs_set(0);
bottombars(MBROWSER);
/* If the directory begins with a newline (i.e. an
* encoded null), treat it as though it's blank. */
if (i < 0 || *answer == '\n') {
/* We canceled. Indicate that on the statusbar, and
* blank out ans, since we're done with it. */
statusbar(_("Cancelled"));
ans = mallocstrcpy(ans, "");
continue;
} else if (i != 0) {
/* Put back the "Go to Directory" key and save
* answer in ans, so that the file list is displayed
* again, the prompt is displayed again, and what we
* typed before at the prompt is displayed again. */
unget_kbinput(sc_seq_or(do_gotolinecolumn_void, 0), FALSE, FALSE);
ans = mallocstrcpy(ans, answer);
continue;
}
/* We have a directory. Blank out ans, since we're done
* with it. */
/* If the directory begins with a newline (i.e. an
* encoded null), treat it as though it's blank. */
if (i < 0 || *answer == '\n') {
/* We canceled. Indicate that on the statusbar, and
* blank out ans, since we're done with it. */
statusbar(_("Cancelled"));
ans = mallocstrcpy(ans, "");
continue;
} else if (i != 0) {
/* Put back the "Go to Directory" key and save
* answer in ans, so that the file list is displayed
* again, the prompt is displayed again, and what we
* typed before at the prompt is displayed again. */
unget_kbinput(sc_seq_or(do_gotolinecolumn_void, 0), FALSE, FALSE);
ans = mallocstrcpy(ans, answer);
continue;
}
/* Convert newlines to nulls, just before we go to the
* directory. */
sunder(answer);
align(&answer);
/* We have a directory. Blank out ans, since we're done
* with it. */
ans = mallocstrcpy(ans, "");
new_path = real_dir_from_tilde(answer);
/* Convert newlines to nulls, just before we go to the
* directory. */
sunder(answer);
align(&answer);
if (new_path[0] != '/') {
new_path = charealloc(new_path, strlen(path) +
strlen(answer) + 1);
sprintf(new_path, "%s%s", path, answer);
}
new_path = real_dir_from_tilde(answer);
if (new_path[0] != '/') {
new_path = charealloc(new_path, strlen(path) +
strlen(answer) + 1);
sprintf(new_path, "%s%s", path, answer);
}
#ifndef DISABLE_OPERATINGDIR
if (check_operating_dir(new_path, FALSE)) {
statusbar(
_("Can't go outside of %s in restricted mode"),
operating_dir);
free(new_path);
continue;
}
if (check_operating_dir(new_path, FALSE)) {
statusbar(_("Can't go outside of %s in restricted mode"),
operating_dir);
free(new_path);
continue;
}
#endif
dir = opendir(new_path);
if (dir == NULL) {
/* We can't open this directory for some reason.
* Complain. */
statusbar(_("Error reading %s: %s"), answer,
strerror(errno));
beep();
free(new_path);
continue;
}
dir = opendir(new_path);
if (dir == NULL) {
/* We can't open this directory for some reason.
* Complain. */
statusbar(_("Error reading %s: %s"), answer,
strerror(errno));
beep();
free(new_path);
continue;
}
/* Start over again with the new path value. */
free(path);
path = new_path;
goto change_browser_directory;
} else if (f->scfunc == do_up_void) {
if (selected >= width)
selected -= width;
} else if (f->scfunc == do_left) {
if (selected > 0)
selected--;
} else if (f->scfunc == do_down_void) {
if (selected + width <= filelist_len - 1)
selected += width;
} else if (f->scfunc == do_right) {
if (selected < filelist_len - 1)
selected++;
} else if (f->scfunc == do_enter_void) {
/* We can't move up from "/". */
if (strcmp(filelist[selected], "/..") == 0) {
statusbar(_("Can't move up a directory"));
beep();
continue;
}
/* Start over again with the new path value. */
free(path);
path = new_path;
goto change_browser_directory;
} else if (func == do_up_void) {
if (selected >= width)
selected -= width;
} else if (func == do_down_void) {
if (selected + width <= filelist_len - 1)
selected += width;
} else if (func == do_left) {
if (selected > 0)
selected--;
} else if (func == do_right) {
if (selected < filelist_len - 1)
selected++;
} else if (func == do_enter_void) {
/* We can't move up from "/". */
if (strcmp(filelist[selected], "/..") == 0) {
statusbar(_("Can't move up a directory"));
beep();
continue;
}
#ifndef DISABLE_OPERATINGDIR
/* Note: The selected file can be outside the operating
* directory if it's ".." or if it's a symlink to a
* directory outside the operating directory. */
if (check_operating_dir(filelist[selected], FALSE)) {
statusbar(
_("Can't go outside of %s in restricted mode"),
operating_dir);
beep();
continue;
}
/* Note: The selected file can be outside the operating
* directory if it's ".." or if it's a symlink to a
* directory outside the operating directory. */
if (check_operating_dir(filelist[selected], FALSE)) {
statusbar(_("Can't go outside of %s in restricted mode"),
operating_dir);
beep();
continue;
}
#endif
if (stat(filelist[selected], &st) == -1) {
/* We can't open this file for some reason.
* Complain. */
statusbar(_("Error reading %s: %s"),
filelist[selected], strerror(errno));
beep();
continue;
}
if (stat(filelist[selected], &st) == -1) {
/* We can't open this file for some reason.
* Complain. */
statusbar(_("Error reading %s: %s"),
filelist[selected], strerror(errno));
beep();
continue;
}
/* If we've successfully opened a file, we're done, so
if (!S_ISDIR(st.st_mode)) {
/* We've successfully opened a file, we're done, so
* get out. */
if (!S_ISDIR(st.st_mode)) {
retval = mallocstrcpy(NULL, filelist[selected]);
abort = TRUE;
continue;
/* If we've successfully opened a directory, and it's
* "..", save the current directory in prev_dir, so that
* we can select it later. */
} else if (strcmp(tail(filelist[selected]), "..") == 0)
prev_dir = mallocstrcpy(NULL,
striponedir(filelist[selected]));
retval = mallocstrcpy(NULL, filelist[selected]);
break;
} else if (strcmp(tail(filelist[selected]), "..") == 0)
/* We've successfully opened the parent directory,
* save the current directory in prev_dir, so that
* we can easily return to it by hitting Enter. */
prev_dir = mallocstrcpy(NULL, striponedir(filelist[selected]));
dir = opendir(filelist[selected]);
if (dir == NULL) {
/* We can't open this directory for some reason.
* Complain. */
statusbar(_("Error reading %s: %s"),
filelist[selected], strerror(errno));
beep();
continue;
}
dir = opendir(filelist[selected]);
if (dir == NULL) {
/* We can't open this directory for some reason.
* Complain. */
statusbar(_("Error reading %s: %s"),
filelist[selected], strerror(errno));
beep();
continue;
}
path = mallocstrcpy(path, filelist[selected]);
path = mallocstrcpy(path, filelist[selected]);
/* Start over again with the new path value. */
goto change_browser_directory;
/* Abort the file browser. */
} else if (f->scfunc == do_exit) {
abort = TRUE;
/* Start over again with the new path value. */
goto change_browser_directory;
} else if (func == do_exit) {
/* Exit from the file browser. */
break;
}
}
titlebar(NULL);
@@ -461,7 +429,7 @@ void browser_init(const char *path, DIR *dir)
/* Don't show the "." entry. */
if (strcmp(nextdir->d_name, ".") == 0)
continue;
continue;
d_len = strlenpt(nextdir->d_name);
if (d_len > longest)
@@ -488,7 +456,7 @@ void browser_init(const char *path, DIR *dir)
while ((nextdir = readdir(dir)) != NULL && i < filelist_len) {
/* Don't show the "." entry. */
if (strcmp(nextdir->d_name, ".") == 0)
continue;
continue;
filelist[i] = charalloc(path_len + strlen(nextdir->d_name) + 1);
sprintf(filelist[i], "%s%s", path, nextdir->d_name);
@@ -540,46 +508,33 @@ void browser_init(const char *path, DIR *dir)
width = longest;
}
/* Determine the shortcut key corresponding to the values of kbinput
* (the key itself) and meta_key (whether the key is a meta sequence).
* Also convert certain non-shortcut keys into their corresponding
* shortcut keys. */
void parse_browser_input(int *kbinput, bool *meta_key)
/* Return the function that is bound to the given key, accepting certain
* plain characters too, for compatibility with Pico. */
functionptrtype parse_browser_input(int *kbinput)
{
get_shortcut(MBROWSER, kbinput, meta_key);
/* Pico compatibility. */
if (!*meta_key) {
if (!meta_key) {
switch (*kbinput) {
case ' ':
*kbinput = KEY_NPAGE;
break;
return do_page_down;
case '-':
*kbinput = KEY_PPAGE;
break;
return do_page_up;
case '?':
#ifndef DISABLE_HELP
*kbinput = sc_seq_or(do_help_void, 0);
#endif
break;
return do_help_void;
case 'E':
case 'e':
*kbinput = sc_seq_or(do_exit, 0);
break;
return do_exit;
case 'G':
case 'g':
*kbinput = sc_seq_or(goto_dir_void, 0);
break;
return goto_dir_void;
case 'S':
case 's':
*kbinput = sc_seq_or(do_enter_void, 0);
break;
return do_enter_void;
case 'W':
case 'w':
*kbinput = sc_seq_or(do_search, 0);
break;
return do_search;
}
}
return func_from_key(kbinput);
}
/* Set width to the number of files that we can display per line, if
@@ -618,8 +573,7 @@ void browser_refresh(void)
/* The maximum length of the file information in
* columns: seven for "--", "(dir)", or the file size,
* and 12 for "(parent dir)". */
bool dots = (COLS >= 15 && filetaillen >= longest -
foomaxlen - 1);
bool dots = (COLS >= 15 && filetaillen >= longest - foomaxlen - 1);
/* Do we put an ellipsis before the filename? Don't set
* this to TRUE if we have fewer than 15 columns (i.e.
* one column for padding, plus seven columns for a
@@ -729,58 +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;
bool meta_key, func_key;
const sc *s;
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);
@@ -788,189 +721,98 @@ 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,
&meta_key, &func_key,
#ifndef NANO_TINY
MWHEREISFILE, NULL,
#ifndef DISABLE_HISTORIES
&search_history,
#endif
browser_refresh, "%s%s%s%s%s", _("Search"),
#ifndef NANO_TINY
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") :
#endif
"",
#ifdef HAVE_REGEX_H
ISSET(USE_REGEXP) ? _(" [Regexp]") :
#endif
"",
#ifndef NANO_TINY
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") :
#endif
"", buf);
browser_refresh, "%s%s", _("Search"), buf);
/* 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;
} else {
s = get_shortcut(MBROWSER, &i, &meta_key);
if (i == -2 || i == 0) {
#ifdef HAVE_REGEX_H
/* Use last_search if answer is an empty string, or
* answer if it isn't. */
if (ISSET(USE_REGEXP) && !regexp_init((i == -2) ?
last_search : answer))
return -1;
#endif
} else
#ifndef NANO_TINY
if (s && s->scfunc == case_sens_void) {
TOGGLE(CASE_SENSITIVE);
backupstring = mallocstrcpy(backupstring, answer);
return 1;
} else if (s && s->scfunc == backwards_void) {
TOGGLE(BACKWARDS_SEARCH);
backupstring = mallocstrcpy(backupstring, answer);
return 1;
} else
#endif
#ifdef HAVE_REGEX_H
if (s && s->scfunc == regexp_void) {
TOGGLE(USE_REGEXP);
backupstring = mallocstrcpy(backupstring, answer);
return 1;
} else
#endif
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;
#ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH))
rev_start += strlen(rev_start);
#endif
/* 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 previous or next filename in the list. If we've
* reached the start or end of the list, wrap around. */
#ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH)) {
if (currselected > 0)
currselected--;
else {
currselected = filelist_len - 1;
statusbar(_("Search Wrapped"));
}
} else {
#endif
if (currselected < filelist_len - 1)
currselected++;
else {
currselected = 0;
statusbar(_("Search Wrapped"));
}
#ifndef NANO_TINY
/* Move to the next filename in the list. If we've reached the
* end of the list, wrap around. */
if (looking_at < filelist_len - 1)
looking_at++;
else {
looking_at = 0;
statusbar(_("Search Wrapped"));
}
#endif
/* 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;
#ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH))
rev_start += strlen(rev_start);
#endif
}
/* 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, displaying it, and
* decompiling the compiled regular expression we used in the last
* search, if any. */
void filesearch_abort(void)
{
currmenu = MBROWSER;
bottombars(MBROWSER);
#ifdef HAVE_REGEX_H
regexp_cleanup();
#endif
/* Select the one we've found. */
selected = looking_at;
}
/* Search for a filename. */
void do_filesearch(void)
{
size_t begin = selected;
int i;
bool didfind;
UNSET(CASE_SENSITIVE);
UNSET(USE_REGEXP);
UNSET(BACKWARDS_SEARCH);
i = filesearch_init();
if (i == -1) /* Cancel, blank search string, or regcomp()
* failed. */
filesearch_abort();
#if !defined(NANO_TINY) || defined(HAVE_REGEX_H)
else if (i == 1) /* Case Sensitive, Backwards, or Regexp search
* toggle. */
do_filesearch();
#endif
if (i != 0)
if (filesearch_init() != 0) {
/* Cancelled, or a blank search string, or done something. */
bottombars(MBROWSER);
return;
}
/* If answer is now "", copy last_search into answer. */
if (*answer == '\0')
@@ -978,63 +820,28 @@ void do_filesearch(void)
else
last_search = mallocstrcpy(last_search, answer);
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
/* If answer is not "", add this search string to the search history
* list. */
if (answer[0] != '\0')
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') {
#ifdef HAVE_REGEX_H
/* Since answer is "", use last_search! */
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
return;
#endif
findnextfile_wrap_reset();
didfind = findnextfile(FALSE, begin, answer);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
if (selected == begin && didfind) {
/* Do the search again, skipping over the current line. We
* should only end up back at the same position if the
* string isn't found again, in which case it's the only
* occurrence. */
didfind = findnextfile(TRUE, begin, answer);
if (selected == begin && !didfind)
statusbar(_("This is the only occurrence"));
}
} else
statusbar(_("No current search pattern"));
filesearch_abort();
if (last_search[0] == '\0')
statusbar(_("No current search pattern"));
else
findnextfile(last_search);
}
/* Select the first file in the list. */

View File

@@ -43,17 +43,6 @@ static const wchar_t bad_wchar = 0xFFFD;
static const char *const bad_mbchar = "\xEF\xBF\xBD";
static const int bad_mbchar_len = 3;
/* Concatenate two allocated strings. */
char* addstrings(char* str1, size_t len1, char* str2, size_t len2)
{
str1 = charealloc(str1, len1 + len2 + 1);
str1[len1] = '\0';
strncat(&str1[len1], str2, len2);
free(str2);
return str1;
}
/* Enable UTF-8 support. */
void utf8_init(void)
{
@@ -67,6 +56,18 @@ bool using_utf8(void)
}
#endif /* ENABLE_UTF8 */
/* Concatenate two allocated strings. */
char* addstrings(char* str1, size_t len1, char* str2, size_t len2)
{
str1 = charealloc(str1, len1 + len2 + 1);
str1[len1] = '\0';
strncat(&str1[len1], str2, len2);
free(str2);
return str1;
}
#ifndef HAVE_ISBLANK
/* This function is equivalent to isblank(). */
bool nisblank(int c)
@@ -483,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;

View File

@@ -155,18 +155,15 @@ void color_update(void)
colortype *tmpcolor, *defcolor = NULL;
regexlisttype *e;
/* Var magicstring will stay NULL if we fail to get a magic result. */
#ifdef HAVE_LIBMAGIC
const char *magicstring = NULL;
magic_t cookie = NULL;
struct stat fileinfo;
#endif
assert(openfile != NULL);
openfile->syntax = NULL;
openfile->colorstrings = NULL;
/* If the rcfiles were not read, or contained no syntaxes, get out. */
if (syntaxes == NULL)
return;
/* If we specified a syntax override string, use it. */
if (syntaxstr != NULL) {
/* If the syntax override is "none", it's the same as not having
@@ -262,6 +259,9 @@ void color_update(void)
#ifdef HAVE_LIBMAGIC
/* Check magic if we don't have an answer yet. */
if (openfile->colorstrings == NULL) {
struct stat fileinfo;
magic_t cookie = NULL;
const char *magicstring = NULL;
#ifdef DEBUG
fprintf(stderr, "No result from headerline either, trying libmagic...\n");
#endif
@@ -269,9 +269,9 @@ void color_update(void)
/* Open the magic database and get a diagnosis of the file. */
cookie = magic_open(MAGIC_SYMLINK |
#ifdef DEBUG
MAGIC_DEBUG | MAGIC_CHECK |
MAGIC_DEBUG | MAGIC_CHECK |
#endif
MAGIC_ERROR);
MAGIC_ERROR);
if (cookie == NULL || magic_load(cookie, NULL) < 0)
statusbar(_("magic_load() failed: %s"), strerror(errno));
else {

View File

@@ -37,6 +37,12 @@ void cutbuffer_reset(void)
keep_cutbuffer = FALSE;
}
/* Return the status of cutbuffer preservation. */
inline bool keeping_cutbuffer(void)
{
return keep_cutbuffer;
}
/* If we aren't on the last line of the file, move all the text of the
* current line, plus the newline at the end, into the cutbuffer. If we
* are, move all of the text of the current line into the cutbuffer. In
@@ -114,11 +120,11 @@ void cut_to_eof(void)
/* Move text from the current filestruct into the cutbuffer. If
* copy_text is TRUE, copy the text back into the filestruct afterward.
* If cut_till_end is TRUE, move all text from the current cursor
* If cut_till_eof is TRUE, move all text from the current cursor
* position to the end of the file into the cutbuffer. */
void do_cut_text(
#ifndef NANO_TINY
bool copy_text, bool cut_till_end, bool undoing
bool copy_text, bool cut_till_eof, bool undoing
#else
void
#endif
@@ -167,8 +173,8 @@ void do_cut_text(
keep_cutbuffer = TRUE;
#ifndef NANO_TINY
if (cut_till_end) {
/* If cut_till_end is TRUE, move all text up to the end of the
if (cut_till_eof) {
/* If cut_till_eof is TRUE, move all text up to the end of the
* file into the cutbuffer. */
cut_to_eof();
} else if (openfile->mark_set) {
@@ -209,14 +215,13 @@ void do_cut_text(
if (!old_no_newlines)
UNSET(NO_NEWLINES);
} else if (!undoing)
update_undo(cut_till_end ? CUT_EOF : CUT);
update_undo(cut_till_eof ? CUT_EOF : CUT);
/* Leave the text in the cutbuffer, and mark the file as
* modified. */
if (!copy_text) {
set_modified();
}
if (!copy_text)
#endif /* !NANO_TINY */
set_modified();
/* Update the screen. */
edit_refresh_needed = TRUE;
@@ -245,14 +250,24 @@ void do_cut_text_void(void)
#ifndef NANO_TINY
/* Move text from the current filestruct into the cutbuffer, and copy it
* back into the filestruct afterward. */
* back into the filestruct afterward. If the mark is set or the cursor
* was moved, blow away previous contents of the cutbuffer. */
void do_copy_text(void)
{
static struct filestruct *next_contiguous_line = NULL;
bool mark_set = openfile->mark_set;
if (mark_set || openfile->current != next_contiguous_line)
cutbuffer_reset();
do_cut_text(TRUE, FALSE, FALSE);
/* If the mark was set, blow away the cutbuffer on the next copy. */
next_contiguous_line = (mark_set ? NULL : openfile->current);
}
/* Cut from the current cursor position to the end of the file. */
void do_cut_till_end(void)
void do_cut_till_eof(void)
{
add_undo(CUT_EOF);
do_cut_text(FALSE, TRUE, FALSE);

View File

@@ -126,6 +126,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
pid_t mypid;
uid_t myuid;
struct passwd *mypwuid;
struct stat fileinfo;
char *lockdata = charalloc(1024);
char myhostname[32];
ssize_t lockdatalen = 1024;
@@ -145,8 +146,10 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
return -1;
}
if (delete_lockfile(lockfilename) < 0)
return -1;
/* Check if the lock exists before we try to delete it...*/
if (stat(lockfilename, &fileinfo) != -1)
if (delete_lockfile(lockfilename) < 0)
return -1;
if (ISSET(INSECURE_BACKUP))
cflags = O_WRONLY | O_CREAT | O_APPEND;
@@ -156,11 +159,13 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
fd = open(lockfilename, cflags,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
/* Maybe we just don't have write access. Don't stop us from
* opening the file at all, just don't set the lock_filename and
* return success. */
if (fd < 0 && errno == EACCES)
return 1;
/* Maybe we just don't have write access. Print an error message
and continue. */
if (fd < 0) {
statusbar(_("Error writing lock file %s: %s"), lockfilename,
strerror(errno));
return 0;
}
/* Now we've got a safe file stream. If the previous open() call
* failed, this will return NULL. */
@@ -190,12 +195,12 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
* our lockfile' message in here...
*
* This is likely very wrong, so this is a WIP. */
null_at(&lockdata, lockdatalen);
memset(lockdata, 0, lockdatalen);
lockdata[0] = 0x62;
lockdata[1] = 0x30;
lockdata[24] = mypid % 256;
lockdata[25] = mypid / 256;
snprintf(&lockdata[2], 10, "nano %s", VERSION);
snprintf(&lockdata[2], 11, "nano %s", VERSION);
strncpy(&lockdata[28], mypwuid->pw_name, 16);
strncpy(&lockdata[68], myhostname, 31);
strncpy(&lockdata[108], origfilename, 768);
@@ -210,7 +215,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
}
#ifdef DEBUG
fprintf(stderr, "In write_lockfile(), write successful (wrote %d bytes)\n", wroteamt);
fprintf(stderr, "In write_lockfile(), write successful (wrote %lu bytes)\n", (unsigned long)wroteamt);
#endif
if (fclose(filestream) == EOF) {
@@ -229,8 +234,8 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
int delete_lockfile(const char *lockfilename)
{
if (unlink(lockfilename) < 0 && errno != ENOENT) {
statusbar(_("Error deleting lock file %s: %s"), lockfilename,
strerror(errno));
statusbar(_("Error deleting lock file %s: %s"), lockfilename,
strerror(errno));
return -1;
}
return 1;
@@ -244,10 +249,11 @@ int do_lockfile(const char *filename)
{
char *lockdir = dirname((char *) mallocstrcpy(NULL, filename));
char *lockbase = basename((char *) mallocstrcpy(NULL, filename));
ssize_t lockfilesize = (sizeof (char *) * (strlen(filename)
+ strlen(locking_prefix) + strlen(locking_suffix) + 3));
char *lockfilename = (char *) nmalloc(lockfilesize);
char lockprog[12], lockuser[16];
size_t lockfilesize = strlen(filename) + strlen(locking_prefix)
+ strlen(locking_suffix) + 3;
char *lockfilename = charalloc(lockfilesize);
char *lockfiledir = NULL;
static char lockprog[11], lockuser[17];
struct stat fileinfo;
int lockfd, lockpid;
@@ -259,8 +265,8 @@ int do_lockfile(const char *filename)
if (stat(lockfilename, &fileinfo) != -1) {
ssize_t readtot = 0;
ssize_t readamt = 0;
char *lockbuf = (char *) nmalloc(8192);
char *promptstr = (char *) nmalloc(128);
char *lockbuf = charalloc(8192);
char *promptstr = charalloc(128);
int ans;
if ((lockfd = open(lockfilename, O_RDONLY)) < 0) {
statusbar(_("Error opening lock file %s: %s"),
@@ -278,7 +284,7 @@ int do_lockfile(const char *filename)
return -1;
}
strncpy(lockprog, &lockbuf[2], 10);
lockpid = lockbuf[25] * 256 + lockbuf[24];
lockpid = (unsigned char)lockbuf[25] * 256 + (unsigned char)lockbuf[24];
strncpy(lockuser, &lockbuf[28], 16);
#ifdef DEBUG
fprintf(stderr, "lockpid = %d\n", lockpid);
@@ -287,15 +293,25 @@ int do_lockfile(const char *filename)
fprintf(stderr, "user which created this lock file should be %s\n",
lockuser);
#endif
sprintf(promptstr, "File being edited (by %s, PID %d, user %s), continue?",
lockprog, lockpid, lockuser);
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
sprintf(promptstr, _("File %s is being edited (by %s with %s, PID %d); continue?"),
filename, lockuser, lockprog, lockpid);
ans = do_yesno_prompt(FALSE, promptstr);
if (ans < 1) {
blank_statusbar();
return -1;
}
} else {
lockfiledir = mallocstrcpy(NULL, lockfilename);
lockfiledir = dirname(lockfiledir);
if (stat(lockfiledir, &fileinfo) == -1) {
statusbar(_("Error writing lock file: Directory \'%s\' doesn't exist"),
lockfiledir);
return 0;
}
}
return write_lockfile(lockfilename, filename, FALSE);
}
#endif /* !NANO_TINY */
@@ -304,6 +320,7 @@ int do_lockfile(const char *filename)
* necessary, and then open and read the file, if applicable. */
void open_buffer(const char *filename, bool undoable)
{
bool quiet = FALSE;
bool new_buffer = (openfile == NULL
#ifndef DISABLE_MULTIBUFFER
|| ISSET(MULTIBUFFER)
@@ -327,13 +344,31 @@ void open_buffer(const char *filename, bool undoable)
/* If we're loading into a new buffer, add a new entry to
* openfile. */
if (new_buffer)
if (new_buffer) {
make_new_buffer();
#ifndef NANO_TINY
if (ISSET(LOCKING) && filename[0] != '\0') {
int lockstatus = do_lockfile(filename);
if (lockstatus < 0) {
#ifndef DISABLE_MULTIBUFFER
if (openfile->next) {
close_buffer(TRUE);
return;
}
#endif
} else if (lockstatus == 0) {
quiet = TRUE;
}
}
#endif
}
/* If the filename isn't blank, and we are not in NOREAD_MODE,
* open the file. Otherwise, treat it as a new file. */
rc = (filename[0] != '\0' && !ISSET(NOREAD_MODE)) ?
open_file(filename, new_buffer, &f) : -2;
open_file(filename, new_buffer, quiet, &f) : -2;
/* If we have a file, and we're loading into a new buffer, update
* the filename. */
@@ -385,7 +420,7 @@ void replace_buffer(const char *filename)
/* If the filename isn't blank, open the file. Otherwise, treat it
* as a new file. */
rc = (filename[0] != '\0') ? open_file(filename, TRUE, &f) : -2;
rc = (filename[0] != '\0') ? open_file(filename, TRUE, FALSE, &f) : -2;
/* Reinitialize the text of the current buffer. */
free_filestruct(openfile->fileage);
@@ -421,14 +456,15 @@ void display_buffer(void)
#ifndef DISABLE_MULTIBUFFER
/* Switch to the next file buffer if next_buf is TRUE. Otherwise,
* switch to the previous file buffer. */
void switch_to_prevnext_buffer(bool next_buf)
void switch_to_prevnext_buffer(bool next_buf, bool quiet)
{
assert(openfile != NULL);
/* If only one file buffer is open, indicate it on the statusbar and
* get out. */
if (openfile == openfile->next) {
statusbar(_("No more open file buffers"));
if (quiet == FALSE)
statusbar(_("No more open file buffers"));
return;
}
@@ -444,9 +480,10 @@ void switch_to_prevnext_buffer(bool next_buf)
display_buffer();
/* Indicate the switch on the statusbar. */
statusbar(_("Switched to %s"),
((openfile->filename[0] == '\0') ? _("New Buffer") :
openfile->filename));
if (quiet == FALSE)
statusbar(_("Switched to %s"),
((openfile->filename[0] == '\0') ? _("New Buffer") :
openfile->filename));
#ifdef DEBUG
dump_filestruct(openfile->current);
@@ -457,19 +494,21 @@ void switch_to_prevnext_buffer(bool next_buf)
/* Switch to the previous entry in the openfile filebuffer. */
void switch_to_prev_buffer_void(void)
{
switch_to_prevnext_buffer(FALSE);
switch_to_prevnext_buffer(FALSE, FALSE);
}
/* Switch to the next entry in the openfile filebuffer. */
void switch_to_next_buffer_void(void)
{
switch_to_prevnext_buffer(TRUE);
switch_to_prevnext_buffer(TRUE, FALSE);
}
/* Delete an entry from the openfile filebuffer, and switch to the one
* after it. Return TRUE on success, or FALSE if there are no more open
* file buffers. */
bool close_buffer(void)
* file buffers.
* quiet - should we print messages switching bufers
*/
bool close_buffer(bool quiet)
{
assert(openfile != NULL);
@@ -477,12 +516,12 @@ bool close_buffer(void)
if (openfile == openfile->next)
return FALSE;
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
update_poshistory(openfile->filename, openfile->current->lineno, xplustabs()+1);
#ifndef DISABLE_HISTORIES
update_poshistory(openfile->filename, openfile->current->lineno, xplustabs() + 1);
#endif
/* Switch to the next file buffer. */
switch_to_next_buffer_void();
switch_to_prevnext_buffer(TRUE, quiet);
/* Close the file buffer we had open before. */
unlink_opennode(openfile->prev);
@@ -878,7 +917,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
* Return -2 if we say "New File", -1 if the file isn't opened, and the
* fd opened otherwise. The file might still have an error while reading
* with a 0 return value. *f is set to the opened file. */
int open_file(const char *filename, bool newfie, FILE **f)
int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
{
struct stat fileinfo, fileinfo2;
int fd;
@@ -896,23 +935,19 @@ int open_file(const char *filename, bool newfie, FILE **f)
full_filename = mallocstrcpy(NULL, filename);
#ifndef NANO_TINY
if (ISSET(LOCKING))
if (do_lockfile(full_filename) < 0)
return -1;
#endif
if (stat(full_filename, &fileinfo) == -1) {
/* Well, maybe we can open the file even if the OS says it's
* not there. */
if ((fd = open(filename, O_RDONLY)) != -1) {
statusbar(_("Reading File"));
if (!quiet)
statusbar(_("Reading File"));
free(full_filename);
return 0;
}
if (newfie) {
statusbar(_("New File"));
if (!quiet)
statusbar(_("New File"));
return -2;
}
statusbar(_("\"%s\" not found"), filename);
@@ -1009,14 +1044,11 @@ void do_insertfile(
filestruct *edittop_save = openfile->edittop;
size_t current_x_save = openfile->current_x;
ssize_t current_y_save = openfile->current_y;
bool edittop_inside = FALSE, meta_key = FALSE, func_key = FALSE;
const sc *s;
bool edittop_inside = FALSE;
#ifndef NANO_TINY
bool right_side_up = FALSE, single_line = FALSE;
#endif
currmenu = MINSERTFILE;
while (TRUE) {
#ifndef NANO_TINY
if (execute) {
@@ -1026,17 +1058,16 @@ void do_insertfile(
_("Command to execute in new buffer [from %s] ") :
#endif
_("Command to execute [from %s] ");
} else {
#endif
} else
#endif /* NANO_TINY */
{
msg =
#ifndef DISABLE_MULTIBUFFER
ISSET(MULTIBUFFER) ?
_("File to insert into new buffer [from %s] ") :
#endif
_("File to insert [from %s] ");
#ifndef NANO_TINY
}
#endif
i = do_prompt(TRUE,
#ifndef DISABLE_TABCOMP
@@ -1046,8 +1077,7 @@ void do_insertfile(
execute ? MEXTCMD :
#endif
MINSERTFILE, ans,
&meta_key, &func_key,
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
NULL,
#endif
edit_refresh, msg,
@@ -1070,31 +1100,29 @@ void do_insertfile(
break;
} else {
size_t pww_save = openfile->placewewant;
functionptrtype func = func_from_key(&i);
ans = mallocstrcpy(ans, answer);
s = get_shortcut(currmenu, &i, &meta_key);
#ifndef NANO_TINY
#ifndef DISABLE_MULTIBUFFER
if (s && s->scfunc == new_buffer_void) {
if (func == new_buffer_void) {
/* Don't allow toggling if we're in view mode. */
if (!ISSET(VIEW_MODE))
TOGGLE(MULTIBUFFER);
else
beep();
continue;
} else
}
#endif
if (s && s->scfunc == ext_cmd_void) {
if (func == flip_execute_void) {
execute = !execute;
continue;
}
#ifndef DISABLE_BROWSER
else
#endif
#endif /* !NANO_TINY */
#ifndef DISABLE_BROWSER
if (s && s->scfunc == to_files_void) {
if (func == to_files_void) {
char *tmp = do_browse_from(answer);
if (tmp == NULL)
@@ -1118,18 +1146,18 @@ void do_insertfile(
continue;
#ifndef NANO_TINY
/* Keep track of whether the mark begins inside the
* partition and will need adjustment. */
if (openfile->mark_set) {
filestruct *top, *bot;
size_t top_x, bot_x;
/* Keep track of whether the mark begins inside the
* partition and will need adjustment. */
if (openfile->mark_set) {
filestruct *top, *bot;
size_t top_x, bot_x;
mark_order((const filestruct **)&top, &top_x,
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x,
&right_side_up);
single_line = (top == bot);
}
single_line = (top == bot);
}
#endif
#ifndef DISABLE_MULTIBUFFER
@@ -1188,18 +1216,19 @@ void do_insertfile(
}
#endif
#if !defined(DISABLE_MULTIBUFFER) && !defined(DISABLE_NANORC)
#if !defined(DISABLE_MULTIBUFFER) && !defined(DISABLE_HISTORIES)
if (ISSET(MULTIBUFFER)) {
/* Update the screen to account for the current
* buffer. */
display_buffer();
#ifndef NANO_TINY
ssize_t savedposline, savedposcol;
if (!execute && ISSET(POS_HISTORY)
&& check_poshistory(answer, &savedposline, &savedposcol))
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE, FALSE, FALSE);
if (ISSET(POS_HISTORY) &&
#ifndef NANO_TINY
!execute &&
#endif
check_poshistory(answer, &savedposline, &savedposcol))
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE, FALSE, FALSE);
} else
#endif
{
@@ -1280,7 +1309,7 @@ void do_insertfile(
void do_insertfile_void(void)
{
if (ISSET(RESTRICTED)) {
nano_disabled_msg();
nano_disabled_msg();
return;
}
@@ -1675,12 +1704,14 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
/* The file descriptor we use. */
mode_t original_umask = 0;
/* Our umask, from when nano started. */
#ifndef NANO_TINY
bool realexists;
/* The result of stat(). TRUE if the file exists, FALSE
* otherwise. If name is a link that points nowhere, realexists
* is FALSE. */
struct stat st;
/* The status fields filled in by stat(). */
#endif
bool anyexists;
/* The result of lstat(). The same as realexists, unless name
* is a link. */
@@ -1729,10 +1760,10 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
goto cleanup_and_exit;
}
#ifndef NANO_TINY
/* Check whether the file (at the end of the symlink) exists. */
realexists = (stat(realname, &st) != -1);
#ifndef NANO_TINY
/* If we haven't stat()d this file before (say, the user just
* specified it interactively), stat and save the value now,
* or else we will chase null pointers when we do modtime checks,
@@ -1840,7 +1871,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
if (ISSET(INSECURE_BACKUP))
backup_cflags = O_WRONLY | O_CREAT | O_APPEND;
else
else
backup_cflags = O_WRONLY | O_CREAT | O_EXCL | O_APPEND;
backup_fd = open(backupname, backup_cflags,
@@ -1856,8 +1887,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
goto cleanup_and_exit;
}
/* We shouldn't worry about chown()ing something if we're not
root, since it's likely to fail! */
/* We shouldn't worry about chown()ing something if we're not
* root, since it's likely to fail! */
if (geteuid() == NANO_ROOT_UID && fchown(backup_fd,
openfile->current_stat->st_uid, openfile->current_stat->st_gid) == -1
&& !ISSET(INSECURE_BACKUP)) {
@@ -2206,7 +2237,8 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
/* Write the current file to disk. If the mark is on, write the current
* marked selection to disk. If exiting is TRUE, write the file to disk
* regardless of whether the mark is on, and without prompting if the
* TEMP_FILE flag is set. Return TRUE on success or FALSE on error. */
* TEMP_FILE flag is set and the current file has a name. Return TRUE
* on success or FALSE on error. */
bool do_writeout(bool exiting)
{
int i;
@@ -2216,10 +2248,7 @@ bool do_writeout(bool exiting)
#ifndef DISABLE_EXTRA
static bool did_credits = FALSE;
#endif
bool retval = FALSE, meta_key = FALSE, func_key = FALSE;
const sc *s;
currmenu = MWRITEFILE;
bool retval = FALSE;
if (exiting && openfile->filename[0] != '\0' && ISSET(TEMP_FILE)) {
retval = write_file(openfile->filename, NULL, FALSE, OVERWRITE,
@@ -2271,8 +2300,7 @@ bool do_writeout(bool exiting)
TRUE,
#endif
MWRITEFILE, ans,
&meta_key, &func_key,
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
NULL,
#endif
edit_refresh, "%s%s%s", msg,
@@ -2290,11 +2318,12 @@ bool do_writeout(bool exiting)
retval = FALSE;
break;
} else {
functionptrtype func = func_from_key(&i);
ans = mallocstrcpy(ans, answer);
s = get_shortcut(currmenu, &i, &meta_key);
#ifndef DISABLE_BROWSER
if (s && s->scfunc == to_files_void) {
if (func == to_files_void) {
char *tmp = do_browse_from(answer);
if (tmp == NULL)
@@ -2306,26 +2335,26 @@ bool do_writeout(bool exiting)
} else
#endif /* !DISABLE_BROWSER */
#ifndef NANO_TINY
if (s && s->scfunc == dos_format_void) {
if (func == dos_format_void) {
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
DOS_FILE;
continue;
} else if (s && s->scfunc == mac_format_void) {
} else if (func == mac_format_void) {
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE :
MAC_FILE;
continue;
} else if (s && s->scfunc == backup_file_void) {
} else if (func == backup_file_void) {
TOGGLE(BACKUP_FILE);
continue;
} else
#endif /* !NANO_TINY */
if (s && s->scfunc == prepend_void) {
if (func == prepend_void) {
append = (append == PREPEND) ? OVERWRITE : PREPEND;
continue;
} else if (s && s->scfunc == append_void) {
} else if (func == append_void) {
append = (append == APPEND) ? OVERWRITE : APPEND;
continue;
} else if (s && s->scfunc == do_help_void) {
} else if (func == do_help_void) {
continue;
}
@@ -2409,8 +2438,10 @@ bool do_writeout(bool exiting)
/* Complain if the file exists, the name hasn't changed,
* and the stat information we had before does not match
* what we have now. */
else if (name_exists && openfile->current_stat && (openfile->current_stat->st_mtime < st.st_mtime ||
openfile->current_stat->st_dev != st.st_dev || openfile->current_stat->st_ino != st.st_ino)) {
else if (name_exists && openfile->current_stat &&
(openfile->current_stat->st_mtime < st.st_mtime ||
openfile->current_stat->st_dev != st.st_dev ||
openfile->current_stat->st_ino != st.st_ino)) {
i = do_yesno_prompt(FALSE,
_("File was modified since you opened it, continue saving ? "));
if (i == 0 || i == -1)
@@ -2892,8 +2923,8 @@ const char *tail(const char *foo)
return tmp;
}
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
/* Return the constructed dorfile path, or NULL if we can't find the home
#ifndef DISABLE_HISTORIES
/* Return the constructed dirfile path, or NULL if we can't find the home
* directory. The string is dynamically allocated, and should be
* freed. */
char *construct_filename(const char *str)
@@ -2930,7 +2961,7 @@ char *poshistfilename(void)
void history_error(const char *msg, ...)
{
va_list ap;
va_list ap;
va_start(ap, msg);
vfprintf(stderr, _(msg), ap);
@@ -2951,32 +2982,36 @@ int check_dotnano(void)
if (stat(nanodir, &dirstat) == -1) {
if (mkdir(nanodir, S_IRWXU | S_IRWXG | S_IRWXO) == -1) {
history_error(N_("Unable to create directory %s: %s\nIt is required for saving/loading search history or cursor position\n"),
nanodir, strerror(errno));
history_error(N_("Unable to create directory %s: %s\n"
"It is required for saving/loading search history or cursor positions.\n"),
nanodir, strerror(errno));
return 0;
}
} else if (!S_ISDIR(dirstat.st_mode)) {
history_error(N_("Path %s is not a directory and needs to be.\nNano will be unable to load or save search or cursor position history\n"));
history_error(N_("Path %s is not a directory and needs to be.\n"
"Nano will be unable to load or save search history or cursor positions.\n"),
nanodir);
return 0;
}
return 1;
}
/* Load histories from ~/.nano_history. */
/* Load the search and replace histories from ~/.nano/search_history. */
void load_history(void)
{
char *nanohist = histfilename();
char *legacyhist = legacyhistfilename();
struct stat hstat;
if (stat(legacyhist, &hstat) != -1 && stat(nanohist, &hstat) == -1) {
if (rename(legacyhist, nanohist) == -1)
history_error(N_("Detected a legacy nano history file (%s) which I tried to move\nto the preferred location (%s) but encountered an error: %s"),
legacyhist, nanohist, strerror(errno));
history_error(N_("Detected a legacy nano history file (%s) which I tried to move\n"
"to the preferred location (%s) but encountered an error: %s"),
legacyhist, nanohist, strerror(errno));
else
history_error(N_("Detected a legacy nano history file (%s) which I moved\nto the preferred location (%s)\n(see the nano FAQ about this change)"),
legacyhist, nanohist);
history_error(N_("Detected a legacy nano history file (%s) which I moved\n"
"to the preferred location (%s)\n(see the nano FAQ about this change)"),
legacyhist, nanohist);
}
/* Assume do_rcfile() has reported a missing home directory. */
@@ -3043,7 +3078,7 @@ bool writehist(FILE *hist, filestruct *h)
return TRUE;
}
/* Save histories to ~/.nano/search_history. */
/* Save the search and replace histories to ~/.nano/search_history. */
void save_history(void)
{
char *nanohist;
@@ -3078,7 +3113,7 @@ void save_history(void)
}
}
/* Analogs for the POS history. */
/* Save the recorded last file positions to ~/.nano/filepos_history. */
void save_poshistory(void)
{
char *poshist;
@@ -3098,10 +3133,10 @@ void save_poshistory(void)
* history file. */
chmod(poshist, S_IRUSR | S_IWUSR);
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
statusstr = charalloc(strlen(posptr->filename) + 2 * sizeof(ssize_t) + 4);
sprintf(statusstr, "%s %d %d\n", posptr->filename, (int) posptr->lineno,
(int) posptr->xno);
sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno,
(long)posptr->xno);
if (fwrite(statusstr, sizeof(char), strlen(statusstr), hist) < strlen(statusstr))
history_error(N_("Error writing %s: %s"), poshist,
strerror(errno));
@@ -3113,27 +3148,27 @@ void save_poshistory(void)
}
}
/* Update the POS history, given a filename line and column. If no
* entry is found, add a new entry on the end. */
/* Update the recorded last file positions, given a filename, a line
* and a column. If no entry is found, add a new one at the end. */
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
{
poshiststruct *posptr, *posprev = NULL;
char *fullpath = get_full_path(filename);
poshiststruct *posptr, *posprev = NULL;
char *fullpath = get_full_path(filename);
if (fullpath == NULL)
return;
return;
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
if (!strcmp(posptr->filename, fullpath)) {
if (!strcmp(posptr->filename, fullpath)) {
posptr->lineno = lineno;
posptr->xno = xpos;
return;
}
return;
}
posprev = posptr;
}
/* Didn't find it, make a new node yo! */
posptr = (poshiststruct *) nmalloc(sizeof(poshiststruct));
posptr = (poshiststruct *)nmalloc(sizeof(poshiststruct));
posptr->filename = mallocstrcpy(NULL, fullpath);
posptr->lineno = lineno;
posptr->xno = xpos;
@@ -3147,10 +3182,9 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
free(fullpath);
}
/* Check the POS history to see if file matches an existing entry. If
* so, return 1 and set line and column to the right values. Otherwise,
* return 0. */
/* Check the recorded last file positions to see if the given file
* matches an existing entry. If so, return 1 and set line and column
* to the retrieved values. Otherwise, return 0. */
int check_poshistory(const char *file, ssize_t *line, ssize_t *column)
{
poshiststruct *posptr;
@@ -3171,7 +3205,7 @@ int check_poshistory(const char *file, ssize_t *line, ssize_t *column)
return 0;
}
/* Load histories from ~/.nano_history. */
/* Load the recorded file positions from ~/.nano/filepos_history. */
void load_poshistory(void)
{
char *nanohist = poshistfilename();
@@ -3193,21 +3227,21 @@ void load_poshistory(void)
ssize_t read, lineno, xno;
poshiststruct *posptr;
/* See if we can find the file we're currently editing. */
/* Read and parse each line, and put the data into the
* positions history structure. */
while ((read = getline(&line, &buf_len, hist)) >= 0) {
if (read > 0 && line[read - 1] == '\n') {
read--;
line[read] = '\0';
}
if (read > 0) {
if (read > 0)
unsunder(line, read);
}
lineptr = parse_next_word(line);
xptr = parse_next_word(lineptr);
lineno = atoi(lineptr);
xno = atoi(xptr);
if (poshistory == NULL) {
poshistory = (poshiststruct *) nmalloc(sizeof(poshiststruct));
poshistory = (poshiststruct *)nmalloc(sizeof(poshiststruct));
poshistory->filename = mallocstrcpy(NULL, line);
poshistory->lineno = lineno;
poshistory->xno = xno;
@@ -3215,13 +3249,12 @@ void load_poshistory(void)
} else {
for (posptr = poshistory; posptr->next != NULL; posptr = posptr->next)
;
posptr->next = (poshiststruct *) nmalloc(sizeof(poshiststruct));
posptr->next = (poshiststruct *)nmalloc(sizeof(poshiststruct));
posptr->next->filename = mallocstrcpy(NULL, line);
posptr->next->lineno = lineno;
posptr->next->xno = xno;
posptr->next->next = NULL;
}
}
fclose(hist);
@@ -3230,5 +3263,4 @@ void load_poshistory(void)
free(nanohist);
}
}
#endif /* !NANO_TINY && !DISABLE_NANORC */
#endif /* !DISABLE_HISTORIES */

File diff suppressed because it is too large Load Diff

View File

@@ -37,23 +37,21 @@ static char *help_text = NULL;
void do_help(void (*refresh_func)(void))
{
int kbinput = ERR;
bool meta_key, func_key, old_no_help = ISSET(NO_HELP);
bool old_no_help = ISSET(NO_HELP);
size_t line = 0;
/* The line number in help_text of the first displayed help
* line. This variable is zero-based. */
size_t last_line = 0;
/* The line number in help_text of the last help line. This
* variable is zero-based. */
#ifndef DISABLE_MOUSE
int oldmenu = currmenu;
/* The menu we were called from. */
#endif
const char *ptr;
/* The current line of the help text. */
size_t old_line = (size_t)-1;
/* The line we were on before the current line. */
const sc *s;
const subnfunc *f;
functionptrtype func;
/* The function of the key the user typed in. */
curs_set(0);
blank_edit();
@@ -64,12 +62,6 @@ void do_help(void (*refresh_func)(void))
assert(help_text != NULL);
#ifndef DISABLE_MOUSE
/* Set currmenu to allow clicking on the help screen's shortcut
* list, after help_init() is called. */
currmenu = MHELP;
#endif
if (ISSET(NO_HELP)) {
/* Make sure that the help screen's shortcut list will actually
* be displayed. */
@@ -123,65 +115,53 @@ void do_help(void (*refresh_func)(void))
old_line = line;
kbinput = get_kbinput(edit, &meta_key, &func_key);
kbinput = get_kbinput(edit);
#ifndef DISABLE_MOUSE
if (kbinput == KEY_MOUSE) {
int mouse_x, mouse_y;
get_mouseinput(&mouse_x, &mouse_y, TRUE);
continue; /* Redraw the screen. */
int mouse_x, mouse_y;
get_mouseinput(&mouse_x, &mouse_y, TRUE);
continue; /* Redraw the screen. */
}
#endif
parse_help_input(&kbinput, &meta_key);
s = get_shortcut(MHELP, &kbinput, &meta_key);
if (!s)
continue;
f = sctofunc((sc *) s);
if (!f)
continue;
func = parse_help_input(&kbinput);
if (f->scfunc == total_refresh) {
total_redraw();
} else if (f->scfunc == do_page_up) {
if (line > editwinrows - 2)
line -= editwinrows - 2;
else
line = 0;
} else if (f->scfunc == do_page_down) {
if (line + (editwinrows - 1) < last_line)
line += editwinrows - 2;
} else if (f->scfunc == do_up_void) {
if (line > 0)
line--;
} else if (f->scfunc == do_down_void) {
if (line + (editwinrows - 1) < last_line)
line++;
} else if (f->scfunc == do_first_line) {
if (meta_key)
line = 0;
} else if (f->scfunc == do_last_line) {
if (meta_key) {
if (line + (editwinrows - 1) < last_line)
line = last_line - (editwinrows - 1);
}
} else if (f->scfunc == do_exit) {
/* Abort the help browser. */
if (func == total_refresh) {
total_redraw();
} else if (func == do_page_up) {
if (line > editwinrows - 2)
line -= editwinrows - 2;
else
line = 0;
} else if (func == do_page_down) {
if (line + (editwinrows - 1) < last_line)
line += editwinrows - 2;
} else if (func == do_up_void) {
if (line > 0)
line--;
} else if (func == do_down_void) {
if (line + (editwinrows - 1) < last_line)
line++;
} else if (func == do_first_line) {
line = 0;
} else if (func == do_last_line) {
if (line + (editwinrows - 1) < last_line)
line = last_line - (editwinrows - 1);
} else if (func == do_exit) {
/* Exit from the help browser. */
break;
}
}
#ifndef DISABLE_MOUSE
currmenu = oldmenu;
#endif
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();
@@ -419,9 +399,6 @@ void help_init(void)
if ((f->menus & currmenu) == 0)
continue;
if (!f->desc || !strcmp(f->desc, ""))
continue;
/* Let's simply show the first two shortcuts from the list. */
for (s = sclist, scsfound = 0; s != NULL; s = s->next) {
@@ -479,29 +456,22 @@ void help_init(void)
assert(strlen(help_text) <= allocsize + 1);
}
/* Determine the shortcut key corresponding to the values of kbinput
* (the key itself) and meta_key (whether the key is a meta sequence).
* Also convert certain non-shortcut keys into their corresponding
* shortcut keys. */
void parse_help_input(int *kbinput, bool *meta_key)
/* Return the function that is bound to the given key, accepting certain
* plain characters too, for consistency with the file browser. */
functionptrtype parse_help_input(int *kbinput)
{
get_shortcut(MHELP, kbinput, meta_key);
if (!*meta_key) {
if (!meta_key) {
switch (*kbinput) {
/* For consistency with the file browser. */
case ' ':
*kbinput = KEY_NPAGE;
break;
return do_page_down;
case '-':
*kbinput = KEY_PPAGE;
break;
return do_page_up;
case 'E':
case 'e':
*kbinput = sc_seq_or(do_exit, 0);
break;
return do_exit;
}
}
return func_from_key(kbinput);
}
/* Calculate the next line of help_text, starting at ptr. */

View File

@@ -55,7 +55,10 @@ void do_page_up(void)
/* If there's less than a page of text left on the screen, put the
* cursor at the beginning of the first line of the file, and then
* update the edit window. */
if (openfile->current->lineno == 1 || (!ISSET(SOFTWRAP) &&
if (openfile->current->lineno == 1 || (
#ifndef NANO_TINY
!ISSET(SOFTWRAP) &&
#endif
openfile->current->lineno <= editwinrows - 2)) {
do_first_line();
return;
@@ -63,7 +66,6 @@ void do_page_up(void)
/* If we're not in smooth scrolling mode, put the cursor at the
* beginning of the top line of the edit window, as Pico does. */
#ifndef NANO_TINY
if (!ISSET(SMOOTH_SCROLL)) {
#endif
@@ -76,13 +78,15 @@ void do_page_up(void)
for (i = editwinrows - 2; i - skipped > 0 && openfile->current !=
openfile->fileage; i--) {
openfile->current = openfile->current->prev;
#ifndef NANO_TINY
if (ISSET(SOFTWRAP) && openfile->current) {
skipped += strlenpt(openfile->current->data) / COLS;
#ifdef DEBUG
fprintf(stderr, "do_page_up: i = %d, skipped = %d based on line %lu len %d\n",
i, skipped, (unsigned long) openfile->current->lineno, strlenpt(openfile->current->data));
fprintf(stderr, "do_page_up: i = %d, skipped = %d based on line %ld len %lu\n",
i, skipped, (long)openfile->current->lineno, (unsigned long)strlenpt(openfile->current->data));
#endif
}
#endif
}
openfile->current_x = actual_x(openfile->current->data,
@@ -90,7 +94,7 @@ void do_page_up(void)
#ifdef DEBUG
fprintf(stderr, "do_page_up: openfile->current->lineno = %lu, skipped = %d\n",
(unsigned long) openfile->current->lineno, skipped);
(unsigned long)openfile->current->lineno, skipped);
#endif
/* Scroll the edit window up a page. */
@@ -126,7 +130,7 @@ void do_page_down(void)
openfile->filebot; i--) {
openfile->current = openfile->current->next;
#ifdef DEBUG
fprintf(stderr, "do_page_down: moving to line %lu\n", (unsigned long) openfile->current->lineno);
fprintf(stderr, "do_page_down: moving to line %lu\n", (unsigned long)openfile->current->lineno);
#endif
}
@@ -514,12 +518,12 @@ void do_up(
* smooth scrolling mode, or up half a page if we're not. If
* scroll_only is TRUE, scroll the edit window up one line
* unconditionally. */
if (openfile->current_y == 0 || (ISSET(SOFTWRAP) && openfile->edittop->lineno == openfile->current->next->lineno)
if (openfile->current_y == 0
#ifndef NANO_TINY
|| scroll_only
|| (ISSET(SOFTWRAP) && openfile->edittop->lineno == openfile->current->next->lineno) || scroll_only
#endif
)
edit_scroll(UP_DIR,
edit_scroll(UPWARD,
#ifndef NANO_TINY
(ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 :
#endif
@@ -612,7 +616,7 @@ void do_down(
if (amount < 1 || scroll_only)
amount = 1;
#endif
edit_scroll(DOWN_DIR,
edit_scroll(DOWNWARD,
#ifndef NANO_TINY
(ISSET(SMOOTH_SCROLL) || scroll_only) ? amount :
#endif
@@ -623,7 +627,11 @@ void do_down(
* we were on before and the line we're on now. The former needs to
* be redrawn if we're not on the first page, and the latter needs
* to be drawn unconditionally. */
if (ISSET(SOFTWRAP) || openfile->current_y < editwinrows - 1) {
if (openfile->current_y < editwinrows - 1
#ifndef NANO_TINY
|| ISSET(SOFTWRAP)
#endif
) {
if (need_vertical_update(0))
update_line(openfile->current->prev, 0);
update_line(openfile->current, openfile->current_x);

View File

@@ -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;
@@ -360,10 +361,12 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
*file_bot = openfile->filebot;
}
openfile->fileage->next = NULL;
free_filestruct(openfile->fileage);
/* 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
@@ -447,6 +450,7 @@ void copy_from_filestruct(filestruct *somebuffer)
/* Put the top and bottom of the current filestruct at the top and
* bottom of a copy of the passed buffer. */
free_filestruct(openfile->fileage);
openfile->fileage = copy_filestruct(somebuffer);
openfile->filebot = openfile->fileage;
while (openfile->filebot->next != NULL)
@@ -612,11 +616,11 @@ void finish(void)
/* Restore the old terminal settings. */
tcsetattr(0, TCSANOW, &oldterm);
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
if (!no_rcfiles && ISSET(HISTORYLOG))
#ifndef DISABLE_HISTORIES
if (ISSET(HISTORYLOG))
save_history();
if (!no_rcfiles && ISSET(POS_HISTORY)) {
update_poshistory(openfile->filename, openfile->current->lineno, xplustabs()+1);
if (ISSET(POS_HISTORY)) {
update_poshistory(openfile->filename, openfile->current->lineno, xplustabs() + 1);
save_poshistory();
}
#endif
@@ -715,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);
@@ -734,7 +738,7 @@ void die_save_file(const char *die_filename
void window_init(void)
{
/* If the screen height is too small, get out. */
editwinrows = LINES - 5 + no_more_space() + no_help();
editwinrows = LINES - 5 + more_space() + no_help();
if (COLS < MIN_EDITOR_COLS || editwinrows < MIN_EDITOR_ROWS)
die(_("Window size is too small for nano...\n"));
@@ -755,10 +759,10 @@ void window_init(void)
delwin(bottomwin);
/* Set up the windows. */
topwin = newwin(2 - no_more_space(), COLS, 0, 0);
edit = newwin(editwinrows, COLS, 2 - no_more_space(), 0);
topwin = newwin(2 - more_space(), COLS, 0, 0);
edit = newwin(editwinrows, COLS, 2 - more_space(), 0);
bottomwin = newwin(3 - no_help(), COLS, editwinrows + (2 -
no_more_space()), 0);
more_space()), 0);
/* Turn the keypad on for the windows, if necessary. */
if (!ISSET(REBIND_KEYPAD)) {
@@ -856,13 +860,15 @@ void usage(void)
#ifndef DISABLE_MULTIBUFFER
print_opt("-F", "--multibuffer", N_("Enable multiple file buffers"));
#endif
#ifndef DISABLE_NANORC
#ifndef NANO_TINY
print_opt("-G", "--locking",
N_("Use (vim-style) lock files"));
#endif
#ifndef DISABLE_HISTORIES
print_opt("-H", "--historylog",
N_("Log & read search/replace string history"));
#endif
#ifndef DISABLE_NANORC
print_opt("-I", "--ignorercfiles",
N_("Don't look at nanorc files"));
#endif
@@ -875,7 +881,7 @@ void usage(void)
N_("Don't convert files from DOS/Mac format"));
#endif
print_opt("-O", "--morespace", N_("Use one more line for editing"));
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
print_opt("-P", "--poslog",
N_("Log & read location of cursor position"));
#endif
@@ -906,8 +912,8 @@ void usage(void)
print_opt("-c", "--const", N_("Constantly show cursor position"));
print_opt("-d", "--rebinddelete",
N_("Fix Backspace/Delete confusion problem"));
#ifndef NANO_TINY
print_opt("-h", "--help", N_("Show this help text"));
#ifndef NANO_TINY
print_opt("-i", "--autoindent",
N_("Automatically indent new lines"));
print_opt("-k", "--cut", N_("Cut from cursor to end of line"));
@@ -924,8 +930,10 @@ void usage(void)
#endif
print_opt("-p", "--preserve",
N_("Preserve XON (^Q) and XOFF (^S) keys"));
#ifndef DISABLE_NANORC
print_opt("-q", "--quiet",
N_("Silently ignore startup issues like rc file errors"));
#endif
#ifndef DISABLE_WRAPJUSTIFY
print_opt(_("-r <#cols>"), _("--fill=<#cols>"),
N_("Set hard-wrapping point at column #cols"));
@@ -936,10 +944,6 @@ void usage(void)
#endif
print_opt("-t", "--tempfile",
N_("Auto save on exit, don't prompt"));
#ifndef NANO_TINY
print_opt("-u", "--undo", N_("Allow generic undo [EXPERIMENTAL]"));
#endif
print_opt("-v", "--view", N_("View mode (read-only)"));
#ifndef DISABLE_WRAPPING
print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines"));
@@ -956,9 +960,8 @@ void usage(void)
* it was compiled with. */
void version(void)
{
printf(_(" GNU nano version %s (compiled %s, %s)\n"), VERSION,
__TIME__, __DATE__);
printf(" (C) 1999..2014 Free Software Foundation, Inc.\n");
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/"));
printf(_("\n Compiled options:"));
@@ -977,6 +980,9 @@ void version(void)
#ifndef DISABLE_HELP
printf(" --enable-help");
#endif
#ifndef DISABLE_HISTORIES
printf(" --enable-histories");
#endif
#ifndef DISABLE_JUSTIFY
printf(" --enable-justify");
#endif
@@ -1017,6 +1023,9 @@ void version(void)
#ifdef DISABLE_HELP
printf(" --disable-help");
#endif
#ifdef DISABLE_HISTORIES
printf(" --disable-histories");
#endif
#ifdef DISABLE_JUSTIFY
printf(" --disable-justify");
#endif
@@ -1067,16 +1076,15 @@ void version(void)
}
/* Return 1 if the MORE_SPACE flag is set, and 0 otherwise. This is
* used to calculate the relative screen position while taking this flag
* into account, since it adds one line to the edit window. */
int no_more_space(void)
* used to calculate the sizes and Y coordinates of the subwindows. */
int more_space(void)
{
return ISSET(MORE_SPACE) ? 1 : 0;
}
/* Return 2 if the NO_HELP flag is set, and 0 otherwise. This is used
* to calculate the relative screen position while taking this flag into
* account, since it removes two lines from the edit window. */
* to calculate the sizes and Y coordinates of the subwindows, because
* having NO_HELP adds two lines to the edit window. */
int no_help(void)
{
return ISSET(NO_HELP) ? 2 : 0;
@@ -1090,9 +1098,10 @@ void nano_disabled_msg(void)
/* If the current file buffer has been modified, and the TEMP_FILE flag
* isn't set, ask whether or not to save the file buffer. If the
* TEMP_FILE flag is set, save it unconditionally. Then, if more than
* one file buffer is open, close the current file buffer and switch to
* the next one. If only one file buffer is open, exit from nano. */
* TEMP_FILE flag is set and the current file has a name, save it
* unconditionally. Then, if more than one file buffer is open, close
* the current file buffer and switch to the next one. If only one file
* buffer is open, exit from nano. */
void do_exit(void)
{
int i;
@@ -1101,13 +1110,31 @@ void do_exit(void)
* save. */
if (!openfile->modified)
i = 0;
/* If the TEMP_FILE flag is set, pretend the user chose to save. */
else if (ISSET(TEMP_FILE))
/* If the TEMP_FILE flag is set and the current file has a name,
* pretend the user chose to save. */
else if (openfile->filename[0] != '\0' && ISSET(TEMP_FILE))
i = 1;
/* Otherwise, ask the user whether or not to save. */
else
else {
/* If the TEMP_FILE flag is set, and the current file doesn't
* have a name, handle it the same way Pico does. */
if (ISSET(TEMP_FILE)) {
curs_set(0);
/* Warn that the current file has no name. */
statusbar(_("No file name"));
beep();
/* Ensure that we see the warning. */
doupdate();
napms(2000);
curs_set(1);
}
i = do_yesno_prompt(FALSE,
_("Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "));
}
#ifdef DEBUG
dump_filestruct(openfile->fileage);
@@ -1118,13 +1145,13 @@ 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
/* Exit only if there are no more open file buffers. */
if (!close_buffer())
if (!close_buffer(FALSE))
#endif
finish();
/* If the user canceled, we go on. */
@@ -1153,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();
}
@@ -1174,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;
}
@@ -1186,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");
@@ -1256,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;
}
@@ -1433,11 +1458,9 @@ void do_toggle(int flag)
#endif
#ifndef DISABLE_COLOR
case NO_COLOR_SYNTAX:
edit_refresh();
break;
#endif
case SOFTWRAP:
total_refresh();
edit_refresh();
break;
}
@@ -1456,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. */
@@ -1565,11 +1588,10 @@ void terminal_init(void)
}
/* Read in a character, interpret it as a shortcut or toggle if
* necessary, and return it. Set meta_key to TRUE if the character is a
* meta sequence, set func_key to TRUE if the character is a function key.
* necessary, and return it.
* If allow_funcs is FALSE, don't actually run any functions associated
* with shortcut keys. */
int do_input(bool *meta_key, bool *func_key, bool allow_funcs)
int do_input(bool allow_funcs)
{
int input;
/* The character we read in. */
@@ -1577,32 +1599,29 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs)
/* The input buffer. */
static size_t kbinput_len = 0;
/* The length of the input buffer. */
bool cut_copy = FALSE;
/* Are we cutting or copying text? */
bool preserve = FALSE;
/* Preserve the contents of the cutbuffer? */
const sc *s;
bool have_shortcut;
/* Read in a character. */
input = get_kbinput(edit, meta_key, func_key);
input = get_kbinput(edit);
#ifndef DISABLE_MOUSE
if (allow_funcs) {
/* If we got a mouse click and it was on a shortcut, read in the
* shortcut character. */
if (*func_key && input == KEY_MOUSE) {
if (do_mouse() == 1)
input = get_kbinput(edit, meta_key, func_key);
else {
*meta_key = FALSE;
*func_key = FALSE;
input = ERR;
}
}
if (func_key && input == KEY_MOUSE) {
/* We received a mouse click. */
if (do_mouse() == 1)
/* The click was on a shortcut -- read in the character
* that it was converted into. */
input = get_kbinput(edit);
else
/* The click was invalid or has been handled -- get out. */
return ERR;
}
#endif
/* Check for a shortcut in the main list. */
s = get_shortcut(MMAIN, &input, meta_key);
s = get_shortcut(&input);
/* If we got a shortcut from the main list, or a "universal"
* edit window shortcut, set have_shortcut to TRUE. */
@@ -1611,11 +1630,11 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs)
/* If we got a non-high-bit control key, a meta key sequence, or a
* function key, and it's not a shortcut or toggle, throw it out. */
if (!have_shortcut) {
if (is_ascii_cntrl_char(input) || *meta_key || *func_key) {
if (is_ascii_cntrl_char(input) || meta_key || func_key) {
statusbar(_("Unknown Command"));
beep();
*meta_key = FALSE;
*func_key = FALSE;
meta_key = FALSE;
func_key = FALSE;
input = ERR;
}
}
@@ -1642,12 +1661,11 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs)
* output all the characters in the input buffer if it isn't
* empty. Note that it should be empty if we're in view
* mode. */
if (have_shortcut || get_key_buffer_len() == 0) {
if (have_shortcut || get_key_buffer_len() == 0) {
#ifndef DISABLE_WRAPPING
/* If we got a shortcut or toggle, and it's not the shortcut
* for verbatim input, turn off prepending of wrapped text. */
if (have_shortcut && (!have_shortcut || s == NULL || s->scfunc !=
do_verbatim_input))
if (have_shortcut && s->scfunc != do_verbatim_input)
wrap_reset();
#endif
@@ -1673,55 +1691,51 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs)
}
if (have_shortcut) {
switch (input) {
/* Handle the normal edit-window shortcuts. */
default:
/* If the function associated with this shortcut is
* cutting or copying text, indicate this. */
if (s->scfunc == do_cut_text_void
/* If the function associated with this shortcut is
* cutting or copying text, remember this. */
if (s->scfunc == do_cut_text_void
#ifndef NANO_TINY
|| s->scfunc == do_copy_text || s->scfunc ==
do_cut_till_end
|| s->scfunc == do_copy_text || s->scfunc == do_cut_till_eof
#endif
)
cut_copy = TRUE;
)
preserve = TRUE;
if (s->scfunc != 0) {
const subnfunc *f = sctofunc((sc *) s);
if (ISSET(VIEW_MODE) && f && !f->viewok)
print_view_warning();
else {
if (s->scfunc != 0) {
const subnfunc *f = sctofunc((sc *) s);
if (ISSET(VIEW_MODE) && f && !f->viewok)
print_view_warning();
else {
#ifndef NANO_TINY
if (s->scfunc == do_toggle_void)
do_toggle(s->toggle);
else
if (s->scfunc == do_toggle_void) {
do_toggle(s->toggle);
if (s->toggle != CUT_TO_END)
preserve = TRUE;
} else
#endif
{
s->scfunc();
{
/* Execute the function of the shortcut. */
s->scfunc();
#ifndef DISABLE_COLOR
if (f && !f->viewok && openfile->syntax != NULL
&& openfile->syntax->nmultis > 0) {
reset_multis(openfile->current, FALSE);
}
if (f && !f->viewok && openfile->syntax != NULL
&& openfile->syntax->nmultis > 0)
reset_multis(openfile->current, FALSE);
#endif
if (edit_refresh_needed) {
if (edit_refresh_needed) {
#ifdef DEBUG
fprintf(stderr, "running edit_refresh() as edit_refresh_needed is true\n");
fprintf(stderr, "running edit_refresh() as edit_refresh_needed is true\n");
#endif
edit_refresh();
edit_refresh_needed = FALSE;
}
}
edit_refresh();
edit_refresh_needed = FALSE;
}
}
break;
}
}
}
}
/* If we aren't cutting or copying text, blow away the text in the
* cutbuffer. */
if (!cut_copy)
/* If we aren't cutting or copying text, and the key wasn't a toggle,
* blow away the text in the cutbuffer upon the next cutting action. */
if (!preserve)
cutbuffer_reset();
return input;
@@ -1745,8 +1759,12 @@ int do_mouse(void)
int mouse_x, mouse_y;
int retval = get_mouseinput(&mouse_x, &mouse_y, TRUE);
if (retval != 0)
/* The click is wrong or already handled. */
return retval;
/* We can click on the edit window to move the cursor. */
if (retval == 0 && wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) {
if (wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) {
bool sameline;
/* Did they click on the line with the cursor? If they
* clicked on the cursor, we set the mark. */
@@ -1759,20 +1777,21 @@ int do_mouse(void)
sameline = (mouse_y == openfile->current_y);
#ifdef DEBUG
fprintf(stderr, "mouse_y = %d, current_y = %d\n", mouse_y, openfile->current_y);
fprintf(stderr, "mouse_y = %d, current_y = %ld\n", mouse_y, (long)openfile->current_y);
#endif
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
int i = 0;
size_t i = 0;
for (openfile->current = openfile->edittop;
openfile->current->next && i < mouse_y;
openfile->current = openfile->current->next, i++) {
openfile->current_y = i;
i += strlenpt(openfile->current->data) / COLS;
}
#ifdef DEBUG
fprintf(stderr, "do_mouse(): moving to current_y = %d, i %d\n", openfile->current_y, i);
fprintf(stderr, "do_mouse(): moving to current_y = %ld, index i = %lu\n",
(long)openfile->current_y, (unsigned long)i);
fprintf(stderr, " openfile->current->data = \"%s\"\n", openfile->current->data);
#endif
@@ -1780,18 +1799,19 @@ int do_mouse(void)
openfile->current = openfile->current->prev;
openfile->current_x = actual_x(openfile->current->data, mouse_x + (mouse_y - openfile->current_y) * COLS);
#ifdef DEBUG
fprintf(stderr, "do_mouse(): i > mouse_y, mouse_x = %d, current_x to = %d\n", mouse_x, openfile->current_x);
fprintf(stderr, "do_mouse(): i > mouse_y, mouse_x = %d, current_x to = %lu\n",
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 = %d\n", mouse_x, openfile->current_x);
fprintf(stderr, "do_mouse(): i <= mouse_y, mouse_x = %d, setting current_x to = %lu\n",
mouse_x, (unsigned long)openfile->current_x);
#endif
}
openfile->placewewant = xplustabs();
} else {
} else
#endif /* NANO_TINY */
{
/* Move to where the click occurred. */
for (; openfile->current_y < mouse_y && openfile->current !=
openfile->filebot; openfile->current_y++)
@@ -1802,22 +1822,26 @@ int do_mouse(void)
openfile->current_x = actual_x(openfile->current->data,
get_page_start(xplustabs()) + mouse_x);
openfile->placewewant = xplustabs();
}
openfile->placewewant = xplustabs();
#ifndef NANO_TINY
/* Clicking where the cursor is toggles the mark, as does
* clicking beyond the line length with the cursor at the end of
* the line. */
if (sameline && openfile->current_x == current_x_save)
do_mark();
else
#endif
/* The cursor moved; clean the cutbuffer on the next cut. */
cutbuffer_reset();
edit_redraw(current_save, pww_save);
}
return retval;
/* No more handling is needed. */
return 2;
}
#endif /* !DISABLE_MOUSE */
@@ -1825,7 +1849,7 @@ int do_mouse(void)
void alloc_multidata_if_needed(filestruct *fileptr)
{
if (!fileptr->multidata)
fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
}
/* Precalculate the multi-line start and end regex info so we can
@@ -1860,7 +1884,7 @@ void precalc_multicolorinfo(void)
int startx = 0;
int nostart = 0;
#ifdef DEBUG
fprintf(stderr, "working on lineno %lu... ", (unsigned long) fileptr->lineno);
fprintf(stderr, "working on lineno %ld... ", (long)fileptr->lineno);
#endif
alloc_multidata_if_needed(fileptr);
@@ -1877,7 +1901,7 @@ void precalc_multicolorinfo(void)
* encompassed, which should speed up rendering later. */
startx += startmatch.rm_eo;
#ifdef DEBUG
fprintf(stderr, "start found at pos %d... ", startx);
fprintf(stderr, "start found at pos %lu... ", (unsigned long)startx);
#endif
/* Look first on this line for an end. */
@@ -1894,7 +1918,7 @@ void precalc_multicolorinfo(void)
/* Nice, we didn't find the end regex on this line. Let's start looking for it. */
for (endptr = fileptr->next; endptr != NULL; endptr = endptr->next) {
#ifdef DEBUG
fprintf(stderr, "\nadvancing to line %lu to find end... ", (unsigned long) endptr->lineno);
fprintf(stderr, "\nadvancing to line %ld to find end... ", (long)endptr->lineno);
#endif
/* Check for keyboard input, again. */
if ((cur_check = time(NULL)) - last_check > 1) {
@@ -1903,7 +1927,7 @@ void precalc_multicolorinfo(void)
goto precalc_cleanup;
}
if (regexec(tmpcolor->end, endptr->data, 1, &endmatch, 0) == 0)
break;
break;
}
if (endptr == NULL) {
@@ -1920,24 +1944,24 @@ void precalc_multicolorinfo(void)
* the lines in between and the end properly. */
fileptr->multidata[tmpcolor->id] |= CENDAFTER;
#ifdef DEBUG
fprintf(stderr, "marking line %lu as CENDAFTER\n", (unsigned long) fileptr->lineno);
fprintf(stderr, "marking line %ld as CENDAFTER\n", (long)fileptr->lineno);
#endif
for (fileptr = fileptr->next; fileptr != endptr; fileptr = fileptr->next) {
alloc_multidata_if_needed(fileptr);
fileptr->multidata[tmpcolor->id] = CWHOLELINE;
#ifdef DEBUG
fprintf(stderr, "marking intermediary line %lu as CWHOLELINE\n", (unsigned long) fileptr->lineno);
fprintf(stderr, "marking intermediary line %ld as CWHOLELINE\n", (long)fileptr->lineno);
#endif
}
alloc_multidata_if_needed(endptr);
fileptr->multidata[tmpcolor->id] |= CBEGINBEFORE;
#ifdef DEBUG
fprintf(stderr, "marking line %lu as CBEGINBEFORE\n", (unsigned long) fileptr->lineno);
fprintf(stderr, "marking line %ld as CBEGINBEFORE\n", (long)fileptr->lineno);
#endif
/* Skip to the end point of the match. */
startx = endmatch.rm_eo;
#ifdef DEBUG
fprintf(stderr, "jumping to line %lu pos %d to continue\n", (unsigned long) fileptr->lineno, startx);
fprintf(stderr, "jumping to line %ld pos %lu to continue\n", (long)fileptr->lineno, (unsigned long)startx);
#endif
}
if (nostart && startx == 0) {
@@ -1960,15 +1984,22 @@ precalc_cleanup:
* TRUE. */
void do_output(char *output, size_t output_len, bool allow_cntrls)
{
size_t current_len, orig_lenpt = 0, i = 0;
size_t current_len, i = 0;
#ifndef NANO_TINY
size_t orig_lenpt = 0;
#endif
char *char_buf = charalloc(mb_cur_max());
int char_buf_len;
assert(openfile->current != NULL && openfile->current->data != NULL);
current_len = strlen(openfile->current->data);
#ifndef NANO_TINY
if (ISSET(SOFTWRAP))
orig_lenpt = strlenpt(openfile->current->data);
#endif
while (i < output_len) {
/* If allow_cntrls is TRUE, convert nulls and newlines
@@ -2037,7 +2068,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#ifndef DISABLE_WRAPPING
/* If we're wrapping text, we need to call edit_refresh(). */
if (!ISSET(NO_WRAP))
if (do_wrap(openfile->current, FALSE))
if (do_wrap(openfile->current))
edit_refresh_needed = TRUE;
#endif
@@ -2049,11 +2080,13 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#endif
}
/* Well we might also need a full refresh if we've changed the
#ifndef NANO_TINY
/* Well, we might also need a full refresh if we've changed the
* line length to be a new multiple of COLS. */
if (ISSET(SOFTWRAP) && edit_refresh_needed == FALSE)
if (strlenpt(openfile->current->data) / COLS != orig_lenpt / COLS)
if (strlenpt(openfile->current->data) / COLS != orig_lenpt / COLS)
edit_refresh_needed = TRUE;
#endif
free(char_buf);
@@ -2072,10 +2105,8 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
int main(int argc, char **argv)
{
int optchr;
ssize_t startline = 1;
/* Line to try and start at. */
ssize_t startcol = 1;
/* Column to try and start at. */
ssize_t startline = 0, startcol = 0;
/* Target line and column when specified on the command line. */
#ifndef DISABLE_WRAPJUSTIFY
bool fill_used = FALSE;
/* Was the fill option used? */
@@ -2186,11 +2217,11 @@ int main(int argc, char **argv)
while ((optchr =
#ifdef HAVE_GETOPT_LONG
getopt_long(argc, argv,
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tuvwxz$",
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tvwxz$",
long_options, NULL)
#else
getopt(argc, argv,
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tuvwxz$")
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tvwxz$")
#endif
) != -1) {
switch (optchr) {
@@ -2226,15 +2257,17 @@ int main(int argc, char **argv)
SET(MULTIBUFFER);
break;
#endif
#ifndef DISABLE_NANORC
#ifndef NANO_TINY
case 'G':
SET(LOCKING);
break;
#endif
#ifndef DISABLE_HISTORIES
case 'H':
SET(HISTORYLOG);
break;
#endif
#ifndef DISABLE_NANORC
case 'I':
no_rcfiles = TRUE;
break;
@@ -2253,7 +2286,7 @@ int main(int argc, char **argv)
case 'O':
SET(MORE_SPACE);
break;
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
case 'P':
SET(POS_HISTORY);
break;
@@ -2329,9 +2362,11 @@ int main(int argc, char **argv)
case 'p':
SET(PRESERVE);
break;
#ifndef DISABLE_NANORC
case 'q':
SET(QUIET);
break;
#endif
#ifndef DISABLE_WRAPJUSTIFY
case 'r':
if (!parse_num(optarg, &wrap_at)) {
@@ -2350,11 +2385,6 @@ int main(int argc, char **argv)
case 't':
SET(TEMP_FILE);
break;
#ifndef NANO_TINY
case 'u':
SET(UNDOABLE);
break;
#endif
case 'v':
SET(VIEW_MODE);
break;
@@ -2391,14 +2421,16 @@ int main(int argc, char **argv)
if (*(tail(argv[0])) == 'r')
SET(RESTRICTED);
/* If we're using restricted mode, disable suspending, backups, and
* reading rcfiles, since they all would allow reading from or
* writing to files not specified on the command line. */
/* If we're using restricted mode, disable suspending, backups,
* rcfiles, and history files, since they all would allow reading
* from or writing to files not specified on the command line. */
if (ISSET(RESTRICTED)) {
UNSET(SUSPEND);
UNSET(BACKUP_FILE);
#ifndef DISABLE_NANORC
no_rcfiles = TRUE;
UNSET(HISTORYLOG);
UNSET(POS_HISTORY);
#endif
}
@@ -2448,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
@@ -2496,7 +2528,7 @@ int main(int argc, char **argv)
#ifndef DISABLE_WRAPPING
/* Overwrite an rcfile "set nowrap" or --disable-wrapping-as-root
if a --fill option was given on the command line. */
* if a --fill option was given on the command line. */
if (fill_used)
UNSET(NO_WRAP);
#endif
@@ -2506,24 +2538,24 @@ int main(int argc, char **argv)
if (ISSET(BOLD_TEXT))
hilite_attribute = A_BOLD;
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
/* Set up the search/replace history. */
history_init();
#ifndef DISABLE_NANORC
if (!no_rcfiles) {
if (ISSET(HISTORYLOG) || ISSET(POS_HISTORY)) {
if (check_dotnano() == 0) {
UNSET(HISTORYLOG);
UNSET(POS_HISTORY);
}
/* Verify that the home directory and ~/.nano subdir exist. */
if (ISSET(HISTORYLOG) || ISSET(POS_HISTORY)) {
get_homedir();
if (homedir == NULL || check_dotnano() == 0) {
UNSET(HISTORYLOG);
UNSET(POS_HISTORY);
}
if (ISSET(HISTORYLOG))
load_history();
if (ISSET(POS_HISTORY))
load_poshistory();
}
#endif /* !DISABLE_NANORC */
if (ISSET(HISTORYLOG))
load_history();
if (ISSET(POS_HISTORY))
load_poshistory();
#endif /* !DISABLE_HISTORIES */
#ifndef NANO_TINY
/* Set up the backup directory (unless we're using restricted mode,
* in which case backups are disabled, since they would allow
* reading from or writing to files not specified on the command
@@ -2531,7 +2563,7 @@ int main(int argc, char **argv)
* that backup files will be saved there. */
if (!ISSET(RESTRICTED))
init_backup_dir();
#endif /* !NANO_TINY */
#endif
#ifndef DISABLE_OPERATINGDIR
/* Set up the operating directory. This entails chdir()ing there,
@@ -2687,7 +2719,7 @@ int main(int argc, char **argv)
* new buffers. */
{
int i = optind + 1;
ssize_t iline = 1, icol = 1;
ssize_t iline = 0, icol = 0;
for (; i < argc; i++) {
/* If there's a +LINE or +LINE,COLUMN flag here, it is
@@ -2699,14 +2731,14 @@ int main(int argc, char **argv)
else {
open_buffer(argv[i], FALSE);
if (iline > 1 || icol > 1) {
if (iline > 0 || icol > 0) {
do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE,
FALSE);
iline = 1;
icol = 1;
}
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
else {
#ifndef DISABLE_HISTORIES
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))
@@ -2749,10 +2781,10 @@ int main(int argc, char **argv)
precalc_multicolorinfo();
#endif
if (startline > 1 || startcol > 1)
if (startline > 0 || startcol > 0)
do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE,
FALSE);
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
#ifndef DISABLE_HISTORIES
else {
/* See if we have a POS history to use if we haven't overridden it. */
ssize_t savedposline, savedposcol;
@@ -2766,8 +2798,6 @@ int main(int argc, char **argv)
display_buffer();
while (TRUE) {
bool meta_key, func_key;
/* Make sure the cursor is in the edit window. */
reset_cursor();
wnoutrefresh(edit);
@@ -2793,10 +2823,10 @@ 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(&meta_key, &func_key, TRUE);
do_input(TRUE);
}
/* We should never get here. */

View File

@@ -31,8 +31,8 @@
#ifdef NEED_XOPEN_SOURCE_EXTENDED
#ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED 1
#endif /* _XOPEN_SOURCE_EXTENDED */
#endif /* NEED_XOPEN_SOURCE_EXTENDED */
#endif
#endif
#ifdef __TANDEM
/* Tandem NonStop Kernel support. */
@@ -175,7 +175,7 @@ typedef enum {
} append_type;
typedef enum {
UP_DIR, DOWN_DIR
UPWARD, DOWNWARD
} scroll_dir;
typedef enum {
@@ -184,10 +184,14 @@ typedef enum {
typedef enum {
CONTROL, META, FKEY, RAWINPUT
} function_type;
} key_type;
typedef enum {
ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, CUT_EOF, PASTE, ENTER, INSERT, OTHER
ADD, DEL, BACK, CUT, CUT_EOF, REPLACE,
#ifndef DISABLE_WRAPPING
SPLIT_BEGIN, SPLIT_END,
#endif
JOIN, PASTE, INSERT, ENTER, OTHER
} undo_type;
typedef struct color_pair {
@@ -247,6 +251,8 @@ typedef struct syntaxtype {
/* The colors used in this syntax. */
char *linter;
/* The command to lint this type of file. */
char *formatter;
/* Use this formatter command (for programming lang mainly) */
int nmultis;
/* How many multi-line strings this syntax has. */
struct syntaxtype *next;
@@ -328,8 +334,6 @@ typedef struct undo {
/* Where did this action begin or end. */
char *strdata;
/* String type data we will use for copying the affected line back. */
char *strdata2;
/* Sigh, need this too, it looks like. */
int xflags;
/* Some flag data we need. */
@@ -340,16 +344,15 @@ typedef struct undo {
/* Copy of cutbottom. */
bool mark_set;
/* Was the marker set when we cut? */
bool to_end;
/* Was this a cut to end? */
ssize_t mark_begin_lineno;
/* copy copy copy */
size_t mark_begin_x;
/* Another shadow variable. */
struct undo *next;
} undo;
#endif /* !NANO_TINY */
#ifndef DISABLE_HISTORIES
typedef struct poshiststruct {
char *filename;
/* The file. */
@@ -359,9 +362,7 @@ typedef struct poshiststruct {
/* x position in the file we left off on. */
struct poshiststruct *next;
} poshiststruct;
#endif /* !NANO_TINY */
#endif
typedef struct openfilestruct {
char *filename;
@@ -441,14 +442,13 @@ typedef struct rcoption {
long flag;
/* The flag associated with it, if any. */
} rcoption;
#endif
typedef struct sc {
char *keystr;
/* The shortcut key for a function, ASCII version. */
function_type type;
/* What kind of function key it is, for convenience later. */
key_type type;
/* What kind of command key it is, for convenience later. */
int seq;
/* The actual sequence to check on the type is determined. */
int menu;
@@ -533,7 +533,6 @@ enum
NO_NEWLINES,
BOLD_TEXT,
QUIET,
UNDOABLE,
SOFTWRAP,
POS_HISTORY,
LOCKING,
@@ -566,18 +565,19 @@ enum
#define NANO_CONTROL_7 31
#define NANO_CONTROL_8 127
/* Codes for "modified" Arrow keys. Chosen like this because some
* terminals produce them, and they are beyond KEY_MAX of ncurses. */
#define CONTROL_LEFT 539
#define CONTROL_RIGHT 554
#ifndef NANO_TINY
/* Extra bits for the undo function. */
#define UNdel_del (1<<0)
#define UNdel_backspace (1<<1)
#define UNsplit_madenew (1<<2)
#define UNdel_backspace (1<<1)
#define UNcut_marked_forward (1<<2)
#define UNcut_cutline (1<<3)
#endif /* !NANO_TINY */
#define VIEW TRUE
#define NOVIEW FALSE
/* The maximum number of entries displayed in the main shortcut list. */
#define MAIN_VISIBLE (((COLS + 40) / 20) * 2)

View File

@@ -42,18 +42,13 @@ static bool reset_statusbar_x = FALSE;
* prompt? */
/* Read in a character, interpret it as a shortcut or toggle if
* necessary, and return it. Set meta_key to TRUE if the character is a
* meta sequence, set func_key to TRUE if the character is a function
* key, set have_shortcut to TRUE if the character is a shortcut
* key, set ran_func to TRUE if we ran a function associated with a
* necessary, and return it.
* Set ran_func to TRUE if we ran a function associated with a
* shortcut key, and set finished to TRUE if we're done after running
* or trying to run a function associated with a shortcut key. If
* allow_funcs is FALSE, don't actually run any functions associated
* with shortcut keys. refresh_func is the function we will call to
* refresh the edit window. */
int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
bool *ran_func, bool *finished, bool allow_funcs, void
(*refresh_func)(void))
* or trying to run a function associated with a shortcut key.
* refresh_func is the function we will call to refresh the edit window. */
int do_statusbar_input(bool *ran_func, bool *finished,
void (*refresh_func)(void))
{
int input;
/* The character we read in. */
@@ -62,149 +57,134 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
static size_t kbinput_len = 0;
/* The length of the input buffer. */
const sc *s;
bool have_shortcut = FALSE;
const subnfunc *f;
*have_shortcut = FALSE;
*ran_func = FALSE;
*finished = FALSE;
/* Read in a character. */
input = get_kbinput(bottomwin, meta_key, func_key);
input = get_kbinput(bottomwin);
#ifndef DISABLE_MOUSE
if (allow_funcs) {
/* If we got a mouse click and it was on a shortcut, read in the
* shortcut character. */
if (*func_key && input == KEY_MOUSE) {
if (do_statusbar_mouse() == 1)
input = get_kbinput(bottomwin, meta_key, func_key);
else {
*meta_key = FALSE;
*func_key = FALSE;
input = ERR;
}
/* If we got a mouse click and it was on a shortcut, read in the
* shortcut character. */
if (func_key && input == KEY_MOUSE) {
if (do_statusbar_mouse() == 1)
input = get_kbinput(bottomwin);
else {
meta_key = FALSE;
func_key = FALSE;
input = ERR;
}
}
#endif
/* Check for a shortcut in the current list. */
s = get_shortcut(currmenu, &input, meta_key);
s = get_shortcut(&input);
/* If we got a shortcut from the current list, or a "universal"
* statusbar prompt shortcut, set have_shortcut to TRUE. */
*have_shortcut = (s != NULL);
have_shortcut = (s != NULL);
/* If we got a non-high-bit control key, a meta key sequence, or a
* function key, and it's not a shortcut or toggle, throw it out. */
if (!*have_shortcut) {
if (is_ascii_cntrl_char(input) || *meta_key || *func_key) {
if (!have_shortcut) {
if (is_ascii_cntrl_char(input) || meta_key || func_key) {
beep();
*meta_key = FALSE;
*func_key = FALSE;
meta_key = FALSE;
func_key = FALSE;
input = ERR;
}
}
if (allow_funcs) {
/* If we got a character, and it isn't a shortcut or toggle,
* it's a normal text character. Display the warning if we're
* in view mode, or add the character to the input buffer if
* we're not. */
if (input != ERR && !*have_shortcut) {
/* If we're using restricted mode, the filename isn't blank,
* and we're at the "Write File" prompt, disable text
* input. */
if (!ISSET(RESTRICTED) || openfile->filename[0] == '\0' ||
/* If we got a character, and it isn't a shortcut or toggle,
* it's a normal text character. Display the warning if we're
* in view mode, or add the character to the input buffer if
* we're not. */
if (input != ERR && !have_shortcut) {
/* If we're using restricted mode, the filename isn't blank,
* and we're at the "Write File" prompt, disable text input. */
if (!ISSET(RESTRICTED) || openfile->filename[0] == '\0' ||
currmenu != MWRITEFILE) {
kbinput_len++;
kbinput = (int *)nrealloc(kbinput, kbinput_len *
sizeof(int));
kbinput[kbinput_len - 1] = input;
}
kbinput_len++;
kbinput = (int *)nrealloc(kbinput, kbinput_len * sizeof(int));
kbinput[kbinput_len - 1] = input;
}
}
/* If we got a shortcut, or if there aren't any other characters
* waiting after the one we read in, we need to display all the
* characters in the input buffer if it isn't empty. */
if (have_shortcut || get_key_buffer_len() == 0) {
if (kbinput != NULL) {
/* Display all the characters in the input buffer at
* once, filtering out control characters. */
char *output = charalloc(kbinput_len + 1);
size_t i;
bool got_enter;
/* Whether we got the Enter key. */
for (i = 0; i < kbinput_len; i++)
output[i] = (char)kbinput[i];
output[i] = '\0';
do_statusbar_output(output, kbinput_len, &got_enter, FALSE);
free(output);
/* Empty the input buffer. */
kbinput_len = 0;
free(kbinput);
kbinput = NULL;
}
/* If we got a shortcut, or if there aren't any other characters
* waiting after the one we read in, we need to display all the
* characters in the input buffer if it isn't empty. */
if (*have_shortcut || get_key_buffer_len() == 0) {
if (kbinput != NULL) {
/* Display all the characters in the input buffer at
* once, filtering out control characters. */
char *output = charalloc(kbinput_len + 1);
size_t i;
bool got_enter;
/* Whether we got the Enter key. */
for (i = 0; i < kbinput_len; i++)
output[i] = (char)kbinput[i];
output[i] = '\0';
do_statusbar_output(output, kbinput_len, &got_enter,
FALSE);
free(output);
/* Empty the input buffer. */
kbinput_len = 0;
free(kbinput);
kbinput = NULL;
}
}
if (*have_shortcut) {
if (have_shortcut) {
if (s->scfunc == do_tab || s->scfunc == do_enter_void)
;
else if (s->scfunc == total_refresh)
total_statusbar_refresh(refresh_func);
else if (s->scfunc == do_cut_text_void) {
else if (s->scfunc == do_cut_text_void) {
/* If we're using restricted mode, the filename
* isn't blank, and we're at the "Write File"
* prompt, disable Cut. */
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
'\0' || currmenu != MWRITEFILE)
do_statusbar_cut_text();
} else if (s->scfunc == do_right)
do_statusbar_right();
else if (s->scfunc == do_left)
} else if (s->scfunc == do_left)
do_statusbar_left();
else if (s->scfunc == do_right)
do_statusbar_right();
#ifndef NANO_TINY
else if (s->scfunc == do_prev_word_void)
do_statusbar_prev_word(FALSE);
else if (s->scfunc == do_next_word_void)
do_statusbar_next_word(FALSE);
else if (s->scfunc == do_prev_word_void)
do_statusbar_prev_word(FALSE);
#endif
else if (s->scfunc == do_home)
do_statusbar_home();
do_statusbar_home();
else if (s->scfunc == do_end)
do_statusbar_end();
#ifndef NANO_TINY
else if (s->scfunc == do_find_bracket)
do_statusbar_find_bracket();
#endif
do_statusbar_end();
else if (s->scfunc == do_verbatim_input) {
/* If we're using restricted mode, the filename
* isn't blank, and we're at the "Write File"
* prompt, disable verbatim input. */
if (!ISSET(RESTRICTED) ||
openfile->filename[0] == '\0' ||
currmenu != MWRITEFILE) {
bool got_enter;
/* Whether we got the Enter key. */
/* If we're using restricted mode, the filename
* isn't blank, and we're at the "Write File"
* prompt, disable verbatim input. */
if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
openfile->filename[0] == '\0') {
bool got_enter;
/* Whether we got the Enter key. */
do_statusbar_verbatim_input(&got_enter);
do_statusbar_verbatim_input(&got_enter);
/* If we got the Enter key, remove it from
* the input buffer, set input to the key
* value for Enter, and set finished to TRUE
* to indicate that we're done. */
if (got_enter) {
get_input(NULL, 1);
input = sc_seq_or(do_enter_void, 0);
*finished = TRUE;
}
/* If we got the Enter key, remove it from the input
* buffer, set input to the key value for Enter, and
* set finished to TRUE to indicate that we're done. */
if (got_enter) {
get_input(NULL, 1);
input = sc_seq_or(do_enter_void, 0);
*finished = TRUE;
}
}
} else if (s->scfunc == do_delete) {
/* If we're using restricted mode, the filename
* isn't blank, and we're at the "Write File"
@@ -220,16 +200,17 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
'\0' || currmenu != MWRITEFILE)
do_statusbar_backspace();
} else {
/* Handle the normal statusbar prompt shortcuts, setting
/* Handle any other shortcut in the current menu, setting
* ran_func to TRUE if we try to run their associated
* functions and setting finished to TRUE to indicate
* that we're done after running or trying to run their
* associated functions. */
f = sctofunc((sc *) s);
if (s->scfunc != 0 && s->execute == TRUE) {
if (s->scfunc != NULL) {
*ran_func = TRUE;
if (f && (!ISSET(VIEW_MODE) || (f->viewok)))
f->scfunc();
if (f && (!ISSET(VIEW_MODE) || f->viewok) &&
f->scfunc != do_gotolinecolumn_void)
f->scfunc();
}
*finished = TRUE;
}
@@ -359,13 +340,12 @@ void do_statusbar_home(void)
statusbar_x = 0;
statusbar_pww = statusbar_xplustabs();
} else {
} else
#endif
{
statusbar_x = 0;
statusbar_pww = statusbar_xplustabs();
#ifndef NANO_TINY
}
#endif
if (need_statusbar_horizontal_update(pww_save))
update_statusbar_line(answer, statusbar_x);
@@ -450,14 +430,13 @@ void do_statusbar_cut_text(void)
#ifndef NANO_TINY
if (ISSET(CUT_TO_END))
null_at(&answer, statusbar_x);
else {
else
#endif
{
null_at(&answer, 0);
statusbar_x = 0;
statusbar_pww = statusbar_xplustabs();
#ifndef NANO_TINY
}
#endif
update_statusbar_line(answer, statusbar_x);
}
@@ -650,162 +629,6 @@ void do_statusbar_verbatim_input(bool *got_enter)
free(output);
}
#ifndef NANO_TINY
/* Search for a match to one of the two characters in bracket_set. If
* reverse is TRUE, search backwards for the leftmost bracket.
* Otherwise, search forwards for the rightmost bracket. Return TRUE if
* we found a match, and FALSE otherwise. */
bool find_statusbar_bracket_match(bool reverse, const char
*bracket_set)
{
const char *rev_start = NULL, *found = NULL;
assert(mbstrlen(bracket_set) == 2);
/* rev_start might end up 1 character before the start or after the
* end of the line. This won't be a problem because we'll skip over
* it below in that case. */
rev_start = reverse ? answer + (statusbar_x - 1) : answer +
(statusbar_x + 1);
while (TRUE) {
/* Look for either of the two characters in bracket_set.
* rev_start can be 1 character before the start or after the
* end of the line. In either case, just act as though no match
* is found. */
found = ((rev_start > answer && *(rev_start - 1) == '\0') ||
rev_start < answer) ? NULL : (reverse ?
mbrevstrpbrk(answer, bracket_set, rev_start) :
mbstrpbrk(rev_start, bracket_set));
/* We've found a potential match. */
if (found != NULL)
break;
/* We've reached the start or end of the statusbar text, so
* get out. */
return FALSE;
}
/* We've definitely found something. */
statusbar_x = found - answer;
statusbar_pww = statusbar_xplustabs();
return TRUE;
}
/* Search for a match to the bracket at the current cursor position, if
* there is one. */
void do_statusbar_find_bracket(void)
{
size_t statusbar_x_save, pww_save;
const char *ch;
/* The location in matchbrackets of the bracket at the current
* cursor position. */
int ch_len;
/* The length of ch in bytes. */
const char *wanted_ch;
/* The location in matchbrackets of the bracket complementing
* the bracket at the current cursor position. */
int wanted_ch_len;
/* The length of wanted_ch in bytes. */
char *bracket_set;
/* The pair of characters in ch and wanted_ch. */
size_t i;
/* Generic loop variable. */
size_t matchhalf;
/* The number of single-byte characters in one half of
* matchbrackets. */
size_t mbmatchhalf;
/* The number of multibyte characters in one half of
* matchbrackets. */
size_t count = 1;
/* The initial bracket count. */
bool reverse;
/* The direction we search. */
char *found_ch;
/* The character we find. */
assert(mbstrlen(matchbrackets) % 2 == 0);
ch = answer + statusbar_x;
if (ch == '\0' || (ch = mbstrchr(matchbrackets, ch)) == NULL)
return;
/* Save where we are. */
statusbar_x_save = statusbar_x;
pww_save = statusbar_pww;
/* If we're on an opening bracket, which must be in the first half
* of matchbrackets, we want to search forwards for a closing
* bracket. If we're on a closing bracket, which must be in the
* second half of matchbrackets, we want to search backwards for an
* opening bracket. */
matchhalf = 0;
mbmatchhalf = mbstrlen(matchbrackets) / 2;
for (i = 0; i < mbmatchhalf; i++)
matchhalf += parse_mbchar(matchbrackets + matchhalf, NULL,
NULL);
reverse = ((ch - matchbrackets) >= matchhalf);
/* If we're on an opening bracket, set wanted_ch to the character
* that's matchhalf characters after ch. If we're on a closing
* bracket, set wanted_ch to the character that's matchhalf
* characters before ch. */
wanted_ch = ch;
while (mbmatchhalf > 0) {
if (reverse)
wanted_ch = matchbrackets + move_mbleft(matchbrackets,
wanted_ch - matchbrackets);
else
wanted_ch += move_mbright(wanted_ch, 0);
mbmatchhalf--;
}
ch_len = parse_mbchar(ch, NULL, NULL);
wanted_ch_len = parse_mbchar(wanted_ch, NULL, NULL);
/* Fill bracket_set in with the values of ch and wanted_ch. */
bracket_set = charalloc((mb_cur_max() * 2) + 1);
strncpy(bracket_set, ch, ch_len);
strncpy(bracket_set + ch_len, wanted_ch, wanted_ch_len);
null_at(&bracket_set, ch_len + wanted_ch_len);
found_ch = charalloc(mb_cur_max() + 1);
while (TRUE) {
if (find_statusbar_bracket_match(reverse, bracket_set)) {
/* If we found an identical bracket, increment count. If we
* found a complementary bracket, decrement it. */
parse_mbchar(answer + statusbar_x, found_ch, NULL);
count += (strncmp(found_ch, ch, ch_len) == 0) ? 1 : -1;
/* If count is zero, we've found a matching bracket. Update
* the statusbar prompt and get out. */
if (count == 0) {
if (need_statusbar_horizontal_update(pww_save))
update_statusbar_line(answer, statusbar_x);
break;
}
} else {
/* We didn't find either an opening or closing bracket.
* Restore where we were, and get out. */
statusbar_x = statusbar_x_save;
statusbar_pww = pww_save;
break;
}
}
/* Clean up. */
free(bracket_set);
free(found_ch);
}
#endif /* !NANO_TINY */
/* Return the placewewant associated with statusbar_x, i.e. the
* zero-based column position of the cursor. The value will be no
@@ -896,30 +719,26 @@ void total_statusbar_refresh(void (*refresh_func)(void))
/* Get a string of input at the statusbar prompt. This should only be
* called from do_prompt(). */
const sc *get_prompt_string(int *actual, bool allow_tabs,
functionptrtype get_prompt_string(int *actual, bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool allow_files,
bool *list,
#endif
const char *curranswer,
bool *meta_key, bool *func_key,
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
filestruct **history_list,
#endif
void (*refresh_func)(void), int menu
#ifndef DISABLE_TABCOMP
, bool *list
#endif
)
void (*refresh_func)(void))
{
int kbinput = ERR;
bool have_shortcut, ran_func, finished;
bool ran_func, finished;
size_t curranswer_len;
const sc *s;
functionptrtype func;
#ifndef DISABLE_TABCOMP
bool tabbed = FALSE;
/* Whether we've pressed Tab. */
#endif
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
char *history = NULL;
/* The current history string. */
char *magichistory = NULL;
@@ -932,7 +751,7 @@ const sc *get_prompt_string(int *actual, bool allow_tabs,
/* The length of the original string that we're trying to
* tab complete, if any. */
#endif
#endif /* !NANO_TINY */
#endif /* !DISABLE_HISTORIES */
answer = mallocstrcpy(answer, curranswer);
curranswer_len = strlen(answer);
@@ -955,10 +774,8 @@ const sc *get_prompt_string(int *actual, bool allow_tabs,
statusbar_pww = statusbar_xplustabs();
}
currmenu = menu;
#ifdef DEBUG
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
#endif
update_statusbar_line(answer, statusbar_x);
@@ -973,23 +790,21 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
* allow writing to files not specified on the command line. In
* this case, disable all keys that would change the text if the
* filename isn't blank and we're at the "Write File" prompt. */
while (1) {
kbinput = do_statusbar_input(meta_key, func_key, &have_shortcut,
&ran_func, &finished, TRUE, refresh_func);
while (TRUE) {
kbinput = do_statusbar_input(&ran_func, &finished, refresh_func);
assert(statusbar_x <= strlen(answer));
s = get_shortcut(currmenu, &kbinput, meta_key);
func = func_from_key(&kbinput);
if (s)
if (s->scfunc == do_cancel || s->scfunc == do_enter_void)
break;
if (func == do_cancel || func == do_enter_void)
break;
#ifndef DISABLE_TABCOMP
if (s && s->scfunc != do_tab)
if (func != do_tab)
tabbed = FALSE;
if (s && s->scfunc == do_tab) {
#ifndef NANO_TINY
if (func == do_tab) {
#ifndef DISABLE_HISTORIES
if (history_list != NULL) {
if (last_kbinput != sc_seq_or(do_tab, NANO_CONTROL_I))
complete_len = strlen(answer);
@@ -1001,7 +816,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
statusbar_x = strlen(answer);
}
} else
#endif /* !NANO_TINY */
#endif
if (allow_tabs)
answer = input_tab(answer, allow_files, &statusbar_x,
&tabbed, refresh_func, list);
@@ -1009,8 +824,8 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
update_statusbar_line(answer, statusbar_x);
} else
#endif /* !DISABLE_TABCOMP */
#ifndef NANO_TINY
if (s && s->scfunc == get_history_older_void) {
#ifndef DISABLE_HISTORIES
if (func == get_history_older_void) {
if (history_list != NULL) {
/* If we're scrolling up at the bottom of the history list
* and answer isn't blank, save answer in magichistory. */
@@ -1030,9 +845,9 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
* move to an older search, which means that finished has
* been set to TRUE. Set it back to FALSE here, so that
* we aren't kicked out of the statusbar prompt. */
finished = FALSE;
finished = FALSE;
}
} else if (s && s->scfunc == get_history_newer_void) {
} else if (func == get_history_newer_void) {
if (history_list != NULL) {
/* Get the newer search from the history list and save it in
* answer. If there is no newer search, don't do anything. */
@@ -1059,8 +874,8 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
finished = FALSE;
}
} else
#endif /* !NANO_TINY */
if (s && s->scfunc == do_help_void) {
#endif /* !DISABLE_HISTORIES */
if (func == do_help_void) {
update_statusbar_line(answer, statusbar_x);
/* This key has a shortcut-list entry when it's used to go to
@@ -1076,7 +891,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
if (finished)
break;
#if !defined(NANO_TINY) && !defined(DISABLE_TABCOMP)
#if !defined(DISABLE_HISTORIES) && !defined(DISABLE_TABCOMP)
last_kbinput = kbinput;
#endif
@@ -1084,8 +899,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
wnoutrefresh(bottomwin);
}
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
/* Set the current position in the history list to the bottom,
* and free magichistory if we need to. */
if (history_list != NULL) {
@@ -1096,14 +910,12 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
}
#endif
/* We've finished putting in an answer or run a normal shortcut's
* associated function, so reset statusbar_x and statusbar_pww. If
* we've finished putting in an answer, reset the statusbar cursor
* position too. */
if (s) {
if (s->scfunc == do_cancel || s->scfunc == do_enter_void ||
ran_func) {
if (func) {
if (func == do_cancel || func == do_enter_void || ran_func) {
statusbar_x = old_statusbar_x;
statusbar_pww = old_pww;
@@ -1117,7 +929,8 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
}
*actual = kbinput;
return s;
return func;
}
/* Ask a question on the statusbar. The prompt will be stored in the
@@ -1137,15 +950,14 @@ int do_prompt(bool allow_tabs,
bool allow_files,
#endif
int menu, const char *curranswer,
bool *meta_key, bool *func_key,
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
filestruct **history_list,
#endif
void (*refresh_func)(void), const char *msg, ...)
{
va_list ap;
int retval;
const sc *s;
functionptrtype func;
#ifndef DISABLE_TABCOMP
bool list = FALSE;
#endif
@@ -1164,20 +976,16 @@ int do_prompt(bool allow_tabs,
va_end(ap);
null_at(&prompt, actual_x(prompt, COLS - 4));
s = get_prompt_string(&retval, allow_tabs,
func = get_prompt_string(&retval, allow_tabs,
#ifndef DISABLE_TABCOMP
allow_files,
&list,
#endif
curranswer,
meta_key, func_key,
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
history_list,
#endif
refresh_func, menu
#ifndef DISABLE_TABCOMP
, &list
#endif
);
refresh_func);
free(prompt);
prompt = NULL;
@@ -1189,9 +997,9 @@ int do_prompt(bool allow_tabs,
/* If we left the prompt via Cancel or Enter, set the return value
* properly. */
if (s && s->scfunc == do_cancel)
if (func == do_cancel)
retval = -1;
else if (s && s->scfunc == do_enter_void)
else if (func == do_enter_void)
retval = (*answer == '\0') ? -2 : 0;
blank_statusbar();
@@ -1232,7 +1040,6 @@ int do_yesno_prompt(bool all, const char *msg)
const char *yesstr; /* String of Yes characters accepted. */
const char *nostr; /* Same for No. */
const char *allstr; /* And All, surprise! */
const sc *s;
int oldmenu = currmenu;
assert(msg != NULL);
@@ -1293,16 +1100,16 @@ int do_yesno_prompt(bool all, const char *msg)
do {
int kbinput;
bool meta_key, func_key;
functionptrtype func;
#ifndef DISABLE_MOUSE
int mouse_x, mouse_y;
#endif
currmenu = MYESNO;
kbinput = get_kbinput(bottomwin, &meta_key, &func_key);
s = get_shortcut(currmenu, &kbinput, &meta_key);
kbinput = get_kbinput(bottomwin);
func = func_from_key(&kbinput);
if (s && s->scfunc == do_cancel)
if (func == do_cancel)
ok = -1;
#ifndef DISABLE_MOUSE
else if (kbinput == KEY_MOUSE) {
@@ -1334,7 +1141,7 @@ int do_yesno_prompt(bool all, const char *msg)
}
}
#endif /* !DISABLE_MOUSE */
else if (s && s->scfunc == total_refresh) {
else if (func == total_refresh) {
total_redraw();
continue;
} else {

View File

@@ -30,9 +30,12 @@
#ifndef NANO_TINY
extern sigjmp_buf jump_buf;
extern bool jump_buf_main;
extern bool use_undo;
#endif
extern bool meta_key;
extern bool func_key;
extern bool focusing;
#ifndef DISABLE_WRAPJUSTIFY
extern ssize_t fill;
extern ssize_t wrap_at;
@@ -63,7 +66,6 @@ extern char *matchbrackets;
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
extern char *whitespace;
extern int whitespace_len[2];
extern undo_type last_action;
#endif
extern const char *exit_tag;
@@ -81,7 +83,8 @@ extern char *quoteerr;
#else
extern size_t quotelen;
#endif
#endif
#endif /* !DISABLE_JUSTIFY */
extern bool nodelay_mode;
extern char *answer;
@@ -101,20 +104,20 @@ extern char *full_operating_dir;
extern char *alt_speller;
#endif
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
#ifndef DISABLE_COLOR
extern syntaxtype *syntaxes;
extern char *syntaxstr;
#endif
extern bool edit_refresh_needed;
extern const shortcut *currshortcut;
extern int currmenu;
#ifndef NANO_TINY
extern int currmenu;
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
#ifndef DISABLE_HISTORIES
extern filestruct *search_history;
extern filestruct *searchage;
extern filestruct *searchbot;
@@ -122,7 +125,6 @@ extern filestruct *replace_history;
extern filestruct *replaceage;
extern filestruct *replacebot;
extern poshiststruct *poshistory;
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
#endif
#ifdef HAVE_REGEX_H
@@ -138,17 +140,18 @@ extern color_pair interface_color_pair[NUMBER_OF_ELEMENTS];
extern char *homedir;
typedef void (*functionptrtype)(void);
/* All functions in browser.c. */
#ifndef DISABLE_BROWSER
char *do_browser(char *path, DIR *dir);
char *do_browse_from(const char *inpath);
void browser_init(const char *path, DIR *dir);
void parse_browser_input(int *kbinput, bool *meta_key);
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);
@@ -249,6 +252,7 @@ void color_update(void);
/* All functions in cut.c. */
void cutbuffer_reset(void);
bool keeping_cutbuffer(void);
void cut_line(void);
#ifndef NANO_TINY
void cut_marked(void);
@@ -257,7 +261,7 @@ void cut_to_eof(void);
#endif
void do_cut_text(
#ifndef NANO_TINY
bool copy_text, bool cut_till_end, bool undoing
bool copy_text, bool cut_till_eof, bool undoing
#else
void
#endif
@@ -265,7 +269,7 @@ void do_cut_text(
void do_cut_text_void(void);
#ifndef NANO_TINY
void do_copy_text(void);
void do_cut_till_end(void);
void do_cut_till_eof(void);
#endif
void do_uncut_text(void);
@@ -279,15 +283,15 @@ void replace_buffer(const char *filename);
#endif
void display_buffer(void);
#ifndef DISABLE_MULTIBUFFER
void switch_to_prevnext_buffer(bool next);
void switch_to_prevnext_buffer(bool next, bool quiet);
void switch_to_prev_buffer_void(void);
void switch_to_next_buffer_void(void);
bool close_buffer(void);
bool close_buffer(bool quiet);
#endif
filestruct *read_line(char *buf, filestruct *prevnode, bool
*first_line_ins, size_t buf_len);
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
int open_file(const char *filename, bool newfie, FILE **f);
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
char *get_next_filename(const char *name, const char *suffix);
void do_insertfile(
#ifndef NANO_TINY
@@ -333,7 +337,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
*lastwastab, void (*refresh_func)(void), bool *list);
#endif
const char *tail(const char *foo);
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
#ifndef DISABLE_HISTORIES
char *histfilename(void);
void load_history(void);
bool writehist(FILE *hist, filestruct *histhead);
@@ -341,16 +345,27 @@ void save_history(void);
int check_dotnano(void);
void load_poshistory(void);
void save_poshistory(void);
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
int check_poshistory(const char *file, ssize_t *line, ssize_t *column);
#endif
#ifndef DISABLE_COLOR
void set_lint_shortcuts(void);
void set_spell_shortcuts(void);
#endif
/* Some functions in global.c. */
size_t length_of_list(int menu);
key_type strtokeytype(const char *str);
const sc *first_sc_for(int menu, void (*func)(void));
int sc_seq_or(void (*func)(void), int defaultval);
functionptrtype func_from_key(int *kbinput);
void assign_keyinfo(sc *s);
void print_sclist(void);
void shortcut_init(void);
#ifndef DISABLE_COLOR
void set_lint_or_format_shortcuts(void);
void set_spell_shortcuts(void);
#endif
const subnfunc *sctofunc(sc *s);
const char *flagtostr(int flag);
sc *strtosc(char *input);
int strtomenu(char *input);
#ifdef DEBUG
void thanks_for_all_the_fish(void);
#endif
@@ -359,7 +374,7 @@ void thanks_for_all_the_fish(void);
#ifndef DISABLE_HELP
void do_help(void (*refresh_func)(void));
void help_init(void);
void parse_help_input(int *kbinput, bool *meta_key);
functionptrtype parse_help_input(int *kbinput);
size_t help_line_len(const char *ptr);
#endif
void do_help_void(void);
@@ -453,7 +468,7 @@ void print_opt_full(const char *shortflag
, const char *desc);
void usage(void);
void version(void);
int no_more_space(void);
int more_space(void);
int no_help(void);
void nano_disabled_msg(void);
void do_exit(void);
@@ -465,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);
@@ -477,16 +492,15 @@ void enable_signals(void);
void disable_flow_control(void);
void enable_flow_control(void);
void terminal_init(void);
int do_input(bool *meta_key, bool *func_key, bool allow_funcs);
int do_input(bool allow_funcs);
#ifndef DISABLE_MOUSE
int do_mouse(void);
#endif
void do_output(char *output, size_t output_len, bool allow_cntrls);
/* All functions in prompt.c. */
int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
bool *ran_func, bool *finished, bool allow_funcs, void
(*refresh_func)(void));
int do_statusbar_input(bool *ran_func, bool *finished,
void (*refresh_func)(void));
#ifndef DISABLE_MOUSE
int do_statusbar_mouse(void);
#endif
@@ -504,38 +518,28 @@ bool do_statusbar_next_word(bool allow_punct);
bool do_statusbar_prev_word(bool allow_punct);
#endif
void do_statusbar_verbatim_input(bool *got_enter);
#ifndef NANO_TINY
bool find_statusbar_bracket_match(bool reverse, const char
*bracket_set);
void do_statusbar_find_bracket(void);
#endif
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
void reset_statusbar_cursor(void);
void update_statusbar_line(const char *curranswer, size_t index);
bool need_statusbar_horizontal_update(size_t pww_save);
void total_statusbar_refresh(void (*refresh_func)(void));
const sc *get_prompt_string(int *value, bool allow_tabs,
functionptrtype get_prompt_string(int *value, bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool allow_files,
bool *list,
#endif
const char *curranswer,
bool *meta_key, bool *func_key,
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
filestruct **history_list,
#endif
void (*refresh_func)(void), int menu
#ifndef DISABLE_TABCOMP
, bool *list
#endif
);
void (*refresh_func)(void));
int do_prompt(bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool allow_files,
#endif
int menu, const char *curranswer,
bool *meta_key, bool *func_key,
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
filestruct **history_list,
#endif
void (*refresh_func)(void), const char *msg, ...);
@@ -543,9 +547,11 @@ void do_prompt_abort(void);
int do_yesno_prompt(bool all, const char *msg);
/* Most functions in rcfile.c. */
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
char *parse_next_word(char *ptr);
#endif
#ifndef DISABLE_NANORC
void rcfile_error(const char *msg, ...);
char *parse_next_word(char *ptr);
char *parse_argument(char *ptr);
#ifndef DISABLE_COLOR
char *parse_next_regex(char *ptr);
@@ -564,7 +570,7 @@ void parse_rcfile(FILE *rcstream
#endif
);
void do_rcfile(void);
#endif
#endif /* !DISABLE_NANORC */
/* All functions in search.c. */
#ifdef HAVE_REGEX_H
@@ -608,9 +614,12 @@ void goto_line_posx(ssize_t line, size_t pos_x);
#ifndef NANO_TINY
bool find_bracket_match(bool reverse, const char *bracket_set);
void do_find_bracket(void);
#ifndef DISABLE_NANORC
bool history_has_changed(void);
#ifndef DISABLE_TABCOMP
char *get_history_completion(filestruct **h, const char *s, size_t len);
#endif
#endif
#ifndef DISABLE_HISTORIES
bool history_has_changed(void);
void history_init(void);
void history_reset(const filestruct *h);
filestruct *find_history(const filestruct *h_start, const filestruct
@@ -620,9 +629,6 @@ char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
void get_history_older_void(void);
void get_history_newer_void(void);
#ifndef DISABLE_TABCOMP
char *get_history_completion(filestruct **h, const char *s, size_t len);
#endif
#endif
/* All functions in text.c. */
@@ -647,7 +653,7 @@ bool execute_command(const char *command);
#endif
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(filestruct *line, bool undoing);
bool do_wrap(filestruct *line);
#endif
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
ssize_t break_line(const char *line, ssize_t goal
@@ -682,6 +688,7 @@ void do_spell(void);
#endif
#ifndef DISABLE_COLOR
void do_linter(void);
void do_formatter(void);
#endif
#ifndef NANO_TINY
void do_wordlinechar_count(void);
@@ -744,10 +751,10 @@ void dump_filestruct_reverse(void);
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
void unget_input(int *input, size_t input_len);
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
void unget_kbinput(int kbinput, bool metakey, bool funckey);
int *get_input(WINDOW *win, size_t input_len);
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
int get_kbinput(WINDOW *win);
int parse_kbinput(WINDOW *win);
int get_escape_seq_kbinput(const int *seq, size_t seq_len);
int get_escape_seq_abcd(int kbinput);
int parse_escape_seq_kbinput(WINDOW *win, int kbinput);
@@ -763,8 +770,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
#ifndef DISABLE_MOUSE
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
#endif
const sc *get_shortcut(int menu, int *kbinput, bool *meta_key);
const sc *first_sc_for(int menu, void (*func)(void));
const sc *get_shortcut(int *kbinput);
void blank_line(WINDOW *win, int y, int x, int n);
void blank_titlebar(void);
void blank_topbar(void);
@@ -775,7 +781,7 @@ void check_statusblank(void);
char *display_string(const char *buf, size_t start_col, size_t len, bool
dollars);
void titlebar(const char *path);
void set_modified(void);
extern void set_modified(void);
void statusbar(const char *msg, ...);
void bottombars(int menu);
void onekey(const char *keystroke, const char *desc, size_t len);
@@ -795,27 +801,11 @@ void display_main_list(void);
void do_cursorpos(bool constant);
void do_cursorpos_void(void);
void do_replace_highlight(bool highlight, const char *word);
const char *flagtostr(int flag);
const subnfunc *sctofunc(sc *s);
const subnfunc *getfuncfromkey(WINDOW *win);
void print_sclist(void);
sc *strtosc(char *input);
function_type strtokeytype(const char *str);
int strtomenu(char *input);
void assign_keyinfo(sc *s);
void xon_complaint(void);
void xoff_complaint(void);
int sc_seq_or (void (*func)(void), int defaultval);
void do_suspend_void(void);
void enable_nodelay(void);
void disable_nodelay(void);
#ifdef HAVE_REGEX_H
extern const char *regexp_msg;
#endif
#ifndef DISABLE_EXTRA
void do_credits(void);
#endif
@@ -836,7 +826,7 @@ void backup_file_void(void);
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);
void no_replace_void(void);
void ext_cmd_void(void);
void flip_replace_void(void);
void flip_execute_void(void);
#endif /* !PROTO_H */

View File

@@ -95,7 +95,6 @@ static const rcoption rcopts[] = {
{"smarthome", SMART_HOME},
{"smooth", SMOOTH_SCROLL},
{"tabstospaces", TABS_TO_SPACES},
{"undo", UNDOABLE},
{"whitespace", 0},
{"wordbounds", WORD_BOUNDS},
{"softwrap", SOFTWRAP},
@@ -144,7 +143,9 @@ void rcfile_error(const char *msg, ...)
fprintf(stderr, "\n");
}
#endif /* !DISABLE_NANORC */
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
/* Parse the next word from the string, null-terminate it, and return
* a pointer to the first character after the null terminator. The
* returned pointer will point to '\0' if we hit the end of the line. */
@@ -164,7 +165,9 @@ char *parse_next_word(char *ptr)
return ptr;
}
#endif /* !DISABLE_NANORC || !DISABLE_HISTORIES */
#ifndef DISABLE_NANORC
/* Parse an argument, with optional quotes, after a keyword that takes
* one. If the next word starts with a ", we say that it ends with the
* last " of the line. Otherwise, we interpret it as usual, so that the
@@ -325,6 +328,7 @@ void parse_syntax(char *ptr)
endsyntax->next = NULL;
endsyntax->nmultis = 0;
endsyntax->linter = NULL;
endsyntax->formatter = NULL;
#ifdef DEBUG
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
@@ -383,7 +387,7 @@ void parse_syntax(char *ptr)
int check_bad_binding(sc *s)
{
#define BADLISTLEN 1
int badtypes[BADLISTLEN] = {META};
key_type badtypes[BADLISTLEN] = {META};
int badseqs[BADLISTLEN] = { 91 };
int i;
@@ -394,6 +398,24 @@ int check_bad_binding(sc *s)
return 0;
}
/* Check whether the given executable function is "universal" (meaning
* any horizontal movement or deletion) and thus is present in almost
* all menus. */
bool is_universal(void (*func))
{
if (func == do_left || func == do_right ||
func == do_home || func == do_end ||
#ifndef NANO_TINY
func == do_prev_word_void || func == do_next_word_void ||
#endif
func == do_verbatim_input || func == do_cut_text_void ||
func == do_delete || func == do_backspace ||
func == do_tab || func == do_enter)
return TRUE;
else
return FALSE;
}
/* Bind or unbind a key combo, to or from a function. */
void parse_binding(char *ptr, bool dobind)
{
@@ -446,7 +468,7 @@ void parse_binding(char *ptr, bool dobind)
funcptr = ptr;
ptr = parse_next_word(ptr);
if (!strcmp(funcptr, "")) {
if (funcptr[0] == '\0') {
rcfile_error(N_("Must specify a function to bind the key to"));
return;
}
@@ -455,7 +477,7 @@ void parse_binding(char *ptr, bool dobind)
menuptr = ptr;
ptr = parse_next_word(ptr);
if (!strcmp(menuptr, "")) {
if (menuptr[0] == '\0') {
/* TRANSLATORS: Do not translate the word "all". */
rcfile_error(N_("Must specify a menu (or \"all\") in which to bind/unbind the key"));
return;
@@ -484,6 +506,30 @@ void parse_binding(char *ptr, bool dobind)
#endif
if (dobind) {
subnfunc *f;
int mask = 0;
/* Tally up the menus where the function exists. */
for (f = allfuncs; f != NULL; f = f->next)
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;
else
menu = menu & mask;
if (!menu) {
rcfile_error(N_("Function '%s' does not exist in menu '%s'"), funcptr, menuptr);
free(newsc);
return;
}
newsc->keystr = keycopy;
newsc->menu = menu;
newsc->type = strtokeytype(newsc->keystr);
@@ -555,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)
@@ -763,8 +805,8 @@ void parse_colors(char *ptr, bool icase)
0)) ? mallocstrcpy(NULL, fgstr) : NULL;
/* Lame way to skip another static counter. */
newcolor->id = endsyntax->nmultis;
endsyntax->nmultis++;
newcolor->id = endsyntax->nmultis;
endsyntax->nmultis++;
}
}
}
@@ -861,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);
@@ -925,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);
@@ -952,8 +992,36 @@ 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);
if (syntaxes == NULL) {
rcfile_error(
N_("Cannot add formatter without a syntax command"));
return;
}
if (*ptr == '\0') {
rcfile_error(N_("Missing formatter command"));
return;
}
if (endsyntax->formatter != NULL)
free(endsyntax->formatter);
/* Let them unset the formatter by using "". */
if (!strcmp(ptr, "\"\""))
endsyntax->formatter = NULL;
else
endsyntax->formatter = mallocstrcpy(NULL, ptr);
}
#endif /* !DISABLE_SPELLER */
#endif /* !DISABLE_COLOR */
/* Check whether the user has unmapped every shortcut for a
@@ -967,19 +1035,19 @@ static void check_vitals_mapped(void)
int inmenus[VITALS] = { MMAIN, MHELP, MWHEREIS, MREPLACE, MGOTOLINE };
for (v = 0; v < VITALS; v++) {
for (f = allfuncs; f != NULL; f = f->next) {
if (f->scfunc == vitals[v] && f->menus & inmenus[v]) {
const sc *s = first_sc_for(inmenus[v], f->scfunc);
if (!s) {
fprintf(stderr, _("Fatal error: no keys mapped for function "
for (f = allfuncs; f != NULL; f = f->next) {
if (f->scfunc == vitals[v] && f->menus & inmenus[v]) {
const sc *s = first_sc_for(inmenus[v], f->scfunc);
if (!s) {
fprintf(stderr, _("Fatal error: no keys mapped for function "
"\"%s\". Exiting.\n"), f->desc);
fprintf(stderr, _("If needed, use nano with the -I option "
fprintf(stderr, _("If needed, use nano with the -I option "
"to adjust your nanorc settings.\n"));
exit(1);
}
break;
}
}
exit(1);
}
break;
}
}
}
}
@@ -1080,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)
@@ -1089,6 +1161,12 @@ void parse_rcfile(FILE *rcstream
parse_colors(ptr, TRUE);
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);
@@ -1265,9 +1343,6 @@ void parse_rcfile(FILE *rcstream
else
rcfile_error(N_("Cannot unset option \"%s\""),
rcopts[i].name);
/* If undo/redo was enabled, reinitialize the lists. */
if (strcasecmp(rcopts[i].name, "undo") == 0)
shortcut_init();
break;
}
}

View File

@@ -32,7 +32,7 @@
static bool search_last_line = FALSE;
/* Have we gone past the last line while searching? */
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
#ifndef DISABLE_HISTORIES
static bool history_changed = FALSE;
/* Have any of the history lists changed? */
#endif
@@ -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)
@@ -137,8 +139,6 @@ int search_init(bool replacing, bool use_answer)
{
int i = 0;
char *buf;
sc *s;
bool meta_key = FALSE, func_key = FALSE;
static char *backupstring = NULL;
/* The search string we'll be using. */
@@ -163,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);
@@ -177,8 +176,7 @@ int search_init(bool replacing, bool use_answer)
TRUE,
#endif
replacing ? MREPLACE : MWHEREIS, backupstring,
&meta_key, &func_key,
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
&search_history,
#endif
/* TRANSLATORS: This is the main search prompt. */
@@ -216,13 +214,7 @@ int search_init(bool replacing, bool use_answer)
statusbar(_("Cancelled"));
return -1;
} else {
void (*func)(void) = NULL;
for (s = sclist; s != NULL; s = s->next)
if ((s->menu & currmenu) && i == s->seq) {
func = s->scfunc;
break;
}
functionptrtype func = func_from_key(&i);
if (i == -2 || i == 0 ) {
#ifdef HAVE_REGEX_H
@@ -249,7 +241,7 @@ int search_init(bool replacing, bool use_answer)
backupstring = mallocstrcpy(backupstring, answer);
return 1;
#endif
} else if (func == do_replace || func == no_replace_void) {
} else if (func == do_replace || func == flip_replace_void) {
backupstring = mallocstrcpy(backupstring, answer);
return -2; /* Call the opposite search function. */
} else if (func == do_gotolinecolumn_void) {
@@ -286,7 +278,6 @@ bool findnextstr(
ssize_t current_y_find = openfile->current_y;
filestruct *fileptr = openfile->current;
const char *rev_start = fileptr->data, *found = NULL;
const subnfunc *f;
time_t lastkbcheck = time(NULL);
/* rev_start might end up 1 character before the start or after the
@@ -297,17 +288,19 @@ 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();
while (TRUE) {
if (time(NULL) - lastkbcheck > 1) {
int input = parse_kbinput(edit);
lastkbcheck = time(NULL);
f = getfuncfromkey(edit);
if (f && f->scfunc == do_cancel) {
if (input && func_from_key(&input) == do_cancel) {
statusbar(_("Cancelled"));
return FALSE;
}
@@ -355,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;
@@ -375,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;
@@ -392,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;
@@ -453,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. */
@@ -474,7 +465,7 @@ void do_search(void)
else
last_search = mallocstrcpy(last_search, answer);
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
/* If answer is not "", add this search string to the search history
* list. */
if (answer[0] != '\0')
@@ -499,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,
@@ -565,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"));
@@ -701,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 */
@@ -743,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;
@@ -761,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;
@@ -774,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);
@@ -797,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
@@ -807,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
@@ -829,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;
}
}
@@ -839,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
@@ -858,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
@@ -885,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
@@ -910,7 +908,6 @@ void do_replace(void)
{
filestruct *edittop_save, *begin;
size_t begin_x, pww_save;
bool meta_key = FALSE, func_key = FALSE;
ssize_t numreplaced;
int i;
@@ -922,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) {
@@ -940,7 +936,7 @@ void do_replace(void)
/* If answer is not "", add answer to the search history list and
* copy answer into last_search. */
if (answer[0] != '\0') {
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
update_history(&search_history, answer);
#endif
last_search = mallocstrcpy(last_search, answer);
@@ -953,16 +949,14 @@ void do_replace(void)
TRUE,
#endif
MREPLACEWITH, last_replace,
&meta_key, &func_key,
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
&replace_history,
#endif
/* TRANSLATORS: This is a prompt. */
edit_refresh, _("Replace with"));
#ifndef NANO_TINY
/* Add this replace string to the replace history list. i == 0
* means that the string is not "". */
#ifndef DISABLE_HISTORIES
/* If the replace string is not "", add it to the replace history list. */
if (i == 0)
update_history(&replace_history, answer);
#endif
@@ -1027,11 +1021,9 @@ void goto_line_posx(ssize_t line, size_t pos_x)
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive, bool save_pos, bool allow_update)
{
bool meta_key = FALSE, func_key = FALSE;
const sc *s;
if (interactive) {
char *ans = mallocstrcpy(NULL, answer);
functionptrtype func;
/* Ask for the line and column. */
int i = do_prompt(FALSE,
@@ -1039,8 +1031,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
TRUE,
#endif
MGOTOLINE, use_answer ? ans : "",
&meta_key, &func_key,
#ifndef NANO_TINY
#ifndef DISABLE_HISTORIES
NULL,
#endif
/* TRANSLATORS: This is a prompt. */
@@ -1055,9 +1046,9 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
return;
}
s = get_shortcut(currmenu, &i, &meta_key);
func = func_from_key(&i);
if (s && s->scfunc == gototext_void) {
if (func == gototext_void) {
/* Keep answer up on the statusbar. */
search_init(TRUE, TRUE);
@@ -1098,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();
}
}
@@ -1157,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) {
@@ -1169,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;
@@ -1304,14 +1294,14 @@ void do_find_bracket(void)
free(bracket_set);
free(found_ch);
}
#endif /* !NANO_TINY */
#ifndef DISABLE_NANORC
#ifndef DISABLE_HISTORIES
/* Indicate whether any of the history lists have changed. */
bool history_has_changed(void)
{
return history_changed;
}
#endif
/* Initialize the search and replace history lists. */
void history_init(void)
@@ -1386,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
@@ -1408,10 +1397,8 @@ void update_history(filestruct **h, const char *s)
*hbot = (*hbot)->next;
(*hbot)->data = mallocstrcpy(NULL, "");
#ifndef DISABLE_NANORC
/* Indicate that the history's been changed. */
history_changed = TRUE;
#endif
/* Set the current position in the list to the bottom. */
*h = *hbot;
@@ -1510,4 +1497,4 @@ char *get_history_completion(filestruct **h, const char *s, size_t len)
return (char *)s;
}
#endif /* !DISABLE_TABCOMP */
#endif /* !NANO_TINY */
#endif /* !DISABLE_HISTORIES */

File diff suppressed because it is too large Load Diff

View File

@@ -72,8 +72,8 @@ bool parse_num(const char *str, ssize_t *val)
assert(str != NULL);
/* Man page for strtol() says this is required, and
it looks like it is! */
/* The manual page for strtol() says this is required, and
* it looks like it is! */
errno = 0;
j = (ssize_t)strtol(str, &first_error, 10);
@@ -261,7 +261,8 @@ bool regexp_bol_or_eol(const regex_t *preg, const char *string)
/* Fix the regex if we're on platforms which require an adjustment
* from GNU-style to BSD-style word boundaries. */
const char *fixbounds(const char *r) {
const char *fixbounds(const char *r)
{
#ifndef GNU_WORDBOUNDS
int i, j = 0;
char *r2 = charalloc(strlen(r) * 5);
@@ -272,15 +273,15 @@ const char *fixbounds(const char *r) {
#endif
for (i = 0; i < strlen(r); i++) {
if (r[i] != '\0' && r[i] == '\\' && (r[i+1] == '>' || r[i+1] == '<')) {
strcpy(&r2[j], "[[:");
r2[j+3] = r[i+1];
strcpy(&r2[j+4], ":]]");
i++;
j += 6;
} else
r2[j] = r[i];
j++;
if (r[i] != '\0' && r[i] == '\\' && (r[i + 1] == '>' || r[i + 1] == '<')) {
strcpy(&r2[j], "[[:");
r2[j + 3] = r[i + 1];
strcpy(&r2[j + 4], ":]]");
i++;
j += 6;
} else
r2[j] = r[i];
j++;
}
r2[j] = '\0';
r3 = mallocstrcpy(NULL, r2);
@@ -642,7 +643,7 @@ filestruct *fsfromline(ssize_t lineno)
for (; f->lineno != lineno && f != openfile->fileage; f = f->prev)
;
else
for (; f->lineno != lineno && f->next != NULL; f = f->next)
for (; f->lineno != lineno && f->next != NULL; f = f->next)
;
if (f->lineno != lineno)

View File

@@ -124,7 +124,7 @@ void get_key_buffer(WINDOW *win)
errcount = 0;
if (nodelay_mode) {
if ((input = wgetch(win)) == ERR)
return;
return;
} else
while ((input = wgetch(win)) == ERR) {
errcount++;
@@ -224,17 +224,17 @@ void unget_input(int *input, size_t input_len)
}
/* Put back the character stored in kbinput, putting it in byte range
* beforehand. If meta_key is TRUE, put back the Escape character after
* putting back kbinput. If func_key is TRUE, put back the function key
* beforehand. If metakey is TRUE, put back the Escape character after
* putting back kbinput. If funckey is TRUE, put back the function key
* (a value outside byte range) without putting it in byte range. */
void unget_kbinput(int kbinput, bool meta_key, bool func_key)
void unget_kbinput(int kbinput, bool metakey, bool funckey)
{
if (!func_key)
if (!funckey)
kbinput = (char)kbinput;
unget_input(&kbinput, 1);
if (meta_key) {
if (metakey) {
kbinput = NANO_CONTROL_3;
unget_input(&kbinput, 1);
}
@@ -298,20 +298,19 @@ int *get_input(WINDOW *win, size_t input_len)
/* Read in a single character. If it's ignored, swallow it and go on.
* Otherwise, try to translate it from ASCII, meta key sequences, escape
* sequences, and/or extended keypad values. Set meta_key to TRUE when
* we get a meta key sequence, and set func_key to TRUE when we get an
* extended keypad value. Supported extended keypad values consist of
* sequences, and/or extended keypad values. Supported extended keypad
* values consist of
* [arrow key], Ctrl-[arrow key], Shift-[arrow key], Enter, Backspace,
* the editing keypad (Insert, Delete, Home, End, PageUp, and PageDown),
* the function keypad (F1-F16), and the numeric keypad with NumLock
* off. */
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
int get_kbinput(WINDOW *win)
{
int kbinput;
/* Read in a character and interpret it. Continue doing this until
* we get a recognized value or sequence. */
while ((kbinput = parse_kbinput(win, meta_key, func_key)) == ERR)
while ((kbinput = parse_kbinput(win)) == ERR)
;
/* If we read from the edit window, blank the statusbar if we need
@@ -326,13 +325,13 @@ int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
* sequences into their corresponding key values. Set meta_key to TRUE
* when we get a meta key sequence, and set func_key to TRUE when we get
* a function key. */
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
int parse_kbinput(WINDOW *win)
{
static int escapes = 0, byte_digits = 0;
int *kbinput, retval = ERR;
*meta_key = FALSE;
*func_key = FALSE;
meta_key = FALSE;
func_key = FALSE;
/* Read in a character. */
if (nodelay_mode) {
@@ -379,7 +378,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
* meta key sequence mode. Set meta_key to
* TRUE, and save the lowercase version of the
* non-escape character as the result. */
*meta_key = TRUE;
meta_key = TRUE;
retval = tolower(*kbinput);
} else
/* One escape followed by a non-escape, and
@@ -469,7 +468,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
* escape counter, set meta_key to TRUE, and
* interpret the escape sequence. */
escapes = 0;
*meta_key = TRUE;
meta_key = TRUE;
retval = parse_escape_seq_kbinput(win,
*kbinput);
}
@@ -545,9 +544,9 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
/* Slang doesn't support KEY_SDC. */
case KEY_SDC:
if (ISSET(REBIND_DELETE))
retval = sc_seq_or(do_delete, *kbinput);
retval = sc_seq_or(do_delete, *kbinput);
else
retval = sc_seq_or(do_backspace, *kbinput);
retval = sc_seq_or(do_backspace, *kbinput);
break;
#endif
#ifdef KEY_SIC
@@ -634,16 +633,26 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
retval = ERR;
break;
#endif
case CONTROL_LEFT:
#ifndef NANO_TINY
retval = sc_seq_or(do_prev_word_void, 0);
#endif
break;
case CONTROL_RIGHT:
#ifndef NANO_TINY
retval = sc_seq_or(do_next_word_void, 0);
#endif
break;
}
/* If our result is an extended keypad value (i.e. a value
* outside of byte range), set func_key to TRUE. */
if (retval != ERR)
*func_key = !is_byte(retval);
func_key = !is_byte(retval);
}
#ifdef DEBUG
fprintf(stderr, "parse_kbinput(): kbinput = %d, meta_key = %s, func_key = %s, escapes = %d, byte_digits = %d, retval = %d\n", *kbinput, *meta_key ? "TRUE" : "FALSE", *func_key ? "TRUE" : "FALSE", escapes, byte_digits, retval);
fprintf(stderr, "parse_kbinput(): kbinput = %d, meta_key = %s, func_key = %s, escapes = %d, byte_digits = %d, retval = %d\n", *kbinput, meta_key ? "TRUE" : "FALSE", func_key ? "TRUE" : "FALSE", escapes, byte_digits, retval);
#endif
free(kbinput);
@@ -709,11 +718,15 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
* Terminal. */
case 'B': /* Esc O 1 ; 5 B == Ctrl-Down on
* Terminal. */
retval = get_escape_seq_abcd(seq[4]);
break;
case 'C': /* Esc O 1 ; 5 C == Ctrl-Right on
* Terminal. */
retval = CONTROL_RIGHT;
break;
case 'D': /* Esc O 1 ; 5 D == Ctrl-Left on
* Terminal. */
retval = get_escape_seq_abcd(seq[4]);
retval = CONTROL_LEFT;
break;
}
}
@@ -806,10 +819,14 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
break;
case 'a': /* Esc O a == Ctrl-Up on rxvt. */
case 'b': /* Esc O b == Ctrl-Down on rxvt. */
case 'c': /* Esc O c == Ctrl-Right on rxvt. */
case 'd': /* Esc O d == Ctrl-Left on rxvt. */
retval = get_escape_seq_abcd(seq[1]);
break;
case 'c': /* Esc O c == Ctrl-Right on rxvt. */
retval = CONTROL_RIGHT;
break;
case 'd': /* Esc O d == Ctrl-Left on rxvt. */
retval = CONTROL_LEFT;
break;
case 'j': /* Esc O j == '*' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
* rxvt/Eterm/Terminal. */
@@ -896,10 +913,14 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
switch (seq[1]) {
case 'a': /* Esc o a == Ctrl-Up on Eterm. */
case 'b': /* Esc o b == Ctrl-Down on Eterm. */
case 'c': /* Esc o c == Ctrl-Right on Eterm. */
case 'd': /* Esc o d == Ctrl-Left on Eterm. */
retval = get_escape_seq_abcd(seq[1]);
break;
case 'c': /* Esc o c == Ctrl-Right on Eterm. */
retval = CONTROL_RIGHT;
break;
case 'd': /* Esc o d == Ctrl-Left on Eterm. */
retval = CONTROL_LEFT;
break;
}
break;
case '[':
@@ -968,11 +989,15 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
* xterm. */
case 'B': /* Esc [ 1 ; 5 B == Ctrl-Down on
* xterm. */
retval = get_escape_seq_abcd(seq[4]);
break;
case 'C': /* Esc [ 1 ; 5 C == Ctrl-Right on
* xterm. */
retval = CONTROL_RIGHT;
break;
case 'D': /* Esc [ 1 ; 5 D == Ctrl-Left on
* xterm. */
retval = get_escape_seq_abcd(seq[4]);
retval = CONTROL_LEFT;
break;
}
}
@@ -1053,7 +1078,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
break;
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
* Linux console/xterm/Terminal;
* Esc [ 6 ^ == PageDown on Eterm. */
* Esc [ 6 ^ == PageDown on Eterm. */
retval = sc_seq_or(do_page_down, 0);
break;
case '7': /* Esc [ 7 ~ == Home on rxvt. */
@@ -1696,14 +1721,14 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
/* Go through the list of functions to determine which
* shortcut in the current menu we released/clicked on. */
for (f = allfuncs; f != NULL; f = f->next) {
if ((f->menus & currmenu) == 0)
if ((f->menus & currmenu) == 0)
continue;
#ifndef DISABLE_HELP
if (!f->help || strlen(f->help) == 0)
continue;
#endif
if (first_sc_for(currmenu, f->scfunc) == NULL)
continue;
continue;
/* Tick off an actually shown shortcut. */
j -= 1;
if (j == 0)
@@ -1715,9 +1740,10 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
/* And put the corresponding key into the keyboard buffer. */
if (f != NULL) {
const sc *s = first_sc_for(currmenu, f->scfunc);
unget_kbinput(s->seq, s->type == META, FALSE);
const sc *s = first_sc_for(currmenu, f->scfunc);
unget_kbinput(s->seq, s->type == META, s->type == FKEY);
}
return 1;
} else
/* Handle releases/clicks of the first mouse button that
* aren't on the current shortcut list elsewhere. */
@@ -1743,7 +1769,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
* wheel is equivalent to moving down three lines. */
for (i = 0; i < 3; i++)
unget_kbinput((mevent.bstate & BUTTON4_PRESSED) ?
sc_seq_or(do_up_void, 0) : sc_seq_or(do_down_void, 0),
sc_seq_or(do_up_void, 0) : sc_seq_or(do_down_void, 0),
FALSE, FALSE);
return 1;
@@ -1764,51 +1790,31 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
* key itself) and meta_key (whether the key is a meta sequence). The
* returned shortcut will be the first in the list that corresponds to
* the given sequence. */
const sc *get_shortcut(int menu, int *kbinput, bool *meta_key)
const sc *get_shortcut(int *kbinput)
{
sc *s;
#ifdef DEBUG
fprintf(stderr, "get_shortcut(): kbinput = %d, meta_key = %s -- ", *kbinput, *meta_key ? "TRUE" : "FALSE");
fprintf(stderr, "get_shortcut(): kbinput = %d, meta_key = %s -- ", *kbinput, meta_key ? "TRUE" : "FALSE");
#endif
/* Check for shortcuts. */
for (s = sclist; s != NULL; s = s->next) {
if ((menu & s->menu)
&& ((s->type == META && *meta_key == TRUE && *kbinput == s->seq)
|| (s->type != META && *kbinput == s->seq))) {
if ((currmenu & s->menu) && *kbinput == s->seq
&& meta_key == (s->type == META)) {
#ifdef DEBUG
fprintf (stderr, "matched seq \"%s\", and btw meta was %d (menu is %x from %x)\n",
s->keystr, *meta_key, menu, s->menu);
s->keystr, meta_key, currmenu, s->menu);
#endif
return s;
}
}
#ifdef DEBUG
fprintf (stderr, "matched nothing, btw meta was %d\n", *meta_key);
fprintf (stderr, "matched nothing, btw meta was %d\n", meta_key);
#endif
return NULL;
}
/* Try to get a function back from a window. Just a wrapper. */
const subnfunc *getfuncfromkey(WINDOW *win)
{
int kbinput;
bool func_key = FALSE, meta_key = FALSE;
const sc *s;
kbinput = parse_kbinput(win, &meta_key, &func_key);
if (kbinput == 0)
return NULL;
s = get_shortcut(currmenu, &kbinput, &meta_key);
if (!s)
return NULL;
return sctofunc((sc *) s);
}
/* Move to (x, y) in win, and display a line of n spaces with the
* current attributes. */
void blank_line(WINDOW *win, int y, int x, int n)
@@ -2248,15 +2254,15 @@ void set_modified(void)
titlebar(NULL);
#ifndef NANO_TINY
if (ISSET(LOCKING)) {
if (!strcmp(openfile->filename, ""))
if (openfile->filename[0] == '\0')
return;
else if (openfile->lock_filename == NULL) {
/* TRANSLATORS: Try to keep this at most 76 characters. */
statusbar(_("Warning: Modifying a file which is not locked, check directory permission?"));
/* TRANSLATORS: Try to keep this at most 76 characters. */
statusbar(_("Warning: Modifying a file which is not locked, check directory permission?"));
} else {
write_lockfile(openfile->lock_filename,
get_full_path(openfile->filename), TRUE);
}
get_full_path(openfile->filename), TRUE);
}
}
#endif
}
@@ -2338,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;
@@ -2368,30 +2377,27 @@ void bottombars(int menu)
for (f = allfuncs, i = 0; i < slen && f != NULL; f = f->next) {
#ifdef DEBUG
fprintf(stderr, "Checking menu items....");
fprintf(stderr, "Checking menu items....");
#endif
if ((f->menus & menu) == 0)
continue;
if (!f->desc || strlen(f->desc) == 0)
if ((f->menus & menu) == 0)
continue;
#ifdef DEBUG
fprintf(stderr, "found one! f->menus = %x, desc = \"%s\"\n", f->menus, f->desc);
fprintf(stderr, "found one! f->menus = %x, desc = \"%s\"\n", f->menus, f->desc);
#endif
s = first_sc_for(menu, f->scfunc);
if (s == NULL) {
s = first_sc_for(menu, f->scfunc);
if (s == NULL) {
#ifdef DEBUG
fprintf(stderr, "Whoops, guess not, no shortcut key found for func!\n");
#endif
continue;
}
continue;
}
wmove(bottomwin, 1 + i % 2, (i / 2) * colwidth);
#ifdef DEBUG
fprintf(stderr, "Calling onekey with keystr \"%s\" and desc \"%s\"\n", s->keystr, f->desc);
fprintf(stderr, "Calling onekey with keystr \"%s\" and desc \"%s\"\n", s->keystr, f->desc);
#endif
onekey(s->keystr, _(f->desc), colwidth + (COLS % colwidth));
i++;
i++;
}
wnoutrefresh(bottomwin);
@@ -2447,17 +2453,20 @@ void reset_cursor(void)
xpt = xplustabs();
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
filestruct *tmp;
openfile->current_y = 0;
for (tmp = openfile->edittop; tmp && tmp != openfile->current; tmp = tmp->next)
openfile->current_y += 1 + strlenpt(tmp->data) / COLS;
openfile->current_y += (strlenpt(tmp->data) / COLS) + 1;
openfile->current_y += xplustabs() / COLS;
if (openfile->current_y < editwinrows)
wmove(edit, openfile->current_y, xpt % COLS);
} else {
} else
#endif
{
openfile->current_y = openfile->current->lineno -
openfile->edittop->lineno;
@@ -2495,10 +2504,11 @@ void edit_draw(filestruct *fileptr, const char *converted, int
/* First simply paint the line -- then we'll add colors or the
* marking highlight on just the pieces that need it. */
mvwaddstr(edit, line, 0, converted);
/* Tell ncurses to really redraw the line without trying to optimize
for what it thinks is already there, because it gets it wrong in
the case of a wide character in column zero. See bug #31743. */
#ifndef USE_SLANG
/* Tell ncurses to really redraw the line without trying to optimize
* for what it thinks is already there, because it gets it wrong in
* the case of a wide character in column zero. See bug #31743. */
wredrawln(edit, line, 1);
#endif
@@ -2508,13 +2518,15 @@ void edit_draw(filestruct *fileptr, const char *converted, int
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
const colortype *tmpcolor = openfile->colorstrings;
/* Set up multi-line color data for this line if it's not yet calculated. */
if (fileptr->multidata == NULL && openfile->syntax
/* Set up multi-line color data for this line if it's not yet
* calculated. */
if (fileptr->multidata == NULL && openfile->syntax
&& openfile->syntax->nmultis > 0) {
int i;
fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
for (i = 0; i < openfile->syntax->nmultis; i++)
fileptr->multidata[i] = -1; /* Assume this applies until we know otherwise. */
fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
for (i = 0; i < openfile->syntax->nmultis; i++)
/* Assume this applies until we know otherwise. */
fileptr->multidata[i] = -1;
}
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
int x_start;
@@ -2601,7 +2613,8 @@ void edit_draw(filestruct *fileptr, const char *converted, int
short md = fileptr->multidata[tmpcolor->id];
if (md == -1)
fileptr->multidata[tmpcolor->id] = CNONE; /* until we find out otherwise */
/* Assume this until we know otherwise. */
fileptr->multidata[tmpcolor->id] = CNONE;
else if (md == CNONE)
goto end_of_loop;
else if (md == CWHOLELINE) {
@@ -2854,15 +2867,17 @@ int update_line(filestruct *fileptr, size_t index)
/* fileptr->data converted to have tabs and control characters
* expanded. */
size_t page_start;
filestruct *tmp;
assert(fileptr != NULL);
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
for (tmp = openfile->edittop; tmp && tmp != fileptr; tmp = tmp->next) {
line += 1 + (strlenpt(tmp->data) / COLS);
}
filestruct *tmp;
for (tmp = openfile->edittop; tmp && tmp != fileptr; tmp = tmp->next)
line += (strlenpt(tmp->data) / COLS) + 1;
} else
#endif
line = fileptr->lineno - openfile->edittop->lineno;
if (line < 0 || line >= editwinrows)
@@ -2873,37 +2888,44 @@ int update_line(filestruct *fileptr, size_t index)
/* Next, convert variables that index the line to their equivalent
* positions in the expanded line. */
#ifndef NANO_TINY
if (ISSET(SOFTWRAP))
index = 0;
else
#endif
index = strnlenpt(fileptr->data, index);
page_start = get_page_start(index);
/* Expand the line, replacing tabs with spaces, and control
* characters with their displayed forms. */
#ifdef NANO_TINY
converted = display_string(fileptr->data, page_start, COLS, TRUE);
#else
converted = display_string(fileptr->data, page_start, COLS, !ISSET(SOFTWRAP));
#ifdef DEBUG
if (ISSET(SOFTWRAP) && strlen(converted) >= COLS - 2)
fprintf(stderr, "update_line(): converted(1) line = %s\n", converted);
fprintf(stderr, "update_line(): converted(1) line = %s\n", converted);
#endif
#endif /* !NANO_TINY */
/* Paint the line. */
edit_draw(fileptr, converted, line, page_start);
free(converted);
#ifndef NANO_TINY
if (!ISSET(SOFTWRAP)) {
#endif
if (page_start > 0)
mvwaddch(edit, line, 0, '$');
if (strlenpt(fileptr->data) > page_start + COLS)
mvwaddch(edit, line, COLS - 1, '$');
#ifndef NANO_TINY
} else {
int full_length = strlenpt(fileptr->data);
size_t full_length = strlenpt(fileptr->data);
for (index += COLS; index <= full_length && line < editwinrows; index += COLS) {
line++;
#ifdef DEBUG
fprintf(stderr, "update_line(): Softwrap code, moving to %d index %lu\n", line, (unsigned long) index);
fprintf(stderr, "update_line(): softwrap code, moving to %d index %lu\n", line, (unsigned long)index);
#endif
blank_line(edit, line, 0, COLS);
@@ -2921,6 +2943,7 @@ int update_line(filestruct *fileptr, size_t index)
extralinesused++;
}
}
#endif /* !NANO_TINY */
return extralinesused;
}
@@ -2973,14 +2996,14 @@ void compute_maxrows(void)
maxrows += editwinrows - n;
#ifdef DEBUG
fprintf(stderr, "compute_maxrows(): maxrows = %i\n", maxrows);
fprintf(stderr, "compute_maxrows(): maxrows = %d\n", maxrows);
#endif
}
/* Scroll the edit window in the given direction and the given number
* of lines, and draw new lines on the blank lines left after the
* scrolling. direction is the direction to scroll, either UP_DIR or
* DOWN_DIR, and nlines is the number of lines to scroll. We change
* scrolling. direction is the direction to scroll, either UPWARD or
* DOWNWARD, and nlines is the number of lines to scroll. We change
* edittop, and assume that current and current_x are up to date. We
* also assume that scrollok(edit) is FALSE. */
void edit_scroll(scroll_dir direction, ssize_t nlines)
@@ -3003,7 +3026,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
* value of direction) nlines lines, or as many lines as we can if
* there are fewer than nlines lines available. */
for (i = nlines; i > 0; i--) {
if (direction == UP_DIR) {
if (direction == UPWARD) {
if (openfile->edittop == openfile->fileage)
break;
openfile->edittop = openfile->edittop->prev;
@@ -3012,13 +3035,16 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
break;
openfile->edittop = openfile->edittop->next;
}
#ifndef NANO_TINY
/* Don't over-scroll on long lines. */
if (ISSET(SOFTWRAP) && (direction == UP_DIR)) {
if (ISSET(SOFTWRAP) && direction == UPWARD) {
ssize_t len = strlenpt(openfile->edittop->data) / COLS;
i -= len;
if (len > 0)
do_redraw = TRUE;
}
#endif
}
/* Limit nlines to the number of lines we could scroll. */
@@ -3036,7 +3062,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
/* Scroll the text of the edit window up or down nlines lines,
* depending on the value of direction. */
scrollok(edit, TRUE);
wscrl(edit, (direction == UP_DIR) ? -nlines : nlines);
wscrl(edit, (direction == UPWARD) ? -nlines : nlines);
scrollok(edit, FALSE);
/* Part 2: nlines is the number of lines in the scrolled region of
@@ -3044,8 +3070,8 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
/* If the top or bottom line of the file is now visible in the edit
* window, we need to draw the entire edit window. */
if ((direction == UP_DIR && openfile->edittop ==
openfile->fileage) || (direction == DOWN_DIR &&
if ((direction == UPWARD && openfile->edittop ==
openfile->fileage) || (direction == DOWNWARD &&
openfile->edittop->lineno + editwinrows - 1 >=
openfile->filebot->lineno))
nlines = editwinrows;
@@ -3066,7 +3092,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
/* If we scrolled down, move down to the line before the scrolled
* region. */
if (direction == DOWN_DIR) {
if (direction == DOWNWARD) {
for (i = editwinrows - nlines; i > 0 && foo != NULL; i--)
foo = foo->next;
}
@@ -3077,8 +3103,8 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
* blank, so we don't need to draw it unless the mark is on or we're
* not on the first page. */
for (i = nlines; i > 0 && foo != NULL; i--) {
if ((i == nlines && direction == DOWN_DIR) || (i == 1 &&
direction == UP_DIR)) {
if ((i == nlines && direction == DOWNWARD) || (i == 1 &&
direction == UPWARD)) {
if (do_redraw)
update_line(foo, (foo == openfile->current) ?
openfile->current_x : 0);
@@ -3106,8 +3132,8 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
openfile->edittop->lineno || openfile->current->lineno >=
openfile->edittop->lineno + maxrows) {
#ifdef DEBUG
fprintf(stderr, "edit_redraw(): line %d was offscreen, oldcurrent = %d edittop = %d",
openfile->current->lineno, old_current->lineno, openfile->edittop->lineno);
fprintf(stderr, "edit_redraw(): line %ld was offscreen, oldcurrent = %ld edittop = %ld",
(long)openfile->current->lineno, (long)old_current->lineno, (long)openfile->edittop->lineno);
#endif
#ifndef NANO_TINY
@@ -3137,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. */
@@ -3201,14 +3225,13 @@ void edit_refresh(void)
if (openfile->current->lineno < openfile->edittop->lineno ||
openfile->current->lineno >= openfile->edittop->lineno +
maxrows) {
#ifdef DEBUG
fprintf(stderr, "edit_refresh(): line = %d, edittop %d + maxrows %d\n", openfile->current->lineno, openfile->edittop->lineno, maxrows);
fprintf(stderr, "edit_refresh(): line = %ld, edittop %ld + maxrows %d\n",
(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;
@@ -3259,12 +3282,14 @@ void edit_update(update_type location)
for (; goal > 0 && foo->prev != NULL; goal--) {
foo = foo->prev;
#ifndef NANO_TINY
if (ISSET(SOFTWRAP) && foo)
goal -= strlenpt(foo->data) / COLS;
#endif
}
openfile->edittop = foo;
#ifdef DEBUG
fprintf(stderr, "edit_udpate(), setting edittop to lineno %d\n", openfile->edittop->lineno);
fprintf(stderr, "edit_update(): setting edittop to lineno %ld\n", (long)openfile->edittop->lineno);
#endif
compute_maxrows();
edit_refresh_needed = TRUE;
@@ -3298,8 +3323,9 @@ void total_refresh(void)
void display_main_list(void)
{
#ifndef DISABLE_COLOR
if (openfile->syntax && openfile->syntax->linter)
set_lint_shortcuts();
if (openfile->syntax
&& (openfile->syntax->formatter || openfile->syntax->linter))
set_lint_or_format_shortcuts();
else
set_spell_shortcuts();
#endif
@@ -3365,14 +3391,14 @@ void do_cursorpos_void(void)
void enable_nodelay(void)
{
nodelay_mode = TRUE;
nodelay(edit, TRUE);
nodelay_mode = TRUE;
nodelay(edit, TRUE);
}
void disable_nodelay(void)
{
nodelay_mode = FALSE;
nodelay(edit, FALSE);
nodelay_mode = FALSE;
nodelay(edit, FALSE);
}
/* Highlight the current word being replaced or spell checked. We
@@ -3410,8 +3436,8 @@ void do_replace_highlight(bool highlight, const char *word)
}
#ifndef DISABLE_EXTRA
#define CREDIT_LEN 57
#define XLCREDIT_LEN 8
#define CREDIT_LEN 54
#define XLCREDIT_LEN 9
/* Easter egg: Display credits. Assume nodelay(edit) and scrollok(edit)
* are FALSE. */
@@ -3433,15 +3459,11 @@ void do_credits(void)
"Rocco Corsi",
"David Lawrence Ramsey",
"David Benbennick",
"Mark Majeres",
"Mike Frysinger",
"Benno Schulenberg",
"Ken Tyler",
"Sven Guckes",
NULL, /* credits[16], handled below. */
"Pauli Virtanen",
"Daniele Medri",
"Clement Laforet",
"Tedi Heriyanto",
"Bill Soudan",
"Christian Weisgerber",
"Erik Andersen",
@@ -3460,6 +3482,7 @@ void do_credits(void)
"Richard Kolb II",
NULL, /* "The Free Software Foundation" */
"Linus Torvalds",
NULL, /* "the many translators and the TP" */
NULL, /* "For ncurses:" */
"Thomas Dickey",
"Pavel Curtis",
@@ -3471,7 +3494,7 @@ void do_credits(void)
"",
"",
"",
"(C) 1999 - 2014",
"(C) 1999 - 2015",
"Free Software Foundation, Inc.",
"",
"",
@@ -3486,20 +3509,12 @@ void do_credits(void)
N_("Brought to you by:"),
N_("Special thanks to:"),
N_("The Free Software Foundation"),
N_("the many translators and the TP"),
N_("For ncurses:"),
N_("and anyone else we forgot..."),
N_("Thank you for using nano!")
};
/* credits[16]: Make sure this name is displayed properly, since we
* can't dynamically assign it above, using Unicode 00F6 (Latin
* Small Letter O with Diaresis) if applicable. */
credits[16] =
#ifdef ENABLE_UTF8
using_utf8() ? "Florian K\xC3\xB6nig" :
#endif
"Florian K\xF6nig";
if (!old_more_space || !old_no_help) {
SET(MORE_SPACE);
SET(NO_HELP);