Compare commits

...

262 Commits

Author SHA1 Message Date
Chris Allegretta
fa695744fd GNU nano 2.5.0 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5483 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-06 05:24:07 +00:00
Chris Allegretta
c4a6725ad6 2015-12-05 Chris Allegretta <chrisa@asty.org>
* src/nano.c (main) : key_defined() is an ncurses-ism.  Add
	better checks for this.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5482 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-06 05:21:43 +00:00
Benno Schulenberg
bb31118fcb Avoiding two compilation warnings.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5481 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-05 11:38:26 +00:00
Benno Schulenberg
26151189ba Updating date and version number for the upcoming release.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5480 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-05 11:04:24 +00:00
Benno Schulenberg
40e1fd37d7 Fixing compilation with --enable-tiny --enable-justify.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5479 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-05 10:16:26 +00:00
Benno Schulenberg
f2da466388 Rewrapping some lines and tweaking some comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5478 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-04 21:11:10 +00:00
Benno Schulenberg
ba8f806705 Fusing three functions into a single one.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5477 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-04 20:54:34 +00:00
Benno Schulenberg
c12d1b87d4 Avoiding a compilation warning.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5476 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-04 11:01:48 +00:00
Benno Schulenberg
ccc9b24f16 Adding a note to the documentation about undo not working after
a justification or reindentation.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5475 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-03 09:34:10 +00:00
Benno Schulenberg
4bc8ff1e6d Discarding the entire undo stack, to prevent nano from making mistakes
when trying to undo edits after an indentation change.
This works around Savannah bug #46591.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5474 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-03 09:17:06 +00:00
Benno Schulenberg
8651fefc68 Discarding the entire undo stack, to prevent nano from dying (or
making mistakes) when trying to undo edits after a justification.
This works around Savannah bug #45531.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5473 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-03 09:03:45 +00:00
Benno Schulenberg
ee5cdcbce5 Moving the trimming of the undo stack into a separate function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5472 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-03 08:50:34 +00:00
Benno Schulenberg
a41968eeef A typo fix by David Lawrence Ramsey,
and an accent fix by myself.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5471 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-03 08:35:40 +00:00
Benno Schulenberg
e76bbc8832 Oh darn... doing too many things at once.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5470 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-02 19:13:06 +00:00
Benno Schulenberg
6fa1e98c8d Ehm... that was a silly, superfluous condition.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5469 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-02 19:11:03 +00:00
Benno Schulenberg
1fbcf0b23d Accepting not just 'Uncut' but also 'Undo' for undoing a justification.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5468 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-02 19:03:34 +00:00
Benno Schulenberg
1ea76eb51b Treating backslashed quotes properly, and
not colouring triple-quoted strings twice.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5467 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-02 10:29:18 +00:00
Benno Schulenberg
5634d7d717 Not colouring triple quotes by themselves (in Python).
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5466 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-02 09:19:04 +00:00
Benno Schulenberg
ad1f1bce7f Adding syntax colouring for nftables.
Original file by Arturo Borrero Gonzalez.
This addresses Debian bug #805288.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5465 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-02 09:14:45 +00:00
Benno Schulenberg
c9e91df4e4 Deleting four superfluous checks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5464 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 13:44:52 +00:00
Benno Schulenberg
07e806e7f2 Unindenting the part that was the 'else'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5463 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 13:33:45 +00:00
Benno Schulenberg
eee07d5755 Renaming a label and eliding an 'else'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5462 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 12:49:17 +00:00
Benno Schulenberg
3d6378b153 Moving a check to a better place.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5461 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 12:35:48 +00:00
Benno Schulenberg
ae22fe03eb Deleting two redundant assignments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5460 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 11:51:10 +00:00
Benno Schulenberg
4ea55c3bf7 Renaming two variables for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5459 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 11:43:13 +00:00
Benno Schulenberg
6a88d8a737 Marking the current buffer as mofified only when actually something
was inserted.  This fixes Savannah bug #45409.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5458 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 11:39:04 +00:00
Benno Schulenberg
42ac5368e1 Allowing an array parameter to be NULL.
This fixes Savannah bug #46420.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5457 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-30 16:44:44 +00:00
Benno Schulenberg
66e21416af Storing and retrieving the correct file size before and after an action.
This fixes Savannah bug #45523.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5456 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-30 16:21:51 +00:00
Benno Schulenberg
6b1566023a Redoing cuts at EOF properly.
This fixes Savannah bug #46541.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5455 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-30 15:49:37 +00:00
Benno Schulenberg
0129299dc9 Eliding a variable, and tweaking some comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5454 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-29 14:15:16 +00:00
Benno Schulenberg
98f2f852dd Deleting two redundant conditions, and moving the least frequent case
to the end.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5453 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-29 13:52:48 +00:00
Benno Schulenberg
ee33503402 Using the main multidata-cache-allocation routine.
(Note that there can only be colorstrings when there /is/ a syntax,
so there is no need to check for the latter here.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5452 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-29 13:20:08 +00:00
Benno Schulenberg
e19a16f0e6 Always setting the multidata to CBEGINBEFORE when an end is found,
also when the coloured part is horizontally scrolled off.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5451 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-29 12:31:49 +00:00
Benno Schulenberg
9e22e8b1b5 Adjusting whitespace and comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5450 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-29 10:43:10 +00:00
Benno Schulenberg
6135e28878 Resetting the multidata a bit less often.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5449 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-29 10:14:25 +00:00
Benno Schulenberg
f9a6eb8bec Evaluating correctly whether to reset the multidata cache.
This fixes Savannah bug #46543.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5448 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-29 10:07:49 +00:00
Benno Schulenberg
b1d6d7f95c Initializing a newly allocated multidata array.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5447 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-28 19:03:33 +00:00
Benno Schulenberg
be01647a18 Allowing the user full control over the values of MALLOC_CHECK_ and
MALLOC_PERTURB_; nano shouldn't override them.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5446 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-28 17:29:39 +00:00
Benno Schulenberg
4a59b12ed4 Warning about an impossible condition, instead of blithely continuing.
And eliding an unneeded variable.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5445 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-26 09:31:33 +00:00
Benno Schulenberg
793d8490de Also the /redoing/ of a Backspace at EOF is a special case.
This fixes Savannah bug #46532.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5444 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-26 08:45:22 +00:00
Benno Schulenberg
cf0c9403e1 Adding Mark Majeres and myself to the AUTHORS file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5443 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-25 10:23:05 +00:00
Benno Schulenberg
530c7862c9 Handling more internal errors, and doing it correctly: showing it
directly on the statusbar instead of as an undid or redid message.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5442 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-25 10:11:54 +00:00
Benno Schulenberg
b255b01b50 Eliding an unneeded variable, and not skipping the end of the function
when things went wrong.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5441 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-25 09:49:27 +00:00
Benno Schulenberg
1b69dd629a Warning about a condition that should never occur,
instead of silently continuing.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5440 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-25 09:27:25 +00:00
Benno Schulenberg
438cb110ff Refreshing the whole edit window only when there are multiline regexes,
and checking for this just once for every burst of keystrokes.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5439 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-25 09:10:02 +00:00
Benno Schulenberg
e0d0ca4b97 Renaming a variable for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5438 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-24 13:28:32 +00:00
Benno Schulenberg
fbe4376822 Inserting a new node into a linked list by using just two parameters:
the insertion point and the new node.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5437 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-24 13:24:01 +00:00
Benno Schulenberg
9c821dfe2e Telling the user on the statusbar when a syntax name given on the
command line does not exist.  This fixes Savannah bug #46503.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5436 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-24 11:42:19 +00:00
Benno Schulenberg
9dc47fdfe5 Recognizing also files with the extensions .make and .mk as Makefiles.
This addresses Debian bug #804845.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5435 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-24 11:09:06 +00:00
Benno Schulenberg
f08d79d204 Making Ctrl+Left and Ctrl+Right work on more terminals by asking
ncurses for the keycodes.  This addresses Debian bug #800681.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5434 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-23 08:52:23 +00:00
Benno Schulenberg
72caa54020 Deleting a node right after unlinking it.
This now mirrors unlink_opennode() and delete_opennode().


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5433 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-22 16:14:42 +00:00
Benno Schulenberg
81f3177a33 Eliding an unneeded variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5432 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-22 16:09:15 +00:00
Benno Schulenberg
6007d6227b Rewrapping, rewriting, renaming, and reordering some things.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5431 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-22 16:08:28 +00:00
Benno Schulenberg
d6bd276c8c Deleting a condition that will never occur.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5430 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-22 16:07:23 +00:00
Benno Schulenberg
c706b79b63 Adding the release marker, and copying the news item from the 2.4 branch.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5429 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-21 19:55:09 +00:00
Benno Schulenberg
1f027a838e Letting the value of a --fill option on the command line
override the value of a "set fill" option in an rcfile.
This fixes Savannah bug #46492.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5428 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-21 19:44:27 +00:00
Benno Schulenberg
c9e8370cec Fixing a typo and adjusting some spacing.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5427 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-21 19:05:10 +00:00
Benno Schulenberg
f9274a5a29 Deleting an unneeded variable alias.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5405 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-12 19:50:33 +00:00
Benno Schulenberg
ec26fd5e7c Storing the correct end position of an inserted file,
and using it for an undo and redo.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5404 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-12 19:01:57 +00:00
Benno Schulenberg
bde996db67 Discarding a now useless function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5403 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-11 19:56:35 +00:00
Benno Schulenberg
7be493047c Oops! Blackout!
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5402 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-11 19:15:36 +00:00
Benno Schulenberg
54c2f6b5ae Chopping the now unused parameter 'undoing'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5401 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-11 19:04:31 +00:00
Benno Schulenberg
f1d9fcc77b Redoing an Enter from stored undo data, instead of running do_enter() again,
because the latter behaves differently depending on the setting of autoindent.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5400 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-11 18:51:39 +00:00
Benno Schulenberg
619f28077c Plugging four memory leaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5399 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-10 15:09:36 +00:00
Benno Schulenberg
02a3a25aa0 Skipping a zero-length match only when there /is/ a match.
(Finally I understood what valgrind was complaining about.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5398 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-10 10:39:12 +00:00
Benno Schulenberg
c43c048783 Accepting longer bug and patch numbers.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5397 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-08 19:44:57 +00:00
Benno Schulenberg
4a23a171b8 Allowing to exit the file browser with the same key as it was entered: ^T.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5396 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-08 19:40:13 +00:00
Benno Schulenberg
a1c03ed5c1 Correcting the logic for adjusting the x position of the mark,
and improving the comments.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5395 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-07 09:49:34 +00:00
Benno Schulenberg
b66e4bfa5b Deleting a redundant assignment.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5394 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-06 21:02:50 +00:00
Benno Schulenberg
a3c9dfa391 Not setting 'openfile->mark_begin' for no reason.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5393 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-06 20:55:46 +00:00
Benno Schulenberg
53fbcf77f2 Not checking whether a function has a help line; it's irrelevant.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5392 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-06 20:25:05 +00:00
Benno Schulenberg
4ede3b494f Truncating an overlong hostname properly instead of bailing out
when writing a lock file.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5391 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-06 20:14:37 +00:00
Benno Schulenberg
452066bc88 Chopping the 'undoing' parameter, so that the calls of do_cut_text() become
more symmetrical: wrapped in add_undo() + update_undo() where needed.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5390 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-02 13:46:40 +00:00
Benno Schulenberg
d0e8887e3b Eliding two variables.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5389 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-02 11:24:22 +00:00
Benno Schulenberg
bf84e5972d Improving several comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5388 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-02 10:40:06 +00:00
Benno Schulenberg
5cbb5115c6 Deleting an unused type definition.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5387 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-02 10:27:02 +00:00
Benno Schulenberg
2418b9486b Correcting the changelog description of an old change.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5386 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-31 20:32:11 +00:00
Benno Schulenberg
df80bfd2fc Improving comments and combining two conditions.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5385 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-31 20:17:09 +00:00
Benno Schulenberg
4a1835fd93 Refreshing the mark's pointer only when it is on the same line as the cursor,
and recalculating the mark's x coordinate only when the mark comes after it.
Also correcting the recalculation in one case.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5384 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-31 19:03:53 +00:00
Benno Schulenberg
c67ab656dc Adding a forgotton bug number to the Changelog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5383 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 21:10:26 +00:00
Benno Schulenberg
3c40b35055 Tweaking the Changelog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5382 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 17:31:34 +00:00
Benno Schulenberg
499c2af385 Removing an 'if' that will never be true, and removing some
assignments that have already been done.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5381 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 17:27:33 +00:00
Benno Schulenberg
bf64514283 Checking for "nothing to redo" earlier, in order to restore the
possible warning about an internal error.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5380 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 17:02:13 +00:00
Benno Schulenberg
b0a2f9853b Skipping the addition of an undo only when the current action equals the
last action.  Necessary for when typing text is broken by an undo+redo.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5379 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 16:52:42 +00:00
Benno Schulenberg
0d9397e5b0 Making ^O work the same way as under Pico when option -t is given:
writing out the file immediately, without prompting.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5378 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 10:36:07 +00:00
Benno Schulenberg
d0b72552bf Oops! You can't swap those two conditions.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5377 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 09:04:30 +00:00
Benno Schulenberg
26eed9d406 Removing a condition that can never occur.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5376 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-28 20:49:16 +00:00
Benno Schulenberg
3059e16c25 Spoofing a line number for the redoing of an INSERT, because
'u->mark_begin_lineno' is being used as the length of the insertion.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5375 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-28 20:24:15 +00:00
Benno Schulenberg
08e5eea5b6 Not calculating the line length twice.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5374 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-27 16:57:32 +00:00
Benno Schulenberg
17b46f04da Rewriting do_next_word() to use the same, simpler logic as do_prev_word().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5373 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-27 16:48:24 +00:00
Benno Schulenberg
b4103321e6 Jumping to the beginning of the current word when in its middle
instead of to the beginning of the preceding word, to match the
behaviour of Pico and of most other editors.  It also rewrites
the entire routine.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5372 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-09-05 09:40:09 +00:00
Benno Schulenberg
6620de0091 Dropping a return value that is never used.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5371 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-09-05 09:22:50 +00:00
Benno Schulenberg
954d04bc59 Forcing a redraw of a line only when it contains a multicolumn character,
as that is the only known situation where things go wrong.  This spares
all regular text a significant slowdown.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5370 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-09-05 09:14:24 +00:00
Benno Schulenberg
9205c28865 Reverting my own patch that claimed that UTF8 is a stateless encoding.
Apparently there is /some/ state somewhere after all.  Don't have time
now to figure out where exactly.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5369 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-09-04 19:34:55 +00:00
Benno Schulenberg
459d9f8ba8 Rewrapping some lines and tweaking two comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5368 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-29 20:14:57 +00:00
Benno Schulenberg
213294e69c Adding a file: syntax colouring for Autoconf files.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5367 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-29 19:52:03 +00:00
Benno Schulenberg
86bbe50a3b Discarding an unneeded extra freeing of the help text.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5366 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-16 17:53:28 +00:00
Benno Schulenberg
8925eabd5e Not bothering to set things to NULL when they will be initialized right away,
nor bothering with a separate initialization function when it's used only once.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5365 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-16 15:21:32 +00:00
Benno Schulenberg
149b1fe439 Removing some duplication in the initialization of a new openfile node.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5364 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-16 13:05:35 +00:00
Benno Schulenberg
a5b29539b1 Renaming and reordering most of 'help_line_len()'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5363 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-16 12:20:24 +00:00
Benno Schulenberg
9e438cdce1 Determining the length of the current line by starting at the very
beginning of it instead of at the wrap location.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5362 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-16 12:15:11 +00:00
Benno Schulenberg
7a1959fb11 Not bothering to pass around a function when it's used only once.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5361 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-16 09:28:33 +00:00
Benno Schulenberg
427eff6780 Adjusting some comments and whitespace.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5360 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-16 09:14:42 +00:00
Benno Schulenberg
5440796f31 Reducing the scope of a variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5359 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-16 08:49:29 +00:00
Benno Schulenberg
a9aa0ef997 Avoiding wide paragraphs of running text in the help screens,
wrapping them at 74 columns if the screen is wider.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5358 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-16 08:43:56 +00:00
Benno Schulenberg
f811846dc5 Allowing to change the file format in restricted mode, but actually disabling
Appending, Prepending, making Backups, and opening the File Browser.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5357 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-13 19:29:55 +00:00
Benno Schulenberg
8a058d1f9a Speeding up the finding of the longest filename in the current folder.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5356 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-13 18:22:29 +00:00
Benno Schulenberg
677e9474f7 Removing the mistaken comparison between a pointer and a literal character.
(It will always be false, so it is apparently unneeded.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5355 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-13 17:46:19 +00:00
Benno Schulenberg
58a0ddebac Not bothering to reset any state, because UTF-8 is a stateless encoding.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5354 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-12 19:27:13 +00:00
Benno Schulenberg
07fdf46154 Avoiding a possibly erroneous message, because failing to delete
the temporary file does not mean that copying failed.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5353 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-11 17:43:08 +00:00
Benno Schulenberg
c9337dd4ed Avoiding a call of copy_file() with a null pointer.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5352 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-11 17:27:30 +00:00
Benno Schulenberg
f5234e583f Making a message sound more definitive instead of temporary.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5351 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-09 18:12:32 +00:00
Benno Schulenberg
ea2b51a41d Removing an unneeded and mistaken condition:
if something should be blanked, then both.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5350 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-09 18:10:13 +00:00
Benno Schulenberg
eac0446c86 Fixing compilation with --enable-tiny: file formats don't exist then.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5349 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-09 16:31:01 +00:00
Benno Schulenberg
90798fbfba Allowing to toggle whitespace display also when support for nanorc files
has not been built in, since the default values are quite usable.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5348 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-09 16:05:50 +00:00
Benno Schulenberg
2a5bd555e7 Putting in the null byte "manually", and only when using UTF-8.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5347 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-08 08:10:57 +00:00
Benno Schulenberg
7e1bc82d98 Improving the formatting of the texi file, to get better HTML
without adding confusing single quotes to the Info document.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5346 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-06 19:42:08 +00:00
Benno Schulenberg
30daf4d43f Letting malloc() help to find initialization failures and uses-after-free.
Change was suggested by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5345 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-06 09:01:33 +00:00
Benno Schulenberg
24d6b7fcf7 Tweaking the documentation. Mainly putting prevword and nextword in
the standard order, and giving the Savannah URL for bug reporting.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5344 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-04 19:51:02 +00:00
Benno Schulenberg
052ad10d11 Advertising the five new bindable functions.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5343 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-04 19:20:51 +00:00
Benno Schulenberg
70cbbda87c Adding the option --unix (and 'set unix'),
to save a file by default in Unix format.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5342 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-04 18:49:57 +00:00
Benno Schulenberg
95e1f55574 Plugging a tiny leak.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5341 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-03 19:52:48 +00:00
Benno Schulenberg
455fb4f063 Plugging a memory leak.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5340 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-03 08:32:52 +00:00
Benno Schulenberg
3d2784e113 Checking the value of shortcut->toggle only if it actually is a toggle.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5339 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-03 08:03:22 +00:00
Benno Schulenberg
8a06dfa4d7 Initializing also openfile->syntax.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5338 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-02 20:27:45 +00:00
Benno Schulenberg
ace151778b Adding "and exit" to the description of --help, for veracity, to match
--version, and to distinguish it more from the description of ^G.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5337 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-01 08:47:38 +00:00
Benno Schulenberg
45f873a6a7 Showing also the dedicated keys in the ^G help text,
to clarify some keys and to see which ones can be rebound.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5336 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-01 08:41:36 +00:00
Benno Schulenberg
e919c22793 Setting each multiline-color value instead of OR-ing it.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5335 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-01 08:35:14 +00:00
Benno Schulenberg
b3e4051ded Adding two new bindable functions which delete all characters
from the cursor to the preceding or succeeding word start.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5334 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-31 11:52:26 +00:00
Benno Schulenberg
20ba559b9f Providing feedback for ^Z when suspension is not enabled.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5333 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-30 20:15:01 +00:00
Benno Schulenberg
b7f7df93df Changing "Justify" to a tag and regrouping a couple.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5332 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-30 19:51:08 +00:00
Benno Schulenberg
6847616aee Differentiating between something being disabled/restricted and
help texts being unavailable.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5331 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-30 18:10:16 +00:00
Benno Schulenberg
104ea6b0c3 Normalizing whitespace after the preceding changes.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5330 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-30 11:29:45 +00:00
Benno Schulenberg
2ee18d635f Not showing ^R and ^T in the help lines in restricted mode (if possible),
to give visual feedback.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5329 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-30 10:37:28 +00:00
Benno Schulenberg
efbf7b6ef3 Making the four toggles that don't have any effect in restricted mode
say that they're disabled.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5328 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-29 20:21:45 +00:00
Benno Schulenberg
5885e34b23 Not showing options that don't have any effect when asking for --help in
restricted mode.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5327 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-29 19:31:50 +00:00
Benno Schulenberg
e4294a211e It is better to say that this function is disabled
than that no linter has been defined.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5326 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-29 17:36:39 +00:00
Benno Schulenberg
0b15c42a5c Dropping two superfluous checks for restricted mode, and
two superfluous checks for the definition of a formatter.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5325 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-28 20:04:18 +00:00
Benno Schulenberg
bff6a905af Reenabling SIGWINCH-es also when invocation of the formatter fails,
and correcting some comments.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5324 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-28 19:39:34 +00:00
Benno Schulenberg
c7f5691637 Making the calculation of the new line size more efficient and symmetrical,
and renaming two variables in the process.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5323 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-26 17:29:34 +00:00
Benno Schulenberg
17ab9a2dba Improving a few comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5322 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-26 17:04:29 +00:00
Benno Schulenberg
f7e8861770 Tweaking a string, to match the --help text.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5321 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-26 09:29:42 +00:00
Benno Schulenberg
4990f74f83 Adding two new bindable functions that repeat the last search command
in a fixed direction without prompting.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5320 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-26 09:23:24 +00:00
Benno Schulenberg
8ffc33cd89 Finding each zero-length match only once, when doing regex replacements.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5319 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-26 08:20:28 +00:00
Benno Schulenberg
ee7b095678 Adding a new bindable function that writes a file to disk without
first asking for its name.  Patch was suggested by Seiya Nuta.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5318 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-25 19:25:50 +00:00
Benno Schulenberg
25c775af21 Mentioning the configure options --disable-histories and --disable-libmagic.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5317 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-23 19:31:36 +00:00
Benno Schulenberg
b967368d41 Finding only valid UTF-8 byte sequences when searching.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5316 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-23 19:18:25 +00:00
Benno Schulenberg
f47813eefa Adding deprecation notices for the options 'const' and 'poslog'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5315 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-23 17:56:54 +00:00
Benno Schulenberg
474b390816 Plugging a few memory leaks.
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5314 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-22 18:02:36 +00:00
Benno Schulenberg
b58676f3c9 Correcting a name in the Changelog; otherwise googling for it is difficult.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5313 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-19 16:01:15 +00:00
Benno Schulenberg
d52f108526 Adjusting some comments for clarity and accuracy, and rewrapping some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5312 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-19 09:25:25 +00:00
Benno Schulenberg
9dc544acbd Accepting again a +LINE argument for each file given on the command line,
instead of only for the first.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5311 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-19 09:01:59 +00:00
Benno Schulenberg
59fdd4db7a Making the release markers stand out more,
plus a few small other fixes.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5310 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-18 19:06:42 +00:00
Benno Schulenberg
f1bd958851 Fixing a few typos and making some updates for 2.4.* in the FAQ.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5309 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-18 12:00:34 +00:00
Benno Schulenberg
74e7521478 Adjusting some comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5308 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-18 10:32:01 +00:00
Benno Schulenberg
3f1878d9a9 Looking for a new start only after an end,
instead of right after the last start.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5307 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-18 07:34:27 +00:00
Benno Schulenberg
6039cd7f6e Avoiding an unfounded warning about a possibly uninitialized variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5306 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-17 21:11:32 +00:00
Benno Schulenberg
1dc298d28b Removing an earlier attempt at making M-W work at startup.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5305 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-17 21:06:46 +00:00
Benno Schulenberg
98ffb642f3 Verifying that a named and existing file is a normal file, to avoid
opening an empty buffer when the name of a directory is specified. 


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5304 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-17 20:40:44 +00:00
Benno Schulenberg
8cde95e170 Using the proper type (off_t) for the size of a file,
and avoiding warnings about too large bit shifts.
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5303 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-17 19:38:22 +00:00
Benno Schulenberg
aa0fd889af Fixing a quote. (Found this with my default syntax colouring.)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5302 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-15 20:21:15 +00:00
Benno Schulenberg
1f866c29db Renaming the 'menu' item to 'menus' in the shortcut struct.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5301 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-15 20:13:05 +00:00
Benno Schulenberg
cadb4f3689 Unabbreviating the long option --poslog to --positionlog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5300 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-15 19:50:55 +00:00
Benno Schulenberg
79526151d5 Unabbreviating the long option --const to --constantshow.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5299 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-15 19:40:37 +00:00
Benno Schulenberg
5e53c6ee9e Preventing a segfault when spellchecking a marked region
and nonewlines isn't set.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5298 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-13 18:04:05 +00:00
Benno Schulenberg
42f307ef75 (Putting in the original patch, from before I got overzealous.)
Removing an unneeded condition -- 'added_magicline' can only be
true when NO_NEWLINES isn't.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5297 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-13 17:57:58 +00:00
Benno Schulenberg
674ab835e8 Arh! I tested that without actually making any spell correction.
That wasn't very clever.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5296 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-13 05:32:17 +00:00
Benno Schulenberg
badbc676fb Removing a stray space from a statusbar message.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5295 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-12 19:31:08 +00:00
Benno Schulenberg
aee86996de Renaming the variable 'totsize_save' to 'size_of_surrounding',
to better describe what it contains.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5294 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-12 19:27:26 +00:00
Benno Schulenberg
3d01486409 Removing the variable 'added_magicline', as it will always be FALSE
and thus will never cause anything to be done.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5293 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-12 19:20:46 +00:00
Benno Schulenberg
5bb096d32f Rearranging a few lines plus some whitespace.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5292 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-10 17:49:30 +00:00
Benno Schulenberg
aff252aed6 Removing two lines of dead code.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5291 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-10 17:42:32 +00:00
Benno Schulenberg
08d9f572a4 Unwrapping some lines and rewrapping some others in a more congenial manner;
tweaking some comments and whitespace and braces.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5290 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-10 17:25:51 +00:00
Benno Schulenberg
ea4b775a3e Eliding an unneeded variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5289 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-10 16:00:12 +00:00
Benno Schulenberg
93e391eba3 Renaming a variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5288 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-10 15:57:49 +00:00
Benno Schulenberg
9fcde23009 Plugging a small memory leak.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5287 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-10 15:54:06 +00:00
Benno Schulenberg
6095ff3d39 Adjusting whitespace and bracings after the previous changes.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5286 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-06 19:17:27 +00:00
Benno Schulenberg
fc7825d00d Not removing and then re-adding the magic line when a Backspace happens
at the end-of-file; just adding a token undo item to be able to put the
cursor back at the very tail of the file.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5285 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-06 19:08:13 +00:00
Benno Schulenberg
8f5fa24e51 Moving the check for a Delete at the end-of-file to a less frequently
travelled code path.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5284 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-06 18:48:15 +00:00
Benno Schulenberg
619666460e Making it more transparent what WAS_FINAL_BACKSPACE does.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5283 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-06 18:03:14 +00:00
Benno Schulenberg
5ac6a87522 Giving each toggle a sequence number, to be able to show them in a fixed order.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5282 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-06 17:51:17 +00:00
Chris Allegretta
05fb283034 move trunk to 2.5 branch
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5281 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-05 08:06:40 +00:00
Chris Allegretta
6edb7a43f2 Type in NEWS
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5280 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-05 08:04:53 +00:00
Chris Allegretta
5190ab9c9b GNU nano 2.4.2 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5277 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-05 07:51:55 +00:00
Benno Schulenberg
b60f555843 Recognizing several more kinds of XML files.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5276 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-28 18:15:41 +00:00
Benno Schulenberg
953ccc990f Unwrapping some lines, rewrapping some others more logically,
plus several other esthetic tweaks.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5275 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-28 14:12:25 +00:00
Benno Schulenberg
296ff1ed2a Not checking again for a condition that was checked before.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5274 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-28 14:04:03 +00:00
Benno Schulenberg
6062a040e1 Limiting the selected file to the available ones in the list.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5273 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-28 06:32:56 +00:00
Benno Schulenberg
954f98c448 Removing a duplicate binding of ^T, to prevent it being shown twice.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5272 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-27 15:58:20 +00:00
Benno Schulenberg
076fcbf631 Removing the obsolete execute flag from the shortcut struct.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5271 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-27 15:47:39 +00:00
Benno Schulenberg
38e8ed14ca Normalizing the whitespace and some comments in src/files.c.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5270 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-27 15:10:58 +00:00
Benno Schulenberg
ecffb85656 Forgetting the case of an empty filename for replace_buffer(),
and not bothering to put the pointer at the top.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5269 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-27 15:03:45 +00:00
Benno Schulenberg
f0bb50306c Renaming three flags for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5268 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-27 09:27:19 +00:00
Benno Schulenberg
412b9fc0a2 Skipping the undo of a backspace *only* when it really
tried to delete the final, magic newline.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5267 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-27 09:17:36 +00:00
Benno Schulenberg
75ac24b25e Verifying that there exists multidata for the found starting line
before trying to use this multidata -- when a file is inserted, all
its lines will not have any multidata associated with them.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5266 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-23 18:06:30 +00:00
Benno Schulenberg
4499520c03 Removing the obsolete long option --undo, and sorting some things.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5265 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-20 18:48:43 +00:00
Benno Schulenberg
7f0003a54b Adding a bug reference.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5264 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-20 12:53:27 +00:00
Benno Schulenberg
57f52a8a20 Reverting the last commit, as it is making things worse:
backspacing at the tail of the file no longer has any efffect.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5263 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-20 09:42:26 +00:00
Benno Schulenberg
e219bb9dba Not deleting the magic line, instead of removing and then re-adding it.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5262 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-20 09:00:22 +00:00
Benno Schulenberg
4310139117 Stopping the changed-files colour from spilling beyond an empty line.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5261 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-20 08:44:31 +00:00
Benno Schulenberg
11fa458677 Colouring key-binding lines in a nanorc file affirmatively
only when the specified menu name is an existing one.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5260 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-20 08:31:27 +00:00
Benno Schulenberg
e06472a249 Keeping homedir NULL when no home directory could be determined,
so that nano will show a message about it.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5259 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-20 08:21:35 +00:00
Benno Schulenberg
a267699440 Making M-W work also right after startup.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5258 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-20 08:10:25 +00:00
Benno Schulenberg
025553769e Deleting two unused things, and adding two comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5257 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-18 19:07:56 +00:00
Benno Schulenberg
7c2f53b2a9 Allowing a tiny nano to enable search and position histories.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5256 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-18 18:51:27 +00:00
Benno Schulenberg
3021a04c1c Improving the visibility of the undo-related debugging messages.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5255 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-17 15:17:09 +00:00
Benno Schulenberg
86cbd959f6 Renaming the parameter 'current_action' to 'action',
in order to match the other functions.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5254 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-17 11:18:20 +00:00
Benno Schulenberg
ef2593695d Oops! Misplaced a closing parenthesis.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5253 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-17 11:12:42 +00:00
Benno Schulenberg
6404101407 Eliding an unneeded variable and correcting two comments.
And putting the more frequent condition first.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5252 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-17 10:59:16 +00:00
Benno Schulenberg
67667af233 Adjusting whitespace after the previous change.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5251 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-17 10:47:00 +00:00
Benno Schulenberg
82373d85f9 Preventing the addition of an extra newline when undoing a Backspace or Delete
at the tail of the file while nonewlines is not set.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5250 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-17 10:41:57 +00:00
Benno Schulenberg
c32a58a826 Not checking for non-NULL before freeing a variable, as it's unnecessary.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5249 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-14 19:14:41 +00:00
Benno Schulenberg
26ae9dbd12 Not bothering to look for any starting matches on the current line
when the whole line has already been coloured.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5248 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-14 18:06:36 +00:00
Benno Schulenberg
d49c267f91 Skipping to the next step when a found start has been qualified as
an end earlier.  This helps with Python's triple-quoted strings.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5247 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-14 17:56:44 +00:00
Benno Schulenberg
2e121fa08c Adding some debugging code to track which multidata codes get assigned.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5246 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-14 15:58:57 +00:00
Benno Schulenberg
e00b3e8587 Making it easy to see what codes a key stroke produces when debugging.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5245 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-11 19:01:28 +00:00
Benno Schulenberg
87e963a2c7 Adding a section to the man page on the non-obvious functioning of
the cutbuffer and the mark.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5244 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-07 20:14:41 +00:00
Benno Schulenberg
74ac8ce407 Clarifying the meaning of the --backupdir option.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5243 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-07 18:45:34 +00:00
Benno Schulenberg
f87de12b96 Improving some formatting, hyphenation, wording and dashes.
And removing some confusing, historical text.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5242 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-07 16:45:09 +00:00
Benno Schulenberg
1a3fa549a9 Showing the node with the command-line options in the main menu.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5241 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-07 10:02:31 +00:00
Benno Schulenberg
0424243e3c Adding the post-install and pre-uninstall rules for the Info document,
plus some tweaks.  (Patch was tested by Kamil Dudka.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5240 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-04 18:05:27 +00:00
Benno Schulenberg
a1c4da8b04 Fixing compilation with --enable-tiny.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5239 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-04 17:59:50 +00:00
Benno Schulenberg
7b2ea40575 Requiring again that the triple quote that starts a docstring
is followed by some character.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5238 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-02 14:53:48 +00:00
Benno Schulenberg
1f3148db4b Colouring also an optional option in apt's sources.list on Debian.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5237 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-02 14:35:21 +00:00
Benno Schulenberg
24f39d3ad1 Tweaking some wordings, adding some missing formatting to the Info document,
and fixing an mdash.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5236 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-02 14:24:19 +00:00
Benno Schulenberg
40bfc729ca Preventing a floating-point exception when the available length
for an answer becomes zero.  The answer will instead wrap to the
next line, which does not look nice but is better than crashing.
Patch by Mahyar Abbaspour.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5235 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-31 08:45:17 +00:00
Benno Schulenberg
01e39f4ff9 Ah, fixing name.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5234 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-28 18:59:41 +00:00
Benno Schulenberg
d297784b87 Allowing a CD name to contain any character.
Changes were suggested by Dani Moller.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5233 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-28 18:56:31 +00:00
Benno Schulenberg
72b437bbd2 Marking window resizes and better file-type detection as done.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5232 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-28 14:56:38 +00:00
Benno Schulenberg
3e8dadfb1b Back to SVN.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5231 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-28 13:51:32 +00:00
Benno Schulenberg
2661d6d397 Using 'width' instead of hardcoded 16. And doing things in the same order
for all three cases: setting the string and then positioning the cursor.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5230 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-28 13:51:03 +00:00
Benno Schulenberg
59187b8051 Normalizing the whitespace after the recent changes in logic.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5229 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-28 13:28:37 +00:00
Benno Schulenberg
75d64e677e Handling a SIGWINCH (which signals a change in window size) not when it
happens but only when checking for keyboard input.  It now reports the
SIGWINCH via a special key value to the calling routine, to allow not
only the main editor but also the help viewer and the file browser to
adapt their display to the new size.
Patch by Mahyar Abbaspour, somewhat edited by Benno.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5228 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-28 13:02:29 +00:00
Benno Schulenberg
c5710d0ef8 Bleh. Adding postgresql to the Makefile.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5227 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-21 07:46:01 +00:00
Benno Schulenberg
de6da120a0 Adding one file: syntax highlighting for PostgreSQL.
Original file by Devrim Gündüz.  (Tweaked by Benno.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5226 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-20 18:57:18 +00:00
Benno Schulenberg
f111c0d6ab Limiting the number of backup files to one hundred thousand, well
before finding a unused filename takes an annoying amount of time.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5225 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-08 21:11:30 +00:00
Benno Schulenberg
55d1e1a9b8 Taking the distant possibility of terabyte files into account,
and in the bargain getting rid of the need to calculate the
number of digits in UINT_MAX.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5224 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-08 19:35:47 +00:00
Benno Schulenberg
2da9cbf1a1 Using character classes correctly.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5223 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-03 15:47:05 +00:00
Benno Schulenberg
a338798559 Adjusting a few comments and line wrappings.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5222 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-03 13:56:51 +00:00
Benno Schulenberg
46464105f2 Displaying an ellipsis only when the filename is longer than
the available space, not when it still fits.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5221 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-03 13:25:24 +00:00
Benno Schulenberg
7f3bd26593 Unwrapping a bunch of comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5220 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-28 20:09:40 +00:00
Benno Schulenberg
9233c98a7e Improving the colouring of message tags in PO files.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5219 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-28 19:22:11 +00:00
Benno Schulenberg
ec8d51bee3 Matching the file regex of a syntax against the absolute,
canonical path instead of against the path the user gave.
This fixes Savannah bug #44288, reported by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5218 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-28 19:18:38 +00:00
Benno Schulenberg
3739016e45 Adding a cross reference.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5217 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-25 15:47:08 +00:00
Benno Schulenberg
df7524d7e8 Renaming the parameter 'whole_word' to 'whole_word_only',
because the first sounds too much like "found_whole" to me.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5216 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-25 15:26:09 +00:00
Benno Schulenberg
b454d9c89b Deleting an always-FALSE parameter.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5215 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-25 15:17:22 +00:00
Benno Schulenberg
af708843f6 Removing the unintended special case for replacing
multiple occurrences of a literal ^ or $.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5214 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-25 14:52:58 +00:00
Benno Schulenberg
ca1983adb4 Eliding another tiny function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5213 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-21 18:47:58 +00:00
Benno Schulenberg
1cf22d4d4f Initializing the search and replace strings in a central place.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5212 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-21 18:42:11 +00:00
Benno Schulenberg
583a30e971 Saving and restoring the global flags the short and quick way.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5211 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-21 17:37:59 +00:00
Benno Schulenberg
6bdcc8faa9 Saving the settings of the global case-sens, direction, and regexp flags,
and restoring them on exit.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5210 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-21 17:27:33 +00:00
Benno Schulenberg
e68759bf12 Deleting redundant reprises of a bol/eol regular-expression search.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5209 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-20 18:01:06 +00:00
Benno Schulenberg
ec0e0235fa Renaming a function to the simpler 'need_statusbar_update()'
as there is no vertical counterpart.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5208 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-20 08:35:41 +00:00
Benno Schulenberg
7edd350593 Fusing two identical functions into one: need_screen_update().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5207 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-20 08:16:41 +00:00
Benno Schulenberg
455a918071 Making sure an invalid starting byte of a multibyte sequence is properly
terminated, to prevent the displaying of ghost characters.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5206 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-18 20:07:31 +00:00
Benno Schulenberg
296152ec67 Making the descriptions of the multibuffer feature more accurate.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5205 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-18 16:07:53 +00:00
Benno Schulenberg
6ff772b8d9 Adding two files: syntax highlighting for Emacs Lisp and Guile Scheme.
Patch by Mark Oteiza.  (Tweaked by Benno.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5204 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-18 13:04:57 +00:00
Benno Schulenberg
3de2c704ef Adding a linter definition to four of the syntax files.
Patch by Mark Oteiza.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5203 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-18 11:35:23 +00:00
Benno Schulenberg
cc65a42035 Arranging the movement keys in the File Browser in the order of
ascending stride, as in the Help Viewer.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5202 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-17 10:06:03 +00:00
Benno Schulenberg
5b83d7df51 Binding the unbound Home and End keys to goto_top and goto_bottom in the
Help Viewer and the File Browswer, to mimic the behaviour of these keys
in file viewers and web browsers.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5201 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-17 09:42:04 +00:00
Benno Schulenberg
45772652ff Adding the 2.4.1 release marker to the Changelog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5200 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-17 09:28:18 +00:00
Benno Schulenberg
f225991b05 Distinguishing a failure to launch the linter from receiving 0 parsable lines.
Adding a new function to glue together the invocation-error string.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5199 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-17 09:24:17 +00:00
80 changed files with 25235 additions and 21837 deletions

15
AUTHORS
View File

@@ -9,8 +9,8 @@ Chris Allegretta <chrisa@asty.org>
David Lawrence Ramsey <pooka109@gmail.com>
* Former stable series maintainer. Multiple buffer support,
operating dir (-o) option, bug fixes for display routines,
wrapping code, spelling fixes, const mode, parts of the UTF-8
support, and various other fixes.
wrapping code, spelling fixes, const mode, parts of the
UTF-8 support, and various other fixes.
Jordi Mallach <jordi@gnu.org>
* Debian package maintainer, fellow bug squasher.
@@ -23,8 +23,8 @@ Adam Rogoyski <rogoyski@cs.utexas.edu>
Robert Siemborski <rjs3@andrew.cmu.edu>
* Miscellaneous cut, display, replace, and other bug fixes,
original and new "magic line" code, read_line() function, new
edit display routines.
original and new "magic line" code, read_line() function,
new edit display routines.
Rocco Corsi <rocco.corsi@sympatico.ca>
* Internal spelling code, many optimizations and bug fixes for
@@ -41,3 +41,10 @@ Mike Frysinger <vapier@gentoo.org>
--enable-utf8/--disable-utf8 configure options for ncurses,
many new color regexes and improvements to existing color
regexes for nanorc.sample, and miscellaneous bug fixes.
Mark Majeres <mark@engine12.com>
* A functional undo/redo system, and coloring nano's interface.
Benno Schulenberg <bensberg@justemail.net>
* A bunch of small bug fixes, the cutword routines, some extra
key bindings. Current maintainer.

744
ChangeLog
View File

@@ -1,3 +1,699 @@
GNU nano 2.5.0 - 2015.12.05
2015-12-05 Chris Allegretta <chrisa@asty.org>
* src/nano.c (main) : key_defined() is an ncurses-ism. Add
better checks for this.
2015-12-05 Benno Schulenberg <bensberg@justemail.net>
* src/text.c: Fix compilation with --enable-tiny --enable-justify.
* doc/man/{nano.1,rnano.1,nanorc.5}, doc/texinfo/nano.texi:
Update date and version number to match the upcoming release.
* src/files.c, src/winio.c: Avoid two compilation warnings.
2015-12-04 Benno Schulenberg <bensberg@justemail.net>
* src/proto.h: Avoid a compilation warning.
* src/color.c (reset_multis_for_id, reset_multis_before/after):
Fuse these three functions into a single one.
* src/*.c: Rewrap some lines and tweak some comments.
2015-12-03 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (discard_until): Move the trimming of the undo stack
into a separate function, so it can be used elsewhere.
* src/text.c (do_justify): Discard the entire undo stack, to prevent
nano from dying (or making mistakes) when trying to undo edits after
a justification. This works around Savannah bug #45531.
* src/text.c (do_indent): Also here discard the entire undo stack, to
prevent nano from making mistakes when trying to undo edits after an
indentation change. This works around Savannah bug #46591.
* doc/man/nano.1, doc/texinfo/nano.texi: Add a note about undo not
working after a justification or reindentation.
2015-12-02 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/python.nanorc: Don't colour triple quotes by themselves.
* doc/syntax/python.nanorc: Treat backslashed quotes properly, and
don't colour triple-quoted strings in two manners.
* src/text.c (do_justify): Accept not just the Uncut keystroke but
also the Undo keystroke for undoing a justification.
2015-12-02 Arturo Borrero González <arturo.borrero.glez@gmail.com>
* doc/syntax/nftables.nanorc: New file; syntax colouring for nftables.
This addresses Debian bug #805288.
2015-12-01 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (do_insertfile): Mark the buffer as mofified only when
actually something was inserted. This fixes Savannah bug #45409.
* src/files.c (do_insertfile): Rename two variables for clarity.
* src/text.c (redo_cut): Delete two redundant assignments.
* src/winio.c (edit_draw): Move a check to a better place.
* src/winio.c (edit_draw): Rename a label and elide an 'else'.
* src/winio.c (edit_draw): Unindent after previous change.
* src/color.c (reset_multis_before, reset_multis_after): Delete four
superfluous checks.
2015-11-30 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (redo_cut, update_undo): When cutting reaches the EOF,
and NONEWLINES is set, there is no next line at which to put the
cutting point for a redo. So put it at the very end of the cut.
This fixes Savannah bug #46541.
* src/text.c (add_undo, update_undo, do_undo, do_redo), src/nano.h:
Store and retrieve the correct file size before and after an action.
This fixes Savannah bug #45523.
* src/files.c (free_chararray): Allow the parameter to be NULL.
This fixes Savannah bug #46420.
2015-11-29 Benno Schulenberg <bensberg@justemail.net>
* src/color.c (reset_multis): Evaluate correctly whether to reset
the multidata cache. This fixes Savannah bug #46543.
* src/color.c (reset_multis): Reset the multidata a bit less often.
* src/color.c (reset_multis): Adjust whitespace and comments.
* src/winio.c (edit_draw): When an end is found but nothing is painted
(because the coloured part is horizontally scrolled off), nevertheless
set the multidata to CBEGINBEFORE. This fixes Savannah bug #46545.
* src/winio.c (edit_draw): Use the main cache-allocation routine.
* src/winio.c (edit_draw): Delete two redundant conditions, and move
the least frequent case to the end.
* src/winio.c (edit_draw): Elide a variable, tweak some comments.
2015-11-28 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (main): Allow the user full control over the values of
MALLOC_CHECK_ and MALLOC_PERTURB_; nano shouldn't override these.
This reverts r5344 from August 6.
* src/nano.c (alloc_multidata_if_needed): When allocating a new
multidata array, initialize the array. Problem was betrayed by
using MALLOC_PERTURB_, and was located with valgrind.
2015-11-26 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_redo): Not just the undoing, also the redoing of a
Backspace at EOF is a special case. This fixes Savannah bug #46532.
* src/text.c (do_redo): Warn about an impossible condition, instead
of blithely continuing. And elide an unneeded variable.
2015-11-25 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (do_output): Refreshing the whole edit window (instead
of just the current line) is not needed for any kind of syntax, but
only when there are multiline regexes. And check for this not on
every keystroke in a burst, but just once.
* src/text.c (do_undo): Warn about a condition that should never
occur, instead of silently continuing.
* src/text.c (do_undo): Elide an unneeded variable, and don't skip
the end of this function when things went wrong.
* src/text.c (do_undo, do_redo, add_undo, update_undo): Handle more
possible internal errors, and do it correctly.
* AUTHORS: Add Mark and myself.
2015-11-24 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/makefile.nanorc: Also recognize the extensions .make and
.mk as Makefiles. Suggested by Emmanuel Bourg in Debian bug #804845.
* src/color.c (color_update): Tell the user when a syntax name given
on the command line does not exist. This fixes Savannah bug #46503.
* src/nano.c (splice_node): Inserting a new node into a linked list
requires just two parameters: the insertion point and the new node.
* src/nano.c (splice_node): Rename a variable for clarity.
2015-11-23 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (main), src/winio.c (parse_kbinput): Make Ctrl+Left and
Ctrl+Right work on more terminals by asking ncurses for the keycodes.
This addresses Debian bug #800681 reported by Arturo Borrero González.
2015-11-22 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (add_undo): Delete a condition that will never occur --
this function is only ever called with PASTE when cutbuffer != NULL.
* src/text.c: Rewrap, rewrite, rename, and reorder some things.
* src/text.c (do_undo, do_redo): Elide an unneeded variable.
* src/nano.c (unlink_node): After unlinking, also delete the node.
2015-11-21 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (main): Let the value of a --fill option on the
command line override the value of a "set fill" in an rcfile.
This fixes Savannah bug #46492.
* ChangeLog, NEWS: Add the release marker and copy the news item.
2015-11-21 David Lawrence Ramsey <pooka109@gmail.com>
* ChangeLog, NEWS: Fix a typo and adjust some spacing.
GNU nano 2.4.3 - 2015.11.18
2015-11-12 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_undo, update_undo): Store the correct end position of
an inserted file, and use it when undoing. Fixes Savannah bug #46414.
* src/text.c (add_undo, update_undo): Delete an unneeded alias -- it
wasn't being used consistently anyway.
2015-11-11 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_redo, update_undo): Redo an Enter from the stored
undo data, instead of running do_enter() again, because the latter
will behave differently depending on the setting of autoindent.
This addresses Debian bug #793053 reported by Clancy.
* src/text.c (do_enter): Chop the now unused parameter 'undoing'.
* src/text.c (do_enter_void): Discard this now useless function.
2015-11-10 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (edit_draw): Skip a zero-length match only when there
/is/ a match. Found with valgrind. This fixes Savannah bug #41908.
* src/files.c (do_lockfile, update_poshistory): Plug memory leaks.
2015-11-08 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (shortcut_init): Allow exiting from the file browser
with the same key (^T) as it was entered (as ^G for the help viewer).
* doc/syntax/changelog.nanorc: Accept longer bug and patch numbers.
2015-11-07 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_replace_loop): Correct the logic for adjusting the
x position of the mark -- it happened to work because 'mark_begin' is
NULL when 'old_mark_set' is FALSE. Also improve the comments.
2015-11-06 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (write_lockfile): Don't bail out when the hostname is
overlong, but instead truncate it properly and continue. This fixes
Ubuntu bug #1509081 reported by Sam Reed.
* src/global.c (length_of_list), src/winio.c(get_mouseinput): Don't
check whether a function has a help line, since all of them have.
(And even if some didn't, they would still be valid functions.)
* src/cut.c (cut_line): There is no need to set 'openfile->mark_begin'
just like that; it will be set when 'openfile->mark_set' becomes TRUE.
* src/text.c (do_redo): Delete a redundant assignment.
2015-11-02 Benno Schulenberg <bensberg@justemail.net>
* src/nano.h: Delete an unused type definition.
* src/nano.h: Improve several comments.
* src/text.c (do_wrap): Elide two variables.
* src/cut.c (do_cut_text): Chop the 'undoing' parameter, so that the
calls of this function become more symmetrical.
2015-10-31 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (copy_from_filestruct): When pasting while the mark is
on, the mark's pointer needs to be refreshed only when it is on the
same line as the cursor, and the mark's x coordinate only when the
mark is located after the cursor. This fixes Savannah bug #46347.
* src/nano.c (copy_from_filestruct): Improve comments and combine
two conditions.
* ChangeLog: Correct the description of an old change.
2015-10-29 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (add_undo): Only skip adding an undo when the current
action equals the last action. This condition is needed for when
typing text is broken by an undo+redo. Fixes Savannah bug #46323.
* src/text.c (do_redo): Check for "nothing to redo" earlier, so we
can restore the possible warning about an internal error.
* src/text.c (add_undo): Remove an 'if' that will never be true,
and remove some assignments that have already been done.
2015-10-29 David Lawrence Ramsey <pooka109@gmail.com>
* src/files.c (do_writeout), src/nano.c (no_current_file_name_warning,
do_exit): When option -t is given, make ^O work the same way as under
Pico, writing out the file without prompting. And make it work even
better than Pico when the current file doesn't have a name yet. This
fixes Savannah bug #45415.
2015-10-28 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_redo): For an INSERT, 'u->mark_begin_lineno' is not
an actual line number, so spoof it. It can be spoofed, because 'f'
is not used for the INSERT case. This fixes Savannah bug #45524.
* src/text.c (do_redo): Remove a condition that can never occur.
Also rewrite a loop to become somewhat clearer.
2015-10-27 Benno Schulenberg <bensberg@justemail.net>
* src/move.c (do_next_word): Rewrite this function to use the same
logic as do_prev_word(), reducing its number of lines to half.
* src/move.c (do_down): Don't calculate the line length twice. And
in the bargain avoid a warning about comparison of signed/unsigned.
2015-09-05 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (display_string, edit_draw): Force a redraw of a line
only when it contains a multicolumn character, to spare all regular
text this significant slowdown. This fixes Savannah bug #45684
reported by Wyatt Ward.
* src/move.c (do_prev_word): Drop a return value that is never used.
* src/move.c (do_prev_word): When in the middle of a word, jump to
its beginning instead of to the beginning of the preceding word.
Nano now matches the behaviour of Pico and of most other editors.
This fixes Savannah bug #45413.
2015-09-04 Benno Schulenberg <bensberg@justemail.net>
* src/chars.c: Reverting r5354 from August 12. This fixes Savannah
bug #45874. Apparently there is /some/ state somewhere after all.
2015-08-29 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/autoconf.nanorc: New file; syntax colouring for Autoconf.
* src/files.c: Rewrap some lines and tweak two comments.
2015-08-16 Benno Schulenberg <bensberg@justemail.net>
* src/help.c (help_init, help_line_len): Avoid wide paragraphs of text
in the help screens: wrap them at 74 columns if the screen is wider.
* src/help.c (help_init): Reduce the scope of a variable.
* src/help.c: Adjust some comments and whitespace.
* src/help.c (do_help, do_help_void): Don't bother passing a function
when it's used only once.
* src/help.c (help_line_len): The wrap location can be beyond the EOL,
so for determining the length of the current line, don't start at that
location but at the beginning. This fixes Savannah bug #45770.
* src/help.c (help_line_len): Rename and reorder most of it.
* src/nano.c (make_new_opennode), src/files.c (initialize_buffer):
Remove some duplication in the initialization of a new openfile node.
* src/nano.c (make_new_opennode): Don't bother setting things to NULL
when they will be initialized right away.
* src/files.c (make_new_buffer): Don't bother with a separate function
when it's used only once, right there.
* src/help.c (help_init): Since the new SIGWINCH handling, a resizing
of the window will no longer break out of the help viewer, so there is
no need any more for an extra freeing of the help text.
2015-08-13 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_find_bracket): Remove mistaken comparison between
pointer and literal character. Found with cppcheck.
* src/browser.c (browser_init): Speed up the finding of the longest
filename: don't limit the value to that of COLS all the time, as this
is done later anyway, and don't bother skipping the dot entry.
* src/global.c (shortcut_init): In restricted mode, allow changing
the file format, but actually disable Appending, Prepending, making
Backups, and opening the File Browser.
2015-08-12 Benno Schulenberg <bensberg@justemail.net>
* src/chars.c: UTF-8 is a stateless encoding, so there is no need to
reset any state. [Reverted in r5369 on September 4.]
2015-08-11 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (write_file): Avoid calling copy_file() with a null
pointer. Found with cppcheck.
* src/files.c (write_file): A failure to delete the temporary file
does not mean that it wasn't copied properly.
2015-08-09 Benno Schulenberg <bensberg@justemail.net>
* src/global.c, src/help.c (help_init), src/nano.c (do_toggle, main),
src/winio.c (display_string, statusbar): Allow toggling the display
of whitespace also when support for nanorc files was not built in,
because the default values are quite usable.
* src/files.c (read_file), src/rcfile.c, src/nano.c (main, usage):
Fix compilation with --enable-tiny; file formats are not available
then, so option --unix has no place; also add its description.
* src/nano.c (finish): Remove an unneeded and mistaken condition.
* src/nano.c (say_there_is_no_help): Make it sound more definitive.
2015-08-08 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (display_string): For some reason the reallocation done
by null_at() messes things up. So put in the null byte "manually".
This is a fix -- or workaround -- for Savannah bug #45718.
2015-08-06 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (main): For --enable-debug builds, let malloc() help
to find initialization failures and uses-after-free. Suggested by
Mike Frysinger. [Reverted in r5446 on November 28.]
* doc/texinfo/nano.texi: Improve the formatting, using @t to mark
double-quoted literal strings, @: to mark periods that do not end
sentences, and @. to mark a finishing period after a capital.
2015-08-04 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (main), src/files.c (read_file), src/rcfile.c,
doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Add
the option --unix, to save a file by default in Unix format.
* doc/nanorc.sample.in: Advertise the five new bindable functions.
* doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Tweaks.
2015-08-03 Benno Schulenberg <bensberg@justemail.net>
* src/rcfile.c (parse_binding): Check the value of shortcut->toggle
only if it actually is a toggle. Found with valgrind.
* src/files.c (write_lockfile): Plug a leak. Found with valgrind.
* src/rcfile.c (parse_binding): Plug a tiny leak.
2015-08-02 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (initialize_buffer): Initialize also openfile->syntax.
This addresses Debian bug #787914 reported by Paul Wise.
2015-08-01 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (precalc_multicolorinfo): Set each multiline-color
value instead of OR-ing it. This fixes Savannah bug #45640.
* src/help.c (help_init): Show also the dedicated keys in the
^G help text. This helps to clarify some keys, and helps to
see which ones could easily be rebound.
* src/nano.c (usage): Add "and exit" to the description of --help,
to match --version, and to distinguish it more from ^G.
2015-07-31 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_cutword, do_cut_prev_word, do_cut_next_word),
src/global.c (shortcut_init, strtosc), doc/texinfo/nano.texi,
doc/man/nanorc.5: Add two new bindable functions, 'cutwordleft'
and 'cutwordright', which delete all characters from the cursor
to the preceding or succeeding word start. Fixes bug #32803.
2015-07-30 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (shortcut_init): Don't show ^R and ^T in the help
lines in restricted mode (if possible), to give visual feedback.
* src/*.c: Normalize the whitespace after the preceding changes.
* src/nano.c (show_restricted_warning, say_there_is_no_help):
Differentiate between something being disabled/restricted (because
of the way of invocation) and help texts being unavailable (which
is a compile-time decision).
* src/global.c (shortcut_init): Change "Justify" to a tag and regroup.
* src/nano.c (do_suspend_void, do_suspend): Provide feedback when
suspension is not enabled; and it cannot be enabled in restricted
mode any longer, so there is no need to check for that any more.
2015-07-29 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_linter): When the linter is called in restricted mode
(possible when nano was built with --disable-speller), it is better to
say that this function is disabled than that no linter was defined.
* src/nano.c (usage): When asking for --help in restricted mode, don't
show options that don't have any effect.
* src/nano.c (do_toggle): Make the four toggles that don't have any
effect in restricted mode say that they're disabled.
2015-07-28 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_formatter), src/nano.c (allow_pending_sigwinch):
Reenable SIGWINCH-es also when invoking the formatter fails, and
correct some comments.
* src/text.c (do_linter, do_formatter): In restricted mode, no nanorc
files are read, so no linter or formatter will be defined, so these
routines will never be called. Also, the formatter will only ever
be called when a syntax applies to the current file and this syntax
defines a formatter, so there is no need to check this again.
2015-07-26 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_replace_loop): When doing regex replacements, find
each zero-length match only once. This fixes Savannah bug #45626.
* src/global.c (shortcut_init, strtosc), src/search.c (do_findnext,
do_findprevious), doc/man/nanorc.5, doc/texinfo/nano.texi: Add two
new bindable functions, 'findnext' and 'findprevious', which repeat
the last search command in a fixed direction without prompting.
* src/global.c (shortcut_init): Tweak a string.
* src/search.c, src/move.c: Improve a few of the comments.
* src/search.c (replace_regexp, replace_line): Rename two variables,
and make the calculation of the new line size more symmetrical.
2015-07-25 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (shortcut_init, strtosc), src/files.c (savefile),
doc/man/nanorc.5, doc/texinfo/nano.texi: Add a new bindable function,
'savefile', which writes a file to disk without first asking for its
name. This implements Savannah patch #8208 submitted by Seiya Nuta.
2015-07-23 Benno Schulenberg <bensberg@justemail.net>
* doc/man/{nano.1,nanorc.5}, doc/texinfo/nano.texi: Add deprecation
notices for the options 'set const', 'set poslog' and '--poslog'.
Suggested by Eitan Adler.
* doc/faq.html: Mention --disable-histories and --disable-libmagic.
* src/chars.c (mbstrcasestr, mbrevstrcasestr): When searching, find
only valid UTF-8 byte sequences. This fixes Savannah bug #45579,
first reported in 2009 by Mike Frysinger.
2015-07-22 Mike Frysinger <vapier@gentoo.org>
* src/files.c (check_dotnano), src/global.c (thanks_for_all_the_fish),
src/rcfile.c (parse_binding): Plug a few memory leaks.
2015-07-19 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (main): Accept again a +LINE argument for each file
given on the command line. This fixes Savannah bug #45576.
* src/nano.c (main): Adjust some comments and rewrap some lines.
2015-07-18 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (edit_draw): When looking for multiline-regex matches,
look for a new start only after an end, instead of right after the
last start. This fixes bug #45525 and bug #41313 on Savannah.
* src/nano.c, src/text.c, src/winio.c: Adjust some comments.
* doc/faq.html: Fix a few typos and make some updates for 2.4.*.
* ChangeLog: Make the release markers stand out more.
2015-07-17 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (open_buffer): Verify that a named and existing file
is a normal file, to avoid opening an empty buffer when the name of
a directory is specified. This fixes Savannah bug #45383 reported
by Mike Frysinger, and also Savannah bug #27839 (which is an echo
from Debian bug #551717 reported by Paul Wise).
* src/files.c (load_history): Remove an earlier attempt to make M-W
work at startup. It no longer worked because the assigned value gets
overwritten by a later initialization of 'last_search' to the empty
string. Found through the use of valgrind.
* src/text.c (do_alt_speller): Avoid an unfounded warning about a
possibly uninitialized variable.
2015-07-17 Mike Frysinger <vapier@gentoo.org>
* src/browser.c (browser_refresh): Use the proper type (off_t) for
the size of a file, and avoid warnings about too large bit shifts.
2015-07-15 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c, src/rcfile.c, doc/nanorc.sample.in, doc/man/nano.1,
doc/man/nanorc.5, doc/texinfo/nano.texi, doc/syntax/nanorc.nanorc:
Unabbreviate the long option --const to --constantshow, and --poslog
to --positionlog, to be more understandable.
* src/nano.h, src/global.c (add_to_sclist), src/help.c (help_init),
src/rcfile.c (parse_binding), src/winio.c (get_shortcut): Rename
the 'menu' item in the sc (shortcut) struct to 'menus', as it can
refer to more than one menu.
2015-07-13 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_int_spell_fix, do_alt_speller): Remove an unneeded
condition; 'added_magicline' can only be true when NO_NEWLINES isn't.
* src/files.c (replace_buffer): Prevent a segfault when spellchecking
a marked region and nonewlines isn't set.
2015-07-12 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_alt_speller): Rename the variable 'totsize_save'
to 'size_of_surrounding', to better describe what it contains.
* src/files.c (read_file): Remove a stray space from a message.
2015-07-10 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (delete_opennode): Plug a small memory leak.
* src/files.c (do_lockfile): Rename a variable; it does not contain
the size of the file but the size of the name.
* src/nano.c (do_toggle): Elide an unneeded variable.
* src/files.c: Unwrap some lines and rewrap some others in a more
congenial manner; tweak some comments and whitespace and braces.
* src/files.c (read_line): Remove two lines of dead code.
* src/files.c (read_line): Rearrange a few lines and some whitespace.
2015-07-06 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (add_to_sclist), src/help.c (help_init), src/nano.h,
src/rcfile.c (parse_binding): When defining the toggles, give each
of them a sequence number, so that, when they are rebound, they can
still be listed in the original order in the help text. This fixes
Savannah bug #45417.
* src/text.c (do_undo): Make it clearer what WAS_FINAL_BACKSPACE does.
* src/text.c (add_undo, do_deletion): Move the check for a Delete at
the end-of-file to a less frequently travelled path.
* src/text.c (do_deletion): If a Backspace happens at the end-of-file,
don't remove and then re-add the magic line; just add an undo item.
* src/help.c (help_init), src/text.c (do_undo): Adjust whitespace and
bracing after the previous changes.
GNU nano 2.4.2 - 2015.07.05
2015-06-28 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (browser_refresh): Limit the selected file to the
available ones in the list -- after a refresh the number may have
decreased. This fixes Savannah bug #45424.
* src/text.c (do_deletion): There is no need to check again for the
line ending -- it was done already in the encompassing 'if'.
* src/text.c: Unwrap some lines, rewrap some others more logically,
plus several other esthetic tweaks.
* doc/syntax/xml.nanorc: Recognize many more kinds of XML files.
This addresses Debian bug #790017 reported by Emmanuel Bourg.
Also colour the strings in tags differently, and add some comments.
2015-06-27 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_undo, add_undo): Skip undoing a backspace *only* when
it really tried to delete the final, magic newline.
* src/nano.h, src/text.c: Rename three flags for clarity.
* src/files.c (replace_buffer): This function is only ever called with
a temporary file as parameter, so forget the case of an empty filename.
Also, don't bother putting the pointer at the top of the buffer, as the
first action after this function is to restore the cursor position.
* src/files.c: Normalize whitespace and comments.
* src/nano.h: Remove obsolete execute flag from the shortcut struct.
* src/global.c (shortcut_init): Remove a duplicate binding of ^T, to
prevent it being shown twice in the ^G help text. It will be rebound
dynamically when for the current syntax another function is available.
2015-06-23 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (edit_draw): Verify that there exists multidata for the
found starting line before trying to use it. When a file is inserted
(^R), it will not have any precalculated multidata associated with it.
This fixes Savannah bug #45377 reported by Cody A. Taylor.
2015-06-20 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_research): If nothing was searched for yet during
this run of nano, take the most recent item from the search history.
This makes M-W work also right after startup, like <n> in vim/less.
* src/utils.c (get_homedir): Keep homedir NULL when no home directory
could be determined, so that nano will show a message about it. This
is a fix for Savannah bug #45343.
* doc/syntax/nanorc.nanorc: Colour key-binding lines affirmatively
only when the specified menu name is an existing one.
* doc/syntax/changelog.nanorc: Stop the changed-files colour from
spilling beyond a blank line. Also highlight releases.
* src/nano.c (main), src/rcfile.c: Remove the obsolete long option
--undo. And sort --help and the softwrap option more consistently.
2015-06-18 Benno Schulenberg <bensberg@justemail.net>
* src/rcfile.c: Allow a tiny nano's ~/.nanorc to enable search and
position histories. Also sort the options more strictly.
* src/nano.h: Delete two unused things, and add two comments.
2015-06-17 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_undo, add_undo): When undoing a Backspace at the tail
of the file and nonewlines is not set, then don't add another newline
but just reposition the cursor. Also, when doing a Delete at the tail
of the file, don't add a superfluous undo structure. This prevents
the appearance of an extra newline when undoing the Backspace/Delete.
Patch partially by Mark Majeres. The problem was first reported in
https://lists.gnu.org/archive/html/nano-devel/2015-06/msg00003.html.
* src/text.c (do_undo): Adjust whitespace after the previous change.
* src/text.c (add_undo): Elide an unneeded variable and correct two
comments. And try to put the more frequent condition first.
* src/text.c (add_undo): Rename the parameter 'current_action' to
'action', to match the other functions.
* src/text.c (do_undo, add_undo, update_undo): Improve the visibility
of the undo-related debugging messages.
2015-06-14 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (edit_draw): Add some debugging code to track which
multidata codes (for multiline regexes) get assigned to which lines.
* src/winio.c (edit_draw): Start and end regexes can be very similar;
so if a found start has been qualified as an end earlier, believe it
and skip to the next step. This helps with Python's docstrings.
* src/winio.c (edit_draw): When the whole line has been coloured,
don't bother looking for any more starts. This prevents some lines
from being erroneously marked as CENDAFTER instead of CWHOLELINE.
* src/*.c: Don't check for non-NULL before freeing; it's unneeded.
2015-06-11 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (get_key_buffer): Add some debugging code to make it
easy to see what codes a key stroke produces.
2015-06-07 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Show the node with the command-line options
in the main menu, to make it easy to find.
* doc/texinfo/nano.texi: Improve some formatting, hyphenation, wording
and dashes. And remove some confusing, historical things.
* doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Clarify the
meaning of --backupdir: it doesn't just specify a directory for saving
backup files, it mainly causes uniquely numbered backups to be made.
* doc/man/nano.1: Add a section on the non-obvious functioning of the
cutbuffer and the mark.
2015-06-04 Benno Schulenberg <bensberg@justemail.net>
* src/nano.h: Fix compilation with --enable-tiny.
* nano.spec.in: Add the post-install and pre-uninstall rules for the
Info document, plus some tweaks. (Patch was tested by Kamil Dudka.)
2015-06-02 Benno Schulenberg <bensberg@justemail.net>
* doc/man/nanorc.5, doc/texinfo/nano.texi: Tweak some wordings, and
add some missing formatting to the Info document, and fix an mdash.
* doc/syntax/debian.nanorc: Colour also an optional option.
This addresses Debian bug #664456 reported by Shawn Landden.
Also shorten the name of the syntax to "sources.list".
* doc/syntax/python.nanorc: Require again that the triple quote that
starts a docstring is followed by some character -- it is better to
*not* colour some strings than far too often colour far too much.
This addresses Debian bug #785508 reported by Alexandre Detiste.
2015-05-31 Mahyar Abbaspour <mahyar.abaspour@gmail.com>
* src/prompt.c (get_statusbar_page_start): Prevent a floating-point
exception when the available length for an answer becomes zero.
2015-05-28 Benno Schulenberg <bensberg@justemail.net>
* src/help.c (do_help), src/prompt.c (do_yesno_prompt): Normalize
the whitespace after the recent changes in logic.
* src/prompt.c (do_yesno_prompt): Use 'width' instead of hardcoded
16. Also always first set the string and then position the cursor.
* TODO: Mark window resizes and better file-type detection as done.
* doc/syntax/debian.nanorc: Allow a CD name to contain any character.
This addresses Debian bug #688892 reported by Dani Möller Montull.
2015-05-28 Mahyar Abbaspour <mahyar.abaspour@gmail.com>
* src/nano.c (handle_sigwinch, regenerate_screen), src/global.c,
src/prompt.c (do_statusbar_input, get_prompt_string, do_yesno_prompt),
src/browser.c (do_browser, browser_refresh), src/help.c (do_help),
src/winio.c (get_key_buffer, unget_input, get_input, parse_kbinput),
src/text.c (do_justify, do_linter), src/nano.h, src/proto.h:
Handle a SIGWINCH (signalling a change in window size) not when it
happens but only when checking for input. Report the SIGWINCH via
a special key value to the calling routine, to allow not only the
main editor but also the help viewer and the file browser to adapt
their display to the new size. (Patch edited by Benno.)
2015-05-20 Devrim Gündüz <devrim@gunduz.org>
* doc/syntax/postgresql.nanorc: New file -- syntax highlighting for
PostgreSQL, first posted as Savannah patch #8601. Trimmed by Benno.
2015-05-08 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (browser_refresh): Take the distant possibility of
terabyte files into account, and in the bargain get rid of the need
to calculate the number of digits in UINT_MAX.
* src/files.c (get_next_filename): Limit the number of backup files
to one hundred thousand -- which should be far more than enough --
before finding an unused filename takes an annoying amount of time.
* src/utils.c (digits): Delete this now unneeded function.
2015-05-03 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (browser_refresh): Display an ellipsis only when the
filename is longer than the available space, not when it still fits.
* src/browser.c, src/nano.c: Adjust a few comments and line wrappings.
* doc/syntax/groff.nanorc: Use character classes correctly.
2015-04-28 Benno Schulenberg <bensberg@justemail.net>
* src/color.c (color_update): Match the file regex of a syntax against
the absolute, canonical path instead of against the path the user gave.
This fixes Savannah bug #44288, reported by Mike Frysinger.
* doc/syntax/po.nanorc: Improve the colouring of message tags.
* src/winio.c (get_escape_seq_kbinput): Unwrap a bunch of comments.
2015-04-25 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_replace_loop): Remove the unintended special
case for replacing multiple occurrences of a literal ^ or $; see
https://lists.gnu.org/archive/html/nano-devel/2015-04/msg00065.html.
* src/search.c (findnextstr): Delete an always-FALSE parameter.
* src/search.c (findnextstr): Rename the parameter 'whole_word'
to 'whole_word_only', for clarity.
2015-04-21 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (findnextfile): Save the settings of the global
case-sens, direction, and regexp flags, and restore them on exit.
And do this not in do_filesearch() but in findnextfile(), so that
it will also work for do_fileresearch().
* src/text.c (do_int_spell_fix): Save and restore the global flags
in the same short and quick way as above.
* src/nano.c (main): Initialize the search and replace strings in
a central place, to get rid of a bunch of ifs.
* src/search.c (search_init_globals): Elide this tiny function.
2015-04-20 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (need_horizontal_update, need_vertical_update): Fuse
two identical functions into one: need_screen_update().
* src/prompt.c (need_statusbar_horizontal_update): Rename function
to need_statusbar_update() as there is no vertical counterpart.
* src/search.c (do_search, do_research): Delete redundant reprises
of a regex search: finding an occurrence only at the very starting
point of the search necessarily means it is the only occurrence.
2015-04-18 Benno Schulenberg <bensberg@justemail.net>
* src/global.c, src/nano.c, doc/man/nanorc.5, doc/texinfo/nano.texi:
Make the descriptions of the multibuffer feature more accurate.
* src/winio.c (display_string): Make sure an invalid starting byte
of a multibyte sequence is properly terminated, so that it doesn't
pick up lingering bytes of any previous content. This prevents the
displaying of ghosts -- characters that aren't really there -- when a
file contains valid ánd invalid UTF-8 sequences. For an example see:
https://lists.gnu.org/archive/html/nano-devel/2015-04/msg00052.html.
Also make two comments more accurate: an invalid multibyte sequence
will never be categorized as a control character or anything else.
2015-04-18 Mark Oteiza <mvoteiza@udel.edu>
* doc/syntax/{python,ruby,sh,tex}.nanorc: Add a linter definition.
* doc/syntax/elisp.nanorc: New file; syntax highlighting for Elisp.
* doc/syntax/guile.nanorc: New file; syntax highlighting for Guile.
2015-04-17 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_alt_speller, do_linter, do_formatter): Distinguish
a failure to launch the linter from receiving zero parsable lines;
add a new function to glue together the invocation-error string.
* src/global.c (shortcut_init): In the Help Viewer and File Browswer,
bind the unbound Home and End keys to goto_top and goto_bottom, to
mimic the behaviour of these keys in file viewers and web browsers.
Also show ^Y and ^V in the WhereisFile menu instead of M-\ and M-/,
for similarity with the WhereIs menu.
* src/global.c (shortcut_init): Arrange the movement keys in the File
Browser in the order of ascending stride, as in the Help Viewer.
GNU nano 2.4.1 - 2015.04.14
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.
@@ -114,7 +810,8 @@
* 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
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
@@ -178,6 +875,7 @@ GNU nano 2.4.0 - 2015.03.22
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.)
@@ -202,6 +900,7 @@ GNU nano 2.3.99pre3 - 2015.02.27
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.
@@ -228,6 +927,7 @@ GNU nano 2.3.99pre2 - 2015.02.06
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
@@ -303,6 +1003,7 @@ GNU nano 2.3.99pre1 - 2015.01.06
* 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.
@@ -349,6 +1050,7 @@ GNU nano 2.3.6 - 2014.07.17
* 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
@@ -679,6 +1381,7 @@ GNU nano 2.3.5 - 2014.07.11
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
@@ -694,6 +1397,7 @@ GNU nano 2.3.4 - 2014.06.02
* 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.
@@ -1512,8 +2216,10 @@ GNU nano 2.3.3 - 2014.05.29
* src/winio.c (set_modified): Check for a filename before trying to lock.
2014-01-24 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (copy_from_filestruct): Check explicitly for mark being set when
trying to partition, as we shouldn't be messing with the x address, etc.
* src/nano.c (copy_from_filestruct): Refresh the mark's pointer when
stuff was pasted into the line where the mark is. This applies
Savannah patch #8180 and fixes the segfault reported on the list:
https://lists.gnu.org/archive/html/nano-devel/2012-07/msg00000.html.
2014-01-01 Chris Allegretta <chrisa@asty.org>
* doc/texinfo/nano.texi: Change '@sp4' since makeinfo 5.1 hates the
@@ -1547,6 +2253,7 @@ GNU nano 2.3.3 - 2014.05.29
Partly fixes an issue reported by Benno Schulenberg.
GNU nano 2.3.2 - 2013.03.23
2013-03-17 Chris Allegretta <chrisa@asty.org>
* Revert r4547 as we should have a new release and the overlap code is not yet
ready for public consumption.
@@ -1603,6 +2310,7 @@ GNU nano 2.3.2 - 2013.03.23
be, and maybe we'll even start checking for it in autoconf!
GNU nano 2.3.1 - 2011.05.10
2011-05-10 Chris Allegretta <chrisa@asty.org>
* text.c (do_enter): Only increment totsize by the auto-indented amount, since the previous
line's size was already counted. Fixes bug reported by Robert Spanjaard.
@@ -1630,6 +2338,7 @@ GNU nano 2.3.1 - 2011.05.10
Fixed extra messages going to stderr, reported by Mike Frysinger.
GNU nano 2.3.0 - 2011.02.26
2011-02-26 Chris Allegretta <chrisa@asty.org>
* Change RAW in function_type enum to RAWINPUT, to fix compilation on AIX,
reported by Richard G Daniel <skunk@iskunk.org>.
@@ -1671,6 +2380,7 @@ GNU nano 2.3.0 - 2011.02.26
* 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.
@@ -1680,6 +2390,7 @@ GNU nano 2.2.6 - 2010.11.22
mode. Fixes Savannah bug #31625 reported by Charlie Somerville.
GNU nano 2.2.5 - 2010.08.05
2010-08-04 Lauri Kasanen <curaga@operamail.comcuraga@operamail.com>
* doc/syntax/mgp.nanorc: New Magicpoint syntax highlighting definition.
@@ -1698,6 +2409,7 @@ GNU nano 2.2.5 - 2010.08.05
#29514: [nano 2.2.2] backup should ignore chown errors.
GNU nano 2.2.4 - 2010.04.15
2010-04-07 Chris Allegretta <chrisa@asty.org>
* doc/man/nano.1,nanorc.5: Remove the backup file warnings now
that a sufficient security fix exists for the backup file code.
@@ -1756,11 +2468,13 @@ GNU nano 2.2.4 - 2010.04.15
bug #28984.
GNU nano 2.2.3 - 2010.02.11
2010-01-28 Chris Allegretta <chrisa@asty.org>
* move.c (do_page_up, do_page_down): Fix for smooth mode not preserving cursor
position. Part one of fix for Savannah bug #21178 by Mike Frysinger.
GNU nano 2.2.2 - 2010.01.17
2010-01-17 Chris Allegretta <chrisa@asty.org>
* nano.c (main), prompt.c (do_statusbar_input): Handle problems with an unmapped
function due to key rebinding, fixes crashes on FreeBSD reported by Eitan
@@ -1811,6 +2525,7 @@ GNU nano 2.2.2 - 2010.01.17
Savannah bug #28299 reported by Mike Frysinger.
GNU nano 2.2.1 - 2009.12.12
2009-12-12 Chris Allegretta <chrisa@asty.org>
* text.c (do_delete), nano.c (do_output): Add check for length of current line
before and after adding/deleting text, and do full refresh if it is now
@@ -1863,6 +2578,7 @@ GNU nano 2.2.1 - 2009.12.12
file, man pages, UPGRADE file, and update copyright notice for the current year.
GNU nano 2.2.0 - 2009.11.30
2009-11-29 Chris Allegretta <chrisa@asty.org>
* prompt.c (get_prompt_string): Universally handle help key when it is disabled.
Fixes Savannah bug #28117 by David Lawrence Ramsey <pooka109@gmail.com>.
@@ -1907,13 +2623,14 @@ GNU nano 2.2.0 - 2009.11.30
* doc/syntax/gentoo.nanorc: Tweak comment highlighting.
GNU nano 2.1.99pre2 - 2009.11.21
2009-11-21 Chris Allegretta <chrisa@asty.org>
* rcfile.c: Add unbinding keyword, fixes Savannah bug #22852 reported by frankd.
* prompt.c (update_statusbar_line): Set statusbar_pww when updating the line.
Fixes Savannah bug #24957 reported by Mike Frysinger.
2009-11-19 Chris Allegretta <chrisa@asty.org>
* nano.c (die_save_file) Try and match the permissions of the file we were
* nano.c (die_save_file): Try and match the permissions of the file we were
editing but only make a minimal effort to do so. Fixes Savannah bug #27273
reported by Mike Frysinger.
@@ -1926,6 +2643,7 @@ GNU nano 2.1.99pre2 - 2009.11.21
is enabled. Fixes Savannah bug #28024 by Mike Frysinger.
GNU nano 2.1.99pre1 - 2009.11.15
2009-11-14 Chris Allegretta <chrisa@asty.org>
* move.c (do_first_line, do_last_line): Just set edit_refresh_needed
rather than get messy.
@@ -1971,6 +2689,7 @@ GNU nano 2.1.99pre1 - 2009.11.15
* winio.c: Clean up some unused variables from the soft wrapping code.
GNU nano 2.1.11 - 2009.09.14
2009-09-12 Chris Allegretta <chrisa@asty.org>
* winio.c (edit_update): properly update edittop when using soft wrapping.
Fixes lack of centering for searching for off-screen answers, found by
@@ -1985,7 +2704,7 @@ GNU nano 2.1.11 - 2009.09.14
2009-09-02 Chris Allegretta <chrisa@asty.org>
* Attempt to check file writability and emit a warning on the status bar
if nano doesn't think the file can be written to. Feature originally
requested by Damien Jolders <madamien@skullsquad.com> et al.
requested by Damien Joldersma <damien@skullsquad.com> et al.
2009-08-29 Chris Allegretta <chrisa@asty.org>
* Fix more soft wrapping issues, particularly with scrolling,
@@ -2009,6 +2728,7 @@ GNU nano 2.1.11 - 2009.09.14
previous undo flag to be implemented consistent with other flags.
GNU nano 2.1.10 - 2009.07.28
2009-07-27 Chris Allegretta <chrisa@asty.org>
* text.c (undo_cut, redo_cut): Don't actually try and undo/redo an empty cut, i.e. the magicline.
Fixes crash on cutting last line discovered by Eitan Adler <eitanadlerlist@gmail.com>.
@@ -2037,6 +2757,7 @@ GNU nano 2.1.10 - 2009.07.28
* doc/man/fr/Makefile.am: Add groff check fix to fr files.
GNU nano 2.1.9 - 2009.02.16
2009-02-16 Chris Allegretta <chrisa@asty.org>
* Add new argument to reset_multis for force redraws without attempting to
guess whether we need to, for functions that we don't have good info about
@@ -2075,6 +2796,7 @@ GNU nano 2.1.9 - 2009.02.16
with syntax highlighting in new buffers, initially reported by Mike Frysinger.
GNU nano 2.1.8 - 2009.02.07
2009-02-06 Chris Allegretta <chrisa@asty.org>
* rcfile.c (parse_include): Abort on being unable to open an included rcfile.
Fixes Savannah bug #25490, nanorc: "include"ing a file which doesn't exist
@@ -2120,6 +2842,7 @@ GNU nano 2.1.8 - 2009.02.07
reported by Eitan Adler <eitanadlerlist@gmail.com>.
GNU nano 2.1.7 - 2008.11.10
2008-10-20 Chris Allegretta <chrisa@asty.org>
* files.c (do_writeout): Add check for file modification when saving
the file so the user can at least know they may be blowing away changes.
@@ -2139,6 +2862,7 @@ GNU nano 2.1.7 - 2008.11.10
next uncut, fixes Savannah bug #24183.
GNU nano 2.1.6 - 2008.10.03
2008-10-03 Pascal Gentil <pascal.gentil@univ-rennes1.fr>
* fortran.nanorc: Sample Fortran syntax highlighting file.
@@ -2170,6 +2894,7 @@ GNU nano 2.1.6 - 2008.10.03
we can't generate ^C without it.
GNU nano 2.1.5 - 2008.08.30
2008-08-29 Chris Allegretta <chrisa@asty.org>
* configure.ac, color.c, rcfile.c, utils.c: 1st attempt at supporting systems
which don't support GNU-style word boundaries. New function fixbounds() to
@@ -2201,6 +2926,7 @@ GNU nano 2.1.5 - 2008.08.30
space on partition - nano claims successful write - file is empty.
GNU nano 2.1.4 - 2008.08.09
2008-08-08 Chris Allegretta <chrisa@asty.org>
* files.c (write_file): Do not go on and attempt to write the main file if writing
the backup file failed, related to Savannah bug #24000.
@@ -2214,11 +2940,12 @@ GNU nano 2.1.4 - 2008.08.09
a struct which may be NULL.
GNU nano 2.1.3 - 2008.08.04
2008-07-23 Chris Allegretta <chrisa@asty.org>
* configure.ac: Add ncursesw dir to include path if lib is detected.
2008-07-11 Mike Frysinger <vapier@gentoo.org>
* doc/nanorc.sample.in: Include the updates files in the default sample nanorc.
* doc/nanorc.sample.in: Include the updated files in the default sample nanorc.
2008-07-11 Fabian Groffen <grobian@gentoo.org>
* nano.c: Don't include langinfo.h if not using ENABLE_UTF8
@@ -2236,8 +2963,8 @@ GNU nano 2.1.3 - 2008.08.04
* global.c: Fix for not having a search history when --disable-justify is used
(Savannah bug #23733).
GNU nano 2.1.2 - 2008.06.24
2008-06-24 Chris Allegretta <chrisa@asty.org>
* rcfile.c: Added function check_bad_binding() to look for sequences which
shouldn't be bound, per Savannah bug #22674.
@@ -2263,6 +2990,7 @@ GNU nano 2.1.2 - 2008.06.24
by Andreas Amann <andreas.amann@tyndall.ie>.
GNU nano 2.1.1 - 2008.04.01
2008-05-31 Chris Allegretta <chrisa@asty.org>
* Added the following contributed files, by owner:
Donnie Berkholz <dberkholz@gentoo.org>
@@ -2270,7 +2998,7 @@ GNU nano 2.1.1 - 2008.04.01
Simon Rupf <simon.rupf@int-ag.ch>
* Sample css.nanorc
Josef 'Jupp' Schugt <jupp@rubyforge.org>
* sample ruby.nanorc
* Sample ruby.nanorc
2008-03-31 Chris Allegretta <chrisa@asty.org>
* global.c: Fix for issues compiling with --enable-tiny and

45
NEWS
View File

@@ -1,9 +1,38 @@
2015.12.05 - GNU nano 2.5.0 "Karma", the the first release of the 2.5
series, is now available. Please note that as of this release,
there will no longer be separate stable and unstable
branches. The development team will prioritize bug fixes as
needed, and make new releases in proportion to the
severity of the bugs which are fixed.
This release includes many of the fixes now in
2.4.3, as well as color synax highlighting improvements,
undo fixes, and many more improvements! Thank you for
using nano!
2015.11.18 - GNU nano 2.4.3 "Apocalypse" is now available for your
downloading pleasure. This release includes a myriad
of fixes including several memory leaks, issues with
color syntax highlighting, search/replace, file
insertion and help menu bugs. Many thanks to
Benno Schulenberg for tireless efforts on the vast
majority of fixes for some time now. As always please
report bugs via the Savannah page, and remember to
Share and Enjoy.
2015.07.05 - GNU nano 2.4.2 "Portorož" is released. This release
includes several fixes, including the ability to resize
when in modes other than the main editing window,
proper displaying of invalid UTF-8 bytes, new syntax
definitions for Elisp, Guile, and PostgreSQL, and
better display of shortcuts in the help menu and file
browser. Thanks for your patience and using nano!
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
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!
@@ -68,12 +97,12 @@
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
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!
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
@@ -84,7 +113,7 @@
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
for catch all highlighting. Finally, nano now has the
for catch all highlighting. Finally, nano now has the
ability to set the color of the title bar, status bar, and
shortcut keys (e.g. "^X") and their descriptions. Again
see the nanorc page for details. There's much more, too
@@ -119,7 +148,7 @@
in your .nanorc. Also included are some fixes for
compilation with g++, and better handling of issues
writing the backup file, which should reduce the need
for the 'set allow_insecure_backup" nanorc option.
for the "set allow_insecure_backup" nanorc option.
Don't stop, get it get it, don't stop, get it get it.
2010.11.22 - GNU nano 2.2.6 "Pimp my BBS" wants you to go to
@@ -165,7 +194,7 @@
This release contains a fix for only one bug, but a
rather irritating one: when paging up/down with smooth
scrolling, the cursor position was not being preserved
due to a bug in 2.2.2. With such a targeted fix
due to a bug in 2.2.2. With such a targeted fix
like this what could POSSIBLY go WRONG? Hahaha.
Enjoy and if you find new bugs, as always please
use Savannah's bug tracker.
@@ -206,7 +235,7 @@
the help keys and replace menu text), more 'final'
fixes for soft wrapping, and several typo and documentation
updates including nanorc tweaks and a new syntax
highlighting file for makefiles. Also included is a long
highlighting file for makefiles. Also included is a long
standing fix for random crashing when using nanorc on
FreeBSD, and nano will no longer clear the screen on
suspend to maintain compatibility with other *nix editors.
@@ -245,7 +274,7 @@
2009.09.14 - GNU nano 2.1.11 is on very thin ice, very thin ice, very thin
ice. This release includes two new features: first, nano
will check whether the current file is writable when it
is opened, and warn if it is not on the status bar. Secondly,
is opened, and warn if it is not on the status bar. Secondly,
a new soft-wrapping (AKA full line display) option is
available, which will attempt to fully display the contents
of lines longer than the width of the screen without the

20
TODO
View File

@@ -17,30 +17,32 @@ For the future (no targeted version, catch-all)
- Allow color syntaxes to apply to more than just color, so that we can
e.g. specify a different alternate spell checker depending on which
file type we have open.
- Allow even better file type detection than we have currently, e.g.
through libmagic?
- Allow setting marks (saved positions, not to be confused with the mark
set via Ctrl-^) at various lines and/or columns in the buffer, and
allow movement between them with a single keystroke? (we're running
out of keystrokes)
allow movement between them with a single keystroke? (We're running
out of keystrokes, though.)
- Allow searching for and replacing newlines.
- Fix handling of bad/incomplete UTF-8 sequences to display one Unicode
FFFD (Replacement Character) per sequence instead of one per byte.
For version 2.4:
For version 2.6:
- New regression framework built on expect.
- Allow text searches in the help browser.
- Handle window resizes better. After we resize, we should stay
wherever we were before we resized, as Pico does.
- Allow text searches in the help viewer.
- Add the ability to move to different lines of the screen with a single
keystroke, e.g. M-` (M-~) to go to the top line, M-& (M-7) to go to
the center line, and M-' (M-") to go to the last line.
- Detect when we're pasting text, so that we can handle it differently
(i.e. faster than currently with screen redraws)
(i.e. faster than currently with screen redraws).
- Allow piping marked text to an external command and replacing it with
the command's output (as the internal spell checker already does with
the "spell" command)?
For version 2.4:
- Handle window resizes better. After we've resized, we should stay
wherever we were before we resized, as Pico does. [DONE]
- Allow even better file-type detection than we have currently, e.g.
through libmagic. [DONE]
For version 2.2:
- Rebindable keys? [DONE]
- Undo/Redo keys (M-U and M-E)? [DONE]

View File

@@ -20,7 +20,7 @@
#
# $Id$
AC_INIT([GNU nano], [2.4.1], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [2.5.0], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
@@ -527,6 +527,7 @@ else
fi
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors() command.]))
AC_CHECK_LIB([$CURSES_LIB_NAME], key_defined, AC_DEFINE(HAVE_KEY_DEFINED, 1, [Define this if your curses library has the key_defined() command.]))
dnl Parse any configure options.

View File

@@ -28,8 +28,8 @@
<a href="#3.6">3.6. How can I make the executable smaller? This is too bloated!</a><br>
<a href="#3.7">3.7. Tell me more about this multibuffer stuff!</a><br>
<a href="#3.8">3.8. Tell me more about this verbatim input stuff!</a><br>
<a href="#3.9">3.9. How do I make a .nanorc file that nano will read when I start it?</a></br>
<a href="#3.9.1">3.9.1. How about in Win32?</a></p></blockquote>
<a href="#3.9a">3.9a. How do I make a .nanorc file that nano will read when I start it?</a><br>
<a href="#3.9b">3.9b. How about in Win32?</a></p></blockquote>
<h2><a href="#4">4. Running</a></h2>
<blockquote><p><a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
<a href="#4.2">4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</a><br>
@@ -84,9 +84,9 @@
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program &quot;establishes a full duplex terminal connection to a remote host&quot;, and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
<blockquote><p>The current stable version of nano *should* be 2.2.6. Of course, you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
<blockquote><p>The current stable version of nano *should* be 2.4.2. Of course, you should always check the <a href="http://www.nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v2.2/nano.1.html">here</a>.</p></blockquote>
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v2.4/nano.1.html">here</a>.</p></blockquote>
<hr width="100%">
<h1><a name="2"></a>2. Where to get GNU nano.</h1>
<h2><a name="2.1"></a>2.1. FTP and WWW sites that carry nano.</h2>
@@ -135,18 +135,20 @@
<h2><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h2>
<blockquote><p>Actually, there are several parts of the editor that can be disabled. You can pass arguments to the <b>configure</b> script that disable certain features. Here's a brief list:</p>
<pre>
<b>--disable-browser</b> Disable built-in file browser
<b>--disable-browser</b> Disable the built-in file browser
<b>--disable-color</b> Disable color and syntax highlighting
<b>--disable-extra</b> Disable extra features, currently only an easter egg
<b>--disable-extra</b> Disable extra features (currently only an easter egg)
<b>--disable-help</b> Disable help functions
<b>--disable-histories</b> Disable the saving of search strings and cursor positions
<b>--disable-justify</b> Disable justify/unjustify functions
<b>--disable-mouse</b> Disable mouse support (and -m flag)
<b>--disable-libmagic</b> Disable the use of libmagic for determining a file's syntax
<b>--disable-mouse</b> Disable mouse support
<b>--disable-multibuffer</b> Disable having multiple file buffers open
<b>--disable-nanorc</b> Disable the use of .nanorc files
<b>--disable-operatingdir</b> Disable setting of operating directory
<b>--disable-operatingdir</b> Disable the setting of an operating directory
<b>--disable-speller</b> Disable spell checker functions
<b>--disable-tabcomp</b> Disable tab completion functions
<b>--disable-wrapping</b> Disable all wrapping of text (and -w flag)</pre>
<b>--disable-wrapping</b> Disable all hard-wrapping of text</pre>
<p>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the marker code that you use with Control-^ to select text). Also, if you know you aren't going to be using other languages you can use <b>--disable-nls</b> to disable internationalization and save a few K to a few dozen K depending on if you have locale support on your system. And finally there's always good old <b>strip</b> to strip all debugging code and code that exists in libraries on your system.</p>
<p>With <b>--disable-wrapping-as-root</b> you can disable any hard-wrapping by default when the user is root, useful to prevent accidentally changing long lines in system configuration files.</p>
</blockquote>
@@ -156,12 +158,12 @@
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
<blockquote><p>To use verbatim input, you must be using nano 1.3.1 or newer. When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message &quot;Verbatim Input&quot;), then press the key(s) that generate the character you want.</p>
<p>Alternatively, if you've enabled Unicode support (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code (from 000000 to 10FFFF, case-insensitive), and the character with the corresponding value will be inserted instead. The prompt will change to &quot;Unicode Input&quot; when you do this.</p></blockquote>
<h2><a name="3.9"></a>3.9. How do I make a .nanorc file that nano will read when I start it?</h2>
<blockquote><p>It's not hard at all! But, your version of nano must not have been compiled with <b>--disable-nanorc</b>, and must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the word <b>set</b> and the getopt_long flag for the feature, for example &quot;set nowrap&quot; or &quot;set suspend&quot;.</p></blockquote>
<h2><a name="3.9.1"></a>3.9. How about in Win32?</h2>
<blockquote><p>If you're using the official nano .zip file and have extracted all the files, you should take the file nano.rc and place it somewhere on your Win32 system (for example if you have write permission to do so, at the top of C:\). Then you must create an Environment variable called HOME which points to the directory where you put nano.rc. In Windows XP, you can get to Environment variables by right-clicking "My Computer" either on the desktop or in the Start Menu, and selecting Properties. This should bring up the System Properties panel. Then click the Advanced Tab, and there should be a button called Environment Variables. Click that to bring up the Environment Variables section. Now, under User Variables you should be able to click the New button, and make a new Variables Name called HOME, with the Variable Value of whatever path you copied nano.rc into (just the directory name; don't add nano.rc onto the end).</p>
<p>We're still working on documentation for enabling synax highlighting on Win32; please bear with us.</p>
<p>Note that the nano.rc file must remain Unix-formated in order for nano to understand it. In other words, you should probably use only nano to edit its config file. Other programs like Wordpad and Notepad will convert the file to DOS format when saving, and the latter does not even properly read Unix-formatted files to begin with.</p></blockquote>
<h2><a name="3.9a"></a>3.9a. How do I make a .nanorc file that nano will read when I start it?</h2>
<blockquote><p>It's not hard at all! But, your version of nano must <b>not</b> have been compiled with <b>--disable-nanorc</b>, and must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the words <b>set</b> and <b>unset</b> plus the long option name for the feature. For example, &quot;set nowrap&quot; or &quot;set smarthome&quot;.</p></blockquote>
<h2><a name="3.9b"></a>3.9b. How about in Win32?</h2>
<blockquote><p>If you're using the official nano .zip file and have extracted all the files, you should take the file nano.rc and place it somewhere on your Win32 system (for example, if you have write permission to do so, at the top of C:\). Then you must create an Environment variable called HOME which points to the directory where you put nano.rc. In Windows XP, you can get to Environment variables by right-clicking "My Computer" either on the desktop or in the Start Menu, and selecting Properties. This should bring up the System Properties panel. Then click the Advanced Tab, and there should be a button called Environment Variables. Click that to bring up the Environment Variables section. Now, under User Variables you should be able to click the New button, and make a new Variables Name called HOME, with the Variable Value of whatever path you copied nano.rc into (just the directory name; don't add nano.rc onto the end).</p>
<p>We're still working on documentation for enabling syntax highlighting on Win32; please bear with us.</p>
<p>Note that the nano.rc file must remain Unix-formatted in order for nano to understand it. In other words, you should probably use only nano to edit its config file. Other programs like Wordpad and Notepad will convert the file to DOS format when saving, and the latter does not even properly read Unix-formatted files to begin with.</p></blockquote>
<hr width="100%">
<h1><a name="4"></a>4. Running</h1>
<h2><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h2>
@@ -182,9 +184,9 @@
<h2><a name="4.5"></a>4.5. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, and Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
<h2><a name="4.6"></a>4.6. nano crashes when I type &lt;insert keystroke here&gt;!</h2>
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or in the <a href="https://savannah.gnu.org/bugs/?group=nano">bug database</a> on Savannah.</p></blockquote>
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or in the <a href="https://savannah.gnu.org/bugs/?group=nano">bug tracker</a> on Savannah.</p></blockquote>
<h2><a name="4.7"></a>4.7. nano crashes when I resize my window. How can I fix that?</h2>
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9, but 2.2.6 is recommended).</p></blockquote>
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9, but 2.4.2 is recommended).</p></blockquote>
<h2><a name="4.8"></a>4.8. [version 1.3.12 and later] I'm using glibc 2.2.3, and nano crashes when I use color support or do regular expression searches. How can I fix that?</h2>
<blockquote><p>It's a bug in glibc 2.2.3. You should upgrade to at least glibc 2.2.4.</p></blockquote>
<h2><a name="4.9"></a>4.9. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
@@ -207,15 +209,15 @@
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
<h2><a name="4.12"></a>4.12. I've compiled nano with color support, but I don't see any color when I run it!</h2>
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Several example configurations are in the <b>doc/syntax</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9">3.9</a>.</p></blockquote>
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Several example configurations are in the <b>doc/syntax</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9a">3.9a</a>.</p></blockquote>
<h2><a name="4.13"></a>4.13. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
<h2><a name="4.14"></a>4.14. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</h2>
<blockquote><p>You have the autoindent feature turned on. Hit Meta-I to turn it off, paste your text, and then hit Meta-I again to turn it back on.</p></blockquote>
<h2><a name="4.15"></a>4.15. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</h2>
<blockquote><p>In nano 2.3.0, cursor-position history was introduced, and both history files now reside under a .nano directory in your home. nano was trying to move this file into the new location so it could continue to use it. This means that if you try and use an earlier version of nano, it will be unable to see your current search history. To fix this, run the following commands:<br>
mv ~/.nano/search_history ~/.nano_history<br>
ln -sf ~/.nano_history ~/.nano/search_history<br>
<p><b>mv ~/.nano/search_history ~/.nano_history</b><br>
<b>ln -sf ~/.nano_history ~/.nano/search_history</b></p>
</p></blockquote>
<hr width="100%">
<h1><a name="5"></a>5. Internationalization</h1>
@@ -256,7 +258,9 @@ Of course, due to the license change you can now use the <A HREF="http://www.was
<h2><a name="7.5"></a>7.5. Can I have write access to the subversion tree?</h2>
<blockquote><p>Re-read Section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
<h2><a name="8"></a>8. ChangeLog</h2>
<blockquote><p>2014/04/24 - A bunch of small fixes and updates. (Benno)<br>
<blockquote><p>
2015/07/18 - More small fixes and updates. (Benno)<br>
2014/04/24 - A bunch of small fixes and updates. (Benno)<br>
2009/11/30 - Update various bits for nano 2.2.x. (DLR)<br>
2009/11/18 - Typo fix. (j.mader@gmail.com)<br>
2008/03/16 - Update docs to refer to subversion instead of CVS, add more words about Alpine, and refer to Savannah for bugs and patches. (chrisa)<br>

View File

@@ -20,7 +20,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH NANO 1 "version 2.4.0" "March 2015"
.TH NANO 1 "version 2.5.0" "December 2015"
.\" Please adjust this date whenever revising the manpage.
.\"
@@ -38,6 +38,27 @@ top of copying Pico's look and feel, \fBnano\fP also implements some
missing (or disabled by default) features in Pico, such as "search and
replace" and "go to line and column number".
.SH EDITING
Entering text and moving around in a file is straightforward: typing the
letters and using the normal cursor movement keys. Commands are entered
by using the Control (^) and the Alt or Meta (M-) keys.
Typing \fB^K\fR deletes the current line and puts it in the cutbuffer.
Consecutive \fB^K\fRs will put all deleted lines together in the cutbuffer.
Any cursor movement or executing any other command will cause the next
\fB^K\fR to overwrite the cutbuffer. A \fB^U\fR will paste the current
contents of the cutbuffer at the current cursor position.
.PP
When a more precise piece of text needs to be cut or copied, one can mark
its start with \fB^6\fR, move the cursor to its end (the marked text will be
highlighted), and then use \fB^K\fR to cut it, or \fBM-6\fR to copy it to the
cutbuffer. One can also save the marked text to a file with \fB^O\fR, or
spell check it with \fB^T\fR.
.PP
The two lines at the bottom of the screen show the most important commands;
the built-in help (\fB^G\fR) lists all the available ones.
The default key bindings can be changed via the .nanorc file -- see
.BR nanorc (5).
.SH OPTIONS
.TP
.B +\fIline\fP,\fIcolumn\fP
@@ -53,12 +74,13 @@ already at that position, it will jump to the true beginning of the
line.
.TP
.BR \-B ", " \-\-backup
When saving a file, back up the previous version of it to the current
When saving a file, back up the previous version of it, using the current
filename suffixed with a tilde (\fB~\fP).
.TP
.BR \-C\ \fIdirectory\fR ", " \-\-backupdir= \fIdirectory
Set the directory where \fBnano\fP puts unique backup files, if file
backups are enabled.
Make and keep not just one backup file, but make and keep a uniquely
numbered one every time a file is saved -- when backups are enabled.
The uniquely numbered files are stored in the specified \fIdirectory\fR.
.TP
.BR \-D ", " \-\-boldtext
Use bold text instead of reverse video text.
@@ -93,9 +115,9 @@ Disable automatic conversion of files from DOS/Mac format.
.BR \-O ", " \-\-morespace
Use the blank line below the titlebar as extra editing space.
.TP
.BR \-P ", " \-\-poslog
.BR \-P ", " \-\-positionlog
Log and later read back the location of the cursor and place it there
again.
again. (The old form of this option, \fB\-\-poslog\fR, is deprecated.)
.TP
.BR "\-Q ""\fIcharacters\fB""" ", " "\-\-quotestr=""" \fIcharacters\fR """
Set the quoting string for justifying. The default is
@@ -135,7 +157,7 @@ characters as part of a word.
Specify the name of the syntax highlighting to use from among the ones
defined in the \fInanorc\fP files.
.TP
.BR \-c ", " \-\-const
.BR \-c ", " \-\-constantshow
Constantly show the cursor position. Note that this overrides \fB\-U\fP.
.TP
.BR \-d ", " \-\-rebinddelete
@@ -200,6 +222,11 @@ Use this alternative spell checker command.
Always save a changed buffer without prompting. Same as Pico's \fB\-t\fP
option.
.TP
.BR \-u ", " \-\-unix
Save a file by default in Unix format. This overrides nano's
default behavior of saving a file in the format that it had.
(This option has no effect when you also use \fB\-\-noconvert\fR.)
.TP
.BR \-v ", " \-\-view
View-file (read-only) mode.
.TP
@@ -248,12 +275,14 @@ it unique. In multibuffer mode, \fBnano\fP will write all the open
buffers to their respective emergency files.
.SH BUGS
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
The \fBnano\fP mailing list is available from \fBnano-devel@gnu.org\fP.
To subscribe, email to \fBnano-devel-request@gnu.org\fP with a subject
of "subscribe".
Justifications (\fB^J\fR) and reindentations (\fBM-{\fR and \fBM-}\fR)
are not yet covered by the general undo system. So after a justification
that is not immediately undone, or after any reindentation, earlier edits
cannot be undone any more. The workaround is, of course, to exit without
saving.
.sp
Please report any other bugs that you encounter via
https://savannah.gnu.org/bugs/?group=nano.
.SH HOMEPAGE
http://www.nano-editor.org/

View File

@@ -20,7 +20,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH NANORC 5 "version 2.4.0" "March 2015"
.TH NANORC 5 "version 2.5.0" "December 2015"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -64,11 +64,14 @@ NOT enable this option unless you are sure you need it.
Use auto-indentation.
.TP
.B set backup
Create backup files by adding a tilde (\fB~\fP) to each file's name.
When saving a file, create a backup file by adding a tilde (\fB~\fP) to
the file's name.
.TP
.B set backupdir "\fIdirectory\fP"
Set the directory where \fBnano\fP puts unique backup files, if file
backups are enabled.
Make and keep not just one backup file, but make and keep a uniquely
numbered one every time a file is saved --- when backups are enabled
with \fBset backup\fR or \fB\-\-backup\fR or \fB\-B\fR.
The uniquely numbered files are stored in the specified \fIdirectory\fR.
.TP
.B set backwards
Do backwards searches by default.
@@ -87,8 +90,9 @@ closing brackets, can end sentences. The default value is "\fB"')>]}\fP".
.B set casesensitive
Do case-sensitive searches by default.
.TP
.B set const
.B set constantshow
Constantly display the cursor position in the status bar.
(The old form of this option, '\fBset const\fR', is deprecated.)
.TP
.B set cut
Use cut-to-end-of-line by default, instead of cutting the whole line.
@@ -132,7 +136,7 @@ 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 multibuffer
Allow inserting files into their own buffers.
When reading in a file with ^R, insert it into a new buffer by default.
.TP
.B set noconvert
Don't convert files from DOS/Mac format.
@@ -155,8 +159,9 @@ 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 poslog
.B set positionlog
Save the cursor position of files between editing sessions.
(The old form of this option, '\fBset poslog\fR', is deprecated.)
.TP
.B set preserve
Preserve the XON and XOFF keys (^Q and ^S).
@@ -237,6 +242,11 @@ 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 unix
Save a file by default in Unix format. This overrides nano's
default behavior of saving a file in the format that it had.
(This option has no effect when you also use \fBset noconvert\fR.)
.TP
.B set view
Disallow file modification.
.TP
@@ -264,31 +274,30 @@ Defines a syntax named \fIstr\fP which can be activated via the
.BR \-Y / \-\-syntax
command-line option, or will be automatically activated if
the current filename matches the extended regular expression
\fIfileregex\fP. All following \fBcolor\fP and \fBicolor\fP statements
will apply to this \fIstr\fP syntax until a new syntax is defined.
\fIfileregex\fP. All subsequent \fBcolor\fR, \fBicolor\fR,
\fBheader\fR and other such statements will apply to this
\fIstr\fP syntax until a new \fBsyntax\fR command is encountered.
The \fBnone\fP syntax is reserved; specifying it on the command line is
the same as not having a syntax at all. The \fBdefault\fP syntax is
special: it takes no \fIfileregex\fP, and applies to files that don't
match any other syntax's \fIfileregex\fP.
match any syntax's \fIfileregex\fP.
.TP
.BI linter " program " \fR[ "arg " \fR...]
For the currently defined syntax, use the given \fIprogram\fR
to invoke the linter (this overrides the speller function when
defined).
Use the given \fIprogram\fR to run a syntax check on the current file
(this overrides the speller function when defined).
.TP
.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).
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
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
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
@@ -296,7 +305,7 @@ 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""" ...
For the currently defined syntax, display all expressions matching
Display all pieces of text that match
the extended regular expression \fIregex\fP with foreground color
\fIfgcolor\fP and background color \fIbgcolor\fP, at least one of which
must be specified. Valid colors for foreground and background
@@ -307,34 +316,34 @@ foreground. If your terminal supports transparency, not specifying a
background.
.TP
.B icolor \fIfgcolor\fR,\fIbgcolor\fR """\fIregex\fR""" ...
Same as above, except that the expression matching is case insensitive.
Same as above, except that the text matching is case insensitive.
.TP
.BR color " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIsr\fR"" " end= """\fIer\fR""
Display expressions which start with the extended regular expression
\fIsr\fP and end with the extended regular expression \fIer\fP with
Display all pieces of text whose start matches extended regular expression
\fIsr\fP and whose end matches extended regular expression \fIer\fP with
foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
at least one of which must be specified. This allows syntax
highlighting to span multiple lines. Note that all subsequent instances
of \fIsr\fP after an initial \fIsr\fP is found will be highlighted until
the first instance of \fIer\fP.
at least one of which must be specified. This means that, after an
initial instance of \fIsr\fP, all text will be highlighted until the
first instance of \fIer\fP. This allows syntax highlighting to span
multiple lines.
.TP
.BR icolor " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIsr\fR"" " end= """\fIer\fR""
Same as above, except that the expression matching is case insensitive.
Same as above, except that the text matching is case insensitive.
.TP
.BR include " ""\fIsyntaxfile\fR"""
Read in self-contained color syntaxes from \fIsyntaxfile\fP. Note that
\fIsyntaxfile\fP can only contain the above commands, from \fBsyntax\fP
\fIsyntaxfile\fP may contain only the above commands, from \fBsyntax\fP
to \fBicolor\fP.
.TP
.BI extendsyntax " str directive " \fR[ "arg " \fR...]
Extend the syntax previously defined as \fIstr\fP to include
new information. This allows you to add a new \fIcolor\fP, \fIicolor\fP,
\fImagic\fP, \fIheader\fP, or \fIlinter\fP directive to an already
defined syntax -- useful when you want to add to definitions from the
system-installed syntax definitions (which are normally not writable).
new information. This allows you to add a new \fBcolor\fP, \fBicolor\fP,
\fBheader\fP, \fBmagic\fP, \fBlinter\fP, or \fBformatter\fP directive
to an already defined syntax -- useful when you want to
slightly improve a syntax defined in one of the system-installed
files (which are normally not writable)
.SH REBINDING KEYS
Key bindings may be reassigned via the following commands:
Key bindings can be changed via the following two commands:
.TP
.BI bind " key function menu"
Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the
@@ -363,7 +372,7 @@ Example: F10
.RE
.TP
Valid \fIfunction\fP names to be bound include:
Valid \fIfunction\fP names to be bound are:
.RS 3
.TP 2
.B help
@@ -376,18 +385,27 @@ Cancels the current command.
Exits from the program (or from the help viewer or the file browser).
.TP
.B writeout
Writes the current buffer to disk.
Writes the current buffer to disk, asking for a name.
.TP
.B savefile
Writes the current file to disk without prompting or warning.
.TP
.B insert
Inserts a file into the current buffer (or into a new buffer when multibuffer
is enabled).
Inserts a file into the current buffer (at the current cursor position),
or into a new buffer when option \fBmultibuffer\fR is set.
.TP
.B whereis
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.
Repeats the last search command without prompting.
.TP
.B findprevious
As \fBsearchagain\fR, but always in the backward direction.
.TP
.B findnext
As \fBsearchagain\fR, but always in the forward direction.
.TP
.B replace
Interactively replaces text within the current buffer.
@@ -405,6 +423,12 @@ current cursor position.
.B mark
Sets the mark at the current position, to start selecting text.
.TP
.B cutwordleft
Cuts from the cursor position to the beginning of the preceding word.
.TP
.B cutwordright
Cuts from the cursor position to the beginning of the next word.
.TP
.B cutrestoffile
Cuts all text from the cursor position till the end of the buffer.
.TP
@@ -451,12 +475,12 @@ Scrolls up one line of text from the current position.
.B scrolldown
Scrolls down one line of text from the current position.
.TP
.B nextword
Moves the cursor to the beginning of the next word.
.TP
.B prevword
Moves the cursor to the beginning of the previous word.
.TP
.B nextword
Moves the cursor to the beginning of the next word.
.TP
.B home
Moves the cursor to the beginning of the current line.
.TP
@@ -492,10 +516,10 @@ Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
(pairs) with the one under the cursor.
.TP
.B prevbuf
Switches to editing/viewing the previous buffer when using multibuffer mode.
Switches to editing/viewing the previous buffer when multiple buffers are open.
.TP
.B nextbuf
Switches to editing/viewing the next buffer when using multibuffer mode.
Switches to editing/viewing the next buffer when multiple buffers are open.
.TP
.B verbatim
Inserts the next character verbatim into the file.
@@ -616,10 +640,11 @@ Toggles whether long lines will be hard-wrapped to the next line.
Toggles whether typed tabs will be converted to spaces.
.TP
.B backupfile
Toggles whether a backup will be made of the file to be edited.
Toggles whether a backup will be made of the file being edited.
.TP
.B multibuffer
Toggles the use of multiple file buffers (if support for them has been compiled in).
Toggles whether a file is inserted into the current buffer
or read into a new buffer.
.TP
.B mouse
Toggles mouse support.

View File

@@ -19,7 +19,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH RNANO 1 "version 2.4.0" "March 2015"
.TH RNANO 1 "version 2.5.0" "December 2015"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME

View File

@@ -46,7 +46,8 @@
## Constantly display the cursor position in the statusbar. Note that
## this overrides "quickblank".
# set const
# set constantshow
## (The old form, 'const', is deprecated.)
## Use cut-to-end-of-line by default.
# set cut
@@ -104,7 +105,8 @@
# set operatingdir ""
## Remember the cursor position in each file for the next editing session.
# set poslog
# set positionlog
## (The old form, 'poslog', is deprecated.)
## Preserve the XON and XOFF keys (^Q and ^S).
# set preserve
@@ -235,13 +237,15 @@
## Key bindings.
## See nanorc(5) for more details on this.
## See nanorc(5) (section REBINDING KEYS) for more details on this.
##
## Here are a few samples to get you going.
##
# bind M-W nowrap main
# bind M-A casesens search
# bind ^S research main
## The following five functions are not bound to any key by default.
## You may wish to choose different keys than the ones suggested here.
# bind ^S savefile main
# bind M-Q findprevious main
# bind M-W findnext main
# bind M-B cutwordleft main
# bind M-N cutwordright main
## Set this if your backspace key sends Del most of the time.
## Set this if your Backspace key sends Del most of the time.
# bind Del backspace all

View File

@@ -6,10 +6,12 @@ pkgdata_DATA = asm.nanorc \
css.nanorc \
debian.nanorc \
default.nanorc \
elisp.nanorc \
fortran.nanorc \
gentoo.nanorc \
go.nanorc \
groff.nanorc \
guile.nanorc \
html.nanorc \
java.nanorc \
javascript.nanorc \
@@ -26,6 +28,7 @@ pkgdata_DATA = asm.nanorc \
perl.nanorc \
php.nanorc \
po.nanorc \
postgresql.nanorc \
pov.nanorc \
python.nanorc \
ruby.nanorc \

View File

@@ -0,0 +1,28 @@
## Here is an example for Autoconf.
syntax "autoconf" "\.ac$"
# Keywords:
color yellow "\<(if|test|then|else|fi|for|in|do|done)\>"
color yellow "(=|!=|&&|\|\|)"
# Macros:
color cyan "\<[[:upper:]_[:digit:]]+\>"
# Version numbers:
color red "\<[-_.0-9]+\>"
# Strings:
color red "\"[^"]*\"" "\'[^']*\'"
# Backticks:
color green "`[^`]*`"
# Error lines:
color black "^\*\*\*.*"
# Brackets:
color magenta "\[|\]|\(|\)"
# Comments:
color blue "^[[:blank:]]*#.*" "^dnl.*"

View File

@@ -12,14 +12,17 @@ color yellow "<[^>]*@[^>]*>"
# Command-line options.
color cyan "[[:space:]]-[a-zA-Z\$]" "--[8a-z-]+"
# Bug and patch numbers.
color cyan "bug #[0-9]{5,6}" "patch #[0-9]{4,5}"
# Probable variables, for variety.
color cyan "bug #[0-9]{5,9}" "patch #[0-9]{4,9}"
# Probable constants, 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=":( |$)"
color magenta start="^( | {8})\* " end="(:( |$)|^$)"
# Release markers.
color brightblue "^(GNU )?nano[- ][0-9]\.[0-9]\.[^ ]+"
# Trailing whitespace.
color ,green "[[:space:]]+$"

View File

@@ -1,19 +1,20 @@
## Here is an example for apt's sources.list.
syntax "apt/sources.list" "sources\.list(~|\.old|\.save)?$" "sources\.list\.d/.*\.list(~|\.old|\.save)?$"
syntax "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(s)?|ftp|rsh|ssh|file|copy|tor|spacewalk):/[^ ]+|cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/) [^ ]+"
color brightred "^deb(-src)?\s+.*((ftp|https?|rsh|ssh|copy|file|spacewalk|tor):/\S+|cdrom:\[.+\]/)\s+\S+"
# URIs.
color brightgreen "(http(s)?|ftp|rsh|ssh|file|copy|tor|spacewalk):/[^ ]+"
color brightgreen "^deb(-src)?\s+.*(ftp|https?|rsh|ssh|copy|file|spacewalk|tor):/\S+"
# CDroms.
color brightgreen "cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/"
color brightgreen "^deb(-src)?\s+.*cdrom:\[.+\]/"
# Options.
color brightcyan "^deb(-src)?\s+\[.+\]\s+"
# And finally the initial deb tag.
color yellow "^deb(-src)?"
# Comments.
color brightblue "#.*"

31
doc/syntax/elisp.nanorc Normal file
View File

@@ -0,0 +1,31 @@
## Here is an example for Emacs Lisp.
syntax "elisp" "\.el$"
# Basic functions/macros
color brightcyan "\<(if|when|unless|cond|and|or|lambda|let|progn|while|dolist|dotimes)\>"
color brightcyan "\<save-((window-)?excursion|restriction)\>"
color brightcyan "\<eval-(and|when)-compile\>"
# Defining functions
color brightcyan "\<def(un|macro|subst|generic|alias)\>"
color brightcyan "\<cl-def(un|macro|subst|generic|struct|type)\>"
color brightcyan "\<define-(derived|minor|generic)-mode\>"
# Defining variables
color brightcyan "\<def(class|const|var(-local|alias)?)\>"
# Customization functions
color brightcyan "\<def(custom|face|group|theme)\>"
# Setting values
color brightcyan "\<(setq(-default|-local)?|setf|push|pop|declare(-function)?)\>"
# Feature functions
color brightcyan "\<(require|provide)\>"
# Quoted symbols
color brightyellow "#?'\<(\w|-)+\>"
# Booleans
color brightred "\<(t|nil)\>"
# Keywords
color blue ":(\w|[?-])+"
# Strings
color yellow start="^[[:blank:]]+\"" end="[^\]\""
color yellow ""(\\.|[^"])*""
# Comments
color cyan "(^|[[:space:]]);.*$"

View File

@@ -3,7 +3,7 @@
syntax "groff" "\.m[ems]$" "\.rof" "\.tmac$" "^tmac."
# The argument of .ds or .nr
color cyan "^\.(ds|nr) [^[[:space:]]]*"
color cyan "^\.(ds|nr) [^[:space:]]*"
# Single-character escapes
color brightmagenta "\\."
# The argument of \f or \s in the same color
@@ -12,7 +12,7 @@ color brightmagenta "\\f." "\\f\(.." "\\s(\+|\-)?[0-9]"
color cyan "(\\|\\\\)n(.|\(..)"
color cyan start="(\\|\\\\)n\[" end="]"
# Requests
color brightgreen "^\.[[:space:]]*[^[[:space:]]]*"
color brightgreen "^\.[[:space:]]*[^[:space:]]*"
# Comments
color yellow "^\.\\".*$"
# Strings

24
doc/syntax/guile.nanorc Normal file
View File

@@ -0,0 +1,24 @@
## Here is an example for Guile Scheme.
syntax "guile" "\.scm$"
header "^#!.*guile"
magic "guile"
# Basic scheme functions
color green "\<(do|if|lambda|let(rec)?|map|unless|when)\>"
# Defining things
color brightcyan "\<define(-macro|-module|-public|-syntax)?\>"
# Quoted symbols
color brightyellow "'\<(\w|-)+\>"
# Chars
color brightmagenta "#\\."
color brightmagenta "#\\\w+\>"
# Booleans
color brightred "(#t|#f)\>"
# Keywords
color blue "#?:(\w|[?-])+"
# Strings
color yellow start="^[[:blank:]]+\"" end="[^\]\""
color yellow ""(\\.|[^"])*""
# Comments
color cyan "(^|[[:space:]]);.*$"

View File

@@ -1,6 +1,6 @@
## Here is an example for Makefiles.
syntax "makefile" "Makefile[^/]*$"
syntax "makefile" "Makefile[^/]*$" "\.(make|mk)$"
color red "[:=]"
color magenta "\<(if|ifeq|else|endif)\>"

View File

@@ -6,13 +6,13 @@ 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|view|wordbounds)\>"
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const(antshow)?|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|pos(ition)?log|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|unix|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])|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:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)+[[:space:]]*$"
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)+[[: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)\>"
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|formatter|extendsyntax)\>"
# Colors
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"

View File

@@ -0,0 +1,29 @@
## Here is an example for nftables.
syntax "nftables" "\.(nft|nftables)$"
header "^#!.*(nft|nftables)"
# Objects and operations
color green "\<(chain|hook|policy|priority|ruleset|set|table|type|v?map)\>"
color green "\<(define|include)\>"
color red "\<(add|delete|flush|insert|remove|replace)\>"
# Families
color yellow "\<(arp|bridge|inet|ip6?)\>"
# Terminal statements
color red "\<(drop|reject)\>"
color brightblue "\<(accept|continue|(d|s)nat|goto|jump|masquerade|return)\>"
# Comments
color cyan "(^|[[:space:]])#.*$"
# Trailing whitespace
color ,green "[[:space:]]+$"
# Strings and others
color yellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
# Basic variable names
color brightred "\$[[:alpha:]_][[:alnum:]_.]*"

View File

@@ -25,7 +25,7 @@ color brightyellow "<[^= ]*>" ""(\.|[^"])*""
color brightblue "//.*"
color brightblue start="/\*" end="\*/"
##color blue start="<" end=">"
##color red "&[^;[[:space:]]]*;"
##color red "&[^;[:space:]]*;"
# Trailing whitespace.
color ,green "[[:space:]]+$"

View File

@@ -6,16 +6,16 @@ syntax "po" "\.pot?$"
color green "^#.*$"
color yellow "Copyright|\(C\)"
# Header fields.
color brightmagenta "\<(Project\-Id\-Version|Report\-Msgid\-Bugs\-To|Last\-Translator|Language\-Team|Language|X\-Generator|Plural\-Forms)\>"
color brightmagenta "\<(Project\-Id\-Version|Report\-Msgid\-Bugs\-To|Last\-Translator|Language(\-Team)?|X\-Generator|Plural\-Forms)\>"
color cyan "\<(POT\-Creation\-Date|PO\-Revision\-Date|MIME\-Version|Content\-Type|Content\-Transfer\-Encoding)\>"
# Encodings and numbers.
color yellow "\<(UTF|ISO|Windows|Mac|IBM)\>\-[0-9]"
color yellow "[0-9]|pre[0-9]|[0-9]bit"
# Msgids.
color brightblue "\<(msgid|msgid_plural|msgstr)\>"
color brightblue "^(msgid|msgid_plural|msgstr)\>"
# Tags.
color red "\<fuzzy\>"
color yellow "\<c-format\>"
color red " fuzzy(,|$)"
color yellow " (no-)?[-[:alpha:]]+-format(,|$)"
# Format specifiers.
color brightmagenta "%([1-9]\$)?[a-z]*"
# Quotes and newlines.

View File

@@ -0,0 +1,75 @@
## Here is an example for PostgreSQL.
syntax "sql" "\.sql[2345s~]?$"
magic "PostgreSQL script text"
# Functions.
color white "\<[a-z_]*\("
# Types.
color green "\<(int2|smallint|int4|int|integer|int8|bigint|decimal|numeric|real|double precision|(small|big)?serial)\>"
color green "\<(bit( varying)?|boolean|bytea|enum|money|tsvector|uuid)\>"
color green "\<(char|varchar|character( varying)?|text)\>"
color green "\<(date|interval|time(stamp)?( with time zone| without time zone)?)\>"
color green "\<(point|line|lseg|path|box|polygon|circle)\>"
color green "\<(cidr|inet|macaddr)\>"
color green "\<(daterange|int4range|int8range|numrange|tsrange|tstzrange)\>"
# Structure.
color brightyellow "\<(CASE|CLASS|DEFAULT|DO|ELSE|ELSEIF|FOR|FOREACH|FUNCTION|IF|IS NULL)\>"
color brightyellow "\<(NEW|PRIVATE|PUBLIC|RETURN|RETURNS|SETOF|SWITCH|THEN|WHEN|WHILE)>"
# Control flow.
color magenta "\<(EXCEPTION|NOTICE|RAISE|RETURN)\>"
# SQL keywords.
color blue "\<(ABORT|AGGREGATE|ALTER|ANALYZE|AND|AS|AUTHORIZATION|BEGIN|CAST|CHECKPOINT|CLASS|CLOSE)\>"
color blue "\<(CLUSTER|COLLATION|COMMENT|COMMIT|CONFIGURATION|CONSTRAINTS|CONVERSION|COPY|CREATE)\>"
color blue "\<(DATA|DATABASE|DEALLOCATE|DECLARE|DEFAULT|DELETE|DICTIONARY|DISCARD|DO|DOMAIN|DROP)\>"
color blue "\<(END|EVENT|EXECUTE|EXPLAIN|EXTENSION|FAMILY|FETCH|FOREIGN|FROM|FUNCTION)\>"
color blue "\<(GRANT|GROUP|IF NOT EXISTS|IMMUTABLE|INDEX|INSERT|INTO|LABEL|LANGUAGE|LARGE|LOAD|LOCK)\>"
color blue "\<(MAPPING FOR|MATERIALIZED|MOVE|NOTIFY|OBJECT|OPERATOR|OPTIONS|OWNED|OWNER)\>"
color blue "\<(PARSER|PREPARED?|PRIVILEGES|REASSIGN|REFRESH|RELEASE|RESET|REVOKE|ROLE|ROLLBACK|RULE)\>"
color blue "\<(SAVEPOINT|SCHEMA|SEARCH|SECURITY|SELECT|SEQUENCE|SERVER|SESSION|SET|SHOW|SPACE|START|SYSTEM)\>"
color blue "\<(TABLE|TEXT|TO|TRANSACTION|TYPE|UPDATE|USER|VACUUM|VALUES|VIEW|WHERE|WITH|WRAPPER)\>"
# Strings.
color brightyellow "<[^= ]*>" ""(\.|[^"])*""
# Trailing whitespace.
color ,green "[[:space:]]+$"
# Regular expressions.
color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
# Shell command expansion is in `backticks` or like %x{this}. These are
# "double-quotish" (to use a perlism).
color brightblue "`[^`]*`" "%x\{[^}]*\}"
# Strings, double-quoted.
color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>"
color green "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
# Expression substitution. These go inside double-quoted strings,
# "like #{this}".
color brightgreen "#\{[^}]*\}"
# Strings, single-quoted.
color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>"
color green "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
# Comments.
color red "#[^{].*$" "#$"
color red "--[^{].*$" "#$"
color red "##[^{].*$" "##$"
color brightblue "//.*"
color brightblue start="/\*" end="\*/"
# PostgreSQL markings.
color red "(--)"
# PostgreSQL default schemas.
color brightred "(pg_catalog|public)"
# PostgreSQL PLs.
color brightblue "(pljava|plperlu?|plpgsql|plpy|plpythonu?|plr|plruby|plsh|pltcl|plscheme)"

View File

@@ -2,6 +2,7 @@
syntax "python" "\.py$"
header "^#!.*python[-0-9._]*"
linter pyflakes
# Function definitions.
icolor brightblue "def [0-9A-Z_]+"
@@ -9,14 +10,14 @@ icolor brightblue "def [0-9A-Z_]+"
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}"
# Single-quoted strings.
color brightgreen "'([^'\]|\\.)+'"
color brightgreen ""([^"\]|\\.)+""
# Comments.
color brightred "(^|[[:blank:]])#.*$"
# Multiline strings.
color brightgreen start="\"\"\"([^"),]|$)" end="(^|[^(])\"\"\""
color brightgreen start="'''([^'),]|$)" end="(^|[^(])'''"
# Triple-quoted strings.
color brightgreen start="'''[^'),]" end="(^|[^(\])'''"
color brightgreen start="\"\"\"[^"),]" end="(^|[^(\])\"\"\""
# Reminders.
color ,yellow "(FIXME|TODO|XXX)"

View File

@@ -2,6 +2,7 @@
syntax "ruby" "\.rb$"
header "^#!.*ruby[-0-9._]*"
linter ruby -w -c
# Reserved words.
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module)\>"

View File

@@ -3,6 +3,7 @@
syntax "sh" "\.sh$"
header "^#!.*((ba|da|k|pdk)?sh[-0-9_]*|openrc-run|runscript)"
magic "(POSIX|Bourne.*) shell script text"
linter dash -n
icolor brightgreen "^[0-9A-Z_]+\(\)"
color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"

View File

@@ -1,6 +1,7 @@
## Here is a short example for TeX files.
syntax "tex" "\.tex$"
linter chktex -v0 -q -I
icolor green "\\.|\\[A-Z]*"
color magenta "[{}]"

View File

@@ -1,11 +1,20 @@
## Here is an example for XML files.
syntax "xml" "\.([jrs]html?|sgml?|xml|xslt?)$"
syntax "xml" "\.([jrsx]html?|jnlp|mml|pom|rng|sgml?|svg|w[as]dl|wsdd|xjb|xml|xs(d|lt?)|xul)$"
magic "(XML|SGML) (sub)?document text"
# The entire content of the tag:
color green start="<" end=">"
color cyan "<[^> ]+"
color cyan ">"
# The start and the end of the tag:
color cyan "<[^> ]+" ">"
# The strings inside the tag:
color magenta "\"[^"]*\""
# Comments:
color yellow start="<!DOCTYPE" end="[/]?>"
color yellow start="<!--" end="-->"
# Escapes:
color red "&[^;]*;"

View File

@@ -1,15 +1,13 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename nano.info
@settitle nano Command Manual
@settitle nano
@c %**end of header
@c This file has the new style title page commands.
@c Run 'makeinfo' rather than 'texinfo-format-buffer'.
@smallbook
@set EDITION 0.3
@set VERSION 2.4.1
@set UPDATED April 2015
@set VERSION 2.5.0
@set UPDATED December 2015
@dircategory Editors
@direntry
@@ -23,7 +21,7 @@
@titlepage
@title GNU @code{nano}
@subtitle a small and friendly text editor.
@subtitle version 2.4.1
@subtitle version 2.5.0
@author Chris Allegretta
@page
@@ -63,6 +61,8 @@ editor.
@menu
* Introduction::
* Invoking::
* Command-line Options::
* Editor Basics::
* Built-in Help::
* Feature Toggles::
@@ -82,19 +82,16 @@ 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::
* Command Line Options::
@end menu
@node Overview
@section Overview
The original goal for @code{nano} was a complete bug-for-bug compatible
emulation of Pico, but @code{nano}'s current goal is to be as compatible
The original goal for @code{nano} was to be a complete bug-for-bug
emulation of Pico. But currently the goal is to be as compatible
as possible while offering a superset of Pico's functionality. See
@xref{Pico Compatibility}, for more info.
Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}.
@node Invoking
@chapter Invoking
The usual way to invoke @code{nano} is:
@quotation
@@ -112,19 +109,17 @@ adding it with a comma. So the complete command synopsis is:
@end quotation
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.
@file{.nanorc} file. And when the @code{positionlog} option is set
(making @code{nano} remember the cursor position when you close a file),
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
@node Command-line Options
@chapter Command-line Options
@command{nano} takes the following options from the command line:
@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.
@@ -139,13 +134,14 @@ line.
@item -B
@itemx --backup
When saving a file, back up the previous version of it to the current
filename suffixed with a @samp{~}.
When saving a file, back up the previous version of it, using the current
filename suffixed with a tilde (@code{~}).
@item -C @var{directory}
@itemx --backupdir=@var{directory}
Set the directory where @command{nano} puts unique backup files if file
backups are enabled.
Make and keep not just one backup file, but make and keep a uniquely
numbered one every time a file is saved --- when backups are enabled.
The uniquely numbered files are stored in the specified directory.
@item -D
@itemx --boldtext
@@ -157,7 +153,7 @@ Convert typed tabs to spaces.
@item -F
@itemx --multibuffer
Enable multiple file buffers (if support for them has been compiled in).
Read a file into a new buffer by default.
@item -G
@itemx --locking
@@ -191,20 +187,17 @@ Disable automatic conversion of files from DOS/Mac format.
Use the blank line below the titlebar as extra editing space.
@item -P
@itemx --poslog
@itemx --positionlog
Log for each file the last location of the cursor, and read it
back upon reopening the file and place it there again.
(The old form of this option, @code{--poslog}, is deprecated.)
@item -Q "@var{characters}"
@itemx --quotestr="@var{characters}"
Set the quoting string for justifying. The default value is
@quotation
"^([ \t]*[|>:@}#])+"
@end quotation
if extended regular expression support is available, or @code{> } otherwise.
Note that @code{\t} above stands for a literal Tab character.
@t{"^([ \t]*[|>:@}#])+"} if extended regular expression support
is available, and @t{"> "} otherwise.
Note that @code{\t} stands for a literal Tab character.
@item -R
@itemx --restricted
@@ -214,7 +207,7 @@ 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; 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}).
any name beginning with @code{r} (e.g.@: @command{rnano}).
@item -S
@itemx --smooth
@@ -224,12 +217,13 @@ usual chunk-by-chunk behavior.
@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}.
@var{number} must be greater than 0. The default value is @t{8}.
@item -U
@itemx --quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25. Note that @option{-c} overrides this.
keystroke instead of 25. Note that option @option{-c}
(@option{--constantshow}) overrides this.
@item -V
@itemx --version
@@ -246,9 +240,9 @@ Specify a specific syntax from the nanorc files to use for highlighting.
See @xref{Syntax Highlighting}, for more info.
@item -c
@itemx --const
@itemx --constantshow
Constantly display the cursor position and line number on the statusbar.
Note that this overrides @option{-U}.
Note that this overrides option @option{-U} (@option{--quickblank}).
@item -d
@itemx --rebinddelete
@@ -312,8 +306,8 @@ 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 @samp{-8}. This option conflicts with @option{-w}
-- the last one given takes effect.
The default value is @t{-8}. This option conflicts with @option{-w}
(@option{--nowrap}); the last one given takes effect.
@item -s @var{program}
@itemx --speller=@var{program}
@@ -328,6 +322,12 @@ Don't ask whether or not to save the current contents of the file when
exiting, assume yes. This is most useful when using @command{nano} as the
composer of a mailer program.
@item -u
@item --unix
Save a file by default in Unix format. This overrides nano's
default behavior of saving a file in the format that it had.
(This option has no effect when you also use @code{--noconvert}.)
@item -v
@itemx --view
Don't allow the contents of the file to be altered. Note that this
@@ -337,7 +337,7 @@ implement a read-only file.
@item -w
@itemx --nowrap
Don't hard-wrap long lines at any length. This option conflicts with
@option{-r} -- the last one given takes effect.
@option{-r} (@option{--fill}); the last one given takes effect.
@anchor{Expert Mode}
@item -x
@@ -359,9 +359,9 @@ keystroke (usually ^Z).
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
@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 -$}).
@code{$} 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
@itemx -b
@@ -370,6 +370,7 @@ separately (e.g. @code{nano -wS -$}).
@itemx -g
@itemx -j
Ignored, for compatibility with Pico.
@end table
@@ -385,6 +386,7 @@ Ignored, for compatibility with Pico.
* The Statusbar::
* Shortcut Lists::
* Using the Mouse::
* Limitation::
@end menu
@node Entering Text
@@ -489,11 +491,20 @@ Shift key during those actions.
The mouse will work in the X Window System, and on the console when gpm
is running.
@node Limitation
@section Limitation
Justifications (@code{^J}) and reindentations (@code{M-@{} and @code{M-@}})
are not yet covered by the general undo system. So after a justification
that is not immediately undone, or after any reindentation, earlier edits
cannot be undone any more. The workaround is, of course, to exit without
saving.
@node Built-in Help
@chapter Built-in Help
The built-in help system in @code{nano} is available by pressing ^G.
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.
@@ -502,65 +513,65 @@ and ^V (Page Down) keys. ^X exits the help system.
@node Feature Toggles
@chapter Feature Toggles
Toggles allow you to change certain aspects of the editor that would
normally be done via command-line options. They are invoked via Meta
key sequences. See @xref{Special Functions}, for more info. The
following global toggles are available:
Toggles allow you to change on-the-fly certain aspects of the editor
which would normally be specified via command-line options. They are
invoked via Meta-key sequences. See @xref{Special Functions}, for more info.
The following global toggles are available:
@table @code
@item Backup Files Toggle (Meta-B)
toggles the -B (@code{--backup}) command line option.
toggles the @code{-B} (@code{--backup}) command-line option.
@item Constant Cursor Position Display Toggle (Meta-C)
toggles the -c (@code{--const}) command line option.
toggles the @code{-c} (@code{--constantshow}) command-line option.
@item Multiple File Buffers Toggle (Meta-F)
toggles the -F (@code{--multibuffer}) command line option.
toggles the @code{-F} (@code{--multibuffer}) command-line option.
@item Smart Home Key Toggle (Meta-H)
toggles the -A (@code{--smarthome}) command line option.
toggles the @code{-A} (@code{--smarthome}) command-line option.
@item Auto Indent Toggle (Meta-I)
toggles the -i (@code{--autoindent}) command line option.
toggles the @code{-i} (@code{--autoindent}) command-line option.
@item Cut To End Toggle (Meta-K)
toggles the -k (@code{--cut}) command line option.
toggles the @code{-k} (@code{--cut}) command-line option.
@item Long Line Wrapping Toggle (Meta-L)
toggles the -w (@code{--nowrap}) command line option.
toggles the @code{-w} (@code{--nowrap}) command-line option.
@item Mouse Support Toggle (Meta-M)
toggles the -m (@code{--mouse}) command line option.
toggles the @code{-m} (@code{--mouse}) command-line option.
@item No Conversion From DOS/Mac Format Toggle (Meta-N)
toggles the -N (@code{--noconvert}) command line option.
toggles the @code{-N} (@code{--noconvert}) command-line option.
@item More Space For Editing Toggle (Meta-O)
toggles the -O (@code{--morespace}) command line option.
toggles the @code{-O} (@code{--morespace}) command-line option.
@item Whitespace Display Toggle (Meta-P)
toggles whitespace-display mode.
toggles the whitespace-display mode.
See @xref{Whitespace}, for more info.
@item Tabs to Spaces Toggle (Meta-Q)
toggles the -E (@code{--tabstospaces}) command line option.
toggles the @code{-E} (@code{--tabstospaces}) command-line option.
@item Smooth Scrolling Toggle (Meta-S)
toggles the -S (@code{--smooth}) command line option.
toggles the @code{-S} (@code{--smooth}) command-line option.
@item Expert/No Help Toggle (Meta-X)
toggles the -x (@code{--nohelp}) command line option.
toggles the @code{-x} (@code{--nohelp}) command-line option.
@item Color Syntax Highlighting Toggle (Meta-Y)
toggles color syntax highlighting if you have color syntaxes in your
nanorc. See @xref{Syntax Highlighting}, for more info.
@item Suspend Toggle (Meta-Z)
toggles the -z (@code{--suspend}) command line option.
@item Suspension Toggle (Meta-Z)
toggles the @code{-z} (@code{--suspend}) command-line option.
@item Soft Wrapping Toggle (Meta-$)
toggles the -$ (@code{--softwrap}) command line option.
toggles the @code{-$} (@code{--softwrap}) command-line option.
@end table
@@ -572,12 +583,12 @@ 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
(the exact path might be different), and then the user-specific settings,
from ~/.nanorc.
from @file{~/.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
options. Additionally, there are some commands to define syntax highlighting
and to rebind keys -- @xref{Syntax Highlighting}, and @xref{Rebinding Keys}.
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
@@ -589,7 +600,7 @@ 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
end. For example, for the "brackets" option, @code{""')>]@}"} will match
end. For example, for the @code{brackets} option, @t{""')>]@}"} will match
@code{"}, @code{'}, @code{)}, @code{>}, @code{]}, and @code{@}}.
@menu
@@ -614,12 +625,14 @@ You should NOT enable this option unless you are sure you need it.
Use auto-indentation.
@item set backup
When saving a file, back up the previous version of it to the current
When saving a file, back up the previous version of it, using the current
filename suffixed with a tilde (@code{~}).
@item set backupdir "directory"
Set the directory where @code{nano} puts unique backup files, if file
backups are enabled.
Make and keep not just one backup file, but make and keep a uniquely
numbered one every time a file is saved --- when backups are enabled
with @code{set backup} or @code{--backup} or @code{-B}.
The uniquely numbered files are stored in the specified directory.
@item set backwards
Do backwards searches by default.
@@ -627,23 +640,21 @@ Do backwards searches by default.
@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".
the options @code{titlecolor}, @code{statuscolor}, and @code{keycolor}.
@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
punctuation (see @code{set punct}), optionally followed by the specified
closing brackets, can end sentences. The default value is
@quotation
""')>]@}"
@end quotation
@t{"')>]@}"}.
@item set casesensitive
Do case-sensitive searches by default.
@item set const
@item set constantshow
Constantly display the cursor position in the status bar.
(The old form of this option, @code{set const}, is deprecated.)
@item set cut
Use cut-to-end-of-line by default, instead of cutting the whole line.
@@ -651,7 +662,7 @@ Use cut-to-end-of-line by default, instead of cutting the whole line.
@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.
The default value is @t{-8}.
@item set functioncolor @var{fgcolor},@var{bgcolor}
Specify the color combination to use for the function descriptions
@@ -674,11 +685,7 @@ Enable vim-style lock-files for when editing files.
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
"(<[@{)>]@}"
@end quotation
The default value is @t{"(<[@{)>]@}"}.
@item set morespace
Use the blank line below the titlebar as extra editing space.
@@ -688,7 +695,7 @@ 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 multibuffer
Allow inserting files into their own buffers.
When reading in a file with ^R, insert it into a new buffer by default.
@item set noconvert
Don't convert files from DOS/Mac format.
@@ -711,8 +718,9 @@ 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 poslog
@item set positionlog
Save the cursor position of files between editing sessions.
(The old form of this option, @code{set poslog}, is deprecated.)
@item set preserve
Preserve the XON and XOFF keys (^Q and ^S).
@@ -721,7 +729,8 @@ Preserve the XON and XOFF keys (^Q and ^S).
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 "!.?".
(see @code{set brackets}), can end sentences.
The default value is @t{"!.?"}.
@item set quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
@@ -736,13 +745,9 @@ should be placed at the top of the file to be fully effective.
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
"^([ \\t]*[#:>\\|@}])+"
@end quotation
if you have extended regular expression support, and "> " otherwise.
Note that '\\t' stands for a literal Tab character.
@t{"^([ \\t]*[#:>\\|@}])+"} if you have extended regular expression
support, and @t{"> "} otherwise.
Note that @code{\t} stands for a literal Tab character.
@item set rebinddelete
Interpret the Delete key differently so that both Backspace and Delete
@@ -783,7 +788,7 @@ Allow @code{nano} to be suspended.
@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.
greater than 0. The default value is @t{8}.
@item set tabstospaces
Convert typed tabs to spaces.
@@ -797,6 +802,11 @@ Valid color names for foreground and background are:
white, black, red, blue, green, yellow, magenta, and cyan.
And either @var{fgcolor} or @var{,bgcolor} may be left out.
@item set unix
Save a file by default in Unix format. This overrides nano's
default behavior of saving a file in the format that it had.
(This option has no effect when you also use @code{set noconvert}.)
@item set view
Disallow file modification.
@@ -804,7 +814,7 @@ Disallow file modification.
@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 ">.".
for a UTF-8 locale is @t{"»·"}, and for other locales @t{">."}.
@item set wordbounds
Detect word boundaries more accurately by treating punctuation
@@ -828,39 +838,40 @@ via the following commands in a nanorc file:
@table @code
@item syntax "str" ["fileregex" @dots{}]
Defines a syntax named "str" which can be activated via the -Y/--syntax
Defines a syntax named "str" which can be activated via the @code{-Y/--syntax}
command-line option, or will be automatically activated if the current
filename matches the extended regular expression "fileregex". All
following "color" and "icolor" statements will apply to this "str"
syntax until a new syntax is defined.
subsequent @code{color}, @code{icolor}, @code{header} and other such
statements will apply to this "str" syntax until a new @code{syntax}
command is encountered.
The "none" syntax is reserved; specifying it on the command line is the
same as not having a syntax at all. The "default" syntax is special: it
takes no "fileregex", and applies to files that don't match any other
takes no "fileregex", and applies to files that don't match any
syntax's "fileregex".
@item linter program [arg @dots{}]
For the currently defined syntax, use the given program to invoke the
linter (this overrides the speller function when defined).
Use the given program to do a syntax check on the current file
(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).
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
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{}
For the currently defined syntax, add one or more regexes which will be
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
file. This functionality only works when libmagic is installed on the
system and will be silently ignored otherwise.
@item color fgcolor,bgcolor "regex" @dots{}
For the currently defined syntax, display all expressions matching the
Display all pieces of text that match the
extended regular expression "regex" with foreground color "fgcolor" and
background color "bgcolor", at least one of which must be specified.
Valid colors for foreground and background are: white, black, red,
@@ -870,36 +881,37 @@ terminal supports transparency, not specifying a "bgcolor" tells @code{nano}
to attempt to use a transparent background.
@item icolor fgcolor,bgcolor "regex" @dots{}
Same as above, except that the expression matching is case insensitive.
Same as above, except that the text matching is case insensitive.
@item color fgcolor,bgcolor start="sr" end="er"
Display expressions which start with the extended regular expression
"sr" and end with the extended regular expression "er" with foreground
Display all pieces of text whose start matches extended regular expression
"sr" and whose end matches extended regular expression "er" with foreground
color "fgcolor" and background color "bgcolor", at least one of which
must be specified. This allows syntax highlighting to span multiple
lines. Note that all subsequent instances of "sr" after an initial "sr"
is found will be highlighted until the first instance of "er".
must be specified. This means that, after an initial instance of "sr",
all text will be highlighted until the first instance of "er".
This allows syntax highlighting to span multiple lines.
@item icolor fgcolor,bgcolor start="sr" end="er"
Same as above, except that the expression matching is case insensitive.
Same as above, except that the text matching is case insensitive.
@item include "syntaxfile"
Read in self-contained color syntaxes from "syntaxfile". Note that
"syntaxfile" can only contain the above commands, from "syntax" to
"icolor".
"syntaxfile" may contain only the above commands, from @code{syntax}
to @code{icolor}.
@item extendsyntax str directive [arg @dots{}]
Extend the syntax previously defined as str to include new information.
Allows you to add a new color, icolor, magic, header, or linter directive
to an already defined syntax. Useful when you want to add to definitions
from the system-installed syntax definitions (which are normally not writable).
This allows you to add a new @code{color}, @code{icolor}, @code{header},
@code{magic}, @code{linter}, or @code{formatter} directive to an already
defined syntax --- useful when you want to slightly improve a syntax defined
in one of the system-installed files (which are normally not writable).
@end table
@node Rebinding Keys
@section Rebinding Keys
Key bindings may be reassigned via the following two commands in a
Key bindings can be changed via the following two commands in a
nanorc file:
@table @code
@@ -946,18 +958,27 @@ Cancels the current command.
Exits from the program (or from the help viewer or the file browser).
@item writeout
Writes the current buffer to disk.
Writes the current buffer to disk, asking for a name.
@item savefile
Writes the current file to disk without prompting or warning.
@item insert
Inserts a file into the current buffer (or into a new buffer when multibuffer
is enabled).
Inserts a file into the current buffer (at the current cursor position),
or into a new buffer when option @code{multibuffer} is set.
@item whereis
Searches for text in the current buffer -- or for filenames matching
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.
Repeats the last search command without prompting.
@item findprevious
As @code{searchagain}, but always in the backward direction.
@item findnext
As @code{searchagain}, but always in the forward direction.
@item replace
Interactively replaces text within the current buffer.
@@ -975,6 +996,12 @@ current cursor position.
@item mark
Sets the mark at the current position, to start selecting text.
@item cutwordleft
Cuts from the cursor position to the beginning of the preceding word.
@item cutwordright
Cuts from the cursor position to the beginning of the next word.
@item cutrestoffile
Cuts all text from the cursor position till the end of the buffer.
@@ -1018,12 +1045,12 @@ Scrolls up one line of text from the current position.
@item scrolldown
Scrolls down one line of text from the current position.
@item nextword
Moves the cursor to the beginning of the next word.
@item prevword
Moves the cursor to the beginning of the previous word.
@item nextword
Moves the cursor to the beginning of the next word.
@item home
Moves the cursor to the beginning of the current line.
@@ -1059,10 +1086,10 @@ Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
(pairs) with the one under the cursor.
@item prevbuf
Switches to editing/viewing the previous buffer when using multibuffer mode.
Switches to editing/viewing the previous buffer when multiple buffers are open.
@item nextbuf
Switches to editing/viewing the next buffer when using multibuffer mode.
Switches to editing/viewing the next buffer when multiple buffers are open.
@item verbatim
Inserts the next character verbatim into the file.
@@ -1102,10 +1129,10 @@ Toggles whether searching/replacing is based on literal strings or regular expre
Toggles whether searching/replacing goes forward or backward.
@item prevhistory
Shows the previous history entry in the prompt menus (e.g. search).
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).
Shows the next history entry in the prompt menus (e.g.@: search).
@item flipreplace
Toggles between searching for something and replacing something.
@@ -1186,7 +1213,8 @@ Toggles whether typed tabs will be converted to spaces.
Toggles whether a backup will be made of the file to be edited.
@item multibuffer
Toggles the use of multiple file buffers (if available).
Toggles whether a file is inserted into the current buffer
or read into a new buffer.
@item mouse
Toggles mouse support.
@@ -1249,6 +1277,7 @@ The 'go to directory' menu in the file browser.
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
@@ -1276,20 +1305,19 @@ browser exits.
are certain differences between the editors:
@table @code
@item Search and Replace History
As of version 1.1.99pre1 of @code{nano}, text entered as search or
replace strings will be stored and can be accessed with the up/down
arrow keys. Previously, @code{nano} offered a more consistent, but
incompatible with Pico, method for entering search and replace strings.
In the old method, previous entries would be displayed by default as
editable text in front of the cursor, as opposed to being bracketed and
uneditable as it is in Pico. The old behavior could be made compatible
with Pico via the @code{-p} option, but recent versions of Pico use the
@code{-p} option to preserve the XON and XOFF sequences within the
editor. Since, with the new method, search and replace strings can
still be edited by simply hitting the up arrow key once, the old method
was removed completely.
@item Interactive Replace
Instead of allowing you to replace either just one occurrence of a search
string or all of them, @code{nano}'s replace function is interactive: it
will pause at each found search string and query whether to replace this
instance. You can then choose Yes, or No (skip this one), or All (don't
ask any more), or Cancel (stop with replacing).
@item Search and Replace History
When the option @code{-H} or @code{--historylog} is given (or set in
the .nanorc file), text entered as search or replace strings is stored.
These strings can be accessed with the up/down arrow keys. A retrieved
string can subsequently be edited.
@item Writing, Appending, or Prepending Selected Text to Files
Text selected using the marking key (^^) can be written out, appended,
@@ -1298,26 +1326,20 @@ or prepended to a new or existing file using the WriteOut key (^O).
@item Toggles
Many options which alter the functionality of the program can be
"toggled" on or off using Meta key sequences, meaning the program does
not have to be restarted to turn a particular feature of the editor on
or off. Please see the internal help function (^G) for a list of what
functions can be toggled for a particular version of @code{nano}. See
@xref{Feature Toggles}, for more info.
not have to be restarted to turn a particular feature on or off.
See the internal help function (^G) for a list of features that
can be toggled. Or see @xref{Feature Toggles} instead.
@item Cursor Position Display
The output of the "Display Cursor Position" in @code{nano} displays
the current line position of the cursor, as well as the column and
total character position.
@item Current Cursor Position
The output of the "Display Cursor Position" command (^C) displays
not only the current line and character position of the cursor,
but also (between the two) the current column position.
@item Interactive Replace and Spell Checker
It is worth noting that @code{nano}'s replace function is interactive,
i.e. it does not stop after one search string was found and automatically
replaced. The @code{nano} implementation will pause at each found
search string and query whether to replace this instance or not. The
internal spell checker operates similarly. Note that there is no way to
force these functions to behave in the Pico fashion. As of version
1.1.99pre1, misspelled words are sorted and trimmed for uniqueness in
the internal spell checker such that the words 'apple' and 'Apple' will
@item Spell Checking
In the internal spell checker misspelled words are sorted alphabetically
and trimmed for uniqueness, such that the words 'apple' and 'Apple' will
be prompted for correction separately.
@end table
@@ -1345,7 +1367,7 @@ Disable the mini file browser when reading or writing files.
@item --disable-color
Disable support for the syntax coloring of files. This also eliminates
the -Y command-line option, which chooses a specific syntax.
the @code{-Y} command-line option, which chooses a specific syntax.
@item --disable-extra
Disable extra features. At the moment, this is just easter-egg-type
@@ -1359,57 +1381,57 @@ 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.
file was closed. This also eliminates the @code{-H} and @code{-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.
@item --disable-libmagic
Disable the use of the library of magic-number tests (for determining
the file type and thus which syntax to use for colouring -- often the
the file type and thus which syntax to use for colouring --- often the
tests on filename extension and header line will be enough).
@item --disable-mouse
Disable all mouse functionality. This also eliminates the -m
Disable all mouse functionality. This also eliminates the @code{-m}
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. This also eliminates the -F command-line
option, which switches the use of multiple file buffers on.
between them on the fly. This also eliminates the @code{-F} command-line
option, which causes a file to be read into a separate buffer by default.
@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
Disabling this also eliminates the @code{-I} and @code{-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
Disable setting the operating directory. This also eliminates the @code{-o}
command-line option, which sets the operating directory.
@item --disable-speller
Disable use of the spell checker. This also eliminates the -s
Disable use of the spell checker. This also eliminates the @code{-s}
command-line option, which allows specifying an alternate spell checker.
@item --disable-tabcomp
Disable the tab completion code when reading or writing files.
@item --disable-wrapping
Disable hard-wrapping of overlong lines. This also eliminates the -w
Disable hard-wrapping of overlong lines. This also eliminates the @code{-w}
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. By using the enabling
counterpart of the above options together with --enable-tiny, specific
features can be switched back on.
counterpart of the above options together with @code{--enable-tiny},
specific features can be switched back on.
@item --enable-debug
Enable support for runtime debug output. This can get pretty messy, so

View File

@@ -2,20 +2,24 @@
%define version @VERSION@
%define release 1
Summary : Pico editor clone with enhancements
Name : %{name}
Version : %{version}
Release : %{release}
Summary : a user-friendly editor, a Pico clone with enhancements
License : GPLv3+
Group : Applications/Editors
URL : http://www.nano-editor.org/
Source : http://www.nano-editor.org/dist/v2.3/%{name}-%{version}.tar.gz
Source : http://www.nano-editor.org/dist/v2.4/%{name}-%{version}.tar.gz
BuildRoot : %{_tmppath}/%{name}-%{version}-root
BuildRequires : autoconf, automake, gettext-devel, ncurses-devel, texinfo
Requires(post) : info
Requires(preun) : info
%description
GNU nano is a small and friendly text editor. It aims to emulate the
Pico text editor while also offering a few enhancements.
Pico text editor while also offering several enhancements.
%prep
%setup -q
@@ -26,8 +30,16 @@ make
%install
make DESTDIR="%{buildroot}" install
#ln -s nano %{buildroot}%{_bindir}/pico
rm -f %{buildroot}%{_infodir}/dir
#ln -s nano %{buildroot}/%{_bindir}/pico
rm -f %{buildroot}/%{_infodir}/dir
%post
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
%preun
if [ $1 = 0 ] ; then
/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
fi
%files
%defattr(-,root,root)

1264
po/bg.po

File diff suppressed because it is too large Load Diff

1140
po/ca.po

File diff suppressed because it is too large Load Diff

1126
po/cs.po

File diff suppressed because it is too large Load Diff

1663
po/da.po

File diff suppressed because it is too large Load Diff

1132
po/de.po

File diff suppressed because it is too large Load Diff

1301
po/eo.po

File diff suppressed because it is too large Load Diff

1558
po/es.po

File diff suppressed because it is too large Load Diff

1275
po/eu.po

File diff suppressed because it is too large Load Diff

1285
po/fi.po

File diff suppressed because it is too large Load Diff

1200
po/fr.po

File diff suppressed because it is too large Load Diff

1118
po/ga.po

File diff suppressed because it is too large Load Diff

1123
po/gl.po

File diff suppressed because it is too large Load Diff

1115
po/hu.po

File diff suppressed because it is too large Load Diff

1251
po/id.po

File diff suppressed because it is too large Load Diff

1140
po/it.po

File diff suppressed because it is too large Load Diff

1275
po/ja.po

File diff suppressed because it is too large Load Diff

1258
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1826
po/nb.po

File diff suppressed because it is too large Load Diff

1293
po/nl.po

File diff suppressed because it is too large Load Diff

1245
po/nn.po

File diff suppressed because it is too large Load Diff

1120
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1271
po/ro.po

File diff suppressed because it is too large Load Diff

1120
po/ru.po

File diff suppressed because it is too large Load Diff

1115
po/sl.po

File diff suppressed because it is too large Load Diff

1129
po/sr.po

File diff suppressed because it is too large Load Diff

1310
po/sv.po

File diff suppressed because it is too large Load Diff

1248
po/tr.po

File diff suppressed because it is too large Load Diff

1128
po/uk.po

File diff suppressed because it is too large Load Diff

1288
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

@@ -24,6 +24,7 @@
#include "proto.h"
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -41,6 +42,8 @@ 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; zero-based. */
static char *path_save = NULL;
/* A copy of the current path. */
/* Our main file browser function. path is the tilde-expanded path we
* start browsing from. */
@@ -75,6 +78,9 @@ char *do_browser(char *path, DIR *dir)
path = mallocstrassn(path, get_full_path(path));
/* Save the current path in order to be used later. */
path_save = path;
assert(path != NULL && path[strlen(path) - 1] == '/');
/* Get the file list, and set longest and width in the process. */
@@ -118,6 +124,14 @@ char *do_browser(char *path, DIR *dir)
kbinput = get_kbinput(edit);
#ifndef NANO_TINY
if (kbinput == KEY_WINCH) {
kbinput = ERR;
curs_set(0);
continue;
}
#endif
#ifndef DISABLE_MOUSE
if (kbinput == KEY_MOUSE) {
int mouse_x, mouse_y;
@@ -144,7 +158,7 @@ char *do_browser(char *path, DIR *dir)
/* 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);
unget_kbinput(sc_seq_or(do_enter, 0), FALSE, FALSE);
}
}
#endif /* !DISABLE_MOUSE */
@@ -156,9 +170,11 @@ char *do_browser(char *path, DIR *dir)
} else if (func == do_help_void) {
#ifndef DISABLE_HELP
do_help_void();
/* Perhaps the window dimensions have changed. */
browser_refresh();
curs_set(0);
#else
nano_disabled_msg();
say_there_is_no_help();
#endif
} else if (func == do_search) {
/* Search for a filename. */
@@ -269,7 +285,7 @@ char *do_browser(char *path, DIR *dir)
} else if (func == do_right) {
if (selected < filelist_len - 1)
selected++;
} else if (func == do_enter_void) {
} else if (func == do_enter) {
/* We can't move up from "/". */
if (strcmp(filelist[selected], "/..") == 0) {
statusbar(_("Can't move up a directory"));
@@ -390,8 +406,7 @@ char *do_browse_from(const char *inpath)
/* If we can't open the path, get out. */
if (dir == NULL) {
if (path != NULL)
free(path);
free(path);
beep();
return NULL;
}
@@ -421,31 +436,31 @@ void browser_init(const char *path, DIR *dir)
assert(path != NULL && path[strlen(path) - 1] == '/' && dir != NULL);
/* Set longest to zero, just before we initialize it. */
longest = 0;
/* Find the length of the longest filename in the current folder. */
while ((nextdir = readdir(dir)) != NULL) {
size_t d_len;
size_t name_len = strlenpt(nextdir->d_name);
/* Don't show the "." entry. */
if (strcmp(nextdir->d_name, ".") == 0)
continue;
d_len = strlenpt(nextdir->d_name);
if (d_len > longest)
longest = (d_len > COLS) ? COLS : d_len;
if (name_len > longest)
longest = name_len;
i++;
}
rewinddir(dir);
/* Put 10 columns' worth of blank space between columns of filenames
/* Put 10 characters' worth of blank space between columns of filenames
* in the list whenever possible, as Pico does. */
longest += 10;
if (filelist != NULL)
free_chararray(filelist, filelist_len);
/* Make sure longest is between 15 and COLS. */
if (longest < 15)
longest = 15;
if (longest > COLS)
longest = COLS;
rewinddir(dir);
free_chararray(filelist, filelist_len);
filelist_len = i;
@@ -471,12 +486,6 @@ void browser_init(const char *path, DIR *dir)
closedir(dir);
/* Make sure longest is between 15 and COLS. */
if (longest < 15)
longest = 15;
if (longest > COLS)
longest = COLS;
/* Set width to zero, just before we initialize it. */
width = 0;
@@ -528,7 +537,7 @@ functionptrtype parse_browser_input(int *kbinput)
return goto_dir_void;
case 'S':
case 's':
return do_enter_void;
return do_enter;
case 'W':
case 'w':
return do_search;
@@ -541,20 +550,21 @@ functionptrtype parse_browser_input(int *kbinput)
* necessary, and display the list of files. */
void browser_refresh(void)
{
static int uimax_digits = -1;
size_t i;
int col = 0;
/* The maximum number of columns that the filenames will take
* up. */
int line = 0;
/* The maximum number of lines that the filenames will take
* up. */
int line = 0, col = 0;
/* The current line and column while the list is getting displayed. */
char *foo;
/* The file information that we'll display. */
/* The additional information that we'll display about a file. */
if (uimax_digits == -1)
uimax_digits = digits(UINT_MAX);
/* Perhaps window dimensions have changed; reinitialize the browser. */
browser_init(path_save, opendir(path_save));
qsort(filelist, filelist_len, sizeof(char *), diralphasort);
/* Make sure the selected file is within range. */
if (selected >= filelist_len)
selected = filelist_len - 1;
titlebar(path_save);
blank_edit();
wmove(edit, 0, 0);
@@ -573,7 +583,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);
/* 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
@@ -585,15 +595,13 @@ void browser_refresh(void)
* "(dir)", or the file size, plus three columns for the
* ellipsis. */
/* Start highlighting the currently selected file or
* directory. */
/* Start highlighting the currently selected file or directory. */
if (i == selected)
wattron(edit, hilite_attribute);
blank_line(edit, line, col, longest);
/* If dots is TRUE, we will display something like
* "...ename". */
/* If dots is TRUE, we will display something like "...ename". */
if (dots)
mvwaddstr(edit, line, col, "...");
mvwaddstr(edit, line, dots ? col + 3 : col, disp);
@@ -613,42 +621,43 @@ void browser_refresh(void)
/* If the file is a symlink that points to a directory,
* display it as a directory. */
else
/* TRANSLATORS: Try to keep this at most 7
* characters. */
/* TRANSLATORS: Try to keep this at most 7 characters. */
foo = mallocstrcpy(NULL, _("(dir)"));
} else if (S_ISDIR(st.st_mode)) {
/* If the file is a directory, display it as such. */
if (strcmp(filetail, "..") == 0) {
/* TRANSLATORS: Try to keep this at most 12
* characters. */
/* TRANSLATORS: Try to keep this at most 12 characters. */
foo = mallocstrcpy(NULL, _("(parent dir)"));
foomaxlen = 12;
} else
foo = mallocstrcpy(NULL, _("(dir)"));
} else {
unsigned long result = st.st_size;
off_t result = st.st_size;
char modifier;
foo = charalloc(uimax_digits + 4);
foo = charalloc(foomaxlen + 1);
/* Bytes. */
if (st.st_size < (1 << 10))
modifier = ' ';
/* Kilobytes. */
modifier = ' '; /* bytes */
else if (st.st_size < (1 << 20)) {
result >>= 10;
modifier = 'K';
/* Megabytes. */
modifier = 'K'; /* kilobytes */
} else if (st.st_size < (1 << 30)) {
result >>= 20;
modifier = 'M';
/* Gigabytes. */
modifier = 'M'; /* megabytes */
} else {
result >>= 30;
modifier = 'G';
modifier = 'G'; /* gigabytes */
}
sprintf(foo, "%4lu %cB", result, modifier);
/* Show the size if less than a terabyte,
* otherwise show "(huge)". */
if (result < (1 << 10))
sprintf(foo, "%4ju %cB", (intmax_t)result, modifier);
else
/* TRANSLATORS: Try to keep this at most 7 characters.
* If necessary, you can leave out the parentheses. */
foo = mallocstrcpy(foo, _("(huge)"));
}
/* Make sure foo takes up no more than foomaxlen columns. */
@@ -660,8 +669,7 @@ void browser_refresh(void)
mvwaddstr(edit, line, col - foolen, foo);
/* Finish highlighting the currently selected file or
* directory. */
/* Finish highlighting the currently selected file or directory. */
if (i == selected)
wattroff(edit, hilite_attribute);
@@ -706,9 +714,6 @@ int filesearch_init(void)
int input;
char *buf;
if (last_search == NULL)
last_search = mallocstrcpy(NULL, "");
if (last_search[0] != '\0') {
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
@@ -755,6 +760,16 @@ void findnextfile(const char *needle)
const char *filetail = tail(filelist[looking_at]);
/* The filename we display, minus the path. */
const char *rev_start = filetail, *found = NULL;
unsigned stash[sizeof(flags) / sizeof(flags[0])];
/* A storage place for the current flag settings. */
/* Save the settings of all flags. */
memcpy(stash, flags, sizeof(flags));
/* Search forward, case insensitive and without regexes. */
UNSET(BACKWARDS_SEARCH);
UNSET(CASE_SENSITIVE);
UNSET(USE_REGEXP);
/* Step through each filename in the list until a match is found or
* we've come back to the point where we started. */
@@ -797,6 +812,9 @@ void findnextfile(const char *needle)
rev_start = filetail;
}
/* Restore the settings of all flags. */
memcpy(flags, stash, sizeof(flags));
/* Select the one we've found. */
selected = looking_at;
}
@@ -804,10 +822,6 @@ void findnextfile(const char *needle)
/* Search for a filename. */
void do_filesearch(void)
{
UNSET(CASE_SENSITIVE);
UNSET(USE_REGEXP);
UNSET(BACKWARDS_SEARCH);
if (filesearch_init() != 0) {
/* Cancelled, or a blank search string, or done something. */
bottombars(MBROWSER);
@@ -835,9 +849,6 @@ void do_filesearch(void)
/* Search for the last given filename again without prompting. */
void do_fileresearch(void)
{
if (last_search == NULL)
last_search = mallocstrcpy(NULL, "");
if (last_search[0] == '\0')
statusbar(_("No current search pattern"));
else

View File

@@ -636,7 +636,8 @@ char *mbstrcasestr(const char *haystack, const char *needle)
for (; *haystack != '\0' && haystack_len >= needle_len;
haystack += move_mbright(haystack, 0), haystack_len--) {
if (mbstrncasecmp(haystack, needle, needle_len) == 0)
if (mbstrncasecmp(haystack, needle, needle_len) == 0 &&
mblen(haystack, MB_CUR_MAX) > 0)
return (char *)haystack;
}
@@ -729,8 +730,9 @@ char *mbrevstrcasestr(const char *haystack, const char *needle, const
rev_start_len = mbstrlen(rev_start);
while (!begin_line) {
if (rev_start_len >= needle_len && mbstrncasecmp(rev_start,
needle, needle_len) == 0)
if (rev_start_len >= needle_len &&
mbstrncasecmp(rev_start, needle, needle_len) == 0 &&
mblen(rev_start, MB_CUR_MAX) > 0)
return (char *)rev_start;
if (rev_start == haystack)

View File

@@ -3,7 +3,7 @@
* color.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) *
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#ifdef HAVE_MAGIC_H
#include <magic.h>
@@ -69,10 +70,8 @@ void set_colorpairs(void)
interface_color_pair[i].pairnum = A_NORMAL;
}
if (specified_color_combo[i] != NULL) {
free(specified_color_combo[i]);
specified_color_combo[i] = NULL;
}
free(specified_color_combo[i]);
specified_color_combo[i] = NULL;
}
for (; this_syntax != NULL; this_syntax = this_syntax->next) {
@@ -181,12 +180,30 @@ void color_update(void)
if (openfile->colorstrings != NULL)
break;
}
if (openfile->colorstrings == NULL)
statusbar(_("Unknown syntax name: %s"), syntaxstr);
}
/* If we didn't specify a syntax override string, or if we did and
* there was no syntax by that name, get the syntax based on the
* file extension, then try the headerline, and then try magic. */
if (openfile->colorstrings == NULL) {
char *currentdir = getcwd(NULL, PATH_MAX + 1);
char *joinednames = charalloc(PATH_MAX + 1);
char *fullname = NULL;
if (currentdir != NULL) {
/* Concatenate the current working directory with the
* specified filename, and canonicalize the result. */
sprintf(joinednames, "%s/%s", currentdir, openfile->filename);
fullname = realpath(joinednames, NULL);
free(currentdir);
}
if (fullname == NULL)
fullname = mallocstrcpy(fullname, openfile->filename);
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) {
@@ -211,7 +228,7 @@ void color_update(void)
}
/* Set colorstrings if we match the extension regex. */
if (regexec(e->ext, openfile->filename, 0, NULL, 0) == 0) {
if (regexec(e->ext, fullname, 0, NULL, 0) == 0) {
openfile->syntax = tmpsyntax;
openfile->colorstrings = tmpsyntax->color;
break;
@@ -224,6 +241,9 @@ void color_update(void)
}
}
free(joinednames);
free(fullname);
/* Check the headerline if the extension didn't match anything. */
if (openfile->colorstrings == NULL) {
#ifdef DEBUG
@@ -345,67 +365,49 @@ void color_update(void)
}
}
/* Reset the multicolor info cache for records for any lines which need
* to be recalculated. */
void reset_multis_after(filestruct *fileptr, int mindex)
/* Reset the multiline coloring cache for one specific regex (given by
* index) for lines that need reevaluation. */
void reset_multis_for_id(filestruct *fileptr, int index)
{
filestruct *oof;
for (oof = fileptr->next; oof != NULL; oof = oof->next) {
alloc_multidata_if_needed(oof);
if (oof->multidata == NULL)
continue;
if (oof->multidata[mindex] != CNONE)
oof->multidata[mindex] = -1;
else
filestruct *row;
/* Reset the cache of earlier lines, as far back as needed. */
for (row = fileptr->prev; row != NULL; row = row->prev) {
alloc_multidata_if_needed(row);
if (row->multidata[index] == CNONE)
break;
row->multidata[index] = -1;
}
for (; oof != NULL; oof = oof->next) {
alloc_multidata_if_needed(oof);
if (oof->multidata == NULL)
continue;
if (oof->multidata[mindex] == CNONE)
oof->multidata[mindex] = -1;
else
for (; row != NULL; row = row->prev) {
alloc_multidata_if_needed(row);
if (row->multidata[index] != CNONE)
break;
row->multidata[index] = -1;
}
/* Reset the cache of the current line. */
fileptr->multidata[index] = -1;
/* Reset the cache of later lines, as far ahead as needed. */
for (row = fileptr->next; row != NULL; row = row->next) {
alloc_multidata_if_needed(row);
if (row->multidata[index] == CNONE)
break;
row->multidata[index] = -1;
}
for (; row != NULL; row = row->next) {
alloc_multidata_if_needed(row);
if (row->multidata[index] != CNONE)
break;
row->multidata[index] = -1;
}
edit_refresh_needed = TRUE;
}
void reset_multis_before(filestruct *fileptr, int mindex)
{
filestruct *oof;
for (oof = fileptr->prev; oof != NULL; oof = oof->prev) {
alloc_multidata_if_needed(oof);
if (oof->multidata == NULL)
continue;
if (oof->multidata[mindex] != CNONE)
oof->multidata[mindex] = -1;
else
break;
}
for (; oof != NULL; oof = oof->prev) {
alloc_multidata_if_needed(oof);
if (oof->multidata == NULL)
continue;
if (oof->multidata[mindex] == CNONE)
oof->multidata[mindex] = -1;
else
break;
}
edit_refresh_needed = TRUE;
}
/* Reset one multiline regex info. */
void reset_multis_for_id(filestruct *fileptr, int num)
{
reset_multis_before(fileptr, num);
reset_multis_after(fileptr, num);
fileptr->multidata[num] = -1;
}
/* Reset multi-line strings around a filestruct ptr, trying to be smart
* about stopping. Bool force means: reset everything regardless, useful
* when we don't know how much screen state has changed. */
/* Reset multi-line strings around the filestruct fileptr, trying to be
* smart about stopping. Bool force means: reset everything regardless,
* useful when we don't know how much screen state has changed. */
void reset_multis(filestruct *fileptr, bool force)
{
int nobegin, noend;
@@ -416,34 +418,32 @@ void reset_multis(filestruct *fileptr, bool force)
return;
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
/* If it's not a multi-line regex, amscray. */
if (tmpcolor->end == NULL)
continue;
alloc_multidata_if_needed(fileptr);
if (force == TRUE) {
reset_multis_for_id(fileptr, tmpcolor->id);
continue;
if (force == FALSE) {
/* Check whether the multidata still matches the current situation. */
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
if ((fileptr->multidata[tmpcolor->id] == CWHOLELINE ||
fileptr->multidata[tmpcolor->id] == CNONE) &&
nobegin && noend)
continue;
else if (fileptr->multidata[tmpcolor->id] == CSTARTENDHERE &&
!nobegin && !noend && startmatch.rm_so < endmatch.rm_so)
continue;
else if (fileptr->multidata[tmpcolor->id] == CBEGINBEFORE &&
nobegin && !noend)
continue;
else if (fileptr->multidata[tmpcolor->id] == CENDAFTER &&
!nobegin && noend)
continue;
}
/* Figure out where the first begin and end are to determine if
* things changed drastically for the precalculated multi values. */
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
if (fileptr->multidata[tmpcolor->id] == CWHOLELINE) {
if (nobegin && noend)
continue;
} else if (fileptr->multidata[tmpcolor->id] == CNONE) {
if (nobegin && noend)
continue;
} else if (fileptr->multidata[tmpcolor->id] & CBEGINBEFORE && !noend
&& (nobegin || endmatch.rm_eo > startmatch.rm_eo)) {
reset_multis_after(fileptr, tmpcolor->id);
continue;
}
/* If we got here, assume the worst. */
/* If we got here, things have changed. */
reset_multis_for_id(fileptr, tmpcolor->id);
}
}

View File

@@ -50,11 +50,6 @@ inline bool keeping_cutbuffer(void)
* current line. */
void cut_line(void)
{
#ifndef NANO_TINY
if (!openfile->mark_begin)
openfile->mark_begin = openfile->current;
#endif
if (openfile->current != openfile->filebot)
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current, 0,
openfile->current->next, 0);
@@ -124,7 +119,7 @@ void cut_to_eof(void)
* position to the end of the file into the cutbuffer. */
void do_cut_text(
#ifndef NANO_TINY
bool copy_text, bool cut_till_eof, bool undoing
bool copy_text, bool cut_till_eof
#else
void
#endif
@@ -214,8 +209,7 @@ void do_cut_text(
* disturbing the text. */
if (!old_no_newlines)
UNSET(NO_NEWLINES);
} else if (!undoing)
update_undo(cut_till_eof ? CUT_EOF : CUT);
}
/* Leave the text in the cutbuffer, and mark the file as
* modified. */
@@ -240,12 +234,11 @@ void do_cut_text_void(void)
{
#ifndef NANO_TINY
add_undo(CUT);
do_cut_text(FALSE, FALSE);
update_undo(CUT);
#else
do_cut_text();
#endif
do_cut_text(
#ifndef NANO_TINY
FALSE, FALSE, FALSE
#endif
);
}
#ifndef NANO_TINY
@@ -260,7 +253,7 @@ void do_copy_text(void)
if (mark_set || openfile->current != next_contiguous_line)
cutbuffer_reset();
do_cut_text(TRUE, FALSE, FALSE);
do_cut_text(TRUE, FALSE);
/* If the mark was set, blow away the cutbuffer on the next copy. */
next_contiguous_line = (mark_set ? NULL : openfile->current);
@@ -270,7 +263,8 @@ void do_copy_text(void)
void do_cut_till_eof(void)
{
add_undo(CUT_EOF);
do_cut_text(FALSE, TRUE, FALSE);
do_cut_text(FALSE, TRUE);
update_undo(CUT_EOF);
}
#endif /* !NANO_TINY */

File diff suppressed because it is too large Load Diff

View File

@@ -30,12 +30,8 @@
/* Global variables. */
#ifndef NANO_TINY
sigjmp_buf jump_buf;
/* Used to return to either main() or the unjustify routine in
* do_justify() after a SIGWINCH. */
bool jump_buf_main = FALSE;
/* Have we set jump_buf so that we return to main() after a
* SIGWINCH? */
volatile sig_atomic_t sigwinch_counter = 0;
/* Is incremented by the handler whenever a SIGWINCH occurs. */
#endif
bool meta_key;
@@ -45,6 +41,11 @@ bool func_key;
bool focusing = FALSE;
/* Whether an update of the edit window should center the cursor. */
#ifndef NANO_TINY
int controlleft = CONTROL_LEFT;
int controlright = CONTROL_RIGHT;
#endif
#ifndef DISABLE_WRAPJUSTIFY
ssize_t fill = 0;
/* The column where we will wrap lines. */
@@ -93,14 +94,10 @@ openfilestruct *openfile = NULL;
char *matchbrackets = NULL;
/* The opening and closing brackets that can be found by bracket
* searches. */
#endif
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
char *whitespace = NULL;
/* The characters used when displaying the first characters of
* tabs and spaces. */
/* The characters used when visibly showing tabs and spaces. */
int whitespace_len[2];
/* The length of these characters. */
/* The length in bytes of these characters. */
#endif
#ifndef DISABLE_JUSTIFY
@@ -225,11 +222,7 @@ size_t length_of_list(int menu)
size_t i = 0;
for (f = allfuncs; f != NULL; f = f->next)
if ((f->menus & menu) != 0
#ifndef DISABLE_HELP
&& strlen(f->help) > 0
#endif
) {
if ((f->menus & menu) != 0) {
i++;
}
return i;
@@ -315,9 +308,10 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
}
/* Add a key combo to the shortcut list. */
void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggle)
void add_to_sclist(int menus, const char *scstring, void (*func)(void), int toggle)
{
static sc *tailsc;
static int counter = 0;
sc *s = (sc *)nmalloc(sizeof(sc));
/* Start the list, or tack on the next item. */
@@ -329,15 +323,17 @@ void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggl
s->next = NULL;
/* Fill in the data. */
s->menu = menu;
s->menus = menus;
s->scfunc = func;
s->toggle = toggle;
if (toggle)
s->ordinal = ++counter;
s->keystr = (char *) scstring;
s->type = strtokeytype(scstring);
assign_keyinfo(s);
#ifdef DEBUG
fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menu %x\n", s->seq, scstring, (int)s->menu);
fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menus %x\n", s->seq, scstring, s->menus);
#endif
}
@@ -358,7 +354,7 @@ const sc *first_sc_for(int menu, void (*func)(void))
const sc *s;
for (s = sclist; s != NULL; s = s->next)
if ((s->menu & menu) && s->scfunc == func)
if ((s->menus & menu) && s->scfunc == func)
return s;
#ifdef DEBUG
@@ -475,32 +471,35 @@ void print_sclist(void)
}
#endif
/* TRANSLATORS: Try to keep the next four strings at most 10 characters. */
/* These four tags are used elsewhere too, so they are global. */
/* TRANSLATORS: Try to keep the next fifteen strings at most 10 characters. */
const char *exit_tag = N_("Exit");
const char *close_tag = N_("Close");
const char *uncut_tag = N_("Uncut Text");
#ifndef DISABLE_JUSITIFY
const char *unjust_tag = N_("Unjustify");
#endif
#ifndef NANO_TINY
/* TRANSLATORS: Try to keep this at most 12 characters. */
const char *whereis_next_tag = N_("WhereIs Next");
#endif
/* Initialize the list of functions and the list of shortcuts. */
void shortcut_init(void)
{
/* TRANSLATORS: Try to keep the next eight strings at most 10 characters. */
const char *read_file_tag = N_("Read File");
const char *whereis_tag = N_("Where Is");
const char *replace_tag = N_("Replace");
const char *gotoline_tag = N_("Go To Line");
const char *prev_line_tag = N_("Prev Line");
const char *next_line_tag = N_("Next Line");
const char *read_file_tag = N_("Read File");
const char *prev_page_tag = N_("Prev Page");
const char *next_page_tag = N_("Next Page");
#ifndef DISABLE_JUSTIFY
const char *justify_tag = N_("Justify");
const char *fulljustify_tag = N_("FullJstify");
#endif
const char *refresh_tag = N_("Refresh");
#ifndef NANO_TINY
/* TRANSLATORS: Try to keep this string at most 12 characters. */
const char *whereis_next_tag = N_("WhereIs Next");
#endif
#ifndef DISABLE_HELP
#ifndef DISABLE_JUSTIFY
@@ -585,6 +584,10 @@ void shortcut_init(void)
const char *nano_backspace_msg =
N_("Delete the character to the left of the cursor");
#ifndef NANO_TINY
const char *nano_cut_word_left_msg =
N_("Cut backward from cursor to word start");
const char *nano_cut_word_right_msg =
N_("Cut forward from cursor to next word start");
const char *nano_cut_till_eof_msg =
N_("Cut from the cursor position to the end of the file");
#endif
@@ -598,8 +601,11 @@ void shortcut_init(void)
const char *nano_refresh_msg =
N_("Refresh (redraw) the current screen");
const char *nano_suspend_msg =
N_("Suspend the editor (if suspend is enabled)");
N_("Suspend the editor (if suspension is enabled)");
#ifndef NANO_TINY
const char *nano_savefile_msg = N_("Save file without prompting");
const char *nano_findprev_msg = N_("Search next occurrence backward");
const char *nano_findnext_msg = N_("Search next occurrence forward");
const char *nano_case_msg =
N_("Toggle the case sensitivity of the search");
const char *nano_reverse_msg =
@@ -681,18 +687,28 @@ void shortcut_init(void)
add_to_funcs(do_writeout_void, MMAIN,
N_("Write Out"), IFSCHELP(nano_writeout_msg), TOGETHER, NOVIEW);
/* We allow inserting files in view mode if multibuffers are
* available, so that we can view multiple files. If we're using
* restricted mode, inserting files is disabled, since it allows
* reading from or writing to files not specified on the command
* line. */
add_to_funcs(do_insertfile_void, MMAIN,
read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER,
#ifndef DISABLE_MULTIBUFFER
VIEW);
#ifndef DISABLE_JUSTIFY
if (!ISSET(RESTRICTED)) {
#else
NOVIEW);
/* If we can't replace Insert with Justify, show Insert anyway, to
* keep the help items nicely paired also in restricted mode. */
if (TRUE) {
#endif
add_to_funcs(do_insertfile_void, MMAIN,
read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER,
/* We allow inserting files in view mode if multibuffer mode
* is switched on, so that we can view multiple files. */
#ifndef DISABLE_MULTIBUFFER
VIEW);
#else
NOVIEW);
#endif
} else {
#ifndef DISABLE_JUSTIFY
add_to_funcs(do_justify_void, MMAIN,
justify_tag, IFSCHELP(nano_justify_msg), BLANKAFTER, NOVIEW);
#endif
}
add_to_funcs(do_search, MMAIN,
whereis_tag, IFSCHELP(nano_whereis_msg), TOGETHER, VIEW);
@@ -727,24 +743,25 @@ void shortcut_init(void)
/* Remember the entry for Uncut, to be able to replace it with Unjustify. */
uncutfunc = tailfunc;
if (!ISSET(RESTRICTED)) {
#ifndef DISABLE_JUSTIFY
add_to_funcs(do_justify_void, MMAIN,
N_("Justify"), IFSCHELP(nano_justify_msg), TOGETHER, NOVIEW);
add_to_funcs(do_justify_void, MMAIN,
justify_tag, IFSCHELP(nano_justify_msg), TOGETHER, NOVIEW);
#endif
#ifndef DISABLE_SPELLER
add_to_funcs(do_spell, MMAIN,
N_("To Spell"), IFSCHELP(nano_spell_msg), TOGETHER, NOVIEW);
add_to_funcs(do_spell, MMAIN,
N_("To Spell"), IFSCHELP(nano_spell_msg), TOGETHER, NOVIEW);
#endif
#ifndef DISABLE_COLOR
add_to_funcs(do_linter, MMAIN,
N_("To Linter"), IFSCHELP(nano_lint_msg), TOGETHER, NOVIEW);
add_to_funcs(do_linter, MMAIN,
N_("To Linter"), IFSCHELP(nano_lint_msg), TOGETHER, NOVIEW);
#ifndef DISABLE_SPELLER
add_to_funcs(do_formatter, MMAIN,
N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, NOVIEW);
add_to_funcs(do_formatter, MMAIN,
N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, NOVIEW);
#endif
#endif
}
#ifndef NANO_TINY
add_to_funcs(case_sens_void, MWHEREIS|MREPLACE,
@@ -782,10 +799,10 @@ void shortcut_init(void)
gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, VIEW);
#endif
add_to_funcs(do_page_up, MMAIN|MHELP|MBROWSER,
N_("Prev Page"), IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
add_to_funcs(do_page_down, MMAIN|MHELP|MBROWSER,
N_("Next Page"), IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
add_to_funcs(do_page_up, MMAIN|MHELP,
prev_page_tag, IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
add_to_funcs(do_page_down, MMAIN|MHELP,
next_page_tag, IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
add_to_funcs(do_first_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
N_("First Line"), IFSCHELP(nano_firstline_msg), TOGETHER, VIEW);
@@ -876,8 +893,9 @@ void shortcut_init(void)
add_to_funcs(do_tab, MMAIN,
N_("Tab"), IFSCHELP(nano_tab_msg), TOGETHER, NOVIEW);
add_to_funcs(do_enter_void, MMAIN,
N_("Enter"), IFSCHELP(nano_enter_msg), TOGETHER, NOVIEW);
add_to_funcs(do_enter, MMAIN,
N_("Enter"), IFSCHELP(nano_enter_msg), BLANKAFTER, NOVIEW);
add_to_funcs(do_delete, MMAIN,
N_("Delete"), IFSCHELP(nano_delete_msg), TOGETHER, NOVIEW);
add_to_funcs(do_backspace, MMAIN,
@@ -890,6 +908,10 @@ void shortcut_init(void)
NOVIEW);
#ifndef NANO_TINY
add_to_funcs(do_cut_prev_word, MMAIN,
N_("Cut Left"), IFSCHELP(nano_cut_word_left_msg), TOGETHER, NOVIEW);
add_to_funcs(do_cut_next_word, MMAIN,
N_("Cut Right"), IFSCHELP(nano_cut_word_right_msg), TOGETHER, NOVIEW);
add_to_funcs(do_cut_till_eof, MMAIN,
N_("CutTillEnd"), IFSCHELP(nano_cut_till_eof_msg), BLANKAFTER, NOVIEW);
#endif
@@ -910,6 +932,16 @@ void shortcut_init(void)
add_to_funcs(do_suspend_void, MMAIN,
N_("Suspend"), IFSCHELP(nano_suspend_msg), BLANKAFTER, VIEW);
#ifndef NANO_TINY
add_to_funcs(do_savefile, MMAIN,
N_("Save"), IFSCHELP(nano_savefile_msg), BLANKAFTER, NOVIEW);
add_to_funcs(do_findprevious, MMAIN,
N_("Previous"), IFSCHELP(nano_findprev_msg), TOGETHER, VIEW);
add_to_funcs(do_findnext, MMAIN,
N_("Next"), IFSCHELP(nano_findnext_msg), BLANKAFTER, VIEW);
#endif
#ifndef DISABLE_HISTORIES
add_to_funcs(get_history_older_void,
(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE),
@@ -923,19 +955,16 @@ void shortcut_init(void)
N_("Go To Text"), IFSCHELP(nano_whereis_msg), BLANKAFTER, VIEW);
#ifndef NANO_TINY
/* If we're using restricted mode, the DOS format, Mac format,
* append, prepend, and backup toggles are disabled. The first and
* second are useless since inserting files is disabled, the third
* and fourth are disabled because they allow writing to files not
* specified on the command line, and the fifth is useless since
* backups are disabled. */
add_to_funcs(dos_format_void, MWRITEFILE,
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
add_to_funcs(mac_format_void, MWRITEFILE,
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
/* If we're using restricted mode, the Append, Prepend, and Backup toggles
* are disabled. The first and second are not useful as they only allow
* reduplicating the current file, and the third is not allowed as it
* would write to a file not specified on the command line. */
if (!ISSET(RESTRICTED)) {
add_to_funcs(dos_format_void, MWRITEFILE,
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
add_to_funcs(mac_format_void, MWRITEFILE,
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
add_to_funcs(append_void, MWRITEFILE,
N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW);
add_to_funcs(prepend_void, MWRITEFILE,
@@ -966,10 +995,15 @@ void shortcut_init(void)
add_to_funcs(to_files_void, MWRITEFILE|MINSERTFILE,
N_("To Files"), IFSCHELP(nano_tofiles_msg), TOGETHER, VIEW);
add_to_funcs(do_page_up, MBROWSER,
prev_page_tag, IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
add_to_funcs(do_page_down, MBROWSER,
next_page_tag, IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
add_to_funcs(do_first_file, (MBROWSER|MWHEREISFILE),
N_("First File"), IFSCHELP(nano_firstfile_msg), TOGETHER, VIEW);
add_to_funcs(do_last_file, (MBROWSER|MWHEREISFILE),
N_("Last File"), IFSCHELP(nano_lastfile_msg), TOGETHER, VIEW);
N_("Last File"), IFSCHELP(nano_lastfile_msg), BLANKAFTER, VIEW);
#endif
#if !defined(NANO_TINY) && !defined(DISABLE_BROWSER)
@@ -1012,10 +1046,6 @@ void shortcut_init(void)
#ifndef DISABLE_SPELLER
add_to_sclist(MMAIN, "^T", do_spell, 0);
add_to_sclist(MMAIN, "F12", do_spell, 0);
#ifndef DISABLE_COLOR
add_to_sclist(MMAIN, "^T", do_formatter, 0);
add_to_sclist(MMAIN, "F12", do_formatter, 0);
#endif
#else
#ifndef DISABLE_COLOR
add_to_sclist(MMAIN, "^T", do_linter, 0);
@@ -1059,10 +1089,10 @@ void shortcut_init(void)
add_to_sclist(MMOST, "M-Space", do_prev_word_void, 0);
add_to_sclist(MMOST, "^Space", do_next_word_void, 0);
#endif
add_to_sclist(MMOST, "^A", do_home, 0);
add_to_sclist(MMOST, "Home", do_home, 0);
add_to_sclist(MMOST, "^E", do_end, 0);
add_to_sclist(MMOST, "End", do_end, 0);
add_to_sclist((MMOST & ~MBROWSER), "^A", do_home, 0);
add_to_sclist((MMOST & ~MBROWSER), "Home", do_home, 0);
add_to_sclist((MMOST & ~MBROWSER), "^E", do_end, 0);
add_to_sclist((MMOST & ~MBROWSER), "End", do_end, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", do_up_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", do_up_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", do_down_void, 0);
@@ -1155,33 +1185,45 @@ void shortcut_init(void)
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Down", get_history_newer_void, 0);
#endif
#ifndef DISABLE_BROWSER
add_to_sclist(MWHEREISFILE, "^Y", do_first_file, 0);
add_to_sclist(MWHEREISFILE, "^V", do_last_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", do_first_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", do_first_file, 0);
add_to_sclist(MWHEREISFILE, "^Y", do_first_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", do_last_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", do_last_file, 0);
add_to_sclist(MWHEREISFILE, "^V", do_last_file, 0);
add_to_sclist(MBROWSER, "Home", do_first_file, 0);
add_to_sclist(MBROWSER, "End", do_last_file, 0);
add_to_sclist(MBROWSER, "^_", goto_dir_void, 0);
add_to_sclist(MBROWSER, "M-G", goto_dir_void, 0);
add_to_sclist(MBROWSER, "F13", goto_dir_void, 0);
#endif
add_to_sclist(MWRITEFILE, "M-D", dos_format_void, 0);
add_to_sclist(MWRITEFILE, "M-M", mac_format_void, 0);
add_to_sclist(MWRITEFILE, "M-A", append_void, 0);
add_to_sclist(MWRITEFILE, "M-P", prepend_void, 0);
add_to_sclist(MWRITEFILE, "M-B", backup_file_void, 0);
if (!ISSET(RESTRICTED)) {
/* Don't allow Appending, Prepending, nor Backups in restricted mode. */
add_to_sclist(MWRITEFILE, "M-A", append_void, 0);
add_to_sclist(MWRITEFILE, "M-P", prepend_void, 0);
add_to_sclist(MWRITEFILE, "M-B", backup_file_void, 0);
#ifndef DISABLE_BROWSER
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", to_files_void, 0);
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", to_files_void, 0);
#endif
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", flip_execute_void, 0);
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", new_buffer_void, 0);
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", flip_execute_void, 0);
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", new_buffer_void, 0);
}
add_to_sclist(MHELP|MBROWSER, "^C", do_exit, 0);
/* Allow exiting from the file browser and the help viewer with
* the same key as they were entered. */
#ifndef DISABLE_BROWSER
add_to_sclist(MBROWSER, "^T", do_exit, 0);
#endif
#ifndef DISABLE_HELP
add_to_sclist(MHELP, "^G", do_exit, 0);
add_to_sclist(MHELP, "Home", do_first_line, 0);
add_to_sclist(MHELP, "End", do_last_line, 0);
#endif
add_to_sclist(MMOST, "^I", do_tab, 0);
add_to_sclist(MMOST, "^M", do_enter_void, 0);
add_to_sclist(MMOST, "Enter", do_enter_void, 0);
add_to_sclist(MMOST, "^M", do_enter, 0);
add_to_sclist(MMOST, "Enter", do_enter, 0);
add_to_sclist(MMOST, "^D", do_delete, 0);
add_to_sclist(MMOST, "Del", do_delete, 0);
add_to_sclist(MMOST, "^H", do_backspace, 0);
@@ -1260,7 +1302,7 @@ const char *flagtostr(int flag)
case BACKUP_FILE:
return N_("Backup files");
case MULTIBUFFER:
return N_("Multiple file buffers");
return N_("Reading file into separate buffer");
case USE_MOUSE:
return N_("Mouse support");
case NO_CONVERT:
@@ -1293,6 +1335,10 @@ sc *strtosc(char *input)
s->scfunc = do_exit;
else if (!strcasecmp(input, "writeout"))
s->scfunc = do_writeout_void;
#ifndef NANO_TINY
else if (!strcasecmp(input, "savefile"))
s->scfunc = do_savefile;
#endif
else if (!strcasecmp(input, "insert"))
s->scfunc = do_insertfile_void;
else if (!strcasecmp(input, "whereis"))
@@ -1301,6 +1347,10 @@ sc *strtosc(char *input)
else if (!strcasecmp(input, "searchagain") ||
!strcasecmp(input, "research"))
s->scfunc = do_research;
else if (!strcasecmp(input, "findprevious"))
s->scfunc = do_findprevious;
else if (!strcasecmp(input, "findnext"))
s->scfunc = do_findnext;
#endif
else if (!strcasecmp(input, "replace"))
s->scfunc = do_replace;
@@ -1353,6 +1403,10 @@ sc *strtosc(char *input)
s->scfunc = do_prev_word_void;
else if (!strcasecmp(input, "nextword"))
s->scfunc = do_next_word_void;
else if (!strcasecmp(input, "cutwordleft"))
s->scfunc = do_cut_prev_word;
else if (!strcasecmp(input, "cutwordright"))
s->scfunc = do_cut_next_word;
else if (!strcasecmp(input, "findbracket"))
s->scfunc = do_find_bracket;
else if (!strcasecmp(input, "wordcount"))
@@ -1399,7 +1453,7 @@ sc *strtosc(char *input)
else if (!strcasecmp(input, "tab"))
s->scfunc = do_tab;
else if (!strcasecmp(input, "enter"))
s->scfunc = do_enter_void;
s->scfunc = do_enter;
else if (!strcasecmp(input, "delete"))
s->scfunc = do_delete;
else if (!strcasecmp(input, "backspace"))
@@ -1573,34 +1627,25 @@ void thanks_for_all_the_fish(void)
delwin(bottomwin);
#ifndef DISABLE_JUSTIFY
if (quotestr != NULL)
free(quotestr);
free(quotestr);
#ifdef HAVE_REGEX_H
regfree(&quotereg);
if (quoteerr != NULL)
free(quoteerr);
free(quoteerr);
#endif
#endif
#ifndef NANO_TINY
if (backup_dir != NULL)
free(backup_dir);
free(backup_dir);
#endif
#ifndef DISABLE_OPERATINGDIR
if (operating_dir != NULL)
free(operating_dir);
if (full_operating_dir != NULL)
free(full_operating_dir);
free(operating_dir);
free(full_operating_dir);
#endif
if (last_search != NULL)
free(last_search);
if (last_replace != NULL)
free(last_replace);
free(answer);
free(last_search);
free(last_replace);
#ifndef DISABLE_SPELLER
if (alt_speller != NULL)
free(alt_speller);
free(alt_speller);
#endif
if (answer != NULL)
free(answer);
if (cutbuffer != NULL)
free_filestruct(cutbuffer);
#ifndef DISABLE_JUSTIFY
@@ -1611,12 +1656,13 @@ void thanks_for_all_the_fish(void)
if (openfile != NULL)
free_openfilestruct(openfile);
#ifndef DISABLE_COLOR
if (syntaxstr != NULL)
free(syntaxstr);
free(syntaxstr);
while (syntaxes != NULL) {
syntaxtype *bill = syntaxes;
free(syntaxes->desc);
free(syntaxes->linter);
free(syntaxes->formatter);
while (syntaxes->extensions != NULL) {
regexlisttype *bob = syntaxes->extensions;
syntaxes->extensions = bob->next;
@@ -1687,8 +1733,7 @@ void thanks_for_all_the_fish(void)
free(s);
}
#ifndef DISABLE_NANORC
if (homedir != NULL)
free(homedir);
free(homedir);
#endif
}

View File

@@ -32,9 +32,12 @@
static char *help_text = NULL;
/* The text displayed in the help window. */
/* Our main help browser function. refresh_func is the function we will
* call to refresh the edit window. */
void do_help(void (*refresh_func)(void))
static char *end_of_intro = NULL;
/* The point in the help text where the introductory paragraphs end
* and the shortcut descriptions begin. */
/* Our main help-viewer function. */
void do_help(void)
{
int kbinput = ERR;
bool old_no_help = ISSET(NO_HELP);
@@ -72,35 +75,35 @@ void do_help(void (*refresh_func)(void))
bottombars(MHELP);
wnoutrefresh(bottomwin);
/* Get the last line of the help text. */
ptr = help_text;
for (; *ptr != '\0'; last_line++) {
ptr += help_line_len(ptr);
if (*ptr == '\n')
ptr++;
}
if (last_line > 0)
last_line--;
while (TRUE) {
size_t i;
/* Display the help text if we don't have a key, or if the help
* text has moved. */
if (kbinput == ERR || line != old_line) {
ptr = help_text;
/* Find the line number of the last line of the help text. */
for (last_line = 0; *ptr != '\0'; last_line++) {
ptr += help_line_len(ptr);
if (*ptr == '\n')
ptr++;
}
if (last_line > 0)
last_line--;
/* Redisplay if the text was scrolled or an invalid key was pressed. */
if (line != old_line || kbinput == ERR) {
blank_edit();
ptr = help_text;
/* Calculate where in the text we should be, based on the
* page. */
/* Advance in the text to the first line to be displayed. */
for (i = 0; i < line; i++) {
ptr += help_line_len(ptr);
if (*ptr == '\n')
ptr++;
}
/* Now display as many lines as the window will hold. */
for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
size_t j = help_line_len(ptr);
@@ -117,6 +120,14 @@ void do_help(void (*refresh_func)(void))
kbinput = get_kbinput(edit);
#ifndef NANO_TINY
if (kbinput == KEY_WINCH) {
kbinput = ERR;
curs_set(0);
continue; /* Redraw the screen. */
}
#endif
#ifndef DISABLE_MOUSE
if (kbinput == KEY_MOUSE) {
int mouse_x, mouse_y;
@@ -149,7 +160,7 @@ void do_help(void (*refresh_func)(void))
if (line + (editwinrows - 1) < last_line)
line = last_line - (editwinrows - 1);
} else if (func == do_exit) {
/* Exit from the help browser. */
/* Exit from the help viewer. */
break;
}
}
@@ -164,35 +175,35 @@ void do_help(void (*refresh_func)(void))
bottombars(oldmenu);
curs_set(1);
refresh_func();
/* The help_init() at the beginning allocated help_text. Since
* help_text has now been written to the screen, we don't need it
* anymore. */
#ifndef DISABLE_BROWSER
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
browser_refresh();
else
#endif
edit_refresh();
/* We're exiting from the help screen. */
free(help_text);
help_text = NULL;
}
/* This function allocates help_text, and stores the help string in it.
* help_text should be NULL initially. */
/* Allocate space for the help text for the current menu, and concatenate
* the different pieces of text into it. */
void help_init(void)
{
size_t allocsize = 0; /* Space needed for help_text. */
const char *htx[3]; /* Untranslated help message. We break
* it up into three chunks in case the
* full string is too long for the
* compiler to handle. */
size_t allocsize = 0;
/* Space needed for help_text. */
const char *htx[3];
/* Untranslated help introduction. We break it up into three chunks
* in case the full string is too long for the compiler to handle. */
char *ptr;
const subnfunc *f;
const sc *s;
int scsfound = 0;
#ifndef NANO_TINY
#ifndef DISABLE_NANORC
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
UNSET(WHITESPACE_DISPLAY);
#endif
#endif
/* First, set up the initial help text for the current function. */
@@ -359,9 +370,9 @@ void help_init(void)
/* Calculate the length of the shortcut help text. Each entry has
* one or two keys, which fill 16 columns, plus translated text,
* plus one or two \n's. */
for (f = allfuncs; f != NULL; f = f->next)
if (f->menus & currmenu)
allocsize += (16 * mb_cur_max()) + strlen(f->help) + 2;
for (f = allfuncs; f != NULL; f = f->next)
if (f->menus & currmenu)
allocsize += (16 * mb_cur_max()) + strlen(f->help) + 2;
#ifndef NANO_TINY
/* If we're on the main list, we also count the toggle help text.
@@ -376,11 +387,6 @@ void help_init(void)
}
#endif
/* help_text has been freed and set to NULL unless the user resized
* while in the help screen. */
if (help_text != NULL)
free(help_text);
/* Allocate space for the help text. */
help_text = charalloc(allocsize + 1);
@@ -393,19 +399,20 @@ void help_init(void)
ptr = help_text + strlen(help_text);
/* Remember this end-of-introduction, start-of-shortcuts. */
end_of_intro = ptr;
/* Now add our shortcut info. */
for (f = allfuncs; f != NULL; f = f->next) {
int scsfound = 0;
if ((f->menus & currmenu) == 0)
continue;
/* Let's simply show the first two shortcuts from the list. */
for (s = sclist, scsfound = 0; s != NULL; s = s->next) {
for (s = sclist; s != NULL; s = s->next) {
if (s->type == RAWINPUT)
continue;
if ((s->menu & currmenu) == 0)
if ((s->menus & currmenu) == 0)
continue;
if (s->scfunc == f->scfunc) {
@@ -436,23 +443,32 @@ void help_init(void)
#ifndef NANO_TINY
/* And the toggles... */
if (currmenu == MMAIN)
for (s = sclist; s != NULL; s = s->next) {
if (s->scfunc == do_toggle_void)
ptr += sprintf(ptr, "%s\t\t%s %s\n", (s->menu == MMAIN ? s->keystr : ""),
_(flagtostr(s->toggle)), _("enable/disable"));
if (s->toggle == NO_COLOR_SYNTAX || s->toggle == TABS_TO_SPACES)
ptr += sprintf(ptr, "\n");
}
if (currmenu == MMAIN) {
int maximum = 0, counter = 0;
/* First see how many toggles there are. */
for (s = sclist; s != NULL; s = s->next)
maximum = (s->toggle && s->ordinal > maximum) ? s->ordinal : maximum;
/* Now show them in the original order. */
while (counter < maximum) {
counter++;
for (s = sclist; s != NULL; s = s->next)
if (s->toggle && s->ordinal == counter) {
ptr += sprintf(ptr, "%s\t\t%s %s\n", (s->menus == MMAIN ? s->keystr : ""),
_(flagtostr(s->toggle)), _("enable/disable"));
if (s->toggle == NO_COLOR_SYNTAX || s->toggle == TABS_TO_SPACES)
ptr += sprintf(ptr, "\n");
break;
}
}
}
#ifndef DISABLE_NANORC
if (old_whitespace)
SET(WHITESPACE_DISPLAY);
#endif
#endif /* !NANO_TINY */
/* If all went well, we didn't overwrite the allocated space for
* help_text. */
/* If all went well, we didn't overwrite the allocated space. */
assert(strlen(help_text) <= allocsize + 1);
}
@@ -474,46 +490,45 @@ functionptrtype parse_help_input(int *kbinput)
return func_from_key(kbinput);
}
/* Calculate the next line of help_text, starting at ptr. */
/* Calculate the displayable length of the help-text line starting at ptr. */
size_t help_line_len(const char *ptr)
{
int help_cols = (COLS > 24) ? COLS - 1 : 24;
size_t wrapping_point = (COLS > 24) ? COLS - 1 : 24;
/* The target width for wrapping long lines. */
ssize_t wrap_location;
/* Actual position where the line can be wrapped. */
size_t length = 0;
/* Full length of the line, until the first newline. */
/* Try to break the line at (COLS - 1) columns if we have more than
* 24 columns, and at 24 columns otherwise. */
ssize_t wrap_loc = break_line(ptr, help_cols, TRUE);
size_t retval = (wrap_loc < 0) ? 0 : wrap_loc;
size_t retval_save = retval;
/* Avoid overwide paragraphs in the introductory text. */
if (ptr < end_of_intro && COLS > 74)
wrapping_point = 74;
wrap_location = break_line(ptr, wrapping_point, TRUE);
/* Get the length of the entire line up to a null or a newline. */
while (*(ptr + retval) != '\0' && *(ptr + retval) != '\n')
retval += move_mbright(ptr + retval, 0);
while (*(ptr + length) != '\0' && *(ptr + length) != '\n')
length = move_mbright(ptr, length);
/* If the entire line doesn't go more than one column beyond where
* we tried to break it, we should display it as-is. Otherwise, we
* should display it only up to the break. */
if (strnlenpt(ptr, retval) > help_cols + 1)
retval = retval_save;
return retval;
/* If the entire line will just fit the screen, don't wrap it. */
if (strnlenpt(ptr, length) <= wrapping_point + 1)
return length;
else if (wrap_location > 0)
return wrap_location;
else
return 0;
}
#endif /* !DISABLE_HELP */
/* Start the help browser. */
/* Start the help viewer. */
void do_help_void(void)
{
#ifndef DISABLE_HELP
/* Start the help browser, with the correct refresher for afterwards. */
#ifndef DISABLE_BROWSER
if (currmenu == MBROWSER || currmenu == MWHEREISFILE || currmenu == MGOTODIR)
do_help(&browser_refresh);
else
#endif
do_help(&edit_refresh);
do_help();
#else
if (currmenu == MMAIN)
nano_disabled_msg();
say_there_is_no_help();
else
beep();
#endif /* !DISABLE_HELP */

View File

@@ -52,9 +52,8 @@ void do_page_up(void)
{
int i, skipped = 0;
/* 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 the cursor is less than a page away from the top of the file,
* put it at the beginning of the first line. */
if (openfile->current->lineno == 1 || (
#ifndef NANO_TINY
!ISSET(SOFTWRAP) &&
@@ -106,9 +105,8 @@ void do_page_down(void)
{
int i;
/* If there's less than a page of text left on the screen, put the
* cursor at the beginning of the last line of the file, and then
* update the edit window. */
/* If the cursor is less than a page away from the bottom of the file,
* put it at the end of the last line. */
if (openfile->current->lineno + maxrows - 2 >=
openfile->filebot->lineno) {
do_last_line();
@@ -225,75 +223,37 @@ bool do_next_word(bool allow_punct, bool allow_update)
{
size_t pww_save = openfile->placewewant;
filestruct *current_save = openfile->current;
char *char_mb;
int char_mb_len;
bool end_line = FALSE, started_on_word = FALSE;
bool started_on_word = is_word_mbchar(openfile->current->data +
openfile->current_x, allow_punct);
bool seen_space = !started_on_word;
assert(openfile->current != NULL && openfile->current->data != NULL);
char_mb = charalloc(mb_cur_max());
/* Move forward until we find the character after the last letter of
* the current word. */
while (!end_line) {
char_mb_len = parse_mbchar(openfile->current->data +
openfile->current_x, char_mb, NULL);
/* If we've found it, stop moving forward through the current
* line. */
if (!is_word_mbchar(char_mb, allow_punct))
break;
/* If we haven't found it, then we've started on a word, so set
* started_on_word to TRUE. */
started_on_word = TRUE;
if (openfile->current->data[openfile->current_x] == '\0')
end_line = TRUE;
else
openfile->current_x += char_mb_len;
}
/* Move forward until we find the first letter of the next word. */
if (openfile->current->data[openfile->current_x] == '\0')
end_line = TRUE;
else
openfile->current_x += char_mb_len;
for (; openfile->current != NULL;
openfile->current = openfile->current->next) {
while (!end_line) {
char_mb_len = parse_mbchar(openfile->current->data +
openfile->current_x, char_mb, NULL);
/* If we've found it, stop moving forward through the
* current line. */
if (is_word_mbchar(char_mb, allow_punct))
/* Move forward until we reach the start of a word. */
while (TRUE) {
/* If at the end of a line, move to the beginning of the next one. */
if (openfile->current->data[openfile->current_x] == '\0') {
/* If at the end of the file, stop. */
if (openfile->current->next == NULL)
break;
if (openfile->current->data[openfile->current_x] == '\0')
end_line = TRUE;
else
openfile->current_x += char_mb_len;
}
/* If we've found it, stop moving forward to the beginnings of
* subsequent lines. */
if (!end_line)
break;
if (openfile->current != openfile->filebot) {
end_line = FALSE;
openfile->current = openfile->current->next;
openfile->current_x = 0;
seen_space = TRUE;
} else {
/* Step forward one character. */
openfile->current_x = move_mbright(openfile->current->data,
openfile->current_x);
}
/* If this is not a word character, then it's a separator; else
* if we've already seen a separator, then it's a word start. */
if (!is_word_mbchar(openfile->current->data + openfile->current_x,
allow_punct))
seen_space = TRUE;
else if (seen_space)
break;
}
free(char_mb);
/* If we haven't found it, move to the end of the file. */
if (openfile->current == NULL)
openfile->current = openfile->filebot;
openfile->placewewant = xplustabs();
/* If allow_update is TRUE, update the screen. */
@@ -314,125 +274,51 @@ void do_next_word_void(void)
/* Move to the previous word in the file. If allow_punct is TRUE, treat
* punctuation as part of a word. If allow_update is TRUE, update the
* screen afterwards. Return TRUE if we started on a word, and FALSE
* otherwise. */
bool do_prev_word(bool allow_punct, bool allow_update)
* screen afterwards. */
void do_prev_word(bool allow_punct, bool allow_update)
{
size_t pww_save = openfile->placewewant;
filestruct *current_save = openfile->current;
char *char_mb;
int char_mb_len;
bool begin_line = FALSE, started_on_word = FALSE;
bool seen_a_word = FALSE, step_forward = FALSE;
assert(openfile->current != NULL && openfile->current->data != NULL);
char_mb = charalloc(mb_cur_max());
/* Move backward until we pass over the start of a word. */
while (TRUE) {
/* If at the head of a line, move to the end of the preceding one. */
if (openfile->current_x == 0) {
if (openfile->current->prev == NULL)
break;
openfile->current = openfile->current->prev;
openfile->current_x = strlen(openfile->current->data);
}
/* Move backward until we find the character before the first letter
* of the current word. */
while (!begin_line) {
char_mb_len = parse_mbchar(openfile->current->data +
openfile->current_x, char_mb, NULL);
/* If we've found it, stop moving backward through the current
* line. */
if (!is_word_mbchar(char_mb, allow_punct))
break;
/* If we haven't found it, then we've started on a word, so set
* started_on_word to TRUE. */
started_on_word = TRUE;
if (openfile->current_x == 0)
begin_line = TRUE;
else
openfile->current_x = move_mbleft(openfile->current->data,
openfile->current_x);
}
/* Move backward until we find the last letter of the previous
* word. */
if (openfile->current_x == 0)
begin_line = TRUE;
else
/* Step back one character. */
openfile->current_x = move_mbleft(openfile->current->data,
openfile->current_x);
for (; openfile->current != NULL;
openfile->current = openfile->current->prev) {
while (!begin_line) {
char_mb_len = parse_mbchar(openfile->current->data +
openfile->current_x, char_mb, NULL);
/* If we've found it, stop moving backward through the
* current line. */
if (is_word_mbchar(char_mb, allow_punct))
break;
openfile->current_x);
if (is_word_mbchar(openfile->current->data + openfile->current_x,
allow_punct)) {
seen_a_word = TRUE;
/* If at the head of a line now, this surely is a word start. */
if (openfile->current_x == 0)
begin_line = TRUE;
else
openfile->current_x =
move_mbleft(openfile->current->data,
openfile->current_x);
}
/* If we've found it, stop moving backward to the ends of
* previous lines. */
if (!begin_line)
break;
} else if (seen_a_word) {
/* This is space now: we've overshot the start of the word. */
step_forward = TRUE;
break;
if (openfile->current != openfile->fileage) {
begin_line = FALSE;
openfile->current_x = strlen(openfile->current->prev->data);
}
}
/* If we haven't found it, move to the beginning of the file. */
if (openfile->current == NULL)
openfile->current = openfile->fileage;
/* If we've found it, move backward until we find the character
* before the first letter of the previous word. */
else if (!begin_line) {
if (openfile->current_x == 0)
begin_line = TRUE;
else
openfile->current_x = move_mbleft(openfile->current->data,
openfile->current_x);
while (!begin_line) {
char_mb_len = parse_mbchar(openfile->current->data +
openfile->current_x, char_mb, NULL);
/* If we've found it, stop moving backward through the
* current line. */
if (!is_word_mbchar(char_mb, allow_punct))
break;
if (openfile->current_x == 0)
begin_line = TRUE;
else
openfile->current_x =
move_mbleft(openfile->current->data,
openfile->current_x);
}
/* If we've found it, move forward to the first letter of the
* previous word. */
if (!begin_line)
openfile->current_x += char_mb_len;
}
free(char_mb);
if (step_forward)
/* Move one character forward again to sit on the start of the word. */
openfile->current_x = move_mbright(openfile->current->data,
openfile->current_x);
openfile->placewewant = xplustabs();
/* If allow_update is TRUE, update the screen. */
if (allow_update)
edit_redraw(current_save, pww_save);
/* Return whether we started on a word. */
return started_on_word;
}
/* Move to the previous word in the file, treating punctuation as part
@@ -471,7 +357,7 @@ void do_home(void)
}
#endif
if (need_horizontal_update(pww_save))
if (need_screen_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
@@ -483,7 +369,7 @@ void do_end(void)
openfile->current_x = strlen(openfile->current->data);
openfile->placewewant = xplustabs();
if (need_horizontal_update(pww_save))
if (need_screen_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
@@ -534,7 +420,7 @@ void do_up(
* needs to be redrawn if we're not on the first page, and the
* latter needs to be drawn unconditionally. */
if (openfile->current_y > 0) {
if (need_vertical_update(0))
if (need_screen_update(0))
update_line(openfile->current->next, 0);
update_line(openfile->current, openfile->current_x);
}
@@ -592,11 +478,11 @@ void do_down(
topline = openfile->edittop;
/* Reduce the amount when there are overlong lines at the top. */
for (enough = 1; enough < amount; enough++) {
if (amount <= strlenpt(topline->data) / COLS) {
amount -= strlenpt(topline->data) / COLS;
if (amount <= 0) {
amount = enough;
break;
}
amount -= strlenpt(topline->data) / COLS;
topline = topline->next;
}
}
@@ -632,7 +518,7 @@ void do_down(
|| ISSET(SOFTWRAP)
#endif
) {
if (need_vertical_update(0))
if (need_screen_update(0))
update_line(openfile->current->prev, 0);
update_line(openfile->current, openfile->current_x);
}
@@ -671,7 +557,7 @@ void do_left(void)
openfile->placewewant = xplustabs();
if (need_horizontal_update(pww_save))
if (need_screen_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
@@ -692,6 +578,6 @@ void do_right(void)
openfile->placewewant = xplustabs();
if (need_horizontal_update(pww_save))
if (need_screen_update(pww_save))
update_line(openfile->current, openfile->current_x);
}

View File

@@ -25,7 +25,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
@@ -95,21 +94,20 @@ filestruct *copy_node(const filestruct *src)
return dst;
}
/* Splice a node into an existing filestruct. */
void splice_node(filestruct *begin, filestruct *newnode, filestruct
*end)
/* Splice a new node into an existing linked list of filestructs. */
void splice_node(filestruct *afterthis, filestruct *newnode)
{
assert(newnode != NULL && begin != NULL);
assert(afterthis != NULL && newnode != NULL);
newnode->next = end;
newnode->prev = begin;
begin->next = newnode;
if (end != NULL)
end->prev = newnode;
newnode->next = afterthis->next;
newnode->prev = afterthis;
if (afterthis->next != NULL)
afterthis->next->prev = newnode;
afterthis->next = newnode;
}
/* Unlink a node from the rest of the filestruct. */
void unlink_node(const filestruct *fileptr)
/* Unlink a node from the rest of the filestruct and delete it. */
void unlink_node(filestruct *fileptr)
{
assert(fileptr != NULL);
@@ -117,6 +115,8 @@ void unlink_node(const filestruct *fileptr)
fileptr->prev->next = fileptr->next;
if (fileptr->next != NULL)
fileptr->next->prev = fileptr->prev;
delete_node(fileptr);
}
/* Delete a node from the filestruct. */
@@ -124,14 +124,10 @@ void delete_node(filestruct *fileptr)
{
assert(fileptr != NULL && fileptr->data != NULL);
if (fileptr->data != NULL)
free(fileptr->data);
free(fileptr->data);
#ifndef DISABLE_COLOR
if (fileptr->multidata)
free(fileptr->multidata);
free(fileptr->multidata);
#endif
free(fileptr);
}
@@ -389,7 +385,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
openfile->mark_begin = openfile->current;
openfile->mark_begin_x = openfile->current_x;
} else if (same_line)
/* Update the content of this partially cut line. */
/* Update the pointer to this partially cut line. */
openfile->mark_begin = openfile->current;
#endif
@@ -456,34 +452,31 @@ void copy_from_filestruct(filestruct *somebuffer)
while (openfile->filebot->next != NULL)
openfile->filebot = openfile->filebot->next;
/* Restore the current line and cursor position. If the mark begins
* inside the partition, adjust the mark coordinates to compensate
* for the change in the current line. */
/* Put the cursor at the end of the pasted text. */
openfile->current = openfile->filebot;
openfile->current_x = strlen(openfile->filebot->data);
/* Refresh the mark's pointer, and compensate the mark's
* x coordinate for the change in the current line. */
if (openfile->fileage == openfile->filebot) {
#ifndef NANO_TINY
if (openfile->mark_set) {
if (openfile->mark_set && single_line) {
openfile->mark_begin = openfile->current;
if (!right_side_up)
openfile->mark_begin_x += openfile->current_x;
}
#endif
/* When the pasted stuff contains no newline, adjust the cursor's
* x coordinate for the text that is before the pasted stuff. */
openfile->current_x += current_x_save;
}
#ifndef NANO_TINY
else if (openfile->mark_set) {
if (right_side_up) {
if (single_line)
/* Get the new data, stuff was inserted on the mark line. */
openfile->mark_begin = openfile->fileage;
/* The x is okay, it did not move. */
} else {
if (single_line) {
openfile->mark_begin = openfile->current;
openfile->mark_begin_x -= current_x_save;
} else
openfile->mark_begin_x -= openfile->current_x;
else if (openfile->mark_set && single_line) {
if (right_side_up)
openfile->mark_begin = openfile->fileage;
else {
openfile->mark_begin = openfile->current;
openfile->mark_begin_x += openfile->current_x - current_x_save;
}
}
#endif
@@ -522,21 +515,7 @@ void copy_from_filestruct(filestruct *somebuffer)
/* Create a new openfilestruct node. */
openfilestruct *make_new_opennode(void)
{
openfilestruct *newnode =
(openfilestruct *)nmalloc(sizeof(openfilestruct));
newnode->filename = NULL;
newnode->fileage = NULL;
newnode->filebot = NULL;
newnode->edittop = NULL;
newnode->current = NULL;
#ifndef NANO_TINY
newnode->current_stat = NULL;
newnode->last_action = OTHER;
newnode->lock_filename = NULL;
#endif
return newnode;
return (openfilestruct *)nmalloc(sizeof(openfilestruct));
}
/* Splice a node into an existing openfilestruct. */
@@ -556,7 +535,8 @@ void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
/* Unlink a node from the rest of the openfilestruct, and delete it. */
void unlink_opennode(openfilestruct *fileptr)
{
assert(fileptr != NULL && fileptr->prev != NULL && fileptr->next != NULL && fileptr != fileptr->prev && fileptr != fileptr->next);
assert(fileptr != NULL && fileptr->prev != NULL && fileptr->next != NULL &&
fileptr != fileptr->prev && fileptr != fileptr->next);
fileptr->prev->next = fileptr->next;
fileptr->next->prev = fileptr->prev;
@@ -572,10 +552,9 @@ void delete_opennode(openfilestruct *fileptr)
free(fileptr->filename);
free_filestruct(fileptr->fileage);
#ifndef NANO_TINY
if (fileptr->current_stat != NULL)
free(fileptr->current_stat);
free(fileptr->current_stat);
free(fileptr->lock_filename);
#endif
free(fileptr);
}
@@ -598,18 +577,31 @@ void free_openfilestruct(openfilestruct *src)
/* Display a warning about a key disabled in view mode. */
void print_view_warning(void)
{
statusbar(_("Key invalid in view mode"));
statusbar(_("Key is invalid in view mode"));
}
/* Indicate that something is disabled in restricted mode. */
void show_restricted_warning(void)
{
statusbar(_("This function is disabled in restricted mode"));
beep();
}
#ifdef DISABLE_HELP
/* Indicate that help texts are unavailable. */
void say_there_is_no_help(void)
{
statusbar(_("Help is not available"));
}
#endif
/* Make nano exit gracefully. */
void finish(void)
{
/* Blank the statusbar (and shortcut list, if applicable), and move
* the cursor to the last line of the screen. */
if (!ISSET(NO_HELP))
blank_bottombars();
else
blank_statusbar();
/* Blank the statusbar and (if applicable) the shortcut list,
* and move the cursor to the last line of the screen. */
blank_statusbar();
blank_bottombars();
wrefresh(bottomwin);
endwin();
@@ -847,30 +839,32 @@ void usage(void)
N_("Start at line LINE, column COLUMN"));
#ifndef NANO_TINY
print_opt("-A", "--smarthome", N_("Enable smart home key"));
print_opt("-B", "--backup", N_("Save backups of existing files"));
print_opt(_("-C <dir>"), _("--backupdir=<dir>"),
N_("Directory for saving unique backup files"));
if (!ISSET(RESTRICTED)) {
print_opt("-B", "--backup", N_("Save backups of existing files"));
print_opt(_("-C <dir>"), _("--backupdir=<dir>"),
N_("Directory for saving unique backup files"));
}
#endif
print_opt("-D", "--boldtext",
N_("Use bold instead of reverse video text"));
print_opt("-D", "--boldtext", N_("Use bold instead of reverse video text"));
#ifndef NANO_TINY
print_opt("-E", "--tabstospaces",
N_("Convert typed tabs to spaces"));
print_opt("-E", "--tabstospaces", N_("Convert typed tabs to spaces"));
#endif
#ifndef DISABLE_MULTIBUFFER
print_opt("-F", "--multibuffer", N_("Enable multiple file buffers"));
if (!ISSET(RESTRICTED))
print_opt("-F", "--multibuffer",
N_("Read a file into a new buffer by default"));
#endif
#ifndef NANO_TINY
print_opt("-G", "--locking",
N_("Use (vim-style) lock files"));
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"));
if (!ISSET(RESTRICTED))
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"));
if (!ISSET(RESTRICTED))
print_opt("-I", "--ignorercfiles", N_("Don't look at nanorc files"));
#endif
print_opt("-K", "--rebindkeypad",
N_("Fix numeric keypad key confusion problem"));
@@ -882,44 +876,42 @@ void usage(void)
#endif
print_opt("-O", "--morespace", N_("Use one more line for editing"));
#ifndef DISABLE_HISTORIES
print_opt("-P", "--poslog",
N_("Log & read location of cursor position"));
if (!ISSET(RESTRICTED))
print_opt("-P", "--positionlog",
N_("Log & read location of cursor position"));
#endif
#ifndef DISABLE_JUSTIFY
print_opt(_("-Q <str>"), _("--quotestr=<str>"),
N_("Quoting string"));
print_opt(_("-Q <str>"), _("--quotestr=<str>"), N_("Quoting string"));
#endif
print_opt("-R", "--restricted", N_("Restricted mode"));
if (!ISSET(RESTRICTED))
print_opt("-R", "--restricted", N_("Restricted mode"));
#ifndef NANO_TINY
print_opt("-S", "--smooth",
N_("Scroll by line instead of half-screen"));
print_opt("-S", "--smooth", N_("Scroll by line instead of half-screen"));
#endif
print_opt(_("-T <#cols>"), _("--tabsize=<#cols>"),
N_("Set width of a tab to #cols columns"));
#ifndef NANO_TINY
print_opt("-U", "--quickblank", N_("Do quick statusbar blanking"));
#endif
print_opt("-V", "--version",
N_("Print version information and exit"));
print_opt("-V", "--version", N_("Print version information and exit"));
#ifndef NANO_TINY
print_opt("-W", "--wordbounds",
N_("Detect word boundaries more accurately"));
#endif
#ifndef DISABLE_COLOR
print_opt(_("-Y <str>"), _("--syntax=<str>"),
N_("Syntax definition to use for coloring"));
if (!ISSET(RESTRICTED))
print_opt(_("-Y <str>"), _("--syntax=<str>"),
N_("Syntax definition to use for coloring"));
#endif
print_opt("-c", "--const", N_("Constantly show cursor position"));
print_opt("-c", "--constantshow", N_("Constantly show cursor position"));
print_opt("-d", "--rebinddelete",
N_("Fix Backspace/Delete confusion problem"));
print_opt("-h", "--help", N_("Show this help text"));
print_opt("-h", "--help", N_("Show this help text and exit"));
#ifndef NANO_TINY
print_opt("-i", "--autoindent",
N_("Automatically indent new lines"));
print_opt("-i", "--autoindent", N_("Automatically indent new lines"));
print_opt("-k", "--cut", N_("Cut from cursor to end of line"));
#endif
print_opt("-l", "--nofollow",
N_("Don't follow symbolic links, overwrite"));
print_opt("-l", "--nofollow", N_("Don't follow symbolic links, overwrite"));
#ifndef DISABLE_MOUSE
print_opt("-m", "--mouse", N_("Enable the use of the mouse"));
#endif
@@ -928,28 +920,32 @@ void usage(void)
print_opt(_("-o <dir>"), _("--operatingdir=<dir>"),
N_("Set operating directory"));
#endif
print_opt("-p", "--preserve",
N_("Preserve XON (^Q) and XOFF (^S) keys"));
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"));
if (!ISSET(RESTRICTED))
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"));
#endif
#ifndef DISABLE_SPELLER
print_opt(_("-s <prog>"), _("--speller=<prog>"),
N_("Enable alternate speller"));
if (!ISSET(RESTRICTED))
print_opt(_("-s <prog>"), _("--speller=<prog>"),
N_("Enable alternate speller"));
#endif
print_opt("-t", "--tempfile", N_("Auto save on exit, don't prompt"));
#ifndef NANO_TINY
print_opt("-u", "--unix", N_("Save a file by default in Unix format"));
#endif
print_opt("-t", "--tempfile",
N_("Auto save on exit, don't prompt"));
print_opt("-v", "--view", N_("View mode (read-only)"));
#ifndef DISABLE_WRAPPING
print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines"));
#endif
print_opt("-x", "--nohelp", N_("Don't show the two help lines"));
print_opt("-z", "--suspend", N_("Enable suspension"));
if (!ISSET(RESTRICTED))
print_opt("-z", "--suspend", N_("Enable suspension"));
#ifndef NANO_TINY
print_opt("-$", "--softwrap", N_("Enable soft line wrapping"));
#endif
@@ -1090,10 +1086,22 @@ int no_help(void)
return ISSET(NO_HELP) ? 2 : 0;
}
/* Indicate a disabled function on the statusbar. */
void nano_disabled_msg(void)
/* Indicate that the current file has no name, in a way that gets the
* user's attention. This is used when trying to save a file with no
* name with the TEMP_FILE flag set, just before the filename prompt. */
void no_current_file_name_warning(void)
{
statusbar(_("Sorry, support for this function has been disabled"));
curs_set(0);
/* Warn that the current file has no name. */
statusbar(_("No file name"));
beep();
/* Ensure that we see the warning. */
doupdate();
napms(1800);
curs_set(1);
}
/* If the current file buffer has been modified, and the TEMP_FILE flag
@@ -1117,20 +1125,9 @@ void do_exit(void)
/* Otherwise, ask the user whether or not to save. */
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);
}
* have a name, warn the user before prompting for a name. */
if (ISSET(TEMP_FILE))
no_current_file_name_warning();
i = do_yesno_prompt(FALSE,
_("Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "));
@@ -1167,9 +1164,12 @@ void do_cancel(void)
;
}
static struct sigaction pager_oldaction, pager_newaction; /* Original and temporary handlers for SIGINT. */
static bool pager_sig_failed = FALSE; /* Did sigaction() fail without changing the signal handlers? */
static bool pager_input_aborted = FALSE; /* Did someone invoke the pager and abort it via ^C? */
static struct sigaction pager_oldaction, pager_newaction;
/* Original and temporary handlers for SIGINT. */
static bool pager_sig_failed = FALSE;
/* Did sigaction() fail without changing the signal handlers? */
static bool pager_input_aborted = FALSE;
/* Did someone invoke the pager and abort it via ^C? */
/* Things which need to be run regardless of whether
* we finished the stdin pipe correctly or not. */
@@ -1237,8 +1237,7 @@ void stdin_pager(void)
/* Initialize the signal handlers. */
void signal_init(void)
{
/* Trap SIGINT and SIGQUIT because we want them to do useful
* things. */
/* Trap SIGINT and SIGQUIT because we want them to do useful things. */
memset(&act, 0, sizeof(struct sigaction));
act.sa_handler = SIG_IGN;
sigaction(SIGINT, &act, NULL);
@@ -1253,7 +1252,6 @@ void signal_init(void)
/* Trap SIGWINCH because we want to handle window resizes. */
act.sa_handler = handle_sigwinch;
sigaction(SIGWINCH, &act, NULL);
allow_pending_sigwinch(FALSE);
#endif
/* Trap normal suspend (^Z) so we can handle it ourselves. */
@@ -1282,11 +1280,6 @@ RETSIGTYPE handle_hupterm(int signal)
/* Handler for SIGTSTP (suspend). */
RETSIGTYPE do_suspend(int signal)
{
if (ISSET(RESTRICTED)) {
nano_disabled_msg();
return;
}
#ifndef DISABLE_MOUSE
/* Turn mouse support off. */
disable_mouse_support();
@@ -1313,11 +1306,15 @@ RETSIGTYPE do_suspend(int signal)
kill(0, SIGSTOP);
}
/* the subnfunc version */
/* The version of above function that is bound to a key. */
void do_suspend_void(void)
{
if (ISSET(SUSPEND))
do_suspend(0);
else {
statusbar(_("Suspension is not enabled"));
beep();
}
}
/* Handler for SIGCONT (continue after suspend). */
@@ -1351,6 +1348,13 @@ RETSIGTYPE do_continue(int signal)
#ifndef NANO_TINY
/* Handler for SIGWINCH (window size change). */
RETSIGTYPE handle_sigwinch(int signal)
{
/* Let the input routine know that a SIGWINCH has occurred. */
sigwinch_counter++;
}
/* Reinitialize and redraw the screen completely. */
void regenerate_screen(void)
{
const char *tty = ttyname(0);
int fd, result = 0;
@@ -1375,10 +1379,6 @@ RETSIGTYPE handle_sigwinch(int signal)
LINES = win.ws_row;
#endif
/* If we've partitioned the filestruct, unpartition it now. */
if (filepart != NULL)
unpartition_filestruct(&filepart);
#ifdef USE_SLANG
/* Slang curses emulation brain damage, part 1: If we just do what
* curses does here, it'll only work properly if the resize made the
@@ -1405,22 +1405,16 @@ RETSIGTYPE handle_sigwinch(int signal)
window_init();
/* Redraw the contents of the windows that need it. */
blank_statusbar();
wnoutrefresh(bottomwin);
currmenu = MMAIN;
total_refresh();
/* Jump back to either main() or the unjustify routine in
* do_justify(). */
siglongjmp(jump_buf, 1);
}
/* If allow is TRUE, block any SIGWINCH signals that we get, so that we
* can deal with them later. If allow is FALSE, unblock any SIGWINCH
/* If allow is FALSE, block any SIGWINCH signals that we get, so that
* we can deal with them later. If allow is TRUE, unblock any SIGWINCH
* signals that we have, so that we can deal with them now. */
void allow_pending_sigwinch(bool allow)
{
sigset_t winch;
sigemptyset(&winch);
sigaddset(&winch, SIGWINCH);
sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL);
@@ -1432,7 +1426,12 @@ void allow_pending_sigwinch(bool allow)
void do_toggle(int flag)
{
bool enabled;
const char *desc;
if (ISSET(RESTRICTED) && (flag == SUSPEND || flag == MULTIBUFFER ||
flag == BACKUP_FILE || flag == NO_COLOR_SYNTAX)) {
show_restricted_warning();
return;
}
TOGGLE(flag);
@@ -1450,12 +1449,10 @@ void do_toggle(int flag)
case SUSPEND:
signal_init();
break;
#ifndef DISABLE_NANORC
case WHITESPACE_DISPLAY:
titlebar(NULL);
edit_refresh();
break;
#endif
#ifndef DISABLE_COLOR
case NO_COLOR_SYNTAX:
#endif
@@ -1476,8 +1473,7 @@ void do_toggle(int flag)
)
enabled = !enabled;
desc = (char *) _(flagtostr(flag));
statusbar("%s %s", desc, enabled ? _("enabled") : _("disabled"));
statusbar("%s %s", _(flagtostr(flag)), enabled ? _("enabled") : _("disabled"));
}
#endif /* !NANO_TINY */
@@ -1607,6 +1603,11 @@ int do_input(bool allow_funcs)
/* Read in a character. */
input = get_kbinput(edit);
#ifndef NANO_TINY
if (input == KEY_WINCH)
return KEY_WINCH;
#endif
#ifndef DISABLE_MOUSE
if (func_key && input == KEY_MOUSE) {
/* We received a mouse click. */
@@ -1848,8 +1849,14 @@ int do_mouse(void)
#ifndef DISABLE_COLOR
void alloc_multidata_if_needed(filestruct *fileptr)
{
if (!fileptr->multidata)
int i;
if (fileptr->multidata == NULL) {
fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
for (i = 0; i < openfile->syntax->nmultis; i++)
fileptr->multidata[i] = -1;
}
}
/* Precalculate the multi-line start and end regex info so we can
@@ -1908,7 +1915,7 @@ void precalc_multicolorinfo(void)
if (regexec(tmpcolor->end, &fileptr->data[startx], 1, &endmatch,
(startx == 0) ? 0 : REG_NOTBOL) == 0) {
startx += endmatch.rm_eo;
fileptr->multidata[tmpcolor->id] |= CSTARTENDHERE;
fileptr->multidata[tmpcolor->id] = CSTARTENDHERE;
#ifdef DEBUG
fprintf(stderr, "end found on this line\n");
#endif
@@ -1942,7 +1949,7 @@ void precalc_multicolorinfo(void)
#endif
/* We found it, we found it, la la la la la. Mark all
* the lines in between and the end properly. */
fileptr->multidata[tmpcolor->id] |= CENDAFTER;
fileptr->multidata[tmpcolor->id] = CENDAFTER;
#ifdef DEBUG
fprintf(stderr, "marking line %ld as CENDAFTER\n", (long)fileptr->lineno);
#endif
@@ -1954,7 +1961,7 @@ void precalc_multicolorinfo(void)
#endif
}
alloc_multidata_if_needed(endptr);
fileptr->multidata[tmpcolor->id] |= CBEGINBEFORE;
fileptr->multidata[tmpcolor->id] = CBEGINBEFORE;
#ifdef DEBUG
fprintf(stderr, "marking line %ld as CBEGINBEFORE\n", (long)fileptr->lineno);
#endif
@@ -2002,15 +2009,14 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#endif
while (i < output_len) {
/* If allow_cntrls is TRUE, convert nulls and newlines
* properly. */
/* If allow_cntrls is TRUE, convert nulls and newlines properly. */
if (allow_cntrls) {
/* Null to newline, if needed. */
if (output[i] == '\0')
output[i] = '\n';
/* Newline to Enter, if needed. */
else if (output[i] == '\n') {
do_enter(FALSE);
do_enter();
i++;
continue;
}
@@ -2021,28 +2027,24 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
i += char_buf_len;
/* If allow_cntrls is FALSE, filter out an ASCII control
* character. */
if (!allow_cntrls && is_ascii_cntrl_char(*(output + i -
char_buf_len)))
/* If allow_cntrls is FALSE, filter out an ASCII control character. */
if (!allow_cntrls && is_ascii_cntrl_char(*(output + i - char_buf_len)))
continue;
/* If the NO_NEWLINES flag isn't set, when a character is
* added to the magicline, it means we need a new magicline. */
if (!ISSET(NO_NEWLINES) && openfile->filebot ==
openfile->current)
if (!ISSET(NO_NEWLINES) && openfile->filebot == openfile->current)
new_magicline();
/* More dangerousness fun =) */
openfile->current->data = charealloc(openfile->current->data,
current_len + (char_buf_len * 2));
current_len + (char_buf_len * 2));
assert(openfile->current_x <= current_len);
charmove(openfile->current->data + openfile->current_x +
char_buf_len, openfile->current->data +
openfile->current_x, current_len - openfile->current_x +
char_buf_len);
charmove(openfile->current->data + openfile->current_x + char_buf_len,
openfile->current->data + openfile->current_x,
current_len - openfile->current_x + char_buf_len);
strncpy(openfile->current->data + openfile->current_x, char_buf,
char_buf_len);
current_len += char_buf_len;
@@ -2053,9 +2055,8 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
add_undo(ADD);
/* Note that current_x has not yet been incremented. */
if (openfile->mark_set && openfile->current ==
openfile->mark_begin && openfile->current_x <
openfile->mark_begin_x)
if (openfile->mark_set && openfile->current == openfile->mark_begin &&
openfile->current_x < openfile->mark_begin_x)
openfile->mark_begin_x += char_buf_len;
#endif
@@ -2071,14 +2072,15 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
if (do_wrap(openfile->current))
edit_refresh_needed = TRUE;
#endif
}
#ifndef DISABLE_COLOR
/* If color syntaxes are available and turned on, we need to
* call edit_refresh(). */
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX))
edit_refresh_needed = TRUE;
/* If syntax highlighting is turned on and there are multiline regexes,
* the edit window will need to be refreshed. */
if (!ISSET(NO_COLOR_SYNTAX) && openfile->syntax &&
openfile->syntax->nmultis > 0)
edit_refresh_needed = TRUE;
#endif
}
#ifndef NANO_TINY
/* Well, we might also need a full refresh if we've changed the
@@ -2109,7 +2111,9 @@ int main(int argc, char **argv)
/* Target line and column when specified on the command line. */
#ifndef DISABLE_WRAPJUSTIFY
bool fill_used = FALSE;
/* Was the fill option used? */
/* Was the fill option used on the command line? */
bool forced_wrapping = FALSE;
/* Should long lines be automatically hard wrapped? */
#endif
#ifndef DISABLE_MULTIBUFFER
bool old_multibuffer;
@@ -2118,7 +2122,6 @@ int main(int argc, char **argv)
#endif
#ifdef HAVE_GETOPT_LONG
const struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"boldtext", 0, NULL, 'D'},
#ifndef DISABLE_MULTIBUFFER
{"multibuffer", 0, NULL, 'F'},
@@ -2138,8 +2141,9 @@ int main(int argc, char **argv)
#ifndef DISABLE_COLOR
{"syntax", 1, NULL, 'Y'},
#endif
{"const", 0, NULL, 'c'},
{"constantshow", 0, NULL, 'c'},
{"rebinddelete", 0, NULL, 'd'},
{"help", 0, NULL, 'h'},
{"nofollow", 0, NULL, 'l'},
#ifndef DISABLE_MOUSE
{"mouse", 0, NULL, 'm'},
@@ -2171,13 +2175,14 @@ int main(int argc, char **argv)
{"locking", 0, NULL, 'G'},
{"historylog", 0, NULL, 'H'},
{"noconvert", 0, NULL, 'N'},
{"poslog", 0, NULL, 'P'},
{"poslog", 0, NULL, 'P'}, /* deprecated form, remove in 2018 */
{"positionlog", 0, NULL, 'P'},
{"smooth", 0, NULL, 'S'},
{"quickblank", 0, NULL, 'U'},
{"undo", 0, NULL, 'u'},
{"wordbounds", 0, NULL, 'W'},
{"autoindent", 0, NULL, 'i'},
{"cut", 0, NULL, 'k'},
{"unix", 0, NULL, 'u'},
{"softwrap", 0, NULL, '$'},
#endif
{NULL, 0, NULL, 0}
@@ -2217,11 +2222,11 @@ int main(int argc, char **argv)
while ((optchr =
#ifdef HAVE_GETOPT_LONG
getopt_long(argc, argv,
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tvwxz$",
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tuvwxz$",
long_options, NULL)
#else
getopt(argc, argv,
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tvwxz$")
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tuvwxz$")
#endif
) != -1) {
switch (optchr) {
@@ -2375,6 +2380,7 @@ int main(int argc, char **argv)
exit(1);
}
fill_used = TRUE;
forced_wrapping = TRUE;
break;
#endif
#ifndef DISABLE_SPELLER
@@ -2385,6 +2391,11 @@ int main(int argc, char **argv)
case 't':
SET(TEMP_FILE);
break;
#ifndef NANO_TINY
case 'u':
SET(MAKE_IT_UNIX);
break;
#endif
case 'v':
SET(VIEW_MODE);
break;
@@ -2393,7 +2404,7 @@ int main(int argc, char **argv)
SET(NO_WRAP);
/* If both --fill and --nowrap are given on the
* command line, the last given option wins. */
fill_used = FALSE;
forced_wrapping = FALSE;
break;
#endif
case 'x':
@@ -2527,9 +2538,9 @@ int main(int argc, char **argv)
#endif /* !DISABLE_NANORC */
#ifndef DISABLE_WRAPPING
/* Overwrite an rcfile "set nowrap" or --disable-wrapping-as-root
* if a --fill option was given on the command line. */
if (fill_used)
/* Override a "set nowrap" in an rcfile (or a --disable-wrapping-as-root)
* if --fill was given on the command line and not undone by --nowrap. */
if (forced_wrapping)
UNSET(NO_WRAP);
#endif
@@ -2625,7 +2636,6 @@ int main(int argc, char **argv)
if (matchbrackets == NULL)
matchbrackets = mallocstrcpy(NULL, "(<[{)>]}");
#ifndef DISABLE_NANORC
/* If whitespace wasn't specified, set its default value. If we're
* using UTF-8, it's Unicode 00BB (Right-Pointing Double Angle
* Quotation Mark) and Unicode 00B7 (Middle Dot). Otherwise, it's
@@ -2644,9 +2654,12 @@ int main(int argc, char **argv)
whitespace_len[1] = 1;
}
}
#endif /* !DISABLE_NANORC */
#endif /* !NANO_TINY */
/* Initialize the search and replace strings. */
last_search = mallocstrcpy(NULL, "");
last_replace = mallocstrcpy(NULL, "");
/* If tabsize wasn't specified, set its default value. */
if (tabsize == -1)
tabsize = WIDTH_OF_TAB;
@@ -2693,6 +2706,14 @@ int main(int argc, char **argv)
interface_color_pair[FUNCTION_TAG].bright = FALSE;
#endif
#if !defined(NANO_TINY) && defined(HAVE_KEY_DEFINED)
/* Ask ncurses for the key codes for Control+Left and Control+Right. */
if ((int)tigetstr("kLFT5") > 0)
controlleft = key_defined(tigetstr("kLFT5"));
if ((int)tigetstr("kRIT5") > 0)
controlright = key_defined(tigetstr("kRIT5"));
#endif
#ifdef DEBUG
fprintf(stderr, "Main: open file\n");
#endif
@@ -2722,28 +2743,26 @@ int main(int argc, char **argv)
ssize_t iline = 0, icol = 0;
for (; i < argc; i++) {
/* If there's a +LINE or +LINE,COLUMN flag here, it is
* followed by at least one other argument, the filename it
* applies to. */
if (i < argc - 1 && argv[i][0] == '+' && iline == 1 &&
icol == 1)
/* If there's a +LINE or +LINE,COLUMN flag here, it is followed
* by at least one other argument: the filename it applies to. */
if (i < argc - 1 && argv[i][0] == '+')
parse_line_column(&argv[i][1], &iline, &icol);
else {
open_buffer(argv[i], FALSE);
/* If a position was given on the command line, go there. */
if (iline > 0 || icol > 0) {
do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE,
FALSE);
iline = 1;
icol = 1;
do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE, FALSE);
iline = 0;
icol = 0;
}
#ifndef DISABLE_HISTORIES
else {
/* See if we have a POS history to use if we haven't overridden it. */
ssize_t savedposline, savedposcol;
/* If edited before, restore the last cursor position. */
if (check_poshistory(argv[i], &savedposline, &savedposcol))
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE, FALSE,
FALSE);
do_gotolinecolumn(savedposline, savedposcol, FALSE,
FALSE, FALSE, FALSE);
}
#endif
}
@@ -2751,16 +2770,13 @@ int main(int argc, char **argv)
}
#endif /* !DISABLE_MULTIBUFFER */
/* Read the first file on the command line into either the current
* buffer or a new buffer, depending on whether multibuffer mode is
* enabled. */
/* Now read the first file on the command line into a new buffer. */
if (optind < argc)
open_buffer(argv[optind], FALSE);
/* We didn't open any files if all the command line arguments were
* invalid files like directories or if there were no command line
* arguments given. In this case, we have to load a blank buffer.
* Also, we unset view mode to allow editing. */
/* If all the command-line arguments were invalid files like directories,
* or if there were no filenames given, we didn't open any file. In this
* case, load a blank buffer. Also, unset view mode to allow editing. */
if (openfile == NULL) {
open_buffer("", FALSE);
UNSET(VIEW_MODE);
@@ -2781,13 +2797,13 @@ int main(int argc, char **argv)
precalc_multicolorinfo();
#endif
/* If a starting position was given on the command line, go there. */
if (startline > 0 || startcol > 0)
do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE,
FALSE);
do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE, FALSE);
#ifndef DISABLE_HISTORIES
else {
/* See if we have a POS history to use if we haven't overridden it. */
ssize_t savedposline, savedposcol;
/* If the file was edited before, restore the last cursor position. */
if (check_poshistory(argv[optind], &savedposline, &savedposcol))
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE, FALSE, FALSE);
}
@@ -2802,17 +2818,6 @@ int main(int argc, char **argv)
reset_cursor();
wnoutrefresh(edit);
#ifndef NANO_TINY
if (!jump_buf_main) {
/* If we haven't already, we're going to set jump_buf so
* that we return here after a SIGWINCH. Indicate this. */
jump_buf_main = TRUE;
/* Return here after a SIGWINCH. */
sigsetjmp(jump_buf, 1);
}
#endif
/* Just in case we were at the statusbar prompt, make sure the
* statusbar cursor position is reset. */
do_prompt_abort();

View File

@@ -116,9 +116,7 @@
#ifdef HAVE_REGEX_H
#include <regex.h>
#endif
#ifndef NANO_TINY
#include <setjmp.h>
#endif
#include <signal.h>
#include <assert.h>
/* If no vsnprintf(), use the version from glib 2.x. */
@@ -194,6 +192,7 @@ typedef enum {
JOIN, PASTE, INSERT, ENTER, OTHER
} undo_type;
/* Structure types. */
typedef struct color_pair {
int pairnum;
/* The color pair number used for this foreground color and
@@ -274,7 +273,7 @@ typedef struct lintstruct {
/* Previous error. */
} lintstruct;
/* Flags that indicate how a multiline regex applies to a line. */
#define CNONE (1<<1)
/* Yay, regex doesn't apply to this line at all! */
#define CBEGINBEFORE (1<<2)
@@ -285,13 +284,9 @@ typedef struct lintstruct {
/* Whole line engulfed by the regex, start < me, end > me. */
#define CSTARTENDHERE (1<<5)
/* Regex starts and ends within this line. */
#define CWTF (1<<6)
/* Something else. */
#endif /* !DISABLE_COLOR */
/* Structure types. */
/* More structure types. */
typedef struct filestruct {
char *data;
/* The text of this line. */
@@ -334,6 +329,10 @@ typedef struct undo {
/* Where did this action begin or end. */
char *strdata;
/* String type data we will use for copying the affected line back. */
size_t wassize;
/* The file size before the action. */
size_t newsize;
/* The file size after the action. */
int xflags;
/* Some flag data we need. */
@@ -366,75 +365,57 @@ typedef struct poshiststruct {
typedef struct openfilestruct {
char *filename;
/* The current file's name. */
/* The file's name. */
filestruct *fileage;
/* The current file's first line. */
/* The file's first line. */
filestruct *filebot;
/* The current file's last line. */
/* The file's last line. */
filestruct *edittop;
/* The current top of the edit window. */
/* The current top of the edit window for this file. */
filestruct *current;
/* The current file's current line. */
/* The current line for this file. */
size_t totsize;
/* The current file's total number of characters. */
/* The file's total number of characters. */
size_t current_x;
/* The current file's x-coordinate position. */
/* The file's x-coordinate position. */
size_t placewewant;
/* The current file's x position we would like. */
/* The file's x position we would like. */
ssize_t current_y;
/* The current file's y-coordinate position. */
/* The file's y-coordinate position. */
bool modified;
/* Whether the current file has been modified. */
/* Whether the file has been modified. */
#ifndef NANO_TINY
bool mark_set;
/* Whether the mark is on in the current file. */
/* Whether the mark is on in this file. */
filestruct *mark_begin;
/* The current file's beginning marked line, if any. */
/* The file's line where the mark is, if any. */
size_t mark_begin_x;
/* The current file's beginning marked line's x-coordinate
* position, if any. */
/* The file's mark's x-coordinate position, if any. */
file_format fmt;
/* The current file's format. */
/* The file's format. */
struct stat *current_stat;
/* The current file's stat. */
/* The file's current stat information. */
undo *undotop;
/* Top of the undo list. */
/* The top of the undo list. */
undo *current_undo;
/* The current (i.e. next) level of undo. */
undo_type last_action;
const char *lock_filename;
/* The type of the last action the user performed. */
char *lock_filename;
/* The path of the lockfile, if we created one. */
#endif
#ifndef DISABLE_COLOR
syntaxtype *syntax;
/* The syntax struct for this file, if any. */
colortype *colorstrings;
/* The current file's associated colors. */
/* The file's associated colors. */
#endif
struct openfilestruct *next;
/* Next node. */
/* The next open file, if any. */
struct openfilestruct *prev;
/* Previous node. */
/* The preceding open file, if any. */
} openfilestruct;
typedef struct shortcut {
const char *desc;
/* The function's description, e.g. "Page Up". */
#ifndef DISABLE_HELP
const char *help;
/* The help file entry text for this function. */
bool blank_after;
/* Whether there should be a blank line after the help entry
* text for this function. */
#endif
bool viewok;
/* Is this function allowed when in view mode? */
void (*func)(void);
/* The function to call when we get this key. */
struct shortcut *next;
/* Next shortcut. */
} shortcut;
#ifndef DISABLE_NANORC
typedef struct rcoption {
const char *name;
@@ -450,38 +431,38 @@ typedef struct sc {
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;
/* What list this applies to. */
/* The actual sequence to check once the type is determined. */
int menus;
/* Which menus this applies to. */
void (*scfunc)(void);
/* The function we're going to run. */
int toggle;
/* If a toggle, what we're toggling. */
bool execute;
/* Whether to execute the function in question or just return
* so the sequence can be caught by the calling code. */
int ordinal;
/* The how-manieth toggle this is, in order to be able to
* keep them in sequence. */
struct sc *next;
/* Next in the list. */
} sc;
typedef struct subnfunc {
void (*scfunc)(void);
/* What function this is. */
/* The actual function to call. */
int menus;
/* In what menus this function applies. */
const char *desc;
/* The function's description, e.g. "Page Up". */
/* The function's short description, for example "Where Is". */
#ifndef DISABLE_HELP
const char *help;
/* The help file entry text for this function. */
/* The help-screen text for this function. */
bool blank_after;
/* Whether there should be a blank line after the help entry
* text for this function. */
/* Whether there should be a blank line after the help text
* for this function. */
#endif
bool viewok;
/* Is this function allowed when in view mode? */
long toggle;
/* If this is a toggle, if nonzero what toggle to set. */
/* If this is a toggle, which toggle to affect. */
struct subnfunc *next;
/* Next item in the list. */
} subnfunc;
@@ -536,7 +517,8 @@ enum
SOFTWRAP,
POS_HISTORY,
LOCKING,
NOREAD_MODE
NOREAD_MODE,
MAKE_IT_UNIX
};
/* Flags for the menus in which a given function should be present. */
@@ -556,7 +538,8 @@ enum
#define MYESNO (1<<13)
#define MLINTER (1<<14)
/* This is an abbreviation for all menus except Help and YesNo. */
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MSPELL|MLINTER)
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MSPELL|MLINTER)
/* Control key sequences. Changing these would be very, very bad. */
#define NANO_CONTROL_SPACE 0
@@ -565,17 +548,18 @@ 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
/* Codes for "modified" Arrow keys, beyond KEY_MAX of ncurses. */
#define CONTROL_LEFT 0x401
#define CONTROL_RIGHT 0x402
#ifndef NANO_TINY
/* Extra bits for the undo function. */
#define UNdel_del (1<<0)
#define UNdel_backspace (1<<1)
#define UNcut_marked_forward (1<<2)
#define UNcut_cutline (1<<3)
/* An imaginary key for when we get a SIGWINCH (window resize). */
#define KEY_WINCH -2
/* Some extra flags for the undo function. */
#define WAS_FINAL_BACKSPACE (1<<1)
#define WAS_MARKED_FORWARD (1<<2)
#define WAS_WHOLE_LINE (1<<3)
#endif /* !NANO_TINY */
/* The maximum number of entries displayed in the main shortcut list. */

View File

@@ -66,6 +66,11 @@ int do_statusbar_input(bool *ran_func, bool *finished,
/* Read in a character. */
input = get_kbinput(bottomwin);
#ifndef NANO_TINY
if (input == KEY_WINCH)
return KEY_WINCH;
#endif
#ifndef DISABLE_MOUSE
/* If we got a mouse click and it was on a shortcut, read in the
* shortcut character. */
@@ -140,7 +145,7 @@ int do_statusbar_input(bool *ran_func, bool *finished,
}
if (have_shortcut) {
if (s->scfunc == do_tab || s->scfunc == do_enter_void)
if (s->scfunc == do_tab || s->scfunc == do_enter)
;
else if (s->scfunc == total_refresh)
total_statusbar_refresh(refresh_func);
@@ -181,7 +186,7 @@ int do_statusbar_input(bool *ran_func, bool *finished,
* 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);
input = sc_seq_or(do_enter, 0);
*finished = TRUE;
}
}
@@ -245,7 +250,7 @@ int do_statusbar_mouse(void)
statusbar_xplustabs()) + mouse_x - start_col);
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_horizontal_update(pww_save))
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
}
}
@@ -347,7 +352,7 @@ void do_statusbar_home(void)
statusbar_pww = statusbar_xplustabs();
}
if (need_statusbar_horizontal_update(pww_save))
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
}
@@ -359,7 +364,7 @@ void do_statusbar_end(void)
statusbar_x = strlen(answer);
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_horizontal_update(pww_save))
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
}
@@ -372,7 +377,7 @@ void do_statusbar_left(void)
statusbar_x = move_mbleft(answer, statusbar_x);
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_horizontal_update(pww_save))
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
}
}
@@ -386,7 +391,7 @@ void do_statusbar_right(void)
statusbar_x = move_mbright(answer, statusbar_x);
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_horizontal_update(pww_save))
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
}
}
@@ -500,7 +505,7 @@ bool do_statusbar_next_word(bool allow_punct)
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_horizontal_update(pww_save))
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
/* Return whether we started on a word. */
@@ -595,7 +600,7 @@ bool do_statusbar_prev_word(bool allow_punct)
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_horizontal_update(pww_save))
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
/* Return whether we started on a word. */
@@ -645,7 +650,7 @@ size_t statusbar_xplustabs(void)
* get_statusbar_page_start(column) < COLS). */
size_t get_statusbar_page_start(size_t start_col, size_t column)
{
if (column == start_col || column < COLS - 1)
if (column == start_col || column < COLS - 1 || COLS == start_col + 1)
return 0;
else
return column - start_col - (column - start_col) % (COLS -
@@ -698,10 +703,10 @@ void update_statusbar_line(const char *curranswer, size_t index)
wnoutrefresh(bottomwin);
}
/* Return TRUE if we need an update after moving horizontally, and FALSE
* otherwise. We need one if pww_save and statusbar_pww are on
/* Return TRUE if we need an update after moving the cursor, and FALSE
* otherwise. We need an update if pww_save and statusbar_pww are on
* different pages. */
bool need_statusbar_horizontal_update(size_t pww_save)
bool need_statusbar_update(size_t pww_save)
{
size_t start_col = strlenpt(prompt) + 2;
@@ -794,9 +799,17 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
kbinput = do_statusbar_input(&ran_func, &finished, refresh_func);
assert(statusbar_x <= strlen(answer));
#ifndef NANO_TINY
if (kbinput == KEY_WINCH) {
refresh_func();
update_statusbar_line(answer, statusbar_x);
continue;
}
#endif
func = func_from_key(&kbinput);
if (func == do_cancel || func == do_enter_void)
if (func == do_cancel || func == do_enter)
break;
#ifndef DISABLE_TABCOMP
@@ -905,8 +918,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
if (history_list != NULL) {
history_reset(*history_list);
if (magichistory != NULL)
free(magichistory);
free(magichistory);
}
#endif
@@ -915,7 +927,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
* we've finished putting in an answer, reset the statusbar cursor
* position too. */
if (func) {
if (func == do_cancel || func == do_enter_void || ran_func) {
if (func == do_cancel || func == do_enter || ran_func) {
statusbar_x = old_statusbar_x;
statusbar_pww = old_pww;
@@ -964,8 +976,7 @@ int do_prompt(bool allow_tabs,
/* prompt has been freed and set to NULL unless the user resized
* while at the statusbar prompt. */
if (prompt != NULL)
free(prompt);
free(prompt);
prompt = charalloc(((COLS - 4) * mb_cur_max()) + 1);
@@ -999,7 +1010,7 @@ int do_prompt(bool allow_tabs,
* properly. */
if (func == do_cancel)
retval = -1;
else if (func == do_enter_void)
else if (func == do_enter)
retval = (*answer == '\0') ? -2 : 0;
blank_statusbar();
@@ -1055,49 +1066,6 @@ int do_yesno_prompt(bool all, const char *msg)
nostr = _("Nn");
allstr = _("Aa");
if (!ISSET(NO_HELP)) {
char shortstr[3];
/* Temp string for Yes, No, All. */
if (COLS < 32)
width = COLS / 2;
/* Clear the shortcut list from the bottom of the screen. */
blank_bottombars();
sprintf(shortstr, " %c", yesstr[0]);
wmove(bottomwin, 1, 0);
onekey(shortstr, _("Yes"), width);
if (all) {
wmove(bottomwin, 1, width);
shortstr[1] = allstr[0];
onekey(shortstr, _("All"), width);
}
wmove(bottomwin, 2, 0);
shortstr[1] = nostr[0];
onekey(shortstr, _("No"), width);
wmove(bottomwin, 2, 16);
onekey("^C", _("Cancel"), width);
}
if (interface_color_pair[TITLE_BAR].bright)
wattron(bottomwin, A_BOLD);
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
blank_statusbar();
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
wattroff(bottomwin, A_BOLD);
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
/* Refresh the edit window and the statusbar before getting
* input. */
wnoutrefresh(edit);
wnoutrefresh(bottomwin);
do {
int kbinput;
functionptrtype func;
@@ -1105,8 +1073,57 @@ int do_yesno_prompt(bool all, const char *msg)
int mouse_x, mouse_y;
#endif
if (!ISSET(NO_HELP)) {
char shortstr[3];
/* Temporary string for (translated) " Y", " N" and " A". */
if (COLS < 32)
width = COLS / 2;
/* Clear the shortcut list from the bottom of the screen. */
blank_bottombars();
/* Now show the ones for "Yes", "No", "Cancel" and maybe "All". */
sprintf(shortstr, " %c", yesstr[0]);
wmove(bottomwin, 1, 0);
onekey(shortstr, _("Yes"), width);
if (all) {
shortstr[1] = allstr[0];
wmove(bottomwin, 1, width);
onekey(shortstr, _("All"), width);
}
shortstr[1] = nostr[0];
wmove(bottomwin, 2, 0);
onekey(shortstr, _("No"), width);
wmove(bottomwin, 2, width);
onekey("^C", _("Cancel"), width);
}
if (interface_color_pair[TITLE_BAR].bright)
wattron(bottomwin, A_BOLD);
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
blank_statusbar();
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
wattroff(bottomwin, A_BOLD);
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
/* Refresh edit window and statusbar before getting input. */
wnoutrefresh(edit);
wnoutrefresh(bottomwin);
currmenu = MYESNO;
kbinput = get_kbinput(bottomwin);
#ifndef NANO_TINY
if (kbinput == KEY_WINCH)
continue;
#endif
func = func_from_key(&kbinput);
if (func == do_cancel)

View File

@@ -28,14 +28,18 @@
/* All external variables. See global.c for their descriptions. */
#ifndef NANO_TINY
extern sigjmp_buf jump_buf;
extern bool jump_buf_main;
extern volatile sig_atomic_t sigwinch_counter;
#endif
extern bool meta_key;
extern bool func_key;
extern bool focusing;
#ifndef NANO_TINY
extern int controlleft;
extern int controlright;
#endif
#ifndef DISABLE_WRAPJUSTIFY
extern ssize_t fill;
extern ssize_t wrap_at;
@@ -63,7 +67,7 @@ extern openfilestruct *openfile;
extern char *matchbrackets;
#endif
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
#ifndef NANO_TINY
extern char *whitespace;
extern int whitespace_len[2];
#endif
@@ -261,7 +265,7 @@ void cut_to_eof(void);
#endif
void do_cut_text(
#ifndef NANO_TINY
bool copy_text, bool cut_till_eof, bool undoing
bool copy_text, bool cut_till_eof
#else
void
#endif
@@ -275,7 +279,6 @@ void do_uncut_text(void);
/* All functions in files.c. */
void make_new_buffer(void);
void initialize_buffer(void);
void initialize_buffer_text(void);
void open_buffer(const char *filename, bool undoable);
#ifndef DISABLE_SPELLER
@@ -322,6 +325,9 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
#endif
bool do_writeout(bool exiting);
void do_writeout_void(void);
#ifndef NANO_TINY
void do_savefile(void);
#endif
char *real_dir_from_tilde(const char *buf);
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
int diralphasort(const void *va, const void *vb);
@@ -372,7 +378,7 @@ void thanks_for_all_the_fish(void);
/* All functions in help.c. */
#ifndef DISABLE_HELP
void do_help(void (*refresh_func)(void));
void do_help(void);
void help_init(void);
functionptrtype parse_help_input(int *kbinput);
size_t help_line_len(const char *ptr);
@@ -393,7 +399,7 @@ void do_para_end_void(void);
#ifndef NANO_TINY
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
bool do_prev_word(bool allow_punct, bool allow_update);
void do_prev_word(bool allow_punct, bool allow_update);
void do_prev_word_void(void);
#endif
void do_home(void);
@@ -426,9 +432,8 @@ void do_right(void);
/* All functions in nano.c. */
filestruct *make_new_node(filestruct *prevnode);
filestruct *copy_node(const filestruct *src);
void splice_node(filestruct *begin, filestruct *newnode, filestruct
*end);
void unlink_node(const filestruct *fileptr);
void splice_node(filestruct *afterthis, filestruct *newnode);
void unlink_node(filestruct *fileptr);
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
void free_filestruct(filestruct *src);
@@ -448,6 +453,10 @@ void delete_opennode(openfilestruct *fileptr);
void free_openfilestruct(openfilestruct *src);
#endif
void print_view_warning(void);
void show_restricted_warning(void);
#ifdef DISABLE_HELP
void say_there_is_no_help(void);
#endif
void finish(void);
void die(const char *msg, ...);
void die_save_file(const char *die_filename
@@ -470,7 +479,7 @@ void usage(void);
void version(void);
int more_space(void);
int no_help(void);
void nano_disabled_msg(void);
void no_current_file_name_warning(void);
void do_exit(void);
void signal_init(void);
RETSIGTYPE handle_hupterm(int signal);
@@ -478,6 +487,7 @@ RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_continue(int signal);
#ifndef NANO_TINY
RETSIGTYPE handle_sigwinch(int signal);
void regenerate_screen(void);
void allow_pending_sigwinch(bool allow);
void do_toggle(int flag);
#endif
@@ -522,7 +532,7 @@ 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);
bool need_statusbar_update(size_t pww_save);
void total_statusbar_refresh(void (*refresh_func)(void));
functionptrtype get_prompt_string(int *value, bool allow_tabs,
#ifndef DISABLE_TABCOMP
@@ -579,16 +589,19 @@ void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
void search_replace_abort(void);
void search_init_globals(void);
int search_init(bool replacing, bool use_answer);
bool findnextstr(
#ifndef DISABLE_SPELLER
bool whole_word,
bool whole_word_only,
#endif
bool no_sameline, const filestruct *begin, size_t begin_x, const
char *needle, size_t *needle_len);
const filestruct *begin, size_t begin_x,
const char *needle, size_t *needle_len);
void findnextstr_wrap_reset(void);
void do_search(void);
#ifndef NANO_TINY
void do_findprevious(void);
void do_findnext(void);
#endif
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
void do_research(void);
#endif
@@ -598,7 +611,7 @@ int replace_regexp(char *string, bool create);
char *replace_line(const char *needle);
ssize_t do_replace_loop(
#ifndef DISABLE_SPELLER
bool whole_word,
bool whole_word_only,
#endif
bool *canceled, const filestruct *real_current, size_t
*real_current_x, const char *needle);
@@ -637,6 +650,10 @@ void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
#ifndef NANO_TINY
void do_cut_prev_word(void);
void do_cut_next_word(void);
#endif
void do_tab(void);
#ifndef NANO_TINY
void do_indent(ssize_t cols);
@@ -645,8 +662,7 @@ void do_unindent(void);
void do_undo(void);
void do_redo(void);
#endif
void do_enter(bool undoing);
void do_enter_void(void);
void do_enter(void);
#ifndef NANO_TINY
RETSIGTYPE cancel_command(int signal);
bool execute_command(const char *command);
@@ -696,7 +712,6 @@ void do_wordlinechar_count(void);
void do_verbatim_input(void);
/* All functions in utils.c. */
int digits(size_t n);
void get_homedir(void);
bool parse_num(const char *str, ssize_t *val);
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
@@ -713,7 +728,6 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
#endif
#endif
#ifdef HAVE_REGEX_H
bool regexp_bol_or_eol(const regex_t *preg, const char *string);
const char *fixbounds(const char *r);
#endif
#ifndef DISABLE_SPELLER
@@ -737,7 +751,8 @@ void new_magicline(void);
void remove_magicline(void);
void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x, bool *right_side_up);
void add_undo(undo_type current_action);
void discard_until(undo *thisone);
void add_undo(undo_type action);
void update_undo(undo_type action);
#endif
size_t get_totsize(const filestruct *begin, const filestruct *end);
@@ -789,8 +804,7 @@ void reset_cursor(void);
void edit_draw(filestruct *fileptr, const char *converted, int
line, size_t start);
int update_line(filestruct *fileptr, size_t index);
bool need_horizontal_update(size_t pww_save);
bool need_vertical_update(size_t pww_save);
bool need_screen_update(size_t pww_save);
void edit_scroll(scroll_dir direction, ssize_t nlines);
void edit_redraw(filestruct *old_current, size_t pww_save);
void edit_refresh(void);

View File

@@ -38,20 +38,21 @@ static const rcoption rcopts[] = {
#ifndef DISABLE_JUSTIFY
{"brackets", 0},
#endif
{"const", CONST_UPDATE},
{"const", CONST_UPDATE}, /* deprecated form, remove in 2018 */
{"constantshow", CONST_UPDATE},
#ifndef DISABLE_WRAPJUSTIFY
{"fill", 0},
#endif
#ifndef NANO_TINY
{"locking", LOCKING},
#ifndef DISABLE_HISTORIES
{"historylog", HISTORYLOG},
#endif
{"morespace", MORE_SPACE},
#ifndef DISABLE_MOUSE
{"mouse", USE_MOUSE},
#endif
#ifndef DISABLE_MULTIBUFFER
{"multibuffer", MULTIBUFFER},
#endif
{"morespace", MORE_SPACE},
{"nofollow", NOFOLLOW_SYMLINKS},
{"nohelp", NO_HELP},
{"nonewlines", NO_NEWLINES},
@@ -60,6 +61,10 @@ static const rcoption rcopts[] = {
#endif
#ifndef DISABLE_OPERATINGDIR
{"operatingdir", 0},
#endif
#ifndef DISABLE_HISTORIES
{"poslog", POS_HISTORY}, /* deprecated form, remove in 2018 */
{"positionlog", POS_HISTORY},
#endif
{"preserve", PRESERVE},
#ifndef DISABLE_JUSTIFY
@@ -79,25 +84,25 @@ static const rcoption rcopts[] = {
{"tempfile", TEMP_FILE},
{"view", VIEW_MODE},
#ifndef NANO_TINY
{"allow_insecure_backup", INSECURE_BACKUP},
{"autoindent", AUTOINDENT},
{"backup", BACKUP_FILE},
{"allow_insecure_backup", INSECURE_BACKUP},
{"backupdir", 0},
{"backwards", BACKWARDS_SEARCH},
{"casesensitive", CASE_SENSITIVE},
{"cut", CUT_TO_END},
{"historylog", HISTORYLOG},
{"locking", LOCKING},
{"matchbrackets", 0},
{"noconvert", NO_CONVERT},
{"poslog", POS_HISTORY},
{"quiet", QUIET},
{"quickblank", QUICK_BLANK},
{"quiet", QUIET},
{"smarthome", SMART_HOME},
{"smooth", SMOOTH_SCROLL},
{"softwrap", SOFTWRAP},
{"tabstospaces", TABS_TO_SPACES},
{"unix", MAKE_IT_UNIX},
{"whitespace", 0},
{"wordbounds", WORD_BOUNDS},
{"softwrap", SOFTWRAP},
#endif
#ifndef DISABLE_COLOR
{"titlecolor", 0},
@@ -440,7 +445,7 @@ void parse_binding(char *ptr, bool dobind)
if (strlen(keycopy) < 2) {
rcfile_error(N_("Key name is too short"));
return;
goto free_copy;
}
/* Uppercase only the first two or three characters of the key name. */
@@ -451,7 +456,7 @@ void parse_binding(char *ptr, bool dobind)
keycopy[2] = toupper(keycopy[2]);
else {
rcfile_error(N_("Key name is too short"));
return;
goto free_copy;
}
}
@@ -461,7 +466,7 @@ void parse_binding(char *ptr, bool dobind)
keycopy[1] = tolower(keycopy[1]);
else if (keycopy[0] != '^' && keycopy[0] != 'M' && keycopy[0] != 'F') {
rcfile_error(N_("Key name must begin with \"^\", \"M\", or \"F\""));
return;
goto free_copy;
}
if (dobind) {
@@ -470,7 +475,7 @@ void parse_binding(char *ptr, bool dobind)
if (funcptr[0] == '\0') {
rcfile_error(N_("Must specify a function to bind the key to"));
return;
goto free_copy;
}
}
@@ -480,21 +485,21 @@ void parse_binding(char *ptr, bool dobind)
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;
goto free_copy;
}
if (dobind) {
newsc = strtosc(funcptr);
if (newsc == NULL) {
rcfile_error(N_("Cannot map name \"%s\" to a function"), funcptr);
return;
goto free_copy;
}
}
menu = strtomenu(menuptr);
if (menu < 1) {
rcfile_error(N_("Cannot map name \"%s\" to a menu"), menuptr);
return;
goto free_copy;
}
#ifdef DEBUG
@@ -527,11 +532,11 @@ void parse_binding(char *ptr, bool dobind)
if (!menu) {
rcfile_error(N_("Function '%s' does not exist in menu '%s'"), funcptr, menuptr);
free(newsc);
return;
goto free_copy;
}
newsc->keystr = keycopy;
newsc->menu = menu;
newsc->menus = menu;
newsc->type = strtokeytype(newsc->keystr);
assign_keyinfo(newsc);
#ifdef DEBUG
@@ -542,25 +547,36 @@ void parse_binding(char *ptr, bool dobind)
if (check_bad_binding(newsc)) {
rcfile_error(N_("Sorry, keystroke \"%s\" may not be rebound"), newsc->keystr);
free(newsc);
return;
goto free_copy;
}
}
/* Now find and delete any existing same shortcut in the menu(s). */
for (s = sclist; s != NULL; s = s->next) {
if (((s->menu & menu)) && !strcmp(s->keystr, keycopy)) {
if ((s->menus & menu) && !strcmp(s->keystr, keycopy)) {
#ifdef DEBUG
fprintf(stderr, "deleting entry from menu %x\n", s->menu);
fprintf(stderr, "deleting entry from among menus %x\n", s->menus);
#endif
s->menu &= ~menu;
s->menus &= ~menu;
}
}
if (dobind) {
/* If this is a toggle, copy its sequence number. */
if (newsc->scfunc == do_toggle_void) {
for (s = sclist; s != NULL; s = s->next)
if (s->scfunc == do_toggle_void && s->toggle == newsc->toggle)
newsc->ordinal = s->ordinal;
} else
newsc->ordinal = 0;
/* Add the new shortcut at the start of the list. */
newsc->next = sclist;
sclist = newsc;
return;
}
free_copy:
free(keycopy);
}
@@ -985,8 +1001,7 @@ void parse_linter(char *ptr)
return;
}
if (endsyntax->linter != NULL)
free(endsyntax->linter);
free(endsyntax->linter);
/* Let them unset the linter by using "". */
if (!strcmp(ptr, "\"\""))
@@ -1012,8 +1027,7 @@ void parse_formatter(char *ptr)
return;
}
if (endsyntax->formatter != NULL)
free(endsyntax->formatter);
free(endsyntax->formatter);
/* Let them unset the formatter by using "". */
if (!strcmp(ptr, "\"\""))

View File

@@ -116,16 +116,6 @@ void search_replace_abort(void)
#endif
}
/* 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)
last_replace = mallocstrcpy(NULL, "");
}
/* Set up the system variables for a search or replace. If use_answer
* is TRUE, only set backupstring to answer. Return -2 to run the
* opposite program (search -> replace, replace -> search), return -1 if
@@ -157,7 +147,7 @@ int search_init(bool replacing, bool use_answer)
* do_search() or do_replace() and be called again. In that case,
* we should put the same search string back up. */
search_init_globals();
focusing = TRUE;
if (last_search[0] != '\0') {
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
@@ -259,17 +249,16 @@ int search_init(bool replacing, bool use_answer)
return 0;
}
/* Look for needle, starting at (current, current_x). If no_sameline is
* TRUE, skip over begin when looking for needle. begin is the line
/* Look for needle, starting at (current, current_x). begin is the line
* where we first started searching, at column begin_x. The return
* value specifies whether we found anything. If we did, set needle_len
* to the length of the string we found if it isn't NULL. */
bool findnextstr(
#ifndef DISABLE_SPELLER
bool whole_word,
bool whole_word_only,
#endif
bool no_sameline, const filestruct *begin, size_t begin_x, const
char *needle, size_t *needle_len)
const filestruct *begin, size_t begin_x,
const char *needle, size_t *needle_len)
{
size_t found_len;
/* The length of the match we find. */
@@ -326,7 +315,7 @@ bool findnextstr(
#ifndef DISABLE_SPELLER
/* If we're searching for whole words, see if this potential
* match is a whole word. */
if (whole_word) {
if (whole_word_only) {
char *word = mallocstrncpy(NULL, found, found_len + 1);
word[found_len] = '\0';
@@ -334,17 +323,11 @@ bool findnextstr(
fileptr->data, word);
free(word);
}
#endif
/* If we're searching for whole words and this potential
* match isn't a whole word, or if we're not allowed to find
* a match on the same line we started on and this potential
* match is on that line, continue searching. */
if (
#ifndef DISABLE_SPELLER
(!whole_word || found_whole) &&
* match isn't a whole word, continue searching. */
if (!whole_word_only || found_whole)
#endif
(!no_sameline || fileptr != openfile->current))
break;
}
@@ -477,35 +460,13 @@ void do_search(void)
#ifndef DISABLE_SPELLER
FALSE,
#endif
FALSE, openfile->current, openfile->current_x, answer, NULL);
openfile->current, openfile->current_x, answer, NULL);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
/* If we found something, and we're back at the exact same spot where
* we started searching, then this is the only occurrence. */
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && didfind) {
#ifdef HAVE_REGEX_H
/* Do the search again, skipping over the current line, if we're
* doing a bol and/or eol regex search ("^", "$", or "^$"), so
* that we find one only once per 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. */
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
answer)) {
didfind = findnextstr(
#ifndef DISABLE_SPELLER
FALSE,
#endif
TRUE, openfile->current,
openfile->current_x, answer, NULL);
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && !didfind)
statusbar(_("This is the only occurrence"));
} else {
#endif
statusbar(_("This is the only occurrence"));
#ifdef HAVE_REGEX_H
}
#endif
}
openfile->placewewant = xplustabs();
@@ -513,6 +474,31 @@ void do_search(void)
search_replace_abort();
}
#ifndef NANO_TINY
/* Search in the backward direction for the next occurrence. */
void do_findprevious(void)
{
if ISSET(BACKWARDS_SEARCH)
do_research();
else {
SET(BACKWARDS_SEARCH);
do_research();
UNSET(BACKWARDS_SEARCH);
}
}
/* Search in the forward direction for the next occurrence. */
void do_findnext(void)
{
if ISSET(BACKWARDS_SEARCH) {
UNSET(BACKWARDS_SEARCH);
do_research();
SET(BACKWARDS_SEARCH);
} else
do_research();
}
#endif
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
/* Search for the last string without prompting. */
void do_research(void)
@@ -522,7 +508,14 @@ void do_research(void)
size_t pww_save = openfile->placewewant;
bool didfind;
search_init_globals();
focusing = TRUE;
#ifndef DISABLE_HISTORIES
/* If nothing was searched for yet during this run of nano, but
* there is a search history, take the most recent item. */
if (last_search[0] == '\0' && searchbot->prev != NULL)
last_search = mallocstrcpy(last_search, searchbot->prev->data);
#endif
if (last_search[0] != '\0') {
#ifdef HAVE_REGEX_H
@@ -536,36 +529,13 @@ void do_research(void)
#ifndef DISABLE_SPELLER
FALSE,
#endif
FALSE, openfile->current, openfile->current_x,
last_search, NULL);
openfile->current, openfile->current_x, last_search, NULL);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
/* If we found something, and we're back at the exact same spot
* where we started searching, then this is the only occurrence. */
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && didfind) {
#ifdef HAVE_REGEX_H
/* Do the search again, skipping over the current line, if
* we're doing a bol and/or eol regex search ("^", "$", or
* "^$"), so that we find one only once per 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. */
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
last_search)) {
didfind = findnextstr(
#ifndef DISABLE_SPELLER
FALSE,
#endif
TRUE, openfile->current, openfile->current_x,
last_search, NULL);
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && !didfind)
statusbar(_("This is the only occurrence"));
} else {
#endif /* HAVE_REGEX_H */
statusbar(_("This is the only occurrence"));
#ifdef HAVE_REGEX_H
}
#endif
}
} else
statusbar(_("No current search pattern"));
@@ -577,17 +547,13 @@ void do_research(void)
#endif /* !NANO_TINY */
#ifdef HAVE_REGEX_H
/* Calculate the size of the replacement text, taking possible
* subexpressions \1 to \9 into account. Return the replacement
* text in the passed string only when create is TRUE. */
int replace_regexp(char *string, bool create)
{
/* We have a split personality here. If create is FALSE, just
* calculate the size of the replacement line (necessary because of
* subexpressions \1 to \9 in the replaced text). */
const char *c = last_replace;
size_t search_match_count = regmatches[0].rm_eo -
regmatches[0].rm_so;
size_t new_line_size = strlen(openfile->current->data) + 1 -
search_match_count;
size_t replacement_size = 0;
/* Iterate through the replacement text to handle subexpression
* replacement using \1, \2, \3, etc. */
@@ -599,7 +565,7 @@ int replace_regexp(char *string, bool create)
if (create)
*string++ = *c;
c++;
new_line_size++;
replacement_size++;
} else {
size_t i = regmatches[num].rm_eo - regmatches[num].rm_so;
@@ -607,7 +573,7 @@ int replace_regexp(char *string, bool create)
c += 2;
/* But add the length of the subexpression to new_size. */
new_line_size += i;
replacement_size += i;
/* And if create is TRUE, append the result of the
* subexpression match to the new line. */
@@ -622,25 +588,26 @@ int replace_regexp(char *string, bool create)
if (create)
*string = '\0';
return new_line_size;
return replacement_size;
}
#endif /* HAVE_REGEX_H */
/* Return a copy of the current line with one needle replaced. */
char *replace_line(const char *needle)
{
char *copy;
size_t new_line_size, search_match_count;
size_t match_len;
size_t new_line_size = strlen(openfile->current->data) + 1;
/* Calculate the size of the new line. */
/* First adjust the size of the new line for the change. */
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP)) {
search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
new_line_size = replace_regexp(NULL, FALSE);
match_len = regmatches[0].rm_eo - regmatches[0].rm_so;
new_line_size += replace_regexp(NULL, FALSE) - match_len;
} else {
#endif
search_match_count = strlen(needle);
new_line_size = strlen(openfile->current->data) -
search_match_count + strlen(answer) + 1;
match_len = strlen(needle);
new_line_size += strlen(answer) - match_len;
#ifdef HAVE_REGEX_H
}
#endif
@@ -648,10 +615,10 @@ char *replace_line(const char *needle)
/* Create the buffer. */
copy = charalloc(new_line_size);
/* The head of the original line. */
/* Copy the head of the original line. */
strncpy(copy, openfile->current->data, openfile->current_x);
/* The replacement text. */
/* Add the replacement text. */
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP))
replace_regexp(copy + openfile->current_x, TRUE);
@@ -659,11 +626,10 @@ char *replace_line(const char *needle)
#endif
strcpy(copy + openfile->current_x, answer);
/* The tail of the original line. */
assert(openfile->current_x + search_match_count <= strlen(openfile->current->data));
assert(openfile->current_x + match_len <= strlen(openfile->current->data));
strcat(copy, openfile->current->data + openfile->current_x +
search_match_count);
/* Copy the tail of the original line. */
strcat(copy, openfile->current->data + openfile->current_x + match_len);
return copy;
}
@@ -678,7 +644,7 @@ char *replace_line(const char *needle)
* canceled isn't NULL, set it to TRUE if we canceled. */
ssize_t do_replace_loop(
#ifndef DISABLE_SPELLER
bool whole_word,
bool whole_word_only,
#endif
bool *canceled, const filestruct *real_current, size_t
*real_current_x, const char *needle)
@@ -686,10 +652,6 @@ ssize_t do_replace_loop(
ssize_t numreplaced = -1;
size_t match_len;
bool replaceall = FALSE;
#ifdef HAVE_REGEX_H
/* The starting-line match and bol/eol regex flags. */
bool begin_line = FALSE, bol_or_eol = FALSE;
#endif
#ifndef NANO_TINY
bool old_mark_set = openfile->mark_set;
filestruct *top, *bot;
@@ -721,18 +683,9 @@ ssize_t do_replace_loop(
findnextstr_wrap_reset();
while (findnextstr(
#ifndef DISABLE_SPELLER
whole_word,
whole_word_only,
#endif
#ifdef HAVE_REGEX_H
/* We should find a bol and/or eol regex only once per line. If
* the bol_or_eol flag is set, it means that the last search
* found one on the beginning line, so we should skip over the
* beginning line when doing this search. */
bol_or_eol
#else
FALSE
#endif
, real_current, *real_current_x, needle, &match_len)) {
real_current, *real_current_x, needle, &match_len)) {
int i = 0;
#ifndef NANO_TINY
@@ -747,22 +700,6 @@ ssize_t do_replace_loop(
}
#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)
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. */
else {
if (openfile->current == real_current)
begin_line = TRUE;
bol_or_eol = FALSE;
}
#endif
/* Indicate that we found the search string. */
if (numreplaced == -1)
numreplaced = 0;
@@ -795,13 +732,6 @@ 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))
bol_or_eol = TRUE;
#endif
if (i > 0 || replaceall) { /* Yes, replace it!!!! */
char *copy;
size_t length_change;
@@ -817,14 +747,12 @@ ssize_t do_replace_loop(
length_change = strlen(copy) - strlen(openfile->current->data);
#ifndef NANO_TINY
/* If the mark was on and (mark_begin, mark_begin_x) was the
* top of it, don't change mark_begin_x. */
if (!old_mark_set || !right_side_up) {
/* Keep mark_begin_x in sync with the text changes. */
/* If the mark was on and it was located after the cursor,
* then adjust its x position for any text length changes. */
if (old_mark_set && !right_side_up) {
if (openfile->current == openfile->mark_begin &&
openfile->mark_begin_x > openfile->current_x) {
if (openfile->mark_begin_x < openfile->current_x +
match_len)
if (openfile->mark_begin_x < openfile->current_x + match_len)
openfile->mark_begin_x = openfile->current_x;
else
openfile->mark_begin_x += length_change;
@@ -832,11 +760,10 @@ ssize_t do_replace_loop(
}
}
/* If the mark was on and (current, current_x) was the top
* of it, don't change real_current_x. */
/* If the mark was not on or it was before the cursor, then
* adjust the cursor's x position for any text length changes. */
if (!old_mark_set || right_side_up) {
#endif
/* 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)
@@ -848,6 +775,12 @@ ssize_t do_replace_loop(
#endif
}
#ifdef HAVE_REGEX_H
/* Don't find the same zero-length match again. */
if (match_len == 0)
match_len++;
#endif
/* Set the cursor at the last character of the replacement
* text, so searching will resume after the replacement
* text. Note that current_x might be set to (size_t)-1
@@ -857,9 +790,8 @@ ssize_t do_replace_loop(
#endif
openfile->current_x += match_len + length_change - 1;
/* Clean up. */
openfile->totsize += mbstrlen(copy) -
mbstrlen(openfile->current->data);
/* Update the file size, and put the changed line into place. */
openfile->totsize += mbstrlen(copy) - mbstrlen(openfile->current->data);
free(openfile->current->data);
openfile->current->data = copy;
@@ -1214,7 +1146,7 @@ void do_find_bracket(void)
ch = openfile->current->data + openfile->current_x;
if (ch == '\0' || (ch = mbstrchr(matchbrackets, ch)) == NULL) {
if ((ch = mbstrchr(matchbrackets, ch)) == NULL) {
statusbar(_("Not a bracket"));
return;
}
@@ -1375,7 +1307,6 @@ void update_history(filestruct **h, const char *s)
foo = p;
bar = p->next;
unlink_node(foo);
delete_node(foo);
renumber(bar);
}
@@ -1387,13 +1318,12 @@ void update_history(filestruct **h, const char *s)
*hage = (*hage)->next;
unlink_node(foo);
delete_node(foo);
renumber(*hage);
}
/* Add the new entry to the end. */
(*hbot)->data = mallocstrcpy((*hbot)->data, s);
splice_node(*hbot, make_new_node(*hbot), (*hbot)->next);
splice_node(*hbot, make_new_node(*hbot));
*hbot = (*hbot)->next;
(*hbot)->data = mallocstrcpy(NULL, "");

File diff suppressed because it is too large Load Diff

View File

@@ -30,21 +30,6 @@
#include <ctype.h>
#include <errno.h>
/* Return the number of decimal digits in n. */
int digits(size_t n)
{
int i;
if (n == 0)
i = 1;
else {
for (i = 0; n != 0; n /= 10, i++)
;
}
return i;
}
/* Return the user's home directory. We use $HOME, and if that fails,
* we fall back on the home directory of the effective user ID. */
void get_homedir(void)
@@ -58,7 +43,11 @@ void get_homedir(void)
if (userage != NULL)
homenv = userage->pw_dir;
}
homedir = mallocstrcpy(NULL, homenv);
/* Only set homedir if some home directory could be determined,
* otherwise keep homedir NULL. */
if (homenv != NULL && strcmp(homenv, "") != 0)
homedir = mallocstrcpy(NULL, homenv);
}
}
@@ -250,15 +239,6 @@ ssize_t ngetline(char **lineptr, size_t *n, FILE *stream)
#endif /* !DISABLE_NANORC */
#ifdef HAVE_REGEX_H
/* Do the compiled regex in preg and the regex in string match the
* beginning or end of a line? */
bool regexp_bol_or_eol(const regex_t *preg, const char *string)
{
return (regexec(preg, string, 0, NULL, 0) == 0 &&
regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
REG_NOMATCH);
}
/* 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)
@@ -290,12 +270,11 @@ const char *fixbounds(const char *r)
fprintf(stderr, "fixbounds(): Ending string = \"%s\"\n", r3);
#endif
return (const char *) r3;
#endif
#endif /* !GNU_WORDBOUNDS */
return r;
}
#endif
#endif /* HAVE_REGEX_H */
#ifndef DISABLE_SPELLER
/* Is the word starting at position pos in buf a whole word? */
@@ -425,8 +404,7 @@ void *nrealloc(void *ptr, size_t howmuch)
}
/* Copy the first n characters of one malloc()ed string to another
* pointer. Should be used as: "dest = mallocstrncpy(dest, src,
* n);". */
* pointer. Should be used as: "dest = mallocstrncpy(dest, src, n);". */
char *mallocstrncpy(char *dest, const char *src, size_t n)
{
if (src == NULL)
@@ -445,8 +423,7 @@ char *mallocstrncpy(char *dest, const char *src, size_t n)
* "dest = mallocstrcpy(dest, src);". */
char *mallocstrcpy(char *dest, const char *src)
{
return mallocstrncpy(dest, src, (src == NULL) ? 1 :
strlen(src) + 1);
return mallocstrncpy(dest, src, (src == NULL) ? 1 : strlen(src) + 1);
}
/* Free the malloc()ed string at dest and return the malloc()ed string

File diff suppressed because it is too large Load Diff