Compare commits
441 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2cd986cdef | ||
|
|
5e4d81c99e | ||
|
|
628c4e2928 | ||
|
|
e57bd4993e | ||
|
|
bf38aad0be | ||
|
|
7859d5254c | ||
|
|
5aaaad4a63 | ||
|
|
abaa9a81f7 | ||
|
|
b0e04c0de3 | ||
|
|
6d6a36c647 | ||
|
|
034b994eb5 | ||
|
|
8befda6490 | ||
|
|
24777c0740 | ||
|
|
a685468a18 | ||
|
|
26ebd35d54 | ||
|
|
13b6115894 | ||
|
|
783062a0cc | ||
|
|
c7c04bb665 | ||
|
|
3239ff22c8 | ||
|
|
e6fb106cf0 | ||
|
|
ad1b64cdfa | ||
|
|
79383beef3 | ||
|
|
9a065c089f | ||
|
|
1932dfb131 | ||
|
|
eae8571ae4 | ||
|
|
2e2112cad1 | ||
|
|
5da68ee193 | ||
|
|
da1f55cec7 | ||
|
|
43eee6ed44 | ||
|
|
ace033d834 | ||
|
|
5453b0accf | ||
|
|
315eb3280a | ||
|
|
b4e5c02474 | ||
|
|
4db1b099dd | ||
|
|
b919f37c85 | ||
|
|
219a814de2 | ||
|
|
615f4c71c0 | ||
|
|
b9b2fd52ff | ||
|
|
708de360dc | ||
|
|
853a44d3f0 | ||
|
|
d1ab408965 | ||
|
|
fa35aef359 | ||
|
|
7949e6ae09 | ||
|
|
4ffdb1bbec | ||
|
|
7a07cdb51e | ||
|
|
ccd1b7b50a | ||
|
|
d15c92d41a | ||
|
|
8dec783333 | ||
|
|
87397ba37b | ||
|
|
391cef12c9 | ||
|
|
ad074011c9 | ||
|
|
c009ec56f5 | ||
|
|
5ab56eaa8d | ||
|
|
45d344b72c | ||
|
|
29fb951fcd | ||
|
|
4580f1502c | ||
|
|
cf9c34acef | ||
|
|
bd0b3cd39b | ||
|
|
eba0711939 | ||
|
|
c499382fec | ||
|
|
ebe4b3b52e | ||
|
|
cfffbf71ce | ||
|
|
9d3a468ad8 | ||
|
|
c5c5230b9d | ||
|
|
6c860c07c8 | ||
|
|
1c3b211142 | ||
|
|
b299a6a0d9 | ||
|
|
bc8b7d74eb | ||
|
|
9c92634388 | ||
|
|
979286c65e | ||
|
|
ebe3425f9f | ||
|
|
023db6aa77 | ||
|
|
41dd9122fe | ||
|
|
a1064d4279 | ||
|
|
3f7c8c5158 | ||
|
|
bbac1bb047 | ||
|
|
aa20fcf7b0 | ||
|
|
eb5e08fb98 | ||
|
|
6533e235e8 | ||
|
|
de39a2b05b | ||
|
|
fb0c3f85de | ||
|
|
a24da6944c | ||
|
|
b3c846cd98 | ||
|
|
1520350e20 | ||
|
|
da0691b4ad | ||
|
|
d82dae0925 | ||
|
|
bdff665b5d | ||
|
|
1be131a9f9 | ||
|
|
8b203d6f22 | ||
|
|
53f641f909 | ||
|
|
57f1bbd991 | ||
|
|
cd8f73521e | ||
|
|
52161ee3a1 | ||
|
|
874ec8f259 | ||
|
|
985d586c3a | ||
|
|
ae9eea7634 | ||
|
|
e74851451d | ||
|
|
ad7cf31cbf | ||
|
|
75689f3901 | ||
|
|
82b5debb1b | ||
|
|
b2d1c5f5b2 | ||
|
|
036a9d5341 | ||
|
|
b885c9c5e9 | ||
|
|
e99223dd25 | ||
|
|
6195f7c34c | ||
|
|
653a5a3a45 | ||
|
|
e8d505ba02 | ||
|
|
5d6f127948 | ||
|
|
f0575cfa10 | ||
|
|
af5a9997fd | ||
|
|
c82bc8ba84 | ||
|
|
1836a0fb7a | ||
|
|
12090dd320 | ||
|
|
2101403824 | ||
|
|
5455b6af46 | ||
|
|
9bedc4b71c | ||
|
|
47b693e582 | ||
|
|
2c5d0ecbb3 | ||
|
|
5c33e88b25 | ||
|
|
8bd960bbc9 | ||
|
|
0083bd29d2 | ||
|
|
ce51bb2509 | ||
|
|
c1a28fa9ae | ||
|
|
31d7b3667c | ||
|
|
32bd29e3cc | ||
|
|
970a809357 | ||
|
|
53bd1ddad7 | ||
|
|
212ab782df | ||
|
|
1903713225 | ||
|
|
a016d1939d | ||
|
|
b387137af7 | ||
|
|
0f6236f556 | ||
|
|
c9820ac098 | ||
|
|
0ed7171138 | ||
|
|
4ed8134699 | ||
|
|
d84cfb03df | ||
|
|
126cc1c8dd | ||
|
|
9c984e8e63 | ||
|
|
1e0e235cbb | ||
|
|
8779a17ffe | ||
|
|
f400c23279 | ||
|
|
eb02e3df4c | ||
|
|
c0181c95ee | ||
|
|
f1a717291b | ||
|
|
4a8c9b6124 | ||
|
|
069674c2d5 | ||
|
|
ea9d03f135 | ||
|
|
e19449ec50 | ||
|
|
af3314c376 | ||
|
|
b3c6b40550 | ||
|
|
37ddfa9dbd | ||
|
|
64844b6959 | ||
|
|
43fff01ede | ||
|
|
46f5665da2 | ||
|
|
c0e54d16cb | ||
|
|
a0168ca896 | ||
|
|
c3b3b9a28f | ||
|
|
6619c43b88 | ||
|
|
4eeff48c5f | ||
|
|
b7dc8f3a12 | ||
|
|
72ad7dc602 | ||
|
|
6a0ea821e9 | ||
|
|
a50e36c6b2 | ||
|
|
306049666a | ||
|
|
cf0efaab5d | ||
|
|
29bf57ff67 | ||
|
|
2ffdea4fc1 | ||
|
|
38ebba11b7 | ||
|
|
626bcd7cc2 | ||
|
|
ee11c6a62f | ||
|
|
00cc565ddd | ||
|
|
305c6459e9 | ||
|
|
d420b5a50c | ||
|
|
c359301955 | ||
|
|
7e2d673b5f | ||
|
|
c85e4f43b5 | ||
|
|
56a8aad848 | ||
|
|
bdc038db14 | ||
|
|
744e97911c | ||
|
|
143b8c7b13 | ||
|
|
2b9d6a0e6c | ||
|
|
d24d0a43e8 | ||
|
|
81c4e187f5 | ||
|
|
67d1951e4d | ||
|
|
3e477263da | ||
|
|
26f61a4503 | ||
|
|
f726053325 | ||
|
|
a0aff67a4d | ||
|
|
377098e617 | ||
|
|
20186f8849 | ||
|
|
07a47017d7 | ||
|
|
52320f344d | ||
|
|
b5776ac698 | ||
|
|
2c8cf48372 | ||
|
|
874703be5f | ||
|
|
3d12f0f53d | ||
|
|
b2bf101d0c | ||
|
|
2de84c1c8d | ||
|
|
ae5d2dffff | ||
|
|
5a9d4935eb | ||
|
|
92dd91cd0b | ||
|
|
dad746e6dd | ||
|
|
45e3452b3e | ||
|
|
4005fc6257 | ||
|
|
90b07fc2fd | ||
|
|
7b71f573e7 | ||
|
|
4071de1989 | ||
|
|
6f5de42702 | ||
|
|
7de4dc8d08 | ||
|
|
0ed9c5fb37 | ||
|
|
37dd775f98 | ||
|
|
86b6c3e5db | ||
|
|
62a2528ab8 | ||
|
|
e283b0d638 | ||
|
|
d04499202c | ||
|
|
ec729750b0 | ||
|
|
8f36d09d18 | ||
|
|
ae4c3a6206 | ||
|
|
95ef337b1a | ||
|
|
9c4488bf0c | ||
|
|
5ab12ca761 | ||
|
|
ca37ee67d9 | ||
|
|
bdc1b9b568 | ||
|
|
cd9a5f0377 | ||
|
|
c4b854d5c7 | ||
|
|
a03d9c0ecd | ||
|
|
23bdb27155 | ||
|
|
3c4dc46fdc | ||
|
|
1c3bfa9f2b | ||
|
|
feb89db8a0 | ||
|
|
239b415786 | ||
|
|
7f26c7384d | ||
|
|
1c367b6949 | ||
|
|
f56229948d | ||
|
|
093d500e15 | ||
|
|
93bef536f7 | ||
|
|
e4e6173389 | ||
|
|
be614ec3b4 | ||
|
|
e014fbda80 | ||
|
|
7fc0ada6cc | ||
|
|
20d3cb0614 | ||
|
|
47daf0279d | ||
|
|
79d9795c80 | ||
|
|
738893f9c7 | ||
|
|
c83512ac6a | ||
|
|
111f37a853 | ||
|
|
c6836ec6d5 | ||
|
|
a8db26010b | ||
|
|
8bcf43b137 | ||
|
|
6834650570 | ||
|
|
8ad58bcde3 | ||
|
|
a9b862c804 | ||
|
|
21bec6c96d | ||
|
|
11219babbf | ||
|
|
c71e031d8a | ||
|
|
84fdb90e52 | ||
|
|
31de105eec | ||
|
|
85ea1de1c7 | ||
|
|
4fde119362 | ||
|
|
4cf2246f04 | ||
|
|
9fece9deb0 | ||
|
|
d7f0fe9243 | ||
|
|
4f03daff91 | ||
|
|
6a3ac36420 | ||
|
|
4adb37ed1d | ||
|
|
057edf7384 | ||
|
|
abd8993660 | ||
|
|
8c7a562394 | ||
|
|
8b006c2912 | ||
|
|
815fb0a2a2 | ||
|
|
6ff695c154 | ||
|
|
71dd8c1ca6 | ||
|
|
8c55d21bd6 | ||
|
|
b7bf27a509 | ||
|
|
c25ed534eb | ||
|
|
258497fb5c | ||
|
|
107e816324 | ||
|
|
6a83647a11 | ||
|
|
56e36ef7b5 | ||
|
|
bf0e47dc37 | ||
|
|
5d552195ea | ||
|
|
e796a7b5b9 | ||
|
|
492e501fb3 | ||
|
|
7aec89e9c9 | ||
|
|
d152ad378b | ||
|
|
5a584ccda3 | ||
|
|
179b1bad87 | ||
|
|
eab0fd808c | ||
|
|
04f65f2e17 | ||
|
|
db57ad757f | ||
|
|
5745c0a11f | ||
|
|
15d6857b27 | ||
|
|
4ab80154e9 | ||
|
|
c879f55691 | ||
|
|
6135bf3f6b | ||
|
|
ab73dd4816 | ||
|
|
5295cfe72c | ||
|
|
2385c1aa9b | ||
|
|
282a940745 | ||
|
|
3f4520b348 | ||
|
|
d4e3c59f27 | ||
|
|
d6c24c4133 | ||
|
|
6d8e495c37 | ||
|
|
75a29b749e | ||
|
|
96452cb60c | ||
|
|
d4defccded | ||
|
|
f9782e0437 | ||
|
|
3fe08acd27 | ||
|
|
6969c995d1 | ||
|
|
b18482e1b0 | ||
|
|
4401862e12 | ||
|
|
3f12ada4ef | ||
|
|
520a90c8d9 | ||
|
|
94d7cb6826 | ||
|
|
56d083779f | ||
|
|
c35e351dd0 | ||
|
|
22ae034f2d | ||
|
|
3d5e94560d | ||
|
|
78a81b29b1 | ||
|
|
07d5df4aeb | ||
|
|
8e94234b00 | ||
|
|
72936854c4 | ||
|
|
7ea09e540f | ||
|
|
cc8185fe2b | ||
|
|
150d889965 | ||
|
|
4e5e1ae1a3 | ||
|
|
691698a954 | ||
|
|
2a73131f0e | ||
|
|
ce78cdb722 | ||
|
|
acefd9e9b5 | ||
|
|
945a91357a | ||
|
|
27865304d7 | ||
|
|
c00513b65e | ||
|
|
c009759c23 | ||
|
|
47bb888ad2 | ||
|
|
44ca4f898c | ||
|
|
61f567378a | ||
|
|
66444c37b3 | ||
|
|
d1dc23bd78 | ||
|
|
7f343a6dc4 | ||
|
|
3a9a32996b | ||
|
|
c4037f3055 | ||
|
|
e99494f21a | ||
|
|
ca62f9fa2b | ||
|
|
38f70a5edd | ||
|
|
7866cd3ef7 | ||
|
|
03777799d4 | ||
|
|
e4b0742e9e | ||
|
|
239c3d47dd | ||
|
|
96e6d56571 | ||
|
|
826fbea8e1 | ||
|
|
e3bae98aab | ||
|
|
91d468d7fd | ||
|
|
7dc531a801 | ||
|
|
0dd50d6f62 | ||
|
|
0e581b3524 | ||
|
|
24b1563068 | ||
|
|
a0aa4df041 | ||
|
|
091068982d | ||
|
|
f7bcbeb87e | ||
|
|
de0c5eb899 | ||
|
|
dbeb503316 | ||
|
|
4c221675a8 | ||
|
|
50a33dbbb7 | ||
|
|
7eb30a8353 | ||
|
|
a7f488b51f | ||
|
|
c104ef15a6 | ||
|
|
5e146e815f | ||
|
|
157ce9120b | ||
|
|
4d46437f87 | ||
|
|
5b44f373fd | ||
|
|
8f4762a842 | ||
|
|
8f1afee813 | ||
|
|
b00f7e3c6f | ||
|
|
e5806be519 | ||
|
|
6a74c9224c | ||
|
|
cb8d845ad7 | ||
|
|
538dc352c5 | ||
|
|
a74f2f8618 | ||
|
|
8f948fa1eb | ||
|
|
26ee759503 | ||
|
|
0532296a10 | ||
|
|
443a766fe2 | ||
|
|
fa82853aea | ||
|
|
47a153f538 | ||
|
|
b802a13c5a | ||
|
|
1458891b9f | ||
|
|
d2361f0761 | ||
|
|
43cf7a1be3 | ||
|
|
f00c9612b3 | ||
|
|
a8da623410 | ||
|
|
db95802a18 | ||
|
|
0c4ca3509f | ||
|
|
e5c7e928c9 | ||
|
|
222b201afe | ||
|
|
5128de8308 | ||
|
|
16349c992a | ||
|
|
112620432a | ||
|
|
90f772b250 | ||
|
|
caa86591f4 | ||
|
|
d4dab46ebc | ||
|
|
b386a905e6 | ||
|
|
b1ce64a375 | ||
|
|
2d705caec7 | ||
|
|
1d696c0047 | ||
|
|
a0ebc813f1 | ||
|
|
56001845cd | ||
|
|
be5cdb2748 | ||
|
|
76c25f582a | ||
|
|
dbcaa3b1fb | ||
|
|
6ad59cd29b | ||
|
|
64661ac140 | ||
|
|
9d8396d340 | ||
|
|
f8cb832b50 | ||
|
|
503f278547 | ||
|
|
90573296ea | ||
|
|
826ab5a4fe | ||
|
|
d41b468975 | ||
|
|
3e0f523d59 | ||
|
|
de03989e86 | ||
|
|
757f739367 | ||
|
|
1228699f2c | ||
|
|
d72bdf17f4 | ||
|
|
9c1fef04a2 | ||
|
|
c275f068ab | ||
|
|
62d616b62b | ||
|
|
9838a5182e | ||
|
|
ec01074075 | ||
|
|
504ae90a8e | ||
|
|
405ed0f822 | ||
|
|
da50e73c40 | ||
|
|
e927ce59d1 | ||
|
|
892396bb7d | ||
|
|
658f7e6630 | ||
|
|
32263ede86 | ||
|
|
0c3d3c9fed | ||
|
|
612b41615b | ||
|
|
e3df8788b7 | ||
|
|
a549a82c32 | ||
|
|
9c3249c893 | ||
|
|
d5092294cd |
8
AUTHORS
8
AUTHORS
@@ -6,7 +6,7 @@ nano editor. Please see the ChangeLog for specific changes by author.
|
||||
Chris Allegretta <chrisa@asty.org>
|
||||
* Original program author, stable series maintainer.
|
||||
|
||||
David Lawrence Ramsey <pooka_regent@sluggy.net>
|
||||
David Lawrence Ramsey <pooka109@cox.net>
|
||||
* Development series maintainer. Multiple buffer support,
|
||||
operating dir (-o) option, bug fixes for display routines,
|
||||
wrapping code, spelling fixes, const mode, parts of the UTF-8
|
||||
@@ -35,3 +35,9 @@ David Benbennick <dbenbenn@math.cornell.edu>
|
||||
* Wrap and justify bugfixes/enhancements, new color syntax
|
||||
code, memleak fixes, parts of the UTF-8 support, and other
|
||||
miscellaneous fixes.
|
||||
|
||||
Mike Frysinger <vapier@gentoo.org>
|
||||
* Gentoo package maintainer. Whitespace display mode,
|
||||
--enable-utf8/--disable-utf8 configure options for ncurses,
|
||||
many new color regexes and improvements to existing color
|
||||
regexes for nanorc.sample, and miscellaneous bug fixes.
|
||||
|
||||
818
ChangeLog
818
ChangeLog
@@ -1,3 +1,753 @@
|
||||
GNU nano 1.3.10 - 2005.12.23
|
||||
- General:
|
||||
- Miscellaneous comment fixes. (DLR)
|
||||
- More int -> bool conversions. (DLR)
|
||||
- Add the ability to scroll up or down single lines without
|
||||
scrolling the cursor, via Meta-- and Meta-+. Note that this
|
||||
is disabled when NANO_SMALL is defined. New functions
|
||||
do_scroll_up() and do_scroll_down(); changes to
|
||||
shortcut_init(). (DLR, suggested by Mike Frysinger)
|
||||
- Properly handle mouse clicks on the statusbar prompt text.
|
||||
New functions statusbar_xplustabs() and
|
||||
get_statusbar_page_start(); changes to do_statusbar_mouse(),
|
||||
nanoget_repaint(), nanogetstr(), and statusq(). (DLR)
|
||||
- Since the statusbar prompt code needs at least 4 columns in
|
||||
order to work properly, make that the minimum number of
|
||||
columns that nano requires in order to run, and remove
|
||||
assertions and code that make use of a smaller number of
|
||||
columns. Changes to window_init(), nanoget_repaint(),
|
||||
titlebar(), statusbar(), and get_page_start(). (DLR)
|
||||
- Move get_page_start(), xplustabs(), actual_x(), strnlenpt(),
|
||||
strlenpt(), check_linenumbers(), dump_buffer(), and
|
||||
dump_buffer_reverse() from winio.c to utils.c, as they're
|
||||
really utility functions. (DLR)
|
||||
- Add missing stdio.h #include to text.c and winio.c, and remove
|
||||
unneeded sys/wait.h #include from files.c. (DLR)
|
||||
- Move functions specific to the statusbar prompt to their own
|
||||
source file, adjust related variables accordingly, and rename
|
||||
variable resetstatuspos reset_statusbar_x. New file prompt.c;
|
||||
changes to do_statusbar_input(), do_statusbar_mouse(),
|
||||
do_statusbar_output(), do_statusbar_home(),
|
||||
do_statusbar_end(), do_statusbar_right(), do_statusbar_left(),
|
||||
do_statusbar_backspace(), do_statusbar_delete(),
|
||||
do_statusbar_cut_text(), do_statusbar_next_word(),
|
||||
do_statusbar_prev_word(), do_statusbar_verbatim_input(),
|
||||
statusbar_xplustabs(), get_statusbar_page_start(),
|
||||
nanoget_repaint(), nanogetstr(), statusq(), statusq_abort(),
|
||||
and do_yesno() (all moved to prompt.c). (DLR)
|
||||
- Move functions specific to the help browser to their own
|
||||
source file, and adjust related variables accordingly. New
|
||||
file help.c; changes to help_init(), help_line_len(), and
|
||||
do_help() (all moved to help.c). (DLR)
|
||||
- Tweak a few functions to remove the assumption that the file
|
||||
always ends in a magicline. Changes to cut_line(),
|
||||
do_cut_till_end(), open_buffer(), read_file(), write_file(),
|
||||
do_last_line(), do_para_end(), do_wrap(), backup_lines(),
|
||||
find_paragraph(), do_justify(), do_alt_speller(), and
|
||||
do_wordlinechar_count(). (DLR)
|
||||
- Tweak a few functions to rely on fileage and filebot instead
|
||||
of NULL for their checks to detect the top or bottom of the
|
||||
file. Changes to cut_line(), cut_to_eol(), do_page_up(),
|
||||
do_page_down(), do_para_end(), do_next_word(), do_prev_word(),
|
||||
do_up(), do_down(), do_scroll_down(), do_right(), do_mouse(),
|
||||
do_gotolinecolumn(), do_delete(), begpar(), find_paragraph(),
|
||||
do_wrap(), remove_magicline(), and edit_scroll(). (DLR)
|
||||
- Add new -L/--nonewlines command line option, and new
|
||||
"nonewlines" rcfile option, to control whether nano adds
|
||||
magiclines to the ends of files. Changes to read_file(),
|
||||
write_marked_file(), move_to_filestruct(),
|
||||
copy_from_filestruct(), usage(), do_output(), main(),
|
||||
do_replace_loop(), do_delete(), do_int_spell_fix(),
|
||||
do_alt_speller(), nano.1, nanorc.5, nano.texi, and
|
||||
nanorc.sample. (DLR, suggested by Jaime
|
||||
<re2823@Safe-mail.net>)
|
||||
- Move functions specific to the file browser to their own
|
||||
source file, and adjust related variables accordingly. New
|
||||
file browser.c; changes to striponedir(), browser_init(),
|
||||
do_browser(), and do_browse_from() (all moved to browser.c).
|
||||
(DLR)
|
||||
- Add the statusbar prompt's equivalent of placewewant,
|
||||
statusbar_pww, to prompt.c, and convert its functions to use
|
||||
it. New functions reset_statusbar_cursor() and
|
||||
need_statusbar_horizontal_update(); changes to
|
||||
do_statusbar_mouse(), do_statusbar_output(),
|
||||
do_statusbar_home(), do_statusbar_end(), do_statusbar_right(),
|
||||
do_statusbar_left(), do_statusbar_delete(),
|
||||
do_statusbar_cut_text(), do_statusbar_next_word(),
|
||||
do_statusbar_prev_word(), do_statusbar_verbatim_input(),
|
||||
nanoget_repaint() (renamed update_statusbar_line()),
|
||||
nanogetstr() (renamed get_prompt_string()), statusq() (renamed
|
||||
do_prompt()), statusq_abort() (renamed do_prompt_abort()), and
|
||||
do_yesno() (renamed do_yesno_prompt()). (DLR)
|
||||
- Initialize the static pid_t pid in text.c to -1. (DLR)
|
||||
- Fix copyright years on source files. All functions in
|
||||
browser.c were originally added in 2001; the oldest function
|
||||
in color.c is do_colorinit() (now color_init()), which was
|
||||
originally added in 2001; the oldest function in chars.c is
|
||||
revstrstr(), which was originally added in 2001; the oldest
|
||||
function in help.c is do_help(), which was originally added in
|
||||
2000; the oldest function in prompt.c is statusq() (now
|
||||
do_prompt()), which was originally added before 0.6.6, which
|
||||
was apparently in 1999; all functions in rcfile.c were
|
||||
originally added in 2001; one of the oldest functions in
|
||||
search.c is do_search(), which was originally added in 0.2.7,
|
||||
which was apparently in 1999; and one of the oldest functions
|
||||
in text.c is do_wrap(), which was originally added in 0.3.1,
|
||||
which was apparently in 1999. (DLR)
|
||||
- For functions originally adapted from other sources, add
|
||||
notices from the original files, as we do with the tab
|
||||
completion functions adapted from busybox, updating the Free
|
||||
Software Foundation's address as needed. Also, invoke LGPL
|
||||
clause 3 to convert the LGPLed ngetdelim() and ngetline()
|
||||
functions to use the GPL instead. This is done so that we
|
||||
don't have to include a copy of the LGPL, and because the
|
||||
changes made to integrate these functions with nano make them
|
||||
dependent on nano's GPLed functions and hence useless
|
||||
elsewhere. (DLR)
|
||||
- Don't install the localized versions of the manpages if
|
||||
nano is built with --disable-nls. Changes to Makefile.am and
|
||||
doc/man/Makefile.am. (Mike Frysinger)
|
||||
- Rename the NANO_SMALL #define to NANO_TINY. (DLR)
|
||||
- Overhaul the bracket searching code so that it no longer
|
||||
requires regex support to work. New functions revstrpbrk()
|
||||
and find_bracket_match(); changes to shortcut_init() and
|
||||
do_find_bracket(). (DLR)
|
||||
- Add the ability to do bracket searches at the statusbar
|
||||
prompt. New functions find_statusbar_bracket_match() and
|
||||
do_statusbar_find_bracket(); changes to do_statusbar_input().
|
||||
(DLR)
|
||||
- Beep whenever we can't read a file or directory and have to
|
||||
indicate it on the statusbar, as Pico does. Changes to
|
||||
do_browser(), open_file(), and write_file(). (DLR)
|
||||
- Adjust copyright notices in all source files to account for
|
||||
Chris' reassigning the 2005-2006 copyright on nano to me.
|
||||
Changes to do_credits(). (DLR)
|
||||
- Readd RETSIGTYPE return types for signal handlers, since any
|
||||
problems with its being defined as the wrong type aren't
|
||||
nano's fault. Changes to handle_hupterm(), do_suspend(),
|
||||
do_continue(), handle_sigwinch(), and cancel_command(). (DLR)
|
||||
- Since proto.h includes nano.h, and nano.h includes config.h
|
||||
first, include proto.h first and remove redundant includes of
|
||||
config.h in all non-header source files. (DLR)
|
||||
- Refer to the Enter key instead of the Return key for
|
||||
consistency. Changes to load_history() and rcfile_error().
|
||||
(DLR)
|
||||
- browser.c:
|
||||
do_browser()
|
||||
- When setting the width of each file, use the "?" operator
|
||||
instead of an if/else clause. (DLR)
|
||||
- chars.c:
|
||||
mbwidth()
|
||||
- If wcwidth() returns -1 for the character passed in, treat the
|
||||
character as having the width of Unicode U+FFFD (Replacement
|
||||
Character) instead of having a width of zero, since display
|
||||
problems can crop up with the latter approach. (DLR)
|
||||
mbstrchr()
|
||||
- Detect the case where the character isn't found in the string
|
||||
more accurately. (DLR)
|
||||
- cut.c:
|
||||
cut_line()
|
||||
- Since placewewant will always be zero after the line is cut,
|
||||
set it to zero directly instead of assigning it the value of
|
||||
xplustabs(). (DLR)
|
||||
- files.c:
|
||||
read_file()
|
||||
- Remove apparently unneeded logic to handle a case where
|
||||
current is NULL, since it shouldn't be NULL there. (DLR)
|
||||
get_next_filename()
|
||||
- Store the value of digits(ULONG_MAX) in a static, since it
|
||||
doesn't change and hence doesn't need to be recalculated.
|
||||
(DLR)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Change the description of the Meta-] shortcut to "Find
|
||||
matching bracket", as it's clearer. (DLR)
|
||||
- nano.c:
|
||||
version()
|
||||
- If DISABLE_WRAPPING is defined, the code in DISABLE_ROOTWRAP
|
||||
#ifdefs isn't included, so don't display
|
||||
"--disable-wrapping-as-root" in that case. (DLR)
|
||||
do_cont()
|
||||
- Rename to do_continue(), and rename parameter s to signal, for
|
||||
consistency. (DLR)
|
||||
do_verbatim_input()
|
||||
- Move to text.c, since it's an advanced text-based operation.
|
||||
(DLR)
|
||||
- nano.h:
|
||||
- Readd MIN_EDITOR_COLS #define, set to 4. (DLR)
|
||||
- proto.h:
|
||||
- Remove now-unused externs for currslen, shortcut_list,
|
||||
fileinfo, syntaxfile_regexp, and synfilematches. (DLR)
|
||||
- prompt.c:
|
||||
do_statusbar_input()
|
||||
- Fix misplaced break when handling NANO_VERBATIM_KEY. (DLR)
|
||||
reset_statusbar_cursor()
|
||||
- Fix cursor placement problem by modeling the code more closely
|
||||
after reset_cursor(). (DLR)
|
||||
get_prompt_string()
|
||||
- Adjust #ifdefs to leave out disabled keys entirely instead of
|
||||
keeping enough code to just ignore them. (DLR)
|
||||
- rcfile.c:
|
||||
do_rcfile()
|
||||
- Remove unneeded assert. (DLR)
|
||||
- search.c:
|
||||
search_abort()
|
||||
- Rename to search_replace_abort(). (DLR)
|
||||
findnextstr()
|
||||
- Remove parameter can_display_wrap, as it's always set to TRUE
|
||||
now, and rename parameter wholeword to whole_word, for
|
||||
consistency. (DLR)
|
||||
- Only include the whole_word parameter when DISABLE_SPELLER
|
||||
isn't defined, as it's only used then. (DLR)
|
||||
replace_abort()
|
||||
- Replace with search_replace_abort(), since it does the same
|
||||
things that this function does. (DLR)
|
||||
do_replace_loop()
|
||||
- Change order of parameters to more closely match those of
|
||||
findnextstr(), and rename parameter wholewords to whole_word,
|
||||
for consistency. (DLR)
|
||||
- Only include the whole_word parameter when DISABLE_SPELLER
|
||||
isn't defined, as it's only used then. (DLR)
|
||||
- text.c:
|
||||
execute_command()
|
||||
- Instead of hardcoding /bin/sh as the shell to use when
|
||||
executing a command, use $SHELL, and only fall back to /bin/sh
|
||||
if $SHELL isn't set. (DLR)
|
||||
do_wrap()
|
||||
- Rename variable wrapping to prepending, to avoid confusion,
|
||||
and rename the static bool same_line_wrap to prepend_wrap to
|
||||
match. (DLR)
|
||||
- Properly add a new magicline when needed if, in the process of
|
||||
wrapping, we prepend text to the last line of the file. (DLR)
|
||||
break_line()
|
||||
- Only include the newline parameter if DISABLE_HELP isn't
|
||||
defined, as it's only used then. (DLR)
|
||||
- In the surrounding #ifdef, replace the combination of
|
||||
!DISABLE_JUSTIFY and !DISABLE_WRAPPING with
|
||||
!DISABLE_WRAPJUSTIFY, for consistency. (DLR)
|
||||
begpar()
|
||||
- Return FALSE if foo is NULL, as inpar() does. (DLR)
|
||||
backup_lines()
|
||||
- Return void instead of a pointer to the copy of the first
|
||||
line, since current will point to the same location after the
|
||||
text is copied and so can be used instead of the old return
|
||||
value. (DLR)
|
||||
- Remove unused quote_len parameter. (DLR)
|
||||
do_justify()
|
||||
- Don't save current_y and restore it if the user unjustifies,
|
||||
as the reset_cursor() called by edit_refresh() after restoring
|
||||
edittop and current will ensure that current_y is restored to
|
||||
its original value. (DLR)
|
||||
- Renumber after justifying each individual paragraph, since
|
||||
find_paragraph() needs the line numbers to be right as well as
|
||||
edit_refresh(). This fixes a potential segfault when doing
|
||||
full justify with auto-indent turned on. (DLR)
|
||||
do_alt_speller()
|
||||
- Move the code that replaces the text of the current file with
|
||||
the text of the spell-checked file into its own function,
|
||||
replace_buffer(). (DLR)
|
||||
- utils.c:
|
||||
parse_line_column()
|
||||
- Simplify parsing of the column number. (DLR)
|
||||
ngetdelim()
|
||||
- Do sanity checks in an assert instead of checking them
|
||||
manually and returning -1 if they fail. (DLR)
|
||||
is_whole_word()
|
||||
- Only include when DISABLE_SPELLER isn't defined, as it's only
|
||||
used then. (DLR)
|
||||
get_page_start()
|
||||
- Fix test so that we scroll through the line in 8-character
|
||||
chunks when COLS is greater than 8, not when COLS is greater
|
||||
than 9. (DLR)
|
||||
remove_magicline()
|
||||
- Add assert. (DLR)
|
||||
- winio.c:
|
||||
nanoget_repaint()
|
||||
- Rename parameter inputbuf to buf, for consistency. (DLR)
|
||||
reset_cursor()
|
||||
- Rename variable x to xpt, to avoid confusion. (DLR)
|
||||
update_line()
|
||||
- Remove now-unneeded logic that set the index parameter to zero
|
||||
if the fileptr parameter didn't point to current. (DLR)
|
||||
edit_add()
|
||||
- Rename to edit_draw(), and rename parameter yval to line.
|
||||
(DLR)
|
||||
do_cursorpos()
|
||||
- Remove unneeded assert. (DLR)
|
||||
do_yesno()
|
||||
- Make mouse clicks on the Yes/No/All shortcuts work properly
|
||||
when the MORE_SPACE flag is set. (DLR)
|
||||
- configure.ac:
|
||||
- Clarify description of --disable-speller. (DLR)
|
||||
- Disable wrapping entirely when --enable-tiny is used, as it
|
||||
matches the FAQ, it makes nano even smaller, and it eliminates
|
||||
the need for --disable-wrapping-as-root in that case (in which
|
||||
it's impossible to turn wrapping back on without nanorc
|
||||
support). (DLR)
|
||||
- README.CVS:
|
||||
- Mention that the minimum required version of texinfo is 4.0,
|
||||
since that's the first version that supports generating HTML.
|
||||
(DLR)
|
||||
- Mention that the minimum required version of groff is 1.12,
|
||||
since that's the first version that supports generating HTML.
|
||||
(DLR)
|
||||
- Update the given cvs commands so that they work again. (DLR)
|
||||
- doc/faq.html:
|
||||
- Add a new section 5.3 to explain the status of nano's Unicode
|
||||
support. (Mike Frysinger, minor tweaks by DLR)
|
||||
- Clarify section 5.3 to better explain how to enable Unicode
|
||||
support, and remove the mention of quirks, since they turned
|
||||
out to not be a nano problem. (Mike Frysinger and DLR)
|
||||
- doc/nano.1:
|
||||
- Make one non-bold instance of "nano" bold, for consistency.
|
||||
(DLR)
|
||||
- doc/man/fr/nano.1, doc/man/fr/nanorc.5:
|
||||
- Updated manpage translations by Jean-Philippe Guérard.
|
||||
- doc/rnano.1:
|
||||
- Add rnano.1 manpage from Thijs Kinkhorst. (Jordi) DLR: Merge
|
||||
a few minor updates from nano.1.
|
||||
- doc/nano.texi:
|
||||
- Fix inconsistent wording and punctuation. (DLR)
|
||||
- Add missing configure options. (Mike Frysinger, minor tweaks
|
||||
by DLR)
|
||||
- Sort the configure options more consistently, and add missing
|
||||
--disable-utf8 option. (DLR)
|
||||
- Move --disable-wrapping above --enable-tiny, as the latter now
|
||||
turns it on. (DLR)
|
||||
- doc/nanorc.sample:
|
||||
- Tweak the "c-file" regex for characters to properly accept
|
||||
'\"' and reject '"' and '''. (DLR)
|
||||
- doc/texinfo/Makefile.am:
|
||||
- Automatically generate an HTML version of the info page,
|
||||
nano.html. (DLR)
|
||||
- src/Makefile.am:
|
||||
- Add browser.c, help.c, and prompt.c to nano_SOURCES. (DLR)
|
||||
|
||||
GNU nano 1.3.9 - 2005.10.23
|
||||
- General:
|
||||
- Miscellaneous comment fixes. (DLR)
|
||||
- More int -> bool conversions. (DLR)
|
||||
- Fix a few last instances of the current line number's being
|
||||
saved as an int instead of a ssize_t. Changes to
|
||||
renumber_all(), renumber(), do_alt_speller(), and
|
||||
backup_lines(). (DLR)
|
||||
- Reorder some functions for consistency. (DLR)
|
||||
- Rename variable open_files openfile, for consistency. (DLR)
|
||||
- Remove renumber()'s dependency on the main filestruct.
|
||||
Changes to renumber(); removal of renumber_all(). (DLR)
|
||||
- Restructure things so that every file has its own
|
||||
openfilestruct, and so that the values in it are used directly
|
||||
instead of being periodically synced up with the globals.
|
||||
Accordingly, remove the globals. Changes to pretty much
|
||||
every function. Rename add_open_file() make_new_buffer(),
|
||||
rename load_buffer() open_buffer(), rename load_open_file()
|
||||
display_buffer(), rename open_prevnext_file()
|
||||
switch_to_prevnext_buffer(), rename open_prevfile_void()
|
||||
switch_to_prev_buffer(), rename open_nextfile_void()
|
||||
switch_to_next_buffer(), rename write_marked()
|
||||
write_marked_file(), remove load_file(), rename cancel_fork()
|
||||
cancel_command(), rename open_pipe() execute_command(), remove
|
||||
execute_command(), rename resize_variables(), rename
|
||||
global_init() window_size_init(), rename get_buffer()
|
||||
get_key_buffer(), and rename get_buffer_len()
|
||||
get_key_buffer_len(). (DLR)
|
||||
- Replace all mvwaddstr(hblank) calls with a new function that
|
||||
does the same thing without the need for hblank. New function
|
||||
blank_line(); changes to do_browser(), blank_titlebar(),
|
||||
blank_topbar(), blank_edit(), blank_statusbar(),
|
||||
blank_bottombars(), update_line(), and edit_refresh(). (DLR)
|
||||
- Make the static pid variable used by execute_command() and
|
||||
cancel_command() a pid_t instead of an int, for consistency.
|
||||
(DLR)
|
||||
- Consistently make the flags global and any variables used to
|
||||
hold it longs. (DLR)
|
||||
- Make edit_scroll() sophisticated enough to keep track of
|
||||
current and current_x, update the lines before and after the
|
||||
scrolled region, and properly scroll more than editwinrows
|
||||
lines; and change the movement functions that use
|
||||
edit_scroll() to (a) set current and current_x before calling
|
||||
it, and (b) no longer call edit_redraw() afterward, as it's
|
||||
now unnecessary. These changes eliminate redundant screen
|
||||
updates when the mark is on, since the mark display depends on
|
||||
current and current_x. Also change edit_redraw() to use
|
||||
edit_scroll() instead of edit_refresh() when one of its two
|
||||
reference lines is offscreen. Changes to edit_scroll(),
|
||||
do_page_up(), do_page_down(), do_up(), and do_down(). (DLR)
|
||||
- Consistently make the fg and bg colortype struct entries and
|
||||
any variables used to hold them shorts. Changes to
|
||||
do_colorinit() (renamed color_init()), color_to_int() (renamed
|
||||
color_to_short()), and parse_colors(). (DLR)
|
||||
- Change color handling to save only the extension and color
|
||||
regex strings constantly, and to actually compile them on an
|
||||
as-needed basis. Also, make a color syntax specified on the
|
||||
command line override the syntax associated with the current
|
||||
file extension, add a "default" syntax that takes no
|
||||
extensions for those files that don't match any other
|
||||
syntax's extensions, and add a "none" syntax that's the same
|
||||
as having no syntax at all. Changes to update_color(),
|
||||
thanks_for_all_the_fish(), nregcomp(), parse_syntax(), and
|
||||
parse_colors(). (Brand Huntsman and DLR)
|
||||
- Various other color fixes. Handle unspecified foreground
|
||||
colors properly, treat syntax names case sensitively, flag
|
||||
duplicate syntax names as errors, don't automatically
|
||||
reinitialize the displayed colors every time we update the
|
||||
current buffer's colors (since the buffer may not be displayed
|
||||
immediately), don't bother doing complete refreshes of the
|
||||
screen when color support is enabled if there's no regex
|
||||
associated with the current file, and rename variable
|
||||
exttype->val to exttype->ext, for consistency. Changes to
|
||||
do_colorinit() (renamed color_init()), update_color() (renamed
|
||||
color_update()), write_file(), do_input(), do_output(), and
|
||||
parse_syntax(). (DLR)
|
||||
- Simplify get_totals() to only get the total number of
|
||||
characters, and eliminate dependence on its old ability to get
|
||||
the total number of lines by renumber()ing when necessary and
|
||||
using the number of the last line of a filestruct. Changes to
|
||||
read_file(), move_to_filestruct(), copy_from_filestruct(),
|
||||
do_justify(), get_totals() (renamed get_totsize()), and
|
||||
do_cursorpos(). (DLR)
|
||||
- Change the NANO_WIDE #define to ENABLE_UTF8, as the latter is
|
||||
clearer. (DLR)
|
||||
- Minor history code fixes: Make sure that the current position
|
||||
in the history list is properly set to the bottom if we cancel
|
||||
out of the prompt, and that magichistory is properly updated
|
||||
when we change it and then move up. New function
|
||||
history_reset(); changes to nanogetstr(). (DLR)
|
||||
- Various character-handling cleanups. If we get an invalid
|
||||
multibyte sequence, treat it as Unicode FFFD (Replacement
|
||||
Character), unless we're searching for a match to it. Also,
|
||||
remove unneeded variables and checks when parsing multibyte
|
||||
sequences. Changes to is_alnum_mbchar(), is_blank_mbchar(),
|
||||
is_cntrl_mbchar(), is_punct_mbchar(), control_mbrep(),
|
||||
mbwidth(), make_mbchar(), parse_mbchar(), mbstrncasecmp(),
|
||||
mbstrcasestr(), mbrevstrcasestr(), mbstrchr(), and
|
||||
display_string(). (DLR)
|
||||
- Move advanced text operations (command execution in a buffer,
|
||||
wrapping, spell checking, justifying, and word counting) to
|
||||
their own source file, and adjust related variables
|
||||
accordingly. New file text.c; changes to cancel_command(),
|
||||
execute_command(), do_backspace(), do_delete(), do_tab(),
|
||||
do_enter(), do_mark(), wrap_reset(), do_wrap(),
|
||||
do_int_spell_fix(), do_int_speller(), do_alt_speller(),
|
||||
do_spell(), break_line(), indent_length(), justify_format(),
|
||||
quote_length(), quotes_match(), indents_match(), begpar(),
|
||||
inpar(), backup_lines(), find_paragraph(), do_justify(),
|
||||
do_justify_void(), do_full_justify(), and do_word_count() (all
|
||||
moved to text.c). (DLR)
|
||||
- Since the total number of lines in a file is the same as the
|
||||
number of its last line when all its lines are numbered
|
||||
properly, use that in place of openfile->totlines, and
|
||||
eliminate references to openfile->totlines. Changes to
|
||||
initialize_buffer_text(), read_file(), move_to_filestruct(),
|
||||
copy_from_filestruct(), do_delete(), do_enter(), do_wrap(),
|
||||
do_justify(), do_alt_speller(), do_wordlinechar_count(),
|
||||
new_magicline(), remove_magicline(), and do_cursorpos(). (DLR)
|
||||
- Various fill-related cleanups. Move check_die_too_small() and
|
||||
window_size_init()'s code into window_init(), as they really
|
||||
belong there, remove associated separate calls to them, make
|
||||
sure window_init() is always called at the same time when
|
||||
redrawing the screen, and turn the keypad on in topwin in case
|
||||
we ever read input from it. Changes to window_init(), main(),
|
||||
and do_alt_speller(); removal of check_die_too_small() and
|
||||
window_size_init(). (DLR)
|
||||
- Remove still more redundant screen updates. Change all
|
||||
wrefresh() calls to wnoutrefresh() calls, except for those in
|
||||
total_update() and do_credits(); call doupdate() just before
|
||||
using blocking input, since nano spends the most time using
|
||||
it, for blocking input; and only do constant sursor position
|
||||
display if we're just about to use blocking input. Changes to
|
||||
input_tab(), do_browser(), do_output(), main(),
|
||||
get_key_buffer(), check_statusblank(), nanogetstr(),
|
||||
titlebar(), statusbar(), bottombars(), edit_refresh(),
|
||||
do_yesno(), and do_help(). (DLR)
|
||||
- Treat the Unicode characters D800-DFFF, FDD0-FDEF, and
|
||||
xxFFFE-xxFFFF, as invalid, since the C library's multibyte
|
||||
functions don't seem to. New function is_valid_unicode();
|
||||
changes to mbrep() and make_mbchar(). (DLR)
|
||||
- Store Unicode values in longs instead of ints, and cover the
|
||||
entire range of Unicode. Changes to make_mbchar(),
|
||||
is_valid_unicode(), parse_kbinput(), get_unicode_kbinput(),
|
||||
parse_verbatim_kbinput(), and faq.html. (DLR)
|
||||
- Readd the option to turn the keypad off by default from nano
|
||||
1.2.x, but rename the long option from --keypad to
|
||||
--rebindkeypad, clarify its description on the command line,
|
||||
and add an updated FAQ entry about its use. Changes to
|
||||
window_init(), usage(), main(), get_verbatim_kbinput(),
|
||||
nanorc.sample, nano.1, nanorc.5, nano.texi, and faq.html.
|
||||
(DLR)
|
||||
- Add new -W/--wordbounds command line option, and new
|
||||
"wordbounds" rcfile option, to control whether
|
||||
the word movement functions treat punctuation characters as
|
||||
part of a word. Changes to do_next_word_void(),
|
||||
do_prev_word_void(), usage(), main(), nano.1, nanorc.5,
|
||||
nano.texi, and nanorc.sample. (DLR, suggested by Mike
|
||||
Frysinger)
|
||||
- Update email address. Changes to faq.html and AUTHORS. (DLR)
|
||||
- Remove do_(left|right)()'s ability to optionally not update
|
||||
the current line, as this was only used in do_backspace(), and
|
||||
it didn't always update the screen properly. Changes to
|
||||
shortcut_init(), do_left(), do_right(), and do_backspace();
|
||||
removal of do_left_void() and do_right_void(). (DLR; problem
|
||||
found by Mike Frysinger)
|
||||
- color.c:
|
||||
- Remove unneeded fcntl.h include. (DLR)
|
||||
- chars.c:
|
||||
control_rep(), control_mbrep()
|
||||
- Assert that the multibyte character passed in is a control
|
||||
character if it's valid. (DLR)
|
||||
- If crep is an invalid multibyte sequence, copy Unicode 0xFFFD
|
||||
(Replacement Character) into it using strncpy() instead of
|
||||
assigning the former to it. This avoids segfaults when freeing
|
||||
crep later, since it's supposed to be dynamically allocated.
|
||||
(DLR)
|
||||
mbrep()
|
||||
- New function, the equivalent of control_mbrep() for non-control
|
||||
characters. (DLR)
|
||||
parse_mbchar()
|
||||
- Remove now-unneeded bad_chr parameter. (DLR)
|
||||
mbstrchr()
|
||||
- Don't count matches between valid and invalid multibyte
|
||||
sequences anymore, for consistency. (DLR)
|
||||
- files.c:
|
||||
open_file()
|
||||
- Assert that filename isn't NULL, and don't do anything special
|
||||
if it's blank, as the the former case shouldn't occur, and the
|
||||
latter case is now handled elsewhere. (DLR)
|
||||
write_file(), write_marked_file(), do_writeout()
|
||||
- Make append an append_type enum instead of an int. (DLR)
|
||||
input_tab()
|
||||
- Make columns an int instead of a size_t, since it's limited by
|
||||
COLS. (DLR)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Simplify wording of nano_gotoline_msg. (Jordi and Ken Tyler)
|
||||
- Clarify wording of nano_wordcount_msg, as it will only go
|
||||
through the marked portions of the file if the mark is on.
|
||||
(DLR)
|
||||
- move.c:
|
||||
do_first_line(), do_last_line()
|
||||
- Simplify by only using edit_redraw(), and also make them call
|
||||
check_statusblank(). (DLR)
|
||||
do_page_up(), do_page_down()
|
||||
- If there's less than a page of text onscreen, just call
|
||||
do_(first|last)_line(). (DLR)
|
||||
do_para_begin(), do_para_begin_void(), do_para_end(),
|
||||
do_para_end_void(), do_next_word(), do_next_word_void(),
|
||||
do_prev_word(), do_prev_word_void()
|
||||
- Move here from nano.c, as they're movement functions, and also
|
||||
make them call check_statusblank().
|
||||
- nano.c:
|
||||
move_to_filestruct()
|
||||
- Fix problem where edittop wouldn't be reset properly if it was
|
||||
inside the text moved to another filestruct. (DLR)
|
||||
copy_from_filestruct()
|
||||
- Miscellaneous cleanups. (DLR)
|
||||
usage()
|
||||
- Properly mention the support for "[+LINE,COLUMN]" on the
|
||||
command line when HAVE_GETOPT_LONG isn't defined. (DLR)
|
||||
- Remove unneeded translation of "--quickblank". (DLR)
|
||||
do_verbatim_input()
|
||||
- If constant cursor position display is on, make sure the
|
||||
cursor position is displayed properly when we finish. (DLR)
|
||||
do_next_word()
|
||||
- Rework to be more like do_prev_word(), to avoid a potential
|
||||
problem if we start at the end of a line. (DLR)
|
||||
do_mouse()
|
||||
- Avoid redundant screen updates by using edit_redraw() instead
|
||||
of edit_refresh(), and remove now-erroneous code that disables
|
||||
setting the mark while in view mode. (DLR)
|
||||
do_output()
|
||||
- When adding a character, just add its length in bytes to
|
||||
current_x instead of calling do_right(), and set placewewant
|
||||
afterward. (DLR)
|
||||
do_alt_speller()
|
||||
- If we can't invoke the spell checker, use sprintf() instead of
|
||||
snprintf() to write the error string we return, as the one
|
||||
formatted value is a simple string, and so altspell_error will
|
||||
always be long enough to hold it. Also remove unnecessary
|
||||
initialization of altspell_error, refactor so that msglen is
|
||||
no longer needed, and make the error message more similar to
|
||||
what the internal spell checker returns under the same
|
||||
circumstances. (DLR)
|
||||
- Block any pending SIGWINCHes while the alternate spell checker
|
||||
is running, so that it can handle them, and unblock them once
|
||||
it's finished and we've loaded the spell-checked file back in.
|
||||
(DLR)
|
||||
- Use doupdate() to reenter curses mode instead of refresh().
|
||||
(DLR)
|
||||
do_spell()
|
||||
- When displaying an error message from do_(int|alt)_speller(),
|
||||
don't display the error message corresponding to errno if
|
||||
errno is zero. (David Benbennick)
|
||||
do_justify()
|
||||
- If constant cursor position display is on, make sure the
|
||||
cursor position is displayed properly when we finish. (DLR)
|
||||
handle_sigwinch()
|
||||
- Use doupdate() to reenter curses mode instead of refresh().
|
||||
(DLR)
|
||||
allow_pending_sigwinch()
|
||||
- Simplify by using the "?" operator instead of an if clause.
|
||||
(DLR)
|
||||
main()
|
||||
- When opening files with "+LINE,COLUMN" arguments on the
|
||||
command line, don't update the screen when moving to their
|
||||
specified lines and columns. (DLR)
|
||||
- Rename variable fill_flag_used to fill_used, for consistency.
|
||||
(DLR)
|
||||
- nano.h:
|
||||
- Since we only use vsnprintf() now, remove the #ifdef block for
|
||||
HAVE_SNPRINTF. (DLR)
|
||||
- Remove TOP from the topmidnone enum, and rename the latter
|
||||
centernone. (DLR)
|
||||
- Move stdlib.h, dirent.h, regex.h, and assert.h includes here,
|
||||
as every source file needs them. (DLR)
|
||||
- Rename the updown enum scroll_dir and the centernone enum
|
||||
update_type for clarity, and add an append_type enum. (DLR)
|
||||
- If we don't have regex.h and hence regex support, disable
|
||||
color support, as it depends on the use of regexes. (DLR)
|
||||
- rcfile.c:
|
||||
nregcomp()
|
||||
- Return TRUE when the compilation succeeds and FALSE otherwise,
|
||||
instead of the other way around. (DLR)
|
||||
- search.c:
|
||||
search_init()
|
||||
- Don't blank out last_replace anymore when we get a new string,
|
||||
as it'll be blanked out in do_replace(). Also, consolidate
|
||||
the cases for blank and new search strings, as they now differ
|
||||
only in which string they pass to regexp_init(). (DLR)
|
||||
is_whole_word()
|
||||
- Move to utils.c, as it's really a utility function in the same
|
||||
vein as regexp_bol_or_eol(). (DLR)
|
||||
replace_abort()
|
||||
- Remove unnecessary update of placewewant. (DLR)
|
||||
do_replace()
|
||||
- Blank out last_replace properly again just before displaying
|
||||
the "Replace" prompt. (DLR, found by Mike Frysinger)
|
||||
- Remove unnecessary renumber(). (DLR)
|
||||
do_gotolinecolumn()
|
||||
- Add parameter allow_update to control whether the screen is
|
||||
updated after moving. If it's TRUE, call edit_refresh() after
|
||||
edit_update(). (DLR)
|
||||
do_gotopos()
|
||||
- Only include this function when DISABLE_SPELLER isn't defined,
|
||||
as the alternate spell checking code is now the only place
|
||||
where it's used. (DLR)
|
||||
do_find_bracket()
|
||||
- Add comments and minor cleanups. (DLR)
|
||||
find_history()
|
||||
- Make parameters const where possible. (DLR)
|
||||
update_history()
|
||||
- Don't renumber the history list starting after the entry we
|
||||
found if the entry we found is at the bottom of the list.
|
||||
(DLR, found by Simon Strandman)
|
||||
get_history_completion()
|
||||
- Make parameters const where possible. (DLR)
|
||||
- text.c:
|
||||
do_tab()
|
||||
- Make sure that we insert the correct number of spaces if the
|
||||
TABS_TO_SPACES flag is set and placewewant is greater than the
|
||||
current column position of the cursor. (DLR)
|
||||
do_enter()
|
||||
- Don't update the edit window until we set placewewant. (DLR)
|
||||
break_line()
|
||||
- Fix a problem where a line could be broken in the middle of a
|
||||
multibyte character. (DLR)
|
||||
do_word_count()
|
||||
- Rename to do_wordlinechar_count(), and expand to also count
|
||||
the number of lines and characters in the file or selection,
|
||||
as wc does. (DLR)
|
||||
- winio.c:
|
||||
get_key_buffer()
|
||||
- Only save all open buffers and hang up when a blocking
|
||||
wgetch() returns ERR and errno is set to EIO (input/output
|
||||
error). If errno is set to something else, recover properly.
|
||||
This fixes problems with nano's erroneously hanging up while
|
||||
e.g. resizing or unsuspending in a chroot. (DLR, found by Mike
|
||||
Frysinger)
|
||||
get_escape_seq_kbinput()
|
||||
- Fix typo preventing the VT100/VT220/VT320/xterm/rxvt escape
|
||||
sequence for ',' on the numeric keypad with NumLock off from
|
||||
being interpreted properly. (DLR)
|
||||
get_word_kbinput()
|
||||
- Multiply the entered digits by hexadecimal numbers instead of
|
||||
decimal numbers for clarity, rename to get_unicode_kbinput(),
|
||||
and rename variables word and word_digits to uni and
|
||||
uni_digits. (DLR)
|
||||
parse_verbatim_kbinput()
|
||||
- Rename variables word_mb and word_mb_len to uni_mb and
|
||||
uni_mb_len. (DLR)
|
||||
display_string()
|
||||
- Instead of using parse_mbchar()'s bad_chr parameter, use
|
||||
mbrep() to get the representation of a bad character. (DLR)
|
||||
- If column is less than start_col and the character's a tab,
|
||||
which can be possible if there are enough tabs and the
|
||||
terminal size is sufficiently large, don't try to display it
|
||||
using control_mbrep(). (DLR, found by Duncan Geoffry Doyle)
|
||||
- Really avoid a memory corruption problem by allocating enough
|
||||
space for COLS characters. (DLR)
|
||||
edit_redraw(), edit_refresh()
|
||||
- Clean up and simplify. (DLR)
|
||||
edit_update()
|
||||
- Since we no longer use TOP, remove references to it. Also,
|
||||
don't call edit_refresh() anymore; it will call us. (DLR)
|
||||
do_statusbar_next_word()
|
||||
- Rework to be more like do_statusbar_prev_word(), to avoid a
|
||||
potential problem if we start at the end of a line. (DLR)
|
||||
do_statusbar_input()
|
||||
- Call do_statusbar_mouse() instead of do_mouse(). (DLR)
|
||||
do_statusbar_output()
|
||||
- When adding a character, just add its length in bytes to
|
||||
statusbar_x instead of calling do_statusbar_right(). (DLR)
|
||||
titlebar()
|
||||
- Rework to display only one space after the version number, so
|
||||
that there's more room for other things, and to not display
|
||||
the status when we're in the file browser, since Pico doesn't.
|
||||
(DLR)
|
||||
do_credits()
|
||||
- Various cleanups. Turn on the MORE_SPACE and NO_HELP flags
|
||||
before showing the credits, so that they use as much of the
|
||||
screen as possible, and set the flags back to their original
|
||||
values afterward. Also, call wscrl(1) instead of scroll(),
|
||||
only call scrollok() just before and after we scroll, and
|
||||
tweak where screen updates occur so that messages are properly
|
||||
displayed when they first scroll onto the bottom line of the
|
||||
screen. (DLR)
|
||||
- Add Mike Frysinger to credits. (DLR)
|
||||
- configure.ac:
|
||||
- Since we only use vsnprintf() now, remove the tests for
|
||||
snprintf(). (DLR)
|
||||
- Change the description of "sufficient wide character support"
|
||||
to "sufficient UTF-8 support", as the latter is clearer. (DLR)
|
||||
- Update the description of the ENABLE_COLOR option to mention
|
||||
the need for regex.h. (DLR)
|
||||
- doc/faq.html:
|
||||
- Update section 4.10 to mention that pasting from the X
|
||||
clipboard via the middle mouse button also works when the
|
||||
Shift key is used. (DLR)
|
||||
- doc/nanorc.sample:
|
||||
- Add regexes for Bourne shell scripts. (Mike Frysinger, minor
|
||||
tweaks by DLR)
|
||||
- Explain how the "none" and "default" syntaxes work. (DLR)
|
||||
- Tweaks and additions to the "c-file" regexes: handle #defined
|
||||
constants more accurately and use a brighter color for them,
|
||||
support C99 standard integer types, support more GCC builtins,
|
||||
and color code flow control statements differently. (Mike
|
||||
Frysinger) DLR: Slightly simplify the integer types regex.
|
||||
- Tweak one "TeX" regex to use the "icolor" directive. (DLR)
|
||||
- doc/man/nanorc.5:
|
||||
- Explain how the "none" and "default" syntaxes work. (DLR)
|
||||
- doc/man/fr/nano.1, doc/man/fr/nanorc.5:
|
||||
- Updated translation by Jean-Philippe Guérard.
|
||||
- src/Makefile.am:
|
||||
- Add text.c to nano_SOURCES. (DLR)
|
||||
- AUTHORS:
|
||||
- Add Mike Frysinger. (DLR)
|
||||
- README.CVS:
|
||||
- Since we only use vsnprintf() now, remove the mention of
|
||||
snprintf(). (DLR)
|
||||
- THANKS:
|
||||
- Add Bulgarian and Dutch translators.
|
||||
|
||||
GNU nano 1.3.8 - 2005.06.30
|
||||
- General:
|
||||
- Miscellaneous comment fixes. (DLR)
|
||||
@@ -127,7 +877,7 @@ GNU nano 1.3.8 - 2005.06.30
|
||||
totlines a size_t, and change related variables to match.
|
||||
(DLR, initial problem with parse_line_column() found by Mike
|
||||
Frysinger)
|
||||
- Rework the credits handling to display Florian König's name
|
||||
- Rework the credits handling to display Florian König's name
|
||||
properly whether we're in a UTF-8 locale or not, and without
|
||||
requiring a massive function that we only use once. Changes
|
||||
to do_credits(); removal of make_valid_mbstring(). (DLR)
|
||||
@@ -1138,7 +1888,7 @@ GNU nano 1.3.5 - 2004.11.22
|
||||
to" messages on the statusbar. (DLR)
|
||||
input_tab()
|
||||
- Fix snprintf() call so that we don't segfault when trying to
|
||||
complete a filename containing %'s. (Ulf Härnhammar)
|
||||
complete a filename containing %'s. (Ulf Härnhammar)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Remove redundant NANO_SMALL #ifdef. (DLR)
|
||||
@@ -1352,7 +2102,7 @@ GNU nano 1.3.5 - 2004.11.22
|
||||
option makes aspell not create backup files, and this is
|
||||
consistent with the internal spell checker's behavior. (DLR)
|
||||
- doc/man/fr/nano.1, doc/man/fr/nanorc.1:
|
||||
- Updated manpage translations by Jean-Philippe Guérard.
|
||||
- Updated manpage translations by Jean-Philippe Guérard.
|
||||
- README.CVS:
|
||||
- Mention the requirement for glib 2.x on systems lacking
|
||||
v?snprintf(), and add minor formatting changes.
|
||||
@@ -2476,7 +3226,7 @@ GNU nano 1.3.1 - 2004.01.09
|
||||
do_writeout()
|
||||
- Prompt the user if we're trying to save an existing file (and
|
||||
not just a selection of it) under a different name. (DLR;
|
||||
suggested by Jean-Philippe Guérard)
|
||||
suggested by Jean-Philippe Guérard)
|
||||
- Overhaul the code used to write a selection of a file to
|
||||
temporarily set fileage and filebot to the top and bottom of
|
||||
the selection and then call write_file(), instead of following
|
||||
@@ -2626,14 +3376,14 @@ GNU nano 1.3.0 - 2003.10.22
|
||||
the backup search string in one place in the search code
|
||||
instead of several; and do some other minor refactoring of
|
||||
related display functions to simplify them. New functions
|
||||
mark_order() and display_string(); changes to actual_x(),
|
||||
strnlenpt(), blank_bottombars(), blank_edit(),
|
||||
get_page_start(), edit_add(), update_line(), statusbar(), and
|
||||
do_replace_highlight(). (David Benbennick) DLR: Add minor
|
||||
cosmetic tweaks, add missing NANO_SMALL #ifdef around the text
|
||||
for a backwards search in the refactored code, and enclose
|
||||
dump_buffer() and dump_buffer_reverse() in one ENABLE_DEBUG
|
||||
#ifdef instead of two.
|
||||
mark_order() and display_string(); new macro charmove();
|
||||
changes to actual_x(), strnlenpt(), blank_bottombars(),
|
||||
blank_edit(), get_page_start(), edit_add(), update_line(),
|
||||
statusbar(), and do_replace_highlight(). (David Benbennick)
|
||||
DLR: Add minor cosmetic tweaks, add missing NANO_SMALL #ifdef
|
||||
around the text for a backwards search in the refactored code,
|
||||
and enclose dump_buffer() and dump_buffer_reverse() in one
|
||||
ENABLE_DEBUG #ifdef instead of two.
|
||||
- Convert memmove() function calls to charmove() macro calls, as
|
||||
the former all work on char*'s. (DLR)
|
||||
- Miscellaneous #define cleanups: only include the prototype for
|
||||
@@ -2764,7 +3514,7 @@ GNU nano 1.3.0 - 2003.10.22
|
||||
interpreted as Ctrl-[character], and the support for Pico's
|
||||
Esc Esc [three-digit decimal ASCII code] input method, if
|
||||
applicable. (DLR)
|
||||
- French translation by Jean-Philippe Guérard.
|
||||
- French translation by Jean-Philippe Guérard.
|
||||
- nano.1.html, nanorc.5.html:
|
||||
- Regenerated. (DLR)
|
||||
- nanorc.sample:
|
||||
@@ -2778,7 +3528,7 @@ GNU nano 1.3.0 - 2003.10.22
|
||||
as such when parsed by color regexes. Accordingly, simplify
|
||||
regexes that handle both spaces and tabs to just handle
|
||||
spaces, as the results are the same. (DLR)
|
||||
- AUTHORS
|
||||
- AUTHORS:
|
||||
- Updated to show 1.2/1.3 maintainers.
|
||||
|
||||
- 1.3 tree forks here
|
||||
@@ -2831,7 +3581,7 @@ GNU nano 1.2.2 - 2003.08.11
|
||||
comments) added by DLR.
|
||||
- THANKS:
|
||||
- Added Laurentiu Buzdugan, for Romanian.
|
||||
- Added Geir Helland, for Norwegian Bokmål.
|
||||
- Added Geir Helland, for Norwegian Bokmål.
|
||||
- TODO:
|
||||
- Move the items for nano 1.2 to the "Old Requests" section,
|
||||
and mark color syntax highlighting as done. (David Benbennick)
|
||||
@@ -2839,7 +3589,7 @@ GNU nano 1.2.2 - 2003.08.11
|
||||
- Added question about nano's not showing color when it's
|
||||
compiled with color support. (DLR; suggested by Jordi)
|
||||
- nano.1, nanorc.5:
|
||||
- Formatting improvements by Jean-Philippe Guérard.
|
||||
- Formatting improvements by Jean-Philippe Guérard.
|
||||
- Minor fixes by DLR.
|
||||
- nano.1.html, nanorc.5.html:
|
||||
- Regenerated from nano.1 and nanorc.5. (DLR)
|
||||
@@ -3078,7 +3828,7 @@ GNU nano 1.1.99pre2 - 2003.02.03
|
||||
nano.c:breakable() (David Benbennick).
|
||||
- Fix screen getting trashed on signals nano can catch
|
||||
(TERM and HUP). New global variable curses_ended,
|
||||
changes to winio.c:statubar() and nano.c:die()
|
||||
changes to winio.c:statusbar() and nano.c:die()
|
||||
(David Benbennick).
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
@@ -4030,7 +4780,7 @@ GNU nano 1.1.9 - 05/12/2002
|
||||
- po/de.po:
|
||||
- German translation updates (Michael Piefel).
|
||||
- po/fr.po:
|
||||
- French translation updates (Jean-Philippe Guérard).
|
||||
- French translation updates (Jean-Philippe Guérard).
|
||||
- po/ca.po, po/es.po:
|
||||
- Catalan and Spanish translation updates (Jordi).
|
||||
- po/sv.po:
|
||||
@@ -4096,7 +4846,7 @@ GNU nano 1.1.8 - 03/30/2002
|
||||
- Fix errno->strerror(errno) mismatch.
|
||||
parse_rcfile()
|
||||
- Don't use i for both for loop and atoi(), fixes lots of
|
||||
potential crashes, 1st reported by Jean-Philippe Guérard.
|
||||
potential crashes, 1st reported by Jean-Philippe Guérard.
|
||||
rcfile_error()
|
||||
- Don't print out the file name if we haven't opened the file
|
||||
yet (lineno == 0).
|
||||
@@ -4129,7 +4879,7 @@ GNU nano 1.1.8 - 03/30/2002
|
||||
- Catalan and Spanish translation updates (Jordi).
|
||||
- Typo (DLR).
|
||||
- po/fr.po:
|
||||
- French translation updates (Jean-Philippe Guérard).
|
||||
- French translation updates (Jean-Philippe Guérard).
|
||||
- po/gl.po:
|
||||
- Galician translation updates (Jacobo Tarrio).
|
||||
- po/uk.po, po/ru.po:
|
||||
@@ -4137,7 +4887,7 @@ GNU nano 1.1.8 - 03/30/2002
|
||||
- po/pl.po:
|
||||
- Polish translation updates (Wojciech Kotwica).
|
||||
- po/fr.po:
|
||||
- French translation updates (Jean-Philippe Guérard).
|
||||
- French translation updates (Jean-Philippe Guérard).
|
||||
- po/it.po:
|
||||
- Italian translation updates (Marco Colombo).
|
||||
- po/da.po:
|
||||
@@ -4240,7 +4990,7 @@ GNU nano 1.1.7 - 03/05/2002
|
||||
- po/sv.po:
|
||||
- Swedish translation updates (Christian Rose).
|
||||
- po/fr.po:
|
||||
- French translation updates (Jean-Philippe Guérard).
|
||||
- French translation updates (Jean-Philippe Guérard).
|
||||
- po/nn.po:
|
||||
- Norwegian nynorsk translation updates (Kjetil Torgrim Homme).
|
||||
- po/de.po:
|
||||
@@ -4257,7 +5007,7 @@ GNU nano 1.1.7 - 03/05/2002
|
||||
- po/da.po:
|
||||
- Danish translation updates (Keld Simonsen).
|
||||
- po/nb.po:
|
||||
- Norwegian bokmål translation updates (Stig E Sandoe).
|
||||
- Norwegian bokmål translation updates (Stig E Sandoe).
|
||||
- po/nl.po:
|
||||
- Dutch translation updates (Guus Sliepen).
|
||||
- po/pl.po:
|
||||
@@ -4342,7 +5092,7 @@ nano-1.1.6 - 01/25/2002
|
||||
users into the fact that their regex is doing something bad.
|
||||
- THANKS:
|
||||
- Oops, correct Eivind's entry. His translation was Norwegian nynorsk,
|
||||
not bokmål as we claimed (Jordi).
|
||||
not bokmål as we claimed (Jordi).
|
||||
- .cvsignore
|
||||
- Added config.guess config.sub install-sh missing & mkinstalldirs
|
||||
- po/ca.po, po/es.po:
|
||||
@@ -4352,7 +5102,7 @@ nano-1.1.6 - 01/25/2002
|
||||
- po/de.po:
|
||||
- German translation update (Michael Piefel).
|
||||
- po/fr.po:
|
||||
- French translation update (Jean-Philippe Guérard).
|
||||
- French translation update (Jean-Philippe Guérard).
|
||||
- po/ru.po, po/uk.po:
|
||||
- Russian and Ukrainian translation updates (Sergey A. Ribalchenko).
|
||||
- po/no.po:
|
||||
@@ -4360,7 +5110,7 @@ nano-1.1.6 - 01/25/2002
|
||||
- po/nn.po:
|
||||
- Norwegian nynorsk translation updates (Kjetil Torgrim Homme).
|
||||
- po/nb.po:
|
||||
- New Norwegian bokmål translation (Stig E Sandoe <stig@ii.uib.no>).
|
||||
- New Norwegian bokmål translation (Stig E Sandoe <stig@ii.uib.no>).
|
||||
- po/da.po:
|
||||
- Danish translation update (Keld Simonsen).
|
||||
|
||||
@@ -4431,13 +5181,13 @@ nano-1.1.5 - 01/05/2002
|
||||
- po/fr.po:
|
||||
- French translation update (Michel Robitaille).
|
||||
- po/gl.po:
|
||||
- Galician translation update (Jacobo Tarrío).
|
||||
- Galician translation update (Jacobo Tarrío).
|
||||
- po/it.po:
|
||||
- Italian translation update (Marco Colombo).
|
||||
- po/de.po:
|
||||
- German translation update (Michael Piefel).
|
||||
- po/fr.po:
|
||||
- French translation update (Jean-Philippe Guérard).
|
||||
- French translation update (Jean-Philippe Guérard).
|
||||
|
||||
nano-1.1.4 - 12/11/2001
|
||||
- General
|
||||
@@ -4642,7 +5392,7 @@ nano-1.1.2 - 10/03/2001
|
||||
- po/ca.po, po/es.po:
|
||||
- Updated Catalan and Spanish translation (Jordi).
|
||||
- po/gl.po:
|
||||
- Updated Galician translation (Jacobo Tarrío).
|
||||
- Updated Galician translation (Jacobo Tarrío).
|
||||
- po/da.po:
|
||||
- New Danish translation, by Keld Simonsen <keld@dkuug.dk>.
|
||||
- po/sv.po:
|
||||
@@ -4862,7 +5612,7 @@ nano-1.1.0 - 07/15/2001
|
||||
- po/es.po, po/ca.po:
|
||||
- Updated (Jordi).
|
||||
- po/gl.po:
|
||||
- Galician translation by Jacobo Tarrío.
|
||||
- Galician translation by Jacobo Tarrío.
|
||||
- po/uk.po, po/ru.po:
|
||||
- New Ukrainian and Russian translations by Sergey A. Ribalchenko
|
||||
<fisher@obu.ck.ua>, thanks!
|
||||
@@ -4871,7 +5621,7 @@ nano-1.1.0 - 07/15/2001
|
||||
- po/it.po
|
||||
- Updated Italian translation by Marco Colombo.
|
||||
- po/no.po:
|
||||
- New Norwegian translation by Eivind Kjørstad <ekj@vestdata.no>.
|
||||
- New Norwegian translation by Eivind Kjørstad <ekj@vestdata.no>.
|
||||
- po/sv.po:
|
||||
- New Swedish translation by Christian Rose <menthos@menthos.com>.
|
||||
|
||||
@@ -4978,7 +5728,7 @@ nano-0.9.99pre3 - 02/19/2001
|
||||
- Added localized yes, no and all strings to function and rewrote
|
||||
handler for the new format.
|
||||
- de.po:
|
||||
- Translation updates by Florian König.
|
||||
- Translation updates by Florian König.
|
||||
- fi.po:
|
||||
- Translation updates by Pauli Virtanen.
|
||||
- hu.po:
|
||||
@@ -5869,7 +6619,7 @@ nano-0.9.7 - 05/14/2000
|
||||
- nano.c:
|
||||
do_home(), do_end():
|
||||
- Added calls to update_line for the current line, fixes
|
||||
lack of update (bug discovered by Alberto García).
|
||||
lack of update (bug discovered by Alberto García).
|
||||
main():
|
||||
- Added SET(FOLLOW_SYMLINKS) before getopt call, fixes not
|
||||
following symlinks even when -l isn't set, and "no changes"
|
||||
@@ -6305,7 +7055,7 @@ nano-0.7.8 - 01/23/2000
|
||||
buffer, cut support. (Adam Rogoyski)
|
||||
blank_edit(): New function, blanks edit buffer. Added call to it in
|
||||
total_refresh().
|
||||
- configure: Checks for glib if snprintf of vsnprintf aren't available
|
||||
- configure: Checks for glib if snprintf or vsnprintf aren't available
|
||||
(Andy Kahn). Changed warning message when no termcap lib
|
||||
is found.
|
||||
|
||||
|
||||
38
NEWS
38
NEWS
@@ -1,3 +1,41 @@
|
||||
2005.12.23 - GNU nano 1.3.10 rises to the surface. This release
|
||||
contains several new features as well as fixes for
|
||||
several longstanding bugs. The former include the
|
||||
ability to scroll up or down single lines without
|
||||
scrolling the cursor, reworked bracket searching code
|
||||
that doesn't require regular expression support,
|
||||
reworked command execution code that uses $SHELL if
|
||||
available instead of hardcoding "/bin/sh", and the
|
||||
ability to no longer add newlines to files that don't
|
||||
end in them via the -L/--nonewlines option. The latter
|
||||
include fixes to the statusbar prompt so that mouse
|
||||
clicks work properly on it, fixes to the Yes/No/All
|
||||
prompt so that mouse clicks on it work properly when
|
||||
-O/--morespace is used, and fixes to the resize handling
|
||||
so that nano dies properly when the terminal is too
|
||||
small to display a prompt. Enjoy.
|
||||
|
||||
2005.10.23 - GNU nano 1.3.9 breaks through the wall. This release
|
||||
includes major enhancements as well as bugfixes. The
|
||||
enhancements include better handling of invalid UTF-8,
|
||||
expansion of the word count option to also count lines
|
||||
and characters in the file or selection, more efficient
|
||||
screen update routines, a readded -K/--rebindkeypad
|
||||
option to work around numeric keypad problems on
|
||||
terminals that don't show the usual NumLock glitch, a
|
||||
new -W/--wordbounds option to properly detect words
|
||||
containing punctuation when moving among them, and
|
||||
massive improvements to the color code such as handling
|
||||
of unspecified foreground colors, more efficient memory
|
||||
usage for color regexes, and new reserved syntaxes
|
||||
"default" and "none". The bugfixes include fixes for
|
||||
the rewritten history code, fixes for potential line
|
||||
numbering problems on 64-bit platforms, fixes for a few
|
||||
long-standing minor display problems, a fix for erroneous
|
||||
hangups occurring while waiting for input, and a fix for
|
||||
a segfault when displaying certain overly long lines.
|
||||
Have fun with it.
|
||||
|
||||
2005.06.30 - GNU nano 1.3.8 floats at its own level. This release
|
||||
contains several new features. Among other things, you
|
||||
can now move to a specified column number as well as
|
||||
|
||||
10
README.CVS
10
README.CVS
@@ -10,11 +10,11 @@ packages:
|
||||
- autoconf (version >= 2.54)
|
||||
- automake (version >= 1.7)
|
||||
- gettext (version >= 0.11.5)
|
||||
- groff
|
||||
- texinfo
|
||||
- groff (version >= 1.12)
|
||||
- texinfo (version >= 4.0)
|
||||
- cvs
|
||||
- ssh (with support for the SSH version 2 protocol)
|
||||
- glib 2.x (if your system doesn't have snprintf() and/or vsnprintf())
|
||||
- glib 2.x (if your system doesn't have vsnprintf())
|
||||
- make, gcc and the normal development libraries (curses or slang, etc.)
|
||||
|
||||
These should be available on your GNU mirror. Note that you'll need a
|
||||
@@ -28,10 +28,10 @@ If you're using a C shell (e.g. tcsh or csh), do
|
||||
$ setenv CVS_RSH ssh
|
||||
|
||||
After it's set up, use the following command to download the CVS tree:
|
||||
$ cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/nano checkout nano
|
||||
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout nano
|
||||
|
||||
If you want to download the stable CVS branch, add "-r nano_1_2_branch":
|
||||
$ cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/nano checkout -r nano_1_2_branch nano
|
||||
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout -r nano_1_2_branch nano
|
||||
|
||||
Once you have the sources in the "nano" directory, cd into it, and
|
||||
execute the "autogen.sh" script in the top directory. This will set up
|
||||
|
||||
20
THANKS
20
THANKS
@@ -1,24 +1,26 @@
|
||||
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> Traditional Chinese translator
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish 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>
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net>
|
||||
French translator
|
||||
Geir Helland Norwegian bokmål translator
|
||||
Geir Helland Norwegian bokmål translator
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Indonesian translator
|
||||
Václav Haisman <V.Haisman@sh.cvut.cz> Czech 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
|
||||
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
|
||||
@@ -28,13 +30,14 @@ Michael Piefel <piefel@informatik.hu-berlin.de> German translator
|
||||
Sergey A. Ribalchenko <fisher@obu.ck.ua> Russian, Ukrainian translator
|
||||
Michel Robitaille <robitail@IRO.UMontreal.CA> French translator
|
||||
Christian Rose <menthos@menthos.com> Swedish translator
|
||||
Stig E Sandoe <stig@ii.uib.no> Norwegian bokmål translator
|
||||
Stig E Sandoe <stig@ii.uib.no> Norwegian bokmål translator
|
||||
Benno Schulenberg <benno@nietvergeten.nl> Dutch 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
|
||||
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
|
||||
@@ -44,6 +47,7 @@ Peio Ziarsolo <peio@sindominio.net> Basque translator
|
||||
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
|
||||
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
|
||||
|
||||
42
configure.ac
42
configure.ac
@@ -19,7 +19,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [1.3.8], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [1.3.10], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
@@ -39,6 +39,7 @@ dnl Internationalization macros.
|
||||
|
||||
AM_GNU_GETTEXT_VERSION(0.11.5)
|
||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
||||
AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
|
||||
|
||||
dnl Checks for header files.
|
||||
|
||||
@@ -86,14 +87,15 @@ fi])
|
||||
AC_ARG_ENABLE(tiny,
|
||||
[ --enable-tiny Disable features for the sake of size],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(NANO_SMALL, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
|
||||
AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable any and all text wrapping.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(browser,
|
||||
@@ -127,9 +129,9 @@ AC_ARG_ENABLE(operatingdir,
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(speller,
|
||||
[ --disable-speller Disable spell checker function],
|
||||
[ --disable-speller Disable spell checker functions],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(tabcomp,
|
||||
@@ -154,7 +156,7 @@ AC_ARG_ENABLE(color,
|
||||
[ --enable-color Enable color and syntax highlighting],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
|
||||
AC_MSG_WARN([
|
||||
***********************************************************************
|
||||
*** WARNING: Color support is far from perfect, but functional. ***
|
||||
@@ -179,7 +181,7 @@ AC_ARG_ENABLE(all,
|
||||
[ --enable-all Enable ALL extra nano functionality (kitchen sink option)],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
|
||||
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
|
||||
AC_MSG_WARN([
|
||||
@@ -398,18 +400,18 @@ int main(void)
|
||||
|
||||
dnl Checks for functions.
|
||||
|
||||
AC_CHECK_FUNCS(getdelim getline isblank snprintf strcasecmp strcasestr strncasecmp strnlen vsnprintf)
|
||||
AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace mblen mbstowcs mbtowc wctomb wcwidth)
|
||||
fi
|
||||
|
||||
if test x$ac_cv_func_snprintf = xno || test x$ac_cv_func_vsnprintf = xno; then
|
||||
if test x$ac_cv_func_vsnprintf = xno; then
|
||||
AM_PATH_GLIB_2_0(2.0.0,,
|
||||
AC_MSG_ERROR([
|
||||
*** snprintf() and/or vsnprintf() not found. GLIB 2.x not found either.
|
||||
*** You need both snprintf() and vsnprintf(). Alternatively you can
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
|
||||
*** vsnprintf() not found. GLIB 2.x not found either. You should
|
||||
*** install the GLIB 2.x library which can be found at
|
||||
*** ftp://ftp.gtk.org/.]),
|
||||
glib)
|
||||
fi
|
||||
|
||||
@@ -455,7 +457,7 @@ else
|
||||
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.]))
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors() command.]))
|
||||
|
||||
dnl Parse any configure options.
|
||||
|
||||
@@ -480,7 +482,7 @@ if test x$enable_utf8 != xno && \
|
||||
test x$ac_cv_func_mbtowc = xyes && \
|
||||
test x$ac_cv_func_wctomb = xyes && \
|
||||
test x$ac_cv_func_wcwidth = xyes; then
|
||||
AC_DEFINE(NANO_WIDE, 1, [Define this if your system has sufficient wide character support (a wide curses library, iswalnum(), iswpunct(), iswblank() or iswspace(), mblen(), mbstowcs(), mbtowc(), wctomb(), and wcwidth()).])
|
||||
AC_DEFINE(ENABLE_UTF8, 1, [Define this if your system has sufficient UTF-8 support (a wide curses library, iswalnum(), iswpunct(), iswblank() or iswspace(), mblen(), mbstowcs(), mbtowc(), wctomb(), and wcwidth()).])
|
||||
else
|
||||
if test x$enable_utf8 = xyes; then
|
||||
AC_MSG_ERROR([
|
||||
|
||||
59
doc/faq.html
59
doc/faq.html
@@ -33,18 +33,20 @@
|
||||
<h2><a href="#4">4. Running</a></h2>
|
||||
<blockquote><p><a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
|
||||
<a href="#4.2">4.2. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</a><br>
|
||||
<a href="#4.3">4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.4">4.4. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.5">4.5. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.6">4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.7a">4.7a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
|
||||
<a href="#4.7b">4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.8">4.8. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.9">4.9. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.10">4.10. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a></p></blockquote>
|
||||
<a href="#4.3">4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</a><br>
|
||||
<a href="#4.4">4.4. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.5">4.5. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.6">4.6. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.7">4.7. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.8a">4.8a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
|
||||
<a href="#4.8b">4.8b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.9">4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.10">4.10. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.11">4.11. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a></p></blockquote>
|
||||
<h2><a href="#5">5. Internationalization</a></h2>
|
||||
<blockquote><p><a href="#5.1">5.1. There's no translation for my language!</a><br>
|
||||
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a></p></blockquote>
|
||||
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a><br>
|
||||
<a href="#5.3">5.3. What is the status of Unicode support?</a></p></blockquote>
|
||||
<h2><a href="#6">6. Advocacy and Licensing</a></h2>
|
||||
<blockquote><p><a href="#6.1">6.1. Why should I use nano instead of Pico?</a><br>
|
||||
<a href="#6.2">6.2. Why should I use Pico instead of nano?</a><br>
|
||||
@@ -62,7 +64,7 @@
|
||||
<hr width="100%">
|
||||
<h1><a name="1"></a>1. General</h1>
|
||||
<h2><a name="1.1"></a>1.1 About this FAQ</h2>
|
||||
<blockquote><p>This FAQ was originally written and maintained by Chris Allegretta <<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>>, who also happens to be the creator of nano. It is currently maintained by David Lawrence Ramsey <<a href="mailto:pooka_regent@sluggy.net">pooka_regent@sluggy.net</a>>. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
|
||||
<blockquote><p>This FAQ was originally written and maintained by Chris Allegretta <<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>>, who also happens to be the creator of nano. It is currently maintained by David Lawrence Ramsey <<a href="mailto:pooka109@cox.net">pooka109@cox.net</a>>. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
|
||||
<h2><a name="1.2"></a>1.2. How do I contribute to it?</h2>
|
||||
<blockquote><p>Your best bet is to send it to the nano email address, <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a> and if it is useful enough it will be included in future versions.</p></blockquote>
|
||||
<h2><a name="1.3"></a>1.3. What is GNU nano?</h2>
|
||||
@@ -80,7 +82,7 @@
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano *should* be 1.3.8. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano *should* be 1.3.10. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.3/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
@@ -167,7 +169,7 @@
|
||||
<p>You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b> keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the normal "Exit" when only one buffer is open.</p></blockquote>
|
||||
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
|
||||
<blockquote><p>To use verbatim input, you must be using nano 1.3.1 or newer. When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b>. (If you're not at a prompt, you'll get the message "Verbatim Input".) Then press the key(s) that generate the character you want.</p>
|
||||
<p>Alternatively, you can press <b>Meta-V</b> and then type a four-digit hexadecimal code from 0000 to ffff (case-insensitive), and the character with the corresponding value will be inserted instead.</p></blockquote>
|
||||
<p>Alternatively, you can press <b>Meta-V</b> and then type a six-digit hexadecimal code from 000000 to 10FFFF (case-insensitive), and the character with the corresponding value will be inserted instead.</p></blockquote>
|
||||
<h2><a name="3.9"></a>3.9. How do I make a .nanorc file that nano will read when I start it?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your version of nano must have been compiled with <b>--enable-nanorc</b>, and again must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the word <b>set</b> and the getopt_long flag for the feature, for example "set nowrap" or "set suspend".</p></blockquote>
|
||||
<hr width="100%">
|
||||
@@ -181,19 +183,21 @@
|
||||
<blockquote><p>Try setting your $TERM variable to 'vt100'. Nano doesn't yet support every term entry under the sun.</p>
|
||||
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
|
||||
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
|
||||
<h2><a name="4.3"></a>4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
|
||||
<h2><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h2>
|
||||
<blockquote><p>You can use the <b>-K</b> or <b>--rebindkeypad</b> options on the command line, or add the line <b>set rebindkeypad</b> to your .nanorc. However, nano's mouse support won't work properly if you do any of these things.</p></blockquote>
|
||||
<h2><a name="4.4"></a>4.4. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
|
||||
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, or Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
|
||||
<h2><a name="4.4"></a>4.4. Nano crashes when I type <insert keystroke here>!</h2>
|
||||
<h2><a name="4.5"></a>4.5. Nano crashes when I type <insert keystroke here>!</h2>
|
||||
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or to <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</p></blockquote>
|
||||
<h2><a name="4.5"></a>4.5. Nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<h2><a name="4.6"></a>4.6. Nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9 would be great, 0.9.12 is recommended).</p></blockquote>
|
||||
<h2><a name="4.6"></a>4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
|
||||
<h2><a name="4.7"></a>4.7. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
|
||||
<blockquote><p>The help (^G) and justify (^J) function were among the last to be written. To show the improvements that nano had over Pico (go to line # and replace), ^_ and ^\ were put on the shortcut list. Later, ^G came back in place of ^_ as it proved to be very valuable for new Unix users. If you use the <b>-p</b> option to nano (or hit Meta-P) you will get the same shortcuts at the bottom as Pico.</p></blockquote>
|
||||
<h2><a name="4.7a"></a>4.7a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
|
||||
<h2><a name="4.8a"></a>4.8a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
|
||||
<blockquote><p>In nano version 0.9.20, the default is to have a completely consistent user interface across all user input functions. This means that regardless of whether you're being asked for a filename to insert or write, or a string to search for, the previous value is already inserted before the cursor. If you prefer the old behavior, use the Pico emulation mode (-p or --pico) or just hit Meta-P while in nano (see the ^G help text for more details).</p></blockquote>
|
||||
<h2><a name="4.7b"></a>4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<h2><a name="4.8b"></a>4.8b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<blockquote><p>It was decided that consistency was nice, but people are used to Pico's inconsistent behavior. Also, in version 1.1.99pre1, search and replace history was introduced. If you wish to edit your previous search/replace entry (or any previous entry), you can do so by hitting the up arrow to cycle through your history. This method allows the best of both worlds: You don't need to erase the previous string if you want to enter a new one, but you can with one keystroke recall previous entries for editing. Therefore there is now no "Pico mode", nano is and has always been a Pico <b>clone</b>, and clones by default should be compatible.</p></blockquote>
|
||||
<h2><a name="4.8"></a>4.8. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<h2><a name="4.9"></a>4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
|
||||
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
|
||||
<p>or if you use tcsh put this in your <b>.cshrc</b> file:</p>
|
||||
@@ -206,10 +210,10 @@
|
||||
<p>Mutt users should see an effect immediately the next time you log in, no further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
|
||||
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
|
||||
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
|
||||
<h2><a name="4.9"></a>4.9. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<h2><a name="4.10"></a>4.10. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Some example configurations are in the <b>nanorc.sample</b> that comes with the nano source or your nano package. See Section <a href="#3.9">3.9</a>.</p></blockquote>
|
||||
<h2><a name="4.10"></a>4.10. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
|
||||
<blockquote><p>Try holding down the Shift key and selecting the text as you normally would.</p></blockquote>
|
||||
<h2><a name="4.11"></a>4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
|
||||
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
<h2><a name="5.1"></a>5.1. There's no translation for my language!</h2>
|
||||
@@ -218,6 +222,8 @@
|
||||
<p>In any case, translating nano is very easy. Just grab the <b>nano.pot</b> file from the latest and greatest nano distribution (it's in the <b>po/</b> directory) and translate each line into your native language on the <b>msgstr</b> line. When you're done, you should send it to the TP's central po repository.</p></blockquote>
|
||||
<h2><a name="5.2"></a>5.2. I don't like the translation for <x> in my language. How can I fix it?</h2>
|
||||
<blockquote><p>The best way would probably be to e-mail the person listed in the <code>Last-Translator:</code> field in the <b><your_language>.po</b> file with your suggested corrections and they can make the changes reach the nano-devel list.</p></blockquote>
|
||||
<h2><a name="5.3"></a>5.3. What is the status of Unicode support?</h2>
|
||||
<blockquote><p>With the latest development version (1.3.10+), Unicode should be mostly usable. With your terminal, locale (LC_ALL and similar environment variables), and encoding configured to properly support UTF-8, you should be able to enter and save Unicode text.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="6"></a>6. Advocacy and Licensing</h1>
|
||||
<h2><a name="6.1"></a>6.1. Why should I use nano instead of Pico?</h2>
|
||||
@@ -249,7 +255,12 @@
|
||||
<blockquote><p>Re-read Section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote>
|
||||
<p>
|
||||
<p>2005/11/21 - Clarify section 5.3 to better explain how to enable Unicode support, and remove the mention of quirks, since they turned out to not be a nano problem. (Mike Frysinger and DLR)<br>
|
||||
2005/11/19 - Add a new section 5.3 to explain the status of nano's Unicode support. (Mike Frysinger, minor tweaks by DLR)<br>
|
||||
2005/08/27 - Update email address. (DLR)<br>
|
||||
2005/08/10 - Add a new section 4.3, and move all section 4 entries after it down one number, to explain how to deal with numeric keypad problems. (DLR)<br>
|
||||
2005/08/08 - Update section 3.8 to mention that verbatim input mode now takes a six-digit hexadecimal number. (DLR)<br>
|
||||
2005/07/04 - Update section 4.10 to mention that pasting from the X clipboard via the middle mouse button also works when the Shift key is used. (DLR)<br>
|
||||
2005/06/15 - Update description of --enable-extra, and add missing line breaks. (DLR)<br>
|
||||
2005/06/13 - Minor capitalization and wording fixes. (DLR)<br>
|
||||
2005/06/08 - Updated section 1.1 to mention the current maintainer. (DLR)<br>
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
if USE_NLS
|
||||
SUBDIRS = fr
|
||||
else
|
||||
SUBDIRS =
|
||||
endif
|
||||
|
||||
man_MANS = nano.1 nanorc.5
|
||||
man_MANS = nano.1 nanorc.5 rnano.1
|
||||
|
||||
BUILT_SOURCES = nano.1.html nanorc.5.html
|
||||
BUILT_SOURCES = nano.1.html nanorc.5.html rnano.1.html
|
||||
|
||||
nano.1.html: nano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
nanorc.5.html: nanorc.5
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
rnano.1.html: rnano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(BUILT_SOURCES)
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003 by
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by
|
||||
.\" Chris Allegretta <chrisa@asty.org>
|
||||
.\"
|
||||
.\" (c) 2003-2004 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" pour l'adaptation française
|
||||
.\" Adaptation française (c) 2003-2005 par
|
||||
.\" Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" Ce document est libre. Reportez-vous à la dernière version de la
|
||||
.\" licence publique générale GNU (GNU GPL) pour connaître ses
|
||||
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
|
||||
.\" conditions d'utilisation. Ce document est distribué sans
|
||||
.\" AUCUNE garantie.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.4" "17 août 2004"
|
||||
.TH NANO 1 "version 1.3.10" "15 décembre 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" 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
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [\+LIGNE]\ [options]\ [fichier]
|
||||
.I [\+LIGNE,COLONNE]\ [options]\ [fichier]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -43,31 +43,35 @@ num
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILIGNE\fR
|
||||
Démarre avec le curseur positionné à la ligne numéro \fILIGNE\fR.
|
||||
.B \+\fILIGNE\fP,\fICOLONNE\fP
|
||||
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
|
||||
la ligne \fILIGNE\fR au lieu de démarrer à la colonne\ 1, ligne\ 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Identique à \fB-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
Active le fonctionnement évolué 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 à ce début de ligne (qu'il soit en avant ou en arrière). Si
|
||||
le curseur est déjà au tout début de la ligne, il se placera au vrai
|
||||
début de la ligne.
|
||||
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.
|
||||
.TP
|
||||
.B \-D (\-\-dos)
|
||||
Écrit le fichier au format DOS.
|
||||
.TP
|
||||
.B \-E \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
|
||||
.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é si celles-ci sont activées.
|
||||
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 multifichier, autorisant l'édition simultanée de plusieurs
|
||||
fichiers, si ce mode est disponible.
|
||||
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
|
||||
@@ -76,60 +80,76 @@ r
|
||||
utiliser les fichiers nanorc.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
N'utilise pas les fichiers \fISYSCONFDIR/nanorc\fR et \fI~/.nanorc\fR, même si
|
||||
\fBnano\fR est capable de les utiliser.
|
||||
Ne pas utiliser pas les fichiers \fISYSCONFDIR/nanorc\fR et
|
||||
\fI~/.nanorc\fR (si \fBnano\fR est capable de les utiliser).
|
||||
.TP
|
||||
.B \-M (\-\-mac)
|
||||
Écrit le fichier au format Mac.
|
||||
.B \-K (\-\-rebindkeypad)
|
||||
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.
|
||||
.TP
|
||||
.B \-L (\-\-nonewlines)
|
||||
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
|
||||
DOS.
|
||||
.TP
|
||||
.B \-O (\-\-morespace)
|
||||
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
|
||||
sera "^([\ \\t]*[|>:}#])+", sinon, ce sera ">\ ".
|
||||
.TP
|
||||
.B \-R (\-\-regexp)
|
||||
Active l'utilisation d'expressions rationnelles lors des recherches, ainsi
|
||||
que la possibilité d'utiliser \\n dans les chaînes de remplacement pour
|
||||
faire référence à la n-ième sous-expression du motif de recherche, si
|
||||
cette fonction est disponible.
|
||||
.B \-R (\-\-restricted)
|
||||
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
|
||||
ou de sauvegarder un fichier ayant déjà un nom sous un nom différent.
|
||||
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.
|
||||
.TP
|
||||
.B \-T \fInombre\fP (\-\-tabsize=\fInombre\fP)
|
||||
Définit la taille (largeur) des tabulations.
|
||||
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
|
||||
\fB-c\fP annule cette option.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Affiche le numéro de version et l'auteur.
|
||||
.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.
|
||||
.TP
|
||||
.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
|
||||
disponible.
|
||||
.TP
|
||||
.B \-Z (\-\-restricted)
|
||||
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 et interdiction de sauvegarder (ou d'ajouter
|
||||
en tête ou en fin) un fichier ayant déjà un nom sous un nom différent.
|
||||
Cette option peut aussi être activée en appelant \fBnano\fP sous un nom
|
||||
commençant par «\ r\ » (par exemple «\ rnano\ »).
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Affiche en permanence la position du curseur.
|
||||
Affiche en permanence la position du curseur. Notez que cette option
|
||||
annule l'option \fB-U\fP.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous devriez n'avoir besoin de cette option que si la touche
|
||||
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
|
||||
sur votre système.
|
||||
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 disponibles en ligne de commande.
|
||||
@@ -139,20 +159,20 @@ Indentation automatique. Commence chaque nouvelle ligne au m
|
||||
la ligne précédente. Utile pour l'édition de code source.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
^K coupe le texte du curseur à la fin de la ligne, au lieu de couper la
|
||||
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, remplace le lien par le
|
||||
nouveau fichier, sans le suivre. Ce mode ne serait-il pas utile pour éditer
|
||||
les fichiers de \fI/tmp\fR ?
|
||||
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 sur votre
|
||||
Active l'utilisation de la souris (si elle est disponible pour votre
|
||||
système).
|
||||
.TP
|
||||
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
|
||||
Définit le répertoire de travail. Demande à nano de mettre en place
|
||||
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
|
||||
@@ -161,18 +181,18 @@ Pr
|
||||
par le terminal.
|
||||
.TP
|
||||
.B \-r \fIcolonne\fP (\-\-fill=\fIcolonne\fP)
|
||||
Passe automatiquement à la ligne à la colonne \fIcolonne\fR. Par défaut, le
|
||||
passage à la ligne se fait à la taille de l'écran moins huit. Si la
|
||||
valeur indiquée est négative, le point de passage à la ligne sera
|
||||
calculé relativement au bord droit de l'écran. Cela permet de faire varier
|
||||
le point de passage à la ligne lorsque l'on change la taille de l'écran.
|
||||
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 -t de Pico.
|
||||
demande de confirmation. Identique à l'option \fB-t\fP de Pico.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
Mode visualisation (lecture seule).
|
||||
@@ -190,14 +210,14 @@ Autorise
|
||||
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 manuel
|
||||
de \fBnanorc\fR(5) et au fichier-exemple \fInanorc.sample\fR qui devrait être
|
||||
livré avec \fBnano\fR.
|
||||
\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
|
||||
manuel de \fBnanorc(5)\fR et au fichier d'exemple \fInanorc.sample\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
|
||||
ligne de commande ou dans le fichier nanorc, \fBnano\fR prendra
|
||||
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.
|
||||
|
||||
@@ -209,7 +229,7 @@ cours n'avait pas encore de nom, ou sera compos
|
||||
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 multifichier, \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.
|
||||
|
||||
@@ -223,6 +243,10 @@ La liste de discussion anglophone \fBnano\fR est disponible via
|
||||
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@corbeaunoir.org\fR.
|
||||
|
||||
.SH "SITE INTERNET"
|
||||
http://www.nano-editor.org/
|
||||
|
||||
@@ -234,13 +258,25 @@ http://www.nano-editor.org/
|
||||
\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@sindominio.net> pour le système GNU Debian (mais elle peut
|
||||
être utilisée par d'autres).
|
||||
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@sindominio.net> 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é par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@corbeaunoir.org> le 15\ décembre\ 2005 à partir
|
||||
de la version du 21\ novembre\ 2005 de la page de manuel de nano 1.3.10.
|
||||
Cette version a été relue par Gérard Delafond.
|
||||
|
||||
Adaptation française du 4\ septembre\ 2004 par
|
||||
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.
|
||||
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
|
||||
consultable via la commande :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
.\" nanorc.5 is Copyright (C) 2003, 2004, 2005 Free Software
|
||||
.\" Foundation, Inc.
|
||||
.\"
|
||||
.\" (c) 2003-2004 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" (c) 2003-2005 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" pour l'adaptation française
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
@@ -9,10 +10,11 @@
|
||||
.\"
|
||||
.\" Ce document est libre. Reportez-vous à la dernière version de la
|
||||
.\" licence publique générale GNU (GNU GPL) pour connaître ses
|
||||
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
|
||||
.\" conditions d'utilisation. Ce document est distribué sans
|
||||
.\" AUCUNE garantie.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 1.3.4" "17 août 2004"
|
||||
\" $Id$
|
||||
.TH NANORC 5 "version 1.3.10" "15 décembre 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
|
||||
@@ -21,27 +23,27 @@ nanorc \- fichier de configuration de l'
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement le fichier de configuration de
|
||||
l'éditeur \fBnano\fP du projet GNU.
|
||||
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 paquet non-libre Pine.
|
||||
remplacer Pico, l'éditeur par défaut du paquet 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
|
||||
les fonctions de recherche et de remplacement et la possibilité de
|
||||
sauter directement à un numéro de ligne.
|
||||
.PP
|
||||
Le fichier \fInanorc\fP contient les paramètres par défaut de
|
||||
\fBnano\fP. Lors de son démarrage, nano commence par lire le fichier de
|
||||
configuration général \fISYSCONFDIR/nanorc\fP, puis lit le fichier de
|
||||
configuration personnel de l'utilisateur \fI~/.nanorc\fP.
|
||||
\fBnano\fP. 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 «\ set\ »
|
||||
(activer) et «\ unset\ » (désactiver), qui permettent de définir la
|
||||
configuration de nano au démarrage sans avoir à utiliser d'options sur
|
||||
la ligne de commande.
|
||||
De plus, les mots clefs «\ syntax\ » (syntaxe) et «\ color\ » (couleur)
|
||||
la ligne de commande. De plus, les mots clefs «\ syntax\ » (syntaxe),
|
||||
«\ color\ » (couleur) et «\ icolor\ » (couleur insensible à la casse)
|
||||
sont utilisés pour définir les règles de colorisation pour différents
|
||||
motifs de texte. Nano lira une commande par ligne.
|
||||
|
||||
@@ -59,20 +61,42 @@ Les commandes et arguments reconnus sont\ :
|
||||
Active l'indentation automatique.
|
||||
.TP
|
||||
\fBset/unset backup\fP
|
||||
Crée des copie 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é.
|
||||
.TP
|
||||
.B set/unset backwards
|
||||
Par défaut, les recherches se font vers l'arrière.
|
||||
.TP
|
||||
.B set brackets \fIchaîne\fP
|
||||
Définit les caractères considérés comme des fermetures de parenthèses.
|
||||
Ces caractères ne doivent pas contenir d'espaces. Seules les
|
||||
ponctuations terminales, éventuellement suivies de parenthèses
|
||||
fermantes, peuvent terminer une phrase.
|
||||
|
||||
(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.
|
||||
.TP
|
||||
\fBset/unset const\fP
|
||||
Affiche en permanence la position du curseur dans la ligne d'état.
|
||||
.TP
|
||||
\fBset/unset cut\fP
|
||||
Par défaut, ^K coupe le texte du curseur jusqu'à 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
|
||||
\fBset fill \fIn\fP\fP
|
||||
Passe automatiquement à la ligne à la colonne \fIn\fP. Si la valeur
|
||||
indiquée est 0 ou moins, la longueur de la ligne sera égale à la largeur
|
||||
de l'écran moins \fIn\fP. La valeur par défaut est -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
|
||||
\fBset/unset historylog\fP
|
||||
Active l'utilisation de
|
||||
@@ -80,6 +104,14 @@ Active l'utilisation de
|
||||
pour enregistrer et relire les chaînes ayant fait l'objet d'une
|
||||
recherche ou d'un remplacement.
|
||||
.TP
|
||||
.B set/unset morespace
|
||||
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, afin que des clics souris puissent
|
||||
être utilisés pour marquer le texte ou accéder aux raccourcis.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
Mode multifichier\ : permet de charger les fichiers dans leur propre
|
||||
espace.
|
||||
@@ -93,10 +125,13 @@ Ne suit pas les liens symboliques lors de l'
|
||||
\fBset/unset nohelp\fP
|
||||
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.
|
||||
.TP
|
||||
\fBset/unset nowrap\fP
|
||||
Désactive le passage automatique à la ligne.
|
||||
.TP
|
||||
\fBset operatingdir "\fIrépertoire\fP"\fP
|
||||
\fBset operatingdir \fIrépertoire\fP\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
|
||||
@@ -105,19 +140,23 @@ r
|
||||
\fBset/unset preserve\fP
|
||||
Préserve les séquences XON et XOFF (^Q et ^S).
|
||||
.TP
|
||||
\fBset punct "\fIchaîne\fP"\fP
|
||||
\fBset punct \fIchaîne\fP\fP
|
||||
Définit les caractères interprétés comme des ponctuations terminales.
|
||||
Ces caractères ne peuvent inclure d'espaces ou de tabulations. Seules les
|
||||
ponctuations terminales, éventuellement suivies de crochets fermants,
|
||||
peuvent terminer une phrase.
|
||||
Ces caractères ne peuvent inclure de blancs. Seules les ponctuations
|
||||
terminales, éventuellement suivies de parenthèses fermantes, peuvent
|
||||
terminer une phrase.
|
||||
|
||||
(N.D.T.\ : ce réglage permet de conserver 2\ espaces au lieu d'une
|
||||
derrière les ponctuations terminales lors de la justification, 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
|
||||
\fBset quotestr "\fIchaîne\fP"\fP
|
||||
.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.
|
||||
.TP
|
||||
\fBset quotestr \fIchaîne\fP\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
|
||||
@@ -131,22 +170,28 @@ Sinon, ce sera ">\ ". Notez que le
|
||||
caractère de tabulation.
|
||||
.TP
|
||||
\fBset/unset rebinddelete\fP
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous devriez uniquement avoir besoin de cette option si la touche
|
||||
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
|
||||
sur votre système.
|
||||
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
|
||||
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.
|
||||
.TP
|
||||
\fBset/unset regexp\fP
|
||||
Utilise par défaut des expressions rationnelles pour les recherches.
|
||||
.TP
|
||||
\fBset/unset smarthome\fP
|
||||
Active le fonctionnement évolué 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 à ce début de ligne (qu'il soit en avant ou en arrière). Si
|
||||
le curseur est déjà au tout début de la ligne, il se placera au vrai
|
||||
début de la ligne.
|
||||
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
|
||||
\fBset/unset smooth\fP
|
||||
Active le défilement ligne-par-ligne du texte.
|
||||
@@ -156,52 +201,76 @@ Utilise le correcteur orthographique \fIprogramme\fP au lieu du
|
||||
correcteur intégré, qui s'appuie sur \fIspell\fP.
|
||||
.TP
|
||||
\fBset/unset suspend\fP
|
||||
Autorise à suspendre nano avec ^Z.
|
||||
Autorise à suspendre nano.
|
||||
.TP
|
||||
\fBset tabsize \fIn\fP\fP
|
||||
Utilise une largeur de tabulation de \fIn\fP au lieu de la valeur par
|
||||
défaut (8). Cette valeur doit être supérieur à 0.
|
||||
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.
|
||||
.TP
|
||||
.B set/unset tabstospaces
|
||||
Convertit les tabulations clavier en espaces.
|
||||
.TP
|
||||
\fBset/unset tempfile\fP
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement en
|
||||
quittant, sans demande de confirmation.
|
||||
.TP
|
||||
\fBset/unset view\fP
|
||||
Interdit la modification du fichier.
|
||||
Interdit de modifier les fichiers.
|
||||
.TP
|
||||
\fBset whitespace "\fIchaîne\fP"\fP
|
||||
\fBset whitespace \fIchaîne\fP\fP
|
||||
Définit les deux caractères utilisés pour afficher les premiers
|
||||
caractères de tabulations et d'espaces. Cela ne doit pas être
|
||||
des caractère de contrôle.
|
||||
caractères des tabulations et des espaces. Ces deux caractères doivent
|
||||
être mono-colonne.
|
||||
.TP
|
||||
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
|
||||
.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.
|
||||
.TP
|
||||
.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 qui sera automatiquement activé si le nom du
|
||||
l'option \fB-Y\fP ou qui sera automatiquement activée si le nom du
|
||||
fichier en cours correspond au \fImotif_de_fichier\fP. Toutes les
|
||||
instructions suivantes de colorisation \fBcolor\fP s'appliqueront à
|
||||
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
|
||||
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
|
||||
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 \fImotif\fP en utilisant la couleur de texte
|
||||
\fIcouleur_texte\fP et éventuellement la couleur de fond
|
||||
\fIcouleur_fond\fP. 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. Vous pouvez ajouter à
|
||||
ces couleurs le préfixe \fIbright\fP 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 transparent.
|
||||
\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 (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
|
||||
\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
|
||||
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
|
||||
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 \fImotif_début\fP et se terminant
|
||||
par \fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
|
||||
et éventuellement la couleur de fond \fIcouleur_fond\fP. 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.
|
||||
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.
|
||||
.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
|
||||
compte de la casse.
|
||||
|
||||
.SH FICHIERS
|
||||
.TP
|
||||
@@ -225,6 +294,18 @@ Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
manuel a été rédigée par Jordi Mallach <jordi@gnu.org>.
|
||||
|
||||
.SH TRADUCTION
|
||||
Cette adaptation française a été réalisé par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@corbeaunoir.org> le 15\ décembre\ 2005 à partir de
|
||||
la version du 21\ novembre\ 2005 de la page de manuel de nano 1.3.10.
|
||||
Cette version a été relue par Gérard Delafond.
|
||||
|
||||
Adaptation française du 4\ septembre\ 2004 par
|
||||
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.
|
||||
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
|
||||
consultable via la commande :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.8" "June 27, 2005"
|
||||
.TH NANO 1 "version 1.3.10" "November 21, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -68,6 +68,14 @@ stored for later editing, if nanorc support is configured.
|
||||
Don't look at \fISYSCONFDIR/nanorc\fP or \fI~/.nanorc\fP, if nanorc
|
||||
support is available.
|
||||
.TP
|
||||
.B \-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)
|
||||
Don't add newlines to the ends of files.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
@@ -101,6 +109,10 @@ keystroke instead of 25. Note that \fB-c\fP cancels this out.
|
||||
.B \-V (\-\-version)
|
||||
Show the current version number and author.
|
||||
.TP
|
||||
.B \-W (\-\-wordbounds)
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
.TP
|
||||
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
|
||||
Specify a specific syntax highlighting from the \fInanorc\fP to use, if
|
||||
available.
|
||||
@@ -133,7 +145,7 @@ a new file instead of following it. Good for editing files in
|
||||
Enable mouse support (if available for your system).
|
||||
.TP
|
||||
.B \-o \fIdir\fP (\-\-operatingdir=\fIdir\fP)
|
||||
Set operating directory. Makes nano set up something similar to a
|
||||
Set operating directory. Makes \fBnano\fP set up something similar to a
|
||||
chroot.
|
||||
.TP
|
||||
.B \-p (\-\-preserve)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 1.3.8" "June 27, 2005"
|
||||
.TH NANORC 5 "version 1.3.10" "November 21, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -95,6 +95,9 @@ Don't follow symlinks when writing files.
|
||||
.B set/unset nohelp
|
||||
Don't display the help lists at the bottom of the screen.
|
||||
.TP
|
||||
.B set/unset nonewlines
|
||||
Don't add newlines to the ends of files.
|
||||
.TP
|
||||
.B set/unset nowrap
|
||||
Don't wrap text at all.
|
||||
.TP
|
||||
@@ -112,7 +115,7 @@ Set the characters treated as closing punctuation. They cannot contain
|
||||
blank characters. Only closing punctuation, optionally followed by
|
||||
closing brackets, can end sentences.
|
||||
.TP
|
||||
.B set quickblank
|
||||
.B set/unset quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
.TP
|
||||
@@ -131,6 +134,11 @@ 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
|
||||
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
|
||||
Do regular expression searches by default.
|
||||
.TP
|
||||
@@ -168,11 +176,20 @@ Disallow file modification.
|
||||
Set the two characters used to display the first characters of tabs and
|
||||
spaces. They must be single-column characters.
|
||||
.TP
|
||||
.B set/unset wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
.TP
|
||||
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
|
||||
Defines a syntax named \fIstr\fP which can be activated via the \fB-Y\fP
|
||||
flag, or will be automatically activated if the current filename matches
|
||||
\fIfileregex\fP. All following \fBcolor\fP and \fBicolor\fP statements
|
||||
will apply to \fIsyntax\fP until a new syntax is defined.
|
||||
|
||||
The \fInone\fP syntax is reserved; specifying it on the command line is
|
||||
the same as not having a syntax at all. The \fIdefault\fP syntax is
|
||||
special: it takes no \fIfileregex\fP, and applies to files that don't
|
||||
match any other syntax's \fIfileregex\fP.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
|
||||
For the currently defined syntax, display all expressions matching
|
||||
|
||||
83
doc/man/rnano.1
Normal file
83
doc/man/rnano.1
Normal file
@@ -0,0 +1,83 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" rnano.1 is copyright 2005 by
|
||||
.\" Thijs Kinkhorst <thijs@kinkhorst.com>;
|
||||
.\" skeleton based on nano-tiny.1 by Jordi Mallach <jordi@debian.org>.
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.\" $Id$
|
||||
.TH RNANO 1 "version 1.3.10" "November 23, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
rnano \- Restricted mode for Nano's ANOther editor, an enhanced free
|
||||
Pico clone
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B rnano
|
||||
.I [\+LINE,COLUMN]\ [options]\ [file]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
This manual page documents briefly the \fBrnano\fP command.
|
||||
.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\fP is a small, free and friendly editor which aims to replace
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just 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 number".
|
||||
.PP
|
||||
\fBrnano\fP is a restricted version of \fBnano\fP, which only edits
|
||||
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:
|
||||
.IP \[bu] 2
|
||||
read or write to any file not specified on the command line;
|
||||
.IP \[bu]
|
||||
read any nanorc files;
|
||||
.IP \[bu]
|
||||
allow suspending;
|
||||
.IP \[bu]
|
||||
allow a file to be appended to, prepended to, or saved under a different
|
||||
name;
|
||||
.IP \[bu]
|
||||
use backup files or spell checking.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-?
|
||||
Same as \fB-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Display a summary of command line options.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Show the current version number and author.
|
||||
.PP
|
||||
See the \fBnano\fP(1) manpage for the complete documentation of
|
||||
\fBnano\fP.
|
||||
|
||||
.SH BUGS
|
||||
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
|
||||
|
||||
The \fBnano\fP mailing list is available from \fBnano-devel@gnu.org\fP.
|
||||
|
||||
To subscribe, email to \fBnano-devel-request@gnu.org\fP with a subject
|
||||
of "subscribe".
|
||||
|
||||
.SH HOMEPAGE
|
||||
http://www.nano-editor.org/
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see 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).
|
||||
@@ -67,6 +67,9 @@
|
||||
## Don't display the helpful shortcut lists at the bottom of the screen.
|
||||
# set nohelp
|
||||
|
||||
## Don't add newlines to the ends of files.
|
||||
# set nonewlines
|
||||
|
||||
## Don't wrap text at all.
|
||||
# set nowrap
|
||||
|
||||
@@ -103,6 +106,9 @@
|
||||
## Fix Backspace/Delete confusion problem.
|
||||
# set rebinddelete
|
||||
|
||||
## Fix numeric keypad key confusion problem.
|
||||
# set rebindkeypad
|
||||
|
||||
## Do extended regular expression searches by default.
|
||||
# set regexp
|
||||
|
||||
@@ -141,18 +147,27 @@
|
||||
## (00B7 hexadecimal) seem to be good values for these.
|
||||
# set whitespace " "
|
||||
|
||||
## Detect word boundaries more accurately by treating punctuation
|
||||
## characters as part of a word.
|
||||
# set wordbounds
|
||||
|
||||
## Color setup
|
||||
##
|
||||
## Format:
|
||||
##
|
||||
## syntax "short description" ["filename regex" ...]
|
||||
##
|
||||
## (The "none" syntax is reserved; specifying it on the command line is
|
||||
## the same as not having a syntax at all. The "default" syntax is
|
||||
## special: it takes no filename regexes, and applies to files that
|
||||
## don't match any other syntax's filename regexes.)
|
||||
##
|
||||
## color foreground,background "regex" ["regex"...]
|
||||
## or
|
||||
## icolor foreground,background "regex" ["regex"...]
|
||||
##
|
||||
## "color" will do case sensitive matches, while "icolor" will do case
|
||||
## insensitive matches.
|
||||
## ("color" will do case sensitive matches, while "icolor" will do case
|
||||
## insensitive matches.)
|
||||
##
|
||||
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
|
||||
## You may use the prefix "bright" to mean a stronger color highlight
|
||||
@@ -165,17 +180,19 @@
|
||||
## to set the background color to black or white.
|
||||
##
|
||||
# syntax "c-file" "\.(c|C|cc|cpp|cxx|h|H|hh|hpp|hxx)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# color brightred "\<[A-Z_][A-Z_0-9]+\>"
|
||||
# color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
|
||||
# color green "\<(u_?)?int(8|16|32|64|ptr)_t\>"
|
||||
# color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|default|switch|goto|continue|break|return)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
|
||||
# color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||
# color magenta "\<(goto|continue|break|return)\>"
|
||||
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
# color brightmagenta "'([^\]|(\\['abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
|
||||
# color brightmagenta "'([^"'\]|(\\["'abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
|
||||
##
|
||||
## GCC builtins
|
||||
##
|
||||
# color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(asm|builtin|inline|restrict|typeof)__"
|
||||
# color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||
##
|
||||
## You will in general want your comments and strings to come last,
|
||||
## because syntax highlighting rules will be applied in the order they
|
||||
@@ -183,7 +200,7 @@
|
||||
##
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
##
|
||||
## This string is VERY resource intensive!!!
|
||||
## This string is VERY resource intensive!
|
||||
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
|
||||
##
|
||||
## And we want to have some nice comment highlighting too
|
||||
@@ -197,7 +214,7 @@
|
||||
|
||||
## Here is a short example for TeX files
|
||||
# syntax "TeX" "\.tex$"
|
||||
# color green "\\.|\\[A-Za-z]*"
|
||||
# icolor green "\\.|\\[A-Z]*"
|
||||
# color magenta "[{}]"
|
||||
# color blue "%.*"
|
||||
|
||||
@@ -297,13 +314,26 @@
|
||||
# color brightblue "//.*"
|
||||
# color brightblue start="/\*" end="\*/"
|
||||
|
||||
## Here is an example for Bourne shell scripts
|
||||
##
|
||||
# syntax "shellscript" "\.sh$"
|
||||
# icolor brightgreen "^[_A-Z0-9]+\(\)"
|
||||
# color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>"
|
||||
# color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
|
||||
# color green "-(L|d|e|f|g|r|u|w|x)\>"
|
||||
# color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
|
||||
# color brightblue "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>"
|
||||
# icolor brightred "\$\{?[_A-Z0-9]+\}?"
|
||||
# color yellow "#.*$"
|
||||
# color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
|
||||
|
||||
## Here is an example for your .nanorc
|
||||
##
|
||||
# syntax "nanorc" "(\.|/|)nanorc$"
|
||||
## highlight possible errors and parameters
|
||||
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?color).*$"
|
||||
## set, unset and syntax
|
||||
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quickblank|quotestr|rebinddelete)\>" "^[[:space:]]*(set|unset)[[:space:]]+(regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace)\>"
|
||||
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct|quickblank)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
|
||||
# icolor green "^[[:space:]]*(set|unset|syntax)\>"
|
||||
## colors
|
||||
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
|
||||
@@ -2,4 +2,9 @@ info_TEXINFOS = nano.texi
|
||||
|
||||
MAKEINFO = makeinfo --no-split
|
||||
|
||||
EXTRA_DIST = nano.info
|
||||
BUILT_SOURCES = nano.html
|
||||
|
||||
nano.html: nano.texi
|
||||
cat $< | makeinfo --no-split --html > $@
|
||||
|
||||
EXTRA_DIST = $(info_TEXINFOS) $(BUILT_SOURCES)
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
@c Run `makeinfo' rather than `texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.3.8
|
||||
@set UPDATED 27 Jun 2005
|
||||
@set VERSION 1.3.10
|
||||
@set UPDATED 28 Nov 2005
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.3.8
|
||||
@subtitle version 1.3.10
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -138,8 +138,16 @@ Enable multiple file buffers, if available.
|
||||
Don't look at SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
|
||||
available.
|
||||
|
||||
@item -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.
|
||||
|
||||
@item -L, --nonewlines
|
||||
Don't add newlines to the ends of files.
|
||||
|
||||
@item -N, --noconvert
|
||||
Do not convert files from DOS/Mac format.
|
||||
Don't convert files from DOS/Mac format.
|
||||
|
||||
@item -Q [str], --quotestr [str]
|
||||
Set the quoting string for justifying. The default is
|
||||
@@ -172,8 +180,12 @@ keystroke instead of 25. Note that -c cancels this out.
|
||||
@item -V, --version
|
||||
Print the version number and copyright and quit.
|
||||
|
||||
@item -W, --wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
|
||||
@item -Y, --syntax=[str]
|
||||
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||
Specify a specific syntax highlighting from the nanorc to use, if
|
||||
available.
|
||||
|
||||
@item -c, --const
|
||||
@@ -224,7 +236,7 @@ set, its own interactive spell checker that requires the @code{spell}
|
||||
program to be installed on your system.
|
||||
|
||||
@item -t, --tempfile
|
||||
Do not ask whether or not to save the current contents of the file when
|
||||
Don't ask whether or not to save the current contents of the file when
|
||||
exiting, assume yes. This is most useful when using @code{nano} as the
|
||||
composer of a mailer program.
|
||||
|
||||
@@ -238,16 +250,16 @@ Note: When accessing the help system, Expert Mode is temporarily
|
||||
disabled to display the help system navigation keys.
|
||||
|
||||
@item -v, --view
|
||||
Do not allow the contents of the file to be altered. Note that this
|
||||
flag should NOT be used in place of correct file permissions to
|
||||
Don't allow the contents of the file to be altered. Note that this
|
||||
option should NOT be used in place of correct file permissions to
|
||||
implement a read-only file.
|
||||
|
||||
@item -w, --nowrap
|
||||
Do not wrap long lines at any length. This option overrides any value
|
||||
Don't wrap long lines at any length. This option overrides any value
|
||||
for -r.
|
||||
|
||||
@item -z, --suspend
|
||||
Enable suspend ability of @code{nano} using the system's suspend
|
||||
Enable @code{nano}'s suspend ability using the system's suspend
|
||||
keystroke (usually ^Z).
|
||||
|
||||
@item -a, -b, -e, -f, -g, -j
|
||||
@@ -341,61 +353,61 @@ and ^V (Page Down) keys. ^X exits the help system.
|
||||
@chapter Feature Toggles
|
||||
|
||||
Toggles allow you to change certain aspects of the editor that
|
||||
would normally be done via command line flags. They are invoked via
|
||||
would normally be done via command line options. They are invoked via
|
||||
certain Meta key sequences. @xref{Special Functions}, for more info.
|
||||
The following global toggles are available:
|
||||
|
||||
@table @code
|
||||
|
||||
@item Backup Files Toggle (Meta-B)
|
||||
toggles the -B (@code{--backup}) command line flag.
|
||||
toggles the -B (@code{--backup}) command line option.
|
||||
|
||||
@item Constant Cursor Position Display Toggle (Meta-C)
|
||||
toggles the -c (@code{--const}) command line flag.
|
||||
toggles the -c (@code{--const}) command line option.
|
||||
|
||||
@item Multiple File Buffers Toggle (Meta-F)
|
||||
toggles the -F (@code{--multibuffer}) command line flag.
|
||||
toggles the -F (@code{--multibuffer}) command line option.
|
||||
|
||||
@item Smart Home Key Toggle (Meta-H)
|
||||
toggles the -A (@code{--smarthome}) command line flag.
|
||||
toggles the -A (@code{--smarthome}) command line option.
|
||||
|
||||
@item Auto Indent Toggle (Meta-I)
|
||||
toggles the -i (@code{--autoindent}) command line flag.
|
||||
toggles the -i (@code{--autoindent}) command line option.
|
||||
|
||||
@item Cut To End Toggle (Meta-K)
|
||||
toggles the -k (@code{--cut}) command line flag.
|
||||
toggles the -k (@code{--cut}) command line option.
|
||||
|
||||
@item Long Line Wrapping Toggle (Meta-L)
|
||||
toggles the -w (@code{--nowrap}) command line flag.
|
||||
toggles the -w (@code{--nowrap}) command line option.
|
||||
|
||||
@item Mouse Support Toggle (Meta-M)
|
||||
toggles the -m (@code{--mouse}) command line flag.
|
||||
toggles the -m (@code{--mouse}) command line option.
|
||||
|
||||
@item No Conversion From DOS/Mac Format Toggle (Meta-N)
|
||||
toggles the -N (@code{--noconvert}) command line flag.
|
||||
toggles the -N (@code{--noconvert}) command line option.
|
||||
|
||||
@item More Space For Editing Toggle (Meta-O)
|
||||
toggles the -O (@code{--morespace}) command line flag.
|
||||
toggles the -O (@code{--morespace}) command line option.
|
||||
|
||||
@item Whitespace Display Toggle (Meta-P)
|
||||
toggles whitespace display mode if you have a "whitespace" option in
|
||||
your .nanorc.
|
||||
your nanorc.
|
||||
|
||||
@item Tabs to Spaces Toggle (Meta-Q)
|
||||
toggles the -E (@code{--tabstospaces}) command line flag.
|
||||
toggles the -E (@code{--tabstospaces}) command line option.
|
||||
|
||||
@item Smooth Scrolling Toggle (Meta-S)
|
||||
toggles the -S (@code{--smooth}) command line flag.
|
||||
toggles the -S (@code{--smooth}) command line option.
|
||||
|
||||
@item Expert/No Help Toggle (Meta-X)
|
||||
toggles the -x (@code{--nohelp}) command line flag.
|
||||
toggles the -x (@code{--nohelp}) command line option.
|
||||
|
||||
@item Color Syntax Highlighting Toggle (Meta-Y)
|
||||
toggles color syntax highlighting if you have color syntaxes in your
|
||||
.nanorc.
|
||||
nanorc.
|
||||
|
||||
@item Suspend Toggle (Meta-Z)
|
||||
toggles the -z (@code{--suspend}) command line flag.
|
||||
toggles the -z (@code{--suspend}) command line option.
|
||||
|
||||
@end table
|
||||
|
||||
@@ -429,11 +441,11 @@ incompatible with Pico, method for entering search and replace strings.
|
||||
In the old method, previous entries would be displayed by default as
|
||||
editable text in front of the cursor, as opposed to being bracketed and
|
||||
uneditable as it is in Pico. The old behavior could be made compatible
|
||||
with Pico via the @code{-p} flag, but recent versions of Pico use the
|
||||
@code{-p} flag to preserve the XON and XOFF sequences within the editor.
|
||||
Since with the new method search and replace strings can still be edited
|
||||
by simply hitting the up arrow key once, the old method was removed
|
||||
completely.
|
||||
with Pico via the @code{-p} option, but recent versions of Pico use the
|
||||
@code{-p} option to preserve the XON and XOFF sequences within the
|
||||
editor. Since with the new method search and replace strings can still
|
||||
be edited by simply hitting the up arrow key once, the old method was
|
||||
removed completely.
|
||||
|
||||
|
||||
@item Writing or Appending Selected Text to Files
|
||||
@@ -480,50 +492,83 @@ familiar with compiling programs with autoconf support:
|
||||
@item make install
|
||||
@end itemize
|
||||
|
||||
if you are looking to optimize @code{nano} for size, you may want to
|
||||
consider the following command line options:
|
||||
|
||||
|
||||
@table @code
|
||||
|
||||
|
||||
@item --disable-browser
|
||||
Disable the mini file browser when reading or writing files.
|
||||
|
||||
@item --disable-help
|
||||
Disable the help function. Doing this makes the binary much smaller,
|
||||
but makes it difficult for new users to learn more than very basic
|
||||
things about using the editor.
|
||||
|
||||
@item --disable-justify
|
||||
Disable the justify and unjustify functions.
|
||||
|
||||
@item --disable-mouse
|
||||
Disable all mouse functionality. This also disables the -m command line
|
||||
option, which enables the mouse functionality.
|
||||
|
||||
@item --disable-operatingdir
|
||||
Disable setting the operating directory. This also disables the -o
|
||||
command line option, which sets the operating directory.
|
||||
|
||||
@item --disable-speller
|
||||
Disable use of the spell checker. This also disables the -s command
|
||||
line option, which allows specifying an alternate spell checker.
|
||||
|
||||
@item --disable-tabcomp
|
||||
Disable the tab completion code when reading or writing files.
|
||||
|
||||
@item --disable-justify
|
||||
Disable the justify (^J)/unjustify (^U) functions in the editor.
|
||||
|
||||
@item --disable-speller
|
||||
Disable spell checker ability.
|
||||
|
||||
@item --disable-help
|
||||
Disable the help function (^G). Disabling this option makes the binary
|
||||
much smaller, but makes it difficult for new users to learn more than
|
||||
very basic things about using the editor.
|
||||
|
||||
@item --disable-browser
|
||||
Disable the mini file browser (^T) when reading or writing files.
|
||||
|
||||
@item --disable-mouse
|
||||
Disable all mouse functionality. This also disables the -m command line
|
||||
flag, which enables the mouse functions.
|
||||
|
||||
@item --disable-operatingdir
|
||||
Disable setting the operating directory. This also disables the -o
|
||||
command line flag.
|
||||
@item --disable-wrapping
|
||||
Disable all long line wrapping. This also eliminates the -w command
|
||||
line option, which enables long line wrapping.
|
||||
|
||||
@item --enable-tiny
|
||||
This option disables all the above. It also disables some of the larger
|
||||
internals of the editor, like the marker code (^^) and the cut to line
|
||||
(-k) option, which depends on the marker code to work properly. It also
|
||||
disables the function toggles.
|
||||
internals of the editor, like the marking code and the cut to line code.
|
||||
It also disables the function toggles.
|
||||
|
||||
@item --disable-wrapping
|
||||
Disable all word wrapping in the editor. This also eliminates the -w
|
||||
command line flag, as nonwrapping is then the default behavior.
|
||||
@item --enable-debug
|
||||
Enable support for runtime debug output. This can get pretty messy, so
|
||||
chances are you only want this feature to work on the nano source.
|
||||
|
||||
@item --enable-extra
|
||||
Enable extra features. At the moment, this is just easter egg-type
|
||||
stuff.
|
||||
|
||||
@item --enable-color
|
||||
Enable support for syntax coloring of files. See the nanorc
|
||||
documentation for more details. The nanorc feature will also be
|
||||
enabled.
|
||||
|
||||
@item --enable-multibuffer
|
||||
Enable support for opening multiple files at a time and switching
|
||||
between them on the fly.
|
||||
|
||||
@item --enable-nanorc
|
||||
Enable support for reading the nanorc file at startup. You can store
|
||||
custom settings in the nanorc file rather than having to pass command
|
||||
line options to get desired behavior.
|
||||
|
||||
@item --enable-all
|
||||
Shortcut for enabling the above four features (extra, color,
|
||||
multibuffer, and nanorc).
|
||||
|
||||
@item --disable-nls
|
||||
Disables Native Language support. This will make the available GNU
|
||||
@code{nano} translations unusable.
|
||||
Disables Native Language support. This will disable use of the
|
||||
available GNU @code{nano} translations.
|
||||
|
||||
@item --disable-wrapping-as-root
|
||||
Disable long line wrapping by default when nano is run as root.
|
||||
|
||||
@item --enable-utf8
|
||||
Enable support for reading and writing Unicode files. This will require
|
||||
either the wide version of ncurses, or a UTF-8-enabled version of Slang.
|
||||
|
||||
@item --disable-utf8
|
||||
Disable support for reading and writing Unicode files.
|
||||
|
||||
@item --with-slang
|
||||
Compiling @code{nano} with Slang is supported, and will make the binary
|
||||
|
||||
76
po/ChangeLog
76
po/ChangeLog
@@ -1,9 +1,81 @@
|
||||
2005-06-28 David Lawrence Ramsey <pooka_regent@sluggy.net>
|
||||
2005-12-21 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* bg.po: Updated Bulgarian translation by Anton Zinoviev.
|
||||
* ca.po: Updated Catalan translation.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
* zh_TW: Updated Traditional Chinese translation by
|
||||
Wei-Lun Chao.
|
||||
|
||||
2005-12-13 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* de.po: Updated German translation by Michael Piefel.
|
||||
* nl.po: Updated Dutch translation by Benno Schulenberg.
|
||||
|
||||
2005-11-08 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* POTFILES.in: Add prompt.c.
|
||||
|
||||
2005-11-05 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* POTFILES.in: Add browser.c.
|
||||
|
||||
2005-11-01 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* POTFILES.in: Add help.c.
|
||||
|
||||
2006-10-23 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* eu.po: Updated Basque translation by Mikel Olasagasti.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
* nl.po: Updated Dutch translation by Benno Schulenberg.
|
||||
* zh_TW: Updated Traditional Chinese translation by
|
||||
Wei-Lun Chao.
|
||||
|
||||
2006-08-22 Jordi Mallach <jordi@gnu.org>
|
||||
* bg.po: New Bulgarian translation by
|
||||
Yavor Doganov <yavor@doganov.org>.
|
||||
|
||||
* LINGUAS: Added "bg".
|
||||
|
||||
2005-08-16 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
|
||||
2005-08-16 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* nl.po: Updated Dutch translation by
|
||||
Benno Schulenberg and Reinout van Schouwen.
|
||||
|
||||
2005-07-24 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* POTFILES.in: Add text.c.
|
||||
|
||||
2005-07-19 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by
|
||||
Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2005-07-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by
|
||||
Jean-Philippe Guérard.
|
||||
|
||||
2005-07-07 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* ca.po: Updated Catalan translation.
|
||||
|
||||
2005-06-28 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* POTFILES.in: Remove source files that contain no translatable
|
||||
strings.
|
||||
|
||||
2005-06-19 David Lawrence Ramsey <pooka_regent@sluggy.net>
|
||||
2005-06-19 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* pt_BR.po: Typo fix.
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk vi zh_TW
|
||||
bg ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk vi zh_TW
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# $Id$
|
||||
# List of source files containing translatable strings.
|
||||
|
||||
src/browser.c
|
||||
src/files.c
|
||||
src/global.c
|
||||
src/help.c
|
||||
src/nano.c
|
||||
src/prompt.c
|
||||
src/rcfile.c
|
||||
src/search.c
|
||||
src/text.c
|
||||
src/utils.c
|
||||
src/winio.c
|
||||
|
||||
1753
po/zh_TW.po
1753
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -4,17 +4,21 @@ INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
bin_PROGRAMS = nano
|
||||
nano_SOURCES = chars.c \
|
||||
nano_SOURCES = browser.c \
|
||||
chars.c \
|
||||
color.c \
|
||||
cut.c \
|
||||
files.c \
|
||||
global.c \
|
||||
help.c \
|
||||
move.c \
|
||||
nano.c \
|
||||
nano.h \
|
||||
prompt.c \
|
||||
proto.h \
|
||||
rcfile.c \
|
||||
search.c \
|
||||
text.c \
|
||||
utils.c \
|
||||
winio.c
|
||||
|
||||
|
||||
539
src/browser.c
Normal file
539
src/browser.c
Normal file
@@ -0,0 +1,539 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* browser.c *
|
||||
* *
|
||||
* Copyright (C) 2001-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
|
||||
/* Our browser function. path is the path to start browsing from.
|
||||
* Assume path has already been tilde-expanded. */
|
||||
char *do_browser(char *path, DIR *dir)
|
||||
{
|
||||
int kbinput, longest, selected, width;
|
||||
bool meta_key, func_key, old_const_update = ISSET(CONST_UPDATE);
|
||||
size_t numents;
|
||||
char **filelist, *retval = NULL;
|
||||
|
||||
curs_set(0);
|
||||
blank_statusbar();
|
||||
bottombars(browser_list);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
|
||||
/* Set currshortcut so the user can click in the shortcut area, and
|
||||
* so the browser help screen will come up. */
|
||||
currshortcut = browser_list;
|
||||
#endif
|
||||
|
||||
UNSET(CONST_UPDATE);
|
||||
|
||||
change_browser_directory:
|
||||
/* We go here after the user selects a new directory. */
|
||||
|
||||
kbinput = ERR;
|
||||
selected = 0;
|
||||
width = 0;
|
||||
|
||||
path = mallocstrassn(path, get_full_path(path));
|
||||
|
||||
/* Assume that path exists and ends with a slash. */
|
||||
assert(path != NULL && path[strlen(path) - 1] == '/');
|
||||
|
||||
/* Get the list of files. */
|
||||
filelist = browser_init(path, &longest, &numents, dir);
|
||||
|
||||
assert(filelist != NULL);
|
||||
|
||||
/* Sort the list. */
|
||||
qsort(filelist, numents, sizeof(char *), diralphasort);
|
||||
|
||||
titlebar(path);
|
||||
|
||||
do {
|
||||
bool abort = FALSE;
|
||||
int j, col = 0, editline = 0, fileline;
|
||||
int filecols = 0;
|
||||
/* Used only if width == 0, to calculate the number of files
|
||||
* per row below. */
|
||||
struct stat st;
|
||||
char *new_path;
|
||||
/* Used by the "Go To Directory" prompt. */
|
||||
#ifndef DISABLE_MOUSE
|
||||
MEVENT mevent;
|
||||
#endif
|
||||
|
||||
check_statusblank();
|
||||
|
||||
/* Compute the line number we're on now, so that we don't divide
|
||||
* by zero later. */
|
||||
fileline = selected;
|
||||
if (width != 0)
|
||||
fileline /= width;
|
||||
|
||||
switch (kbinput) {
|
||||
#ifndef DISABLE_MOUSE
|
||||
case KEY_MOUSE:
|
||||
if (getmouse(&mevent) == ERR)
|
||||
break;
|
||||
|
||||
/* If we clicked in the edit window, we probably clicked
|
||||
* on a file. */
|
||||
if (wenclose(edit, mevent.y, mevent.x)) {
|
||||
int old_selected = selected;
|
||||
|
||||
/* Subtract out the size of topwin. */
|
||||
mevent.y -= 2 - no_more_space();
|
||||
|
||||
/* longest is the width of each column. There are
|
||||
* two spaces between each column. */
|
||||
selected = (fileline / editwinrows) * editwinrows *
|
||||
width + mevent.y * width + mevent.x /
|
||||
(longest + 2);
|
||||
|
||||
/* If they clicked beyond the end of a row, select
|
||||
* the end of that row. */
|
||||
if (mevent.x > width * (longest + 2))
|
||||
selected--;
|
||||
|
||||
/* If we're off the screen, reset to the last item.
|
||||
* If we clicked the same place as last time, select
|
||||
* this name! */
|
||||
if (selected > numents - 1)
|
||||
selected = numents - 1;
|
||||
else if (old_selected == selected)
|
||||
/* Put back the 'select' key. */
|
||||
unget_kbinput(NANO_ENTER_KEY, FALSE, FALSE);
|
||||
} else {
|
||||
/* We must have clicked a shortcut. Put back the
|
||||
* equivalent shortcut key. */
|
||||
int mouse_x, mouse_y;
|
||||
get_mouseinput(&mouse_x, &mouse_y, TRUE);
|
||||
}
|
||||
|
||||
break;
|
||||
#endif
|
||||
case NANO_PREVLINE_KEY:
|
||||
if (selected >= width)
|
||||
selected -= width;
|
||||
break;
|
||||
case NANO_BACK_KEY:
|
||||
if (selected > 0)
|
||||
selected--;
|
||||
break;
|
||||
case NANO_NEXTLINE_KEY:
|
||||
if (selected + width <= numents - 1)
|
||||
selected += width;
|
||||
break;
|
||||
case NANO_FORWARD_KEY:
|
||||
if (selected < numents - 1)
|
||||
selected++;
|
||||
break;
|
||||
case NANO_PREVPAGE_KEY:
|
||||
case NANO_PREVPAGE_FKEY:
|
||||
case '-': /* Pico compatibility. */
|
||||
if (selected >= (editwinrows + fileline % editwinrows) *
|
||||
width)
|
||||
selected -= (editwinrows + fileline % editwinrows) *
|
||||
width;
|
||||
else
|
||||
selected = 0;
|
||||
break;
|
||||
case NANO_NEXTPAGE_KEY:
|
||||
case NANO_NEXTPAGE_FKEY:
|
||||
case ' ': /* Pico compatibility. */
|
||||
selected += (editwinrows - fileline % editwinrows) *
|
||||
width;
|
||||
if (selected >= numents)
|
||||
selected = numents - 1;
|
||||
break;
|
||||
case NANO_HELP_KEY:
|
||||
case NANO_HELP_FKEY:
|
||||
case '?': /* Pico compatibility. */
|
||||
#ifndef DISABLE_HELP
|
||||
do_help();
|
||||
curs_set(0);
|
||||
#else
|
||||
nano_disabled_msg();
|
||||
#endif
|
||||
break;
|
||||
case NANO_ENTER_KEY:
|
||||
case 'S': /* Pico compatibility. */
|
||||
case 's':
|
||||
/* You can't move up from "/". */
|
||||
if (strcmp(filelist[selected], "/..") == 0) {
|
||||
statusbar(_("Can't move up a directory"));
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
/* Note: the selected file can be outside the operating
|
||||
* directory if it's ".." or if it's a symlink to a
|
||||
* directory outside the operating directory. */
|
||||
if (check_operating_dir(filelist[selected], FALSE)) {
|
||||
statusbar(
|
||||
_("Can't go outside of %s in restricted mode"),
|
||||
operating_dir);
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (stat(filelist[selected], &st) == -1) {
|
||||
/* We can't open this file for some reason.
|
||||
* Complain. */
|
||||
statusbar(_("Error reading %s: %s"),
|
||||
filelist[selected], strerror(errno));
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!S_ISDIR(st.st_mode)) {
|
||||
retval = mallocstrcpy(retval, filelist[selected]);
|
||||
abort = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
dir = opendir(filelist[selected]);
|
||||
if (dir == NULL) {
|
||||
/* We can't open this dir for some reason.
|
||||
* Complain. */
|
||||
statusbar(_("Error reading %s: %s"),
|
||||
filelist[selected], strerror(errno));
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
|
||||
path = mallocstrcpy(path, filelist[selected]);
|
||||
|
||||
/* Start over again with the new path value. */
|
||||
free_chararray(filelist, numents);
|
||||
goto change_browser_directory;
|
||||
|
||||
/* Redraw the screen. */
|
||||
case NANO_REFRESH_KEY:
|
||||
total_redraw();
|
||||
break;
|
||||
|
||||
/* Go to a specific directory. */
|
||||
case NANO_GOTOLINE_KEY:
|
||||
case NANO_GOTOLINE_FKEY:
|
||||
case 'G': /* Pico compatibility. */
|
||||
case 'g':
|
||||
curs_set(1);
|
||||
|
||||
j = do_prompt(FALSE, gotodir_list, "",
|
||||
#ifndef NANO_TINY
|
||||
NULL,
|
||||
#endif
|
||||
_("Go To Directory"));
|
||||
|
||||
curs_set(0);
|
||||
bottombars(browser_list);
|
||||
|
||||
if (j < 0) {
|
||||
statusbar(_("Cancelled"));
|
||||
break;
|
||||
}
|
||||
|
||||
new_path = real_dir_from_tilde(answer);
|
||||
|
||||
if (new_path[0] != '/') {
|
||||
new_path = charealloc(new_path, strlen(path) +
|
||||
strlen(answer) + 1);
|
||||
sprintf(new_path, "%s%s", path, answer);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (check_operating_dir(new_path, FALSE)) {
|
||||
statusbar(
|
||||
_("Can't go outside of %s in restricted mode"),
|
||||
operating_dir);
|
||||
free(new_path);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
dir = opendir(new_path);
|
||||
if (dir == NULL) {
|
||||
/* We can't open this dir for some reason.
|
||||
* Complain. */
|
||||
statusbar(_("Error reading %s: %s"), answer,
|
||||
strerror(errno));
|
||||
beep();
|
||||
free(new_path);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Start over again with the new path value. */
|
||||
free(path);
|
||||
path = new_path;
|
||||
free_chararray(filelist, numents);
|
||||
goto change_browser_directory;
|
||||
|
||||
/* Abort the browser. */
|
||||
case NANO_EXIT_KEY:
|
||||
case NANO_EXIT_FKEY:
|
||||
case 'E': /* Pico compatibility. */
|
||||
case 'e':
|
||||
abort = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (abort)
|
||||
break;
|
||||
|
||||
blank_edit();
|
||||
|
||||
j = (width != 0) ? width * editwinrows * ((selected / width) /
|
||||
editwinrows) : 0;
|
||||
|
||||
wmove(edit, 0, 0);
|
||||
|
||||
{
|
||||
size_t foo_len = mb_cur_max() * 7;
|
||||
char *foo = charalloc(foo_len + 1);
|
||||
|
||||
for (; j < numents && editline <= editwinrows - 1; j++) {
|
||||
char *disp = display_string(tail(filelist[j]), 0,
|
||||
longest, FALSE);
|
||||
|
||||
/* Highlight the currently selected file/dir. */
|
||||
if (j == selected)
|
||||
wattron(edit, A_REVERSE);
|
||||
|
||||
blank_line(edit, editline, col, longest);
|
||||
mvwaddstr(edit, editline, col, disp);
|
||||
free(disp);
|
||||
|
||||
col += longest;
|
||||
filecols++;
|
||||
|
||||
/* Show file info also. We don't want to report file
|
||||
* sizes for links, so we use lstat(). Also, stat() and
|
||||
* lstat() return an error if, for example, the file is
|
||||
* deleted while the file browser is open. In that
|
||||
* case, we report "--" as the file info. */
|
||||
if (lstat(filelist[j], &st) == -1 ||
|
||||
S_ISLNK(st.st_mode)) {
|
||||
/* Aha! It's a symlink! Now, is it a dir? If so,
|
||||
* mark it as such. */
|
||||
if (stat(filelist[j], &st) == 0 &&
|
||||
S_ISDIR(st.st_mode)) {
|
||||
strncpy(foo, _("(dir)"), foo_len);
|
||||
foo[foo_len] = '\0';
|
||||
} else
|
||||
strcpy(foo, "--");
|
||||
} else if (S_ISDIR(st.st_mode)) {
|
||||
strncpy(foo, _("(dir)"), foo_len);
|
||||
foo[foo_len] = '\0';
|
||||
} else if (st.st_size < (1 << 10)) /* less than 1 k. */
|
||||
sprintf(foo, "%4u B", (unsigned int)st.st_size);
|
||||
else if (st.st_size < (1 << 20)) /* less than 1 meg. */
|
||||
sprintf(foo, "%4u KB",
|
||||
(unsigned int)(st.st_size >> 10));
|
||||
else if (st.st_size < (1 << 30)) /* less than 1 gig. */
|
||||
sprintf(foo, "%4u MB",
|
||||
(unsigned int)(st.st_size >> 20));
|
||||
else
|
||||
sprintf(foo, "%4u GB",
|
||||
(unsigned int)(st.st_size >> 30));
|
||||
|
||||
mvwaddnstr(edit, editline, col - strlen(foo), foo,
|
||||
foo_len);
|
||||
|
||||
if (j == selected)
|
||||
wattroff(edit, A_REVERSE);
|
||||
|
||||
/* Add some space between the columns. */
|
||||
col += 2;
|
||||
|
||||
/* If the next entry isn't going to fit on the line,
|
||||
* move to the next line. */
|
||||
if (col > COLS - longest) {
|
||||
editline++;
|
||||
col = 0;
|
||||
if (width == 0)
|
||||
width = filecols;
|
||||
}
|
||||
|
||||
wmove(edit, editline, col);
|
||||
}
|
||||
|
||||
free(foo);
|
||||
}
|
||||
|
||||
wnoutrefresh(edit);
|
||||
} while ((kbinput = get_kbinput(edit, &meta_key, &func_key)) !=
|
||||
NANO_EXIT_KEY && kbinput != NANO_EXIT_FKEY);
|
||||
|
||||
blank_edit();
|
||||
titlebar(NULL);
|
||||
edit_refresh();
|
||||
curs_set(1);
|
||||
if (old_const_update)
|
||||
SET(CONST_UPDATE);
|
||||
|
||||
/* Clean up. */
|
||||
free_chararray(filelist, numents);
|
||||
free(path);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Return a list of files contained in the directory path. *longest is
|
||||
* the maximum display length of a file, up to COLS - 1 (but at least
|
||||
* 7). *numents is the number of files. We assume path exists and is a
|
||||
* directory. If neither is true, we return NULL. */
|
||||
char **browser_init(const char *path, int *longest, size_t *numents, DIR
|
||||
*dir)
|
||||
{
|
||||
const struct dirent *nextdir;
|
||||
char **filelist;
|
||||
size_t i = 0, path_len;
|
||||
|
||||
assert(dir != NULL);
|
||||
|
||||
*longest = 0;
|
||||
|
||||
while ((nextdir = readdir(dir)) != NULL) {
|
||||
size_t dlen;
|
||||
|
||||
/* Don't show the "." entry. */
|
||||
if (strcmp(nextdir->d_name, ".") == 0)
|
||||
continue;
|
||||
i++;
|
||||
|
||||
dlen = strlenpt(nextdir->d_name);
|
||||
if (dlen > *longest)
|
||||
*longest = (dlen > COLS - 1) ? COLS - 1 : dlen;
|
||||
}
|
||||
|
||||
*numents = i;
|
||||
rewinddir(dir);
|
||||
*longest += 10;
|
||||
|
||||
filelist = (char **)nmalloc(*numents * sizeof(char *));
|
||||
|
||||
path_len = strlen(path);
|
||||
|
||||
i = 0;
|
||||
|
||||
while ((nextdir = readdir(dir)) != NULL && i < *numents) {
|
||||
/* Don't show the "." entry. */
|
||||
if (strcmp(nextdir->d_name, ".") == 0)
|
||||
continue;
|
||||
|
||||
filelist[i] = charalloc(path_len + strlen(nextdir->d_name) + 1);
|
||||
sprintf(filelist[i], "%s%s", path, nextdir->d_name);
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Maybe the number of files in the directory changed between the
|
||||
* first time we scanned and the second. i is the actual length of
|
||||
* filelist, so record it. */
|
||||
*numents = i;
|
||||
closedir(dir);
|
||||
|
||||
if (*longest > COLS - 1)
|
||||
*longest = COLS - 1;
|
||||
if (*longest < 7)
|
||||
*longest = 7;
|
||||
|
||||
return filelist;
|
||||
}
|
||||
|
||||
/* The file browser front end. We check to see if inpath has a dir in
|
||||
* it. If it does, we start do_browser() from there. Otherwise, we
|
||||
* start do_browser() from the current directory. */
|
||||
char *do_browse_from(const char *inpath)
|
||||
{
|
||||
struct stat st;
|
||||
char *path;
|
||||
/* This holds the tilde-expanded version of inpath. */
|
||||
DIR *dir = NULL;
|
||||
|
||||
assert(inpath != NULL);
|
||||
|
||||
path = real_dir_from_tilde(inpath);
|
||||
|
||||
/* Perhaps path is a directory. If so, we'll pass it to
|
||||
* do_browser(). Or perhaps path is a directory / a file. If so,
|
||||
* we'll try stripping off the last path element and passing it to
|
||||
* do_browser(). Or perhaps path doesn't have a directory portion
|
||||
* at all. If so, we'll just pass the current directory to
|
||||
* do_browser(). */
|
||||
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
||||
striponedir(path);
|
||||
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
||||
free(path);
|
||||
|
||||
path = charalloc(PATH_MAX + 1);
|
||||
path = getcwd(path, PATH_MAX + 1);
|
||||
|
||||
if (path != NULL)
|
||||
align(&path);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
/* If the resulting path isn't in the operating directory, use
|
||||
* the operating directory instead. */
|
||||
if (check_operating_dir(path, FALSE)) {
|
||||
if (path != NULL)
|
||||
free(path);
|
||||
path = mallocstrcpy(NULL, operating_dir);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (path != NULL)
|
||||
dir = opendir(path);
|
||||
|
||||
if (dir == NULL) {
|
||||
beep();
|
||||
free(path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return do_browser(path, dir);
|
||||
}
|
||||
|
||||
/* Strip one directory from the end of path. */
|
||||
void striponedir(char *path)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
assert(path != NULL);
|
||||
|
||||
tmp = strrchr(path, '/');
|
||||
|
||||
if (tmp != NULL)
|
||||
*tmp = '\0';
|
||||
}
|
||||
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
386
src/chars.c
386
src/chars.c
@@ -2,7 +2,8 @@
|
||||
/**************************************************************************
|
||||
* chars.c *
|
||||
* *
|
||||
* Copyright (C) 2005 Chris Allegretta *
|
||||
* Copyright (C) 2001-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -20,23 +21,26 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
#ifdef HAVE_WCHAR_H
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
#ifdef HAVE_WCTYPE_H
|
||||
#include <wctype.h>
|
||||
#endif
|
||||
|
||||
static const wchar_t bad_wchar = 0xFFFD;
|
||||
/* If we get an invalid multibyte sequence, we treat it as
|
||||
* Unicode FFFD (Replacement Character), unless we're
|
||||
* determining if it's a control character or searching for a
|
||||
* match to it. */
|
||||
static const char *bad_mbchar = "\xEF\xBF\xBD";
|
||||
static const int bad_mbchar_len = 3;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ISBLANK
|
||||
@@ -47,7 +51,7 @@ bool nisblank(int c)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_ISWBLANK) && defined(NANO_WIDE)
|
||||
#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
|
||||
/* This function is equivalent to iswblank(). */
|
||||
bool niswblank(wchar_t wc)
|
||||
{
|
||||
@@ -67,14 +71,13 @@ bool is_alnum_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
return iswalnum(wc);
|
||||
@@ -88,14 +91,13 @@ bool is_blank_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
return iswblank(wc);
|
||||
@@ -105,14 +107,14 @@ bool is_blank_mbchar(const char *c)
|
||||
}
|
||||
|
||||
/* This function is equivalent to iscntrl(), except in that it also
|
||||
* handles control characters with their high bits set. */
|
||||
* handles high-bit control characters. */
|
||||
bool is_cntrl_char(int c)
|
||||
{
|
||||
return (-128 <= c && c < -96) || (0 <= c && c < 32) ||
|
||||
(127 <= c && c < 160);
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
/* This function is equivalent to iscntrl() for wide characters, except
|
||||
* in that it also handles wide control characters with their high bits
|
||||
* set. */
|
||||
@@ -129,14 +131,13 @@ bool is_cntrl_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
return is_cntrl_wchar(wc);
|
||||
@@ -150,14 +151,14 @@ bool is_punct_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
if (c_mb_len < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
return iswpunct(wc);
|
||||
@@ -178,9 +179,11 @@ bool is_word_mbchar(const char *c, bool allow_punct)
|
||||
}
|
||||
|
||||
/* c is a control character. It displays as ^@, ^?, or ^[ch], where ch
|
||||
* is c + 64. We return that character. */
|
||||
* is (c + 64). We return that character. */
|
||||
char control_rep(char c)
|
||||
{
|
||||
assert(is_cntrl_char(c));
|
||||
|
||||
/* Treat newlines embedded in a line as encoded nulls. */
|
||||
if (c == '\n')
|
||||
return '@';
|
||||
@@ -190,11 +193,13 @@ char control_rep(char c)
|
||||
return c + 64;
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
/* c is a wide control character. It displays as ^@, ^?, or ^[ch],
|
||||
* where ch is c + 64. We return that wide character. */
|
||||
* where ch is (c + 64). We return that wide character. */
|
||||
wchar_t control_wrep(wchar_t wc)
|
||||
{
|
||||
assert(is_cntrl_wchar(wc));
|
||||
|
||||
/* Treat newlines embedded in a line as encoded nulls. */
|
||||
if (wc == '\n')
|
||||
return '@';
|
||||
@@ -206,31 +211,69 @@ wchar_t control_wrep(wchar_t wc)
|
||||
#endif
|
||||
|
||||
/* c is a multibyte control character. It displays as ^@, ^?, or ^[ch],
|
||||
* where ch is c + 64. We return that multibyte character. */
|
||||
* where ch is (c + 64). We return that multibyte character. If crep
|
||||
* is an invalid multibyte sequence, it will be replaced with Unicode
|
||||
* 0xFFFD (Replacement Character). */
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len)
|
||||
{
|
||||
assert(c != NULL && crep != NULL && crep_len != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) <= 0) {
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
*crep_len = bad_mbchar_len;
|
||||
strncpy(crep, bad_mbchar, *crep_len);
|
||||
} else {
|
||||
*crep_len = wctomb(crep, control_wrep(wc));
|
||||
|
||||
*crep_len = wctomb(crep, control_wrep(wc));
|
||||
|
||||
if (*crep_len <= 0) {
|
||||
wctomb(NULL, 0);
|
||||
*crep_len = 0;
|
||||
if (*crep_len < 0) {
|
||||
wctomb(NULL, 0);
|
||||
*crep_len = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
*crep_len = 1;
|
||||
*crep = control_rep(*c);
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
}
|
||||
#endif
|
||||
|
||||
return crep;
|
||||
}
|
||||
|
||||
/* c is a multibyte non-control character. We return that multibyte
|
||||
* character. If crep is an invalid multibyte sequence, it will be
|
||||
* replaced with Unicode 0xFFFD (Replacement Character). */
|
||||
char *mbrep(const char *c, char *crep, int *crep_len)
|
||||
{
|
||||
assert(c != NULL && crep != NULL && crep_len != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
|
||||
/* Reject invalid Unicode characters. */
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0 || !is_valid_unicode(wc)) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
*crep_len = bad_mbchar_len;
|
||||
strncpy(crep, bad_mbchar, *crep_len);
|
||||
} else {
|
||||
*crep_len = wctomb(crep, wc);
|
||||
|
||||
if (*crep_len < 0) {
|
||||
wctomb(NULL, 0);
|
||||
*crep_len = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
*crep_len = 1;
|
||||
*crep = *c;
|
||||
#ifdef ENABLE_UTF8
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -242,20 +285,22 @@ int mbwidth(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX), width;
|
||||
int width;
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
width = wcwidth(wc);
|
||||
|
||||
if (width == -1)
|
||||
width++;
|
||||
if (width == -1) {
|
||||
wc = bad_wchar;
|
||||
width = wcwidth(wc);
|
||||
}
|
||||
|
||||
return width;
|
||||
} else
|
||||
@@ -267,29 +312,30 @@ int mbwidth(const char *c)
|
||||
int mb_cur_max(void)
|
||||
{
|
||||
return
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
ISSET(USE_UTF8) ? MB_CUR_MAX :
|
||||
#endif
|
||||
1;
|
||||
}
|
||||
|
||||
/* Convert the value in chr to a multibyte character with the same
|
||||
* wide character value as chr, if possible. If the conversion
|
||||
/* Convert the Unicode value in chr to a multibyte character with the
|
||||
* same wide character value as chr, if possible. If the conversion
|
||||
* succeeds, return the (dynamically allocated) multibyte character and
|
||||
* its length. Otherwise, return an undefined (dynamically allocated)
|
||||
* multibyte character and a length of zero. */
|
||||
char *make_mbchar(int chr, int *chr_mb_len)
|
||||
char *make_mbchar(long chr, int *chr_mb_len)
|
||||
{
|
||||
char *chr_mb;
|
||||
|
||||
assert(chr_mb_len != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
chr_mb = charalloc(MB_CUR_MAX);
|
||||
*chr_mb_len = wctomb(chr_mb, chr);
|
||||
*chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
|
||||
|
||||
if (*chr_mb_len <= 0) {
|
||||
/* Reject invalid Unicode characters. */
|
||||
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
|
||||
wctomb(NULL, 0);
|
||||
*chr_mb_len = 0;
|
||||
}
|
||||
@@ -297,7 +343,7 @@ char *make_mbchar(int chr, int *chr_mb_len)
|
||||
#endif
|
||||
*chr_mb_len = 1;
|
||||
chr_mb = mallocstrncpy(NULL, (char *)&chr, 1);
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -306,33 +352,26 @@ char *make_mbchar(int chr, int *chr_mb_len)
|
||||
|
||||
/* Parse a multibyte character from buf. Return the number of bytes
|
||||
* used. If chr isn't NULL, store the multibyte character in it. If
|
||||
* bad_chr isn't NULL, set it to TRUE if we have a bad multibyte
|
||||
* character. If col isn't NULL, store the new display width in it. If
|
||||
* *str is '\t', we expect col to have the current display width. */
|
||||
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
|
||||
*col)
|
||||
* col isn't NULL, store the new display width in it. If *buf is '\t',
|
||||
* we expect col to have the current display width. */
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
{
|
||||
int buf_mb_len;
|
||||
|
||||
assert(buf != NULL);
|
||||
|
||||
if (bad_chr != NULL)
|
||||
*bad_chr = FALSE;
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
/* Get the number of bytes in the multibyte character. */
|
||||
buf_mb_len = mblen(buf, MB_CUR_MAX);
|
||||
|
||||
/* If buf contains a null byte or an invalid multibyte
|
||||
* character, set bad_chr to TRUE (if it contains the latter)
|
||||
* and interpret buf's first byte. */
|
||||
if (buf_mb_len <= 0) {
|
||||
/* If buf contains an invalid multibyte character, only
|
||||
* interpret buf's first byte. */
|
||||
if (buf_mb_len < 0) {
|
||||
mblen(NULL, 0);
|
||||
if (buf_mb_len < 0 && bad_chr != NULL)
|
||||
*bad_chr = TRUE;
|
||||
buf_mb_len = 1;
|
||||
}
|
||||
} else if (buf_mb_len == 0)
|
||||
buf_mb_len++;
|
||||
|
||||
/* Save the multibyte character in chr. */
|
||||
if (chr != NULL) {
|
||||
@@ -393,7 +432,7 @@ int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
|
||||
else
|
||||
(*col)++;
|
||||
}
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -411,10 +450,9 @@ size_t move_mbleft(const char *buf, size_t pos)
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. Here is the naive, O(pos) way to do it. */
|
||||
while (TRUE) {
|
||||
int buf_mb_len = parse_mbchar(buf + pos - pos_prev, NULL, NULL,
|
||||
NULL);
|
||||
int buf_mb_len = parse_mbchar(buf + pos - pos_prev, NULL, NULL);
|
||||
|
||||
if (pos_prev <= (size_t)buf_mb_len)
|
||||
if (pos_prev <= buf_mb_len)
|
||||
break;
|
||||
|
||||
pos_prev -= buf_mb_len;
|
||||
@@ -427,7 +465,7 @@ size_t move_mbleft(const char *buf, size_t pos)
|
||||
* after the one at pos. */
|
||||
size_t move_mbright(const char *buf, size_t pos)
|
||||
{
|
||||
return pos + parse_mbchar(buf + pos, NULL, NULL, NULL);
|
||||
return pos + parse_mbchar(buf + pos, NULL, NULL);
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
@@ -466,7 +504,7 @@ int nstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
* strings. */
|
||||
int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *s1_mb = charalloc(MB_CUR_MAX);
|
||||
char *s2_mb = charalloc(MB_CUR_MAX);
|
||||
@@ -478,17 +516,17 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
bool bad_s1_mb = FALSE, bad_s2_mb = FALSE;
|
||||
int s1_mb_len, s2_mb_len;
|
||||
|
||||
s1_mb_len = parse_mbchar(s1, s1_mb, NULL, NULL);
|
||||
s1_mb_len = parse_mbchar(s1, s1_mb, NULL);
|
||||
|
||||
if (mbtowc(&ws1, s1_mb, s1_mb_len) <= 0) {
|
||||
if (mbtowc(&ws1, s1_mb, s1_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws1 = (unsigned char)*s1_mb;
|
||||
bad_s1_mb = TRUE;
|
||||
}
|
||||
|
||||
s2_mb_len = parse_mbchar(s2, s2_mb, NULL, NULL);
|
||||
s2_mb_len = parse_mbchar(s2, s2_mb, NULL);
|
||||
|
||||
if (mbtowc(&ws2, s2_mb, s2_mb_len) <= 0) {
|
||||
if (mbtowc(&ws2, s2_mb, s2_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws2 = (unsigned char)*s2_mb;
|
||||
bad_s2_mb = TRUE;
|
||||
@@ -513,8 +551,31 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRCASESTR
|
||||
/* This function is equivalent to strcasestr(). It was adapted from
|
||||
* mutt's mutt_stristr() function. */
|
||||
/* This function, nstrcasestr() (originally mutt_stristr()), was adapted
|
||||
* from mutt 1.2.4i (lib.c). Here is the notice from that file, with
|
||||
* the Free Software Foundation's address updated:
|
||||
*
|
||||
* Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
|
||||
* Copyright (C) 1999-2000 Thomas Roessler <roessler@guug.de>
|
||||
*
|
||||
* 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 2 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* This function is equivalent to strcasestr(). */
|
||||
const char *nstrcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
assert(haystack != NULL && needle != NULL);
|
||||
@@ -536,7 +597,7 @@ const char *nstrcasestr(const char *haystack, const char *needle)
|
||||
/* This function is equivalent to strcasestr() for multibyte strings. */
|
||||
const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
@@ -552,17 +613,17 @@ const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
while (*q != '\0') {
|
||||
bool bad_r_mb = FALSE, bad_q_mb = FALSE;
|
||||
|
||||
r_mb_len = parse_mbchar(r, r_mb, NULL, NULL);
|
||||
r_mb_len = parse_mbchar(r, r_mb, NULL);
|
||||
|
||||
if (mbtowc(&wr, r_mb, r_mb_len) <= 0) {
|
||||
if (mbtowc(&wr, r_mb, r_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wr = (unsigned char)*r;
|
||||
bad_r_mb = TRUE;
|
||||
}
|
||||
|
||||
q_mb_len = parse_mbchar(q, q_mb, NULL, NULL);
|
||||
q_mb_len = parse_mbchar(q, q_mb, NULL);
|
||||
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wq = (unsigned char)*q;
|
||||
bad_q_mb = TRUE;
|
||||
@@ -593,7 +654,7 @@ const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
return strcasestr(haystack, needle);
|
||||
}
|
||||
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
|
||||
/* This function is equivalent to strstr(), except in that it scans the
|
||||
* string in reverse, starting at rev_start. */
|
||||
const char *revstrstr(const char *haystack, const char *needle, const
|
||||
@@ -613,9 +674,9 @@ const char *revstrstr(const char *haystack, const char *needle, const
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif /* !NANO_SMALL || !DISABLE_TABCOMP */
|
||||
#endif /* !NANO_TINY || !DISABLE_TABCOMP */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* This function is equivalent to strcasestr(), except in that it scans
|
||||
* the string in reverse, starting at rev_start. */
|
||||
const char *revstrcasestr(const char *haystack, const char *needle,
|
||||
@@ -642,7 +703,7 @@ const char *revstrcasestr(const char *haystack, const char *needle,
|
||||
const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
const char *rev_start)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
@@ -658,17 +719,17 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
while (*q != '\0') {
|
||||
bool bad_r_mb = FALSE, bad_q_mb = FALSE;
|
||||
|
||||
r_mb_len = parse_mbchar(r, r_mb, NULL, NULL);
|
||||
r_mb_len = parse_mbchar(r, r_mb, NULL);
|
||||
|
||||
if (mbtowc(&wr, r_mb, r_mb_len) <= 0) {
|
||||
if (mbtowc(&wr, r_mb, r_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wr = (unsigned char)*r;
|
||||
bad_r_mb = TRUE;
|
||||
}
|
||||
|
||||
q_mb_len = parse_mbchar(q, q_mb, NULL, NULL);
|
||||
q_mb_len = parse_mbchar(q, q_mb, NULL);
|
||||
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wq = (unsigned char)*q;
|
||||
bad_q_mb = TRUE;
|
||||
@@ -702,7 +763,7 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
#endif
|
||||
return revstrcasestr(haystack, needle, rev_start);
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* This function is equivalent to strlen() for multibyte strings. */
|
||||
size_t mbstrlen(const char *s)
|
||||
@@ -730,13 +791,13 @@ size_t mbstrnlen(const char *s, size_t maxlen)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
size_t n = 0;
|
||||
int s_mb_len;
|
||||
|
||||
while (*s != '\0') {
|
||||
s_mb_len = parse_mbchar(s, NULL, NULL, NULL);
|
||||
s_mb_len = parse_mbchar(s, NULL, NULL);
|
||||
|
||||
if (maxlen == 0)
|
||||
break;
|
||||
@@ -752,7 +813,73 @@ size_t mbstrnlen(const char *s, size_t maxlen)
|
||||
return strnlen(s, maxlen);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* This function is equivalent to strpbrk(), except in that it scans the
|
||||
* string in reverse, starting at rev_start. */
|
||||
char *revstrpbrk(const char *s, const char *accept, const char
|
||||
*rev_start)
|
||||
{
|
||||
assert(s != NULL && accept != NULL && rev_start != NULL);
|
||||
|
||||
for (; rev_start >= s; rev_start--) {
|
||||
const char *q = (*rev_start == '\0') ? NULL : strchr(accept,
|
||||
*rev_start);
|
||||
|
||||
if (q != NULL)
|
||||
return (char *)rev_start;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* This function is equivalent to strchr() for multibyte strings. */
|
||||
char *mbstrchr(const char *s, char *c)
|
||||
{
|
||||
assert(s != NULL && c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
bool bad_s_mb = FALSE, bad_c_mb = FALSE;
|
||||
char *s_mb = charalloc(MB_CUR_MAX);
|
||||
const char *q = s;
|
||||
wchar_t ws, wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
bad_c_mb = TRUE;
|
||||
}
|
||||
|
||||
while (*s != '\0') {
|
||||
int s_mb_len = parse_mbchar(s, s_mb, NULL);
|
||||
|
||||
if (mbtowc(&ws, s_mb, s_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws = (unsigned char)*s;
|
||||
bad_s_mb = TRUE;
|
||||
}
|
||||
|
||||
if (bad_s_mb == bad_c_mb && ws == wc)
|
||||
break;
|
||||
|
||||
s += s_mb_len;
|
||||
q += s_mb_len;
|
||||
}
|
||||
|
||||
free(s_mb);
|
||||
|
||||
if (*s == '\0')
|
||||
q = NULL;
|
||||
|
||||
return (char *)q;
|
||||
} else
|
||||
#endif
|
||||
return strchr(s, *c);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Return TRUE if the string s contains one or more blank characters,
|
||||
* and FALSE otherwise. */
|
||||
@@ -774,7 +901,7 @@ bool has_blank_mbchars(const char *s)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *chr_mb = charalloc(MB_CUR_MAX);
|
||||
bool retval = FALSE;
|
||||
@@ -782,7 +909,7 @@ bool has_blank_mbchars(const char *s)
|
||||
while (*s != '\0') {
|
||||
int chr_mb_len;
|
||||
|
||||
chr_mb_len = parse_mbchar(s, chr_mb, NULL, NULL);
|
||||
chr_mb_len = parse_mbchar(s, chr_mb, NULL);
|
||||
|
||||
if (is_blank_mbchar(chr_mb)) {
|
||||
retval = TRUE;
|
||||
@@ -800,51 +927,18 @@ bool has_blank_mbchars(const char *s)
|
||||
return has_blank_chars(s);
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* This function is equivalent to strchr() for multibyte strings. */
|
||||
char *mbstrchr(const char *s, char *c)
|
||||
{
|
||||
assert(s != NULL && c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *s_mb = charalloc(MB_CUR_MAX);
|
||||
const char *q = s;
|
||||
wchar_t ws, wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
while (*s != '\0') {
|
||||
int s_mb_len = parse_mbchar(s, s_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&ws, s_mb, s_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws = (unsigned char)*s;
|
||||
}
|
||||
|
||||
if (ws == wc)
|
||||
break;
|
||||
|
||||
s += s_mb_len;
|
||||
q += s_mb_len;
|
||||
}
|
||||
|
||||
free(s_mb);
|
||||
|
||||
if (ws != wc)
|
||||
q = NULL;
|
||||
|
||||
return (char *)q;
|
||||
} else
|
||||
#endif
|
||||
return strchr(s, *c);
|
||||
}
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
|
||||
bool is_valid_unicode(wchar_t wc)
|
||||
{
|
||||
return ((0 <= wc && wc <= 0x10FFFF) && (wc <= 0xD7FF || 0xE000 <=
|
||||
wc) && (wc <= 0xFDCF || 0xFDF0 <= wc) && ((wc & 0xFFFF) <=
|
||||
0xFFFD));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Check if the string s is a valid multibyte string. Return TRUE if it
|
||||
* is, and FALSE otherwise. */
|
||||
@@ -853,7 +947,7 @@ bool is_valid_mbstring(const char *s)
|
||||
assert(s != NULL);
|
||||
|
||||
return
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
ISSET(USE_UTF8) ?
|
||||
(mbstowcs(NULL, s, 0) != (size_t)-1) :
|
||||
#endif
|
||||
|
||||
144
src/color.c
144
src/color.c
@@ -2,7 +2,8 @@
|
||||
/**************************************************************************
|
||||
* color.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* Copyright (C) 2001-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -20,21 +21,15 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include "proto.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
/* For each syntax list entry, we go through the list of colors and
|
||||
* assign color pairs. */
|
||||
/* For each syntax list entry, go through the list of colors and assign
|
||||
* color pairs. */
|
||||
void set_colorpairs(void)
|
||||
{
|
||||
const syntaxtype *this_syntax = syntaxes;
|
||||
@@ -63,70 +58,147 @@ void set_colorpairs(void)
|
||||
}
|
||||
}
|
||||
|
||||
void do_colorinit(void)
|
||||
/* Initialize the color information. */
|
||||
void color_init(void)
|
||||
{
|
||||
assert(openfile != NULL);
|
||||
|
||||
if (has_colors()) {
|
||||
const colortype *tmpcolor = NULL;
|
||||
const colortype *tmpcolor;
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
bool defok;
|
||||
#endif
|
||||
|
||||
start_color();
|
||||
|
||||
/* Add in colors, if available. */
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
/* Add in colors, if available. */
|
||||
defok = (use_default_colors() != ERR);
|
||||
#endif
|
||||
|
||||
for (tmpcolor = colorstrings; tmpcolor != NULL;
|
||||
for (tmpcolor = openfile->colorstrings; tmpcolor != NULL;
|
||||
tmpcolor = tmpcolor->next) {
|
||||
short background = tmpcolor->bg;
|
||||
short foreground = tmpcolor->fg, background = tmpcolor->bg;
|
||||
if (foreground == -1) {
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
if (!defok)
|
||||
#endif
|
||||
foreground = COLOR_WHITE;
|
||||
}
|
||||
|
||||
if (background == -1)
|
||||
if (background == -1) {
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
if (!defok)
|
||||
#endif
|
||||
background = COLOR_BLACK;
|
||||
}
|
||||
|
||||
init_pair(tmpcolor->pairnum, tmpcolor->fg, background);
|
||||
init_pair(tmpcolor->pairnum, foreground, background);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "init_pair(): fg = %d, bg = %d\n",
|
||||
tmpcolor->fg, tmpcolor->bg);
|
||||
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", tmpcolor->fg, tmpcolor->bg);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the color information based on the current filename. */
|
||||
void update_color(void)
|
||||
void color_update(void)
|
||||
{
|
||||
const syntaxtype *tmpsyntax;
|
||||
colortype *tmpcolor, *defcolor = NULL;
|
||||
|
||||
colorstrings = NULL;
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
const exttype *e;
|
||||
assert(openfile != NULL);
|
||||
|
||||
for (e = tmpsyntax->extensions; e != NULL; e = e->next) {
|
||||
/* Set colorstrings if we matched the extension regex. */
|
||||
if (regexec(&e->val, filename, 0, NULL, 0) == 0)
|
||||
colorstrings = tmpsyntax->color;
|
||||
openfile->colorstrings = NULL;
|
||||
|
||||
if (colorstrings != NULL)
|
||||
/* If we specified a syntax override string, use it. */
|
||||
if (syntaxstr != NULL) {
|
||||
/* If the syntax override is "none", it's the same as not having
|
||||
* a syntax at all, so get out. */
|
||||
if (strcmp(syntaxstr, "none") == 0)
|
||||
return;
|
||||
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcmp(tmpsyntax->desc, syntaxstr) == 0)
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
|
||||
if (openfile->colorstrings != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we haven't found a match, use the override string. */
|
||||
if (colorstrings == NULL && syntaxstr != NULL) {
|
||||
/* If we didn't specify a syntax override string, or if we did and
|
||||
* there was no syntax by that name, get the syntax based on the
|
||||
* file extension. */
|
||||
if (openfile->colorstrings == NULL) {
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (mbstrcasecmp(tmpsyntax->desc, syntaxstr) == 0)
|
||||
colorstrings = tmpsyntax->color;
|
||||
exttype *e;
|
||||
|
||||
/* If this is the default syntax, it has no associated
|
||||
* extensions. (We've checked for this and for duplicate
|
||||
* syntax names elsewhere.) Skip over it here, but keep
|
||||
* track of its color regexes. */
|
||||
if (strcmp(tmpsyntax->desc, "default") == 0) {
|
||||
defcolor = syntaxes->color;
|
||||
continue;
|
||||
}
|
||||
|
||||
for (e = tmpsyntax->extensions; e != NULL; e = e->next) {
|
||||
bool not_compiled = (e->ext == NULL);
|
||||
|
||||
/* e->ext_regex has already been checked for validity
|
||||
* elsewhere. Compile its specified regex if we haven't
|
||||
* already. */
|
||||
if (not_compiled) {
|
||||
e->ext = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(e->ext, e->ext_regex, REG_EXTENDED);
|
||||
}
|
||||
|
||||
/* Set colorstrings if we matched the extension
|
||||
* regex. */
|
||||
if (regexec(e->ext, openfile->filename, 0, NULL,
|
||||
0) == 0)
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
|
||||
if (openfile->colorstrings != NULL)
|
||||
break;
|
||||
|
||||
/* Decompile e->ext_regex's specified regex if we aren't
|
||||
* going to use it. */
|
||||
if (not_compiled) {
|
||||
regfree(e->ext);
|
||||
free(e->ext);
|
||||
e->ext = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If we didn't get a syntax based on the file extension, and we
|
||||
* have a default syntax, use it. */
|
||||
if (openfile->colorstrings == NULL && defcolor != NULL)
|
||||
openfile->colorstrings = defcolor;
|
||||
|
||||
for (tmpcolor = openfile->colorstrings; tmpcolor != NULL;
|
||||
tmpcolor = tmpcolor->next) {
|
||||
/* tmpcolor->start_regex and tmpcolor->end_regex have already
|
||||
* been checked for validity elsewhere. Compile their specified
|
||||
* regexes if we haven't already. */
|
||||
if (tmpcolor->start == NULL) {
|
||||
tmpcolor->start = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(tmpcolor->start, tmpcolor->start_regex,
|
||||
REG_EXTENDED | (tmpcolor->icase ? REG_ICASE : 0));
|
||||
}
|
||||
|
||||
if (tmpcolor->end_regex != NULL && tmpcolor->end == NULL) {
|
||||
tmpcolor->end = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(tmpcolor->end, tmpcolor->end_regex,
|
||||
REG_EXTENDED | (tmpcolor->icase ? REG_ICASE : 0));
|
||||
}
|
||||
}
|
||||
do_colorinit();
|
||||
}
|
||||
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
101
src/cut.c
101
src/cut.c
@@ -2,7 +2,8 @@
|
||||
/**************************************************************************
|
||||
* cut.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -20,39 +21,40 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "proto.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
|
||||
static bool keep_cutbuffer = FALSE;
|
||||
/* Should we keep the contents of the cutbuffer? */
|
||||
static filestruct *cutbottom = NULL;
|
||||
/* Pointer to end of cutbuffer. */
|
||||
/* Pointer to the end of the cutbuffer. */
|
||||
|
||||
/* Indicate that we should no longer keep the contents of the
|
||||
* cutbuffer. */
|
||||
void cutbuffer_reset(void)
|
||||
{
|
||||
keep_cutbuffer = FALSE;
|
||||
}
|
||||
|
||||
/* If we're not on the magicline, move all the text of the current line,
|
||||
* plus the newline at the end, to the cutbuffer, and set the current
|
||||
* place we want to where the line used to start. */
|
||||
/* If we're not on the last line of the file, move all the text of the
|
||||
* current line, plus the newline at the end, to the cutbuffer. If we
|
||||
* are, move all of the text of the current line to the cutbuffer. In
|
||||
* both cases, set the current place we want to the beginning of the
|
||||
* current line. */
|
||||
void cut_line(void)
|
||||
{
|
||||
if (current->next != NULL) {
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, 0,
|
||||
current->next, 0);
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
if (openfile->current != openfile->filebot)
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current, 0,
|
||||
openfile->current->next, 0);
|
||||
else
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current, 0,
|
||||
openfile->current, strlen(openfile->current->data));
|
||||
openfile->placewewant = 0;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Move all currently marked text to the cutbuffer, and set the current
|
||||
* place we want to where the text used to start. */
|
||||
void cut_marked(void)
|
||||
@@ -64,43 +66,43 @@ void cut_marked(void)
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
|
||||
placewewant = xplustabs();
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
|
||||
/* If we're not at the end of the current line, move all the text from
|
||||
* the current cursor position to the end of the current line,
|
||||
* not counting the newline at the end, to the cutbuffer. If we are,
|
||||
* and we're not on the magicline, move the newline at the end to the
|
||||
* cutbuffer, and set the current place we want to where the newline
|
||||
* used to be. */
|
||||
* and we're not on the last line of the file, move the newline at the
|
||||
* end to the cutbuffer, and set the current place we want to where the
|
||||
* newline used to be. */
|
||||
void cut_to_eol(void)
|
||||
{
|
||||
size_t data_len = strlen(current->data);
|
||||
size_t data_len = strlen(openfile->current->data);
|
||||
|
||||
assert(current_x <= data_len);
|
||||
assert(openfile->current_x <= data_len);
|
||||
|
||||
if (current_x < data_len)
|
||||
if (openfile->current_x < data_len)
|
||||
/* If we're not at the end of the line, move all the text from
|
||||
* the current position up to it, not counting the newline at
|
||||
* the end, to the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
current, data_len);
|
||||
else if (current->next != NULL) {
|
||||
/* If we're at the end of the line, and it isn't the magicline,
|
||||
* move all the text from the current position up to the
|
||||
* beginning of the next line, i.e, the newline at the end, to
|
||||
* the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
current->next, 0);
|
||||
placewewant = xplustabs();
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->current, data_len);
|
||||
else if (openfile->current != openfile->filebot) {
|
||||
/* If we're at the end of the line, and it isn't the last line
|
||||
* of the file, move all the text from the current position up
|
||||
* to the beginning of the next line, i.e, the newline at the
|
||||
* end, to the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->current->next, 0);
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Move text from the current filestruct into the cutbuffer. */
|
||||
void do_cut_text(void)
|
||||
{
|
||||
assert(current != NULL && current->data != NULL);
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
check_statusblank();
|
||||
|
||||
@@ -119,12 +121,12 @@ void do_cut_text(void)
|
||||
* cutbuffer instead of replacing it. */
|
||||
keep_cutbuffer = TRUE;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(MARK_ISSET)) {
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set) {
|
||||
/* If the mark is on, move the marked text to the cutbuffer and
|
||||
* turn the mark off. */
|
||||
cut_marked();
|
||||
UNSET(MARK_ISSET);
|
||||
openfile->mark_set = FALSE;
|
||||
} else if (ISSET(CUT_TO_END))
|
||||
/* Otherwise, if the CUT_TO_END flag is set, move all text up to
|
||||
* the end of the line into the cutbuffer. */
|
||||
@@ -138,34 +140,35 @@ void do_cut_text(void)
|
||||
set_modified();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
dump_filestruct(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Cut from the current cursor position to the end of the file. */
|
||||
void do_cut_till_end(void)
|
||||
{
|
||||
assert(current != NULL && current->data != NULL);
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
check_statusblank();
|
||||
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
filebot, 0);
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->filebot,
|
||||
strlen(openfile->filebot->data));
|
||||
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
dump_filestruct(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Copy text from the cutbuffer into the current filestruct. */
|
||||
void do_uncut_text(void)
|
||||
{
|
||||
assert(current != NULL && current->data != NULL);
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
@@ -183,12 +186,12 @@ void do_uncut_text(void)
|
||||
|
||||
/* Set the current place we want to where the text from the
|
||||
* cutbuffer ends. */
|
||||
placewewant = xplustabs();
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer_reverse();
|
||||
dump_filestruct_reverse();
|
||||
#endif
|
||||
}
|
||||
|
||||
1808
src/files.c
1808
src/files.c
File diff suppressed because it is too large
Load Diff
560
src/global.c
560
src/global.c
File diff suppressed because it is too large
Load Diff
516
src/help.c
Normal file
516
src/help.c
Normal file
@@ -0,0 +1,516 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* help.c *
|
||||
* *
|
||||
* Copyright (C) 2000-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
|
||||
static char *help_text = NULL;
|
||||
/* The text displayed in the help window. */
|
||||
|
||||
/* Our dynamic, shortcut-list-compliant help function. */
|
||||
void do_help(void)
|
||||
{
|
||||
int line = 0;
|
||||
/* The line number in help_text of the first displayed help
|
||||
* line. This variable is zero-based. */
|
||||
bool no_more = FALSE;
|
||||
/* no_more means the end of the help text is shown, so don't go
|
||||
* down any more. */
|
||||
int kbinput = ERR;
|
||||
bool meta_key, func_key;
|
||||
|
||||
bool old_no_help = ISSET(NO_HELP);
|
||||
#ifndef DISABLE_MOUSE
|
||||
const shortcut *oldshortcut = currshortcut;
|
||||
/* We will set currshortcut to allow clicking on the help
|
||||
* screen's shortcut list. */
|
||||
#endif
|
||||
|
||||
curs_set(0);
|
||||
blank_edit();
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
blank_statusbar();
|
||||
|
||||
/* Set help_text as the string to display. */
|
||||
help_init();
|
||||
|
||||
assert(help_text != NULL);
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
/* Set currshortcut to allow clicking on the help screen's shortcut
|
||||
* list, after help_init() is called. */
|
||||
currshortcut = help_list;
|
||||
#endif
|
||||
|
||||
if (ISSET(NO_HELP)) {
|
||||
/* Make sure that the help screen's shortcut list will actually
|
||||
* be displayed. */
|
||||
UNSET(NO_HELP);
|
||||
window_init();
|
||||
}
|
||||
|
||||
bottombars(help_list);
|
||||
|
||||
do {
|
||||
int i;
|
||||
int old_line = line;
|
||||
/* We redisplay the help only if it moved. */
|
||||
const char *ptr = help_text;
|
||||
|
||||
switch (kbinput) {
|
||||
#ifndef DISABLE_MOUSE
|
||||
case KEY_MOUSE:
|
||||
{
|
||||
int mouse_x, mouse_y;
|
||||
get_mouseinput(&mouse_x, &mouse_y, TRUE);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case NANO_PREVPAGE_KEY:
|
||||
case NANO_PREVPAGE_FKEY:
|
||||
if (line > 0) {
|
||||
line -= editwinrows - 2;
|
||||
if (line < 0)
|
||||
line = 0;
|
||||
}
|
||||
break;
|
||||
case NANO_NEXTPAGE_KEY:
|
||||
case NANO_NEXTPAGE_FKEY:
|
||||
if (!no_more)
|
||||
line += editwinrows - 2;
|
||||
break;
|
||||
case NANO_PREVLINE_KEY:
|
||||
if (line > 0)
|
||||
line--;
|
||||
break;
|
||||
case NANO_NEXTLINE_KEY:
|
||||
if (!no_more)
|
||||
line++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (kbinput == NANO_REFRESH_KEY)
|
||||
/* Redraw the screen. */
|
||||
total_redraw();
|
||||
else {
|
||||
if (kbinput != ERR && line == old_line)
|
||||
goto skip_redisplay;
|
||||
|
||||
blank_edit();
|
||||
}
|
||||
|
||||
/* Calculate where in the text we should be, based on the
|
||||
* page. */
|
||||
for (i = 0; i < line; i++) {
|
||||
ptr += help_line_len(ptr);
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
|
||||
for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
|
||||
size_t j = help_line_len(ptr);
|
||||
|
||||
mvwaddnstr(edit, i, 0, ptr, j);
|
||||
ptr += j;
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
no_more = (*ptr == '\0');
|
||||
|
||||
skip_redisplay:
|
||||
kbinput = get_kbinput(edit, &meta_key, &func_key);
|
||||
} while (kbinput != NANO_EXIT_KEY && kbinput != NANO_EXIT_FKEY);
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
currshortcut = oldshortcut;
|
||||
#endif
|
||||
|
||||
if (old_no_help) {
|
||||
blank_bottombars();
|
||||
wnoutrefresh(bottomwin);
|
||||
SET(NO_HELP);
|
||||
window_init();
|
||||
} else
|
||||
bottombars(currshortcut);
|
||||
|
||||
curs_set(1);
|
||||
edit_refresh();
|
||||
|
||||
/* The help_init() at the beginning allocated help_text. Since
|
||||
* help_text has now been written to the screen, we don't need it
|
||||
* anymore. */
|
||||
free(help_text);
|
||||
help_text = NULL;
|
||||
}
|
||||
|
||||
/* This function allocates help_text, and stores the help string in it.
|
||||
* help_text should be NULL initially. */
|
||||
void help_init(void)
|
||||
{
|
||||
size_t allocsize = 0; /* Space needed for help_text. */
|
||||
const char *htx[3]; /* Untranslated help message. We break
|
||||
* it up into three chunks in case the
|
||||
* full string is too long for the
|
||||
* compiler to handle. */
|
||||
char *ptr;
|
||||
const shortcut *s;
|
||||
#ifndef NANO_TINY
|
||||
const toggle *t;
|
||||
#ifdef ENABLE_NANORC
|
||||
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
|
||||
|
||||
UNSET(WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* First, set up the initial help text for the current function. */
|
||||
if (currshortcut == whereis_list || currshortcut == replace_list ||
|
||||
currshortcut == replace_list_2) {
|
||||
htx[0] = N_("Search Command Help Text\n\n "
|
||||
"Enter the words or characters you would like to "
|
||||
"search for, and then press Enter. If there is a "
|
||||
"match for the text you entered, the screen will be "
|
||||
"updated to the location of the nearest match for the "
|
||||
"search string.\n\n The previous search string will be "
|
||||
"shown in brackets after the search prompt. Hitting "
|
||||
"Enter without entering any text will perform the "
|
||||
"previous search. ");
|
||||
htx[1] = N_("If you have selected text with the mark and then "
|
||||
"search to replace, only matches in the selected text "
|
||||
"will be replaced.\n\n The following function keys are "
|
||||
"available in Search mode:\n\n");
|
||||
htx[2] = NULL;
|
||||
} else if (currshortcut == gotoline_list) {
|
||||
htx[0] = N_("Go To Line Help Text\n\n "
|
||||
"Enter the line number that you wish to go to and hit "
|
||||
"Enter. If there are fewer lines of text than the "
|
||||
"number you entered, you will be brought to the last "
|
||||
"line of the file.\n\n The following function keys are "
|
||||
"available in Go To Line mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
} else if (currshortcut == insertfile_list) {
|
||||
htx[0] = N_("Insert File Help Text\n\n "
|
||||
"Type in the name of a file to be inserted into the "
|
||||
"current file buffer at the current cursor "
|
||||
"location.\n\n If you have compiled nano with multiple "
|
||||
"file buffer support, and enable multiple file buffers "
|
||||
"with the -F or --multibuffer command line flags, the "
|
||||
"Meta-F toggle, or a nanorc file, inserting a file "
|
||||
"will cause it to be loaded into a separate buffer "
|
||||
"(use Meta-< and > to switch between file buffers). ");
|
||||
htx[1] = N_("If you need another blank buffer, do not enter "
|
||||
"any filename, or type in a nonexistent filename at "
|
||||
"the prompt and press Enter.\n\n The following "
|
||||
"function keys are available in Insert File mode:\n\n");
|
||||
htx[2] = NULL;
|
||||
} else if (currshortcut == writefile_list) {
|
||||
htx[0] = N_("Write File Help Text\n\n "
|
||||
"Type the name that you wish to save the current file "
|
||||
"as and press Enter to save the file.\n\n If you have "
|
||||
"selected text with the mark, you will be prompted to "
|
||||
"save only the selected portion to a separate file. To "
|
||||
"reduce the chance of overwriting the current file with "
|
||||
"just a portion of it, the current filename is not the "
|
||||
"default in this mode.\n\n The following function keys "
|
||||
"are available in Write File mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#ifndef DISABLE_BROWSER
|
||||
else if (currshortcut == browser_list) {
|
||||
htx[0] = N_("File Browser Help Text\n\n "
|
||||
"The file browser is used to visually browse the "
|
||||
"directory structure to select a file for reading "
|
||||
"or writing. You may use the arrow keys or Page Up/"
|
||||
"Down to browse through the files, and S or Enter to "
|
||||
"choose the selected file or enter the selected "
|
||||
"directory. To move up one level, select the "
|
||||
"directory called \"..\" at the top of the file "
|
||||
"list.\n\n The following function keys are available "
|
||||
"in the file browser:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
} else if (currshortcut == gotodir_list) {
|
||||
htx[0] = N_("Browser Go To Directory Help Text\n\n "
|
||||
"Enter the name of the directory you would like to "
|
||||
"browse to.\n\n If tab completion has not been "
|
||||
"disabled, you can use the Tab key to (attempt to) "
|
||||
"automatically complete the directory name.\n\n The "
|
||||
"following function keys are available in Browser Go "
|
||||
"To Directory mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
else if (currshortcut == spell_list) {
|
||||
htx[0] = N_("Spell Check Help Text\n\n "
|
||||
"The spell checker checks the spelling of all text in "
|
||||
"the current file. When an unknown word is "
|
||||
"encountered, it is highlighted and a replacement can "
|
||||
"be edited. It will then prompt to replace every "
|
||||
"instance of the given misspelled word in the current "
|
||||
"file, or, if you have selected text with the mark, in "
|
||||
"the selected text.\n\n The following other functions "
|
||||
"are available in Spell Check mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
else if (currshortcut == extcmd_list) {
|
||||
htx[0] = N_("Execute Command Help Text\n\n "
|
||||
"This menu allows you to insert the output of a "
|
||||
"command run by the shell into the current buffer (or "
|
||||
"a new buffer in multiple file buffer mode). If you "
|
||||
"need another blank buffer, do not enter any "
|
||||
"command.\n\n The following keys are available in "
|
||||
"Execute Command mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
/* Default to the main help list. */
|
||||
htx[0] = N_(" nano help text\n\n "
|
||||
"The nano editor is designed to emulate the "
|
||||
"functionality and ease-of-use of the UW Pico text "
|
||||
"editor. There are four main sections of the editor. "
|
||||
"The top line shows the program version, the current "
|
||||
"filename being edited, and whether or not the file "
|
||||
"has been modified. Next is the main editor window "
|
||||
"showing the file being edited. The status line is "
|
||||
"the third line from the bottom and shows important "
|
||||
"messages. The bottom two lines show the most "
|
||||
"commonly used shortcuts in the editor.\n\n ");
|
||||
htx[1] = N_("The notation for shortcuts is as follows: "
|
||||
"Control-key sequences are notated with a caret (^) "
|
||||
"symbol and can be entered either by using the Control "
|
||||
"(Ctrl) key or pressing the Escape (Esc) key twice. "
|
||||
"Escape-key sequences are notated with the Meta (M) "
|
||||
"symbol and can be entered using either the Esc, Alt, "
|
||||
"or Meta key depending on your keyboard setup. ");
|
||||
htx[2] = N_("Also, pressing Esc twice and then typing a "
|
||||
"three-digit decimal number from 000 to 255 will enter "
|
||||
"the character with the corresponding value. The "
|
||||
"following keystrokes are available in the main editor "
|
||||
"window. Alternative keys are shown in "
|
||||
"parentheses:\n\n");
|
||||
}
|
||||
|
||||
htx[0] = _(htx[0]);
|
||||
if (htx[1] != NULL)
|
||||
htx[1] = _(htx[1]);
|
||||
if (htx[2] != NULL)
|
||||
htx[2] = _(htx[2]);
|
||||
|
||||
allocsize += strlen(htx[0]);
|
||||
if (htx[1] != NULL)
|
||||
allocsize += strlen(htx[1]);
|
||||
if (htx[2] != NULL)
|
||||
allocsize += strlen(htx[2]);
|
||||
|
||||
/* The space needed for the shortcut lists, at most COLS characters,
|
||||
* plus '\n'. */
|
||||
allocsize += (COLS < 24 ? (24 * mb_cur_max()) :
|
||||
((COLS + 1) * mb_cur_max())) * length_of_list(currshortcut);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we're on the main list, we also count the toggle help text.
|
||||
* Each line has "M-%c\t\t\t", which fills 24 columns, plus a space,
|
||||
* plus translated text, plus '\n'. */
|
||||
if (currshortcut == main_list) {
|
||||
size_t endis_len = strlen(_("enable/disable"));
|
||||
|
||||
for (t = toggles; t != NULL; t = t->next)
|
||||
allocsize += 8 + strlen(t->desc) + endis_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* help_text has been freed and set to NULL unless the user resized
|
||||
* while in the help screen. */
|
||||
if (help_text != NULL)
|
||||
free(help_text);
|
||||
|
||||
/* Allocate space for the help text. */
|
||||
help_text = charalloc(allocsize + 1);
|
||||
|
||||
/* Now add the text we want. */
|
||||
strcpy(help_text, htx[0]);
|
||||
if (htx[1] != NULL)
|
||||
strcat(help_text, htx[1]);
|
||||
if (htx[2] != NULL)
|
||||
strcat(help_text, htx[2]);
|
||||
|
||||
ptr = help_text + strlen(help_text);
|
||||
|
||||
/* Now add our shortcut info. Assume that each shortcut has, at the
|
||||
* very least, an equivalent control key, an equivalent primary meta
|
||||
* key sequence, or both. Also assume that the meta key values are
|
||||
* not control characters. We can display a maximum of 3 shortcut
|
||||
* entries. */
|
||||
for (s = currshortcut; s != NULL; s = s->next) {
|
||||
int entries = 0;
|
||||
|
||||
/* Control key. */
|
||||
if (s->ctrlval != NANO_NO_KEY) {
|
||||
entries++;
|
||||
/* Yucky sentinel values that we can't handle a better
|
||||
* way. */
|
||||
if (s->ctrlval == NANO_CONTROL_SPACE) {
|
||||
char *space_ptr = display_string(_("Space"), 0, 6,
|
||||
FALSE);
|
||||
|
||||
ptr += sprintf(ptr, "^%s", space_ptr);
|
||||
|
||||
free(space_ptr);
|
||||
} else if (s->ctrlval == NANO_CONTROL_8)
|
||||
ptr += sprintf(ptr, "^?");
|
||||
/* Normal values. */
|
||||
else
|
||||
ptr += sprintf(ptr, "^%c", s->ctrlval + 64);
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
|
||||
/* Function key. */
|
||||
if (s->funcval != NANO_NO_KEY) {
|
||||
entries++;
|
||||
/* If this is the first entry, put it in the middle. */
|
||||
if (entries == 1) {
|
||||
entries++;
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
ptr += sprintf(ptr, "(F%d)", s->funcval - KEY_F0);
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
|
||||
/* Primary meta key sequence. If it's the first entry, don't
|
||||
* put parentheses around it. */
|
||||
if (s->metaval != NANO_NO_KEY) {
|
||||
entries++;
|
||||
/* If this is the last entry, put it at the end. */
|
||||
if (entries == 2 && s->miscval == NANO_NO_KEY) {
|
||||
entries++;
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
/* Yucky sentinel values that we can't handle a better
|
||||
* way. */
|
||||
if (s->metaval == NANO_ALT_SPACE && entries == 1) {
|
||||
char *space_ptr = display_string(_("Space"), 0, 5,
|
||||
FALSE);
|
||||
|
||||
ptr += sprintf(ptr, "M-%s", space_ptr);
|
||||
|
||||
free(space_ptr);
|
||||
} else
|
||||
/* Normal values. */
|
||||
ptr += sprintf(ptr, (entries == 1) ? "M-%c" : "(M-%c)",
|
||||
toupper(s->metaval));
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
|
||||
/* Miscellaneous meta key sequence. */
|
||||
if (entries < 3 && s->miscval != NANO_NO_KEY) {
|
||||
entries++;
|
||||
/* If this is the last entry, put it at the end. */
|
||||
if (entries == 2) {
|
||||
entries++;
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
ptr += sprintf(ptr, "(M-%c)", toupper(s->miscval));
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
|
||||
/* Make sure all the help text starts at the same place. */
|
||||
while (entries < 3) {
|
||||
entries++;
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
|
||||
assert(s->help != NULL);
|
||||
|
||||
if (COLS > 24) {
|
||||
char *help_ptr = display_string(s->help, 0, COLS - 24,
|
||||
FALSE);
|
||||
|
||||
ptr += sprintf(ptr, help_ptr);
|
||||
|
||||
free(help_ptr);
|
||||
}
|
||||
|
||||
ptr += sprintf(ptr, "\n");
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* And the toggles... */
|
||||
if (currshortcut == main_list) {
|
||||
for (t = toggles; t != NULL; t = t->next) {
|
||||
|
||||
assert(t->desc != NULL);
|
||||
|
||||
ptr += sprintf(ptr, "M-%c\t\t\t%s %s\n", toupper(t->val),
|
||||
t->desc, _("enable/disable"));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
if (old_whitespace)
|
||||
SET(WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If all went well, we didn't overwrite the allocated space for
|
||||
* help_text. */
|
||||
assert(strlen(help_text) <= allocsize + 1);
|
||||
}
|
||||
|
||||
/* Calculate the next line of help_text, starting at ptr. */
|
||||
size_t help_line_len(const char *ptr)
|
||||
{
|
||||
int help_cols = (COLS > 24) ? COLS - 8 : 24;
|
||||
|
||||
/* Try to break the line at (COLS - 8) columns if we have more than
|
||||
* 24 columns, and at 24 columns otherwise. */
|
||||
size_t retval = break_line(ptr, help_cols, TRUE);
|
||||
size_t retval_save = retval;
|
||||
|
||||
/* Get the length of the entire line up to a null or a newline. */
|
||||
while (*(ptr + retval) != '\0' && *(ptr + retval) != '\n')
|
||||
retval += move_mbright(ptr + retval, 0);
|
||||
|
||||
/* If the entire line doesn't go more than 8 columns beyond where we
|
||||
* tried to break it, we should display it as-is. Otherwise, we
|
||||
* should display it only up to the break. */
|
||||
if (strnlenpt(ptr, retval) > help_cols + 8)
|
||||
retval = retval_save;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif /* !DISABLE_HELP */
|
||||
767
src/move.c
767
src/move.c
@@ -2,7 +2,8 @@
|
||||
/**************************************************************************
|
||||
* move.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -20,272 +21,654 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* Move to the first line of the file. */
|
||||
void do_first_line(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
current = fileage;
|
||||
placewewant = 0;
|
||||
current_x = 0;
|
||||
if (edittop != fileage || need_vertical_update(pww_save))
|
||||
edit_update(TOP);
|
||||
const filestruct *current_save = openfile->current;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
openfile->current = openfile->fileage;
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
|
||||
edit_redraw(current_save, pww_save);
|
||||
}
|
||||
|
||||
/* Move to the last line of the file. */
|
||||
void do_last_line(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
current = filebot;
|
||||
placewewant = 0;
|
||||
current_x = 0;
|
||||
if (edittop->lineno + (editwinrows / 2) != filebot->lineno ||
|
||||
need_vertical_update(pww_save))
|
||||
edit_update(CENTER);
|
||||
}
|
||||
const filestruct *current_save = openfile->current;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
void do_home(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(SMART_HOME)) {
|
||||
size_t current_x_save = current_x;
|
||||
|
||||
current_x = indent_length(current->data);
|
||||
|
||||
if (current_x == current_x_save ||
|
||||
current->data[current_x] == '\0')
|
||||
current_x = 0;
|
||||
|
||||
placewewant = xplustabs();
|
||||
} else {
|
||||
#endif
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
check_statusblank();
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_end(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
current_x = strlen(current->data);
|
||||
placewewant = xplustabs();
|
||||
check_statusblank();
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
|
||||
openfile->current = openfile->filebot;
|
||||
openfile->current_x = strlen(openfile->filebot->data);
|
||||
openfile->placewewant = xplustabs();
|
||||
openfile->current_y = editwinrows - 1;
|
||||
|
||||
edit_redraw(current_save, pww_save);
|
||||
}
|
||||
|
||||
/* Move up one page. */
|
||||
void do_page_up(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
const filestruct *current_save = current;
|
||||
int i;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
/* If the first line of the file is onscreen, move current up there
|
||||
* and put the cursor at the beginning of the line. */
|
||||
if (edittop == fileage) {
|
||||
current = fileage;
|
||||
placewewant = 0;
|
||||
} else {
|
||||
edit_scroll(UP, editwinrows - 2);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* If we're in smooth scrolling mode and there's at least one
|
||||
* page of text left, move the current line of the edit window
|
||||
* up a page. */
|
||||
if (ISSET(SMOOTH_SCROLL) && current->lineno > editwinrows - 2) {
|
||||
int i;
|
||||
for (i = 0; i < editwinrows - 2; i++)
|
||||
current = current->prev;
|
||||
}
|
||||
/* If we're not in smooth scrolling mode or there isn't at least
|
||||
* one page of text left, put the cursor at the beginning of the
|
||||
* top line of the edit window, as Pico does. */
|
||||
else {
|
||||
#endif
|
||||
current = edittop;
|
||||
placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
/* If there's less than a page of text left on the screen, put the
|
||||
* cursor at the beginning of the first line of the file, and then
|
||||
* update the edit window. */
|
||||
if (openfile->current->lineno <= editwinrows - 2) {
|
||||
do_first_line();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the equivalent x-coordinate of the new line. */
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
/* If we're not in smooth scrolling mode, put the cursor at the
|
||||
* beginning of the top line of the edit window, as Pico does. */
|
||||
#ifndef NANO_TINY
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
#endif
|
||||
openfile->current = openfile->edittop;
|
||||
openfile->placewewant = 0;
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(current_save, pww_save);
|
||||
for (i = editwinrows - 2; i > 0 && openfile->current !=
|
||||
openfile->fileage; i--)
|
||||
openfile->current = openfile->current->prev;
|
||||
|
||||
check_statusblank();
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window up a page. */
|
||||
edit_scroll(UP, editwinrows - 2);
|
||||
}
|
||||
|
||||
/* Move down one page. */
|
||||
void do_page_down(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
const filestruct *current_save = current;
|
||||
int i;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
/* If the last line of the file is onscreen, move current down
|
||||
* there and put the cursor at the beginning of the line. */
|
||||
if (edittop->lineno + editwinrows > filebot->lineno) {
|
||||
current = filebot;
|
||||
placewewant = 0;
|
||||
} else {
|
||||
edit_scroll(DOWN, editwinrows - 2);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* If we're in smooth scrolling mode and there's at least one
|
||||
* page of text left, move the current line of the edit window
|
||||
* down a page. */
|
||||
if (ISSET(SMOOTH_SCROLL) && current->lineno + editwinrows - 2 <=
|
||||
filebot->lineno) {
|
||||
int i;
|
||||
for (i = 0; i < editwinrows - 2; i++)
|
||||
current = current->next;
|
||||
}
|
||||
/* If we're not in smooth scrolling mode or there isn't at least
|
||||
* one page of text left, put the cursor at the beginning of the
|
||||
* top line of the edit window, as Pico does. */
|
||||
else {
|
||||
#endif
|
||||
current = edittop;
|
||||
placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
/* If there's less than a page of text left on the screen, put the
|
||||
* cursor at the beginning of the last line of the file, and then
|
||||
* update the edit window. */
|
||||
if (openfile->current->lineno + editwinrows - 2 >=
|
||||
openfile->filebot->lineno) {
|
||||
do_last_line();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the equivalent x-coordinate of the new line. */
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
/* If we're not in smooth scrolling mode, put the cursor at the
|
||||
* beginning of the top line of the edit window, as Pico does. */
|
||||
#ifndef NANO_TINY
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
#endif
|
||||
openfile->current = openfile->edittop;
|
||||
openfile->placewewant = 0;
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(current_save, pww_save);
|
||||
for (i = editwinrows - 2; i > 0 && openfile->current !=
|
||||
openfile->filebot; i--)
|
||||
openfile->current = openfile->current->next;
|
||||
|
||||
check_statusblank();
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window down a page. */
|
||||
edit_scroll(DOWN, editwinrows - 2);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Move up to the beginning of the last beginning-of-paragraph line
|
||||
* before the current line. If allow_update is TRUE, update the screen
|
||||
* afterwards. */
|
||||
void do_para_begin(bool allow_update)
|
||||
{
|
||||
const filestruct *current_save = openfile->current;
|
||||
const size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
if (openfile->current != openfile->fileage) {
|
||||
do {
|
||||
openfile->current = openfile->current->prev;
|
||||
openfile->current_y--;
|
||||
} while (!begpar(openfile->current));
|
||||
}
|
||||
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
|
||||
if (allow_update)
|
||||
edit_redraw(current_save, pww_save);
|
||||
}
|
||||
|
||||
/* Move up to the beginning of the last beginning-of-paragraph line
|
||||
* before the current line, and update the screen afterwards. */
|
||||
void do_para_begin_void(void)
|
||||
{
|
||||
do_para_begin(TRUE);
|
||||
}
|
||||
|
||||
/* Move down to the beginning of the last line of the current paragraph.
|
||||
* Then move down one line farther if there is such a line, or to the
|
||||
* end of the current line if not. If allow_update is TRUE, update the
|
||||
* screen afterwards. A line is the last line of a paragraph if it is
|
||||
* in a paragraph, and the next line either is the beginning line of a
|
||||
* paragraph or isn't in a paragraph. */
|
||||
void do_para_end(bool allow_update)
|
||||
{
|
||||
const filestruct *const current_save = openfile->current;
|
||||
const size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
while (openfile->current != openfile->filebot &&
|
||||
!inpar(openfile->current))
|
||||
openfile->current = openfile->current->next;
|
||||
|
||||
while (openfile->current != openfile->filebot &&
|
||||
inpar(openfile->current->next) &&
|
||||
!begpar(openfile->current->next)) {
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_y++;
|
||||
}
|
||||
|
||||
if (openfile->current != openfile->filebot) {
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
} else {
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
|
||||
if (allow_update)
|
||||
edit_redraw(current_save, pww_save);
|
||||
}
|
||||
|
||||
/* Move down to the beginning of the last line of the current paragraph.
|
||||
* Then move down one line farther if there is such a line, or to the
|
||||
* end of the current line if not, and update the screen afterwards. */
|
||||
void do_para_end_void(void)
|
||||
{
|
||||
do_para_end(TRUE);
|
||||
}
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Move to the next word in the file. If allow_punct is TRUE, treat
|
||||
* punctuation as part of a word. If allow_update is TRUE, update the
|
||||
* screen afterwards. Return TRUE if we started on a word, and FALSE
|
||||
* otherwise. */
|
||||
bool do_next_word(bool allow_punct, bool allow_update)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
const filestruct *current_save = openfile->current;
|
||||
char *char_mb;
|
||||
int char_mb_len;
|
||||
bool end_line = FALSE, started_on_word = FALSE;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
check_statusblank();
|
||||
|
||||
char_mb = charalloc(mb_cur_max());
|
||||
|
||||
/* Move forward until we find the character after the last letter of
|
||||
* the current word. */
|
||||
while (!end_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving forward through the current
|
||||
* line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
/* If we haven't found it, then we've started on a word, so set
|
||||
* started_on_word to TRUE. */
|
||||
started_on_word = TRUE;
|
||||
|
||||
if (openfile->current->data[openfile->current_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
openfile->current_x += char_mb_len;
|
||||
}
|
||||
|
||||
/* Move forward until we find the first letter of the next word. */
|
||||
if (openfile->current->data[openfile->current_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
openfile->current_x += char_mb_len;
|
||||
|
||||
for (; openfile->current != NULL;
|
||||
openfile->current = openfile->current->next) {
|
||||
while (!end_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving forward through the
|
||||
* current line. */
|
||||
if (is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
if (openfile->current->data[openfile->current_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
openfile->current_x += char_mb_len;
|
||||
}
|
||||
|
||||
/* If we've found it, stop moving forward to the beginnings of
|
||||
* subsequent lines. */
|
||||
if (!end_line)
|
||||
break;
|
||||
|
||||
if (openfile->current != openfile->filebot) {
|
||||
end_line = FALSE;
|
||||
openfile->current_x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
free(char_mb);
|
||||
|
||||
/* If we haven't found it, leave the cursor at the end of the
|
||||
* file. */
|
||||
if (openfile->current == NULL)
|
||||
openfile->current = openfile->filebot;
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update)
|
||||
edit_redraw(current_save, pww_save);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
return started_on_word;
|
||||
}
|
||||
|
||||
/* Move to the next word in the file, treating punctuation as part of a
|
||||
* word if the WORD_BOUNDS flag is set, and update the screen
|
||||
* afterwards. */
|
||||
void do_next_word_void(void)
|
||||
{
|
||||
do_next_word(ISSET(WORD_BOUNDS), TRUE);
|
||||
}
|
||||
|
||||
/* Move to the previous word in the file. If allow_punct is TRUE, treat
|
||||
* punctuation as part of a word. If allow_update is TRUE, update the
|
||||
* screen afterwards. Return TRUE if we started on a word, and FALSE
|
||||
* otherwise. */
|
||||
bool do_prev_word(bool allow_punct, bool allow_update)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
const filestruct *current_save = openfile->current;
|
||||
char *char_mb;
|
||||
int char_mb_len;
|
||||
bool begin_line = FALSE, started_on_word = FALSE;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
check_statusblank();
|
||||
|
||||
char_mb = charalloc(mb_cur_max());
|
||||
|
||||
/* Move backward until we find the character before the first letter
|
||||
* of the current word. */
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the current
|
||||
* line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
/* If we haven't found it, then we've started on a word, so set
|
||||
* started_on_word to TRUE. */
|
||||
started_on_word = TRUE;
|
||||
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
/* Move backward until we find the last letter of the previous
|
||||
* word. */
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
|
||||
for (; openfile->current != NULL;
|
||||
openfile->current = openfile->current->prev) {
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the
|
||||
* current line. */
|
||||
if (is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x =
|
||||
move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
/* If we've found it, stop moving backward to the ends of
|
||||
* previous lines. */
|
||||
if (!begin_line)
|
||||
break;
|
||||
|
||||
if (openfile->current != openfile->fileage) {
|
||||
begin_line = FALSE;
|
||||
openfile->current_x = strlen(openfile->current->prev->data);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we haven't found it, leave the cursor at the beginning of the
|
||||
* file. */
|
||||
if (openfile->current == NULL)
|
||||
openfile->current = openfile->fileage;
|
||||
/* If we've found it, move backward until we find the character
|
||||
* before the first letter of the previous word. */
|
||||
else if (!begin_line) {
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the
|
||||
* current line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x =
|
||||
move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
/* If we've found it, move forward to the first letter of the
|
||||
* previous word. */
|
||||
if (!begin_line)
|
||||
openfile->current_x += char_mb_len;
|
||||
}
|
||||
|
||||
free(char_mb);
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update)
|
||||
edit_redraw(current_save, pww_save);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
return started_on_word;
|
||||
}
|
||||
|
||||
/* Move to the previous word in the file, treating punctuation as part
|
||||
* of a word if the WORD_BOUNDS flag is set, and update the screen
|
||||
* afterwards. */
|
||||
void do_prev_word_void(void)
|
||||
{
|
||||
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Move to the beginning of the current line. If the SMART_HOME flag is
|
||||
* set, move to the first non-whitespace character of the current line
|
||||
* if we're not already there, or to the beginning of the current line
|
||||
* if we are. */
|
||||
void do_home(void)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SMART_HOME)) {
|
||||
size_t current_x_save = openfile->current_x;
|
||||
|
||||
openfile->current_x = indent_length(openfile->current->data);
|
||||
|
||||
if (openfile->current_x == current_x_save ||
|
||||
openfile->current->data[openfile->current_x] == '\0')
|
||||
openfile->current_x = 0;
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
} else {
|
||||
#endif
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
/* Move to the end of the current line. */
|
||||
void do_end(void)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
/* Move up one line. */
|
||||
void do_up(void)
|
||||
{
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statusblank();
|
||||
|
||||
if (current->prev == NULL)
|
||||
/* If we're at the top of the file, get out. */
|
||||
if (openfile->current == openfile->fileage)
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
||||
|
||||
current = current->prev;
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
/* Move the current line of the edit window up. */
|
||||
openfile->current = openfile->current->prev;
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* If we're on the first row of the edit window, scroll up one line
|
||||
* if we're in smooth scrolling mode, or up half a page if we're
|
||||
* not. */
|
||||
if (current_y == 0)
|
||||
/* If we're on the first line of the edit window, scroll the edit
|
||||
* window up one line if we're in smooth scrolling mode, or up half
|
||||
* a page if we're not. */
|
||||
if (openfile->current_y == 0)
|
||||
edit_scroll(UP,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
|
||||
/* Update the lines left alone by edit_scroll(): the line we were on
|
||||
* before and the line we're on now. The former needs to be redrawn
|
||||
* if we're not on the first page, and the latter needs to be
|
||||
* drawn. */
|
||||
if (need_vertical_update(0))
|
||||
update_line(current->next, 0);
|
||||
update_line(current, current_x);
|
||||
/* Update the line we were on before and the line we're on now. The
|
||||
* former needs to be redrawn if we're not on the first page, and
|
||||
* the latter needs to be drawn unconditionally. */
|
||||
else {
|
||||
if (need_vertical_update(0))
|
||||
update_line(openfile->current->next, 0);
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Scroll up one line without scrolling the cursor. */
|
||||
void do_scroll_up(void)
|
||||
{
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
/* If the top of the file is onscreen, get out. */
|
||||
if (openfile->edittop == openfile->fileage)
|
||||
return;
|
||||
|
||||
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
||||
|
||||
/* Move the current line of the edit window up. */
|
||||
openfile->current = openfile->current->prev;
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window up one line. */
|
||||
edit_scroll(UP, 1);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Move down one line. */
|
||||
void do_down(void)
|
||||
{
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statusblank();
|
||||
|
||||
if (current->next == NULL)
|
||||
/* If we're at the bottom of the file, get out. */
|
||||
if (openfile->current == openfile->filebot)
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
||||
|
||||
current = current->next;
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
/* Move the current line of the edit window down. */
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* If we're on the last row of the edit window, scroll down one line
|
||||
* if we're in smooth scrolling mode, or down half a page if we're
|
||||
* not. */
|
||||
if (current_y == editwinrows - 1)
|
||||
/* If we're on the last line of the edit window, scroll the edit
|
||||
* window down one line if we're in smooth scrolling mode, or down
|
||||
* half a page if we're not. */
|
||||
if (openfile->current_y == editwinrows - 1)
|
||||
edit_scroll(DOWN,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
|
||||
/* Update the lines left alone by edit_scroll(): the line we were on
|
||||
* before and the line we're on now. The former needs to be redrawn
|
||||
* if we're not on the first page, and the latter needs to be
|
||||
* drawn. */
|
||||
if (need_vertical_update(0))
|
||||
update_line(current->prev, 0);
|
||||
update_line(current, current_x);
|
||||
/* Update the line we were on before and the line we're on now. The
|
||||
* former needs to be redrawn if we're not on the first page, and
|
||||
* the latter needs to be drawn unconditionally. */
|
||||
else {
|
||||
if (need_vertical_update(0))
|
||||
update_line(openfile->current->prev, 0);
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
}
|
||||
|
||||
void do_left(bool allow_update)
|
||||
#ifndef NANO_TINY
|
||||
/* Scroll down one line without scrolling the cursor. */
|
||||
void do_scroll_down(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
if (current_x > 0)
|
||||
current_x = move_mbleft(current->data, current_x);
|
||||
else if (current != fileage) {
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
/* If we're at the bottom of the file, get out. */
|
||||
if (openfile->current == openfile->filebot)
|
||||
return;
|
||||
|
||||
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
||||
|
||||
/* Move the current line of the edit window down. */
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window down one line. */
|
||||
edit_scroll(DOWN, 1);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Move left one character. */
|
||||
void do_left(void)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
if (openfile->current_x > 0)
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
else if (openfile->current != openfile->fileage) {
|
||||
do_up();
|
||||
current_x = strlen(current->data);
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
/* Move right one character. */
|
||||
void do_right(void)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
if (allow_update && need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_left_void(void)
|
||||
{
|
||||
do_left(TRUE);
|
||||
}
|
||||
assert(openfile->current_x <= strlen(openfile->current->data));
|
||||
|
||||
void do_right(bool allow_update)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
assert(current_x <= strlen(current->data));
|
||||
|
||||
if (current->data[current_x] != '\0')
|
||||
current_x = move_mbright(current->data, current_x);
|
||||
else if (current->next != NULL) {
|
||||
if (openfile->current->data[openfile->current_x] != '\0')
|
||||
openfile->current_x = move_mbright(openfile->current->data,
|
||||
openfile->current_x);
|
||||
else if (openfile->current != openfile->filebot) {
|
||||
do_down();
|
||||
current_x = 0;
|
||||
openfile->current_x = 0;
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
check_statusblank();
|
||||
if (allow_update && need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_right_void(void)
|
||||
{
|
||||
do_right(TRUE);
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
3698
src/nano.c
3698
src/nano.c
File diff suppressed because it is too large
Load Diff
379
src/nano.h
379
src/nano.h
@@ -2,7 +2,8 @@
|
||||
/**************************************************************************
|
||||
* nano.h *
|
||||
* *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -63,15 +64,17 @@
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLANG
|
||||
/* Slang support enabled. */
|
||||
/* Slang support. */
|
||||
#include <slcurses.h>
|
||||
/* Slang curses emulation brain damage, part 2: Slang doesn't define the
|
||||
* curses equivalents of the Insert or Delete keys. */
|
||||
#define KEY_DC SL_KEY_DELETE
|
||||
#define KEY_IC SL_KEY_IC
|
||||
/* Ncurses support. */
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
#include <ncurses.h>
|
||||
#else /* Uh oh. */
|
||||
#else
|
||||
/* Curses support. */
|
||||
#include <curses.h>
|
||||
#endif /* CURSES_H */
|
||||
|
||||
@@ -90,19 +93,20 @@
|
||||
/* Mark a string that will be sent to gettext() later. */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
/* If no snprintf() or vsnprintf(), use the versions from glib 2.x. */
|
||||
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
|
||||
#include <glib.h>
|
||||
#ifndef HAVE_SNPRINTF
|
||||
#define snprintf g_snprintf
|
||||
#endif
|
||||
/* If no vsnprintf(), use the version from glib 2.x. */
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
#include <glib.h>
|
||||
#define vsnprintf g_vsnprintf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If no isblank(), iswblank(), strcasecmp(), strncasecmp(),
|
||||
* strcasestr(), strnlen(), getdelim(), or getline(), use the versions
|
||||
@@ -134,6 +138,12 @@
|
||||
|
||||
#define VERMSG "GNU nano " VERSION
|
||||
|
||||
/* If we don't have regex support, turn the color support off, as it
|
||||
* depends on the use of regexes. */
|
||||
#ifndef HAVE_REGEX_H
|
||||
#undef ENABLE_COLOR
|
||||
#endif
|
||||
|
||||
/* If we aren't using ncurses, turn the mouse support off, as it's
|
||||
* ncurses-specific. */
|
||||
#ifndef NCURSES_MOUSE_VERSION
|
||||
@@ -150,160 +160,219 @@ typedef enum {
|
||||
} file_format;
|
||||
|
||||
typedef enum {
|
||||
UP, DOWN
|
||||
} updown;
|
||||
OVERWRITE, APPEND, PREPEND
|
||||
} append_type;
|
||||
|
||||
typedef enum {
|
||||
TOP, CENTER, NONE
|
||||
} topmidnone;
|
||||
UP, DOWN
|
||||
} scroll_dir;
|
||||
|
||||
typedef enum {
|
||||
CENTER, NONE
|
||||
} update_type;
|
||||
|
||||
/* Structure types. */
|
||||
typedef struct filestruct {
|
||||
char *data;
|
||||
struct filestruct *next; /* Next node. */
|
||||
struct filestruct *prev; /* Previous node. */
|
||||
ssize_t lineno; /* The line number. */
|
||||
/* The text of this line. */
|
||||
ssize_t lineno;
|
||||
/* The number of this line. */
|
||||
struct filestruct *next;
|
||||
/* Next node. */
|
||||
struct filestruct *prev;
|
||||
/* Previous node. */
|
||||
} filestruct;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
typedef struct openfilestruct {
|
||||
char *filename;
|
||||
#ifndef NANO_SMALL
|
||||
struct stat originalfilestat;
|
||||
#endif
|
||||
struct openfilestruct *next;
|
||||
/* Next node. */
|
||||
struct openfilestruct *prev;
|
||||
/* Previous node. */
|
||||
filestruct *fileage; /* Current file. */
|
||||
filestruct *filebot; /* Current file's last line. */
|
||||
filestruct *edittop; /* Current top of edit window. */
|
||||
filestruct *current; /* Current file's line. */
|
||||
#ifndef NANO_SMALL
|
||||
filestruct *mark_beginbuf;
|
||||
/* Current file's beginning marked
|
||||
* line. */
|
||||
size_t mark_beginx; /* Current file's beginning marked
|
||||
* line's x-coordinate position. */
|
||||
#endif
|
||||
size_t current_x; /* Current file's x-coordinate
|
||||
* position. */
|
||||
size_t placewewant; /* Current file's place we want. */
|
||||
size_t totlines; /* Current file's total number of
|
||||
* lines. */
|
||||
size_t totsize; /* Current file's total size. */
|
||||
unsigned long flags; /* Current file's flags: modification
|
||||
* status (and marking status, if
|
||||
* available). */
|
||||
file_format fmt; /* Current file's format. */
|
||||
} openfilestruct;
|
||||
#endif
|
||||
|
||||
typedef struct partition {
|
||||
filestruct *fileage;
|
||||
/* The top line of this portion of the file. */
|
||||
filestruct *top_prev;
|
||||
/* The line before the top line of this portion of the file. */
|
||||
char *top_data;
|
||||
/* The text before the beginning of the top line of this portion
|
||||
* of the file. */
|
||||
filestruct *filebot;
|
||||
/* The bottom line of this portion of the file. */
|
||||
filestruct *bot_next;
|
||||
/* The line after the bottom line of this portion of the
|
||||
* file. */
|
||||
char *bot_data;
|
||||
/* The text after the end of the bottom line of this portion of
|
||||
* the file. */
|
||||
} partition;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
typedef struct colortype {
|
||||
short fg;
|
||||
/* This syntax's foreground color. */
|
||||
short bg;
|
||||
/* This syntax's background color. */
|
||||
bool bright;
|
||||
/* Is this color A_BOLD? */
|
||||
bool icase;
|
||||
/* Is this regex string case insensitive? */
|
||||
int pairnum;
|
||||
/* The color pair number used for this foreground color and
|
||||
* background color. */
|
||||
char *start_regex;
|
||||
/* The start (or all) of the regex string. */
|
||||
regex_t *start;
|
||||
/* The compiled start (or all) of the regex string. */
|
||||
char *end_regex;
|
||||
/* The end (if any) of the regex string. */
|
||||
regex_t *end;
|
||||
/* The compiled end (if any) of the regex string. */
|
||||
struct colortype *next;
|
||||
/* Next set of colors. */
|
||||
} colortype;
|
||||
|
||||
typedef struct exttype {
|
||||
char *ext_regex;
|
||||
/* The extensions that match this syntax. */
|
||||
regex_t *ext;
|
||||
/* The compiled extensions that match this syntax. */
|
||||
struct exttype *next;
|
||||
/* Next set of extensions. */
|
||||
} exttype;
|
||||
|
||||
typedef struct syntaxtype {
|
||||
char *desc;
|
||||
/* The name of this syntax. */
|
||||
exttype *extensions;
|
||||
/* The list of extensions that this syntax applies to. */
|
||||
colortype *color;
|
||||
/* The colors used in this syntax. */
|
||||
struct syntaxtype *next;
|
||||
/* Next syntax. */
|
||||
} syntaxtype;
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
typedef struct openfilestruct {
|
||||
char *filename;
|
||||
/* The current file's name. */
|
||||
filestruct *fileage;
|
||||
/* The current file's first line. */
|
||||
filestruct *filebot;
|
||||
/* The current file's last line. */
|
||||
filestruct *edittop;
|
||||
/* The current top of the edit window. */
|
||||
filestruct *current;
|
||||
/* The current file's current line. */
|
||||
size_t totsize;
|
||||
/* The current file's total number of characters. */
|
||||
size_t current_x;
|
||||
/* The current file's x-coordinate position. */
|
||||
size_t placewewant;
|
||||
/* The current file's place we want. */
|
||||
ssize_t current_y;
|
||||
/* The current file's y-coordinate position. */
|
||||
bool modified;
|
||||
/* Whether the current file has been modified. */
|
||||
#ifndef NANO_TINY
|
||||
bool mark_set;
|
||||
/* Whether the mark is on in the current file. */
|
||||
filestruct *mark_begin;
|
||||
/* The current file's beginning marked line, if any. */
|
||||
size_t mark_begin_x;
|
||||
/* The current file's beginning marked line's x-coordinate
|
||||
* position, if any. */
|
||||
file_format fmt;
|
||||
/* The current file's format. */
|
||||
struct stat *current_stat;
|
||||
/* The current file's stat. */
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
colortype *colorstrings;
|
||||
/* The current file's associated colors. */
|
||||
#endif
|
||||
struct openfilestruct *next;
|
||||
/* Next node. */
|
||||
struct openfilestruct *prev;
|
||||
/* Previous node. */
|
||||
} openfilestruct;
|
||||
|
||||
typedef struct shortcut {
|
||||
/* Key values that aren't used should be set to NANO_NO_KEY. */
|
||||
int ctrlval; /* Special sentinel key or control key we want
|
||||
* bound. */
|
||||
int metaval; /* Meta key we want bound. */
|
||||
int funcval; /* Function key we want bound. */
|
||||
int miscval; /* Other Meta key we want bound. */
|
||||
bool viewok; /* Is this function legal in view mode? */
|
||||
void (*func)(void); /* Function to call when we catch this key. */
|
||||
const char *desc; /* Description, e.g. "Page Up". */
|
||||
int ctrlval;
|
||||
/* The special sentinel key or control key we want bound, if
|
||||
* any. */
|
||||
int metaval;
|
||||
/* The meta key we want bound, if any. */
|
||||
int funcval;
|
||||
/* The function key we want bound, if any. */
|
||||
int miscval;
|
||||
/* The other meta key we want bound, if any. */
|
||||
bool viewok;
|
||||
/* Is this function allowed when in view mode? */
|
||||
void (*func)(void);
|
||||
/* The function to call when we get this key. */
|
||||
const char *desc;
|
||||
/* The function's description, e.g. "Page Up". */
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help; /* Help file entry text. */
|
||||
const char *help;
|
||||
/* The help file entry text for this function. */
|
||||
#endif
|
||||
struct shortcut *next;
|
||||
/* Next shortcut. */
|
||||
} shortcut;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
typedef struct toggle {
|
||||
int val; /* Sequence to toggle the key. Should only need
|
||||
* one. */
|
||||
const char *desc; /* Description for when toggle is, uh, toggled,
|
||||
* e.g. "Cut to end"; we'll append Enabled or
|
||||
* Disabled. */
|
||||
long flag; /* What flag actually gets toggled. */
|
||||
int val;
|
||||
/* The sequence to toggle the key. We should only need one. */
|
||||
const char *desc;
|
||||
/* The description for when the toggle is, uh, toggled, e.g.
|
||||
* "Cut to end"; we'll append Enabled or Disabled. */
|
||||
long flag;
|
||||
/* Which flag actually gets toggled. */
|
||||
struct toggle *next;
|
||||
/* Next toggle. */
|
||||
} toggle;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
typedef struct rcoption {
|
||||
const char *name;
|
||||
/* The name of the rcfile option. */
|
||||
long flag;
|
||||
/* The flag associated with it, if any. */
|
||||
} rcoption;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
typedef struct colortype {
|
||||
int fg; /* Foreground color. */
|
||||
int bg; /* Background color. */
|
||||
bool bright; /* Is this color A_BOLD? */
|
||||
int pairnum; /* Color pair number used for this
|
||||
* foreground/background. */
|
||||
regex_t start; /* Start (or all) of the regex
|
||||
* string. */
|
||||
regex_t *end; /* End (if any) of the regex string. */
|
||||
struct colortype *next;
|
||||
} colortype;
|
||||
|
||||
typedef struct exttype {
|
||||
regex_t val; /* The extensions that match this
|
||||
* syntax. */
|
||||
struct exttype *next;
|
||||
} exttype;
|
||||
|
||||
typedef struct syntaxtype {
|
||||
char *desc; /* Name of this syntax type. */
|
||||
exttype *extensions; /* List of extensions that this syntax
|
||||
* applies to. */
|
||||
colortype *color; /* Color struct for this syntax. */
|
||||
struct syntaxtype *next;
|
||||
} syntaxtype;
|
||||
#endif
|
||||
|
||||
/* Bitwise flags so that we can save space (or, more correctly, not
|
||||
* waste it). */
|
||||
#define MODIFIED (1<<0)
|
||||
#define CASE_SENSITIVE (1<<1)
|
||||
#define MARK_ISSET (1<<2)
|
||||
#define CONST_UPDATE (1<<3)
|
||||
#define NO_HELP (1<<4)
|
||||
#define NOFOLLOW_SYMLINKS (1<<5)
|
||||
#define SUSPEND (1<<6)
|
||||
#define NO_WRAP (1<<7)
|
||||
#define AUTOINDENT (1<<8)
|
||||
#define VIEW_MODE (1<<9)
|
||||
#define USE_MOUSE (1<<10)
|
||||
#define USE_REGEXP (1<<11)
|
||||
#define TEMP_FILE (1<<12)
|
||||
#define CUT_TO_END (1<<13)
|
||||
#define BACKWARDS_SEARCH (1<<14)
|
||||
#define MULTIBUFFER (1<<15)
|
||||
#define SMOOTH_SCROLL (1<<16)
|
||||
#define REBIND_DELETE (1<<17)
|
||||
#define NO_CONVERT (1<<18)
|
||||
#define BACKUP_FILE (1<<19)
|
||||
#define NO_RCFILE (1<<20)
|
||||
#define NO_COLOR_SYNTAX (1<<21)
|
||||
#define PRESERVE (1<<22)
|
||||
#define HISTORYLOG (1<<23)
|
||||
#define RESTRICTED (1<<24)
|
||||
#define SMART_HOME (1<<25)
|
||||
#define WHITESPACE_DISPLAY (1<<26)
|
||||
#define MORE_SPACE (1<<27)
|
||||
#define TABS_TO_SPACES (1<<28)
|
||||
#define QUICK_BLANK (1<<29)
|
||||
#define USE_UTF8 (1<<30)
|
||||
#define CASE_SENSITIVE (1<<0)
|
||||
#define CONST_UPDATE (1<<1)
|
||||
#define NO_HELP (1<<2)
|
||||
#define NOFOLLOW_SYMLINKS (1<<3)
|
||||
#define SUSPEND (1<<4)
|
||||
#define NO_WRAP (1<<5)
|
||||
#define AUTOINDENT (1<<6)
|
||||
#define VIEW_MODE (1<<7)
|
||||
#define USE_MOUSE (1<<8)
|
||||
#define USE_REGEXP (1<<9)
|
||||
#define TEMP_FILE (1<<10)
|
||||
#define CUT_TO_END (1<<11)
|
||||
#define BACKWARDS_SEARCH (1<<12)
|
||||
#define MULTIBUFFER (1<<13)
|
||||
#define SMOOTH_SCROLL (1<<14)
|
||||
#define REBIND_DELETE (1<<15)
|
||||
#define REBIND_KEYPAD (1<<16)
|
||||
#define NO_CONVERT (1<<17)
|
||||
#define BACKUP_FILE (1<<18)
|
||||
#define NO_RCFILE (1<<19)
|
||||
#define NO_COLOR_SYNTAX (1<<20)
|
||||
#define PRESERVE (1<<21)
|
||||
#define HISTORYLOG (1<<22)
|
||||
#define RESTRICTED (1<<23)
|
||||
#define SMART_HOME (1<<24)
|
||||
#define WHITESPACE_DISPLAY (1<<25)
|
||||
#define MORE_SPACE (1<<26)
|
||||
#define TABS_TO_SPACES (1<<27)
|
||||
#define QUICK_BLANK (1<<28)
|
||||
#define WORD_BOUNDS (1<<29)
|
||||
#define NO_NEWLINES (1<<30)
|
||||
#define USE_UTF8 (1<<31)
|
||||
|
||||
/* Control key sequences. Changing these would be very, very bad. */
|
||||
#define NANO_CONTROL_SPACE 0
|
||||
@@ -340,8 +409,20 @@ typedef struct syntaxtype {
|
||||
#define NANO_CONTROL_7 31
|
||||
#define NANO_CONTROL_8 127
|
||||
|
||||
#define NANO_ALT_SPACE ' '
|
||||
#define NANO_ALT_LPAREN '('
|
||||
#define NANO_ALT_RPAREN ')'
|
||||
#define NANO_ALT_PLUS '+'
|
||||
#define NANO_ALT_COMMA ','
|
||||
#define NANO_ALT_MINUS '-'
|
||||
#define NANO_ALT_PERIOD '.'
|
||||
#define NANO_ALT_9 '9'
|
||||
#define NANO_ALT_0 '0'
|
||||
#define NANO_ALT_LCARAT '<'
|
||||
#define NANO_ALT_EQUALS '='
|
||||
#define NANO_ALT_RCARAT '>'
|
||||
#define NANO_ALT_RBRACKET ']'
|
||||
#define NANO_ALT_USCORE '_'
|
||||
#define NANO_ALT_A 'a'
|
||||
#define NANO_ALT_B 'b'
|
||||
#define NANO_ALT_C 'c'
|
||||
@@ -368,14 +449,6 @@ typedef struct syntaxtype {
|
||||
#define NANO_ALT_X 'x'
|
||||
#define NANO_ALT_Y 'y'
|
||||
#define NANO_ALT_Z 'z'
|
||||
#define NANO_ALT_PERIOD '.'
|
||||
#define NANO_ALT_COMMA ','
|
||||
#define NANO_ALT_LPAREN '('
|
||||
#define NANO_ALT_RPAREN ')'
|
||||
#define NANO_ALT_LCARAT '<'
|
||||
#define NANO_ALT_RCARAT '>'
|
||||
#define NANO_ALT_RBRACKET ']'
|
||||
#define NANO_ALT_SPACE ' '
|
||||
|
||||
/* Some semi-changeable keybindings; don't play with these unless you're
|
||||
* sure you know what you're doing. Assume ERR is defined as -1. */
|
||||
@@ -429,8 +502,8 @@ typedef struct syntaxtype {
|
||||
#define NANO_REFRESH_KEY NANO_CONTROL_L
|
||||
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
|
||||
#define NANO_JUSTIFY_FKEY KEY_F(4)
|
||||
#define NANO_UNJUSTIFY_KEY NANO_UNCUT_KEY /* Same key as uncut. */
|
||||
#define NANO_UNJUSTIFY_FKEY NANO_UNCUT_FKEY /* Same key as uncut. */
|
||||
#define NANO_UNJUSTIFY_KEY NANO_UNCUT_KEY /* Same key as UnCut. */
|
||||
#define NANO_UNJUSTIFY_FKEY NANO_UNCUT_FKEY /* Same key as UnCut. */
|
||||
#define NANO_PREVLINE_KEY NANO_CONTROL_P
|
||||
#define NANO_NEXTLINE_KEY NANO_CONTROL_N
|
||||
#define NANO_FORWARD_KEY NANO_CONTROL_F
|
||||
@@ -448,14 +521,18 @@ typedef struct syntaxtype {
|
||||
#define NANO_TOFILES_KEY NANO_CONTROL_T
|
||||
#define NANO_APPEND_KEY NANO_ALT_A
|
||||
#define NANO_PREPEND_KEY NANO_ALT_P
|
||||
#define NANO_OPENPREV_KEY NANO_ALT_LCARAT
|
||||
#define NANO_OPENNEXT_KEY NANO_ALT_RCARAT
|
||||
#define NANO_OPENPREV_ALTKEY NANO_ALT_COMMA
|
||||
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
|
||||
#define NANO_PREVFILE_KEY NANO_ALT_LCARAT
|
||||
#define NANO_NEXTFILE_KEY NANO_ALT_RCARAT
|
||||
#define NANO_PREVFILE_ALTKEY NANO_ALT_COMMA
|
||||
#define NANO_NEXTFILE_ALTKEY NANO_ALT_PERIOD
|
||||
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
|
||||
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
||||
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
||||
#define NANO_WORDCOUNT_KEY NANO_ALT_D
|
||||
#define NANO_SCROLLUP_KEY NANO_ALT_MINUS
|
||||
#define NANO_SCROLLDOWN_KEY NANO_ALT_PLUS
|
||||
#define NANO_SCROLLUP_ALTKEY NANO_ALT_USCORE
|
||||
#define NANO_SCROLLDOWN_ALTKEY NANO_ALT_EQUALS
|
||||
#define NANO_CUTTILLEND_KEY NANO_CONTROL_X
|
||||
#define NANO_CUTTILLEND_ALTKEY NANO_ALT_T
|
||||
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
||||
@@ -468,8 +545,8 @@ typedef struct syntaxtype {
|
||||
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Toggles do not exist with NANO_SMALL. */
|
||||
#ifndef NANO_TINY
|
||||
/* Toggles do not exist with NANO_TINY. */
|
||||
#define TOGGLE_CONST_KEY NANO_ALT_C
|
||||
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
||||
#define TOGGLE_SUSPEND_KEY NANO_ALT_Z
|
||||
@@ -490,28 +567,30 @@ typedef struct syntaxtype {
|
||||
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
|
||||
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
|
||||
#define TOGGLE_TABSTOSPACES_KEY NANO_ALT_Q
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#define MAIN_VISIBLE 12
|
||||
|
||||
#define VIEW TRUE
|
||||
#define NOVIEW FALSE
|
||||
|
||||
/* Minimum editor window rows required for nano to work correctly. */
|
||||
/* The minimum editor window columns and rows required for nano to work
|
||||
* correctly. */
|
||||
#define MIN_EDITOR_COLS 4
|
||||
#define MIN_EDITOR_ROWS 1
|
||||
|
||||
/* Default number of characters from end-of-line where text wrapping
|
||||
* occurs. */
|
||||
/* The default number of characters from the end of the line where
|
||||
* wrapping occurs. */
|
||||
#define CHARS_FROM_EOL 8
|
||||
|
||||
/* Default width of a tab. */
|
||||
/* The default width of a tab in spaces. */
|
||||
#define WIDTH_OF_TAB 8
|
||||
|
||||
/* Maximum number of search/replace history strings saved, not counting
|
||||
* the blank lines at their ends. */
|
||||
/* The maximum number of search/replace history strings saved, not
|
||||
* counting the blank lines at their ends. */
|
||||
#define MAX_SEARCH_HISTORY 100
|
||||
|
||||
/* Maximum number of bytes we read from a file at one time. */
|
||||
/* The maximum number of bytes we read from a file at one time. */
|
||||
#define MAX_BUF_SIZE 128
|
||||
|
||||
#endif /* !NANO_H */
|
||||
|
||||
1244
src/prompt.c
Normal file
1244
src/prompt.c
Normal file
File diff suppressed because it is too large
Load Diff
631
src/proto.h
631
src/proto.h
@@ -2,7 +2,8 @@
|
||||
/**************************************************************************
|
||||
* proto.h *
|
||||
* *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -23,33 +24,31 @@
|
||||
#ifndef PROTO_H
|
||||
#define PROTO_H 1
|
||||
|
||||
/* Externs. */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
#include "nano.h"
|
||||
|
||||
/* Public externs. See global.c for descriptions of them. */
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
extern ssize_t fill;
|
||||
extern ssize_t wrap_at;
|
||||
#endif
|
||||
extern int editwinrows;
|
||||
extern size_t current_x;
|
||||
extern ssize_t current_y;
|
||||
extern size_t totlines;
|
||||
extern size_t placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
extern size_t mark_beginx;
|
||||
#endif
|
||||
extern size_t totsize;
|
||||
extern unsigned long flags;
|
||||
extern ssize_t tabsize;
|
||||
extern int currslen;
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
extern char *last_search;
|
||||
extern char *last_replace;
|
||||
|
||||
extern long flags;
|
||||
extern WINDOW *topwin;
|
||||
extern WINDOW *edit;
|
||||
extern WINDOW *bottomwin;
|
||||
extern int editwinrows;
|
||||
|
||||
extern filestruct *cutbuffer;
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
extern filestruct *jusbuffer;
|
||||
#endif
|
||||
extern partition *filepart;
|
||||
extern openfilestruct *openfile;
|
||||
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
extern char *whitespace;
|
||||
extern int whitespace_len[2];
|
||||
#endif
|
||||
@@ -67,55 +66,30 @@ extern size_t quotelen;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
extern char *answer;
|
||||
|
||||
extern ssize_t tabsize;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
extern char *backup_dir;
|
||||
#endif
|
||||
|
||||
extern WINDOW *topwin, *edit, *bottomwin;
|
||||
extern char *filename;
|
||||
extern struct stat originalfilestat;
|
||||
extern char *answer;
|
||||
extern char *hblank;
|
||||
#ifndef DISABLE_HELP
|
||||
extern char *help_text;
|
||||
#endif
|
||||
extern char *last_search;
|
||||
extern char *last_replace;
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
extern char *operating_dir;
|
||||
extern char *full_operating_dir;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
extern char *alt_speller;
|
||||
#endif
|
||||
|
||||
extern struct stat fileinfo;
|
||||
extern filestruct *current, *fileage, *edittop, *filebot;
|
||||
extern filestruct *cutbuffer;
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
extern filestruct *jusbuffer;
|
||||
#endif
|
||||
extern partition *filepart;
|
||||
#ifndef NANO_SMALL
|
||||
extern filestruct *mark_beginbuf;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
extern openfilestruct *open_files;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
extern const colortype *colorstrings;
|
||||
extern syntaxtype *syntaxes;
|
||||
extern char *syntaxstr;
|
||||
#endif
|
||||
|
||||
extern shortcut *shortcut_list;
|
||||
extern shortcut *main_list, *whereis_list;
|
||||
extern shortcut *replace_list, *gotoline_list;
|
||||
extern shortcut *writefile_list, *insertfile_list;
|
||||
extern shortcut *main_list;
|
||||
extern shortcut *whereis_list;
|
||||
extern shortcut *replace_list;
|
||||
extern shortcut *replace_list_2;
|
||||
#ifndef NANO_SMALL
|
||||
extern shortcut *gotoline_list;
|
||||
extern shortcut *writefile_list;
|
||||
extern shortcut *insertfile_list;
|
||||
#ifndef NANO_TINY
|
||||
extern shortcut *extcmd_list;
|
||||
#endif
|
||||
#ifndef DISABLE_HELP
|
||||
@@ -125,25 +99,21 @@ extern shortcut *help_list;
|
||||
extern shortcut *spell_list;
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
extern shortcut *browser_list, *gotodir_list;
|
||||
extern shortcut *browser_list;
|
||||
extern shortcut *gotodir_list;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
extern syntaxtype *syntaxes;
|
||||
extern char *syntaxstr;
|
||||
#endif
|
||||
|
||||
extern const shortcut *currshortcut;
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
extern regex_t search_regexp;
|
||||
extern regmatch_t regmatches[10];
|
||||
#ifdef ENABLE_COLOR
|
||||
extern regex_t syntaxfile_regexp;
|
||||
extern regmatch_t synfilematches[1];
|
||||
#endif /* ENABLE_COLOR */
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
extern toggle *toggles;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
extern filestruct *search_history;
|
||||
extern filestruct *searchage;
|
||||
extern filestruct *searchbot;
|
||||
@@ -152,39 +122,51 @@ extern filestruct *replaceage;
|
||||
extern filestruct *replacebot;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
extern regex_t search_regexp;
|
||||
extern regmatch_t regmatches[10];
|
||||
#endif
|
||||
|
||||
extern bool curses_ended;
|
||||
|
||||
extern char *homedir;
|
||||
|
||||
/* The functions we want available. */
|
||||
/* Public functions in browser.c. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
char *do_browser(char *path, DIR *dir);
|
||||
char **browser_init(const char *path, int *longest, size_t *numents, DIR
|
||||
*dir);
|
||||
char *do_browse_from(const char *inpath);
|
||||
void striponedir(char *path);
|
||||
#endif
|
||||
|
||||
/* Public functions in chars.c. */
|
||||
#ifndef HAVE_ISBLANK
|
||||
bool nisblank(int c);
|
||||
#endif
|
||||
#if !defined(HAVE_ISWBLANK) && defined(NANO_WIDE)
|
||||
#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
|
||||
bool niswblank(wchar_t wc);
|
||||
#endif
|
||||
bool is_byte(int c);
|
||||
bool is_alnum_mbchar(const char *c);
|
||||
bool is_blank_mbchar(const char *c);
|
||||
bool is_cntrl_char(int c);
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
bool is_cntrl_wchar(wchar_t wc);
|
||||
#endif
|
||||
bool is_cntrl_mbchar(const char *c);
|
||||
bool is_punct_mbchar(const char *c);
|
||||
bool is_word_mbchar(const char *c, bool allow_punct);
|
||||
char control_rep(char c);
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
wchar_t control_wrep(wchar_t c);
|
||||
#endif
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len);
|
||||
char *mbrep(const char *c, char *crep, int *crep_len);
|
||||
int mbwidth(const char *c);
|
||||
int mb_cur_max(void);
|
||||
char *make_mbchar(int chr, int *chr_mb_len);
|
||||
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
|
||||
*col);
|
||||
char *make_mbchar(long chr, int *chr_mb_len);
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col);
|
||||
size_t move_mbleft(const char *buf, size_t pos);
|
||||
size_t move_mbright(const char *buf, size_t pos);
|
||||
#ifndef HAVE_STRCASECMP
|
||||
@@ -199,11 +181,11 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n);
|
||||
const char *nstrcasestr(const char *haystack, const char *needle);
|
||||
#endif
|
||||
const char *mbstrcasestr(const char *haystack, const char *needle);
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
|
||||
const char *revstrstr(const char *haystack, const char *needle, const
|
||||
char *rev_start);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const char *revstrcasestr(const char *haystack, const char *needle,
|
||||
const char *rev_start);
|
||||
const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
@@ -214,12 +196,19 @@ size_t mbstrlen(const char *s);
|
||||
size_t nstrnlen(const char *s, size_t maxlen);
|
||||
#endif
|
||||
size_t mbstrnlen(const char *s, size_t maxlen);
|
||||
#ifndef NANO_TINY
|
||||
char *revstrpbrk(const char *s, const char *accept, const char
|
||||
*rev_start);
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
char *mbstrchr(const char *s, char *c);
|
||||
#ifdef ENABLE_NANORC
|
||||
bool has_blank_chars(const char *s);
|
||||
bool has_blank_mbchars(const char *s);
|
||||
#endif
|
||||
char *mbstrchr(const char *s, char *c);
|
||||
#endif
|
||||
#ifdef ENABLE_UTF8
|
||||
bool is_valid_unicode(wchar_t wc);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
bool is_valid_mbstring(const char *s);
|
||||
@@ -228,59 +217,51 @@ bool is_valid_mbstring(const char *s);
|
||||
/* Public functions in color.c. */
|
||||
#ifdef ENABLE_COLOR
|
||||
void set_colorpairs(void);
|
||||
void do_colorinit(void);
|
||||
void update_color(void);
|
||||
#endif /* ENABLE_COLOR */
|
||||
void color_init(void);
|
||||
void color_update(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
void cut_line(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void cut_marked(void);
|
||||
void cut_to_eol(void);
|
||||
#endif
|
||||
void do_cut_text(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_cut_till_end(void);
|
||||
#endif
|
||||
void do_uncut_text(void);
|
||||
|
||||
/* Public functions in files.c. */
|
||||
void new_file(void);
|
||||
void make_new_buffer(void);
|
||||
void initialize_buffer(void);
|
||||
void initialize_buffer_text(void);
|
||||
void open_buffer(const char *filename);
|
||||
#ifndef DISABLE_SPELLER
|
||||
void replace_buffer(const char *filename);
|
||||
#endif
|
||||
void display_buffer(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void switch_to_prevnext_buffer(bool next);
|
||||
void switch_to_prev_buffer_void(void);
|
||||
void switch_to_next_buffer_void(void);
|
||||
bool close_buffer(void);
|
||||
#endif
|
||||
filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
*first_line_ins, size_t buf_len);
|
||||
void load_file(void);
|
||||
void read_file(FILE *f, const char *filename);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
#ifndef NANO_SMALL
|
||||
void execute_command(const char *command);
|
||||
#endif
|
||||
void load_buffer(const char *name);
|
||||
void do_insertfile(
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool execute
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
);
|
||||
void do_insertfile_void(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
openfilestruct *make_new_opennode(void);
|
||||
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
|
||||
openfilestruct *end);
|
||||
void unlink_opennode(openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
#ifdef DEBUG
|
||||
void free_openfilestruct(openfilestruct *src);
|
||||
#endif
|
||||
void add_open_file(bool update);
|
||||
void load_open_file(void);
|
||||
void open_prevnext_file(bool next_file);
|
||||
void open_prevfile_void(void);
|
||||
void open_nextfile_void(void);
|
||||
bool close_open_file(void);
|
||||
#endif
|
||||
char *get_full_path(const char *origpath);
|
||||
char *check_writable_directory(const char *path);
|
||||
char *safe_tempfile(FILE **f);
|
||||
@@ -288,14 +269,15 @@ char *safe_tempfile(FILE **f);
|
||||
void init_operating_dir(void);
|
||||
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void init_backup_dir(void);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out);
|
||||
int write_file(const char *name, FILE *f_open, bool tmp, int append,
|
||||
bool nonamechange);
|
||||
#ifndef NANO_SMALL
|
||||
int write_marked(const char *name, FILE *f_open, bool tmp, int append);
|
||||
int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
append, bool nonamechange);
|
||||
#ifndef NANO_TINY
|
||||
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
append_type append);
|
||||
#endif
|
||||
int do_writeout(bool exiting);
|
||||
void do_writeout_void(void);
|
||||
@@ -312,14 +294,7 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
|
||||
char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
|
||||
#endif
|
||||
const char *tail(const char *foo);
|
||||
#ifndef DISABLE_BROWSER
|
||||
void striponedir(char *path);
|
||||
char **browser_init(const char *path, int *longest, size_t *numents, DIR
|
||||
*dir);
|
||||
char *do_browser(char *path, DIR *dir);
|
||||
char *do_browse_from(const char *inpath);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
char *histfilename(void);
|
||||
void load_history(void);
|
||||
bool writehist(FILE *hist, filestruct *histhead);
|
||||
@@ -328,7 +303,7 @@ void save_history(void);
|
||||
|
||||
/* Public functions in global.c. */
|
||||
size_t length_of_list(const shortcut *s);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void toggle_init_one(int val, const char *desc, long flag);
|
||||
void toggle_init(void);
|
||||
#endif
|
||||
@@ -344,35 +319,44 @@ void free_shortcutage(shortcut **shortcutage);
|
||||
void thanks_for_all_the_fish(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in help.c. */
|
||||
#ifndef DISABLE_HELP
|
||||
void do_help(void);
|
||||
void help_init(void);
|
||||
size_t help_line_len(const char *ptr);
|
||||
#endif
|
||||
|
||||
/* Public functions in move.c. */
|
||||
void do_first_line(void);
|
||||
void do_last_line(void);
|
||||
void do_home(void);
|
||||
void do_end(void);
|
||||
void do_page_up(void);
|
||||
void do_page_down(void);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
void do_para_begin(bool allow_update);
|
||||
void do_para_begin_void(void);
|
||||
void do_para_end(bool allow_update);
|
||||
void do_para_end_void(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
bool do_next_word(bool allow_punct, bool allow_update);
|
||||
void do_next_word_void(void);
|
||||
bool do_prev_word(bool allow_punct, bool allow_update);
|
||||
void do_prev_word_void(void);
|
||||
#endif
|
||||
void do_home(void);
|
||||
void do_end(void);
|
||||
void do_up(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_scroll_up(void);
|
||||
#endif
|
||||
void do_down(void);
|
||||
void do_left(bool allow_update);
|
||||
void do_left_void(void);
|
||||
void do_right(bool allow_update);
|
||||
void do_right_void(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_scroll_down(void);
|
||||
#endif
|
||||
void do_left(void);
|
||||
void do_right(void);
|
||||
|
||||
/* Public functions in nano.c. */
|
||||
void print_view_warning(void);
|
||||
void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename);
|
||||
void check_die_too_small(void);
|
||||
void resize_variables(void);
|
||||
void global_init(bool save_cutbuffer);
|
||||
void window_init(void);
|
||||
#ifndef DISABLE_MOUSE
|
||||
void mouse_init(void);
|
||||
#endif
|
||||
#ifndef DISABLE_HELP
|
||||
void help_init(void);
|
||||
#endif
|
||||
filestruct *make_new_node(filestruct *prevnode);
|
||||
filestruct *copy_node(const filestruct *src);
|
||||
void splice_node(filestruct *begin, filestruct *newnode, filestruct
|
||||
@@ -381,14 +365,29 @@ void unlink_node(const filestruct *fileptr);
|
||||
void delete_node(filestruct *fileptr);
|
||||
filestruct *copy_filestruct(const filestruct *src);
|
||||
void free_filestruct(filestruct *src);
|
||||
void renumber(filestruct *fileptr);
|
||||
partition *partition_filestruct(filestruct *top, size_t top_x,
|
||||
filestruct *bot, size_t bot_x);
|
||||
void unpartition_filestruct(partition **p);
|
||||
void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
|
||||
void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
|
||||
void renumber_all(void);
|
||||
void renumber(filestruct *fileptr);
|
||||
openfilestruct *make_new_opennode(void);
|
||||
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
|
||||
openfilestruct *end);
|
||||
void unlink_opennode(openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
#ifdef DEBUG
|
||||
void free_openfilestruct(openfilestruct *src);
|
||||
#endif
|
||||
void print_view_warning(void);
|
||||
void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename);
|
||||
void window_init(void);
|
||||
#ifndef DISABLE_MOUSE
|
||||
void mouse_init(void);
|
||||
#endif
|
||||
void print1opt_full(const char *shortflag
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
, const char *longflag
|
||||
@@ -399,74 +398,21 @@ void version(void);
|
||||
int no_more_space(void);
|
||||
int no_help(void);
|
||||
void nano_disabled_msg(void);
|
||||
#ifndef NANO_SMALL
|
||||
void cancel_fork(int signal);
|
||||
bool open_pipe(const char *command);
|
||||
#endif
|
||||
void do_verbatim_input(void);
|
||||
void do_backspace(void);
|
||||
void do_delete(void);
|
||||
void do_tab(void);
|
||||
void do_enter(void);
|
||||
#ifndef NANO_SMALL
|
||||
bool do_next_word(bool allow_punct, bool allow_update);
|
||||
void do_next_word_void(void);
|
||||
bool do_prev_word(bool allow_punct, bool allow_update);
|
||||
void do_prev_word_void(void);
|
||||
void do_word_count(void);
|
||||
void do_mark(void);
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
void wrap_reset(void);
|
||||
bool do_wrap(filestruct *line);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool do_int_spell_fix(const char *word);
|
||||
const char *do_int_speller(const char *tempfile_name);
|
||||
const char *do_alt_speller(char *tempfile_name);
|
||||
void do_spell(void);
|
||||
#endif
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
|
||||
ssize_t break_line(const char *line, ssize_t goal, bool newline);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
|
||||
size_t indent_length(const char *line);
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
void justify_format(filestruct *paragraph, size_t skip);
|
||||
size_t quote_length(const char *line);
|
||||
bool quotes_match(const char *a_line, size_t a_quote, const char
|
||||
*b_line);
|
||||
bool indents_match(const char *a_line, size_t a_indent, const char
|
||||
*b_line, size_t b_indent);
|
||||
bool begpar(const filestruct *const foo);
|
||||
void do_para_begin(bool allow_update);
|
||||
void do_para_begin_void(void);
|
||||
bool inpar(const filestruct *const foo);
|
||||
void do_para_end(bool allow_update);
|
||||
void do_para_end_void(void);
|
||||
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
|
||||
quote_len);
|
||||
bool find_paragraph(size_t *const quote, size_t *const par);
|
||||
void do_justify(bool full_justify);
|
||||
void do_justify_void(void);
|
||||
void do_full_justify(void);
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
void do_exit(void);
|
||||
void signal_init(void);
|
||||
void handle_hupterm(int signal);
|
||||
void do_suspend(int signal);
|
||||
void do_cont(int signal);
|
||||
#ifndef NANO_SMALL
|
||||
void handle_sigwinch(int s);
|
||||
RETSIGTYPE handle_hupterm(int signal);
|
||||
RETSIGTYPE do_suspend(int signal);
|
||||
RETSIGTYPE do_continue(int signal);
|
||||
#ifndef NANO_TINY
|
||||
RETSIGTYPE handle_sigwinch(int signal);
|
||||
void allow_pending_sigwinch(bool allow);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_toggle(const toggle *which);
|
||||
#endif
|
||||
void disable_extended_io(void);
|
||||
void disable_signals(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void enable_signals(void);
|
||||
#endif
|
||||
void disable_flow_control(void);
|
||||
@@ -479,21 +425,69 @@ bool do_mouse(void);
|
||||
#endif
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls);
|
||||
|
||||
/* Public functions in prompt.c. */
|
||||
int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
bool *ran_func, bool *finished, bool allow_funcs);
|
||||
#ifndef DISABLE_MOUSE
|
||||
bool do_statusbar_mouse(void);
|
||||
#endif
|
||||
void do_statusbar_output(char *output, size_t output_len, bool
|
||||
*got_enter, bool allow_cntrls);
|
||||
void do_statusbar_home(void);
|
||||
void do_statusbar_end(void);
|
||||
void do_statusbar_left(void);
|
||||
void do_statusbar_right(void);
|
||||
void do_statusbar_backspace(void);
|
||||
void do_statusbar_delete(void);
|
||||
void do_statusbar_cut_text(void);
|
||||
#ifndef NANO_TINY
|
||||
bool do_statusbar_next_word(bool allow_punct);
|
||||
bool do_statusbar_prev_word(bool allow_punct);
|
||||
#endif
|
||||
void do_statusbar_verbatim_input(bool *got_enter);
|
||||
#ifndef NANO_TINY
|
||||
bool find_statusbar_bracket_match(bool reverse, const char
|
||||
*bracket_set);
|
||||
void do_statusbar_find_bracket(void);
|
||||
#endif
|
||||
size_t statusbar_xplustabs(void);
|
||||
size_t get_statusbar_page_start(size_t start_col, size_t column);
|
||||
void update_statusbar_line(const char *curranswer, size_t index);
|
||||
void reset_statusbar_cursor(void);
|
||||
bool need_statusbar_horizontal_update(size_t old_pww);
|
||||
int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
#ifndef NANO_TINY
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const shortcut *s
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, bool *list
|
||||
#endif
|
||||
);
|
||||
int do_prompt(bool allow_tabs, const shortcut *s, const char
|
||||
*curranswer,
|
||||
#ifndef NANO_TINY
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
void do_prompt_abort(void);
|
||||
int do_yesno_prompt(bool all, const char *msg);
|
||||
|
||||
/* Public functions in rcfile.c. */
|
||||
#ifdef ENABLE_NANORC
|
||||
void rcfile_error(const char *msg, ...);
|
||||
char *parse_next_word(char *ptr);
|
||||
char *parse_argument(char *ptr);
|
||||
#ifdef ENABLE_COLOR
|
||||
int color_to_int(const char *colorname, bool *bright);
|
||||
short color_to_short(const char *colorname, bool *bright);
|
||||
char *parse_next_regex(char *ptr);
|
||||
bool nregcomp(regex_t *preg, const char *regex, int eflags);
|
||||
bool nregcomp(const char *regex, int eflags);
|
||||
void parse_syntax(char *ptr);
|
||||
void parse_colors(char *ptr, bool icase);
|
||||
#endif /* ENABLE_COLOR */
|
||||
#endif
|
||||
void parse_rcfile(FILE *rcstream);
|
||||
void do_rcfile(void);
|
||||
#endif /* ENABLE_NANORC */
|
||||
#endif
|
||||
|
||||
/* Public functions in search.c. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
@@ -501,60 +495,109 @@ int regexp_init(const char *regexp);
|
||||
void regexp_cleanup(void);
|
||||
#endif
|
||||
void not_found_msg(const char *str);
|
||||
void search_abort(void);
|
||||
void search_replace_abort(void);
|
||||
void search_init_globals(void);
|
||||
int search_init(bool replacing, bool use_answer);
|
||||
bool is_whole_word(size_t pos, const char *buf, const char *word);
|
||||
bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
no_sameline, const filestruct *begin, size_t beginx, const char
|
||||
*needle, size_t *needle_len);
|
||||
bool findnextstr(
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool whole_word,
|
||||
#endif
|
||||
bool no_sameline, const filestruct *begin, size_t begin_x, const
|
||||
char *needle, size_t *needle_len);
|
||||
void findnextstr_wrap_reset(void);
|
||||
void do_search(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_research(void);
|
||||
#endif
|
||||
void replace_abort(void);
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, bool create);
|
||||
#endif
|
||||
char *replace_line(const char *needle);
|
||||
ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
*real_current, size_t *real_current_x, bool wholewords, bool
|
||||
*canceled);
|
||||
ssize_t do_replace_loop(
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool whole_word,
|
||||
#endif
|
||||
bool *canceled, const filestruct *real_current, size_t
|
||||
*real_current_x, const char *needle);
|
||||
void do_replace(void);
|
||||
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
bool interactive, bool save_pos);
|
||||
bool interactive, bool save_pos, bool allow_update);
|
||||
void do_gotolinecolumn_void(void);
|
||||
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
|
||||
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
|
||||
#ifndef DISABLE_SPELLER
|
||||
void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
|
||||
pos_pww);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifndef NANO_TINY
|
||||
bool find_bracket_match(bool reverse, const char *bracket_set);
|
||||
void do_find_bracket(void);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
bool history_has_changed(void);
|
||||
#endif
|
||||
void history_init(void);
|
||||
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
|
||||
char *s, size_t len);
|
||||
void history_reset(const filestruct *h);
|
||||
filestruct *find_history(const filestruct *h_start, const filestruct
|
||||
*h_end, const char *s, size_t len);
|
||||
void update_history(filestruct **h, const char *s);
|
||||
char *get_history_older(filestruct **h);
|
||||
char *get_history_newer(filestruct **h);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
char *get_history_completion(filestruct **h, char *s, size_t len);
|
||||
char *get_history_completion(filestruct **h, const char *s, size_t len);
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif
|
||||
|
||||
/* Public functions in text.c. */
|
||||
#ifndef NANO_TINY
|
||||
void do_mark(void);
|
||||
#endif
|
||||
void do_delete(void);
|
||||
void do_backspace(void);
|
||||
void do_tab(void);
|
||||
void do_enter(void);
|
||||
#ifndef NANO_TINY
|
||||
RETSIGTYPE cancel_command(int signal);
|
||||
bool execute_command(const char *command);
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
void wrap_reset(void);
|
||||
bool do_wrap(filestruct *line);
|
||||
#endif
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
|
||||
ssize_t break_line(const char *line, ssize_t goal
|
||||
#ifndef DISABLE_HELP
|
||||
, bool newline
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
|
||||
size_t indent_length(const char *line);
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
void justify_format(filestruct *paragraph, size_t skip);
|
||||
size_t quote_length(const char *line);
|
||||
bool quotes_match(const char *a_line, size_t a_quote, const char
|
||||
*b_line);
|
||||
bool indents_match(const char *a_line, size_t a_indent, const char
|
||||
*b_line, size_t b_indent);
|
||||
bool begpar(const filestruct *const foo);
|
||||
bool inpar(const filestruct *const foo);
|
||||
void backup_lines(filestruct *first_line, size_t par_len);
|
||||
bool find_paragraph(size_t *const quote, size_t *const par);
|
||||
void do_justify(bool full_justify);
|
||||
void do_justify_void(void);
|
||||
void do_full_justify(void);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool do_int_spell_fix(const char *word);
|
||||
const char *do_int_speller(const char *tempfile_name);
|
||||
const char *do_alt_speller(char *tempfile_name);
|
||||
void do_spell(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void do_wordlinechar_count(void);
|
||||
#endif
|
||||
void do_verbatim_input(void);
|
||||
|
||||
/* Public functions in utils.c. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags);
|
||||
#endif
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string);
|
||||
#endif
|
||||
int digits(size_t n);
|
||||
void get_homedir(void);
|
||||
bool parse_num(const char *str, ssize_t *val);
|
||||
@@ -563,14 +606,24 @@ void align(char **str);
|
||||
void null_at(char **data, size_t index);
|
||||
void unsunder(char *str, size_t true_len);
|
||||
void sunder(char *str);
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
#ifndef HAVE_GETLINE
|
||||
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
|
||||
#endif
|
||||
#ifndef HAVE_GETDELIM
|
||||
ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
|
||||
#endif
|
||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags);
|
||||
#endif
|
||||
bool regexp_bol_or_eol(const regex_t *preg, const char *string);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool is_whole_word(size_t pos, const char *buf, const char *word);
|
||||
#endif
|
||||
const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *start);
|
||||
void nperror(const char *s);
|
||||
@@ -579,27 +632,38 @@ void *nrealloc(void *ptr, size_t howmuch);
|
||||
char *mallocstrncpy(char *dest, const char *src, size_t n);
|
||||
char *mallocstrcpy(char *dest, const char *src);
|
||||
char *mallocstrassn(char *dest, char *src);
|
||||
size_t get_page_start(size_t column);
|
||||
size_t xplustabs(void);
|
||||
size_t actual_x(const char *s, size_t column);
|
||||
size_t strnlenpt(const char *s, size_t maxlen);
|
||||
size_t strlenpt(const char *s);
|
||||
void new_magicline(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
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);
|
||||
#endif
|
||||
void get_totals(const filestruct *begin, const filestruct *end, size_t
|
||||
*lines, size_t *size);
|
||||
size_t get_totsize(const filestruct *begin, const filestruct *end);
|
||||
#ifndef NDEBUG
|
||||
int check_linenumbers(const filestruct *fileptr);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void dump_filestruct(const filestruct *inptr);
|
||||
void dump_filestruct_reverse(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in winio.c. */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void reset_kbinput(void);
|
||||
#endif
|
||||
void get_buffer(WINDOW *win);
|
||||
size_t get_buffer_len(void);
|
||||
void get_key_buffer(WINDOW *win);
|
||||
size_t get_key_buffer_len(void);
|
||||
void unget_input(int *input, size_t input_len);
|
||||
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
|
||||
int *get_input(WINDOW *win, size_t input_len);
|
||||
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
||||
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
@@ -607,12 +671,12 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
||||
*ignore_seq);
|
||||
int get_escape_seq_abcd(int kbinput);
|
||||
int get_byte_kbinput(int kbinput
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
int get_word_kbinput(int kbinput
|
||||
#ifndef NANO_SMALL
|
||||
long get_unicode_kbinput(int kbinput
|
||||
#ifndef NANO_TINY
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
@@ -625,32 +689,10 @@ bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
||||
#endif
|
||||
const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
|
||||
*meta_key, bool *func_key);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const toggle *get_toggle(int kbinput, bool meta_key);
|
||||
#endif
|
||||
int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
bool *ran_func, bool *finished, bool allow_funcs);
|
||||
#ifndef DISABLE_MOUSE
|
||||
bool do_statusbar_mouse(void);
|
||||
#endif
|
||||
void do_statusbar_home(void);
|
||||
void do_statusbar_end(void);
|
||||
void do_statusbar_right(void);
|
||||
void do_statusbar_left(void);
|
||||
void do_statusbar_backspace(void);
|
||||
void do_statusbar_delete(void);
|
||||
void do_statusbar_cut_text(void);
|
||||
#ifndef NANO_SMALL
|
||||
bool do_statusbar_next_word(bool allow_punct);
|
||||
bool do_statusbar_prev_word(bool allow_punct);
|
||||
#endif
|
||||
void do_statusbar_verbatim_input(bool *got_enter);
|
||||
void do_statusbar_output(char *output, size_t output_len, bool
|
||||
*got_enter, bool allow_cntrls);
|
||||
size_t xplustabs(void);
|
||||
size_t actual_x(const char *str, size_t xplus);
|
||||
size_t strnlenpt(const char *buf, size_t size);
|
||||
size_t strlenpt(const char *buf);
|
||||
void blank_line(WINDOW *win, int y, int x, int n);
|
||||
void blank_titlebar(void);
|
||||
void blank_topbar(void);
|
||||
void blank_edit(void);
|
||||
@@ -659,56 +701,27 @@ void blank_bottombars(void);
|
||||
void check_statusblank(void);
|
||||
char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||
dollars);
|
||||
void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
|
||||
int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
#ifndef NANO_SMALL
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const shortcut *s
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, bool *list
|
||||
#endif
|
||||
);
|
||||
int statusq(bool allow_tabs, const shortcut *s, const char *curranswer,
|
||||
#ifndef NANO_SMALL
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
void statusq_abort(void);
|
||||
void titlebar(const char *path);
|
||||
void set_modified(void);
|
||||
void statusbar(const char *msg, ...);
|
||||
void bottombars(const shortcut *s);
|
||||
void onekey(const char *keystroke, const char *desc, size_t len);
|
||||
size_t get_page_start(size_t column);
|
||||
void reset_cursor(void);
|
||||
void edit_add(const filestruct *fileptr, const char *converted, int
|
||||
yval, size_t start);
|
||||
void edit_draw(const filestruct *fileptr, const char *converted, int
|
||||
line, size_t start);
|
||||
void update_line(const filestruct *fileptr, size_t index);
|
||||
int need_horizontal_update(size_t old_pww);
|
||||
int need_vertical_update(size_t old_pww);
|
||||
void edit_scroll(updown direction, int nlines);
|
||||
bool need_horizontal_update(size_t old_pww);
|
||||
bool need_vertical_update(size_t old_pww);
|
||||
void edit_scroll(scroll_dir direction, ssize_t nlines);
|
||||
void edit_redraw(const filestruct *old_current, size_t old_pww);
|
||||
void edit_refresh(void);
|
||||
void edit_update(topmidnone location);
|
||||
int do_yesno(bool all, const char *msg);
|
||||
void edit_update(update_type location);
|
||||
void total_redraw(void);
|
||||
void total_refresh(void);
|
||||
void display_main_list(void);
|
||||
void do_cursorpos(bool constant);
|
||||
void do_cursorpos_void(void);
|
||||
#ifndef DISABLE_HELP
|
||||
size_t help_line_len(const char *ptr);
|
||||
void do_help(void);
|
||||
#endif
|
||||
void do_replace_highlight(bool highlight, const char *word);
|
||||
#ifndef NDEBUG
|
||||
int check_linenumbers(const filestruct *fileptr);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void dump_buffer(const filestruct *inptr);
|
||||
void dump_buffer_reverse(void);
|
||||
#endif
|
||||
#ifdef NANO_EXTRA
|
||||
void do_credits(void);
|
||||
#endif
|
||||
|
||||
153
src/rcfile.c
153
src/rcfile.c
@@ -2,7 +2,8 @@
|
||||
/**************************************************************************
|
||||
* rcfile.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* Copyright (C) 2001-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -20,19 +21,14 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "proto.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
|
||||
@@ -53,6 +49,7 @@ const static rcoption rcopts[] = {
|
||||
{"morespace", MORE_SPACE},
|
||||
{"nofollow", NOFOLLOW_SYMLINKS},
|
||||
{"nohelp", NO_HELP},
|
||||
{"nonewlines", NO_NEWLINES},
|
||||
#ifndef DISABLE_WRAPPING
|
||||
{"nowrap", NO_WRAP},
|
||||
#endif
|
||||
@@ -65,6 +62,7 @@ const static rcoption rcopts[] = {
|
||||
{"quotestr", 0},
|
||||
#endif
|
||||
{"rebinddelete", REBIND_DELETE},
|
||||
{"rebindkeypad", REBIND_KEYPAD},
|
||||
#ifdef HAVE_REGEX_H
|
||||
{"regexp", USE_REGEXP},
|
||||
#endif
|
||||
@@ -75,7 +73,7 @@ const static rcoption rcopts[] = {
|
||||
{"tabsize", 0},
|
||||
{"tempfile", TEMP_FILE},
|
||||
{"view", VIEW_MODE},
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"backup", BACKUP_FILE},
|
||||
{"backupdir", 0},
|
||||
@@ -89,13 +87,18 @@ const static rcoption rcopts[] = {
|
||||
{"smooth", SMOOTH_SCROLL},
|
||||
{"tabstospaces", TABS_TO_SPACES},
|
||||
{"whitespace", 0},
|
||||
{"wordbounds", WORD_BOUNDS},
|
||||
#endif
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
static bool errors = FALSE;
|
||||
/* Whether we got any errors while parsing an rcfile. */
|
||||
static size_t lineno = 0;
|
||||
/* If we did, the line number where the current error
|
||||
* occurred. */
|
||||
static char *nanorc = NULL;
|
||||
/* The path to the rcfile we're parsing. */
|
||||
#ifdef ENABLE_COLOR
|
||||
static syntaxtype *endsyntax = NULL;
|
||||
/* The end of the list of syntaxes. */
|
||||
@@ -104,7 +107,7 @@ static colortype *endcolor = NULL;
|
||||
#endif
|
||||
|
||||
/* We have an error in some part of the rcfile. Put it on stderr and
|
||||
* make the user hit Return to continue starting up nano. */
|
||||
* make the user hit Enter to continue starting up nano. */
|
||||
void rcfile_error(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -112,8 +115,7 @@ void rcfile_error(const char *msg, ...)
|
||||
fprintf(stderr, "\n");
|
||||
if (lineno > 0) {
|
||||
errors = TRUE;
|
||||
fprintf(stderr, _("Error in %s on line %lu: "), nanorc,
|
||||
(unsigned long)lineno);
|
||||
fprintf(stderr, _("Error in %s on line %lu: "), nanorc, (unsigned long)lineno);
|
||||
}
|
||||
|
||||
va_start(ap, msg);
|
||||
@@ -182,9 +184,11 @@ char *parse_argument(char *ptr)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
int color_to_int(const char *colorname, bool *bright)
|
||||
/* Return the short value corresponding to the color named in colorname,
|
||||
* and set bright to TRUE if that color is bright. */
|
||||
short color_to_short(const char *colorname, bool *bright)
|
||||
{
|
||||
int mcolor = -1;
|
||||
short mcolor = -1;
|
||||
|
||||
assert(colorname != NULL && bright != NULL);
|
||||
|
||||
@@ -219,6 +223,7 @@ int color_to_int(const char *colorname, bool *bright)
|
||||
return mcolor;
|
||||
}
|
||||
|
||||
/* Parse the next regex string from the line at ptr, and return it. */
|
||||
char *parse_next_regex(char *ptr)
|
||||
{
|
||||
assert(ptr != NULL);
|
||||
@@ -246,27 +251,33 @@ char *parse_next_regex(char *ptr)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* Compile the regular expression regex to preg. Return FALSE on
|
||||
* success, or TRUE if the expression is invalid. */
|
||||
bool nregcomp(regex_t *preg, const char *regex, int eflags)
|
||||
/* Compile the regular expression regex to see if it's valid. Return
|
||||
* TRUE if it is, or FALSE otherwise. */
|
||||
bool nregcomp(const char *regex, int eflags)
|
||||
{
|
||||
int rc = regcomp(preg, regex, REG_EXTENDED | eflags);
|
||||
regex_t preg;
|
||||
int rc = regcomp(&preg, regex, REG_EXTENDED | eflags);
|
||||
|
||||
if (rc != 0) {
|
||||
size_t len = regerror(rc, preg, NULL, 0);
|
||||
size_t len = regerror(rc, &preg, NULL, 0);
|
||||
char *str = charalloc(len);
|
||||
|
||||
regerror(rc, preg, str, len);
|
||||
regerror(rc, &preg, str, len);
|
||||
rcfile_error(N_("Bad regex \"%s\": %s"), regex, str);
|
||||
free(str);
|
||||
}
|
||||
|
||||
return (rc != 0);
|
||||
regfree(&preg);
|
||||
|
||||
return (rc == 0);
|
||||
}
|
||||
|
||||
/* Parse the next syntax string from the line at ptr, and add it to the
|
||||
* global list of color syntaxes. */
|
||||
void parse_syntax(char *ptr)
|
||||
{
|
||||
const char *fileregptr = NULL, *nameptr = NULL;
|
||||
const syntaxtype *tmpsyntax;
|
||||
exttype *endext = NULL;
|
||||
/* The end of the extensions list for this syntax. */
|
||||
|
||||
@@ -291,6 +302,14 @@ void parse_syntax(char *ptr)
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcmp(nameptr, tmpsyntax->desc) == 0) {
|
||||
rcfile_error(N_("Duplicate syntax name %s"), nameptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
syntaxes = (syntaxtype *)nmalloc(sizeof(syntaxtype));
|
||||
endsyntax = syntaxes;
|
||||
@@ -301,15 +320,31 @@ void parse_syntax(char *ptr)
|
||||
fprintf(stderr, "Adding new syntax after first one\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
endsyntax->desc = mallocstrcpy(NULL, nameptr);
|
||||
endsyntax->color = NULL;
|
||||
endcolor = NULL;
|
||||
endsyntax->extensions = NULL;
|
||||
endsyntax->next = NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
|
||||
#endif
|
||||
|
||||
/* The "none" syntax is the same as not having a syntax at all, so
|
||||
* we can't assign any extensions or colors to it. */
|
||||
if (strcmp(endsyntax->desc, "none") == 0) {
|
||||
rcfile_error(N_("The \"none\" syntax is reserved"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* The default syntax should have no associated extensions. */
|
||||
if (strcmp(endsyntax->desc, "default") == 0 && *ptr != '\0') {
|
||||
rcfile_error(
|
||||
N_("The \"default\" syntax must take no extensions"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Now load the extensions into their part of the struct. */
|
||||
while (*ptr != '\0') {
|
||||
exttype *newext;
|
||||
@@ -329,24 +364,29 @@ void parse_syntax(char *ptr)
|
||||
break;
|
||||
|
||||
newext = (exttype *)nmalloc(sizeof(exttype));
|
||||
if (nregcomp(&newext->val, fileregptr, REG_NOSUB))
|
||||
free(newext);
|
||||
else {
|
||||
|
||||
/* Save the extension regex if it's valid. */
|
||||
if (nregcomp(fileregptr, REG_NOSUB)) {
|
||||
newext->ext_regex = mallocstrcpy(NULL, fileregptr);
|
||||
newext->ext = NULL;
|
||||
|
||||
if (endext == NULL)
|
||||
endsyntax->extensions = newext;
|
||||
else
|
||||
endext->next = newext;
|
||||
endext = newext;
|
||||
endext->next = NULL;
|
||||
}
|
||||
} else
|
||||
free(newext);
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the color stuff into the colorstrings array. If icase is TRUE,
|
||||
* treat the color stuff as case insensitive. */
|
||||
/* Parse the color string in the line at ptr, and add it to the current
|
||||
* file's associated colors. If icase is TRUE, treat the color string
|
||||
* as case insensitive. */
|
||||
void parse_colors(char *ptr, bool icase)
|
||||
{
|
||||
int fg, bg;
|
||||
short fg, bg;
|
||||
bool bright = FALSE, no_fgcolor = FALSE;
|
||||
char *fgstr;
|
||||
|
||||
@@ -377,12 +417,12 @@ void parse_colors(char *ptr, bool icase)
|
||||
bgcolorname);
|
||||
return;
|
||||
}
|
||||
bg = color_to_int(bgcolorname, &bright);
|
||||
bg = color_to_short(bgcolorname, &bright);
|
||||
} else
|
||||
bg = -1;
|
||||
|
||||
if (!no_fgcolor) {
|
||||
fg = color_to_int(fgstr, &bright);
|
||||
fg = color_to_short(fgstr, &bright);
|
||||
|
||||
/* Don't try to parse screwed-up foreground colors. */
|
||||
if (fg == -1)
|
||||
@@ -425,34 +465,45 @@ void parse_colors(char *ptr, bool icase)
|
||||
|
||||
ptr++;
|
||||
|
||||
newcolor = (colortype *)nmalloc(sizeof(colortype));
|
||||
fgstr = ptr;
|
||||
ptr = parse_next_regex(ptr);
|
||||
if (ptr == NULL)
|
||||
break;
|
||||
|
||||
if (nregcomp(&newcolor->start, fgstr, icase ? REG_ICASE : 0)) {
|
||||
free(newcolor);
|
||||
cancelled = TRUE;
|
||||
} else {
|
||||
newcolor = (colortype *)nmalloc(sizeof(colortype));
|
||||
|
||||
/* Save the starting regex string if it's valid, and set up the
|
||||
* color information. */
|
||||
if (nregcomp(fgstr, icase ? REG_ICASE : 0)) {
|
||||
newcolor->fg = fg;
|
||||
newcolor->bg = bg;
|
||||
newcolor->bright = bright;
|
||||
newcolor->next = NULL;
|
||||
newcolor->icase = icase;
|
||||
|
||||
newcolor->start_regex = mallocstrcpy(NULL, fgstr);
|
||||
newcolor->start = NULL;
|
||||
|
||||
newcolor->end_regex = NULL;
|
||||
newcolor->end = NULL;
|
||||
|
||||
newcolor->next = NULL;
|
||||
|
||||
if (endcolor == NULL) {
|
||||
endsyntax->color = newcolor;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting a new colorstring for fg %d, bg %d\n", fg, bg);
|
||||
fprintf(stderr, "Starting a new colorstring for fg %hd, bg %hd\n", fg, bg);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Adding new entry for fg %d, bg %d\n", fg, bg);
|
||||
fprintf(stderr, "Adding new entry for fg %hd, bg %hd\n", fg, bg);
|
||||
#endif
|
||||
endcolor->next = newcolor;
|
||||
}
|
||||
|
||||
endcolor = newcolor;
|
||||
} else {
|
||||
free(newcolor);
|
||||
cancelled = TRUE;
|
||||
}
|
||||
|
||||
if (expectend) {
|
||||
@@ -480,17 +531,16 @@ void parse_colors(char *ptr, bool icase)
|
||||
if (cancelled)
|
||||
continue;
|
||||
|
||||
newcolor->end = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
if (nregcomp(newcolor->end, fgstr, icase ? REG_ICASE : 0)) {
|
||||
free(newcolor->end);
|
||||
newcolor->end = NULL;
|
||||
}
|
||||
/* Save the ending regex string if it's valid. */
|
||||
newcolor->end_regex = (nregcomp(fgstr, icase ? REG_ICASE :
|
||||
0)) ? mallocstrcpy(NULL, fgstr) : NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
/* Parse the rcfile, once it has been opened successfully. */
|
||||
/* Parse the rcfile, once it has been opened successfully at
|
||||
* rcstream. */
|
||||
void parse_rcfile(FILE *rcstream)
|
||||
{
|
||||
char *buf = NULL;
|
||||
@@ -598,7 +648,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
free(option);
|
||||
} else
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
||||
whitespace = option;
|
||||
if (mbstrlen(whitespace) != 2 ||
|
||||
@@ -610,11 +660,10 @@ void parse_rcfile(FILE *rcstream)
|
||||
} else {
|
||||
whitespace_len[0] =
|
||||
parse_mbchar(whitespace, NULL,
|
||||
NULL, NULL);
|
||||
NULL);
|
||||
whitespace_len[1] =
|
||||
parse_mbchar(whitespace +
|
||||
whitespace_len[0], NULL,
|
||||
NULL, NULL);
|
||||
whitespace_len[0], NULL, NULL);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
@@ -641,7 +690,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
quotestr = option;
|
||||
else
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (strcasecmp(rcopts[i].name,
|
||||
"backupdir") == 0)
|
||||
backup_dir = option;
|
||||
@@ -686,8 +735,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
|
||||
if (errors) {
|
||||
errors = FALSE;
|
||||
fprintf(stderr,
|
||||
_("\nPress Return to continue starting nano\n"));
|
||||
fprintf(stderr, _("\nPress Enter to continue starting nano\n"));
|
||||
while (getchar() != '\n')
|
||||
;
|
||||
}
|
||||
@@ -695,14 +743,13 @@ void parse_rcfile(FILE *rcstream)
|
||||
return;
|
||||
}
|
||||
|
||||
/* The main rc file function, tries to open the rc file */
|
||||
/* The main rcfile function. It tries to open the system-wide rcfile,
|
||||
* followed by the local rcfile. */
|
||||
void do_rcfile(void)
|
||||
{
|
||||
FILE *rcstream;
|
||||
|
||||
#ifdef SYSCONFDIR
|
||||
assert(sizeof(SYSCONFDIR) == strlen(SYSCONFDIR) + 1);
|
||||
|
||||
nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");
|
||||
/* Try to open the system-wide nanorc. */
|
||||
rcstream = fopen(nanorc, "r");
|
||||
|
||||
713
src/search.c
713
src/search.c
File diff suppressed because it is too large
Load Diff
2264
src/text.c
Normal file
2264
src/text.c
Normal file
File diff suppressed because it is too large
Load Diff
374
src/utils.c
374
src/utils.c
@@ -2,7 +2,8 @@
|
||||
/**************************************************************************
|
||||
* utils.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -20,41 +21,16 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "proto.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
/* Work around a potential segfault in glibc 2.2.3's regexec(). */
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
if (string != NULL && *string != '\0')
|
||||
return regexec(preg, string, nmatch, pmatch, eflags);
|
||||
|
||||
return REG_NOMATCH;
|
||||
}
|
||||
#endif
|
||||
|
||||
int 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);
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
/* Return the number of decimal digits in n. */
|
||||
int digits(size_t n)
|
||||
{
|
||||
int i = 1;
|
||||
@@ -118,7 +94,7 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||
comma = strchr(str, ',');
|
||||
|
||||
if (comma != NULL && column != NULL) {
|
||||
if (!parse_num(str + (comma - str + 1), column))
|
||||
if (!parse_num(comma + 1, column))
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
@@ -180,10 +156,33 @@ void sunder(char *str)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
/* These functions, ngetline() (originally getline()) and ngetdelim()
|
||||
* (originally getdelim()), were adapted from GNU mailutils 0.5
|
||||
* (mailbox/getline.c). Here is the notice from that file, after
|
||||
* converting to the GPL via LGPL clause 3, and with the Free Software
|
||||
* Foundation's address updated:
|
||||
*
|
||||
* GNU Mailutils -- a suite of utilities for electronic mail
|
||||
* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
*
|
||||
* This library 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 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA. */
|
||||
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
#ifndef HAVE_GETLINE
|
||||
/* This function is equivalent to getline(). It was adapted from
|
||||
* GNU mailutils' getline() function. */
|
||||
/* This function is equivalent to getline(). */
|
||||
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream)
|
||||
{
|
||||
return getdelim(lineptr, n, '\n', stream);
|
||||
@@ -191,16 +190,14 @@ ssize_t ngetline(char **lineptr, size_t *n, FILE *stream)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETDELIM
|
||||
/* This function is equivalent to getdelim(). It was adapted from
|
||||
* GNU mailutils' getdelim() function. */
|
||||
/* This function is equivalent to getdelim(). */
|
||||
ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
{
|
||||
size_t indx = 0;
|
||||
int c;
|
||||
|
||||
/* Sanity checks. */
|
||||
if (lineptr == NULL || n == NULL || stream == NULL)
|
||||
return -1;
|
||||
assert(lineptr != NULL && n != NULL && stream != NULL);
|
||||
|
||||
/* Allocate the line the first time. */
|
||||
if (*lineptr == NULL) {
|
||||
@@ -215,7 +212,7 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
*n += MAX_BUF_SIZE;
|
||||
}
|
||||
|
||||
/* Push the result in the line. */
|
||||
/* Put the result in the line. */
|
||||
(*lineptr)[indx++] = (char)c;
|
||||
|
||||
/* Bail out. */
|
||||
@@ -233,12 +230,62 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
null_at(lineptr, indx++);
|
||||
*n = indx;
|
||||
|
||||
/* The last line may not have the delimiter, we have to return what
|
||||
* we got and the error will be seen on the next iteration. */
|
||||
/* The last line may not have the delimiter. We have to return what
|
||||
* we got, and the error will be seen on the next iteration. */
|
||||
return (c == EOF && (indx - 1) == 0) ? -1 : indx - 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
||||
#endif /* !NANO_TINY && ENABLE_NANORC */
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
/* Work around a potential segfault in glibc 2.2.3's regexec(). */
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
if (string != NULL && *string != '\0')
|
||||
return regexec(preg, string, nmatch, pmatch, eflags);
|
||||
|
||||
return REG_NOMATCH;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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);
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
/* Is the word starting at position pos in buf a whole word? */
|
||||
bool is_whole_word(size_t pos, const char *buf, const char *word)
|
||||
{
|
||||
char *p = charalloc(mb_cur_max()), *r = charalloc(mb_cur_max());
|
||||
size_t word_end = pos + strlen(word);
|
||||
bool retval;
|
||||
|
||||
assert(buf != NULL && pos <= strlen(buf) && word != NULL);
|
||||
|
||||
parse_mbchar(buf + move_mbleft(buf, pos), p, NULL);
|
||||
parse_mbchar(buf + word_end, r, NULL);
|
||||
|
||||
/* If we're at the beginning of the line or the character before the
|
||||
* word isn't a non-punctuation "word" character, and if we're at
|
||||
* the end of the line or the character after the word isn't a
|
||||
* non-punctuation "word" character, we have a whole word. */
|
||||
retval = (pos == 0 || !is_word_mbchar(p, FALSE)) &&
|
||||
(word_end == strlen(buf) || !is_word_mbchar(r, FALSE));
|
||||
|
||||
free(p);
|
||||
free(r);
|
||||
|
||||
return retval;
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER */
|
||||
|
||||
/* If we are searching backwards, we will find the last match that
|
||||
* starts no later than start. Otherwise we find the first match
|
||||
@@ -258,7 +305,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
if (regexec(&search_regexp, haystack, 1, regmatches,
|
||||
0) == 0 && haystack + regmatches[0].rm_so <= start) {
|
||||
@@ -276,7 +323,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
return retval;
|
||||
}
|
||||
} else
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
if (regexec(&search_regexp, start, 10, regmatches,
|
||||
(start > haystack) ? REG_NOTBOL : 0) == 0) {
|
||||
const char *retval = start + regmatches[0].rm_so;
|
||||
@@ -287,17 +334,17 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
return NULL;
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_SPELLER)
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_SPELLER)
|
||||
if (ISSET(CASE_SENSITIVE)) {
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
return revstrstr(haystack, needle, start);
|
||||
else
|
||||
#endif
|
||||
return strstr(start, needle);
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER || !NANO_SMALL */
|
||||
#ifndef NANO_SMALL
|
||||
#endif /* !DISABLE_SPELLER || !NANO_TINY */
|
||||
#ifndef NANO_TINY
|
||||
else if (ISSET(BACKWARDS_SEARCH))
|
||||
return mbrevstrcasestr(haystack, needle, start);
|
||||
#endif
|
||||
@@ -317,7 +364,9 @@ void nperror(const char *s)
|
||||
}
|
||||
}
|
||||
|
||||
/* Thanks, BG, many people have been asking for this... */
|
||||
/* This is a wrapper for the malloc() function that properly handles
|
||||
* things when we run out of memory. Thanks, BG, many people have been
|
||||
* asking for this... */
|
||||
void *nmalloc(size_t howmuch)
|
||||
{
|
||||
void *r = malloc(howmuch);
|
||||
@@ -328,6 +377,8 @@ void *nmalloc(size_t howmuch)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* This is a wrapper for the realloc() function that properly handles
|
||||
* things when we run out of memory. */
|
||||
void *nrealloc(void *ptr, size_t howmuch)
|
||||
{
|
||||
void *r = realloc(ptr, howmuch);
|
||||
@@ -372,103 +423,218 @@ char *mallocstrassn(char *dest, char *src)
|
||||
return src;
|
||||
}
|
||||
|
||||
/* nano scrolls horizontally within a line in chunks. Return the column
|
||||
* number of the first character displayed in the edit window when the
|
||||
* cursor is at the given column. Note that (0 <= column -
|
||||
* get_page_start(column) < COLS). */
|
||||
size_t get_page_start(size_t column)
|
||||
{
|
||||
if (column == 0 || column < COLS - 1)
|
||||
return 0;
|
||||
else if (COLS > 8)
|
||||
return column - 7 - (column - 7) % (COLS - 8);
|
||||
else
|
||||
return column - (COLS - 2);
|
||||
}
|
||||
|
||||
/* Return the placewewant associated with current_x, i.e, the zero-based
|
||||
* column position of the cursor. The value will be no smaller than
|
||||
* current_x. */
|
||||
size_t xplustabs(void)
|
||||
{
|
||||
return strnlenpt(openfile->current->data, openfile->current_x);
|
||||
}
|
||||
|
||||
/* Return the index in s of the character displayed at the given column,
|
||||
* i.e, the largest value such that strnlenpt(s, actual_x(s, column)) <=
|
||||
* column. */
|
||||
size_t actual_x(const char *s, size_t column)
|
||||
{
|
||||
size_t i = 0;
|
||||
/* The position in s, returned. */
|
||||
size_t len = 0;
|
||||
/* The screen display width to s[i]. */
|
||||
|
||||
assert(s != NULL);
|
||||
|
||||
while (*s != '\0') {
|
||||
int s_len = parse_mbchar(s, NULL, &len);
|
||||
|
||||
if (len > column)
|
||||
break;
|
||||
|
||||
i += s_len;
|
||||
s += s_len;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/* A strnlen() with tabs and multicolumn characters factored in, similar
|
||||
* to xplustabs(). How many columns wide are the first maxlen characters
|
||||
* of s? */
|
||||
size_t strnlenpt(const char *s, size_t maxlen)
|
||||
{
|
||||
size_t len = 0;
|
||||
/* The screen display width to s[i]. */
|
||||
|
||||
if (maxlen == 0)
|
||||
return 0;
|
||||
|
||||
assert(s != NULL);
|
||||
|
||||
while (*s != '\0') {
|
||||
int s_len = parse_mbchar(s, NULL, &len);
|
||||
|
||||
s += s_len;
|
||||
|
||||
if (maxlen <= s_len)
|
||||
break;
|
||||
|
||||
maxlen -= s_len;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/* A strlen() with tabs and multicolumn characters factored in, similar
|
||||
* to xplustabs(). How many columns wide is s? */
|
||||
size_t strlenpt(const char *s)
|
||||
{
|
||||
return strnlenpt(s, (size_t)-1);
|
||||
}
|
||||
|
||||
/* Append a new magicline to filebot. */
|
||||
void new_magicline(void)
|
||||
{
|
||||
filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
filebot->next->data = mallocstrcpy(NULL, "");
|
||||
filebot->next->prev = filebot;
|
||||
filebot->next->next = NULL;
|
||||
filebot->next->lineno = filebot->lineno + 1;
|
||||
filebot = filebot->next;
|
||||
totlines++;
|
||||
totsize++;
|
||||
openfile->filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
openfile->filebot->next->data = mallocstrcpy(NULL, "");
|
||||
openfile->filebot->next->prev = openfile->filebot;
|
||||
openfile->filebot->next->next = NULL;
|
||||
openfile->filebot->next->lineno = openfile->filebot->lineno + 1;
|
||||
openfile->filebot = openfile->filebot->next;
|
||||
openfile->totsize++;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Remove the magicline from filebot, if there is one and it isn't the
|
||||
* only line in the file. */
|
||||
* only line in the file. Assume that edittop and current are not at
|
||||
* filebot. */
|
||||
void remove_magicline(void)
|
||||
{
|
||||
if (filebot->data[0] == '\0' && filebot->prev != NULL) {
|
||||
filebot = filebot->prev;
|
||||
free_filestruct(filebot->next);
|
||||
filebot->next = NULL;
|
||||
totlines--;
|
||||
totsize--;
|
||||
if (openfile->filebot->data[0] == '\0' &&
|
||||
openfile->filebot != openfile->fileage) {
|
||||
assert(openfile->filebot != openfile->edittop && openfile->filebot != openfile->current);
|
||||
|
||||
openfile->filebot = openfile->filebot->prev;
|
||||
free_filestruct(openfile->filebot->next);
|
||||
openfile->filebot->next = NULL;
|
||||
openfile->totsize--;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set top_x and bot_x to the top and bottom x-coordinates of the mark,
|
||||
* respectively, based on the locations of top and bot. If
|
||||
* right_side_up isn't NULL, set it to TRUE If the mark begins with
|
||||
* (mark_beginbuf, mark_beginx) and ends with (current, current_x), or
|
||||
* (mark_begin, mark_begin_x) and ends with (current, current_x), or
|
||||
* FALSE otherwise. */
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up)
|
||||
{
|
||||
assert(top != NULL && top_x != NULL && bot != NULL && bot_x != NULL);
|
||||
|
||||
if ((current->lineno == mark_beginbuf->lineno && current_x >
|
||||
mark_beginx) || current->lineno > mark_beginbuf->lineno) {
|
||||
*top = mark_beginbuf;
|
||||
*top_x = mark_beginx;
|
||||
*bot = current;
|
||||
*bot_x = current_x;
|
||||
if ((openfile->current->lineno == openfile->mark_begin->lineno &&
|
||||
openfile->current_x > openfile->mark_begin_x) ||
|
||||
openfile->current->lineno > openfile->mark_begin->lineno) {
|
||||
*top = openfile->mark_begin;
|
||||
*top_x = openfile->mark_begin_x;
|
||||
*bot = openfile->current;
|
||||
*bot_x = openfile->current_x;
|
||||
if (right_side_up != NULL)
|
||||
*right_side_up = TRUE;
|
||||
} else {
|
||||
*bot = mark_beginbuf;
|
||||
*bot_x = mark_beginx;
|
||||
*top = current;
|
||||
*top_x = current_x;
|
||||
*bot = openfile->mark_begin;
|
||||
*bot_x = openfile->mark_begin_x;
|
||||
*top = openfile->current;
|
||||
*top_x = openfile->current_x;
|
||||
if (right_side_up != NULL)
|
||||
*right_side_up = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Calculate the number of lines and the number of characters between
|
||||
* begin and end, and return them in lines and size, respectively. */
|
||||
void get_totals(const filestruct *begin, const filestruct *end, size_t
|
||||
*lines, size_t *size)
|
||||
/* Calculate the number of characters between begin and end, and return
|
||||
* it. */
|
||||
size_t get_totsize(const filestruct *begin, const filestruct *end)
|
||||
{
|
||||
size_t totsize = 0;
|
||||
const filestruct *f;
|
||||
|
||||
if (lines != NULL)
|
||||
*lines = 0;
|
||||
if (size != NULL)
|
||||
*size = 0;
|
||||
|
||||
/* Go through the lines from begin to end->prev, if we can. */
|
||||
for (f = begin; f != NULL && f != end; f = f->next) {
|
||||
/* Count this line. */
|
||||
if (lines != NULL)
|
||||
(*lines)++;
|
||||
|
||||
for (f = begin; f != end && f != NULL; f = f->next) {
|
||||
/* Count the number of characters on this line. */
|
||||
if (size != NULL) {
|
||||
*size += mbstrlen(f->data);
|
||||
totsize += mbstrlen(f->data);
|
||||
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
(*size)++;
|
||||
}
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
totsize++;
|
||||
}
|
||||
|
||||
/* Go through the line at end, if we can. */
|
||||
if (f != NULL) {
|
||||
/* Count this line. */
|
||||
if (lines != NULL)
|
||||
(*lines)++;
|
||||
|
||||
/* Count the number of characters on this line. */
|
||||
if (size != NULL) {
|
||||
*size += mbstrlen(f->data);
|
||||
totsize += mbstrlen(f->data);
|
||||
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
(*size)++;
|
||||
}
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
totsize++;
|
||||
}
|
||||
|
||||
return totsize;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
/* Return what the current line number should be, starting at edittop
|
||||
* and ending at fileptr. */
|
||||
int check_linenumbers(const filestruct *fileptr)
|
||||
{
|
||||
int check_line = 0;
|
||||
const filestruct *filetmp;
|
||||
|
||||
for (filetmp = openfile->edittop; filetmp != fileptr;
|
||||
filetmp = filetmp->next)
|
||||
check_line++;
|
||||
|
||||
return check_line;
|
||||
}
|
||||
#endif /* !NDEBUG */
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Dump the filestruct inptr to stderr. */
|
||||
void dump_filestruct(const filestruct *inptr)
|
||||
{
|
||||
if (inptr == openfile->fileage)
|
||||
fprintf(stderr, "Dumping file buffer to stderr...\n");
|
||||
else if (inptr == cutbuffer)
|
||||
fprintf(stderr, "Dumping cutbuffer to stderr...\n");
|
||||
else
|
||||
fprintf(stderr, "Dumping a buffer to stderr...\n");
|
||||
|
||||
while (inptr != NULL) {
|
||||
fprintf(stderr, "(%ld) %s\n", (long)inptr->lineno, inptr->data);
|
||||
inptr = inptr->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dump the current buffer's filestruct to stderr in reverse. */
|
||||
void dump_filestruct_reverse(void)
|
||||
{
|
||||
const filestruct *fileptr = openfile->filebot;
|
||||
|
||||
while (fileptr != NULL) {
|
||||
fprintf(stderr, "(%ld) %s\n", (long)fileptr->lineno,
|
||||
fileptr->data);
|
||||
fileptr = fileptr->prev;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
2344
src/winio.c
2344
src/winio.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user