Compare commits
210 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5190ab9c9b | ||
|
|
b60f555843 | ||
|
|
953ccc990f | ||
|
|
296ff1ed2a | ||
|
|
6062a040e1 | ||
|
|
954f98c448 | ||
|
|
076fcbf631 | ||
|
|
38e8ed14ca | ||
|
|
ecffb85656 | ||
|
|
f0bb50306c | ||
|
|
412b9fc0a2 | ||
|
|
75ac24b25e | ||
|
|
4499520c03 | ||
|
|
7f0003a54b | ||
|
|
57f52a8a20 | ||
|
|
e219bb9dba | ||
|
|
4310139117 | ||
|
|
11fa458677 | ||
|
|
e06472a249 | ||
|
|
a267699440 | ||
|
|
025553769e | ||
|
|
7c2f53b2a9 | ||
|
|
3021a04c1c | ||
|
|
86cbd959f6 | ||
|
|
ef2593695d | ||
|
|
6404101407 | ||
|
|
67667af233 | ||
|
|
82373d85f9 | ||
|
|
c32a58a826 | ||
|
|
26ae9dbd12 | ||
|
|
d49c267f91 | ||
|
|
2e121fa08c | ||
|
|
e00b3e8587 | ||
|
|
87e963a2c7 | ||
|
|
74ac8ce407 | ||
|
|
f87de12b96 | ||
|
|
1a3fa549a9 | ||
|
|
0424243e3c | ||
|
|
a1c4da8b04 | ||
|
|
7b2ea40575 | ||
|
|
1f3148db4b | ||
|
|
24f39d3ad1 | ||
|
|
40bfc729ca | ||
|
|
01e39f4ff9 | ||
|
|
d297784b87 | ||
|
|
72b437bbd2 | ||
|
|
3e8dadfb1b | ||
|
|
2661d6d397 | ||
|
|
59187b8051 | ||
|
|
75d64e677e | ||
|
|
c5710d0ef8 | ||
|
|
de6da120a0 | ||
|
|
f111c0d6ab | ||
|
|
55d1e1a9b8 | ||
|
|
2da9cbf1a1 | ||
|
|
a338798559 | ||
|
|
46464105f2 | ||
|
|
7f3bd26593 | ||
|
|
9233c98a7e | ||
|
|
ec8d51bee3 | ||
|
|
3739016e45 | ||
|
|
df7524d7e8 | ||
|
|
b454d9c89b | ||
|
|
af708843f6 | ||
|
|
ca1983adb4 | ||
|
|
1cf22d4d4f | ||
|
|
583a30e971 | ||
|
|
6bdcc8faa9 | ||
|
|
e68759bf12 | ||
|
|
ec0e0235fa | ||
|
|
7edd350593 | ||
|
|
455a918071 | ||
|
|
296152ec67 | ||
|
|
6ff772b8d9 | ||
|
|
3de2c704ef | ||
|
|
cc65a42035 | ||
|
|
5b83d7df51 | ||
|
|
45772652ff | ||
|
|
f225991b05 | ||
|
|
4d2b198403 | ||
|
|
5ea46cacb6 | ||
|
|
fd759d5ca3 | ||
|
|
f34c8fdc6b | ||
|
|
1cf9deb603 | ||
|
|
4e5ea18394 | ||
|
|
4e9b3687ba | ||
|
|
99d2358510 | ||
|
|
08a52c1dab | ||
|
|
ce48ca2223 | ||
|
|
2dc9cbefd3 | ||
|
|
0f7b99b433 | ||
|
|
057348e1da | ||
|
|
ab21161a69 | ||
|
|
d8b6dbfffe | ||
|
|
d5177059e8 | ||
|
|
a9647b0508 | ||
|
|
37fd348a1d | ||
|
|
2aac470cb9 | ||
|
|
25ce5f6759 | ||
|
|
5d0b267aaa | ||
|
|
c2ed8277c2 | ||
|
|
d7ade1f346 | ||
|
|
de53c53c6e | ||
|
|
5ac108188d | ||
|
|
e683e32c74 | ||
|
|
7fe830fd20 | ||
|
|
07e199ff0e | ||
|
|
6f2da6b9b2 | ||
|
|
14a9c8aa0b | ||
|
|
52d7d5f55a | ||
|
|
0b6d6f45d2 | ||
|
|
0a79c78e05 | ||
|
|
ad827a6aef | ||
|
|
41580848e3 | ||
|
|
b455fa3a16 | ||
|
|
ff4a457d82 | ||
|
|
eae9f282de | ||
|
|
e39cf37026 | ||
|
|
6440aa9e47 | ||
|
|
745fab8293 | ||
|
|
a37ebcf2f8 | ||
|
|
92142bed34 | ||
|
|
83ec9e7d50 | ||
|
|
a0a0556993 | ||
|
|
33ac317132 | ||
|
|
9007c58bdd | ||
|
|
2456dd2a85 | ||
|
|
a44cf41d37 | ||
|
|
76e7aaf514 | ||
|
|
cb776fad88 | ||
|
|
a4f28694c8 | ||
|
|
82d737ee6d | ||
|
|
138add24c8 | ||
|
|
532d55c8bd | ||
|
|
3345e3407d | ||
|
|
52d1c20973 | ||
|
|
6898c60ba6 | ||
|
|
69d26c35fb | ||
|
|
4d9b5e92b3 | ||
|
|
18a2edfb84 | ||
|
|
4e95ee9f6e | ||
|
|
79ff393dc2 | ||
|
|
03bcaf6067 | ||
|
|
5891c4a542 | ||
|
|
3131d0c48a | ||
|
|
336b0ecbca | ||
|
|
32e76c4386 | ||
|
|
7d77521794 | ||
|
|
7f61fa1b55 | ||
|
|
98485c96d8 | ||
|
|
184cf609c0 | ||
|
|
e73e02fe10 | ||
|
|
ed2f0b349f | ||
|
|
d4e1d31ea4 | ||
|
|
bb4edd0136 | ||
|
|
c9b3a71d02 | ||
|
|
1b65b19abd | ||
|
|
35cd49ec50 | ||
|
|
6c7764862b | ||
|
|
9c88cab78c | ||
|
|
651bb5009f | ||
|
|
86c6cd1725 | ||
|
|
bd98ff02f6 | ||
|
|
057ef182cd | ||
|
|
67cdd5ee1e | ||
|
|
92896a708d | ||
|
|
57fa775f25 | ||
|
|
8d53aa3ad2 | ||
|
|
5b1fb56a8f | ||
|
|
6948d2e779 | ||
|
|
69429ce274 | ||
|
|
170679294b | ||
|
|
4b3f2771b5 | ||
|
|
a44def03a0 | ||
|
|
9f1b1e2b14 | ||
|
|
e99f0b609b | ||
|
|
5bb10d25ef | ||
|
|
edabd27cd8 | ||
|
|
97a5d1270a | ||
|
|
f729c6dae5 | ||
|
|
a3cc4e6ecd | ||
|
|
2a9536c4e8 | ||
|
|
1f960f7e34 | ||
|
|
3f4389b968 | ||
|
|
700c43bd42 | ||
|
|
2ec70b6466 | ||
|
|
cf9f32b009 | ||
|
|
fcd4468f90 | ||
|
|
7239fda971 | ||
|
|
47dffa483f | ||
|
|
266e0496ab | ||
|
|
dbb5e7cd8e | ||
|
|
80750632d0 | ||
|
|
d23283e249 | ||
|
|
7ffc7b0438 | ||
|
|
1a8c90eec7 | ||
|
|
ea40ebb648 | ||
|
|
1c8cdfd174 | ||
|
|
0dfd5f7f67 | ||
|
|
35cb2c8659 | ||
|
|
3d5de0df51 | ||
|
|
a3710f695f | ||
|
|
18be89773c | ||
|
|
a9fdfd0799 | ||
|
|
2394e52ebc | ||
|
|
ee7bbf4650 | ||
|
|
8914bd5b1a | ||
|
|
5dde918e24 | ||
|
|
300e27745b | ||
|
|
cfc396c32e |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -14,6 +14,7 @@ core
|
||||
/INSTALL
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
/compile
|
||||
/config.cache
|
||||
/config.guess
|
||||
/config.h
|
||||
|
||||
572
ChangeLog
572
ChangeLog
@@ -1,3 +1,573 @@
|
||||
GNU nano 2.4.2 - 2015.07.05
|
||||
2015-06-28 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/browser.c (browser_refresh): Limit the selected file to the
|
||||
available ones in the list -- after a refresh the number may have
|
||||
decreased. This fixes Savannah bug #45424.
|
||||
* src/text.c (do_deletion): There is no need to check again for the
|
||||
line ending -- it was done already in the encompassing 'if'.
|
||||
* src/text.c: Unwrap some lines, rewrap some others more logically,
|
||||
plus several other esthetic tweaks.
|
||||
* doc/syntax/xml.nanorc: Recognize many more kinds of XML files.
|
||||
This addresses Debian bug #790017 reported by Emmanuel Bourg.
|
||||
Also colour the strings in tags differently, and add some comments.
|
||||
|
||||
2015-06-27 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_undo, add_undo): Skip undoing a backspace *only* when
|
||||
it really tried to delete the final, magic newline.
|
||||
* src/nano.h, src/text.c: Rename three flags for clarity.
|
||||
* src/files.c (replace_buffer): This function is only ever called with
|
||||
a temporary file as parameter, so forget the case of an empty filename.
|
||||
Also, don't bother putting the pointer at the top of the buffer, as the
|
||||
first action after this function is to restore the cursor position.
|
||||
* src/files.c: Normalize whitespace and comments.
|
||||
* src/nano.h: Remove obsolete execute flag from the shortcut struct.
|
||||
* src/global.c (shortcut_init): Remove a duplicate binding of ^T, to
|
||||
prevent it being shown twice in the ^G help text. It will be rebound
|
||||
dynamically when for the current syntax another function is available.
|
||||
|
||||
2015-06-23 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/winio.c (edit_draw): Verify that there exists multidata for the
|
||||
found starting line before trying to use it. When a file is inserted
|
||||
(^R), it will not have any precalculated multidata associated with it.
|
||||
This fixes Savannah bug #45377 reported by Cody A. Taylor.
|
||||
|
||||
2015-06-20 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/search.c (do_research): If nothing was searched for yet during
|
||||
this run of nano, take the most recent item from the search history.
|
||||
This makes M-W work also right after startup, like <n> in vim/less.
|
||||
* src/utils.c (get_homedir): Keep homedir NULL when no home directory
|
||||
could be determined, so that nano will show a message about it. This
|
||||
is a fix for Savannah bug #45343.
|
||||
* doc/syntax/nanorc.nanorc: Colour key-binding lines affirmatively
|
||||
only when the specified menu name is an existing one.
|
||||
* doc/syntax/changelog.nanorc: Stop the changed-files colour from
|
||||
spilling beyond a blank line. Also highlight releases.
|
||||
* src/nano.c (main), src/rcfile.c: Remove the obsolete long option
|
||||
--undo. And sort --help and the softwrap option more consistently.
|
||||
|
||||
2015-06-18 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/rcfile.c: Allow a tiny nano's ~/.nanorc to enable search and
|
||||
position histories. Also sort the options more strictly.
|
||||
* src/nano.h: Delete two unused things, and add two comments.
|
||||
|
||||
2015-06-17 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_undo, add_undo): When undoing a Backspace at the tail
|
||||
of the file and nonewlines is not set, then don't add another newline
|
||||
but just reposition the cursor. Also, when doing a Delete at the tail
|
||||
of the file, don't add a superfluous undo structure. This prevents
|
||||
the appearance of an extra newline when undoing the Backspace/Delete.
|
||||
Patch partially by Mark Majeres. The problem was first reported in
|
||||
https://lists.gnu.org/archive/html/nano-devel/2015-06/msg00003.html.
|
||||
* src/text.c (do_undo): Adjust whitespace after the previous change.
|
||||
* src/text.c (add_undo): Elide an unneeded variable and correct two
|
||||
comments. And try to put the more frequent condition first.
|
||||
* src/text.c (add_undo): Rename the parameter 'current_action' to
|
||||
'action', to match the other functions.
|
||||
* src/text.c (do_undo, add_undo, update_undo): Improve the visibility
|
||||
of the undo-related debugging messages.
|
||||
|
||||
2015-06-14 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/winio.c (edit_draw): Add some debugging code to track which
|
||||
multidata codes (for multiline regexes) get assigned to which lines.
|
||||
* src/winio.c (edit_draw): Start and end regexes can be very similar;
|
||||
so if a found start has been qualified as an end earlier, believe it
|
||||
and skip to the next step. This helps with Python's docstrings.
|
||||
* src/winio.c (edit_draw): When the whole line has been coloured,
|
||||
don't bother looking for any more starts. This prevents some lines
|
||||
from being erroneously marked as CENDAFTER instead of CWHOLELINE.
|
||||
* src/*.c: Don't check for non-NULL before freeing; it's unneeded.
|
||||
|
||||
2015-06-11 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/winio.c (get_key_buffer): Add some debugging code to make it
|
||||
easy to see what codes a key stroke produces.
|
||||
|
||||
2015-06-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/texinfo/nano.texi: Show the node with the command-line options
|
||||
in the main menu, to make it easy to find.
|
||||
* doc/texinfo/nano.texi: Improve some formatting, hyphenation, wording
|
||||
and dashes. And remove some confusing, historical things.
|
||||
* doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Clarify the
|
||||
meaning of --backupdir: it doesn't just specify a directory for saving
|
||||
backup files, it mainly causes uniquely numbered backups to be made.
|
||||
* doc/man/nano.1: Add a section on the non-obvious functioning of the
|
||||
cutbuffer and the mark.
|
||||
|
||||
2015-06-04 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/nano.h: Fix compilation with --enable-tiny.
|
||||
* nano.spec.in: Add the post-install and pre-uninstall rules for the
|
||||
Info document, plus some tweaks. (Patch was tested by Kamil Dudka.)
|
||||
|
||||
2015-06-02 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/man/nanorc.5, doc/texinfo/nano.texi: Tweak some wordings, and
|
||||
add some missing formatting to the Info document, and fix an mdash.
|
||||
* doc/syntax/debian.nanorc: Colour also an optional option.
|
||||
This addresses Debian bug #664456 reported by Shawn Landden.
|
||||
Also shorten the name of the syntax to "sources.list".
|
||||
* doc/syntax/python.nanorc: Require again that the triple quote that
|
||||
starts a docstring is followed by some character -- it is better to
|
||||
*not* colour some strings than far too often colour far too much.
|
||||
This addresses Debian bug #785508 reported by Alexandre Detiste.
|
||||
|
||||
2015-05-31 Mahyar Abbaspour <mahyar.abaspour@gmail.com>
|
||||
* src/prompt.c (get_statusbar_page_start): Prevent a floating-point
|
||||
exception when the available length for an answer becomes zero.
|
||||
|
||||
2015-05-28 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/help.c (do_help), src/prompt.c (do_yesno_prompt): Normalize
|
||||
the whitespace after the recent changes in logic.
|
||||
* src/prompt.c (do_yesno_prompt): Use 'width' instead of hardcoded
|
||||
16. Also always first set the string and then position the cursor.
|
||||
* TODO: Mark window resizes and better file-type detection as done.
|
||||
* doc/syntax/debian.nanorc: Allow a CD name to contain any character.
|
||||
This addresses Debian bug #688892 reported by Dani Möller Montull.
|
||||
|
||||
2015-05-28 Mahyar Abbaspour <mahyar.abaspour@gmail.com>
|
||||
* src/nano.c (handle_sigwinch, regenerate_screen), src/global.c,
|
||||
src/prompt.c (do_statusbar_input, get_prompt_string, do_yesno_prompt),
|
||||
src/browser.c (do_browser, browser_refresh), src/help.c (do_help),
|
||||
src/winio.c (get_key_buffer, unget_input, get_input, parse_kbinput),
|
||||
src/text.c (do_justify, do_linter), src/nano.h, src/proto.h:
|
||||
Handle a SIGWINCH (signalling a change in window size) not when it
|
||||
happens but only when checking for input. Report 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 edited by Benno.)
|
||||
|
||||
2015-05-20 Devrim Gündüz <devrim@gunduz.org>
|
||||
* doc/syntax/postgresql.nanorc: New file -- syntax highlighting for
|
||||
PostgreSQL, first posted as Savannah patch #8601. Trimmed by Benno.
|
||||
|
||||
2015-05-08 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/browser.c (browser_refresh): Take the distant possibility of
|
||||
terabyte files into account, and in the bargain get rid of the need
|
||||
to calculate the number of digits in UINT_MAX.
|
||||
* src/files.c (get_next_filename): Limit the number of backup files
|
||||
to one hundred thousand -- which should be far more than enough --
|
||||
before finding an unused filename takes an annoying amount of time.
|
||||
* src/utils.c (digits): Delete this now unneeded function.
|
||||
|
||||
2015-05-03 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/browser.c (browser_refresh): Display an ellipsis only when the
|
||||
filename is longer than the available space, not when it still fits.
|
||||
* src/browser.c, src/nano.c: Adjust a few comments and line wrappings.
|
||||
* doc/syntax/groff.nanorc: Use character classes correctly.
|
||||
|
||||
2015-04-28 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/color.c (color_update): Match 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.
|
||||
* doc/syntax/po.nanorc: Improve the colouring of message tags.
|
||||
* src/winio.c (get_escape_seq_kbinput): Unwrap a bunch of comments.
|
||||
|
||||
2015-04-25 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/search.c (do_replace_loop): Remove the unintended special
|
||||
case for replacing multiple occurrences of a literal ^ or $; see
|
||||
https://lists.gnu.org/archive/html/nano-devel/2015-04/msg00065.html.
|
||||
* src/search.c (findnextstr): Delete an always-FALSE parameter.
|
||||
* src/search.c (findnextstr): Rename the parameter 'whole_word'
|
||||
to 'whole_word_only', for clarity.
|
||||
|
||||
2015-04-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/browser.c (findnextfile): Save the settings of the global
|
||||
case-sens, direction, and regexp flags, and restore them on exit.
|
||||
And do this not in do_filesearch() but in findnextfile(), so that
|
||||
it will also work for do_fileresearch().
|
||||
* src/text.c (do_int_spell_fix): Save and restore the global flags
|
||||
in the same short and quick way as above.
|
||||
* src/nano.c (main): Initialize the search and replace strings in
|
||||
a central place, to get rid of a bunch of ifs.
|
||||
* src/search.c (search_init_globals): Elide this tiny function.
|
||||
|
||||
2015-04-20 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/winio.c (need_horizontal_update, need_vertical_update): Fuse
|
||||
two identical functions into one: need_screen_update().
|
||||
* src/prompt.c (need_statusbar_horizontal_update): Rename function
|
||||
to need_statusbar_update() as there is no vertical counterpart.
|
||||
* src/search.c (do_search, do_research): Delete redundant reprises
|
||||
of a regex search: finding an occurrence only at the very starting
|
||||
point of the search necessarily means it is the only occurrence.
|
||||
|
||||
2015-04-18 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/global.c, src/nano.c, doc/man/nanorc.5, doc/texinfo/nano.texi:
|
||||
Make the descriptions of the multibuffer feature more accurate.
|
||||
* src/winio.c (display_string): Make sure an invalid starting byte
|
||||
of a multibyte sequence is properly terminated, so that it doesn't
|
||||
pick up lingering bytes of any previous content. This prevents the
|
||||
displaying of ghosts -- characters that aren't really there -- when a
|
||||
file contains valid ánd invalid UTF-8 sequences. For an example see:
|
||||
https://lists.gnu.org/archive/html/nano-devel/2015-04/msg00052.html.
|
||||
Also make two comments more accurate: an invalid multibyte sequence
|
||||
will never be categorized as a control character or anything else.
|
||||
|
||||
2015-04-18 Mark Oteiza <mvoteiza@udel.edu>
|
||||
* doc/syntax/{python,ruby,sh,tex}.nanorc: Add a linter definition.
|
||||
* doc/syntax/elisp.nanorc: New file; syntax highlighting for Elisp.
|
||||
* doc/syntax/guile.nanorc: New file; syntax highlighting for Guile.
|
||||
|
||||
2015-04-17 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_alt_speller, do_linter, do_formatter): Distinguish
|
||||
a failure to launch the linter from receiving zero parsable lines;
|
||||
add a new function to glue together the invocation-error string.
|
||||
* src/global.c (shortcut_init): In the Help Viewer and File Browswer,
|
||||
bind the unbound Home and End keys to goto_top and goto_bottom, to
|
||||
mimic the behaviour of these keys in file viewers and web browsers.
|
||||
Also show ^Y and ^V in the WhereisFile menu instead of M-\ and M-/,
|
||||
for similarity with the WhereIs menu.
|
||||
* src/global.c (shortcut_init): Arrange the movement keys in the File
|
||||
Browser in the order of ascending stride, as in the Help Viewer.
|
||||
|
||||
GNU nano 2.4.1 - 2015.04.14
|
||||
2015-04-13 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/search.c (do_replace_loop): Fix compilation with --enable-tiny.
|
||||
* README: Mention also the Savannah page for reporting bugs.
|
||||
|
||||
2015-04-12 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/browser.c (filesearch_init): Stop M-\ and M-/ in WhereisFile
|
||||
menu (reached via ^R ^T ^W) from doing also an unrequested search
|
||||
after having performed their function. Fixes Savannah bug #44790.
|
||||
* src/global.c (shortcut_init): Rebind ^Y and ^V in the WhereisFile
|
||||
menu from the pointless page_up() and page_down() to the effective
|
||||
first_file() and last_file(). Also unbind some other useless keys.
|
||||
* src/browser.c (filesearch_init): Remove an unused variable, and
|
||||
adjust the introductory comment for the recently tweaked logic.
|
||||
* src/rcfile.c (parse_linter, parse_formatter): Use mallocstrcpy()
|
||||
in a correct manner; don't let it free an unrelated string.
|
||||
|
||||
2015-04-11 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/search.c (do_replace_loop): Do not split off the marked region
|
||||
into a separate partition, but do the replacings in the current one,
|
||||
taking good care to stay within the boundaries of the region. This
|
||||
fixes an undo bug where the first part of a line would disappear if
|
||||
the region started in the middle of a line. Bug was reported here:
|
||||
https://lists.gnu.org/archive/html/nano-devel/2015-03/msg00077.html.
|
||||
Original idea and patch were by Mark Majeres.
|
||||
|
||||
2015-04-08 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/browser.c (browser_select_dirname, findnextfile): Rename
|
||||
'currselected' to 'looking_at', for more contrast with 'selected',
|
||||
and rename browser_select_filename() to browser_select_dirname().
|
||||
* src/text.c: Correct and adjust some comments.
|
||||
|
||||
2015-04-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/browser.c (do_fileresearch): Don't search for the empty string
|
||||
when nothing was sought yet (when historylog is set).
|
||||
* src/browser.c (filesearch_init): Remove an unfitting comment
|
||||
(there are no toggles here) and tweak some others.
|
||||
* src/search.c (do_search, do_research): Use the same variable as
|
||||
in the surrounding code, for consistency.
|
||||
* src/browser.c (findnextfile_wrap_reset): Elide this function,
|
||||
and rename 'search_last_file' to 'came_full_circle'.
|
||||
* src/browser.c (filesearch_init, do_fileresearch): Avoid setting
|
||||
'focusing' when searching only for filenames.
|
||||
* src/browser.c (findnextfile, do_filesearch, do_fileresearch):
|
||||
Greatly simplify the searching for the next matching filename.
|
||||
* src/{browser,files,help,prompt,text,winio}.c: Let the function
|
||||
bottombars() set the global variable 'currmenu' -- the displayed
|
||||
menu must necessarily be the active one.
|
||||
* src/browser.c (filesearch_abort): Elide this tiny function.
|
||||
* THANKS: Add the names of recent translators, and sort the list.
|
||||
* THANKS: A neater layout, plus two table headers.
|
||||
|
||||
2015-04-05 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/texinfo/nano.texi: Expand on nano's features, condense the
|
||||
synopsis, and "online" means something else to most people.
|
||||
|
||||
2015-04-03 Benno Schulenberg <bensberg@justemail.net>
|
||||
* README: Update text to the fifth milestone, 2.4.x, plus tweaks.
|
||||
* src/rcfile.c: Remove two superfluous (because nested) #ifndefs.
|
||||
* src/rcfile.c (parse_rcfile): Ignore any magic when libmagic was
|
||||
disabled, and ignore a formatter when spell checking was disabled.
|
||||
|
||||
2015-03-28 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/search.c (search_init_globals, search_replace_abort),
|
||||
src/winio.c (edit_redraw), src/proto.h, src/global.c: When finding
|
||||
an off-screen string, put it on the center line of the screen and
|
||||
not on the bottom or top line. This restores the old behaviour
|
||||
that was unintentionally changed in r5149 six days ago.
|
||||
* src/winio.c (edit_refresh): When pasting lines on the bottom line,
|
||||
only scroll the required number of lines and not half a screen --
|
||||
that is, when smooth scrolling is enabled.
|
||||
* doc/syntax/changelog.nanorc: Also colour a series of changed files
|
||||
that spans more than one line.
|
||||
|
||||
2015-03-27 Mark Majeres <mark@engine12.com>
|
||||
* src/text.c (do_alt_speller): Adjust the end point of the marked
|
||||
region for any change in length of the region's last line.
|
||||
|
||||
2015-03-27 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/patch.nanorc: Recognize also Debian package diffs.
|
||||
Fixes https://bugs.launchpad.net/ubuntu/+source/nano/+bug/1300565
|
||||
requested by Rolf Leggewie.
|
||||
* src/search.c (do_replace_loop): Adjust some whitespace and wrapping.
|
||||
* src/search.c (do_replace_loop): Place a call to edit_refresh better,
|
||||
and remove two unneeded ones. This greatly speeds up nano when doing
|
||||
a Replace All with *lots* of occurrences.
|
||||
* src/{color,global,nano,text,utils}.c: Normalize some whitespace.
|
||||
* src/global.c (strtosc): The linter is only available when colour is.
|
||||
* src/global.c, src/text.c: Treat the formatter like a speller, to fix
|
||||
compilation with --disable-speller. Fixes Savannah bug #44607.
|
||||
|
||||
2015-03-25 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/debian.nanorc: Slightly widen and relax the header regex.
|
||||
* doc/syntax/python.nanorc: Hashes inside triple-quoted strings should
|
||||
not cause comment colouring. (Inside single-qouted strings neither,
|
||||
but then quotes in comments will be coloured like strings.) This
|
||||
solves https://bugs.launchpad.net/ubuntu/+source/nano/+bug/481363.
|
||||
* src/global.c (strtomenu): Remove mistaken menu name -- as the
|
||||
formatter allows no interaction it needs no associated menu.
|
||||
* src/text.c (do_formatter): Remove unneeded statement -- nothing
|
||||
has changed the value of 'currmenu'.
|
||||
* src/global.c (strtosc), doc/man/nanorc.5: Allow rebinding the
|
||||
linter when nano was configured with --disable-speller.
|
||||
|
||||
2015-03-23 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_alt_speller): Avoid the spell checker reporting
|
||||
an error when the marked region is zero bytes long. The message
|
||||
is not needed -- it gets printed by the caller. This generalizes
|
||||
the fix for Savannah bug #29393.
|
||||
* src/text.c (do_alt_speller): Do not unset the mark before the
|
||||
possible bailout because of a zero-sized region.
|
||||
* NEWS: Option --noread allows writing, not reading, to named pipes.
|
||||
|
||||
2015-03-22 Chris Allegretta <chrisa@asty.org>
|
||||
* src/text.c (do_alt_speller): timestamp can just be a time_t.
|
||||
Fixes compilation on win32 and macOS.
|
||||
|
||||
GNU nano 2.4.0 - 2015.03.22
|
||||
2015-03-22 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/chars.c (move_mbleft): Start looking for a multibyte char
|
||||
not at the start of the string, but only as far back as such a
|
||||
char can possibly be. Change suggested by Mark Majeres.
|
||||
* src/search.c (findnextstr): Step backward or forward not simply
|
||||
one byte but one character (possibly multibyte). Fixes Savannah
|
||||
bug #42175, reported by myself, and the finding of ghosts seen in
|
||||
https://lists.gnu.org/archive/html/nano-devel/2015-03/msg00055.html.
|
||||
* src/winio.c (edit_redraw): Do not center the current line when
|
||||
smooth scrolling is used. This fixes Savannah bug #42654.
|
||||
|
||||
2015-03-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_alt_speller): Remove some leftovers.
|
||||
* src/search.c: Place some comments better and unwrap some lines.
|
||||
|
||||
2015-03-21 Mark Majeres <mark@engine12.com>
|
||||
* src/text.c (do_alt_speller): Restore the positions of the mark
|
||||
and the cursor in a better way: to the columns where they were.
|
||||
This fixes Savannah bug #44542, reported by Benno Schulenberg.
|
||||
|
||||
2015-03-20 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/nano.c (finish_stdin_pager, cancel_stdin_pager, stdin_pager):
|
||||
Normalize the whitespace, remove an old comment, and place another
|
||||
one better.
|
||||
* src/text.c (do_undo): Make a message equal to another one. It
|
||||
was mistakenly changed in r4950. (This is translation-neutral.)
|
||||
* src/global.c (shortcut_init): Keep related items together in the
|
||||
^G help screen.
|
||||
|
||||
2015-03-17 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_alt_speller): Do not set the modified flag when
|
||||
an external spell checker didn't make any changes. This fixes
|
||||
Savannah bug #44320, reported by Cody A. Taylor.
|
||||
|
||||
2015-03-14 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_formatter): Fix a message plus a few comments.
|
||||
|
||||
2015-03-14 Mark Majeres <mark@engine12.com>
|
||||
* src/nano.c (renumber): Get out if there is nothing to renumber,
|
||||
to prevent do_undo() from falling over trying to renumber emptiness.
|
||||
This fixes Savannah bug #44488, reported by Dennis Decker Jensen.
|
||||
|
||||
2015-03-08 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/proto.h, src/nano.c: Fix compilation with --enable-tiny plus
|
||||
--enable-nanorc.
|
||||
* src/rcfile.c (parse_binding): Fix the rebinding of toggles.
|
||||
* doc/man/{nano.1,rnano.1,nanorc.5}, doc/texinfo/nano.texi: Update
|
||||
years and version numbers in the docs in anticipation of a release.
|
||||
* src/nano.c (version): Drop compile time from version information
|
||||
to enable a reproducible build. Proposed by Jérémy Bobbio and Jordi
|
||||
Mallach (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774388).
|
||||
|
||||
2015-03-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/man/nanorc.5, doc/texinfo/nano.texi: Add a note about the
|
||||
inherent imperfection of using regular expressions for syntax
|
||||
highlighting, as suggested by Mike Frysinger in bug #30962.
|
||||
* doc/man/nanorc.5: Improve the indentation of some lists.
|
||||
* doc/man/nanorc.5, doc/texinfo/nano.texi: Remove the mistaken
|
||||
square brackets around the arguments of "header" and "magic" --
|
||||
those arguments are not optional. Also add "formatter" to the
|
||||
texinfo document, and slightly improve its punctuation.
|
||||
|
||||
GNU nano 2.3.99pre3 - 2015.02.27
|
||||
2015-02-25 Chris Allegretta <chrisa@asty.org>
|
||||
* src/rcfile.c (parse_binding): Add an exception for do_toggle() as
|
||||
rebinding toggles broke with r5022. (Fixed in r5134.)
|
||||
|
||||
2015-02-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* README: Fix the explanation of how to subscribe to a mailing list.
|
||||
* doc/syntax/{java,lua,python,ruby}.nanorc: Wrap some overlong lines.
|
||||
|
||||
2015-02-18 Mike Frysinger <vapier@gentoo.org>
|
||||
* doc/syntax/sh.nanorc: Recognize also dash, openrc and runscript.
|
||||
|
||||
2015-02-16 Mike Frysinger <vapier@gentoo.org>
|
||||
* .gitignore: Ignore the autotools 'compile' file.
|
||||
|
||||
2015-02-15 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/file.c (do_lockfile): Also show the name of the affected file
|
||||
when finding a lock file, for when many files are opened at once.
|
||||
* src/file.c (do_lockfile): The user does the editing, not the editor.
|
||||
|
||||
2015-02-09 Chris Allegretta <chrisa@asty.org>
|
||||
* nano.spec.in: Add dependency on texinfo, docdir files for
|
||||
RPM file creation.
|
||||
|
||||
GNU nano 2.3.99pre2 - 2015.02.06
|
||||
2015-02-03 Alex Henrie <alexhenrie24@gmail.com>
|
||||
* src/cut.c (do_cut_text): Make sure to set modified even when
|
||||
using --enable-tiny.
|
||||
|
||||
2015-02-01 Kamil Dudka <kdudka@redhat.com>
|
||||
* src/files.c (write_lockfile): Avoid writing uninitialized bytes to
|
||||
the lock file -- a simple null_at() would not initialize the buffer.
|
||||
* src/files.c (do_lockfile): Make sure that 'lockprog' and 'lockuser'
|
||||
are terminated -- strncpy() does not guarantee that on its own.
|
||||
* src/files.c (do_lockfile): Avoid printing a wrong PID on the status
|
||||
bar due to treating serialized PID bytes as signed integers. This
|
||||
addresses https://bugzilla.redhat.com/1186384 reported by Don Swaner.
|
||||
* src/files.c (write_lockfile): Do not trim the nano version number
|
||||
-- snprintf() counts the trailing zero into the size limit.
|
||||
|
||||
2015-02-01 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/winio.c (do_credits): Add a general entry for all translators.
|
||||
* src/nano.c (version), src/winio.c (do_credits): Update the copyright
|
||||
years to include 2015.
|
||||
|
||||
2015-01-13 Chris Allegretta <chrisa@asty.org>
|
||||
* src/files.c (open_buffer): Check here for locking and properly
|
||||
handle choosing to not open a file when locked instead of in
|
||||
open_file(). Fixes Savannah bug #42373 reported by Benno Schulenberg.
|
||||
|
||||
GNU nano 2.3.99pre1 - 2015.01.06
|
||||
2015-01-03 Chris Allegretta <chrisa@asty.org>
|
||||
* 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.
|
||||
|
||||
2014-12-28 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (do_lockfile): Gettextize the "File being edited"
|
||||
prompt, and improve its wording.
|
||||
* src/winio.c (do_credits): Remove the names of past translators
|
||||
from the Easter-egg scroll.
|
||||
* THANKS: Add a missing historical translator name.
|
||||
* src/winio.c (do_credits): Add Mark to the scroll, for all his
|
||||
undo work, colouring nano's interface, and other patches.
|
||||
|
||||
2014-11-30 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/spec.nanorc: Colorize %pretrans and %posttrans fully.
|
||||
Original patch from Savannah patch #8573 by Daniel Vrátil.
|
||||
|
||||
2014-09-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/{perl,python,ruby,sh}.nanorc: Recognize also header
|
||||
lines of the form "#!/usr/bin/env thing" besides "#!/bin/thing".
|
||||
This fixes Savannah bug #43270 reported by Kitty.
|
||||
|
||||
2014-08-29 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_justify): Replace the old get_shortcut() wrapper
|
||||
with the new func_from_key().
|
||||
|
||||
2014-08-10 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/texinfo/nano.texi: Improve some wordings and formatting.
|
||||
|
||||
2014-08-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/nanorc.nanorc: Remove a mistaken OR which causes a
|
||||
'Bad regex, empty (sub)expression' error on some systems. This
|
||||
fixes Savannah bug #42929 reported by Misty De Meo.
|
||||
|
||||
2014-08-03 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/man/nano.1, doc/man/rnano.1: Tweak the formatting a bit so that
|
||||
po4a will create a nicer POT file.
|
||||
* doc/man/nanorc.5: Improve some of the wordings and formatting.
|
||||
|
||||
2014-08-02 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/texinfo/nano.texi: Standardize the formatting of command-line
|
||||
options -- each one separately. Also add some more markup.
|
||||
|
||||
2014-08-01 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/man/nano.1, doc/man/rnano.1: Separate short and long option
|
||||
by a comma instead of putting the long one between parentheses.
|
||||
And showing the required quotes around the argument of -Q.
|
||||
|
||||
2014-07-31 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (do_insertfile): Adjust some indentation.
|
||||
* src/prompt.c (do_statusbar_input), src/browser.c (do_browser):
|
||||
Reorder a few things, and adjust some whitespace.
|
||||
|
||||
2014-07-27 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/global.c (add_to_sclist): Remove the now unused and unneeded
|
||||
addition ability from this builder function of the shortcut list.
|
||||
* src/global.c (strtokeytype): Move this to a better place.
|
||||
* src/global.c (first_sc_for): Move this too to a better place.
|
||||
* src/prompt.c (do_yesno_prompt): Use the new and more direct
|
||||
func_from_key() wrapper instead of get_shortcut().
|
||||
* src/text.c (do_linter): Likewise.
|
||||
* src/files.c (do_insertfile, do_writeout): Likewise.
|
||||
|
||||
2014-07-24 Jordi Mallach <jordi@gnu.org>
|
||||
* doc/texinfo/nano.texi, doc/man/nanorc.5: Typo fix.
|
||||
|
||||
2014-07-22 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/nanorc.nanorc: Remove 'undo' from the valid options.
|
||||
|
||||
2014-07-21 Jordi Mallach <jordi@gnu.org>
|
||||
* doc/nanorc.sample.in: Remove ‘undo’ section which is now obsolete.
|
||||
|
||||
GNU nano 2.3.6 - 2014.07.17
|
||||
2014-07-16 Jordi Mallach <jordi@gnu.org>
|
||||
* doc/man/rnano.1: Additional printing formatting improvement from
|
||||
Bjarni Ingi Gislason.
|
||||
|
||||
2014-07-16 Jordi Mallach <jordi@gnu.org>
|
||||
* 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.
|
||||
|
||||
2014-07-16 Jordi Mallach <jordi@gnu.org>
|
||||
* 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.
|
||||
|
||||
2014-07-16 Jordi Mallach <jordi@gnu.org>
|
||||
* 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.
|
||||
|
||||
2014-07-16 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c: Normalize the tabbing.
|
||||
|
||||
2014-07-16 Mark Majeres <mark@engine12.com>
|
||||
* src/text.c (do_undo): Make sure renumbering starts far enough back
|
||||
after undoing a cut or paste. This fixes a segmentation fault when
|
||||
undoing a repeated cutting and pasting of the first line of a file.
|
||||
* src/nano.c (move_to_filestruct, copy_from_filestruct): Fix two leaks.
|
||||
|
||||
2014-07-13 David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* ChangeLog: Typo fix.
|
||||
|
||||
2014-07-12 Benno Schulenberg <bensberg@justemail.net>
|
||||
* configure.ac: The warning about datarootdir being ignored is
|
||||
not merely a warning, it also activates a workaround.
|
||||
|
||||
2014-07-11 Mark Majeres <mark@engine12.com>
|
||||
* src/text.c (do_undo, do_redo): Do not speak of "line wrap"
|
||||
but instead of "text add" when undoing/redoing text additions
|
||||
that caused automatic line breaks.
|
||||
|
||||
2014-07-11 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (write_lockfile): Refix typo in error message.
|
||||
|
||||
GNU nano 2.3.5 - 2014.07.11
|
||||
2014-07-11 Chris Allegretta <chrisa@asty.org>
|
||||
* src/files.c (do_lockfile, open_file): If locking fails,
|
||||
allow the lock failure message to be preserved AND
|
||||
@@ -118,7 +688,7 @@
|
||||
* src/help.c (do_help): Same thing for 'firstline'/'lastline'.
|
||||
|
||||
2014-06-23 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/nano.h, src/move.c (do_up, do_down), src/winio.c (edit_scrol):
|
||||
* src/nano.h, src/move.c (do_up, do_down), src/winio.c (edit_scroll):
|
||||
Rename UP_DIR and DOWN_DIR to UPWARD and DOWNWARD, for clarity.
|
||||
* src/proto.h, src/global.c, src/search.c: Rename 'no_replace_void()'
|
||||
to 'flip_replace_void()', to show what it actually does.
|
||||
|
||||
69
NEWS
69
NEWS
@@ -1,3 +1,68 @@
|
||||
2015.07.05 - GNU nano 2.4.1 "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
|
||||
@@ -23,7 +88,7 @@
|
||||
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
|
||||
@@ -319,7 +384,7 @@
|
||||
2008.03.18 - GNU nano 2.1.0 "under old mismanagement" is released.
|
||||
This first release in the 2.1 development series
|
||||
introduces rebinadble keys for most actions inside
|
||||
the editor. Please see the nanorc(5) page for
|
||||
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,
|
||||
|
||||
63
README
63
README
@@ -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.
|
||||
|
||||
141
THANKS
141
THANKS
@@ -2,81 +2,87 @@ 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
|
||||
Wei-Lun CHAO <chaoweilun@pcmail.com.tw> Chinese (traditional)
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish
|
||||
Yuri Chornoivan <yurchor@ukr.net> Ukrainian
|
||||
Mihai Cristescu <mihai.cristescu@archlinux.info> Romanian
|
||||
Marco Colombo <magicdice@inwind.it> Italian
|
||||
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)
|
||||
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
|
||||
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
|
||||
Roy Lanek <lanek@ranahminang.net> Advice and advocacy
|
||||
Mark Majeres <mark@engine12.com> Working undo/redo code
|
||||
Chuck Mead <csm@MoonGroup.com> Feedback and RPM stuff
|
||||
Mike Melanson <melanson@pcisys.net> Bugs
|
||||
Neil Parks <nparks@acsmail.com> Bug reports and fixes
|
||||
@@ -84,4 +90,5 @@ 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
20
TODO
@@ -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]
|
||||
|
||||
@@ -20,16 +20,12 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.3.5], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.4.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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
135
doc/man/nano.1
135
doc/man/nano.1
@@ -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.4.2" "June 2015"
|
||||
.\" 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,94 @@ 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)
|
||||
.BR \-P ", " \-\-poslog
|
||||
Log and later read back the location of the cursor and place it there
|
||||
again.
|
||||
.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 +134,80 @@ 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 ", " \-\-const
|
||||
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)
|
||||
.BR \-l ", " \-\-nofollow
|
||||
If the file being edited is a symbolic link, replace the link with
|
||||
a new file instead of following it. Good for editing files in
|
||||
\fI/tmp\fP, perhaps?
|
||||
.TP
|
||||
.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 +215,36 @@ 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 \-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,7 +265,7 @@ 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.
|
||||
|
||||
@@ -267,7 +288,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).
|
||||
|
||||
206
doc/man/nanorc.5
206
doc/man/nanorc.5
@@ -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.4.2" "June 2015"
|
||||
.\" 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,26 @@ 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 const
|
||||
Constantly display the cursor position in the status bar.
|
||||
.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 +115,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 +124,32 @@ 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
|
||||
.B set 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 +158,10 @@ 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 poslog
|
||||
Save the cursor position of files between editing sessions.
|
||||
.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,57 @@ 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 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 +298,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,32 +309,32 @@ 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:
|
||||
.TP
|
||||
@@ -331,7 +349,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 +362,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:
|
||||
|
||||
.RS 3
|
||||
.TP 2
|
||||
.B help
|
||||
Invokes the help viewer.
|
||||
@@ -361,8 +381,8 @@ Exits from the program (or from the help viewer or the file browser).
|
||||
Writes the current buffer to disk.
|
||||
.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
|
||||
@@ -400,6 +420,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
|
||||
@@ -464,17 +487,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.
|
||||
@@ -595,10 +618,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 +632,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 +684,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
|
||||
|
||||
@@ -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.4.0" "March 2015"
|
||||
.\" 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).
|
||||
|
||||
@@ -165,10 +165,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
|
||||
|
||||
|
||||
@@ -6,10 +6,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 \
|
||||
@@ -26,6 +28,7 @@ pkgdata_DATA = asm.nanorc \
|
||||
perl.nanorc \
|
||||
php.nanorc \
|
||||
po.nanorc \
|
||||
postgresql.nanorc \
|
||||
pov.nanorc \
|
||||
python.nanorc \
|
||||
ruby.nanorc \
|
||||
|
||||
@@ -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,6}" "patch #[0-9]{4,5}"
|
||||
# Probable constants, for variety.
|
||||
color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
||||
# Key sequences.
|
||||
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:]]+$"
|
||||
|
||||
@@ -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
31
doc/syntax/elisp.nanorc
Normal 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:]]);.*$"
|
||||
@@ -40,3 +40,6 @@ color brightblue start="/\*" end="\*/"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
# Set up the formatter since spelling is probably useless...
|
||||
formatter gofmt -w
|
||||
|
||||
@@ -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
24
doc/syntax/guile.nanorc
Normal 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:]]);.*$"
|
||||
@@ -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 "//.*"
|
||||
|
||||
@@ -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)\>"
|
||||
|
||||
@@ -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|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|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:]]*$"
|
||||
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)+[[:space:]]*$"
|
||||
icolor brightgreen "^[[:space:]]*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))?\>"
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)\>"
|
||||
|
||||
@@ -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:]]+$"
|
||||
|
||||
@@ -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.
|
||||
|
||||
75
doc/syntax/postgresql.nanorc
Normal file
75
doc/syntax/postgresql.nanorc
Normal 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)"
|
||||
@@ -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)\>"
|
||||
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)\>"
|
||||
|
||||
# Strings.
|
||||
color brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
|
||||
color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
|
||||
# Multiline strings.
|
||||
color brightgreen start="\"\"\"([^"),]|$)" end="(^|[^(])\"\"\""
|
||||
color brightgreen start="'''([^'),]|$)" end="(^|[^(])'''"
|
||||
|
||||
# Comments.
|
||||
color brightred "(^|[[:blank:]])#.*$"
|
||||
# Multiline strings.
|
||||
color brightgreen start="\"\"\"[^"),]" end="(^|[^(])\"\"\""
|
||||
color brightgreen start="'''[^'),]" end="(^|[^(])'''"
|
||||
|
||||
# Reminders.
|
||||
color ,yellow "(FIXME|TODO|XXX)"
|
||||
|
||||
|
||||
@@ -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".
|
||||
|
||||
@@ -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)\>"
|
||||
|
||||
@@ -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)"
|
||||
|
||||
|
||||
@@ -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 "[{}]"
|
||||
|
||||
@@ -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
25
nano.spec.in
25
nano.spec.in
@@ -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*
|
||||
|
||||
1164
po/nano.pot
1164
po/nano.pot
File diff suppressed because it is too large
Load Diff
1994
po/pt_BR.po
1994
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1186
po/zh_CN.po
1186
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
1188
po/zh_TW.po
1188
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
320
src/browser.c
320
src/browser.c
@@ -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) *
|
||||
@@ -39,10 +40,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 +52,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 +62,6 @@ char *do_browser(char *path, DIR *dir)
|
||||
|
||||
curs_set(0);
|
||||
blank_statusbar();
|
||||
currmenu = MBROWSER;
|
||||
bottombars(MBROWSER);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
@@ -79,6 +77,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 +93,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 +123,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,19 +146,16 @@ 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);
|
||||
}
|
||||
@@ -163,6 +169,8 @@ 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();
|
||||
@@ -203,7 +211,6 @@ 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
|
||||
@@ -268,12 +275,12 @@ 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++;
|
||||
@@ -398,8 +405,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;
|
||||
}
|
||||
@@ -549,20 +555,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 +588,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 +600,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,14 +626,12 @@ 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
|
||||
@@ -638,26 +640,29 @@ void browser_refresh(void)
|
||||
unsigned long 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);
|
||||
/* If less than a terabyte, or if numbers can't even go
|
||||
* that high, show the size, otherwise show "(huge)". */
|
||||
if (st.st_size < (1 << 40) || (1 << 40) == 0)
|
||||
sprintf(foo, "%4lu %cB", 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 +674,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 +696,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 +731,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 +744,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 +846,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. */
|
||||
|
||||
10
src/chars.c
10
src/chars.c
@@ -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;
|
||||
|
||||
33
src/color.c
33
src/color.c
@@ -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,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_MAGIC_H
|
||||
#include <magic.h>
|
||||
@@ -69,10 +70,8 @@ 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 (; this_syntax != NULL; this_syntax = this_syntax->next) {
|
||||
@@ -187,6 +186,21 @@ void color_update(void)
|
||||
* 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 +225,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 +238,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 +286,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 {
|
||||
|
||||
@@ -219,10 +219,9 @@ void do_cut_text(
|
||||
|
||||
/* Leave the text in the cutbuffer, and mark the file as
|
||||
* modified. */
|
||||
if (!copy_text) {
|
||||
set_modified();
|
||||
}
|
||||
if (!copy_text)
|
||||
#endif /* !NANO_TINY */
|
||||
set_modified();
|
||||
|
||||
/* Update the screen. */
|
||||
edit_refresh_needed = TRUE;
|
||||
|
||||
339
src/files.c
339
src/files.c
@@ -126,6 +126,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
pid_t mypid;
|
||||
uid_t myuid;
|
||||
struct passwd *mypwuid;
|
||||
struct stat fileinfo;
|
||||
char *lockdata = charalloc(1024);
|
||||
char myhostname[32];
|
||||
ssize_t lockdatalen = 1024;
|
||||
@@ -135,41 +136,45 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
* old state. */
|
||||
myuid = geteuid();
|
||||
if ((mypwuid = getpwuid(myuid)) == NULL) {
|
||||
statusbar(_("Couldn't determine my identity for lock file (getpwuid() failed)"));
|
||||
return -1;
|
||||
statusbar(_("Couldn't determine my identity for lock file (getpwuid() failed)"));
|
||||
return -1;
|
||||
}
|
||||
mypid = getpid();
|
||||
|
||||
if (gethostname(myhostname, 31) < 0) {
|
||||
statusbar(_("Couldn't determine hosttname for lock file: %s"), strerror(errno));
|
||||
return -1;
|
||||
statusbar(_("Couldn't determine hostname for lock file: %s"), strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (delete_lockfile(lockfilename) < 0)
|
||||
return -1;
|
||||
/* Check if the lock exists before we try to delete it...*/
|
||||
if (stat(lockfilename, &fileinfo) != -1)
|
||||
if (delete_lockfile(lockfilename) < 0)
|
||||
return -1;
|
||||
|
||||
if (ISSET(INSECURE_BACKUP))
|
||||
cflags = O_WRONLY | O_CREAT | O_APPEND;
|
||||
cflags = O_WRONLY | O_CREAT | O_APPEND;
|
||||
else
|
||||
cflags = O_WRONLY | O_CREAT | O_EXCL | O_APPEND;
|
||||
cflags = O_WRONLY | O_CREAT | O_EXCL | O_APPEND;
|
||||
|
||||
fd = open(lockfilename, cflags,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
|
||||
/* Maybe we just don't have write access. Don't stop us from
|
||||
* opening the file at all, just don't set the lock_filename and
|
||||
* return success. */
|
||||
if (fd < 0 && errno == EACCES)
|
||||
return 1;
|
||||
/* Maybe we just don't have write access. Print an error message
|
||||
* and continue. */
|
||||
if (fd < 0) {
|
||||
statusbar(_("Error writing lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Now we've got a safe file stream. If the previous open() call
|
||||
* failed, this will return NULL. */
|
||||
filestream = fdopen(fd, "wb");
|
||||
|
||||
if (fd < 0 || filestream == NULL) {
|
||||
statusbar(_("Error writing lock file %s: %s"), lockfilename,
|
||||
statusbar(_("Error writing lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Okay, so at the moment we're following this state for how to
|
||||
@@ -190,23 +195,23 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
* our lockfile' message in here...
|
||||
*
|
||||
* This is likely very wrong, so this is a WIP. */
|
||||
null_at(&lockdata, lockdatalen);
|
||||
memset(lockdata, 0, lockdatalen);
|
||||
lockdata[0] = 0x62;
|
||||
lockdata[1] = 0x30;
|
||||
lockdata[24] = mypid % 256;
|
||||
lockdata[25] = mypid / 256;
|
||||
snprintf(&lockdata[2], 10, "nano %s", VERSION);
|
||||
snprintf(&lockdata[2], 11, "nano %s", VERSION);
|
||||
strncpy(&lockdata[28], mypwuid->pw_name, 16);
|
||||
strncpy(&lockdata[68], myhostname, 31);
|
||||
strncpy(&lockdata[108], origfilename, 768);
|
||||
if (modified == TRUE)
|
||||
lockdata[1007] = 0x55;
|
||||
lockdata[1007] = 0x55;
|
||||
|
||||
wroteamt = fwrite(lockdata, sizeof(char), lockdatalen, filestream);
|
||||
if (wroteamt < lockdatalen) {
|
||||
statusbar(_("Error writing lock file %s: %s"),
|
||||
lockfilename, ferror(filestream));
|
||||
return -1;
|
||||
statusbar(_("Error writing lock file %s: %s"),
|
||||
lockfilename, ferror(filestream));
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -214,9 +219,9 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
#endif
|
||||
|
||||
if (fclose(filestream) == EOF) {
|
||||
statusbar(_("Error writing lock file %s: %s"),
|
||||
lockfilename, strerror(errno));
|
||||
return -1;
|
||||
statusbar(_("Error writing lock file %s: %s"),
|
||||
lockfilename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
openfile->lock_filename = lockfilename;
|
||||
@@ -229,9 +234,9 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
int delete_lockfile(const char *lockfilename)
|
||||
{
|
||||
if (unlink(lockfilename) < 0 && errno != ENOENT) {
|
||||
statusbar(_("Error deleting lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
statusbar(_("Error deleting lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -248,53 +253,52 @@ int do_lockfile(const char *filename)
|
||||
+ strlen(locking_suffix) + 3;
|
||||
char *lockfilename = charalloc(lockfilesize);
|
||||
char *lockfiledir = NULL;
|
||||
char lockprog[12], lockuser[16];
|
||||
static char lockprog[11], lockuser[17];
|
||||
struct stat fileinfo;
|
||||
int lockfd, lockpid;
|
||||
|
||||
snprintf(lockfilename, lockfilesize, "%s/%s%s%s", lockdir,
|
||||
locking_prefix, lockbase, locking_suffix);
|
||||
locking_prefix, lockbase, locking_suffix);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "lock file name is %s\n", lockfilename);
|
||||
#endif
|
||||
if (stat(lockfilename, &fileinfo) != -1) {
|
||||
ssize_t readtot = 0;
|
||||
ssize_t readamt = 0;
|
||||
char *lockbuf = charalloc(8192);
|
||||
char *promptstr = charalloc(128);
|
||||
int ans;
|
||||
if ((lockfd = open(lockfilename, O_RDONLY)) < 0) {
|
||||
statusbar(_("Error opening lock file %s: %s"),
|
||||
lockfilename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
do {
|
||||
readamt = read(lockfd, &lockbuf[readtot], BUFSIZ);
|
||||
readtot += readamt;
|
||||
} while (readtot < 8192 && readamt > 0);
|
||||
ssize_t readtot = 0;
|
||||
ssize_t readamt = 0;
|
||||
char *lockbuf = charalloc(8192);
|
||||
char *promptstr = charalloc(128);
|
||||
int ans;
|
||||
if ((lockfd = open(lockfilename, O_RDONLY)) < 0) {
|
||||
statusbar(_("Error opening lock file %s: %s"),
|
||||
lockfilename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
do {
|
||||
readamt = read(lockfd, &lockbuf[readtot], BUFSIZ);
|
||||
readtot += readamt;
|
||||
} while (readtot < 8192 && readamt > 0);
|
||||
|
||||
if (readtot < 48) {
|
||||
statusbar(_("Error reading lock file %s: Not enough data read"),
|
||||
lockfilename);
|
||||
return -1;
|
||||
}
|
||||
strncpy(lockprog, &lockbuf[2], 10);
|
||||
lockpid = lockbuf[25] * 256 + lockbuf[24];
|
||||
strncpy(lockuser, &lockbuf[28], 16);
|
||||
if (readtot < 48) {
|
||||
statusbar(_("Error reading lock file %s: Not enough data read"),
|
||||
lockfilename);
|
||||
return -1;
|
||||
}
|
||||
strncpy(lockprog, &lockbuf[2], 10);
|
||||
lockpid = (unsigned char)lockbuf[25] * 256 + (unsigned char)lockbuf[24];
|
||||
strncpy(lockuser, &lockbuf[28], 16);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "lockpid = %d\n", lockpid);
|
||||
fprintf(stderr, "program name which created this lock file should be %s\n",
|
||||
lockprog);
|
||||
fprintf(stderr, "user which created this lock file should be %s\n",
|
||||
lockuser);
|
||||
fprintf(stderr, "lockpid = %d\n", lockpid);
|
||||
fprintf(stderr, "program name which created this lock file should be %s\n", lockprog);
|
||||
fprintf(stderr, "user which created this lock file should be %s\n", lockuser);
|
||||
#endif
|
||||
sprintf(promptstr, "File being edited (by %s, PID %d, user %s), continue?",
|
||||
lockprog, lockpid, lockuser);
|
||||
ans = do_yesno_prompt(FALSE, promptstr);
|
||||
if (ans < 1) {
|
||||
blank_statusbar();
|
||||
return -1;
|
||||
}
|
||||
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
|
||||
sprintf(promptstr, _("File %s is being edited (by %s with %s, PID %d); continue?"),
|
||||
filename, lockuser, lockprog, lockpid);
|
||||
ans = do_yesno_prompt(FALSE, promptstr);
|
||||
if (ans < 1) {
|
||||
blank_statusbar();
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
lockfiledir = mallocstrcpy(NULL, lockfilename);
|
||||
lockfiledir = dirname(lockfiledir);
|
||||
@@ -305,7 +309,6 @@ int do_lockfile(const char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return write_lockfile(lockfilename, filename, FALSE);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
@@ -314,6 +317,7 @@ int do_lockfile(const char *filename)
|
||||
* necessary, and then open and read the file, if applicable. */
|
||||
void open_buffer(const char *filename, bool undoable)
|
||||
{
|
||||
bool quiet = FALSE;
|
||||
bool new_buffer = (openfile == NULL
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
|| ISSET(MULTIBUFFER)
|
||||
@@ -337,13 +341,30 @@ void open_buffer(const char *filename, bool undoable)
|
||||
|
||||
/* If we're loading into a new buffer, add a new entry to
|
||||
* openfile. */
|
||||
if (new_buffer)
|
||||
if (new_buffer) {
|
||||
make_new_buffer();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING) && filename[0] != '\0') {
|
||||
int lockstatus = do_lockfile(filename);
|
||||
if (lockstatus < 0) {
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
if (openfile->next) {
|
||||
close_buffer(TRUE);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
} else if (lockstatus == 0) {
|
||||
quiet = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If the filename isn't blank, and we are not in NOREAD_MODE,
|
||||
* open the file. Otherwise, treat it as a new file. */
|
||||
rc = (filename[0] != '\0' && !ISSET(NOREAD_MODE)) ?
|
||||
open_file(filename, new_buffer, &f) : -2;
|
||||
open_file(filename, new_buffer, quiet, &f) : -2;
|
||||
|
||||
/* If we have a file, and we're loading into a new buffer, update
|
||||
* the filename. */
|
||||
@@ -380,35 +401,25 @@ void open_buffer(const char *filename, bool undoable)
|
||||
}
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
/* If it's not "", filename is a file to open. We blow away the text of
|
||||
* the current buffer, and then open and read the file, if
|
||||
* applicable. Note that we skip the operating directory test when
|
||||
* doing this. */
|
||||
/* Blow away the text of the current buffer, and then open and read
|
||||
* the specified file into its place. */
|
||||
void replace_buffer(const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
int rc;
|
||||
/* rc == -2 means that we have a new file. -1 means that the
|
||||
* open() failed. 0 means that the open() succeeded. */
|
||||
int descriptor;
|
||||
|
||||
assert(filename != NULL);
|
||||
assert(filename != NULL && filename[0] != '\0');
|
||||
|
||||
/* If the filename isn't blank, open the file. Otherwise, treat it
|
||||
* as a new file. */
|
||||
rc = (filename[0] != '\0') ? open_file(filename, TRUE, &f) : -2;
|
||||
/* Open the file quietly. */
|
||||
descriptor = open_file(filename, TRUE, FALSE, &f);
|
||||
|
||||
/* Reinitialize the text of the current buffer. */
|
||||
free_filestruct(openfile->fileage);
|
||||
initialize_buffer_text();
|
||||
|
||||
/* If we have a non-new file, read it in. */
|
||||
if (rc > 0)
|
||||
read_file(f, rc, filename, FALSE, TRUE);
|
||||
|
||||
/* Move back to the beginning of the first line of the buffer. */
|
||||
openfile->current = openfile->fileage;
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
/* If opening the file succeeded, read it in. */
|
||||
if (descriptor > 0)
|
||||
read_file(f, descriptor, filename, FALSE, TRUE);
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER */
|
||||
|
||||
@@ -431,14 +442,15 @@ void display_buffer(void)
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
/* Switch to the next file buffer if next_buf is TRUE. Otherwise,
|
||||
* switch to the previous file buffer. */
|
||||
void switch_to_prevnext_buffer(bool next_buf)
|
||||
void switch_to_prevnext_buffer(bool next_buf, bool quiet)
|
||||
{
|
||||
assert(openfile != NULL);
|
||||
|
||||
/* If only one file buffer is open, indicate it on the statusbar and
|
||||
* get out. */
|
||||
if (openfile == openfile->next) {
|
||||
statusbar(_("No more open file buffers"));
|
||||
if (quiet == FALSE)
|
||||
statusbar(_("No more open file buffers"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -454,9 +466,10 @@ void switch_to_prevnext_buffer(bool next_buf)
|
||||
display_buffer();
|
||||
|
||||
/* Indicate the switch on the statusbar. */
|
||||
statusbar(_("Switched to %s"),
|
||||
((openfile->filename[0] == '\0') ? _("New Buffer") :
|
||||
openfile->filename));
|
||||
if (quiet == FALSE)
|
||||
statusbar(_("Switched to %s"),
|
||||
((openfile->filename[0] == '\0') ?
|
||||
_("New Buffer") : openfile->filename));
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_filestruct(openfile->current);
|
||||
@@ -467,19 +480,21 @@ void switch_to_prevnext_buffer(bool next_buf)
|
||||
/* Switch to the previous entry in the openfile filebuffer. */
|
||||
void switch_to_prev_buffer_void(void)
|
||||
{
|
||||
switch_to_prevnext_buffer(FALSE);
|
||||
switch_to_prevnext_buffer(FALSE, FALSE);
|
||||
}
|
||||
|
||||
/* Switch to the next entry in the openfile filebuffer. */
|
||||
void switch_to_next_buffer_void(void)
|
||||
{
|
||||
switch_to_prevnext_buffer(TRUE);
|
||||
switch_to_prevnext_buffer(TRUE, FALSE);
|
||||
}
|
||||
|
||||
/* Delete an entry from the openfile filebuffer, and switch to the one
|
||||
* after it. Return TRUE on success, or FALSE if there are no more open
|
||||
* file buffers. */
|
||||
bool close_buffer(void)
|
||||
* file buffers.
|
||||
* quiet - should we print messages switching bufers
|
||||
*/
|
||||
bool close_buffer(bool quiet)
|
||||
{
|
||||
assert(openfile != NULL);
|
||||
|
||||
@@ -492,7 +507,7 @@ bool close_buffer(void)
|
||||
#endif
|
||||
|
||||
/* Switch to the next file buffer. */
|
||||
switch_to_next_buffer_void();
|
||||
switch_to_prevnext_buffer(TRUE, quiet);
|
||||
|
||||
/* Close the file buffer we had open before. */
|
||||
unlink_opennode(openfile->prev);
|
||||
@@ -527,17 +542,17 @@ int is_file_writable(const char *filename)
|
||||
full_filename = get_full_path(filename);
|
||||
|
||||
/* Okay, if we can't stat the path due to a component's
|
||||
permissions, just try the relative one. */
|
||||
if (full_filename == NULL
|
||||
|| (stat(full_filename, &fileinfo) == -1 && stat(filename, &fileinfo2) != -1))
|
||||
full_filename = mallocstrcpy(NULL, filename);
|
||||
*permissions, just try the relative one. */
|
||||
if (full_filename == NULL ||
|
||||
(stat(full_filename, &fileinfo) == -1 && stat(filename, &fileinfo2) != -1))
|
||||
full_filename = mallocstrcpy(NULL, filename);
|
||||
|
||||
if ((fd = open(full_filename, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR |
|
||||
S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) == -1
|
||||
|| (f = fdopen(fd, "a")) == NULL)
|
||||
S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) == -1 ||
|
||||
(f = fdopen(fd, "a")) == NULL)
|
||||
ans = FALSE;
|
||||
else
|
||||
fclose(f);
|
||||
fclose(f);
|
||||
close(fd);
|
||||
|
||||
free(full_filename);
|
||||
@@ -801,10 +816,8 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
|
||||
/* Move fileptr back one line and blow away the old fileptr,
|
||||
* since its text has been saved. */
|
||||
fileptr = fileptr->prev;
|
||||
if (fileptr != NULL) {
|
||||
if (fileptr->next != NULL)
|
||||
free(fileptr->next);
|
||||
}
|
||||
if (fileptr != NULL)
|
||||
free(fileptr->next);
|
||||
}
|
||||
|
||||
/* Attach the line at current after the line at fileptr. */
|
||||
@@ -888,10 +901,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
|
||||
* Return -2 if we say "New File", -1 if the file isn't opened, and the
|
||||
* fd opened otherwise. The file might still have an error while reading
|
||||
* with a 0 return value. *f is set to the opened file. */
|
||||
int open_file(const char *filename, bool newfie, FILE **f)
|
||||
int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
|
||||
{
|
||||
struct stat fileinfo, fileinfo2;
|
||||
int fd, quiet = 0;
|
||||
int fd;
|
||||
char *full_filename;
|
||||
|
||||
assert(filename != NULL && f != NULL);
|
||||
@@ -900,26 +913,16 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
||||
full_filename = get_full_path(filename);
|
||||
|
||||
/* Okay, if we can't stat the path due to a component's
|
||||
permissions, just try the relative one. */
|
||||
* permissions, just try the relative one. */
|
||||
if (full_filename == NULL
|
||||
|| (stat(full_filename, &fileinfo) == -1 && stat(filename, &fileinfo2) != -1))
|
||||
full_filename = mallocstrcpy(NULL, filename);
|
||||
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING)) {
|
||||
int lockstatus = do_lockfile(full_filename);
|
||||
if (lockstatus < 0)
|
||||
return -1;
|
||||
else if (lockstatus == 0)
|
||||
quiet = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (stat(full_filename, &fileinfo) == -1) {
|
||||
/* Well, maybe we can open the file even if the OS says it's
|
||||
* not there. */
|
||||
if ((fd = open(filename, O_RDONLY)) != -1) {
|
||||
if ((fd = open(filename, O_RDONLY)) != -1) {
|
||||
if (!quiet)
|
||||
statusbar(_("Reading File"));
|
||||
free(full_filename);
|
||||
@@ -948,7 +951,7 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
||||
strerror(errno));
|
||||
beep();
|
||||
return -1;
|
||||
} else {
|
||||
} else {
|
||||
/* The file is A-OK. Open it. */
|
||||
*f = fdopen(fd, "rb");
|
||||
|
||||
@@ -972,20 +975,17 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
||||
* extension exists, we return "". */
|
||||
char *get_next_filename(const char *name, const char *suffix)
|
||||
{
|
||||
static int ulmax_digits = -1;
|
||||
unsigned long i = 0;
|
||||
char *buf;
|
||||
size_t namelen, suffixlen;
|
||||
size_t wholenamelen;
|
||||
|
||||
assert(name != NULL && suffix != NULL);
|
||||
|
||||
if (ulmax_digits == -1)
|
||||
ulmax_digits = digits(ULONG_MAX);
|
||||
wholenamelen = strlen(name) + strlen(suffix);
|
||||
|
||||
namelen = strlen(name);
|
||||
suffixlen = strlen(suffix);
|
||||
|
||||
buf = charalloc(namelen + suffixlen + ulmax_digits + 2);
|
||||
/* Reserve space for: the name plus the suffix plus a dot plus
|
||||
* possibly five digits plus a null byte. */
|
||||
buf = charalloc(wholenamelen + 7);
|
||||
sprintf(buf, "%s%s", name, suffix);
|
||||
|
||||
while (TRUE) {
|
||||
@@ -993,11 +993,12 @@ char *get_next_filename(const char *name, const char *suffix)
|
||||
|
||||
if (stat(buf, &fs) == -1)
|
||||
return buf;
|
||||
if (i == ULONG_MAX)
|
||||
|
||||
/* Limit the number of backup files to a hundred thousand. */
|
||||
if (++i == 100000)
|
||||
break;
|
||||
|
||||
i++;
|
||||
sprintf(buf + namelen + suffixlen, ".%lu", i);
|
||||
sprintf(buf + wholenamelen, ".%lu", i);
|
||||
}
|
||||
|
||||
/* We get here only if there is no possible save file. Blank out
|
||||
@@ -1026,13 +1027,10 @@ void do_insertfile(
|
||||
size_t current_x_save = openfile->current_x;
|
||||
ssize_t current_y_save = openfile->current_y;
|
||||
bool edittop_inside = FALSE;
|
||||
const sc *s;
|
||||
#ifndef NANO_TINY
|
||||
bool right_side_up = FALSE, single_line = FALSE;
|
||||
#endif
|
||||
|
||||
currmenu = MINSERTFILE;
|
||||
|
||||
while (TRUE) {
|
||||
#ifndef NANO_TINY
|
||||
if (execute) {
|
||||
@@ -1084,14 +1082,13 @@ void do_insertfile(
|
||||
break;
|
||||
} else {
|
||||
size_t pww_save = openfile->placewewant;
|
||||
functionptrtype func = func_from_key(&i);
|
||||
|
||||
ans = mallocstrcpy(ans, answer);
|
||||
|
||||
s = get_shortcut(&i);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
if (s && s->scfunc == new_buffer_void) {
|
||||
if (func == new_buffer_void) {
|
||||
/* Don't allow toggling if we're in view mode. */
|
||||
if (!ISSET(VIEW_MODE))
|
||||
TOGGLE(MULTIBUFFER);
|
||||
@@ -1100,14 +1097,14 @@ void do_insertfile(
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (s && s->scfunc == flip_execute_void) {
|
||||
if (func == flip_execute_void) {
|
||||
execute = !execute;
|
||||
continue;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
if (s && s->scfunc == to_files_void) {
|
||||
if (func == to_files_void) {
|
||||
char *tmp = do_browse_from(answer);
|
||||
|
||||
if (tmp == NULL)
|
||||
@@ -1131,18 +1128,18 @@ void do_insertfile(
|
||||
continue;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Keep track of whether the mark begins inside the
|
||||
* partition and will need adjustment. */
|
||||
if (openfile->mark_set) {
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
/* Keep track of whether the mark begins inside the
|
||||
* partition and will need adjustment. */
|
||||
if (openfile->mark_set) {
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x,
|
||||
&right_side_up);
|
||||
|
||||
single_line = (top == bot);
|
||||
}
|
||||
single_line = (top == bot);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
@@ -1441,8 +1438,7 @@ char *get_full_path(const char *origpath)
|
||||
}
|
||||
|
||||
/* Free d_there_file, since we're done using it. */
|
||||
if (d_there_file != NULL)
|
||||
free(d_there_file);
|
||||
free(d_there_file);
|
||||
|
||||
return d_there;
|
||||
}
|
||||
@@ -1598,11 +1594,11 @@ int prompt_failed_backupwrite(const char *filename)
|
||||
{
|
||||
static int i;
|
||||
static char *prevfile = NULL; /* What was the last file we were
|
||||
* passed so we don't keep asking
|
||||
* this? Though maybe we should... */
|
||||
* passed so we don't keep asking
|
||||
* this? Though maybe we should... */
|
||||
if (prevfile == NULL || strcmp(filename, prevfile)) {
|
||||
i = do_yesno_prompt(FALSE,
|
||||
_("Failed to write backup file, continue saving? (Say N if unsure) "));
|
||||
_("Failed to write backup file, continue saving? (Say N if unsure) "));
|
||||
prevfile = mallocstrcpy(prevfile, filename);
|
||||
}
|
||||
return i;
|
||||
@@ -1895,9 +1891,9 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
free(backupname);
|
||||
fclose(backup_file);
|
||||
/* If we can't write to the backup, DONT go on, since
|
||||
whatever caused the backup file to fail (e.g. disk
|
||||
full may well cause the real file write to fail, which
|
||||
means we could lose both the backup and the original! */
|
||||
* whatever caused the backup file to fail (e.g. disk
|
||||
* full may well cause the real file write to fail, which
|
||||
* means we could lose both the backup and the original! */
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
@@ -2164,8 +2160,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
|
||||
cleanup_and_exit:
|
||||
free(realname);
|
||||
if (tempname != NULL)
|
||||
free(tempname);
|
||||
free(tempname);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -2234,9 +2229,6 @@ bool do_writeout(bool exiting)
|
||||
static bool did_credits = FALSE;
|
||||
#endif
|
||||
bool retval = FALSE;
|
||||
const sc *s;
|
||||
|
||||
currmenu = MWRITEFILE;
|
||||
|
||||
if (exiting && openfile->filename[0] != '\0' && ISSET(TEMP_FILE)) {
|
||||
retval = write_file(openfile->filename, NULL, FALSE, OVERWRITE,
|
||||
@@ -2306,11 +2298,12 @@ bool do_writeout(bool exiting)
|
||||
retval = FALSE;
|
||||
break;
|
||||
} else {
|
||||
functionptrtype func = func_from_key(&i);
|
||||
|
||||
ans = mallocstrcpy(ans, answer);
|
||||
s = get_shortcut(&i);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
if (s && s->scfunc == to_files_void) {
|
||||
if (func == to_files_void) {
|
||||
char *tmp = do_browse_from(answer);
|
||||
|
||||
if (tmp == NULL)
|
||||
@@ -2322,26 +2315,26 @@ bool do_writeout(bool exiting)
|
||||
} else
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#ifndef NANO_TINY
|
||||
if (s && s->scfunc == dos_format_void) {
|
||||
if (func == dos_format_void) {
|
||||
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
|
||||
DOS_FILE;
|
||||
continue;
|
||||
} else if (s && s->scfunc == mac_format_void) {
|
||||
} else if (func == mac_format_void) {
|
||||
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE :
|
||||
MAC_FILE;
|
||||
continue;
|
||||
} else if (s && s->scfunc == backup_file_void) {
|
||||
} else if (func == backup_file_void) {
|
||||
TOGGLE(BACKUP_FILE);
|
||||
continue;
|
||||
} else
|
||||
#endif /* !NANO_TINY */
|
||||
if (s && s->scfunc == prepend_void) {
|
||||
if (func == prepend_void) {
|
||||
append = (append == PREPEND) ? OVERWRITE : PREPEND;
|
||||
continue;
|
||||
} else if (s && s->scfunc == append_void) {
|
||||
} else if (func == append_void) {
|
||||
append = (append == APPEND) ? OVERWRITE : APPEND;
|
||||
continue;
|
||||
} else if (s && s->scfunc == do_help_void) {
|
||||
} else if (func == do_help_void) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2390,10 +2383,8 @@ bool do_writeout(bool exiting)
|
||||
* string's real length. */
|
||||
unsunder(answer, answer_len);
|
||||
|
||||
if (full_filename != NULL)
|
||||
free(full_filename);
|
||||
if (full_answer != NULL)
|
||||
free(full_answer);
|
||||
free(full_filename);
|
||||
free(full_answer);
|
||||
|
||||
if (do_warning) {
|
||||
/* If we're using restricted mode, we aren't allowed
|
||||
|
||||
360
src/global.c
360
src/global.c
@@ -30,18 +30,16 @@
|
||||
|
||||
/* 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 DISABLE_WRAPJUSTIFY
|
||||
ssize_t fill = 0;
|
||||
@@ -137,9 +135,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;
|
||||
@@ -223,7 +221,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
|
||||
if ((f->menus & menu) != 0
|
||||
#ifndef DISABLE_HELP
|
||||
&& strlen(f->help) > 0
|
||||
#endif
|
||||
@@ -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,54 +310,26 @@ 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))
|
||||
{
|
||||
const sc *s;
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if ((s->menu & 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;
|
||||
}
|
||||
|
||||
|
||||
/* Add a string to the shortcut list.
|
||||
* Allows updates to existing entries in the list. */
|
||||
/* Add a key combo to the shortcut list. */
|
||||
void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggle)
|
||||
{
|
||||
sc *s;
|
||||
static sc *tailsc;
|
||||
sc *s = (sc *)nmalloc(sizeof(sc));
|
||||
|
||||
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;
|
||||
/* Start the list, or tack on the next item. */
|
||||
if (sclist == NULL)
|
||||
sclist = s;
|
||||
else
|
||||
tailsc->next = s;
|
||||
tailsc = s;
|
||||
s->next = NULL;
|
||||
|
||||
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);
|
||||
/* Fill in the data. */
|
||||
s->menu = menu;
|
||||
s->scfunc = func;
|
||||
s->toggle = toggle;
|
||||
s->keystr = (char *) scstring;
|
||||
s->scfunc = func;
|
||||
s->type = strtokeytype(scstring);
|
||||
assign_keyinfo(s);
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -391,6 +347,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->menu & 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 +372,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 +389,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")))
|
||||
@@ -500,12 +486,14 @@ const char *whereis_next_tag = N_("WhereIs Next");
|
||||
/* 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. */
|
||||
/* TRANSLATORS: Try to keep the next ten strings at most 10 characters. */
|
||||
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 *prev_page_tag = N_("Prev Page");
|
||||
const char *next_page_tag = N_("Next Page");
|
||||
const char *read_file_tag = N_("Read File");
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *fulljustify_tag = N_("FullJstify");
|
||||
@@ -651,6 +639,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 */
|
||||
|
||||
@@ -661,9 +652,9 @@ void shortcut_init(void)
|
||||
#endif
|
||||
|
||||
while (allfuncs != NULL) {
|
||||
subnfunc *f = allfuncs;
|
||||
allfuncs = allfuncs->next;
|
||||
free(f);
|
||||
subnfunc *f = allfuncs;
|
||||
allfuncs = allfuncs->next;
|
||||
free(f);
|
||||
}
|
||||
|
||||
/* Start populating the different menus with functions. */
|
||||
@@ -746,7 +737,11 @@ void shortcut_init(void)
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
add_to_funcs(do_linter, MMAIN,
|
||||
N_("To Linter"), IFSCHELP(nano_lint_msg), BLANKAFTER, NOVIEW);
|
||||
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
|
||||
@@ -785,10 +780,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);
|
||||
@@ -933,28 +928,28 @@ void shortcut_init(void)
|
||||
* specified on the command line, and the fifth is useless since
|
||||
* backups are disabled. */
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
add_to_funcs(dos_format_void, MWRITEFILE,
|
||||
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
|
||||
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);
|
||||
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(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,10 +964,15 @@ 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
|
||||
|
||||
#if !defined(NANO_TINY) && !defined(DISABLE_BROWSER)
|
||||
@@ -1026,12 +1026,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 +1058,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,13 +1154,17 @@ 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
|
||||
add_to_sclist(MWRITEFILE, "M-D", dos_format_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-M", mac_format_void, 0);
|
||||
@@ -1175,6 +1179,8 @@ void shortcut_init(void)
|
||||
add_to_sclist(MHELP|MBROWSER, "^C", do_exit, 0);
|
||||
#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);
|
||||
@@ -1190,17 +1196,24 @@ 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
|
||||
@@ -1221,44 +1234,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 */
|
||||
@@ -1310,6 +1323,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"))
|
||||
@@ -1559,34 +1576,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("ereg);
|
||||
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,8 +1605,7 @@ 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;
|
||||
|
||||
@@ -1663,18 +1670,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
|
||||
}
|
||||
|
||||
|
||||
43
src/help.c
43
src/help.c
@@ -62,10 +62,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,20 +72,21 @@ 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;
|
||||
|
||||
/* Get the last line of the help text. */
|
||||
ptr = 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--;
|
||||
|
||||
/* Display the help text if we don't have a key, or if the help
|
||||
* text has moved. */
|
||||
if (kbinput == ERR || line != old_line) {
|
||||
@@ -121,6 +118,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;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
if (kbinput == KEY_MOUSE) {
|
||||
int mouse_x, mouse_y;
|
||||
@@ -158,15 +163,14 @@ void do_help(void (*refresh_func)(void))
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -383,8 +387,7 @@ void help_init(void)
|
||||
|
||||
/* 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);
|
||||
free(help_text);
|
||||
|
||||
/* Allocate space for the help text. */
|
||||
help_text = charalloc(allocsize + 1);
|
||||
|
||||
12
src/move.c
12
src/move.c
@@ -471,7 +471,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 +483,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 +534,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);
|
||||
}
|
||||
@@ -632,7 +632,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 +671,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 +692,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);
|
||||
}
|
||||
|
||||
164
src/nano.c
164
src/nano.c
@@ -25,7 +25,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
@@ -124,14 +123,10 @@ void delete_node(filestruct *fileptr)
|
||||
{
|
||||
assert(fileptr != NULL && fileptr->data != NULL);
|
||||
|
||||
if (fileptr->data != NULL)
|
||||
free(fileptr->data);
|
||||
|
||||
free(fileptr->data);
|
||||
#ifndef DISABLE_COLOR
|
||||
if (fileptr->multidata)
|
||||
free(fileptr->multidata);
|
||||
free(fileptr->multidata);
|
||||
#endif
|
||||
|
||||
free(fileptr);
|
||||
}
|
||||
|
||||
@@ -178,7 +173,8 @@ void renumber(filestruct *fileptr)
|
||||
{
|
||||
ssize_t line;
|
||||
|
||||
assert(fileptr != NULL);
|
||||
if (fileptr == NULL)
|
||||
return;
|
||||
|
||||
line = (fileptr->prev == NULL) ? 0 : fileptr->prev->lineno;
|
||||
|
||||
@@ -360,10 +356,12 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
*file_bot = openfile->filebot;
|
||||
}
|
||||
|
||||
openfile->fileage->next = NULL;
|
||||
free_filestruct(openfile->fileage);
|
||||
|
||||
/* Renumber starting with the line after the original
|
||||
* file_bot. */
|
||||
if (file_bot_save->next != NULL)
|
||||
renumber(file_bot_save->next);
|
||||
renumber(file_bot_save->next);
|
||||
}
|
||||
|
||||
/* Since the text has now been saved, remove it from the
|
||||
@@ -447,6 +445,7 @@ void copy_from_filestruct(filestruct *somebuffer)
|
||||
|
||||
/* Put the top and bottom of the current filestruct at the top and
|
||||
* bottom of a copy of the passed buffer. */
|
||||
free_filestruct(openfile->fileage);
|
||||
openfile->fileage = copy_filestruct(somebuffer);
|
||||
openfile->filebot = openfile->fileage;
|
||||
while (openfile->filebot->next != NULL)
|
||||
@@ -552,7 +551,8 @@ void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
|
||||
/* Unlink a node from the rest of the openfilestruct, and delete it. */
|
||||
void unlink_opennode(openfilestruct *fileptr)
|
||||
{
|
||||
assert(fileptr != NULL && fileptr->prev != NULL && fileptr->next != NULL && fileptr != fileptr->prev && fileptr != fileptr->next);
|
||||
assert(fileptr != NULL && fileptr->prev != NULL && fileptr->next != NULL &&
|
||||
fileptr != fileptr->prev && fileptr != fileptr->next);
|
||||
|
||||
fileptr->prev->next = fileptr->next;
|
||||
fileptr->next->prev = fileptr->prev;
|
||||
@@ -568,10 +568,8 @@ void delete_opennode(openfilestruct *fileptr)
|
||||
free(fileptr->filename);
|
||||
free_filestruct(fileptr->fileage);
|
||||
#ifndef NANO_TINY
|
||||
if (fileptr->current_stat != NULL)
|
||||
free(fileptr->current_stat);
|
||||
free(fileptr->current_stat);
|
||||
#endif
|
||||
|
||||
free(fileptr);
|
||||
}
|
||||
|
||||
@@ -715,9 +713,9 @@ void die_save_file(const char *die_filename
|
||||
_("Too many backup files?"));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Try and chmod/chown the save file to the values of the original file, but
|
||||
dont worry if it fails because we're supposed to be bailing as fast
|
||||
as possible. */
|
||||
/* Try and chmod/chown the save file to the values of the original file,
|
||||
* but don't worry if it fails because we're supposed to be bailing as
|
||||
* fast as possible. */
|
||||
if (die_stat) {
|
||||
int shush;
|
||||
shush = chmod(retval, die_stat->st_mode);
|
||||
@@ -847,26 +845,23 @@ void usage(void)
|
||||
print_opt(_("-C <dir>"), _("--backupdir=<dir>"),
|
||||
N_("Directory for saving unique backup files"));
|
||||
#endif
|
||||
print_opt("-D", "--boldtext",
|
||||
N_("Use bold instead of reverse video text"));
|
||||
print_opt("-D", "--boldtext", N_("Use bold instead of reverse video text"));
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-E", "--tabstospaces",
|
||||
N_("Convert typed tabs to spaces"));
|
||||
print_opt("-E", "--tabstospaces", N_("Convert typed tabs to spaces"));
|
||||
#endif
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
print_opt("-F", "--multibuffer", N_("Enable multiple file buffers"));
|
||||
print_opt("-F", "--multibuffer",
|
||||
N_("Read a file into a new buffer by default"));
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-G", "--locking",
|
||||
N_("Use (vim-style) lock files"));
|
||||
print_opt("-G", "--locking", N_("Use (vim-style) lock files"));
|
||||
#endif
|
||||
#ifndef DISABLE_HISTORIES
|
||||
print_opt("-H", "--historylog",
|
||||
N_("Log & read search/replace string history"));
|
||||
#endif
|
||||
#ifndef DISABLE_NANORC
|
||||
print_opt("-I", "--ignorercfiles",
|
||||
N_("Don't look at nanorc files"));
|
||||
print_opt("-I", "--ignorercfiles", N_("Don't look at nanorc files"));
|
||||
#endif
|
||||
print_opt("-K", "--rebindkeypad",
|
||||
N_("Fix numeric keypad key confusion problem"));
|
||||
@@ -878,25 +873,21 @@ void usage(void)
|
||||
#endif
|
||||
print_opt("-O", "--morespace", N_("Use one more line for editing"));
|
||||
#ifndef DISABLE_HISTORIES
|
||||
print_opt("-P", "--poslog",
|
||||
N_("Log & read location of cursor position"));
|
||||
print_opt("-P", "--poslog", N_("Log & read location of cursor position"));
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
print_opt(_("-Q <str>"), _("--quotestr=<str>"),
|
||||
N_("Quoting string"));
|
||||
print_opt(_("-Q <str>"), _("--quotestr=<str>"), N_("Quoting string"));
|
||||
#endif
|
||||
print_opt("-R", "--restricted", N_("Restricted mode"));
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-S", "--smooth",
|
||||
N_("Scroll by line instead of half-screen"));
|
||||
print_opt("-S", "--smooth", N_("Scroll by line instead of half-screen"));
|
||||
#endif
|
||||
print_opt(_("-T <#cols>"), _("--tabsize=<#cols>"),
|
||||
N_("Set width of a tab to #cols columns"));
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-U", "--quickblank", N_("Do quick statusbar blanking"));
|
||||
#endif
|
||||
print_opt("-V", "--version",
|
||||
N_("Print version information and exit"));
|
||||
print_opt("-V", "--version", N_("Print version information and exit"));
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-W", "--wordbounds",
|
||||
N_("Detect word boundaries more accurately"));
|
||||
@@ -910,12 +901,10 @@ void usage(void)
|
||||
N_("Fix Backspace/Delete confusion problem"));
|
||||
print_opt("-h", "--help", N_("Show this help text"));
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-i", "--autoindent",
|
||||
N_("Automatically indent new lines"));
|
||||
print_opt("-i", "--autoindent", N_("Automatically indent new lines"));
|
||||
print_opt("-k", "--cut", N_("Cut from cursor to end of line"));
|
||||
#endif
|
||||
print_opt("-l", "--nofollow",
|
||||
N_("Don't follow symbolic links, overwrite"));
|
||||
print_opt("-l", "--nofollow", N_("Don't follow symbolic links, overwrite"));
|
||||
#ifndef DISABLE_MOUSE
|
||||
print_opt("-m", "--mouse", N_("Enable the use of the mouse"));
|
||||
#endif
|
||||
@@ -924,8 +913,7 @@ void usage(void)
|
||||
print_opt(_("-o <dir>"), _("--operatingdir=<dir>"),
|
||||
N_("Set operating directory"));
|
||||
#endif
|
||||
print_opt("-p", "--preserve",
|
||||
N_("Preserve XON (^Q) and XOFF (^S) keys"));
|
||||
print_opt("-p", "--preserve", N_("Preserve XON (^Q) and XOFF (^S) keys"));
|
||||
#ifndef DISABLE_NANORC
|
||||
print_opt("-q", "--quiet",
|
||||
N_("Silently ignore startup issues like rc file errors"));
|
||||
@@ -938,8 +926,7 @@ void usage(void)
|
||||
print_opt(_("-s <prog>"), _("--speller=<prog>"),
|
||||
N_("Enable alternate speller"));
|
||||
#endif
|
||||
print_opt("-t", "--tempfile",
|
||||
N_("Auto save on exit, don't prompt"));
|
||||
print_opt("-t", "--tempfile", N_("Auto save on exit, don't prompt"));
|
||||
print_opt("-v", "--view", N_("View mode (read-only)"));
|
||||
#ifndef DISABLE_WRAPPING
|
||||
print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines"));
|
||||
@@ -956,9 +943,8 @@ void usage(void)
|
||||
* it was compiled with. */
|
||||
void version(void)
|
||||
{
|
||||
printf(_(" GNU nano version %s (compiled %s, %s)\n"), VERSION,
|
||||
__TIME__, __DATE__);
|
||||
printf(" (C) 1999..2014 Free Software Foundation, Inc.\n");
|
||||
printf(_(" GNU nano, version %s\n"), VERSION);
|
||||
printf(" (C) 1999..2015 Free Software Foundation, Inc.\n");
|
||||
printf(
|
||||
_(" Email: nano@nano-editor.org Web: http://www.nano-editor.org/"));
|
||||
printf(_("\n Compiled options:"));
|
||||
@@ -1142,13 +1128,13 @@ void do_exit(void)
|
||||
if (i == 0 || (i == 1 && do_writeout(TRUE))) {
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING) && openfile->lock_filename)
|
||||
delete_lockfile(openfile->lock_filename);
|
||||
if (ISSET(LOCKING) && openfile->lock_filename)
|
||||
delete_lockfile(openfile->lock_filename);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
/* Exit only if there are no more open file buffers. */
|
||||
if (!close_buffer())
|
||||
if (!close_buffer(FALSE))
|
||||
#endif
|
||||
finish();
|
||||
/* If the user canceled, we go on. */
|
||||
@@ -1164,9 +1150,12 @@ void do_cancel(void)
|
||||
;
|
||||
}
|
||||
|
||||
static struct sigaction pager_oldaction, pager_newaction; /* Original and temporary handlers for SIGINT. */
|
||||
static bool pager_sig_failed = FALSE; /* Did sigaction() fail without changing the signal handlers? */
|
||||
static bool pager_input_aborted = FALSE; /* Did someone invoke the pager and abort it via ^C? */
|
||||
static struct sigaction pager_oldaction, pager_newaction;
|
||||
/* Original and temporary handlers for SIGINT. */
|
||||
static bool pager_sig_failed = FALSE;
|
||||
/* Did sigaction() fail without changing the signal handlers? */
|
||||
static bool pager_input_aborted = FALSE;
|
||||
/* Did someone invoke the pager and abort it via ^C? */
|
||||
|
||||
/* Things which need to be run regardless of whether
|
||||
* we finished the stdin pipe correctly or not. */
|
||||
@@ -1177,20 +1166,20 @@ void finish_stdin_pager(void)
|
||||
|
||||
/* Read whatever we did get from stdin. */
|
||||
f = fopen("/dev/stdin", "rb");
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
|
||||
read_file(f, 0, "stdin", TRUE, FALSE);
|
||||
ttystdin = open("/dev/tty", O_RDONLY);
|
||||
if (!ttystdin)
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
|
||||
dup2(ttystdin,0);
|
||||
close(ttystdin);
|
||||
if (!pager_input_aborted)
|
||||
tcgetattr(0, &oldterm);
|
||||
if (!pager_sig_failed && sigaction(SIGINT, &pager_oldaction, NULL) == -1)
|
||||
nperror("sigaction");
|
||||
nperror("sigaction");
|
||||
terminal_init();
|
||||
doupdate();
|
||||
}
|
||||
@@ -1198,7 +1187,6 @@ void finish_stdin_pager(void)
|
||||
/* Cancel reading from stdin like a pager. */
|
||||
RETSIGTYPE cancel_stdin_pager(int signal)
|
||||
{
|
||||
/* Currently do nothing, just handle the intr silently. */
|
||||
pager_input_aborted = TRUE;
|
||||
}
|
||||
|
||||
@@ -1210,13 +1198,13 @@ void stdin_pager(void)
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
fprintf(stderr, _("Reading from stdin, ^C to abort\n"));
|
||||
|
||||
/* Set things up so that Ctrl-C will cancel the new process. */
|
||||
/* Enable interpretation of the special control keys so that
|
||||
* we get SIGINT when Ctrl-C is pressed. */
|
||||
#ifndef NANO_TINY
|
||||
enable_signals();
|
||||
#endif
|
||||
|
||||
/* Set things up so that SIGINT will cancel the new process. */
|
||||
if (sigaction(SIGINT, NULL, &pager_newaction) == -1) {
|
||||
pager_sig_failed = TRUE;
|
||||
nperror("sigaction");
|
||||
@@ -1235,8 +1223,7 @@ void stdin_pager(void)
|
||||
/* Initialize the signal handlers. */
|
||||
void signal_init(void)
|
||||
{
|
||||
/* Trap SIGINT and SIGQUIT because we want them to do useful
|
||||
* things. */
|
||||
/* Trap SIGINT and SIGQUIT because we want them to do useful things. */
|
||||
memset(&act, 0, sizeof(struct sigaction));
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigaction(SIGINT, &act, NULL);
|
||||
@@ -1251,7 +1238,6 @@ void signal_init(void)
|
||||
/* Trap SIGWINCH because we want to handle window resizes. */
|
||||
act.sa_handler = handle_sigwinch;
|
||||
sigaction(SIGWINCH, &act, NULL);
|
||||
allow_pending_sigwinch(FALSE);
|
||||
#endif
|
||||
|
||||
/* Trap normal suspend (^Z) so we can handle it ourselves. */
|
||||
@@ -1280,9 +1266,8 @@ RETSIGTYPE handle_hupterm(int signal)
|
||||
/* Handler for SIGTSTP (suspend). */
|
||||
RETSIGTYPE do_suspend(int signal)
|
||||
{
|
||||
|
||||
if (ISSET(RESTRICTED)) {
|
||||
nano_disabled_msg();
|
||||
nano_disabled_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1312,7 +1297,7 @@ RETSIGTYPE do_suspend(int signal)
|
||||
kill(0, SIGSTOP);
|
||||
}
|
||||
|
||||
/* the subnfunc version */
|
||||
/* The version of above function that is bound to a key. */
|
||||
void do_suspend_void(void)
|
||||
{
|
||||
if (ISSET(SUSPEND))
|
||||
@@ -1350,6 +1335,13 @@ RETSIGTYPE do_continue(int signal)
|
||||
#ifndef NANO_TINY
|
||||
/* Handler for SIGWINCH (window size change). */
|
||||
RETSIGTYPE handle_sigwinch(int signal)
|
||||
{
|
||||
/* Let the input routine know that a SIGWINCH has occurred. */
|
||||
sigwinch_counter++;
|
||||
}
|
||||
|
||||
/* Reinitialize and redraw the screen completely. */
|
||||
void regenerate_screen(void)
|
||||
{
|
||||
const char *tty = ttyname(0);
|
||||
int fd, result = 0;
|
||||
@@ -1374,10 +1366,6 @@ RETSIGTYPE handle_sigwinch(int signal)
|
||||
LINES = win.ws_row;
|
||||
#endif
|
||||
|
||||
/* If we've partitioned the filestruct, unpartition it now. */
|
||||
if (filepart != NULL)
|
||||
unpartition_filestruct(&filepart);
|
||||
|
||||
#ifdef USE_SLANG
|
||||
/* Slang curses emulation brain damage, part 1: If we just do what
|
||||
* curses does here, it'll only work properly if the resize made the
|
||||
@@ -1404,14 +1392,7 @@ RETSIGTYPE handle_sigwinch(int signal)
|
||||
window_init();
|
||||
|
||||
/* Redraw the contents of the windows that need it. */
|
||||
blank_statusbar();
|
||||
wnoutrefresh(bottomwin);
|
||||
currmenu = MMAIN;
|
||||
total_refresh();
|
||||
|
||||
/* Jump back to either main() or the unjustify routine in
|
||||
* do_justify(). */
|
||||
siglongjmp(jump_buf, 1);
|
||||
}
|
||||
|
||||
/* If allow is TRUE, block any SIGWINCH signals that we get, so that we
|
||||
@@ -1478,13 +1459,13 @@ void do_toggle(int flag)
|
||||
desc = (char *) _(flagtostr(flag));
|
||||
statusbar("%s %s", desc, enabled ? _("enabled") : _("disabled"));
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Bleh. */
|
||||
void do_toggle_void(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Disable extended input and output processing in our terminal
|
||||
* settings. */
|
||||
@@ -1606,6 +1587,11 @@ int do_input(bool allow_funcs)
|
||||
/* Read in a character. */
|
||||
input = get_kbinput(edit);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (input == KEY_WINCH)
|
||||
return KEY_WINCH;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
if (func_key && input == KEY_MOUSE) {
|
||||
/* We received a mouse click. */
|
||||
@@ -1802,7 +1788,7 @@ int do_mouse(void)
|
||||
mouse_x, (unsigned long)openfile->current_x);
|
||||
#endif
|
||||
} else {
|
||||
openfile->current_x = actual_x(openfile->current->data, mouse_x);
|
||||
openfile->current_x = actual_x(openfile->current->data, mouse_x);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "do_mouse(): i <= mouse_y, mouse_x = %d, setting current_x to = %lu\n",
|
||||
mouse_x, (unsigned long)openfile->current_x);
|
||||
@@ -2117,7 +2103,6 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
const struct option long_options[] = {
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"boldtext", 0, NULL, 'D'},
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
{"multibuffer", 0, NULL, 'F'},
|
||||
@@ -2139,6 +2124,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
{"const", 0, NULL, 'c'},
|
||||
{"rebinddelete", 0, NULL, 'd'},
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"nofollow", 0, NULL, 'l'},
|
||||
#ifndef DISABLE_MOUSE
|
||||
{"mouse", 0, NULL, 'm'},
|
||||
@@ -2173,7 +2159,6 @@ int main(int argc, char **argv)
|
||||
{"poslog", 0, NULL, 'P'},
|
||||
{"smooth", 0, NULL, 'S'},
|
||||
{"quickblank", 0, NULL, 'U'},
|
||||
{"undo", 0, NULL, 'u'},
|
||||
{"wordbounds", 0, NULL, 'W'},
|
||||
{"autoindent", 0, NULL, 'i'},
|
||||
{"cut", 0, NULL, 'k'},
|
||||
@@ -2479,8 +2464,8 @@ int main(int argc, char **argv)
|
||||
do_rcfile();
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "After rebinding keys...\n");
|
||||
print_sclist();
|
||||
fprintf(stderr, "After rebinding keys...\n");
|
||||
print_sclist();
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
@@ -2646,6 +2631,10 @@ int main(int argc, char **argv)
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Initialize the search and replace strings. */
|
||||
last_search = mallocstrcpy(NULL, "");
|
||||
last_replace = mallocstrcpy(NULL, "");
|
||||
|
||||
/* If tabsize wasn't specified, set its default value. */
|
||||
if (tabsize == -1)
|
||||
tabsize = WIDTH_OF_TAB;
|
||||
@@ -2737,7 +2726,7 @@ int main(int argc, char **argv)
|
||||
icol = 1;
|
||||
}
|
||||
#ifndef DISABLE_HISTORIES
|
||||
else {
|
||||
else {
|
||||
/* See if we have a POS history to use if we haven't overridden it. */
|
||||
ssize_t savedposline, savedposcol;
|
||||
if (check_poshistory(argv[i], &savedposline, &savedposcol))
|
||||
@@ -2801,17 +2790,6 @@ int main(int argc, char **argv)
|
||||
reset_cursor();
|
||||
wnoutrefresh(edit);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (!jump_buf_main) {
|
||||
/* If we haven't already, we're going to set jump_buf so
|
||||
* that we return here after a SIGWINCH. Indicate this. */
|
||||
jump_buf_main = TRUE;
|
||||
|
||||
/* Return here after a SIGWINCH. */
|
||||
sigsetjmp(jump_buf, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Just in case we were at the statusbar prompt, make sure the
|
||||
* statusbar cursor position is reset. */
|
||||
do_prompt_abort();
|
||||
@@ -2822,7 +2800,7 @@ int main(int argc, char **argv)
|
||||
if (ISSET(CONST_UPDATE) && get_key_buffer_len() == 0)
|
||||
do_cursorpos(TRUE);
|
||||
|
||||
currmenu = MMAIN;
|
||||
currmenu = MMAIN;
|
||||
|
||||
/* Read in and interpret characters. */
|
||||
do_input(TRUE);
|
||||
|
||||
30
src/nano.h
30
src/nano.h
@@ -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. */
|
||||
@@ -455,9 +452,6 @@ typedef struct sc {
|
||||
/* 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. */
|
||||
struct sc *next;
|
||||
/* Next in the list. */
|
||||
} sc;
|
||||
@@ -569,11 +563,13 @@ enum
|
||||
#define CONTROL_RIGHT 554
|
||||
|
||||
#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. */
|
||||
|
||||
166
src/prompt.c
166
src/prompt.c
@@ -66,6 +66,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. */
|
||||
@@ -151,15 +156,15 @@ int do_statusbar_input(bool *ran_func, bool *finished,
|
||||
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);
|
||||
else if (s->scfunc == do_next_word_void)
|
||||
do_statusbar_next_word(FALSE);
|
||||
#endif
|
||||
else if (s->scfunc == do_home)
|
||||
do_statusbar_home();
|
||||
@@ -245,7 +250,7 @@ int do_statusbar_mouse(void)
|
||||
statusbar_xplustabs()) + mouse_x - start_col);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
}
|
||||
@@ -340,15 +345,14 @@ void do_statusbar_home(void)
|
||||
statusbar_x = 0;
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
statusbar_x = 0;
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
|
||||
@@ -360,7 +364,7 @@ void do_statusbar_end(void)
|
||||
statusbar_x = strlen(answer);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
|
||||
@@ -373,7 +377,7 @@ void do_statusbar_left(void)
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
}
|
||||
@@ -387,7 +391,7 @@ void do_statusbar_right(void)
|
||||
statusbar_x = move_mbright(answer, statusbar_x);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
}
|
||||
@@ -431,14 +435,13 @@ 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);
|
||||
}
|
||||
@@ -502,7 +505,7 @@ bool do_statusbar_next_word(bool allow_punct)
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
@@ -597,7 +600,7 @@ bool do_statusbar_prev_word(bool allow_punct)
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
@@ -647,7 +650,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 -
|
||||
@@ -700,10 +703,10 @@ void update_statusbar_line(const char *curranswer, size_t index)
|
||||
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
|
||||
/* Return TRUE if we need an update after moving the cursor, and FALSE
|
||||
* otherwise. We need an update if pww_save and statusbar_pww are on
|
||||
* different pages. */
|
||||
bool need_statusbar_horizontal_update(size_t pww_save)
|
||||
bool need_statusbar_update(size_t pww_save)
|
||||
{
|
||||
size_t start_col = strlenpt(prompt) + 2;
|
||||
|
||||
@@ -777,7 +780,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
}
|
||||
|
||||
#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);
|
||||
@@ -796,6 +799,14 @@ 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_statusbar_line(answer, statusbar_x);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
func = func_from_key(&kbinput);
|
||||
|
||||
if (func == do_cancel || func == do_enter_void)
|
||||
@@ -901,19 +912,16 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
/* Set the current position in the history list to the bottom,
|
||||
* and free magichistory if we need to. */
|
||||
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
|
||||
@@ -968,12 +976,10 @@ int do_prompt(bool allow_tabs,
|
||||
|
||||
/* prompt has been freed and set to NULL unless the user resized
|
||||
* while at the statusbar prompt. */
|
||||
if (prompt != NULL)
|
||||
free(prompt);
|
||||
free(prompt);
|
||||
|
||||
prompt = charalloc(((COLS - 4) * mb_cur_max()) + 1);
|
||||
|
||||
currmenu = menu;
|
||||
bottombars(menu);
|
||||
|
||||
va_start(ap, msg);
|
||||
@@ -1045,7 +1051,6 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
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,60 +1066,67 @@ 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)
|
||||
#ifndef NANO_TINY
|
||||
if (kbinput == KEY_WINCH)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
func = func_from_key(&kbinput);
|
||||
|
||||
if (func == do_cancel)
|
||||
ok = -1;
|
||||
#ifndef DISABLE_MOUSE
|
||||
else if (kbinput == KEY_MOUSE) {
|
||||
@@ -1146,7 +1158,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
}
|
||||
}
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
else if (s && s->scfunc == total_refresh) {
|
||||
else if (func == total_refresh) {
|
||||
total_redraw();
|
||||
continue;
|
||||
} else {
|
||||
|
||||
41
src/proto.h
41
src/proto.h
@@ -28,12 +28,12 @@
|
||||
|
||||
/* 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 DISABLE_WRAPJUSTIFY
|
||||
extern ssize_t fill;
|
||||
@@ -148,10 +148,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);
|
||||
@@ -283,15 +282,15 @@ 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);
|
||||
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
|
||||
@@ -359,7 +358,7 @@ 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);
|
||||
@@ -478,10 +477,11 @@ RETSIGTYPE do_suspend(int signal);
|
||||
RETSIGTYPE do_continue(int signal);
|
||||
#ifndef NANO_TINY
|
||||
RETSIGTYPE handle_sigwinch(int signal);
|
||||
void regenerate_screen(void);
|
||||
void allow_pending_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);
|
||||
@@ -522,7 +522,7 @@ 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);
|
||||
bool need_statusbar_update(size_t pww_save);
|
||||
void total_statusbar_refresh(void (*refresh_func)(void));
|
||||
functionptrtype get_prompt_string(int *value, bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
@@ -579,14 +579,13 @@ 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);
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
|
||||
@@ -598,7 +597,7 @@ 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);
|
||||
@@ -688,6 +687,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 +695,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 +711,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 +734,7 @@ void new_magicline(void);
|
||||
void remove_magicline(void);
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
void add_undo(undo_type current_action);
|
||||
void add_undo(undo_type action);
|
||||
void update_undo(undo_type action);
|
||||
#endif
|
||||
size_t get_totsize(const filestruct *begin, const filestruct *end);
|
||||
@@ -780,7 +778,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 +786,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);
|
||||
|
||||
79
src/rcfile.c
79
src/rcfile.c
@@ -42,16 +42,16 @@ static const rcoption rcopts[] = {
|
||||
#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},
|
||||
@@ -60,6 +60,9 @@ static const rcoption rcopts[] = {
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
{"operatingdir", 0},
|
||||
#endif
|
||||
#ifndef DISABLE_HISTORIES
|
||||
{"poslog", POS_HISTORY},
|
||||
#endif
|
||||
{"preserve", PRESERVE},
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -79,25 +82,24 @@ 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},
|
||||
{"whitespace", 0},
|
||||
{"wordbounds", WORD_BOUNDS},
|
||||
{"softwrap", SOFTWRAP},
|
||||
#endif
|
||||
#ifndef DISABLE_COLOR
|
||||
{"titlecolor", 0},
|
||||
@@ -328,6 +330,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);
|
||||
@@ -513,6 +516,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;
|
||||
@@ -596,11 +603,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 +905,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 +968,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 +987,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 +1148,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 +1161,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);
|
||||
|
||||
245
src/search.c
245
src/search.c
@@ -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);
|
||||
@@ -258,17 +249,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 +277,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 +315,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 +323,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 +351,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 +367,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 +428,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,35 +460,13 @@ 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 we found something, and we're back at the exact same spot where
|
||||
* we started searching, then this is the only occurrence. */
|
||||
if (fileptr == openfile->current && fileptr_x ==
|
||||
openfile->current_x && didfind) {
|
||||
#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
|
||||
}
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
@@ -523,7 +483,14 @@ void do_research(void)
|
||||
size_t pww_save = openfile->placewewant;
|
||||
bool didfind;
|
||||
|
||||
search_init_globals();
|
||||
focusing = TRUE;
|
||||
|
||||
#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') {
|
||||
#ifdef HAVE_REGEX_H
|
||||
@@ -537,36 +504,13 @@ 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 we found something, and we're back at the exact same spot
|
||||
* where we started searching, then this is the only occurrence. */
|
||||
if (fileptr == openfile->current && fileptr_x ==
|
||||
openfile->current_x && didfind) {
|
||||
#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"));
|
||||
@@ -679,7 +623,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 +631,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 +662,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 +689,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,28 +711,19 @@ 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
|
||||
@@ -821,6 +737,7 @@ ssize_t do_replace_loop(
|
||||
openfile->mark_begin_x = openfile->current_x;
|
||||
else
|
||||
openfile->mark_begin_x += length_change;
|
||||
bot_x = openfile->mark_begin_x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,15 +748,14 @@ ssize_t do_replace_loop(
|
||||
/* 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
|
||||
}
|
||||
|
||||
/* Set the cursor at the last character of the replacement
|
||||
* text, so searching will resume after the replacement
|
||||
@@ -850,16 +766,19 @@ ssize_t do_replace_loop(
|
||||
#endif
|
||||
openfile->current_x += match_len + length_change - 1;
|
||||
|
||||
/* Cleanup. */
|
||||
/* Clean up. */
|
||||
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
|
||||
@@ -877,16 +796,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 +828,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 +865,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
|
||||
@@ -1085,7 +998,6 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update) {
|
||||
edit_refresh();
|
||||
|
||||
display_main_list();
|
||||
}
|
||||
}
|
||||
@@ -1144,8 +1056,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 +1068,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;
|
||||
@@ -1373,8 +1285,7 @@ void update_history(filestruct **h, const char *s)
|
||||
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
|
||||
|
||||
614
src/text.c
614
src/text.c
File diff suppressed because it is too large
Load Diff
37
src/utils.c
37
src/utils.c
@@ -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)
|
||||
@@ -58,7 +43,11 @@ void get_homedir(void)
|
||||
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 +239,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 +270,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? */
|
||||
@@ -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)
|
||||
|
||||
326
src/winio.c
326
src/winio.c
@@ -41,6 +41,8 @@ static bool disable_cursorpos = FALSE;
|
||||
/* Should we temporarily disable constant cursor position
|
||||
* display? */
|
||||
|
||||
static sig_atomic_t sigwinch_counter_save = 0;
|
||||
|
||||
/* Control character compatibility:
|
||||
*
|
||||
* - NANO_BACKSPACE_KEY is Ctrl-H, which is Backspace under ASCII, ANSI,
|
||||
@@ -112,10 +114,6 @@ void get_key_buffer(WINDOW *win)
|
||||
if (key_buffer != NULL)
|
||||
return;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(TRUE);
|
||||
#endif
|
||||
|
||||
/* Just before reading in the first character, display any pending
|
||||
* screen updates. */
|
||||
doupdate();
|
||||
@@ -125,8 +123,17 @@ void get_key_buffer(WINDOW *win)
|
||||
if (nodelay_mode) {
|
||||
if ((input = wgetch(win)) == ERR)
|
||||
return;
|
||||
} else
|
||||
} else {
|
||||
while ((input = wgetch(win)) == ERR) {
|
||||
#ifndef NANO_TINY
|
||||
/* Did we get SIGWINCH since we were last here? */
|
||||
if (sigwinch_counter != sigwinch_counter_save) {
|
||||
sigwinch_counter_save = sigwinch_counter;
|
||||
regenerate_screen();
|
||||
input = KEY_WINCH;
|
||||
break;
|
||||
} else
|
||||
#endif
|
||||
errcount++;
|
||||
|
||||
/* If we've failed to get a character MAX_BUF_SIZE times in a
|
||||
@@ -137,10 +144,7 @@ void get_key_buffer(WINDOW *win)
|
||||
if (errcount == MAX_BUF_SIZE)
|
||||
handle_hupterm(0);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Increment the length of the keystroke buffer, and save the value
|
||||
* of the keystroke at the end of it. */
|
||||
@@ -148,14 +152,17 @@ void get_key_buffer(WINDOW *win)
|
||||
key_buffer = (int *)nmalloc(sizeof(int));
|
||||
key_buffer[0] = input;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we got SIGWINCH, get out immediately since the win argument is
|
||||
* no longer valid. */
|
||||
if (input == KEY_WINCH)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* Read in the remaining characters using non-blocking input. */
|
||||
nodelay(win, TRUE);
|
||||
|
||||
while (TRUE) {
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(TRUE);
|
||||
#endif
|
||||
|
||||
input = wgetch(win);
|
||||
|
||||
/* If there aren't any more characters, stop reading. */
|
||||
@@ -168,17 +175,19 @@ void get_key_buffer(WINDOW *win)
|
||||
key_buffer = (int *)nrealloc(key_buffer, key_buffer_len *
|
||||
sizeof(int));
|
||||
key_buffer[key_buffer_len - 1] = input;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Switch back to waiting mode for input. */
|
||||
nodelay(win, FALSE);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "get_key_buffer(): key_buffer_len = %lu\n", (unsigned long)key_buffer_len);
|
||||
{
|
||||
size_t i;
|
||||
fprintf(stderr, "get_key_buffer(): the series of codes:");
|
||||
for (i = 0; i < key_buffer_len; i++)
|
||||
fprintf(stderr, " %3x", key_buffer[i]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -191,11 +200,6 @@ size_t get_key_buffer_len(void)
|
||||
/* Add the keystrokes in input to the keystroke buffer. */
|
||||
void unget_input(int *input, size_t input_len)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(TRUE);
|
||||
allow_pending_sigwinch(FALSE);
|
||||
#endif
|
||||
|
||||
/* If input is empty, get out. */
|
||||
if (input_len == 0)
|
||||
return;
|
||||
@@ -249,11 +253,6 @@ int *get_input(WINDOW *win, size_t input_len)
|
||||
{
|
||||
int *input;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(TRUE);
|
||||
allow_pending_sigwinch(FALSE);
|
||||
#endif
|
||||
|
||||
if (key_buffer_len == 0) {
|
||||
if (win != NULL) {
|
||||
get_key_buffer(win);
|
||||
@@ -643,6 +642,11 @@ int parse_kbinput(WINDOW *win)
|
||||
retval = sc_seq_or(do_next_word_void, 0);
|
||||
#endif
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
case KEY_WINCH:
|
||||
retval = KEY_WINCH;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If our result is an extended keypad value (i.e. a value
|
||||
@@ -692,20 +696,16 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
* Terminal. */
|
||||
retval = get_escape_seq_abcd(seq[4]);
|
||||
break;
|
||||
case 'P': /* Esc O 1 ; 2 P == F13 on
|
||||
* Terminal. */
|
||||
case 'P': /* Esc O 1 ; 2 P == F13 on Terminal. */
|
||||
retval = KEY_F(13);
|
||||
break;
|
||||
case 'Q': /* Esc O 1 ; 2 Q == F14 on
|
||||
* Terminal. */
|
||||
case 'Q': /* Esc O 1 ; 2 Q == F14 on Terminal. */
|
||||
retval = KEY_F(14);
|
||||
break;
|
||||
case 'R': /* Esc O 1 ; 2 R == F15 on
|
||||
* Terminal. */
|
||||
case 'R': /* Esc O 1 ; 2 R == F15 on Terminal. */
|
||||
retval = KEY_F(15);
|
||||
break;
|
||||
case 'S': /* Esc O 1 ; 2 S == F16 on
|
||||
* Terminal. */
|
||||
case 'S': /* Esc O 1 ; 2 S == F16 on Terminal. */
|
||||
retval = KEY_F(16);
|
||||
break;
|
||||
}
|
||||
@@ -714,18 +714,14 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
case '5':
|
||||
if (seq_len >= 5) {
|
||||
switch (seq[4]) {
|
||||
case 'A': /* Esc O 1 ; 5 A == Ctrl-Up on
|
||||
* Terminal. */
|
||||
case 'B': /* Esc O 1 ; 5 B == Ctrl-Down on
|
||||
* Terminal. */
|
||||
case 'A': /* Esc O 1 ; 5 A == Ctrl-Up on Terminal. */
|
||||
case 'B': /* Esc O 1 ; 5 B == Ctrl-Down on Terminal. */
|
||||
retval = get_escape_seq_abcd(seq[4]);
|
||||
break;
|
||||
case 'C': /* Esc O 1 ; 5 C == Ctrl-Right on
|
||||
* Terminal. */
|
||||
case 'C': /* Esc O 1 ; 5 C == Ctrl-Right on Terminal. */
|
||||
retval = CONTROL_RIGHT;
|
||||
break;
|
||||
case 'D': /* Esc O 1 ; 5 D == Ctrl-Left on
|
||||
* Terminal. */
|
||||
case 'D': /* Esc O 1 ; 5 D == Ctrl-Left on Terminal. */
|
||||
retval = CONTROL_LEFT;
|
||||
break;
|
||||
}
|
||||
@@ -740,32 +736,25 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
case '2':
|
||||
if (seq_len >= 3) {
|
||||
switch (seq[2]) {
|
||||
case 'P': /* Esc O 2 P == F13 on
|
||||
* xterm. */
|
||||
case 'P': /* Esc O 2 P == F13 on xterm. */
|
||||
retval = KEY_F(13);
|
||||
break;
|
||||
case 'Q': /* Esc O 2 Q == F14 on
|
||||
* xterm. */
|
||||
case 'Q': /* Esc O 2 Q == F14 on xterm. */
|
||||
retval = KEY_F(14);
|
||||
break;
|
||||
case 'R': /* Esc O 2 R == F15 on
|
||||
* xterm. */
|
||||
case 'R': /* Esc O 2 R == F15 on xterm. */
|
||||
retval = KEY_F(15);
|
||||
break;
|
||||
case 'S': /* Esc O 2 S == F16 on
|
||||
* xterm. */
|
||||
case 'S': /* Esc O 2 S == F16 on xterm. */
|
||||
retval = KEY_F(16);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'A': /* Esc O A == Up on VT100/VT320/xterm. */
|
||||
case 'B': /* Esc O B == Down on
|
||||
* VT100/VT320/xterm. */
|
||||
case 'C': /* Esc O C == Right on
|
||||
* VT100/VT320/xterm. */
|
||||
case 'D': /* Esc O D == Left on
|
||||
* VT100/VT320/xterm. */
|
||||
case 'B': /* Esc O B == Down on VT100/VT320/xterm. */
|
||||
case 'C': /* Esc O C == Right on VT100/VT320/xterm. */
|
||||
case 'D': /* Esc O D == Left on VT100/VT320/xterm. */
|
||||
retval = get_escape_seq_abcd(seq[1]);
|
||||
break;
|
||||
case 'E': /* Esc O E == Center (5) on numeric keypad
|
||||
@@ -928,20 +917,16 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
case '1':
|
||||
if (seq_len >= 3) {
|
||||
switch (seq[2]) {
|
||||
case '1': /* Esc [ 1 1 ~ == F1 on rxvt/
|
||||
* Eterm. */
|
||||
case '1': /* Esc [ 1 1 ~ == F1 on rxvt/Eterm. */
|
||||
retval = KEY_F(1);
|
||||
break;
|
||||
case '2': /* Esc [ 1 2 ~ == F2 on rxvt/
|
||||
* Eterm. */
|
||||
case '2': /* Esc [ 1 2 ~ == F2 on rxvt/Eterm. */
|
||||
retval = KEY_F(2);
|
||||
break;
|
||||
case '3': /* Esc [ 1 3 ~ == F3 on rxvt/
|
||||
* Eterm. */
|
||||
case '3': /* Esc [ 1 3 ~ == F3 on rxvt/Eterm. */
|
||||
retval = KEY_F(3);
|
||||
break;
|
||||
case '4': /* Esc [ 1 4 ~ == F4 on rxvt/
|
||||
* Eterm. */
|
||||
case '4': /* Esc [ 1 4 ~ == F4 on rxvt/Eterm. */
|
||||
retval = KEY_F(4);
|
||||
break;
|
||||
case '5': /* Esc [ 1 5 ~ == F5 on xterm/
|
||||
@@ -969,14 +954,10 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
case '2':
|
||||
if (seq_len >= 5) {
|
||||
switch (seq[4]) {
|
||||
case 'A': /* Esc [ 1 ; 2 A == Shift-Up on
|
||||
* xterm. */
|
||||
case 'B': /* Esc [ 1 ; 2 B == Shift-Down on
|
||||
* xterm. */
|
||||
case 'C': /* Esc [ 1 ; 2 C == Shift-Right on
|
||||
* xterm. */
|
||||
case 'D': /* Esc [ 1 ; 2 D == Shift-Left on
|
||||
* xterm. */
|
||||
case 'A': /* Esc [ 1 ; 2 A == Shift-Up on xterm. */
|
||||
case 'B': /* Esc [ 1 ; 2 B == Shift-Down on xterm. */
|
||||
case 'C': /* Esc [ 1 ; 2 C == Shift-Right on xterm. */
|
||||
case 'D': /* Esc [ 1 ; 2 D == Shift-Left on xterm. */
|
||||
retval = get_escape_seq_abcd(seq[4]);
|
||||
break;
|
||||
}
|
||||
@@ -985,18 +966,14 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
case '5':
|
||||
if (seq_len >= 5) {
|
||||
switch (seq[4]) {
|
||||
case 'A': /* Esc [ 1 ; 5 A == Ctrl-Up on
|
||||
* xterm. */
|
||||
case 'B': /* Esc [ 1 ; 5 B == Ctrl-Down on
|
||||
* xterm. */
|
||||
case 'A': /* Esc [ 1 ; 5 A == Ctrl-Up on xterm. */
|
||||
case 'B': /* Esc [ 1 ; 5 B == Ctrl-Down on xterm. */
|
||||
retval = get_escape_seq_abcd(seq[4]);
|
||||
break;
|
||||
case 'C': /* Esc [ 1 ; 5 C == Ctrl-Right on
|
||||
* xterm. */
|
||||
case 'C': /* Esc [ 1 ; 5 C == Ctrl-Right on xterm. */
|
||||
retval = CONTROL_RIGHT;
|
||||
break;
|
||||
case 'D': /* Esc [ 1 ; 5 D == Ctrl-Left on
|
||||
* xterm. */
|
||||
case 'D': /* Esc [ 1 ; 5 D == Ctrl-Left on xterm. */
|
||||
retval = CONTROL_LEFT;
|
||||
break;
|
||||
}
|
||||
@@ -1015,49 +992,40 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
case '2':
|
||||
if (seq_len >= 3) {
|
||||
switch (seq[2]) {
|
||||
case '0': /* Esc [ 2 0 ~ == F9 on
|
||||
* VT220/VT320/Linux console/
|
||||
* xterm/rxvt/Eterm. */
|
||||
case '0': /* Esc [ 2 0 ~ == F9 on VT220/VT320/
|
||||
* Linux console/xterm/rxvt/Eterm. */
|
||||
retval = KEY_F(9);
|
||||
break;
|
||||
case '1': /* Esc [ 2 1 ~ == F10 on
|
||||
* VT220/VT320/Linux console/
|
||||
* xterm/rxvt/Eterm. */
|
||||
case '1': /* Esc [ 2 1 ~ == F10 on VT220/VT320/
|
||||
* Linux console/xterm/rxvt/Eterm. */
|
||||
retval = KEY_F(10);
|
||||
break;
|
||||
case '3': /* Esc [ 2 3 ~ == F11 on
|
||||
* VT220/VT320/Linux console/
|
||||
* xterm/rxvt/Eterm. */
|
||||
case '3': /* Esc [ 2 3 ~ == F11 on VT220/VT320/
|
||||
* Linux console/xterm/rxvt/Eterm. */
|
||||
retval = KEY_F(11);
|
||||
break;
|
||||
case '4': /* Esc [ 2 4 ~ == F12 on
|
||||
* VT220/VT320/Linux console/
|
||||
* xterm/rxvt/Eterm. */
|
||||
case '4': /* Esc [ 2 4 ~ == F12 on VT220/VT320/
|
||||
* Linux console/xterm/rxvt/Eterm. */
|
||||
retval = KEY_F(12);
|
||||
break;
|
||||
case '5': /* Esc [ 2 5 ~ == F13 on
|
||||
* VT220/VT320/Linux console/
|
||||
* rxvt/Eterm. */
|
||||
case '5': /* Esc [ 2 5 ~ == F13 on VT220/VT320/
|
||||
* Linux console/rxvt/Eterm. */
|
||||
retval = KEY_F(13);
|
||||
break;
|
||||
case '6': /* Esc [ 2 6 ~ == F14 on
|
||||
* VT220/VT320/Linux console/
|
||||
* rxvt/Eterm. */
|
||||
case '6': /* Esc [ 2 6 ~ == F14 on VT220/VT320/
|
||||
* Linux console/rxvt/Eterm. */
|
||||
retval = KEY_F(14);
|
||||
break;
|
||||
case '8': /* Esc [ 2 8 ~ == F15 on
|
||||
* VT220/VT320/Linux console/
|
||||
* rxvt/Eterm. */
|
||||
case '8': /* Esc [ 2 8 ~ == F15 on VT220/VT320/
|
||||
* Linux console/rxvt/Eterm. */
|
||||
retval = KEY_F(15);
|
||||
break;
|
||||
case '9': /* Esc [ 2 9 ~ == F16 on
|
||||
* VT220/VT320/Linux console/
|
||||
* rxvt/Eterm. */
|
||||
case '9': /* Esc [ 2 9 ~ == F16 on VT220/VT320/
|
||||
* Linux console/rxvt/Eterm. */
|
||||
retval = KEY_F(16);
|
||||
break;
|
||||
default: /* Esc [ 2 ~ == Insert on
|
||||
* VT220/VT320/Linux console/
|
||||
* xterm/Terminal. */
|
||||
default: /* Esc [ 2 ~ == Insert on VT220/VT320/
|
||||
* Linux console/xterm/Terminal. */
|
||||
retval = sc_seq_or(do_insertfile_void, 0);
|
||||
break;
|
||||
}
|
||||
@@ -1112,24 +1080,20 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
* Terminal. */
|
||||
retval = KEY_B2;
|
||||
break;
|
||||
case 'F': /* Esc [ F == End on FreeBSD
|
||||
* console/Eterm. */
|
||||
case 'F': /* Esc [ F == End on FreeBSD console/Eterm. */
|
||||
retval = sc_seq_or(do_end, 0);
|
||||
break;
|
||||
case 'G': /* Esc [ G == PageDown on FreeBSD
|
||||
* console. */
|
||||
case 'G': /* Esc [ G == PageDown on FreeBSD console. */
|
||||
retval = sc_seq_or(do_page_down, 0);
|
||||
break;
|
||||
case 'H': /* Esc [ H == Home on ANSI/VT220/FreeBSD
|
||||
* console/Mach console/Eterm. */
|
||||
retval = sc_seq_or(do_home, 0);
|
||||
break;
|
||||
case 'I': /* Esc [ I == PageUp on FreeBSD
|
||||
* console. */
|
||||
case 'I': /* Esc [ I == PageUp on FreeBSD console. */
|
||||
retval = sc_seq_or(do_page_up, 0);
|
||||
break;
|
||||
case 'L': /* Esc [ L == Insert on ANSI/FreeBSD
|
||||
* console. */
|
||||
case 'L': /* Esc [ L == Insert on ANSI/FreeBSD console. */
|
||||
retval = sc_seq_or(do_insertfile_void, 0);
|
||||
break;
|
||||
case 'M': /* Esc [ M == F1 on FreeBSD console. */
|
||||
@@ -1141,20 +1105,16 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
case 'O':
|
||||
if (seq_len >= 3) {
|
||||
switch (seq[2]) {
|
||||
case 'P': /* Esc [ O P == F1 on
|
||||
* xterm. */
|
||||
case 'P': /* Esc [ O P == F1 on xterm. */
|
||||
retval = KEY_F(1);
|
||||
break;
|
||||
case 'Q': /* Esc [ O Q == F2 on
|
||||
* xterm. */
|
||||
case 'Q': /* Esc [ O Q == F2 on xterm. */
|
||||
retval = KEY_F(2);
|
||||
break;
|
||||
case 'R': /* Esc [ O R == F3 on
|
||||
* xterm. */
|
||||
case 'R': /* Esc [ O R == F3 on xterm. */
|
||||
retval = KEY_F(3);
|
||||
break;
|
||||
case 'S': /* Esc [ O S == F4 on
|
||||
* xterm. */
|
||||
case 'S': /* Esc [ O S == F4 on xterm. */
|
||||
retval = KEY_F(4);
|
||||
break;
|
||||
}
|
||||
@@ -1197,8 +1157,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
break;
|
||||
case 'a': /* Esc [ a == Shift-Up on rxvt/Eterm. */
|
||||
case 'b': /* Esc [ b == Shift-Down on rxvt/Eterm. */
|
||||
case 'c': /* Esc [ c == Shift-Right on rxvt/
|
||||
* Eterm. */
|
||||
case 'c': /* Esc [ c == Shift-Right on rxvt/Eterm. */
|
||||
case 'd': /* Esc [ d == Shift-Left on rxvt/Eterm. */
|
||||
retval = get_escape_seq_abcd(seq[1]);
|
||||
break;
|
||||
@@ -2004,9 +1963,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||
converted[index++] = ' ';
|
||||
start_col++;
|
||||
}
|
||||
/* If buf contains a control character, interpret it. If buf
|
||||
* contains an invalid multibyte control character, display it
|
||||
* as such. */
|
||||
/* If buf contains a control character, interpret it. */
|
||||
} else if (is_cntrl_mbchar(buf_mb)) {
|
||||
char *ctrl_buf_mb = charalloc(mb_cur_max());
|
||||
int ctrl_buf_mb_len, i;
|
||||
@@ -2036,13 +1993,17 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||
#endif
|
||||
converted[index++] = ' ';
|
||||
start_col++;
|
||||
/* If buf contains a non-control character, interpret it. If
|
||||
* buf contains an invalid multibyte non-control character,
|
||||
* display it as such. */
|
||||
/* If buf contains a non-control character, interpret it. If buf
|
||||
* contains an invalid multibyte sequence, display it as such. */
|
||||
} else {
|
||||
char *nctrl_buf_mb = charalloc(mb_cur_max());
|
||||
int nctrl_buf_mb_len, i;
|
||||
|
||||
/* Make sure an invalid sequence-starter byte is properly
|
||||
* terminated, so that it doesn't pick up lingering bytes
|
||||
* of any previous content. */
|
||||
null_at(&buf_mb, buf_mb_len);
|
||||
|
||||
nctrl_buf_mb = mbrep(buf_mb, nctrl_buf_mb,
|
||||
&nctrl_buf_mb_len);
|
||||
|
||||
@@ -2344,6 +2305,9 @@ void bottombars(int menu)
|
||||
subnfunc *f;
|
||||
const sc *s;
|
||||
|
||||
/* Set the global variable to the given menu. */
|
||||
currmenu = menu;
|
||||
|
||||
if (ISSET(NO_HELP))
|
||||
return;
|
||||
|
||||
@@ -2528,7 +2492,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
|
||||
int x_start;
|
||||
/* Starting column for mvwaddnstr. Zero-based. */
|
||||
int paintlen;
|
||||
int paintlen = 0;
|
||||
/* Number of chars to paint on this line. There are
|
||||
* COLS characters on a whole line. */
|
||||
size_t index;
|
||||
@@ -2636,6 +2600,12 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
start_line = start_line->prev;
|
||||
}
|
||||
|
||||
/* If the found start has been qualified as an end earlier,
|
||||
* believe it and skip to the next step. */
|
||||
if (start_line != NULL && start_line->multidata != NULL &&
|
||||
start_line->multidata[tmpcolor->id] == CBEGINBEFORE)
|
||||
goto step_two;
|
||||
|
||||
/* Skip over a zero-length regex match. */
|
||||
if (startmatch.rm_so == startmatch.rm_eo)
|
||||
startmatch.rm_eo++;
|
||||
@@ -2690,13 +2660,23 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
if (end_line != fileptr) {
|
||||
paintlen = -1;
|
||||
fileptr->multidata[tmpcolor->id] = CWHOLELINE;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " Marking for id %i line %i as CWHOLELINE\n", tmpcolor->id, line);
|
||||
#endif
|
||||
} else {
|
||||
paintlen = actual_x(converted,
|
||||
strnlenpt(fileptr->data,
|
||||
endmatch.rm_eo) - start);
|
||||
fileptr->multidata[tmpcolor->id] = CBEGINBEFORE;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " Marking for id %i line %i as CBEGINBEFORE\n", tmpcolor->id, line);
|
||||
#endif
|
||||
}
|
||||
mvwaddnstr(edit, line, 0, converted, paintlen);
|
||||
/* If the whole line has been painted, don't bother
|
||||
* looking for any more starts. */
|
||||
if (paintlen < 0)
|
||||
goto end_of_loop;
|
||||
step_two:
|
||||
/* Second step, we look for starts on this line. */
|
||||
start_col = 0;
|
||||
@@ -2741,9 +2721,12 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
|
||||
mvwaddnstr(edit, line, x_start,
|
||||
converted + index, paintlen);
|
||||
if (paintlen > 0)
|
||||
if (paintlen > 0) {
|
||||
fileptr->multidata[tmpcolor->id] = CSTARTENDHERE;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " Marking for id %i line %i as CSTARTENDHERE\n", tmpcolor->id, line);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* There is no end on this line. But we
|
||||
@@ -2764,6 +2747,9 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
/* We painted to the end of the line, so
|
||||
* don't bother checking any more
|
||||
* starts. */
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " Marking for id %i line %i as CENDAFTER\n", tmpcolor->id, line);
|
||||
#endif
|
||||
fileptr->multidata[tmpcolor->id] = CENDAFTER;
|
||||
break;
|
||||
}
|
||||
@@ -2944,23 +2930,10 @@ int update_line(filestruct *fileptr, size_t index)
|
||||
return extralinesused;
|
||||
}
|
||||
|
||||
/* Return TRUE if we need an update after moving horizontally, and FALSE
|
||||
* otherwise. We need one if the mark is on or if pww_save and
|
||||
* placewewant are on different pages. */
|
||||
bool need_horizontal_update(size_t pww_save)
|
||||
{
|
||||
return
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark_set ||
|
||||
#endif
|
||||
get_page_start(pww_save) !=
|
||||
get_page_start(openfile->placewewant);
|
||||
}
|
||||
|
||||
/* Return TRUE if we need an update after moving vertically, and FALSE
|
||||
* otherwise. We need one if the mark is on or if pww_save and
|
||||
* placewewant are on different pages. */
|
||||
bool need_vertical_update(size_t pww_save)
|
||||
/* Return TRUE if we need an update after moving the cursor, and
|
||||
* FALSE otherwise. We need an update if the mark is on, or if
|
||||
* pww_save and placewewant are on different pages. */
|
||||
bool need_screen_update(size_t pww_save)
|
||||
{
|
||||
return
|
||||
#ifndef NANO_TINY
|
||||
@@ -3007,15 +2980,12 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
{
|
||||
ssize_t i;
|
||||
filestruct *foo;
|
||||
bool do_redraw = FALSE;
|
||||
bool do_redraw = need_screen_update(0);
|
||||
|
||||
/* Don't bother scrolling less than one line. */
|
||||
if (nlines < 1)
|
||||
return;
|
||||
|
||||
if (need_vertical_update(0))
|
||||
do_redraw = TRUE;
|
||||
|
||||
/* Part 1: nlines is the number of lines we're going to scroll the
|
||||
* text of the edit window. */
|
||||
|
||||
@@ -3117,9 +3087,8 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
* updated. Use this if we've moved without changing any text. */
|
||||
void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
{
|
||||
bool do_redraw = need_vertical_update(0) ||
|
||||
need_vertical_update(pww_save);
|
||||
filestruct *foo = NULL;
|
||||
bool do_redraw = need_screen_update(0) || need_screen_update(pww_save);
|
||||
|
||||
/* If either old_current or current is offscreen, scroll the edit
|
||||
* window until it's onscreen and get out. */
|
||||
@@ -3160,10 +3129,8 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Put edittop in range of current, get the difference in lines
|
||||
* between the original edittop and the current edittop, and
|
||||
* then restore the original edittop. */
|
||||
edit_update(CENTER);
|
||||
/* Make sure the current line is on the screen. */
|
||||
edit_update((ISSET(SMOOTH_SCROLL) && !focusing) ? NONE : CENTER);
|
||||
|
||||
/* Update old_current if we're not on the same page as
|
||||
* before. */
|
||||
@@ -3229,9 +3196,8 @@ void edit_refresh(void)
|
||||
(long)openfile->current->lineno, (long)openfile->edittop->lineno, maxrows);
|
||||
#endif
|
||||
|
||||
/* Put the top line of the edit window in range of the current
|
||||
* line. */
|
||||
edit_update(CENTER);
|
||||
/* Make sure the current line is on the screen. */
|
||||
edit_update(ISSET(SMOOTH_SCROLL) ? NONE : CENTER);
|
||||
}
|
||||
|
||||
foo = openfile->edittop;
|
||||
@@ -3323,8 +3289,9 @@ void total_refresh(void)
|
||||
void display_main_list(void)
|
||||
{
|
||||
#ifndef DISABLE_COLOR
|
||||
if (openfile->syntax && openfile->syntax->linter)
|
||||
set_lint_shortcuts();
|
||||
if (openfile->syntax
|
||||
&& (openfile->syntax->formatter || openfile->syntax->linter))
|
||||
set_lint_or_format_shortcuts();
|
||||
else
|
||||
set_spell_shortcuts();
|
||||
#endif
|
||||
@@ -3435,8 +3402,8 @@ void do_replace_highlight(bool highlight, const char *word)
|
||||
}
|
||||
|
||||
#ifndef DISABLE_EXTRA
|
||||
#define CREDIT_LEN 57
|
||||
#define XLCREDIT_LEN 8
|
||||
#define CREDIT_LEN 54
|
||||
#define XLCREDIT_LEN 9
|
||||
|
||||
/* Easter egg: Display credits. Assume nodelay(edit) and scrollok(edit)
|
||||
* are FALSE. */
|
||||
@@ -3458,15 +3425,11 @@ void do_credits(void)
|
||||
"Rocco Corsi",
|
||||
"David Lawrence Ramsey",
|
||||
"David Benbennick",
|
||||
"Mark Majeres",
|
||||
"Mike Frysinger",
|
||||
"Benno Schulenberg",
|
||||
"Ken Tyler",
|
||||
"Sven Guckes",
|
||||
NULL, /* credits[16], handled below. */
|
||||
"Pauli Virtanen",
|
||||
"Daniele Medri",
|
||||
"Clement Laforet",
|
||||
"Tedi Heriyanto",
|
||||
"Bill Soudan",
|
||||
"Christian Weisgerber",
|
||||
"Erik Andersen",
|
||||
@@ -3485,6 +3448,7 @@ void do_credits(void)
|
||||
"Richard Kolb II",
|
||||
NULL, /* "The Free Software Foundation" */
|
||||
"Linus Torvalds",
|
||||
NULL, /* "the many translators and the TP" */
|
||||
NULL, /* "For ncurses:" */
|
||||
"Thomas Dickey",
|
||||
"Pavel Curtis",
|
||||
@@ -3496,7 +3460,7 @@ void do_credits(void)
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"(C) 1999 - 2014",
|
||||
"(C) 1999 - 2015",
|
||||
"Free Software Foundation, Inc.",
|
||||
"",
|
||||
"",
|
||||
@@ -3511,20 +3475,12 @@ void do_credits(void)
|
||||
N_("Brought to you by:"),
|
||||
N_("Special thanks to:"),
|
||||
N_("The Free Software Foundation"),
|
||||
N_("the many translators and the TP"),
|
||||
N_("For ncurses:"),
|
||||
N_("and anyone else we forgot..."),
|
||||
N_("Thank you for using nano!")
|
||||
};
|
||||
|
||||
/* credits[16]: Make sure this name is displayed properly, since we
|
||||
* can't dynamically assign it above, using Unicode 00F6 (Latin
|
||||
* Small Letter O with Diaresis) if applicable. */
|
||||
credits[16] =
|
||||
#ifdef ENABLE_UTF8
|
||||
using_utf8() ? "Florian K\xC3\xB6nig" :
|
||||
#endif
|
||||
"Florian K\xF6nig";
|
||||
|
||||
if (!old_more_space || !old_no_help) {
|
||||
SET(MORE_SPACE);
|
||||
SET(NO_HELP);
|
||||
|
||||
Reference in New Issue
Block a user