Compare commits

..

543 Commits

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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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

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


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


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


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


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

Patch by Mike Frysinger.


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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5557 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-14 13:14:16 +00:00
Benno Schulenberg
34fbb1f4de Adjusting a few comments and rewrapping some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5556 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-13 20:32:40 +00:00
Benno Schulenberg
ecf3cd7244 Reducing the number of indentation steps elsewhere too.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5555 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-13 20:08:36 +00:00
Benno Schulenberg
96b9249f91 Reducing the number of indentation steps.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5554 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 20:26:59 +00:00
Benno Schulenberg
774c8ba1bf Condensing the preparsing of a line.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5553 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 20:17:05 +00:00
Benno Schulenberg
73ee7d7ee5 Removing a senseless iteration: simply add the new record at the tail.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5552 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 20:08:31 +00:00
Benno Schulenberg
deb271d708 Differentiating a variable name from function names.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5551 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 19:20:40 +00:00
Benno Schulenberg
cb832bef1b Removing some code duplication.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5550 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 19:07:01 +00:00
Benno Schulenberg
583b67bad2 Rename a variable, to match the save routine.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5549 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 11:16:39 +00:00
Benno Schulenberg
5b350b86ba Fixing some typos and whitespace, and normalizing the dates in the NEWS file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5548 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 11:03:00 +00:00
Benno Schulenberg
53991cf073 Fixing the 2.5.1 tag in the Changelog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5547 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 10:23:38 +00:00
Chris Allegretta
3f31bbcb7a Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5546 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-11 05:11:30 +00:00
Chris Allegretta
c26a940167 GNU nano 2.5.1 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5544 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-11 05:05:01 +00:00
Chris Allegretta
26347ed38e Forward date 2.5.1 up to the 11th since I didnt get to it before Midnight.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5543 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-11 05:03:20 +00:00
Benno Schulenberg
1b293ff34c Adjusting dates and version number.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5542 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-10 16:18:43 +00:00
Benno Schulenberg
83475b0d84 Adding a news item for the upcoming 2.5.1.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5541 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-10 16:10:57 +00:00
Benno Schulenberg
113cd506c9 Snipping inconsistent blank lines in the Changelog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5540 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-09 21:10:39 +00:00
Benno Schulenberg
ec4ee1c489 Not going beyond the number of available rows in the edit window.
This fixes Savannah bug #42188.


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5489 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-07 17:05:04 +00:00
Benno Schulenberg
5d27910d6d Quitting the loop when there is no end match.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5488 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-07 15:40:07 +00:00
Benno Schulenberg
a955b332e3 Fixing whitespace, layout, wording, and typo.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5487 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-07 13:31:38 +00:00
Chris Allegretta
1233e8e37a Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5486 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-06 05:40:56 +00:00
Chris Allegretta
4eb4d08038 Typo in release announcement
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5485 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-06 05:27:40 +00:00
Chris Allegretta
fa695744fd GNU nano 2.5.0 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5483 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-06 05:24:07 +00:00
Chris Allegretta
c4a6725ad6 2015-12-05 Chris Allegretta <chrisa@asty.org>
* src/nano.c (main) : key_defined() is an ncurses-ism.  Add
	better checks for this.



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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5199 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-17 09:24:17 +00:00
Chris Allegretta
4d2b198403 GNU nano 2.4.1 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5197 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-14 18:03:44 +00:00
Chris Allegretta
5ea46cacb6 Go even farther on the bug report front in README and only mention
about the Savannah page, based on Benno's excellent suggestion.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5196 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-14 16:07:23 +00:00
Benno Schulenberg
fd759d5ca3 Fixing compilation with --enable-tiny (oops), and mentioning
also the Savannah page as a place for reporting bugs.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5195 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-13 10:59:12 +00:00
Benno Schulenberg
f34c8fdc6b Oops. Correcting an oversight in the Changelog:
the original recent undo fix was by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5194 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 11:29:35 +00:00
Benno Schulenberg
1cf9deb603 Using mallocstrcpy() in a correct manner and
not letting it free an unrelated string.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5193 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 11:15:57 +00:00
Benno Schulenberg
4e5ea18394 Removing an unused variable, and adjusting the introductory comment
for the recently tweaked logic.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5192 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 09:04:30 +00:00
Benno Schulenberg
4e9b3687ba Rebinding ^Y and ^V in the WhereisFile menu
to the effective and consistent first_file() and last_file().


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5191 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 08:44:37 +00:00
Benno Schulenberg
99d2358510 Stopping M-\ and M-/ in the WhereisFile menu from doing also an
unrequested search after having performed their function.
Fixes Savannah bug #44790.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5190 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 08:31:53 +00:00
Benno Schulenberg
08a52c1dab Not splitting off the marked region into a separate partition, but
doing the replacings in situ in the current one, to fix an undo bug.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5189 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-11 15:21:08 +00:00
Benno Schulenberg
ce48ca2223 Correcting and adjusting some comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5188 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-08 19:57:31 +00:00
Benno Schulenberg
2dc9cbefd3 Renaming some things, for more contrast or to be more fitting.
And condensing the renamed function, and making it void because
the result isn't used anyway.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5187 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-08 18:40:40 +00:00
Benno Schulenberg
0f7b99b433 Giving the file a neater layout, plus two table headers.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5186 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 15:37:07 +00:00
Benno Schulenberg
057348e1da Adding the names of recent translators, and sorting them.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5185 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 15:23:12 +00:00
Benno Schulenberg
ab21161a69 Eliding another miniscule function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5184 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 14:24:18 +00:00
Benno Schulenberg
d8b6dbfffe Letting bottombars() set the global variable 'currmenu'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5183 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 14:16:07 +00:00
Benno Schulenberg
d5177059e8 Greatly simplifying the searching for the next matching filename.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5182 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 13:34:12 +00:00
Benno Schulenberg
a9647b0508 Avoiding to set 'focusing' when searching for filenames;
it should be set only when searching/replacing text.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5181 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 11:04:32 +00:00
Benno Schulenberg
37fd348a1d Eliding a miniscule function, and renaming a variable for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5180 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 10:41:00 +00:00
Benno Schulenberg
2aac470cb9 Consistently using the appropriate variable in the appropriate function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5179 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 08:44:24 +00:00
Benno Schulenberg
25ce5f6759 Removing an unfitting comment and tweaking some others.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5178 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 08:23:52 +00:00
Benno Schulenberg
5d0b267aaa Not searching for the empty string when nothing was sought yet
in the file browser (when historylig is set).


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5177 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-07 08:19:04 +00:00
Benno Schulenberg
c2ed8277c2 Expanding on nano's features, and condensing the synopsis,
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5176 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-05 09:14:13 +00:00
Benno Schulenberg
d7ade1f346 Ignoring magic without libmagic, and ignoring formatter without spell checking.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5175 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-03 17:28:30 +00:00
Benno Schulenberg
de53c53c6e Removing two superfluous #ifndefs.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5174 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-03 15:57:22 +00:00
Benno Schulenberg
5ac108188d Updating the README text to the fifth milestone: 2.4.x.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5173 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-03 15:48:57 +00:00
Benno Schulenberg
e683e32c74 Also colouring a series of changed files that spans more than one line.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5172 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-28 19:56:41 +00:00
Benno Schulenberg
7fe830fd20 Only scrolling the required number of lines
when pasting lines onto the bottom line.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5171 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-28 17:11:28 +00:00
Benno Schulenberg
07e199ff0e When searching, put a found off-screen string on the center line
instead of at the bottom or top, to show it in context.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5170 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-28 17:01:46 +00:00
Benno Schulenberg
6f2da6b9b2 Adjusting the end point of the marked region to compensate
for any change in length of the region's last line.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5169 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 20:16:36 +00:00
Benno Schulenberg
14a9c8aa0b Treating the formatter like a speller,
to fix compilation with --disable-speller.
This fixes Savannah bug #44607.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5168 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 16:55:49 +00:00
Benno Schulenberg
52d7d5f55a The linter is only available when colour is.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5167 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 15:34:41 +00:00
Benno Schulenberg
0b6d6f45d2 Normalizing some whitespace.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5166 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 13:46:50 +00:00
Benno Schulenberg
0a79c78e05 Removing two unneeded calls to edit_refresh(), to greatly speed up nano
when doing a Replace All with *lots* of occurrences.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5165 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 11:29:23 +00:00
Benno Schulenberg
ad827a6aef Adjusting some whitespace and wrapping.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5164 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 10:49:19 +00:00
Benno Schulenberg
41580848e3 Recognizing also Debian package diffs.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5163 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-27 09:14:21 +00:00
Benno Schulenberg
b455fa3a16 Allowing to rebind the linter when nano was configured with --disable-speller.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5162 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-25 19:33:00 +00:00
Benno Schulenberg
ff4a457d82 Removing unneeded statement -- nothing has changed the value of 'currmenu'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5161 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-25 16:23:45 +00:00
Benno Schulenberg
eae9f282de Removing a mistaken menu name -- as the formatter allows no interaction
it needs no associated menu.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5160 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-25 16:20:45 +00:00
Benno Schulenberg
e39cf37026 Not letting hashes inside triple-quoted strings cause comment colouring.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5159 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-25 13:50:12 +00:00
Benno Schulenberg
6440aa9e47 Slightly widening and relaxing the header regex.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5158 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-25 13:42:40 +00:00
Benno Schulenberg
745fab8293 Correcting the description of option --noread,
allowing writing to named pipes.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5157 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 18:16:37 +00:00
Benno Schulenberg
a37ebcf2f8 Not unsetting the mark before the possible bailout for zero size.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5156 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 17:12:49 +00:00
Benno Schulenberg
92142bed34 Avoiding a spell-check error when the marked region is zero bytes long.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5155 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 17:01:25 +00:00
Benno Schulenberg
83ec9e7d50 Three tiny Changelog fixes.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5154 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 13:06:07 +00:00
Chris Allegretta
a0a0556993 2015-02-25 Chris Allegretta <chrisa@asty.org>
* src/text.c (do_alt_speller): timestamp can just be a __time_t.
        Fixes compilation on win32.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5153 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 04:32:45 +00:00
Chris Allegretta
33ac317132 Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5152 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 04:23:32 +00:00
Chris Allegretta
9007c58bdd GNU nano 2.4.0 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5150 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-23 03:49:37 +00:00
Benno Schulenberg
2456dd2a85 Not centering the current line when smooth scrolling is used.
This fixes Savannah bug #42654.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5149 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-22 13:23:42 +00:00
Benno Schulenberg
a44cf41d37 Stepping backward or forward not simply one byte
but one character (possibly multibyte).
This fixes Savannah bug #42175.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5148 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-22 11:42:29 +00:00
Benno Schulenberg
76e7aaf514 Starting to look for a multibyte character not at the start of the string,
but only as far back as such a character can possibly be.
Speedup suggested by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5147 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-22 11:20:02 +00:00
Benno Schulenberg
cb776fad88 Placing some comments better and unwrapping some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5146 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-21 21:40:56 +00:00
Benno Schulenberg
a4f28694c8 Removing some leftovers after Mark's patch.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5145 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-21 21:13:03 +00:00
Benno Schulenberg
82d737ee6d Restoring the positions of the mark and the cursor in a better way.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5144 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-21 21:02:13 +00:00
Benno Schulenberg
138add24c8 Keeping related items together in the ^G help screen.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5143 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-20 12:22:49 +00:00
Benno Schulenberg
532d55c8bd Making a message equal to another one.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5142 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-20 11:37:53 +00:00
Benno Schulenberg
3345e3407d Normalizing some whitespace, removing an old comment,
and placing another one better.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5141 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-20 11:18:22 +00:00
Benno Schulenberg
52d1c20973 Not setting the modified flag when an external spell checker
didn't make any changes.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5140 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-17 20:10:59 +00:00
Benno Schulenberg
6898c60ba6 Adding full name of bug reporter.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5139 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-15 19:48:50 +00:00
Benno Schulenberg
69d26c35fb Fixing a mistaken message plus a few comments too.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5138 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-14 20:17:21 +00:00
Benno Schulenberg
4d9b5e92b3 Getting out if there is nothing to renumber,
to prevent do_undo() from falling over when trying to renumber emptiness.
Patch basically by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5137 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-14 15:59:01 +00:00
Benno Schulenberg
18a2edfb84 Dropping compile time from version information to enable a reproducible
build.  Proposed by Jérémy Bobbio and Jordi Mallach.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5136 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-08 20:14:10 +00:00
Benno Schulenberg
4e95ee9f6e Updating years and version numbers in the docs
in anticipation of a release.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5135 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-08 15:59:15 +00:00
Benno Schulenberg
79ff393dc2 Fixing the rebinding of toggles.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5134 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-08 15:42:52 +00:00
Benno Schulenberg
03bcaf6067 Fixing compilation with --enable-tiny plus --enable-nanorc.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5133 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-08 12:10:52 +00:00
Benno Schulenberg
5891c4a542 Removing the mistaken square brackets around the arguments
of "header" and "magic" -- those regexes are not optional.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5132 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-07 22:11:56 +00:00
Benno Schulenberg
3131d0c48a Oops.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5131 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-07 21:51:01 +00:00
Benno Schulenberg
336b0ecbca Improving the indentation of some lists in the nanorc man page.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5130 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-07 21:48:15 +00:00
Benno Schulenberg
32e76c4386 Adding a note about the inherent imperfection of using regular expressions
for syntax highlighting, as suggested by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5129 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-07 21:30:36 +00:00
Benno Schulenberg
7d77521794 Typo fixing and whitespace adjusting of the NEWS file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5128 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-03-07 20:46:11 +00:00
Chris Allegretta
7f61fa1b55 Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5127 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-27 17:00:11 +00:00
Chris Allegretta
98485c96d8 GNU nano 2.3.99pre3 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5125 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-27 16:57:55 +00:00
Chris Allegretta
184cf609c0 2015-02-25 Chris Allegretta <chrisa@asty.org>
* src/rcfile.c (parse_binding): Add exception for do_toggle as
        rebinding toggles broke with r5022.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5124 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-25 19:04:53 +00:00
Benno Schulenberg
e73e02fe10 Oops -- created that typo myself.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5123 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-21 11:31:56 +00:00
Benno Schulenberg
ed2f0b349f Wrapping some overlong lines, and fixing a typo in the Java file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5122 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-21 10:34:15 +00:00
Benno Schulenberg
d4e1d31ea4 Fixing the explanation of how to subscribe to a mailing list.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5121 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-21 09:45:53 +00:00
Benno Schulenberg
bb4edd0136 Recognizing also dash, openrc and runscript as shell scripts.
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5120 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-18 20:01:30 +00:00
Benno Schulenberg
c9b3a71d02 Ignoring the autotools 'compile' file. Patch by Mike Frysinger.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5119 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-16 20:13:29 +00:00
Benno Schulenberg
1b65b19abd The user does the editing, not the editor. So rephrasing.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5118 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-15 16:28:08 +00:00
Benno Schulenberg
35cd49ec50 Also showing the name of the affected file when finding a lock file,
for when many files are opened at once.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5117 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-15 16:20:09 +00:00
Chris Allegretta
6c7764862b 2015-02-09 Chris Allegretta <chrisa@asty.org>
* nano.spec.in: Add dependency on texinfo, docdir files for
        RPM file creation.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5116 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-09 19:53:29 +00:00
Chris Allegretta
9c88cab78c Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5115 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-07 03:33:14 +00:00
Chris Allegretta
651bb5009f GNU nano 2.3.99pre2 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5113 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-07 00:26:43 +00:00
Chris Allegretta
86c6cd1725 2015-02-03 Alex Henrie <alexhenrie24@gmail.com>
* src/cut.c (do_cut_text): Make sure to set modified even when
        using --enable-tiny.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5112 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-03 22:49:57 +00:00
Benno Schulenberg
bd98ff02f6 Avoiding to trim the nano version number on the status bar.
Patch by Kamil Dudka.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5111 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 10:07:08 +00:00
Benno Schulenberg
057ef182cd Avoiding to print a wrong PID on the status bar.
Patch by Kamil Dudka.  Bug reported by Don Swaner.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5110 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 09:58:02 +00:00
Benno Schulenberg
67cdd5ee1e Making sure that 'lockprog' and 'lockuser' are properly terminated.
Patch by Kamil Dudka.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5109 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 09:48:50 +00:00
Benno Schulenberg
92896a708d Avoiding to write uninitialized bytes to the lock file.
Patch by Kamil Dudka.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5108 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 09:39:27 +00:00
Benno Schulenberg
57fa775f25 Updating the copyright years to include 2015.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5107 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 09:32:02 +00:00
Benno Schulenberg
8d53aa3ad2 Adding a general entry for all translators plus the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5106 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-02-01 09:19:58 +00:00
Chris Allegretta
5b1fb56a8f Take 2 at file locking fixes. New args to close_buffer() and
switch_to_prevnext_buffer() to support message passthrough
when trying to lock files using multibuffer.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5105 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-20 06:15:34 +00:00
Chris Allegretta
6948d2e779 2015-01-13 Chris Allegretta <chrisa@asty.org>
* src/files.c (open_buffer): Check here for locking and properly
        handle choosing to not open a file when locked instead of in
        open_file().  Fixes Savannah bug 42373 reported by Benno Schulenberg



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5104 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-14 02:36:30 +00:00
Chris Allegretta
69429ce274 Back to SVN version
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5103 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-06 15:28:02 +00:00
Chris Allegretta
170679294b GNU nano 2.3.99pre1 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5101 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-06 15:20:04 +00:00
Chris Allegretta
4b3f2771b5 2015-01-03 Chris Allegretta <chrisa@asty.org>
* New formatter code to support syntaxes like
        go which have tools to automatically lint and reformat the text for
        you (gofmt), which is lovely.  rcfile option formatter, function
        text.c:do_formatter() and some other calls.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5100 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-01-03 07:24:17 +00:00
Benno Schulenberg
a44def03a0 Adding Mark to the scroll.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5099 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-12-28 22:27:56 +00:00
Benno Schulenberg
9f1b1e2b14 Removing the names of past translators from the Easter-egg scroll.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5098 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-12-28 22:23:31 +00:00
Benno Schulenberg
e99f0b609b Gettextizing the "File being edited" prompt,
and improving its wording.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5097 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-12-28 21:58:27 +00:00
Benno Schulenberg
5bb10d25ef Colorizing the section headers %pretrans and %posttrans fully.
Original patch from Savannah patch #8573 by Daniel Vrátil.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5096 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-11-30 12:05:13 +00:00
Benno Schulenberg
edabd27cd8 Recognizing also header lines that use "/usr/bin/env" to call
the program, instead of just a direct call via "/bin/program".
Doing this for Shell scripts, and for Python, Perl and Ruby.
This fixes Savannah bug #43270 reported by Kitty.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5095 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-09-21 15:29:40 +00:00
Benno Schulenberg
97a5d1270a Replacing the old get_shortcut() wrapper with the new func_from_key().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5094 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-29 20:03:58 +00:00
Benno Schulenberg
f729c6dae5 Adding name of reporter.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5093 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-29 19:22:15 +00:00
Benno Schulenberg
a3cc4e6ecd Improving some wordings and formatting in the texinfo document.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5092 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-10 16:27:30 +00:00
Benno Schulenberg
2a9536c4e8 Removing a mistaken doubled-up | which causes
an 'empty (sub)expression' error on MacOS X.
This fixes Savannah bug #42929.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5091 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-07 20:27:21 +00:00
Benno Schulenberg
1f960f7e34 Improving some of the wordings and formatting of the nanorc manpage.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5090 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-03 20:57:15 +00:00
Benno Schulenberg
3f4389b968 Tweaking the formatting of the man pages a bit
so that po4a will create a nicer POT file.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5089 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-03 20:25:16 +00:00
Benno Schulenberg
700c43bd42 Standardizing the formatting of command-line options -- each one separately.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5088 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-02 20:47:35 +00:00
Benno Schulenberg
2ec70b6466 Separating short and long option by a customary comma
instead of putting the long one between parentheses.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5087 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-08-01 21:04:35 +00:00
Benno Schulenberg
cf9f32b009 Reordering a few things, and adjusting some whitespace.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5086 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-31 20:49:32 +00:00
Benno Schulenberg
fcd4468f90 Adjusting some indentation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5085 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-31 20:44:19 +00:00
Benno Schulenberg
7239fda971 Using still further the func_from_key() wrapper instead of get_shortcut().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5084 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 21:07:15 +00:00
Benno Schulenberg
47dffa483f Using still more the func_from_key() wrapper instead of get_shortcut().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5083 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 20:16:28 +00:00
Benno Schulenberg
266e0496ab Using the more direct func_from_key() wrapper instead of get_shortcut().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5082 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:32:03 +00:00
Benno Schulenberg
dbb5e7cd8e Moving first_sc_for() next to its sister function too.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5081 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:23:41 +00:00
Benno Schulenberg
80750632d0 Moving strtokeytype() next to its sister function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5080 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:18:00 +00:00
Benno Schulenberg
d23283e249 Removing the now unused and unneeded addition ability to the shortcut list.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5079 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-27 19:13:46 +00:00
Jordi Mallach
7ffc7b0438 * doc/texinfo/nano.texi, doc/man/nanorc.5: Typo fix.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5078 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-24 16:11:20 +00:00
Benno Schulenberg
1a8c90eec7 Removing 'undo' from the valid options, so it gets coloured brightred.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5077 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-22 08:17:20 +00:00
Jordi Mallach
ea40ebb648 * doc/nanorc.sample.in: Remove ‘undo’ section which is now obsolete.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5076 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-21 21:27:15 +00:00
Chris Allegretta
1c8cdfd174 Add release to ChangeLog and back to svn version
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5075 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-17 15:32:28 +00:00
Chris Allegretta
0dfd5f7f67 GNU nano 2.3.6 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5073 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-17 15:17:49 +00:00
Jordi Mallach
35cb2c8659 * doc/man/rnano.1: Additional printing formatting improvement from
Bjarni Ingi Gislason.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5072 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-17 06:27:08 +00:00
Jordi Mallach
3d5de0df51 * doc/man/fr/nano.1, doc/man/fr/rnano.1: Apply similar escaping fixes
to French manpages.
* doc/man/fr/nano.1, doc/man/fr/rnano.1, doc/man/fr/nanorc.5: Recode
as UTF-8.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5071 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-16 17:25:55 +00:00
Jordi Mallach
a3710f695f * doc/syntax/debian.nanorc: Add https, tor and spacewalk to supported
APT methods.
* doc/syntax/debian.nanorc: Apply the syntax to apt/sources.list.d/
entries as well, as reported by Rodolphe Pelloux-Prayer.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5070 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-16 11:22:02 +00:00
Jordi Mallach
18be89773c doc/man/nano.1, doc/man/rnano.1: Add some escaping and formatting
fixes as suggested Bjarni Ingi Gislason <bjarniig@rhi.hi.is> in
Debian bugs #662842 and #726956.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5069 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-16 11:07:08 +00:00
Benno Schulenberg
a9fdfd0799 Normalizing some tabbing.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5068 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-16 08:53:16 +00:00
Benno Schulenberg
2394e52ebc Making sure line renumbering starts far enough back after
undoing a cut or paste.  And fixing two memory leaks.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5067 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-16 08:46:42 +00:00
Chris Allegretta
ee7bbf4650 2014-07-13 David Lawrence Ramsey <pooka109@gmail.com>
* ChangeLog: Typo fix



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5066 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-13 19:46:32 +00:00
Benno Schulenberg
8914bd5b1a Not silencing the warning about datarootdir being ignored --
it is not merely a warning, it also activates a workaround.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5065 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-12 08:17:52 +00:00
Benno Schulenberg
5dde918e24 Not speaking of "line wrap" but of "text add" when undoing/redoing
text additions that caused automatic line breaks.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5064 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-11 19:14:25 +00:00
Benno Schulenberg
300e27745b Refixing a typo in a statusbar error message.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5063 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-11 18:35:08 +00:00
Chris Allegretta
cfc396c32e Add 2.3.5 to ChangeLog, and back to svn version
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5062 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2014-07-11 13:46:32 +00:00
98 changed files with 37360 additions and 29506 deletions

1
.gitignore vendored
View File

@@ -14,6 +14,7 @@ core
/INSTALL
/aclocal.m4
/autom4te.cache
/compile
/config.cache
/config.guess
/config.h

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

1482
ChangeLog

File diff suppressed because it is too large Load Diff

265
NEWS
View File

@@ -1,3 +1,106 @@
2016.02.12 - GNU nano 2.5.2 is carrying too many dogs. This release includes
several fixes for various memory leaks, position history
size growth, and a long standing issue with using
nano under sudo creading root-owned files. There are also
the usual bevy of documentation and other miscellaneous
fixes and touch ups. Upgrade today while supplies last,
operators are standing by!
2016.01.11 - GNU nano 2.5.1 "Salzburg" is released. It includes fixes
for a syntax-highlighting bug and a positionlog bug, it
disables a time-eating multiline regex in the C syntax,
and it adds an escape hatch to the WriteOut menu when
--tempfile is used: the discardbuffer command, ^Q. It
also has translation updates for fifteen languages, and
a small fix in the softwrap code. So... you are heartily
invited to upgrade. Enjoy!
2015.12.05 - GNU nano 2.5.0 "Karma", the first release of the 2.5 series,
is now available. Please note that as of this release,
there will no longer be separate stable and unstable
branches. The development team will prioritize bug fixes
as needed, and make new releases in proportion to the
severity of the bugs which are fixed.
This release includes all of the fixes now in
2.4.3, as well as color syntax highlighting improvements,
undo fixes, and many more improvements! Thank you for
using nano!
2015.11.18 - GNU nano 2.4.3 "Apocalypse" is now available for your
downloading pleasure. This release includes a myriad
of fixes including several memory leaks, issues with
color syntax highlighting, search/replace, file
insertion and help menu bugs. Many thanks to
Benno Schulenberg for tireless efforts on the vast
majority of fixes for some time now. As always please
report bugs via the Savannah page, and remember to
Share and Enjoy.
2015.07.05 - GNU nano 2.4.2 "Portorož" is released. This release
includes several fixes, including the ability to resize
when in modes other than the main editing window,
proper displaying of invalid UTF-8 bytes, new syntax
definitions for Elisp, Guile, and PostgreSQL, and
better display of shortcuts in the help menu and file
browser. Thanks for your patience and using nano!
2015.04.14 - GNU nano 2.4.1 "Glitch Gremlin" is released. This release
includes several fixes for issues with the file browser
menu, linter and formatter functions, spell checker,
undo/redo with some specific marked-cutting situations,
and some small improvements to the color syntax
highlighting definitions. There are also various
documentation and code comment updates included, and
finally, fixes for compilation on non-GNU/Linux systems
and certain configure combinations. Toasters!
2015.03.22 - GNU nano 2.4.0 "lizf" is released. This is the first
stable release in many years, and brings together many
new features from the 2.3 series, including:
a fully functional undo system (now enabled by default),
vim-compatible file locking, linter support, formatter
support, syntax highlighting flexibility, and many fixes
for issues reported since 2.2. Many sincere thanks
to all of the bug reports, patches, well wishes and
contributions from everyone who has continued to
support us. Thank you for using nano!
2015.02.27 - GNU nano 2.3.99pre3 "Ashley" is released. This is likely
to be the last release before the next major (2.4.0)
release. Please test it out and send us any feedback
via the Savannah bug page for nano
(https://savannah.gnu.org/bugs/?group=nano). This
release includes fixes for rebinding toggles via
nanorc, several memory alignment fixes, and documentation
and build updates. As always thank you for using
nano - Share and Enjoy!
2015.02.06 - GNU nano 2.3.99pre2 "Snowblind" is released. This release
contains only fixes, including: a long-standing problem
with cutting in nano-tiny, several memory alignment
improvements, and issues with leftover file locks. Please
keep reporting bugs so we can get a happy and healthy
2.4.0 soon. Thanks for using nano!
2015.01.06 - GNU nano 2.3.99pre1 "Junior" is released. As the first
2.4 release candidate there will be fewer new features
but many bugfixes going forward. This release contains
new support for language reformatters like Go's gofmt
command which takes the place of the spelling checker.
Fixes in this release include many syntax highlighting
fixes and improvements, and documentation formatting updates.
As always please report bugs via the Savannah bug page for
nano (https://savannah.gnu.org/bugs/?group=nano), so we can
release a super awesome and bug-free 2.4.0 soon!
2014.07.17 - GNU nano 2.3.6 "Columbo" is released. This release
contains a fix for installing internationalization
files. Also included are scattered documentation
(in particular man page) fixes, and a few touch ups
to syntax highlighting definitions. Oh, just one
more thing, thanks for using nano!
2014.07.11 - GNU nano 2.3.5 "lucky day" is released. This release
contains many visible and under-the-hood fixes for
components such as file locking, more fixes to the
@@ -11,23 +114,23 @@
https://savannah.gnu.org/bugs/index.php?42639 and
thanks for using nano.
2014.06.02 - GNU nano 2.3.4 won't leave you high, won't leave you dry. This
2014.06.02 - GNU nano 2.3.4 won't leave you high, won't leave you dry. This
release contains only a small number of fixes, but in
particular allows nano to compile on non-UTF8 curses
implementations (i.e. libncursesw). Other small fixes to
the undo implementation and the default syntax config are
also included. As always, Share and Enjoy!
also included. As always, Share and Enjoy!
2014.05.28 - GNU nano 2.3.3 is in its right place. This release contains
many many improvements to the core system, including
substantial improvements to the undo/redo code, UTF-8
handling, the configure script, and display of shortcuts
on very wide terminals, New features include the
ability to read named pipes (--noread), as well as
ability to write to named pipes (--noread), as well as
linter support (see the nanorc man page for details). Also
included are much improved syntax highlighting code, and
configurations for JSON, texinfo, Go, and a default syntax
for catch all highlighting. Finally, nano now has the
for catch all highlighting. Finally, nano now has the
ability to set the color of the title bar, status bar, and
shortcut keys (e.g. "^X") and their descriptions. Again
see the nanorc page for details. There's much more, too
@@ -62,7 +165,7 @@
in your .nanorc. Also included are some fixes for
compilation with g++, and better handling of issues
writing the backup file, which should reduce the need
for the 'set allow_insecure_backup" nanorc option.
for the "set allow_insecure_backup" nanorc option.
Don't stop, get it get it, don't stop, get it get it.
2010.11.22 - GNU nano 2.2.6 "Pimp my BBS" wants you to go to
@@ -108,7 +211,7 @@
This release contains a fix for only one bug, but a
rather irritating one: when paging up/down with smooth
scrolling, the cursor position was not being preserved
due to a bug in 2.2.2. With such a targeted fix
due to a bug in 2.2.2. With such a targeted fix
like this what could POSSIBLY go WRONG? Hahaha.
Enjoy and if you find new bugs, as always please
use Savannah's bug tracker.
@@ -134,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
@@ -149,7 +252,7 @@
the help keys and replace menu text), more 'final'
fixes for soft wrapping, and several typo and documentation
updates including nanorc tweaks and a new syntax
highlighting file for makefiles. Also included is a long
highlighting file for makefiles. Also included is a long
standing fix for random crashing when using nanorc on
FreeBSD, and nano will no longer clear the screen on
suspend to maintain compatibility with other *nix editors.
@@ -164,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
@@ -188,7 +291,7 @@
2009.09.14 - GNU nano 2.1.11 is on very thin ice, very thin ice, very thin
ice. This release includes two new features: first, nano
will check whether the current file is writable when it
is opened, and warn if it is not on the status bar. Secondly,
is opened, and warn if it is not on the status bar. Secondly,
a new soft-wrapping (AKA full line display) option is
available, which will attempt to fully display the contents
of lines longer than the width of the screen without the
@@ -245,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.
@@ -282,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
@@ -318,8 +421,8 @@
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
the editor. Please see the nanorc(5) page for
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
menu functions) using the Savannah bug tracker URL,
@@ -612,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
@@ -761,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
@@ -774,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
@@ -791,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
@@ -805,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,
@@ -820,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
@@ -830,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,
@@ -849,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 (^_).
@@ -866,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
@@ -889,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
@@ -912,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
@@ -926,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
@@ -938,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
@@ -950,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
@@ -961,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
@@ -971,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
@@ -980,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
@@ -990,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
@@ -1003,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
@@ -1015,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,
@@ -1026,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
@@ -1035,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
@@ -1046,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
@@ -1056,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
@@ -1071,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
@@ -1095,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
@@ -1104,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
@@ -1143,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
@@ -1162,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
@@ -1176,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
@@ -1184,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)
@@ -1197,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
@@ -1221,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".
@@ -1244,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
@@ -1263,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
@@ -1279,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
@@ -1296,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
@@ -1323,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,
@@ -1331,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
@@ -1339,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
@@ -1347,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
@@ -1355,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
@@ -1367,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$

63
README
View File

@@ -6,24 +6,24 @@ Overview
The nano project was started because of a few "problems" with the
wonderfully easy-to-use and friendly Pico text editor.
First and foremost is its license: the Pine suite does not use the
GPL or a GPL-friendly license, and has unclear restrictions on
First and foremost was its license: the Pine suite does not use
the GPL or a GPL-friendly license, and has unclear restrictions on
redistribution. Because of this, Pine and Pico are not included
with many GNU/Linux distributions. Also, other features (like go
to line number or search and replace) were unavailable until
recently or require a command line flag. Yuck.
with many GNU/Linux distributions. Also, other features (like
go-to-line-number or search-and-replace) were unavailable until
recently or require a command-line flag. Yuck.
nano aims to solve these problems by emulating the functionality of
Pico as closely as possible while addressing the problems above and
perhaps providing other extra functionality.
providing other extra functionality.
The nano editor is now an official GNU package. For more
information on GNU and the Free Software Foundation, please see
http://www.gnu.org/.
The nano editor is an official GNU package. For more information on
GNU and the Free Software Foundation, please see http://www.gnu.org/.
How to compile and install nano
Download the nano source code, then:
tar zxvf nano-x.y.z.tar.gz
cd nano-x.y.z
./configure
@@ -32,41 +32,42 @@ How to compile and install nano
It's that simple. Use --prefix with configure to override the
default installation directory of /usr/local.
If you configured with the "--enable-nanorc" option, after
installation you might copy the doc/nanorc.sample to your home
directory, rename it to ".nanorc", and then edit it according to
your taste.
If you haven't configured with the "--disable-nanorc" option, after
installation you may want to copy the doc/nanorc.sample to your
home directory, rename it to ".nanorc", and then edit it according
to your taste.
Web Page
http://www.nano-editor.org/
Mailing List and Bug Reports
Mailing Lists and Bug Reports
Savannah hosts all the nano-related mailing-lists.
+ info-nano@gnu.org is a very low traffic list
used to announce new nano versions or other important
information about the project.
+ info-nano@gnu.org is a very low traffic list used to announce
new nano versions or other important information about the
project.
+ help-nano@gnu.org is for those seeking to get help without
wanting to hear about the technical details of its
development.
+ nano-devel@gnu.org is the list used by the people
that make nano and a general development discussion list, with
moderate traffic.
wanting to hear about the technical details of its development.
+ nano-devel@gnu.org is the list used by the people that make
nano and a general development discussion list, with moderate
traffic.
To subscribe, send email to nano-<name>-request@gnu.org with a
To subscribe, send email to <name>-request@gnu.org with a
subject of "subscribe", where <name> is the list you want to
subscribe to.
For general bug reports, send a description of the problem to
nano@nano-editor.org or directly to the development list.
For general bug reports, please file a description of the problem
on the Savannah bug tracker page for nano
(https://savannah.gnu.org/bugs/?group=nano). The issue may have
already been reported, and we are better able to track the state
of the issue and whom to notify when fixed, the more the bug
tracker is used.
Current Status
GNU nano has reached its fourth stable milestone, 2.2.x.
Development of new features continues in the 2.3.x branch, while
2.2.x versions are dedicated to bug-fixing and polishing.
$Id$
GNU nano has reached its fifth stable milestone, 2.4.x.
Development of new features will continue in the 2.5.x branch,
while 2.4.x versions are dedicated to bug-fixing and polishing.

144
THANKS
View File

@@ -2,77 +2,85 @@ The following people have helped GNU nano in some way or another.
If we missed you here, let us know!
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com>
Malay translator
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian translator
CHAO Wei-Lun <chaoweilun@pcmail.com.tw> Chinese (traditional) translator
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish translator
Marco Colombo <magicdice@inwind.it> Italian translator
Yavor Doganov <yavor@doganov.org> Bulgarian translator
Karl Eichwalder <keichwa@gmx.net> German translator
Doruk Fisek <dfisek@fisek.com.tr> Turkish translator
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net>
French translator
Geir Helland <pjallabais@users.sourceforge.net> Norwegian Bokmål translator
Tedi Heriyanto <tedi_h@gmx.net> Indonesian translator
Václav Haisman <V.Haisman@sh.cvut.cz> Czech translator
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu>
Hungarian translator
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish translator
Eivind Kjørstad <ekj@vestdata.no> Norwegian Nynorsk translator
Florian König <floki@bigfoot.com> German translator
Wojciech Kotwica <wkotwica@post.pl> Polish translator
Clement Laforet <clem_laf@wanadoo.fr> French translator
Gergely Nagy <algernon@debian.org> Hungarian translator
Kalle Olavi Niemitalo <kon@iki.fi> Finnish translator
A. Murat EREN <meren@comu.edu.tr> Turkish translator
Claudio Neves <cneves@nextis.com> Brazilian Portuguese translator
Daniel Nylander <po@danielnylander.se> Swedish translator
Michael Piefel <piefel@informatik.hu-berlin.de> German translator
Sergey A. Ribalchenko <fisher@obu.ck.ua> Ukrainian and Russian translator
Michel Robitaille <robitail@IRO.UMontreal.CA> French translator
Christian Rose <menthos@menthos.com> Swedish translator
Stig E Sandø <stig@ii.uib.no> Norwegian Bokmål translator
Benno Schulenberg <benno@vertaalt.nl> Dutch and Esperanto translator
Danilo Segan <dsegan@gmx.net> Serbian translator
Keld Simonsen <keld@dkuug.dk> Danish translator
Guus Sliepen <guus@nl.linux.org> Dutch translator
Cezary Sliwa <sliwa@cft.edu.pl> Polish translator
Pierre Tane <tanep@bigfoot.com> French translator
Jacobo Tarrío <jtarrio@trasno.net> Galician translator
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian Nynorsk translator
Miquel Vidal <miquel@sindominio.net> Catalan translator
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese translator
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish translator
Peio Ziarsolo <peio@sindominio.net> Basque translator
Anton Zinoviev <zinoviev@debian.org> Bulgarian translator
João Victor Duarte Martins <jvdm@sdf.lonestar.org>
Brazilian Portuguese translator
Kevin Patrick Scannell <kscanne@gmail.com> Irish translator
Gabor Kelemen <kelemeng@gnome.hu> Hungarian translator
Francisco Javier Tsao Santín <tsao@members.fsf.org>
Galician translator
Dimitriy Ryazantcev <DJm00n@mail.ru> Russian translator
Clytie Siddall <clytie@riverland.net.au> Vietnamese translator
LI Daobing <lidaobing@gmail.com> Chinese (simplified) translator
Jorma Karvonen <karvonen.jorma@gmail.com> Finnish translator
Aron Xu <happyaron.xu@gmail.com> Chinese (simplified) translator
Pavel Fric <pavelfric@seznam.cz> Czech translator
Pavel Maryanov <acid@jack.kiev.ua> Russian translator
Sergey Poznyakoff <gray@gnu.org> Polish translator
Ask Hjorth Larsen <asklarsen@gmail.com> Danish translator
Trần Ngọc Quân <vnwildman@gmail.com> Vietnamese translator
Klemen Košir <klemen913@gmail.com> Slovenian translator
Yasuaki Taniguchi <yasuakit@gmail.com> Japanese translator
Jorge González <aloriel@gmail.com> Spanish translator
Johnny A. Solbu <johnny@solbu.net> Norwegian Bokmål translator
Мирослав Николић <miroslavnikolic@rocketmail.com>
Serbian translator
Translations:
============
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
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
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
Rafael Ferreira <rafael.f.f1@gmail.com> Brazilian Portuguese
Doruk Fisek <dfisek@fisek.com.tr> Turkish
Pavel Fric <pavelfric@seznam.cz> Czech
Jorge González <aloriel@gmail.com> Spanish
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net> French
Geir Helland <pjallabais@users.sourceforge.net> Norwegian Bokmål
Tedi Heriyanto <tedi_h@gmx.net> Indonesian
Václav Haisman <V.Haisman@sh.cvut.cz> Czech
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian Nynorsk
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu> Hungarian
Jorma Karvonen <karvonen.jorma@gmail.com> Finnish
Gabor Kelemen <kelemeng@gnome.hu> Hungarian
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish
Eivind Kjørstad <ekj@vestdata.no> Norwegian Nynorsk
Florian König <floki@bigfoot.com> German
Klemen Košir <klemen913@gmail.com> Slovenian
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
Gergely Nagy <algernon@debian.org> Hungarian
Kalle Olavi Niemitalo <kon@iki.fi> Finnish
Мирослав Николић <miroslavnikolic@rocketmail.com> Serbian
Claudio Neves <cneves@nextis.com> Brazilian Portuguese
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
Christian Rose <menthos@menthos.com> Swedish
Dimitriy Ryazantcev <DJm00n@mail.ru> Russian
Stig E Sandø <stig@ii.uib.no> Norwegian Bokmål
Kevin Patrick Scannell <kscanne@gmail.com> Irish
Benno Schulenberg <benno@vertaalt.nl> Dutch and Esperanto
Danilo Segan <dsegan@gmx.net> Serbian
Clytie Siddall <clytie@riverland.net.au> Vietnamese
Keld Simonsen <keld@dkuug.dk> Danish
Guus Sliepen <guus@nl.linux.org> Dutch
Cezary Sliwa <sliwa@cft.edu.pl> Polish
Johnny A. Solbu <johnny@solbu.net> Norwegian Bokmål
Pierre Tane <tanep@bigfoot.com> French
Yasuaki Taniguchi <yasuakit@gmail.com> Japanese
Jacobo Tarrío <jtarrio@trasno.net> Galician
Francisco Javier Tsao Santín <tsao@members.fsf.org> Galician
Miquel Vidal <miquel@sindominio.net> Catalan
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish
Aron Xu <happyaron.xu@gmail.com> Chinese (simplified)
Peio Ziarsolo <peio@sindominio.net> Basque
Anton Zinoviev <zinoviev@debian.org> Bulgarian
Other stuff:
===========
Ben Armstrong <synrg@sanctuary.nslug.ns.ca> Negative -r value idea, code
Thomas Dickey <dickey@herndon4.his.com> Curses help and advice
Sven Guckes <guckes@math.fu-berlin.de> Advice and Advocacy
Sven Guckes <guckes@math.fu-berlin.de> Advice and advocacy
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
@@ -83,5 +91,3 @@ 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$

20
TODO
View File

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

View File

@@ -20,16 +20,12 @@
#
# $Id$
AC_INIT([GNU nano], [2.3.5], [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
AC_CONFIG_HEADERS([config.h])
dnl Silence a pointless warning from the gettext Makefile.
AC_DEFUN([AC_DATAROOTDIR_CHECKED])
dnl Make sure the ONCE macros are available.
AC_PREREQ(2.61)
@@ -531,6 +527,7 @@ else
fi
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors() command.]))
AC_CHECK_LIB([$CURSES_LIB_NAME], key_defined, AC_DEFINE(HAVE_KEY_DEFINED, 1, [Define this if your curses library has the key_defined() command.]))
dnl Parse any configure options.
@@ -660,9 +657,9 @@ AC_MSG_RESULT(no),
AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling]))
AS_IF([test "x$enable_libmagic" != "xno"], [
AC_CHECK_HEADERS_ONCE([magic.h])
AC_CHECK_HEADERS([magic.h])
AC_CHECK_LIB(magic, magic_open)
AC_CHECK_HEADERS_ONCE([zlib.h])
AC_CHECK_HEADERS([zlib.h])
AC_CHECK_LIB(z, inflate)
])

View File

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

View File

@@ -2,14 +2,14 @@
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
.\" Free Software Foundation, Inc.
.\"
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
.\" Ce travail d'adaptation est dans le domaine public. Attention, la
.\" page traduite reste soumise au droit d'auteur de ses auteurs
.\" originaux.
.\"
.\" The French translation of this document is a public domain work of
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
.\" 2005, 2006 and 2007. The translated man page in itself is still
.\" subject to the copyright of its original authors.
.\"
@@ -29,20 +29,20 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.\" Ce document est publié sous une double licence. Vous pouvez
.\" Ce document est publié sous une double licence. Vous pouvez
.\" le distribuer et le modifier selon les termes de l'une des deux
.\" licences ci-dessous :
.\" licences ci-dessous :
.\"
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
.\" le cas, consultez <http://www.gnu.org/licenses/>.
.\"
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2 ou,
.\" à votre choix, supérieure, telle que publiée par la Free
.\" à votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation, sans section invariante, ni texte de
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" une copie de la Licence de documentation libre GNU avec ce
.\" programme. Si ce n'est pas le cas, consultez
.\" <http://www.gnu.org/licenses/>.
@@ -50,71 +50,71 @@
.\" $Id$
.TH NANO 1 "version 2.0.0" "29\ novembre\ 2007"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\"
.SH NOM
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
.SH SYNOPSIS
.B nano
.I [OPTIONS]\ [[\+LIGNE,COLONNE]\ FICHIER]...
.I [OPTIONS]\ [[+LIGNE,COLONNE]\ FICHIER]...
.br
.SH DESCRIPTION
Cette page de manuel décrit brièvement la commande \fBnano\fR.
Cette page de manuel décrit brièvement la commande \fBnano\fR.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
.\" respectively.
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à remplacer
Pico, l'éditeur par défaut du logiciel non libre Pine. \fBnano\fR ne se
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à remplacer
Pico, l'éditeur par défaut du logiciel non libre Pine. \fBnano\fR ne se
contentant pas de copier l'interface et l'ergonomie de Pico, il offre
également certaines fonctions manquantes (ou désactivées par défaut)
dans Pico. Ces fonctionnalités sont, par exemple, les fonctions de
recherche et de remplacement, et la possibilité de sauter directement à
une ligne et à une colonne précise.
également certaines fonctions manquantes (ou désactivées par défaut)
dans Pico. Ces fonctionnalités sont, par exemple, les fonctions de
recherche et de remplacement, et la possibilité de sauter directement à
une ligne et à une colonne précise.
.SH OPTIONS
.TP
.B \+\fILIGNE\fP,\fICOLONNE\fP
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
lieu de démarrer à la colonne\ 1, ligne\ 1.
.B +\fILIGNE\fP,\fICOLONNE\fP
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
lieu de démarrer à la colonne\ 1, ligne\ 1.
.TP
.B \-?
Identique à \fB-h (\-\-help)\fP.
Identique à \fB\-h (\-\-help)\fP.
.TP
.B \-A (\-\-smarthome)
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque l'on
appuie sur cette touche à n'importe quel endroit excepté au tout début
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
arrière). Si le curseur est déjà là, il se placera au vrai début de la
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque l'on
appuie sur cette touche à n'importe quel endroit excepté au tout début
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
arrière). Si le curseur est déjà là, il se placera au vrai début de la
ligne.
.TP
.B \-B (\-\-backup)
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
version précédente, en ajoutant un tilde (~) au nom du fichier.
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
version précédente, en ajoutant un tilde (~) au nom du fichier.
.TP
.B \-D (\-\-boldtext)
Utilise des caractères gras à la place de la vidéo inverse.
Utilise des caractères gras à la place de la vidéo inverse.
.TP
.B \-C \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
de sécurité uniques si celles-ci sont activées.
.B \-C \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
de sécurité uniques si celles-ci sont activées.
.TP
.B \-E (\-\-tabstospaces)
Convertit les tabulations clavier en espaces.
.TP
.B \-F (\-\-multibuffer)
Active le mode multi-espace, autorisant l'édition simultanée de
Active le mode multi-espace, autorisant l'édition simultanée de
plusieurs fichiers, si ce mode est disponible.
.TP
.B \-H (\-\-historylog)
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
remplacement dans le fichier \fI~/.nano_history\fR afin de permettre leur
réutilisation. Ceci n'est possible que si \fBnano\fR est configuré pour
réutilisation. Ceci n'est possible que si \fBnano\fR est configuré pour
utiliser les fichiers nanorc.
.TP
.B \-I (\-\-ignorercfiles)
@@ -122,63 +122,63 @@ Ne pas utiliser pas les fichiers \fISYSCONFDIR/nanorc\fR et
\fI~/.nanorc\fR (si \fBnano\fR est capable de les utiliser).
.TP
.B \-K (\-\-rebindkeypad)
Interprète les touches du pavé numérique afin qu'elles fonctionnent
Interprète les touches du pavé numérique afin qu'elles fonctionnent
toutes correctement. Vous ne devriez utiliser cette option que si ce
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
correctement lorsque cette option sera activée.
correctement lorsque cette option sera activée.
.TP
.B \-L (\-\-nonewlines)
Ne pas ajouter de passage à la ligne à la fin des fichiers.
Ne pas ajouter de passage à la ligne à la fin des fichiers.
.TP
.B \-N (\-\-noconvert)
Désactive la conversion automatique des fichiers depuis les formats Mac et
Désactive la conversion automatique des fichiers depuis les formats Mac et
DOS.
.TP
.B \-O (\-\-morespace)
Utiliser la ligne blanche située sous la ligne de titre comme
espace supplémentaire d'édition.
Utiliser la ligne blanche située sous la ligne de titre comme
espace supplémentaire d'édition.
.TP
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
pour réaliser une justification correcte des citations. Si nano est
capable d'utiliser des expressions rationnelles, le préfixe par défaut
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
pour réaliser une justification correcte des citations. Si nano est
capable d'utiliser des expressions rationnelles, le préfixe par défaut
sera "\fI^([\ \\t]*[#:>\\|}])+\fP", sinon, ce sera "\fI>\ \fP". Dans
l'expression rationnelle précédente, «\ \fI\\t\fP\ » représente une
l'expression rationnelle précédente, «\ \fI\\t\fP\ » représente une
tabulation.
.TP
.B \-R (\-\-restricted)
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
sur la ligne de commande, pas de lecture des fichiers nanorc,
interdiction de suspendre, interdiction d'ajouter au début, à la fin,
de sauvegarder un fichier ayant déjà un nom sous un nom différent,
d'utiliser une copie de sécurité ou le correcteur orthographique. Cette
option peut aussi être activée en appelant \fBnano\fP sous un nom
commençant par «\ r\ » (par exemple «\ rnano\ »).
interdiction de suspendre, interdiction d'ajouter au début, à la fin,
de sauvegarder un fichier ayant déjà un nom sous un nom différent,
d'utiliser une copie de sécurité ou le correcteur orthographique. Cette
option peut aussi être activée en appelant \fBnano\fP sous un nom
commençant par «\ r\ » (par exemple «\ rnano\ »).
.TP
.B \-S (\-\-smooth)
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
de défiler morceau-par-morceau.
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
de défiler morceau-par-morceau.
.TP
.B \-T \fInombre\fP (\-\-tabsize=\fInombre\fP)
Définit la taille (largeur) des tabulations en nombre de colonnes. Le
nombre indiqué doit être strictement supérieur à 0. La valeur par défaut
Définit la taille (largeur) des tabulations en nombre de colonnes. Le
nombre indiqué doit être strictement supérieur à 0. La valeur par défaut
est de 8.
.TP
.B \-U (\-\-quickblank)
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
d'état disparaîtront après une frappe clavier au lieu de 25. Notez que
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
d'état disparaîtront après une frappe clavier au lieu de 25. Notez que
l'option \fB-c\fP prend le pas sur cette option.
.TP
.B \-V (\-\-version)
Affiche la version, puis s'arrête.
Affiche la version, puis s'arrête.
.TP
.B \-W (\-\-wordbounds)
Détection plus précise des limites de mots, obtenue en considérant les
caractères de ponctuation comme faisant partie des mots.
Détection plus précise des limites de mots, obtenue en considérant les
caractères de ponctuation comme faisant partie des mots.
.TP
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
Indique quel mode de colorisation syntaxique adopter, parmi les modes
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
disponible.
.TP
.B \-c (\-\-const)
@@ -186,111 +186,111 @@ Affiche en permanence la position du curseur. Notez que cette option
prend le pas sur l'option \fB-U\fP.
.TP
.B \-d (\-\-rebinddelete)
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous ne devriez avoir besoin de cette option que si, sur votre système,
la touche «\ Effacement arrière\ » produit l'effet de la touche
«\ Supprimer\ ».
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous ne devriez avoir besoin de cette option que si, sur votre système,
la touche «\ Effacement arrière\ » produit l'effet de la touche
«\ Supprimer\ ».
.TP
.B \-h (\-\-help)
Affiche un résumé des options de lancement de nano, puis s'arrête.
Affiche un résumé des options de lancement de nano, puis s'arrête.
.TP
.B \-i (\-\-autoindent)
Indentation automatique. Commence chaque nouvelle ligne au même niveau que
la ligne précédente. Utile pour l'édition de code source.
Indentation automatique. Commence chaque nouvelle ligne au même niveau que
la ligne précédente. Utile pour l'édition de code source.
.TP
.B \-k (\-\-cut)
Coupe le texte du curseur à la fin de la ligne, au lieu de couper la
ligne entière.
Coupe le texte du curseur à la fin de la ligne, au lieu de couper la
ligne entière.
.TP
.B \-l (\-\-nofollow)
Si le fichier édité est un lien symbolique, au lieu de le suivre,
remplace le lien par le nouveau fichier. Sans doute utile pour éditer
Si le fichier édité est un lien symbolique, au lieu de le suivre,
remplace le lien par le nouveau fichier. Sans doute utile pour éditer
les fichiers de \fI/tmp\fR, non\ ?
.TP
.B \-m (\-\-mouse)
Active l'utilisation de la souris, si elle est disponible pour votre
système. Lorsque celle-ci est activée, il est possible d'utiliser la
système. Lorsque celle-ci est activée, il est possible d'utiliser la
souris pour positionner le curseur, pour marquer le texte (avec un
double-clic) et pour lancer les fonctions correspondant aux raccourcis.
Il est possible d'utiliser la souris sous X\ Window ou en mode console
avec gpm.
.TP
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
Définit le répertoire de travail. Demande à \fBnano\fP de mettre en place
quelque chose de similaire à un environnement d'exécution restreint
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
Définit le répertoire de travail. Demande à \fBnano\fP de mettre en place
quelque chose de similaire à un environnement d'exécution restreint
(\fIchroot\fR).
.TP
.B \-p (\-\-preserve)
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient reçues
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient reçues
par le terminal.
.TP
.B \-r \fIcolonne\fP (\-\-fill=\fIcolonne\fP)
Passe automatiquement à la ligne une fois arrivé à la colonne
\fIcolonne\fR. Si la valeur indiquée est de 0 ou moins, le point de
passage à la ligne aura lieu à la taille de l'écran moins \fIcolonne\fR.
Cela permet de faire varier le point de passage à la ligne lorsque l'on
change la taille de l'écran. La valeur par défaut est de \-8.
Passe automatiquement à la ligne une fois arrivé à la colonne
\fIcolonne\fR. Si la valeur indiquée est de 0 ou moins, le point de
passage à la ligne aura lieu à la taille de l'écran moins \fIcolonne\fR.
Cela permet de faire varier le point de passage à la ligne lorsque l'on
change la taille de l'écran. La valeur par défaut est de \-8.
.TP
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
Choix d'un correcteur orthographique de remplacement.
.TP
.B \-t (\-\-tempfile)
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
demande de confirmation. Identique à l'option \fB-t\fP de Pico.
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
demande de confirmation. Identique à l'option \fB-t\fP de Pico.
.TP
.B \-v (\-\-view)
Mode visualisation (lecture seule).
.TP
.B \-w (\-\-nowrap)
Désactive le passage automatique à la ligne.
Désactive le passage automatique à la ligne.
.TP
.B \-x (\-\-nohelp)
Désactive la barre d'aide affichée en bas de l'écran.
Désactive la barre d'aide affichée en bas de l'écran.
.TP
.B \-z (\-\-suspend)
Autorise à suspendre l'éditeur.
Autorise à suspendre l'éditeur.
.TP
.B \-a, \-b, \-e, \-f, \-g, \-j
Ignoré, pour être compatible avec Pico.
Ignoré, pour être compatible avec Pico.
.SH "FICHIERS D'INITIALISATION"
\fBnano\fR lit les fichiers d'initialisation dans l'ordre suivant\ :
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de
manuel de \fBnanorc(5)\fR et au fichier d'exemple \fInanorc.sample\fR,
qui devraient tous les deux être livrés avec \fBnano\fR.
qui devraient tous les deux être livrés avec \fBnano\fR.
.SH NOTES
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
ligne de commande ou dans l'un des fichiers nanorc, \fBnano\fR prendra
la commande indiquée par la variable d'environnement \fBSPELL\fR si
elle est définie.
la commande indiquée par la variable d'environnement \fBSPELL\fR si
elle est définie.
Dans certains cas, \fBnano\fR essaiera de sauvegarder le fichier en cours
d'édition dans un fichier de secours. Cela arrivera principalement si
\fBnano\fR reçoit un signal SIGHUP ou SIGTERM, ou bien se trouve à court de
mémoire. Le nom de ce fichier de secours sera \fInano.save\fR si le fichier en
cours n'avait pas encore de nom, ou sera composé du nom du fichier en cours
suivi du suffixe «\ .save\ ». Si un fichier de ce nom existe déjà dans
le répertoire, un «\ .save\ » et un nombre seront ajoutés à la fin du
d'édition dans un fichier de secours. Cela arrivera principalement si
\fBnano\fR reçoit un signal SIGHUP ou SIGTERM, ou bien se trouve à court de
mémoire. Le nom de ce fichier de secours sera \fInano.save\fR si le fichier en
cours n'avait pas encore de nom, ou sera composé du nom du fichier en cours
suivi du suffixe «\ .save\ ». Si un fichier de ce nom existe déjà dans
le répertoire, un «\ .save\ » et un nombre seront ajoutés à la fin du
nom du fichier en cours afin de le rendre unique (par exemple,
«\ .save.1\ »). En mode multi-espace, \fBnano\fR réalisera une
«\ .save.1\ »). En mode multi-espace, \fBnano\fR réalisera une
sauvegarde de tous les fichiers en cours dans leurs fichiers de secours
respectifs.
.SH BOGUES
Merci de nous faire parvenir vos commentaires et de nous signaler les
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
\fBnano-devel@gnu.org\fR.
Pour vous abonner, envoyez un courrier électronique à
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
Pour vous abonner, envoyez un courrier électronique à
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
N'hésitez pas également à envoyez vos commentaires, suggestions et
corrections relatives à l'adaptation française de cette page de manuel
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
N'hésitez pas également à envoyez vos commentaires, suggestions et
corrections relatives à l'adaptation française de cette page de manuel
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
.SH "SITE INTERNET"
http://www.nano-editor.org/
@@ -300,27 +300,27 @@ http://www.nano-editor.org/
.TP
\fBnanorc\fR(5)
.PP
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
.SH AUTEUR
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
\fIAUTHORS\fR et \fITHANKS\fR pour plus d'information). Cette page de
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
le système Debian (mais elle peut être utilisée par d'autres).
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
le système Debian (mais elle peut être utilisée par d'autres).
.SH TRADUCTION
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
de la version 1.54 du 11\ octobre\ 2007 de la page de manuel de nano
2.0.0. Cette page a été relue par Gérard Delafond.
2.0.0. Cette page a été relue par Gérard Delafond.
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
traducteur.
La version originale la plus à jour de ce document est toujours
La version originale la plus à jour de ce document est toujours
consultable via la commande\ :
LANGUAGE=en man nano

View File

@@ -2,14 +2,14 @@
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007
.\" Free Software Foundation, Inc.
.\"
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
.\" Ce travail d'adaptation est dans le domaine public. Attention, la
.\" page traduite reste soumise au droit d'auteur de ses auteurs
.\" originaux.
.\"
.\" The French translation of this document is a public domain work of
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
.\" 2005, 2006 and 2007. The translated man page in itself is still
.\" subject to the copyright of its original authors.
.\"
@@ -29,20 +29,20 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.\" Ce document est publié sous une double licence. Vous pouvez
.\" Ce document est publié sous une double licence. Vous pouvez
.\" le distribuer et le modifier selon les termes de l'une des deux
.\" licences ci-dessous :
.\" licences ci-dessous :
.\"
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est
.\" pas le cas, consultez <http://www.gnu.org/licenses/>.
.\"
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2
.\" ou, à votre choix, supérieure, telle que publiée par la Free
.\" ou, à votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation, sans section invariante, ni texte de
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" une copie de la Licence de documentation libre GNU avec ce
.\" programme. Si ce n'est pas le cas, consultez
.\" <http://www.gnu.org/licenses/>.
@@ -50,50 +50,50 @@
.\" $Id$
.TH NANORC 5 "version 2.0.0" "29\ novembre\ 2007"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.SH NOM
nanorc \- fichier de configuration de l'éditeur nano du projet GNU
nanorc \- fichier de configuration de l'éditeur nano du projet GNU
.SH DESCRIPTION
Cette page de manuel décrit brièvement le fichier de configuration de
l'éditeur \fBnano\fP GNU.
Cette page de manuel décrit brièvement le fichier de configuration de
l'éditeur \fBnano\fP GNU.
.PP
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
\fBnano\fP ne se contentant pas de copier l'interface et l'ergonomie de
Pico, il offre également certaines fonctionnalités manquantes (ou
désactivées par défaut) de Pico. Ces fonctionnalités sont, par exemple,
les fonctions de recherche et de remplacement et la possibilité de
sauter directement à une ligne et à une colonne précise.
Pico, il offre également certaines fonctionnalités manquantes (ou
désactivées par défaut) de Pico. Ces fonctionnalités sont, par exemple,
les fonctions de recherche et de remplacement et la possibilité de
sauter directement à une ligne et à une colonne précise.
.PP
Le fichier \fInanorc\fP contient les paramètres par défaut de
\fBnano\fP. Il ne doit pas être au format DOS ou Mac. Lors de son
démarrage, nano commencera par lire le fichier de configuration général
Le fichier \fInanorc\fP contient les paramètres par défaut de
\fBnano\fP. Il ne doit pas être au format DOS ou Mac. Lors de son
démarrage, nano commencera par lire le fichier de configuration général
\fISYSCONFDIR/nanorc\fP, puis lira le fichier de configuration personnel
de l'utilisateur \fI~/.nanorc\fP.
.SH OPTIONS
Le fichier de configuration accepte une série de commandes \fBset\fP
(activer) et \fBunset\fP (désactiver), qui permettent de définir le
paramétrage de nano au démarrage sans avoir à utiliser d'options de
Le fichier de configuration accepte une série de commandes \fBset\fP
(activer) et \fBunset\fP (désactiver), qui permettent de définir le
paramétrage de nano au démarrage sans avoir à utiliser d'options de
ligne de commande. De plus, les mots clefs \fBsyntax\fP (syntaxe),
\fBcolor\fP (couleur) et \fBicolor\fP (couleur insensible à la casse)
sont utilisés pour définir les règles de colorisation pour différents
\fBcolor\fP (couleur) et \fBicolor\fP (couleur insensible à la casse)
sont utilisés pour définir les règles de colorisation pour différents
motifs de texte. \fBnano\fP lit une commande par ligne.
Les options du fichier de configuration ont priorité sur les valeurs par
défaut utilisées par nano. Les options de la ligne de commande sont
Les options du fichier de configuration ont priorité sur les valeurs par
défaut utilisées par nano. Les options de la ligne de commande sont
prioritaires par rapport aux options du fichier de configuration. Les
options sont désactivées (unset) par défaut, sauf les options prenant un
options sont désactivées (unset) par défaut, sauf les options prenant un
argument.
Les apostrophes («\ \fI'\fP\ ») et les guillemets droits («\ \fI"\fP\ »)
présents dans des chaînes de caractères utilisées comme paramètres n'ont
pas besoin d'être précédées d'une barre oblique inversée
\ \fI\\\fP\ »). La chaîne sera terminée par le dernier guillemet
Les apostrophes («\ \fI'\fP\ ») et les guillemets droits («\ \fI"\fP\ »)
présents dans des chaînes de caractères utilisées comme paramètres n'ont
pas besoin d'être précédées d'une barre oblique inversée
\ \fI\\\fP\ »). La chaîne sera terminée par le dernier guillemet
droit. Par exemple, pour l'option \fBbrackets\fP, "\fI"')>]}\fP"
correspondra à \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP et \fI}\fP.
correspondra à \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP et \fI}\fP.
Les commandes et arguments reconnus sont\ :
@@ -102,69 +102,69 @@ Les commandes et arguments reconnus sont\ :
Active l'indentation automatique.
.TP
.B set/unset backup
Crée des copies de sécurité nommées
Crée des copies de sécurité nommées
.IR nom_du_fichier~ .
.TP
.B set backupdir "\fIrépertoire\fP"
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
de sécurité uniques, si l'enregistrement de copies de sécurité est
activé.
.B set backupdir "\fIrépertoire\fP"
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
de sécurité uniques, si l'enregistrement de copies de sécurité est
activé.
.TP
.B set/unset backwards
Par défaut, les recherches se font vers l'arrière.
Par défaut, les recherches se font vers l'arrière.
.TP
.B set/unset boldtext
Utilise des caractères gras à la place de la vidéo inverse.
Utilise des caractères gras à la place de la vidéo inverse.
.TP
.B set brackets "\fIchaîne\fP"
Définit les caractères considérés comme des crochets fermants lors de la
justification des paragraphes. Ces caractères ne doivent pas contenir
d'espaces. Seules les ponctuations terminales, éventuellement suivies
.B set brackets "\fIchaîne\fP"
Définit les caractères considérés comme des crochets fermants lors de la
justification des paragraphes. Ces caractères ne doivent pas contenir
d'espaces. Seules les ponctuations terminales, éventuellement suivies
de crochets fermants, peuvent terminer une phrase.
La valeur par défaut de cette option est\ : "\fI"')>]}\fP".
La valeur par défaut de cette option est\ : "\fI"')>]}\fP".
N.D.T.\ : reportez-vous au paragraphe sur l'option \fBpunct\fR pour
plus d'informations.
.TP
.B set/unset casesensitive
Par défaut, les recherches ne tiennent pas compte de la casse.
Par défaut, les recherches ne tiennent pas compte de la casse.
.TP
.B set/unset const
Affiche en permanence la position du curseur dans la ligne d'état.
Affiche en permanence la position du curseur dans la ligne d'état.
.TP
.B set/unset cut
Par défaut, coupe le texte du curseur à la fin de la ligne, au lieu de
couper la ligne entière.
Par défaut, coupe le texte du curseur à la fin de la ligne, au lieu de
couper la ligne entière.
.TP
.B set fill \fIn\fP
Passe automatiquement à la ligne une fois arrivé à la colonne
\fIn\fR. Si la valeur indiquée est de 0 ou moins, le point de passage à
la ligne aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de
faire varier le point de passage à la ligne lorsque l'on change la
taille de l'écran. La valeur par défaut est de \-8.
Passe automatiquement à la ligne une fois arrivé à la colonne
\fIn\fR. Si la valeur indiquée est de 0 ou moins, le point de passage à
la ligne aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de
faire varier le point de passage à la ligne lorsque l'on change la
taille de l'écran. La valeur par défaut est de \-8.
.TP
.B set/unset historylog
Active l'utilisation de
.I ~/.nano_history
pour enregistrer et relire les chaînes ayant fait l'objet d'une
pour enregistrer et relire les chaînes ayant fait l'objet d'une
recherche ou d'un remplacement.
.TP
.B set matchbrackets "\fIchaîne\fP"
Définit les crochets ouvrants et fermant pour la recherche de crochets
.B set matchbrackets "\fIchaîne\fP"
Définit les crochets ouvrants et fermant pour la recherche de crochets
correspondants. Cette liste ne doit pas contenir de blancs. L'ensemble
des crochets ouvrants doit être indiqué en premier, suivi de l'ensemble
des crochets fermant, qui doit être dans le même ordre. La valeur par
défaut de cette option est "\fI(<[{)>]}\fP".
des crochets ouvrants doit être indiqué en premier, suivi de l'ensemble
des crochets fermant, qui doit être dans le même ordre. La valeur par
défaut de cette option est "\fI(<[{)>]}\fP".
.TP
.B set/unset morespace
Utiliser la ligne blanche située sous la ligne de titre comme espace
supplémentaire d'édition.
Utiliser la ligne blanche située sous la ligne de titre comme espace
supplémentaire d'édition.
.TP
.B set/unset mouse
Active l'utilisation de la souris, si elle est disponible pour votre
système. Lorsque celle-ci est activée, il est possible d'utiliser la
système. Lorsque celle-ci est activée, il est possible d'utiliser la
souris pour positionner le curseur, pour marquer le texte (avec un
double-clic) et pour lancer les fonctions correspondant aux raccourcis.
Il est possible d'utiliser la souris sous X\ Window ou en mode console
@@ -178,167 +178,167 @@ espace.
Pas de conversion depuis les formats DOS et Mac.
.TP
.B set/unset nofollow
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
.TP
.B set/unset nohelp
Désactive les lignes d'aide affichée en bas de l'écran.
Désactive les lignes d'aide affichée en bas de l'écran.
.TP
.B set/unset nonewlines
Ne pas ajouter de passage à la ligne à la fin des fichiers.
Ne pas ajouter de passage à la ligne à la fin des fichiers.
.TP
.B set/unset nowrap
Désactive le passage automatique à la ligne.
Désactive le passage automatique à la ligne.
.TP
.B set operatingdir "\fIrépertoire\fP"
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
le répertoire courant, afin que les fichiers soient lus depuis ce
répertoire. Par défaut, cette fonction est désactivée.
.B set operatingdir "\fIrépertoire\fP"
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
le répertoire courant, afin que les fichiers soient lus depuis ce
répertoire. Par défaut, cette fonction est désactivée.
.TP
.B set/unset preserve
Préserve les séquences XON et XOFF (^Q et ^S).
Préserve les séquences XON et XOFF (^Q et ^S).
.TP
.B set punct "\fIchaîne\fP"
Définit les caractères interprétés comme des ponctuations terminales
lors de la justification des paragraphes. Ces caractères ne peuvent
inclure de blancs. Seules les ponctuations terminales, éventuellement
.B set punct "\fIchaîne\fP"
Définit les caractères interprétés comme des ponctuations terminales
lors de la justification des paragraphes. Ces caractères ne peuvent
inclure de blancs. Seules les ponctuations terminales, éventuellement
suivies de crochets fermants, peuvent terminer une phrase. La valeur par
défaut de cette option est "\fI!.?\fP".
défaut de cette option est "\fI!.?\fP".
N.D.T.\ : ce réglage permet, lors de la justification, de conserver
2\ espaces au lieu d'une derrière les ponctuations terminales, ce qui
N.D.T.\ : ce réglage permet, lors de la justification, de conserver
2\ espaces au lieu d'une derrière les ponctuations terminales, ce qui
correspond aux normes typographiques anglo-saxonnes, mais n'a pas lieu
d'être en français. Pour le français, le plus simple est d'indiquer,
dans le fichier nanorc, une chaîne vide pour ce paramètre.
d'être en français. Pour le français, le plus simple est d'indiquer,
dans le fichier nanorc, une chaîne vide pour ce paramètre.
.TP
.B set/unset quickblank
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
d'état disparaîtront après une frappe clavier au lieu de 25.
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
d'état disparaîtront après une frappe clavier au lieu de 25.
.TP
.B set quotestr "\fIchaîne\fP"
Définit le préfixe par défaut utilisé pour les citations dans les
courriers électroniques. Ce préfixe est utilisé pour réaliser une
justification correcte de ces citations. Il s'agira, si votre système le
permet, d'une expression rationnelle étendue. Dans le cas
contraire, il s'agira d'une chaîne de texte brut. Si vous disposez des
expressions rationnelles, la valeur par défaut de cette option sera
.B set quotestr "\fIchaîne\fP"
Définit le préfixe par défaut utilisé pour les citations dans les
courriers électroniques. Ce préfixe est utilisé pour réaliser une
justification correcte de ces citations. Il s'agira, si votre système le
permet, d'une expression rationnelle étendue. Dans le cas
contraire, il s'agira d'une chaîne de texte brut. Si vous disposez des
expressions rationnelles, la valeur par défaut de cette option sera
"\fI^([\ \\t]*[#:>\\|}])+\fP", sinon, ce sera ">\ ". Notez que le
«\ \\t\ » ci-dessus correspond à un caractère de tabulation.
«\ \\t\ » ci-dessus correspond à un caractère de tabulation.
.TP
.B set/unset rebinddelete
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous ne devriez avoir besoin de cette option que si, sur votre système,
la touche «\ Effacement arrière\ » produit l'effet de la touche «\
Supprimer\ ».
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous ne devriez avoir besoin de cette option que si, sur votre système,
la touche «\ Effacement arrière\ » produit l'effet de la touche «\
Supprimer\ ».
.TP
.B set/unset rebindkeypad
Interprète les touches du pavé numérique afin qu'elles fonctionnent
Interprète les touches du pavé numérique afin qu'elles fonctionnent
toutes correctement. Vous ne devriez utiliser cette option que si ce
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
correctement lorsque cette option sera activée.
correctement lorsque cette option sera activée.
.TP
.B set/unset regexp
Utilise par défaut des expressions rationnelles étendues pour les
Utilise par défaut des expressions rationnelles étendues pour les
recherches.
.TP
.B set/unset smarthome
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque
cette touche est pressée à n'importe quel endroit excepté au tout début
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
arrière). Si le curseur est déjà là, il se placera au vrai début de la
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque
cette touche est pressée à n'importe quel endroit excepté au tout début
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
arrière). Si le curseur est déjà là, il se placera au vrai début de la
ligne.
.TP
.B set/unset smooth
Active le défilement ligne-par-ligne du texte.
Active le défilement ligne-par-ligne du texte.
.TP
.B set speller "\fIprogramme\fP"
Utilise le correcteur orthographique \fIprogramme\fP au lieu du
correcteur intégré, qui s'appuie sur \fIspell\fP.
correcteur intégré, qui s'appuie sur \fIspell\fP.
.TP
.B set/unset suspend
Autorise à suspendre \fBnano\fP.
Autorise à suspendre \fBnano\fP.
.TP
.B set tabsize \fIn\fP
Utilise une taille de tabulation de \fIn\fP colonnes. Cette valeur doit
être strictement supérieure à 0. La valeur par défaut est de\ 8.
être strictement supérieure à 0. La valeur par défaut est de\ 8.
.TP
.B set/unset tabstospaces
Convertit les tabulations clavier en espaces.
.TP
.B set/unset tempfile
S'il a été modifié, le fichier sera sauvegardé automatiquement en
S'il a été modifié, le fichier sera sauvegardé automatiquement en
quittant, sans demande de confirmation.
.TP
.B set/unset view
Interdit de modifier les fichiers.
.TP
.B set whitespace "\fIchaîne\fP"
Définit les deux caractères utilisés pour afficher les premiers
caractères des tabulations et des espaces. Ces deux caractères doivent
être mono-colonne.
.B set whitespace "\fIchaîne\fP"
Définit les deux caractères utilisés pour afficher les premiers
caractères des tabulations et des espaces. Ces deux caractères doivent
être mono-colonne.
.TP
.B set/unset wordbounds
Détection plus précise des limites de mots, obtenue en considérant les
caractères de ponctuation comme faisant partie des mots.
Détection plus précise des limites de mots, obtenue en considérant les
caractères de ponctuation comme faisant partie des mots.
.TP
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
l'option \fB-Y\fP (ou \fB--syntax\fP) ou qui sera automatiquement
activée si le nom du fichier en cours correspond à l'expression
rationnelle étendue \fImotif_de_fichier\fP. Toutes les instructions
suivantes de colorisation \fBcolor\fP ou \fBicolor\fP s'appliqueront à
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
activée si le nom du fichier en cours correspond à l'expression
rationnelle étendue \fImotif_de_fichier\fP. Toutes les instructions
suivantes de colorisation \fBcolor\fP ou \fBicolor\fP s'appliqueront à
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
La syntaxe nommée \fInone\fP (aucune) est réservée\ ; si elle est
indiquée dans la ligne de commande, cela revient à ne définir aucune
syntaxe. La syntaxe nommée \fIdefault\fP (par défaut) est spéciale, elle
ne nécessite aucun motif de \fImotif_de_fichier\fP, et s'applique aux
fichiers ne correspondant à aucun des \fImotif_de_fichier\fP des autres
La syntaxe nommée \fInone\fP (aucune) est réservée\ ; si elle est
indiquée dans la ligne de commande, cela revient à ne définir aucune
syntaxe. La syntaxe nommée \fIdefault\fP (par défaut) est spéciale, elle
ne nécessite aucun motif de \fImotif_de_fichier\fP, et s'applique aux
fichiers ne correspondant à aucun des \fImotif_de_fichier\fP des autres
syntaxes.
.TP
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
l'expression rationnelle étendue \fImotif\fP en utilisant la couleur de
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
l'expression rationnelle étendue \fImotif\fP en utilisant la couleur de
texte \fIcouleur_texte\fP et la couleur de fond \fIcouleur_fond\fP,
l'une de ces deux couleurs au moins devant être définie. Les couleurs
acceptées par \fBnano\fP pour le texte et le fond sont\ : \fIwhite\fP
l'une de ces deux couleurs au moins devant être définie. Les couleurs
acceptées par \fBnano\fP pour le texte et le fond sont\ : \fIwhite\fP
(blanc), \fIblack\fP (noir), \fIred\fP (rouge), \fIblue\fP (bleu),
\fIgreen\fP (vert), \fIyellow\fP (jaune), \fImagenta\fP, et \fIcyan\fP.
Pour la couleur du texte, vous pouvez ajouter à ces couleurs le préfixe
Pour la couleur du texte, vous pouvez ajouter à ces couleurs le préfixe
\fIbright\fP (lumineux) pour obtenir une couleur plus lumineuse. Si
votre terminal est capable de gérer la transparence, ne pas spécifier de
\fIcouleur_fond\fP indique à \fBnano\fP d'essayer d'utiliser un fond
votre terminal est capable de gérer la transparence, ne pas spécifier de
\fIcouleur_fond\fP indique à \fBnano\fP d'essayer d'utiliser un fond
transparent.
.TP
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
compte de la casse.
.TP
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
Affiche les expressions commençant par l'expression rationnelle étendue
\fImotif_début\fP et se terminant par l'expression rationnelle étendue
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
Affiche les expressions commençant par l'expression rationnelle étendue
\fImotif_début\fP et se terminant par l'expression rationnelle étendue
\fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
et la couleur de fond \fIcouleur_fond\fP, l'une de ces deux couleurs au
moins devant être définie. Cela permet à la colorisation syntaxique de
s'étendre sur plusieurs lignes. Notez que toutes les occurrences
successives de \fImotif_début\fP après le \fImotif_début\fP initial
seront surlignées jusqu'à la prochaine instance de \fImotif_fin\fP.
moins devant être définie. Cela permet à la colorisation syntaxique de
s'étendre sur plusieurs lignes. Notez que toutes les occurrences
successives de \fImotif_début\fP après le \fImotif_début\fP initial
seront surlignées jusqu'à la prochaine instance de \fImotif_fin\fP.
.TP
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
compte de la casse.
.TP
.B include "\fIfichier_de_syntaxes\fP"
Lit le fichier \fIfichier_de_syntaxes\fP contenant une liste
autosuffisante de définitions de syntaxes. Ce fichier ne doit contenir
autosuffisante de définitions de syntaxes. Ce fichier ne doit contenir
que des commandes \fBsyntax\fP, \fBcolor\fP et \fBicolor\fP.
.SH FICHIERS
.TP
.I $SYSCONFDIR/nanorc
Fichier de configuration général
Fichier de configuration général
.TP
.I ~/.nanorc
Fichier de configuration personnel
@@ -348,29 +348,29 @@ Fichier de configuration personnel
.TP
\fBnano\fP(1)
.PP
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (ou son équivalent sur
votre système)
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (ou son équivalent sur
votre système)
.SH AUTEUR
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
\fIAUTHORS\fP et \fITHANKS\fP pour plus d'information). Cette page de
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
le système Debian (mais elle peut être utilisée par d'autres).
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
le système Debian (mais elle peut être utilisée par d'autres).
.SH TRADUCTION
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir de
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir de
la version 1.56 du 11\ octobre\ 2007 de la page de manuel de nanorc
(pour la version 2.0.0 de nano). Cette page a été relue par Gérard
(pour la version 2.0.0 de nano). Cette page a été relue par Gérard
Delafond.
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
traducteur.
La version originale la plus à jour de ce document est toujours
La version originale la plus à jour de ce document est toujours
consultable via la commande\ :
LANGUAGE=en man nano

View File

@@ -3,13 +3,13 @@
.\" Skeleton based on nano-tiny.1:
.\" Copyright (C) 2002 Free Software Foundation, Inc.
.\"
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2006 et 2007. Ce travail
.\" Le travail d'adaptation française de cette page de manuel a été
.\" réalisé par Jean-Philippe Guérard, en 2006 et 2007. Ce travail
.\" d'adaptation est dans le domaine public. Attention, la page traduite
.\" reste soumise au droit d'auteur de ses auteurs originaux.
.\"
.\" The French translation of this document is a public domain work of
.\" Jean-Philippe Guérard. This translation work was made in 2006 and
.\" Jean-Philippe Guérard. This translation work was made in 2006 and
.\" 2007. The translated man page in itself is still subject to the
.\" copyright of its original authors.
.\"
@@ -29,20 +29,20 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.\" Ce document est publié sous une double licence. Vous pouvez
.\" Ce document est publié sous une double licence. Vous pouvez
.\" le distribuer et le modifier selon les termes de l'une des deux
.\" licences ci-dessous :
.\" licences ci-dessous :
.\"
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
.\" votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation. Vous devriez avoir reçu une copie de la
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
.\" le cas, consultez <http://www.gnu.org/licenses/>.
.\"
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2 ou,
.\" à votre choix, supérieure, telle que publiée par la Free
.\" à votre choix, supérieure, telle que publiée par la Free
.\" Software Foundation, sans section invariante, ni texte de
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
.\" une copie de la Licence de documentation libre GNU avec ce
.\" programme. Si ce n'est pas le cas, consultez
.\" <http://www.gnu.org/licenses/>.
@@ -50,105 +50,105 @@
.\" $Id$
.TH RNANO 1 "version 2.0.0" "29\ novembre\ 20O7"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\"
.SH NOM
rnano \- Le mode restreint de NAno un NOuvel éditeur, un clone libre et
amélioré de Pico
rnano \- Le mode restreint de NAno un NOuvel éditeur, un clone libre et
amélioré de Pico
.SH SYNOPSIS
.B rnano
.I [OPTIONS]\ [[\+LIGNE,COLONNE]\ FICHIER]...
.I [OPTIONS]\ [[+LIGNE,COLONNE]\ FICHIER]...
.br
.SH DESCRIPTION
Cette page de manuel décrit brièvement la commande \fBrnano\fR.
Cette page de manuel décrit brièvement la commande \fBrnano\fR.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
.\" respectively.
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
\fBnano\fR ne se contentant pas de copier l'interface et l'ergonomie de
Pico, il offre également certaines fonctions manquantes (ou désactivées
par défaut) dans Pico. Ces fonctionnalités sont, par exemple, les
fonctions de recherche et de remplacement, et la possibilité de sauter
directement à une ligne et à une colonne précise..
Pico, il offre également certaines fonctions manquantes (ou désactivées
par défaut) dans Pico. Ces fonctionnalités sont, par exemple, les
fonctions de recherche et de remplacement, et la possibilité de sauter
directement à une ligne et à une colonne précise..
.PP
\fBrnano\fP est une version de \fBnano\fP fonctionnant en mode
restreint, qui ne permet d'éditer que les fichiers indiqués et qui
n'autorise pas l'utilisateur à accéder au système de fichier ou à un
interpréteur de commandes.
restreint, qui ne permet d'éditer que les fichiers indiqués et qui
n'autorise pas l'utilisateur à accéder au système de fichier ou à un
interpréteur de commandes.
.PP
En mode restreint, \fBnano\fP refusera\ :
.IP \[bu] 2
de lire ou d'écrire dans un fichier n'ayant pas été indiqué dans la
de lire ou d'écrire dans un fichier n'ayant pas été indiqué dans la
ligne de commande\ ;
.IP \[bu]
de lire un fichier nanorc\ ;
.IP \[bu]
de permettre de suspendre l'édition\ ;
de permettre de suspendre l'édition\ ;
.IP \[bu]
de permettre d'ajouter en début ou en fin d'un fichier, ou de
l'enregistrer sous un nom différent\ ;
de permettre d'ajouter en début ou en fin d'un fichier, ou de
l'enregistrer sous un nom différent\ ;
.IP \[bu]
l'utilisation de copies de sécurité ou de la correction orthographique.
l'utilisation de copies de sécurité ou de la correction orthographique.
.SH OPTIONS
.TP
.B \+\fILIGNE\fP,\fICOLONNE\fP
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
lieu de démarrer à la colonne\ 1, ligne\ 1.
.B +\fILIGNE\fP,\fICOLONNE\fP
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
lieu de démarrer à la colonne\ 1, ligne\ 1.
.TP
.B \-?
Identique à \fB-h (\-\-help)\fP.
Identique à \fB\-h (\-\-help)\fP.
.TP
.B \-h (\-\-help)
Affiche un résumé des options de lancement de nano, puis s'arrête.
Affiche un résumé des options de lancement de nano, puis s'arrête.
.TP
.B \-V (\-\-version)
Affiche la version, puis s'arrête.
Affiche la version, puis s'arrête.
.PP
Reportez-vous à la page de manuel \fBnano\fP(1) si vous souhaitez
consulter la documentation complète de \fBnano\fP.
Reportez-vous à la page de manuel \fBnano\fP(1) si vous souhaitez
consulter la documentation complète de \fBnano\fP.
.SH BOGUES
Merci de nous faire parvenir vos commentaires et de nous signaler les
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
\fBnano-devel@gnu.org\fR.
Pour vous abonner, envoyez un courrier électronique à
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
Pour vous abonner, envoyez un courrier électronique à
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
N'hésitez pas également à envoyez vos commentaires, suggestions et
corrections relatives à l'adaptation française de cette page de manuel
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
N'hésitez pas également à envoyez vos commentaires, suggestions et
corrections relatives à l'adaptation française de cette page de manuel
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
.SH "SITE INTERNET"
http://www.nano-editor.org/
.SH AUTEUR
Chris Allegretta <chrisa@asty.org> et d'autres (voir le fichier
\fIAUTHORS\fR). Cette page de manuel a été initialement rédigée par
Thijs Kinkhorst <thijs@kinkhorst.com>, pour le système GNU Debian (mais
elle peut être utilisée par d'autres).
\fIAUTHORS\fR). Cette page de manuel a été initialement rédigée par
Thijs Kinkhorst <thijs@kinkhorst.com>, pour le système GNU Debian (mais
elle peut être utilisée par d'autres).
.SH TRADUCTION
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
de la version 1.19 du 6\ novembre\ 2007 de la page de manuel de rnano
(pour la version 2.0.0 de nano).
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
traducteur.
La version originale la plus à jour de ce document est toujours
La version originale la plus à jour de ce document est toujours
consultable via la commande\ :
LANGUAGE=en man nano

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.3.5" "June 2014"
.TH NANO 1 "version 2.5.2" "February 2016"
.\" Please adjust this date whenever revising the manpage.
.\"
@@ -29,8 +29,7 @@ nano \- Nano's ANOther editor, an enhanced free Pico clone
.SH SYNOPSIS
.B nano
.RI [ options "] [[\+" line , column "]\ " file "]..."
.br
.RI [ options "] [[+" line , column "]\ " file "]..."
.SH DESCRIPTION
\fBnano\fP is a small, free and friendly editor which aims to replace
@@ -39,72 +38,95 @@ top of copying Pico's look and feel, \fBnano\fP also implements some
missing (or disabled by default) features in Pico, such as "search and
replace" and "go to line and column number".
.SH EDITING
Entering text and moving around in a file is straightforward: typing the
letters and using the normal cursor movement keys. Commands are entered
by using the Control (^) and the Alt or Meta (M-) keys.
Typing \fB^K\fR deletes the current line and puts it in the cutbuffer.
Consecutive \fB^K\fRs will put all deleted lines together in the cutbuffer.
Any cursor movement or executing any other command will cause the next
\fB^K\fR to overwrite the cutbuffer. A \fB^U\fR will paste the current
contents of the cutbuffer at the current cursor position.
.PP
When a more precise piece of text needs to be cut or copied, one can mark
its start with \fB^6\fR, move the cursor to its end (the marked text will be
highlighted), and then use \fB^K\fR to cut it, or \fBM-6\fR to copy it to the
cutbuffer. One can also save the marked text to a file with \fB^O\fR, or
spell check it with \fB^T\fR.
.PP
The two lines at the bottom of the screen show the most important commands;
the built-in help (\fB^G\fR) lists all the available ones.
The default key bindings can be changed via the .nanorc file -- see
.BR nanorc (5).
.SH OPTIONS
.TP
.B \+\fIline\fP,\fIcolumn\fP
.B +\fIline\fP,\fIcolumn\fP
Places the cursor on line number \fIline\fP and at column number \fIcolumn\fP
(at least one of which must be specified) on startup, instead of the
default line 1, column 1.
.TP
.B \-A (\-\-smarthome)
.BR \-A ", " \-\-smarthome
Make the Home key smarter. When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will
jump to that beginning (either forwards or backwards). If the cursor is
already at that position, it will jump to the true beginning of the
line.
.TP
.B \-B (\-\-backup)
When saving a file, back up the previous version of it to the current
.BR \-B ", " \-\-backup
When saving a file, back up the previous version of it, using the current
filename suffixed with a tilde (\fB~\fP).
.TP
.B \-C \fIdir\fP (\-\-backupdir=\fIdir\fP)
Set the directory where \fBnano\fP puts unique backup files, if file
backups are enabled.
.BR \-C\ \fIdirectory\fR ", " \-\-backupdir= \fIdirectory
Make and keep not just one backup file, but make and keep a uniquely
numbered one every time a file is saved -- when backups are enabled.
The uniquely numbered files are stored in the specified \fIdirectory\fR.
.TP
.B \-D (\-\-boldtext)
.BR \-D ", " \-\-boldtext
Use bold text instead of reverse video text.
.TP
.B \-E (\-\-tabstospaces)
.BR \-E ", " \-\-tabstospaces
Convert typed tabs to spaces.
.TP
.B \-F (\-\-multibuffer)
.BR \-F ", " \-\-multibuffer
Enable multiple file buffers (if support for them has been compiled in).
.TP
.B \-G (\-\-locking)
.BR \-G ", " \-\-locking
Enable vim-style file locking when editing files.
.TP
.B \-H (\-\-historylog)
.BR \-H ", " \-\-historylog
Log search and replace strings to \fI~/.nano/search_history\fP, so they can be
retrieved in later sessions.
.TP
.B \-I (\-\-ignorercfiles)
.BR \-I ", " \-\-ignorercfiles
Don't look at the system's \fBnanorc\fP nor at \fB~/.nanorc\fP.
.TP
.B \-K (\-\-rebindkeypad)
.BR \-K ", " \-\-rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
.TP
.B \-L (\-\-nonewlines)
.BR \-L ", " \-\-nonewlines
Don't add newlines to the ends of files.
.TP
.B \-N (\-\-noconvert)
.BR \-N ", " \-\-noconvert
Disable automatic conversion of files from DOS/Mac format.
.TP
.B \-O (\-\-morespace)
.BR \-O ", " \-\-morespace
Use the blank line below the titlebar as extra editing space.
.TP
.B \-P (\-\-poslog)
Log and later read back the location of the cursor and place it there
again.
.BR \-P ", " \-\-positionlog
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
.B \-Q \fIstr\fP (\-\-quotestr=\fIstr\fP)
.BR "\-Q ""\fIcharacters\fB""" ", " "\-\-quotestr=""" \fIcharacters\fR """
Set the quoting string for justifying. The default is
"\fI^([\ \\t]*[#:>\\|}])+\fP" if extended regular expression support is
available, or "\fI>\ \fP" otherwise. Note that \fI\\t\fP stands for a
\fB"^([\ \\t]*[#:>\\|}])+"\fP if extended regular expression support is
available, or \fB">\ "\fP otherwise. Note that \fB\\t\fP stands for a
Tab.
.TP
.B \-R (\-\-restricted)
.BR \-R ", " \-\-restricted
Restricted mode: don't read or write to any file not specified on the
command line; don't read any \fInanorc\fP files nor history files;
don't allow suspending nor spell checking;
@@ -113,80 +135,75 @@ different name if it already has one; and don't use backup files.
This restricted mode is also accessible by invoking \fBnano\fP
with any name beginning with 'r' (e.g. "rnano").
.TP
.B \-S (\-\-smooth)
.BR \-S ", " \-\-smooth
Enable smooth scrolling. Text will scroll line-by-line, instead of the
usual chunk-by-chunk behavior.
.TP
.B \-T \fInumber\fP (\-\-tabsize=\fInumber\fP)
.BR \-T\ \fInumber\fR ", " \-\-tabsize= \fInumber
Set the size (width) of a tab to \fInumber\fP columns. The value of
\fInumber\fP must be greater than 0. The default value is 8.
.TP
.B \-U (\-\-quickblank)
.BR \-U ", " \-\-quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25. Note that \fB\-c\fP overrides this.
.TP
.B \-V (\-\-version)
.BR \-V ", " \-\-version
Show the current version number and exit.
.TP
.B \-W (\-\-wordbounds)
.BR \-W ", " \-\-wordbounds
Detect word boundaries more accurately by treating punctuation
characters as part of a word.
.TP
.B \-Y \fIname\fP (\-\-syntax=\fIname\fP)
.BR \-Y\ \fIname\fR ", " \-\-syntax= \fIname
Specify the name of the syntax highlighting to use from among the ones
defined in the \fInanorc\fP files.
.TP
.B \-c (\-\-const)
.BR \-c ", " \-\-constantshow
Constantly show the cursor position. Note that this overrides \fB\-U\fP.
.TP
.B \-d (\-\-rebinddelete)
.BR \-d ", " \-\-rebinddelete
Interpret the Delete key differently so that both Backspace and Delete
work properly. You should only need to use this option if Backspace
acts like Delete on your system.
.TP
.B \-h (\-\-help)
.BR \-h ", " \-\-help
Show a summary of the available command-line options and exit.
.TP
.B \-i (\-\-autoindent)
.BR \-i ", " \-\-autoindent
Indent new lines to the previous line's indentation. Useful when
editing source code.
.TP
.B \-k (\-\-cut)
.BR \-k ", " \-\-cut
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
.B \-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
.B \-m (\-\-mouse)
.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
click), and execute shortcuts. The mouse will work in the X Window
System, and on the console when gpm is running. Text can still be
selected through dragging by holding down the Shift key.
.TP
.B \-n (\-\-noread)
.BR \-n ", " \-\-noread
Treat any name given on the command line as a new file. This allows
\fBnano\fR to write to named pipes: it will start with a blank buffer,
and will write to the pipe when the user saves the "file". This way
\fBnano\fR can be used as an editor in combination with for instance
\fBgpg\fR without having to write sensitive data to disk first.
.TP
.B \-o \fIdir\fP (\-\-operatingdir=\fIdir\fP)
.BR \-o\ \fIdirectory\fR ", " \-\-operatingdir= \fIdirectory
Set the operating directory. This makes \fBnano\fP set up something
similar to a chroot.
.TP
.B \-p (\-\-preserve)
.BR \-p ", " \-\-preserve
Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
by the terminal.
.TP
.B \-q (\-\-quiet)
.BR \-q ", " \-\-quiet
Do not report errors in the \fInanorc\fP files nor ask them to be
acknowledged by pressing Enter at startup.
.TP
.B \-r \fInumber\fP (\-\-fill=\fInumber\fP)
.BR \-r\ \fInumber\fR ", " \-\-fill= \fInumber
Hard-wrap lines at column \fInumber\fP. If this value is 0 or less, wrapping
will occur at the width of the screen less \fInumber\fP columns, allowing
the wrap point to vary along with the width of the screen if the screen
@@ -194,36 +211,41 @@ is resized. The default value is \-8. This option conflicts with
.B \-w
-- the last one given takes effect.
.TP
.B \-s \fIprogram\fP (\-\-speller=\fIprogram\fP)
Enable alternative spell checker command.
.BR \-s\ \fIprogram\fR ", " \-\-speller= \fIprogram
Use this alternative spell checker command.
.TP
.B \-t (\-\-tempfile)
Always save changed buffer without prompting. Same as Pico's \fB\-t\fP
.BR \-t ", " \-\-tempfile
Always save a changed buffer without prompting. Same as Pico's \fB\-t\fP
option.
.TP
.B \-v (\-\-view)
.BR \-u ", " \-\-unix
Save a file by default in Unix format. This overrides nano's
default behavior of saving a file in the format that it had.
(This option has no effect when you also use \fB\-\-noconvert\fR.)
.TP
.BR \-v ", " \-\-view
View-file (read-only) mode.
.TP
.B \-w (\-\-nowrap)
.BR \-w ", " \-\-nowrap
Disable the hard-wrapping of long lines. This option conflicts with
.B \-r
-- the last one given takes effect.
.TP
.B \-x (\-\-nohelp)
.BR \-x ", " \-\-nohelp
Don't show the two help lines at the bottom of the screen.
.TP
.B \-z (\-\-suspend)
.BR \-z ", " \-\-suspend
Enable the suspend ability.
.TP
.B \-$ (\-\-softwrap)
.BR \-$ ", " \-\-softwrap
Enable 'soft wrapping'. This will make \fBnano\fP attempt to display the
entire contents of any line, even if it is longer than the screen width, by
continuing it over multiple screen lines. Since
\&'$' normally refers to a variable in the Unix shell, you should specify
this option last when using other options (e.g. 'nano \-wS$') or pass it
separately (e.g. 'nano \-wS \-$').
this option last when using other options (e.g.\& 'nano \-wS$') or pass it
separately (e.g.\& 'nano \-wS \-$').
.TP
.B \-a, \-b, \-e, \-f, \-g, \-j
.BR \-a ", " \-b ", " \-e ", " \-f ", " \-g ", " \-j
Ignored, for compatibility with Pico.
.SH INITIALIZATION FILE
@@ -244,17 +266,19 @@ SIGTERM or runs out of memory. It will write the buffer into a file
named \fInano.save\fP if the buffer didn't have a name already, or will
add a ".save" suffix to the current filename. If an emergency file with
that name already exists in the current directory, it will add ".save"
plus a number (e.g. ".save.1") to the current filename in order to make
plus a number (e.g.\& ".save.1") to the current filename in order to make
it unique. In multibuffer mode, \fBnano\fP will write all the open
buffers to their respective emergency files.
.SH BUGS
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
The \fBnano\fP mailing list is available from \fBnano-devel@gnu.org\fP.
To subscribe, email to \fBnano-devel-request@gnu.org\fP with a subject
of "subscribe".
Justifications (\fB^J\fR) and reindentations (\fBM-{\fR and \fBM-}\fR)
are not yet covered by the general undo system. So after a justification
that is not immediately undone, or after any reindentation, earlier edits
cannot be undone any more. The workaround is, of course, to exit without
saving.
.sp
Please report any other bugs that you encounter via
https://savannah.gnu.org/bugs/?group=nano.
.SH HOMEPAGE
http://www.nano-editor.org/
@@ -267,7 +291,7 @@ http://www.nano-editor.org/
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
.SH AUTHOR
Chris Allegretta <chrisa@asty.org>, et al (see \fIAUTHORS\fP and
Chris Allegretta <chrisa@asty.org>, et al (see the files \fIAUTHORS\fP and
\fITHANKS\fP for details). This manual page was originally written by
Jordi Mallach <jordi@gnu.org>, for the Debian system (but may be used by
others).

View File

@@ -2,7 +2,7 @@
.\" $Id$
.\"
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
.\" 2013, 2014 Free Software Foundation, Inc.
.\" 2013, 2014, 2015 Free Software Foundation, Inc.
.\"
.\" This document is dual-licensed. You may distribute and/or modify it
.\" under the terms of either of the following licenses:
@@ -20,7 +20,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH NANORC 5 "version 2.3.5" "June 2014"
.TH NANORC 5 "version 2.5.2" "February 2016"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -38,38 +38,45 @@ commands, which can be used to configure nano on startup without using
command-line options. Additionally, there are some commands to define
syntax highlighting and to rebind keys -- see the two separate sections
on those. \fBnano\fP reads one command per line.
.PP
Options in \fInanorc\fP files take precedence over nano's defaults, and
command-line options override \fInanorc\fP settings. Also, options are
unset by default, except for those that take arguments.
Quotes inside string parameters don't have to be escaped with
command-line options override \fInanorc\fP settings. Also, options that
do not take an argument are unset by default. So using the \fBunset\fR
command is only needed when wanting to override a setting of the system's
\fInanorc\fR file in your own \fB~/.nanorc\fR. Options that take an
argument cannot be unset.
.PP
Below, the \fIstring\fR parameters need to be enclosed in double quotes.
Quotes inside these string parameters don't have to be escaped with
backslashes. The last double quote in the string will be treated as its
end. For example, for the \fBbrackets\fP option, "\fB"')>]}\fP" will
match \fB"\fP, \fB'\fP, \fB)\fP, \fB>\fP, \fB]\fP, and \fB}\fP.
.PP
The supported commands and arguments are:
.TP 3
.B set/unset allow_insecure_backup
.B set allow_insecure_backup
When backing up files, allow the backup to succeed even if its permissions
can't be (re)set due to special OS considerations. You should
NOT enable this option unless you are sure you need it.
.TP
.B set/unset autoindent
.B set autoindent
Use auto-indentation.
.TP
.B set/unset backup
Create backup files by adding a tilde (\fB~\fP) to each file's name.
.B set backup
When saving a file, create a backup file by adding a tilde (\fB~\fP) to
the file's name.
.TP
.B set backupdir "\fIdirectory\fP"
Set the directory where \fBnano\fP puts unique backup files, if file
backups are enabled.
Make and keep not just one backup file, but make and keep a uniquely
numbered one every time a file is saved --- when backups are enabled
with \fBset backup\fR or \fB\-\-backup\fR or \fB\-B\fR.
The uniquely numbered files are stored in the specified \fIdirectory\fR.
.TP
.B set/unset backwards
.B set backwards
Do backwards searches by default.
.TP
.B set/unset boldtext
.B set boldtext
Use bold instead of reverse video for the titlebar, statusbar, key combos,
and selected text. This can be overridden for the first three by setting
the options \fBtitlecolor\fP, \fBstatuscolor\fP, and \fBkeycolor\fP.
@@ -80,26 +87,27 @@ paragraphs. This may not include blank characters. Only closing
punctuation (see \fBpunct\fP), optionally followed by the specified
closing brackets, can end sentences. The default value is "\fB"')>]}\fP".
.TP
.B set/unset casesensitive
.B set casesensitive
Do case-sensitive searches by default.
.TP
.B set/unset const
.B set constantshow
Constantly display the cursor position in the status bar.
(The old form of this option, '\fBset const\fR', is deprecated.)
.TP
.B set/unset cut
.B set cut
Use cut-to-end-of-line by default, instead of cutting the whole line.
.TP
.B set fill \fIn\fP
Hard-wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the
maximum line length will be the screen width less \fIn\fP columns. The
default value is \-8.
.B set fill \fInumber\fR
Hard-wrap lines at column number \fInumber\fR. If \fInumber\fR is 0 or less,
the maximum line length will be the screen width less \fInumber\fP columns.
The default value is \fB\-8\fR.
.TP
.B set functioncolor \fIfgcolor\fR,\fIbgcolor\fR
Specify the color combination to use for the function descriptions
in the two help lines at the bottom of the screen.
See \fBset titlecolor\fR for more details.
.TP
.B set/unset historylog
.B set historylog
Enable the use of \fB~/.nano/search_history\fP for saving and reading
search/replace strings.
.TP
@@ -108,7 +116,7 @@ Specify the color combination to use for the shortcut key combos
in the two help lines at the bottom of the screen.
See \fBset titlecolor\fR for more details.
.TP
.B set/unset locking
.B set locking
Enable vim-style lock-files for when editing files.
.TP
.B set matchbrackets "\fIstring\fP"
@@ -117,32 +125,29 @@ searches. This may not include blank characters. The opening set must
come before the closing set, and the two sets must be in the same order.
The default value is "\fB(<[{)>]}\fP".
.TP
.B set/unset morespace
.B set morespace
Use the blank line below the titlebar as extra editing space.
.TP
.B set/unset mouse
.B set 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
click), and execute shortcuts. The mouse will work in the X Window
System, and on the console when gpm is running. Text can still be
selected through dragging by holding down the Shift key.
.TP
.B set/unset multibuffer
Allow inserting files into their own buffers.
.B set multibuffer
When reading in a file with ^R, insert it into a new buffer by default.
.TP
.B set/unset noconvert
.B set noconvert
Don't convert files from DOS/Mac format.
.TP
.B set/unset nofollow
Don't follow symlinks when writing files.
.TP
.B set/unset nohelp
.B set nohelp
Don't display the two help lines at the bottom of the screen.
.TP
.B set/unset nonewlines
.B set nonewlines
Don't automatically add a newline to the ends of files.
.TP
.B set/unset nowrap
.B set nowrap
Don't hard-wrap text at all.
.TP
.B set operatingdir "\fIdirectory\fP"
@@ -151,10 +156,12 @@ subdirectories. Also, the current directory is changed to here, so
files are inserted from this directory. By default, the operating
directory feature is turned off.
.TP
.B set/unset poslog
.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/unset preserve
.B set preserve
Preserve the XON and XOFF keys (^Q and ^S).
.TP
.B set punct "\fIstring\fP"
@@ -163,11 +170,11 @@ paragraphs. This may not include blank characters. Only the
specfified closing punctuation, optionally followed by closing brackets
(see \fBbrackets\fP), can end sentences. The default value is "\fB!.?\fP".
.TP
.B set/unset quickblank
.B set quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25.
.TP
.B set/unset quiet
.B set quiet
\fBnano\fP will not report errors in the \fInanorc\fP file nor ask them
to be acknowledged by pressing Enter at startup. If this is used, it
should be placed at the top of the file to be fully effective.
@@ -180,30 +187,30 @@ otherwise a literal string. The default value is
support, and "\fB>\ \fP" otherwise. Note that '\\t' stands for a literal
Tab character.
.TP
.B set/unset rebinddelete
.B set rebinddelete
Interpret the Delete key differently so that both Backspace and Delete
work properly. You should only need to use this option if Backspace
acts like Delete on your system.
.TP
.B set/unset rebindkeypad
.B set rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
.TP
.B set/unset regexp
.B set regexp
Do extended regular expression searches by default.
.TP
.B set/unset smarthome
.B set smarthome
Make the Home key smarter. When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will
jump to that beginning (either forwards or backwards). If the cursor is
already at that position, it will jump to the true beginning of the
line.
.TP
.B set/unset smooth
.B set smooth
Use smooth scrolling by default.
.TP
.B set/unset softwrap
.B set softwrap
Enable soft line wrapping for easier viewing of very long lines.
.TP
.B set speller "\fIspellprog\fP"
@@ -214,17 +221,17 @@ calls \fIspell\fP.
Specify the color combination to use for the statusbar.
See \fBset titlecolor\fR for more details.
.TP
.B set/unset suspend
.B set suspend
Allow \fBnano\fP to be suspended.
.TP
.B set tabsize \fIn\fP
Use a tab size of \fIn\fP columns. The value of \fIn\fP must be greater
than 0. The default value is 8.
.B set tabsize \fInumber\fR
Use a tab size of \fInumber\fR columns. The value of \fInumber\fP must be
greater than 0. The default value is \fB8\fR.
.TP
.B set/unset tabstospaces
.B set tabstospaces
Convert typed tabs to spaces.
.TP
.B set/unset tempfile
.B set tempfile
Save automatically on exit, don't prompt.
.TP
.B set titlecolor \fIfgcolor\fR,\fIbgcolor\fR
@@ -233,46 +240,62 @@ Valid color names for foreground and background are:
.BR white , \ black , \ red , \ blue , \ green , \ yellow , \ magenta ", and " cyan .
And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
.TP
.B set/unset view
.B set unix
Save a file by default in Unix format. This overrides nano's
default behavior of saving a file in the format that it had.
(This option has no effect when you also use \fBset noconvert\fR.)
.TP
.B set view
Disallow file modification.
.TP
.B set whitespace "\fIstring\fP"
Set the two characters used to indicate the presence of tabs and
spaces. They must be single-column characters.
.TP
.B set/unset wordbounds
.B set wordbounds
Detect word boundaries more accurately by treating punctuation
characters as parts of words.
.SH SYNTAX HIGHLIGHTING
Coloring the different syntactic elements of a file
can be defined via the following commands:
is done via regular expressions (see the \fBcolor\fR command below).
This is inherently imperfect, because regular expressions are not
powerful enough to fully parse a file. Nevertheless, regular
expressions can do a lot and are easy to make, so they are a
good fit for a small editor like \fBnano\fR.
.sp
A separate syntax can be defined for each kind of file
via the following commands:
.TP
.BR syntax " ""\fIstr\fR"" [""\fIfileregex\fR"" ...]"
Defines a syntax named \fIstr\fP which can be activated via the
.BR \-Y / \-\-syntax
command-line option, or will be automatically activated if
the current filename matches the extended regular expression
\fIfileregex\fP. All following \fBcolor\fP and \fBicolor\fP statements
will apply to this \fIstr\fP syntax until a new syntax is defined.
\fIfileregex\fP. All subsequent \fBcolor\fR, \fBicolor\fR,
\fBheader\fR and other such statements will apply to this
\fIstr\fP syntax until a new \fBsyntax\fR command is encountered.
The \fBnone\fP syntax is reserved; specifying it on the command line is
the same as not having a syntax at all. The \fBdefault\fP syntax is
special: it takes no \fIfileregex\fP, and applies to files that don't
match any other syntax's \fIfileregex\fP.
match any syntax's \fIfileregex\fP.
.TP
.BI linter " program " \fR[ "arg " \fR...]
For the currently defined syntax, use the given \fIprogram\fR
to invoke the linter (this overrides the speller function when
defined).
Use the given \fIprogram\fR to run a syntax check on the current file
(this overrides the speller function when defined).
.TP
.BR header " [""\fIregex\fR"" ...]
For the currently defined syntax, add one or more regexes which will
.BI formatter " program " \fR[ "arg " \fR...]
Use the given \fIprogram\fR to automatically reformat text.
Useful in certain programming languages (e.g. Go).
.TP
.BR header " \fIregex\fR " ...
Add one or more regexes which will
be compared against the very first line of the file to be edited,
to determine whether this syntax should be used for that file.
.TP
.BR magic " [""\fIregex\fR"" ...]
For the currently defined syntax, add one or more regexes which
.BR magic " \fIregex\fR " ...
Add one or more regexes which
will be compared against the result of querying the \fBmagic\fP
database about the file to be edited, to determine whether this
syntax should be used for that file. This
@@ -280,7 +303,7 @@ functionality only works when \fBlibmagic\fP is installed on the
system and will be silently ignored otherwise.
.TP
.B color \fIfgcolor\fR,\fIbgcolor\fR """\fIregex\fR""" ...
For the currently defined syntax, display all expressions matching
Display all pieces of text that match
the extended regular expression \fIregex\fP with foreground color
\fIfgcolor\fP and background color \fIbgcolor\fP, at least one of which
must be specified. Valid colors for foreground and background
@@ -291,34 +314,34 @@ foreground. If your terminal supports transparency, not specifying a
background.
.TP
.B icolor \fIfgcolor\fR,\fIbgcolor\fR """\fIregex\fR""" ...
Same as above, except that the expression matching is case insensitive.
Same as above, except that the text matching is case insensitive.
.TP
.BR color " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIsr\fR"" " end= """\fIer\fR""
Display expressions which start with the extended regular expression
\fIsr\fP and end with the extended regular expression \fIer\fP with
Display all pieces of text whose start matches extended regular expression
\fIsr\fP and whose end matches extended regular expression \fIer\fP with
foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
at least one of which must be specified. This allows syntax
highlighting to span multiple lines. Note that all subsequent instances
of \fIsr\fP after an initial \fIsr\fP is found will be highlighted until
the first instance of \fIer\fP.
at least one of which must be specified. This means that, after an
initial instance of \fIsr\fP, all text will be highlighted until the
first instance of \fIer\fP. This allows syntax highlighting to span
multiple lines.
.TP
.BR icolor " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIsr\fR"" " end= """\fIer\fR""
Same as above, except that the expression matching is case insensitive.
Same as above, except that the text matching is case insensitive.
.TP
.BR include " ""\fIsyntaxfile\fR"""
Read in self-contained color syntaxes from \fIsyntaxfile\fP. Note that
\fIsyntaxfile\fP can only contain the above commands, from \fBsyntax\fP
\fIsyntaxfile\fP may contain only the above commands, from \fBsyntax\fP
to \fBicolor\fP.
.TP
.BI extendsyntax " str directive " \fR[ "arg " \fR...]
Extend the syntax previously defined as \fIstr\fP to include
new information. This allows you to add a new \fIcolor\fP, \fIicolor\fP,
\fImagic\fP, \fIheader\fP, or \fIlinter\fP directive to an already
defined syntax -- useful when you want to add to definitions from the
system-installed syntax definitions (which are normally not writable).
new information. This allows you to add a new \fBcolor\fP, \fBicolor\fP,
\fBheader\fP, \fBmagic\fP, \fBlinter\fP, or \fBformatter\fP directive
to an already defined syntax -- useful when you want to
slightly improve a syntax defined in one of the system-installed
files (which are normally not writable)
.SH REBINDING KEYS
Key bindings may be reassigned via the following commands:
Key bindings can be changed via the following two commands:
.TP
.BI bind " key function menu"
Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the
@@ -331,7 +354,8 @@ menus where it exists by using \fBall\fP).
.TP
The format of \fIkey\fP should be one of:
.TP
.RS 3
.TP 3
.B ^
followed by an alpha character or the word "Space".
Example: ^C
@@ -343,10 +367,11 @@ Example: M-C
.B F
followed by a numeric value from 1 to 16.
Example: F10
.RE
.TP
Valid \fIfunction\fP names to be bound include:
Valid \fIfunction\fP names to be bound are:
.RS 3
.TP 2
.B help
Invokes the help viewer.
@@ -358,18 +383,27 @@ Cancels the current command.
Exits from the program (or from the help viewer or the file browser).
.TP
.B writeout
Writes the current buffer to disk.
Writes the current buffer to disk, asking for a name.
.TP
.B savefile
Writes the current file to disk without prompting or warning.
.TP
.B insert
Inserts a file into the current buffer (or into a new buffer when multibuffer
is enabled).
Inserts a file into the current buffer (at the current cursor position),
or into a new buffer when option \fBmultibuffer\fR is set.
.TP
.B whereis
Searches for text in the current buffer -- or for filenames matching
a string in the current list in the file browser.
.TP
.B searchagain
Repeats the last search command.
Repeats the last search command without prompting.
.TP
.B findprevious
As \fBsearchagain\fR, but always in the backward direction.
.TP
.B findnext
As \fBsearchagain\fR, but always in the forward direction.
.TP
.B replace
Interactively replaces text within the current buffer.
@@ -387,6 +421,12 @@ current cursor position.
.B mark
Sets the mark at the current position, to start selecting text.
.TP
.B cutwordleft
Cuts from the cursor position to the beginning of the preceding word.
.TP
.B cutwordright
Cuts from the cursor position to the beginning of the next word.
.TP
.B cutrestoffile
Cuts all text from the cursor position till the end of the buffer.
.TP
@@ -400,6 +440,9 @@ Counts the number of words, lines and characters in the current buffer.
Invokes a spell-checking program (or a linting program, if the current
syntax highlighting defines one).
.TP
.B linter
A synonym of \fBspeller\fR (for when the speller has not been configured).
.TP
.B justify
Justifies the current paragraph.
.TP
@@ -430,12 +473,12 @@ Scrolls up one line of text from the current position.
.B scrolldown
Scrolls down one line of text from the current position.
.TP
.B nextword
Moves the cursor to the beginning of the next word.
.TP
.B prevword
Moves the cursor to the beginning of the previous word.
.TP
.B nextword
Moves the cursor to the beginning of the next word.
.TP
.B home
Moves the cursor to the beginning of the current line.
.TP
@@ -464,17 +507,17 @@ Goes to the last line of the file.
Goes to a specific line (and column if specified).
.TP
.B gototext
Switches from targetting a line number to searching for text.
Switches from targeting a line number to searching for text.
.TP
.B findbracket
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
(pairs) with the one under the cursor.
.TP
.B prevbuf
Switches to editing/viewing the previous buffer when using multibuffer mode.
Switches to editing/viewing the previous buffer when multiple buffers are open.
.TP
.B nextbuf
Switches to editing/viewing the next buffer when using multibuffer mode.
Switches to editing/viewing the next buffer when multiple buffers are open.
.TP
.B verbatim
Inserts the next character verbatim into the file.
@@ -529,13 +572,6 @@ Toggles between inserting a file and executing a command.
Toggles between inserting into the current buffer and into a new
empty buffer.
.TP
.B tofiles
Starts the file browser, allowing to select a file from a list.
.TP
.B gotodir
Goes to a directory to be specified, allowing to browse anywhere
in the filesystem.
.TP
.B dosformat
When writing a file, switches to writing a DOS format (CR/LF).
.TP
@@ -551,6 +587,18 @@ When writing a file, 'prepends' (writes at the beginning) instead of overwriting
.B backup
When writing a file, creates a backup of the current file.
.TP
.B discardbuffer
When about to write a file, discard the current buffer without saving.
(This function is bound by default only when option \fB\-\-tempfile\fR
is in effect.)
.TP
.B tofiles
Starts the file browser, allowing to select a file from a list.
.TP
.B gotodir
Goes to a directory to be specified, allowing to browse anywhere
in the filesystem.
.TP
.B firstfile
Goes to the first file when using the file browser (reading or writing files).
.TP
@@ -595,10 +643,11 @@ Toggles whether long lines will be hard-wrapped to the next line.
Toggles whether typed tabs will be converted to spaces.
.TP
.B backupfile
Toggles whether a backup will be made of the file to be edited.
Toggles whether a backup will be made of the file being edited.
.TP
.B multibuffer
Toggles the use of multiple file buffers (if support for them has been compiled in).
Toggles whether a file is inserted into the current buffer
or read into a new buffer.
.TP
.B mouse
Toggles mouse support.
@@ -608,10 +657,11 @@ Toggles automatic conversion of files from DOS/Mac format.
.TP
.B suspendenable
Toggles whether the suspend sequence (normally ^Z) will suspend the editor window.
.RE
.TP
Valid \fImenu\fP sections are:
.RS 3
.TP 2
.B main
The main editor window where text is entered and edited.
@@ -659,6 +709,7 @@ The 'go to directory' menu in the file browser.
A special name that encompasses all menus.
For \fBbind\fR it means all menus where the specified \fIfunction\fR exists;
for \fBunbind\fR it means all menus where the specified \fIkey\fR exists.
.RE
.SH FILES
.TP

View File

@@ -1,7 +1,7 @@
.\" Hey, EMACS: -*- nroff -*-
.\" Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
.\" Skeleton based on nano-tiny.1:
.\" Copyright (C) 2002 Free Software Foundation, Inc.
.\" $Id$
.\"
.\" Copyright (C) 2002, 2005, 2006, 2007, 2014 Free Software Foundation, Inc.
.\"
.\" This document is dual-licensed. You may distribute and/or modify it
.\" under the terms of either of the following licenses:
@@ -19,8 +19,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.\" $Id$
.TH RNANO 1 "version 2.3.3" "April 2014"
.TH RNANO 1 "version 2.5.2" "February 2016"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -29,8 +28,7 @@ Pico clone
.SH SYNOPSIS
.B rnano
.RI [ options "] [[\+" line , column "]\ " file "]..."
.br
.RI [ options "] [[+" line , column "]\ " file "]..."
.SH DESCRIPTION
\fBnano\fP is a small, free and friendly editor which aims to replace
@@ -43,7 +41,7 @@ replace" and "go to line and column number".
specific files and doesn't allow the user access to the filesystem or a
command shell.
.PP
In restricted mode, \fBnano\fP will \fInot\fP:
In restricted mode, \fBnano\fP will \fInot\/\fP:
.IP \[bu] 2
read or write to any file not specified on the command line;
.IP \[bu]
@@ -58,14 +56,13 @@ use backup files or spell checking.
.SH OPTIONS
.TP
.B \-h (\-\-help)
Show a summary of command line options and exit.
.BR \-h ", " \-\-help
Show a summary of command-line options and exit.
.TP
.B \-V (\-\-version)
.BR \-V ", " \-\-version
Show the current version number and exit.
.PP
See the \fBnano\fP(1) manpage for the complete documentation of
\fBnano\fP.
See the \fBnano\fP(1) manpage for all of the possible options.
.SH BUGS
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
@@ -79,7 +76,7 @@ of "subscribe".
http://www.nano-editor.org/
.SH AUTHOR
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS for details).
Chris Allegretta <chrisa@asty.org>, et al (see the file AUTHORS for details).
This manual page was originally written by Thijs Kinkhorst
<thijs@kinkhorst.com>, for the Debian system (but may be used by
others).

View File

@@ -46,7 +46,8 @@
## Constantly display the cursor position in the statusbar. Note that
## this overrides "quickblank".
# set const
# set constantshow
## (The old form, 'const', is deprecated.)
## Use cut-to-end-of-line by default.
# set cut
@@ -56,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
@@ -85,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
@@ -104,7 +102,8 @@
# set operatingdir ""
## Remember the cursor position in each file for the next editing session.
# set poslog
# set positionlog
## (The old form, 'poslog', is deprecated.)
## Preserve the XON and XOFF keys (^Q and ^S).
# set preserve
@@ -165,10 +164,6 @@
## Save automatically on exit; don't prompt.
# set tempfile
## Enable the new (EXPERIMENTAL) generic undo code, not just for line
## cuts.
# set undo
## Disallow file modification. Why would you want this in an rcfile? ;)
# set view
@@ -239,13 +234,15 @@
## Key bindings.
## See nanorc(5) for more details on this.
## See nanorc(5) (section REBINDING KEYS) for more details on this.
##
## Here are a few samples to get you going.
##
# bind M-W nowrap main
# bind M-A casesens search
# bind ^S research main
## The following five functions are not bound to any key by default.
## You may wish to choose different keys than the ones suggested here.
# bind ^S savefile main
# bind M-Q findprevious main
# bind M-W findnext main
# bind M-B cutwordleft main
# bind M-N cutwordright main
## Set this if your backspace key sends Del most of the time.
## Set this if your Backspace key sends Del most of the time.
# bind Del backspace all

View File

@@ -1,4 +1,5 @@
pkgdata_DATA = asm.nanorc \
autoconf.nanorc \
awk.nanorc \
changelog.nanorc \
cmake.nanorc \
@@ -6,10 +7,12 @@ pkgdata_DATA = asm.nanorc \
css.nanorc \
debian.nanorc \
default.nanorc \
elisp.nanorc \
fortran.nanorc \
gentoo.nanorc \
go.nanorc \
groff.nanorc \
guile.nanorc \
html.nanorc \
java.nanorc \
javascript.nanorc \
@@ -19,6 +22,7 @@ pkgdata_DATA = asm.nanorc \
man.nanorc \
mgp.nanorc \
mutt.nanorc \
nftables.nanorc \
nanorc.nanorc \
objc.nanorc \
ocaml.nanorc \
@@ -26,6 +30,7 @@ pkgdata_DATA = asm.nanorc \
perl.nanorc \
php.nanorc \
po.nanorc \
postgresql.nanorc \
pov.nanorc \
python.nanorc \
ruby.nanorc \

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,19 +1,20 @@
## Here is an example for apt's sources.list.
syntax "apt/sources.list" "sources\.list(\.old|~)?$"
syntax "sources.list" "sources\.list(~|\.old|\.save)?$" "sources\.list\.d/.*\.list(~|\.old|\.save)?$"
# Coloring the deb lines, working from tail to head. First the
# components -- well, everything, and thus also the components.
color brightmagenta "^deb.*"
# Distribution -- well, everything, except the components.
color brightred "^deb(-src)? ((http|ftp|rsh|ssh|file|copy):/[^ ]+|cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/) [^ ]+"
color brightred "^deb(-src)?\s+.*((ftp|https?|rsh|ssh|copy|file|spacewalk|tor):/\S+|cdrom:\[.+\]/)\s+\S+"
# URIs.
color brightgreen "(http|ftp|rsh|ssh|file|copy):/[^ ]+"
color brightgreen "^deb(-src)?\s+.*(ftp|https?|rsh|ssh|copy|file|spacewalk|tor):/\S+"
# CDroms.
color brightgreen "cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/"
color brightgreen "^deb(-src)?\s+.*cdrom:\[.+\]/"
# Options.
color brightcyan "^deb(-src)?\s+\[.+\]\s+"
# And finally the initial deb tag.
color yellow "^deb(-src)?"
# Comments.
color brightblue "#.*"

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

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

View File

@@ -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)\>"

View File

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

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

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

View File

@@ -5,7 +5,8 @@ magic "Java "
color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native)\>"
color cyan "\<(package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
color red ""[^"]*""
color yellow "\<(true|false|null)\>"
color blue "//.*"

View File

@@ -15,18 +15,20 @@ color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|break)\>"
# Keywords
color brightyellow "\<(debug|string|math|table|io|coroutine|os)\>\."
color brightyellow "\<(io|math|os|string|table|coroutine|debug)\>\."
color brightyellow "\<(_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\("
# Standard library
color brightyellow "io\.\<(close|flush|input|lines|open|output|popen|read|tmpfile|type|write|stdin|stdout|stderr)\>"
color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log)\>"
color brightyellow "math\.\<(max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
color brightyellow "os\.\<(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>"
color brightyellow "package\.\<(cpath|loaded|loadlib|path|preload|seeall)\>"
color brightyellow "string\.\<(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)\>"
color brightyellow "table\.\<(concat|insert|maxn|remove|sort)\>"
color brightyellow "coroutine\.\<(create|resume|running|status|wrap|yield)\>"
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue)\>"
color brightyellow "debug\.\<(setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
# File handle methods
color brightyellow "\:\<(close|flush|lines|read|seek|setvbuf|write)\>"

View File

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

View File

@@ -6,13 +6,13 @@ syntax "nanorc" "\.?nanorc$"
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|i?color|extendsyntax).*$"
# Keywords
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|poslog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|undo|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|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:]]+[[:alpha:]]+[[:space:]]*$"
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]*$"
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|linter)[[:space:]]+.*$"
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|extendsyntax)\>"
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)\>"
# Colors
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
@@ -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

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
## Here is an example for patch files.
syntax "patch" "\.(patch|diff)$"
syntax "patch" "\.(patch|diff|debdiff)$"
magic "diff output text"
# Added lines.

View File

@@ -1,7 +1,7 @@
## Here is an example for Perl.
syntax "perl" "\.p[lm]$"
header "^#!.*/perl[-0-9._]*"
header "^#!.*perl[-0-9._]*"
magic "Perl script text"
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"

View File

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

View File

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

View File

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

View File

@@ -1,22 +1,24 @@
## Here is an example for Python.
syntax "python" "\.py$"
header "^#!.*/python[-0-9._]*"
header "^#!.*python[-0-9._]*"
linter pyflakes
# Function definitions.
icolor brightblue "def [0-9A-Z_]+"
# Keywords.
color brightcyan "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
# Strings.
color brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
# Multiline strings.
color brightgreen start="\"\"\"([^"),]|$)" end="(^|[^(])\"\"\""
color brightgreen start="'''([^'),]|$)" end="(^|[^(])'''"
color brightcyan "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from)\>"
color brightcyan "\<(global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
# Single-quoted strings.
color brightgreen "'([^'\]|\\.)+'"
color brightgreen ""([^"\]|\\.)+""
# Comments.
color brightred "(^|[[:blank:]])#.*$"
# Triple-quoted strings.
color brightgreen start="'''[^'),]" end="(^|[^(\])'''"
color brightgreen start="\"\"\"[^"),]" end="(^|[^(\])\"\"\""
# Reminders.
color ,yellow "(FIXME|TODO|XXX)"

View File

@@ -1,10 +1,12 @@
## Here is an example for Ruby.
syntax "ruby" "\.rb$"
header "^#!.*/ruby[-0-9._]*"
header "^#!.*ruby[-0-9._]*"
linter ruby -w -c
# Asciibetical list of reserved words.
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
# Reserved words.
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module)\>"
color yellow "\<(next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
# Constants.
color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
# Ruby "symbols".

View File

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

View File

@@ -24,8 +24,8 @@ color yellow start="%__" end="\ "
color magenta start="%\{" end="\}"
color yellow start="%\{__" end="\}"
# Sections.
color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|preun|post|postun)"
color red "^%(trigger|triggerin|triggerpostun|triggerun|verifyscript)"
color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|pretrans|preun)"
color red "^%(post|posttrans|postun|trigger|triggerin|triggerpostun|triggerun|verifyscript)"
# Conditionals and defines.
color brightred "%(if|else|endif|define|global|undefine)"

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

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

1381
po/bg.po

File diff suppressed because it is too large Load Diff

1642
po/ca.po

File diff suppressed because it is too large Load Diff

1677
po/cs.po

File diff suppressed because it is too large Load Diff

1640
po/da.po

File diff suppressed because it is too large Load Diff

2290
po/de.po

File diff suppressed because it is too large Load Diff

1522
po/eo.po

File diff suppressed because it is too large Load Diff

1959
po/es.po

File diff suppressed because it is too large Load Diff

1395
po/eu.po

File diff suppressed because it is too large Load Diff

1462
po/fi.po

File diff suppressed because it is too large Load Diff

1517
po/fr.po

File diff suppressed because it is too large Load Diff

1329
po/ga.po

File diff suppressed because it is too large Load Diff

1459
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

1607
po/hu.po

File diff suppressed because it is too large Load Diff

1368
po/id.po

File diff suppressed because it is too large Load Diff

1362
po/it.po

File diff suppressed because it is too large Load Diff

1386
po/ja.po

File diff suppressed because it is too large Load Diff

1369
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1567
po/nb.po

File diff suppressed because it is too large Load Diff

1473
po/nl.po

File diff suppressed because it is too large Load Diff

1363
po/nn.po

File diff suppressed because it is too large Load Diff

1614
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2803
po/ro.po

File diff suppressed because it is too large Load Diff

1328
po/ru.po

File diff suppressed because it is too large Load Diff

1247
po/sl.po

File diff suppressed because it is too large Load Diff

1360
po/sr.po

File diff suppressed because it is too large Load Diff

2435
po/sv.po

File diff suppressed because it is too large Load Diff

1365
po/tr.po

File diff suppressed because it is too large Load Diff

1353
po/uk.po

File diff suppressed because it is too large Load Diff

1546
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

@@ -3,7 +3,8 @@
* browser.c *
* *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
* 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
* 2010, 2011, 2013, 2014, 2015 Free Software Foundation, Inc. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -23,6 +24,7 @@
#include "proto.h"
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -39,10 +41,9 @@ static int width = 0;
static int longest = 0;
/* The number of columns in the longest filename in the list. */
static size_t selected = 0;
/* The currently selected filename in the list. This variable
* is zero-based. */
static bool search_last_file = FALSE;
/* Have we gone past the last file while searching? */
/* The currently selected filename in the list; zero-based. */
static char *path_save = NULL;
/* A copy of the current path. */
/* Our main file browser function. path is the tilde-expanded path we
* start browsing from. */
@@ -52,8 +53,7 @@ char *do_browser(char *path, DIR *dir)
int kbinput;
bool old_const_update = ISSET(CONST_UPDATE);
char *prev_dir = NULL;
/* The directory we were in, if any, before backing up via
* browsing to "..". */
/* The directory we were in before backing up to "..". */
char *ans = NULL;
/* The last answer the user typed at the statusbar prompt. */
size_t old_selected;
@@ -63,7 +63,6 @@ char *do_browser(char *path, DIR *dir)
curs_set(0);
blank_statusbar();
currmenu = MBROWSER;
bottombars(MBROWSER);
wnoutrefresh(bottomwin);
@@ -79,6 +78,9 @@ char *do_browser(char *path, DIR *dir)
path = mallocstrassn(path, get_full_path(path));
/* Save the current path in order to be used later. */
path_save = path;
assert(path != NULL && path[strlen(path) - 1] == '/');
/* Get the file list, and set longest and width in the process. */
@@ -92,7 +94,7 @@ char *do_browser(char *path, DIR *dir)
/* If prev_dir isn't NULL, select the directory saved in it, and
* then blow it away. */
if (prev_dir != NULL) {
browser_select_filename(prev_dir);
browser_select_dirname(prev_dir);
free(prev_dir);
prev_dir = NULL;
@@ -122,6 +124,14 @@ char *do_browser(char *path, DIR *dir)
kbinput = get_kbinput(edit);
#ifndef NANO_TINY
if (kbinput == KEY_WINCH) {
kbinput = ERR;
curs_set(0);
continue;
}
#endif
#ifndef DISABLE_MOUSE
if (kbinput == KEY_MOUSE) {
int mouse_x, mouse_y;
@@ -137,21 +147,18 @@ char *do_browser(char *path, DIR *dir)
width) + (mouse_x / (longest + 2));
/* If they clicked beyond the end of a row,
* select the filename at the end of that
* row. */
* select the last filename in that row. */
if (mouse_x > width * (longest + 2))
selected--;
/* If we're off the screen, select the last
* filename. */
/* If we're off the screen, select the last filename. */
if (selected > filelist_len - 1)
selected = filelist_len - 1;
/* If we selected the same filename as last
* time, put back the Enter key so that it's
* read in. */
/* If we selected the same filename as last time,
* put back the Enter key so that it's read in. */
if (old_selected == selected)
unget_kbinput(sc_seq_or(do_enter_void, 0), FALSE, FALSE);
unget_kbinput(sc_seq_or(do_enter, 0), FALSE, FALSE);
}
}
#endif /* !DISABLE_MOUSE */
@@ -163,9 +170,11 @@ char *do_browser(char *path, DIR *dir)
} else if (func == do_help_void) {
#ifndef DISABLE_HELP
do_help_void();
/* Perhaps the window dimensions have changed. */
browser_refresh();
curs_set(0);
#else
nano_disabled_msg();
say_there_is_no_help();
#endif
} else if (func == do_search) {
/* Search for a filename. */
@@ -203,16 +212,12 @@ char *do_browser(char *path, DIR *dir)
browser_refresh, _("Go To Directory"));
curs_set(0);
currmenu = MBROWSER;
bottombars(MBROWSER);
/* 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
@@ -224,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);
@@ -268,16 +268,16 @@ char *do_browser(char *path, DIR *dir)
} else if (func == do_up_void) {
if (selected >= width)
selected -= width;
} else if (func == do_left) {
if (selected > 0)
selected--;
} else if (func == do_down_void) {
if (selected + width <= filelist_len - 1)
selected += width;
} else if (func == do_left) {
if (selected > 0)
selected--;
} else if (func == do_right) {
if (selected < filelist_len - 1)
selected++;
} else if (func == do_enter_void) {
} else if (func == do_enter) {
/* We can't move up from "/". */
if (strcmp(filelist[selected], "/..") == 0) {
statusbar(_("Can't move up a directory"));
@@ -398,8 +398,7 @@ char *do_browse_from(const char *inpath)
/* If we can't open the path, get out. */
if (dir == NULL) {
if (path != NULL)
free(path);
free(path);
beep();
return NULL;
}
@@ -429,31 +428,31 @@ void browser_init(const char *path, DIR *dir)
assert(path != NULL && path[strlen(path) - 1] == '/' && dir != NULL);
/* Set longest to zero, just before we initialize it. */
longest = 0;
/* Find the length of the longest filename in the current folder. */
while ((nextdir = readdir(dir)) != NULL) {
size_t d_len;
size_t name_len = strlenpt(nextdir->d_name);
/* Don't show the "." entry. */
if (strcmp(nextdir->d_name, ".") == 0)
continue;
d_len = strlenpt(nextdir->d_name);
if (d_len > longest)
longest = (d_len > COLS) ? COLS : d_len;
if (name_len > longest)
longest = name_len;
i++;
}
rewinddir(dir);
/* Put 10 columns' worth of blank space between columns of filenames
/* Put 10 characters' worth of blank space between columns of filenames
* in the list whenever possible, as Pico does. */
longest += 10;
if (filelist != NULL)
free_chararray(filelist, filelist_len);
/* Make sure longest is between 15 and COLS. */
if (longest < 15)
longest = 15;
if (longest > COLS)
longest = COLS;
rewinddir(dir);
free_chararray(filelist, filelist_len);
filelist_len = i;
@@ -479,12 +478,6 @@ void browser_init(const char *path, DIR *dir)
closedir(dir);
/* Make sure longest is between 15 and COLS. */
if (longest < 15)
longest = 15;
if (longest > COLS)
longest = COLS;
/* Set width to zero, just before we initialize it. */
width = 0;
@@ -536,7 +529,7 @@ functionptrtype parse_browser_input(int *kbinput)
return goto_dir_void;
case 'S':
case 's':
return do_enter_void;
return do_enter;
case 'W':
case 'w':
return do_search;
@@ -549,20 +542,21 @@ functionptrtype parse_browser_input(int *kbinput)
* necessary, and display the list of files. */
void browser_refresh(void)
{
static int uimax_digits = -1;
size_t i;
int col = 0;
/* The maximum number of columns that the filenames will take
* up. */
int line = 0;
/* The maximum number of lines that the filenames will take
* up. */
int line = 0, col = 0;
/* The current line and column while the list is getting displayed. */
char *foo;
/* The file information that we'll display. */
/* The additional information that we'll display about a file. */
if (uimax_digits == -1)
uimax_digits = digits(UINT_MAX);
/* Perhaps window dimensions have changed; reinitialize the browser. */
browser_init(path_save, opendir(path_save));
qsort(filelist, filelist_len, sizeof(char *), diralphasort);
/* Make sure the selected file is within range. */
if (selected >= filelist_len)
selected = filelist_len - 1;
titlebar(path_save);
blank_edit();
wmove(edit, 0, 0);
@@ -581,8 +575,7 @@ void browser_refresh(void)
/* The maximum length of the file information in
* columns: seven for "--", "(dir)", or the file size,
* and 12 for "(parent dir)". */
bool dots = (COLS >= 15 && filetaillen >= longest -
foomaxlen - 1);
bool dots = (COLS >= 15 && filetaillen >= longest - foomaxlen);
/* Do we put an ellipsis before the filename? Don't set
* this to TRUE if we have fewer than 15 columns (i.e.
* one column for padding, plus seven columns for a
@@ -594,15 +587,13 @@ void browser_refresh(void)
* "(dir)", or the file size, plus three columns for the
* ellipsis. */
/* Start highlighting the currently selected file or
* directory. */
/* Start highlighting the currently selected file or directory. */
if (i == selected)
wattron(edit, hilite_attribute);
blank_line(edit, line, col, longest);
/* If dots is TRUE, we will display something like
* "...ename". */
/* If dots is TRUE, we will display something like "...ename". */
if (dots)
mvwaddstr(edit, line, col, "...");
mvwaddstr(edit, line, dots ? col + 3 : col, disp);
@@ -622,42 +613,43 @@ void browser_refresh(void)
/* If the file is a symlink that points to a directory,
* display it as a directory. */
else
/* TRANSLATORS: Try to keep this at most 7
* characters. */
/* TRANSLATORS: Try to keep this at most 7 characters. */
foo = mallocstrcpy(NULL, _("(dir)"));
} else if (S_ISDIR(st.st_mode)) {
/* If the file is a directory, display it as such. */
if (strcmp(filetail, "..") == 0) {
/* TRANSLATORS: Try to keep this at most 12
* characters. */
/* TRANSLATORS: Try to keep this at most 12 characters. */
foo = mallocstrcpy(NULL, _("(parent dir)"));
foomaxlen = 12;
} else
foo = mallocstrcpy(NULL, _("(dir)"));
} else {
unsigned long result = st.st_size;
off_t result = st.st_size;
char modifier;
foo = charalloc(uimax_digits + 4);
foo = charalloc(foomaxlen + 1);
/* Bytes. */
if (st.st_size < (1 << 10))
modifier = ' ';
/* Kilobytes. */
modifier = ' '; /* bytes */
else if (st.st_size < (1 << 20)) {
result >>= 10;
modifier = 'K';
/* Megabytes. */
modifier = 'K'; /* kilobytes */
} else if (st.st_size < (1 << 30)) {
result >>= 20;
modifier = 'M';
/* Gigabytes. */
modifier = 'M'; /* megabytes */
} else {
result >>= 30;
modifier = 'G';
modifier = 'G'; /* gigabytes */
}
sprintf(foo, "%4lu %cB", result, modifier);
/* Show the size if less than a terabyte,
* otherwise show "(huge)". */
if (result < (1 << 10))
sprintf(foo, "%4ju %cB", (intmax_t)result, modifier);
else
/* TRANSLATORS: Try to keep this at most 7 characters.
* If necessary, you can leave out the parentheses. */
foo = mallocstrcpy(foo, _("(huge)"));
}
/* Make sure foo takes up no more than foomaxlen columns. */
@@ -669,8 +661,7 @@ void browser_refresh(void)
mvwaddstr(edit, line, col - foolen, foo);
/* Finish highlighting the currently selected file or
* directory. */
/* Finish highlighting the currently selected file or directory. */
if (i == selected)
wattroff(edit, hilite_attribute);
@@ -692,56 +683,34 @@ void browser_refresh(void)
wnoutrefresh(edit);
}
/* Look for needle. If we find it, set selected to its location. Note
* that needle must be an exact match for a file in the list. The
* return value specifies whether we found anything. */
bool browser_select_filename(const char *needle)
/* Look for needle. If we find it, set selected to its location.
* Note that needle must be an exact match for a file in the list. */
void browser_select_dirname(const char *needle)
{
size_t currselected;
bool found = FALSE;
size_t looking_at = 0;
for (currselected = 0; currselected < filelist_len;
currselected++) {
if (strcmp(filelist[currselected], needle) == 0) {
found = TRUE;
for (; looking_at < filelist_len; looking_at++) {
if (strcmp(filelist[looking_at], needle) == 0) {
selected = looking_at;
break;
}
}
if (found)
selected = currselected;
return found;
}
/* Set up the system variables for a filename search. Return -1 if the
* search should be canceled (due to Cancel, a blank search string, or a
* failed regcomp()), return 0 on success, and return 1 on rerun calling
* program. */
/* Set up the system variables for a filename search. Return -1 or -2 if
* the search should be canceled (due to Cancel or a blank search string),
* return 0 when we have a string, and return a positive value when some
* function was run. */
int filesearch_init(void)
{
int i = 0;
int input;
char *buf;
static char *backupstring = NULL;
/* The search string we'll be using. */
/* If backupstring doesn't exist, initialize it to "". */
if (backupstring == NULL)
backupstring = mallocstrcpy(NULL, "");
/* We display the search prompt below. If the user types a partial
* search string and then Replace or a toggle, we will return to
* do_search() or do_replace() and be called again. In that case,
* we should put the same search string back up. */
search_init_globals();
if (last_search[0] != '\0') {
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
buf = charalloc(strlen(disp) + 7);
/* We use (COLS / 3) here because we need to see more on the
* line. */
/* We use (COLS / 3) here because we need to see more on the line. */
sprintf(buf, " [%s%s]", disp,
(strlenpt(last_search) > COLS / 3) ? "..." : "");
free(disp);
@@ -749,11 +718,11 @@ int filesearch_init(void)
buf = mallocstrcpy(NULL, "");
/* This is now one simple call. It just does a lot. */
i = do_prompt(FALSE,
input = do_prompt(FALSE,
#ifndef DISABLE_TABCOMP
TRUE,
#endif
MWHEREISFILE, backupstring,
MWHEREISFILE, NULL,
#ifndef DISABLE_HISTORIES
&search_history,
#endif
@@ -762,100 +731,92 @@ int filesearch_init(void)
/* Release buf now that we don't need it anymore. */
free(buf);
free(backupstring);
backupstring = NULL;
/* If only Enter was pressed but we have a previous string, it's okay. */
if (input == -2 && *last_search != '\0')
return 0;
/* Cancel any search, or just return with no previous search. */
if (i == -1 || (i < 0 && *last_search == '\0') || (i == 0 &&
*answer == '\0')) {
/* Otherwise negative inputs are a bailout. */
if (input < 0)
statusbar(_("Cancelled"));
return -1;
}
return 0;
return input;
}
/* Look for needle. If no_sameline is TRUE, skip over selected when
* looking for needle. begin is the location of the filename where we
* first started searching. The return value specifies whether we found
* anything. */
bool findnextfile(bool no_sameline, size_t begin, const char *needle)
/* Look for the given needle in the list of files. */
void findnextfile(const char *needle)
{
size_t currselected = selected;
/* The location in the current file list of the match we
* find. */
const char *filetail = tail(filelist[currselected]);
size_t looking_at = selected;
/* The location in the file list of the filename we're looking at. */
bool came_full_circle = FALSE;
/* Have we reached the starting file again? */
const char *filetail = tail(filelist[looking_at]);
/* The filename we display, minus the path. */
const char *rev_start = filetail, *found = NULL;
unsigned stash[sizeof(flags) / sizeof(flags[0])];
/* A storage place for the current flag settings. */
/* Look for needle in the current filename we're searching. */
/* Save the settings of all flags. */
memcpy(stash, flags, sizeof(flags));
/* Search forward, case insensitive and without regexes. */
UNSET(BACKWARDS_SEARCH);
UNSET(CASE_SENSITIVE);
UNSET(USE_REGEXP);
/* Step through each filename in the list until a match is found or
* we've come back to the point where we started. */
while (TRUE) {
found = strstrwrapper(filetail, needle, rev_start);
/* We've found a potential match. If we're not allowed to find
* a match on the same filename we started on and this potential
* match is on that line, continue searching. */
if (found != NULL && (!no_sameline || currselected != begin))
/* If we've found a match and it's not the same filename where
* we started, then we're done. */
if (found != NULL && looking_at != selected)
break;
/* We've finished processing the filenames, so get out. */
if (search_last_file) {
/* If we've found a match and we're back at the beginning, then
* it's the only occurrence. */
if (found != NULL && came_full_circle) {
statusbar(_("This is the only occurrence"));
break;
}
if (came_full_circle) {
/* We're back at the beginning and didn't find anything. */
not_found_msg(needle);
return FALSE;
return;
}
/* Move to the next filename in the list. If we've reached the
* end of the list, wrap around. */
if (currselected < filelist_len - 1)
currselected++;
if (looking_at < filelist_len - 1)
looking_at++;
else {
currselected = 0;
looking_at = 0;
statusbar(_("Search Wrapped"));
}
/* We've reached the original starting file. */
if (currselected == begin)
search_last_file = TRUE;
if (looking_at == selected)
/* We've reached the original starting file. */
came_full_circle = TRUE;
filetail = tail(filelist[currselected]);
filetail = tail(filelist[looking_at]);
rev_start = filetail;
}
/* We've definitely found something. */
selected = currselected;
/* Restore the settings of all flags. */
memcpy(flags, stash, sizeof(flags));
return TRUE;
}
/* Clear the flag indicating that a search reached the last file in the
* list. We need to do this just before a new search. */
void findnextfile_wrap_reset(void)
{
search_last_file = FALSE;
}
/* Abort the current filename search. Clean up by setting the current
* shortcut list to the browser shortcut list, and displaying it. */
void filesearch_abort(void)
{
currmenu = MBROWSER;
bottombars(MBROWSER);
/* Select the one we've found. */
selected = looking_at;
}
/* Search for a filename. */
void do_filesearch(void)
{
size_t begin = selected;
bool didfind;
UNSET(CASE_SENSITIVE);
UNSET(USE_REGEXP);
UNSET(BACKWARDS_SEARCH);
if (filesearch_init() != 0) {
/* Cancelled or a blank search string. */
filesearch_abort();
/* Cancelled, or a blank search string, or done something. */
bottombars(MBROWSER);
return;
}
@@ -872,50 +833,18 @@ void do_filesearch(void)
update_history(&search_history, answer);
#endif
findnextfile_wrap_reset();
didfind = findnextfile(FALSE, begin, answer);
findnextfile(answer);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
if (selected == begin && didfind) {
/* Do the search again, skipping over the current line. We
* should only end up back at the same position if the string
* isn't found again, in which case it's the only occurrence. */
didfind = findnextfile(TRUE, begin, answer);
if (selected == begin && !didfind)
statusbar(_("This is the only occurrence"));
}
filesearch_abort();
bottombars(MBROWSER);
}
/* Search for the last filename without prompting. */
/* Search for the last given filename again without prompting. */
void do_fileresearch(void)
{
size_t begin = selected;
bool didfind;
search_init_globals();
if (last_search[0] != '\0') {
findnextfile_wrap_reset();
didfind = findnextfile(FALSE, begin, answer);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
if (selected == begin && didfind) {
/* Do the search again, skipping over the current line. We
* should only end up back at the same position if the
* string isn't found again, in which case it's the only
* occurrence. */
didfind = findnextfile(TRUE, begin, answer);
if (selected == begin && !didfind)
statusbar(_("This is the only occurrence"));
}
} else
statusbar(_("No current search pattern"));
filesearch_abort();
if (last_search[0] == '\0')
statusbar(_("No current search pattern"));
else
findnextfile(last_search);
}
/* Select the first file in the list. */

View File

@@ -484,12 +484,18 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
* before the one at pos. */
size_t move_mbleft(const char *buf, size_t pos)
{
size_t before = 0, char_len = 0;
size_t before, char_len = 0;
assert(buf != NULL && pos <= strlen(buf));
/* There is no library function to move backward one multibyte
* character. Here is the naive, O(pos) way to do it. */
* character. So we just start groping for one at the farthest
* possible point. */
if (mb_cur_max() > pos)
before = 0;
else
before = pos - mb_cur_max();
while (before < pos) {
char_len = parse_mbchar(buf + before, NULL, NULL);
before += char_len;
@@ -630,7 +636,8 @@ char *mbstrcasestr(const char *haystack, const char *needle)
for (; *haystack != '\0' && haystack_len >= needle_len;
haystack += move_mbright(haystack, 0), haystack_len--) {
if (mbstrncasecmp(haystack, needle, needle_len) == 0)
if (mbstrncasecmp(haystack, needle, needle_len) == 0 &&
mblen(haystack, MB_CUR_MAX) > 0)
return (char *)haystack;
}
@@ -723,8 +730,9 @@ char *mbrevstrcasestr(const char *haystack, const char *needle, const
rev_start_len = mbstrlen(rev_start);
while (!begin_line) {
if (rev_start_len >= needle_len && mbstrncasecmp(rev_start,
needle, needle_len) == 0)
if (rev_start_len >= needle_len &&
mbstrncasecmp(rev_start, needle, needle_len) == 0 &&
mblen(rev_start, MB_CUR_MAX) > 0)
return (char *)rev_start;
if (rev_start == haystack)

View File

@@ -3,7 +3,7 @@
* color.c *
* *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
* 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
* 2010, 2011, 2013, 2014, 2015 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -26,6 +26,8 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <unistd.h>
#ifdef HAVE_MAGIC_H
#include <magic.h>
@@ -33,31 +35,34 @@
#ifndef DISABLE_COLOR
/* For each syntax list entry, go through the list of colors and assign
* the color pairs. */
/* Initialize the colors for nano's interface, and assign pair numbers
* for the colors in each syntax. */
void set_colorpairs(void)
{
const syntaxtype *this_syntax = syntaxes;
bool defok = FALSE;
short fg, bg;
bool using_defaults = FALSE;
short foreground, background;
size_t i;
/* Tell ncurses to enable colors. */
start_color();
#ifdef HAVE_USE_DEFAULT_COLORS
/* Use the default colors, if available. */
defok = (use_default_colors() != ERR);
/* Allow using the default colors, if available. */
using_defaults = (use_default_colors() != ERR);
#endif
/* Initialize the color pairs for nano's interface elements. */
for (i = 0; i < NUMBER_OF_ELEMENTS; i++) {
bool bright = FALSE;
if (parse_color_names(specified_color_combo[i], &fg, &bg, &bright)) {
if (fg == -1 && !defok)
fg = COLOR_WHITE;
if (bg == -1 && !defok)
bg = COLOR_BLACK;
init_pair(i + 1, fg, bg);
if (parse_color_names(specified_color_combo[i],
&foreground, &background, &bright)) {
if (foreground == -1 && !using_defaults)
foreground = COLOR_WHITE;
if (background == -1 && !using_defaults)
background = COLOR_BLACK;
init_pair(i + 1, foreground, background);
interface_color_pair[i].bright = bright;
interface_color_pair[i].pairnum = COLOR_PAIR(i + 1);
}
@@ -69,12 +74,12 @@ void set_colorpairs(void)
interface_color_pair[i].pairnum = A_NORMAL;
}
if (specified_color_combo[i] != NULL) {
free(specified_color_combo[i]);
specified_color_combo[i] = NULL;
}
free(specified_color_combo[i]);
specified_color_combo[i] = NULL;
}
/* For each syntax, go through its list of colors and assign each
* its pair number, giving identical color pairs the same number. */
for (; this_syntax != NULL; this_syntax = this_syntax->next) {
colortype *this_color = this_syntax->color;
int clr_pair = NUMBER_OF_ELEMENTS + 1;
@@ -82,12 +87,11 @@ void set_colorpairs(void)
for (; this_color != NULL; this_color = this_color->next) {
const colortype *beforenow = this_syntax->color;
for (; beforenow != this_color &&
(beforenow->fg != this_color->fg ||
beforenow->bg != this_color->bg ||
beforenow->bright != this_color->bright);
beforenow = beforenow->next)
;
while (beforenow != this_color &&
(beforenow->fg != this_color->fg ||
beforenow->bg != this_color->bg ||
beforenow->bright != this_color->bright))
beforenow = beforenow->next;
if (beforenow != this_color)
this_color->pairnum = beforenow->pairnum;
@@ -102,38 +106,36 @@ void set_colorpairs(void)
/* Initialize the color information. */
void color_init(void)
{
colortype *tmpcolor = openfile->colorstrings;
bool using_defaults = FALSE;
short foreground, background;
assert(openfile != NULL);
if (has_colors()) {
const colortype *tmpcolor;
/* If the terminal is not capable of colors, forget it. */
if (!has_colors())
return;
#ifdef HAVE_USE_DEFAULT_COLORS
/* Use the default colors, if available. */
bool defok = (use_default_colors() != ERR);
/* Allow using the default colors, if available. */
using_defaults = (use_default_colors() != ERR);
#endif
for (tmpcolor = openfile->colorstrings; tmpcolor != NULL;
tmpcolor = tmpcolor->next) {
short foreground = tmpcolor->fg, background = tmpcolor->bg;
if (foreground == -1) {
#ifdef HAVE_USE_DEFAULT_COLORS
if (!defok)
#endif
foreground = COLOR_WHITE;
}
/* For each coloring expression, initialize the color pair. */
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
foreground = tmpcolor->fg;
background = tmpcolor->bg;
if (background == -1) {
#ifdef HAVE_USE_DEFAULT_COLORS
if (!defok)
#endif
background = COLOR_BLACK;
}
if (foreground == -1 && !using_defaults)
foreground = COLOR_WHITE;
init_pair(tmpcolor->pairnum, foreground, background);
if (background == -1 && !using_defaults)
background = COLOR_BLACK;
init_pair(tmpcolor->pairnum, foreground, background);
#ifdef DEBUG
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", tmpcolor->fg, tmpcolor->bg);
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", foreground, background);
#endif
}
}
}
@@ -181,12 +183,30 @@ void color_update(void)
if (openfile->colorstrings != NULL)
break;
}
if (openfile->colorstrings == NULL)
statusbar(_("Unknown syntax name: %s"), syntaxstr);
}
/* If we didn't specify a syntax override string, or if we did and
* there was no syntax by that name, get the syntax based on the
* file extension, then try the headerline, and then try magic. */
if (openfile->colorstrings == NULL) {
char *currentdir = getcwd(NULL, PATH_MAX + 1);
char *joinednames = charalloc(PATH_MAX + 1);
char *fullname = NULL;
if (currentdir != NULL) {
/* Concatenate the current working directory with the
* specified filename, and canonicalize the result. */
sprintf(joinednames, "%s/%s", currentdir, openfile->filename);
fullname = realpath(joinednames, NULL);
free(currentdir);
}
if (fullname == NULL)
fullname = mallocstrcpy(fullname, openfile->filename);
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) {
@@ -211,7 +231,7 @@ void color_update(void)
}
/* Set colorstrings if we match the extension regex. */
if (regexec(e->ext, openfile->filename, 0, NULL, 0) == 0) {
if (regexec(e->ext, fullname, 0, NULL, 0) == 0) {
openfile->syntax = tmpsyntax;
openfile->colorstrings = tmpsyntax->color;
break;
@@ -224,6 +244,9 @@ void color_update(void)
}
}
free(joinednames);
free(fullname);
/* Check the headerline if the extension didn't match anything. */
if (openfile->colorstrings == NULL) {
#ifdef DEBUG
@@ -269,9 +292,9 @@ void color_update(void)
/* Open the magic database and get a diagnosis of the file. */
cookie = magic_open(MAGIC_SYMLINK |
#ifdef DEBUG
MAGIC_DEBUG | MAGIC_CHECK |
MAGIC_DEBUG | MAGIC_CHECK |
#endif
MAGIC_ERROR);
MAGIC_ERROR);
if (cookie == NULL || magic_load(cookie, NULL) < 0)
statusbar(_("magic_load() failed: %s"), strerror(errno));
else {
@@ -345,107 +368,235 @@ void color_update(void)
}
}
/* Reset the multicolor info cache for records for any lines which need
* to be recalculated. */
void reset_multis_after(filestruct *fileptr, int mindex)
/* Reset the multiline coloring cache for one specific regex (given by
* index) for lines that need reevaluation. */
void reset_multis_for_id(filestruct *fileptr, int index)
{
filestruct *oof;
for (oof = fileptr->next; oof != NULL; oof = oof->next) {
alloc_multidata_if_needed(oof);
if (oof->multidata == NULL)
continue;
if (oof->multidata[mindex] != CNONE)
oof->multidata[mindex] = -1;
else
filestruct *row;
/* Reset the cache of earlier lines, as far back as needed. */
for (row = fileptr->prev; row != NULL; row = row->prev) {
alloc_multidata_if_needed(row);
if (row->multidata[index] == CNONE)
break;
row->multidata[index] = -1;
}
for (; oof != NULL; oof = oof->next) {
alloc_multidata_if_needed(oof);
if (oof->multidata == NULL)
continue;
if (oof->multidata[mindex] == CNONE)
oof->multidata[mindex] = -1;
else
for (; row != NULL; row = row->prev) {
alloc_multidata_if_needed(row);
if (row->multidata[index] != CNONE)
break;
row->multidata[index] = -1;
}
/* Reset the cache of the current line. */
fileptr->multidata[index] = -1;
/* Reset the cache of later lines, as far ahead as needed. */
for (row = fileptr->next; row != NULL; row = row->next) {
alloc_multidata_if_needed(row);
if (row->multidata[index] == CNONE)
break;
row->multidata[index] = -1;
}
for (; row != NULL; row = row->next) {
alloc_multidata_if_needed(row);
if (row->multidata[index] != CNONE)
break;
row->multidata[index] = -1;
}
edit_refresh_needed = TRUE;
}
void reset_multis_before(filestruct *fileptr, int mindex)
{
filestruct *oof;
for (oof = fileptr->prev; oof != NULL; oof = oof->prev) {
alloc_multidata_if_needed(oof);
if (oof->multidata == NULL)
continue;
if (oof->multidata[mindex] != CNONE)
oof->multidata[mindex] = -1;
else
break;
}
for (; oof != NULL; oof = oof->prev) {
alloc_multidata_if_needed(oof);
if (oof->multidata == NULL)
continue;
if (oof->multidata[mindex] == CNONE)
oof->multidata[mindex] = -1;
else
break;
}
edit_refresh_needed = TRUE;
}
/* Reset one multiline regex info. */
void reset_multis_for_id(filestruct *fileptr, int num)
{
reset_multis_before(fileptr, num);
reset_multis_after(fileptr, num);
fileptr->multidata[num] = -1;
}
/* Reset multi-line strings around a filestruct ptr, trying to be smart
* about stopping. Bool force means: reset everything regardless, useful
* when we don't know how much screen state has changed. */
/* Reset multi-line strings around the filestruct fileptr, trying to be
* smart about stopping. Bool force means: reset everything regardless,
* useful when we don't know how much screen state has changed. */
void reset_multis(filestruct *fileptr, bool force)
{
int nobegin, noend;
regmatch_t startmatch, endmatch;
const colortype *tmpcolor = openfile->colorstrings;
if (!openfile->syntax)
/* If there is no syntax or no multiline regex, there is nothing to do. */
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0)
return;
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
/* If it's not a multi-line regex, amscray. */
if (tmpcolor->end == NULL)
continue;
alloc_multidata_if_needed(fileptr);
if (force == TRUE) {
reset_multis_for_id(fileptr, tmpcolor->id);
continue;
if (force == FALSE) {
/* Check whether the multidata still matches the current situation. */
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
if ((fileptr->multidata[tmpcolor->id] == CWHOLELINE ||
fileptr->multidata[tmpcolor->id] == CNONE) &&
nobegin && noend)
continue;
else if (fileptr->multidata[tmpcolor->id] == CSTARTENDHERE &&
!nobegin && !noend && startmatch.rm_so < endmatch.rm_so)
continue;
else if (fileptr->multidata[tmpcolor->id] == CBEGINBEFORE &&
nobegin && !noend)
continue;
else if (fileptr->multidata[tmpcolor->id] == CENDAFTER &&
!nobegin && noend)
continue;
}
/* Figure out where the first begin and end are to determine if
* things changed drastically for the precalculated multi values. */
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
if (fileptr->multidata[tmpcolor->id] == CWHOLELINE) {
if (nobegin && noend)
continue;
} else if (fileptr->multidata[tmpcolor->id] == CNONE) {
if (nobegin && noend)
continue;
} else if (fileptr->multidata[tmpcolor->id] & CBEGINBEFORE && !noend
&& (nobegin || endmatch.rm_eo > startmatch.rm_eo)) {
reset_multis_after(fileptr, tmpcolor->id);
continue;
}
/* If we got here, assume the worst. */
/* If we got here, things have changed. */
reset_multis_for_id(fileptr, tmpcolor->id);
}
}
/* Allocate (for one line) the cache space for multiline color regexes. */
void alloc_multidata_if_needed(filestruct *fileptr)
{
int i;
if (fileptr->multidata == NULL) {
fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
for (i = 0; i < openfile->syntax->nmultis; i++)
fileptr->multidata[i] = -1;
}
}
/* Poll the keyboard every second to see if the user starts typing. */
bool key_was_pressed(void)
{
static time_t last_time = 0;
if (time(NULL) != last_time) {
last_time = time(NULL);
return (wgetch(edit) != ERR);
} else
return FALSE;
}
/* Precalculate the multi-line start and end regex info so we can
* speed up rendering (with any hope at all...). */
void precalc_multicolorinfo(void)
{
const colortype *tmpcolor = openfile->colorstrings;
regmatch_t startmatch, endmatch;
filestruct *fileptr, *endptr;
if (openfile->colorstrings == NULL || ISSET(NO_COLOR_SYNTAX))
return;
#ifdef DEBUG
fprintf(stderr, "Entering precalculation of multiline color info\n");
#endif
/* Let us get keypresses to see if the user is trying to start
* editing. Later we may want to throw up a statusbar message
* before starting this if it takes too long to do this routine.
* For now silently abort if they hit a key. */
nodelay(edit, TRUE);
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
/* If this is not a multi-line regex, skip it. */
if (tmpcolor->end == NULL)
continue;
#ifdef DEBUG
fprintf(stderr, "Starting work on color id %d\n", tmpcolor->id);
#endif
for (fileptr = openfile->fileage; fileptr != NULL; fileptr = fileptr->next) {
int startx = 0, nostart = 0;
if (key_was_pressed())
goto precalc_cleanup;
#ifdef DEBUG
fprintf(stderr, "working on lineno %ld... ", (long)fileptr->lineno);
#endif
alloc_multidata_if_needed(fileptr);
while ((nostart = regexec(tmpcolor->start, &fileptr->data[startx],
1, &startmatch, (startx == 0) ? 0 : REG_NOTBOL)) == 0) {
/* Look for an end, and start marking how many lines are
* encompassed, which should speed up rendering later. */
startx += startmatch.rm_eo;
#ifdef DEBUG
fprintf(stderr, "start found at pos %lu... ", (unsigned long)startx);
#endif
/* Look first on this line for an end. */
if (regexec(tmpcolor->end, &fileptr->data[startx], 1,
&endmatch, (startx == 0) ? 0 : REG_NOTBOL) == 0) {
startx += endmatch.rm_eo;
/* Step ahead when both start and end are mere anchors. */
if (startmatch.rm_so == startmatch.rm_eo &&
endmatch.rm_so == endmatch.rm_eo)
startx += 1;
fileptr->multidata[tmpcolor->id] = CSTARTENDHERE;
#ifdef DEBUG
fprintf(stderr, "end found on this line\n");
#endif
continue;
}
/* Nice, we didn't find the end regex on this line. Let's start looking for it. */
for (endptr = fileptr->next; endptr != NULL; endptr = endptr->next) {
#ifdef DEBUG
fprintf(stderr, "\nadvancing to line %ld to find end... ", (long)endptr->lineno);
#endif
/* Check for interrupting keyboard input again. */
if (key_was_pressed())
goto precalc_cleanup;
if (regexec(tmpcolor->end, endptr->data, 1, &endmatch, 0) == 0)
break;
}
if (endptr == NULL) {
#ifdef DEBUG
fprintf(stderr, "no end found, breaking out\n");
#endif
break;
}
#ifdef DEBUG
fprintf(stderr, "end found\n");
#endif
/* We found it, we found it, la la la la la. Mark all
* the lines in between and the end properly. */
fileptr->multidata[tmpcolor->id] = CENDAFTER;
#ifdef DEBUG
fprintf(stderr, "marking line %ld as CENDAFTER\n", (long)fileptr->lineno);
#endif
for (fileptr = fileptr->next; fileptr != endptr; fileptr = fileptr->next) {
alloc_multidata_if_needed(fileptr);
fileptr->multidata[tmpcolor->id] = CWHOLELINE;
#ifdef DEBUG
fprintf(stderr, "marking intermediary line %ld as CWHOLELINE\n", (long)fileptr->lineno);
#endif
}
alloc_multidata_if_needed(endptr);
fileptr->multidata[tmpcolor->id] = CBEGINBEFORE;
#ifdef DEBUG
fprintf(stderr, "marking line %ld as CBEGINBEFORE\n", (long)fileptr->lineno);
#endif
/* Skip to the end point of the match. */
startx = endmatch.rm_eo;
#ifdef DEBUG
fprintf(stderr, "jumping to line %ld pos %lu to continue\n", (long)fileptr->lineno, (unsigned long)startx);
#endif
}
if (nostart && startx == 0) {
#ifdef DEBUG
fprintf(stderr, "no match\n");
#endif
fileptr->multidata[tmpcolor->id] = CNONE;
continue;
}
}
}
precalc_cleanup:
nodelay(edit, FALSE);
}
#endif /* !DISABLE_COLOR */

View File

@@ -28,10 +28,8 @@
static bool keep_cutbuffer = FALSE;
/* Should we keep the contents of the cutbuffer? */
/* Pointer to the end of the cutbuffer. */
/* Indicate that we should no longer keep the contents of the
* cutbuffer. */
/* Indicate that we should no longer keep the contents of the cutbuffer. */
void cutbuffer_reset(void)
{
keep_cutbuffer = FALSE;
@@ -50,11 +48,6 @@ inline bool keeping_cutbuffer(void)
* current line. */
void cut_line(void)
{
#ifndef NANO_TINY
if (!openfile->mark_begin)
openfile->mark_begin = openfile->current;
#endif
if (openfile->current != openfile->filebot)
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current, 0,
openfile->current->next, 0);
@@ -73,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();
@@ -112,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 */
@@ -124,7 +117,7 @@ void cut_to_eof(void)
* position to the end of the file into the cutbuffer. */
void do_cut_text(
#ifndef NANO_TINY
bool copy_text, bool cut_till_eof, bool undoing
bool copy_text, bool cut_till_eof
#else
void
#endif
@@ -132,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. */
@@ -167,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
@@ -214,17 +202,10 @@ void do_cut_text(
* disturbing the text. */
if (!old_no_newlines)
UNSET(NO_NEWLINES);
} else if (!undoing)
update_undo(cut_till_eof ? CUT_EOF : CUT);
/* Leave the text in the cutbuffer, and mark the file as
* modified. */
if (!copy_text) {
set_modified();
}
} else
#endif /* !NANO_TINY */
set_modified();
/* Update the screen. */
edit_refresh_needed = TRUE;
#ifndef DISABLE_COLOR
@@ -241,12 +222,11 @@ void do_cut_text_void(void)
{
#ifndef NANO_TINY
add_undo(CUT);
do_cut_text(FALSE, FALSE);
update_undo(CUT);
#else
do_cut_text();
#endif
do_cut_text(
#ifndef NANO_TINY
FALSE, FALSE, FALSE
#endif
);
}
#ifndef NANO_TINY
@@ -261,7 +241,7 @@ void do_copy_text(void)
if (mark_set || openfile->current != next_contiguous_line)
cutbuffer_reset();
do_cut_text(TRUE, FALSE, FALSE);
do_cut_text(TRUE, FALSE);
/* If the mark was set, blow away the cutbuffer on the next copy. */
next_contiguous_line = (mark_set ? NULL : openfile->current);
@@ -271,7 +251,8 @@ void do_copy_text(void)
void do_cut_till_eof(void)
{
add_undo(CUT_EOF);
do_cut_text(FALSE, TRUE, FALSE);
do_cut_text(FALSE, TRUE);
update_undo(CUT_EOF);
}
#endif /* !NANO_TINY */
@@ -303,7 +284,6 @@ void do_uncut_text(void)
/* Mark the file as modified. */
set_modified();
/* Update the screen. */
edit_refresh_needed = TRUE;
#ifndef DISABLE_COLOR

File diff suppressed because it is too large Load Diff

View File

@@ -30,18 +30,21 @@
/* Global variables. */
#ifndef NANO_TINY
sigjmp_buf jump_buf;
/* Used to return to either main() or the unjustify routine in
* do_justify() after a SIGWINCH. */
bool jump_buf_main = FALSE;
/* Have we set jump_buf so that we return to main() after a
* SIGWINCH? */
volatile sig_atomic_t sigwinch_counter = 0;
/* Is incremented by the handler whenever a SIGWINCH occurs. */
#endif
bool meta_key;
/* Whether the current keystroke is a Meta key. */
bool func_key;
/* Whether the current keystroke is an extended keypad value. */
bool focusing = FALSE;
/* Whether an update of the edit window should center the cursor. */
#ifndef NANO_TINY
int controlleft = CONTROL_LEFT;
int controlright = CONTROL_RIGHT;
#endif
#ifndef DISABLE_WRAPJUSTIFY
ssize_t fill = 0;
@@ -91,14 +94,10 @@ openfilestruct *openfile = NULL;
char *matchbrackets = NULL;
/* The opening and closing brackets that can be found by bracket
* searches. */
#endif
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
char *whitespace = NULL;
/* The characters used when displaying the first characters of
* tabs and spaces. */
/* The characters used when visibly showing tabs and spaces. */
int whitespace_len[2];
/* The length of these characters. */
/* The length in bytes of these characters. */
#endif
#ifndef DISABLE_JUSTIFY
@@ -137,9 +136,9 @@ char *backup_dir = NULL;
/* The directory where we store backup files. */
const char *locking_prefix = ".";
/* Prefix of how to store the vim-style lock file. */
/* Prefix of how to store the vim-style lock file. */
const char *locking_suffix = ".swp";
/* Suffix of the vim-style lock file. */
/* Suffix of the vim-style lock file. */
#endif
#ifndef DISABLE_OPERATINGDIR
char *operating_dir = NULL;
@@ -191,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
@@ -223,11 +222,7 @@ size_t length_of_list(int menu)
size_t i = 0;
for (f = allfuncs; f != NULL; f = f->next)
if ((f->menus & menu) != 0
#ifndef DISABLE_HELP
&& strlen(f->help) > 0
#endif
) {
if ((f->menus & menu) != 0) {
i++;
}
return i;
@@ -275,6 +270,9 @@ void prepend_void(void)
void backup_file_void(void)
{
}
void discard_buffer(void)
{
}
void new_buffer_void(void)
{
}
@@ -285,21 +283,7 @@ void flip_execute_void(void)
{
}
/* Set the type of command key based on the string. */
key_type strtokeytype(const char *str)
{
if (str[0] == '^')
return CONTROL;
else if (str[0] == 'M')
return META;
else if (str[0] == 'F')
return FKEY;
else
return RAWINPUT;
}
/* Add a string to the function list struct.
* Does not allow updates, not yet anyway. */
/* Add a function to the function list. */
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
bool blank_after, bool viewok)
{
@@ -326,58 +310,33 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
#endif
}
/* Return the first shortcut in the list of shortcuts that
* matches the given func in the given menu. */
const sc *first_sc_for(int menu, void (*func)(void))
/* Add a key combo to the shortcut list. */
void add_to_sclist(int menus, const char *scstring, void (*func)(void), int toggle)
{
const sc *s;
static sc *tailsc;
static int counter = 0;
sc *s = (sc *)nmalloc(sizeof(sc));
for (s = sclist; s != NULL; s = s->next)
if ((s->menu & menu) && s->scfunc == func)
return s;
/* Start the list, or tack on the next item. */
if (sclist == NULL)
sclist = s;
else
tailsc->next = s;
tailsc = s;
s->next = NULL;
#ifdef DEBUG
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
#endif
/* Otherwise... */
return NULL;
}
/* Add a string to the shortcut list.
* Allows updates to existing entries in the list. */
void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggle)
{
sc *s;
if (sclist == NULL) {
sclist = (sc *)nmalloc(sizeof(sc));
s = sclist;
s->next = NULL;
} else {
for (s = sclist; s->next != NULL; s = s->next)
if (s->menu == menu && s->keystr == scstring)
break;
if (s->menu != menu || s->keystr != scstring) { /* i.e. this is not a replace... */
#ifdef DEBUG
fprintf(stderr, "No match found...\n");
#endif
s->next = (sc *)nmalloc(sizeof(sc));
s = s->next;
s->next = NULL;
}
}
s->type = strtokeytype(scstring);
s->menu = menu;
s->toggle = toggle;
s->keystr = (char *) scstring;
/* Fill in the data. */
s->menus = menus;
s->scfunc = func;
s->toggle = toggle;
if (toggle)
s->ordinal = ++counter;
s->keystr = (char *) scstring;
s->type = strtokeytype(scstring);
assign_keyinfo(s);
#ifdef DEBUG
fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menu %x\n", s->seq, scstring, (int)s->menu);
fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menus %x\n", s->seq, scstring, s->menus);
#endif
}
@@ -391,6 +350,23 @@ void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
s->scfunc = newfunc;
}
/* Return the first shortcut in the list of shortcuts that
* matches the given func in the given menu. */
const sc *first_sc_for(int menu, void (*func)(void))
{
const sc *s;
for (s = sclist; s != NULL; s = s->next)
if ((s->menus & menu) && s->scfunc == func)
return s;
#ifdef DEBUG
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
#endif
/* Otherwise... */
return NULL;
}
/* Return the given menu's first shortcut sequence, or the default value
* (2nd arg). Assumes currmenu for the menu to check. */
int sc_seq_or(void (*func)(void), int defaultval)
@@ -399,7 +375,7 @@ int sc_seq_or(void (*func)(void), int defaultval)
if (s) {
meta_key = (s->type == META);
return s->seq;
return s->seq;
}
/* else */
return defaultval;
@@ -416,21 +392,34 @@ functionptrtype func_from_key(int *kbinput)
return NULL;
}
/* Return the type of command key based on the given string. */
key_type strtokeytype(const char *str)
{
if (str[0] == '^')
return CONTROL;
else if (str[0] == 'M')
return META;
else if (str[0] == 'F')
return FKEY;
else
return RAWINPUT;
}
/* Assign the info to the shortcut struct.
* Assumes keystr is already assigned, naturally. */
void assign_keyinfo(sc *s)
{
if (s->type == CONTROL) {
assert(strlen(s->keystr) > 1);
s->seq = s->keystr[1] - 64;
assert(strlen(s->keystr) > 1);
s->seq = s->keystr[1] - 64;
} else if (s->type == META) {
assert(strlen(s->keystr) > 2);
s->seq = tolower((int) s->keystr[2]);
assert(strlen(s->keystr) > 2);
s->seq = tolower((int) s->keystr[2]);
} else if (s->type == FKEY) {
assert(strlen(s->keystr) > 1);
s->seq = KEY_F0 + atoi(&s->keystr[1]);
assert(strlen(s->keystr) > 1);
s->seq = KEY_F0 + atoi(&s->keystr[1]);
} else /* RAWINPUT */
s->seq = (int) s->keystr[0];
s->seq = (int) s->keystr[0];
/* Override some keys which don't bind as easily as we'd like. */
if (s->type == CONTROL && (!strcasecmp(&s->keystr[1], "space")))
@@ -452,20 +441,21 @@ void assign_keyinfo(sc *s)
s->seq = KEY_DC;
else if (!strcasecmp(s->keystr, "Bsp"))
s->seq = KEY_BACKSPACE;
/* The Tab and Enter keys don't actually produce special codes
* but the exact integer values of ^I and ^M. Rebinding the
* latter therefore also rebinds Tab and Enter. */
else if (!strcasecmp(s->keystr, "Tab"))
s->seq = NANO_CONTROL_I;
else if (!strcasecmp(s->keystr, "Enter"))
s->seq = KEY_ENTER;
else if (!strcasecmp(s->keystr, "PgUp"))
s->seq = KEY_PPAGE;
else if (!strcasecmp(s->keystr, "PgDn"))
s->seq = KEY_NPAGE;
#ifdef KEY_HOME
else if (!strcasecmp(s->keystr, "Home"))
s->seq = KEY_HOME;
#endif
#ifdef KEY_END
else if (!strcasecmp(s->keystr, "End"))
s->seq = KEY_END;
#endif
}
}
@@ -485,32 +475,35 @@ void print_sclist(void)
}
#endif
/* TRANSLATORS: Try to keep the next four strings at most 10 characters. */
/* These four tags are used elsewhere too, so they are global. */
/* TRANSLATORS: Try to keep the next fifteen strings at most 10 characters. */
const char *exit_tag = N_("Exit");
const char *close_tag = N_("Close");
const char *uncut_tag = N_("Uncut Text");
#ifndef DISABLE_JUSITIFY
#ifndef DISABLE_JUSTIFY
const char *unjust_tag = N_("Unjustify");
#endif
#ifndef NANO_TINY
/* TRANSLATORS: Try to keep this at most 12 characters. */
const char *whereis_next_tag = N_("WhereIs Next");
#endif
/* Initialize the list of functions and the list of shortcuts. */
void shortcut_init(void)
{
/* TRANSLATORS: Try to keep the next eight strings at most 10 characters. */
const char *read_file_tag = N_("Read File");
const char *whereis_tag = N_("Where Is");
const char *replace_tag = N_("Replace");
const char *gotoline_tag = N_("Go To Line");
const char *prev_line_tag = N_("Prev Line");
const char *next_line_tag = N_("Next Line");
const char *read_file_tag = N_("Read File");
const char *prev_page_tag = N_("Prev Page");
const char *next_page_tag = N_("Next Page");
#ifndef DISABLE_JUSTIFY
const char *justify_tag = N_("Justify");
const char *fulljustify_tag = N_("FullJstify");
#endif
const char *refresh_tag = N_("Refresh");
#ifndef NANO_TINY
/* TRANSLATORS: Try to keep this string at most 12 characters. */
const char *whereis_next_tag = N_("WhereIs Next");
#endif
#ifndef DISABLE_HELP
#ifndef DISABLE_JUSTIFY
@@ -559,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");
@@ -595,6 +588,10 @@ void shortcut_init(void)
const char *nano_backspace_msg =
N_("Delete the character to the left of the cursor");
#ifndef NANO_TINY
const char *nano_cut_word_left_msg =
N_("Cut backward from cursor to word start");
const char *nano_cut_word_right_msg =
N_("Cut forward from cursor to next word start");
const char *nano_cut_till_eof_msg =
N_("Cut from the cursor position to the end of the file");
#endif
@@ -608,8 +605,11 @@ void shortcut_init(void)
const char *nano_refresh_msg =
N_("Refresh (redraw) the current screen");
const char *nano_suspend_msg =
N_("Suspend the editor (if suspend is enabled)");
N_("Suspend the editor (if suspension is enabled)");
#ifndef NANO_TINY
const char *nano_savefile_msg = N_("Save file without prompting");
const char *nano_findprev_msg = N_("Search next occurrence backward");
const char *nano_findnext_msg = N_("Search next occurrence forward");
const char *nano_case_msg =
N_("Toggle the case sensitivity of the search");
const char *nano_reverse_msg =
@@ -636,6 +636,7 @@ void shortcut_init(void)
const char *nano_backup_msg = N_("Toggle backing up of the original file");
const char *nano_execute_msg = N_("Execute external command");
#endif
const char *nano_discard_buffer_msg = N_("Close buffer without saving it");
#ifndef DISABLE_MULTIBUFFER
const char *nano_multibuffer_msg = N_("Toggle the use of a new buffer");
#endif
@@ -651,6 +652,9 @@ void shortcut_init(void)
const char *nano_lint_msg = N_("Invoke the linter, if available");
const char *nano_prevlint_msg = N_("Go to previous linter msg");
const char *nano_nextlint_msg = N_("Go to next linter msg");
#ifndef DISABLE_SPELLER
const char *nano_formatter_msg = N_("Invoke formatter, if available");
#endif
#endif
#endif /* !DISABLE_HELP */
@@ -660,12 +664,6 @@ void shortcut_init(void)
#define IFSCHELP(help) ""
#endif
while (allfuncs != NULL) {
subnfunc *f = allfuncs;
allfuncs = allfuncs->next;
free(f);
}
/* Start populating the different menus with functions. */
add_to_funcs(do_help_void, MMOST,
@@ -688,18 +686,28 @@ void shortcut_init(void)
add_to_funcs(do_writeout_void, MMAIN,
N_("Write Out"), IFSCHELP(nano_writeout_msg), TOGETHER, NOVIEW);
/* We allow inserting files in view mode if multibuffers are
* available, so that we can view multiple files. If we're using
* restricted mode, inserting files is disabled, since it allows
* reading from or writing to files not specified on the command
* line. */
add_to_funcs(do_insertfile_void, MMAIN,
read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER,
#ifndef DISABLE_MULTIBUFFER
VIEW);
#ifndef DISABLE_JUSTIFY
if (!ISSET(RESTRICTED)) {
#else
NOVIEW);
/* If we can't replace Insert with Justify, show Insert anyway, to
* keep the help items nicely paired also in restricted mode. */
if (TRUE) {
#endif
add_to_funcs(do_insertfile_void, MMAIN,
read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER,
/* We allow inserting files in view mode if multibuffer mode
* is switched on, so that we can view multiple files. */
#ifndef DISABLE_MULTIBUFFER
VIEW);
#else
NOVIEW);
#endif
} else {
#ifndef DISABLE_JUSTIFY
add_to_funcs(do_justify_void, MMAIN,
justify_tag, IFSCHELP(nano_justify_msg), BLANKAFTER, NOVIEW);
#endif
}
add_to_funcs(do_search, MMAIN,
whereis_tag, IFSCHELP(nano_whereis_msg), TOGETHER, VIEW);
@@ -734,20 +742,25 @@ void shortcut_init(void)
/* Remember the entry for Uncut, to be able to replace it with Unjustify. */
uncutfunc = tailfunc;
if (!ISSET(RESTRICTED)) {
#ifndef DISABLE_JUSTIFY
add_to_funcs(do_justify_void, MMAIN,
N_("Justify"), IFSCHELP(nano_justify_msg), TOGETHER, NOVIEW);
add_to_funcs(do_justify_void, MMAIN,
justify_tag, IFSCHELP(nano_justify_msg), TOGETHER, NOVIEW);
#endif
#ifndef DISABLE_SPELLER
add_to_funcs(do_spell, MMAIN,
N_("To Spell"), IFSCHELP(nano_spell_msg), TOGETHER, NOVIEW);
add_to_funcs(do_spell, MMAIN,
N_("To Spell"), IFSCHELP(nano_spell_msg), TOGETHER, NOVIEW);
#endif
#ifndef DISABLE_COLOR
add_to_funcs(do_linter, MMAIN,
N_("To Linter"), IFSCHELP(nano_lint_msg), BLANKAFTER, NOVIEW);
add_to_funcs(do_linter, MMAIN,
N_("To Linter"), IFSCHELP(nano_lint_msg), TOGETHER, NOVIEW);
#ifndef DISABLE_SPELLER
add_to_funcs(do_formatter, MMAIN,
N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, NOVIEW);
#endif
#endif
}
#ifndef NANO_TINY
add_to_funcs(case_sens_void, MWHEREIS|MREPLACE,
@@ -785,10 +798,10 @@ void shortcut_init(void)
gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, VIEW);
#endif
add_to_funcs(do_page_up, MMAIN|MHELP|MBROWSER,
N_("Prev Page"), IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
add_to_funcs(do_page_down, MMAIN|MHELP|MBROWSER,
N_("Next Page"), IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
add_to_funcs(do_page_up, MMAIN|MHELP,
prev_page_tag, IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
add_to_funcs(do_page_down, MMAIN|MHELP,
next_page_tag, IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
add_to_funcs(do_first_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
N_("First Line"), IFSCHELP(nano_firstline_msg), TOGETHER, VIEW);
@@ -879,8 +892,9 @@ void shortcut_init(void)
add_to_funcs(do_tab, MMAIN,
N_("Tab"), IFSCHELP(nano_tab_msg), TOGETHER, NOVIEW);
add_to_funcs(do_enter_void, MMAIN,
N_("Enter"), IFSCHELP(nano_enter_msg), TOGETHER, NOVIEW);
add_to_funcs(do_enter, MMAIN,
N_("Enter"), IFSCHELP(nano_enter_msg), BLANKAFTER, NOVIEW);
add_to_funcs(do_delete, MMAIN,
N_("Delete"), IFSCHELP(nano_delete_msg), TOGETHER, NOVIEW);
add_to_funcs(do_backspace, MMAIN,
@@ -893,6 +907,11 @@ void shortcut_init(void)
NOVIEW);
#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);
add_to_funcs(do_cut_till_eof, MMAIN,
N_("CutTillEnd"), IFSCHELP(nano_cut_till_eof_msg), BLANKAFTER, NOVIEW);
#endif
@@ -913,6 +932,16 @@ void shortcut_init(void)
add_to_funcs(do_suspend_void, MMAIN,
N_("Suspend"), IFSCHELP(nano_suspend_msg), BLANKAFTER, VIEW);
#ifndef NANO_TINY
add_to_funcs(do_savefile, MMAIN,
N_("Save"), IFSCHELP(nano_savefile_msg), BLANKAFTER, NOVIEW);
add_to_funcs(do_findprevious, MMAIN,
N_("Previous"), IFSCHELP(nano_findprev_msg), TOGETHER, VIEW);
add_to_funcs(do_findnext, MMAIN,
N_("Next"), IFSCHELP(nano_findnext_msg), BLANKAFTER, VIEW);
#endif
#ifndef DISABLE_HISTORIES
add_to_funcs(get_history_older_void,
(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE),
@@ -926,35 +955,32 @@ void shortcut_init(void)
N_("Go To Text"), IFSCHELP(nano_whereis_msg), BLANKAFTER, VIEW);
#ifndef NANO_TINY
/* If we're using restricted mode, the DOS format, Mac format,
* append, prepend, and backup toggles are disabled. The first and
* second are useless since inserting files is disabled, the third
* and fourth are disabled because they allow writing to files not
* specified on the command line, and the fifth is useless since
* backups are disabled. */
add_to_funcs(dos_format_void, MWRITEFILE,
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
add_to_funcs(mac_format_void, MWRITEFILE,
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
/* If we're using restricted mode, the Append, Prepend, and Backup toggles
* are disabled. The first and second are not useful as they only allow
* reduplicating the current file, and the third is not allowed as it
* would write to a file not specified on the command line. */
if (!ISSET(RESTRICTED)) {
add_to_funcs(dos_format_void, MWRITEFILE,
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
add_to_funcs(append_void, MWRITEFILE,
N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW);
add_to_funcs(prepend_void, MWRITEFILE,
N_("Prepend"), IFSCHELP(nano_prepend_msg), TOGETHER, NOVIEW);
add_to_funcs(mac_format_void, MWRITEFILE,
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
add_to_funcs(append_void, MWRITEFILE,
N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW);
add_to_funcs(prepend_void, MWRITEFILE,
N_("Prepend"), IFSCHELP(nano_prepend_msg), TOGETHER, NOVIEW);
add_to_funcs(backup_file_void, MWRITEFILE,
N_("Backup File"), IFSCHELP(nano_backup_msg), TOGETHER, NOVIEW);
add_to_funcs(backup_file_void, MWRITEFILE,
N_("Backup File"), IFSCHELP(nano_backup_msg), TOGETHER, NOVIEW);
}
/* If we're using restricted mode, file insertion is disabled, and
* thus command execution and the multibuffer toggle have no place. */
if (!ISSET(RESTRICTED)) {
add_to_funcs(flip_execute_void, MINSERTFILE,
add_to_funcs(flip_execute_void, MINSERTFILE,
N_("Execute Command"), IFSCHELP(nano_execute_msg), TOGETHER, NOVIEW);
add_to_funcs(flip_execute_void, MEXTCMD,
add_to_funcs(flip_execute_void, MEXTCMD,
read_file_tag, IFSCHELP(nano_insert_msg), TOGETHER, NOVIEW);
#ifndef DISABLE_MULTIBUFFER
@@ -969,20 +995,28 @@ void shortcut_init(void)
add_to_funcs(to_files_void, MWRITEFILE|MINSERTFILE,
N_("To Files"), IFSCHELP(nano_tofiles_msg), TOGETHER, VIEW);
add_to_funcs(do_page_up, MBROWSER,
prev_page_tag, IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
add_to_funcs(do_page_down, MBROWSER,
next_page_tag, IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
add_to_funcs(do_first_file, (MBROWSER|MWHEREISFILE),
N_("First File"), IFSCHELP(nano_firstfile_msg), TOGETHER, VIEW);
add_to_funcs(do_last_file, (MBROWSER|MWHEREISFILE),
N_("Last File"), IFSCHELP(nano_lastfile_msg), TOGETHER, VIEW);
N_("Last File"), IFSCHELP(nano_lastfile_msg), BLANKAFTER, VIEW);
#endif
add_to_funcs(discard_buffer, MWRITEFILE,
N_("Discard buffer"), IFSCHELP(nano_discard_buffer_msg), BLANKAFTER, NOVIEW);
#if !defined(NANO_TINY) && !defined(DISABLE_BROWSER)
add_to_funcs(do_research, MBROWSER,
whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
#endif
#ifndef DISABLE_COLOR
/* TRANSLATORS: Try to keep the next two strings at most 20 characters. */
add_to_funcs(do_page_up, MLINTER,
/* TRANSLATORS: Try to keep the next two strings at most 20 characters. */
N_("Prev Lint Msg"), IFSCHELP(nano_prevlint_msg), TOGETHER, VIEW);
add_to_funcs(do_page_down, MLINTER,
N_("Next Lint Msg"), IFSCHELP(nano_nextlint_msg), TOGETHER, VIEW);
@@ -1026,12 +1060,12 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "^_", do_gotolinecolumn_void, 0);
add_to_sclist(MMAIN, "M-G", do_gotolinecolumn_void, 0);
add_to_sclist(MMAIN, "F13", do_gotolinecolumn_void, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "^Y", do_page_up, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "F7", do_page_up, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "PgUp", do_page_up, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "^V", do_page_down, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "F8", do_page_down, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "PgDn", do_page_down, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^Y", do_page_up, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F7", do_page_up, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgUp", do_page_up, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", do_page_down, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", do_page_down, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", do_page_down, 0);
add_to_sclist(MMAIN|MHELP, "M-\\", do_first_line, 0);
add_to_sclist(MMAIN|MHELP, "M-|", do_first_line, 0);
add_to_sclist(MMAIN|MHELP, "M-/", do_last_line, 0);
@@ -1058,10 +1092,10 @@ void shortcut_init(void)
add_to_sclist(MMOST, "M-Space", do_prev_word_void, 0);
add_to_sclist(MMOST, "^Space", do_next_word_void, 0);
#endif
add_to_sclist(MMOST, "^A", do_home, 0);
add_to_sclist(MMOST, "Home", do_home, 0);
add_to_sclist(MMOST, "^E", do_end, 0);
add_to_sclist(MMOST, "End", do_end, 0);
add_to_sclist((MMOST & ~MBROWSER), "^A", do_home, 0);
add_to_sclist((MMOST & ~MBROWSER), "Home", do_home, 0);
add_to_sclist((MMOST & ~MBROWSER), "^E", do_end, 0);
add_to_sclist((MMOST & ~MBROWSER), "End", do_end, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", do_up_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", do_up_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", do_down_void, 0);
@@ -1154,31 +1188,48 @@ void shortcut_init(void)
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Down", get_history_newer_void, 0);
#endif
#ifndef DISABLE_BROWSER
add_to_sclist(MWHEREISFILE, "^Y", do_first_file, 0);
add_to_sclist(MWHEREISFILE, "^V", do_last_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", do_first_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", do_first_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", do_last_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", do_last_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "^_", goto_dir_void, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-G", goto_dir_void, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "F13", goto_dir_void, 0);
add_to_sclist(MBROWSER, "Home", do_first_file, 0);
add_to_sclist(MBROWSER, "End", do_last_file, 0);
add_to_sclist(MBROWSER, "^_", goto_dir_void, 0);
add_to_sclist(MBROWSER, "M-G", goto_dir_void, 0);
add_to_sclist(MBROWSER, "F13", goto_dir_void, 0);
#endif
if (ISSET(TEMP_FILE))
add_to_sclist(MWRITEFILE, "^Q", discard_buffer, 0);
add_to_sclist(MWRITEFILE, "M-D", dos_format_void, 0);
add_to_sclist(MWRITEFILE, "M-M", mac_format_void, 0);
add_to_sclist(MWRITEFILE, "M-A", append_void, 0);
add_to_sclist(MWRITEFILE, "M-P", prepend_void, 0);
add_to_sclist(MWRITEFILE, "M-B", backup_file_void, 0);
if (!ISSET(RESTRICTED)) {
/* Don't allow Appending, Prepending, nor Backups in restricted mode. */
add_to_sclist(MWRITEFILE, "M-A", append_void, 0);
add_to_sclist(MWRITEFILE, "M-P", prepend_void, 0);
add_to_sclist(MWRITEFILE, "M-B", backup_file_void, 0);
#ifndef DISABLE_BROWSER
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", to_files_void, 0);
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", to_files_void, 0);
#endif
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", flip_execute_void, 0);
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", new_buffer_void, 0);
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", flip_execute_void, 0);
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", new_buffer_void, 0);
}
add_to_sclist(MHELP|MBROWSER, "^C", do_exit, 0);
/* Allow exiting from the file browser and the help viewer with
* the same key as they were entered. */
#ifndef DISABLE_BROWSER
add_to_sclist(MBROWSER, "^T", do_exit, 0);
#endif
#ifndef DISABLE_HELP
add_to_sclist(MHELP, "^G", do_exit, 0);
add_to_sclist(MHELP, "Home", do_first_line, 0);
add_to_sclist(MHELP, "End", do_last_line, 0);
#endif
add_to_sclist(MMOST, "^I", do_tab, 0);
add_to_sclist(MMOST, "^M", do_enter_void, 0);
add_to_sclist(MMOST, "Enter", do_enter_void, 0);
add_to_sclist(MMOST, "Tab", do_tab, 0);
add_to_sclist(MMOST, "^M", do_enter, 0);
add_to_sclist(MMOST, "Enter", do_enter, 0);
add_to_sclist(MMOST, "^D", do_delete, 0);
add_to_sclist(MMOST, "Del", do_delete, 0);
add_to_sclist(MMOST, "^H", do_backspace, 0);
@@ -1190,27 +1241,34 @@ void shortcut_init(void)
}
#ifndef DISABLE_COLOR
void set_lint_shortcuts(void)
void set_lint_or_format_shortcuts(void)
{
#ifndef DISABLE_SPELLER
replace_scs_for(do_spell, do_linter);
if (openfile->syntax->formatter) {
replace_scs_for(do_spell, do_formatter);
replace_scs_for(do_linter, do_formatter);
} else {
replace_scs_for(do_spell, do_linter);
replace_scs_for(do_formatter, do_linter);
}
#endif
}
void set_spell_shortcuts(void)
{
#ifndef DISABLE_SPELLER
replace_scs_for(do_linter, do_spell);
replace_scs_for(do_formatter, do_spell);
replace_scs_for(do_linter, do_spell);
#endif
}
#endif
#endif /* !DISABLE_COLOR */
const subnfunc *sctofunc(sc *s)
const subnfunc *sctofunc(const sc *s)
{
subnfunc *f;
subnfunc *f = allfuncs;
for (f = allfuncs; f != NULL && s->scfunc != f->scfunc; f = f->next)
;
while (f != NULL && f->scfunc != s->scfunc)
f = f->next;
return f;
}
@@ -1221,44 +1279,44 @@ const subnfunc *sctofunc(sc *s)
const char *flagtostr(int flag)
{
switch (flag) {
case NO_HELP:
/* TRANSLATORS: The next seventeen strings are toggle descriptions;
* they are best kept shorter than 40 characters, but may be longer. */
return N_("Help mode");
case CONST_UPDATE:
return N_("Constant cursor position display");
case MORE_SPACE:
return N_("Use of one more line for editing");
case SMOOTH_SCROLL:
return N_("Smooth scrolling");
case SOFTWRAP:
return N_("Soft wrapping of overlong lines");
case WHITESPACE_DISPLAY:
return N_("Whitespace display");
case NO_COLOR_SYNTAX:
return N_("Color syntax highlighting");
case SMART_HOME:
return N_("Smart home key");
case AUTOINDENT:
return N_("Auto indent");
case CUT_TO_END:
return N_("Cut to end");
case NO_WRAP:
return N_("Hard wrapping of overlong lines");
case TABS_TO_SPACES:
return N_("Conversion of typed tabs to spaces");
case BACKUP_FILE:
return N_("Backup files");
case MULTIBUFFER:
return N_("Multiple file buffers");
case USE_MOUSE:
return N_("Mouse support");
case NO_CONVERT:
return N_("No conversion from DOS/Mac format");
case SUSPEND:
return N_("Suspension");
default:
return "?????";
case NO_HELP:
/* TRANSLATORS: The next seventeen strings are toggle descriptions;
* they are best kept shorter than 40 characters, but may be longer. */
return N_("Help mode");
case CONST_UPDATE:
return N_("Constant cursor position display");
case MORE_SPACE:
return N_("Use of one more line for editing");
case SMOOTH_SCROLL:
return N_("Smooth scrolling");
case SOFTWRAP:
return N_("Soft wrapping of overlong lines");
case WHITESPACE_DISPLAY:
return N_("Whitespace display");
case NO_COLOR_SYNTAX:
return N_("Color syntax highlighting");
case SMART_HOME:
return N_("Smart home key");
case AUTOINDENT:
return N_("Auto indent");
case CUT_TO_END:
return N_("Cut to end");
case NO_WRAP:
return N_("Hard wrapping of overlong lines");
case TABS_TO_SPACES:
return N_("Conversion of typed tabs to spaces");
case BACKUP_FILE:
return N_("Backup files");
case MULTIBUFFER:
return N_("Reading file into separate buffer");
case USE_MOUSE:
return N_("Mouse support");
case NO_CONVERT:
return N_("No conversion from DOS/Mac format");
case SUSPEND:
return N_("Suspension");
default:
return "?????";
}
}
#endif /* !NANO_TINY */
@@ -1266,7 +1324,7 @@ const char *flagtostr(int flag)
#ifndef DISABLE_NANORC
/* Interpret a function string given in the rc file, and return a
* shortcut struct with the corresponding function filled in. */
sc *strtosc(char *input)
sc *strtosc(const char *input)
{
sc *s;
@@ -1281,8 +1339,14 @@ sc *strtosc(char *input)
s->scfunc = do_cancel;
else if (!strcasecmp(input, "exit"))
s->scfunc = do_exit;
else if (!strcasecmp(input, "discardbuffer"))
s->scfunc = discard_buffer;
else if (!strcasecmp(input, "writeout"))
s->scfunc = do_writeout_void;
#ifndef NANO_TINY
else if (!strcasecmp(input, "savefile"))
s->scfunc = do_savefile;
#endif
else if (!strcasecmp(input, "insert"))
s->scfunc = do_insertfile_void;
else if (!strcasecmp(input, "whereis"))
@@ -1291,6 +1355,10 @@ sc *strtosc(char *input)
else if (!strcasecmp(input, "searchagain") ||
!strcasecmp(input, "research"))
s->scfunc = do_research;
else if (!strcasecmp(input, "findprevious"))
s->scfunc = do_findprevious;
else if (!strcasecmp(input, "findnext"))
s->scfunc = do_findnext;
#endif
else if (!strcasecmp(input, "replace"))
s->scfunc = do_replace;
@@ -1310,6 +1378,10 @@ sc *strtosc(char *input)
else if (!strcasecmp(input, "tospell") ||
!strcasecmp(input, "speller"))
s->scfunc = do_spell;
#endif
#ifndef DISABLE_COLOR
else if (!strcasecmp(input, "linter"))
s->scfunc = do_linter;
#endif
else if (!strcasecmp(input, "curpos") ||
!strcasecmp(input, "cursorpos"))
@@ -1339,6 +1411,10 @@ sc *strtosc(char *input)
s->scfunc = do_prev_word_void;
else if (!strcasecmp(input, "nextword"))
s->scfunc = do_next_word_void;
else if (!strcasecmp(input, "cutwordleft"))
s->scfunc = do_cut_prev_word;
else if (!strcasecmp(input, "cutwordright"))
s->scfunc = do_cut_next_word;
else if (!strcasecmp(input, "findbracket"))
s->scfunc = do_find_bracket;
else if (!strcasecmp(input, "wordcount"))
@@ -1385,7 +1461,7 @@ sc *strtosc(char *input)
else if (!strcasecmp(input, "tab"))
s->scfunc = do_tab;
else if (!strcasecmp(input, "enter"))
s->scfunc = do_enter_void;
s->scfunc = do_enter;
else if (!strcasecmp(input, "delete"))
s->scfunc = do_delete;
else if (!strcasecmp(input, "backspace"))
@@ -1501,7 +1577,7 @@ sc *strtosc(char *input)
}
/* Interpret a menu name and return the corresponding menu flag. */
int strtomenu(char *input)
int strtomenu(const char *input)
{
if (!strcasecmp(input, "all"))
return (MMOST|MHELP|MYESNO);
@@ -1559,34 +1635,25 @@ void thanks_for_all_the_fish(void)
delwin(bottomwin);
#ifndef DISABLE_JUSTIFY
if (quotestr != NULL)
free(quotestr);
free(quotestr);
#ifdef HAVE_REGEX_H
regfree(&quotereg);
if (quoteerr != NULL)
free(quoteerr);
free(quoteerr);
#endif
#endif
#ifndef NANO_TINY
if (backup_dir != NULL)
free(backup_dir);
free(backup_dir);
#endif
#ifndef DISABLE_OPERATINGDIR
if (operating_dir != NULL)
free(operating_dir);
if (full_operating_dir != NULL)
free(full_operating_dir);
free(operating_dir);
free(full_operating_dir);
#endif
if (last_search != NULL)
free(last_search);
if (last_replace != NULL)
free(last_replace);
free(answer);
free(last_search);
free(last_replace);
#ifndef DISABLE_SPELLER
if (alt_speller != NULL)
free(alt_speller);
free(alt_speller);
#endif
if (answer != NULL)
free(answer);
if (cutbuffer != NULL)
free_filestruct(cutbuffer);
#ifndef DISABLE_JUSTIFY
@@ -1597,12 +1664,13 @@ void thanks_for_all_the_fish(void)
if (openfile != NULL)
free_openfilestruct(openfile);
#ifndef DISABLE_COLOR
if (syntaxstr != NULL)
free(syntaxstr);
free(syntaxstr);
while (syntaxes != NULL) {
syntaxtype *bill = syntaxes;
free(syntaxes->desc);
free(syntaxes->linter);
free(syntaxes->formatter);
while (syntaxes->extensions != NULL) {
regexlisttype *bob = syntaxes->extensions;
syntaxes->extensions = bob->next;
@@ -1663,18 +1731,17 @@ void thanks_for_all_the_fish(void)
#endif
/* Free the functions and shortcuts lists. */
while (allfuncs != NULL) {
subnfunc *f = allfuncs;
allfuncs = allfuncs->next;
free(f);
subnfunc *f = allfuncs;
allfuncs = allfuncs->next;
free(f);
}
while (sclist != NULL) {
sc *s = sclist;
sclist = sclist->next;
free(s);
sc *s = sclist;
sclist = sclist->next;
free(s);
}
#ifndef DISABLE_NANORC
if (homedir != NULL)
free(homedir);
free(homedir);
#endif
}

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -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.
@@ -66,6 +63,11 @@ int do_statusbar_input(bool *ran_func, bool *finished,
/* Read in a character. */
input = get_kbinput(bottomwin);
#ifndef NANO_TINY
if (input == KEY_WINCH)
return KEY_WINCH;
#endif
#ifndef DISABLE_MOUSE
/* If we got a mouse click and it was on a shortcut, read in the
* shortcut character. */
@@ -140,26 +142,27 @@ int do_statusbar_input(bool *ran_func, bool *finished,
}
if (have_shortcut) {
if (s->scfunc == do_tab || s->scfunc == do_enter_void)
if (s->scfunc == do_tab || s->scfunc == do_enter)
;
else if (s->scfunc == total_refresh)
total_statusbar_refresh(refresh_func);
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_right)
do_statusbar_right();
else if (s->scfunc == do_left)
} else if (s->scfunc == do_left)
do_statusbar_left();
else if (s->scfunc == do_right)
do_statusbar_right();
#ifndef NANO_TINY
else if (s->scfunc == do_next_word_void)
do_statusbar_next_word(FALSE);
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();
#endif
else if (s->scfunc == do_home)
do_statusbar_home();
@@ -181,7 +184,7 @@ int do_statusbar_input(bool *ran_func, bool *finished,
* set finished to TRUE to indicate that we're done. */
if (got_enter) {
get_input(NULL, 1);
input = sc_seq_or(do_enter_void, 0);
input = sc_seq_or(do_enter, 0);
*finished = TRUE;
}
}
@@ -189,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
@@ -205,7 +208,7 @@ int do_statusbar_input(bool *ran_func, bool *finished,
* functions and setting finished to TRUE to indicate
* that we're done after running or trying to run their
* associated functions. */
f = sctofunc((sc *) s);
f = sctofunc(s);
if (s->scfunc != NULL) {
*ran_func = TRUE;
if (f && (!ISSET(VIEW_MODE) || f->viewok) &&
@@ -228,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);
@@ -238,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_horizontal_update(pww_save))
update_statusbar_line(answer, statusbar_x);
update_bar_if_needed();
}
}
@@ -305,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;
@@ -318,63 +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();
#ifndef NANO_TINY
}
#endif
if (need_statusbar_horizontal_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_horizontal_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_horizontal_update(pww_save))
update_statusbar_line(answer, statusbar_x);
update_bar_if_needed();
}
}
@@ -382,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_horizontal_update(pww_save))
update_statusbar_line(answer, statusbar_x);
update_bar_if_needed();
}
}
@@ -396,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();
}
}
@@ -407,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();
}
}
@@ -431,177 +386,65 @@ void do_statusbar_cut_text(void)
#ifndef NANO_TINY
if (ISSET(CUT_TO_END))
null_at(&answer, statusbar_x);
else {
else
#endif
{
null_at(&answer, 0);
statusbar_x = 0;
statusbar_pww = statusbar_xplustabs();
#ifndef NANO_TINY
}
#endif
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_horizontal_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_horizontal_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 */
@@ -631,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. */
@@ -647,7 +489,7 @@ size_t statusbar_xplustabs(void)
* get_statusbar_page_start(column) < COLS). */
size_t get_statusbar_page_start(size_t start_col, size_t column)
{
if (column == start_col || column < COLS - 1)
if (column == start_col || column < COLS - 1 || COLS == start_col + 1)
return 0;
else
return column - start_col - (column - start_col) % (COLS -
@@ -664,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)
@@ -688,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 horizontally, and FALSE
* otherwise. We need one if pww_save and statusbar_pww are on
* different pages. */
bool need_statusbar_horizontal_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,
@@ -734,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;
@@ -756,34 +588,19 @@ 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();
}
#ifdef DEBUG
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
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);
@@ -796,9 +613,16 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
kbinput = do_statusbar_input(&ran_func, &finished, refresh_func);
assert(statusbar_x <= strlen(answer));
#ifndef NANO_TINY
if (kbinput == KEY_WINCH) {
refresh_func();
update_the_statusbar();
continue;
}
#endif
func = func_from_key(&kbinput);
if (func == do_cancel || func == do_enter_void)
if (func == do_cancel || func == do_enter)
break;
#ifndef DISABLE_TABCOMP
@@ -823,7 +647,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
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
@@ -841,7 +665,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
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
@@ -862,12 +686,12 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
* 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
@@ -878,7 +702,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
} 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
@@ -896,40 +720,23 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
#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);
if (magichistory != NULL)
free(magichistory);
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_void || 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;
@@ -947,8 +754,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
*
* 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,
@@ -966,14 +772,8 @@ 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. */
if (prompt != NULL)
free(prompt);
prompt = charalloc(((COLS - 4) * mb_cur_max()) + 1);
currmenu = menu;
bottombars(menu);
va_start(ap, msg);
@@ -1004,7 +804,7 @@ int do_prompt(bool allow_tabs,
* properly. */
if (func == do_cancel)
retval = -1;
else if (func == do_enter_void)
else if (func == do_enter)
retval = (*answer == '\0') ? -2 : 0;
blank_statusbar();
@@ -1025,27 +825,15 @@ 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! */
const sc *s;
int oldmenu = currmenu;
assert(msg != NULL);
@@ -1061,106 +849,104 @@ int do_yesno_prompt(bool all, const char *msg)
nostr = _("Nn");
allstr = _("Aa");
if (!ISSET(NO_HELP)) {
char shortstr[3];
/* Temp string for Yes, No, All. */
if (COLS < 32)
width = COLS / 2;
/* Clear the shortcut list from the bottom of the screen. */
blank_bottombars();
sprintf(shortstr, " %c", yesstr[0]);
wmove(bottomwin, 1, 0);
onekey(shortstr, _("Yes"), width);
if (all) {
wmove(bottomwin, 1, width);
shortstr[1] = allstr[0];
onekey(shortstr, _("All"), width);
}
wmove(bottomwin, 2, 0);
shortstr[1] = nostr[0];
onekey(shortstr, _("No"), width);
wmove(bottomwin, 2, 16);
onekey("^C", _("Cancel"), width);
}
if (interface_color_pair[TITLE_BAR].bright)
wattron(bottomwin, A_BOLD);
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
blank_statusbar();
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
wattroff(bottomwin, A_BOLD);
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
/* Refresh the edit window and the statusbar before getting
* input. */
wnoutrefresh(edit);
wnoutrefresh(bottomwin);
do {
int kbinput;
functionptrtype func;
#ifndef DISABLE_MOUSE
int mouse_x, mouse_y;
#endif
if (!ISSET(NO_HELP)) {
char shortstr[3];
/* Temporary string for (translated) " Y", " N" and " A". */
if (COLS < 32)
width = COLS / 2;
/* Clear the shortcut list from the bottom of the screen. */
blank_bottombars();
/* Now show the ones for "Yes", "No", "Cancel" and maybe "All". */
sprintf(shortstr, " %c", yesstr[0]);
wmove(bottomwin, 1, 0);
onekey(shortstr, _("Yes"), width);
if (all) {
shortstr[1] = allstr[0];
wmove(bottomwin, 1, width);
onekey(shortstr, _("All"), width);
}
shortstr[1] = nostr[0];
wmove(bottomwin, 2, 0);
onekey(shortstr, _("No"), width);
wmove(bottomwin, 2, width);
onekey("^C", _("Cancel"), width);
}
if (interface_color_pair[TITLE_BAR].bright)
wattron(bottomwin, A_BOLD);
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
blank_statusbar();
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
wattroff(bottomwin, A_BOLD);
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
/* Refresh edit window and statusbar before getting input. */
wnoutrefresh(edit);
wnoutrefresh(bottomwin);
currmenu = MYESNO;
kbinput = get_kbinput(bottomwin);
s = get_shortcut(&kbinput);
if (s && s->scfunc == do_cancel)
ok = -1;
#ifndef NANO_TINY
if (kbinput == KEY_WINCH)
continue;
#endif
func = func_from_key(&kbinput);
if (func == do_cancel)
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 (s && s->scfunc == total_refresh) {
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

@@ -28,12 +28,17 @@
/* All external variables. See global.c for their descriptions. */
#ifndef NANO_TINY
extern sigjmp_buf jump_buf;
extern bool jump_buf_main;
extern volatile sig_atomic_t sigwinch_counter;
#endif
extern bool meta_key;
extern bool func_key;
extern bool focusing;
#ifndef NANO_TINY
extern int controlleft;
extern int controlright;
#endif
#ifndef DISABLE_WRAPJUSTIFY
extern ssize_t fill;
@@ -62,7 +67,7 @@ extern openfilestruct *openfile;
extern char *matchbrackets;
#endif
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
#ifndef NANO_TINY
extern char *whitespace;
extern int whitespace_len[2];
#endif
@@ -123,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
@@ -148,10 +153,9 @@ char *do_browse_from(const char *inpath);
void browser_init(const char *path, DIR *dir);
functionptrtype parse_browser_input(int *kbinput);
void browser_refresh(void);
bool browser_select_filename(const char *needle);
void browser_select_dirname(const char *needle);
int filesearch_init(void);
bool findnextfile(bool no_sameline, size_t begin, const char *needle);
void findnextfile_wrap_reset(void);
void findnextfile(const char *needle);
void filesearch_abort(void);
void do_filesearch(void);
void do_fileresearch(void);
@@ -248,6 +252,9 @@ bool is_valid_mbstring(const char *s);
void set_colorpairs(void);
void color_init(void);
void color_update(void);
void reset_multis(filestruct *fileptr, bool force);
void alloc_multidata_if_needed(filestruct *fileptr);
void precalc_multicolorinfo(void);
#endif
/* All functions in cut.c. */
@@ -261,7 +268,7 @@ void cut_to_eof(void);
#endif
void do_cut_text(
#ifndef NANO_TINY
bool copy_text, bool cut_till_eof, bool undoing
bool copy_text, bool cut_till_eof
#else
void
#endif
@@ -273,25 +280,23 @@ 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(void);
void initialize_buffer_text(void);
void open_buffer(const char *filename, bool undoable);
bool open_buffer(const char *filename, bool undoable);
#ifndef DISABLE_SPELLER
void replace_buffer(const char *filename);
#endif
void display_buffer(void);
#ifndef DISABLE_MULTIBUFFER
void switch_to_prevnext_buffer(bool next);
void switch_to_prevnext_buffer(bool next, bool quiet);
void switch_to_prev_buffer_void(void);
void switch_to_next_buffer_void(void);
bool close_buffer(void);
bool close_buffer(bool quiet);
#endif
filestruct *read_line(char *buf, filestruct *prevnode, bool
*first_line_ins, size_t buf_len);
filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode);
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
int open_file(const char *filename, bool newfie, FILE **f);
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
char *get_next_filename(const char *name, const char *suffix);
void do_insertfile(
#ifndef NANO_TINY
@@ -320,8 +325,11 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
append_type append);
#endif
bool do_writeout(bool exiting);
int do_writeout(bool exiting);
void do_writeout_void(void);
#ifndef NANO_TINY
void do_savefile(void);
#endif
char *real_dir_from_tilde(const char *buf);
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
int diralphasort(const void *va, const void *vb);
@@ -359,20 +367,20 @@ void assign_keyinfo(sc *s);
void print_sclist(void);
void shortcut_init(void);
#ifndef DISABLE_COLOR
void set_lint_shortcuts(void);
void set_lint_or_format_shortcuts(void);
void set_spell_shortcuts(void);
#endif
const subnfunc *sctofunc(sc *s);
const subnfunc *sctofunc(const sc *s);
const char *flagtostr(int flag);
sc *strtosc(char *input);
int strtomenu(char *input);
sc *strtosc(const char *input);
int strtomenu(const char *input);
#ifdef DEBUG
void thanks_for_all_the_fish(void);
#endif
/* All functions in help.c. */
#ifndef DISABLE_HELP
void do_help(void (*refresh_func)(void));
void do_help(void);
void help_init(void);
functionptrtype parse_help_input(int *kbinput);
size_t help_line_len(const char *ptr);
@@ -393,7 +401,7 @@ void do_para_end_void(void);
#ifndef NANO_TINY
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
bool do_prev_word(bool allow_punct, bool allow_update);
void do_prev_word(bool allow_punct, bool allow_update);
void do_prev_word_void(void);
#endif
void do_home(void);
@@ -426,9 +434,8 @@ void do_right(void);
/* All functions in nano.c. */
filestruct *make_new_node(filestruct *prevnode);
filestruct *copy_node(const filestruct *src);
void splice_node(filestruct *begin, filestruct *newnode, filestruct
*end);
void unlink_node(const filestruct *fileptr);
void splice_node(filestruct *afterthis, filestruct *newnode);
void unlink_node(filestruct *fileptr);
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
void free_filestruct(filestruct *src);
@@ -448,6 +455,10 @@ void delete_opennode(openfilestruct *fileptr);
void free_openfilestruct(openfilestruct *src);
#endif
void print_view_warning(void);
void show_restricted_warning(void);
#ifdef DISABLE_HELP
void say_there_is_no_help(void);
#endif
void finish(void);
void die(const char *msg, ...);
void die_save_file(const char *die_filename
@@ -470,18 +481,20 @@ void usage(void);
void version(void);
int more_space(void);
int no_help(void);
void nano_disabled_msg(void);
void no_current_file_name_warning(void);
void do_exit(void);
void close_and_go(void);
void signal_init(void);
RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_continue(int signal);
#ifndef NANO_TINY
RETSIGTYPE handle_sigwinch(int signal);
void allow_pending_sigwinch(bool allow);
void regenerate_screen(void);
void allow_sigwinch(bool allow);
void do_toggle(int flag);
void do_toggle_void(void);
#endif
void do_toggle_void(void);
void disable_extended_io(void);
#ifdef USE_SLANG
void disable_signals(void);
@@ -514,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_horizontal_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
@@ -561,8 +574,6 @@ void parse_include(char *ptr);
short color_to_short(const char *colorname, bool *bright);
void parse_colors(char *ptr, bool icase);
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
void reset_multis(filestruct *fileptr, bool force);
void alloc_multidata_if_needed(filestruct *fileptr);
#endif
void parse_rcfile(FILE *rcstream
#ifndef DISABLE_COLOR
@@ -579,16 +590,19 @@ void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
void search_replace_abort(void);
void search_init_globals(void);
int search_init(bool replacing, bool use_answer);
bool findnextstr(
#ifndef DISABLE_SPELLER
bool whole_word,
bool whole_word_only,
#endif
bool no_sameline, const filestruct *begin, size_t begin_x, const
char *needle, size_t *needle_len);
const filestruct *begin, size_t begin_x,
const char *needle, size_t *needle_len);
void findnextstr_wrap_reset(void);
void do_search(void);
#ifndef NANO_TINY
void do_findprevious(void);
void do_findnext(void);
#endif
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
void do_research(void);
#endif
@@ -598,19 +612,15 @@ int replace_regexp(char *string, bool create);
char *replace_line(const char *needle);
ssize_t do_replace_loop(
#ifndef DISABLE_SPELLER
bool whole_word,
bool whole_word_only,
#endif
bool *canceled, const filestruct *real_current, size_t
*real_current_x, const char *needle);
void do_replace(void);
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive, bool save_pos, bool allow_update);
void do_gotolinecolumn_void(void);
#ifndef DISABLE_SPELLER
void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
pos_pww);
#endif
void goto_line_posx(ssize_t line, size_t pos_x);
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive);
void do_gotolinecolumn_void(void);
#ifndef NANO_TINY
bool find_bracket_match(bool reverse, const char *bracket_set);
void do_find_bracket(void);
@@ -637,6 +647,10 @@ void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
#ifndef NANO_TINY
void do_cut_prev_word(void);
void do_cut_next_word(void);
#endif
void do_tab(void);
#ifndef NANO_TINY
void do_indent(ssize_t cols);
@@ -645,8 +659,7 @@ void do_unindent(void);
void do_undo(void);
void do_redo(void);
#endif
void do_enter(bool undoing);
void do_enter_void(void);
void do_enter(void);
#ifndef NANO_TINY
RETSIGTYPE cancel_command(int signal);
bool execute_command(const char *command);
@@ -688,6 +701,7 @@ void do_spell(void);
#endif
#ifndef DISABLE_COLOR
void do_linter(void);
void do_formatter(void);
#endif
#ifndef NANO_TINY
void do_wordlinechar_count(void);
@@ -695,7 +709,6 @@ void do_wordlinechar_count(void);
void do_verbatim_input(void);
/* All functions in utils.c. */
int digits(size_t n);
void get_homedir(void);
bool parse_num(const char *str, ssize_t *val);
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
@@ -712,7 +725,6 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
#endif
#endif
#ifdef HAVE_REGEX_H
bool regexp_bol_or_eol(const regex_t *preg, const char *string);
const char *fixbounds(const char *r);
#endif
#ifndef DISABLE_SPELLER
@@ -736,7 +748,8 @@ void new_magicline(void);
void remove_magicline(void);
void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x, bool *right_side_up);
void add_undo(undo_type current_action);
void discard_until(const undo *thisitem, openfilestruct *thefile);
void add_undo(undo_type action);
void update_undo(undo_type action);
#endif
size_t get_totsize(const filestruct *begin, const filestruct *end);
@@ -746,7 +759,7 @@ void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
/* All functions in winio.c. */
/* Most functions in winio.c. */
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
void unget_input(int *input, size_t input_len);
@@ -754,9 +767,8 @@ void unget_kbinput(int kbinput, bool metakey, bool funckey);
int *get_input(WINDOW *win, size_t input_len);
int get_kbinput(WINDOW *win);
int parse_kbinput(WINDOW *win);
int get_escape_seq_kbinput(const int *seq, size_t seq_len);
int get_escape_seq_abcd(int kbinput);
int parse_escape_seq_kbinput(WINDOW *win, int kbinput);
int arrow_from_abcd(int kbinput);
int parse_escape_sequence(WINDOW *win, int kbinput);
int get_byte_kbinput(int kbinput);
#ifdef ENABLE_UTF8
long add_unicode_digit(int kbinput, long factor, long *uni);
@@ -780,7 +792,7 @@ void check_statusblank(void);
char *display_string(const char *buf, size_t start_col, size_t len, bool
dollars);
void titlebar(const char *path);
void set_modified(void);
extern void set_modified(void);
void statusbar(const char *msg, ...);
void bottombars(int menu);
void onekey(const char *keystroke, const char *desc, size_t len);
@@ -788,8 +800,7 @@ void reset_cursor(void);
void edit_draw(filestruct *fileptr, const char *converted, int
line, size_t start);
int update_line(filestruct *fileptr, size_t index);
bool need_horizontal_update(size_t pww_save);
bool need_vertical_update(size_t pww_save);
bool need_screen_update(size_t pww_save);
void edit_scroll(scroll_dir direction, ssize_t nlines);
void edit_redraw(filestruct *old_current, size_t pww_save);
void edit_refresh(void);
@@ -811,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);
@@ -822,6 +831,7 @@ void mac_format_void(void);
void append_void(void);
void prepend_void(void);
void backup_file_void(void);
void discard_buffer(void);
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);

View File

@@ -38,21 +38,21 @@ static const rcoption rcopts[] = {
#ifndef DISABLE_JUSTIFY
{"brackets", 0},
#endif
{"const", CONST_UPDATE},
{"const", CONST_UPDATE}, /* deprecated form, remove in 2018 */
{"constantshow", CONST_UPDATE},
#ifndef DISABLE_WRAPJUSTIFY
{"fill", 0},
#endif
#ifndef NANO_TINY
{"locking", LOCKING},
#ifndef DISABLE_HISTORIES
{"historylog", HISTORYLOG},
#endif
{"morespace", MORE_SPACE},
#ifndef DISABLE_MOUSE
{"mouse", USE_MOUSE},
#endif
#ifndef DISABLE_MULTIBUFFER
{"multibuffer", MULTIBUFFER},
#endif
{"morespace", MORE_SPACE},
{"nofollow", NOFOLLOW_SYMLINKS},
{"nohelp", NO_HELP},
{"nonewlines", NO_NEWLINES},
#ifndef DISABLE_WRAPPING
@@ -60,6 +60,10 @@ static const rcoption rcopts[] = {
#endif
#ifndef DISABLE_OPERATINGDIR
{"operatingdir", 0},
#endif
#ifndef DISABLE_HISTORIES
{"poslog", POS_HISTORY}, /* deprecated form, remove in 2018 */
{"positionlog", POS_HISTORY},
#endif
{"preserve", PRESERVE},
#ifndef DISABLE_JUSTIFY
@@ -79,25 +83,25 @@ static const rcoption rcopts[] = {
{"tempfile", TEMP_FILE},
{"view", VIEW_MODE},
#ifndef NANO_TINY
{"allow_insecure_backup", INSECURE_BACKUP},
{"autoindent", AUTOINDENT},
{"backup", BACKUP_FILE},
{"allow_insecure_backup", INSECURE_BACKUP},
{"backupdir", 0},
{"backwards", BACKWARDS_SEARCH},
{"casesensitive", CASE_SENSITIVE},
{"cut", CUT_TO_END},
{"historylog", HISTORYLOG},
{"locking", LOCKING},
{"matchbrackets", 0},
{"noconvert", NO_CONVERT},
{"poslog", POS_HISTORY},
{"quiet", QUIET},
{"quickblank", QUICK_BLANK},
{"quiet", QUIET},
{"smarthome", SMART_HOME},
{"smooth", SMOOTH_SCROLL},
{"softwrap", SOFTWRAP},
{"tabstospaces", TABS_TO_SPACES},
{"unix", MAKE_IT_UNIX},
{"whitespace", 0},
{"wordbounds", WORD_BOUNDS},
{"softwrap", SOFTWRAP},
#endif
#ifndef DISABLE_COLOR
{"titlecolor", 0},
@@ -328,6 +332,7 @@ void parse_syntax(char *ptr)
endsyntax->next = NULL;
endsyntax->nmultis = 0;
endsyntax->linter = NULL;
endsyntax->formatter = NULL;
#ifdef DEBUG
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
@@ -383,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. */
@@ -439,7 +430,7 @@ void parse_binding(char *ptr, bool dobind)
if (strlen(keycopy) < 2) {
rcfile_error(N_("Key name is too short"));
return;
goto free_copy;
}
/* Uppercase only the first two or three characters of the key name. */
@@ -450,7 +441,7 @@ void parse_binding(char *ptr, bool dobind)
keycopy[2] = toupper(keycopy[2]);
else {
rcfile_error(N_("Key name is too short"));
return;
goto free_copy;
}
}
@@ -460,7 +451,10 @@ void parse_binding(char *ptr, bool dobind)
keycopy[1] = tolower(keycopy[1]);
else if (keycopy[0] != '^' && keycopy[0] != 'M' && keycopy[0] != 'F') {
rcfile_error(N_("Key name must begin with \"^\", \"M\", or \"F\""));
return;
goto free_copy;
} else if (keycopy[0] == '^' && (keycopy[1] < 64 || keycopy[1] > 127)) {
rcfile_error(N_("Key name %s is invalid"), keycopy);
goto free_copy;
}
if (dobind) {
@@ -469,7 +463,7 @@ void parse_binding(char *ptr, bool dobind)
if (funcptr[0] == '\0') {
rcfile_error(N_("Must specify a function to bind the key to"));
return;
goto free_copy;
}
}
@@ -479,21 +473,21 @@ void parse_binding(char *ptr, bool dobind)
if (menuptr[0] == '\0') {
/* TRANSLATORS: Do not translate the word "all". */
rcfile_error(N_("Must specify a menu (or \"all\") in which to bind/unbind the key"));
return;
goto free_copy;
}
if (dobind) {
newsc = strtosc(funcptr);
if (newsc == NULL) {
rcfile_error(N_("Cannot map name \"%s\" to a function"), funcptr);
return;
goto free_copy;
}
}
menu = strtomenu(menuptr);
if (menu < 1) {
rcfile_error(N_("Cannot map name \"%s\" to a menu"), menuptr);
return;
goto free_copy;
}
#ifdef DEBUG
@@ -513,6 +507,10 @@ void parse_binding(char *ptr, bool dobind)
if (f->scfunc == newsc->scfunc)
mask = mask | f->menus;
/* Handle the special case of the toggles. */
if (newsc->scfunc == do_toggle_void)
mask = MMAIN;
/* Now limit the given menu to those where the function exists. */
if (is_universal(newsc->scfunc))
menu = menu & MMOST;
@@ -522,40 +520,52 @@ void parse_binding(char *ptr, bool dobind)
if (!menu) {
rcfile_error(N_("Function '%s' does not exist in menu '%s'"), funcptr, menuptr);
free(newsc);
return;
goto free_copy;
}
newsc->keystr = keycopy;
newsc->menu = menu;
newsc->menus = menu;
newsc->type = strtokeytype(newsc->keystr);
assign_keyinfo(newsc);
/* 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
if (check_bad_binding(newsc)) {
rcfile_error(N_("Sorry, keystroke \"%s\" may not be rebound"), newsc->keystr);
free(newsc);
return;
}
}
/* Now find and delete any existing same shortcut in the menu(s). */
for (s = sclist; s != NULL; s = s->next) {
if (((s->menu & menu)) && !strcmp(s->keystr, keycopy)) {
if ((s->menus & menu) && !strcmp(s->keystr, keycopy)) {
#ifdef DEBUG
fprintf(stderr, "deleting entry from menu %x\n", s->menu);
fprintf(stderr, "deleting entry from among menus %x\n", s->menus);
#endif
s->menu &= ~menu;
s->menus &= ~menu;
}
}
if (dobind) {
/* If this is a toggle, copy its sequence number. */
if (newsc->scfunc == do_toggle_void) {
for (s = sclist; s != NULL; s = s->next)
if (s->scfunc == do_toggle_void && s->toggle == newsc->toggle)
newsc->ordinal = s->ordinal;
} else
newsc->ordinal = 0;
/* Add the new shortcut at the start of the list. */
newsc->next = sclist;
sclist = newsc;
return;
}
free_copy:
free(keycopy);
}
@@ -596,11 +606,7 @@ static void _parse_include(char *file)
fprintf(stderr, "Parsing file \"%s\"\n", file);
#endif
parse_rcfile(rcstream
#ifndef DISABLE_COLOR
, TRUE
#endif
);
parse_rcfile(rcstream, TRUE);
}
void parse_include(char *ptr)
@@ -902,11 +908,10 @@ void parse_header_exp(char *ptr)
}
}
#ifndef DISABLE_COLOR
#ifdef HAVE_LIBMAGIC
/* Parse the magic regexes that may influence the choice of syntax. */
void parse_magic_exp(char *ptr)
{
#ifdef HAVE_LIBMAGIC
regexlisttype *endmagic = NULL;
assert(ptr != NULL);
@@ -966,11 +971,10 @@ void parse_magic_exp(char *ptr)
} else
free(newmagic);
}
#endif /* HAVE_LIBMAGIC */
}
#endif /* !DISABLE_COLOR */
#endif /* HAVE_LIBMAGIC */
/* Parse the linter requested for this syntax. Simple? */
/* Parse the linter requested for this syntax. */
void parse_linter(char *ptr)
{
assert(ptr != NULL);
@@ -986,15 +990,41 @@ void parse_linter(char *ptr)
return;
}
if (endsyntax->linter != NULL)
free(endsyntax->linter);
free(endsyntax->linter);
/* Let them unset the linter by using "". */
if (!strcmp(ptr, "\"\""))
endsyntax->linter = NULL;
else
endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr);
endsyntax->linter = mallocstrcpy(NULL, ptr);
}
#ifndef DISABLE_SPELLER
/* Parse the formatter requested for this syntax. */
void parse_formatter(char *ptr)
{
assert(ptr != NULL);
if (syntaxes == NULL) {
rcfile_error(
N_("Cannot add formatter without a syntax command"));
return;
}
if (*ptr == '\0') {
rcfile_error(N_("Missing formatter command"));
return;
}
free(endsyntax->formatter);
/* Let them unset the formatter by using "". */
if (!strcmp(ptr, "\"\""))
endsyntax->formatter = NULL;
else
endsyntax->formatter = mallocstrcpy(NULL, ptr);
}
#endif /* !DISABLE_SPELLER */
#endif /* !DISABLE_COLOR */
/* Check whether the user has unmapped every shortcut for a
@@ -1121,7 +1151,11 @@ void parse_rcfile(FILE *rcstream
parse_syntax(ptr);
}
else if (strcasecmp(keyword, "magic") == 0)
#ifdef HAVE_LIBMAGIC
parse_magic_exp(ptr);
#else
;
#endif
else if (strcasecmp(keyword, "header") == 0)
parse_header_exp(ptr);
else if (strcasecmp(keyword, "color") == 0)
@@ -1130,6 +1164,12 @@ void parse_rcfile(FILE *rcstream
parse_colors(ptr, TRUE);
else if (strcasecmp(keyword, "linter") == 0)
parse_linter(ptr);
else if (strcasecmp(keyword, "formatter") == 0)
#ifndef DISABLE_SPELLER
parse_formatter(ptr);
#else
;
#endif
#endif /* !DISABLE_COLOR */
else if (strcasecmp(keyword, "bind") == 0)
parse_binding(ptr, TRUE);

View File

@@ -106,6 +106,7 @@ void not_found_msg(const char *str)
void search_replace_abort(void)
{
display_main_list();
focusing = FALSE;
#ifndef NANO_TINY
if (openfile->mark_set)
edit_refresh();
@@ -115,15 +116,6 @@ void search_replace_abort(void)
#endif
}
/* Initialize the global search and replace strings. */
void search_init_globals(void)
{
if (last_search == NULL)
last_search = mallocstrcpy(NULL, "");
if (last_replace == NULL)
last_replace = mallocstrcpy(NULL, "");
}
/* Set up the system variables for a search or replace. If use_answer
* is TRUE, only set backupstring to answer. Return -2 to run the
* opposite program (search -> replace, replace -> search), return -1 if
@@ -155,14 +147,13 @@ int search_init(bool replacing, bool use_answer)
* do_search() or do_replace() and be called again. In that case,
* we should put the same search string back up. */
search_init_globals();
focusing = TRUE;
if (last_search[0] != '\0') {
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
buf = charalloc(strlen(disp) + 7);
/* We use (COLS / 3) here because we need to see more on the
* line. */
/* We use (COLS / 3) here because we need to see more on the line. */
sprintf(buf, " [%s%s]", disp,
(strlenpt(last_search) > COLS / 3) ? "..." : "");
free(disp);
@@ -245,8 +236,7 @@ int search_init(bool replacing, bool use_answer)
return -2; /* Call the opposite search function. */
} else if (func == do_gotolinecolumn_void) {
do_gotolinecolumn(openfile->current->lineno,
openfile->placewewant + 1, TRUE, TRUE, FALSE,
TRUE);
openfile->placewewant + 1, TRUE, TRUE);
/* Put answer up on the statusbar and
* fall through. */
return 3;
@@ -258,17 +248,16 @@ int search_init(bool replacing, bool use_answer)
return 0;
}
/* Look for needle, starting at (current, current_x). If no_sameline is
* TRUE, skip over begin when looking for needle. begin is the line
/* Look for needle, starting at (current, current_x). begin is the line
* where we first started searching, at column begin_x. The return
* value specifies whether we found anything. If we did, set needle_len
* to the length of the string we found if it isn't NULL. */
bool findnextstr(
#ifndef DISABLE_SPELLER
bool whole_word,
bool whole_word_only,
#endif
bool no_sameline, const filestruct *begin, size_t begin_x, const
char *needle, size_t *needle_len)
const filestruct *begin, size_t begin_x,
const char *needle, size_t *needle_len)
{
size_t found_len;
/* The length of the match we find. */
@@ -287,9 +276,9 @@ bool findnextstr(
rev_start +=
#ifndef NANO_TINY
ISSET(BACKWARDS_SEARCH) ?
openfile->current_x - 1 :
((openfile->current_x == 0) ? -1 : move_mbleft(fileptr->data, openfile->current_x)) :
#endif
openfile->current_x + 1;
move_mbright(fileptr->data, openfile->current_x);
/* Look for needle in the current line we're searching. */
enable_nodelay();
@@ -325,7 +314,7 @@ bool findnextstr(
#ifndef DISABLE_SPELLER
/* If we're searching for whole words, see if this potential
* match is a whole word. */
if (whole_word) {
if (whole_word_only) {
char *word = mallocstrncpy(NULL, found, found_len + 1);
word[found_len] = '\0';
@@ -333,22 +322,16 @@ bool findnextstr(
fileptr->data, word);
free(word);
}
#endif
/* If we're searching for whole words and this potential
* match isn't a whole word, or if we're not allowed to find
* a match on the same line we started on and this potential
* match is on that line, continue searching. */
if (
#ifndef DISABLE_SPELLER
(!whole_word || found_whole) &&
* match isn't a whole word, continue searching. */
if (!whole_word_only || found_whole)
#endif
(!no_sameline || fileptr != openfile->current))
break;
}
/* We've finished processing the file, so get out. */
if (search_last_line) {
/* We've finished processing the file, so get out. */
not_found_msg(needle);
disable_nodelay();
return FALSE;
@@ -367,9 +350,8 @@ bool findnextstr(
}
#endif
/* We've reached the start or end of the buffer, so wrap
* around. */
if (fileptr == NULL) {
/* We've reached the start or end of the buffer, so wrap around. */
#ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH)) {
fileptr = openfile->filebot;
@@ -384,8 +366,8 @@ bool findnextstr(
statusbar(_("Search Wrapped"));
}
/* We've reached the original starting line. */
if (fileptr == begin)
/* We've reached the original starting line. */
search_last_line = TRUE;
rev_start = fileptr->data;
@@ -445,8 +427,7 @@ void do_search(void)
i = search_init(FALSE, FALSE);
if (i == -1)
/* Cancel, Go to Line, blank search string, or regcomp()
* failed. */
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
search_replace_abort();
else if (i == -2)
/* Replace. */
@@ -478,42 +459,44 @@ void do_search(void)
#ifndef DISABLE_SPELLER
FALSE,
#endif
FALSE, openfile->current, openfile->current_x, answer, NULL);
openfile->current, openfile->current_x, answer, NULL);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && didfind) {
#ifdef HAVE_REGEX_H
/* Do the search again, skipping over the current line, if we're
* doing a bol and/or eol regex search ("^", "$", or "^$"), so
* that we find one only once per line. We should only end up
* back at the same position if the string isn't found again, in
* which case it's the only occurrence. */
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
last_search)) {
didfind = findnextstr(
#ifndef DISABLE_SPELLER
FALSE,
#endif
TRUE, openfile->current,
openfile->current_x, answer, NULL);
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && !didfind)
statusbar(_("This is the only occurrence"));
} else {
#endif
statusbar(_("This is the only occurrence"));
#ifdef HAVE_REGEX_H
}
#endif
}
/* If we found something, and we're back at the exact same spot where
* we started searching, then 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);
search_replace_abort();
}
#ifndef NANO_TINY
/* Search in the backward direction for the next occurrence. */
void do_findprevious(void)
{
if ISSET(BACKWARDS_SEARCH)
do_research();
else {
SET(BACKWARDS_SEARCH);
do_research();
UNSET(BACKWARDS_SEARCH);
}
}
/* Search in the forward direction for the next occurrence. */
void do_findnext(void)
{
if ISSET(BACKWARDS_SEARCH) {
UNSET(BACKWARDS_SEARCH);
do_research();
SET(BACKWARDS_SEARCH);
} else
do_research();
}
#endif
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
/* Search for the last string without prompting. */
void do_research(void)
@@ -523,9 +506,18 @@ void do_research(void)
size_t pww_save = openfile->placewewant;
bool didfind;
search_init_globals();
focusing = TRUE;
if (last_search[0] != '\0') {
#ifndef DISABLE_HISTORIES
/* If nothing was searched for yet during this run of nano, but
* there is a search history, take the most recent item. */
if (last_search[0] == '\0' && searchbot->prev != NULL)
last_search = mallocstrcpy(last_search, searchbot->prev->data);
#endif
if (last_search[0] == '\0')
statusbar(_("No current search pattern"));
else {
#ifdef HAVE_REGEX_H
/* Since answer is "", use last_search! */
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
@@ -537,39 +529,14 @@ void do_research(void)
#ifndef DISABLE_SPELLER
FALSE,
#endif
FALSE, openfile->current, openfile->current_x,
last_search, NULL);
openfile->current, openfile->current_x, last_search, NULL);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && didfind) {
#ifdef HAVE_REGEX_H
/* Do the search again, skipping over the current line, if
* we're doing a bol and/or eol regex search ("^", "$", or
* "^$"), so that we find one only once per line. We should
* only end up back at the same position if the string isn't
* found again, in which case it's the only occurrence. */
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
last_search)) {
didfind = findnextstr(
#ifndef DISABLE_SPELLER
FALSE,
#endif
TRUE, openfile->current, openfile->current_x,
answer, NULL);
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && !didfind)
statusbar(_("This is the only occurrence"));
} else {
#endif /* HAVE_REGEX_H */
statusbar(_("This is the only occurrence"));
#ifdef HAVE_REGEX_H
}
#endif
}
} else
statusbar(_("No current search pattern"));
/* If we found something, and we're back at the exact same spot
* where we started searching, then this is the only occurrence. */
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);
@@ -578,17 +545,13 @@ void do_research(void)
#endif /* !NANO_TINY */
#ifdef HAVE_REGEX_H
/* Calculate the size of the replacement text, taking possible
* subexpressions \1 to \9 into account. Return the replacement
* text in the passed string only when create is TRUE. */
int replace_regexp(char *string, bool create)
{
/* We have a split personality here. If create is FALSE, just
* calculate the size of the replacement line (necessary because of
* subexpressions \1 to \9 in the replaced text). */
const char *c = last_replace;
size_t search_match_count = regmatches[0].rm_eo -
regmatches[0].rm_so;
size_t new_line_size = strlen(openfile->current->data) + 1 -
search_match_count;
size_t replacement_size = 0;
/* Iterate through the replacement text to handle subexpression
* replacement using \1, \2, \3, etc. */
@@ -600,7 +563,7 @@ int replace_regexp(char *string, bool create)
if (create)
*string++ = *c;
c++;
new_line_size++;
replacement_size++;
} else {
size_t i = regmatches[num].rm_eo - regmatches[num].rm_so;
@@ -608,7 +571,7 @@ int replace_regexp(char *string, bool create)
c += 2;
/* But add the length of the subexpression to new_size. */
new_line_size += i;
replacement_size += i;
/* And if create is TRUE, append the result of the
* subexpression match to the new line. */
@@ -623,25 +586,26 @@ int replace_regexp(char *string, bool create)
if (create)
*string = '\0';
return new_line_size;
return replacement_size;
}
#endif /* HAVE_REGEX_H */
/* Return a copy of the current line with one needle replaced. */
char *replace_line(const char *needle)
{
char *copy;
size_t new_line_size, search_match_count;
size_t match_len;
size_t new_line_size = strlen(openfile->current->data) + 1;
/* Calculate the size of the new line. */
/* First adjust the size of the new line for the change. */
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP)) {
search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
new_line_size = replace_regexp(NULL, FALSE);
match_len = regmatches[0].rm_eo - regmatches[0].rm_so;
new_line_size += replace_regexp(NULL, FALSE) - match_len;
} else {
#endif
search_match_count = strlen(needle);
new_line_size = strlen(openfile->current->data) -
search_match_count + strlen(answer) + 1;
match_len = strlen(needle);
new_line_size += strlen(answer) - match_len;
#ifdef HAVE_REGEX_H
}
#endif
@@ -649,10 +613,10 @@ char *replace_line(const char *needle)
/* Create the buffer. */
copy = charalloc(new_line_size);
/* The head of the original line. */
/* Copy the head of the original line. */
strncpy(copy, openfile->current->data, openfile->current_x);
/* The replacement text. */
/* Add the replacement text. */
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP))
replace_regexp(copy + openfile->current_x, TRUE);
@@ -660,11 +624,10 @@ char *replace_line(const char *needle)
#endif
strcpy(copy + openfile->current_x, answer);
/* The tail of the original line. */
assert(openfile->current_x + search_match_count <= strlen(openfile->current->data));
assert(openfile->current_x + match_len <= strlen(openfile->current->data));
strcat(copy, openfile->current->data + openfile->current_x +
search_match_count);
/* Copy the tail of the original line. */
strcat(copy, openfile->current->data + openfile->current_x + match_len);
return copy;
}
@@ -679,7 +642,7 @@ char *replace_line(const char *needle)
* canceled isn't NULL, set it to TRUE if we canceled. */
ssize_t do_replace_loop(
#ifndef DISABLE_SPELLER
bool whole_word,
bool whole_word_only,
#endif
bool *canceled, const filestruct *real_current, size_t
*real_current_x, const char *needle)
@@ -687,31 +650,28 @@ ssize_t do_replace_loop(
ssize_t numreplaced = -1;
size_t match_len;
bool replaceall = FALSE;
#ifdef HAVE_REGEX_H
/* The starting-line match and bol/eol regex flags. */
bool begin_line = FALSE, bol_or_eol = FALSE;
#endif
#ifndef NANO_TINY
bool old_mark_set = openfile->mark_set;
filestruct *edittop_save = openfile->edittop, *top, *bot;
filestruct *top, *bot;
size_t top_x, bot_x;
bool right_side_up = FALSE;
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
* FALSE if (current, current_x) is. */
if (old_mark_set) {
/* If the mark is on, partition the filestruct so that it
* contains only the marked text, set edittop to the top of the
* partition, turn the mark off, and refresh the screen. */
/* If the mark is on, frame the region, and turn the mark off. */
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
filepart = partition_filestruct(top, top_x, bot, bot_x);
openfile->edittop = openfile->fileage;
openfile->mark_set = FALSE;
#ifndef DISABLE_COLOR
reset_multis(openfile->current, TRUE);
#endif
edit_refresh();
/* Start either at the top or the bottom of the marked region. */
if (!ISSET(BACKWARDS_SEARCH)) {
openfile->current = top;
openfile->current_x = (top_x == 0 ? 0 : top_x - 1);
} else {
openfile->current = bot;
openfile->current_x = bot_x;
}
}
#endif /* !NANO_TINY */
@@ -721,41 +681,23 @@ ssize_t do_replace_loop(
findnextstr_wrap_reset();
while (findnextstr(
#ifndef DISABLE_SPELLER
whole_word,
whole_word_only,
#endif
#ifdef HAVE_REGEX_H
/* We should find a bol and/or eol regex only once per line. If
* the bol_or_eol flag is set, it means that the last search
* found one on the beginning line, so we should skip over the
* beginning line when doing this search. */
bol_or_eol
#else
FALSE
#endif
, real_current, *real_current_x, needle, &match_len)) {
real_current, *real_current_x, needle, &match_len)) {
int i = 0;
#ifdef HAVE_REGEX_H
/* If the bol_or_eol flag is set, we've found a match on the
* beginning line already, and we're still on the beginning line
* after the search, it means that we've wrapped around, so
* we're done. */
if (bol_or_eol && begin_line && openfile->current ==
real_current)
break;
/* Otherwise, set the begin_line flag if we've found a match on
* the beginning line, reset the bol_or_eol flag, and
* continue. */
else {
if (openfile->current == real_current)
begin_line = TRUE;
bol_or_eol = FALSE;
#ifndef NANO_TINY
if (old_mark_set) {
/* When we've found an occurrence outside of the marked region,
* stop the fanfare. */
if (openfile->current->lineno > bot->lineno ||
openfile->current->lineno < top->lineno ||
(openfile->current == bot && openfile->current_x > bot_x) ||
(openfile->current == top && openfile->current_x < top_x))
break;
}
#endif
if (!replaceall)
edit_refresh();
/* Indicate that we found the search string. */
if (numreplaced == -1)
numreplaced = 0;
@@ -766,6 +708,8 @@ ssize_t do_replace_loop(
xpt, strnlenpt(openfile->current->data,
openfile->current_x + match_len) - xpt, FALSE);
edit_refresh();
curs_set(0);
do_replace_highlight(TRUE, exp_word);
@@ -786,59 +730,53 @@ ssize_t do_replace_loop(
}
}
#ifdef HAVE_REGEX_H
/* Set the bol_or_eol flag if we're doing a bol and/or eol regex
* replace ("^", "$", or "^$"). */
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
needle))
bol_or_eol = TRUE;
#endif
if (i > 0 || replaceall) { /* Yes, replace it!!!! */
char *copy;
size_t length_change;
#ifndef NANO_TINY
update_undo(REPLACE);
add_undo(REPLACE);
#endif
if (i == 2)
replaceall = TRUE;
copy = replace_line(needle);
length_change = strlen(copy) -
strlen(openfile->current->data);
length_change = strlen(copy) - strlen(openfile->current->data);
#ifndef NANO_TINY
/* If the mark was on and (mark_begin, mark_begin_x) was the
* top of it, don't change mark_begin_x. */
if (!old_mark_set || !right_side_up) {
/* Keep mark_begin_x in sync with the text changes. */
/* If the mark was on and it was located after the cursor,
* then adjust its x position for any text length changes. */
if (old_mark_set && !right_side_up) {
if (openfile->current == openfile->mark_begin &&
openfile->mark_begin_x > openfile->current_x) {
if (openfile->mark_begin_x < openfile->current_x +
match_len)
if (openfile->mark_begin_x < openfile->current_x + match_len)
openfile->mark_begin_x = openfile->current_x;
else
openfile->mark_begin_x += length_change;
bot_x = openfile->mark_begin_x;
}
}
/* If the mark was on and (current, current_x) was the top
* of it, don't change real_current_x. */
/* If the mark was not on or it was before the cursor, then
* adjust the cursor's x position for any text length changes. */
if (!old_mark_set || right_side_up) {
#endif
/* Keep real_current_x in sync with the text changes. */
if (openfile->current == real_current &&
openfile->current_x <= *real_current_x) {
if (*real_current_x <
openfile->current_x + match_len)
*real_current_x = openfile->current_x +
match_len;
if (*real_current_x < openfile->current_x + match_len)
*real_current_x = openfile->current_x + match_len;
*real_current_x += length_change;
}
#ifndef NANO_TINY
bot_x = *real_current_x;
}
#endif
}
#ifdef HAVE_REGEX_H
/* Don't find the same zero-length match again. */
if (match_len == 0)
match_len++;
#endif
/* Set the cursor at the last character of the replacement
@@ -850,22 +788,23 @@ ssize_t do_replace_loop(
#endif
openfile->current_x += match_len + length_change - 1;
/* Cleanup. */
openfile->totsize += mbstrlen(copy) -
mbstrlen(openfile->current->data);
/* Update the file size, and put the changed line into place. */
openfile->totsize += mbstrlen(copy) - mbstrlen(openfile->current->data);
free(openfile->current->data);
openfile->current->data = copy;
#ifndef DISABLE_COLOR
reset_multis(openfile->current, TRUE);
/* Reset the precalculated multiline-regex hints only when
* the first replacement has been made. */
if (numreplaced == 0)
reset_multis(openfile->current, TRUE);
#endif
edit_refresh();
if (!replaceall) {
#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
@@ -877,16 +816,12 @@ ssize_t do_replace_loop(
}
}
if (numreplaced == -1)
not_found_msg(needle);
#ifndef NANO_TINY
if (old_mark_set) {
/* If the mark was on, unpartition the filestruct so that it
* contains all the text again, set edittop back to what it was
* before, turn the mark back on, and refresh the screen. */
unpartition_filestruct(&filepart);
openfile->edittop = edittop_save;
if (old_mark_set)
openfile->mark_set = TRUE;
edit_refresh();
}
#endif
/* If the NO_NEWLINES flag isn't set, and text has been added to the
@@ -913,8 +848,7 @@ void do_replace(void)
i = search_init(TRUE, FALSE);
if (i == -1) {
/* Cancel, Go to Line, blank search string, or regcomp()
* failed. */
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
search_replace_abort();
return;
} else if (i == -2) {
@@ -951,8 +885,7 @@ void do_replace(void)
edit_refresh, _("Replace with"));
#ifndef DISABLE_HISTORIES
/* Add this replace string to the replace history list. i == 0
* means that the string is not "". */
/* If the replace string is not "", add it to the replace history list. */
if (i == 0)
update_history(&replace_history, answer);
#endif
@@ -1000,8 +933,8 @@ void do_replace(void)
/* Go to the specified line and x position. */
void goto_line_posx(ssize_t line, size_t pos_x)
{
for (openfile->current = openfile->fileage; openfile->current != openfile->filebot &&
openfile->current->next != NULL && line > 1; line--)
for (openfile->current = openfile->fileage; line > 1 &&
openfile->current != openfile->filebot; line--)
openfile->current = openfile->current->next;
openfile->current_x = pos_x;
@@ -1011,11 +944,10 @@ void goto_line_posx(ssize_t line, size_t pos_x)
}
/* Go to the specified line and column, or ask for them if interactive
* is TRUE. Save the x-coordinate and y-coordinate if save_pos is TRUE.
* Update the screen afterwards if allow_update is TRUE. Note that both
* the line and column numbers should be one-based. */
* is TRUE. In the latter case also update the screen afterwards.
* Note that both the line and column number should be one-based. */
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive, bool save_pos, bool allow_update)
bool interactive)
{
if (interactive) {
char *ans = mallocstrcpy(NULL, answer);
@@ -1070,22 +1002,19 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
column = openfile->placewewant + 1;
}
for (openfile->current = openfile->fileage;
openfile->current != openfile->filebot && line > 1; line--)
for (openfile->current = openfile->fileage; line > 1 &&
openfile->current != openfile->filebot; line--)
openfile->current = openfile->current->next;
openfile->current_x = actual_x(openfile->current->data, column - 1);
openfile->placewewant = column - 1;
/* Put the top line of the edit window in range of the current line.
* If save_pos is TRUE, don't change the cursor position when doing
* it. */
edit_update(save_pos ? NONE : CENTER);
/* Put the top line of the edit window in range of the current line. */
edit_update(CENTER);
/* If allow_update is TRUE, update the screen. */
if (allow_update) {
/* When in interactive mode, update the screen. */
if (interactive) {
edit_refresh();
display_main_list();
}
}
@@ -1094,27 +1023,9 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
void do_gotolinecolumn_void(void)
{
do_gotolinecolumn(openfile->current->lineno,
openfile->placewewant + 1, FALSE, TRUE, FALSE, TRUE);
openfile->placewewant + 1, FALSE, TRUE);
}
#ifndef DISABLE_SPELLER
/* Go to the line with the number specified in pos_line, the
* x-coordinate specified in pos_x, the y-coordinate specified in pos_y,
* and the place we want specified in pos_pww. */
void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
pos_pww)
{
/* Since do_gotolinecolumn() resets the x-coordinate but not the
* y-coordinate, set the coordinates up this way. */
openfile->current_y = pos_y;
do_gotolinecolumn(pos_line, pos_x + 1, FALSE, FALSE, TRUE, TRUE);
/* Set the rest of the coordinates up. */
openfile->placewewant = pos_pww;
update_line(openfile->current, pos_x);
}
#endif
#ifndef NANO_TINY
/* Search for a match to one of the two characters in bracket_set. If
* reverse is TRUE, search backwards for the leftmost bracket.
@@ -1144,8 +1055,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
mbrevstrpbrk(fileptr->data, bracket_set, rev_start) :
mbstrpbrk(rev_start, bracket_set));
/* We've found a potential match. */
if (found != NULL)
/* We've found a potential match. */
break;
if (reverse) {
@@ -1156,8 +1067,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
current_y_find++;
}
/* We've reached the start or end of the buffer, so get out. */
if (fileptr == NULL)
/* We've reached the start or end of the buffer, so get out. */
return FALSE;
rev_start = fileptr->data;
@@ -1211,7 +1122,7 @@ void do_find_bracket(void)
ch = openfile->current->data + openfile->current_x;
if (ch == '\0' || (ch = mbstrchr(matchbrackets, ch)) == NULL) {
if ((ch = mbstrchr(matchbrackets, ch)) == NULL) {
statusbar(_("Not a bracket"));
return;
}
@@ -1372,9 +1283,7 @@ void update_history(filestruct **h, const char *s)
foo = p;
bar = p->next;
unlink_node(foo);
delete_node(foo);
if (bar != NULL)
renumber(bar);
renumber(bar);
}
/* If the history is full, delete the beginning entry to make room
@@ -1385,13 +1294,12 @@ void update_history(filestruct **h, const char *s)
*hage = (*hage)->next;
unlink_node(foo);
delete_node(foo);
renumber(*hage);
}
/* Add the new entry to the end. */
(*hbot)->data = mallocstrcpy((*hbot)->data, s);
splice_node(*hbot, make_new_node(*hbot), (*hbot)->next);
splice_node(*hbot, make_new_node(*hbot));
*hbot = (*hbot)->next;
(*hbot)->data = mallocstrcpy(NULL, "");

1155
src/text.c

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff