Compare commits

...

44 Commits

Author SHA1 Message Date
Chris Allegretta
162d534ff6 GNU nano 2.5.3 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5680 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-25 21:46:09 +00:00
Chris Allegretta
9f98333dce Call kill_spaces_on_justify justifytrim, to match the rest of rcfile naming conventions.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5679 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-25 21:04:45 +00:00
Benno Schulenberg
486e828443 Eliding splice_opennode() by handling the two cases (the creation of
the first element, and the insertion of a new element) directly.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5678 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-25 18:58:17 +00:00
Benno Schulenberg
3b8989b0a9 Now putting things in the proper order: setting 'prev_dir' only when
we've actually succeeded in changing directory.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5677 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-25 14:08:47 +00:00
Benno Schulenberg
761fa7cd3a Plugging a memory leak by not copying a string twice.
This fixes Savannah bug #47206.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5676 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-25 13:52:54 +00:00
Chris Allegretta
16c037fdb0 Tweak KILL_TRAILING_SPACES. Still deciding on name...
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5675 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-24 04:46:44 +00:00
Benno Schulenberg
6fef9208da Tweaking the Changelog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5674 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-23 12:49:08 +00:00
Benno Schulenberg
f5eb316603 Rewrapping and reshuffling some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5673 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-23 12:37:10 +00:00
Benno Schulenberg
a9a32d6d89 Centering the cursor when the thing being undone or redone is currently
off the screen.

See https://lists.gnu.org/archive/html/nano-devel/2016-02/msg00104.html.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5672 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-23 12:18:10 +00:00
Benno Schulenberg
287f78a26b Not moving the cursor when copying a backwardly marked region.
This fixes Savannah bug #46980.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5671 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-23 12:07:58 +00:00
Benno Schulenberg
8a2dd978f8 Renaming a variable, for contrast and correctness.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5670 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-23 08:31:57 +00:00
Benno Schulenberg
6a002f5196 Using the correct column number also when messages are skipped.
And not minding when the column number is zero or negative.
This partially fixes Savannah bug #47131.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5669 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 19:49:45 +00:00
Benno Schulenberg
7dd1030b15 Showing the cursor in the edit window when linting.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5668 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 18:34:04 +00:00
Benno Schulenberg
e085ebb872 Making the cursor visible again after a justification and after an
unrecognized escape sequence.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5667 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 17:15:28 +00:00
Benno Schulenberg
27e1e83e8c As the charmove() already copies the terminating null byte,
there is no need to put one in.  Just trim the allocation.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5666 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 16:51:39 +00:00
Chris Allegretta
0dec394303 Make that kill_spaces_on_justify, add hilighting.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5665 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 15:23:57 +00:00
Chris Allegretta
6a0ae5aaa2 2016-02-22 Chris Allegretta <chrisa@asty.org>
* Add ability to kill the trailing spaces when justifying
        code.  New nanorc option kill_spaces_on_wrap, we'll see
        whether this warrants a command line flahg or not.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5664 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 15:10:32 +00:00
Benno Schulenberg
3ed08c568f Eliding a variable -- there is no need to optimize for calls of strlen(),
as this is typing speed, no need to hurry.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5663 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 14:26:05 +00:00
Benno Schulenberg
7c0e433305 Not moving too many bytes -- that is: not moving them beyond the
allocated buffer.  This fixes Savannah bug #47219.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5662 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 13:17:53 +00:00
Benno Schulenberg
c115166f5b Sorting the prev_word() and next_word() functions in the standard way:
the backward one first.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5661 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 12:49:08 +00:00
Benno Schulenberg
9d8c72951f The amount to scroll is never zero, so there is no need to check.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5660 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 09:55:59 +00:00
Benno Schulenberg
818a39cfb9 Condensing some code by factoring out a repetition.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5659 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 09:34:33 +00:00
Benno Schulenberg
f4f9954556 Eliding the function free_openfilestruct() as it is used only once.
(Note that openfile cannot be NULL here.  And in case it is,
nano should crash because DEBUG is enabled.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5658 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 09:02:58 +00:00
Benno Schulenberg
814a4220a2 Removing four unneeded checks for NULL.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5657 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-21 20:54:04 +00:00
Benno Schulenberg
801b3ce675 Not requiring a third Tab to show the list of possible completions
when the first Tab added the part that all matches have in common.

So now two Tabs in a row will always show the list of possible
completions -- if there /are/ any completions.  Which means that
a second Tab will either: 1) do nothing, when the name is complete
and exists; 2) beep, when nothing in the current directory starts
with the current string; 3) show the list of matches.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5656 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-21 13:33:52 +00:00
Benno Schulenberg
acf19bde22 Reducing an allocation to what is actually needed.
This undoes the papering-over of the just-fixed bug.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5655 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-20 16:35:09 +00:00
Benno Schulenberg
0f64fe0af2 Parsing a character in the correct buffer: in the first match
instead of in the given string.  This fixes Savannah bug #47199.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5654 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-20 12:30:07 +00:00
Benno Schulenberg
e86dc0381c Avoiding a memory leak when tabbing on a string that doesn't occur in the
history.  This fixes Savannah bug #47124 reported by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5653 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-20 12:16:43 +00:00
Benno Schulenberg
5fa5ccff43 Deleting a debugging leftover.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5652 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-18 20:10:02 +00:00
Benno Schulenberg
9703934479 Allowing the parameter of free_filestruct() to be NULL,
so we can delete four annoying pre-checks.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5651 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-18 19:58:18 +00:00
Benno Schulenberg
56cfab3df6 Fixing Savannah bug #47127 the proper way,
eliding two silly calls of edit_redraw().


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5650 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-18 16:31:02 +00:00
Benno Schulenberg
2163d961a1 Deleting two dead prototypes, adjusting two comments for correctness,
and two other minute tweaks.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5649 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-16 10:09:26 +00:00
Benno Schulenberg
16ba6df68c Deleting a redundant assignment. The multidata pointer is already
set to NULL in make_new_node(), a few lines earlier.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5648 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-16 09:06:21 +00:00
Benno Schulenberg
706f01422d Avoiding the loss a buffer when getcwd() fails.
This fixes Savannah bug #47129 reported by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5647 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-15 16:24:39 +00:00
Benno Schulenberg
6c0e5e3f2c Freeing not just the struct but also the data it contains,
and also when it is the first and only line.
This fixes Savannah bug #47153 reported by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5646 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-15 12:56:18 +00:00
Benno Schulenberg
8d005c8743 Saying that the 2.5 branch is a "rolling" release, that lock files are done,
and preparing for 2.5.3.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5645 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-14 12:17:17 +00:00
Benno Schulenberg
e540053eb3 Renaming and condensing some stuff, and correcting the main comment,
because 'allow_cntrls == FALSE' meant that controls were being filtered.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5644 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-14 12:03:47 +00:00
Benno Schulenberg
ef16a2a250 Doing the copying of typed stuff from input to output just once.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5643 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-14 11:16:54 +00:00
Benno Schulenberg
15947ac871 Restoring the mentioned behavior also for the internal spell fixer.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5642 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-14 10:29:48 +00:00
Benno Schulenberg
f3a1d7ba06 Making the iteration through replacement matches behave the same again as the
iteration through search matches: showing them centered when found offscreen.
This fixes Savannah bug #47127.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5641 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-14 10:19:27 +00:00
Benno Schulenberg
568d2a389c Switching the cursor on and off at the appropriate moments (that is: when
needed), so that it no longer shows in the help screen nor in the file list.
This fixes Savannah bug #47126.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5640 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-13 19:41:12 +00:00
Benno Schulenberg
ec3cd1eeae Allocating enough space for printing out the line and column numbers.
This fixes Savannah bug #47135.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5639 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-13 17:00:06 +00:00
Benno Schulenberg
813f9f72d0 Rebuilding the file list only when necessary, and not for each and every
cursor movement.  This fixes Savannah bug #47133.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5638 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-13 16:42:30 +00:00
Chris Allegretta
0db28259ad Back to SVN, and fix typo in NEWS
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5637 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-12 05:36:40 +00:00
59 changed files with 11170 additions and 11109 deletions

140
ChangeLog
View File

@@ -1,3 +1,99 @@
GNU nano 2.5.3 - 2016.02.25
2016-02-25 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (do_browser): Plug a memory leak by not copying
a string twice. This fixes Savannah bug #47206.
* src/browser.c (do_browser): Now put things in the proper order.
* src/files.c (make_new_buffer), src/nano.c (splice_opennode): Elide
the latter function, by handling the two cases (the creation of the
first element, and the insertion of a new element) directly.
2016-02-23 Benno Schulenberg <bensberg@justemail.net>
* src/prompt.c (do_statusbar_output, do_statusbar_delete):
Rename a variable, for contrast and correctness.
* src/cut.c (do_copy_text): Don't move the cursor when copying a
backwardly marked region. This fixes Savannah bug #46980.
* src/text.c (do_undo, do_redo): Center the cursor when the
thing being undone or redone is currently off the screen.
* src/{files,nano,winio}.c: Rewrap and reshuffle some lines.
2016-02-22 Chris Allegretta <chrisa@asty.org>
* Add the ability to kill the trailing spaces when justifying text,
by adding a new nanorc option 'justifytrim' -- we'll see
whether this warrants a command-line flag or not. Now with slightly
better logic for multi-spaced lines.
2016-02-22 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (free_openfilestruct): Elide this function.
* scr/global.c (thanks_for_all_the_fish, free_list_item): Condense.
* src/winio.c (edit_scroll): The amount to scroll is never zero.
* src/prompt.c (do_statusbar_prev_word, do_statusbar_next_word),
src/move.c (do_prev_word, do_next_word): Sort these in standard way.
* src/prompt.c (do_statusbar_output): Don't move too many bytes.
This fixes Savannah bug #47219 (uncovered by r5655).
* src/prompt.c (do_statusbar_output): Elide a variable.
* src/prompt.c (do_statusbar_delete): There is no need for nulling:
the charmove() already copies the terminating null byte.
* src/text.c (do_justify), src/winio.c (parse_escape_sequence):
Show the cursor after a justification and after an unrecognized
escape sequence, and in the edit window when linting.
* src/text.c (do_linter): Use the correct column number, also when
messages are skipped. And don't mind zero or negative numbers.
This is a partial fix for Savannah bug #47131.
2016-02-21 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (input_tab): If the first Tab added the part that all
matches have in common, don't require a third Tab to show the list.
* scr/global.c (thanks_for_all_the_fish): Remove unneeded checks.
2016-02-20 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (get_history_completion): Avoid leaking memory
when tabbing on a string that does not occur in the history.
This fixes Savannah bug #47124 reported by Mike Frysinger.
* src/files.c (input_tab): Parse a character in the correct
buffer. This fixes Savannah bug #47199.
* src/prompt.c (do_statusbar_output): Reduce an allocation to what
is actually needed. This undoes the papering-over of above bug.
2016-02-18 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_replace_loop), src/text.c (do_int_spell_fix),
src/winio.c (edit_refresh): Fix Savannah bug #47127 the proper way.
* src/nano.c (free_filestruct): Allow the parameter to be NULL.
* src/search.c (search_init): Delete a debugging leftover.
2016-02-16 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (initialize_buffer_text): Delete redundant assignment.
2016-02-15 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (read_file): Free not just the struct but also the
data it contains, and also when it is the first and only line.
This fixes Savannah bug #47153 reported by Mike Frysinger.
* src/files.c (get_full_path): Avoid losing a buffer when getcwd()
fails. This fixes Savannah bug #47129 reported by Mike Frysinger.
2016-02-14 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_replace_loop): Make iterating through replacement
matches behave again like iterating through search matches: showing
them centered when found offscreen. This fixes Savannah bug #47127.
* src/text.c (do_int_spell_fix): Restore the above behavior also for
the internal spell fixer.
* src/prompt.c (do_statusbar_input, do_statusbar_verbatim_input,
do_statusbar_output): Do the copying from input to output just once.
* src/prompt.c (do_statusbar_output): Rename and condense some stuff,
and correct the main comment: filtering means allow_cntrls==FALSE.
* README, TODO, doc/man/{nano.1,rnano.1,nanorc.5}: Say that 2.5.x
is a "rolling" release, lock files are done, and prepare for 2.5.3.
2016-02-13 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (do_browser, browser_refresh): Rebuild the file list
only when necessary, not for each and every cursor movement. This
fixes Savannah bug #47133.
* src/files.c (save_poshistory): Allocate enough space for printing
out the line and column numbers. This fixes Savannah bug #47135.
* src/*.c: Switch the cursor on and off at the appropriate moments,
so that it no longer shows in the help screen nor in the file list.
This fixes Savannah bug #47126.
GNU nano 2.5.2 - 2016.02.12
2016-02-11 Benno Schulenberg <bensberg@justemail.net>
@@ -148,7 +244,7 @@ GNU nano 2.5.2 - 2016.02.12
* src/winio.c (set_modified): Plug another memory leak.
* src/files.c (set_modified): Move this function to its habitat.
* src/files.c (open_file): Return the fantastic file descriptor
when opening a non-existent file for reading succeeds.
when the opening of a non-existent file for reading succeeds.
* src/nano.c (delete_opennode), src/text.c (discard_until):
Free the items on the undo stack when a buffer is closed.
This fixes Savannah bug #46904 reported by Mike Frysinger.
@@ -317,7 +413,7 @@ GNU nano 2.5.1 - 2016.01.11
GNU nano 2.5.0 - 2015.12.05
2015-12-05 Chris Allegretta <chrisa@asty.org>
2015-12-05 Chris Allegretta <chrisa@asty.org>
* src/nano.c (main): key_defined() is an ncurses-ism. Add better
checks for this.
@@ -1123,7 +1219,7 @@ GNU nano 2.4.1 - 2015.04.14
possible bailout because of a zero-sized region.
* NEWS: Option --noread allows writing, not reading, to named pipes.
2015-03-22 Chris Allegretta <chrisa@asty.org>
2015-03-22 Chris Allegretta <chrisa@asty.org>
* src/text.c (do_alt_speller): timestamp can just be a time_t.
Fixes compilation on win32 and macOS.
@@ -1193,7 +1289,7 @@ GNU nano 2.4.0 - 2015.03.22
GNU nano 2.3.99pre3 - 2015.02.27
2015-02-25 Chris Allegretta <chrisa@asty.org>
2015-02-25 Chris Allegretta <chrisa@asty.org>
* src/rcfile.c (parse_binding): Add an exception for do_toggle() as
rebinding toggles broke with r5022. (Fixed in r5134.)
@@ -1212,7 +1308,7 @@ GNU nano 2.3.99pre3 - 2015.02.27
when finding a lock file, for when many files are opened at once.
* src/file.c (do_lockfile): The user does the editing, not the editor.
2015-02-09 Chris Allegretta <chrisa@asty.org>
2015-02-09 Chris Allegretta <chrisa@asty.org>
* nano.spec.in: Add dependency on texinfo, docdir files for
RPM file creation.
@@ -1238,14 +1334,14 @@ GNU nano 2.3.99pre2 - 2015.02.06
* src/nano.c (version), src/winio.c (do_credits): Update the copyright
years to include 2015.
2015-01-13 Chris Allegretta <chrisa@asty.org>
2015-01-13 Chris Allegretta <chrisa@asty.org>
* src/files.c (open_buffer): Check here for locking and properly
handle choosing to not open a file when locked instead of in
open_file(). Fixes Savannah bug #42373 reported by Benno Schulenberg.
GNU nano 2.3.99pre1 - 2015.01.06
2015-01-03 Chris Allegretta <chrisa@asty.org>
2015-01-03 Chris Allegretta <chrisa@asty.org>
* New formatter code to support syntaxes like
go which have tools to automatically lint and reformat the text for
you (gofmt), which is lovely. rcfile option formatter, function
@@ -1368,13 +1464,13 @@ GNU nano 2.3.6 - 2014.07.17
GNU nano 2.3.5 - 2014.07.11
2014-07-11 Chris Allegretta <chrisa@asty.org>
2014-07-11 Chris Allegretta <chrisa@asty.org>
* src/files.c (do_lockfile, open_file): If locking fails,
allow the lock failure message to be preserved AND
preserve the filename passed on the cmdline. Fixes
Savannah bug #42668.
2014-07-02 Chris Allegretta <chrisa@asty.org>
2014-07-02 Chris Allegretta <chrisa@asty.org>
* src/files.c (do_lockfile): Check whether the directory
of the file we're trying to lock exists, and make the
resulting error message more intuitive. Fixes
@@ -1699,7 +1795,7 @@ GNU nano 2.3.5 - 2014.07.11
GNU nano 2.3.4 - 2014.06.02
2014-06-02 Chris Allegretta <chrisa@asty.org>
2014-06-02 Chris Allegretta <chrisa@asty.org>
* doc/syntax/default.nanorc: Can't do trailing spaces in the
default syntax or it will hilight the spaces as you type them
into a new file, which for non-programming is infuriating.
@@ -1708,14 +1804,14 @@ GNU nano 2.3.4 - 2014.06.02
* src/text.c (do_delete): For the undo structure, differentiate
between deleting a newline and any other character.
2014-05-29 Chris Allegretta <chrisa@asty.org>
2014-05-29 Chris Allegretta <chrisa@asty.org>
* src/chars.c (addstrings): This function needs to be available even
on non-utf-8 systems.
* nano-regress: Added --disable-utf8 to regression check.
GNU nano 2.3.3 - 2014.05.29
2014-05-28 Chris Allegretta <chrisa@asty.org>
2014-05-28 Chris Allegretta <chrisa@asty.org>
* doc/syntax/mutt.nanorc: Include Benno's awesome signature
matcher, modified slightly to also work for quoted sigs.
* doc/syntax/default.nanorc: Be far more gentle with something
@@ -1743,7 +1839,7 @@ GNU nano 2.3.3 - 2014.05.29
* src/global.c (shortcut_init): Standardize the add_to_funcs() calls,
breaking always between the menus and the tag.
2014-05-27 Chris Allegretta <chrisa@asty.org>
2014-05-27 Chris Allegretta <chrisa@asty.org>
* src/winio.c (edit_refresh): wredrawln() is not supported under
slang.
@@ -1870,7 +1966,7 @@ GNU nano 2.3.3 - 2014.05.29
* src/rcfile.c: Move parse_magic_exp() next to its sister.
* src/color.c (color_update): Rename a variable, and elide another.
2014-05-10 Chris Allegretta <chrisa@asty.org>
2014-05-10 Chris Allegretta <chrisa@asty.org>
* src/rcfile.c (parse_color_names): Redefine false and true to
their appropriate macro names so --with-slang works (slangv2 anyway).
* src/text.c (do_linter): Care about whether user cancelled the file
@@ -2212,7 +2308,7 @@ GNU nano 2.3.3 - 2014.05.29
* src/search.c (search_init): Silence a compiler warning about a
variable possibly being used uninitialized.
2014-03-31 Chris Allegretta <chrisa@asty.org>
2014-03-31 Chris Allegretta <chrisa@asty.org>
* doc/syntax/go.nanorc: New file, basic go syntax highlighting.
2014-03-30 Benno Schulenberg <bensberg@justemail.net>
@@ -2340,7 +2436,7 @@ GNU nano 2.3.3 - 2014.05.29
* src/move.c (do_down): Initialize the correct variable to zero.
Solves jumpy scrolling behaviour reported by Chris Allegretta.
2014-03-04 Chris Allegretta <chrisa@asty.org>
2014-03-04 Chris Allegretta <chrisa@asty.org>
* global.c (first_sc_for): Return raw keystrokes last, so
they will not be displayed if there are F-keys or Meta keys
mapped for an item in the shortcut list.
@@ -2357,7 +2453,7 @@ GNU nano 2.3.3 - 2014.05.29
Remove erroneous 'suspendenable' -- it is not a settable option
but a bindable function.
2014-03-03 Chris Allegretta <chrisa@asty.org>
2014-03-03 Chris Allegretta <chrisa@asty.org>
* global.c (shortcut_init): Don't actually free the shortcut
list, since the next pass via justifying will then remove all
custom shortcuts. Fixes bug discovered by Benno Schulenberg.
@@ -2378,7 +2474,7 @@ GNU nano 2.3.3 - 2014.05.29
to the texinfo documentation, and improve alphabetization a bit.
* src/nano.c (usage): Don't mention --softwrap in tiny version.
2014-03-01 Chris Allegretta <chrisa@asty.org>
2014-03-01 Chris Allegretta <chrisa@asty.org>
* global.c (shortcut_init): Fix an issue with the split
do_research() setup when using --enable-tiny.
* rcfile.c (parse_linter): Allow linter to be unset using "".
@@ -2474,7 +2570,7 @@ GNU nano 2.3.3 - 2014.05.29
nano-devel in August 2010: after typing ^R ^T ^W ^G ^X, the file
being edited would get displayed instead of the list of files.
2014-02-24 Chris Allegretta <chrisa@asty.org>
2014-02-24 Chris Allegretta <chrisa@asty.org>
* New linter functionality, rcfile option "linter".
* src/global.c (shortcut_init): Actually free the sclist
if it was allocated before.
@@ -2529,7 +2625,7 @@ GNU nano 2.3.3 - 2014.05.29
2014-02-22 David Lawrence Ramsey <pooka109@gmail.com>
* ChangeLog, NEWS, doc/faq.html: Fix typos, wording, and spacing.
2014-01-25 Chris Allegretta <chrisa@asty.org>
2014-01-25 Chris Allegretta <chrisa@asty.org>
* src/winio.c (set_modified): Check for a filename before trying to lock.
2014-01-24 Benno Schulenberg <bensberg@justemail.net>
@@ -2538,12 +2634,12 @@ GNU nano 2.3.3 - 2014.05.29
Savannah patch #8180 and fixes the segfault reported on the list:
https://lists.gnu.org/archive/html/nano-devel/2012-07/msg00000.html.
2014-01-01 Chris Allegretta <chrisa@asty.org>
2014-01-01 Chris Allegretta <chrisa@asty.org>
* doc/texinfo/nano.texi: Change '@sp4' since makeinfo 5.1 hates the
lack of spacing. Fixes bug #40103 reported by flapane@Savannah.
Also change SVN status to non-binary so diffs work.
2014-01-01 Chris Allegretta <chrisa@asty.org>
2014-01-01 Chris Allegretta <chrisa@asty.org>
* src/global.c (strtokeytype): Check for lower-case 'f' for defining F-key
sequences for consistency (previously was two checks for upper case 'F').
Fixes bug #40815 reported by David Binderman <dcb314@Savannah>.

12
NEWS
View File

@@ -1,7 +1,17 @@
2016.02.25 - GNU nano 2.5.3 "Alphys" is released. This release
contains fixes for bugs like: stray cursor positioning
errors, many many memory leaks including file reading,
using the file browser, searching for multi-byte characters,
history completion, and many other places.
New features include the ability to trim whitespace
from the ends of lines when justifying text, see nanorc(5)
option justifytrim for deets. As always thank you for your
continued support of nano, and keep sparing.
2016.02.12 - GNU nano 2.5.2 is carrying too many dogs. This release includes
several fixes for various memory leaks, position history
size growth, and a long standing issue with using
nano under sudo creading root-owned files. There are also
nano under sudo creating root-owned files. There are also
the usual bevy of documentation and other miscellaneous
fixes and touch ups. Upgrade today while supplies last,
operators are standing by!

5
README
View File

@@ -68,6 +68,5 @@ Mailing Lists and Bug Reports
Current Status
GNU nano has reached its fifth stable milestone, 2.4.x.
Development of new features will continue in the 2.5.x branch,
while 2.4.x versions are dedicated to bug-fixing and polishing.
GNU nano has reached its sixth milestone, 2.5.x. This is now a
"rolling" release: bug fixing and development go hand in hand.

4
TODO
View File

@@ -2,8 +2,6 @@ TODO file (? means the feature may be implemented, but not definitely)
------------------------------------------------------------------------
For the future (no targeted version, catch-all)
- Compatibility with vi/emacs status files so we can let other editors
know we're in a file?
- FriBidi support?
- Port to DJGPP?
- Make matching bracket searches sophisticated enough to skip over
@@ -42,6 +40,8 @@ For version 2.4:
wherever we were before we resized, as Pico does. [DONE]
- Allow even better file-type detection than we have currently, e.g.
through libmagic. [DONE]
- Compatibility with vim status files to let other editors know we're
in a file. [DONE]
For version 2.2:
- Rebindable keys? [DONE]

View File

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

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.2" "February 2016"
.TH NANO 1 "version 2.5.3" "February 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.2" "February 2016"
.TH NANORC 5 "version 2.5.3" "February 2016"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -111,6 +111,9 @@ See \fBset titlecolor\fR for more details.
Enable the use of \fB~/.nano/search_history\fP for saving and reading
search/replace strings.
.TP
.B set justifytrim
When justifying text, trailing newlines will automatically be removed.
.TP
.B set keycolor \fIfgcolor\fR,\fIbgcolor\fR
Specify the color combination to use for the shortcut key combos
in the two help lines at the bottom of the screen.

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.2" "February 2016"
.TH RNANO 1 "version 2.5.3" "February 2016"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME

View File

@@ -60,6 +60,9 @@
## Remember the used search/replace strings for the next session.
# set historylog
## Have the justify command kill whitespace at the end of lines
# set justifytrim
## Enable vim-style lock-files. This is just to let a vim user know you
## are editing a file [s]he is trying to edit and vice versa. There are
## no plans to implement vim-style undo state in these files.

View File

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

608
po/bg.po

File diff suppressed because it is too large Load Diff

624
po/ca.po

File diff suppressed because it is too large Load Diff

602
po/cs.po

File diff suppressed because it is too large Load Diff

608
po/da.po

File diff suppressed because it is too large Load Diff

626
po/de.po

File diff suppressed because it is too large Load Diff

686
po/eo.po

File diff suppressed because it is too large Load Diff

602
po/es.po

File diff suppressed because it is too large Load Diff

608
po/eu.po

File diff suppressed because it is too large Load Diff

602
po/fi.po

File diff suppressed because it is too large Load Diff

623
po/fr.po

File diff suppressed because it is too large Load Diff

612
po/ga.po

File diff suppressed because it is too large Load Diff

602
po/gl.po

File diff suppressed because it is too large Load Diff

1178
po/hr.po

File diff suppressed because it is too large Load Diff

602
po/hu.po

File diff suppressed because it is too large Load Diff

612
po/id.po

File diff suppressed because it is too large Load Diff

602
po/it.po

File diff suppressed because it is too large Load Diff

612
po/ja.po

File diff suppressed because it is too large Load Diff

608
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

622
po/nb.po

File diff suppressed because it is too large Load Diff

622
po/nl.po

File diff suppressed because it is too large Load Diff

613
po/nn.po

File diff suppressed because it is too large Load Diff

602
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

624
po/ro.po

File diff suppressed because it is too large Load Diff

612
po/ru.po

File diff suppressed because it is too large Load Diff

612
po/sl.po

File diff suppressed because it is too large Load Diff

602
po/sr.po

File diff suppressed because it is too large Load Diff

602
po/sv.po

File diff suppressed because it is too large Load Diff

612
po/tr.po

File diff suppressed because it is too large Load Diff

623
po/uk.po

File diff suppressed because it is too large Load Diff

667
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

@@ -61,6 +61,7 @@ char *do_browser(char *path, DIR *dir)
functionptrtype func;
/* The function of the key the user typed in. */
/* Don't show a cursor in the file list. */
curs_set(0);
blank_statusbar();
bottombars(MBROWSER);
@@ -115,9 +116,23 @@ char *do_browser(char *path, DIR *dir)
/* The path we switch to at the "Go to Directory"
* prompt. */
/* Display the file list if we don't have a key, or if the
* selected file has changed, and set width in the process. */
if (kbinput == ERR || old_selected != selected)
/* Make sure that the cursor is off. */
curs_set(0);
#ifndef NANO_TINY
if (kbinput == KEY_WINCH) {
/* Rebuild the file list and sort it. */
browser_init(path_save, opendir(path_save));
qsort(filelist, filelist_len, sizeof(char *), diralphasort);
/* Make sure the selected file is within range. */
if (selected >= filelist_len)
selected = filelist_len - 1;
}
#endif
/* Display (or redisplay) the file list if we don't have a key yet,
* or the list has changed, or the selected file has changed. */
if (kbinput == ERR || kbinput == KEY_WINCH || old_selected != selected)
browser_refresh();
old_selected = selected;
@@ -125,11 +140,8 @@ char *do_browser(char *path, DIR *dir)
kbinput = get_kbinput(edit);
#ifndef NANO_TINY
if (kbinput == KEY_WINCH) {
kbinput = ERR;
curs_set(0);
if (kbinput == KEY_WINCH)
continue;
}
#endif
#ifndef DISABLE_MOUSE
@@ -170,17 +182,14 @@ char *do_browser(char *path, DIR *dir)
} else if (func == do_help_void) {
#ifndef DISABLE_HELP
do_help_void();
/* Perhaps the window dimensions have changed. */
browser_refresh();
curs_set(0);
/* The window dimensions might have changed, so act as if. */
kbinput = KEY_WINCH;
#else
say_there_is_no_help();
#endif
} else if (func == do_search) {
/* Search for a filename. */
curs_set(1);
do_filesearch();
curs_set(0);
} else if (func == do_research) {
/* Search for another filename. */
do_fileresearch();
@@ -199,7 +208,6 @@ char *do_browser(char *path, DIR *dir)
selected = filelist_len - 1;
} else if (func == goto_dir_void) {
/* Go to a specific directory. */
curs_set(1);
i = do_prompt(TRUE,
#ifndef DISABLE_TABCOMP
FALSE,
@@ -211,7 +219,6 @@ char *do_browser(char *path, DIR *dir)
/* TRANSLATORS: This is a prompt. */
browser_refresh, _("Go To Directory"));
curs_set(0);
bottombars(MBROWSER);
/* If the directory begins with a newline (i.e. an
@@ -311,22 +318,22 @@ char *do_browser(char *path, DIR *dir)
* get out. */
retval = mallocstrcpy(NULL, filelist[selected]);
break;
} else if (strcmp(tail(filelist[selected]), "..") == 0)
/* We've successfully opened the parent directory,
* save the current directory in prev_dir, so that
* we can easily return to it by hitting Enter. */
prev_dir = mallocstrcpy(NULL, striponedir(filelist[selected]));
}
dir = opendir(filelist[selected]);
if (dir == NULL) {
/* We can't open this directory for some reason.
* Complain. */
statusbar(_("Error reading %s: %s"),
filelist[selected], strerror(errno));
beep();
continue;
}
/* If we moved up one level, remember where we came from, so
* this directory can be highlighted and easily reentered. */
if (strcmp(tail(filelist[selected]), "..") == 0)
prev_dir = striponedir(filelist[selected]);
path = mallocstrcpy(path, filelist[selected]);
/* Start over again with the new path value. */
@@ -338,7 +345,6 @@ char *do_browser(char *path, DIR *dir)
}
titlebar(NULL);
edit_refresh();
curs_set(1);
if (old_const_update)
SET(CONST_UPDATE);
@@ -548,14 +554,6 @@ void browser_refresh(void)
char *foo;
/* The additional information that we'll display about a file. */
/* Perhaps window dimensions have changed; reinitialize the browser. */
browser_init(path_save, opendir(path_save));
qsort(filelist, filelist_len, sizeof(char *), diralphasort);
/* Make sure the selected file is within range. */
if (selected >= filelist_len)
selected = filelist_len - 1;
titlebar(path_save);
blank_edit();

View File

@@ -57,7 +57,7 @@ bool using_utf8(void)
#endif /* ENABLE_UTF8 */
/* Concatenate two allocated strings. */
char* addstrings(char* str1, size_t len1, char* str2, size_t len2)
char *addstrings(char* str1, size_t len1, char* str2, size_t len2)
{
str1 = charealloc(str1, len1 + len2 + 1);
str1[len1] = '\0';

View File

@@ -134,9 +134,8 @@ void do_cut_text(
assert(openfile->current != NULL && openfile->current->data != NULL);
/* If keep_cutbuffer is FALSE and the cutbuffer isn't empty, blow
* away the text in the cutbuffer. */
if (!keep_cutbuffer && cutbuffer != NULL) {
/* Empty the cutbuffer when a chain of cuts is broken. */
if (!keep_cutbuffer) {
free_filestruct(cutbuffer);
cutbuffer = NULL;
#ifdef DEBUG
@@ -238,6 +237,11 @@ void do_copy_text(void)
static struct filestruct *next_contiguous_line = NULL;
bool mark_set = openfile->mark_set;
/* Remember the current view port and cursor position. */
ssize_t is_edittop_lineno = openfile->edittop->lineno;
ssize_t is_current_lineno = openfile->current->lineno;
size_t is_current_x = openfile->current_x;
if (mark_set || openfile->current != next_contiguous_line)
cutbuffer_reset();
@@ -245,6 +249,13 @@ void do_copy_text(void)
/* If the mark was set, blow away the cutbuffer on the next copy. */
next_contiguous_line = (mark_set ? NULL : openfile->current);
if (mark_set) {
/* Restore the view port and cursor position. */
openfile->edittop = fsfromline(is_edittop_lineno);
openfile->current = fsfromline(is_current_lineno);
openfile->current_x = is_current_x;
}
}
/* Cut from the current cursor position to the end of the file. */

View File

@@ -71,17 +71,25 @@ bool has_valid_path(const char *filename)
* called from open_buffer(). */
void make_new_buffer(void)
{
/* If there are no entries in openfile, make the first one and
* move to it. */
if (openfile == NULL) {
openfile = make_new_opennode();
splice_opennode(openfile, openfile, openfile);
/* Otherwise, make a new entry for openfile, splice it in after
* the current entry, and move to it. */
/* Make the first open file the only element in a circular list. */
openfile->prev = openfile;
openfile->next = openfile;
} else {
splice_opennode(openfile, make_new_opennode(), openfile->next);
openfile = openfile->next;
/* More than one file open, show Close in help lines. */
openfilestruct *newnode = make_new_opennode();
/* Add the new open file after the current one in the list. */
newnode->prev = openfile;
newnode->next = openfile->next;
openfile->next->prev = newnode;
openfile->next = newnode;
/* Make the new file the current one. */
openfile = newnode;
/* There is more than one file open: show Close in help lines. */
exitfunc->desc = close_tag;
}
@@ -128,10 +136,6 @@ void initialize_buffer_text(void)
openfile->edittop = openfile->fileage;
openfile->current = openfile->fileage;
#ifndef DISABLE_COLOR
openfile->fileage->multidata = NULL;
#endif
openfile->totsize = 0;
}
@@ -871,6 +875,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
/* If the file we got doesn't end in a newline, tack its last
* line onto the beginning of the line at current. */
if (len > 0) {
filestruct *dropline = fileptr;
size_t current_len = strlen(openfile->current->data);
/* Adjust the current x-coordinate to compensate for the
@@ -896,11 +901,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
if (fileptr == openfile->filebot)
openfile->filebot = openfile->current;
/* Move fileptr back one line and blow away the old fileptr,
* since its text has been saved. */
/* Step back one line, and blow away the unterminated line,
* since its text has been copied into current. */
fileptr = fileptr->prev;
if (fileptr != NULL)
free(fileptr->next);
delete_node(dropline);
}
/* Attach the line at current after the line at fileptr. */
@@ -1413,14 +1417,13 @@ char *get_full_path(const char *origpath)
/* Get the current directory. If it doesn't exist, back up and try
* again until we get a directory that does, and use that as the
* current directory. */
d_here = charalloc(PATH_MAX + 1);
d_here = getcwd(d_here, PATH_MAX + 1);
d_here = getcwd(NULL, PATH_MAX + 1);
while (d_here == NULL) {
if (chdir("..") == -1)
break;
d_here = getcwd(d_here, PATH_MAX + 1);
d_here = getcwd(NULL, PATH_MAX + 1);
}
/* If we succeeded, canonicalize it in d_here. */
@@ -1481,8 +1484,7 @@ char *get_full_path(const char *origpath)
free(d_there);
/* Get the full path. */
d_there = charalloc(PATH_MAX + 1);
d_there = getcwd(d_there, PATH_MAX + 1);
d_there = getcwd(NULL, PATH_MAX + 1);
/* If we succeeded, canonicalize it in d_there. */
if (d_there != NULL) {
@@ -2556,8 +2558,8 @@ char *real_dir_from_tilde(const char *buf)
do {
userdata = getpwent();
} while (userdata != NULL && strcmp(userdata->pw_name,
tilde_dir + 1) != 0);
} while (userdata != NULL &&
strcmp(userdata->pw_name, tilde_dir + 1) != 0);
endpwent();
if (userdata != NULL)
tilde_dir = mallocstrcpy(tilde_dir, userdata->pw_dir);
@@ -2605,6 +2607,7 @@ void free_chararray(char **array, size_t len)
for (; len > 0; len--)
free(array[len - 1]);
free(array);
}
#endif
@@ -2671,9 +2674,8 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
#endif
matches = (char **)nrealloc(matches, (*num_matches + 1) *
sizeof(char *));
matches[*num_matches] =
charalloc(strlen(userdata->pw_name) + 2);
sizeof(char *));
matches[*num_matches] = charalloc(strlen(userdata->pw_name) + 2);
sprintf(matches[*num_matches], "~%s", userdata->pw_name);
++(*num_matches);
}
@@ -2699,8 +2701,7 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
*num_matches = 0;
null_at(&dirname, buf_len);
/* Okie, if there's a / in the buffer, strip out the directory
* part. */
/* Okie, if there's a / in the buffer, strip out the directory part. */
filename = strrchr(dirname, '/');
if (filename != NULL) {
char *tmpdirname = filename + 1;
@@ -2742,8 +2743,7 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
/* Cool, found a match. Add it to the list. This makes a
* lot more sense to me (Chris) this way... */
char *tmp = charalloc(strlen(dirname) +
strlen(nextdir->d_name) + 1);
char *tmp = charalloc(strlen(dirname) + strlen(nextdir->d_name) + 1);
sprintf(tmp, "%s%s", dirname, nextdir->d_name);
#ifndef DISABLE_OPERATINGDIR
@@ -2764,7 +2764,7 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
continue;
matches = (char **)nrealloc(matches, (*num_matches + 1) *
sizeof(char *));
sizeof(char *));
matches[*num_matches] = mallocstrcpy(NULL, nextdir->d_name);
++(*num_matches);
}
@@ -2797,8 +2797,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
const char *bob = strchr(buf, '/');
if (bob == NULL || bob >= buf + *place)
matches = username_tab_completion(buf, &num_matches,
*place);
matches = username_tab_completion(buf, &num_matches, *place);
}
/* Match against files relative to the current working directory. */
@@ -2813,8 +2812,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
size_t match, common_len = 0;
char *mzero;
const char *lastslash = revstrstr(buf, "/", buf + *place);
size_t lastslash_len = (lastslash == NULL) ? 0 :
lastslash - buf + 1;
size_t lastslash_len = (lastslash == NULL) ? 0 : lastslash - buf + 1;
char *match1_mb = charalloc(mb_cur_max() + 1);
char *match2_mb = charalloc(mb_cur_max() + 1);
int match1_mb_len, match2_mb_len;
@@ -2836,7 +2834,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
if (match < num_matches || matches[0][common_len] == '\0')
break;
common_len += parse_mbchar(buf + common_len, NULL, NULL);
common_len += parse_mbchar(matches[0] + common_len, NULL, NULL);
}
free(match1_mb);
@@ -2861,20 +2859,17 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
if (num_matches > 1 && (common_len != *place || !*lastwastab))
beep();
/* If there is more of a match to display on the statusbar, show
* it. We reset lastwastab to FALSE: it requires pressing Tab
* twice in succession with no statusbar changes to see a match
* list. */
/* If the matches have something in common, show that part. */
if (common_len != *place) {
*lastwastab = FALSE;
buf = charealloc(buf, common_len + buf_len - *place + 1);
charmove(buf + common_len, buf + *place, buf_len -
*place + 1);
charmove(buf + common_len, buf + *place, buf_len - *place + 1);
strncpy(buf, mzero, common_len);
*place = common_len;
} else if (!*lastwastab || num_matches < 2)
}
if (!*lastwastab)
*lastwastab = TRUE;
else {
else if (num_matches > 1) {
int longest_name = 0, ncols, editline = 0;
/* Now we show a list of the available choices. */
@@ -2907,7 +2902,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
blank_edit();
wmove(edit, 0, 0);
/* Disable el cursor. */
/* Don't show a cursor in the list of completions. */
curs_set(0);
for (match = 0; match < num_matches; match++) {
@@ -2923,8 +2918,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
break;
}
disp = display_string(matches[match], 0, longest_name,
FALSE);
disp = display_string(matches[match], 0, longest_name, FALSE);
waddstr(edit, disp);
free(disp);
@@ -2946,9 +2940,6 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
if (!*list)
refresh_func();
/* Enable el cursor. */
curs_set(1);
return buf;
}
#endif /* !DISABLE_TABCOMP */
@@ -2969,8 +2960,7 @@ const char *tail(const char *foo)
#ifndef DISABLE_HISTORIES
/* Return the constructed dirfile path, or NULL if we can't find the home
* directory. The string is dynamically allocated, and should be
* freed. */
* directory. The string is dynamically allocated, and should be freed. */
char *construct_filename(const char *str)
{
char *newstr = NULL;
@@ -3177,7 +3167,9 @@ void save_poshistory(void)
chmod(poshist, S_IRUSR | S_IWUSR);
for (posptr = position_history; posptr != NULL; posptr = posptr->next) {
statusstr = charalloc(strlen(posptr->filename) + 2 * sizeof(ssize_t) + 4);
/* Assume 20 decimal positions each for line and column number,
* plus two spaces, plus the line feed, plus the null byte. */
statusstr = charalloc(strlen(posptr->filename) + 44);
sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno,
(long)posptr->xno);
if (fwrite(statusstr, sizeof(char), strlen(statusstr), hist) < strlen(statusstr))

View File

@@ -1623,6 +1623,17 @@ int strtomenu(const char *input)
#ifdef DEBUG
#ifndef DISABLE_COLOR
void free_list_item(regexlisttype *dropit)
{
free(dropit->ext_regex);
if (dropit->ext != NULL)
regfree(dropit->ext);
free(dropit->ext);
free(dropit);
}
#endif
/* This function is used to gracefully return all the memory we've used.
* It should be called just before calling exit(). Practically, the
* only effect is to cause a segmentation fault if the various data
@@ -1654,15 +1665,16 @@ void thanks_for_all_the_fish(void)
#ifndef DISABLE_SPELLER
free(alt_speller);
#endif
if (cutbuffer != NULL)
free_filestruct(cutbuffer);
free_filestruct(cutbuffer);
#ifndef DISABLE_JUSTIFY
if (jusbuffer != NULL)
free_filestruct(jusbuffer);
free_filestruct(jusbuffer);
#endif
/* Free the memory associated with each open file buffer. */
if (openfile != NULL)
free_openfilestruct(openfile);
while (openfile != openfile->next) {
openfile = openfile->next;
delete_opennode(openfile->prev);
}
delete_opennode(openfile);
#ifndef DISABLE_COLOR
free(syntaxstr);
while (syntaxes != NULL) {
@@ -1671,47 +1683,32 @@ void thanks_for_all_the_fish(void)
free(syntaxes->desc);
free(syntaxes->linter);
free(syntaxes->formatter);
while (syntaxes->extensions != NULL) {
regexlisttype *bob = syntaxes->extensions;
syntaxes->extensions = bob->next;
free(bob->ext_regex);
if (bob->ext != NULL) {
regfree(bob->ext);
free(bob->ext);
}
free(bob);
free_list_item(bob);
}
while (syntaxes->headers != NULL) {
regexlisttype *bob = syntaxes->headers;
syntaxes->headers = bob->next;
free(bob->ext_regex);
if (bob->ext != NULL) {
regfree(bob->ext);
free(bob->ext);
}
free(bob);
free_list_item(bob);
}
while (syntaxes->magics != NULL) {
regexlisttype *bob = syntaxes->magics;
syntaxes->magics = bob->next;
free(bob->ext_regex);
if (bob->ext != NULL) {
regfree(bob->ext);
free(bob->ext);
}
free(bob);
free_list_item(bob);
}
while (syntaxes->color != NULL) {
colortype *bob = syntaxes->color;
syntaxes->color = bob->next;
free(bob->start_regex);
if (bob->start != NULL) {
regfree(bob->start);
free(bob->start);
}
if (bob->end_regex != NULL)
free(bob->end_regex);
free(bob->end_regex);
if (bob->end != NULL) {
regfree(bob->end);
free(bob->end);
@@ -1724,17 +1721,16 @@ void thanks_for_all_the_fish(void)
#endif /* !DISABLE_COLOR */
#ifndef DISABLE_HISTORIES
/* Free the search and replace history lists. */
if (searchage != NULL)
free_filestruct(searchage);
if (replaceage != NULL)
free_filestruct(replaceage);
free_filestruct(searchage);
free_filestruct(replaceage);
#endif
/* Free the functions and shortcuts lists. */
/* Free the list of functions. */
while (allfuncs != NULL) {
subnfunc *f = allfuncs;
allfuncs = allfuncs->next;
free(f);
}
/* Free the list of shortcuts. */
while (sclist != NULL) {
sc *s = sclist;
sclist = sclist->next;
@@ -1744,5 +1740,4 @@ void thanks_for_all_the_fish(void)
free(homedir);
#endif
}
#endif /* DEBUG */

View File

@@ -56,6 +56,7 @@ void do_help(void)
functionptrtype func;
/* The function of the key the user typed in. */
/* Don't show a cursor in the help screen. */
curs_set(0);
blank_edit();
blank_statusbar();
@@ -123,7 +124,6 @@ void do_help(void)
#ifndef NANO_TINY
if (kbinput == KEY_WINCH) {
kbinput = ERR;
curs_set(0);
continue; /* Redraw the screen. */
}
#endif
@@ -174,8 +174,6 @@ void do_help(void)
} else
bottombars(oldmenu);
curs_set(1);
#ifndef DISABLE_BROWSER
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
browser_refresh();

View File

@@ -215,63 +215,6 @@ void do_para_end_void(void)
#endif /* !DISABLE_JUSTIFY */
#ifndef NANO_TINY
/* Move to the next word in the file. If allow_punct is TRUE, treat
* punctuation as part of a word. If allow_update is TRUE, update the
* screen afterwards. Return TRUE if we started on a word, and FALSE
* otherwise. */
bool do_next_word(bool allow_punct, bool allow_update)
{
size_t pww_save = openfile->placewewant;
filestruct *current_save = openfile->current;
bool started_on_word = is_word_mbchar(openfile->current->data +
openfile->current_x, allow_punct);
bool seen_space = !started_on_word;
assert(openfile->current != NULL && openfile->current->data != NULL);
/* Move forward until we reach the start of a word. */
while (TRUE) {
/* If at the end of a line, move to the beginning of the next one. */
if (openfile->current->data[openfile->current_x] == '\0') {
/* If at the end of the file, stop. */
if (openfile->current->next == NULL)
break;
openfile->current = openfile->current->next;
openfile->current_x = 0;
seen_space = TRUE;
} else {
/* Step forward one character. */
openfile->current_x = move_mbright(openfile->current->data,
openfile->current_x);
}
/* If this is not a word character, then it's a separator; else
* if we've already seen a separator, then it's a word start. */
if (!is_word_mbchar(openfile->current->data + openfile->current_x,
allow_punct))
seen_space = TRUE;
else if (seen_space)
break;
}
openfile->placewewant = xplustabs();
/* If allow_update is TRUE, update the screen. */
if (allow_update)
edit_redraw(current_save, pww_save);
/* Return whether we started on a word. */
return started_on_word;
}
/* Move to the next word in the file, treating punctuation as part of a
* word if the WORD_BOUNDS flag is set, and update the screen
* afterwards. */
void do_next_word_void(void)
{
do_next_word(ISSET(WORD_BOUNDS), TRUE);
}
/* Move to the previous word in the file. If allow_punct is TRUE, treat
* punctuation as part of a word. If allow_update is TRUE, update the
* screen afterwards. */
@@ -321,13 +264,68 @@ void do_prev_word(bool allow_punct, bool allow_update)
edit_redraw(current_save, pww_save);
}
/* Move to the previous word in the file, treating punctuation as part
* of a word if the WORD_BOUNDS flag is set, and update the screen
* afterwards. */
/* Move to the previous word in the file, treating punctuation as part of a
* word if the WORD_BOUNDS flag is set, and update the screen afterwards. */
void do_prev_word_void(void)
{
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
}
/* Move to the next word in the file. If allow_punct is TRUE, treat
* punctuation as part of a word. If allow_update is TRUE, update the
* screen afterwards. Return TRUE if we started on a word, and FALSE
* otherwise. */
bool do_next_word(bool allow_punct, bool allow_update)
{
size_t pww_save = openfile->placewewant;
filestruct *current_save = openfile->current;
bool started_on_word = is_word_mbchar(openfile->current->data +
openfile->current_x, allow_punct);
bool seen_space = !started_on_word;
assert(openfile->current != NULL && openfile->current->data != NULL);
/* Move forward until we reach the start of a word. */
while (TRUE) {
/* If at the end of a line, move to the beginning of the next one. */
if (openfile->current->data[openfile->current_x] == '\0') {
/* If at the end of the file, stop. */
if (openfile->current->next == NULL)
break;
openfile->current = openfile->current->next;
openfile->current_x = 0;
seen_space = TRUE;
} else {
/* Step forward one character. */
openfile->current_x = move_mbright(openfile->current->data,
openfile->current_x);
}
/* If this is not a word character, then it's a separator; else
* if we've already seen a separator, then it's a word start. */
if (!is_word_mbchar(openfile->current->data + openfile->current_x,
allow_punct))
seen_space = TRUE;
else if (seen_space)
break;
}
openfile->placewewant = xplustabs();
/* If allow_update is TRUE, update the screen. */
if (allow_update)
edit_redraw(current_save, pww_save);
/* Return whether we started on a word. */
return started_on_word;
}
/* Move to the next word in the file, treating punctuation as part of a word
* if the WORD_BOUNDS flag is set, and update the screen afterwards. */
void do_next_word_void(void)
{
do_next_word(ISSET(WORD_BOUNDS), TRUE);
}
#endif /* !NANO_TINY */
/* Move to the beginning of the current line. If the SMART_HOME flag is

View File

@@ -163,10 +163,11 @@ filestruct *copy_filestruct(const filestruct *src)
return head;
}
/* Free a filestruct. */
/* Free a whole linked list of filestructs. */
void free_filestruct(filestruct *src)
{
assert(src != NULL);
if (src == NULL)
return;
while (src->next != NULL) {
src = src->next;
@@ -364,8 +365,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
*file_bot = openfile->filebot;
}
openfile->fileage->next = NULL;
free_filestruct(openfile->fileage);
delete_node(openfile->fileage);
/* Renumber starting with the line after the original
* file_bot. */
@@ -525,20 +525,6 @@ openfilestruct *make_new_opennode(void)
return (openfilestruct *)nmalloc(sizeof(openfilestruct));
}
/* Splice a node into an existing openfilestruct. */
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
openfilestruct *end)
{
assert(newnode != NULL && begin != NULL);
newnode->next = end;
newnode->prev = begin;
begin->next = newnode;
if (end != NULL)
end->prev = newnode;
}
/* Unlink a node from the rest of the openfilestruct, and delete it. */
void unlink_opennode(openfilestruct *fileptr)
{
@@ -551,7 +537,7 @@ void unlink_opennode(openfilestruct *fileptr)
delete_opennode(fileptr);
}
/* Delete a node from the openfilestruct. */
/* Free all the memory in the given open-file node. */
void delete_opennode(openfilestruct *fileptr)
{
assert(fileptr != NULL && fileptr->filename != NULL && fileptr->fileage != NULL);
@@ -567,22 +553,6 @@ void delete_opennode(openfilestruct *fileptr)
free(fileptr);
}
#ifdef DEBUG
/* Deallocate all memory associated with this and later files, including
* the lines of text. */
void free_openfilestruct(openfilestruct *src)
{
assert(src != NULL);
while (src != src->next) {
src = src->next;
delete_opennode(src->prev);
}
delete_opennode(src);
}
#endif
/* Display a warning about a key disabled in view mode. */
void print_view_warning(void)
{
@@ -1099,8 +1069,6 @@ int no_help(void)
* name with the TEMP_FILE flag set, just before the filename prompt. */
void no_current_file_name_warning(void)
{
curs_set(0);
/* Warn that the current file has no name. */
statusbar(_("No file name"));
beep();
@@ -2643,10 +2611,6 @@ int main(int argc, char **argv)
UNSET(MULTIBUFFER);
#endif
#ifdef DEBUG
fprintf(stderr, "Main: top and bottom win\n");
#endif
/* If a starting position was given on the command line, go there. */
if (startline > 0 || startcol > 0)
do_gotolinecolumn(startline, startcol, FALSE, FALSE);
@@ -2659,6 +2623,10 @@ int main(int argc, char **argv)
}
#endif
#ifdef DEBUG
fprintf(stderr, "Main: bottom win, top win and edit win\n");
#endif
display_main_list();
display_buffer();
@@ -2675,6 +2643,10 @@ int main(int argc, char **argv)
do_cursorpos(TRUE);
currmenu = MMAIN;
focusing = FALSE;
/* Turn the cursor on when waiting for input. */
curs_set(1);
/* Read in and interpret characters. */
do_input(TRUE);

View File

@@ -517,7 +517,8 @@ enum
POS_HISTORY,
LOCKING,
NOREAD_MODE,
MAKE_IT_UNIX
MAKE_IT_UNIX,
JUSTIFY_TRIM
};
/* Flags for the menus in which a given function should be present. */

View File

@@ -122,18 +122,7 @@ int do_statusbar_input(bool *ran_func, bool *finished,
if (kbinput != NULL) {
/* Display all the characters in the input buffer at
* once, filtering out control characters. */
char *output = charalloc(kbinput_len + 1);
size_t i;
bool got_enter;
/* Whether we got the Enter key. */
for (i = 0; i < kbinput_len; i++)
output[i] = (char)kbinput[i];
output[i] = '\0';
do_statusbar_output(output, kbinput_len, &got_enter, FALSE);
free(output);
do_statusbar_output(kbinput, kbinput_len, TRUE, NULL);
/* Empty the input buffer. */
kbinput_len = 0;
@@ -174,8 +163,8 @@ int do_statusbar_input(bool *ran_func, bool *finished,
* prompt, disable verbatim input. */
if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
openfile->filename[0] == '\0') {
bool got_enter;
/* Whether we got the Enter key. */
bool got_enter = FALSE;
/* Whether we got the Enter key. */
do_statusbar_verbatim_input(&got_enter);
@@ -251,66 +240,61 @@ int do_statusbar_mouse(void)
}
#endif
/* The user typed output_len multibyte characters. Add them to the
* statusbar prompt, setting got_enter to TRUE if we get a newline, and
* filtering out all ASCII control characters if allow_cntrls is
* TRUE. */
void do_statusbar_output(char *output, size_t output_len, bool
*got_enter, bool allow_cntrls)
/* The user typed input_len multibyte characters. Add them to the
* statusbar prompt, setting got_enter to TRUE if we get a newline,
* and filtering out ASCII control characters if filtering is TRUE. */
void do_statusbar_output(int *the_input, size_t input_len,
bool filtering, bool *got_enter)
{
size_t answer_len, i = 0;
char *output = charalloc(input_len + 1);
char *char_buf = charalloc(mb_cur_max());
int char_buf_len;
int i, char_len;
assert(answer != NULL);
answer_len = strlen(answer);
*got_enter = FALSE;
/* Copy the typed stuff so it can be treated. */
for (i = 0; i < input_len; i++)
output[i] = (char)the_input[i];
output[i] = '\0';
while (i < output_len) {
/* If allow_cntrls is TRUE, convert nulls and newlines
* properly. */
if (allow_cntrls) {
/* Null to newline, if needed. */
i = 0;
while (i < input_len) {
/* When not filtering, convert nulls and stop at a newline. */
if (!filtering) {
if (output[i] == '\0')
output[i] = '\n';
/* Newline to Enter, if needed. */
else if (output[i] == '\n') {
/* Set got_enter to TRUE to indicate that we got the
* Enter key, put back the rest of the characters in
* output so that they can be parsed and output again,
* and get out. */
/* Put back the rest of the characters for reparsing,
* indicate that we got the Enter key and get out. */
unparse_kbinput(output + i, input_len - i);
*got_enter = TRUE;
unparse_kbinput(output + i, output_len - i);
return;
}
}
/* Interpret the next multibyte character. */
char_buf_len = parse_mbchar(output + i, char_buf, NULL);
char_len = parse_mbchar(output + i, char_buf, NULL);
i += char_buf_len;
i += char_len;
/* If allow_cntrls is FALSE, filter out an ASCII control
* character. */
if (!allow_cntrls && is_ascii_cntrl_char(*(output + i -
char_buf_len)))
/* When filtering, skip any ASCII control character. */
if (filtering && is_ascii_cntrl_char(*(output + i - char_len)))
continue;
/* More dangerousness fun. =) */
answer = charealloc(answer, answer_len + (char_buf_len * 2));
assert(statusbar_x <= strlen(answer));
assert(statusbar_x <= answer_len);
/* Insert the typed character into the existing answer string. */
answer = charealloc(answer, strlen(answer) + char_len + 1);
charmove(answer + statusbar_x + char_len, answer + statusbar_x,
strlen(answer) - statusbar_x + 1);
strncpy(answer + statusbar_x, char_buf, char_len);
charmove(answer + statusbar_x + char_buf_len, answer + statusbar_x,
answer_len - statusbar_x + char_buf_len);
strncpy(answer + statusbar_x, char_buf, char_buf_len);
answer_len += char_buf_len;
statusbar_x += char_buf_len;
statusbar_x += char_len;
}
free(char_buf);
free(output);
statusbar_pww = statusbar_xplustabs();
@@ -364,15 +348,13 @@ void do_statusbar_delete(void)
statusbar_pww = statusbar_xplustabs();
if (answer[statusbar_x] != '\0') {
int char_buf_len = parse_mbchar(answer + statusbar_x, NULL, NULL);
size_t line_len = strlen(answer + statusbar_x);
int char_len = parse_mbchar(answer + statusbar_x, NULL, NULL);
assert(statusbar_x < strlen(answer));
charmove(answer + statusbar_x, answer + statusbar_x + char_buf_len,
strlen(answer) - statusbar_x - char_buf_len + 1);
null_at(&answer, statusbar_x + line_len - char_buf_len);
charmove(answer + statusbar_x, answer + statusbar_x + char_len,
strlen(answer) - statusbar_x - char_len + 1);
align(&answer);
update_the_statusbar();
}
@@ -453,25 +435,14 @@ void do_statusbar_prev_word(void)
void do_statusbar_verbatim_input(bool *got_enter)
{
int *kbinput;
size_t kbinput_len, i;
char *output;
*got_enter = FALSE;
size_t kbinput_len;
/* Read in all the verbatim characters. */
kbinput = get_verbatim_kbinput(bottomwin, &kbinput_len);
/* Display all the verbatim characters at once, not filtering out
* control characters. */
output = charalloc(kbinput_len + 1);
for (i = 0; i < kbinput_len; i++)
output[i] = (char)kbinput[i];
output[i] = '\0';
do_statusbar_output(output, kbinput_len, got_enter, TRUE);
free(output);
do_statusbar_output(kbinput, kbinput_len, FALSE, got_enter);
}
/* Return the placewewant associated with statusbar_x, i.e. the
@@ -610,6 +581,9 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
* this case, disable all keys that would change the text if the
* filename isn't blank and we're at the "Write File" prompt. */
while (TRUE) {
/* Ensure the cursor is on when waiting for input. */
curs_set(1);
kbinput = do_statusbar_input(&ran_func, &finished, refresh_func);
assert(statusbar_x <= strlen(answer));
@@ -636,9 +610,8 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
complete_len = strlen(answer);
if (complete_len > 0) {
answer = mallocstrcpy(answer,
get_history_completion(history_list,
answer, complete_len));
answer = get_history_completion(history_list,
answer, complete_len);
statusbar_x = strlen(answer);
}
} else

View File

@@ -164,7 +164,7 @@ void do_last_file(void);
char *striponedir(const char *path);
#endif
/* All functions in chars.c. */
/* Most functions in chars.c. */
#ifdef ENABLE_UTF8
void utf8_init(void);
bool using_utf8(void);
@@ -189,7 +189,7 @@ bool is_punct_mbchar(const char *c);
bool is_word_mbchar(const char *c, bool allow_punct);
char control_rep(char c);
#ifdef ENABLE_UTF8
wchar_t control_wrep(wchar_t c);
wchar_t control_wrep(wchar_t wc);
#endif
char *control_mbrep(const char *c, char *crep, int *crep_len);
char *mbrep(const char *c, char *crep, int *crep_len);
@@ -247,7 +247,7 @@ bool is_valid_unicode(wchar_t wc);
bool is_valid_mbstring(const char *s);
#endif
/* All functions in color.c. */
/* Most functions in color.c. */
#ifndef DISABLE_COLOR
void set_colorpairs(void);
void color_init(void);
@@ -359,10 +359,10 @@ int check_poshistory(const char *file, ssize_t *line, ssize_t *column);
/* Some functions in global.c. */
size_t length_of_list(int menu);
key_type strtokeytype(const char *str);
const sc *first_sc_for(int menu, void (*func)(void));
int sc_seq_or(void (*func)(void), int defaultval);
functionptrtype func_from_key(int *kbinput);
key_type strtokeytype(const char *str);
void assign_keyinfo(sc *s);
void print_sclist(void);
void shortcut_init(void);
@@ -399,10 +399,10 @@ void do_para_end(bool allow_update);
void do_para_end_void(void);
#endif
#ifndef NANO_TINY
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
void do_prev_word(bool allow_punct, bool allow_update);
void do_prev_word_void(void);
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
#endif
void do_home(void);
void do_end(void);
@@ -447,13 +447,8 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
void copy_from_filestruct(filestruct *somebuffer);
openfilestruct *make_new_opennode(void);
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
openfilestruct *end);
void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
#ifdef DEBUG
void free_openfilestruct(openfilestruct *src);
#endif
void print_view_warning(void);
void show_restricted_warning(void);
#ifdef DISABLE_HELP
@@ -517,8 +512,8 @@ int do_statusbar_input(bool *ran_func, bool *finished,
#ifndef DISABLE_MOUSE
int do_statusbar_mouse(void);
#endif
void do_statusbar_output(char *output, size_t output_len, bool
*got_enter, bool allow_cntrls);
void do_statusbar_output(int *the_input, size_t input_len,
bool filtering, bool *got_enter);
void do_statusbar_home(void);
void do_statusbar_end(void);
void do_statusbar_left(void);
@@ -527,8 +522,8 @@ void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
#ifndef NANO_TINY
void do_statusbar_next_word(void);
void do_statusbar_prev_word(void);
void do_statusbar_next_word(void);
#endif
void do_statusbar_verbatim_input(bool *got_enter);
size_t statusbar_xplustabs(void);
@@ -536,7 +531,6 @@ size_t get_statusbar_page_start(size_t start_col, size_t column);
void reset_statusbar_cursor(void);
void update_the_statusbar(void);
void update_bar_if_needed(void);
void total_statusbar_refresh(void (*refresh_func)(void));
functionptrtype get_prompt_string(int *value, bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool allow_files,
@@ -556,7 +550,6 @@ int do_prompt(bool allow_tabs,
filestruct **history_list,
#endif
void (*refresh_func)(void), const char *msg, ...);
void do_prompt_abort(void);
int do_yesno_prompt(bool all, const char *msg);
/* Most functions in rcfile.c. */
@@ -625,7 +618,7 @@ void do_gotolinecolumn_void(void);
bool find_bracket_match(bool reverse, const char *bracket_set);
void do_find_bracket(void);
#ifndef DISABLE_TABCOMP
char *get_history_completion(filestruct **h, const char *s, size_t len);
char *get_history_completion(filestruct **h, char *s, size_t len);
#endif
#endif
#ifndef DISABLE_HISTORIES

View File

@@ -90,6 +90,7 @@ static const rcoption rcopts[] = {
{"backwards", BACKWARDS_SEARCH},
{"casesensitive", CASE_SENSITIVE},
{"cut", CUT_TO_END},
{"justifytrim", JUSTIFY_TRIM},
{"locking", LOCKING},
{"matchbrackets", 0},
{"noconvert", NO_CONVERT},

View File

@@ -190,8 +190,6 @@ int search_init(bool replacing, bool use_answer)
#endif
_(" (to replace)") : "", buf);
fflush(stderr);
/* Release buf now that we don't need it anymore. */
free(buf);
@@ -708,8 +706,10 @@ ssize_t do_replace_loop(
xpt, strnlenpt(openfile->current->data,
openfile->current_x + match_len) - xpt, FALSE);
/* Refresh the edit window, scrolling it if necessary. */
edit_refresh();
/* Don't show cursor, to not distract from highlighted match. */
curs_set(0);
do_replace_highlight(TRUE, exp_word);
@@ -721,8 +721,6 @@ ssize_t do_replace_loop(
free(exp_word);
curs_set(1);
if (i == -1) { /* We canceled the replace. */
if (canceled != NULL)
*canceled = TRUE;
@@ -1353,7 +1351,7 @@ void get_history_older_void(void)
* looking at only the first len characters of s, and return that
* string. If there isn't one, or if len is 0, don't move h and return
* s. */
char *get_history_completion(filestruct **h, const char *s, size_t len)
char *get_history_completion(filestruct **h, char *s, size_t len)
{
assert(s != NULL);
@@ -1382,7 +1380,7 @@ char *get_history_completion(filestruct **h, const char *s, size_t len)
if (p != NULL) {
*h = p;
return (*h)->data;
return mallocstrcpy(s, (*h)->data);
}
/* Search the history list from the top to the current position
@@ -1394,7 +1392,7 @@ char *get_history_completion(filestruct **h, const char *s, size_t len)
if (p != NULL) {
*h = p;
return (*h)->data;
return mallocstrcpy(s, (*h)->data);
}
}

View File

@@ -459,8 +459,7 @@ void redo_cut(undo *u)
openfile->mark_set = FALSE;
openfile->mark_begin = NULL;
if (cutbuffer != NULL)
free_filestruct(cutbuffer);
free_filestruct(cutbuffer);
cutbuffer = oldcutbuffer;
cutbottom = oldcutbottom;
}
@@ -579,8 +578,7 @@ void do_undo(void)
openfile->mark_set = TRUE;
goto_line_posx(u->lineno, u->begin);
cut_marked();
if (u->cutbuffer != NULL)
free_filestruct(u->cutbuffer);
free_filestruct(u->cutbuffer);
u->cutbuffer = cutbuffer;
u->cutbottom = cutbottom;
cutbuffer = oldcutbuffer;
@@ -608,6 +606,7 @@ void do_undo(void)
openfile->placewewant = xplustabs();
openfile->totsize = u->wassize;
set_modified();
focusing = TRUE;
}
/* Redo the last thing(s) we undid. */
@@ -742,6 +741,7 @@ void do_redo(void)
openfile->placewewant = xplustabs();
openfile->totsize = u->newsize;
set_modified();
focusing = TRUE;
}
#endif /* !NANO_TINY */
@@ -903,8 +903,7 @@ void discard_until(const undo *thisitem, openfilestruct *thefile)
while (dropit != NULL && dropit != thisitem) {
thefile->undotop = dropit->next;
free(dropit->strdata);
if (dropit->cutbuffer != NULL)
free_filestruct(dropit->cutbuffer);
free_filestruct(dropit->cutbuffer);
free(dropit);
dropit = thefile->undotop;
}
@@ -1113,8 +1112,7 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
case CUT:
if (!cutbuffer)
break;
if (u->cutbuffer)
free_filestruct(u->cutbuffer);
free_filestruct(u->cutbuffer);
u->cutbuffer = copy_filestruct(cutbuffer);
if (u->mark_set) {
/* If the "marking" operation was from right-->left or
@@ -1281,7 +1279,7 @@ bool do_wrap(filestruct *line)
/* If after_break doesn't end in a blank, make sure it ends in a
* space. */
if (!is_blank_mbchar(end)) {
if (!is_blank_mbchar(end) && !ISSET(JUSTIFY_TRIM)) {
#ifndef NANO_TINY
add_undo(ADD);
#endif
@@ -2178,6 +2176,12 @@ void do_justify(bool full_justify)
#endif
/* Break the current line. */
if (ISSET(JUSTIFY_TRIM)) {
while (break_pos > 0 &&
is_blank_mbchar(&openfile->current->data[break_pos-1])) {
break_pos--;
}
}
null_at(&openfile->current->data, break_pos);
/* Go to the next line. */
@@ -2235,6 +2239,7 @@ void do_justify(bool full_justify)
do {
#endif
statusbar(_("Can now UnJustify!"));
curs_set(1);
kbinput = do_input(FALSE);
#ifndef NANO_TINY
} while (kbinput == KEY_WINCH);
@@ -3106,13 +3111,9 @@ void do_linter(void)
curlint = lints;
while (TRUE) {
ssize_t tmpcol = 1;
int kbinput;
functionptrtype func;
if (curlint->colno > 0)
tmpcol = curlint->colno;
if (tmplint != curlint) {
#ifndef NANO_TINY
struct stat lintfileinfo;
@@ -3130,8 +3131,11 @@ void do_linter(void)
char *msg = charalloc(1024 + strlen(curlint->filename));
int i;
sprintf(msg, _("This message is for unopened file %s, open it in a new buffer?"),
sprintf(msg, _("This message is for unopened file %s,"
" open it in a new buffer?"),
curlint->filename);
/* Show a cursor after the question. */
curs_set(1);
i = do_yesno_prompt(FALSE, msg);
free(msg);
if (i == -1) {
@@ -3156,13 +3160,17 @@ void do_linter(void)
}
}
#endif /* !NANO_TINY */
do_gotolinecolumn(curlint->lineno, tmpcol, FALSE, FALSE);
do_gotolinecolumn(curlint->lineno, curlint->colno, FALSE, FALSE);
titlebar(NULL);
edit_refresh();
statusbar(curlint->msg);
bottombars(MLINTER);
}
/* Show the cursor to indicate the affected line. */
reset_cursor();
curs_set(1);
kbinput = get_kbinput(bottomwin);
#ifndef NANO_TINY

View File

@@ -311,9 +311,6 @@ int get_kbinput(WINDOW *win)
{
int kbinput;
/* Turn the cursor on when waiting for input. */
curs_set(1);
/* Read in a character and interpret it. Continue doing this until
* we get a recognized value or sequence. */
while ((kbinput = parse_kbinput(win)) == ERR)
@@ -1126,6 +1123,7 @@ int parse_escape_sequence(WINDOW *win, int kbinput)
if (retval == ERR) {
if (win == edit) {
statusbar(_("Unknown Command"));
curs_set(1);
beep();
}
}
@@ -2147,11 +2145,11 @@ void statusbar(const char *msg, ...)
waddstr(bottomwin, " ]");
wattroff(bottomwin, A_BOLD);
wattroff(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
wnoutrefresh(bottomwin);
/* Leave the cursor in the edit window, not in the statusbar. */
reset_cursor();
wnoutrefresh(edit);
/* Leave the cursor at its position in the edit window, not in
* the statusbar. */
disable_cursorpos = TRUE;
@@ -2851,9 +2849,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
filestruct *foo;
bool do_redraw = need_screen_update(0);
/* Don't bother scrolling less than one line. */
if (nlines < 1)
return;
assert(nlines > 0);
/* Part 1: nlines is the number of lines we're going to scroll the
* text of the edit window. */
@@ -2959,7 +2955,7 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
/* If the current line is offscreen, scroll until it's onscreen. */
if (openfile->current->lineno >= openfile->edittop->lineno + maxrows ||
openfile->current->lineno < openfile->edittop->lineno)
edit_update((ISSET(SMOOTH_SCROLL) && !focusing) ? NONE : CENTER);
edit_update((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTER : NONE);
#ifndef NANO_TINY
/* If the mark is on, update all lines between old_current and current. */
@@ -3001,7 +2997,7 @@ void edit_refresh(void)
#endif
/* Make sure the current line is on the screen. */
edit_update(ISSET(SMOOTH_SCROLL) ? NONE : CENTER);
edit_update((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTER : NONE);
}
foo = openfile->edittop;
@@ -3354,7 +3350,6 @@ void do_credits(void)
UNSET(NO_HELP);
window_init();
curs_set(1);
nodelay(edit, FALSE);
total_refresh();