Compare commits

..

150 Commits

Author SHA1 Message Date
Chris Allegretta
0f45b26cb9 GNU nano 2.5.2 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5635 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-12 05:25:29 +00:00
Benno Schulenberg
6f352038da Making the formatter command more visible in the Go syntax file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5634 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-11 17:30:16 +00:00
Benno Schulenberg
de5b2634c8 Condensing some declarations, rewrapping some lines, and improving a
few comments.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5633 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-11 17:25:37 +00:00
Benno Schulenberg
e39938c1fa Not leaving curses mode in the formatter, as that would hide
error messages upon reentry.  And, if there are any messages,
allowing the user a little time to read them.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5632 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-11 16:57:52 +00:00
Benno Schulenberg
d4118efea5 Going to the next item in the list before freeing the current one.
This fixes Savannah bug #46796.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5631 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-11 08:50:11 +00:00
Benno Schulenberg
6c82fd65ad Adding remark to Changelog that Savannah bug #47111 is fixed.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5630 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-11 08:26:08 +00:00
Benno Schulenberg
65efed5f97 Freeing the position-history records that are dropped.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5629 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 20:29:23 +00:00
Benno Schulenberg
b8e0e22d64 Switching the cursor on in the right place: in the central input routine.
This makes the cursor visible again during linting.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5628 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 20:16:50 +00:00
Benno Schulenberg
fddad2636d Removing two SVN Id tags and a duplication.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5627 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 16:40:08 +00:00
Benno Schulenberg
9646d7c87d Thanking a Spanish, a Catalan, and a Croat translator.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5626 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 16:26:51 +00:00
Benno Schulenberg
14d1b3bd36 Allowing only control sequences in the proper range to be rebound.
This fixes Savannah bug #47025.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5625 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 15:06:45 +00:00
Benno Schulenberg
d83bd7e305 Plugging a sneaky memory leak. This fixes Savannah bug #47003
reported and solved by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5624 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 12:32:43 +00:00
Benno Schulenberg
ef2cfa31a7 Preventing a chain of editing actions from continuing after a discard.
This fixes Savannah bug #47104.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5623 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 08:49:23 +00:00
Benno Schulenberg
0dbc867a16 Adjusting the version number in the docs before release.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5622 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-09 20:57:37 +00:00
Benno Schulenberg
cdeb90515b Checking the result of a stat() to avoid referencing unitialized data.
The original patch was by Kamil Dudka.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5621 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-09 20:53:11 +00:00
Benno Schulenberg
e853c1ee7c Renaming a variable for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5620 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-07 13:41:46 +00:00
Benno Schulenberg
e5fee7e649 Normalizing a bit of indentation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5619 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-07 13:37:16 +00:00
Benno Schulenberg
836fa7066a Using a character class instead of a literal tab and space.
The change was inspired by David Niklas.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5618 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-07 13:14:23 +00:00
Benno Schulenberg
98a8c06394 Eliding an unneeded 'if'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5617 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-07 13:08:27 +00:00
Benno Schulenberg
12f27299f1 Avoiding a pointless lstat() when not writing to a temporary file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5616 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-07 13:03:48 +00:00
Benno Schulenberg
05334a2b3c Not recording files that have the default cursor position.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5615 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-07 12:49:42 +00:00
Benno Schulenberg
22a01cad9e Rewrapping some lines and removing some useless comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5614 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 12:12:08 +00:00
Benno Schulenberg
8585bf2dd4 Avoiding to update the statusbar twice for a Backspace.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5613 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 11:50:57 +00:00
Benno Schulenberg
2cfa96bde9 Renaming 'update_bar_if_needed()' for more contrast and aptness.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5612 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 11:44:33 +00:00
Benno Schulenberg
d844f05a1e Chopping two parameters that are always the same, and that are
global variables anyway.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5611 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 11:40:15 +00:00
Benno Schulenberg
97dcd377e7 Turning the cursor off when writing in the status bar,
and ensuring it is on when waiting for input.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5610 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 11:18:27 +00:00
Benno Schulenberg
cc2d37053c Updating the screen immediately when a message is posted on the status bar.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5609 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 11:05:58 +00:00
Benno Schulenberg
6829241433 Removing the --nofollow option that hasn't been working for a dozen years.
With this option, nano would simply refuse to write to any symlinked file;
if anyone really used this option, they would certainly have complained.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5608 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 10:59:31 +00:00
Benno Schulenberg
cca22bb10a Guiding the translators a little bit.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5607 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-05 12:27:54 +00:00
Benno Schulenberg
5a5144b75a Putting four strings in the standard order: first backward, then forward.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5606 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-05 12:01:02 +00:00
Benno Schulenberg
2a2e012064 Condensing the descriptions of command-key sequences and of the screen layout;
mentioning how to enter Unicode and that regular expressions are line oriented.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5605 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-05 11:55:55 +00:00
Benno Schulenberg
7ade5deabe Making Home go always fully home.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5604 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-31 13:26:15 +00:00
Benno Schulenberg
7b74fedc05 Showing ^^ and M-^ as valid key names.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5603 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-31 13:20:40 +00:00
Benno Schulenberg
ba987350a9 Being more specific in how a given path is invalid.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5602 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-31 13:06:06 +00:00
Benno Schulenberg
f96f4fe616 Updating position history only when 'positionlog' is set.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5601 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 20:43:54 +00:00
Benno Schulenberg
68ab4b848b Plugging another memory leak.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5600 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 20:39:12 +00:00
Benno Schulenberg
98e72f50e6 Checking the position history only when 'positionlog' is set
/also/ for the first file.  :|


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5599 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 17:18:27 +00:00
Benno Schulenberg
41f08534d9 Plugging a couple of memory leaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5598 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 16:58:02 +00:00
Benno Schulenberg
f8ed6bb099 Checking the position history only when option 'positionlog' is set.
This fixes a bug reported by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5597 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 16:20:28 +00:00
Benno Schulenberg
d8801ec10e Also displaying the buffer when configured with only --disable-histories.
This fixes a segfault reported in Savannah bug #47011.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5596 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 16:01:43 +00:00
Benno Schulenberg
a93a11eb42 Using a simpler algorithm for jumping to the next word.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5595 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-26 10:31:16 +00:00
Benno Schulenberg
5688c160a9 Jumping to the start of the current word, not to that of the preceding one.
This fixes Savannah bug #46970.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5594 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-26 10:10:20 +00:00
Benno Schulenberg
65c7c810bc Adjusting some indentation and some line wrapping.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5593 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-26 09:16:09 +00:00
Benno Schulenberg
7256b055b1 Not adding directories to the list of file positions.
This fixes Savannah bug #46971.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5592 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-26 09:06:31 +00:00
Benno Schulenberg
3331828696 Mentioning that the position history is limited to the 200 most recent files.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5591 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-25 20:51:00 +00:00
Benno Schulenberg
2b72f1d1f1 Documenting the --enable-altrcname configure option.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5590 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-25 20:38:10 +00:00
Benno Schulenberg
ae42240c33 Handling an update of the first element correctly.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5589 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-25 20:26:01 +00:00
Benno Schulenberg
87460b5998 Eliding another small function that is used only once.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5588 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-24 21:02:09 +00:00
Benno Schulenberg
decee32067 Eliding an unneeded function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5587 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-24 20:44:39 +00:00
Benno Schulenberg
f01dd29f48 Bundling four statements (that in total occur seven times)
into a separate function.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5586 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-24 20:36:02 +00:00
Benno Schulenberg
53c8ada24b Removing a superfluous free.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5585 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-24 16:04:25 +00:00
Benno Schulenberg
eed1aab3f0 Chopping an always-FALSE parameter and deleting an unused return value.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5584 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-24 15:42:45 +00:00
Benno Schulenberg
b8d32d8b7b Condensing the code by removing a triplication.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5583 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-24 15:32:13 +00:00
Benno Schulenberg
8c705b5dc2 Moving an updated position-history item to the end of the list,
so that it won't be dropped any time soon.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5582 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-24 14:49:42 +00:00
Benno Schulenberg
cd1d435ac7 Renaming a variable for clarity and contrast.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5581 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-22 16:56:04 +00:00
Benno Schulenberg
3a3b1764af Not using $HOME when we're root, because some sudos don't filter it out
of the environment (which can lead to a root-owned .nano/ directory in
the invoking user's home directory).  This addresses Ubuntu bug #1471459.
(See https://bugs.launchpad.net/ubuntu/+source/nano/+bug/1471459.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5580 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-22 16:10:36 +00:00
Benno Schulenberg
0af2f9e55c Deleting the unneeded blanking of a variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5579 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-21 20:44:22 +00:00
Benno Schulenberg
a443760d80 Eliding an unneeded variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5578 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-21 18:29:39 +00:00
Benno Schulenberg
7a1709f03b Removing a now unneeded function, as nothing can break out of do_prompt()
any more, not a SIGWINCH either.  And deleting an always-FALSE 'if'.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5577 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-21 18:23:17 +00:00
Benno Schulenberg
aa7edb7fc2 Preserving the cursor position on the statusbar when just toggling
a setting or making an excursion to the file browser.
This fixes Savannah bug #46945.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5576 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-21 17:29:37 +00:00
Benno Schulenberg
a68e1627dc Adding to the Changelog the remark that Savannah bug #44950 is now fixed.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5575 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-20 16:17:21 +00:00
Benno Schulenberg
fe3d849a75 Getting rid of a global variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5574 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-20 15:56:40 +00:00
Benno Schulenberg
a91a1c7bbd Readjusting the indentation and a comment.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5573 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-20 15:33:41 +00:00
Benno Schulenberg
8bd76d8302 Verifying that the containing directory of the given filename exists.
Original patch by Rishabh Dave, edited by Benno.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5572 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-20 15:14:52 +00:00
Benno Schulenberg
f8f2d63107 Limiting the number of loaded items in the positions history.
(So that most likely not more than two hundred plus a handful
will be written out.  This was the easiest to implement.)

See https://lists.gnu.org/archive/html/nano-devel/2016-01/msg00050.html.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5571 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-17 17:04:28 +00:00
Benno Schulenberg
13ba5432cd Removing a mistaken '+': only one menu name is allowed in key bindings.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5570 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-17 16:47:20 +00:00
Benno Schulenberg
a3a69eec02 Fixing a typo in an #ifndef symbol. Reported by Frank.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5569 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-17 16:25:31 +00:00
Benno Schulenberg
ffae582aab Allowing inline comments with key bindings.
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5568 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-17 16:15:08 +00:00
Benno Schulenberg
f845938e86 Freeing the items on the undo stack when a buffer is closed.
This fixes Savannah bug #46904 reported by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5567 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-15 16:44:50 +00:00
Benno Schulenberg
38acacb461 Moving set_modified() to the file that has to do with files.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5566 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-15 14:42:07 +00:00
Benno Schulenberg
caa759be31 Returning a fantastic file descriptor -- when opening
a non-existent file for reading succeeds.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5565 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-15 14:23:50 +00:00
Benno Schulenberg
dfeb0f938f Plugging another memory leak.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5564 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-15 13:27:12 +00:00
Benno Schulenberg
0ee7729666 Freeing the full filename in all cases.
There's a bunch of return cases where we don't free the new full filename
which leads to leaks when writing out new files.  One way to reproduce:
$ rm -f foo
$ nano foo
<hit enter>
<ctrl+o to save>
<ctrl+x to exit>
-> memory leak

Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5563 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-15 13:17:44 +00:00
Benno Schulenberg
63370954bd Showing a key only when it was rebound.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5562 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-14 14:44:11 +00:00
Benno Schulenberg
33fb1746dd Eliding an unneeded function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5561 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-14 14:34:05 +00:00
Benno Schulenberg
431cec477d Deleting two duplicate declarations.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5560 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-14 13:52:39 +00:00
Benno Schulenberg
8a9f71639f Eliding an unneeded variable and adjusting some wrappings and whitespace.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5559 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-14 13:41:45 +00:00
Benno Schulenberg
8f463778d1 Deleting an 'if' that is always FALSE.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5558 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-14 13:27:22 +00:00
Benno Schulenberg
ba7ac78e36 Removing a reference to an obsolete file.
Bug was reported by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5557 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-14 13:14:16 +00:00
Benno Schulenberg
34fbb1f4de Adjusting a few comments and rewrapping some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5556 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-13 20:32:40 +00:00
Benno Schulenberg
ecf3cd7244 Reducing the number of indentation steps elsewhere too.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5555 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-13 20:08:36 +00:00
Benno Schulenberg
96b9249f91 Reducing the number of indentation steps.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5554 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 20:26:59 +00:00
Benno Schulenberg
774c8ba1bf Condensing the preparsing of a line.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5553 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 20:17:05 +00:00
Benno Schulenberg
73ee7d7ee5 Removing a senseless iteration: simply add the new record at the tail.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5552 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 20:08:31 +00:00
Benno Schulenberg
deb271d708 Differentiating a variable name from function names.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5551 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 19:20:40 +00:00
Benno Schulenberg
cb832bef1b Removing some code duplication.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5550 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 19:07:01 +00:00
Benno Schulenberg
583b67bad2 Rename a variable, to match the save routine.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5549 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 11:16:39 +00:00
Benno Schulenberg
5b350b86ba Fixing some typos and whitespace, and normalizing the dates in the NEWS file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5548 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 11:03:00 +00:00
Benno Schulenberg
53991cf073 Fixing the 2.5.1 tag in the Changelog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5547 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 10:23:38 +00:00
Chris Allegretta
3f31bbcb7a Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5546 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-11 05:11:30 +00:00
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
69 changed files with 21696 additions and 18260 deletions

View File

@@ -1,5 +1,4 @@
$Id$
This file lists people who have made significant contribution to the
This file lists people who have made significant contributions to the
nano editor. Please see the ChangeLog for specific changes by author.
-------------------------------------------------------------------------

393
ChangeLog
View File

@@ -1,8 +1,325 @@
GNU nano 2.5.2 - 2016.02.12
2016-02-11 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_linter): Go to the next item in the list before
freeing the current one. This fixes Savannah bug #46796.
* src/text.c (do_formatter): Don't leave curses mode, as that would
hide any error messages upon reentry. And if there are any messages,
allow the user a little time to read them.
* src/text.c (do_linter, do_formatter): Condense some declarations,
rewrap some lines, and improve a few comments.
* doc/syntax/go.nanorc: Make the formatter command more visible.
2016-02-10 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (discard_until): Prevent a chain of editing actions from
continuing after a discard. This fixes Savannah bug #47104.
* src/files.c (get_full_path): Plug a sneaky memory leak. This fixes
Savannah bug #47003 reported and solved by Mike Frysinger.
* src/rcfile.c (parse_binding): Allow only control sequences in the
proper range to be rebound. This fixes Savannah bug #47025.
* THANKS: Add a Spanish, a Catalan, and a Croat translator.
* AUTHORS, THANKS: Remove SVN Id tags and a duplication.
* src/winio.c (get_kbinput), src/nano.c (main): Switch the cursor on
in the right place: in the central input routine.
* src/files.c (load_poshistory): Free any records that are dropped.
This fixes Savannah bug #47111 reported by Mike Frysinger.
2016-02-09 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (stat_with_alloc, open_buffer, write_file): Check the
result of a stat() to avoid referencing unitialized data. Original
patch was by Kamil Dudka.
* doc/man/{nano.1,rnano.1,nanorc.5}: Adjust version for release.
2016-02-07 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (update_poshistory): Don't put files in the history list
when they have the default cursor position (line 1, column 1).
* src/files.c (write_file): Avoid a pointless lstat() when not writing
to a temp file, and in the bargain elide two variables.
* src/files.c (write_file): Elide an unneeded 'if'.
* doc/syntax/c.nanorc: Use a character class instead of a literal tab
and space. The change was inspired by David Niklas.
* src/prompt.c (do_yesno_prompt): Normalize the indentation.
* src/prompt.c (do_yesno_prompt): Rename a variable.
2016-02-06 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (write_file): Remove the --nofollow option that hasn't
been working for a dozen years.
* src/winio.c (statusbar): Update the screen immediately whenever a
message has been posted on the status bar.
* src/winio.c (statusbar), src/nano.c (do_input): Turn the cursor off
when writing in the status bar, and on when waiting for input.
* src/prompt.c (update_the_statusbar): Chop two parameters that are
always the same, and that are global variables anyway.
* src/prompt.c (update_bar_if_needed): Rename this for more contrast.
* src/prompt.c (do_statusbar_backspace): Avoid updating the bar twice.
* src/cut.c, src/files.c, src/prompt.c: Rewrap some lines and remove
some useless comments.
2016-02-05 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Condense the descriptions of command-key
sequences and of the screen layout, mention how to enter Unicode,
and mention that regular expressions are line oriented.
* src/global.c (shortcut_init): Put four strings in standard order.
* src/text.c (do_undo), src/global.c (shortcut_init): Guide the
translators a little bit.
2016-01-31 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (has_valid_path): Be more specific in how a given path
is invalid. The change was improved by Rishabh Dave.
* doc/syntax/nanorc.nanorc: Show ^^ and M-^ as valid key names.
* src/prompt.c (do_statusbar_home): Make Home go always fully home.
2016-01-29 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (do_insertfile): Do display the buffer when configured
with only --disable-histories. This fixes Savannah bug #47011.
* src/nano.c (main): Check position history only when 'positionlog'
is set. This fixes a bug unconsciously reported by Mike Frysinger.
* src/files.c (do_lockfile): Plug a couple of memory leaks.
* src/files.c (update_poshistory): Plug another memory leak.
* src/files.c (close_buffer): Update position history only when
the option 'positionlog' is set.
2016-01-26 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (update_poshistory): Do not add directories to the
list of file positions. This fixes Savannah bug #46971.
* src/*.c: Adjust some indentation and some line wrapping.
* src/prompt.c (do_statusbar_prev_word): When in the middle of a
word, jump to the start of the current word, not to the start of
the preceding one. This fixes Savannah bug #46970.
* src/prompt.c (do_statusbar_next_word): Use simpler algorithm.
2016-01-25 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (update_poshistory): Handle an update of the first
element correctly.
* doc/texinfo/nano.texi: Document the --enable-altrcname option.
The lack of this was pointed out by Frank.
* doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Mention
that the position history is limited to the 200 most recent files.
2016-01-24 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (update_poshistory): Move an updated item to the end
of the list, so that it won't be dropped any time soon. The problem
was pointed out by David Niklas.
* src/winio.c (edit_redraw): Condense by removing a triplication.
* src/prompt.c (do_statusbar_prev_word, do_statusbar_next_word):
Chop an always-FALSE parameter and delete an unused return value.
* src/prompt.c (do_prompt): Remove a superfluous free.
* src/prompt.c (update_the_bar): Bundle some statements.
* src/prompt.c (need_statusbar_update): Elide this function.
* src/prompt.c (total_statusbar_refresh): Elide this function too.
2016-01-22 Benno Schulenberg <bensberg@justemail.net>
* src/utils.c (get_homedir): Don't use $HOME when we're root, because
some sudos don't filter it out of the environment (which can lead to
a root-owned .nano/ directory in the invoking user's home directory).
It fixes https://bugs.launchpad.net/ubuntu/+source/nano/+bug/1471459.
* src/files.c (read_line): Rename a variable for clarity and contrast.
2016-01-21 Benno Schulenberg <bensberg@justemail.net>
* src/prompt.c (get_prompt_string): Preserve the cursor position on
the statusbar when just toggling a setting or making an excursion to
the file browser. This fixes Savannah bug #46945.
* src/prompt.c (do_prompt_abort): Remove this unneeded function, as
nothing can break out of do_prompt(), not a SIGWINCH either.
* src/prompt.c (get_prompt_string): Delete code that is dead now.
* src/prompt.c (get_prompt_string): Elide an unneeded variable.
* src/browser.c (do_browser): Delete unneeded blanking of a variable.
2016-01-20 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (open_buffer): Readjust the indentation and a comment.
* src/files.c (has_valid_path): Get rid of a global variable.
2016-01-20 Rishabh Dave <rishabhddave@gmail.com>
* src/files.c (verify_path, open_buffer): When opening a new buffer,
verify that the containing directory of the given filename exists.
This fixes Savannah bug #44950.
* src/files.c (do_lockfile): Remove the existence check on the
directory, as this is now covered by verify_path().
2016-01-17 Benno Schulenberg <bensberg@justemail.net>
* src/global.c: Fix typo in #ifndef symbol. Reported by Frank.
* doc/syntax/nanorc.nanorc: Remove '+' as only one menu is allowed.
* src/files.c (load_poshistory): Limit the number of loaded items.
2016-01-17 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/nanorc.nanorc: Allow inline comments with key bindings.
2016-01-15 Benno Schulenberg <bensberg@justemail.net>
* 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.
* 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.
2016-01-15 Mike Frysinger <vapier@gentoo.org>
* src/files.c (open_file): Free the full filename in all cases.
2016-01-14 Benno Schulenberg <bensberg@justemail.net>
* doc/nanorc.sample.in: Remove a reference to an obsolete file.
Reported by Mike Frysinger.
* src/winio.c (edit_redraw): Delete an 'if' that is always FALSE.
* src/winio.c (edit_redraw): Elide an unneeded variable and adjust
some wrappings and whitespace.
* src/proto.h: Delete two duplicate declarations.
* src/rcfile.c (check_bad_binding): Elide this unneeded function.
* src/rcfile.c (parse_binding): Show key only when it was rebound.
2016-01-13 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (save_poshistory): Reduce the indentation.
* src/*.c: Adjust a few comments and rewrap some lines.
2016-01-12 Benno Schulenberg <bensberg@justemail.net>
* NEWS: Fix some typos and whitespace, and normalize the dates.
* src/files.c (load_poshistory): Rename a variable.
* src/files.c (load_poshistory): Remove some code duplication.
* src/files.c (save_poshistory, update_poshistory, check_poshistory,
load_poshistory): Differentiate variable name from function names.
* src/files.c (load_poshistory): Remove a senseless iteration.
* src/files.c (load_poshistory): Condense the reading of a line.
* src/files.c (load_poshistory): Reduce the indentation.
GNU nano 2.5.1 - 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 +520,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 +1608,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 +2419,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 +2580,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 +2687,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 +3358,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 +3366,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 +3387,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 +3408,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 +3418,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 +3457,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 +3485,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 +3506,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 +3519,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 +3526,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 +3557,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 +3582,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 +3601,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 +3611,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 +3618,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 +3661,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 +3670,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 +3682,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 +3697,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

173
NEWS
View File

@@ -1,11 +1,28 @@
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.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
the usual bevy of documentation and other miscellaneous
fixes and touch ups. Upgrade today while supplies last,
operators are standing by!
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!
@@ -220,7 +237,7 @@
issues with compiler warnings and configure options, and
documentation updates, including the nano texinfo manual,
nano and nanorc man pages, and UPGRADE file, and some
missing syntax highliting entries for the sample nanorc.
missing syntax highlighting entries for the sample nanorc.
And no release would be complete without the latest round
of 'final' soft wrapping fixes! Finally, nano will no
longer print a warning when attempting to insert the
@@ -250,7 +267,7 @@
Friday discount. Included are some (hopefully
final) fixes for issues with last page display
caused by the soft wrapping code, and a fix for
a long standing issue with hittig the home key when
a long standing issue with hitting the Home key when
going through the search history. On the features
front, nano will now attempt to retain the proper
ownership and permissions when trying to create a
@@ -331,7 +348,7 @@
modifications when saving a file, some code and
documentation cleanups, and more bug fixes for
the new undo code (but we continue to welcome your bug
reports via the Savananh bug page at
reports via the Savannah bug page at
http://savannah.gnu.org/bugs/?func=additem&group=nano.
Come get some.
@@ -368,8 +385,8 @@
files when using backup mode has changed as well: if writing
the backup file fails, nano will not attempt to write the
current file. This should help folks who enjoy "extreme
text editing" i.e. editing files on file systems which
are likely to run out of space; see Savannah bug 24000.
text editing", i.e. editing files on file systems which
are likely to run out of space; see Savannah bug #24000.
Have fun with it!
2008.08.04 - GNU nano 2.1.3 "least stable version ever" is released. This
@@ -404,7 +421,7 @@
2008.03.18 - GNU nano 2.1.0 "under old mismanagement" is released.
This first release in the 2.1 development series
introduces rebinadble keys for most actions inside
introduces rebindable keys for most actions inside
the editor. Please see the nanorc(5) page for
more information on configuring key bindings. Please
also report all keybinding bugs (crashes, missing
@@ -698,7 +715,7 @@
features in this release, including a restricted mode
that provides better security than just setting an
operating directory, the ability to justify the entire
file at once, support for a "smart" home key that can
file at once, support for a "smart" Home key that can
leap from the beginning of text on a line to the true
beginning of the line (or the reverse) in one stroke,
support for specifying an alternative spell checker in
@@ -847,7 +864,7 @@
Please send all new feedback on this release
direct to the development list (nano-devel@gnu.org).
10/24/2002 - GNU nano 1.1.12 "Make Jordi happy" is released. This
2002.10.24 - GNU nano 1.1.12 "Make Jordi happy" is released. This
release demonstrates that nano is starting to freeze for
version 1.2. New features include a Meta-Y toggle for
syntax highlighting, pluralized i18n, and a handler for
@@ -860,7 +877,7 @@
(currently up in the air) search history behavior, the
next version of nano should be 1.1.99pre1. Have fun!
10/01/2002 - GNU nano 1.1.11 "Oddball" is released. This release
2002.10.01 - GNU nano 1.1.11 "Oddball" is released. This release
features a new version of gettext, a new and improved
syntax highlighting engine, and some updates for the
nanorc.sample file. The toggles for case sensitivity
@@ -877,7 +894,7 @@
word and next word, nanorc parser and line wrapping
code. Have fun!
07/25/2002 - At long last! GNU nano 1.1.10 "What didn't we break?" is
2002.07.25 - At long last! GNU nano 1.1.10 "What didn't we break?" is
released. This version of GNU nano features version
0.11.2 of gettext, building with automake 1.6, some new
code for displaying control characters, browser
@@ -891,7 +908,7 @@
updated, and the --quotestr and --regexp really work
now ;-) Enjoy :)
05/12/2002 - GNU nano 1.1.9 is released, happy Mother's Day! This
2002.05.12 - GNU nano 1.1.9 is released, happy Mother's Day! This
release includes many new features, including a prepend
mode (^O,M-P), a new "syntax" command in the .nanorc to
allow multiple syntax highlighting types, and a new -Y,
@@ -906,7 +923,7 @@
been fixed. A lot of new stuff for everyone's favorite
text editor ;) Have fun!
03/30/2002 - GNU nano 1.1.8 is released. New features include an
2002.03.30 - GNU nano 1.1.8 is released. New features include an
"Insert Output of External Command", ^R^X, and a .spec
file is now included in the distribution. There are
cleanups in the usage code, fixes for regex parsing, the
@@ -916,9 +933,9 @@
Also, the "show position" code now shows the starting
column as 1 instead of 0. Have fun!
03/05/2002 - GNU nano 1.1.7 "lets change everything and see what breaks"
2002.03.05 - GNU nano 1.1.7 "lets change everything and see what breaks"
is released. New features include new flags
-N,--noconvert to stop any file format conversion and
-N, --noconvert to stop any file format conversion and
-Q, --quotestr for the new quoted text justification, a
new tempnam() implementation to avoid silly warnings,
DOS and Mac file options in the Write File dialog,
@@ -935,7 +952,7 @@
conditions, variable width for shortcuts, and the usual
ton of translation updates.
01/25/2002 - GNU nano 1.1.6 is released. Lots of new features in this
2002.01.25 - GNU nano 1.1.6 is released. Lots of new features in this
release. New Meta-keys were added as alternates for
control sequences: Meta-A for the marker key (^^), and
Meta-G for the 'goto dir' key in the file browser (^_).
@@ -952,21 +969,21 @@
There are also oodles of translation updates. Have fun
with it.
01/05/2002 - GNU nano 1.1.5 is out. The main new feature in this
2002.01.05 - GNU nano 1.1.5 is out. The main new feature in this
release is the changed behavior of the keypad. Nano now
does the Right Thing and used keypad() by default. If
you wish to use the keypad arrow keys in certain
terminals, you may use the -K or --keypad flag to use
the old behavior. Users of other OSes should see better
handling of their non-keypad keys in this release. Other
changes include more Hurd fixes, fixes parsing the
.nanorc, display fixes for the color syntax
handling of their non-keypad keys in this release.
Other changes include more Hurd fixes, fixes parsing
the .nanorc, display fixes for the color syntax
highlighting, gettext stabilization and many translation
updates. This is almost like a stable release, much
like in the 0.9.x series when every other release was
the most stable one :) Have fun!
12/11/2001 - GNU nano 1.1.4 is released. This release contains
2001.12.11 - GNU nano 1.1.4 is released. This release contains
rudimentary color syntax support (but it's still
broken), compatibility fixes for the Hurd and FreeBSD,
spell checker and wrapping fixes, and more. It seems
@@ -975,7 +992,7 @@
so it's time to show the world all the changes since
1.1.3 ;) Have fun with it!
10/26/2001 - GNU nano 1.1.3 is released. As far as new features go,
2001.10.26 - GNU nano 1.1.3 is released. As far as new features go,
the help system is now available for all functions in
the editor. Also, nano will also now print a message on
the status bar when it automatically converts a file
@@ -998,7 +1015,7 @@
wait for version 1.0.6 which should be available early
next week. Enjoy!
10/03/2001 - GNU nano 1.1.2 is out there. Many new features in this
2001.10.03 - GNU nano 1.1.2 is out there. Many new features in this
release, including support for auto-converting from DOS
and Mac formatted files, as well as toggles for writing
out files in these formats. Pico's -o flag has been
@@ -1012,7 +1029,7 @@
also the usual helping of bugfixes, translation updates
and, surely a bug or two. You better get ready!
07/28/2001 - GNU nano 1.1.1 is released. Our second 1.1 unstable
2001.07.28 - GNU nano 1.1.1 is released. Our second 1.1 unstable
release features many bugfixes from the initial release,
in particular fixes for the multibuffer code, and
various compiler macro fixes. The shortcut lists for
@@ -1024,7 +1041,7 @@
configure script to work on platforms regardless of
their gettext version.
07/15/2001 - GNU nano 1.1.0 is released. This is the first release
2001.07.15 - GNU nano 1.1.0 is released. This is the first release
in the 1.1.x unstable series of GNU nano. It
incorporates all changes up to the 1.0.3 release, and
also includes many many new features, including
@@ -1036,7 +1053,7 @@
introduce lots of bugs ;-) Have fun with it, but be
careful, unstable means unstable.
07/01/2001 - GNU nano 1.0.3 is the "mutt" release. This release
2001.07.01 - GNU nano 1.0.3 is the "mutt" release. This release
features oodles of bug fixes with cutting text,
especially with the -k (cut to end) option. There is
also a new suspend handler which should make nano play
@@ -1047,7 +1064,7 @@
function for more speed and less memory usage. Two new
translations are included, Ukrainian and Russian.
05/12/2001 - GNU nano 1.0.2 is the "just the bugfixes ma'am" release.
2001.05.12 - GNU nano 1.0.2 is the "just the bugfixes ma'am" release.
The most noticeable fixes are for display errors using
page up/down with the marker code, and view mode (-v)
not stopping the replace function. Other fixes include
@@ -1057,7 +1074,7 @@
a new Galician translation (provided by Jacobo Tarrío).
Have fun with it!
04/06/2001 - GNU nano 1.0.1 is out there. The only new feature is a
2001.04.06 - GNU nano 1.0.1 is out there. The only new feature is a
configure option for those who want to disable all word
wrapping from nano, --disable-wrapping. Bug fixes this
release include some bugs with autoconf and i18n, and
@@ -1066,7 +1083,7 @@
and nano now sorts files case insensitively like Pilot.
Have fun with it.
03/22/2001 - GNU Nano 1.0 is released! The autoindent wrapping bug
2001.03.22 - GNU Nano 1.0 is released! The autoindent wrapping bug
has been fixed, as well as strange bug when using Pico
mode and regex search. There have also been some minor
spelling and documentation updates. As stated on the
@@ -1076,7 +1093,7 @@
this first stable release of nano, and as always,
feedback is welcome! nano@nano-editor.org.
02/19/2001 - Nano 0.9.99pre3 brings a lot of changes! The most
2001.02.19 - Nano 0.9.99pre3 brings a lot of changes! The most
important being that nano is now officially a GNU
program. Some changes have been made for GNU
compatibility (like the default list of shortcuts, "^G
@@ -1089,7 +1106,7 @@
ncurses libraries have also been fixed. All in all, a
lot to see.
01/31/2001 - Nano 0.9.99pre2 is released. Not surprisingly, all that is
2001.01.31 - Nano 0.9.99pre2 is released. Not surprisingly, all that is
new is bugfixes, bugfixes, bugfixes. There were a few
cleanups in unneeded global variables and duplicate
functions, but most is just fixing. Specifically, there
@@ -1101,7 +1118,7 @@
an initial write error). Slowly but surely, on toward
1.0 we travel.
01/17/2001 - Nano 0.9.99pre1 is released. This is the first pre-1.0
2001.01.17 - Nano 0.9.99pre1 is released. This is the first pre-1.0
release of nano, and is also the first release since the
code freeze for nano 1.0. Don't expect (or request) any
new features between now and nano 1.0, only bugfixes,
@@ -1112,7 +1129,7 @@
autoconf fixes, and support for the KDE konsole keypad
layout. Have fun.
01/07/2001 - Nano 0.9.25 is the "Just one more feature I swear!"
2001.01.07 - Nano 0.9.25 is the "Just one more feature I swear!"
release. It includes one new feature that Pico has had
forever, a built-in file browser. Since not everyone
may want this option, there is a --disable-browser
@@ -1121,7 +1138,7 @@
for crashes when tab completion in certain instances.
Have fun and Happy New Year!
12/18/2000 - Nano 0.9.24 is released. This version contains the last of
2000.12.18 - Nano 0.9.24 is released. This version contains the last of
the security fixes for writing files, as well as for a
nasty segfault when nano is unable to open a file for
reading, among other fixes. Nano also now cowardly
@@ -1132,7 +1149,7 @@
Pico compatibility. Upgrading to this version is highly
recommended.
12/08/2000 - Nano 0.9.23 is the "race conditions bite" release. The
2000.12.08 - Nano 0.9.23 is the "race conditions bite" release. The
main reason for this release is the less-than-optimal
fix for the security issue in nano with following
symbolic links. Hopefully this will fix the problem
@@ -1142,7 +1159,7 @@
function was renamed to --disable-speller to be in line
with nano and Pico's "speller" term.
12/02/2000 - Nano 0.9.22 is released, with many more changes and
2000.12.02 - Nano 0.9.22 is released, with many more changes and
additions than imaginable. The most important change is
a fix for unsafe handling of symbolic links which could
lead to symlink attacks if nano were to exit because of
@@ -1157,13 +1174,13 @@
surprises). All in all, a whole lot of changes in a
little over a week.
11/23/2000 - Happy Thanksgiving! Nano 0.9.21 is our "last version was
2000.11.23 - Happy Thanksgiving! Nano 0.9.21 is our "last version was
a big turkey" release. It fixes several bugs introduced
by the previous version, as well as a few long- standing
display bugs. All 0.9.20 users are strongly encouraged
to upgrade to this release.
11/18/2000 - Nano 0.9.20 is finally out the door. Probably the biggest
2000.11.18 - Nano 0.9.20 is finally out the door. Probably the biggest
change is the brand new way nano displays previous
search and replace strings (they are now editable!)
This is a break from Pico's (inconsistent) interface, so
@@ -1181,7 +1198,7 @@
something, don't like something, or just want to order a
pizza, let us know!
10/02/2000 - Nano 0.9.19 is the "Chris is getting married in less than
2000.10.02 - Nano 0.9.19 is the "Chris is getting married in less than
a week and needs a distraction" release. There are only
a few actual code changes, mainly portability and
compiler warning fixes. Nano now also supports
@@ -1190,35 +1207,35 @@
nano site has changed (again) as well, check out
www.nano-editor.org for all the latest nano schtuff.
09/18/2000 - Nano 0.9.18 is unleashed. It has some new keyboard
2000.09.18 - Nano 0.9.18 is unleashed. It has some new keyboard
handling code, Cygwin support out of the box, and a more
portable handler for the NOHELP toggle. There is also a
fix for a somewhat serious bug whereby trying to insert
a directory instead of a normal file would destroy the
contents of the editor. A must-see. Four stars.
09/04/2000 - Nano 0.9.17, the Labor Day release, is released after a
2000.09.04 - Nano 0.9.17, the Labor Day release, is released after a
quiet spell (almost an entire month since last release!)
New features include better (not yet perfect) binary
display support and toggle support for most of the
program flags (M-c, M-i, M-z, M-x, M-p, M-w, M-m, M-k
and M-e for -c, -i, -x, -p, -w, -k, and -R).
08/09/2000 - Nano 0.9.16, after some struggling, is released. This
2000.08.09 - Nano 0.9.16, after some struggling, is released. This
release should fix a few of the holes that 0.9.15 dug.
The "cutting text on the first line" bug is fixed, as is
the "cutting text on the last line" bug. Nice symmetry
there huh? Also the --tabsize argument should now work
as well as by using -T.
08/03/2000 - Nano 0.9.15 is the "I can't think of a release description"
2000.08.03 - Nano 0.9.15 is the "I can't think of a release description"
release. There are the usual gala of display bugfixes,
a fix for the nasty bug in -k mode that could create
a loop in the file being edited, and some other code
cleanup. Also, the -T option should now work regardless
of the curses library used. Yay.
07/27/2000 - Nano 0.9.14 is officially the "13 is so unlucky it should
2000.07.27 - Nano 0.9.14 is officially the "13 is so unlucky it should
be skipped as a version number" release. One typo
caused unending problems (calling nano with either -t or
-k caused both flags to be used). The -k code is also
@@ -1229,15 +1246,15 @@
for the next release. Until then, have fun with this
version.
07/23/2000 - Nano 0.9.13 has a few new bits and bobs, most notably the
2000.07.23 - Nano 0.9.13 has a few new bits and bobs, most notably the
-k option from Pico (cut to end of line). The majority
of changes in this release are bugfixes, however,
including the usual display fixes and fixes for writing
to symbolic links and un-writable files. Barring any
to symbolic links and unwritable files. Barring any
other major changes, this should be the feature set for
nano 1.0, whenever it might be released =-)
07/07/2000 - Nano 0.9.12 (The "lucky day" release) is bursting with new
2000.07.07 - Nano 0.9.12 (The "lucky day" release) is bursting with new
features, bug fixes, and yummy fruit flavor. For
changes, the alternate replace keystroke ^W^T is now
^W^R to be compatible with later versions of Pico. ^W^T
@@ -1248,7 +1265,7 @@
flag. And, of course, there are the usual helping of
display and other bug fixes to top it all off.
06/20/2000 - Nano 0.9.11 presents drastic rewrites of the most buggy
2000.06.20 - Nano 0.9.11 presents drastic rewrites of the most buggy
routines in the program, specifically the wrapping code
and almost all of the display routines. There are many
improvements and bugfixes to the display subsystem in
@@ -1262,7 +1279,7 @@
translation department is an Indonesian translation
(id).
06/06/2000 - Nano 0.9.10 is primarily a bugfix for the loss of SIGINT
2000.06.06 - Nano 0.9.10 is primarily a bugfix for the loss of SIGINT
when using "run and terminate" flags (for example,
--help). There are also some minor documentation
updates. This version of nano is the most stable in
@@ -1270,12 +1287,12 @@
awhile. Users are encouraged to upgrade to this
version.
05/31/2000 - Nano 0.9.9 introduces much better working i18n support,
2000.05.31 - Nano 0.9.9 introduces much better working i18n support,
more portability, and a ton of bugfixes. While nano is
not likely anywhere near 1.0 in terms of code quality,
it gets a quantum leap closer with this release.
05/18/2000 - Nano 0.9.8 (the 'what broke now?' release) should fix
2000.05.18 - Nano 0.9.8 (the 'what broke now?' release) should fix
the resize crash people have been experiencing. It also
offers a new input method that should allow nano to do
things the right way (like ^S, ^Q, custom suspend keys)
@@ -1283,21 +1300,21 @@
are also the obligatory display fixes and speedups.
Have fun with it.
05/14/2000 - Nano 0.9.7 (the Mother's Day release) continues in the long
2000.05.14 - Nano 0.9.7 (the Mother's Day release) continues in the long
line of display fixes, and also fixes the broken symlink
behavior (i.e. symlinks weren't being followed by
default). Hopefully all major bugs can be worked out
soon and we can have a 1.0 release before the end of the
year, but who knows.
05/08/2000 - Nano 0.9.6 cleans up a lot of the display bugs that 0.9.5
2000.05.08 - Nano 0.9.6 cleans up a lot of the display bugs that 0.9.5
uncovered. There are improvements (and some remaining
segfaults) in the wrapping code, and even more display
optimizations. I would still say 0.9.4 or 0.9.2 are the
most stable versions of nano to date, but this one may
not be too bad =-)
05/01/2000 - Nano 0.9.5 attempts to speed up the display of text
2000.05.01 - Nano 0.9.5 attempts to speed up the display of text
to be at least somewhat reasonable. Much code profiling
has been done to reduce the ridiculous number of
redundant display updates. This will probably expose a
@@ -1307,12 +1324,12 @@
recently, so use that if you're not particularly
concerned with being on the bleeding edge.
04/25/2000 - Nano 0.9.4 fixes some problems in 0.9.3 with the last
2000.04.25 - Nano 0.9.4 fixes some problems in 0.9.3 with the last
line code and related segfaults. It also now has much
better handling for 8-bit characters. The --enable-tiny
code also produces a smaller executable.
04/19/2000 - Nano 0.9.3 is officially the "Micro$oft" release. It
2000.04.19 - Nano 0.9.3 is officially the "Micro$oft" release. It
underscores the recent problem of bugfixes introducing
more bugs than they fix. The most important change to
this version of nano is the removal of the "magic line".
@@ -1330,12 +1347,12 @@
marker and mouse code), and --with-slang to use the
slang libraries instead of ncurses.
04/15/2000 - Nano 0.9.2 just fixes the serious segfault problem if
2000.04.15 - Nano 0.9.2 just fixes the serious segfault problem if
nano is invoked any way other than using the absolute
path. The bug was in the new code for checking whether
nano is invoked as 'pico'.
04/14/2000 - 0.9.1 has some more Pico compatibility built-in. The
2000.04.14 - 0.9.1 has some more Pico compatibility built-in. The
option to switch to/from Search and Search/Replace (^T)
is now available, and nano now displays the more
Pico-like shortcut list when invoked as 'pico' (i.e. if
@@ -1349,13 +1366,13 @@
"recursive replace" bug, and more bugfixes in the
wrapping code.
04/07/2000 - Nano 0.9.0 has some updates, new language support and
2000.04.07 - Nano 0.9.0 has some updates, new language support and
a much better refresh setup (It's still not great,
but...) There should also be more stability editing
long lines, as there was a stupid mistake in the
update_line call. Silly me =)
03/22/2000 - Nano 0.8.9 is basically just a bugfix release of 0.8.8
2000.03.22 - Nano 0.8.9 is basically just a bugfix release of 0.8.8
to reflect the current stagnant status of the project.
Most things work, the rest doesn't doesn't work because
(a) I can't fix it or I would have already done so, and
@@ -1365,7 +1382,7 @@
nano pages on SourceForge. Here's hoping SF will get us
some more visibility, translators and patches.
03/12/2000 - After a hiatus, I have finally moved (not unpacked though)
2000.03.12 - After a hiatus, I have finally moved (not unpacked though)
to my new home into Albany. Thus I should now have more
time to work on nano. Nano 0.8.8, the "dear god what
broke this time?" release, incorporates patches for both
@@ -1382,25 +1399,25 @@
file as the maintainer of the .po file, and from then on
it is yours to take care of and keep up to date.
03/01/2000 - Well, to continue my trend of going back on my previous
2000.03.01 - Well, to continue my trend of going back on my previous
release's comments, nano 0.8.7 is released. The
crashing behavior was still occurring, and this most
recent fix also fixes some other wrapping problems, so
here you go. There may be another release soon, there
may not be, is that vague enough? =)
02/25/2000 - More minor bugfixes in 0.8.6, the bizarre behavior at the
2000.02.25 - More minor bugfixes in 0.8.6, the bizarre behavior at the
end of a page has ceased, thankfully. I'm also moving
next weekend, so don't be shocked if you don't see a new
version of nano next week =-)
02/11/2000 - Okay, here we go again. Aside from a few minor fixes and
2000.02.11 - Okay, here we go again. Aside from a few minor fixes and
some under-the-hood changes, you won't notice much
different in this version of nano. I haven't gotten
much feedback on the help feature, is it simply amazing
or does no one care? Write and let me know! =)
02/08/2000 - Nano 0.8.3 marks the first time in a long time that there
2000.02.08 - Nano 0.8.3 marks the first time in a long time that there
has been more than three days since the last release.
New features include an initial help mode (YAY!),
hopefully much more support for i18n out of the box, and
@@ -1409,7 +1426,7 @@
distribution site, http://www.asty.org/nano and email
address nano@asty.org for bugs, etc.
02/02/2000 - Okay, I hate to go back on what I said in the last release,
2000.02.02 - Okay, I hate to go back on what I said in the last release,
but I may be changing jobs very soon. I will release
version 0.8.2 as is (no i18n, no help menu (yet). I
expect things to settle down by the end of next week,
@@ -1417,7 +1434,7 @@
menu; look for these new features in version 0.8.5 to
0.9.0.
01/28/2000 - Nano 0.8.1 marks our first official step toward
2000.01.28 - Nano 0.8.1 marks our first official step toward
internationalization (i18n) and the help system (^G). I
will be merging in Jordi's patches for initial i18n in
the next version, and will implement the help system
@@ -1425,7 +1442,7 @@
don't hesitate to send bug reports, as long as you're
sure the fault lies with nano =-).
01/25/2000 - Nano 0.8.0 is officially the 'let's try and be at least a
2000.01.25 - Nano 0.8.0 is officially the 'let's try and be at least a
little portable, mmmmkay?' release. There are many
portability checks and fixes; many thanks to Andy Kahn
for his patches. I removed the broken do_spell behavior
@@ -1433,7 +1450,7 @@
'ispell' until I write a better method to handle the
output of the normal 'spell' command.
01/24/2000 - Nano 0.7.9 features many new features. Among them are a
2000.01.24 - Nano 0.7.9 features many new features. Among them are a
new autoindent feature (-i, --autoindent), tempfile flag
like Pico's -t flag (-t, --tempfile), and preliminary
spelling program support. The spelling function tries
@@ -1441,7 +1458,7 @@
can specify another spelling program with -s or
--speller.
01/17/00 - Nano 0.7.7 is officially the 'way too much stuff changed this
2000.01.17 - Nano 0.7.7 is officially the 'way too much stuff changed this
release' release. It's the busy time at work for me, so
please don't get offended if your patch doesn't get
included in the next immediate version of nano. I'm
@@ -1453,16 +1470,14 @@
new -x and -c flags (see nano -h for help), long command
line flag support, and the usual array of bugfixes.
01/15/00 - Nano 0.7.6 is officially the 'lightning' release. It now
2000.01.15 - Nano 0.7.6 is officially the 'lightning' release. It now
loads large files much faster than previous versions,
and is even much faster than Pico or vi in some rather
rudimentary tests. Many thanks to Adam Rogoyski for the
read_byte patch!
01/09/00 - As of this version (0.7.4), TIP has officially been renamed
2000.01.09 - As of this version (0.7.4), TIP has officially been renamed
to nano. The new homepage is at
http://faculty.plattsburgh.edu/astyanax/nano. Please
update your bookmarks, tell your friends, and all that
jazz.
$Id$

11
THANKS
View File

@@ -8,11 +8,12 @@ Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com> Malay
Josef Andersson <josef.andersson@fripost.org> Swedish
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian
Mario Blättermann <mario.blaettermann@gmail.com> German
Wei-Lun CHAO <chaoweilun@pcmail.com.tw> Chinese (traditional)
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish
Antonio Ceballos <aceballos@gmail.com> Spanish
Wei-Lun CHAO <chaoweilun@pcmail.com.tw> Chinese (traditional)
Yuri Chornoivan <yurchor@ukr.net> Ukrainian
Mihai Cristescu <mihai.cristescu@archlinux.info> Romanian
Marco Colombo <magicdice@inwind.it> Italian
Mihai Cristescu <mihai.cristescu@archlinux.info> Romanian
Yavor Doganov <yavor@doganov.org> Bulgarian
Karl Eichwalder <keichwa@gmx.net> German
A. Murat EREN <meren@comu.edu.tr> Turkish
@@ -36,6 +37,7 @@ Wojciech Kotwica <wkotwica@post.pl> Polish
Ask Hjorth Larsen <asklarsen@gmail.com> Danish
Clement Laforet <clem_laf@wanadoo.fr> French
LI Daobing <lidaobing@gmail.com> Chinese (simplified)
Jordi Mallach <jordi@gnu.org> Catalan
João Victor Duarte Martins <jvdm@sdf.lonestar.org> Brazilian Portuguese
Pavel Maryanov <acid@jack.kiev.ua> Russian
Daniele Medri <madrid@linux.it> Italian
@@ -47,6 +49,7 @@ Daniel Nylander <po@danielnylander.se> Swedish
Mikel Olasagasti <hey_neken@mundurat.net> Basque
Michael Piefel <piefel@informatik.hu-berlin.de> German
Sergey Poznyakoff <gray@gnu.org> Polish
Božidar Putanec <bozidarp@yahoo.com> Croatian
Trần Ngọc Quân <vnwildman@gmail.com> Vietnamese
Sergey A. Ribalchenko <fisher@obu.ck.ua> Ukrainian and Russian
Michel Robitaille <robitail@IRO.UMontreal.CA> French
@@ -82,13 +85,9 @@ Thijs Kinkhorst <thijs@kinkhorst.com> rnano.1 manpage
Jim Knoble <jmknoble@pobox.com> Pico compat for browser
Ryan Krebs <fluffy@highwire.stanford.edu> Many bug fixes and testing
Roy Lanek <lanek@ranahminang.net> Advice and advocacy
Mark Majeres <mark@engine12.com> Working undo/redo code
Chuck Mead <csm@MoonGroup.com> Feedback and RPM stuff
Mike Melanson <melanson@pcisys.net> Bugs
Neil Parks <nparks@acsmail.com> Bug reports and fixes
Jeremy Robichaud <robicj@yahoo.com> Beta tester
Bill Soudan <wes0472@rit.edu> Regex code, etc
Ken Tyler <kent@werple.net.au> Search fixes and more
$Id$

View File

@@ -20,7 +20,7 @@
#
# $Id$
AC_INIT([GNU nano], [2.5.0], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [2.5.2], [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.2" "February 2016"
.\" Please adjust this date whenever revising the manpage.
.\"
@@ -116,8 +116,9 @@ Disable automatic conversion of files from DOS/Mac format.
Use the blank line below the titlebar as extra editing space.
.TP
.BR \-P ", " \-\-positionlog
Log and later read back the location of the cursor and place it there
again. (The old form of this option, \fB\-\-poslog\fR, is deprecated.)
For the 200 most recent files, log the last position of the cursor,
and place it at that position again upon reopening such a file.
(The old form of this option, \fB\-\-poslog\fR, is deprecated.)
.TP
.BR "\-Q ""\fIcharacters\fB""" ", " "\-\-quotestr=""" \fIcharacters\fR """
Set the quoting string for justifying. The default is
@@ -176,11 +177,6 @@ editing source code.
Make the 'Cut Text' command (normally ^K) cut from the current cursor
position to the end of the line, instead of cutting the entire line.
.TP
.BR \-l ", " \-\-nofollow
If the file being edited is a symbolic link, replace the link with
a new file instead of following it. Good for editing files in
\fI/tmp\fP, perhaps?
.TP
.BR \-m ", " \-\-mouse
Enable mouse support, if available for your system. When enabled, mouse
clicks can be used to place the cursor, set the mark (with a double

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.2" "February 2016"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -141,9 +141,6 @@ When reading in a file with ^R, insert it into a new buffer by default.
.B set noconvert
Don't convert files from DOS/Mac format.
.TP
.B set nofollow
Don't follow symlinks when writing files.
.TP
.B set nohelp
Don't display the two help lines at the bottom of the screen.
.TP
@@ -161,6 +158,7 @@ directory feature is turned off.
.TP
.B set positionlog
Save the cursor position of files between editing sessions.
The cursor position is remembered for the 200 most-recently edited files.
(The old form of this option, '\fBset poslog\fR', is deprecated.)
.TP
.B set preserve
@@ -574,13 +572,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 +587,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.2" "February 2016"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME

View File

@@ -57,7 +57,7 @@
## width less this number.
# set fill -8
## Enable ~/.nano_history for saving and reading search/replace strings.
## Remember the used search/replace strings for the next session.
# set historylog
## Enable vim-style lock-files. This is just to let a vim user know you
@@ -86,9 +86,6 @@
## Don't convert files from DOS/Mac format.
# set noconvert
## Don't follow symlinks when writing files.
# set nofollow
## Don't display the helpful shortcut lists at the bottom of the screen.
# set nohelp

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

@@ -18,16 +18,17 @@ 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="^(\\.|[^"])*""
color brightyellow ""([^"]|\\")*"" "<[^[:blank:]=]*>"
# 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 "//.*"
color brightblue start="/\*" end="\*/"
# Reminders.
color ,yellow "(FIXME|TODO|XXX)"
color ,yellow "\<(FIXME|TODO|XXX)\>"
# Trailing whitespace.
color ,green "[[:space:]]+$"

View File

@@ -16,7 +16,7 @@ color cyan "bug #[0-9]{5,9}" "patch #[0-9]{4,9}"
# Probable constants, for variety.
color brightred "\<[A-Z_][0-9A-Z_]+\>"
# Key sequences.
color brightblue "\^[A-Z]" "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
color brightblue "\^[A-Z^\]" "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
# Changed files.
color magenta start="^( | {8})\* " end="(:( |$)|^$)"

View File

@@ -2,6 +2,9 @@
syntax "go" "\.go$"
# Set up a formatter since spelling is probably useless...
formatter gofmt -w
# Types.
color green "\<(bool|u?int(8|16|32|64)?|float(32|64)|complex(64|128)|byte|rune|uintptr|string|error)\>"
color green "\<((<-[[:space:]]*)chan|chan[[:space:]]*<-|const|func|interface|map|struct|type|var)\>"
@@ -40,6 +43,3 @@ color brightblue start="/\*" end="\*/"
# Trailing whitespace.
color ,green "[[:space:]]+$"
# Set up the formatter since spelling is probably useless...
formatter gofmt -w

View File

@@ -6,11 +6,11 @@ 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|nofollow|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)\>"
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:]]*$"
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)+[[:space:]]*$"
icolor brightgreen "^[[:space:]]*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:]]*$)"
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9^_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|linter|formatter)[[:space:]]+.*$"
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|formatter|extendsyntax)\>"
@@ -21,7 +21,7 @@ icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
# Strings
icolor brightmagenta ""(\\.|[^"])*""
# Comments
icolor brightblue "^[[:space:]]*#.*$"
icolor brightblue "(^|[[:space:]]+)#.*$"
icolor cyan "^[[:space:]]*##.*$"
# Trailing whitespace

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,8 +6,8 @@
@smallbook
@set EDITION 0.3
@set VERSION 2.5.0
@set UPDATED December 2015
@set VERSION 2.5.2
@set UPDATED February 2016
@dircategory Editors
@direntry
@@ -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.2
@author Chris Allegretta
@page
@@ -89,6 +89,7 @@ as possible while offering a superset of Pico's functionality. See
Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}.
@node Invoking
@chapter Invoking
@@ -113,6 +114,7 @@ But normallly you would set your preferred options in your
(making @code{nano} remember the cursor position when you close a file),
you will rarely need to specify a line number.
@node Command-line Options
@chapter Command-line Options
@@ -188,8 +190,8 @@ Use the blank line below the titlebar as extra editing space.
@item -P
@itemx --positionlog
Log for each file the last location of the cursor, and read it
back upon reopening the file and place it there again.
For the 200 most recent files, log the last position of the cursor,
and place it at that position again upon reopening such a file.
(The old form of this option, @code{--poslog}, is deprecated.)
@item -Q "@var{characters}"
@@ -264,11 +266,6 @@ the previous line.
Make the 'Cut Text' command (normally ^K) cut from the current cursor
position to the end of the line, instead of cutting the entire line.
@item -l
@itemx --nofollow
When writing files, if the given file is a symbolic link, it is removed
and a new file is created.
@item -m
@itemx --mouse
Enable mouse support, if available for your system. When enabled, mouse
@@ -342,7 +339,7 @@ Don't hard-wrap long lines at any length. This option conflicts with
@anchor{Expert Mode}
@item -x
@itemx --nohelp
Expert Mode: don't show the Shortcut Lists at the bottom of the screen.
Expert Mode: don't show the Shortcut List at the bottom of the screen.
This affects the location of the statusbar as well, as in Expert Mode it
is located at the very bottom of the editor.
@@ -379,12 +376,11 @@ Ignored, for compatibility with Pico.
@menu
* Entering Text::
* Special Functions::
* Commands::
* The Cutbuffer::
* The Mark::
* The Titlebar::
* The Statusbar::
* Shortcut Lists::
* Screen Layout::
* Search and Replace::
* Using the Mouse::
* Limitation::
@end menu
@@ -392,34 +388,46 @@ Ignored, for compatibility with Pico.
@node Entering Text
@section Entering Text
@code{nano} is a "modeless" editor. All keystrokes, with the exception
of Control and Meta key sequences, enter text into the file being edited.
All key sequences in @code{nano} are entered using the keyboard.
@code{nano} is a "modeless" editor. This means that all keystrokes,
with the exception of Control and Meta sequences, enter text into the
file being edited.
@node Special Functions
@section Special Functions
Special functions use the Control key (Ctrl), displayed in the help and
shortcut lists as ^; the Meta key (Alt or Cmd), displayed as M-; or the
Escape key (Esc).
Characters not present on the keyboard can be entered in two ways:
@itemize @bullet
@item
Control key sequences are entered by holding down the Ctrl key and
pressing the desired key, or by pressing the Esc key twice and then
pressing the desired key.
For characters with a single-byte code,
pressing the Esc key twice and then typing a three-digit decimal number
(from 000 to 255) will enter the character with the corresponding value.
@item
Pressing the Esc key twice and then typing a three-digit number from
000 to 255 will enter the character with the corresponding value.
@item
Meta key sequences are entered by holding down the Meta key (normally
the Alt key) and pressing the desired key, or by pressing the Esc key
once and then pressing the desired key. Certain operating systems "swallow"
the Alt key so that it never reaches the application; if your operating
system does this, you should use the Esc key to generate Meta key
sequences.
For any possible character, pressing M-V (Alt+V) and then typing a
six-digit hexadecimal number (starting with 0 or 1) will enter the
character with the corresponding Unicode value.
@end itemize
@node Commands
@section Commands
Commands are given by using the Control key (Ctrl, shown as @code{^})
or the Meta key (Alt or Cmd, shown as @code{M-}).
@itemize @bullet
@item
A control-key sequence is entered by holding down the Ctrl key and
pressing the desired key.
@item
A meta-key sequence is entered by holding down the Meta key (normally
the Alt key) and pressing the desired key.
@end itemize
If for some reason on your system the combinations with Ctrl or Alt do
not work, you can generate them by using the Esc key. A control-key
sequence is generated by pressing the Esc key twice and then pressing
the desired key, and a meta-key sequence by pressing the Esc key once
and then pressing the desired key.
@node The Cutbuffer
@section The Cutbuffer
@@ -448,35 +456,42 @@ search-and-replace (^\) or spell-checking session (^T).
Cutting or copying selected text will toggle the mark off automatically.
If necessary, it can be toggled off manually with another ^6 or M-A.
@node The Titlebar
@section The Titlebar
@node Screen Layout
@section Screen Layout
The titlebar is the line displayed at the top of the editor. There are
The default screen of nano consists of five areas. From top to bottom
these are: the titlebar, a blank line, the edit window, the statusbar,
and two help lines.
The titlebar consists of
three sections: left, center and right. The section on the left
displays the version of @code{nano} being used. The center section
displays the current filename, or "New Buffer" if the file has not yet
been named. The section on the right will display "Modified" if the
been named. The section on the right displays "Modified" if the
file has been modified since it was last saved or opened.
Special modes: When @code{nano} is in "File browser" mode, the center
section will display the current directory instead of the filename. See
@xref{The File Browser}, for more info.
@node The Statusbar
@section The Statusbar
The statusbar is the third line from the bottom of the screen, or the
bottom line in Expert Mode. See @xref{Expert Mode}, for more info. It
The statusbar is the third line from the bottom of the screen. It
shows important and informational messages. Any error messages that
occur from using the editor will appear on the statusbar. Any questions
that are asked of the user will be asked on the statusbar, and any user
input (search strings, filenames, etc.) will be input on the statusbar.
@node Shortcut Lists
@section Shortcut Lists
The two help lines at the bottom of the screen show some of the most
essential functions of the editor. These two lines are called the
Shortcut List.
The Shortcut Lists are the two lines at the bottom of the screen which
show some of the more commonly used functions in the editor.
@node Search and Replace
@section Search and Replace
One can search the current buffer for the occurrence of any string
with the Search command (default key binding: ^W). The default search
mode is forward, case-insensitive, and for literal strings. But one
can search backwards by pressing M-B, search case sensitively with M-C,
and interpret regular expressions in the search string with M-R.
A regular expression in a search string always covers just one line;
it cannot span multiple lines. And when replacing (with ^\ or M-R)
the replacement string cannot contain a newline (LF).
@node Using the Mouse
@section Using the Mouse
@@ -515,7 +530,7 @@ and ^V (Page Down) keys. ^X exits the help system.
Toggles allow you to change on-the-fly certain aspects of the editor
which would normally be specified via command-line options. They are
invoked via Meta-key sequences. See @xref{Special Functions}, for more info.
invoked via Meta-key sequences (see @xref{Commands}, for more info).
The following global toggles are available:
@table @code
@@ -700,9 +715,6 @@ When reading in a file with ^R, insert it into a new buffer by default.
@item set noconvert
Don't convert files from DOS/Mac format.
@item set nofollow
Don't follow symlinks when writing files.
@item set nohelp
Don't display the help lists at the bottom of the screen.
@@ -720,6 +732,7 @@ directory feature is turned off.
@item set positionlog
Save the cursor position of files between editing sessions.
The cursor position is remembered for the 200 most-recently edited files.
(The old form of this option, @code{set poslog}, is deprecated.)
@item set preserve
@@ -1159,6 +1172,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.
@@ -1454,6 +1472,10 @@ Disable support for reading and writing Unicode files. Normally the
configure script auto-detects whether to enable UTF-8 support or not.
You can use this or the previous option to override that detection.
@item --enable-altrcname=@var{name}
Use the file with the given @var{name} (in the user's home directory)
as nano's settings file, instead of the default @code{.nanorc}.
@item --with-slang
Compile @code{nano} against Slang instead of against ncurses or other
curses libraries.

View File

@@ -1,2 +1,2 @@
# List of available languages.
bg ca cs da de eo es eu fi fr ga gl hu id it ja ms nb nl nn pl pt_BR ro ru sl sr sv tr uk vi zh_CN zh_TW
bg ca cs da de eo es eu fi fr ga gl hr hu id it ja ms nb nl nn pl pt_BR ro ru sl sr sv tr uk vi zh_CN zh_TW

970
po/bg.po

File diff suppressed because it is too large Load Diff

1052
po/ca.po

File diff suppressed because it is too large Load Diff

1087
po/cs.po

File diff suppressed because it is too large Load Diff

968
po/da.po

File diff suppressed because it is too large Load Diff

1054
po/de.po

File diff suppressed because it is too large Load Diff

1095
po/eo.po

File diff suppressed because it is too large Load Diff

1045
po/es.po

File diff suppressed because it is too large Load Diff

973
po/eu.po

File diff suppressed because it is too large Load Diff

981
po/fi.po

File diff suppressed because it is too large Load Diff

1191
po/fr.po

File diff suppressed because it is too large Load Diff

971
po/ga.po

File diff suppressed because it is too large Load Diff

1076
po/gl.po

File diff suppressed because it is too large Load Diff

2453
po/hr.po Normal file

File diff suppressed because it is too large Load Diff

1287
po/hu.po

File diff suppressed because it is too large Load Diff

984
po/id.po

File diff suppressed because it is too large Load Diff

975
po/it.po

File diff suppressed because it is too large Load Diff

967
po/ja.po

File diff suppressed because it is too large Load Diff

970
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1047
po/nb.po

File diff suppressed because it is too large Load Diff

1087
po/nl.po

File diff suppressed because it is too large Load Diff

984
po/nn.po

File diff suppressed because it is too large Load Diff

1093
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1044
po/ro.po

File diff suppressed because it is too large Load Diff

970
po/ru.po

File diff suppressed because it is too large Load Diff

973
po/sl.po

File diff suppressed because it is too large Load Diff

1055
po/sr.po

File diff suppressed because it is too large Load Diff

972
po/sv.po

File diff suppressed because it is too large Load Diff

984
po/tr.po

File diff suppressed because it is too large Load Diff

1051
po/uk.po

File diff suppressed because it is too large Load Diff

1080
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

@@ -217,10 +217,7 @@ char *do_browser(char *path, DIR *dir)
/* If the directory begins with a newline (i.e. an
* encoded null), treat it as though it's blank. */
if (i < 0 || *answer == '\n') {
/* We canceled. Indicate that on the statusbar, and
* blank out ans, since we're done with it. */
statusbar(_("Cancelled"));
ans = mallocstrcpy(ans, "");
continue;
} else if (i != 0) {
/* Put back the "Go to Directory" key and save
@@ -232,12 +229,7 @@ char *do_browser(char *path, DIR *dir)
continue;
}
/* We have a directory. Blank out ans, since we're done
* with it. */
ans = mallocstrcpy(ans, "");
/* Convert newlines to nulls, just before we go to the
* directory. */
/* Convert newlines to nulls in the directory name. */
sunder(answer);
align(&answer);

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

@@ -28,10 +28,8 @@
static bool keep_cutbuffer = FALSE;
/* Should we keep the contents of the cutbuffer? */
/* Pointer to the end of the cutbuffer. */
/* Indicate that we should no longer keep the contents of the
* cutbuffer. */
/* Indicate that we should no longer keep the contents of the cutbuffer. */
void cutbuffer_reset(void)
{
keep_cutbuffer = FALSE;
@@ -68,7 +66,7 @@ void cut_marked(void)
size_t top_x, bot_x;
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, NULL);
(const filestruct **)&bot, &bot_x, NULL);
move_to_filestruct(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
openfile->placewewant = xplustabs();
@@ -107,9 +105,9 @@ void cut_to_eol(void)
* file into the cutbuffer. */
void cut_to_eof(void)
{
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
openfile->current_x, openfile->filebot,
strlen(openfile->filebot->data));
move_to_filestruct(&cutbuffer, &cutbottom,
openfile->current, openfile->current_x,
openfile->filebot, strlen(openfile->filebot->data));
}
#endif /* !NANO_TINY */
@@ -127,8 +125,7 @@ void do_cut_text(
{
#ifndef NANO_TINY
filestruct *cb_save = NULL;
/* The current end of the cutbuffer, before we add text to
* it. */
/* The current end of the cutbuffer, before we add text to it. */
size_t cb_save_len = 0;
/* The length of the string at the current end of the cutbuffer,
* before we add text to it. */
@@ -162,24 +159,20 @@ void do_cut_text(
}
#endif
/* Set keep_cutbuffer to TRUE, so that the text we're going to move
* into the cutbuffer will be added to the text already in the
* cutbuffer instead of replacing it. */
/* Ensure that the text we're going to move into the cutbuffer will
* be added to the text already there, instead of replacing it. */
keep_cutbuffer = TRUE;
#ifndef NANO_TINY
if (cut_till_eof) {
/* If cut_till_eof is TRUE, move all text up to the end of the
* file into the cutbuffer. */
/* Move all text up to the end of the file into the cutbuffer. */
cut_to_eof();
} else if (openfile->mark_set) {
/* If the mark is on, move the marked text to the cutbuffer, and
* turn the mark off. */
/* Move the marked text to the cutbuffer, and turn the mark off. */
cut_marked();
openfile->mark_set = FALSE;
} else if (ISSET(CUT_TO_END))
/* If the CUT_TO_END flag is set, move all text up to the end of
* the line into the cutbuffer. */
/* Move all text up to the end of the line into the cutbuffer. */
cut_to_eol();
else
#endif
@@ -209,15 +202,10 @@ void do_cut_text(
* disturbing the text. */
if (!old_no_newlines)
UNSET(NO_NEWLINES);
}
/* Leave the text in the cutbuffer, and mark the file as
* modified. */
if (!copy_text)
} else
#endif /* !NANO_TINY */
set_modified();
/* Update the screen. */
edit_refresh_needed = TRUE;
#ifndef DISABLE_COLOR
@@ -296,7 +284,6 @@ void do_uncut_text(void)
/* Mark the file as modified. */
set_modified();
/* Update the screen. */
edit_refresh_needed = TRUE;
#ifndef DISABLE_COLOR

File diff suppressed because it is too large Load Diff

View File

@@ -190,7 +190,7 @@ filestruct *replaceage = NULL;
/* The top of the replace string history list. */
filestruct *replacebot = NULL;
/* The bottom of the replace string history list. */
poshiststruct *poshistory;
poshiststruct *position_history = NULL;
/* The cursor position history list. */
#endif
@@ -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
}
}
@@ -476,7 +480,7 @@ void print_sclist(void)
const char *exit_tag = N_("Exit");
const char *close_tag = N_("Close");
const char *uncut_tag = N_("Uncut Text");
#ifndef DISABLE_JUSITIFY
#ifndef DISABLE_JUSTIFY
const char *unjust_tag = N_("Unjustify");
#endif
@@ -548,11 +552,11 @@ void shortcut_init(void)
const char *nano_undo_msg = N_("Undo the last operation");
const char *nano_redo_msg = N_("Redo the last undone operation");
#endif
const char *nano_forward_msg = N_("Go forward one character");
const char *nano_back_msg = N_("Go back one character");
const char *nano_forward_msg = N_("Go forward one character");
#ifndef NANO_TINY
const char *nano_nextword_msg = N_("Go forward one word");
const char *nano_prevword_msg = N_("Go back one word");
const char *nano_nextword_msg = N_("Go forward one word");
#endif
const char *nano_prevline_msg = N_("Go to previous line");
const char *nano_nextline_msg = N_("Go to next line");
@@ -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,
@@ -909,6 +908,7 @@ void shortcut_init(void)
#ifndef NANO_TINY
add_to_funcs(do_cut_prev_word, MMAIN,
/* TRANSLATORS: The next two strings refer to cutting words. */
N_("Cut Left"), IFSCHELP(nano_cut_word_left_msg), TOGETHER, NOVIEW);
add_to_funcs(do_cut_next_word, MMAIN,
N_("Cut Right"), IFSCHELP(nano_cut_word_right_msg), TOGETHER, NOVIEW);
@@ -1006,14 +1006,17 @@ 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);
#endif
#ifndef DISABLE_COLOR
/* TRANSLATORS: Try to keep the next two strings at most 20 characters. */
add_to_funcs(do_page_up, MLINTER,
/* TRANSLATORS: Try to keep the next two strings at most 20 characters. */
N_("Prev Lint Msg"), IFSCHELP(nano_prevlint_msg), TOGETHER, VIEW);
add_to_funcs(do_page_down, MLINTER,
N_("Next Lint Msg"), IFSCHELP(nano_nextlint_msg), TOGETHER, VIEW);
@@ -1197,6 +1200,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 +1227,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);
@@ -1255,14 +1261,14 @@ void set_spell_shortcuts(void)
replace_scs_for(do_linter, do_spell);
#endif
}
#endif
#endif /* !DISABLE_COLOR */
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 +1324,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 +1339,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 +1577,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);
@@ -554,6 +561,8 @@ void delete_opennode(openfilestruct *fileptr)
#ifndef NANO_TINY
free(fileptr->current_stat);
free(fileptr->lock_filename);
/* Free the undo stack. */
discard_until(NULL, fileptr);
#endif
free(fileptr);
}
@@ -911,7 +920,6 @@ void usage(void)
print_opt("-i", "--autoindent", N_("Automatically indent new lines"));
print_opt("-k", "--cut", N_("Cut from cursor to end of line"));
#endif
print_opt("-l", "--nofollow", N_("Don't follow symbolic links, overwrite"));
#ifndef DISABLE_MOUSE
print_opt("-m", "--mouse", N_("Enable the use of the mouse"));
#endif
@@ -957,7 +965,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:"));
@@ -1098,7 +1106,6 @@ void no_current_file_name_warning(void)
beep();
/* Ensure that we see the warning. */
doupdate();
napms(1800);
curs_set(1);
@@ -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)
{
@@ -1335,9 +1346,6 @@ RETSIGTYPE do_continue(int signal)
/* Restore the terminal to its previous state. */
terminal_init();
/* Turn the cursor back on for sure. */
curs_set(1);
/* Redraw the contents of the windows that need it. */
blank_statusbar();
wnoutrefresh(bottomwin);
@@ -1396,9 +1404,6 @@ void regenerate_screen(void)
/* Restore the terminal to its previous state. */
terminal_init();
/* Turn the cursor back on for sure. */
curs_set(1);
/* Do the equivalent of what both mutt and Minimum Profit do:
* Reinitialize all the windows based on the new screen
* dimensions. */
@@ -1408,10 +1413,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 +1657,6 @@ int do_input(bool allow_funcs)
kbinput = (int *)nrealloc(kbinput, kbinput_len *
sizeof(int));
kbinput[kbinput_len - 1] = input;
}
}
@@ -1692,6 +1695,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 +1705,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 +1851,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 +1939,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 +1954,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;
@@ -2144,7 +2002,6 @@ int main(int argc, char **argv)
{"constantshow", 0, NULL, 'c'},
{"rebinddelete", 0, NULL, 'd'},
{"help", 0, NULL, 'h'},
{"nofollow", 0, NULL, 'l'},
#ifndef DISABLE_MOUSE
{"mouse", 0, NULL, 'm'},
#endif
@@ -2348,9 +2205,6 @@ int main(int argc, char **argv)
SET(CUT_TO_END);
break;
#endif
case 'l':
SET(NOFOLLOW_SYMLINKS);
break;
#ifndef DISABLE_MOUSE
case 'm':
SET(USE_MOUSE);
@@ -2674,9 +2528,6 @@ int main(int argc, char **argv)
/* Set up the terminal state. */
terminal_init();
/* Turn the cursor on for sure. */
curs_set(1);
#ifdef DEBUG
fprintf(stderr, "Main: set up windows\n");
#endif
@@ -2707,11 +2558,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,21 +2602,23 @@ 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;
}
#ifndef DISABLE_HISTORIES
else {
else if (ISSET(POS_HISTORY)) {
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 +2647,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 {
else if (ISSET(POS_HISTORY)) {
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
@@ -2818,10 +2668,6 @@ int main(int argc, char **argv)
reset_cursor();
wnoutrefresh(edit);
/* Just in case we were at the statusbar prompt, make sure the
* statusbar cursor position is reset. */
do_prompt_abort();
/* If constant cursor position display is on, and there are no
* keys waiting in the input buffer, display the current cursor
* position on the statusbar. */

View File

@@ -484,7 +484,6 @@ enum
CASE_SENSITIVE,
CONST_UPDATE,
NO_HELP,
NOFOLLOW_SYMLINKS,
SUSPEND,
NO_WRAP,
AUTOINDENT,

View File

@@ -37,9 +37,6 @@ static size_t old_statusbar_x = (size_t)-1;
/* The old cursor position in answer, if any. */
static size_t old_pww = (size_t)-1;
/* The old place we want in answer, if any. */
static bool reset_statusbar_x = FALSE;
/* Should we reset the cursor position at the statusbar
* prompt? */
/* Read in a character, interpret it as a shortcut or toggle if
* necessary, and return it.
@@ -147,14 +144,15 @@ int do_statusbar_input(bool *ran_func, bool *finished,
if (have_shortcut) {
if (s->scfunc == do_tab || s->scfunc == do_enter)
;
else if (s->scfunc == total_refresh)
total_statusbar_refresh(refresh_func);
else if (s->scfunc == do_cut_text_void) {
else if (s->scfunc == total_refresh) {
total_redraw();
refresh_func();
} else if (s->scfunc == do_cut_text_void) {
/* If we're using restricted mode, the filename
* isn't blank, and we're at the "Write File"
* prompt, disable Cut. */
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
'\0' || currmenu != MWRITEFILE)
if (!ISSET(RESTRICTED) || openfile->filename[0] == '\0' ||
currmenu != MWRITEFILE)
do_statusbar_cut_text();
} else if (s->scfunc == do_left)
do_statusbar_left();
@@ -162,9 +160,9 @@ int do_statusbar_input(bool *ran_func, bool *finished,
do_statusbar_right();
#ifndef NANO_TINY
else if (s->scfunc == do_prev_word_void)
do_statusbar_prev_word(FALSE);
do_statusbar_prev_word();
else if (s->scfunc == do_next_word_void)
do_statusbar_next_word(FALSE);
do_statusbar_next_word();
#endif
else if (s->scfunc == do_home)
do_statusbar_home();
@@ -194,15 +192,15 @@ int do_statusbar_input(bool *ran_func, bool *finished,
/* If we're using restricted mode, the filename
* isn't blank, and we're at the "Write File"
* prompt, disable Delete. */
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
'\0' || currmenu != MWRITEFILE)
if (!ISSET(RESTRICTED) || openfile->filename[0] == '\0' ||
currmenu != MWRITEFILE)
do_statusbar_delete();
} else if (s->scfunc == do_backspace) {
/* If we're using restricted mode, the filename
* isn't blank, and we're at the "Write File"
* prompt, disable Backspace. */
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
'\0' || currmenu != MWRITEFILE)
if (!ISSET(RESTRICTED) || openfile->filename[0] == '\0' ||
currmenu != MWRITEFILE)
do_statusbar_backspace();
} else {
/* Handle any other shortcut in the current menu, setting
@@ -210,7 +208,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) &&
@@ -233,8 +231,7 @@ int do_statusbar_mouse(void)
int retval = get_mouseinput(&mouse_x, &mouse_y, TRUE);
/* We can click on the statusbar window text to move the cursor. */
if (retval == 0 && wmouse_trafo(bottomwin, &mouse_y, &mouse_x,
FALSE)) {
if (retval == 0 && wmouse_trafo(bottomwin, &mouse_y, &mouse_x, FALSE)) {
size_t start_col;
assert(prompt != NULL);
@@ -243,15 +240,10 @@ int do_statusbar_mouse(void)
/* Move to where the click occurred. */
if (mouse_x >= start_col && mouse_y == 0) {
size_t pww_save = statusbar_pww;
statusbar_x = actual_x(answer,
get_statusbar_page_start(start_col, start_col +
statusbar_xplustabs()) + mouse_x - start_col);
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
update_bar_if_needed();
}
}
@@ -310,9 +302,8 @@ void do_statusbar_output(char *output, size_t output_len, bool
assert(statusbar_x <= answer_len);
charmove(answer + statusbar_x + char_buf_len,
answer + statusbar_x, answer_len - statusbar_x +
char_buf_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;
@@ -323,62 +314,29 @@ void do_statusbar_output(char *output, size_t output_len, bool
statusbar_pww = statusbar_xplustabs();
update_statusbar_line(answer, statusbar_x);
update_the_statusbar();
}
/* Move to the beginning of the prompt text. If the SMART_HOME flag is
* set, move to the first non-whitespace character of the prompt text if
* we're not already there, or to the beginning of the prompt text if we
* are. */
/* Move to the beginning of the prompt text. */
void do_statusbar_home(void)
{
size_t pww_save = statusbar_pww;
#ifndef NANO_TINY
if (ISSET(SMART_HOME)) {
size_t statusbar_x_save = statusbar_x;
statusbar_x = indent_length(answer);
if (statusbar_x == statusbar_x_save ||
statusbar_x == strlen(answer))
statusbar_x = 0;
statusbar_pww = statusbar_xplustabs();
} else
#endif
{
statusbar_x = 0;
statusbar_pww = statusbar_xplustabs();
}
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
statusbar_x = 0;
update_bar_if_needed();
}
/* Move to the end of the prompt text. */
void do_statusbar_end(void)
{
size_t pww_save = statusbar_pww;
statusbar_x = strlen(answer);
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
update_bar_if_needed();
}
/* Move left one character. */
void do_statusbar_left(void)
{
if (statusbar_x > 0) {
size_t pww_save = statusbar_pww;
statusbar_x = move_mbleft(answer, statusbar_x);
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
update_bar_if_needed();
}
}
@@ -386,13 +344,8 @@ void do_statusbar_left(void)
void do_statusbar_right(void)
{
if (statusbar_x < strlen(answer)) {
size_t pww_save = statusbar_pww;
statusbar_x = move_mbright(answer, statusbar_x);
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
update_bar_if_needed();
}
}
@@ -400,7 +353,7 @@ void do_statusbar_right(void)
void do_statusbar_backspace(void)
{
if (statusbar_x > 0) {
do_statusbar_left();
statusbar_x = move_mbleft(answer, statusbar_x);
do_statusbar_delete();
}
}
@@ -411,19 +364,17 @@ 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);
int char_buf_len = parse_mbchar(answer + statusbar_x, NULL, NULL);
size_t line_len = strlen(answer + statusbar_x);
assert(statusbar_x < strlen(answer));
charmove(answer + statusbar_x, answer + statusbar_x +
char_buf_len, strlen(answer) - statusbar_x -
char_buf_len + 1);
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);
update_statusbar_line(answer, statusbar_x);
update_the_statusbar();
}
}
@@ -443,168 +394,57 @@ void do_statusbar_cut_text(void)
statusbar_pww = statusbar_xplustabs();
}
update_statusbar_line(answer, statusbar_x);
update_the_statusbar();
}
#ifndef NANO_TINY
/* Move to the next word in the prompt text. If allow_punct is TRUE,
* treat punctuation as part of a word. Return TRUE if we started on a
* word, and FALSE otherwise. */
bool do_statusbar_next_word(bool allow_punct)
/* Move to the next word in the prompt text. */
void do_statusbar_next_word(void)
{
size_t pww_save = statusbar_pww;
char *char_mb;
int char_mb_len;
bool end_line = FALSE, started_on_word = FALSE;
bool seen_space = !is_word_mbchar(answer + statusbar_x, FALSE);
assert(answer != NULL);
char_mb = charalloc(mb_cur_max());
/* Move forward until we reach the start of a word. */
while (answer[statusbar_x] != '\0') {
statusbar_x = move_mbright(answer, statusbar_x);
/* Move forward until we find the character after the last letter of
* the current word. */
while (!end_line) {
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL);
/* If we've found it, stop moving forward through the current
* line. */
if (!is_word_mbchar(char_mb, allow_punct))
/* 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(answer + statusbar_x, FALSE))
seen_space = TRUE;
else if (seen_space)
break;
/* If we haven't found it, then we've started on a word, so set
* started_on_word to TRUE. */
started_on_word = TRUE;
if (answer[statusbar_x] == '\0')
end_line = TRUE;
else
statusbar_x += char_mb_len;
}
/* Move forward until we find the first letter of the next word. */
if (answer[statusbar_x] == '\0')
end_line = TRUE;
else
statusbar_x += char_mb_len;
while (!end_line) {
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL);
/* If we've found it, stop moving forward through the current
* line. */
if (is_word_mbchar(char_mb, allow_punct))
break;
if (answer[statusbar_x] == '\0')
end_line = TRUE;
else
statusbar_x += char_mb_len;
}
free(char_mb);
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
/* Return whether we started on a word. */
return started_on_word;
update_bar_if_needed();
}
/* Move to the previous word in the prompt text. If allow_punct is
* TRUE, treat punctuation as part of a word. Return TRUE if we started
* on a word, and FALSE otherwise. */
bool do_statusbar_prev_word(bool allow_punct)
/* Move to the previous word in the prompt text. */
void do_statusbar_prev_word(void)
{
size_t pww_save = statusbar_pww;
char *char_mb;
int char_mb_len;
bool begin_line = FALSE, started_on_word = FALSE;
bool seen_a_word = FALSE, step_forward = FALSE;
assert(answer != NULL);
char_mb = charalloc(mb_cur_max());
/* Move backward until we find the character before the first letter
* of the current word. */
while (!begin_line) {
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL);
/* If we've found it, stop moving backward through the current
* line. */
if (!is_word_mbchar(char_mb, allow_punct))
break;
/* If we haven't found it, then we've started on a word, so set
* started_on_word to TRUE. */
started_on_word = TRUE;
if (statusbar_x == 0)
begin_line = TRUE;
else
statusbar_x = move_mbleft(answer, statusbar_x);
}
/* Move backward until we find the last letter of the previous
* word. */
if (statusbar_x == 0)
begin_line = TRUE;
else
/* Move backward until we pass over the start of a word. */
while (statusbar_x != 0) {
statusbar_x = move_mbleft(answer, statusbar_x);
while (!begin_line) {
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL);
/* If we've found it, stop moving backward through the current
* line. */
if (is_word_mbchar(char_mb, allow_punct))
if (is_word_mbchar(answer + statusbar_x, FALSE))
seen_a_word = TRUE;
else if (seen_a_word) {
/* This is space now: we've overshot the start of the word. */
step_forward = TRUE;
break;
if (statusbar_x == 0)
begin_line = TRUE;
else
statusbar_x = move_mbleft(answer, statusbar_x);
}
/* If we've found it, move backward until we find the character
* before the first letter of the previous word. */
if (!begin_line) {
if (statusbar_x == 0)
begin_line = TRUE;
else
statusbar_x = move_mbleft(answer, statusbar_x);
while (!begin_line) {
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb,
NULL);
/* If we've found it, stop moving backward through the
* current line. */
if (!is_word_mbchar(char_mb, allow_punct))
break;
if (statusbar_x == 0)
begin_line = TRUE;
else
statusbar_x = move_mbleft(answer, statusbar_x);
}
/* If we've found it, move forward to the first letter of the
* previous word. */
if (!begin_line)
statusbar_x += char_mb_len;
}
free(char_mb);
if (step_forward)
/* Move one character forward again to sit on the start of the word. */
statusbar_x = move_mbright(answer, statusbar_x);
statusbar_pww = statusbar_xplustabs();
if (need_statusbar_update(pww_save))
update_statusbar_line(answer, statusbar_x);
/* Return whether we started on a word. */
return started_on_word;
update_bar_if_needed();
}
#endif /* !NANO_TINY */
@@ -634,7 +474,6 @@ void do_statusbar_verbatim_input(bool *got_enter)
free(output);
}
/* Return the placewewant associated with statusbar_x, i.e. the
* zero-based column position of the cursor. The value will be no
* smaller than statusbar_x. */
@@ -667,18 +506,16 @@ void reset_statusbar_cursor(void)
get_statusbar_page_start(start_col, start_col + xpt));
}
/* Repaint the statusbar when getting a character in
* get_prompt_string(). The statusbar text line will be displayed
* starting with curranswer[index]. */
void update_statusbar_line(const char *curranswer, size_t index)
/* Repaint the statusbar. */
void update_the_statusbar(void)
{
size_t start_col, page_start;
size_t start_col, index, page_start;
char *expanded;
assert(prompt != NULL && index <= strlen(curranswer));
assert(prompt != NULL && statusbar_x <= strlen(answer));
start_col = strlenpt(prompt) + 2;
index = strnlenpt(curranswer, index);
index = strnlenpt(answer, statusbar_x);
page_start = get_statusbar_page_start(start_col, start_col + index);
if (interface_color_pair[TITLE_BAR].bright)
@@ -691,39 +528,32 @@ void update_statusbar_line(const char *curranswer, size_t index)
waddch(bottomwin, ':');
waddch(bottomwin, (page_start == 0) ? ' ' : '$');
expanded = display_string(curranswer, page_start, COLS - start_col -
1, FALSE);
expanded = display_string(answer, page_start, COLS - start_col - 1, FALSE);
waddstr(bottomwin, expanded);
free(expanded);
wattroff(bottomwin, A_BOLD);
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
statusbar_pww = statusbar_xplustabs();
reset_statusbar_cursor();
wnoutrefresh(bottomwin);
}
/* Return TRUE if we need an update after moving the cursor, and FALSE
* otherwise. We need an update if pww_save and statusbar_pww are on
* different pages. */
bool need_statusbar_update(size_t pww_save)
/* Update the statusbar line /if/ the placewewant changes page. */
void update_bar_if_needed(void)
{
size_t start_col = strlenpt(prompt) + 2;
size_t was_pww = statusbar_pww;
return get_statusbar_page_start(start_col, start_col + pww_save) !=
get_statusbar_page_start(start_col, start_col + statusbar_pww);
statusbar_pww = statusbar_xplustabs();
if (get_statusbar_page_start(start_col, start_col + statusbar_pww) !=
get_statusbar_page_start(start_col, start_col + was_pww))
update_the_statusbar();
}
/* Unconditionally redraw the entire screen, and then refresh it using
* refresh_func(). */
void total_statusbar_refresh(void (*refresh_func)(void))
{
total_redraw();
refresh_func();
}
/* Get a string of input at the statusbar prompt. This should only be
* called from do_prompt(). */
/* Get a string of input at the statusbar prompt. */
functionptrtype get_prompt_string(int *actual, bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool allow_files,
@@ -737,7 +567,6 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
{
int kbinput = ERR;
bool ran_func, finished;
size_t curranswer_len;
functionptrtype func;
#ifndef DISABLE_TABCOMP
bool tabbed = FALSE;
@@ -759,23 +588,9 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
#endif /* !DISABLE_HISTORIES */
answer = mallocstrcpy(answer, curranswer);
curranswer_len = strlen(answer);
/* If reset_statusbar_x is TRUE, restore statusbar_x and
* statusbar_pww to what they were before this prompt. Then, if
* statusbar_x is uninitialized or past the end of curranswer, put
* statusbar_x at the end of the string and update statusbar_pww
* based on it. We do these things so that the cursor position
* stays at the right place if a prompt-changing toggle is pressed,
* or if this prompt was started from another prompt and we cancel
* out of it. */
if (reset_statusbar_x) {
statusbar_x = old_statusbar_x;
statusbar_pww = old_pww;
}
if (statusbar_x == (size_t)-1 || statusbar_x > curranswer_len) {
statusbar_x = curranswer_len;
if (statusbar_x > strlen(answer)) {
statusbar_x = strlen(answer);
statusbar_pww = statusbar_xplustabs();
}
@@ -783,10 +598,9 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
#endif
update_statusbar_line(answer, statusbar_x);
update_the_statusbar();
/* Refresh the edit window and the statusbar before getting
* input. */
/* Refresh edit window and statusbar before getting input. */
wnoutrefresh(edit);
wnoutrefresh(bottomwin);
@@ -800,13 +614,12 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
assert(statusbar_x <= strlen(answer));
#ifndef NANO_TINY
if (kbinput == KEY_WINCH) {
refresh_func();
update_statusbar_line(answer, statusbar_x);
continue;
}
if (kbinput == KEY_WINCH) {
refresh_func();
update_the_statusbar();
continue;
}
#endif
func = func_from_key(&kbinput);
if (func == do_cancel || func == do_enter)
@@ -834,7 +647,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
answer = input_tab(answer, allow_files, &statusbar_x,
&tabbed, refresh_func, list);
update_statusbar_line(answer, statusbar_x);
update_the_statusbar();
} else
#endif /* !DISABLE_TABCOMP */
#ifndef DISABLE_HISTORIES
@@ -852,7 +665,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
statusbar_x = strlen(answer);
}
update_statusbar_line(answer, statusbar_x);
update_the_statusbar();
/* This key has a shortcut-list entry when it's used to
* move to an older search, which means that finished has
@@ -873,12 +686,12 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
* history list, answer is blank, and magichistory is set,
* save magichistory in answer. */
if ((*history_list)->next == NULL &&
*answer == '\0' && magichistory != NULL) {
answer = mallocstrcpy(answer, magichistory);
statusbar_x = strlen(answer);
}
*answer == '\0' && magichistory != NULL) {
answer = mallocstrcpy(answer, magichistory);
statusbar_x = strlen(answer);
}
update_statusbar_line(answer, statusbar_x);
update_the_statusbar();
/* This key has a shortcut-list entry when it's used to
* move to a newer search, which means that finished has
@@ -889,7 +702,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
} else
#endif /* !DISABLE_HISTORIES */
if (func == do_help_void) {
update_statusbar_line(answer, statusbar_x);
update_the_statusbar();
/* This key has a shortcut-list entry when it's used to go to
* the help browser or display a message indicating that help
@@ -907,37 +720,23 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
#if !defined(DISABLE_HISTORIES) && !defined(DISABLE_TABCOMP)
last_kbinput = kbinput;
#endif
reset_statusbar_cursor();
wnoutrefresh(bottomwin);
}
#ifndef DISABLE_HISTORIES
/* Set the current position in the history list to the bottom,
* and free magichistory if we need to. */
/* Set the current position in the history list to the bottom. */
if (history_list != NULL) {
history_reset(*history_list);
free(magichistory);
}
#endif
/* We've finished putting in an answer or run a normal shortcut's
* associated function, so reset statusbar_x and statusbar_pww. If
* we've finished putting in an answer, reset the statusbar cursor
* position too. */
if (func) {
if (func == do_cancel || func == do_enter || ran_func) {
statusbar_x = old_statusbar_x;
statusbar_pww = old_pww;
if (!ran_func)
reset_statusbar_x = TRUE;
/* Otherwise, we're still putting in an answer or a shortcut with
* an associated function, so leave the statusbar cursor position
* alone. */
} else
reset_statusbar_x = FALSE;
/* If we're done with this prompt, restore the cursor position
* to what it was at the /previous/ prompt, in case there was. */
if (func == do_cancel || func == do_enter) {
statusbar_x = old_statusbar_x;
statusbar_pww = old_pww;
}
*actual = kbinput;
@@ -955,8 +754,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
*
* The allow_tabs parameter indicates whether we should allow tabs to be
* interpreted. The allow_files parameter indicates whether we should
* allow all files (as opposed to just directories) to be tab
* completed. */
* allow all files (as opposed to just directories) to be tab completed. */
int do_prompt(bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool allow_files,
@@ -974,10 +772,6 @@ int do_prompt(bool allow_tabs,
bool list = FALSE;
#endif
/* prompt has been freed and set to NULL unless the user resized
* while at the statusbar prompt. */
free(prompt);
prompt = charalloc(((COLS - 4) * mb_cur_max()) + 1);
bottombars(menu);
@@ -1031,23 +825,12 @@ int do_prompt(bool allow_tabs,
return retval;
}
/* This function forces a reset of the statusbar cursor position. It
* should be called when we get out of all statusbar prompts. */
void do_prompt_abort(void)
{
/* Uninitialize the old cursor position in answer. */
old_statusbar_x = (size_t)-1;
old_pww = (size_t)-1;
reset_statusbar_x = TRUE;
}
/* Ask a simple Yes/No (and optionally All) question, specified in msg,
* on the statusbar. Return 1 for Yes, 0 for No, 2 for All (if all is
* TRUE when passed in), and -1 for Cancel. */
int do_yesno_prompt(bool all, const char *msg)
{
int ok = -2, width = 16;
int response = -2, width = 16;
const char *yesstr; /* String of Yes characters accepted. */
const char *nostr; /* Same for No. */
const char *allstr; /* And All, surprise! */
@@ -1127,52 +910,43 @@ int do_yesno_prompt(bool all, const char *msg)
func = func_from_key(&kbinput);
if (func == do_cancel)
ok = -1;
response = -1;
#ifndef DISABLE_MOUSE
else if (kbinput == KEY_MOUSE) {
/* We can click on the Yes/No/All shortcut list to
* select an answer. */
if (get_mouseinput(&mouse_x, &mouse_y, FALSE) == 0 &&
wmouse_trafo(bottomwin, &mouse_y, &mouse_x,
FALSE) && mouse_x < (width * 2) &&
mouse_y > 0) {
int x = mouse_x / width;
/* Calculate the x-coordinate relative to the
* two columns of the Yes/No/All shortcuts in
* bottomwin. */
int y = mouse_y - 1;
/* Calculate the y-coordinate relative to the
* beginning of the Yes/No/All shortcuts in
* bottomwin, i.e. with the sizes of topwin,
* edit, and the first line of bottomwin
* subtracted out. */
/* We can click on the Yes/No/All shortcuts to select an answer. */
if (get_mouseinput(&mouse_x, &mouse_y, FALSE) == 0 &&
wmouse_trafo(bottomwin, &mouse_y, &mouse_x, FALSE) &&
mouse_x < (width * 2) && mouse_y > 0) {
int x = mouse_x / width;
/* The x-coordinate among the Yes/No/All shortcuts. */
int y = mouse_y - 1;
/* The y-coordinate among the Yes/No/All shortcuts. */
assert(0 <= x && x <= 1 && 0 <= y && y <= 1);
assert(0 <= x && x <= 1 && 0 <= y && y <= 1);
/* x == 0 means they clicked Yes or No. y == 0
* means Yes or All. */
ok = -2 * x * y + x - y + 1;
/* x == 0 means they clicked Yes or No.
* y == 0 means Yes or All. */
response = -2 * x * y + x - y + 1;
if (ok == 2 && !all)
ok = -2;
}
if (response == 2 && !all)
response = -2;
}
}
#endif /* !DISABLE_MOUSE */
else if (func == total_refresh) {
total_redraw();
continue;
} else {
/* Look for the kbinput in the Yes, No and (optionally)
* All strings. */
if (strchr(yesstr, kbinput) != NULL)
ok = 1;
else if (strchr(nostr, kbinput) != NULL)
ok = 0;
else if (all && strchr(allstr, kbinput) != NULL)
ok = 2;
/* Look for the kbinput in the Yes, No (and All) strings. */
if (strchr(yesstr, kbinput) != NULL)
response = 1;
else if (strchr(nostr, kbinput) != NULL)
response = 0;
else if (all && strchr(allstr, kbinput) != NULL)
response = 2;
}
} while (ok == -2);
} while (response == -2);
currmenu = oldmenu;
return ok;
return response;
}

View File

@@ -128,7 +128,7 @@ extern filestruct *searchbot;
extern filestruct *replace_history;
extern filestruct *replaceage;
extern filestruct *replacebot;
extern poshiststruct *poshistory;
extern poshiststruct *position_history;
#endif
#ifdef HAVE_REGEX_H
@@ -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. */
@@ -277,10 +280,10 @@ void do_cut_till_eof(void);
#endif
void do_uncut_text(void);
/* All functions in files.c. */
/* Most 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);
@@ -524,15 +527,15 @@ void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
#ifndef NANO_TINY
bool do_statusbar_next_word(bool allow_punct);
bool do_statusbar_prev_word(bool allow_punct);
void do_statusbar_next_word(void);
void do_statusbar_prev_word(void);
#endif
void do_statusbar_verbatim_input(bool *got_enter);
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
void reset_statusbar_cursor(void);
void update_statusbar_line(const char *curranswer, size_t index);
bool need_statusbar_update(size_t pww_save);
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
@@ -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);
@@ -751,7 +748,7 @@ void new_magicline(void);
void remove_magicline(void);
void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x, bool *right_side_up);
void discard_until(undo *thisone);
void discard_until(const undo *thisitem, openfilestruct *thefile);
void add_undo(undo_type action);
void update_undo(undo_type action);
#endif
@@ -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);
@@ -826,8 +822,6 @@ void do_credits(void);
/* May as well throw these here, since they are just placeholders. */
void do_cancel(void);
void do_page_up(void);
void do_page_down(void);
void case_sens_void(void);
void regexp_void(void);
void gototext_void(void);
@@ -837,6 +831,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

@@ -53,7 +53,6 @@ static const rcoption rcopts[] = {
#ifndef DISABLE_MULTIBUFFER
{"multibuffer", MULTIBUFFER},
#endif
{"nofollow", NOFOLLOW_SYMLINKS},
{"nohelp", NO_HELP},
{"nonewlines", NO_NEWLINES},
#ifndef DISABLE_WRAPPING
@@ -389,20 +388,6 @@ void parse_syntax(char *ptr)
}
#endif /* !DISABLE_COLOR */
int check_bad_binding(sc *s)
{
#define BADLISTLEN 1
key_type badtypes[BADLISTLEN] = {META};
int badseqs[BADLISTLEN] = { 91 };
int i;
for (i = 0; i < BADLISTLEN; i++)
if (s->type == badtypes[i] && s->seq == badseqs[i])
return 1;
return 0;
}
/* Check whether the given executable function is "universal" (meaning
* any horizontal movement or deletion) and thus is present in almost
* all menus. */
@@ -467,6 +452,9 @@ void parse_binding(char *ptr, bool dobind)
else if (keycopy[0] != '^' && keycopy[0] != 'M' && keycopy[0] != 'F') {
rcfile_error(N_("Key name must begin with \"^\", \"M\", or \"F\""));
goto free_copy;
} else if (keycopy[0] == '^' && (keycopy[1] < 64 || keycopy[1] > 127)) {
rcfile_error(N_("Key name %s is invalid"), keycopy);
goto free_copy;
}
if (dobind) {
@@ -539,16 +527,17 @@ void parse_binding(char *ptr, bool dobind)
newsc->menus = menu;
newsc->type = strtokeytype(newsc->keystr);
assign_keyinfo(newsc);
#ifdef DEBUG
fprintf(stderr, "s->keystr = \"%s\"\n", newsc->keystr);
fprintf(stderr, "s->seq = \"%d\"\n", newsc->seq);
#endif
if (check_bad_binding(newsc)) {
/* Do not allow rebinding the equivalent of the Escape key. */
if (newsc->type == META && newsc->seq == 91) {
rcfile_error(N_("Sorry, keystroke \"%s\" may not be rebound"), newsc->keystr);
free(newsc);
goto free_copy;
}
#ifdef DEBUG
fprintf(stderr, "s->keystr = \"%s\"\n", newsc->keystr);
fprintf(stderr, "s->seq = \"%d\"\n", newsc->seq);
#endif
}
/* Now find and delete any existing same shortcut in the menu(s). */

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;
@@ -464,10 +463,9 @@ void do_search(void)
/* If we found something, and we're back at the exact same spot where
* we started searching, then this is the only occurrence. */
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && didfind) {
statusbar(_("This is the only occurrence"));
}
if (didfind && fileptr == openfile->current &&
fileptr_x == openfile->current_x)
statusbar(_("This is the only occurrence"));
openfile->placewewant = xplustabs();
edit_redraw(fileptr, pww_save);
@@ -517,7 +515,9 @@ void do_research(void)
last_search = mallocstrcpy(last_search, searchbot->prev->data);
#endif
if (last_search[0] != '\0') {
if (last_search[0] == '\0')
statusbar(_("No current search pattern"));
else {
#ifdef HAVE_REGEX_H
/* Since answer is "", use last_search! */
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
@@ -533,12 +533,10 @@ void do_research(void)
/* If we found something, and we're back at the exact same spot
* where we started searching, then this is the only occurrence. */
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && didfind) {
statusbar(_("This is the only occurrence"));
}
} else
statusbar(_("No current search pattern"));
if (didfind && fileptr == openfile->current &&
fileptr_x == openfile->current_x && didfind)
statusbar(_("This is the only occurrence"));
}
openfile->placewewant = xplustabs();
edit_redraw(fileptr, pww_save);
@@ -806,8 +804,7 @@ ssize_t do_replace_loop(
#ifndef DISABLE_COLOR
/* If color syntaxes are available and turned on, we
* need to call edit_refresh(). */
if (openfile->colorstrings != NULL &&
!ISSET(NO_COLOR_SYNTAX))
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX))
edit_refresh();
else
#endif
@@ -936,8 +933,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 +944,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);
@@ -1006,20 +1002,18 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
column = openfile->placewewant + 1;
}
for (openfile->current = openfile->fileage;
openfile->current != openfile->filebot && line > 1; line--)
for (openfile->current = openfile->fileage; line > 1 &&
openfile->current != openfile->filebot; line--)
openfile->current = openfile->current->next;
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 +1023,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. */
@@ -396,7 +391,7 @@ void do_indent(ssize_t cols)
if (indent_changed) {
/* Throw away the undo stack, to prevent making mistakes when
* the user tries to undo something in the reindented text. */
discard_until(NULL);
discard_until(NULL, openfile);
openfile->current_undo = NULL;
/* Mark the file as modified. */
@@ -496,6 +491,8 @@ void do_undo(void)
openfile->current_x = u->begin;
switch (u->type) {
case ADD:
/* TRANSLATORS: Eight of the next nine strings describe actions
* that are undone or redone. It are all nouns, not verbs. */
undidmsg = _("text add");
data = charalloc(strlen(f->data) - strlen(u->strdata) + 1);
strncpy(data, f->data, u->begin);
@@ -544,8 +541,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 +563,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 +671,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 +702,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 +787,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);
@@ -909,19 +895,22 @@ bool execute_command(const char *command)
return TRUE;
}
/* Discard undo items that are newer than thisone, or all if NULL. */
void discard_until(undo *thisone)
/* Discard undo items that are newer than the given one, or all if NULL. */
void discard_until(const undo *thisitem, openfilestruct *thefile)
{
undo *dropit = openfile->undotop;
undo *dropit = thefile->undotop;
while (dropit != NULL && dropit != thisone) {
openfile->undotop = dropit->next;
while (dropit != NULL && dropit != thisitem) {
thefile->undotop = dropit->next;
free(dropit->strdata);
if (dropit->cutbuffer != NULL)
free_filestruct(dropit->cutbuffer);
free(dropit);
dropit = openfile->undotop;
dropit = thefile->undotop;
}
/* Prevent a chain of editing actions from continuing. */
thefile->last_action = OTHER;
}
/* Add a new undo struct to the top of the current pile. */
@@ -938,7 +927,7 @@ void add_undo(undo_type action)
return;
/* Blow away newer undo items if we add somewhere in the middle. */
discard_until(u);
discard_until(u, openfile);
#ifdef DEBUG
fprintf(stderr, " >> Adding an undo...\n");
@@ -2076,12 +2065,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 +2076,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 +2117,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 +2141,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 +2151,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 +2169,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 +2180,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++;
@@ -2331,7 +2303,7 @@ void do_justify(bool full_justify)
#ifndef NANO_TINY
/* Throw away the entire undo stack, to prevent a crash when
* the user tries to undo something in the justified text. */
discard_until(NULL);
discard_until(NULL, openfile);
openfile->current_undo = NULL;
#endif
/* Blow away the text in the justify buffer. */
@@ -2773,9 +2745,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. */
@@ -2787,13 +2758,6 @@ const char *do_alt_speller(char *tempfile_name)
/* Restore the terminal to its previous state. */
terminal_init();
/* 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 +2831,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 +2844,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 +2852,8 @@ void do_spell(void)
return;
}
temp = safe_tempfile(&temp_file);
if (temp == NULL) {
statusbar(_("Error writing temp file: %s"), strerror(errno));
return;
@@ -2908,7 +2874,6 @@ void do_spell(void)
blank_bottombars();
statusbar(_("Invoking spell checker, please wait"));
doupdate();
spell_msg = (alt_speller != NULL) ? do_alt_speller(temp) :
do_int_speller(temp);
@@ -2934,26 +2899,18 @@ 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)
{
char *read_buff, *read_buff_ptr, *read_buff_word, *ptr;
size_t pipe_buff_size, read_buff_size, read_buff_read, bytesread;
size_t parsesuccess = 0;
int lint_fd[2];
int lint_status, lint_fd[2];
pid_t pid_lint;
int lint_status;
static int arglen = 3;
static char **lintargs = NULL;
char *lintcopy;
char *convendptr = NULL;
char *lintcopy, *convendptr = NULL;
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
if (ISSET(RESTRICTED)) {
@@ -2968,29 +2925,23 @@ void do_linter(void)
if (openfile->modified) {
int i = do_yesno_prompt(FALSE, _("Save modified buffer before linting?"));
if (i == -1) {
statusbar(_("Cancelled"));
lint_cleanup();
return;
} else if (i == 1) {
if (do_writeout(FALSE) != TRUE) {
lint_cleanup();
return;
}
}
goto exit_from_lint;
} else if (i == 1 && (do_writeout(FALSE) != TRUE))
goto exit_from_lint;
}
lintcopy = mallocstrcpy(NULL, openfile->syntax->linter);
/* Create pipe up front. */
/* Create a pipe up front. */
if (pipe(lint_fd) == -1) {
statusbar(_("Could not create pipe"));
lint_cleanup();
return;
goto exit_from_lint;
}
blank_bottombars();
statusbar(_("Invoking linter, please wait"));
doupdate();
/* Set up an argument list to pass to execvp(). */
if (lintargs == NULL) {
@@ -2999,18 +2950,17 @@ void do_linter(void)
lintargs[0] = strtok(lintcopy, " ");
while ((ptr = strtok(NULL, " ")) != NULL) {
arglen++;
lintargs = (char **)nrealloc(lintargs, arglen *
sizeof(char *));
lintargs = (char **)nrealloc(lintargs, arglen * sizeof(char *));
lintargs[arglen - 3] = ptr;
}
lintargs[arglen - 1] = NULL;
}
lintargs[arglen - 2] = openfile->filename;
/* A new process to run the linter in. */
/* Start a new process to run the linter in. */
if ((pid_lint = fork()) == 0) {
/* Child continues (i.e. future linting process). */
/* Child continues here (i.e. the future linting process). */
close(lint_fd[0]);
/* Send the linter's standard output + err to the pipe. */
@@ -3031,20 +2981,18 @@ void do_linter(void)
/* Parent continues here. */
close(lint_fd[1]);
/* The child process was not forked successfully. */
/* If the child process was not forked successfully... */
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. */
@@ -3059,8 +3007,7 @@ void do_linter(void)
#endif
read_buff_read += bytesread;
read_buff_size += pipe_buff_size;
read_buff = read_buff_ptr = charealloc(read_buff,
read_buff_size);
read_buff = read_buff_ptr = charealloc(read_buff, read_buff_size);
read_buff_ptr += read_buff_read;
}
@@ -3071,7 +3018,7 @@ void do_linter(void)
fprintf(stderr, "text.c:do_lint:Raw output: %s\n", read_buff);
#endif
/* Process the output. */
/* Process the linter output. */
read_buff_word = read_buff_ptr = read_buff;
while (*read_buff_ptr != '\0') {
@@ -3144,21 +3091,20 @@ 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);
tmplint = NULL;
curlint = lints;
while (TRUE) {
ssize_t tmpcol = 1;
int kbinput;
@@ -3171,7 +3117,7 @@ void do_linter(void)
#ifndef NANO_TINY
struct stat lintfileinfo;
new_lint_loop:
new_lint_loop:
if (stat(curlint->filename, &lintfileinfo) != -1) {
if (openfile->current_stat->st_ino != lintfileinfo.st_ino) {
openfilestruct *tmpof = openfile;
@@ -3200,7 +3146,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 +3156,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);
@@ -3223,7 +3169,6 @@ void do_linter(void)
if (kbinput == KEY_WINCH)
continue;
#endif
func = func_from_key(&kbinput);
tmplint = curlint;
@@ -3244,16 +3189,22 @@ void do_linter(void)
statusbar(_("At first message"));
}
}
blank_statusbar();
#ifndef NANO_TINY
free_lints_and_return:
#endif
for (tmplint = lints; tmplint != NULL; tmplint = tmplint->next) {
for (curlint = lints; curlint != NULL;) {
tmplint = curlint;
curlint = curlint->next;
free(tmplint->msg);
free(tmplint->filename);
free(tmplint);
}
lint_cleanup();
exit_from_lint:
display_main_list();
}
#ifndef DISABLE_SPELLER
@@ -3264,17 +3215,22 @@ void do_formatter(void)
{
bool status;
FILE *temp_file;
char *temp = safe_tempfile(&temp_file);
int format_status;
ssize_t lineno_save = openfile->current->lineno;
ssize_t current_y_save = openfile->current_y;
size_t current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
ssize_t current_y_save = openfile->current_y;
ssize_t lineno_save = openfile->current->lineno;
pid_t pid_format;
char *ptr;
static int arglen = 3;
static char **formatargs = NULL;
char *finalstatus = NULL;
char *temp, *ptr, *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));
@@ -3291,16 +3247,8 @@ void do_formatter(void)
return;
}
if (openfile->totsize == 0) {
statusbar(_("Finished"));
return;
}
blank_bottombars();
statusbar(_("Invoking formatter, please wait"));
doupdate();
endwin();
/* Set up an argument list to pass to execvp(). */
if (formatargs == NULL) {
@@ -3309,8 +3257,7 @@ void do_formatter(void)
formatargs[0] = strtok(openfile->syntax->formatter, " ");
while ((ptr = strtok(NULL, " ")) != NULL) {
arglen++;
formatargs = (char **)nrealloc(formatargs, arglen *
sizeof(char *));
formatargs = (char **)nrealloc(formatargs, arglen * sizeof(char *));
formatargs[arglen - 3] = ptr;
}
formatargs[arglen - 1] = NULL;
@@ -3329,39 +3276,31 @@ 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. */
wait(&format_status);
/* Reenter curses mode. */
doupdate();
/* Restore the terminal to its previous state. */
terminal_init();
/* 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,15 +3310,18 @@ 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
* sure that they're cleared off. */
total_refresh();
statusbar(finalstatus);
/* If there were error messages, allow the user some time to read them. */
if (WIFEXITED(format_status) && WEXITSTATUS(format_status) == 2)
sleep(4);
/* If there were any messages, clear them off. */
total_refresh();
}
#endif /* !DISABLE_SPELLER */
#endif /* !DISABLE_COLOR */

View File

@@ -37,7 +37,9 @@ void get_homedir(void)
if (homedir == NULL) {
const char *homenv = getenv("HOME");
if (homenv == NULL) {
/* When HOME isn't set, or when we're root, get the home directory
* from the password file instead. */
if (homenv == NULL || geteuid() == 0) {
const struct passwd *userage = getpwuid(geteuid());
if (userage != NULL)

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");
@@ -311,6 +311,9 @@ 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)
@@ -388,8 +391,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 +474,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 +493,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 +670,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 +693,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 +710,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 +728,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 +742,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 +868,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 +900,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 +909,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 +922,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 +931,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 +993,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 +1082,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 +1107,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 +1118,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 +1131,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;
@@ -2210,29 +2096,6 @@ void titlebar(const char *path)
wnoutrefresh(edit);
}
/* Mark the current file as modified if it isn't already, and then
* update the titlebar to display the file's new status. */
void set_modified(void)
{
if (!openfile->modified) {
openfile->modified = TRUE;
titlebar(NULL);
#ifndef NANO_TINY
if (ISSET(LOCKING)) {
if (openfile->filename[0] == '\0')
return;
else if (openfile->lock_filename == NULL) {
/* TRANSLATORS: Try to keep this at most 76 characters. */
statusbar(_("Warning: Modifying a file which is not locked, check directory permission?"));
} else {
write_lockfile(openfile->lock_filename,
get_full_path(openfile->filename), TRUE);
}
}
#endif
}
}
/* Display a message on the statusbar, and set disable_cursorpos to
* TRUE, so that the message won't be immediately overwritten if
* constant cursor position display is on. */
@@ -2257,6 +2120,9 @@ void statusbar(const char *msg, ...)
return;
}
/* Turn the cursor off while fiddling in the statusbar. */
curs_set(0);
blank_statusbar();
bar = charalloc(mb_cur_max() * (COLS - 3));
@@ -2289,6 +2155,9 @@ void statusbar(const char *msg, ...)
disable_cursorpos = TRUE;
/* Push the message to the screen straightaway. */
doupdate();
/* If we're doing quick statusbar blanking, and constant cursor
* position display is off, blank the statusbar after only one
* keystroke. Otherwise, blank it after twenty-six keystrokes, as
@@ -2728,6 +2597,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 +2610,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 +2775,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);
@@ -2936,8 +2809,7 @@ bool need_screen_update(size_t pww_save)
#ifndef NANO_TINY
openfile->mark_set ||
#endif
get_page_start(pww_save) !=
get_page_start(openfile->placewewant);
get_page_start(pww_save) != get_page_start(openfile->placewewant);
}
/* When edittop changes, try and figure out how many lines
@@ -3084,95 +2956,30 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
* updated. Use this if we've moved without changing any text. */
void edit_redraw(filestruct *old_current, size_t pww_save)
{
filestruct *foo = NULL;
bool do_redraw = need_screen_update(0) || need_screen_update(pww_save);
/* If either old_current or current is offscreen, scroll the edit
* window until it's onscreen and get out. */
if (old_current->lineno < openfile->edittop->lineno ||
old_current->lineno >= openfile->edittop->lineno +
maxrows || openfile->current->lineno <
openfile->edittop->lineno || openfile->current->lineno >=
openfile->edittop->lineno + maxrows) {
#ifdef DEBUG
fprintf(stderr, "edit_redraw(): line %ld was offscreen, oldcurrent = %ld edittop = %ld",
(long)openfile->current->lineno, (long)old_current->lineno, (long)openfile->edittop->lineno);
#endif
#ifndef NANO_TINY
/* If the mark is on, update all the lines between old_current
* and either the old first line or old last line (depending on
* whether we've scrolled up or down) of the edit window. */
if (openfile->mark_set) {
ssize_t old_lineno;
filestruct *old_edittop = openfile->edittop;
if (old_edittop->lineno < openfile->edittop->lineno)
old_lineno = old_edittop->lineno;
else
old_lineno = (old_edittop->lineno + maxrows <=
openfile->filebot->lineno) ?
old_edittop->lineno + editwinrows :
openfile->filebot->lineno;
foo = old_current;
while (foo->lineno != old_lineno) {
update_line(foo, 0);
foo = (foo->lineno > old_lineno) ? foo->prev :
foo->next;
}
}
#endif /* !NANO_TINY */
/* Make sure the current line is on the screen. */
/* 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);
/* Update old_current if we're not on the same page as
* before. */
if (do_redraw)
update_line(old_current, 0);
#ifndef NANO_TINY
/* If the mark is on, update all the lines between the old first
* line or old last line of the edit window (depending on
* whether we've scrolled up or down) and current. */
if (openfile->mark_set) {
while (foo->lineno != openfile->current->lineno) {
update_line(foo, 0);
/* If the mark is on, update all lines between old_current and current. */
if (openfile->mark_set) {
filestruct *foo = old_current;
foo = (foo->lineno > openfile->current->lineno) ?
foo->prev : foo->next;
}
}
#endif /* !NANO_TINY */
return;
}
/* Update old_current and current if we're not on the same page as
* before. If the mark is on, update all the lines between
* old_current and current too. */
foo = old_current;
while (foo != openfile->current) {
if (do_redraw)
while (foo != openfile->current) {
update_line(foo, 0);
#ifndef NANO_TINY
if (!openfile->mark_set)
#endif
break;
#ifndef NANO_TINY
foo = (foo->lineno > openfile->current->lineno) ? foo->prev :
foo->next;
#endif
foo = (foo->lineno > openfile->current->lineno) ?
foo->prev : foo->next;
}
}
#endif /* !NANO_TINY */
if (do_redraw)
/* Update old_current and current if we've changed page. */
if (need_screen_update(0) || need_screen_update(pww_save)) {
update_line(old_current, 0);
update_line(openfile->current, openfile->current_x);
}
}
/* Refresh the screen without changing the position of lines. Use this
@@ -3455,7 +3262,7 @@ void do_credits(void)
"",
"",
"",
"(C) 1999 - 2015",
"(C) 1999 - 2016",
"Free Software Foundation, Inc.",
"",
"",
@@ -3541,11 +3348,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);