Compare commits

...

60 Commits

Author SHA1 Message Date
Chris Allegretta
c26a940167 GNU nano 2.5.1 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5544 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-11 05:05:01 +00:00
Chris Allegretta
26347ed38e Forward date 2.5.1 up to the 11th since I didnt get to it before Midnight.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5543 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-11 05:03:20 +00:00
Benno Schulenberg
1b293ff34c Adjusting dates and version number.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5542 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-10 16:18:43 +00:00
Benno Schulenberg
83475b0d84 Adding a news item for the upcoming 2.5.1.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5541 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-10 16:10:57 +00:00
Benno Schulenberg
113cd506c9 Snipping inconsistent blank lines in the Changelog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5540 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-09 21:10:39 +00:00
Benno Schulenberg
ec4ee1c489 Not going beyond the number of available rows in the edit window.
This fixes Savannah bug #42188.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5539 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-09 20:21:29 +00:00
Benno Schulenberg
ebbb5b5d1e Making sure to keep advancing also when regex matches are zero-length.
This fixes Savannah bug #26977 -- a hang on start="^" end="$".


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5538 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-09 18:41:56 +00:00
Benno Schulenberg
1ac2c4cd4f Adding a comment and using a symbolic value.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5537 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-07 15:42:44 +00:00
Benno Schulenberg
6d6cda24c8 Delete two unneeded #ifdefs -- better fail to compile than create a cripple.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5536 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-07 15:21:59 +00:00
Benno Schulenberg
9962e3b65c Making "Tab" produce the appropriate keycode.
This fixes Savannah bug #46812.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5535 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 19:42:37 +00:00
Benno Schulenberg
9d72efa474 Gettextizing a forgotten string.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5534 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 11:10:07 +00:00
Benno Schulenberg
22557df600 Adding "Tab" as a key description, just like "Del" and "Enter" already are.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5533 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 10:50:21 +00:00
Benno Schulenberg
9e6b9a29a5 Improving the name of allow_pending_sigwinch() to allow_sigwinch(),
and improving its comments too.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5532 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 10:37:11 +00:00
Benno Schulenberg
0dd351a5c1 Condensing the exit code of do_linter().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5531 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 10:05:52 +00:00
Benno Schulenberg
dd29c56993 Rewriting the loop, and constifying the input of sctofunc().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5530 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 09:52:43 +00:00
Benno Schulenberg
7a08fa63f5 No longer freeing any existing functions -- they are defined only once.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5529 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 09:44:35 +00:00
Benno Schulenberg
539a4b42be Constifying the input parameter of strtosc() and strtomenu().
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5528 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 09:12:21 +00:00
Benno Schulenberg
42a761e77f Adjusting the indentation after the previous change.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5527 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-03 17:37:05 +00:00
Benno Schulenberg
0d85c8c68c Alerting the user when a functionless shortcut is encountered.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5526 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-03 17:07:29 +00:00
Benno Schulenberg
a5bc70a541 Aborting reset_multis() when there are zero multiline regexes.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5525 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-03 16:57:17 +00:00
Benno Schulenberg
37712fb120 Letting reset_multis() figure out whether after an addition a full refresh is
needed (for the sake of multiline regexes), instead of doing it always.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5524 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-03 16:21:04 +00:00
Benno Schulenberg
5765e9675f Letting reset_multis() figure out whether after a deletion a full refresh is
needed, before doing a redraw of the current line.
This fixes Savannah bug #46794


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5523 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-03 15:35:52 +00:00
Benno Schulenberg
c916ca87bf Correctly restoring the settings of NO_HELP and MORE_SPACE.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5522 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-02 16:33:03 +00:00
Benno Schulenberg
97e9476df5 Skipping the unneeded reinitialization of the windows;
it will be done when polling the keybuffer.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5521 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-02 16:25:50 +00:00
Benno Schulenberg
9eca195990 Plugging three tiny memory leaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5520 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-02 16:01:04 +00:00
Benno Schulenberg
46db638435 Chopping a duplicate parameter.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5519 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-31 19:20:40 +00:00
Benno Schulenberg
1592ca0585 Chopping an always FALSE parameter.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5518 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-31 17:20:46 +00:00
Benno Schulenberg
8f0262f51e Deleting a now unused function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5517 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-31 16:49:07 +00:00
Benno Schulenberg
33bc96ab5c Restoring the cursor position differently, using a more basic routine.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5516 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-31 16:44:32 +00:00
Benno Schulenberg
26bc037b19 Normalizing the comments in the OCaml file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5515 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-30 20:57:31 +00:00
Benno Schulenberg
37d8ad8687 Not trying to position the cursor when opening a buffer failed.
This fixes Savannah bug #46778.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5514 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-30 10:11:20 +00:00
Benno Schulenberg
ae598e79a6 Disabling the regex for multiline strings in C and Assembler,
as it colours some things wrong and is a glutton on time.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5513 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-29 16:48:25 +00:00
Benno Schulenberg
480b6a320f Going back to the filename prompt when the user decides to save a
changed buffer after all, as the buffer may not have a name yet.
This fixes Savannah bug #46752.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5512 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 19:18:33 +00:00
Benno Schulenberg
31e1af646c Not opening an extra blank buffer when an empty file is read.
This bug was exposed by r5498 on December 18.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5511 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 16:44:39 +00:00
Benno Schulenberg
a0eea607ba Improving the ordering of two bindable functions.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5510 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 16:37:04 +00:00
Benno Schulenberg
8cc6308f9c Offering ^Q in the writeout menu to close and discard the current buffer
without saving it.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5509 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 16:34:44 +00:00
Benno Schulenberg
1bebe34b56 Preventing valid pointers from getting truncated and rejected.
Patch by Mike Frysinger, tweaked by Benno.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5508 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 14:05:47 +00:00
Benno Schulenberg
277f58f8d8 History: no prompting on exit errors, because making the user hit Enter when
there's an error saving history state at exit is pointless and annoying.
Just notify the user and move on.
Patch by Mike Frysinger, tweaked and extended by Benno.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5507 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 13:37:55 +00:00
Benno Schulenberg
451b299c1d Expanding the autoconf syntax a little, by handling .m4 files too, adding the
"elif" keyword, handling dnl comments better, and marking trailing whitespace.
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5506 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 10:54:40 +00:00
Benno Schulenberg
454f6ebb97 AC_CHECK_HEADERS_ONCE() is very special cannot be conditionalized.
Use plain AC_CHECK_HEADERS() instead, so ./configure will not check
for magic.h and zlib.h when --disable-libmagic is given.
Patch by Christian Weisgerber.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5505 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 09:39:50 +00:00
Benno Schulenberg
bd91785d73 Using 'return' instead of an intermediate variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5504 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-22 20:24:50 +00:00
Benno Schulenberg
46082bd00c Renaming three keyboard functions -- 'get' is not a good name when the
routine isn't getting something from somewhere but just converting it.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5503 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-22 19:00:25 +00:00
Benno Schulenberg
dd1b2dce98 Tweaking the Changelog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5502 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-22 16:52:09 +00:00
Benno Schulenberg
31f0456e9a Moving two functions to the color.c file, where they belong.
And making the checking for an impatient user into a separate routine.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5501 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-22 16:51:00 +00:00
Benno Schulenberg
5737fe3461 Precalculating the multiline-regex cache data for each buffer,
not just for the first.  This fixes Savannah bug #46511.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5500 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-20 21:10:41 +00:00
Benno Schulenberg
72760159e7 Tweaking some comments and improving a variable name.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5499 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-18 20:44:01 +00:00
Benno Schulenberg
22e9283520 Chopping a superfluous boolean parameter -- 'prevnode' being NULL is
enough indication that the first line is being read.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5498 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-18 19:18:23 +00:00
Benno Schulenberg
d63912947a Improving some comments and renaming three variables.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5497 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-18 18:44:40 +00:00
Benno Schulenberg
4fc16848fa Adjusting the whitespace after the previous change, and adding a comment.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5496 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-18 10:45:35 +00:00
Benno Schulenberg
8295a88ff0 Using a couple less #ifdefs, to mimic how this is done in set_colorpairs().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5495 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-18 10:41:09 +00:00
Benno Schulenberg
a77efae609 Adding the missing autoconf and nftables syntaxes to the files to be
distributed.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5494 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-11 16:55:07 +00:00
Benno Schulenberg
9a6f62ff67 Rewrapping and reordering a few lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5493 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-08 19:09:14 +00:00
Benno Schulenberg
5834638d53 It shouldn't be necessary to doubly check for being at the end of file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5492 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-08 18:54:13 +00:00
Benno Schulenberg
a64bfbee8b Letting also unlink_node() update 'filebot', instead of doing it in
four different places.  It is not a problem that the history routines
also use these functions, as history nodes will never equal filebot.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5491 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-08 16:02:05 +00:00
Benno Schulenberg
77c0357868 Making splice_node() update 'filebot', instead of doing it in
four different places.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5490 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-08 15:29:56 +00:00
Benno Schulenberg
cac3c3399f Making ^O always prompt for a filename, also when --tempfile is given.
Users who want an immediate save, can bind the function 'savefile'.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5489 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-07 17:05:04 +00:00
Benno Schulenberg
5d27910d6d Quitting the loop when there is no end match.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5488 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-07 15:40:07 +00:00
Benno Schulenberg
a955b332e3 Fixing whitespace, layout, wording, and typo.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5487 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-07 13:31:38 +00:00
Chris Allegretta
1233e8e37a Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5486 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-06 05:40:56 +00:00
Chris Allegretta
4eb4d08038 Typo in release announcement
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5485 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-06 05:27:40 +00:00
56 changed files with 14996 additions and 14554 deletions

211
ChangeLog
View File

@@ -1,8 +1,143 @@
GNU nano 2.5.0 - 2016.01.11
2016-01-10 Benno Schulenberg <bensberg@justemail.net>
* NEWS: Add item for upcoming 2.5.1.
* src/nano.c (version), src/winio.c (do_credits), doc/man/rnano.1,
doc/man/nano.1, doc/man/nanorc.5: Adjust dates and version number.
2016-01-09 Benno Schulenberg <bensberg@justemail.net>
* src/color.c (precalc_multicolorinfo), src/winio.c (edit_draw):
Make sure to keep advancing also when matches are zero-length.
This fixes Savannah bug #26977 reported by Tigrmesh.
* src/winio.c (update_line): For softwrap, don't go beyond the number
of available rows in the edit window. This fixes Savannah bug #42188.
* ChangeLog: Snip inconsistent blank lines.
2016-01-07 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (assign_keyinfo): Delete two unneeded #ifdefs: if
they /could/ be false, the H and E keys would stop working.
* src/global.c (assign_keyinfo): Add a comment and use a symbol.
2016-01-04 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (shortcut_init): Nowadays the functions are defined
only once, so there is no longer any need to free existing ones.
* src/global.c (sctofunc): Rewrite the loop, and constify the input.
* src/text.c (do_linter): Condense the exit code.
* src/nano.c (allow_sigwinch): Improve its name and its comments.
* src/global.c (shortcut_init): Add "Tab" as key description.
* src/text.c (do_linter): Gettextize a forgotten string.
* src/global.c (assign_keyinfo): Make "Tab" produce the appropriate
keycode. This fixes Savannah bug #46812 reported by Cody A. Taylor.
2016-01-04 Mike Frysinger <vapier@gentoo.org>
* src/global.c (strtosc, strtomenu): Constify the input parameter.
2016-01-03 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_deletion), src/nano.c (do_input): Let reset_multis()
figure out whether after a deletion a full refresh is needed, before
doing a redraw of the current line. This fixes Savannah bug #46794.
* src/nano.c (do_output): Let reset_multis() figure out whether after
an addition a full refresh is needed (for multiline-regexes' sake),
instead of doing it always.
* src/color.c (reset_multis): Abort when having no multiline regexes.
* src/nano.c (do_input): A functionless shortcut should be impossible.
* src/nano.c (do_input): Adjust indentation.
2016-01-02 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_spell, do_formatter): Plug three tiny memory leaks.
* src/text.c (do_alt_speller, do_formatter): There is no need here to
reinitialize the windows; it will be done when polling the keybuffer.
* src/winio.c (do_credits): Correctly restore the settings of NO_HELP
and MORE_SPACE.
2015-12-31 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_formatter): Restore the cursor position differently.
* src/search.c (do_gotopos): Delete this now unused function.
* src/search.c (do_gotolinecolumn): Chop an always FALSE parameter.
* src/search.c (do_gotolinecolumn): Chop a duplicate parameter --
'allow_update' always has the same value as 'interactive'.
2015-12-30 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (main), src/files.c (open_buffer): Don't try to position
the cursor when opening a buffer failed (because the user specified a
directory, for example). This fixes Savannah bug #46778.
* doc/syntax/ocaml.nanorc: Normalize the comments.
2015-12-29 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/{c,objc,asm}.nanorc: Disable the regex for multiline
strings as it colours some things wrong and is a glutton on time.
2015-12-23 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (do_writeout, do_writeout_void), src/global.c
(shortcut_init, strtosc), src/nano.c (do_exit, close_and_go),
doc/man/nanorc.5, doc/texinfo/nano.texi: In the writeout menu,
offer ^Q to close and discard the buffer without saving it. By
default, the key is bound only when --tempfile is in effect.
* doc/man/nanorc.5: Improve ordering of bindable functions.
* src/files.c (read_file): Don't open an extra blank buffer when
an empty file is read. Bug was exposed by r5498, December 18.
* src/files.c (do_writeout): When the user decides to save the
buffer after all, go back to the filename prompt because the
buffer may not have a name yet. This fixes Savannah bug #46752.
2015-12-23 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/autoconf.nanorc: Handle .m4 files too, add the "elif"
keyword, handle dnl comments better, and mark trailing whitespace.
* src/files.c (save_history, save_poshistory): Don't make the user
hit Enter when there's an error saving history state at exit; it is
pointless and annoying. Just notify the user and move on.
* src/nano.c (main): On most 64-bit systems, casting a pointer to
an integer can cause valid pointers to be truncated and rejected.
Rework the code to test for the two invalid values directly.
2015-12-23 Christian Weisgerber <naddy@mips.inka.de>
* configure.ac: AC_CHECK_HEADERS_ONCE() is very special and cannot be
conditionalized. Use plain AC_CHECK_HEADERS() instead, to not check
for magic.h and zlib.h when configuring with --disable-libmagic.
2015-12-22 Benno Schulenberg <bensberg@justemail.net>
* src/color.c (precalc_multicolorinfo, alloc_multidata_if_needed):
Move these two functions to the file where they belong. And make
the checking for an impatient user into a separate routine.
* src/proto.h, src/winio.c (parse_escape_sequence, convert_sequence,
arrow_from_abcd): Better names for these three functions.
* src/winio.c (convert_sequence): Use return instead of a variable.
2015-12-20 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (display_buffer), src/nano.c (main): Precalculate the
multiline-regex cache data for each buffer, not just for the first.
This fixes Savannah bug #46511.
2015-12-18 Benno Schulenberg <bensberg@justemail.net>
* src/color.c (color_init): Use less #ifdefs, and adjust indentation.
* src/color.c (set_colorpairs): Improve comments and rename vars.
* src/files.c (read_line): Chop a superfluous bool -- 'prevnode' being
NULL is enough indication that the first line is being read.
* src/files.c (switch_to_prevnext_buffer): Tweak comment and var name.
2015-12-11 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/Makefile.am: Add missing autoconf and nftables syntaxes.
* ChangeLog: Correct a bug number, plus a few other tweaks.
2015-12-08 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (splice_node, unlink_node): Let these functions update
'filebot', instead of doing it in four different places each.
* src/search.c (goto_line_posx), src/move.c (do_down): It should not
be necessary to doubly check for being at the end of file.
* src/text.c (do_justify): Rewrap and reorder a few lines.
2015-12-07 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (edit_draw): Quit the loop when there is no end match.
* src/files.c (do_writeout): When --tempfile is given, make ^O not
write out the file rightaway, as otherwise there is no way to discard
the edits. This undoes the core part of r5378 of September 29. See
https://lists.gnu.org/archive/html/help-nano/2015-11/msg00005.html.
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.
* 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.
@@ -203,7 +338,7 @@ GNU nano 2.4.3 - 2015.11.18
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.
fixes Savannah bug #45415. [Reverted in r5489 on December 7.]
2015-10-28 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_redo): For an INSERT, 'u->mark_begin_lineno' is not
@@ -1291,7 +1426,7 @@ GNU nano 2.3.5 - 2014.07.11
* doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Update
the docs for the changed location of nano's search history.
* doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Change
some wordings, triggered by Savannah bug #52539.
some wordings, triggered by Savannah bug #42539.
2014-06-14 Mark Majeres <mark@engine12.com>
* src/nano.h, src/text.c (undo_cut, update_undo): When undoing a
@@ -2102,7 +2237,7 @@ GNU nano 2.3.3 - 2014.05.29
2014-02-27 Benno Schulenberg <bensberg@justemail.net>
* src/help.c (parse_help_input): Make 'Space' again an alias
for PageDown and 'Minus' for PageUp -- they were mistakenly
swapped during code conversion in revision 4223.
swapped during code conversion in r4223.
2014-02-26 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/sh.nanorc: Highlight more shell builtins and
@@ -2263,7 +2398,7 @@ GNU nano 2.3.2 - 2013.03.23
as that puts us into a wacky state. Fixes crash on justify by Joshua Rogers.
* configure.ac: Added --with-wordbounds option to let cross compilers force
whether their target system support GNU-style word boundaries or not.
Originally reported by dave festing.
Originally reported by Dave Festing.
* doc/man/nanorc.5: Fix typo in softwrap description, reported by
cbart387@Savannah.
@@ -2370,14 +2505,14 @@ GNU nano 2.3.0 - 2011.02.26
New nanorc entry "magic" to enable this functionality, nanorc file and man page updates.
2011-02-06 Chris Allegretta <chrisa@asty.org>
* src/*: Retire iso_me_harder_funcmap based on suggestion by <bernd.spaeth@gmx.net>
* src/*: Retire iso_me_harder_funcmap based on suggestion by <bernd.spaeth@gmx.net>.
This does add 20KB to nano's executable size but it gets rid of a lot of indirection
that makes people stomach turn. There are several new stub functions and need of more
tidying as a result of this.
that makes people's stomach turn. There are several new stub functions and a need of
more tidying as a result of this.
* files.c (write_file): Fix problems with writing the backup file (albeit interactively)
with new function prompt_failed_backupwrite(), allows more secure handling of problems
with failing to write the backup file compared to 'allow_insecure_backup'.
* winio.c (edit_redraw): Removed unused variable.
* winio.c (edit_redraw): Remove unused variable.
GNU nano 2.2.6 - 2010.11.22
@@ -3041,7 +3176,7 @@ GNU nano 2.1.1 - 2008.04.01
* src/global.c, doc/man/nanorc.5: Fix typos and poorly worded
lines in the source and man pages.
2008-03-04 Chris Allegretta <chrisa@asty.org
2008-03-04 Chris Allegretta <chrisa@asty.org>
* everything: New shortcut backend. New structs subnfunc
for menu functions and toggles and sc for shortcut keys, old
'shortcut' and 'toggles' structs are gone. The current implementation
@@ -3049,18 +3184,15 @@ GNU nano 2.1.1 - 2008.04.01
Updated nanorc.5 with some mostly complete documentation on configuring.
2007-12-20 David Lawrence Ramsey <pooka109@gmail.com>
* AUTHORS, doc/faq.html: Update maintenance information.
* NEWS: Resync with NEWS from the 2.0 branch.
2007-12-18 David Lawrence Ramsey <pooka109@gmail.com>
* nano.c (print_opt_full): Use strlenpt() instead of strlen(),
so that tabs are placed properly when displaying translated
strings in UTF-8, as found by Jean-Philippe Guérard.
2007-12-17 David Lawrence Ramsey <pooka109@gmail.com>
* configure.ac, doc/texinfo/nano.texi, nano.c (terminal_init):
Change slang curses emulation support to turn off the same
options as --enable-tiny, as it's hopelessly broken otherwise.
@@ -3073,23 +3205,19 @@ GNU nano 2.1.1 - 2008.04.01
* NEWS: Resync with NEWS from the 2.0 branch.
2007-12-10 David Lawrence Ramsey <pooka109@gmail.com>
* nano.c (main): Exit if initscr() fails.
2007-12-09 David Lawrence Ramsey <pooka109@gmail.com>
* faq.html: Add minor punctuation and wording fixes, and update
various sections to account for Alpine.
2007-12-08 David Lawrence Ramsey <pooka109@gmail.com>
* prompt.c (do_statusbar_mouse, reset_statusbar_cursor,
update_statusbar_line, need_statusbar_horizontal_update): Fix
minor display and cursor placement problems when scrolling
between pages at the statusbar prompt.
2007-12-07 David Lawrence Ramsey <pooka109@gmail.com>
* winio.c (get_mouseinput): Fix longstanding problem where mouse
clicks on the statusbar prompt text wouldn't be recognized
unless the NO_HELP flag was turned off.
@@ -3098,7 +3226,6 @@ GNU nano 2.1.1 - 2008.04.01
Free Software Foundation.
2007-12-04 David Lawrence Ramsey <pooka109@gmail.com>
* nano.c (main), prompt.c (get_prompt_string), winio.c
(do_replace_highlight): Per OKATA Akio's patch, with minor
tweaks by me, add wnoutrefresh() calls after
@@ -3109,35 +3236,29 @@ GNU nano 2.1.1 - 2008.04.01
click interval.
2007-11-29 Jean-Philippe Guérard <jean-philippe.guerard@tigreraye.org>
* doc/man/fr/*.1, doc/man/fr/nanorc.5: Fix copyright notices.
The copyrights are disclaimed on these translations, but the
copyrights of the untranslated works also apply.
2007-11-28 David Lawrence Ramsey <pooka109@gmail.com>
* doc/man/fr/nanorc.5: Remove trailing whitespace.
2007-11-17 David Lawrence Ramsey <pooka109@gmail.com>
* files.c (read_file): Improve autodetection of DOS and Mac
format files to not trigger on carriage returns in the middle of
files, as found by Kjell Braden.
2007-11-06 David Lawrence Ramsey <pooka109@gmail.com>
* doc/man/rnano.1, doc/man/fr/rnano.1: Update copyright notices,
as Jordi Mallach's copyrights have now been assigned to the Free
Software Foundation.
2007-11-05 David Lawrence Ramsey <pooka109@gmail.com>
* search.c (do_gotolinecolumn): Use a clearer error message if
we enter an invalid line or column number, per Mike Melanson's
suggestion.
2007-10-11 David Lawrence Ramsey <pooka109@gmail.com>
* doc/man/nano.1, doc/man/fr/nano.1, doc/texinfo/nano.texi,
src/*.c, src/*.h: Update copyright notices, as Chris
Allegretta's copyrights have now been assigned to the Free
@@ -3154,32 +3275,26 @@ GNU nano 2.1.1 - 2008.04.01
uncompleted part of the match).
2007-10-05 David Lawrence Ramsey <pooka109@gmail.com>
* src/*.c, src/*.h: Update copyright notices, as my copyrights
have now been assigned to the Free Software Foundation.
2007-09-16 David Lawrence Ramsey <pooka109@gmail.com>
* winio.c (edit_scroll): Fix problem where the screen wouldn't
be updated properly if you paged up with the first line of the
file onscreen and the mark on.
2007-08-26 David Lawrence Ramsey <pooka109@gmail.com>
* doc/faq.html: Update links to the Free Translation Project.
2007-08-23 Jean-Philippe Guérard <jean-philippe.guerard@tigreraye.org>
* doc/man/fr/*.1, doc/man/fr/nanorc.5: Add translation of new
licensing terms.
2007-08-23 David Lawrence Ramsey <pooka109@gmail.com>
* doc/man/fr/*.1, doc/man/fr/nanorc.5: Delete translation of
old licensing terms, until it can be updated.
2007-08-22 David Lawrence Ramsey <pooka109@gmail.com>
* COPYING.DOC: Add a copy of the GNU FDL version 1.2.
* Makefile.am: Add COPYING.DOC to EXTRA_DIST.
* doc/man/*.1, doc/man/nanorc.5, doc/man/fr/*.1,
@@ -3188,21 +3303,18 @@ GNU nano 2.1.1 - 2008.04.01
Invariant Sections, Front-Cover Texts, or Back-Cover Texts.
2007-08-21 David Lawrence Ramsey <pooka109@gmail.com>
* doc/man/rnano.1, doc/man/fr/rnano.1: Add missing copyright
notice from nano-tiny.1, which rnano.1 is based on.
* doc/man/fr/nano.1, doc/man/fr/nanorc.5, doc/man/fr/rnano.1:
Make all copyright notices consistent.
2007-08-16 David Lawrence Ramsey <pooka109@gmail.com>
* files.c (do_insertfile): Properly handle more cases of
inserting a file with the mark on.
* nano.c (copy_from_file): Properly handle more cases of
uncutting text with the mark on.
2007-08-15 David Lawrence Ramsey <pooka109@gmail.com>
* Makefile.am: Remove erroneous backslash after
ChangeLog.pre-2.1 in EXTRA_DIST, so that "make dist" works
again.
@@ -3212,13 +3324,11 @@ GNU nano 2.1.1 - 2008.04.01
positioned after uncutting multiple lines with the mark on.
2007-08-11 David Lawrence Ramsey <pooka109@gmail.com>
* COPYING: Add a copy of the GNU GPL version 3.
* configure.ac, *.c, *.h: Relicense to the GNU GPL version 3 or
later.
2007-08-10 David Lawrence Ramsey <pooka109@gmail.com>
* files.c (username_tab_completion, cwd_tab_completion,
input_tab): Update copyright notice to account for
modifications.
@@ -3227,7 +3337,6 @@ GNU nano 2.1.1 - 2008.04.01
account for modifications.
2007-08-07 David Lawrence Ramsey <pooka109@gmail.com>
* nano.c (copy_from_file): Fix potential segfault, found by Paul
Goins, after uncutting one line of text with the mark on by
properly preserving the beginning of the mark.
@@ -3235,31 +3344,25 @@ GNU nano 2.1.1 - 2008.04.01
positioned after uncutting one line of text with the mark on.
2007-08-01 David Lawrence Ramsey <pooka109@gmail.com>
* nano.c (version): Display copyright notices.
2007-07-31 David Lawrence Ramsey <pooka109@gmail.com>
* configure.ac: Update copyright notice to account for
modifications.
2007-07-29 David Lawrence Ramsey <pooka109@gmail.com>
* doc/faq.html: Update RPM links for nano 2.0.x.
2007-07-11 David Lawrence Ramsey <pooka109@gmail.com>
* files.c (copy_file): Assert that inn and out don't both point
to the same file.
2007-07-10 David Lawrence Ramsey <pooka109@gmail.com>
* chars.c (nstrcasestr, mbstrcasestr, revstrstr, revstrcasestr,
mbrevstrcasestr): Simplify and rewrite to use the strncasecmp()
equivalents.
2007-07-09 David Lawrence Ramsey <pooka109@gmail.com>
* chars.c (nstrcasestr, mbstrcasestr, revstrstr, revstrcasestr,
mbrevstrcasestr): Fix typo that broke the check for needle's
being blank.
@@ -3272,28 +3375,23 @@ GNU nano 2.1.1 - 2008.04.01
openfile->totsize's being miscalculated.
2007-07-06 David Lawrence Ramsey <pooka109@gmail.com>
* chars.c (nstrcasestr, mbstrcasestr, revstrstr, revstrcasestr,
mbrevstrcasestr): Return char* instead of const char*.
2007-07-02 David Lawrence Ramsey <pooka109@gmail.com>
* chars.c (nstrcasestr, mbstrcasestr, revstrstr, revstrcasestr,
mbrevstrcasestr): For efficiency, return haystack/rev_start
immediately if needle is blank.
2007-07-01 David Lawrence Ramsey <pooka109@gmail.com>
* chars.c (nstrncasecmp, mbstrncasecmp): For efficiency, return
zero immediately if s1 and s2 point to the same string.
2007-06-30 David Lawrence Ramsey <pooka109@gmail.com>
* prompt.c (do_yesno_prompt): Remove redundant check for
NO_HELP's being FALSE.
2007-06-28 David Lawrence Ramsey <pooka109@gmail.com>
* browser.c (do_browser), nano.c (do_mouse), prompt.c
(do_statusbar_mouse, do_yesno_prompt): Further simplify
processing of mouse events by consolidating if clauses.
@@ -3302,19 +3400,16 @@ GNU nano 2.1.1 - 2008.04.01
clause.
2007-05-29 David Lawrence Ramsey <pooka109@gmail.com>
* winio.c (do_mouseinput): Deal with clicks of the first mouse
button again. Oddly, ncurses built without --enable-ext-mouse
needs this, but ncurses built with --enable-ext-mouse doesn't.
2007-05-25 David Lawrence Ramsey <pooka109@gmail.com>
* configure.ac, nano.c (main): Replace the current hackish check
for a UTF-8 locale with a proper call to nl_langinfo().
* winio.c (get_key_buffer): Fix inaccurate comments.
2007-05-22 David Lawrence Ramsey <pooka109@gmail.com>
* browser.c (do_browser), nano.c (do_mouse), prompt.c
(do_statusbar_mouse, do_yesno_prompt), winio.c (do_mouseinput):
Simplify processing of mouse events. Instead of calling
@@ -3324,7 +3419,6 @@ GNU nano 2.1.1 - 2008.04.01
which does both.
2007-05-20 David Lawrence Ramsey <pooka109@gmail.com>
* browser.c (do_browser), nano.c (do_mouse), prompt.c
(do_statusbar_mouse, do_yesno_prompt), winio.c (do_mouseinput):
Fix processing of mouse events so that those we don't handle are
@@ -3335,7 +3429,6 @@ GNU nano 2.1.1 - 2008.04.01
move the cursor if we're in the edit window or on the statusbar.
2007-05-15 David Lawrence Ramsey <pooka109@gmail.com>
* winio.c (do_mouseinput): Add mouse wheel support, per Helmut
Jarausch's suggestion. Now, if mouse support is enabled, and
nano is using a version of ncurses compiled with the
@@ -3343,34 +3436,28 @@ GNU nano 2.1.1 - 2008.04.01
will move the cursor three lines up or down.
2007-04-23 David Lawrence Ramsey <pooka109@gmail.com>
* TODO: Add entries for fixing limitations with pasting text and
handling bad/incomplete UTF-8 sequences.
2007-04-22 David Lawrence Ramsey <pooka109@gmail.com>
* text.c (backup_lines): Avoid a segfault when the mark begins
and ends on the line after the last line of the paragraph.
2007-04-21 David Lawrence Ramsey <pooka109@gmail.com>
* files.c (do_writeout): If we're in restricted mode, we're not
allowed to write selections to files, so don't display the
"Write Selection to File" prompt.
* files.c (do_writeout): Simplify.
2007-04-19 David Lawrence Ramsey <pooka109@gmail.com>
* files.c (tail): Remove unneeded if statement.
2007-04-18 John M. Gabriele <jmg3000@gmail.com>
* doc/faq.html: Add a new section 4.14 (with minor tweaks by
David Lawrence Ramsey) to explain how autoindent affects pasted
text.
2007-04-18 David Lawrence Ramsey <pooka109@gmail.com>
* files.c (open_file): Open files using their full paths
whenever possible, so that ~user/file.txt and "~user/file.txt"
are treated the same way if ~user is a user's home directory.
@@ -3392,7 +3479,6 @@ GNU nano 2.1.1 - 2008.04.01
* winio.c (get_escape_seq_kbinput): Add missing comments.
2007-04-17 David Lawrence Ramsey <pooka109@gmail.com>
* files.c (real_dir_from_tilde): Fix long-standing problem,
found by Justin Fletcher, where directory names that began with
"~", but that weren't users' home directories, could be
@@ -3402,13 +3488,11 @@ GNU nano 2.1.1 - 2008.04.01
less than zero, as it's a size_t and hence unsigned.
2007-04-16 David Lawrence Ramsey <pooka109@gmail.com>
* files.c (real_dir_from_tilde): Fix segfault, found by Justin
Fletcher, when dealing with directory names that begin with "~",
but that aren't users' home directories.
2007-04-11 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/asm.nanorc, doc/syntax/c.nanorc,
doc/syntax/sh.nanorc: Copy the regex that highlights trailing
whitespace (with minor tweaks by David Lawrence Ramsey) from
@@ -3416,13 +3500,11 @@ GNU nano 2.1.1 - 2008.04.01
them.
2007-04-04 David Lawrence Ramsey <pooka109@gmail.com>
* AUTHORS, faq.html: Update email address.
* winio.c (get_escape_seq_kbinput): Add escape sequences for
Terminal.
2007-02-01 Benno Schulenberg <bensberg@justemail.net>
* global.c (shortcut_init): Reword the movement shortcut
descriptions so that they use "Go to" instead of "Move to",
since not all of them move the cursor in the same way.
@@ -3433,7 +3515,6 @@ GNU nano 2.1.1 - 2008.04.01
associated toggle description.
2007-01-29 David Lawrence Ramsey <pooka109@cox.net>
* ChangeLog: Rework the 2.1 branch's changelog to be more
readable, per Jordi Mallach's suggestion.
* ChangeLog.pre-2.1: Move the 2.0 branch's changelog here, per

21
NEWS
View File

@@ -1,11 +1,20 @@
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,
2016.01.11 - GNU nano 2.5.1 "Salzburg" is released. It includes fixes
for a syntax-highlighting bug and a positionlog bug, it
disables a time-eating multiline regex in the C syntax,
and it adds an escape hatch to the WriteOut menu when
--tempfile is used: the discardbuffer command, ^Q. It
also has translation updates for fifteen languages, and
a small fix in the softwrap code. So... you are heartily
invited to upgrade. Enjoy!
2015.12.05 - GNU nano 2.5.0 "Karma", 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
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,
This release includes all of the fixes now in
2.4.3, as well as color syntax highlighting improvements,
undo fixes, and many more improvements! Thank you for
using nano!

View File

@@ -20,7 +20,7 @@
#
# $Id$
AC_INIT([GNU nano], [2.5.0], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [2.5.1], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
@@ -657,9 +657,9 @@ AC_MSG_RESULT(no),
AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling]))
AS_IF([test "x$enable_libmagic" != "xno"], [
AC_CHECK_HEADERS_ONCE([magic.h])
AC_CHECK_HEADERS([magic.h])
AC_CHECK_LIB(magic, magic_open)
AC_CHECK_HEADERS_ONCE([zlib.h])
AC_CHECK_HEADERS([zlib.h])
AC_CHECK_LIB(z, inflate)
])

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.5.0" "December 2015"
.TH NANO 1 "version 2.5.1" "January 2016"
.\" Please adjust this date whenever revising the manpage.
.\"

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.5.0" "December 2015"
.TH NANORC 5 "version 2.5.1" "January 2016"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -574,13 +574,6 @@ Toggles between inserting a file and executing a command.
Toggles between inserting into the current buffer and into a new
empty buffer.
.TP
.B tofiles
Starts the file browser, allowing to select a file from a list.
.TP
.B gotodir
Goes to a directory to be specified, allowing to browse anywhere
in the filesystem.
.TP
.B dosformat
When writing a file, switches to writing a DOS format (CR/LF).
.TP
@@ -596,6 +589,18 @@ When writing a file, 'prepends' (writes at the beginning) instead of overwriting
.B backup
When writing a file, creates a backup of the current file.
.TP
.B discardbuffer
When about to write a file, discard the current buffer without saving.
(This function is bound by default only when option \fB\-\-tempfile\fR
is in effect.)
.TP
.B tofiles
Starts the file browser, allowing to select a file from a list.
.TP
.B gotodir
Goes to a directory to be specified, allowing to browse anywhere
in the filesystem.
.TP
.B firstfile
Goes to the first file when using the file browser (reading or writing files).
.TP

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.5.0" "December 2015"
.TH RNANO 1 "version 2.5.1" "January 2016"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME

View File

@@ -1,4 +1,5 @@
pkgdata_DATA = asm.nanorc \
autoconf.nanorc \
awk.nanorc \
changelog.nanorc \
cmake.nanorc \
@@ -21,6 +22,7 @@ pkgdata_DATA = asm.nanorc \
man.nanorc \
mgp.nanorc \
mutt.nanorc \
nftables.nanorc \
nanorc.nanorc \
objc.nanorc \
ocaml.nanorc \

View File

@@ -12,8 +12,9 @@ color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|
# Strings.
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
# Multiline strings (note: VERY resource intensive).
color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
# Multiline strings. This regex is VERY resource intensive,
# and sometimes colours things that shouldn't be coloured.
###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
# Comments.
color brightblue "//.*"

View File

@@ -1,9 +1,9 @@
## Here is an example for Autoconf.
syntax "autoconf" "\.ac$"
syntax "autoconf" "\.(ac|m4)$"
# Keywords:
color yellow "\<(if|test|then|else|fi|for|in|do|done)\>"
color yellow "\<(if|test|then|elif|else|fi|for|in|do|done)\>"
color yellow "(=|!=|&&|\|\|)"
# Macros:
@@ -25,4 +25,7 @@ color black "^\*\*\*.*"
color magenta "\[|\]|\(|\)"
# Comments:
color blue "^[[:blank:]]*#.*" "^dnl.*"
color blue "^[[:blank:]]*#.*" "\<dnl.*"
# Trailing whitespace:
color ,green "[[:space:]]+$"

View File

@@ -19,8 +19,9 @@ color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidd
# Strings. In general you will want your strings and comments to come last,
# because highlighting rules are applied in the order they are read in.
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
# Multiline strings. This regex is VERY resource intensive!
color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
# Multiline strings. This regex is VERY resource intensive,
# and sometimes colours things that shouldn't be coloured.
###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
# Comments.
color brightblue "//.*"

View File

@@ -25,8 +25,9 @@ color white "\[[^][:space:]]*\]"
color brightblack "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
color brightblack "<[^= ]*>" ""(\\.|[^"])*""
color brightblue "@"(\\.|[^"])*""
# Multiline strings. This regex is VERY resource intensive!
## color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
# Multiline strings. This regex is VERY resource intensive,
# and sometimes colours things that shouldn't be coloured.
###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
# Preprocessor commands.
color brightblue "^[[:space:]]*#[[:space:]]*(define|include|import|(un|ifn?)def|endif|el(if|se)|if|warning|error)"

View File

@@ -2,27 +2,27 @@
syntax "ocaml" "\.mli?$"
#uid
# Uid:
color red "\<[A-Z][0-9a-z_]{2,}\>"
#declarations
# Declarations:
color green "\<(let|val|method|in|and|rec|private|virtual|constraint)\>"
#structure items
# Structure items:
color red "\<(type|open|class|module|exception|external)\>"
#patterns
# Patterns:
color blue "\<(fun|function|functor|match|try|with)\>"
#patterns-modifiers
# Pattern modifiers:
color yellow "\<(as|when|of)\>"
#conditions
# Conditions:
color cyan "\<(if|then|else)\>"
#blocs
# Blocks:
color magenta "\<(begin|end|object|struct|sig|for|while|do|done|to|downto)\>"
#constantes
# Constants:
color green "\<(true|false)\>"
#modules/classes
# Modules/classes:
color green "\<(include|inherit|initializer)\>"
#expr modifiers
# Expression modifiers:
color yellow "\<(new|ref|mutable|lazy|assert|raise)\>"
#comments
# Comments:
color white start="\(\*" end="\*\)"
#strings (no multiline handling yet)
# Strings: (no multiline handling yet)
color brightblack ""[^\"]*""

View File

@@ -6,7 +6,7 @@
@smallbook
@set EDITION 0.3
@set VERSION 2.5.0
@set VERSION 2.5.1
@set UPDATED December 2015
@dircategory Editors
@@ -21,7 +21,7 @@
@titlepage
@title GNU @code{nano}
@subtitle a small and friendly text editor.
@subtitle version 2.5.0
@subtitle version 2.5.1
@author Chris Allegretta
@page
@@ -1159,6 +1159,11 @@ When writing a file, 'prepends' (writes at the beginning) instead of overwriting
@item backup
When writing a file, creates a backup of the current file.
@item discardbuffer
When about to write a file, discard the current buffer without saving.
(This function is bound by default only when option @option{--tempfile}
is in effect.)
@item tofiles
Starts the file browser, allowing to select a file from a list.

796
po/bg.po

File diff suppressed because it is too large Load Diff

869
po/ca.po

File diff suppressed because it is too large Load Diff

910
po/cs.po

File diff suppressed because it is too large Load Diff

797
po/da.po

File diff suppressed because it is too large Load Diff

876
po/de.po

File diff suppressed because it is too large Load Diff

862
po/eo.po

File diff suppressed because it is too large Load Diff

864
po/es.po

File diff suppressed because it is too large Load Diff

796
po/eu.po

File diff suppressed because it is too large Load Diff

797
po/fi.po

File diff suppressed because it is too large Load Diff

911
po/fr.po

File diff suppressed because it is too large Load Diff

796
po/ga.po

File diff suppressed because it is too large Load Diff

797
po/gl.po

File diff suppressed because it is too large Load Diff

1111
po/hu.po

File diff suppressed because it is too large Load Diff

814
po/id.po

File diff suppressed because it is too large Load Diff

797
po/it.po

File diff suppressed because it is too large Load Diff

796
po/ja.po

File diff suppressed because it is too large Load Diff

798
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

872
po/nb.po

File diff suppressed because it is too large Load Diff

879
po/nl.po

File diff suppressed because it is too large Load Diff

814
po/nn.po

File diff suppressed because it is too large Load Diff

924
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

868
po/ro.po

File diff suppressed because it is too large Load Diff

797
po/ru.po

File diff suppressed because it is too large Load Diff

796
po/sl.po

File diff suppressed because it is too large Load Diff

878
po/sr.po

File diff suppressed because it is too large Load Diff

797
po/sv.po

File diff suppressed because it is too large Load Diff

814
po/tr.po

File diff suppressed because it is too large Load Diff

869
po/uk.po

File diff suppressed because it is too large Load Diff

878
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

@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <unistd.h>
#ifdef HAVE_MAGIC_H
@@ -34,31 +35,34 @@
#ifndef DISABLE_COLOR
/* For each syntax list entry, go through the list of colors and assign
* the color pairs. */
/* Initialize the colors for nano's interface, and assign pair numbers
* for the colors in each syntax. */
void set_colorpairs(void)
{
const syntaxtype *this_syntax = syntaxes;
bool defok = FALSE;
short fg, bg;
bool using_defaults = FALSE;
short foreground, background;
size_t i;
/* Tell ncurses to enable colors. */
start_color();
#ifdef HAVE_USE_DEFAULT_COLORS
/* Use the default colors, if available. */
defok = (use_default_colors() != ERR);
/* Allow using the default colors, if available. */
using_defaults = (use_default_colors() != ERR);
#endif
/* Initialize the color pairs for nano's interface elements. */
for (i = 0; i < NUMBER_OF_ELEMENTS; i++) {
bool bright = FALSE;
if (parse_color_names(specified_color_combo[i], &fg, &bg, &bright)) {
if (fg == -1 && !defok)
fg = COLOR_WHITE;
if (bg == -1 && !defok)
bg = COLOR_BLACK;
init_pair(i + 1, fg, bg);
if (parse_color_names(specified_color_combo[i],
&foreground, &background, &bright)) {
if (foreground == -1 && !using_defaults)
foreground = COLOR_WHITE;
if (background == -1 && !using_defaults)
background = COLOR_BLACK;
init_pair(i + 1, foreground, background);
interface_color_pair[i].bright = bright;
interface_color_pair[i].pairnum = COLOR_PAIR(i + 1);
}
@@ -74,6 +78,8 @@ void set_colorpairs(void)
specified_color_combo[i] = NULL;
}
/* For each syntax, go through its list of colors and assign each
* its pair number, giving identical color pairs the same number. */
for (; this_syntax != NULL; this_syntax = this_syntax->next) {
colortype *this_color = this_syntax->color;
int clr_pair = NUMBER_OF_ELEMENTS + 1;
@@ -81,12 +87,11 @@ void set_colorpairs(void)
for (; this_color != NULL; this_color = this_color->next) {
const colortype *beforenow = this_syntax->color;
for (; beforenow != this_color &&
(beforenow->fg != this_color->fg ||
beforenow->bg != this_color->bg ||
beforenow->bright != this_color->bright);
beforenow = beforenow->next)
;
while (beforenow != this_color &&
(beforenow->fg != this_color->fg ||
beforenow->bg != this_color->bg ||
beforenow->bright != this_color->bright))
beforenow = beforenow->next;
if (beforenow != this_color)
this_color->pairnum = beforenow->pairnum;
@@ -101,38 +106,36 @@ void set_colorpairs(void)
/* Initialize the color information. */
void color_init(void)
{
colortype *tmpcolor = openfile->colorstrings;
bool using_defaults = FALSE;
short foreground, background;
assert(openfile != NULL);
if (has_colors()) {
const colortype *tmpcolor;
/* If the terminal is not capable of colors, forget it. */
if (!has_colors())
return;
#ifdef HAVE_USE_DEFAULT_COLORS
/* Use the default colors, if available. */
bool defok = (use_default_colors() != ERR);
/* Allow using the default colors, if available. */
using_defaults = (use_default_colors() != ERR);
#endif
for (tmpcolor = openfile->colorstrings; tmpcolor != NULL;
tmpcolor = tmpcolor->next) {
short foreground = tmpcolor->fg, background = tmpcolor->bg;
if (foreground == -1) {
#ifdef HAVE_USE_DEFAULT_COLORS
if (!defok)
#endif
foreground = COLOR_WHITE;
}
/* For each coloring expression, initialize the color pair. */
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
foreground = tmpcolor->fg;
background = tmpcolor->bg;
if (background == -1) {
#ifdef HAVE_USE_DEFAULT_COLORS
if (!defok)
#endif
background = COLOR_BLACK;
}
if (foreground == -1 && !using_defaults)
foreground = COLOR_WHITE;
init_pair(tmpcolor->pairnum, foreground, background);
if (background == -1 && !using_defaults)
background = COLOR_BLACK;
init_pair(tmpcolor->pairnum, foreground, background);
#ifdef DEBUG
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", tmpcolor->fg, tmpcolor->bg);
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", foreground, background);
#endif
}
}
}
@@ -414,7 +417,8 @@ void reset_multis(filestruct *fileptr, bool force)
regmatch_t startmatch, endmatch;
const colortype *tmpcolor = openfile->colorstrings;
if (!openfile->syntax)
/* If there is no syntax or no multiline regex, there is nothing to do. */
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0)
return;
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
@@ -448,4 +452,151 @@ void reset_multis(filestruct *fileptr, bool force)
}
}
/* Allocate (for one line) the cache space for multiline color regexes. */
void alloc_multidata_if_needed(filestruct *fileptr)
{
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;
}
}
/* Poll the keyboard every second to see if the user starts typing. */
bool key_was_pressed(void)
{
static time_t last_time = 0;
if (time(NULL) != last_time) {
last_time = time(NULL);
return (wgetch(edit) != ERR);
} else
return FALSE;
}
/* Precalculate the multi-line start and end regex info so we can
* speed up rendering (with any hope at all...). */
void precalc_multicolorinfo(void)
{
const colortype *tmpcolor = openfile->colorstrings;
regmatch_t startmatch, endmatch;
filestruct *fileptr, *endptr;
if (openfile->colorstrings == NULL || ISSET(NO_COLOR_SYNTAX))
return;
#ifdef DEBUG
fprintf(stderr, "Entering precalculation of multiline color info\n");
#endif
/* Let us get keypresses to see if the user is trying to start
* editing. Later we may want to throw up a statusbar message
* before starting this if it takes too long to do this routine.
* For now silently abort if they hit a key. */
nodelay(edit, TRUE);
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
/* If this is not a multi-line regex, skip it. */
if (tmpcolor->end == NULL)
continue;
#ifdef DEBUG
fprintf(stderr, "Starting work on color id %d\n", tmpcolor->id);
#endif
for (fileptr = openfile->fileage; fileptr != NULL; fileptr = fileptr->next) {
int startx = 0, nostart = 0;
if (key_was_pressed())
goto precalc_cleanup;
#ifdef DEBUG
fprintf(stderr, "working on lineno %ld... ", (long)fileptr->lineno);
#endif
alloc_multidata_if_needed(fileptr);
while ((nostart = regexec(tmpcolor->start, &fileptr->data[startx],
1, &startmatch, (startx == 0) ? 0 : REG_NOTBOL)) == 0) {
/* Look for an end, and start marking how many lines are
* encompassed, which should speed up rendering later. */
startx += startmatch.rm_eo;
#ifdef DEBUG
fprintf(stderr, "start found at pos %lu... ", (unsigned long)startx);
#endif
/* Look first on this line for an end. */
if (regexec(tmpcolor->end, &fileptr->data[startx], 1,
&endmatch, (startx == 0) ? 0 : REG_NOTBOL) == 0) {
startx += endmatch.rm_eo;
/* Step ahead when both start and end are mere anchors. */
if (startmatch.rm_so == startmatch.rm_eo &&
endmatch.rm_so == endmatch.rm_eo)
startx += 1;
fileptr->multidata[tmpcolor->id] = CSTARTENDHERE;
#ifdef DEBUG
fprintf(stderr, "end found on this line\n");
#endif
continue;
}
/* Nice, we didn't find the end regex on this line. Let's start looking for it. */
for (endptr = fileptr->next; endptr != NULL; endptr = endptr->next) {
#ifdef DEBUG
fprintf(stderr, "\nadvancing to line %ld to find end... ", (long)endptr->lineno);
#endif
/* Check for interrupting keyboard input again. */
if (key_was_pressed())
goto precalc_cleanup;
if (regexec(tmpcolor->end, endptr->data, 1, &endmatch, 0) == 0)
break;
}
if (endptr == NULL) {
#ifdef DEBUG
fprintf(stderr, "no end found, breaking out\n");
#endif
break;
}
#ifdef DEBUG
fprintf(stderr, "end found\n");
#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;
#ifdef DEBUG
fprintf(stderr, "marking line %ld as CENDAFTER\n", (long)fileptr->lineno);
#endif
for (fileptr = fileptr->next; fileptr != endptr; fileptr = fileptr->next) {
alloc_multidata_if_needed(fileptr);
fileptr->multidata[tmpcolor->id] = CWHOLELINE;
#ifdef DEBUG
fprintf(stderr, "marking intermediary line %ld as CWHOLELINE\n", (long)fileptr->lineno);
#endif
}
alloc_multidata_if_needed(endptr);
fileptr->multidata[tmpcolor->id] = CBEGINBEFORE;
#ifdef DEBUG
fprintf(stderr, "marking line %ld as CBEGINBEFORE\n", (long)fileptr->lineno);
#endif
/* Skip to the end point of the match. */
startx = endmatch.rm_eo;
#ifdef DEBUG
fprintf(stderr, "jumping to line %ld pos %lu to continue\n", (long)fileptr->lineno, (unsigned long)startx);
#endif
}
if (nostart && startx == 0) {
#ifdef DEBUG
fprintf(stderr, "no match\n");
#endif
fileptr->multidata[tmpcolor->id] = CNONE;
continue;
}
}
}
precalc_cleanup:
nodelay(edit, FALSE);
}
#endif /* !DISABLE_COLOR */

View File

@@ -323,7 +323,7 @@ int do_lockfile(const char *filename)
/* If it's not "", filename is a file to open. We make a new buffer, if
* necessary, and then open and read the file, if applicable. */
void open_buffer(const char *filename, bool undoable)
bool open_buffer(const char *filename, bool undoable)
{
bool quiet = FALSE;
bool new_buffer = (openfile == NULL
@@ -343,7 +343,7 @@ void open_buffer(const char *filename, bool undoable)
if (check_operating_dir(filename, FALSE)) {
statusbar(_("Can't insert file from outside of %s"),
operating_dir);
return;
return FALSE;
}
#endif
@@ -358,7 +358,7 @@ void open_buffer(const char *filename, bool undoable)
else
statusbar(_("\"%s\" is not a normal file"), filename);
beep();
return;
return FALSE;
}
}
@@ -374,7 +374,7 @@ void open_buffer(const char *filename, bool undoable)
#ifndef DISABLE_MULTIBUFFER
if (openfile->next) {
close_buffer(TRUE);
return;
return FALSE;
}
#endif
} else if (lockstatus == 0) {
@@ -421,6 +421,7 @@ void open_buffer(const char *filename, bool undoable)
if (new_buffer)
color_update();
#endif
return TRUE;
}
#ifndef DISABLE_SPELLER
@@ -456,9 +457,14 @@ void display_buffer(void)
titlebar(NULL);
#ifndef DISABLE_COLOR
/* Make sure we're using the buffer's associated colors, if
* applicable. */
/* Make sure we're using the buffer's associated colors. */
color_init();
/* If there are multiline coloring regexes, and there is no
* multiline cache data yet, precalculate it now. */
if (openfile->syntax && openfile->syntax->nmultis > 0 &&
openfile->fileage->multidata == NULL)
precalc_multicolorinfo();
#endif
/* Update the edit window. */
@@ -466,23 +472,21 @@ void display_buffer(void)
}
#ifndef DISABLE_MULTIBUFFER
/* Switch to the next file buffer if next_buf is TRUE. Otherwise,
* switch to the previous file buffer. */
void switch_to_prevnext_buffer(bool next_buf, bool quiet)
/* Switch to a neighbouring file buffer; to the next if to_next is TRUE;
* otherwise, to the previous one. */
void switch_to_prevnext_buffer(bool to_next, bool quiet)
{
assert(openfile != NULL);
/* If only one file buffer is open, indicate it on the statusbar and
* get out. */
/* If only one file buffer is open, say so and get out. */
if (openfile == openfile->next) {
if (quiet == FALSE)
if (!quiet)
statusbar(_("No more open file buffers"));
return;
}
/* Switch to the next or previous file buffer, depending on the
* value of next_buf. */
openfile = next_buf ? openfile->next : openfile->prev;
/* Switch to the next or previous file buffer. */
openfile = to_next ? openfile->next : openfile->prev;
#ifdef DEBUG
fprintf(stderr, "filename is %s\n", openfile->filename);
@@ -492,7 +496,7 @@ void switch_to_prevnext_buffer(bool next_buf, bool quiet)
display_buffer();
/* Indicate the switch on the statusbar. */
if (quiet == FALSE)
if (!quiet)
statusbar(_("Switched to %s"),
((openfile->filename[0] == '\0') ?
_("New Buffer") : openfile->filename));
@@ -585,12 +589,9 @@ int is_file_writable(const char *filename)
return ans;
}
/* We make a new line of text from buf. buf is length buf_len. If
* first_line_ins is TRUE, then we put the new line at the top of the
* file. Otherwise, we assume prevnode is the last line of the file,
* and put our line after prevnode. */
filestruct *read_line(char *buf, filestruct *prevnode, bool
*first_line_ins, size_t buf_len)
/* Make a new line of text from the given buf, which is of length buf_len.
* Then attach this line after prevnode. */
filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode)
{
filestruct *fileptr = (filestruct *)nmalloc(sizeof(filestruct));
@@ -612,20 +613,17 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool
fileptr->multidata = NULL;
#endif
if (*first_line_ins) {
fileptr->prev = prevnode;
if (prevnode == NULL) {
/* Special case: we're inserting into the first line. */
fileptr->prev = NULL;
fileptr->next = openfile->fileage;
openfile->fileage = fileptr;
fileptr->lineno = 1;
/* Make sure that our edit window stays on the first line. */
openfile->edittop = fileptr;
*first_line_ins = FALSE;
} else {
assert(prevnode != NULL);
prevnode->next = fileptr;
fileptr->prev = prevnode;
fileptr->next = NULL;
fileptr->lineno = prevnode->lineno + 1;
}
@@ -652,10 +650,8 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
/* The current input character. */
char *buf;
/* The buffer where we store chunks of the file. */
filestruct *fileptr = openfile->current;
/* The current line of the file. */
bool first_line_ins = FALSE;
/* Whether we're inserting with the cursor on the first line. */
filestruct *fileptr = openfile->current->prev;
/* The line after which to start inserting. */
int input_int;
/* The current value we read from the file, whether an input
* character or EOF. */
@@ -676,11 +672,6 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
add_undo(INSERT);
#endif
if (openfile->current == openfile->fileage)
first_line_ins = TRUE;
else
fileptr = openfile->current->prev;
/* Read the entire file into the filestruct. */
while ((input_int = getc(f)) != EOF) {
input = (char)input_int;
@@ -701,7 +692,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
#endif
/* Read in the line properly. */
fileptr = read_line(buf, fileptr, &first_line_ins, len);
fileptr = read_line(buf, len, fileptr);
/* Reset the line length in preparation for the next line. */
len = 0;
@@ -722,7 +713,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
format += 2;
/* Read in the line properly. */
fileptr = read_line(buf, fileptr, &first_line_ins, len);
fileptr = read_line(buf, len, fileptr);
/* Reset the line length in preparation for the next line.
* Since we've already read in the next character, reset it
@@ -788,17 +779,12 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
#endif
/* Read in the last line properly. */
fileptr = read_line(buf, fileptr, &first_line_ins, len);
fileptr = read_line(buf, len, fileptr);
num_lines++;
}
free(buf);
/* If we didn't get a file and we don't already have one, open a
* blank buffer. */
if (fileptr == NULL)
open_buffer("", FALSE);
/* Attach the file we got to the filestruct. If we got a file of
* zero bytes, don't do anything. */
if (num_lines > 0) {
@@ -1221,7 +1207,7 @@ void do_insertfile(
!execute &&
#endif
check_poshistory(answer, &savedposline, &savedposcol))
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE, FALSE, FALSE);
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE);
} else
#endif /* !DISABLE_MULTIBUFFER && !DISABLE_HISTORIES */
{
@@ -2221,11 +2207,11 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
#endif /* !NANO_TINY */
/* Write the current file to disk. If the mark is on, write the current
* marked selection to disk. If exiting is TRUE, write the file to disk
* regardless of whether the mark is on, and without prompting if the
* TEMP_FILE flag is set and the current file has a name. Return TRUE
* on success or FALSE on error. */
bool do_writeout(bool exiting)
* marked selection to disk. If exiting is TRUE, write the entire file
* to disk regardless of whether the mark is on, and without prompting if
* the TEMP_FILE flag is set and the current file has a name. Return 0
* on error, 1 on success, and 2 when the buffer is to be discarded. */
int do_writeout(bool exiting)
{
int i;
append_type append = OVERWRITE;
@@ -2234,15 +2220,13 @@ bool do_writeout(bool exiting)
#ifndef DISABLE_EXTRA
static bool did_credits = FALSE;
#endif
bool retval = FALSE;
bool result = FALSE;
if (openfile->filename[0] != '\0' && ISSET(TEMP_FILE)) {
retval = write_file(openfile->filename, NULL, FALSE, OVERWRITE,
FALSE);
if (exiting && openfile->filename[0] != '\0' && ISSET(TEMP_FILE)) {
result = write_file(openfile->filename, NULL, FALSE, OVERWRITE, FALSE);
/* Write succeeded. */
if (retval)
return retval;
if (result)
return 1; /* The write succeeded. */
}
ans = mallocstrcpy(NULL,
@@ -2275,14 +2259,6 @@ bool do_writeout(bool exiting)
(append == APPEND) ? _("File Name to Append to") :
_("File Name to Write");
/* If we're not exiting, and the TEMP_FILE flag is set, and
* the current file doesn't have a name, warn the user before
* prompting for a name. If we are exiting, we've already
* warned the user just before the "Save modified buffer"
* prompt, so we don't need to do it again. */
if (!exiting && openfile->filename[0] == '\0' && ISSET(TEMP_FILE))
no_current_file_name_warning();
/* If we're using restricted mode, the filename isn't blank,
* and we're at the "Write File" prompt, disable tab
* completion. */
@@ -2307,11 +2283,25 @@ bool do_writeout(bool exiting)
* encoded null), treat it as though it's blank. */
if (i < 0 || *answer == '\n') {
statusbar(_("Cancelled"));
retval = FALSE;
break;
} else {
functionptrtype func = func_from_key(&i);
/* Upon request, abandon the buffer, if user is sure. */
if (func == discard_buffer) {
if (openfile->modified)
i = do_yesno_prompt(FALSE,
_("Save modified buffer anyway ? "));
else
i = 0;
if (i == 0) {
free(ans);
return 2; /* Yes, discard the buffer. */
} else
continue; /* Go back to the filename prompt. */
}
ans = mallocstrcpy(ans, answer);
#ifndef DISABLE_BROWSER
@@ -2365,7 +2355,6 @@ bool do_writeout(bool exiting)
strcasecmp(answer, "zzy") == 0) {
do_credits();
did_credits = TRUE;
retval = FALSE;
break;
}
#endif
@@ -2449,7 +2438,7 @@ bool do_writeout(bool exiting)
* a separate file. If we're using restricted mode, this
* function is disabled, since it allows reading from or
* writing to files not specified on the command line. */
retval =
result =
#ifndef NANO_TINY
(!ISSET(RESTRICTED) && !exiting && openfile->mark_set) ?
write_marked_file(answer, NULL, FALSE, append) :
@@ -2462,14 +2451,16 @@ bool do_writeout(bool exiting)
free(ans);
return retval;
return result ? 1 : 0;
}
/* Write the current file to disk. If the mark is on, write the current
* marked selection to disk. */
/* Write the current buffer to disk, or discard it. */
void do_writeout_void(void)
{
do_writeout(FALSE);
/* If the user chose to discard the buffer, close it. */
if (do_writeout(FALSE) == 2)
close_and_go();
display_main_list();
}
@@ -3095,15 +3086,15 @@ void save_history(void)
FILE *hist = fopen(nanohist, "wb");
if (hist == NULL)
history_error(N_("Error writing %s: %s"), nanohist,
strerror(errno));
fprintf(stderr, _("Error writing %s: %s\n"), nanohist,
strerror(errno));
else {
/* Make sure no one else can read from or write to the
* history file. */
chmod(nanohist, S_IRUSR | S_IWUSR);
if (!writehist(hist, searchage) || !writehist(hist, replaceage))
history_error(N_("Error writing %s: %s"), nanohist,
fprintf(stderr, _("Error writing %s: %s\n"), nanohist,
strerror(errno));
fclose(hist);
@@ -3126,8 +3117,8 @@ void save_poshistory(void)
FILE *hist = fopen(poshist, "wb");
if (hist == NULL)
history_error(N_("Error writing %s: %s"), poshist,
strerror(errno));
fprintf(stderr, _("Error writing %s: %s\n"), poshist,
strerror(errno));
else {
/* Make sure no one else can read from or write to the
* history file. */
@@ -3138,8 +3129,8 @@ void save_poshistory(void)
sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno,
(long)posptr->xno);
if (fwrite(statusstr, sizeof(char), strlen(statusstr), hist) < strlen(statusstr))
history_error(N_("Error writing %s: %s"), poshist,
strerror(errno));
fprintf(stderr, _("Error writing %s: %s\n"), poshist,
strerror(errno));
free(statusstr);
}
fclose(hist);

View File

@@ -270,6 +270,9 @@ void prepend_void(void)
void backup_file_void(void)
{
}
void discard_buffer(void)
{
}
void new_buffer_void(void)
{
}
@@ -438,20 +441,21 @@ void assign_keyinfo(sc *s)
s->seq = KEY_DC;
else if (!strcasecmp(s->keystr, "Bsp"))
s->seq = KEY_BACKSPACE;
/* The Tab and Enter keys don't actually produce special codes
* but the exact integer values of ^I and ^M. Rebinding the
* latter therefore also rebinds Tab and Enter. */
else if (!strcasecmp(s->keystr, "Tab"))
s->seq = NANO_CONTROL_I;
else if (!strcasecmp(s->keystr, "Enter"))
s->seq = KEY_ENTER;
else if (!strcasecmp(s->keystr, "PgUp"))
s->seq = KEY_PPAGE;
else if (!strcasecmp(s->keystr, "PgDn"))
s->seq = KEY_NPAGE;
#ifdef KEY_HOME
else if (!strcasecmp(s->keystr, "Home"))
s->seq = KEY_HOME;
#endif
#ifdef KEY_END
else if (!strcasecmp(s->keystr, "End"))
s->seq = KEY_END;
#endif
}
}
@@ -632,6 +636,7 @@ void shortcut_init(void)
const char *nano_backup_msg = N_("Toggle backing up of the original file");
const char *nano_execute_msg = N_("Execute external command");
#endif
const char *nano_discard_buffer_msg = N_("Close buffer without saving it");
#ifndef DISABLE_MULTIBUFFER
const char *nano_multibuffer_msg = N_("Toggle the use of a new buffer");
#endif
@@ -659,12 +664,6 @@ void shortcut_init(void)
#define IFSCHELP(help) ""
#endif
while (allfuncs != NULL) {
subnfunc *f = allfuncs;
allfuncs = allfuncs->next;
free(f);
}
/* Start populating the different menus with functions. */
add_to_funcs(do_help_void, MMOST,
@@ -1006,6 +1005,9 @@ void shortcut_init(void)
N_("Last File"), IFSCHELP(nano_lastfile_msg), BLANKAFTER, VIEW);
#endif
add_to_funcs(discard_buffer, MWRITEFILE,
N_("Discard buffer"), IFSCHELP(nano_discard_buffer_msg), BLANKAFTER, NOVIEW);
#if !defined(NANO_TINY) && !defined(DISABLE_BROWSER)
add_to_funcs(do_research, MBROWSER,
whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
@@ -1197,6 +1199,8 @@ void shortcut_init(void)
add_to_sclist(MBROWSER, "M-G", goto_dir_void, 0);
add_to_sclist(MBROWSER, "F13", goto_dir_void, 0);
#endif
if (ISSET(TEMP_FILE))
add_to_sclist(MWRITEFILE, "^Q", discard_buffer, 0);
add_to_sclist(MWRITEFILE, "M-D", dos_format_void, 0);
add_to_sclist(MWRITEFILE, "M-M", mac_format_void, 0);
if (!ISSET(RESTRICTED)) {
@@ -1222,6 +1226,7 @@ void shortcut_init(void)
add_to_sclist(MHELP, "End", do_last_line, 0);
#endif
add_to_sclist(MMOST, "^I", do_tab, 0);
add_to_sclist(MMOST, "Tab", do_tab, 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);
@@ -1257,12 +1262,12 @@ void set_spell_shortcuts(void)
}
#endif
const subnfunc *sctofunc(sc *s)
const subnfunc *sctofunc(const sc *s)
{
subnfunc *f;
subnfunc *f = allfuncs;
for (f = allfuncs; f != NULL && s->scfunc != f->scfunc; f = f->next)
;
while (f != NULL && f->scfunc != s->scfunc)
f = f->next;
return f;
}
@@ -1318,7 +1323,7 @@ const char *flagtostr(int flag)
#ifndef DISABLE_NANORC
/* Interpret a function string given in the rc file, and return a
* shortcut struct with the corresponding function filled in. */
sc *strtosc(char *input)
sc *strtosc(const char *input)
{
sc *s;
@@ -1333,6 +1338,8 @@ sc *strtosc(char *input)
s->scfunc = do_cancel;
else if (!strcasecmp(input, "exit"))
s->scfunc = do_exit;
else if (!strcasecmp(input, "discardbuffer"))
s->scfunc = discard_buffer;
else if (!strcasecmp(input, "writeout"))
s->scfunc = do_writeout_void;
#ifndef NANO_TINY
@@ -1569,7 +1576,7 @@ sc *strtosc(char *input)
}
/* Interpret a menu name and return the corresponding menu flag. */
int strtomenu(char *input)
int strtomenu(const char *input)
{
if (!strcasecmp(input, "all"))
return (MMOST|MHELP|MYESNO);

View File

@@ -460,10 +460,12 @@ void do_down(
#endif
/* If we're at the bottom of the file, get out. */
if (openfile->current == openfile->filebot || !openfile->current->next)
if (openfile->current == openfile->filebot)
return;
assert(ISSET(SOFTWRAP) || openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
assert(ISSET(SOFTWRAP) || openfile->current_y ==
openfile->current->lineno - openfile->edittop->lineno);
assert(openfile->current->next != NULL);
/* Move the current line of the edit window down. */
openfile->current = openfile->current->next;

View File

@@ -31,7 +31,6 @@
#include <errno.h>
#include <ctype.h>
#include <locale.h>
#include <time.h>
#ifdef ENABLE_UTF8
#include <langinfo.h>
#endif
@@ -104,9 +103,13 @@ void splice_node(filestruct *afterthis, filestruct *newnode)
if (afterthis->next != NULL)
afterthis->next->prev = newnode;
afterthis->next = newnode;
/* Update filebot when inserting a node at the end of file. */
if (openfile && openfile->filebot == afterthis)
openfile->filebot = newnode;
}
/* Unlink a node from the rest of the filestruct and delete it. */
/* Disconnect a node from a linked list of filestructs and delete it. */
void unlink_node(filestruct *fileptr)
{
assert(fileptr != NULL);
@@ -116,10 +119,14 @@ void unlink_node(filestruct *fileptr)
if (fileptr->next != NULL)
fileptr->next->prev = fileptr->prev;
/* Update filebot when removing a node at the end of file. */
if (openfile && openfile->filebot == fileptr)
openfile->filebot = fileptr->prev;
delete_node(fileptr);
}
/* Delete a node from the filestruct. */
/* Free the data structures in the given node. */
void delete_node(filestruct *fileptr)
{
assert(fileptr != NULL && fileptr->data != NULL);
@@ -957,7 +964,7 @@ void usage(void)
void version(void)
{
printf(_(" GNU nano, version %s\n"), VERSION);
printf(" (C) 1999..2015 Free Software Foundation, Inc.\n");
printf(" (C) 1999..2016 Free Software Foundation, Inc.\n");
printf(
_(" Email: nano@nano-editor.org Web: http://www.nano-editor.org/"));
printf(_("\n Compiled options:"));
@@ -1139,25 +1146,29 @@ void do_exit(void)
/* If the user chose not to save, or if the user chose to save and
* the save succeeded, we're ready to exit. */
if (i == 0 || (i == 1 && do_writeout(TRUE))) {
#ifndef NANO_TINY
if (ISSET(LOCKING) && openfile->lock_filename)
delete_lockfile(openfile->lock_filename);
#endif
#ifndef DISABLE_MULTIBUFFER
/* Exit only if there are no more open file buffers. */
if (!close_buffer(FALSE))
#endif
finish();
/* If the user canceled, we go on. */
} else if (i != 1)
if (i == 0 || (i == 1 && do_writeout(TRUE)))
close_and_go();
else if (i != 1)
statusbar(_("Cancelled"));
display_main_list();
}
/* Close the current buffer, and terminate nano if it was the last. */
void close_and_go(void)
{
#ifndef NANO_TINY
/* If there is a lockfile, remove it. */
if (ISSET(LOCKING) && openfile->lock_filename)
delete_lockfile(openfile->lock_filename);
#endif
#ifndef DISABLE_MULTIBUFFER
/* If there are no more open file buffers, jump off a cliff. */
if (!close_buffer(FALSE))
#endif
finish();
}
/* Another placeholder for function mapping. */
void do_cancel(void)
{
@@ -1408,10 +1419,9 @@ void regenerate_screen(void)
total_refresh();
}
/* 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)
/* If allow is FALSE, block any SIGWINCH signal. If allow is TRUE,
* unblock SIGWINCH so any pending ones can be dealt with. */
void allow_sigwinch(bool allow)
{
sigset_t winch;
@@ -1653,7 +1663,6 @@ int do_input(bool allow_funcs)
kbinput = (int *)nrealloc(kbinput, kbinput_len *
sizeof(int));
kbinput[kbinput_len - 1] = input;
}
}
@@ -1692,6 +1701,7 @@ int do_input(bool allow_funcs)
}
if (have_shortcut) {
const subnfunc *f = sctofunc(s);
/* If the function associated with this shortcut is
* cutting or copying text, remember this. */
if (s->scfunc == do_cut_text_void
@@ -1701,34 +1711,35 @@ int do_input(bool allow_funcs)
)
preserve = TRUE;
if (s->scfunc != 0) {
const subnfunc *f = sctofunc((sc *) s);
if (ISSET(VIEW_MODE) && f && !f->viewok)
print_view_warning();
else {
if (s->scfunc == NULL) {
statusbar("Internal error: shortcut without function!");
return ERR;
}
if (ISSET(VIEW_MODE) && f && !f->viewok)
print_view_warning();
else {
#ifndef NANO_TINY
if (s->scfunc == do_toggle_void) {
do_toggle(s->toggle);
if (s->toggle != CUT_TO_END)
preserve = TRUE;
} else
if (s->scfunc == do_toggle_void) {
do_toggle(s->toggle);
if (s->toggle != CUT_TO_END)
preserve = TRUE;
} else
#endif
{
/* Execute the function of the shortcut. */
s->scfunc();
{
/* Execute the function of the shortcut. */
s->scfunc();
#ifndef DISABLE_COLOR
if (f && !f->viewok && openfile->syntax != NULL
&& openfile->syntax->nmultis > 0)
reset_multis(openfile->current, FALSE);
if (f && !f->viewok)
reset_multis(openfile->current, FALSE);
#endif
if (edit_refresh_needed) {
if (edit_refresh_needed) {
#ifdef DEBUG
fprintf(stderr, "running edit_refresh() as edit_refresh_needed is true\n");
fprintf(stderr, "running edit_refresh() as edit_refresh_needed is true\n");
#endif
edit_refresh();
edit_refresh_needed = FALSE;
}
}
edit_refresh();
edit_refresh_needed = FALSE;
} else if (s->scfunc == do_delete || s->scfunc == do_backspace)
update_line(openfile->current, openfile->current_x);
}
}
}
@@ -1846,146 +1857,6 @@ int do_mouse(void)
}
#endif /* !DISABLE_MOUSE */
#ifndef DISABLE_COLOR
void alloc_multidata_if_needed(filestruct *fileptr)
{
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
* speed up rendering (with any hope at all...). */
void precalc_multicolorinfo(void)
{
#ifdef DEBUG
fprintf(stderr, "Entering precalculation of multiline color info\n");
#endif
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
const colortype *tmpcolor = openfile->colorstrings;
regmatch_t startmatch, endmatch;
filestruct *fileptr, *endptr;
time_t last_check = time(NULL), cur_check = 0;
/* Let us get keypresses to see if the user is trying to start
* editing. Later we may want to throw up a statusbar message
* before starting this if it takes too long to do this routine.
* For now silently abort if they hit a key. */
nodelay(edit, TRUE);
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
/* If it's not a multi-line regex, amscray. */
if (tmpcolor->end == NULL)
continue;
#ifdef DEBUG
fprintf(stderr, "Starting work on color id %d\n", tmpcolor->id);
#endif
for (fileptr = openfile->fileage; fileptr != NULL; fileptr = fileptr->next) {
int startx = 0;
int nostart = 0;
#ifdef DEBUG
fprintf(stderr, "working on lineno %ld... ", (long)fileptr->lineno);
#endif
alloc_multidata_if_needed(fileptr);
if ((cur_check = time(NULL)) - last_check > 1) {
last_check = cur_check;
if (wgetch(edit) != ERR)
goto precalc_cleanup;
}
while ((nostart = regexec(tmpcolor->start, &fileptr->data[startx], 1, &startmatch,
(startx == 0) ? 0 : REG_NOTBOL)) == 0) {
/* Look for an end, and start marking how many lines are
* encompassed, which should speed up rendering later. */
startx += startmatch.rm_eo;
#ifdef DEBUG
fprintf(stderr, "start found at pos %lu... ", (unsigned long)startx);
#endif
/* Look first on this line for an end. */
if (regexec(tmpcolor->end, &fileptr->data[startx], 1, &endmatch,
(startx == 0) ? 0 : REG_NOTBOL) == 0) {
startx += endmatch.rm_eo;
fileptr->multidata[tmpcolor->id] = CSTARTENDHERE;
#ifdef DEBUG
fprintf(stderr, "end found on this line\n");
#endif
continue;
}
/* Nice, we didn't find the end regex on this line. Let's start looking for it. */
for (endptr = fileptr->next; endptr != NULL; endptr = endptr->next) {
#ifdef DEBUG
fprintf(stderr, "\nadvancing to line %ld to find end... ", (long)endptr->lineno);
#endif
/* Check for keyboard input, again. */
if ((cur_check = time(NULL)) - last_check > 1) {
last_check = cur_check;
if (wgetch(edit) != ERR)
goto precalc_cleanup;
}
if (regexec(tmpcolor->end, endptr->data, 1, &endmatch, 0) == 0)
break;
}
if (endptr == NULL) {
#ifdef DEBUG
fprintf(stderr, "no end found, breaking out\n");
#endif
break;
}
#ifdef DEBUG
fprintf(stderr, "end found\n");
#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;
#ifdef DEBUG
fprintf(stderr, "marking line %ld as CENDAFTER\n", (long)fileptr->lineno);
#endif
for (fileptr = fileptr->next; fileptr != endptr; fileptr = fileptr->next) {
alloc_multidata_if_needed(fileptr);
fileptr->multidata[tmpcolor->id] = CWHOLELINE;
#ifdef DEBUG
fprintf(stderr, "marking intermediary line %ld as CWHOLELINE\n", (long)fileptr->lineno);
#endif
}
alloc_multidata_if_needed(endptr);
fileptr->multidata[tmpcolor->id] = CBEGINBEFORE;
#ifdef DEBUG
fprintf(stderr, "marking line %ld as CBEGINBEFORE\n", (long)fileptr->lineno);
#endif
/* Skip to the end point of the match. */
startx = endmatch.rm_eo;
#ifdef DEBUG
fprintf(stderr, "jumping to line %ld pos %lu to continue\n", (long)fileptr->lineno, (unsigned long)startx);
#endif
}
if (nostart && startx == 0) {
#ifdef DEBUG
fprintf(stderr, "no match\n");
#endif
fileptr->multidata[tmpcolor->id] = CNONE;
continue;
}
}
}
}
precalc_cleanup:
nodelay(edit, FALSE);
}
#endif /* !DISABLE_COLOR */
/* The user typed output_len multibyte characters. Add them to the edit
* buffer, filtering out all ASCII control characters if allow_cntrls is
* TRUE. */
@@ -2074,14 +1945,6 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#endif
}
#ifndef DISABLE_COLOR
/* 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
* line length to be a new multiple of COLS. */
@@ -2097,6 +1960,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#ifndef DISABLE_COLOR
reset_multis(openfile->current, FALSE);
#endif
if (edit_refresh_needed == TRUE) {
edit_refresh();
edit_refresh_needed = FALSE;
@@ -2707,11 +2571,14 @@ int main(int argc, char **argv)
#endif
#if !defined(NANO_TINY) && defined(HAVE_KEY_DEFINED)
const char *keyvalue;
/* 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"));
keyvalue = tigetstr("kLFT5");
if (keyvalue != 0 && keyvalue != (char *)-1)
controlleft = key_defined(keyvalue);
keyvalue = tigetstr("kRIT5");
if (keyvalue != 0 && keyvalue != (char *)-1)
controlright = key_defined(keyvalue);
#endif
#ifdef DEBUG
@@ -2748,11 +2615,13 @@ int main(int argc, char **argv)
if (i < argc - 1 && argv[i][0] == '+')
parse_line_column(&argv[i][1], &iline, &icol);
else {
open_buffer(argv[i], FALSE);
/* If opening fails, don't try to position the cursor. */
if (!open_buffer(argv[i], FALSE))
continue;
/* If a position was given on the command line, go there. */
if (iline > 0 || icol > 0) {
do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE, FALSE);
do_gotolinecolumn(iline, icol, FALSE, FALSE);
iline = 0;
icol = 0;
}
@@ -2761,8 +2630,8 @@ int main(int argc, char **argv)
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);
}
#endif
}
@@ -2791,21 +2660,15 @@ int main(int argc, char **argv)
fprintf(stderr, "Main: top and bottom win\n");
#endif
#ifndef DISABLE_COLOR
if (openfile->syntax)
if (openfile->syntax->nmultis > 0)
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);
#ifndef DISABLE_HISTORIES
else {
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);
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE);
}
#endif

View File

@@ -210,7 +210,7 @@ int do_statusbar_input(bool *ran_func, bool *finished,
* functions and setting finished to TRUE to indicate
* that we're done after running or trying to run their
* associated functions. */
f = sctofunc((sc *) s);
f = sctofunc(s);
if (s->scfunc != NULL) {
*ran_func = TRUE;
if (f && (!ISSET(VIEW_MODE) || f->viewok) &&

View File

@@ -252,6 +252,9 @@ bool is_valid_mbstring(const char *s);
void set_colorpairs(void);
void color_init(void);
void color_update(void);
void reset_multis(filestruct *fileptr, bool force);
void alloc_multidata_if_needed(filestruct *fileptr);
void precalc_multicolorinfo(void);
#endif
/* All functions in cut.c. */
@@ -280,7 +283,7 @@ void do_uncut_text(void);
/* All functions in files.c. */
void make_new_buffer(void);
void initialize_buffer_text(void);
void open_buffer(const char *filename, bool undoable);
bool open_buffer(const char *filename, bool undoable);
#ifndef DISABLE_SPELLER
void replace_buffer(const char *filename);
#endif
@@ -291,8 +294,7 @@ void switch_to_prev_buffer_void(void);
void switch_to_next_buffer_void(void);
bool close_buffer(bool quiet);
#endif
filestruct *read_line(char *buf, filestruct *prevnode, bool
*first_line_ins, size_t buf_len);
filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode);
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
char *get_next_filename(const char *name, const char *suffix);
@@ -323,7 +325,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
append_type append);
#endif
bool do_writeout(bool exiting);
int do_writeout(bool exiting);
void do_writeout_void(void);
#ifndef NANO_TINY
void do_savefile(void);
@@ -368,10 +370,10 @@ void shortcut_init(void);
void set_lint_or_format_shortcuts(void);
void set_spell_shortcuts(void);
#endif
const subnfunc *sctofunc(sc *s);
const subnfunc *sctofunc(const sc *s);
const char *flagtostr(int flag);
sc *strtosc(char *input);
int strtomenu(char *input);
sc *strtosc(const char *input);
int strtomenu(const char *input);
#ifdef DEBUG
void thanks_for_all_the_fish(void);
#endif
@@ -481,6 +483,7 @@ int more_space(void);
int no_help(void);
void no_current_file_name_warning(void);
void do_exit(void);
void close_and_go(void);
void signal_init(void);
RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
@@ -488,7 +491,7 @@ RETSIGTYPE do_continue(int signal);
#ifndef NANO_TINY
RETSIGTYPE handle_sigwinch(int signal);
void regenerate_screen(void);
void allow_pending_sigwinch(bool allow);
void allow_sigwinch(bool allow);
void do_toggle(int flag);
#endif
void do_toggle_void(void);
@@ -571,8 +574,6 @@ void parse_include(char *ptr);
short color_to_short(const char *colorname, bool *bright);
void parse_colors(char *ptr, bool icase);
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
void reset_multis(filestruct *fileptr, bool force);
void alloc_multidata_if_needed(filestruct *fileptr);
#endif
void parse_rcfile(FILE *rcstream
#ifndef DISABLE_COLOR
@@ -616,14 +617,10 @@ ssize_t do_replace_loop(
bool *canceled, const filestruct *real_current, size_t
*real_current_x, const char *needle);
void do_replace(void);
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive, bool save_pos, bool allow_update);
void do_gotolinecolumn_void(void);
#ifndef DISABLE_SPELLER
void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
pos_pww);
#endif
void goto_line_posx(ssize_t line, size_t pos_x);
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive);
void do_gotolinecolumn_void(void);
#ifndef NANO_TINY
bool find_bracket_match(bool reverse, const char *bracket_set);
void do_find_bracket(void);
@@ -762,7 +759,7 @@ void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
/* All functions in winio.c. */
/* Most functions in winio.c. */
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
void unget_input(int *input, size_t input_len);
@@ -770,9 +767,8 @@ void unget_kbinput(int kbinput, bool metakey, bool funckey);
int *get_input(WINDOW *win, size_t input_len);
int get_kbinput(WINDOW *win);
int parse_kbinput(WINDOW *win);
int get_escape_seq_kbinput(const int *seq, size_t seq_len);
int get_escape_seq_abcd(int kbinput);
int parse_escape_seq_kbinput(WINDOW *win, int kbinput);
int arrow_from_abcd(int kbinput);
int parse_escape_sequence(WINDOW *win, int kbinput);
int get_byte_kbinput(int kbinput);
#ifdef ENABLE_UTF8
long add_unicode_digit(int kbinput, long factor, long *uni);
@@ -837,6 +833,7 @@ void mac_format_void(void);
void append_void(void);
void prepend_void(void);
void backup_file_void(void);
void discard_buffer(void);
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);

View File

@@ -236,8 +236,7 @@ int search_init(bool replacing, bool use_answer)
return -2; /* Call the opposite search function. */
} else if (func == do_gotolinecolumn_void) {
do_gotolinecolumn(openfile->current->lineno,
openfile->placewewant + 1, TRUE, TRUE, FALSE,
TRUE);
openfile->placewewant + 1, TRUE, TRUE);
/* Put answer up on the statusbar and
* fall through. */
return 3;
@@ -936,8 +935,8 @@ void do_replace(void)
/* Go to the specified line and x position. */
void goto_line_posx(ssize_t line, size_t pos_x)
{
for (openfile->current = openfile->fileage; openfile->current != openfile->filebot &&
openfile->current->next != NULL && line > 1; line--)
for (openfile->current = openfile->fileage; line > 1 &&
openfile->current != openfile->filebot; line--)
openfile->current = openfile->current->next;
openfile->current_x = pos_x;
@@ -947,11 +946,10 @@ void goto_line_posx(ssize_t line, size_t pos_x)
}
/* Go to the specified line and column, or ask for them if interactive
* is TRUE. Save the x-coordinate and y-coordinate if save_pos is TRUE.
* Update the screen afterwards if allow_update is TRUE. Note that both
* the line and column numbers should be one-based. */
* is TRUE. In the latter case also update the screen afterwards.
* Note that both the line and column number should be one-based. */
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive, bool save_pos, bool allow_update)
bool interactive)
{
if (interactive) {
char *ans = mallocstrcpy(NULL, answer);
@@ -1013,13 +1011,11 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
openfile->current_x = actual_x(openfile->current->data, column - 1);
openfile->placewewant = column - 1;
/* Put the top line of the edit window in range of the current line.
* If save_pos is TRUE, don't change the cursor position when doing
* it. */
edit_update(save_pos ? NONE : CENTER);
/* Put the top line of the edit window in range of the current line. */
edit_update(CENTER);
/* If allow_update is TRUE, update the screen. */
if (allow_update) {
/* When in interactive mode, update the screen. */
if (interactive) {
edit_refresh();
display_main_list();
}
@@ -1029,27 +1025,9 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
void do_gotolinecolumn_void(void)
{
do_gotolinecolumn(openfile->current->lineno,
openfile->placewewant + 1, FALSE, TRUE, FALSE, TRUE);
openfile->placewewant + 1, FALSE, TRUE);
}
#ifndef DISABLE_SPELLER
/* Go to the line with the number specified in pos_line, the
* x-coordinate specified in pos_x, the y-coordinate specified in pos_y,
* and the place we want specified in pos_pww. */
void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
pos_pww)
{
/* Since do_gotolinecolumn() resets the x-coordinate but not the
* y-coordinate, set the coordinates up this way. */
openfile->current_y = pos_y;
do_gotolinecolumn(pos_line, pos_x + 1, FALSE, FALSE, TRUE, TRUE);
/* Set the rest of the coordinates up. */
openfile->placewewant = pos_pww;
update_line(openfile->current, pos_x);
}
#endif
#ifndef NANO_TINY
/* Search for a match to one of the two characters in bracket_set. If
* reverse is TRUE, search backwards for the leftmost bracket.

View File

@@ -137,6 +137,7 @@ void do_deletion(undo_type action)
openfile->current->data = charealloc(openfile->current->data,
strlen(openfile->current->data) + strlen(foo->data) + 1);
strcat(openfile->current->data, foo->data);
#ifndef NANO_TINY
if (openfile->mark_set &&
openfile->mark_begin == openfile->current->next) {
@@ -144,9 +145,6 @@ void do_deletion(undo_type action)
openfile->mark_begin_x += openfile->current_x;
}
#endif
if (openfile->filebot == foo)
openfile->filebot = openfile->current;
unlink_node(foo);
renumber(openfile->current);
openfile->totsize--;
@@ -163,9 +161,6 @@ void do_deletion(undo_type action)
#endif
set_modified();
if (edit_refresh_needed == FALSE)
update_line(openfile->current, openfile->current_x);
}
/* Delete the character under the cursor. */
@@ -544,8 +539,6 @@ void do_undo(void)
free(f->data);
f->data = data;
splice_node(f, t);
if (f == openfile->filebot)
openfile->filebot = t;
goto_line_posx(u->lineno, u->begin);
break;
case CUT_EOF:
@@ -568,8 +561,6 @@ void do_undo(void)
f->data = charealloc(f->data, strlen(f->data) +
strlen(&f->next->data[u->mark_begin_x]) + 1);
strcat(f->data, &f->next->data[u->mark_begin_x]);
if (openfile->filebot == f->next)
openfile->filebot = f;
unlink_node(f->next);
goto_line_posx(u->lineno, u->begin);
break;
@@ -678,8 +669,6 @@ void do_redo(void)
free(f->data);
f->data = data;
splice_node(f, shoveline);
if (f == openfile->filebot)
openfile->filebot = shoveline;
renumber(shoveline);
goto_line_posx(u->lineno + 1, u->mark_begin_x);
break;
@@ -711,8 +700,6 @@ void do_redo(void)
}
f->data = charealloc(f->data, strlen(f->data) + strlen(u->strdata) + 1);
strcat(f->data, u->strdata);
if (f->next == openfile->filebot)
openfile->filebot = f;
unlink_node(f->next);
renumber(f);
goto_line_posx(u->mark_begin_lineno, u->mark_begin_x);
@@ -798,9 +785,6 @@ void do_enter()
openfile->current_x = extra;
splice_node(openfile->current, newnode);
if (openfile->current == openfile->filebot)
openfile->filebot = newnode;
openfile->current = newnode;
renumber(newnode);
@@ -2076,12 +2060,10 @@ void do_justify(bool full_justify)
for (i = 0; i < par_len - 1; i++) {
filestruct *next_line = openfile->current->next;
size_t line_len = strlen(openfile->current->data);
size_t next_line_len =
strlen(openfile->current->next->data);
size_t next_line_len = strlen(openfile->current->next->data);
indent_len = quote_len +
indent_length(openfile->current->next->data +
quote_len);
indent_length(openfile->current->next->data + quote_len);
next_line_len -= indent_len;
openfile->totsize -= indent_len;
@@ -2089,37 +2071,30 @@ void do_justify(bool full_justify)
/* We're just about to tack the next line onto this one. If
* this line isn't empty, make sure it ends in a space. */
if (line_len > 0 &&
openfile->current->data[line_len - 1] != ' ') {
openfile->current->data[line_len - 1] != ' ') {
line_len++;
openfile->current->data =
charealloc(openfile->current->data,
line_len + 1);
charealloc(openfile->current->data, line_len + 1);
openfile->current->data[line_len - 1] = ' ';
openfile->current->data[line_len] = '\0';
openfile->totsize++;
}
openfile->current->data =
charealloc(openfile->current->data, line_len +
next_line_len + 1);
strcat(openfile->current->data, next_line->data +
indent_len);
/* Don't destroy edittop or filebot! */
if (next_line == openfile->edittop)
openfile->edittop = openfile->current;
if (next_line == openfile->filebot)
openfile->filebot = openfile->current;
openfile->current->data = charealloc(openfile->current->data,
line_len + next_line_len + 1);
strcat(openfile->current->data, next_line->data + indent_len);
#ifndef NANO_TINY
/* Adjust the mark coordinates to compensate for the change
* in the next line. */
if (openfile->mark_set && openfile->mark_begin ==
next_line) {
/* If needed, adjust the coordinates of the mark. */
if (openfile->mark_set &&
openfile->mark_begin == next_line) {
openfile->mark_begin = openfile->current;
openfile->mark_begin_x += line_len - indent_len;
}
#endif
/* Don't destroy edittop! */
if (next_line == openfile->edittop)
openfile->edittop = openfile->current;
unlink_node(next_line);
@@ -2137,8 +2112,7 @@ void do_justify(bool full_justify)
justify_format(openfile->current, quote_len +
indent_length(openfile->current->data + quote_len));
while (par_len > 0 && strlenpt(openfile->current->data) >
fill) {
while (par_len > 0 && strlenpt(openfile->current->data) > fill) {
size_t line_len = strlen(openfile->current->data);
indent_len = strlen(indent_string);
@@ -2162,11 +2136,6 @@ void do_justify(bool full_justify)
assert(break_pos <= line_len);
/* Make a new line, and copy the text after where we're
* going to break this line to the beginning of the new
* line. */
splice_node(openfile->current, make_new_node(openfile->current));
/* If this paragraph is non-quoted, and autoindent isn't
* turned on, set the indentation length to zero so that the
* indentation is treated as part of the line. */
@@ -2177,6 +2146,9 @@ void do_justify(bool full_justify)
)
indent_len = 0;
/* Insert a new line after the current one. */
splice_node(openfile->current, make_new_node(openfile->current));
/* Copy the text after where we're going to break the
* current line to the next line. */
openfile->current->next->data = charalloc(indent_len + 1 +
@@ -2192,9 +2164,9 @@ void do_justify(bool full_justify)
#ifndef NANO_TINY
/* Adjust the mark coordinates to compensate for the change
* in the current line. */
if (openfile->mark_set && openfile->mark_begin ==
openfile->current && openfile->mark_begin_x >
break_pos) {
if (openfile->mark_set &&
openfile->mark_begin == openfile->current &&
openfile->mark_begin_x > break_pos) {
openfile->mark_begin = openfile->current->next;
openfile->mark_begin_x -= break_pos - indent_len;
}
@@ -2203,11 +2175,6 @@ void do_justify(bool full_justify)
/* Break the current line. */
null_at(&openfile->current->data, break_pos);
/* If the current line is the last line of the file, move
* the last line of the file down to the next line. */
if (openfile->filebot == openfile->current)
openfile->filebot = openfile->filebot->next;
/* Go to the next line. */
par_len--;
openfile->current_y++;
@@ -2773,9 +2740,8 @@ const char *do_alt_speller(char *tempfile_name)
return _("Could not fork");
#ifndef NANO_TINY
/* Don't handle a pending SIGWINCH until the alternate spell checker
* is finished and we've loaded the spell-checked file back in. */
allow_pending_sigwinch(FALSE);
/* Block SIGWINCHes so the spell checker doesn't get any. */
allow_sigwinch(FALSE);
#endif
/* Wait for the alternate spell checker to finish. */
@@ -2790,10 +2756,6 @@ const char *do_alt_speller(char *tempfile_name)
/* Turn the cursor back on for sure. */
curs_set(1);
/* The screen might have been resized. If it has, reinitialize all
* the windows based on the new screen dimensions. */
window_init();
if (!WIFEXITED(alt_spell_status) || WEXITSTATUS(alt_spell_status) != 0) {
#ifndef NANO_TINY
/* Turn the mark back on if it was on before. */
@@ -2867,8 +2829,8 @@ const char *do_alt_speller(char *tempfile_name)
set_modified();
#ifndef NANO_TINY
/* Handle a pending SIGWINCH again. */
allow_pending_sigwinch(TRUE);
/* Unblock SIGWINCHes again. */
allow_sigwinch(TRUE);
#endif
return NULL;
@@ -2880,7 +2842,7 @@ void do_spell(void)
{
bool status;
FILE *temp_file;
char *temp = safe_tempfile(&temp_file);
char *temp;
const char *spell_msg;
if (ISSET(RESTRICTED)) {
@@ -2888,6 +2850,8 @@ void do_spell(void)
return;
}
temp = safe_tempfile(&temp_file);
if (temp == NULL) {
statusbar(_("Error writing temp file: %s"), strerror(errno));
return;
@@ -2934,13 +2898,7 @@ void do_spell(void)
#endif /* !DISABLE_SPELLER */
#ifndef DISABLE_COLOR
/* Cleanup things to do after leaving the linter. */
void lint_cleanup(void)
{
display_main_list();
}
/* Run linter. Based on alt-speller code. Return NULL for normal
/* Run a linting program on the current buffer. Return NULL for normal
* termination, and the error string otherwise. */
void do_linter(void)
{
@@ -2970,13 +2928,10 @@ void do_linter(void)
int i = do_yesno_prompt(FALSE, _("Save modified buffer before linting?"));
if (i == -1) {
statusbar(_("Cancelled"));
lint_cleanup();
return;
goto exit_from_lint;
} else if (i == 1) {
if (do_writeout(FALSE) != TRUE) {
lint_cleanup();
return;
}
if (do_writeout(FALSE) != TRUE)
goto exit_from_lint;
}
}
@@ -2984,8 +2939,7 @@ void do_linter(void)
/* Create pipe up front. */
if (pipe(lint_fd) == -1) {
statusbar(_("Could not create pipe"));
lint_cleanup();
return;
goto exit_from_lint;
}
blank_bottombars();
@@ -3035,16 +2989,14 @@ void do_linter(void)
if (pid_lint < 0) {
close(lint_fd[0]);
statusbar(_("Could not fork"));
lint_cleanup();
return;
goto exit_from_lint;
}
/* Get the system pipe buffer size. */
if ((pipe_buff_size = fpathconf(lint_fd[0], _PC_PIPE_BUF)) < 1) {
close(lint_fd[0]);
statusbar(_("Could not get size of pipe buffer"));
lint_cleanup();
return;
goto exit_from_lint;
}
/* Read in the returned syntax errors. */
@@ -3144,16 +3096,14 @@ void do_linter(void)
if (!WIFEXITED(lint_status) || WEXITSTATUS(lint_status) > 2) {
statusbar(invocation_error(openfile->syntax->linter));
lint_cleanup();
return;
goto exit_from_lint;
}
free(read_buff);
if (parsesuccess == 0) {
statusbar(_("Got 0 parsable lines from command: %s"), openfile->syntax->linter);
lint_cleanup();
return;
goto exit_from_lint;
}
bottombars(MLINTER);
@@ -3200,7 +3150,7 @@ void do_linter(void)
while (curlint != NULL && !strcmp(curlint->filename, dontwantfile))
curlint = curlint->next;
if (curlint == NULL) {
statusbar("No more errors in un-opened filed, cancelling");
statusbar(_("No more errors in unopened files, cancelling"));
break;
} else
goto new_lint_loop;
@@ -3210,7 +3160,7 @@ void do_linter(void)
}
}
#endif /* !NANO_TINY */
do_gotolinecolumn(curlint->lineno, tmpcol, FALSE, FALSE, FALSE, FALSE);
do_gotolinecolumn(curlint->lineno, tmpcol, FALSE, FALSE);
titlebar(NULL);
edit_refresh();
statusbar(curlint->msg);
@@ -3253,7 +3203,8 @@ void do_linter(void)
free(tmplint->filename);
free(tmplint);
}
lint_cleanup();
exit_from_lint:
display_main_list();
}
#ifndef DISABLE_SPELLER
@@ -3264,7 +3215,7 @@ void do_formatter(void)
{
bool status;
FILE *temp_file;
char *temp = safe_tempfile(&temp_file);
char *temp;
int format_status;
size_t current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
@@ -3276,6 +3227,13 @@ void do_formatter(void)
static char **formatargs = NULL;
char *finalstatus = NULL;
if (openfile->totsize == 0) {
statusbar(_("Finished"));
return;
}
temp = safe_tempfile(&temp_file);
if (temp == NULL) {
statusbar(_("Error writing temp file: %s"), strerror(errno));
return;
@@ -3291,11 +3249,6 @@ void do_formatter(void)
return;
}
if (openfile->totsize == 0) {
statusbar(_("Finished"));
return;
}
blank_bottombars();
statusbar(_("Invoking formatter, please wait"));
doupdate();
@@ -3329,13 +3282,14 @@ void do_formatter(void)
/* If we couldn't fork, get out. */
if (pid_format < 0) {
statusbar(_("Could not fork"));
unlink(temp);
free(temp);
return;
}
#ifndef NANO_TINY
/* Don't handle any SIGWINCHes until the formatter has finished and
* we've loaded the reformatted file back in. */
allow_pending_sigwinch(FALSE);
/* Block SIGWINCHes so the formatter doesn't get any. */
allow_sigwinch(FALSE);
#endif
/* Wait for the formatter to finish. */
@@ -3350,18 +3304,18 @@ void do_formatter(void)
/* Turn the cursor back on for sure. */
curs_set(1);
/* The screen might have been resized. If it has, reinitialize all
* the windows based on the new screen dimensions. */
window_init();
if (!WIFEXITED(format_status) || WEXITSTATUS(format_status) != 0)
finalstatus = invocation_error(openfile->syntax->formatter);
else {
/* Replace the text of the current buffer with the formatted text. */
replace_buffer(temp);
/* Go back to the old position, and mark the file as modified. */
do_gotopos(lineno_save, current_x_save, current_y_save, pww_save);
/* Restore the cursor position, and mark the file as modified. */
goto_line_posx(lineno_save, current_x_save);
openfile->current_y = current_y_save;
openfile->placewewant = pww_save;
edit_update(NONE);
set_modified();
finalstatus = _("Finished formatting");
@@ -3371,8 +3325,8 @@ void do_formatter(void)
free(temp);
#ifndef NANO_TINY
/* Handle SIGWINCHes again. */
allow_pending_sigwinch(TRUE);
/* Unblock SIGWINCHes again. */
allow_sigwinch(TRUE);
#endif
/* If the formatter printed any error messages onscreen, make

View File

@@ -187,7 +187,7 @@ void get_key_buffer(WINDOW *win)
#ifdef DEBUG
{
size_t i;
fprintf(stderr, "get_key_buffer(): the series of codes:");
fprintf(stderr, "\nget_key_buffer(): the sequence of hex codes:");
for (i = 0; i < key_buffer_len; i++)
fprintf(stderr, " %3x", key_buffer[i]);
fprintf(stderr, "\n");
@@ -388,8 +388,7 @@ int parse_kbinput(WINDOW *win)
* there are other keystrokes waiting: escape
* sequence mode. Interpret the escape
* sequence. */
retval = parse_escape_seq_kbinput(win,
*kbinput);
retval = parse_escape_sequence(win, *kbinput);
break;
case 2:
if (get_key_buffer_len() == 0) {
@@ -472,8 +471,7 @@ int parse_kbinput(WINDOW *win)
* interpret the escape sequence. */
escapes = 0;
meta_key = TRUE;
retval = parse_escape_seq_kbinput(win,
*kbinput);
retval = parse_escape_sequence(win, *kbinput);
}
break;
case 3:
@@ -492,8 +490,7 @@ int parse_kbinput(WINDOW *win)
* Interpret the escape sequence, and interpret
* the result as a control sequence. */
retval = get_control_kbinput(
parse_escape_seq_kbinput(win,
*kbinput));
parse_escape_sequence(win, *kbinput));
break;
}
}
@@ -670,10 +667,8 @@ int parse_kbinput(WINDOW *win)
* keypad values, into their corresponding key values. These sequences
* are generated when the keypad doesn't support the needed keys.
* Assume that Escape has already been read in. */
int get_escape_seq_kbinput(const int *seq, size_t seq_len)
int convert_sequence(const int *seq, size_t seq_len)
{
int retval = ERR;
if (seq_len > 1) {
switch (seq[0]) {
case 'O':
@@ -695,20 +690,15 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
* Terminal. */
case 'D': /* Esc O 1 ; 2 D == Shift-Left on
* Terminal. */
retval = get_escape_seq_abcd(seq[4]);
break;
return arrow_from_abcd(seq[4]);
case 'P': /* Esc O 1 ; 2 P == F13 on Terminal. */
retval = KEY_F(13);
break;
return KEY_F(13);
case 'Q': /* Esc O 1 ; 2 Q == F14 on Terminal. */
retval = KEY_F(14);
break;
return KEY_F(14);
case 'R': /* Esc O 1 ; 2 R == F15 on Terminal. */
retval = KEY_F(15);
break;
return KEY_F(15);
case 'S': /* Esc O 1 ; 2 S == F16 on Terminal. */
retval = KEY_F(16);
break;
return KEY_F(16);
}
}
break;
@@ -717,14 +707,11 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
switch (seq[4]) {
case 'A': /* Esc O 1 ; 5 A == Ctrl-Up on Terminal. */
case 'B': /* Esc O 1 ; 5 B == Ctrl-Down on Terminal. */
retval = get_escape_seq_abcd(seq[4]);
break;
return arrow_from_abcd(seq[4]);
case 'C': /* Esc O 1 ; 5 C == Ctrl-Right on Terminal. */
retval = CONTROL_RIGHT;
break;
return CONTROL_RIGHT;
case 'D': /* Esc O 1 ; 5 D == Ctrl-Left on Terminal. */
retval = CONTROL_LEFT;
break;
return CONTROL_LEFT;
}
}
break;
@@ -738,17 +725,13 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
if (seq_len >= 3) {
switch (seq[2]) {
case 'P': /* Esc O 2 P == F13 on xterm. */
retval = KEY_F(13);
break;
return KEY_F(13);
case 'Q': /* Esc O 2 Q == F14 on xterm. */
retval = KEY_F(14);
break;
return KEY_F(14);
case 'R': /* Esc O 2 R == F15 on xterm. */
retval = KEY_F(15);
break;
return KEY_F(15);
case 'S': /* Esc O 2 S == F16 on xterm. */
retval = KEY_F(16);
break;
return KEY_F(16);
}
}
break;
@@ -756,161 +739,124 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
case 'B': /* Esc O B == Down on VT100/VT320/xterm. */
case 'C': /* Esc O C == Right on VT100/VT320/xterm. */
case 'D': /* Esc O D == Left on VT100/VT320/xterm. */
retval = get_escape_seq_abcd(seq[1]);
break;
return arrow_from_abcd(seq[1]);
case 'E': /* Esc O E == Center (5) on numeric keypad
* with NumLock off on xterm. */
retval = KEY_B2;
break;
return KEY_B2;
case 'F': /* Esc O F == End on xterm/Terminal. */
retval = sc_seq_or(do_end, 0);
break;
return sc_seq_or(do_end, 0);
case 'H': /* Esc O H == Home on xterm/Terminal. */
retval = sc_seq_or(do_home, 0);
break;
return sc_seq_or(do_home, 0);
case 'M': /* Esc O M == Enter on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
* rxvt/Eterm. */
retval = sc_seq_or(do_home, 0);
break;
return sc_seq_or(do_home, 0);
case 'P': /* Esc O P == F1 on VT100/VT220/VT320/Mach
* console. */
retval = KEY_F(1);
break;
return KEY_F(1);
case 'Q': /* Esc O Q == F2 on VT100/VT220/VT320/Mach
* console. */
retval = KEY_F(2);
break;
return KEY_F(2);
case 'R': /* Esc O R == F3 on VT100/VT220/VT320/Mach
* console. */
retval = KEY_F(3);
break;
return KEY_F(3);
case 'S': /* Esc O S == F4 on VT100/VT220/VT320/Mach
* console. */
retval = KEY_F(4);
break;
return KEY_F(4);
case 'T': /* Esc O T == F5 on Mach console. */
retval = KEY_F(5);
break;
return KEY_F(5);
case 'U': /* Esc O U == F6 on Mach console. */
retval = KEY_F(6);
break;
return KEY_F(6);
case 'V': /* Esc O V == F7 on Mach console. */
retval = KEY_F(7);
break;
return KEY_F(7);
case 'W': /* Esc O W == F8 on Mach console. */
retval = KEY_F(8);
break;
return KEY_F(8);
case 'X': /* Esc O X == F9 on Mach console. */
retval = KEY_F(9);
break;
return KEY_F(9);
case 'Y': /* Esc O Y == F10 on Mach console. */
retval = KEY_F(10);
break;
return KEY_F(10);
case 'a': /* Esc O a == Ctrl-Up on rxvt. */
case 'b': /* Esc O b == Ctrl-Down on rxvt. */
retval = get_escape_seq_abcd(seq[1]);
break;
return arrow_from_abcd(seq[1]);
case 'c': /* Esc O c == Ctrl-Right on rxvt. */
retval = CONTROL_RIGHT;
break;
return CONTROL_RIGHT;
case 'd': /* Esc O d == Ctrl-Left on rxvt. */
retval = CONTROL_LEFT;
break;
return CONTROL_LEFT;
case 'j': /* Esc O j == '*' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
* rxvt/Eterm/Terminal. */
retval = '*';
break;
return '*';
case 'k': /* Esc O k == '+' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
* rxvt/Eterm/Terminal. */
retval = '+';
break;
return '+';
case 'l': /* Esc O l == ',' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
* rxvt/Eterm/Terminal. */
retval = ',';
break;
return ',';
case 'm': /* Esc O m == '-' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
* rxvt/Eterm/Terminal. */
retval = '-';
break;
return '-';
case 'n': /* Esc O n == Delete (.) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* xterm/rxvt/Eterm/Terminal. */
retval = sc_seq_or(do_delete, 0);
break;
return sc_seq_or(do_delete, 0);
case 'o': /* Esc O o == '/' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
* rxvt/Eterm/Terminal. */
retval = '/';
break;
return '/';
case 'p': /* Esc O p == Insert (0) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* rxvt/Eterm/Terminal. */
retval = sc_seq_or(do_insertfile_void, 0);
break;
return sc_seq_or(do_insertfile_void, 0);
case 'q': /* Esc O q == End (1) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* rxvt/Eterm/Terminal. */
retval = sc_seq_or(do_end, 0);
break;
return sc_seq_or(do_end, 0);
case 'r': /* Esc O r == Down (2) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* rxvt/Eterm/Terminal. */
retval = sc_seq_or(do_down_void, 0);
break;
return sc_seq_or(do_down_void, 0);
case 's': /* Esc O s == PageDown (3) on numeric
* keypad with NumLock off on VT100/VT220/
* VT320/rxvt/Eterm/Terminal. */
retval = sc_seq_or(do_page_down, 0);
break;
return sc_seq_or(do_page_down, 0);
case 't': /* Esc O t == Left (4) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* rxvt/Eterm/Terminal. */
retval = sc_seq_or(do_left, 0);
break;
return sc_seq_or(do_left, 0);
case 'u': /* Esc O u == Center (5) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* rxvt/Eterm. */
retval = KEY_B2;
break;
return KEY_B2;
case 'v': /* Esc O v == Right (6) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* rxvt/Eterm/Terminal. */
retval = sc_seq_or(do_right, 0);
break;
return sc_seq_or(do_right, 0);
case 'w': /* Esc O w == Home (7) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* rxvt/Eterm/Terminal. */
retval = sc_seq_or(do_home, 0);
break;
return sc_seq_or(do_home, 0);
case 'x': /* Esc O x == Up (8) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* rxvt/Eterm/Terminal. */
retval = sc_seq_or(do_up_void, 0);
break;
return sc_seq_or(do_up_void, 0);
case 'y': /* Esc O y == PageUp (9) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* rxvt/Eterm/Terminal. */
retval = sc_seq_or(do_page_up, 0);
break;
return sc_seq_or(do_page_up, 0);
}
break;
case 'o':
switch (seq[1]) {
case 'a': /* Esc o a == Ctrl-Up on Eterm. */
case 'b': /* Esc o b == Ctrl-Down on Eterm. */
retval = get_escape_seq_abcd(seq[1]);
break;
return arrow_from_abcd(seq[1]);
case 'c': /* Esc o c == Ctrl-Right on Eterm. */
retval = CONTROL_RIGHT;
break;
return CONTROL_RIGHT;
case 'd': /* Esc o d == Ctrl-Left on Eterm. */
retval = CONTROL_LEFT;
break;
return CONTROL_LEFT;
}
break;
case '[':
@@ -919,36 +865,28 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
if (seq_len >= 3) {
switch (seq[2]) {
case '1': /* Esc [ 1 1 ~ == F1 on rxvt/Eterm. */
retval = KEY_F(1);
break;
return KEY_F(1);
case '2': /* Esc [ 1 2 ~ == F2 on rxvt/Eterm. */
retval = KEY_F(2);
break;
return KEY_F(2);
case '3': /* Esc [ 1 3 ~ == F3 on rxvt/Eterm. */
retval = KEY_F(3);
break;
return KEY_F(3);
case '4': /* Esc [ 1 4 ~ == F4 on rxvt/Eterm. */
retval = KEY_F(4);
break;
return KEY_F(4);
case '5': /* Esc [ 1 5 ~ == F5 on xterm/
* rxvt/Eterm. */
retval = KEY_F(5);
break;
return KEY_F(5);
case '7': /* Esc [ 1 7 ~ == F6 on
* VT220/VT320/Linux console/
* xterm/rxvt/Eterm. */
retval = KEY_F(6);
break;
return KEY_F(6);
case '8': /* Esc [ 1 8 ~ == F7 on
* VT220/VT320/Linux console/
* xterm/rxvt/Eterm. */
retval = KEY_F(7);
break;
return KEY_F(7);
case '9': /* Esc [ 1 9 ~ == F8 on
* VT220/VT320/Linux console/
* xterm/rxvt/Eterm. */
retval = KEY_F(8);
break;
return KEY_F(8);
case ';':
if (seq_len >= 4) {
switch (seq[3]) {
@@ -959,8 +897,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
case 'B': /* Esc [ 1 ; 2 B == Shift-Down on xterm. */
case 'C': /* Esc [ 1 ; 2 C == Shift-Right on xterm. */
case 'D': /* Esc [ 1 ; 2 D == Shift-Left on xterm. */
retval = get_escape_seq_abcd(seq[4]);
break;
return arrow_from_abcd(seq[4]);
}
}
break;
@@ -969,14 +906,11 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
switch (seq[4]) {
case 'A': /* Esc [ 1 ; 5 A == Ctrl-Up on xterm. */
case 'B': /* Esc [ 1 ; 5 B == Ctrl-Down on xterm. */
retval = get_escape_seq_abcd(seq[4]);
break;
return arrow_from_abcd(seq[4]);
case 'C': /* Esc [ 1 ; 5 C == Ctrl-Right on xterm. */
retval = CONTROL_RIGHT;
break;
return CONTROL_RIGHT;
case 'D': /* Esc [ 1 ; 5 D == Ctrl-Left on xterm. */
retval = CONTROL_LEFT;
break;
return CONTROL_LEFT;
}
}
break;
@@ -985,8 +919,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
break;
default: /* Esc [ 1 ~ == Home on
* VT320/Linux console. */
retval = sc_seq_or(do_home, 0);
break;
return sc_seq_or(do_home, 0);
}
}
break;
@@ -995,73 +928,56 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
switch (seq[2]) {
case '0': /* Esc [ 2 0 ~ == F9 on VT220/VT320/
* Linux console/xterm/rxvt/Eterm. */
retval = KEY_F(9);
break;
return KEY_F(9);
case '1': /* Esc [ 2 1 ~ == F10 on VT220/VT320/
* Linux console/xterm/rxvt/Eterm. */
retval = KEY_F(10);
break;
return KEY_F(10);
case '3': /* Esc [ 2 3 ~ == F11 on VT220/VT320/
* Linux console/xterm/rxvt/Eterm. */
retval = KEY_F(11);
break;
return KEY_F(11);
case '4': /* Esc [ 2 4 ~ == F12 on VT220/VT320/
* Linux console/xterm/rxvt/Eterm. */
retval = KEY_F(12);
break;
return KEY_F(12);
case '5': /* Esc [ 2 5 ~ == F13 on VT220/VT320/
* Linux console/rxvt/Eterm. */
retval = KEY_F(13);
break;
return KEY_F(13);
case '6': /* Esc [ 2 6 ~ == F14 on VT220/VT320/
* Linux console/rxvt/Eterm. */
retval = KEY_F(14);
break;
return KEY_F(14);
case '8': /* Esc [ 2 8 ~ == F15 on VT220/VT320/
* Linux console/rxvt/Eterm. */
retval = KEY_F(15);
break;
return KEY_F(15);
case '9': /* Esc [ 2 9 ~ == F16 on VT220/VT320/
* Linux console/rxvt/Eterm. */
retval = KEY_F(16);
break;
return KEY_F(16);
default: /* Esc [ 2 ~ == Insert on VT220/VT320/
* Linux console/xterm/Terminal. */
retval = sc_seq_or(do_insertfile_void, 0);
break;
return sc_seq_or(do_insertfile_void, 0);
}
}
break;
case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/
* Linux console/xterm/Terminal. */
retval = sc_seq_or(do_delete, 0);
break;
return sc_seq_or(do_delete, 0);
case '4': /* Esc [ 4 ~ == End on VT220/VT320/Linux
* console/xterm. */
retval = sc_seq_or(do_end, 0);
break;
return sc_seq_or(do_end, 0);
case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/
* Linux console/xterm/Terminal;
* Esc [ 5 ^ == PageUp on Eterm. */
retval = sc_seq_or(do_page_up, 0);
break;
return sc_seq_or(do_page_up, 0);
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
* Linux console/xterm/Terminal;
* Esc [ 6 ^ == PageDown on Eterm. */
retval = sc_seq_or(do_page_down, 0);
break;
return sc_seq_or(do_page_down, 0);
case '7': /* Esc [ 7 ~ == Home on rxvt. */
retval = sc_seq_or(do_home, 0);
break;
return sc_seq_or(do_home, 0);
case '8': /* Esc [ 8 ~ == End on rxvt. */
retval = sc_seq_or(do_end, 0);
break;
return sc_seq_or(do_end, 0);
case '9': /* Esc [ 9 == Delete on Mach console. */
retval = sc_seq_or(do_delete, 0);
break;
return sc_seq_or(do_delete, 0);
case '@': /* Esc [ @ == Insert on Mach console. */
retval = sc_seq_or(do_insertfile_void, 0);
break;
return sc_seq_or(do_insertfile_void, 0);
case 'A': /* Esc [ A == Up on ANSI/VT220/Linux
* console/FreeBSD console/Mach console/
* rxvt/Eterm/Terminal. */
@@ -1074,117 +990,87 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
case 'D': /* Esc [ D == Left on ANSI/VT220/Linux
* console/FreeBSD console/Mach console/
* rxvt/Eterm/Terminal. */
retval = get_escape_seq_abcd(seq[1]);
break;
return arrow_from_abcd(seq[1]);
case 'E': /* Esc [ E == Center (5) on numeric keypad
* with NumLock off on FreeBSD console/
* Terminal. */
retval = KEY_B2;
break;
return KEY_B2;
case 'F': /* Esc [ F == End on FreeBSD console/Eterm. */
retval = sc_seq_or(do_end, 0);
break;
return sc_seq_or(do_end, 0);
case 'G': /* Esc [ G == PageDown on FreeBSD console. */
retval = sc_seq_or(do_page_down, 0);
break;
return sc_seq_or(do_page_down, 0);
case 'H': /* Esc [ H == Home on ANSI/VT220/FreeBSD
* console/Mach console/Eterm. */
retval = sc_seq_or(do_home, 0);
break;
return sc_seq_or(do_home, 0);
case 'I': /* Esc [ I == PageUp on FreeBSD console. */
retval = sc_seq_or(do_page_up, 0);
break;
return sc_seq_or(do_page_up, 0);
case 'L': /* Esc [ L == Insert on ANSI/FreeBSD console. */
retval = sc_seq_or(do_insertfile_void, 0);
break;
return sc_seq_or(do_insertfile_void, 0);
case 'M': /* Esc [ M == F1 on FreeBSD console. */
retval = KEY_F(1);
break;
return KEY_F(1);
case 'N': /* Esc [ N == F2 on FreeBSD console. */
retval = KEY_F(2);
break;
return KEY_F(2);
case 'O':
if (seq_len >= 3) {
switch (seq[2]) {
case 'P': /* Esc [ O P == F1 on xterm. */
retval = KEY_F(1);
break;
return KEY_F(1);
case 'Q': /* Esc [ O Q == F2 on xterm. */
retval = KEY_F(2);
break;
return KEY_F(2);
case 'R': /* Esc [ O R == F3 on xterm. */
retval = KEY_F(3);
break;
return KEY_F(3);
case 'S': /* Esc [ O S == F4 on xterm. */
retval = KEY_F(4);
break;
return KEY_F(4);
}
} else
/* Esc [ O == F3 on FreeBSD console. */
retval = KEY_F(3);
return KEY_F(3);
break;
case 'P': /* Esc [ P == F4 on FreeBSD console. */
retval = KEY_F(4);
break;
return KEY_F(4);
case 'Q': /* Esc [ Q == F5 on FreeBSD console. */
retval = KEY_F(5);
break;
return KEY_F(5);
case 'R': /* Esc [ R == F6 on FreeBSD console. */
retval = KEY_F(6);
break;
return KEY_F(6);
case 'S': /* Esc [ S == F7 on FreeBSD console. */
retval = KEY_F(7);
break;
return KEY_F(7);
case 'T': /* Esc [ T == F8 on FreeBSD console. */
retval = KEY_F(8);
break;
return KEY_F(8);
case 'U': /* Esc [ U == PageDown on Mach console. */
retval = sc_seq_or(do_page_down, 0);
break;
return sc_seq_or(do_page_down, 0);
case 'V': /* Esc [ V == PageUp on Mach console. */
retval = sc_seq_or(do_page_up, 0);
break;
return sc_seq_or(do_page_up, 0);
case 'W': /* Esc [ W == F11 on FreeBSD console. */
retval = KEY_F(11);
break;
return KEY_F(11);
case 'X': /* Esc [ X == F12 on FreeBSD console. */
retval = KEY_F(12);
break;
return KEY_F(12);
case 'Y': /* Esc [ Y == End on Mach console. */
retval = sc_seq_or(do_end, 0);
break;
return sc_seq_or(do_end, 0);
case 'Z': /* Esc [ Z == F14 on FreeBSD console. */
retval = KEY_F(14);
break;
return KEY_F(14);
case 'a': /* Esc [ a == Shift-Up on rxvt/Eterm. */
case 'b': /* Esc [ b == Shift-Down on rxvt/Eterm. */
case 'c': /* Esc [ c == Shift-Right on rxvt/Eterm. */
case 'd': /* Esc [ d == Shift-Left on rxvt/Eterm. */
retval = get_escape_seq_abcd(seq[1]);
break;
return arrow_from_abcd(seq[1]);
case '[':
if (seq_len >= 3) {
switch (seq[2]) {
case 'A': /* Esc [ [ A == F1 on Linux
* console. */
retval = KEY_F(1);
break;
return KEY_F(1);
case 'B': /* Esc [ [ B == F2 on Linux
* console. */
retval = KEY_F(2);
break;
return KEY_F(2);
case 'C': /* Esc [ [ C == F3 on Linux
* console. */
retval = KEY_F(3);
break;
return KEY_F(3);
case 'D': /* Esc [ [ D == F4 on Linux
* console. */
retval = KEY_F(4);
break;
return KEY_F(4);
case 'E': /* Esc [ [ E == F5 on Linux
* console. */
retval = KEY_F(5);
break;
return KEY_F(5);
}
}
break;
@@ -1193,17 +1079,13 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
}
}
#ifdef DEBUG
fprintf(stderr, "get_escape_seq_kbinput(): retval = %d\n", retval);
#endif
return retval;
return ERR;
}
/* Return the equivalent arrow key value for the case-insensitive
* letters A (up), B (down), C (right), and D (left). These are common
* to many escape sequences. */
int get_escape_seq_abcd(int kbinput)
int arrow_from_abcd(int kbinput)
{
switch (tolower(kbinput)) {
case 'a':
@@ -1222,7 +1104,7 @@ int get_escape_seq_abcd(int kbinput)
/* Interpret the escape sequence in the keystroke buffer, the first
* character of which is kbinput. Assume that the keystroke buffer
* isn't empty, and that the initial escape has already been read in. */
int parse_escape_seq_kbinput(WINDOW *win, int kbinput)
int parse_escape_sequence(WINDOW *win, int kbinput)
{
int retval, *seq;
size_t seq_len;
@@ -1233,11 +1115,11 @@ int parse_escape_seq_kbinput(WINDOW *win, int kbinput)
unget_input(&kbinput, 1);
seq_len = get_key_buffer_len();
seq = get_input(NULL, seq_len);
retval = get_escape_seq_kbinput(seq, seq_len);
retval = convert_sequence(seq, seq_len);
free(seq);
/* If we got an unrecognized escape sequence, throw it out. */
/* If we got an unrecognized escape sequence, notify the user. */
if (retval == ERR) {
if (win == edit) {
statusbar(_("Unknown Command"));
@@ -1246,7 +1128,8 @@ int parse_escape_seq_kbinput(WINDOW *win, int kbinput)
}
#ifdef DEBUG
fprintf(stderr, "parse_escape_seq_kbinput(): kbinput = %d, seq_len = %lu, retval = %d\n", kbinput, (unsigned long)seq_len, retval);
fprintf(stderr, "parse_escape_sequence(): kbinput = %d, seq_len = %lu, retval = %d\n",
kbinput, (unsigned long)seq_len, retval);
#endif
return retval;
@@ -2728,6 +2611,9 @@ void edit_draw(filestruct *fileptr, const char *converted, int
}
}
start_col = endmatch.rm_eo;
/* Skip over a zero-length match. */
if (endmatch.rm_so == endmatch.rm_eo)
start_col += 1;
} else {
/* There is no end on this line. But we haven't yet
* looked for one on later lines. */
@@ -2738,20 +2624,21 @@ void edit_draw(filestruct *fileptr, const char *converted, int
0, NULL, 0) == REG_NOMATCH)
end_line = end_line->next;
if (end_line != NULL) {
assert(0 <= x_start && x_start < COLS);
/* If there is no end, we're done on this line. */
if (end_line == NULL)
break;
mvwaddnstr(edit, line, x_start,
converted + index, -1);
fileptr->multidata[tmpcolor->id] = CENDAFTER;
assert(0 <= x_start && x_start < COLS);
/* Paint the rest of the line. */
mvwaddnstr(edit, line, x_start, converted + index, -1);
fileptr->multidata[tmpcolor->id] = CENDAFTER;
#ifdef DEBUG
fprintf(stderr, " Marking for id %i line %i as CENDAFTER\n", tmpcolor->id, line);
#endif
/* We painted to the end of the line, so
* don't bother checking any more starts. */
break;
}
start_col = startmatch.rm_so + 1;
/* We've painted to the end of the line, so don't
* bother checking for any more starts. */
break;
}
}
}
@@ -2902,7 +2789,7 @@ int update_line(filestruct *fileptr, size_t index)
#ifndef NANO_TINY
} else {
size_t full_length = strlenpt(fileptr->data);
for (index += COLS; index <= full_length && line < editwinrows; index += COLS) {
for (index += COLS; index <= full_length && line < editwinrows - 1; index += COLS) {
line++;
#ifdef DEBUG
fprintf(stderr, "update_line(): softwrap code, moving to %d index %lu\n", line, (unsigned long)index);
@@ -3455,7 +3342,7 @@ void do_credits(void)
"",
"",
"",
"(C) 1999 - 2015",
"(C) 1999 - 2016",
"Free Software Foundation, Inc.",
"",
"",
@@ -3541,11 +3428,11 @@ void do_credits(void)
if (kbinput != ERR)
ungetch(kbinput);
if (!old_more_space || !old_no_help) {
if (!old_more_space)
UNSET(MORE_SPACE);
if (!old_no_help)
UNSET(NO_HELP);
window_init();
}
window_init();
curs_set(1);
nodelay(edit, FALSE);