Compare commits

..

90 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
62 changed files with 15883 additions and 12889 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.
-------------------------------------------------------------------------

186
ChangeLog
View File

@@ -1,4 +1,186 @@
GNU nano 2.5.0 - 2016.01.11
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.
@@ -53,7 +235,7 @@ GNU nano 2.5.0 - 2016.01.11
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 an always-FALSE parameter.
* src/search.c (do_gotolinecolumn): Chop a duplicate parameter --
'allow_update' always has the same value as 'interactive'.

156
NEWS
View File

@@ -1,3 +1,11 @@
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,
@@ -8,9 +16,9 @@
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,
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
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 all of the fixes now in
@@ -229,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
@@ -259,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
@@ -340,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.
@@ -377,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
@@ -413,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
@@ -707,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
@@ -856,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
@@ -869,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
@@ -886,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
@@ -900,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,
@@ -915,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
@@ -925,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,
@@ -944,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 (^_).
@@ -961,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
@@ -984,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
@@ -1007,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
@@ -1021,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
@@ -1033,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
@@ -1045,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
@@ -1056,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
@@ -1066,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
@@ -1075,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
@@ -1085,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
@@ -1098,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
@@ -1110,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,
@@ -1121,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
@@ -1130,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
@@ -1141,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
@@ -1151,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
@@ -1166,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
@@ -1190,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
@@ -1199,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
@@ -1238,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
@@ -1257,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
@@ -1271,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
@@ -1279,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)
@@ -1292,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
@@ -1316,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".
@@ -1339,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
@@ -1358,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
@@ -1374,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
@@ -1391,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
@@ -1418,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,
@@ -1426,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
@@ -1434,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
@@ -1442,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
@@ -1450,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
@@ -1462,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.1], [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

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.1" "January 2016"
.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.1" "January 2016"
.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

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.1" "January 2016"
.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

@@ -18,7 +18,7 @@ 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 "<[^= ]*>" ""(\\.|[^"])*""
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="^(\\.|[^"])*""
@@ -28,7 +28,7 @@ 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

@@ -6,8 +6,8 @@
@smallbook
@set EDITION 0.3
@set VERSION 2.5.1
@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.1
@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
@@ -1459,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

722
po/bg.po

File diff suppressed because it is too large Load Diff

749
po/ca.po

File diff suppressed because it is too large Load Diff

725
po/cs.po

File diff suppressed because it is too large Load Diff

719
po/da.po

File diff suppressed because it is too large Load Diff

748
po/de.po

File diff suppressed because it is too large Load Diff

799
po/eo.po

File diff suppressed because it is too large Load Diff

747
po/es.po

File diff suppressed because it is too large Load Diff

725
po/eu.po

File diff suppressed because it is too large Load Diff

732
po/fi.po

File diff suppressed because it is too large Load Diff

850
po/fr.po

File diff suppressed because it is too large Load Diff

723
po/ga.po

File diff suppressed because it is too large Load Diff

827
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

752
po/hu.po

File diff suppressed because it is too large Load Diff

718
po/id.po

File diff suppressed because it is too large Load Diff

726
po/it.po

File diff suppressed because it is too large Load Diff

719
po/ja.po

File diff suppressed because it is too large Load Diff

720
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

741
po/nb.po

File diff suppressed because it is too large Load Diff

782
po/nl.po

File diff suppressed because it is too large Load Diff

718
po/nn.po

File diff suppressed because it is too large Load Diff

723
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

740
po/ro.po

File diff suppressed because it is too large Load Diff

721
po/ru.po

File diff suppressed because it is too large Load Diff

725
po/sl.po

File diff suppressed because it is too large Load Diff

725
po/sr.po

File diff suppressed because it is too large Load Diff

723
po/sv.po

File diff suppressed because it is too large Load Diff

718
po/tr.po

File diff suppressed because it is too large Load Diff

748
po/uk.po

File diff suppressed because it is too large Load Diff

772
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

@@ -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

View File

@@ -33,6 +33,40 @@
#include <pwd.h>
#include <libgen.h>
/* Verify that the containing directory of the given filename exists. */
bool has_valid_path(const char *filename)
{
char *parentdir;
struct stat parentinfo;
bool validity = FALSE;
if (strrchr(filename, '/') == NULL)
parentdir = mallocstrcpy(NULL, ".");
else
parentdir = dirname(mallocstrcpy(NULL, filename));
if (stat(parentdir, &parentinfo) == -1) {
if (errno == ENOENT)
statusbar(_("Directory '%s' does not exist"), parentdir);
else
statusbar(_("Path '%s': %s"), parentdir, strerror(errno));
} else if (!S_ISDIR(parentinfo.st_mode)) {
statusbar(_("Path '%s' is not a directory"), parentdir);
} else {
if (access(parentdir, X_OK) == -1)
statusbar(_("Path '%s' is not accessible"), parentdir);
else
validity = TRUE;
}
free(parentdir);
if (!validity)
beep();
return validity;
}
/* Add an entry to the openfile openfilestruct. This should only be
* called from open_buffer(). */
void make_new_buffer(void)
@@ -101,6 +135,32 @@ void initialize_buffer_text(void)
openfile->totsize = 0;
}
/* 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)
return;
openfile->modified = TRUE;
titlebar(NULL);
#ifndef NANO_TINY
if (!ISSET(LOCKING) || openfile->filename[0] == '\0')
return;
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 {
char *fullname = get_full_path(openfile->filename);
write_lockfile(openfile->lock_filename, fullname, TRUE);
free(fullname);
}
#endif
}
#ifndef NANO_TINY
/* Actually write the lockfile. This function will ALWAYS annihilate
* any previous version of the file. We'll borrow INSECURE_BACKUP here
@@ -256,10 +316,9 @@ int do_lockfile(const char *filename)
size_t locknamesize = strlen(filename) + strlen(locking_prefix)
+ strlen(locking_suffix) + 3;
char *lockfilename = charalloc(locknamesize);
char *lockfiledir = NULL;
static char lockprog[11], lockuser[17];
struct stat fileinfo;
int lockfd, lockpid;
int lockfd, lockpid, retval = -1;
snprintf(lockfilename, locknamesize, "%s/%s%s%s", dirname(namecopy1),
locking_prefix, basename(namecopy2), locking_suffix);
@@ -271,14 +330,16 @@ int do_lockfile(const char *filename)
if (stat(lockfilename, &fileinfo) != -1) {
ssize_t readtot = 0;
ssize_t readamt = 0;
char *lockbuf = charalloc(8192);
char *promptstr = charalloc(128);
char *lockbuf, *promptstr;
int ans;
if ((lockfd = open(lockfilename, O_RDONLY)) < 0) {
statusbar(_("Error opening lock file %s: %s"),
lockfilename, strerror(errno));
return -1;
goto free_the_name;
}
lockbuf = charalloc(8192);
do {
readamt = read(lockfd, &lockbuf[readtot], BUFSIZ);
readtot += readamt;
@@ -287,37 +348,54 @@ int do_lockfile(const char *filename)
if (readtot < 48) {
statusbar(_("Error reading lock file %s: Not enough data read"),
lockfilename);
return -1;
free(lockbuf);
goto free_the_name;
}
strncpy(lockprog, &lockbuf[2], 10);
lockpid = (unsigned char)lockbuf[25] * 256 + (unsigned char)lockbuf[24];
strncpy(lockuser, &lockbuf[28], 16);
free(lockbuf);
#ifdef DEBUG
fprintf(stderr, "lockpid = %d\n", lockpid);
fprintf(stderr, "program name which created this lock file should be %s\n", lockprog);
fprintf(stderr, "user which created this lock file should be %s\n", lockuser);
#endif
promptstr = charalloc(128);
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
sprintf(promptstr, _("File %s is being edited (by %s with %s, PID %d); continue?"),
filename, lockuser, lockprog, lockpid);
ans = do_yesno_prompt(FALSE, promptstr);
free(promptstr);
if (ans < 1) {
blank_statusbar();
return -1;
goto free_the_name;
}
} else {
lockfiledir = mallocstrcpy(NULL, lockfilename);
lockfiledir = dirname(lockfiledir);
if (stat(lockfiledir, &fileinfo) == -1) {
statusbar(_("Error writing lock file: Directory \'%s\' doesn't exist"),
lockfiledir);
free(lockfiledir);
return 0;
}
free(lockfiledir);
}
return write_lockfile(lockfilename, filename, FALSE);
retval = write_lockfile(lockfilename, filename, FALSE);
free_the_name:
if (retval < 1)
free(lockfilename);
return retval;
}
/* Perform a stat call on the given filename, allocating a stat struct
* if necessary. On success, *pstat points to the stat's result. On
* failure, *pstat is freed and made NULL. */
void stat_with_alloc(const char *filename, struct stat **pstat)
{
if (*pstat == NULL)
*pstat = (struct stat *)nmalloc(sizeof(struct stat));
if (stat(filename, *pstat) != 0) {
free(*pstat);
*pstat = NULL;
}
}
#endif /* !NANO_TINY */
@@ -363,25 +441,28 @@ bool open_buffer(const char *filename, bool undoable)
}
/* If we're going to load into a new buffer, first create the new
* buffer and lock the corresponding file. */
* buffer and (if possible) lock the corresponding file. */
if (new_buffer) {
make_new_buffer();
if (!has_valid_path(filename))
quiet = TRUE;
#ifndef NANO_TINY
if (ISSET(LOCKING) && filename[0] != '\0') {
int lockstatus = do_lockfile(filename);
if (lockstatus < 0) {
else {
if (ISSET(LOCKING) && filename[0] != '\0') {
int lockstatus = do_lockfile(filename);
if (lockstatus < 0) {
#ifndef DISABLE_MULTIBUFFER
if (openfile->next) {
close_buffer(TRUE);
return FALSE;
}
if (openfile->next) {
close_buffer(TRUE);
return FALSE;
}
#endif
} else if (lockstatus == 0) {
quiet = TRUE;
} else if (lockstatus == 0)
quiet = TRUE;
}
}
#endif
#endif /* !NANO_TINY */
}
/* If the filename isn't blank, and we are not in NOREAD_MODE,
@@ -399,11 +480,8 @@ bool open_buffer(const char *filename, bool undoable)
if (rc > 0) {
read_file(f, rc, filename, undoable, new_buffer);
#ifndef NANO_TINY
if (openfile->current_stat == NULL) {
openfile->current_stat =
(struct stat *)nmalloc(sizeof(struct stat));
stat(filename, openfile->current_stat);
}
if (openfile->current_stat == NULL)
stat_with_alloc(filename, &openfile->current_stat);
#endif
}
@@ -533,7 +611,9 @@ bool close_buffer(bool quiet)
return FALSE;
#ifndef DISABLE_HISTORIES
update_poshistory(openfile->filename, openfile->current->lineno, xplustabs() + 1);
if (ISSET(POS_HISTORY))
update_poshistory(openfile->filename,
openfile->current->lineno, xplustabs() + 1);
#endif
/* Switch to the next file buffer. */
@@ -593,42 +673,42 @@ int is_file_writable(const char *filename)
* Then attach this line after prevnode. */
filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode)
{
filestruct *fileptr = (filestruct *)nmalloc(sizeof(filestruct));
filestruct *freshline = (filestruct *)nmalloc(sizeof(filestruct));
/* Convert nulls to newlines. buf_len is the string's real length. */
unsunder(buf, buf_len);
assert(openfile->fileage != NULL && strlen(buf) == buf_len);
fileptr->data = mallocstrcpy(NULL, buf);
freshline->data = mallocstrcpy(NULL, buf);
#ifndef NANO_TINY
/* If it's a DOS file ("\r\n"), and file conversion isn't disabled,
* strip the '\r' part from fileptr->data. */
* strip the '\r' part from the data. */
if (!ISSET(NO_CONVERT) && buf_len > 0 && buf[buf_len - 1] == '\r')
fileptr->data[buf_len - 1] = '\0';
freshline->data[buf_len - 1] = '\0';
#endif
#ifndef DISABLE_COLOR
fileptr->multidata = NULL;
freshline->multidata = NULL;
#endif
fileptr->prev = prevnode;
freshline->prev = prevnode;
if (prevnode == NULL) {
/* Special case: we're inserting into the first line. */
fileptr->next = openfile->fileage;
openfile->fileage = fileptr;
fileptr->lineno = 1;
freshline->next = openfile->fileage;
openfile->fileage = freshline;
freshline->lineno = 1;
/* Make sure that our edit window stays on the first line. */
openfile->edittop = fileptr;
openfile->edittop = freshline;
} else {
prevnode->next = fileptr;
fileptr->next = NULL;
fileptr->lineno = prevnode->lineno + 1;
prevnode->next = freshline;
freshline->next = NULL;
freshline->lineno = prevnode->lineno + 1;
}
return fileptr;
return freshline;
}
/* Read an open file into the current buffer. f should be set to the
@@ -922,16 +1002,18 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
* permissions, just try the relative one. */
if (full_filename == NULL || (stat(full_filename, &fileinfo) == -1 &&
stat(filename, &fileinfo2) != -1))
full_filename = mallocstrcpy(NULL, filename);
full_filename = mallocstrcpy(full_filename, filename);
if (stat(full_filename, &fileinfo) == -1) {
/* All cases below return. */
free(full_filename);
/* Well, maybe we can open the file even if the OS says it's
* not there. */
if ((fd = open(filename, O_RDONLY)) != -1) {
if (!quiet)
statusbar(_("Reading File"));
free(full_filename);
return 0;
return fd;
}
if (newfie) {
@@ -944,6 +1026,8 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
return -1;
} else if (S_ISDIR(fileinfo.st_mode) || S_ISCHR(fileinfo.st_mode) ||
S_ISBLK(fileinfo.st_mode)) {
free(full_filename);
/* Don't open directories, character files, or block files.
* Sorry, /dev/sndstat! */
statusbar(S_ISDIR(fileinfo.st_mode) ?
@@ -952,6 +1036,7 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
beep();
return -1;
} else if ((fd = open(full_filename, O_RDONLY)) == -1) {
free(full_filename);
statusbar(_("Error reading %s: %s"), filename, strerror(errno));
beep();
return -1;
@@ -1196,20 +1281,23 @@ void do_insertfile(
open_buffer(answer, TRUE);
}
#if !defined(DISABLE_MULTIBUFFER) && !defined(DISABLE_HISTORIES)
#ifndef DISABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER)) {
/* Update the screen to account for the current buffer. */
display_buffer();
ssize_t savedposline, savedposcol;
if (ISSET(POS_HISTORY) &&
#ifndef DISABLE_HISTORIES
if (ISSET(POS_HISTORY)) {
ssize_t priorline, priorcol;
#ifndef NANO_TINY
!execute &&
if (!execute)
#endif
check_poshistory(answer, &savedposline, &savedposcol))
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE);
if (check_poshistory(answer, &priorline, &priorcol))
do_gotolinecolumn(priorline, priorcol, FALSE, FALSE);
}
#endif /* !DISABLE_HISTORIES */
} else
#endif /* !DISABLE_MULTIBUFFER && !DISABLE_HISTORIES */
#endif /* !DISABLE_MULTIBUFFER */
{
filestruct *top_save = openfile->fileage;
@@ -1416,10 +1504,10 @@ char *get_full_path(const char *origpath)
* where we were before. We don't check for a chdir()
* error, since we can do nothing if we get one. */
IGNORE_CALL_RESULT(chdir(d_here));
/* Free d_here, since we're done using it. */
free(d_here);
}
/* Free d_here, since we're done using it. */
free(d_here);
}
/* At this point, if path_only is FALSE and d_there isn't NULL,
@@ -1446,7 +1534,6 @@ char *check_writable_directory(const char *path)
{
char *full_path = get_full_path(path);
/* If get_full_path() fails, return NULL. */
if (full_path == NULL)
return NULL;
@@ -1457,7 +1544,6 @@ char *check_writable_directory(const char *path)
return NULL;
}
/* Otherwise, return the full path. */
return full_path;
}
@@ -1685,17 +1771,12 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
/* The result of stat(). TRUE if the file exists, FALSE
* otherwise. If name is a link that points nowhere, realexists
* is FALSE. */
#endif
struct stat st;
/* The status fields filled in by stat(). */
#endif
bool anyexists;
/* The result of lstat(). The same as realexists, unless name
* is a link. */
struct stat lst;
/* The status fields filled in by lstat(). */
char *realname;
/* name after tilde expansion. */
FILE *f = NULL;
FILE *f = f_open;
/* The actual file, realname, we are writing to. */
char *tempname = NULL;
/* The name of the temporary file we write to on prepend. */
@@ -1705,9 +1786,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
if (*name == '\0')
return -1;
if (f_open != NULL)
f = f_open;
if (!tmp)
titlebar(NULL);
@@ -1722,20 +1800,10 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
}
#endif
anyexists = (lstat(realname, &lst) != -1);
/* If the temp file exists and isn't already open, give up. */
if (tmp && anyexists && f_open == NULL)
if (tmp && (lstat(realname, &st) != -1) && f_open == NULL)
goto cleanup_and_exit;
/* If NOFOLLOW_SYMLINKS is set, it doesn't make sense to prepend or
* append to a symlink. Here we warn about the contradiction. */
if (ISSET(NOFOLLOW_SYMLINKS) && anyexists && S_ISLNK(lst.st_mode)) {
statusbar(
_("Cannot prepend or append to a symlink with --nofollow set"));
goto cleanup_and_exit;
}
#ifndef NANO_TINY
/* Check whether the file (at the end of the symlink) exists. */
realexists = (stat(realname, &st) != -1);
@@ -1744,10 +1812,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
* specified it interactively), stat and save the value now,
* or else we will chase null pointers when we do modtime checks,
* preserve file times, and so on, during backup. */
if (openfile->current_stat == NULL && !tmp && realexists) {
openfile->current_stat = (struct stat *)nmalloc(sizeof(struct stat));
stat(realname, openfile->current_stat);
}
if (openfile->current_stat == NULL && !tmp && realexists)
stat_with_alloc(realname, &openfile->current_stat);
/* We backup only if the backup toggle is set, the file isn't
* temporary, and the file already exists. Furthermore, if we
@@ -1925,15 +1991,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
skip_backup:
#endif /* !NANO_TINY */
/* If NOFOLLOW_SYMLINKS is set and the file is a link, we aren't
* doing prepend or append. So we delete the link first, and just
* overwrite. */
if (ISSET(NOFOLLOW_SYMLINKS) && anyexists && S_ISLNK(lst.st_mode) &&
unlink(realname) == -1) {
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
goto cleanup_and_exit;
}
if (f_open == NULL) {
original_umask = umask(0);
@@ -2133,12 +2190,9 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
}
#ifndef NANO_TINY
/* Update current_stat to reference the file as it is now. */
if (openfile->current_stat == NULL)
openfile->current_stat =
(struct stat *)nmalloc(sizeof(struct stat));
if (!openfile->mark_set)
stat(realname, openfile->current_stat);
/* Get or update the stat info to reflect the current state. */
stat_with_alloc(realname, &openfile->current_stat);
#endif
statusbar(P_("Wrote %lu line", "Wrote %lu lines",
@@ -2259,9 +2313,8 @@ int do_writeout(bool exiting)
(append == APPEND) ? _("File Name to Append to") :
_("File Name to Write");
/* If we're using restricted mode, the filename isn't blank,
* and we're at the "Write File" prompt, disable tab
* completion. */
/* If we're using restricted mode, and the filename isn't blank,
* disable tab completion. */
i = do_prompt(!ISSET(RESTRICTED) ||
openfile->filename[0] == '\0',
#ifndef DISABLE_TABCOMP
@@ -3107,69 +3160,93 @@ void save_history(void)
/* Save the recorded last file positions to ~/.nano/filepos_history. */
void save_poshistory(void)
{
char *poshist;
char *poshist = poshistfilename();
char *statusstr = NULL;
poshiststruct *posptr;
FILE *hist;
poshist = poshistfilename();
if (poshist == NULL)
return;
if (poshist != NULL) {
FILE *hist = fopen(poshist, "wb");
hist = fopen(poshist, "wb");
if (hist == NULL)
fprintf(stderr, _("Error writing %s: %s\n"), poshist,
strerror(errno));
else {
/* Make sure no one else can read from or write to the
* history file. */
chmod(poshist, S_IRUSR | S_IWUSR);
if (hist == NULL)
fprintf(stderr, _("Error writing %s: %s\n"), poshist, strerror(errno));
else {
/* Don't allow others to read or write the history file. */
chmod(poshist, S_IRUSR | S_IWUSR);
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
statusstr = charalloc(strlen(posptr->filename) + 2 * sizeof(ssize_t) + 4);
sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno,
for (posptr = position_history; posptr != NULL; posptr = posptr->next) {
statusstr = charalloc(strlen(posptr->filename) + 2 * sizeof(ssize_t) + 4);
sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno,
(long)posptr->xno);
if (fwrite(statusstr, sizeof(char), strlen(statusstr), hist) < strlen(statusstr))
fprintf(stderr, _("Error writing %s: %s\n"), poshist,
strerror(errno));
free(statusstr);
}
fclose(hist);
if (fwrite(statusstr, sizeof(char), strlen(statusstr), hist) < strlen(statusstr))
fprintf(stderr, _("Error writing %s: %s\n"), poshist, strerror(errno));
free(statusstr);
}
free(poshist);
fclose(hist);
}
free(poshist);
}
/* Update the recorded last file positions, given a filename, a line
* and a column. If no entry is found, add a new one at the end. */
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
{
poshiststruct *posptr, *posprev = NULL;
poshiststruct *posptr, *theone, *posprev = NULL;
char *fullpath = get_full_path(filename);
if (fullpath == NULL)
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/') {
free(fullpath);
return;
}
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
if (!strcmp(posptr->filename, fullpath)) {
posptr->lineno = lineno;
posptr->xno = xpos;
free(fullpath);
return;
}
/* Look for a matching filename in the list. */
for (posptr = position_history; posptr != NULL; posptr = posptr->next) {
if (!strcmp(posptr->filename, fullpath))
break;
posprev = posptr;
}
/* Didn't find it, make a new node yo! */
posptr = (poshiststruct *)nmalloc(sizeof(poshiststruct));
posptr->filename = mallocstrcpy(NULL, fullpath);
posptr->lineno = lineno;
posptr->xno = xpos;
posptr->next = NULL;
/* Don't record files that have the default cursor position. */
if (lineno == 1 && xpos == 1) {
if (posptr != NULL) {
if (posprev == NULL)
position_history = posptr->next;
else
posprev->next = posptr->next;
free(posptr->filename);
free(posptr);
}
free(fullpath);
return;
}
if (!poshistory)
poshistory = posptr;
else
posprev->next = posptr;
theone = posptr;
/* If we didn't find it, make a new node; otherwise, if we're
* not at the end, move the matching one to the end. */
if (theone == NULL) {
theone = (poshiststruct *)nmalloc(sizeof(poshiststruct));
theone->filename = mallocstrcpy(NULL, fullpath);
if (position_history == NULL)
position_history = theone;
else
posprev->next = theone;
} else if (posptr->next != NULL) {
if (posprev == NULL)
position_history = posptr->next;
else
posprev->next = posptr->next;
while (posptr->next != NULL)
posptr = posptr->next;
posptr->next = theone;
}
/* Store the last cursor position. */
theone->lineno = lineno;
theone->xno = xpos;
theone->next = NULL;
free(fullpath);
}
@@ -3185,7 +3262,7 @@ int check_poshistory(const char *file, ssize_t *line, ssize_t *column)
if (fullpath == NULL)
return 0;
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
for (posptr = position_history; posptr != NULL; posptr = posptr->next) {
if (!strcmp(posptr->filename, fullpath)) {
*line = posptr->lineno;
*column = posptr->xno;
@@ -3200,59 +3277,64 @@ int check_poshistory(const char *file, ssize_t *line, ssize_t *column)
/* Load the recorded file positions from ~/.nano/filepos_history. */
void load_poshistory(void)
{
char *nanohist = poshistfilename();
char *poshist = poshistfilename();
FILE *hist;
/* Assume do_rcfile() has reported a missing home directory. */
if (nanohist != NULL) {
FILE *hist = fopen(nanohist, "rb");
/* If the home directory is missing, do_rcfile() will have reported it. */
if (poshist == NULL)
return;
if (hist == NULL) {
if (errno != ENOENT) {
/* Don't save history when we quit. */
UNSET(POS_HISTORY);
history_error(N_("Error reading %s: %s"), nanohist,
strerror(errno));
}
} else {
char *line = NULL, *lineptr, *xptr;
size_t buf_len = 0;
ssize_t read, lineno, xno;
poshiststruct *posptr;
hist = fopen(poshist, "rb");
/* Read and parse each line, and put the data into the
* positions history structure. */
while ((read = getline(&line, &buf_len, hist)) >= 0) {
if (read > 0 && line[read - 1] == '\n') {
read--;
line[read] = '\0';
}
if (read > 0)
unsunder(line, read);
lineptr = parse_next_word(line);
xptr = parse_next_word(lineptr);
lineno = atoi(lineptr);
xno = atoi(xptr);
if (poshistory == NULL) {
poshistory = (poshiststruct *)nmalloc(sizeof(poshiststruct));
poshistory->filename = mallocstrcpy(NULL, line);
poshistory->lineno = lineno;
poshistory->xno = xno;
poshistory->next = NULL;
} else {
for (posptr = poshistory; posptr->next != NULL; posptr = posptr->next)
;
posptr->next = (poshiststruct *)nmalloc(sizeof(poshiststruct));
posptr->next->filename = mallocstrcpy(NULL, line);
posptr->next->lineno = lineno;
posptr->next->xno = xno;
posptr->next->next = NULL;
}
}
fclose(hist);
free(line);
if (hist == NULL) {
if (errno != ENOENT) {
/* When reading failed, don't save history when we quit. */
UNSET(POS_HISTORY);
history_error(N_("Error reading %s: %s"), poshist, strerror(errno));
}
free(nanohist);
} else {
char *line = NULL, *lineptr, *xptr;
size_t buf_len = 0;
ssize_t read, count = 0;
poshiststruct *record_ptr = NULL, *newrecord;
/* Read and parse each line, and store the extracted data. */
while ((read = getline(&line, &buf_len, hist)) > 2) {
if (line[read - 1] == '\n')
line[--read] = '\0';
unsunder(line, read);
lineptr = parse_next_word(line);
xptr = parse_next_word(lineptr);
/* Create a new position record. */
newrecord = (poshiststruct *)nmalloc(sizeof(poshiststruct));
newrecord->filename = mallocstrcpy(NULL, line);
newrecord->lineno = atoi(lineptr);
newrecord->xno = atoi(xptr);
newrecord->next = NULL;
/* Add the record to the list. */
if (position_history == NULL)
position_history = newrecord;
else
record_ptr->next = newrecord;
record_ptr = newrecord;
/* Impose a limit, so the file will not grow indefinitely. */
if (++count > 200) {
poshiststruct *drop_record = position_history;
position_history = position_history->next;
free(drop_record->filename);
free(drop_record);
}
}
fclose(hist);
free(line);
}
free(poshist);
}
#endif /* !DISABLE_HISTORIES */

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
@@ -480,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
@@ -552,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");
@@ -908,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);
@@ -1014,8 +1015,8 @@ void shortcut_init(void)
#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);
@@ -1260,7 +1261,7 @@ void set_spell_shortcuts(void)
replace_scs_for(do_linter, do_spell);
#endif
}
#endif
#endif /* !DISABLE_COLOR */
const subnfunc *sctofunc(const sc *s)
{

View File

@@ -561,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);
}
@@ -918,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
@@ -1105,7 +1106,6 @@ void no_current_file_name_warning(void)
beep();
/* Ensure that we see the warning. */
doupdate();
napms(1800);
curs_set(1);
@@ -1346,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);
@@ -1407,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. */
@@ -2008,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
@@ -2212,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);
@@ -2538,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
@@ -2626,7 +2613,7 @@ int main(int argc, char **argv)
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))
@@ -2664,7 +2651,7 @@ int main(int argc, char **argv)
if (startline > 0 || startcol > 0)
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))
@@ -2681,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
@@ -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
@@ -280,7 +280,7 @@ 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);
bool open_buffer(const char *filename, bool undoable);
@@ -527,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
@@ -748,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
@@ -822,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);

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

@@ -463,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);
@@ -516,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))
@@ -532,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);
@@ -805,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
@@ -1004,8 +1002,8 @@ 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);

View File

@@ -391,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. */
@@ -491,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);
@@ -893,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. */
@@ -922,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");
@@ -2298,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. */
@@ -2753,9 +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);
if (!WIFEXITED(alt_spell_status) || WEXITSTATUS(alt_spell_status) != 0) {
#ifndef NANO_TINY
/* Turn the mark back on if it was on before. */
@@ -2872,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);
@@ -2905,13 +2906,11 @@ 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)) {
@@ -2926,17 +2925,16 @@ void do_linter(void)
if (openfile->modified) {
int i = do_yesno_prompt(FALSE, _("Save modified buffer before linting?"));
if (i == -1) {
statusbar(_("Cancelled"));
goto exit_from_lint;
} else if (i == 1) {
if (do_writeout(FALSE) != TRUE)
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"));
goto exit_from_lint;
@@ -2944,7 +2942,6 @@ void do_linter(void)
blank_bottombars();
statusbar(_("Invoking linter, please wait"));
doupdate();
/* Set up an argument list to pass to execvp(). */
if (lintargs == NULL) {
@@ -2953,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. */
@@ -2985,7 +2981,7 @@ 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"));
@@ -3011,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;
}
@@ -3023,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') {
@@ -3109,6 +3104,7 @@ void do_linter(void)
bottombars(MLINTER);
tmplint = NULL;
curlint = lints;
while (TRUE) {
ssize_t tmpcol = 1;
int kbinput;
@@ -3121,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;
@@ -3173,7 +3169,6 @@ void do_linter(void)
if (kbinput == KEY_WINCH)
continue;
#endif
func = func_from_key(&kbinput);
tmplint = curlint;
@@ -3194,15 +3189,20 @@ 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);
}
exit_from_lint:
display_main_list();
}
@@ -3215,17 +3215,15 @@ void do_formatter(void)
{
bool status;
FILE *temp_file;
char *temp;
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"));
@@ -3251,9 +3249,6 @@ void do_formatter(void)
blank_bottombars();
statusbar(_("Invoking formatter, please wait"));
doupdate();
endwin();
/* Set up an argument list to pass to execvp(). */
if (formatargs == NULL) {
@@ -3262,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;
@@ -3295,15 +3289,6 @@ void do_formatter(void)
/* 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);
if (!WIFEXITED(format_status) || WEXITSTATUS(format_status) != 0)
finalstatus = invocation_error(openfile->syntax->formatter);
else {
@@ -3329,11 +3314,14 @@ void do_formatter(void)
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

@@ -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)
@@ -2093,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. */
@@ -2140,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));
@@ -2172,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
@@ -2823,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
@@ -2971,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