Compare commits
426 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db5b54767c | ||
|
|
1df1c9e4c0 | ||
|
|
5c8d316a27 | ||
|
|
d76de38109 | ||
|
|
5c878088a1 | ||
|
|
d4401008a4 | ||
|
|
a4fc77a5da | ||
|
|
5aaa1d7dab | ||
|
|
6885a1523c | ||
|
|
af72c16da4 | ||
|
|
9e2f8ea668 | ||
|
|
23ed015725 | ||
|
|
bd2c8f3d2d | ||
|
|
df7aaed743 | ||
|
|
186c795b88 | ||
|
|
832994804e | ||
|
|
bac8908814 | ||
|
|
ee995b7d27 | ||
|
|
5b0781dbf3 | ||
|
|
3dd9d710a1 | ||
|
|
4f2a073cf9 | ||
|
|
b0226fb86a | ||
|
|
386cc99385 | ||
|
|
03979d7a08 | ||
|
|
d4686b8e51 | ||
|
|
503bad02fe | ||
|
|
9134781eaf | ||
|
|
f073884e03 | ||
|
|
f9d13f02f3 | ||
|
|
f32e1dd589 | ||
|
|
b5e66d05cb | ||
|
|
3ce7e9dcac | ||
|
|
85c775a3a3 | ||
|
|
8d42a3bfaa | ||
|
|
a6a06a99af | ||
|
|
c9855a7e46 | ||
|
|
9c2f7ab341 | ||
|
|
11516e0384 | ||
|
|
1d60d78dbd | ||
|
|
9368217972 | ||
|
|
131909fdea | ||
|
|
69395f457d | ||
|
|
fed0195f2d | ||
|
|
4bb60db078 | ||
|
|
25bc37e7c8 | ||
|
|
69e1ce56df | ||
|
|
9e553b21f3 | ||
|
|
f94b993535 | ||
|
|
2d0d60b796 | ||
|
|
f102208c05 | ||
|
|
c504e40a81 | ||
|
|
c923eb9c6a | ||
|
|
6cca33745c | ||
|
|
96dce26401 | ||
|
|
b9c5a5c879 | ||
|
|
0e963be59d | ||
|
|
b5a7bbf4f3 | ||
|
|
57d81ecef9 | ||
|
|
f94fbbc9f4 | ||
|
|
7d9e5bfb36 | ||
|
|
0517d09788 | ||
|
|
888bc14416 | ||
|
|
4dbdbd4660 | ||
|
|
497a9a2032 | ||
|
|
106c1bf3d1 | ||
|
|
f70f67bd10 | ||
|
|
299ab27363 | ||
|
|
a95bdee2cf | ||
|
|
76436426de | ||
|
|
5031ddf8ea | ||
|
|
8f07329d00 | ||
|
|
a004334024 | ||
|
|
cb11a20333 | ||
|
|
e4157968fb | ||
|
|
cf876d5396 | ||
|
|
97eb8e6551 | ||
|
|
5e6434cf54 | ||
|
|
17ab6ed580 | ||
|
|
6119fabdcc | ||
|
|
5f90b4fbd8 | ||
|
|
3dc0e23e0c | ||
|
|
c1662f2eb7 | ||
|
|
95ff10ec47 | ||
|
|
1f5cf0d111 | ||
|
|
2888964c76 | ||
|
|
f397dae5c5 | ||
|
|
a8239c313d | ||
|
|
8d2d0d9a11 | ||
|
|
5cadadd4c2 | ||
|
|
8602fd6aaa | ||
|
|
7f1b1198a7 | ||
|
|
a5b1ca2808 | ||
|
|
5c7d88dc16 | ||
|
|
a620e683e7 | ||
|
|
100bc30d63 | ||
|
|
184955d0c1 | ||
|
|
6fb6689f0f | ||
|
|
a7ca9008bc | ||
|
|
f451d6a64a | ||
|
|
12e3708ead | ||
|
|
9a5139e9d3 | ||
|
|
e2afdbb14b | ||
|
|
5b1d876045 | ||
|
|
f4cf5edd06 | ||
|
|
5566e442b1 | ||
|
|
db39a5e80d | ||
|
|
558d34f5ba | ||
|
|
0b4920adc9 | ||
|
|
2ef7dae971 | ||
|
|
3c780e1d10 | ||
|
|
561db3a7c4 | ||
|
|
bd6e968506 | ||
|
|
d5228b3d82 | ||
|
|
964722a281 | ||
|
|
1320d29267 | ||
|
|
d6eb17515d | ||
|
|
e328ae9423 | ||
|
|
c7251fa4fc | ||
|
|
0c9551a4dd | ||
|
|
2a56ce79c5 | ||
|
|
0b65402b60 | ||
|
|
305d889e9d | ||
|
|
8aa9ac3657 | ||
|
|
3af1e50855 | ||
|
|
b4428a0268 | ||
|
|
592f46bf35 | ||
|
|
8e341e1b22 | ||
|
|
5538150e0a | ||
|
|
4567277310 | ||
|
|
8816564bf2 | ||
|
|
f1e5627ebe | ||
|
|
9133cbe258 | ||
|
|
6fe4e2be04 | ||
|
|
ef0d5a7637 | ||
|
|
6b49e9e54e | ||
|
|
139fa65c66 | ||
|
|
2829aae635 | ||
|
|
be231d39ad | ||
|
|
b7acc735db | ||
|
|
ce8623669b | ||
|
|
41b8972dc9 | ||
|
|
83635c2155 | ||
|
|
124978a5bc | ||
|
|
44abeea53c | ||
|
|
252ecebaf7 | ||
|
|
376eea3d25 | ||
|
|
f320d31ef0 | ||
|
|
c0899cb8eb | ||
|
|
51cb7fd293 | ||
|
|
39bd1b3597 | ||
|
|
cd243f558a | ||
|
|
af7677ecb6 | ||
|
|
d99b0e1cf3 | ||
|
|
b9446ac429 | ||
|
|
c9d76207f3 | ||
|
|
75e9dfe5a4 | ||
|
|
c074edfe36 | ||
|
|
2d3d1e9324 | ||
|
|
139bae0826 | ||
|
|
b6aaa8f365 | ||
|
|
60edb0a989 | ||
|
|
10f8e880ba | ||
|
|
e2c9c58104 | ||
|
|
8803dd8768 | ||
|
|
c1c818ebd5 | ||
|
|
d8d1e26e54 | ||
|
|
4239c3c218 | ||
|
|
e77ebfa3fa | ||
|
|
3fe5acebea | ||
|
|
4f4a0b9abb | ||
|
|
a01f131960 | ||
|
|
f70eca06be | ||
|
|
9dbd0d26c2 | ||
|
|
b7d8926209 | ||
|
|
660e05be3d | ||
|
|
75850e501a | ||
|
|
797c9dd0f6 | ||
|
|
f5d6d9985b | ||
|
|
5b94b8e322 | ||
|
|
0547f51816 | ||
|
|
08f16e2fc7 | ||
|
|
bbabf9562a | ||
|
|
4218206fec | ||
|
|
31efe99e20 | ||
|
|
1c5af644b5 | ||
|
|
fc0f8f8c57 | ||
|
|
d29e861376 | ||
|
|
8992d0adaa | ||
|
|
02a7f84412 | ||
|
|
26dd1b66de | ||
|
|
0df4de37c3 | ||
|
|
f2fe1fd263 | ||
|
|
3cba266d4d | ||
|
|
cf8082f87f | ||
|
|
560e83f143 | ||
|
|
b02a1950e7 | ||
|
|
a5f833de42 | ||
|
|
c7b9e15e9a | ||
|
|
27d5be5e36 | ||
|
|
f22fa1341e | ||
|
|
602199da12 | ||
|
|
0ec909cb98 | ||
|
|
5bb7727740 | ||
|
|
b22c80ad1d | ||
|
|
90b60edc3f | ||
|
|
f629aad27b | ||
|
|
6e7d24dcdc | ||
|
|
3f77c77f11 | ||
|
|
0a208b3b62 | ||
|
|
2545686481 | ||
|
|
80669c34bb | ||
|
|
9e73d98a60 | ||
|
|
eb4f90e182 | ||
|
|
aa4dc9596f | ||
|
|
f0e3ca6e88 | ||
|
|
ac37b04737 | ||
|
|
c7d6f985c7 | ||
|
|
af9052d7c7 | ||
|
|
2ca3fc9fa6 | ||
|
|
7a9422b77d | ||
|
|
e7f9813284 | ||
|
|
12c1b5913a | ||
|
|
fd3cceee44 | ||
|
|
7194a617c4 | ||
|
|
2e8fac6487 | ||
|
|
5c819b53e1 | ||
|
|
d9eca4b8bf | ||
|
|
bf7842090b | ||
|
|
5f274c4b49 | ||
|
|
fbf46a5d88 | ||
|
|
4d9ef69f8e | ||
|
|
4527da5e9b | ||
|
|
8bf39a38fe | ||
|
|
6d1112314b | ||
|
|
f85001a368 | ||
|
|
cf1879b706 | ||
|
|
9dd268730c | ||
|
|
190fae0043 | ||
|
|
0d0d636e72 | ||
|
|
3bcca171ae | ||
|
|
c208ef7f23 | ||
|
|
c838a4cd45 | ||
|
|
fe48da7d74 | ||
|
|
58fabec261 | ||
|
|
bd5966061c | ||
|
|
95b9850517 | ||
|
|
7504714882 | ||
|
|
714c522413 | ||
|
|
fcff1e7401 | ||
|
|
c87e0c0965 | ||
|
|
bc80cb1ba7 | ||
|
|
854a44a414 | ||
|
|
939d4239d4 | ||
|
|
8137876426 | ||
|
|
bf487985bc | ||
|
|
9adc445c5c | ||
|
|
9ea05902ec | ||
|
|
18dae628d2 | ||
|
|
891e0ec281 | ||
|
|
40e0572100 | ||
|
|
2ca2356802 | ||
|
|
5a2dbe26d8 | ||
|
|
b88152d82d | ||
|
|
241771ceb5 | ||
|
|
4fd74e0db4 | ||
|
|
97415dfdc7 | ||
|
|
03252d4fbc | ||
|
|
bdf84dd8fb | ||
|
|
1df3e2d0bf | ||
|
|
d7b804ab6d | ||
|
|
3ea0b1d6d8 | ||
|
|
5f0a58b055 | ||
|
|
df45365592 | ||
|
|
6397b592fb | ||
|
|
e313f5b2c8 | ||
|
|
4879660c9a | ||
|
|
1f09769052 | ||
|
|
fe52ae0d54 | ||
|
|
728c85a119 | ||
|
|
0aeb50342a | ||
|
|
e30c308089 | ||
|
|
57f97538b1 | ||
|
|
e904888324 | ||
|
|
8ff785cf40 | ||
|
|
b9eb2be295 | ||
|
|
9461dbd72d | ||
|
|
efb4b0a96c | ||
|
|
e6757b94d3 | ||
|
|
e806ab8473 | ||
|
|
172aa93f4a | ||
|
|
e916d67389 | ||
|
|
51b1b2f1aa | ||
|
|
3a0da8bb3b | ||
|
|
b1bf7cf791 | ||
|
|
73ff694ce1 | ||
|
|
b61dc89f9a | ||
|
|
39b7189a13 | ||
|
|
8f6fb3c6b6 | ||
|
|
57c9afb9e6 | ||
|
|
f50bd4be88 | ||
|
|
b43648aae2 | ||
|
|
a33ec1deff | ||
|
|
33619f1ac5 | ||
|
|
9e9f4e22ad | ||
|
|
a33671376e | ||
|
|
8e05c315b2 | ||
|
|
cee20e50c6 | ||
|
|
03ee332640 | ||
|
|
f0134ea9b2 | ||
|
|
5fac171c8b | ||
|
|
4d72de73b1 | ||
|
|
61a70388fe | ||
|
|
af318aaa5c | ||
|
|
cde9039335 | ||
|
|
be7fd8a9be | ||
|
|
0c4e30be7c | ||
|
|
125b2f0be5 | ||
|
|
adfecd24b4 | ||
|
|
2420794355 | ||
|
|
d9ae1d6d6a | ||
|
|
8055f0935f | ||
|
|
f6287eaf54 | ||
|
|
ac8dfca510 | ||
|
|
e5af25baef | ||
|
|
9308e5210b | ||
|
|
5cbd990bf5 | ||
|
|
979de2309b | ||
|
|
b0588ae45e | ||
|
|
ca70ff69ed | ||
|
|
dd87073020 | ||
|
|
6d3485e040 | ||
|
|
22e15eb7ad | ||
|
|
71da75e92c | ||
|
|
d9d29c6220 | ||
|
|
eae8f93026 | ||
|
|
0320f5bbac | ||
|
|
4e0984775a | ||
|
|
43ef2e8326 | ||
|
|
11ff847cff | ||
|
|
f420bea2ca | ||
|
|
aa79925d6a | ||
|
|
b8d92feb62 | ||
|
|
cdf3f22c23 | ||
|
|
04061e76ad | ||
|
|
e38b808959 | ||
|
|
ce5284b748 | ||
|
|
e3d40d30c7 | ||
|
|
fb7a6bde7b | ||
|
|
1856ec4425 | ||
|
|
3c43d3d688 | ||
|
|
1f479ee9fc | ||
|
|
804e107474 | ||
|
|
81bfd8244b | ||
|
|
12c08ddf6e | ||
|
|
e006c5131d | ||
|
|
354597f0c2 | ||
|
|
b8d9fb551b | ||
|
|
04716301e0 | ||
|
|
9efbdea09c | ||
|
|
017dde2c81 | ||
|
|
572207da79 | ||
|
|
231158d61a | ||
|
|
20323a82be | ||
|
|
e6958d517d | ||
|
|
27ad0cdb37 | ||
|
|
9b33d51774 | ||
|
|
ec8a055ffd | ||
|
|
9149325400 | ||
|
|
1ec74ee30c | ||
|
|
7a27f68c5c | ||
|
|
5115fa6767 | ||
|
|
167a4b7f9c | ||
|
|
7369c75828 | ||
|
|
6ac73c9408 | ||
|
|
20494f514c | ||
|
|
ee150506d8 | ||
|
|
05454cfb75 | ||
|
|
3e7821006d | ||
|
|
535dc9cd13 | ||
|
|
ac0361df6e | ||
|
|
6816007242 | ||
|
|
1f907c7413 | ||
|
|
d83af2fea7 | ||
|
|
d4bae13d8d | ||
|
|
a8a9050083 | ||
|
|
8326254643 | ||
|
|
162ed2af24 | ||
|
|
3326603341 | ||
|
|
08f4974093 | ||
|
|
591c409f3f | ||
|
|
c0dcdf43c6 | ||
|
|
47d917eea7 | ||
|
|
8a1a886fbe | ||
|
|
5443b46241 | ||
|
|
9b268c2ebf | ||
|
|
33f2a08b5c | ||
|
|
9d8c284135 | ||
|
|
ef9dc83a4b | ||
|
|
3d8d29d08a | ||
|
|
fc8e5cb0f2 | ||
|
|
24e0a465c1 | ||
|
|
91a2a69c4f | ||
|
|
9ffe78aa57 | ||
|
|
99e3733fc6 | ||
|
|
114cfb63f4 | ||
|
|
1f104f8079 | ||
|
|
66d3ebf6a6 | ||
|
|
3a5e6f9317 | ||
|
|
475c402b65 | ||
|
|
4a2e0000f7 | ||
|
|
a6eb8480ea | ||
|
|
76f9485b02 | ||
|
|
db2dc81cee | ||
|
|
1a16df9284 | ||
|
|
d89617fb17 | ||
|
|
a248863b43 | ||
|
|
5978f9b11d | ||
|
|
5329f23345 | ||
|
|
cb475886b1 | ||
|
|
47cfd197b8 | ||
|
|
5b7b3e3c9c | ||
|
|
30bdadd4d5 | ||
|
|
89b6e6b9dd | ||
|
|
ce029f2b11 | ||
|
|
1e73bcfe29 | ||
|
|
da959919fc |
707
ChangeLog
707
ChangeLog
@@ -1,3 +1,701 @@
|
||||
GNU nano 1.3.12 - 2006.06.26
|
||||
- General:
|
||||
- Miscellaneous comment fixes. (DLR)
|
||||
- Implement filename searches in the file browser. New
|
||||
functions filesearch_init(), findnextfile(),
|
||||
findnextfile_wrap_reset(), filesearch_abort(),
|
||||
do_filesearch(), do_fileresearch(), do_first_file(),
|
||||
do_last_file(), do_help_void(), and do_browser_help(); changes
|
||||
to do_browser(), parse_browser_input(), shortcut_init(),
|
||||
do_help(), and help_init(). (DLR)
|
||||
- Open all files in binary mode for consistency and robustness.
|
||||
Changes to load_history() and do_rcfile(). (DLR)
|
||||
- Change translator-specific comments in global.c and prompt.c
|
||||
so that they show up in nano.pot, and make them all
|
||||
consistent. (Benno Schulenberg and DLR)
|
||||
- Reduce USE_UTF8 to a static bool in chars.c, allow nano.c to
|
||||
set it via a function, and allow winio.c to read its value
|
||||
when needed. New functions utf8_init() and using_utf8();
|
||||
changes to is_alnum_mbchar(), is_blank_mbchar(),
|
||||
is_cntrl_mbchar(), is_punct_mbchar(), control_mbrep(),
|
||||
mbrep(), mbwidth(), mb_cur_max(), make_mbchar(),
|
||||
parse_mbchar(), mbstrncasecmp(), mbstrcasestr(),
|
||||
mbrevstrcasestr(), mbstrnlen(), mbstrchr(), mbstrpbrk(),
|
||||
mbrevstrpbrk(), has_blank_mbchars(), is_valid_mbstring(),
|
||||
main(), display_string(), and do_credits(). (DLR)
|
||||
- Add the ability to use bold text instead of reverse video
|
||||
text, via the -D/--boldtext command line option and the
|
||||
"boldtext" rcfile option. Changes to browser_refresh(),
|
||||
do_help(), usage(), main(), update_statusbar_prompt(),
|
||||
do_yesno_prompt(), titlebar(), statusbar(), onekey(),
|
||||
edit_draw(), do_replace_highlight(), nano.1, nanorc.5,
|
||||
nano.texi, and nanorc.sample. (DLR, suggested by Benno
|
||||
Schulenberg)
|
||||
- Add the ability to use self-contained color syntaxes from
|
||||
separate files, accessible in the nanorc via the "include"
|
||||
command. New function parse_include(); changes to
|
||||
parse_rcfile(), do_nanorc(), nanorc.5, and nanorc.sample.
|
||||
(Victor Ananievsky, Brand Huntsman and DLR)
|
||||
- Change references to the "help menu" to the "help text
|
||||
display" refer to display, for clarity. Changes to
|
||||
shortcut_init(), configure.ac, and faq.html. (DLR, suggested
|
||||
by Benno Schulenberg)
|
||||
- Adjust the shortcut list display and related mouse support to
|
||||
not waste the last few characters of bottomwin when the screen
|
||||
width isn't a clean multiple of the column width. Changes to
|
||||
do_mouseinput() and bottombars(). (Benno Schulenberg, minor
|
||||
tweaks by DLR)
|
||||
- Add several blank entries to the main shortcut list and the
|
||||
global toggle list, in order to make the help text easier to
|
||||
read. Changes to sc_init_one(), toggle_init(),
|
||||
toggle_init_one(), shortcut_init(), get_toggle(), and
|
||||
help_init(). (DLR, suggested by Benno Schulenberg)
|
||||
- Reduce NO_RCFILE to a static bool in nano.c, since it's only
|
||||
used there. Changes to finish() and main(). (DLR)
|
||||
- Readd the Cancel -> Exit aliases for the file browser and help
|
||||
browser. New function parse_help_input(); changes to
|
||||
parse_browser_input() and do_help(). (DLR, suggested by Benno
|
||||
Schulenberg)
|
||||
- Add the ability to copy text into the cutbuffer without
|
||||
cutting it, via Meta-^ (Meta-6). Note that this is disabled
|
||||
when NANO_TINY is defined. New functions do_cut_text_void()
|
||||
and do_copy_text(); changes to do_cut_text(), shortcut_init(),
|
||||
and do_input(). (DLR, suggested by Ken Tyler)
|
||||
- Add the ability to indent and unindent all marked lines of
|
||||
text, via Meta-} (Meta-]) and Meta-{ (Meta-[). New functions
|
||||
do_indent_marked(), do_indent_marked_void(), and
|
||||
do_unindent_marked_void(); changes to shortcut_init(). (Chris
|
||||
and DLR)
|
||||
- Change the shortcut to find the matching bracket to Ctrl-].
|
||||
Changes to shortcut_init() and do_statusbar_input(). (DLR)
|
||||
- Drop the Meta-] and Meta-[ aliases for Meta-} and Meta-{, and
|
||||
change the shortcut to find the matching bracket from Ctrl-]
|
||||
back to Meta-], since Ctrl-] is used as the telnet escape key.
|
||||
Changes to shortcut_init() and do_statusbar_input(). (DLR,
|
||||
found by Chris)
|
||||
- Add the ability to move to the first and last line of the help
|
||||
text and the first and last file in the file browser via
|
||||
Meta-\ (Meta-|) and Meta-/ (Meta-?). Changes to do_browser(),
|
||||
shortcut_init(), and do_help(). (DLR)
|
||||
- Allow unjustifying if we resize the window immediately after
|
||||
justifying, as Pico does, and make input handling across
|
||||
resizes more consistent. Changes to handle_sigwinch(),
|
||||
main(), get_kbinput(), parse_kbinput(), get_byte_kbinput(),
|
||||
and get_unicode_kbinput(); removal of reset_kbinput(). (DLR)
|
||||
- Handle statusbar blanking in two places instead of many, so
|
||||
that it always works consistently. Changes to do_browser(),
|
||||
do_cut_text(), do_uncut_text(), do_first_line(),
|
||||
do_last_line(), do_page_up(), do_page_down(), do_para_begin(),
|
||||
do_para_end(), do_para_end(), do_next_word(), do_prev_word(),
|
||||
do_home(), do_end(), do_up(), do_scroll_up(), do_down(),
|
||||
do_scroll_down(), do_left(), do_right(), do_indent_marked(),
|
||||
do_verbatim_input(), and get_kbinput(). (Benno Schulenberg,
|
||||
minor tweaks by DLR)
|
||||
- Handle prepending of wrapped text in one place instead of
|
||||
many, so that it always works consistently. Changes to
|
||||
do_uncut_text(), do_insertfile(), do_page_up(),
|
||||
do_page_down(), do_up(), do_scroll_up(), do_down(),
|
||||
do_scroll_down(), do_input(), do_search(), do_research(), and
|
||||
do_delete(). (DLR)
|
||||
- Ignore unhandled meta key sequences, function keys, and escape
|
||||
sequences, indicate it on the statusbar, and beep when we get
|
||||
an unhandled shortcut or toggle, as Pico does. To get this to
|
||||
work properly, add a shortcut for moving to the next
|
||||
search/replace string. New function is_ascii_cntrl_char();
|
||||
changes to shortcut_init(), do_input(), do_statusbar_input(),
|
||||
get_prompt_string(), and parse_kbinput(). (DLR, suggested by
|
||||
Nick Warne and Benno Schulenberg)
|
||||
- Explain the mouse support in more detail, and sync the text of
|
||||
its description across all documentation. Changes to nano.1,
|
||||
nanorc.5, nanorc.sample, and nano.texi. (Benno Schulenberg and
|
||||
DLR)
|
||||
- If we're using verbatim input to enter a Unicode sequence,
|
||||
indicate it on the statusbar, and add a translator comment
|
||||
explaining the message. Also, refactor get_unicode_kbinput()
|
||||
to remove redundant code. New function add_unicode_digit();
|
||||
changes to get_unicode_kbinput() and parse_verbatim_kbinput().
|
||||
(Benno Schulenberg, minor tweaks by DLR)
|
||||
- Allow normal typing of high-bit control characters, as Pico
|
||||
does. Changes to do_output() and do_statusbar_output(). (DLR)
|
||||
- Move color regexes into separate files, make nanorc.sample
|
||||
reference them, and make them install properly. In the
|
||||
process, rename nanorc.sample to nanorc.sample.in, put
|
||||
@PKGDATADIR@ at the beginning of all nanorc file paths, add
|
||||
needed AC_DEFINE_DIR macro from the Autoconf Macro Archive at
|
||||
http://autoconf-archive.cryp.to/ac_define_dir.m4, and make
|
||||
configure.ac do the substitution, so that the proper paths
|
||||
will always be used in nanorc.sample. New files
|
||||
m4/ac_define_dir.m4, doc/syntax/Makefile.am,
|
||||
doc/syntax/asm.nanorc, doc/syntax/c.nanorc,
|
||||
doc/syntax/groff.nanorc, doc/syntax/html.nanorc,
|
||||
doc/syntax/java.nanorc, doc/syntax/man.nanorc,
|
||||
doc/syntax/mutt.nanorc, doc/syntax/nanorc.nanorc,
|
||||
doc/syntax/patch.nanorc, doc/syntax/perl.nanorc,
|
||||
doc/syntax/python.nanorc, doc/syntax/ruby.nanorc,
|
||||
doc/syntax/sh.nanorc, and doc/syntax/tex.nanorc; changes to
|
||||
configure.ac, nano.spec.in, doc/Makefile.am, and
|
||||
m4/Makefile.am; removal of doc/nanorc.sample. (DLR)
|
||||
- Replace usage of the bool curses_ended with the isendwin()
|
||||
function, and remove curses_ended. Changes to do_suspend().
|
||||
(DLR)
|
||||
- Remove the workaround for glibc 2.2.3's broken regexec(), and
|
||||
replace it with a FAQ entry explaining the problem, since it
|
||||
could break anything using extended regular expressions, and
|
||||
glibc 2.2.3 is old. Changes to configure.ac, faq.html,
|
||||
nano.h, proto.h, and UPGRADE; removal of safe_regexec(). (DLR)
|
||||
- Minor wording fixes to various messages. Changes to
|
||||
load_history(), shortcut_init(), toggle_init(), usage(),
|
||||
do_suspend(), do_input(), rcfile_error(), parse_argument(),
|
||||
parse_rcfile(), nano.1, nano.texi, and nanorc.sample.in.
|
||||
(Benno Schulenberg, minor tweaks by DLR and Nick Warne)
|
||||
- Make suspension clear the screen and put the cursor on the
|
||||
last line before displaying anything, as Pico does. New
|
||||
functions disable_mouse_support() and enable_mouse_support();
|
||||
changes to do_mouse(), do_suspend(), do_continue(), and
|
||||
terminal_init(). (DLR)
|
||||
- browser.c:
|
||||
do_browser()
|
||||
- Reference NANO_GOTODIR_(ALT|F)?KEY instead of
|
||||
NANO_GOTOLINE_(ALT|F)?KEY for the "Go to Directory" shortcut.
|
||||
(DLR)
|
||||
parse_browser_input()
|
||||
- Remove redundant key checks. (DLR)
|
||||
browser_refresh()
|
||||
- Rename variable editline to line, for consistency. (DLR)
|
||||
- Change variable i from an int to a size_t in order to match
|
||||
selected, which it's compared against. (DLR)
|
||||
- color.c:
|
||||
color_update()
|
||||
- Fix incorrect setting of defcolor, which prevented the
|
||||
reserved "default" syntax from being handled correctly. (DLR)
|
||||
- cut.c:
|
||||
cut_to_eof()
|
||||
- New function, containing the main functionality of
|
||||
do_cut_till_end(). (DLR)
|
||||
do_cut_text()
|
||||
- Add parameter cut_till_end, to indicate when we're cutting
|
||||
from the current cursor position to the end of the file, and
|
||||
call cut_to_eof() when it's TRUE. (DLR)
|
||||
do_cut_till_end()
|
||||
- Convert to a wrapper for do_cut_text(). (DLR)
|
||||
- files.c:
|
||||
open_file()
|
||||
- Remove redundant wording in the error message when we try to
|
||||
open a device file. (DLR)
|
||||
do_insertfile()
|
||||
- Use actual gettext calls instead of no-ops, for consistency.
|
||||
(DLR)
|
||||
safe_tempfile()
|
||||
- Don't ignore $TMPDIR if it's set but blank, for consistency.
|
||||
(DLR)
|
||||
write_file()
|
||||
- Don't free backupname before displaying it in a statusbar error
|
||||
message. (DLR, found by Bill Marcum)
|
||||
- If we can't save the backup file for some reason, at least
|
||||
save the original file, if possible, since that's better than
|
||||
saving nothing. (DLR, problem found by Bill Marcum, solution
|
||||
suggested by Jordi)
|
||||
- Clarify the error messages when creating a temporary file or
|
||||
writing one for prepending fails. (DLR)
|
||||
- Simplify the routine for closing the file just before we
|
||||
indicate success on the statusbar. (DLR)
|
||||
do_writeout()
|
||||
- Fix problem where the modifiers at the "Write File" prompt
|
||||
were marked for translation via gettext no-ops but never
|
||||
actually translated. (Benno Schulenberg)
|
||||
free_chararray()
|
||||
- Assert that array isn't NULL, for consistency with the other
|
||||
free_.*() functions. (DLR)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Change the cursor position display help text to use "display"
|
||||
instead of "show", for consistency. (DLR)
|
||||
- In the main shortcut list, move the "Refresh" shortcut down to
|
||||
after the "Enter" shortcut, for consistency. (DLR)
|
||||
- Add the ability to move to the first and last line of the
|
||||
current file from the main list via Meta-\ (Meta-|) and Meta-/
|
||||
(Meta-?). Also, make sure all the equivalent shortcuts in the
|
||||
search, replace, and "Go To Line" lists accept both the meta
|
||||
keys and the equivalent function keys. (DLR)
|
||||
- Reorganize the main shortcut list to make it easier for new
|
||||
users. It now lists the twelve Pico-compatible default
|
||||
operations, followed by search and replace shortcuts, followed
|
||||
by cut and paste shortcuts, followed by marking shortcuts,
|
||||
followed by back and forth movement shortcuts, followed by
|
||||
start and end movement shortcuts, followed by buffer-switching
|
||||
shortcuts, followed by insertion and deletion shortcuts,
|
||||
followed by special movement shortcuts, followed by advanced
|
||||
word and paragraph shortcuts, followed by display shortcuts.
|
||||
(DLR and Benno Schulenberg, suggested by Benno Schulenberg)
|
||||
- Tweak the descriptions of some shortcut keys to make them more
|
||||
uniform. (Benno Schulenberg, minor tweaks by DLR)
|
||||
- Shorten the "Where is Next" shortcut name to fit on the screen
|
||||
after adding Meta-\ (Meta-|) and Meta-/ (Meta-?). (DLR)
|
||||
- Lengthen the "UnCut Txt" shortcut name to "UnCut Text", as
|
||||
there's enough room to display it unabbreviated. (DLR)
|
||||
- Clarify the descriptions of the "Search" and "Replace"
|
||||
shortcuts, and add spaces to the "Exit" shortcut's description
|
||||
in multibuffer mode. (Benno Schulenberg)
|
||||
- Remove the "Go To Line" shortcut in the replace shortcut list,
|
||||
for compatibility with Pico. (DLR)
|
||||
toggle_init()
|
||||
- In the global toggle list, move the "Constant cursor position
|
||||
display" toggle up to after the "Use more space for editing"
|
||||
toggle, for consistency. (DLR)
|
||||
- Reorganize the global toggle list to make it easier for new
|
||||
users. It now lists toggles that affect the way things are
|
||||
displayed, followed by toggles that affect editing, followed
|
||||
by toggles that have to do with peripheral things. (DLR,
|
||||
suggested by Benno Schulenberg)
|
||||
- help.c:
|
||||
do_help()
|
||||
- Call get_shortcut() after getting input, so that we only have
|
||||
to check for a main shortcut key instead of both it and all of
|
||||
its equivalents. (DLR)
|
||||
- Clean up the handling of NANO_REFRESH_KEY. (DLR)
|
||||
- Remove redundant key checks. (DLR)
|
||||
help_init()
|
||||
- If we have at least two entries' worth of blank space, use it
|
||||
to display more of "^Space" and "M-Space". (DLR, suggested by
|
||||
Benno Schulenberg)
|
||||
- Add various wording fixes. (DLR and Benno Schulenberg)
|
||||
- If one of the help strings ends in newlines followed by a
|
||||
space, move the space to the next help string to make it
|
||||
easier for translators to see. (Benno Schulenberg)
|
||||
- Make sure we have enough memory in all cases when displaying
|
||||
the shortcut and toggle lists. (DLR)
|
||||
- Wrap the shortcut list help text, and display it even when we
|
||||
have fewer than 24 columns, for consistency with the toggle
|
||||
help text. (DLR, suggested by Benno Schulenberg)
|
||||
parse_help_input()
|
||||
- Add Space and - as aliases for PageDown and PageUp, for
|
||||
consistency with the file browser. (DLR, suggested by Benno
|
||||
Schulenberg)
|
||||
- Remove redundant key checks. (DLR)
|
||||
help_line_len()
|
||||
- Properly handle the case where we can't break the line of help
|
||||
text. (DLR)
|
||||
- Wrap the line of help text at (COLS - 1) instead of
|
||||
(COLS - 8), for consistency. (DLR, suggested by Benno
|
||||
Schulenberg)
|
||||
- nano.c:
|
||||
print1opt_full()
|
||||
- Rename to print_opt_full(), for consistency. (DLR)
|
||||
usage()
|
||||
- Fix inaccuracies in the usage example. (DLR)
|
||||
- Put command line arguments in <>'s instead of []'s, as the
|
||||
latter imply that the arguments are optional when they aren't.
|
||||
(DLR, found by Benno Schulenberg)
|
||||
renumber()
|
||||
- Remove invalid assert. (DLR, found by Filipe Moreira)
|
||||
do_input()
|
||||
- Remove redundant check for allow_funcs' being TRUE when we get
|
||||
KEY_MOUSE. (DLR)
|
||||
- Don't blow away the cutbuffer when we get a shortcut and the
|
||||
function associated with it is do_cut_till_end(). (DLR)
|
||||
- Simplify the routine to preserve the cutbuffer when we call a
|
||||
cutting or copying function associated with a shortcut. (DLR)
|
||||
- nano.h:
|
||||
- Reorder the toggle #defines to match their corresponding order
|
||||
in toggle_init(). (DLR)
|
||||
- Move the #include for sys/param.h here from nano.c, and add an
|
||||
#ifdef around it. (DLR)
|
||||
- prompt.c:
|
||||
get_prompt_string()
|
||||
- Include the handling of the help key even when help is
|
||||
disabled, so that we aren't erroneously kicked out of the
|
||||
statusbar prompt under any circumstances. (DLR, found by Benno
|
||||
Schulenberg)
|
||||
do_statusbar_input()
|
||||
- Remove redundant check for allow_funcs' being TRUE when we get
|
||||
KEY_MOUSE. (DLR)
|
||||
- Improve the handling of NANO_REFRESH_KEY. (DLR)
|
||||
total_statusbar_refresh()
|
||||
- New function, called when we get NANO_REFRESH_KEY in
|
||||
do_statusbar_input(). (DLR)
|
||||
do_yesno_prompt()
|
||||
- Handle the keys in a switch statement instead of a long if
|
||||
block, for simplicity. (DLR)
|
||||
- rcfile.c:
|
||||
parse_argument()
|
||||
- Rename variable ptr_bak to ptr_save, for consistency. (DLR)
|
||||
- Add double quotes around invalid string arguments in error
|
||||
messages, for consistency. (DLR)
|
||||
- Add single quotes around the invalid string argument in the
|
||||
error message about unterminated strings, to avoid confusion.
|
||||
(Benno Schulenberg)
|
||||
parse_syntax()
|
||||
- Don't generate an error if we find a duplicate syntax name,
|
||||
since we might be trying to override a syntax in the global
|
||||
nanorc with one in our local nanorc. Instead, free any
|
||||
duplicate syntaxes we find, so that we always use the last
|
||||
syntax with a given name. (DLR)
|
||||
color_to_short()
|
||||
- Add quotes around invalid string arguments in error messages,
|
||||
for consistency. (DLR)
|
||||
parse_colors()
|
||||
- Check for a color command's not following a syntax line before
|
||||
anything else. (DLR)
|
||||
- Add quotes around invalid string arguments in error messages,
|
||||
for consistency. (DLR)
|
||||
parse_rcfile()
|
||||
- Properly generate an error if we've read in a syntax without
|
||||
any associated color commands. (DLR)
|
||||
- Change variable i from an int to a size_t, for consistency.
|
||||
(DLR)
|
||||
- Properly handle rcfiles that don't end in newlines. (DLR)
|
||||
- Add quotes around invalid string arguments in error messages,
|
||||
for consistency. (DLR)
|
||||
do_rcfile()
|
||||
- Check for the rcfile's being a directory or device file and
|
||||
reject it if it is, for consistency with file handling
|
||||
elsewhere. (DLR)
|
||||
- Remove SYSCONFDIR #ifdef, as SYSCONFDIR should always be set.
|
||||
(DLR)
|
||||
- Change all rcfile error messages to refer to commands instead
|
||||
of directives, for consistency with nanorc.5. (DLR)
|
||||
- text.c:
|
||||
break_line()
|
||||
- Fix problem where tab widths in columns would always be
|
||||
calculated as tabsize. (DLR, found by Alexey Toptygin)
|
||||
- Handle newlines consistently when searching for the last blank
|
||||
in the first group of blanks in the range of (goal - 1). (DLR,
|
||||
found by Benno Schulenberg)
|
||||
do_justify()
|
||||
- Remove redundant key checks. (DLR)
|
||||
do_spell()
|
||||
- Clarify the error message when creating a temporary file
|
||||
fails. (DLR)
|
||||
- Set currshortcut to main_list before calling total_refresh()
|
||||
near the end of the function, so that we don't display the
|
||||
wrong shortcut list. (DLR)
|
||||
do_verbatim_input()
|
||||
- Add a translator comment explaining the "Verbatim Input"
|
||||
statusbar message. (Benno Schulenberg)
|
||||
- Unconditionally blank the statusbar as soon as we're finished
|
||||
getting input. (DLR, suggested by Benno Schulenberg)
|
||||
- utils.c:
|
||||
digits()
|
||||
- Return the proper number of digits when n is exactly 10. (DLR)
|
||||
- Simplify to use a for loop instead of a while loop. (DLR)
|
||||
ngetdelim()
|
||||
- Set errno to EINVAL if stream is not a valid file stream.
|
||||
This matches the manual page. (DLR)
|
||||
nperror()
|
||||
- Simplify. (DLR)
|
||||
check_linenumbers()
|
||||
- Removed, as it's no longer used, and since there's no way to
|
||||
tell if its return value will be in int or ssize_t range.
|
||||
(DLR)
|
||||
- winio.c:
|
||||
parse_kbinput()
|
||||
- If we get NANO_CONTROL_8, properly handle it in all cases.
|
||||
(DLR)
|
||||
parse_escape_seq_kbinput()
|
||||
- New function used to interpret escape sequences, formerly part
|
||||
of parse_kbinput(). (DLR)
|
||||
get_byte_kbinput()
|
||||
- Fix typo preventing Esc Esc 3 through Esc Esc 6 from being
|
||||
interpreted as control key sequences. (DLR)
|
||||
- Tweak to more closely match get_unicode_kbinput(). (DLR)
|
||||
get_control_kbinput()
|
||||
- Add Ctrl-/ as an alias for Ctrl-_. (DLR, found by Benno
|
||||
Schulenberg)
|
||||
- Simplify the if blocks wherever possible. (DLR)
|
||||
parse_verbatim_kbinput()
|
||||
- Don't include the ability to enter a Unicode sequence via
|
||||
verbatim input mode if ENABLE_UTF8 isn't defined or we're not
|
||||
in a UTF-8 locale. (DLR)
|
||||
check_statusblank()
|
||||
- Avoid redundant updates when statusblank is 0. (DLR)
|
||||
display_string()
|
||||
- Properly display double-column characters if they're past the
|
||||
first virtual page and their first column is covered by the
|
||||
"$" displayed at the beginning of the line. (DLR)
|
||||
statusbar()
|
||||
- Blank the statusbar after 26 keystrokes instead of 25, for
|
||||
conpatibility with Pico. (DLR)
|
||||
edit_draw()
|
||||
- Properly ignore zero-length regexes in multi-line regexes as
|
||||
well as single-line ones. This avoids a segfault when trying
|
||||
to color e.g. "start="$" end="$"". (DLR, found by Trevor
|
||||
Caira)
|
||||
- Don't display any statusbar message when we get a zero-length
|
||||
regex, as we can get one under legitimate circumstances. (DLR,
|
||||
found by Mike Frysinger)
|
||||
update_line()
|
||||
- Remove unneeded assert. (DLR)
|
||||
edit_redraw()
|
||||
- Fix problem where not all lines would be updated properly if
|
||||
we'd scrolled off the screen and the mark was on. (DLR)
|
||||
do_credits()
|
||||
- Update the last copyright notice to include 2006. (DLR)
|
||||
- configure.ac:
|
||||
- Remove old warnings about color support. (DLR)
|
||||
- Remove conditional header checks for fcntl.h and termios.h, as
|
||||
nano won't build without them, and add conditional header
|
||||
check for sys/param.h, as some systems need only limits.h.
|
||||
(DLR)
|
||||
- doc/faq.html:
|
||||
- Add a new section 4.4, and move all section 4 entries after it
|
||||
down one number, to explain how to deal with problems typing
|
||||
Meta-[. (DLR)
|
||||
- Add a new section 4.5, and move all section 4 entries after it
|
||||
down one number, to explain a problem that can occur when
|
||||
holding down keys to generate Meta sequences. (Benno
|
||||
Schulenberg, minor tweaks by DLR)
|
||||
- Add a few capitalization and wording fixes. (DLR)
|
||||
- Remove section 4.4, and move all section 4 entries after it up
|
||||
one number, since it no longer applies. Meta-] and Meta-[ are
|
||||
no longer used to indent and unindent marked text, since they
|
||||
require that the bracket matching key change to Ctrl-], which
|
||||
is used as the telnet escape key. (DLR, found by Chris)
|
||||
- Make the link to the nano CVS page a bit more readable. (DLR)
|
||||
- Update section 3.8 to mention the new "Unicode Input" prompt,
|
||||
and how Unicode input only works when Unicode support is
|
||||
enabled. (DLR)
|
||||
- Add minor punctuation, wording, and typo fixes. (DLR)
|
||||
- Update section 5.3, due to the display fix for two-column
|
||||
Unicode characters. (DLR)
|
||||
- doc/nano.1:
|
||||
- Update the copyright years to include 2006. (DLR)
|
||||
- Explicitly mention that all regexes should be extended regular
|
||||
expressions. (DLR, suggested by John M. Gabriele)
|
||||
- Miscellaneous minor fixes. (DLR)
|
||||
- Add various wording fixes. (Benno Schulenberg and DLR)
|
||||
- Put command line arguments in <>'s instead of []'s, as the
|
||||
latter imply that the arguments are optional when they aren't.
|
||||
(Benno Schulenberg)
|
||||
- doc/nanorc.5:
|
||||
- Update the copyright years to include 2006. (DLR)
|
||||
- Explicitly mention that all regexes should be extended regular
|
||||
expressions. (DLR, suggested by John M. Gabriele)
|
||||
- Miscellaneous minor fixes. (DLR)
|
||||
- Add various wording fixes. (Benno Schulenberg and DLR)
|
||||
- Mention that the nanorc file should not be in DOS or Mac
|
||||
format. (DLR)
|
||||
- doc/rnano.1:
|
||||
- Update the copyright years to include 2006. (DLR)
|
||||
- Explicitly mention that all regexes should be extended regular
|
||||
expressions. (DLR, suggested by John M. Gabriele)
|
||||
- Miscellaneous minor fixes. (DLR)
|
||||
- Add various wording fixes. (Benno Schulenberg and DLR)
|
||||
- Add description of the +LINE[,COLUMN] option. (DLR)
|
||||
- doc/nano.texi:
|
||||
- Update the copyright years to include 2006. (DLR)
|
||||
- Explicitly mention that all regexes should be extended regular
|
||||
expressions. (DLR, suggested by John M. Gabriele)
|
||||
- Miscellaneous minor fixes. (DLR)
|
||||
- Add various wording fixes. (Benno Schulenberg and DLR)
|
||||
- Change license to GPL, in order to match the rest of the
|
||||
documentation, and because the current license is incompatible
|
||||
with everything else in any case. (DLR)
|
||||
- Mention that backup files and spell checking are disabled in
|
||||
restricted mode, as rnano.1 does. (DLR)
|
||||
- Add minor updates to put some text back in sync with nano's
|
||||
help text, and with nano's current feature set. (DLR)
|
||||
- Add a "Nanorc Files" section to explain the nanorc file format
|
||||
in detail, using text from nanorc.5. (DLR)
|
||||
- Put command line arguments in <>'s instead of []'s, as the
|
||||
latter imply that the arguments are optional when they aren't.
|
||||
(Benno Schulenberg)
|
||||
- Add missing description of -H/--historylog, and move
|
||||
-x/--nohelp down so that all the command line options are in
|
||||
alphabetical order. (Benno Schulenberg)
|
||||
- Change all occurrences of "file name" to "filename". (Benno
|
||||
Schulenberg)
|
||||
- doc/man/Makefile.am:
|
||||
- Simplify the setting of SUBDIRS. (DLR)
|
||||
- doc/man/fr/nano.1, doc/man/fr/nanorc.5, doc/man/fr/rnano.1:
|
||||
- Updated manpage translations by Jean-Philippe Guérard.
|
||||
- doc/nanorc.sample:
|
||||
- Miscellaneous minor fixes. (DLR and Benno Schulenberg)
|
||||
- Tweak the "c-file" regex for characters to accept '"' again,
|
||||
as it's apparently valid, and simplify it. (DLR)
|
||||
- Simplify the "shellscript" regex for command line options.
|
||||
(DLR)
|
||||
- Replace instances of \" with ", since quotes inside string
|
||||
parameters don't need to be escaped with backslashes. (DLR)
|
||||
- Mention in the comments that more than one start/end regex can
|
||||
be included per line. Also, change the comment for the
|
||||
"whitespace" option so that the hexadecimal character values
|
||||
are six digits long, and state which character values work
|
||||
with which encodings. (DLR)
|
||||
- Add sample regexes for Python. (singular on the Gentoo forums,
|
||||
http://forums.gentoo.org/viewtopic.php?t=86562; minor tweaks
|
||||
by DLR, suggested by John M. Gabriele)
|
||||
- Explicitly mention that all regexes should be extended regular
|
||||
expressions. (DLR, suggested by John M. Gabriele)
|
||||
- Simplify the "nanorc" regex for commands. (DLR)
|
||||
- Mention that the nanorc file should not be in DOS or Mac
|
||||
format. (DLR)
|
||||
- Add various wording fixes. (Benno Schulenberg and DLR)
|
||||
- Replace instances of "\w" with its equivalent "[0-9A-Z_a-z]",
|
||||
and instances of "\W" with its equivalent "[^0-9A-Z_a-z]", for
|
||||
greater readability. (DLR)
|
||||
- Remove unneeded foreground color for the Java source regex
|
||||
used to highlight trailing whitespace, since we now support
|
||||
background colors without foreground colors. (DLR)
|
||||
- Further simplify the "groff" regexes. (DLR)
|
||||
- Tweak the "shellscript" regexes to properly color all special
|
||||
variables, such as $? and $@. (Benno Schulenberg)
|
||||
- Tweak the "nanorc" regexes to color keywords bright green
|
||||
instead of cyan, and comments bright blue instead of blue.
|
||||
(John M. Gabriele)
|
||||
- Simplify the extensions associated with the "nanorc" regexes.
|
||||
(DLR)
|
||||
- Add regexes for Ruby. (John M. Gabriele, minor tweaks by DLR)
|
||||
- doc/nanorc.sample.in:
|
||||
- Add comments describing the relationships between syntax file
|
||||
names and the names used as their short descriptions. (John M.
|
||||
Gabriele)
|
||||
- doc/java.nanorc:
|
||||
- Simplify a comment. (DLR)
|
||||
- doc/man.nanorc:
|
||||
- Change the name of the "manpage" regexes to "man", for
|
||||
consistency. (John M. Gabriele)
|
||||
- doc/nanorc.nanorc:
|
||||
- Tweak the "nanorc" regexes to color comments starting with a
|
||||
double ## cyan instead of bright blue. (John M. Gabriele)
|
||||
- doc/ruby.nanorc:
|
||||
- Add regex for "here" docs. (John M. Gabriele)
|
||||
- doc/sh.nanorc:
|
||||
- Tweak the regex for special variables, moving "-" to the end,
|
||||
to avoid excessive coloring or an "Invalid range end" error.
|
||||
(Benno Schulenberg)
|
||||
- Tweak the "sh" regexes to color comments cyan instead of
|
||||
yellow. (John M. Gabriele)
|
||||
- src/Makefile.am:
|
||||
- If we're uninstalling, remove the "rnano" symlink. (DLR, found
|
||||
by Benno Schulenberg)
|
||||
- Remove "-Iintl" from INCLUDES, as we don't use an intl
|
||||
directory inside the source directory anymore. (DLR)
|
||||
- README, README.CVS:
|
||||
- Add various cosmetic and wording improvements. (John M.
|
||||
Gabriele, minor tweaks by DLR)
|
||||
- TODO:
|
||||
- Update for nano 2.0, since we're now in a feature freeze.
|
||||
(DLR)
|
||||
- UPGRADE:
|
||||
- Miscellaneous minor fixes. (DLR)
|
||||
- Update for nano 2.0, since we're now in a feature freeze.
|
||||
(DLR)
|
||||
|
||||
GNU nano 1.3.11 - 2006.03.30
|
||||
- General:
|
||||
- Miscellaneous comment fixes. (DLR)
|
||||
- Remove unnecessary #ifdef around termios.h #include in nano.c.
|
||||
(DLR)
|
||||
- Sort the default strings for brackets and punct, and the "or"
|
||||
atom in the default regex string for quotestr, according to
|
||||
ASCII. Changes to main(), nano.1, nanorc.5, and
|
||||
nanorc.sample. (DLR)
|
||||
- Rework the bracket searching code to handle multibyte bracket
|
||||
characters, and allow specifying matching bracket characters
|
||||
other than the default via the "matchbrackets" rcfile option.
|
||||
New functions mbstrpbrk() and mbrevstrpbrk(); changes to
|
||||
find_statusbar_bracket_match(), do_statusbar_find_bracket(),
|
||||
find_bracket_match(), do_find_bracket(), main(),
|
||||
parse_rcfile(), nanorc.5, and nanorc.sample. (DLR)
|
||||
- Rework input parsing in the file browser to be more flexible.
|
||||
New function parse_browser_input(); changes to do_browser().
|
||||
(DLR)
|
||||
- Allow tab completion of directories at the "Go To Directory"
|
||||
prompt. Also, move the browser drawing routines to a separate
|
||||
function, and make sure it's used when refreshing or doing tab
|
||||
completion at the prompt in the file browser. New function
|
||||
browser_refresh(); changes to do_browser(), browser_init(),
|
||||
do_insertfile(), do_writeout(), cwd_tab_completion(),
|
||||
input_tab(), do_statusbar_input(), get_prompt_string(),
|
||||
do_prompt(), search_init(), do_replace(), do_gotolinecolumn(),
|
||||
and do_int_spell_fix(). (DLR)
|
||||
- browser.c:
|
||||
do_browser()
|
||||
- Properly set currshortcut back to the file browser shortcut
|
||||
list after a "Go To Directory" prompt, and properly restore
|
||||
the file list display after returning from the help browser at
|
||||
the "Go To Directory" prompt. (DLR)
|
||||
- Rename variable j to i, for consistency. (DLR)
|
||||
- Make fileline, old_selected, and the static selected size_t's,
|
||||
since the first and second can hold the value of the third,
|
||||
and the first can be that large. (DLR)
|
||||
- chars.c:
|
||||
mbstrchr()
|
||||
- Make parameter c const. (DLR)
|
||||
- files.c:
|
||||
do_writeout()
|
||||
- Remove unneeded setting of currshortcut. (DLR)
|
||||
is_dir()
|
||||
- Rename parameter ret to retval, for consistency. (DLR)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Remove erroneous handling of the "Get Help" shortcut in the
|
||||
file browser shortcut list. (DLR)
|
||||
- nano.h:
|
||||
- Remove now-unneeded VERMSG #define. (DLR)
|
||||
- prompt.c:
|
||||
get_prompt_string()
|
||||
- Redraw the prompt and set finished to FALSE when NANO_HELP_KEY
|
||||
is pressed, so that we don't leave the prompt, enter the help
|
||||
browser, and restart the prompt after leaving it. This will
|
||||
properly preserve the cursor position after doing the last of
|
||||
these. (DLR)
|
||||
- utils.c:
|
||||
ngetdelim()
|
||||
- Do sanity checks manually again instead of in an assert, and
|
||||
set errno to EINVAL as well as return -1 if they fail. This
|
||||
matches the manual page. (DLR)
|
||||
- winio.c:
|
||||
get_key_buffer()
|
||||
- If we fail to get a character MAX_BUF_SIZE times in a row,
|
||||
hang up regardless of the value of errno. This fixes a
|
||||
problem where nano doesn't terminate properly under xterm if
|
||||
the user su's to root, runs nano, and then closes the terminal
|
||||
window. errno isn't set properly to EIO then. (DLR, found by
|
||||
John <acocaracha@gmail.com>)
|
||||
parse_kbinput()
|
||||
- Interpret Shift-Begin, Shift-Delete, Shift-End, Shift-Home,
|
||||
Shift-Insert, and Shift-Suspend as Begin, Delete, End, Home,
|
||||
Insert, and Suspend, respectively, regardless of whether
|
||||
--rebindkeypad is used. (DLR, found by David Benbennick)
|
||||
titlebar()
|
||||
- Use PACKAGE_STRING, as defined by autoconf, instead of VERMSG.
|
||||
(DLR)
|
||||
edit_redraw()
|
||||
- If either current or old_current is offscreen, we're not on
|
||||
the first page, and/or we're not on the same page as before,
|
||||
update old_current before scrolling the edit window. This
|
||||
fixes a potential display problem when a search moves the
|
||||
cursor offscreen and onto a different page. (DLR, found by
|
||||
Mike Frysinger)
|
||||
display_string()
|
||||
- Fix minor memory leak. (DLR)
|
||||
- Fix memory corruption problems caused by not allocating enough
|
||||
space for converted when a line ends in a tab(s) and we're not
|
||||
in UTF-8 mode. (DLR, found by Duncan Geoffry Doyle, Nick
|
||||
Warne, and Mike Frysinger)
|
||||
- doc/faq.html:
|
||||
- Update the Free Translation Project's address, change the
|
||||
character set to UTF-8, and remove broken links to contributed
|
||||
RedHat nano packages. (DLR)
|
||||
- doc/nano.1:
|
||||
- Better display the default values for quotestr. (DLR)
|
||||
- doc/nanorc.5:
|
||||
- Give the default values for the brackets and punct options,
|
||||
and better display the default values for quotestr. (DLR)
|
||||
- Mention that quotes inside string parameters don't need to be
|
||||
escaped with backslashes. (John M. Gabriele, minor tweaks by
|
||||
DLR)
|
||||
- doc/rnano.1:
|
||||
- Remove unneeded comments. (DLR)
|
||||
- doc/nanorc.sample:
|
||||
- Remove unneeded comment. (DLR)
|
||||
- Mention that quotes inside string parameters don't need to be
|
||||
escaped with backslashes. (John M. Gabriele, minor tweaks by
|
||||
DLR)
|
||||
- THANKS:
|
||||
- Add new Swedish translator.
|
||||
|
||||
GNU nano 1.3.10 - 2005.12.23
|
||||
- General:
|
||||
- Miscellaneous comment fixes. (DLR)
|
||||
@@ -2135,7 +2833,8 @@ GNU nano 1.3.5 - 2004.11.22
|
||||
glib 2.x on systems that may not have it installed. (DLR,
|
||||
suggested by Jordi)
|
||||
- src/Makefile.am:
|
||||
- Don't use DEFS to define things. Use INCLUDES instead. (Jordi)
|
||||
- Don't use DEFS to define things. Use INCLUDES instead.
|
||||
(Jordi)
|
||||
|
||||
GNU nano 1.3.4 - 2004.08.17
|
||||
- General:
|
||||
@@ -2862,7 +3561,7 @@ GNU nano 1.3.3 - 2004.06.28
|
||||
- Document restricted mode. (IO ERROR) DLR: Add minor
|
||||
modifications to account for the above changes.
|
||||
- Fix version number inaccuracies: Search/replace history and
|
||||
sorting/uniqueness filtering for the internal spell chacker
|
||||
sorting/uniqueness filtering for the internal spell checker
|
||||
were added in nano 1.1.99pre1. (DLR)
|
||||
- Document the smart home key option. (DLR)
|
||||
- Document the use of the SPELL environment variable. (DLR)
|
||||
@@ -4920,7 +5619,7 @@ GNU nano 1.1.7 - 03/05/2002
|
||||
- Preliminary quoting support for justify. New arg -Q, --quotestr,
|
||||
changes to do_justify(), global variable quotestr().
|
||||
- Makefile.am:
|
||||
- Add SYSCONFDIR to DEFS, so we can have an $SYSCONFDIR/nanorc.
|
||||
- Add SYSCONFDIR to DEFS, so we can have a $SYSCONFDIR/nanorc.
|
||||
- Change localedir line to 1.0's version.
|
||||
- Moved m4/ stuff to its own m4/Makefile.am.
|
||||
- m4/aclocal_inc.m4:
|
||||
@@ -5941,7 +6640,7 @@ General
|
||||
modify_control_key. Removed #ifdef _POSIX_VDISABLE check
|
||||
around Control-S,Q,Z handlers because we need it now for
|
||||
the Alt-Alt-x code.
|
||||
- Added --view option to getopt_long()call . Bug discovered
|
||||
- Added --view option to getopt_long() call. Bug discovered
|
||||
by Rocco Corsi.
|
||||
help_init()
|
||||
- Fix off by one error that was making ^G help in normal mode and
|
||||
|
||||
35
NEWS
35
NEWS
@@ -1,3 +1,34 @@
|
||||
2006.06.26 - GNU nano 1.3.12 escapes the darkness. This release
|
||||
contains the last new features that nano will have
|
||||
before 2.0: copying text into the cutbuffer without
|
||||
cutting it, indenting lines of marked text with a single
|
||||
keystroke, reworked help text that should be easier for
|
||||
new users, searching for filenames in the file browser,
|
||||
the ability to include color regexes in files separate
|
||||
from nanorc files, etc. It also contains many bugfixes.
|
||||
Text can now be unjustified after justifying it and
|
||||
resizing the window; the screen is now cleared when
|
||||
suspending; the "default" color syntax is now handled
|
||||
properly at all times; lines of text containing tabs are
|
||||
now wrapped at the right place; double-column characters
|
||||
are now properly displayed when past the right edge of
|
||||
the screen; invalid multi-line color regexes are now
|
||||
ignored; and so on. Enjoy.
|
||||
|
||||
2006.03.30 - GNU nano 1.3.11 awakens from its fever dream. This release
|
||||
focuses mostly on bugfixes, which include better
|
||||
handling of the cursor at the statusbar prompt, support
|
||||
for certain combinations of Shift and keypad keys in
|
||||
both normal and --rebind-keypad mode, a fix for a minor
|
||||
display problem after some searches, a real fix for a
|
||||
long-standing segfault when displaying overly long
|
||||
lines, and a real fix for nano's not hanging up properly
|
||||
in xterm under certain circumstances. There are also
|
||||
several new features, such as the ability to set the
|
||||
characters used as brackets when searching for matching
|
||||
brackets, and tab completion of directories at the "Go
|
||||
To Directory" prompt. Have fun.
|
||||
|
||||
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
|
||||
@@ -283,7 +314,7 @@
|
||||
direct to the development list (nano-devel@gnu.org).
|
||||
|
||||
10/24/2002 - GNU nano 1.1.12 "Make Jordi happy" is released. This
|
||||
release demonstrated that nano is starting to freeze for
|
||||
release demonstrates that nano is starting to freeze for
|
||||
version 1.2. New features include a Meta-Y toggle for
|
||||
syntax highlighting, pluralized i18n, and a handler for
|
||||
SIGTERM. Nano now ignores XOFF (^S) to stop accidental
|
||||
@@ -361,7 +392,7 @@
|
||||
shows column as well as character position, and
|
||||
multibuffer allows duplicate files, even unnamed ones.
|
||||
Also, the static shortcut and toggle lengths are
|
||||
history, nano now reads $SYSCONFDIR/nanorc if rc file
|
||||
history, nano now reads SYSCONFDIR/nanorc if rc file
|
||||
support is enabled, and nano is now built with (and
|
||||
requires for rebuilding) autoconf 2.5.
|
||||
This release also includes fixes for some memory
|
||||
|
||||
13
README
13
README
@@ -9,16 +9,16 @@ Overview
|
||||
First and foremost is its license: the Pine suite does not use the
|
||||
GPL or a GPL-friendly license, and has unclear restrictions on
|
||||
redistribution. Because of this, Pine and Pico are not included
|
||||
with many GNU/Linux distributions. Also, other features (like goto
|
||||
line number or search and replace) were unavailable until recently
|
||||
or require a command line flag. Yuck.
|
||||
with many GNU/Linux distributions. Also, other features (like go
|
||||
to line number or search and replace) were unavailable until
|
||||
recently or require a command line flag. Yuck.
|
||||
|
||||
nano aims to solve these problems by emulating the functionality of
|
||||
Pico as closely as possible while addressing the problems above and
|
||||
perhaps providing other extra functionality.
|
||||
|
||||
The nano editor is now an official GNU package. For more
|
||||
information on GNU and the Free Software Foundation please see
|
||||
information on GNU and the Free Software Foundation, please see
|
||||
http://www.gnu.org.
|
||||
|
||||
How to compile and install nano
|
||||
@@ -32,6 +32,11 @@ How to compile and install nano
|
||||
|
||||
It's that simple. Use --prefix with configure to override the
|
||||
default installation directory of /usr/local.
|
||||
|
||||
If you configured with the "--enable-nanorc" option, after
|
||||
installation you might copy the doc/nanorc.sample to your home
|
||||
directory, rename it to ".nanorc", and then edit it according to
|
||||
your taste.
|
||||
|
||||
Web Page
|
||||
|
||||
|
||||
86
README.CVS
86
README.CVS
@@ -1,46 +1,94 @@
|
||||
INSTRUCTIONS TO COMPILE AND INSTALL NANO CVS VERSIONS
|
||||
-----------------------------------------------------
|
||||
=====================================================
|
||||
|
||||
GNU nano is available from CVS, but building this needs a bit more care
|
||||
than the official stable and unstable tarballs.
|
||||
|
||||
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
To successfully compile GNU nano from CVS, you'll need the following
|
||||
packages:
|
||||
|
||||
- autoconf (version >= 2.54)
|
||||
- automake (version >= 1.7)
|
||||
- gettext (version >= 0.11.5)
|
||||
- groff (version >= 1.12)
|
||||
- texinfo (version >= 4.0)
|
||||
- gettext (version >= 0.11.5)
|
||||
- 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 vsnprintf())
|
||||
- glib 2.x (if your system doesn't have vsnprintf(), which the configure
|
||||
script will check for)
|
||||
- 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
|
||||
version of curses or slang with wide character support if you want nano
|
||||
to use UTF-8.
|
||||
|
||||
|
||||
Download the source
|
||||
-------------------
|
||||
|
||||
First, you need to set up cvs to download the CVS tree using ssh. If
|
||||
you're using a Bourne shell (e.g. bash or sh), do
|
||||
$ export CVS_RSH=ssh
|
||||
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:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout nano
|
||||
$ export CVS_RSH=ssh
|
||||
|
||||
If you're using a C shell (e.g. tcsh or csh), do
|
||||
|
||||
$ setenv CVS_RSH ssh
|
||||
|
||||
After that's set up, cd to your src directory and use the following
|
||||
command to download the CVS tree:
|
||||
|
||||
$ 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: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
|
||||
a configure script and Makefile.in, and you will be ready to compile
|
||||
with
|
||||
$ ./configure [--add-options-here] && make
|
||||
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout -r nano_1_2_branch nano
|
||||
|
||||
Once it's done compiling,
|
||||
$ make install
|
||||
(as root) should put the required files in their respective directories.
|
||||
|
||||
Generate the configure script
|
||||
-----------------------------
|
||||
|
||||
Once you have the sources in the "nano" directory,
|
||||
|
||||
$ cd nano
|
||||
$ ./autogen.sh
|
||||
|
||||
This will set up a configure script and a Makefile.in file.
|
||||
|
||||
|
||||
Configure your build
|
||||
--------------------
|
||||
|
||||
To configure your build, run the configure script from the nano source
|
||||
directory:
|
||||
|
||||
$ ./configure [--add-options-here]
|
||||
|
||||
|
||||
Build and install
|
||||
-----------------
|
||||
|
||||
From the nano source directory, build the code with:
|
||||
|
||||
$ make
|
||||
|
||||
Then, once it's done compiling, run
|
||||
|
||||
$ make install
|
||||
|
||||
which should copy various files (i.e, the nano executable, the info and
|
||||
man pages, and syntax highlighting pattern files) to their appropriate
|
||||
directories.
|
||||
|
||||
If you're installing into the default install directory (/usr/local),
|
||||
you'll need to run that "make install" command with root privileges.
|
||||
|
||||
|
||||
Problems?
|
||||
---------
|
||||
|
||||
Please submit any bugs in the CVS branch to nano-devel@gnu.org.
|
||||
|
||||
1
THANKS
1
THANKS
@@ -26,6 +26,7 @@ Clement Laforet <clem_laf@wanadoo.fr> French translator
|
||||
Gergely Nagy <algernon@debian.org> Hungarian translator
|
||||
Kalle Olavi Niemitalo <kon@iki.fi> Finnish Translator
|
||||
Claudio Neves <cneves@nextis.com> Brazilian Portuguese translator
|
||||
Daniel Nylander <po@danielnylander.se> Swedish Translator
|
||||
Michael Piefel <piefel@informatik.hu-berlin.de> German translator
|
||||
Sergey A. Ribalchenko <fisher@obu.ck.ua> Russian, Ukrainian translator
|
||||
Michel Robitaille <robitail@IRO.UMontreal.CA> French translator
|
||||
|
||||
42
TODO
42
TODO
@@ -1,13 +1,42 @@
|
||||
TODO file (? means the feature may be implemented, but not definitely)
|
||||
-----------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------
|
||||
|
||||
For version 1.4:
|
||||
For the next version:
|
||||
- Undo/Redo keys?
|
||||
- Rebindable keys?
|
||||
- FriBidi support?
|
||||
- Port to DJGPP?
|
||||
- Make matching bracket searches sophisticated enough to skip over
|
||||
brackets inside comments?
|
||||
- Allow indentation of marked text by spaces as well as tabs?
|
||||
- Rewrite the nano FAQ in SGML.
|
||||
- Allow conversion between different character sets. Maybe use glib's
|
||||
iconv() if the system's iconv() is inadequate, since we already use
|
||||
glib's vsnprintf() if the system lacks vsnprintf()?
|
||||
- Properly preserve the cursor position when going from the "Read File"
|
||||
or "Save File As" prompt to the file browser to the "Go To Directory"
|
||||
prompt, and then canceling back to the "Read File" or "Save File As"
|
||||
prompt.
|
||||
- Allow color syntaxes to apply to more than just color, so that we can
|
||||
e.g. specify a different alternate spell checker depending on which
|
||||
file type we have open.
|
||||
- Allow color syntaxes to be selected based on more than just filename
|
||||
extension, e.g. through libmagic?
|
||||
- Allow text searches in the help browser.
|
||||
- Allow setting marks (saved positions, not to be confused with the mark
|
||||
set via Ctrl-^) at various lines and/or columns in the buffer, and
|
||||
allow movement between them with a single keystroke.
|
||||
- Add the ability to move to different lines of the screen with a single
|
||||
keystroke, e.g. M-` to go to the top line, M-& to go to the center
|
||||
line, and M-' to go to the last line.
|
||||
|
||||
Old requests:
|
||||
|
||||
For version 2.0:
|
||||
- UTF-8 support. [DONE]
|
||||
- Support for paragraph searches. [DONE]
|
||||
- Support for justifying the entire file at once. [DONE]
|
||||
- Support for filename searches in the file browser.
|
||||
- Undo/Redo keys?
|
||||
- Rebindable keys?
|
||||
- Support for filename searches in the file browser. [DONE]
|
||||
- Keystroke to implement "Add next sequence as raw" like vi's ^V. [DONE]
|
||||
- Spell check selected text only. [DONE]
|
||||
- Make "To Line" (^W^T) and "Read from Command" (^R^X) reenter their
|
||||
@@ -15,9 +44,6 @@ For version 1.4:
|
||||
(^R^X^X) (requires figuring out when to keep cursor position and when
|
||||
not to). [DONE]
|
||||
- Fix resetstatuspos global which we shouldn't have. [DONE]
|
||||
- Rewrite the nano FAQ in SGML.
|
||||
|
||||
Old requests:
|
||||
|
||||
For version 1.2:
|
||||
- Single line scroll up/down? [DONE]
|
||||
|
||||
71
UPGRADE
71
UPGRADE
@@ -1,6 +1,73 @@
|
||||
GNU nano upgrading information
|
||||
==============================
|
||||
|
||||
Visible changes since 1.2
|
||||
-------------------------
|
||||
* Editor Features
|
||||
- Support for UTF-8.
|
||||
- Moving to a specified line and column of a file, instead of just a
|
||||
line (+LINE[,COLUMN]).
|
||||
- Smart home key (-A).
|
||||
- Creation of unique backup files in a specified directory (-C <dir>).
|
||||
- Insertion of spaces instead of a tab when Tab is pressed (-E).
|
||||
- The long option for -K is now --rebindkeypad.
|
||||
- Regular expression searching can now be toggled when nano is built
|
||||
with --enable-tiny, so -R now means something else (see below).
|
||||
- Restricted mode that provides more security than -o (-R).
|
||||
- Blanking of the statusbar after 1 keystroke instead of 25 (-U).
|
||||
- Word searches can optionally skip over punctuation (-W).
|
||||
- Workaround for Delete's acting like Backspace (-d).
|
||||
- Many more options are supported in the nanorc.
|
||||
- Improvements to color syntax highlighting support: case insensitive
|
||||
matching, the ability to include color syntaxes in separate files,
|
||||
the ability to specify background colors without foreground colors,
|
||||
etc.
|
||||
- Insertion of single-byte characters via Esc Esc <000-255>.
|
||||
- Insertion of all characters via "Verbatim Input" mode.
|
||||
- Workaround for the "NumLock glitch".
|
||||
- Meta-W now repeats the last search. Wrapping is now toggled via
|
||||
Meta-L.
|
||||
- Replacing and spell checking only selected text.
|
||||
- Indenting all marked lines with one keystroke.
|
||||
- Copying text into the cutbuffer without cutting it.
|
||||
- Scrolling the text up and down single lines without moving the
|
||||
cursor.
|
||||
- PageUp and PageDown work more smoothly when using -S.
|
||||
- Scrolling the help text up and down single lines.
|
||||
- Cutting all text from the current position to the end of the file
|
||||
with one keystroke.
|
||||
- Justifying the entire file with one keystroke.
|
||||
- Justifying without removing spaces from the ends of lines.
|
||||
- Unjustifying after justifying and immediately resizing.
|
||||
- Going to the first or last line of the current paragraph.
|
||||
- Going to the first or last line of the file without having to go to
|
||||
the "Search" prompt.
|
||||
- Searching for filenames in the file browser.
|
||||
- Displaying spaces and tabs differently to make it easier to tell
|
||||
them apart.
|
||||
- Many more functions available at the statusbar prompt: moving to the
|
||||
next or previous word, searching for matching brackets, "Verbatim
|
||||
Input" mode, etc.
|
||||
- The glibc 2.2.3 crashes involving extended regular expressions are
|
||||
no longer worked around, as they can break anything using extended
|
||||
regular expressions, and glibc 2.2.3 is old. You should upgrade to
|
||||
at least glibc 2.2.4.
|
||||
|
||||
* File Handling
|
||||
- Automatic adding of newlines to the ends of files without them can
|
||||
now be disabled (-L).
|
||||
- Converting from and to DOS/Mac file format is now toggled only at
|
||||
the "Write File" prompt, via Meta-D and Meta-M, and the default file
|
||||
format to save in is now set depending on what format the file was
|
||||
originally in. -D now makes nano use bold text instead of reverse
|
||||
video text, and Meta-D at the edit window now does a
|
||||
word/line/character count. -O now makes the unused second line of
|
||||
the screen part of the edit window, and Meta-O at the edit window
|
||||
now toggles this behavior.
|
||||
- Converting files that contain a mix of DOS and Mac format lines.
|
||||
- Automatic switching on of -N with binary files has been removed, as
|
||||
it causes problems with UTF-8 support.
|
||||
|
||||
Visible changes since 1.0
|
||||
-------------------------
|
||||
* Editor Features
|
||||
@@ -8,10 +75,10 @@ Visible changes since 1.0
|
||||
something else, see below).
|
||||
- nanorc support (see nanorc.sample included in sources).
|
||||
- Smooth scrolling (-S).
|
||||
- Searching of matching brace/bracket/etc.
|
||||
- Support for searching for matching braces, brackets, etc.
|
||||
- Help for all editor features.
|
||||
- Color syntax highlighting support.
|
||||
- Quote string support, useful for mail agents, etc (-Q).
|
||||
- Quote string support, useful for mail agents, etc. (-Q).
|
||||
- Insertion of output of external commands.
|
||||
- Optional enabling of XON and XOFF control characters (-p).
|
||||
- Tons of bugfixes/enhancements for already existing features.
|
||||
|
||||
48
configure.ac
48
configure.ac
@@ -19,7 +19,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [1.3.10], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [1.3.12], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
@@ -41,29 +41,15 @@ AM_GNU_GETTEXT_VERSION(0.11.5)
|
||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
||||
AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
|
||||
|
||||
dnl Data location.
|
||||
|
||||
pkgdatadir=${datadir}/${PACKAGE}
|
||||
AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
|
||||
|
||||
dnl Checks for header files.
|
||||
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h regex.h termios.h wchar.h wctype.h)
|
||||
AC_CHECK_HEADER(regex.h,
|
||||
AC_MSG_CHECKING([for broken regexec from glibc 2.2.3])
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
int main(void)
|
||||
{
|
||||
regex_t reg;
|
||||
size_t n = 1;
|
||||
regmatch_t r;
|
||||
regcomp(®, "\\<", 0);
|
||||
regexec(®, "", n, &r, 0);
|
||||
regfree(®);
|
||||
return 0;
|
||||
}],
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions, as the one from glibc 2.2.3 does.]),
|
||||
AC_MSG_RESULT([cross-compiling; assuming no])))
|
||||
AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h)
|
||||
|
||||
dnl Checks for options.
|
||||
|
||||
@@ -89,7 +75,7 @@ AC_ARG_ENABLE(tiny,
|
||||
[if test x$enableval = xyes; then
|
||||
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_HELP, 1, [Define this to disable the help text display.])
|
||||
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).])
|
||||
@@ -107,7 +93,7 @@ fi])
|
||||
AC_ARG_ENABLE(help,
|
||||
[ --disable-help Disable help function],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(justify,
|
||||
@@ -157,12 +143,6 @@ AC_ARG_ENABLE(color,
|
||||
[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 regex.h and ENABLE_NANORC too!]) color_support=yes
|
||||
AC_MSG_WARN([
|
||||
***********************************************************************
|
||||
*** WARNING: Color support is far from perfect, but functional. ***
|
||||
*** Be careful with syntax in your .nanorc or nano may malfunction. ***
|
||||
***********************************************************************
|
||||
])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(multibuffer,
|
||||
@@ -184,12 +164,6 @@ AC_ARG_ENABLE(all,
|
||||
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([
|
||||
***********************************************************************
|
||||
*** WARNING: Color support is far from perfect, but functional. ***
|
||||
*** Be careful with syntax in your .nanorc or nano may malfunction. ***
|
||||
***********************************************************************
|
||||
])
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING([whether to enable UTF-8 support])
|
||||
@@ -398,6 +372,8 @@ int main(void)
|
||||
;;
|
||||
esac], [AC_MSG_RESULT(no)])
|
||||
|
||||
AM_CONDITIONAL(USE_COLOR, test "x$color_support" = "xyes")
|
||||
|
||||
dnl Checks for functions.
|
||||
|
||||
AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
|
||||
@@ -504,8 +480,10 @@ fi
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
doc/Makefile
|
||||
doc/nanorc.sample
|
||||
doc/man/Makefile
|
||||
doc/man/fr/Makefile
|
||||
doc/syntax/Makefile
|
||||
doc/texinfo/Makefile
|
||||
m4/Makefile
|
||||
po/Makefile.in
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
nanorc.sample
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
SUBDIRS = man texinfo
|
||||
|
||||
if USE_COLOR
|
||||
SUBDIRS += syntax
|
||||
endif
|
||||
|
||||
EXTRA_DIST = faq.html nanorc.sample
|
||||
|
||||
86
doc/faq.html
86
doc/faq.html
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>The GNU nano editor FAQ</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
|
||||
<h1>The GNU nano editor FAQ</h1>
|
||||
@@ -32,17 +32,19 @@
|
||||
<a href="#3.9">3.9. How do I make a .nanorc file that nano will read when I start it?</a></p></blockquote>
|
||||
<h2><a href="#4">4. Running</a></h2>
|
||||
<blockquote><p><a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
|
||||
<a href="#4.2">4.2. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</a><br>
|
||||
<a href="#4.2">4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</a><br>
|
||||
<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>
|
||||
<a href="#4.4">4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</a><br>
|
||||
<a href="#4.5">4.5. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.6">4.6. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.7">4.7. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.8">4.8. [version 1.3.12 and later] I'm using glibc 2.2.3, and nano crashes when I use color support or do regular expression searches. How can I fix that?</a><br>
|
||||
<a href="#4.9">4.9. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.10a">4.10a. [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.10b">4.10b. [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.11">4.11. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.12">4.12. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.13">4.13. 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><br>
|
||||
@@ -77,12 +79,12 @@
|
||||
<p>The <a href="http://www.debian.org/">Debian GNU/Linux</a> distribution, known for its strict standards in distributing truly "free" software (i.e. software with no restrictions on redistribution), would not include a binary package for Pine or Pico. Many people had a serious dilemma: they loved these programs, but they were not truly free software in the <a href="http://www.gnu.org/philosophy/free-sw.html">GNU</a> sense of the word.</p>
|
||||
<p><b>The event...</b></p>
|
||||
<p>It was in late 1999 when Chris Allegretta (our hero) was yet again complaining to himself about the less-than-perfect license Pico was distributed under, the 1000 makefiles that came with it and how just a few small improvements could make it the Best Editor in the World (TM). Having been a convert from Slackware to Debian, he missed having a simple binary package that included Pine and Pico, and had grown tired of downloading them himself.</p>
|
||||
<p>Finally something snapped inside and Chris coded and hacked like a madman for many hours straight one weekend to make a (barely usable) Pico clone, at the time called TIP (Tip Isn't Pico). The program could not be invoked without a filename, could not save files, had no help menu, spell checker, and so forth. But over time it improved, and with the help of a few great coders it matured to the (hopefully) stable state it is today.</p>
|
||||
<p>Finally something snapped inside and Chris coded and hacked like a madman for many hours straight one weekend to make a (barely usable) Pico clone, at the time called TIP (Tip Isn't Pico). The program could not be invoked without a filename, could not save files, had no help text display, spell checker, and so forth. But over time it improved, and with the help of a few great coders it matured to the (hopefully) stable state it is today.</p>
|
||||
<p>In February 2001, nano was declared an official GNU program by Richard Stallman. Nano also reached its first production release on March 22, 2001.</p></blockquote>
|
||||
<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.10. 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.12. 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%">
|
||||
@@ -101,11 +103,6 @@
|
||||
<li><a href="http://www.nano-editor.org/dist/v1.2/RPMS/">http://www.nano-editor.org/dist/v1.2/RPMS/</a></li>
|
||||
<li><a href="http://www.ewtoo.org/~astyanax/nano/dist/v1.2/RPMS/">http://www.ewtoo.org/~astyanax/nano/dist/v1.2/RPMS/</a></li>
|
||||
</ul>
|
||||
<p>Additionally, check out the RedHat contribs section at:</p>
|
||||
<ul>
|
||||
<li><a href="http://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/">http://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/</a></li>
|
||||
<li><a href="ftp://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/">ftp://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/</a></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<h2><a name="2.3"></a>2.3. Debian (.deb) packages.</h2>
|
||||
<blockquote><p>Debian users can check out the current nano packages for:</p>
|
||||
@@ -117,7 +114,7 @@
|
||||
<p>You can also have a look at the <a href="ftp://ftp.debian.org/debian/pool/main/n/nano/">Package Pool</a> to see all the available binary and source packages.</p>
|
||||
<p>Note that versions < 0.9.10 are probably not for those wanting to get serious work done, so if you are using Debian 2.2, check that you have updated to 2.2r3, which comes with nano 0.9.23. If you're tracking unstable, you probably have the newest version already.</p></blockquote>
|
||||
<h2><a name="2.4"></a>2.4. By CVS (for the brave).</h2>
|
||||
<blockquote><p>For the 'bleeding edge' current version of nano, you can use CVS to download the current source code. <b>Note:</b> believe it or not, by downloading code that has not yet stabilized into an official release, there could quite possibly be bugs, in fact the code may not even compile! Anyway, see <a href="http://savannah.gnu.org/cvs/?group_id=1025">the nano CVS page</a> for info on anonymous CVS access to the nano source.</p></blockquote>
|
||||
<blockquote><p>For the 'bleeding edge' current version of nano, you can use CVS to download the current source code. <b>Note:</b> believe it or not, by downloading code that has not yet stabilized into an official release, there could quite possibly be bugs, in fact the code may not even compile! Anyway, see <a href="http://savannah.gnu.org/cvs/?group=nano">the nano CVS page</a> for info on anonymous CVS access to the nano source.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="3"></a>3. Installation and Configuration</h1>
|
||||
<h2><a name="3.1"></a>3.1. How do install the RPM or DEB package?</h2>
|
||||
@@ -169,7 +166,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 six-digit hexadecimal code from 000000 to 10FFFF (case-insensitive), and the character with the corresponding value will be inserted instead.</p></blockquote>
|
||||
<p>Alternatively, if you've enabled Unicode support (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code from 000000 to 10FFFF (case-insensitive), and the character with the corresponding value will be inserted instead. The prompt will change to "Unicode Input" when you do this.</p></blockquote>
|
||||
<h2><a name="3.9"></a>3.9. How do I make a .nanorc file that nano will read when I start it?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your version of nano must 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%">
|
||||
@@ -179,51 +176,55 @@
|
||||
<p>To open '+filename.txt' starting on line 1: <b>nano +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 10: <b>nano +10 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 1 and 'filename.txt' starting on line 10 (if nano has been compiled with multibuffer support): <b>nano +1 +filename.txt +20 filename.txt</b></p></blockquote>
|
||||
<h2><a name="4.2"></a>4.2. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</h2>
|
||||
<h2><a name="4.2"></a>4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</h2>
|
||||
<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. 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.5"></a>4.5. Nano crashes when I type <insert keystroke here>!</h2>
|
||||
<h2><a name="4.4"></a>4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</h2>
|
||||
<blockquote><p>This is a bug in the terminal, not in nano. When a key is repeating faster than nano can process it, the keyboard buffer becomes full and starts dropping incoming keystrokes. Unfortunately, it doesn't just drop whole keystrokes; it can also drop parts of multibyte key combinations, resulting in nano's receiving a wrong key.</p></blockquote>
|
||||
<h2><a name="4.5"></a>4.5. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
|
||||
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, and Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
|
||||
<h2><a name="4.6"></a>4.6. Nano crashes when I type <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.6"></a>4.6. Nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<h2><a name="4.7"></a>4.7. Nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9 would be great, 0.9.12 is recommended).</p></blockquote>
|
||||
<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>
|
||||
<h2><a name="4.8"></a>4.8. [version 1.3.12 and later] I'm using glibc 2.2.3, and nano crashes when I use color support or do regular expression searches. How can I fix that?</h2>
|
||||
<blockquote><p>It's a bug in glibc 2.2.3. You should upgrade to at least glibc 2.2.4.</p></blockquote>
|
||||
<h2><a name="4.9"></a>4.9. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
|
||||
<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.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>
|
||||
<h2><a name="4.10a"></a>4.10a. [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.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>
|
||||
<h2><a name="4.10b"></a>4.10b. [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.9"></a>4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<h2><a name="4.11"></a>4.11. 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>
|
||||
<p>or, if you use tcsh, put this in your <b>.cshrc</b> file:</p>
|
||||
<p><b>setenv EDITOR /usr/local/bin/nano</b></p>
|
||||
<p>Change /usr/local/bin/nano to wherever nano is installed on your system. Type "which nano" to find out. This will not take effect until the next time you login. So log out and back in again.</p>
|
||||
<p>Then on top that if you use Pine you must go into setup (type <b>S</b> at the main menu), then configure (type <b>C</b>). Hit enter on the lines that say:</p>
|
||||
<p>Then, on top of that, if you use Pine, you must go into setup (type <b>S</b> at the main menu), and then configure (type <b>C</b>). Hit Enter on the lines that say:</p>
|
||||
<p><b>[ ] enable-alternate-editor-cmd</b><br>
|
||||
<b>[ ] enable-alternate-editor-implicitly</b></p>
|
||||
<p>Then exit (<b>E</b>) and select Yes (<b>Y</b>).</p>
|
||||
<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>If you're a mutt user, you 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.10"></a>4.10. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<h2><a name="4.12"></a>4.12. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. 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.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>
|
||||
<h2><a name="4.13"></a>4.13. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
|
||||
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
|
||||
<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>
|
||||
<blockquote><p>On June of 2001, GNU nano entered the <a href="http://www.iro.umontreal.ca/contrib/po/HTML/">Free Translation Project</a> and since then, translations should be managed from there.</p>
|
||||
<p>If there isn't a translation for your language, you could ask <a href="http://www.iro.umontreal.ca/contrib/po/HTML/teams.html">your language team</a> to translate nano, or better still, join your team and do it yourself. Joining a team is easy. You just need to ask the <a href="mailto:translation@iro.umontreal.ca">TP coordinator</a> to add you to your team, and send a <a href="http://www.iro.umontreal.ca/contrib/po/HTML/disclaim.html">translation disclaimer to the FSF</a> (this is necessary as nano is an official GNU package, but it does <b>not</b> mean that you transfer the rights of your work to the FSF, it's just so the FSF can legally manage them).</p>
|
||||
<blockquote><p>On June of 2001, GNU nano entered the <a href="http://www.iro.umontreal.ca/translation/HTML/">Free Translation Project</a> and since then, translations should be managed from there.</p>
|
||||
<p>If there isn't a translation for your language, you could ask <a href="http://www.iro.umontreal.ca/translation/HTML/teams.html">your language team</a> to translate nano, or better still, join your team and do it yourself. Joining a team is easy. You just need to ask the <a href="mailto:translation@iro.umontreal.ca">TP coordinator</a> to add you to your team, and send a <a href="http://www.iro.umontreal.ca/translation/HTML/disclaim.html">translation disclaimer to the FSF</a> (this is necessary as nano is an official GNU package, but it does <b>not</b> mean that you transfer the rights of your work to the FSF, it's just so the FSF can legally manage them).</p>
|
||||
<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>
|
||||
<blockquote><p>With the latest development version (1.3.12+), Unicode should be 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>
|
||||
@@ -255,7 +256,16 @@
|
||||
<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>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>
|
||||
<p>2006/06/12 - Update section 5.3, due to the display fix for two-column Unicode characters. (DLR)<br>
|
||||
2006/06/05 - Add a new section 4.8, and move all section 4 entries after it down one number, to explain how to deal with glibc 2.2.3's crashes involving extended regular expressions. (DLR)<br>
|
||||
2006/06/04 - Add minor punctuation, wording, and typo fixes. (DLR)<br>
|
||||
2006/05/27 - Update section 3.8 to mention the new "Unicode Input" prompt, and how Unicode input only works when Unicode support is enabled. (DLR)<br>
|
||||
2006/05/12 - Remove section 4.4, and move all section 4 entries after it up one number, since it no longer applies. Meta-] and Meta-[ are no longer used to indent and unindent marked text, since they require that the bracket matching key change to Ctrl-], which is used as the telnet escape key (found by Chris). Also, make the link to the nano CVS page a bit more readable. (DLR)<br>
|
||||
2006/05/08 - Add a new section 4.5, and move all section 4 entries after it down one number, to explain a problem that can occur when holding down keys to generate Meta sequences. Also add a few more capitalization and wording fixes. (Benno Schulenberg, minor tweaks by DLR)<br>
|
||||
2006/05/01 - Add a new section 4.4, and move all section 4 entries after it down one number, to explain how to deal with problems typing Meta-[. Also add a few capitalization and wording fixes. (DLR)<br>
|
||||
2006/04/14 - Clarify section 1.4: help menu -> help text display. (DLR, suggested by Benno Schulenberg)<br>
|
||||
2006/03/16 - Update the Free Translation Project's address, change the character set to UTF-8, and remove broken links to contributed RedHat nano packages. (DLR)<br>
|
||||
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>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
nanorc.5.html
|
||||
nano.1.html
|
||||
nanorc.5.html
|
||||
rnano.1.html
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
if USE_NLS
|
||||
SUBDIRS = fr
|
||||
else
|
||||
SUBDIRS =
|
||||
|
||||
if USE_NLS
|
||||
SUBDIRS += fr
|
||||
endif
|
||||
|
||||
man_MANS = nano.1 nanorc.5 rnano.1
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
nanorc.5.html
|
||||
nano.1.html
|
||||
nanorc.5.html
|
||||
rnano.1.html
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
man_MANS = nano.1 nanorc.5
|
||||
man_MANS = nano.1 nanorc.5 rnano.1
|
||||
|
||||
mandir = @mandir@/fr
|
||||
|
||||
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,12 +1,13 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by
|
||||
.\" Chris Allegretta <chrisa@asty.org>
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
.\" 2006 by Chris Allegretta <chrisa@asty.org>
|
||||
.\"
|
||||
.\" Adaptation française (c) 2003-2005 par
|
||||
.\" Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" Adaptation française (c) 2003-2006 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.
|
||||
.\" 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
|
||||
@@ -14,7 +15,7 @@
|
||||
.\" AUCUNE garantie.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.10" "15 décembre 2005"
|
||||
.TH NANO 1 "version 1.3.12" "17\ juin\ 2006"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\"
|
||||
@@ -24,7 +25,7 @@ nano \- NAno un NOuvel
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [\+LIGNE,COLONNE]\ [options]\ [fichier]
|
||||
.I [OPTIONS]\ [[\+LIGNE[,COLONNE]]\ FICHIER]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -34,7 +35,7 @@ Cette page de manuel d
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" respectively.
|
||||
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à remplacer
|
||||
Pico, l'éditeur par défaut du paquet non libre Pine. \fBnano\fR ne se
|
||||
Pico, l'éditeur par défaut du logiciel non libre Pine. \fBnano\fR ne se
|
||||
contentant pas de copier l'interface et l'ergonomie de Pico, il offre
|
||||
également certaines fonctions manquantes (ou désactivées par défaut)
|
||||
dans Pico. Ces fonctionnalités sont, par exemple, les fonctions de
|
||||
@@ -43,7 +44,7 @@ num
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILIGNE\fP,\fICOLONNE\fP
|
||||
.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
|
||||
@@ -62,6 +63,9 @@ ligne.
|
||||
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
|
||||
version précédente, en ajoutant un tilde (~) au nom du fichier.
|
||||
.TP
|
||||
.B \-D (\-\-boldtext)
|
||||
Utilise des caractères gras à la place de la vidéo inverse.
|
||||
.TP
|
||||
.B \-C \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
|
||||
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
|
||||
de sécurité uniques si celles-ci sont activées.
|
||||
@@ -104,14 +108,17 @@ espace suppl
|
||||
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 ">\ ".
|
||||
sera "\fI^([\ \\t]*[#:>\\|}])+\fP", sinon, ce sera "\fI>\ \fP". Dans
|
||||
l'expression rationnelle précédente, «\ \fI\\t\fP\ » représente une
|
||||
tabulation.
|
||||
.TP
|
||||
.B \-R (\-\-restricted)
|
||||
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
|
||||
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
|
||||
interdiction de suspendre, interdiction d'ajouter au début, à la fin,
|
||||
de sauvegarder un fichier ayant déjà un nom sous un nom différent,
|
||||
d'utiliser une copie de sécurité ou le correcteur orthographique. Cette
|
||||
option peut aussi être activée en appelant \fBnano\fP sous un nom
|
||||
commençant par «\ r\ » (par exemple «\ rnano\ »).
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
@@ -126,10 +133,10 @@ est de 8.
|
||||
.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.
|
||||
l'option \fB-c\fP prend le pas sur cette option.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Affiche le numéro de version et l'auteur.
|
||||
Affiche la version, puis s'arrête.
|
||||
.TP
|
||||
.B \-W (\-\-wordbounds)
|
||||
Détection plus précise des limites de mots, obtenue en considérant les
|
||||
@@ -142,7 +149,7 @@ disponible.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Affiche en permanence la position du curseur. Notez que cette option
|
||||
annule l'option \fB-U\fP.
|
||||
prend le pas sur l'option \fB-U\fP.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
@@ -152,7 +159,7 @@ la touche
|
||||
«\ Supprimer\ ».
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Affiche un résumé des options disponibles en ligne de commande.
|
||||
Affiche un résumé des options de lancement de nano, puis s'arrête.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
Indentation automatique. Commence chaque nouvelle ligne au même niveau que
|
||||
@@ -168,8 +175,12 @@ remplace le lien par le nouveau fichier. Sans doute utile pour
|
||||
les fichiers de \fI/tmp\fR, non\ ?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Active l'utilisation de la souris (si elle est disponible pour votre
|
||||
système).
|
||||
Active l'utilisation de la souris, si elle est disponible pour votre
|
||||
système. Lorsque celle-ci est activée, il est possible d'utiliser la
|
||||
souris pour positionner le curseur, pour marquer le texte (avec un
|
||||
double-clic) et pour lancer les fonctions correspondant aux raccourcis.
|
||||
Il est possible d'utiliser la souris sous X\ Window ou en mode console
|
||||
avec gpm.
|
||||
.TP
|
||||
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
|
||||
Définit le répertoire de travail. Demande à \fBnano\fP de mettre en place
|
||||
@@ -237,7 +248,7 @@ respectifs.
|
||||
Merci de nous faire parvenir vos commentaires et de nous signaler les
|
||||
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
|
||||
|
||||
La liste de discussion anglophone \fBnano\fR est disponible via
|
||||
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
|
||||
\fBnano-devel@gnu.org\fR.
|
||||
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
@@ -266,9 +277,9 @@ utilis
|
||||
|
||||
.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.
|
||||
<jean-philippe.guerard@corbeaunoir.org> le 17\ juin\ 2006 à partir
|
||||
de la version du 8\ juin\ 2006 de la page de manuel de nano 1.3.12.
|
||||
Cette page a été relue par Gérard Delafond.
|
||||
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
@@ -277,6 +288,6 @@ version originale, n'h
|
||||
traducteur.
|
||||
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
consultable via la commande :
|
||||
consultable via la commande\ :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nanorc.5 is Copyright (C) 2003, 2004, 2005 Free Software
|
||||
.\" Foundation, Inc.
|
||||
.\" nanorc.5 is Copyright (C) 2003, 2004, 2005, 2006 by the Free
|
||||
.\" Software Foundation, Inc.
|
||||
.\"
|
||||
.\" (c) 2003-2005 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" pour l'adaptation française
|
||||
.\" (c) 2003-2006 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
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\" 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
|
||||
@@ -14,7 +15,7 @@
|
||||
.\" AUCUNE garantie.
|
||||
.\"
|
||||
\" $Id$
|
||||
.TH NANORC 5 "version 1.3.10" "15 décembre 2005"
|
||||
.TH NANORC 5 "version 1.3.12" "17\ juin\ 2006"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
|
||||
@@ -26,7 +27,7 @@ Cette page de manuel d
|
||||
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 logiciel non libre Pine.
|
||||
\fBnano\fP ne se contentant pas de copier l'interface et l'ergonomie de
|
||||
Pico, il offre également certaines fonctionnalités manquantes (ou
|
||||
désactivées par défaut) de Pico. Ces fonctionnalités sont, par exemple,
|
||||
@@ -34,37 +35,44 @@ les fonctions de recherche et de remplacement et la possibilit
|
||||
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 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.
|
||||
\fBnano\fP. Il ne doit pas être au format DOS ou Mac. Lors de son
|
||||
démarrage, nano commencera par lire le fichier de configuration général
|
||||
\fISYSCONFDIR/nanorc\fP, puis lira le fichier de configuration personnel
|
||||
de l'utilisateur \fI~/.nanorc\fP.
|
||||
|
||||
.SH OPTIONS
|
||||
Le fichier de configuration accepte une série de commandes «\ 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),
|
||||
«\ color\ » (couleur) et «\ icolor\ » (couleur insensible à la casse)
|
||||
Le fichier de configuration accepte une série de commandes \fBset\fP
|
||||
(activer) et \fBunset\fP (désactiver), qui permettent de définir le
|
||||
paramétrage de nano au démarrage sans avoir à utiliser d'options de
|
||||
ligne de commande. De plus, les mots clefs \fBsyntax\fP (syntaxe),
|
||||
\fBcolor\fP (couleur) et \fBicolor\fP (couleur insensible à la casse)
|
||||
sont utilisés pour définir les règles de colorisation pour différents
|
||||
motifs de texte. Nano lira une commande par ligne.
|
||||
motifs de texte. \fBnano\fP lit une commande par ligne.
|
||||
|
||||
Les options du fichier de configuration ont priorité sur les valeurs par
|
||||
défaut utilisées par nano. Les options de la ligne de commande sont
|
||||
prioritaires par rapport aux options du fichier de configuration.
|
||||
Les options du fichier de configuration ont priorité sur les valeurs par
|
||||
défaut utilisées par nano. Les options de la ligne de commande sont
|
||||
prioritaires par rapport aux options du fichier de configuration. Les
|
||||
options sont désactivées (unset) par défaut, sauf les options prenant un
|
||||
argument.
|
||||
|
||||
Les options sont désactivées (unset) par défaut, sauf les options
|
||||
prenant un argument.
|
||||
Les apostrophes («\ \fI'\fP\ ») et les guillemets droits («\ \fI"\fP\ »)
|
||||
présents dans des chaînes de caractères utilisées comme paramètres n'ont
|
||||
pas besoin d'être précédées d'une barre oblique inversée
|
||||
(«\ \fI\\\fP\ »). La chaîne sera terminée par le dernier guillemet
|
||||
droit. Par exemple, pour l'option \fBbrackets\fP, "\fI"')>]}\fP"
|
||||
correspondra à \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP et \fI}\fP.
|
||||
|
||||
Les commandes et arguments reconnus sont\ :
|
||||
|
||||
.TP 3
|
||||
\fBset/unset autoindent\fP
|
||||
.B set/unset autoindent
|
||||
Active l'indentation automatique.
|
||||
.TP
|
||||
\fBset/unset backup\fP
|
||||
.B set/unset backup
|
||||
Crée des copies de sécurité nommées
|
||||
.IR nom_du_fichier~ .
|
||||
.TP
|
||||
.B set backupdir \fIrépertoire\fP
|
||||
.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é.
|
||||
@@ -72,82 +80,100 @@ activ
|
||||
.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.
|
||||
.B set/unset boldtext
|
||||
Utilise des caractères gras à la place de la vidéo inverse.
|
||||
.TP
|
||||
.B set brackets "\fIchaîne\fP"
|
||||
Définit les caractères considérés comme des crochets fermants lors de la
|
||||
justification des paragraphes. Ces caractères ne doivent pas contenir
|
||||
d'espaces. Seules les ponctuations terminales, éventuellement suivies
|
||||
de crochets fermants, peuvent terminer une phrase.
|
||||
|
||||
(N.D.T.\ : reportez-vous au paragraphe sur l'option \fBpunct\fR pour
|
||||
plus d'informations.)
|
||||
|
||||
La valeur par défaut de cette option est\ : "\fI"')>]}\fP".
|
||||
|
||||
.TP
|
||||
.B set/unset casesensitive
|
||||
Par défaut, les recherches ne tiennent pas compte de la casse.
|
||||
.TP
|
||||
\fBset/unset const\fP
|
||||
.B set/unset const
|
||||
Affiche en permanence la position du curseur dans la ligne d'état.
|
||||
.TP
|
||||
\fBset/unset cut\fP
|
||||
.B set/unset cut
|
||||
Par défaut, coupe le texte du curseur à la fin de la ligne, au lieu de
|
||||
couper la ligne entière.
|
||||
.TP
|
||||
\fBset fill \fIn\fP\fP
|
||||
Passe automatiquement à la ligne une fois arrivé à la colonne \fIn\fR.
|
||||
Si la valeur indiquée est de 0 ou moins, le point de passage à la ligne
|
||||
aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de faire
|
||||
varier le point de passage à la ligne lorsque l'on change la taille de
|
||||
l'écran. La valeur par défaut est de -8.
|
||||
.B set fill \fIn\fP
|
||||
Passe automatiquement à la ligne une fois arrivé à la colonne
|
||||
\fIn\fR. Si la valeur indiquée est de 0 ou moins, le point de passage à
|
||||
la ligne aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de
|
||||
faire varier le point de passage à la ligne lorsque l'on change la
|
||||
taille de l'écran. La valeur par défaut est de -8.
|
||||
.TP
|
||||
\fBset/unset historylog\fP
|
||||
.B set/unset historylog
|
||||
Active l'utilisation de
|
||||
.I ~/.nano_history
|
||||
pour enregistrer et relire les chaînes ayant fait l'objet d'une
|
||||
recherche ou d'un remplacement.
|
||||
.TP
|
||||
.B set matchbrackets "\fIchaîne\fP"
|
||||
Définit les crochets ouvrants et fermant pour la recherche de crochets
|
||||
correspondants. Cette liste ne doit pas contenir de blancs. L'ensemble
|
||||
des crochets ouvrants doit être indiqué en premier, suivi de l'ensemble
|
||||
des crochets fermant, qui doit être dans le même ordre. La valeur par
|
||||
défaut de cette option est "\fI(<[{)>]}\fP".
|
||||
.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.
|
||||
Active l'utilisation de la souris, si elle est disponible pour votre
|
||||
système. Lorsque celle-ci est activée, il est possible d'utiliser la
|
||||
souris pour positionner le curseur, pour marquer le texte (avec un
|
||||
double-clic) et pour lancer les fonctions correspondant aux raccourcis.
|
||||
Il est possible d'utiliser la souris sous X\ Window ou en mode console
|
||||
avec gpm.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
Mode multifichier\ : permet de charger les fichiers dans leur propre
|
||||
.B set/unset multibuffer
|
||||
Mode multi-espace\ : permet de charger les fichiers dans leur propre
|
||||
espace.
|
||||
.TP
|
||||
\fBset/unset noconvert\fP
|
||||
.B set/unset noconvert
|
||||
Pas de conversion depuis les formats DOS et Mac.
|
||||
.TP
|
||||
\fBset/unset nofollow\fP
|
||||
.B set/unset nofollow
|
||||
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
|
||||
.TP
|
||||
\fBset/unset nohelp\fP
|
||||
.B set/unset nohelp
|
||||
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
|
||||
.B set/unset nowrap
|
||||
Désactive le passage automatique à la ligne.
|
||||
.TP
|
||||
\fBset operatingdir \fIrépertoire\fP\fP
|
||||
.B set operatingdir "\fIrépertoire\fP"
|
||||
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
|
||||
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
|
||||
le répertoire courant, afin que les fichiers soient lus depuis ce
|
||||
répertoire. Par défaut, cette fonction est désactivée.
|
||||
.TP
|
||||
\fBset/unset preserve\fP
|
||||
.B set/unset preserve
|
||||
Préserve les séquences XON et XOFF (^Q et ^S).
|
||||
.TP
|
||||
\fBset punct \fIchaîne\fP\fP
|
||||
Définit les caractères interprétés comme des ponctuations terminales.
|
||||
Ces caractères ne peuvent inclure de blancs. Seules les ponctuations
|
||||
terminales, éventuellement suivies de parenthèses fermantes, peuvent
|
||||
terminer une phrase.
|
||||
.B set punct "\fIchaîne\fP"
|
||||
Définit les caractères interprétés comme des ponctuations terminales
|
||||
lors de la justification des paragraphes. Ces caractères ne peuvent
|
||||
inclure de blancs. Seules les ponctuations terminales, éventuellement
|
||||
suivies de crochets fermants, peuvent terminer une phrase. La valeur par
|
||||
défaut de cette option est "\fI!.?\fP".
|
||||
|
||||
(N.D.T.\ : ce réglage permet, lors de la justification, de conserver 2\
|
||||
espaces au lieu d'une derrière les ponctuations terminales, ce qui
|
||||
(N.D.T.\ : ce réglage permet, lors de la justification, de conserver
|
||||
2\ espaces au lieu d'une derrière les ponctuations terminales, ce qui
|
||||
correspond aux normes typographiques anglo-saxonnes, mais n'a pas lieu
|
||||
d'être en français. Pour le français, le plus simple est d'indiquer,
|
||||
dans le fichier nanorc, une chaîne vide pour ce paramètre.)
|
||||
@@ -156,20 +182,17 @@ dans le fichier nanorc, une cha
|
||||
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
|
||||
.B set quotestr "\fIchaîne\fP"
|
||||
Définit le préfixe par défaut utilisé pour les citations dans les
|
||||
courriers électroniques. Ce préfixe est utilisé pour réaliser une
|
||||
justification correcte de ces citations. Il s'agira, si votre système le
|
||||
permet, d'une «\ expression rationnelle étendue\ ». Dans le cas
|
||||
permet, d'une expression rationnelle étendue. Dans le cas
|
||||
contraire, il s'agira d'une chaîne de texte brut. Si vous disposez des
|
||||
expressions rationnelles, la valeur par défaut sera\ :
|
||||
|
||||
set quotestr "^([\ \\t]*[|>:}#])+"
|
||||
|
||||
Sinon, ce sera ">\ ". Notez que le «\ \\t\ » ci-dessus correspond à un
|
||||
caractère de tabulation.
|
||||
expressions rationnelles, la valeur par défaut de cette option sera
|
||||
"\fI^([\ \\t]*[#:>\\|}])+\fP", sinon, ce sera ">\ ". Notez que le
|
||||
«\ \\t\ » ci-dessus correspond à un caractère de tabulation.
|
||||
.TP
|
||||
\fBset/unset rebinddelete\fP
|
||||
.B set/unset rebinddelete
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous ne devriez avoir besoin de cette option que si, sur votre système,
|
||||
@@ -182,10 +205,11 @@ 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.
|
||||
.B set/unset regexp
|
||||
Utilise par défaut des expressions rationnelles étendues pour les
|
||||
recherches.
|
||||
.TP
|
||||
\fBset/unset smarthome\fP
|
||||
.B set/unset smarthome
|
||||
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque
|
||||
cette touche est pressée à n'importe quel endroit excepté au tout début
|
||||
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
|
||||
@@ -193,31 +217,31 @@ se positionnera au d
|
||||
arrière). Si le curseur est déjà là, il se placera au vrai début de la
|
||||
ligne.
|
||||
.TP
|
||||
\fBset/unset smooth\fP
|
||||
.B set/unset smooth
|
||||
Active le défilement ligne-par-ligne du texte.
|
||||
.TP
|
||||
\fBset speller \fIprogramme\fP\fP
|
||||
.B set speller "\fIprogramme\fP"
|
||||
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.
|
||||
.B set/unset suspend
|
||||
Autorise à suspendre \fBnano\fP.
|
||||
.TP
|
||||
\fBset tabsize \fIn\fP\fP
|
||||
.B set tabsize \fIn\fP
|
||||
Utilise une taille de tabulation de \fIn\fP colonnes. Cette valeur doit
|
||||
être strictement supérieure à 0. La valeur par défaut est de\ 8.
|
||||
.TP
|
||||
.B set/unset tabstospaces
|
||||
Convertit les tabulations clavier en espaces.
|
||||
.TP
|
||||
\fBset/unset tempfile\fP
|
||||
.B set/unset tempfile
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement en
|
||||
quittant, sans demande de confirmation.
|
||||
.TP
|
||||
\fBset/unset view\fP
|
||||
.B set/unset view
|
||||
Interdit de modifier les fichiers.
|
||||
.TP
|
||||
\fBset whitespace \fIchaîne\fP\fP
|
||||
.B set whitespace "\fIchaîne\fP"
|
||||
Définit les deux caractères utilisés pour afficher les premiers
|
||||
caractères des tabulations et des espaces. Ces deux caractères doivent
|
||||
être mono-colonne.
|
||||
@@ -226,13 +250,13 @@ caract
|
||||
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" ... ]
|
||||
.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ée si le nom du
|
||||
fichier en cours correspond au \fImotif_de_fichier\fP. Toutes les
|
||||
instructions suivantes de colorisation \fBcolor\fP ou \fBicolor\fP
|
||||
s'appliqueront à cette syntaxe, jusqu'à la définition d'une nouvelle
|
||||
syntaxe.
|
||||
l'option \fB-Y\fP (ou \fB--syntax\fP) ou qui sera automatiquement
|
||||
activée si le nom du fichier en cours correspond à l'expression
|
||||
rationnelle étendue \fImotif_de_fichier\fP. Toutes les instructions
|
||||
suivantes de colorisation \fBcolor\fP ou \fBicolor\fP s'appliqueront à
|
||||
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
|
||||
|
||||
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
|
||||
@@ -243,13 +267,13 @@ 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 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
|
||||
l'expression rationnelle étendue \fImotif\fP en utilisant la couleur de
|
||||
texte \fIcouleur_texte\fP et la couleur de fond \fIcouleur_fond\fP,
|
||||
l'une de ces deux couleurs au moins devant être définie. Les couleurs
|
||||
acceptées par \fBnano\fP pour le texte et le fond sont\ : \fIwhite\fP
|
||||
(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
|
||||
@@ -260,8 +284,9 @@ Comme ci-dessus, mais la recherche des motifs est effectu
|
||||
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
|
||||
Affiche les expressions commençant par l'expression rationnelle étendue
|
||||
\fImotif_début\fP et se terminant par l'expression rationnelle étendue
|
||||
\fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
|
||||
et la couleur de fond \fIcouleur_fond\fP, l'une de ces deux couleurs au
|
||||
moins devant être définie. Cela permet à la colorisation syntaxique de
|
||||
s'étendre sur plusieurs lignes. Notez que toutes les occurrences
|
||||
@@ -271,6 +296,11 @@ seront surlign
|
||||
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
|
||||
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
|
||||
compte de la casse.
|
||||
.TP
|
||||
.B include "\fIfichier_de_syntaxes\fP"
|
||||
Lit le fichier \fIfichier_de_syntaxes\fP contenant une liste
|
||||
autosuffisante de définitions de syntaxes. Ce fichier ne doit contenir
|
||||
que des commandes \fBsyntax\fP, \fBcolor\fP et \fBicolor\fP.
|
||||
|
||||
.SH FICHIERS
|
||||
.TP
|
||||
@@ -295,9 +325,10 @@ manuel a
|
||||
|
||||
.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.
|
||||
<jean-philippe.guerard@corbeaunoir.org> le 17\ juin\ 2006 à partir de
|
||||
la version du 24\ mai\ 2006 de la page de manuel de nanorc (pour la
|
||||
version 1.3.12 de nano). Cette page a été relue par Gérard
|
||||
Delafond.
|
||||
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
@@ -306,6 +337,6 @@ version originale, n'h
|
||||
traducteur.
|
||||
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
consultable via la commande :
|
||||
consultable via la commande\ :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
|
||||
121
doc/man/fr/rnano.1
Normal file
121
doc/man/fr/rnano.1
Normal file
@@ -0,0 +1,121 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" rnano.1 is Copyright 2005, 2006 by Thijs Kinkhorst
|
||||
.\" <thijs@kinkhorst.com>; skeleton based on nano-tiny.1 by Jordi
|
||||
.\" Mallach <jordi@debian.org>.
|
||||
.\"
|
||||
.\" Adaptation française (c) 2006 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. Ce document est distribué sans
|
||||
.\" AUCUNE garantie.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH RNANO 1 "version 1.3.12" "17\ juin\ 20O6"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\"
|
||||
.SH NOM
|
||||
rnano \- Le mode restreint de NAno un NOuvel éditeur, un clone libre et
|
||||
amélioré de Pico
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B rnano
|
||||
.I [OPTIONS]\ [[\+LIGNE[,COLONNE]]\ FICHIER]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement la commande \fBrnano\fR.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" respectively.
|
||||
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à
|
||||
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
|
||||
\fBnano\fR ne se contentant pas de copier l'interface et l'ergonomie de
|
||||
Pico, il offre également certaines fonctions manquantes (ou désactivées
|
||||
par défaut) dans Pico. Ces fonctionnalités sont, par exemple, les
|
||||
fonctions de recherche et de remplacement, et la possibilité de sauter
|
||||
directement à un numéro de ligne.
|
||||
.PP
|
||||
\fBrnano\fP est une version de \fBnano\fP fonctionnant en mode
|
||||
restreint, qui ne permet d'éditer que les fichiers indiqués et qui
|
||||
n'autorise pas l'utilisateur à accéder au système de fichier ou à un
|
||||
interpréteur de commandes.
|
||||
.PP
|
||||
En mode restreint, \fBnano\fP refusera\ :
|
||||
.IP \[bu] 2
|
||||
de lire ou d'écrire dans un fichier n'ayant pas été indiqué dans la
|
||||
ligne de commande\ ;
|
||||
.IP \[bu]
|
||||
de lire un fichier nanorc\ ;
|
||||
.IP \[bu]
|
||||
de permettre de suspendre l'édition\ ;
|
||||
.IP \[bu]
|
||||
de permettre d'ajouter en début ou en fin d'un fichier, ou de
|
||||
l'enregistrer sous un nom différent\ ;
|
||||
.IP \[bu]
|
||||
l'utilisation de copies de sécurité ou de la correction orthographique.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILIGNE\fP[,\fICOLONNE\fP]
|
||||
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
|
||||
la ligne \fILIGNE\fR au lieu de démarrer à la colonne\ 1, ligne\ 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Identique à \fB-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Affiche un résumé des options de lancement de nano, puis s'arrête.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Affiche la version, puis s'arrête.
|
||||
.PP
|
||||
Reportez-vous à la page de manuel \fBnano\fP(1) si vous souhaitez
|
||||
consulter la documentation complète de \fBnano\fP.
|
||||
|
||||
.SH BOGUES
|
||||
Merci de nous faire parvenir vos commentaires et de nous signaler les
|
||||
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
|
||||
|
||||
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
|
||||
\fBnano-devel@gnu.org\fR.
|
||||
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
|
||||
|
||||
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/
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir le fichier
|
||||
\fIAUTHORS\fR). Cette page de manuel a été initialement rédigée par
|
||||
Thijs Kinkhorst <thijs@kinkhorst.com>, pour le système GNU Debian (mais
|
||||
elle peut être utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Cette adaptation française a été réalisé par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@corbeaunoir.org> le 17\ juin\ 2006 à partir
|
||||
de la version du 1er\ mai\ 2006 de la page de manuel de rnano
|
||||
(pour la version 1.3.12 de nano).
|
||||
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
traducteur.
|
||||
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
consultable via la commande\ :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
@@ -1,12 +1,13 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by
|
||||
.\" Chris Allegretta <chrisa@asty.org>
|
||||
.\" nano.1 is Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
.\" 2006 by Chris Allegretta <chrisa@asty.org>
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\" This is free documentation, see the latest version of the GNU
|
||||
.\" General Public License for copying conditions. There is NO
|
||||
.\" warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.10" "November 21, 2005"
|
||||
.TH NANO 1 "version 1.3.12" "June 7, 2006"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -15,11 +16,11 @@ nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [\+LINE,COLUMN]\ [options]\ [file]
|
||||
.I [OPTIONS]\ [[\+LINE[,COLUMN]]\ FILE]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
This manual page documents briefly the \fBnano\fP command.
|
||||
This manual page briefly documents the \fBnano\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,
|
||||
@@ -32,7 +33,7 @@ replace" and "go to line number".
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILINE\fP,\fICOLUMN\fP
|
||||
.B \+\fILINE\fP[,\fICOLUMN\fP]
|
||||
Places cursor at line number \fILINE\fP and column number \fICOLUMN\fP
|
||||
on startup, instead of the default of line 1, column 1.
|
||||
.TP
|
||||
@@ -54,6 +55,9 @@ filename suffixed with a ~.
|
||||
Set the directory where \fBnano\fP puts unique backup files if file
|
||||
backups are enabled.
|
||||
.TP
|
||||
.B \-D (\-\-boldtext)
|
||||
Use bold text instead of reverse video text.
|
||||
.TP
|
||||
.B \-E (\-\-tabstospaces)
|
||||
Convert typed tabs to spaces.
|
||||
.TP
|
||||
@@ -61,8 +65,8 @@ Convert typed tabs to spaces.
|
||||
Enable multiple file buffers, if available.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Log search and replace strings to \fI~/.nano_history\fP so they can be
|
||||
stored for later editing, if nanorc support is configured.
|
||||
Log search and replace strings to \fI~/.nano_history\fP, so they can be
|
||||
retrieved in later sessions, if nanorc support is available.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
Don't look at \fISYSCONFDIR/nanorc\fP or \fI~/.nanorc\fP, if nanorc
|
||||
@@ -84,15 +88,16 @@ Use the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
.B \-Q \fIstr\fP (\-\-quotestr=\fIstr\fP)
|
||||
Set the quoting string for justifying. The default is
|
||||
"^([\ \\t]*[|>:}#])+" if regular expression support is available, or
|
||||
">\ " otherwise.
|
||||
"\fI^([\ \\t]*[#:>\\|}])+\fP" if extended regular expression support is
|
||||
available, or "\fI>\ \fP" otherwise. Note that \fI\\t\fP stands for a
|
||||
Tab.
|
||||
.TP
|
||||
.B \-R (\-\-restricted)
|
||||
Restricted mode: Don't read or write to any file not specified on the
|
||||
command line, read any nanorc files, allow suspending, or allow a file
|
||||
Restricted mode: don't read or write to any file not specified on the
|
||||
command line; read any nanorc files; allow suspending; allow a file
|
||||
to be appended to, prepended to, or saved under a different name if it
|
||||
already has one. Also accessible by invoking \fBnano\fP with any name
|
||||
beginning with 'r' (e.g. "rnano").
|
||||
already has one; or use backup files or spell checking. Also accessible
|
||||
by invoking \fBnano\fP with any name beginning with 'r' (e.g. "rnano").
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
@@ -104,10 +109,10 @@ Set the size (width) of a tab to \fIcols\fP columns. The value of
|
||||
.TP
|
||||
.B \-U (\-\-quickblank)
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25. Note that \fB-c\fP cancels this out.
|
||||
keystroke instead of 25. Note that \fB-c\fP overrides this.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Show the current version number and author.
|
||||
Show the current version number and exit.
|
||||
.TP
|
||||
.B \-W (\-\-wordbounds)
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
@@ -118,8 +123,7 @@ Specify a specific syntax highlighting from the \fInanorc\fP to use, if
|
||||
available.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Constantly show the cursor position. Note that this cancels out
|
||||
\fB-U\fP.
|
||||
Constantly show the cursor position. Note that this overrides \fB-U\fP.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
@@ -127,7 +131,7 @@ work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Display a summary of command line options.
|
||||
Show a summary of command line options and exit.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
Indent new lines to the previous line's indentation. Useful when
|
||||
@@ -142,7 +146,10 @@ a new file instead of following it. Good for editing files in
|
||||
\fI/tmp\fP, perhaps?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Enable mouse support (if available for your system).
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
clicks can be used to place the cursor, set the mark (with a double
|
||||
click), and execute shortcuts. The mouse will work in the X Window
|
||||
System, and on the console when gpm is running.
|
||||
.TP
|
||||
.B \-o \fIdir\fP (\-\-operatingdir=\fIdir\fP)
|
||||
Set operating directory. Makes \fBnano\fP set up something similar to a
|
||||
@@ -191,14 +198,14 @@ If no alternative spell checker command is specified on the command
|
||||
line or in one of the nanorc files, \fBnano\fP will check the
|
||||
\fBSPELL\fP environment variable for one.
|
||||
|
||||
\fBnano\fP will try to dump the buffer into an emergency file in some
|
||||
cases. Mainly, this will happen if \fBnano\fP receives a SIGHUP or
|
||||
SIGTERM or runs out of memory, when it will write the buffer into a file
|
||||
In some cases \fBnano\fP will try to dump the buffer into an emergency
|
||||
file. This will happen mainly if \fBnano\fP receives a SIGHUP or
|
||||
SIGTERM or runs out of memory. It will write the buffer into a file
|
||||
named \fInano.save\fP if the buffer didn't have a name already, or will
|
||||
add a ".save" suffix to the current filename. If an emergency file with
|
||||
that name already exists in the current directory, ".save" and a number
|
||||
(e.g. ".save.1") will be suffixed to the current filename in order to
|
||||
make it unique. In multibuffer mode, \fBnano\fP will write all the open
|
||||
that name already exists in the current directory, it will add ".save"
|
||||
plus a number (e.g. ".save.1") to the current filename in order to make
|
||||
it unique. In multibuffer mode, \fBnano\fP will write all the open
|
||||
buffers to their respective emergency files.
|
||||
|
||||
.SH BUGS
|
||||
|
||||
121
doc/man/nanorc.5
121
doc/man/nanorc.5
@@ -1,18 +1,19 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nanorc.5 is Copyright (C) 2003, 2004, 2005 Free Software
|
||||
.\" Foundation, Inc.
|
||||
.\" nanorc.5 is Copyright (C) 2003, 2004, 2005, 2006 by the Free
|
||||
.\" Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\" This is free documentation, see the latest version of the GNU
|
||||
.\" General Public License for copying conditions. There is NO
|
||||
.\" warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 1.3.10" "November 21, 2005"
|
||||
.TH NANORC 5 "version 1.3.12" "May 24, 2006"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
nanorc \- GNU nano's rcfile
|
||||
.SH DESCRIPTION
|
||||
This manual page documents GNU \fBnano\fP's rcfile.
|
||||
This manual page briefly documents GNU \fBnano\fP's rcfile.
|
||||
.PP
|
||||
\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
|
||||
@@ -20,22 +21,26 @@ 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
|
||||
The \fInanorc\fP file contains the default settings for \fBnano\fP.
|
||||
During startup, \fBnano\fP will first read its system-wide settings from
|
||||
\fISYSCONFDIR/nanorc\fP, and then user-specific settings from
|
||||
\fI~/.nanorc\fP.
|
||||
The \fInanorc\fP file contains the default settings for \fBnano\fP. It
|
||||
should not be in DOS or Mac format. During startup, \fBnano\fP will
|
||||
first read its system-wide settings from \fISYSCONFDIR/nanorc\fP, and
|
||||
then user-specific settings from \fI~/.nanorc\fP.
|
||||
|
||||
.SH OPTIONS
|
||||
The configuration file accepts a series of "set" and "unset" commands,
|
||||
which can be used to configure nano on startup without using the
|
||||
command-line options. Additionally, the "syntax", "color", and "icolor"
|
||||
keywords are used to define syntax highlighting rules for different text
|
||||
patterns. GNU nano will read one command per line.
|
||||
The configuration file accepts a series of \fBset\fP and \fBunset\fP
|
||||
commands, which can be used to configure nano on startup without using
|
||||
the command line options. Additionally, the \fBsyntax\fP, \fBcolor\fP,
|
||||
and \fBicolor\fP keywords are used to define syntax highlighting rules
|
||||
for different text patterns. \fBnano\fP will read one command per line.
|
||||
|
||||
Options in rcfiles take precedence over nano's defaults, and command
|
||||
line options override rcfile settings.
|
||||
Options in nanorc files take precedence over nano's defaults, and
|
||||
command line options override nanorc settings. Also, options are unset
|
||||
by default, except for those that take arguments.
|
||||
|
||||
Options are unset by default, except for options that take an argument.
|
||||
Quotes inside string parameters don't have to be escaped with
|
||||
backslashes. The last double quote in the string will be treated as its
|
||||
end. For example, for the \fBbrackets\fP option, "\fI"')>]}\fP" will
|
||||
match \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP, and \fI}\fP.
|
||||
|
||||
The supported commands and arguments are:
|
||||
|
||||
@@ -53,10 +58,14 @@ backups are enabled.
|
||||
.B set/unset backwards
|
||||
Do backwards searches by default.
|
||||
.TP
|
||||
.B set/unset boldtext
|
||||
Use bold text instead of reverse video text.
|
||||
.TP
|
||||
.B set brackets "\fIstring\fP"
|
||||
Set the characters treated as closing brackets. They cannot contain
|
||||
blank characters. Only closing punctuation, optionally followed by
|
||||
closing brackets, can end sentences.
|
||||
Set the characters treated as closing brackets when justifying
|
||||
paragraphs. They cannot contain blank characters. Only closing
|
||||
punctuation, optionally followed by closing brackets, can end sentences.
|
||||
The default value is "\fI"')>]}\fP".
|
||||
.TP
|
||||
.B set/unset casesensitive
|
||||
Do case sensitive searches by default.
|
||||
@@ -76,12 +85,20 @@ default value is -8.
|
||||
Enable \fI~/.nano_history\fP for saving and reading search/replace
|
||||
strings.
|
||||
.TP
|
||||
.B set matchbrackets "\fIstring\fP"
|
||||
Set the opening and closing brackets that can be found by bracket
|
||||
searches. They cannot contain blank characters. The former set must
|
||||
come before the latter set, and both must be in the same order. The
|
||||
default value is "\fI(<[{)>]}\fP".
|
||||
.TP
|
||||
.B set/unset morespace
|
||||
Allow use of the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
.B set/unset mouse
|
||||
Enable mouse support, so that mouse clicks can be used to set the mark
|
||||
and run shortcuts.
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
clicks can be used to place the cursor, set the mark (with a double
|
||||
click), and execute shortcuts. The mouse will work in the X Window
|
||||
System, and on the console when gpm is running.
|
||||
.TP
|
||||
.B set/unset multibuffer
|
||||
Allow inserting files into their own buffers.
|
||||
@@ -104,16 +121,17 @@ Don't wrap text at all.
|
||||
.B set operatingdir "\fIdirectory\fP"
|
||||
\fBnano\fP will only read and write files inside \fIdirectory\fP and its
|
||||
subdirectories. Also, the current directory is changed to here, so
|
||||
files are inserted from this dir. By default the operating directory
|
||||
feature is turned off.
|
||||
files are inserted from this diractory. By default, the operating
|
||||
directory feature is turned off.
|
||||
.TP
|
||||
.B set/unset preserve
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
.TP
|
||||
.B set punct "\fIstring\fP"
|
||||
Set the characters treated as closing punctuation. They cannot contain
|
||||
blank characters. Only closing punctuation, optionally followed by
|
||||
closing brackets, can end sentences.
|
||||
Set the characters treated as closing punctuation when justifying
|
||||
paragraphs. They cannot contain blank characters. Only closing
|
||||
punctuation, optionally followed by closing brackets, can end sentences.
|
||||
The default value is "\fI!.?\fP".
|
||||
.TP
|
||||
.B set/unset quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
@@ -121,13 +139,11 @@ keystroke instead of 25.
|
||||
.TP
|
||||
.B set quotestr "\fIstring\fP"
|
||||
The email-quote string, used to justify email-quoted paragraphs. This
|
||||
is an "extended regular expression" if your system supports them,
|
||||
is an extended regular expression if your system supports them,
|
||||
otherwise a literal string. The default value is
|
||||
|
||||
set quotestr "^([\ \\t]*[|>:}#])+"
|
||||
|
||||
if you have regexps, otherwise set quotestr ">\ ". Note that '\\t'
|
||||
above stands for a literal Tab character.
|
||||
"\fI^([\ \\t]*[#:>\\|}])+\fP" if you have extended regular expression
|
||||
support, or "\fI>\ \fP" otherwise. Note that '\\t' stands for a literal
|
||||
Tab character.
|
||||
.TP
|
||||
.B set/unset rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
@@ -140,7 +156,7 @@ 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.
|
||||
Do extended regular expression searches by default.
|
||||
.TP
|
||||
.B set/unset smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
@@ -152,12 +168,12 @@ line.
|
||||
.B set/unset smooth
|
||||
Use smooth scrolling by default.
|
||||
.TP
|
||||
.B set speller \fIspellprog\fP
|
||||
.B set speller "\fIspellprog\fP"
|
||||
Use spelling checker \fIspellprog\fP instead of the built-in one, which
|
||||
calls \fIspell\fP.
|
||||
.TP
|
||||
.B set/unset suspend
|
||||
Allow nano to be suspended.
|
||||
Allow \fBnano\fP to be suspended.
|
||||
.TP
|
||||
.B set tabsize \fIn\fP
|
||||
Use a tab size of \fIn\fP columns. The value of \fIn\fP must be greater
|
||||
@@ -181,8 +197,9 @@ 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
|
||||
Defines a syntax named \fIstr\fP which can be activated via the
|
||||
-Y/--syntax command line option, or will be automatically activated if
|
||||
the current filename matches the extended regular expression
|
||||
\fIfileregex\fP. All following \fBcolor\fP and \fBicolor\fP statements
|
||||
will apply to \fIsyntax\fP until a new syntax is defined.
|
||||
|
||||
@@ -193,20 +210,22 @@ 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
|
||||
\fIregex\fP with foreground color \fIfgcolor\fP and background color
|
||||
\fIbgcolor\fP, at least one of which must be specified. Legal colors
|
||||
for foreground and background color are: white, black, red, blue, green,
|
||||
yellow, magenta, and cyan. You may use the prefix "bright" to force a
|
||||
stronger color highlight for the foreground. If your terminal supports
|
||||
transparency, not specifying a \fIbgcolor\fP tells \fBnano\fP to attempt
|
||||
to use a transparent background.
|
||||
the extended regular expression \fIregex\fP with foreground color
|
||||
\fIfgcolor\fP and background color \fIbgcolor\fP, at least one of which
|
||||
must be specified. Legal colors for foreground and background color
|
||||
are: white, black, red, blue, green, yellow, magenta, and cyan. You may
|
||||
use the prefix "bright" to force a stronger color highlight for the
|
||||
foreground. If your terminal supports transparency, not specifying a
|
||||
\fIbgcolor\fP tells \fBnano\fP to attempt to use a transparent
|
||||
background.
|
||||
.TP
|
||||
.B icolor \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
|
||||
Same as above, except that the expression matching is case insensitive.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP,\fIbgcolor\fP start="\fIsr\fP" end="\fIer\fP"
|
||||
Display expressions which start with \fIsr\fP and end with \fIer\fP
|
||||
with foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
|
||||
Display expressions which start with the extended regular expression
|
||||
\fIsr\fP and end with the extended regular expression \fIer\fP with
|
||||
foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
|
||||
at least one of which must be specified. This allows syntax
|
||||
highlighting to span multiple lines. Note that all subsequent instances
|
||||
of \fIsr\fP after an initial \fIsr\fP is found will be highlighted until
|
||||
@@ -214,7 +233,11 @@ the first instance of \fIer\fP.
|
||||
.TP
|
||||
.B icolor \fIfgcolor\fP,\fIbgcolor\fP start="\fIsr\fP" end="\fIer\fP"
|
||||
Same as above, except that the expression matching is case insensitive.
|
||||
|
||||
.TP
|
||||
.B include "\fIsyntaxfile\fP"
|
||||
Read in self-contained color syntaxes from \fIsyntaxfile\fP. Note that
|
||||
\fIsyntaxfile\fP can only contain \fBsyntax\fP, \fBcolor\fP, and
|
||||
\fBicolor\fP commands.
|
||||
.SH FILES
|
||||
.TP
|
||||
.I SYSCONFDIR/nanorc
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
.\" 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>.
|
||||
.\" rnano.1 is Copyright 2005, 2006 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.
|
||||
.\" 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"
|
||||
.TH RNANO 1 "version 1.3.12" "May 1, 2006"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -19,11 +17,11 @@ Pico clone
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B rnano
|
||||
.I [\+LINE,COLUMN]\ [options]\ [file]
|
||||
.I [OPTIONS]\ [[\+LINE[,COLUMN]]\ FILE]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
This manual page documents briefly the \fBrnano\fP command.
|
||||
This manual page briefly documents 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,
|
||||
@@ -53,14 +51,18 @@ use backup files or spell checking.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILINE\fP[,\fICOLUMN\fP]
|
||||
Places cursor at line number \fILINE\fP and column number \fICOLUMN\fP
|
||||
on startup, instead of the default of line 1, column 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Same as \fB-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Display a summary of command line options.
|
||||
Show a summary of command line options and exit.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Show the current version number and author.
|
||||
Show the current version number and exit.
|
||||
.PP
|
||||
See the \fBnano\fP(1) manpage for the complete documentation of
|
||||
\fBnano\fP.
|
||||
|
||||
@@ -1,344 +0,0 @@
|
||||
## Sample initialization file for GNU nano
|
||||
## Please note that you must have configured nano with --enable-nanorc
|
||||
## for this file to be read! Also note that characters specially
|
||||
## interpreted by the shell should not be escaped here.
|
||||
##
|
||||
## To make sure a value is not enabled, use "unset <option>"
|
||||
##
|
||||
## For the options that take parameters, the default value is given.
|
||||
## Other options are unset by default.
|
||||
|
||||
## Use auto-indentation.
|
||||
# set autoindent
|
||||
|
||||
## Backup files to filename~.
|
||||
# set backup
|
||||
|
||||
## The directory to put unique backup files in.
|
||||
# set backupdir ""
|
||||
|
||||
## Do backwards searches by default.
|
||||
# set backwards
|
||||
|
||||
## The characters treated as closing brackets. They cannot contain
|
||||
## blank characters. Only closing punctuation, optionally followed by
|
||||
## closing brackets, can end sentences.
|
||||
##
|
||||
# set brackets "'")}]>"
|
||||
|
||||
## Do case sensitive searches by default.
|
||||
# set casesensitive
|
||||
|
||||
## Constantly display the cursor position in the statusbar. Note that
|
||||
## this cancels out "quickblank".
|
||||
# set const
|
||||
|
||||
## Use cut to end of line by default.
|
||||
# set cut
|
||||
|
||||
## Set the line length for wrapping text and justifying paragraphs.
|
||||
## If fill is 0 or less, the line length will be the screen width less
|
||||
## this number.
|
||||
##
|
||||
# set fill -8
|
||||
|
||||
## Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
# set historylog
|
||||
|
||||
## Use the blank line below the titlebar as extra editing space.
|
||||
# set morespace
|
||||
|
||||
## Enable mouse support, so that mouse clicks can be used to set the
|
||||
## mark and run shortcuts.
|
||||
# set mouse
|
||||
|
||||
## Allow multiple file buffers (inserting a file will put it into a
|
||||
## separate buffer). You must have configured with --enable-multibuffer
|
||||
## for this to work.
|
||||
##
|
||||
# set multibuffer
|
||||
|
||||
## Don't convert files from DOS/Mac format.
|
||||
# set noconvert
|
||||
|
||||
## Don't follow symlinks when writing files.
|
||||
# set nofollow
|
||||
|
||||
## Don't display the helpful shortcut lists at the bottom of the screen.
|
||||
# set nohelp
|
||||
|
||||
## Don't add newlines to the ends of files.
|
||||
# set nonewlines
|
||||
|
||||
## Don't wrap text at all.
|
||||
# set nowrap
|
||||
|
||||
## Set operating directory. nano will not read or write files outside
|
||||
## this directory and its subdirectories. Also, the current directory
|
||||
## is changed to here, so files are inserted from this dir. A blank
|
||||
## string means the operating directory feature is turned off.
|
||||
##
|
||||
# set operatingdir ""
|
||||
|
||||
## Preserve the XON and XOFF keys (^Q and ^S).
|
||||
# set preserve
|
||||
|
||||
## The characters treated as closing punctuation. They cannot contain
|
||||
## blank characters. Only closing punctuation, optionally followed by
|
||||
## closing brackets, can end sentences.
|
||||
##
|
||||
# set punct ".?!"
|
||||
|
||||
## Do quick statusbar blanking. Statusbar messages will disappear after
|
||||
## 1 keystroke instead of 25. Note that "const" cancels this out.
|
||||
##
|
||||
# set quickblank
|
||||
|
||||
## The email-quote string, used to justify email-quoted paragraphs.
|
||||
## This is an extended regular expression if your system supports them,
|
||||
## otherwise a literal string. Default:
|
||||
# set quotestr "^([ ]*[\|>:}#])+"
|
||||
## if you have regexps, otherwise:
|
||||
# set quotestr "> "
|
||||
## You can get old nano quoted-justify behavior via:
|
||||
# set quotestr "(> )+"
|
||||
|
||||
## Fix Backspace/Delete confusion problem.
|
||||
# set rebinddelete
|
||||
|
||||
## Fix numeric keypad key confusion problem.
|
||||
# set rebindkeypad
|
||||
|
||||
## Do extended regular expression searches by default.
|
||||
# set regexp
|
||||
|
||||
## Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
## very beginning of non-whitespace characters on a line, the cursor
|
||||
## will jump to that beginning (either forwards or backwards). If the
|
||||
## cursor is already at that position, it will jump to the true
|
||||
## beginning of the line.
|
||||
# set smarthome
|
||||
|
||||
## Use smooth scrolling as the default.
|
||||
# set smooth
|
||||
|
||||
## Use this spelling checker instead of the internal one. This option
|
||||
## does not properly have a default value.
|
||||
##
|
||||
# set speller "aspell -x -c"
|
||||
|
||||
## Allow nano to be suspended.
|
||||
# set suspend
|
||||
|
||||
## Use this tab size instead of the default; it must be greater than 0.
|
||||
# set tabsize 8
|
||||
|
||||
## Convert typed tabs to spaces.
|
||||
# set tabstospaces
|
||||
|
||||
## Save automatically on exit, don't prompt.
|
||||
# set tempfile
|
||||
|
||||
## Disallow file modification; why would you want this in an rcfile? ;)
|
||||
# set view
|
||||
|
||||
## The two single-column characters used to display the first characters
|
||||
## of tabs and spaces. 187 decimal (00BB hexadecimal) and 183 decimal
|
||||
## (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.)
|
||||
##
|
||||
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
|
||||
## You may use the prefix "bright" to mean a stronger color highlight
|
||||
## for the foreground.
|
||||
##
|
||||
## To use multi-line regexes, use the start="regex" end="regex" format.
|
||||
##
|
||||
## If your system supports transparency, not specifying a background
|
||||
## color will use a transparent color. If you don't want this, be sure
|
||||
## to set the background color to black or white.
|
||||
##
|
||||
# syntax "c-file" "\.(c|C|cc|cpp|cxx|h|H|hh|hpp|hxx)$"
|
||||
# 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)\>"
|
||||
# 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]?'"
|
||||
##
|
||||
## GCC builtins
|
||||
##
|
||||
# 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
|
||||
## are read in.
|
||||
##
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
##
|
||||
## This string is VERY resource intensive!
|
||||
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
|
||||
##
|
||||
## And we want to have some nice comment highlighting too
|
||||
# color brightblue "//.*"
|
||||
# color brightblue start="/\*" end="\*/"
|
||||
|
||||
## Here is a short example for HTML
|
||||
# syntax "HTML" "\.html$"
|
||||
# color blue start="<" end=">"
|
||||
# color red "&[^;[[:space:]]]*;"
|
||||
|
||||
## Here is a short example for TeX files
|
||||
# syntax "TeX" "\.tex$"
|
||||
# icolor green "\\.|\\[A-Z]*"
|
||||
# color magenta "[{}]"
|
||||
# color blue "%.*"
|
||||
|
||||
## Here is an example for quoted emails (under e.g. mutt)
|
||||
# syntax "mutt"
|
||||
# color green "^>.*"
|
||||
|
||||
## Here is an example for groff
|
||||
##
|
||||
# syntax "groff" "\.m[ems]$" "\.tmac$" "^tmac." ".rof"
|
||||
## The argument of .nr or .ds
|
||||
# color cyan "^\.ds [^[[:space:]]]*"
|
||||
# color cyan "^\.nr [^[[:space:]]]*"
|
||||
## Single character escapes
|
||||
# color brightmagenta "\\."
|
||||
## Highlight the argument of \f or \s in the same color
|
||||
# color brightmagenta "\\f."
|
||||
# color brightmagenta "\\f\(.."
|
||||
# color brightmagenta "\\s(\+|\-)?[0-9]"
|
||||
## \n
|
||||
# color cyan "(\\|\\\\)n."
|
||||
# color cyan "(\\|\\\\)n\(.."
|
||||
# color cyan start="(\\|\\\\)n\[" end="]"
|
||||
## Requests
|
||||
# color brightgreen "^\.[[:space:]]*[^[[:space:]]]*"
|
||||
## Comments
|
||||
# color yellow "^\.\\\".*$"
|
||||
## Strings
|
||||
# color green "(\\|\\\\)\*."
|
||||
# color green "(\\|\\\\)\*\(.."
|
||||
# color green start="(\\|\\\\)\*\[" end="]"
|
||||
## Characters
|
||||
# color brightred "\\\(.."
|
||||
# color brightred start="\\\[" end="]"
|
||||
## Macro arguments
|
||||
# color brightcyan "\\\\\$[1-9]"
|
||||
|
||||
## Here is an example for perl
|
||||
##
|
||||
# syntax "perl" "\.p[lm]$"
|
||||
# color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
# color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
|
||||
# color cyan start="[$@%]" end="( |\\W|-)"
|
||||
# color yellow "".*"|qq\|.*\|"
|
||||
# color white "[sm]/.*/"
|
||||
# color white start="(^use| = new)" end=";"
|
||||
# color green "#.*"
|
||||
# color yellow start="<< 'STOP'" end="STOP"
|
||||
|
||||
## Here is an example for Java source
|
||||
##
|
||||
# syntax "Java source" "\.java$"
|
||||
# color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
|
||||
# color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
|
||||
# color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
|
||||
# color red ""[^\"]*""
|
||||
# color yellow "\<(true|false|null)\>"
|
||||
# color blue "//.*"
|
||||
# color blue start="/\*" end="\*/"
|
||||
# color brightblue start="/\*\*" end="\*/"
|
||||
# color brightgreen,green "[[:space:]]+$"
|
||||
|
||||
## Here is an example for patch files
|
||||
##
|
||||
# syntax "patch" "\.(patch|diff)$"
|
||||
# color brightgreen "^\+.*"
|
||||
# color green "^\+\+\+.*"
|
||||
# color brightblue "^ .*"
|
||||
# color brightred "^-.*"
|
||||
# color red "^---.*"
|
||||
# color brightyellow "^@@.*"
|
||||
# color magenta "^diff.*"
|
||||
|
||||
## Here is an example for manpages
|
||||
##
|
||||
# syntax "manpage" "\.[1-9]x?$"
|
||||
# color green "\.(S|T)H.*$"
|
||||
# color brightgreen "\.(S|T)H" "\.TP"
|
||||
# color brightred "\.(BR?|I[PR]?).*$"
|
||||
# color brightblue "\.(BR?|I[PR]?|PP)"
|
||||
# color brightwhite "\\f[BIPR]"
|
||||
# color yellow "\.(br|DS|RS|RE|PD)"
|
||||
|
||||
## Here is an example for assembler
|
||||
##
|
||||
# syntax "asm-file" "\.(S|s|asm)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# color brightgreen "\.(data|subsection|text)"
|
||||
# color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
|
||||
# color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
|
||||
# icolor brightred "^[[:space:]]*[._A-Z0-9]*:"
|
||||
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
## Highlight strings (note: VERY resource intensive)
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
|
||||
## Highlight comments
|
||||
# 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|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))?\>"
|
||||
# icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
|
||||
## strings
|
||||
# icolor white "\"(\\.|[^\"])*\""
|
||||
## comments
|
||||
# icolor blue "^[[:space:]]*#.*$"
|
||||
257
doc/nanorc.sample.in
Normal file
257
doc/nanorc.sample.in
Normal file
@@ -0,0 +1,257 @@
|
||||
## Sample initialization file for GNU nano.
|
||||
##
|
||||
## Please note that you must have configured nano with --enable-nanorc
|
||||
## for this file to be read! Also note that this file should not be in
|
||||
## DOS or Mac format, and that characters specially interpreted by the
|
||||
## shell should not be escaped here.
|
||||
##
|
||||
## To make sure a value is disabled, use "unset <option>".
|
||||
##
|
||||
## For the options that take parameters, the default value is given.
|
||||
## Other options are unset by default.
|
||||
##
|
||||
## Quotes inside string parameters don't have to be escaped with
|
||||
## backslashes. The last double quote in the string will be treated as
|
||||
## its end. For example, for the "brackets" option, ""')>]}" will match
|
||||
## ", ', ), >, ], and }.
|
||||
|
||||
## Use auto-indentation.
|
||||
# set autoindent
|
||||
|
||||
## Backup files to filename~.
|
||||
# set backup
|
||||
|
||||
## The directory to put unique backup files in.
|
||||
# set backupdir ""
|
||||
|
||||
## Do backwards searches by default.
|
||||
# set backwards
|
||||
|
||||
## Use bold text instead of reverse video text.
|
||||
# set boldtext
|
||||
|
||||
## The characters treated as closing brackets when justifying
|
||||
## paragraphs. They cannot contain blank characters. Only closing
|
||||
## punctuation, optionally followed by closing brackets, can end
|
||||
## sentences.
|
||||
##
|
||||
# set brackets ""')>]}"
|
||||
|
||||
## Do case sensitive searches by default.
|
||||
# set casesensitive
|
||||
|
||||
## Constantly display the cursor position in the statusbar. Note that
|
||||
## this overrides "quickblank".
|
||||
# set const
|
||||
|
||||
## Use cut to end of line by default.
|
||||
# set cut
|
||||
|
||||
## Set the line length for wrapping text and justifying paragraphs.
|
||||
## If fill is 0 or less, the line length will be the screen width less
|
||||
## this number.
|
||||
##
|
||||
# set fill -8
|
||||
|
||||
## Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
# set historylog
|
||||
|
||||
## The opening and closing brackets that can be found by bracket
|
||||
## searches. They cannot contain blank characters. The former set must
|
||||
## come before the latter set, and both must be in the same order.
|
||||
##
|
||||
# set matchbrackets "(<[{)>]}"
|
||||
|
||||
## Use the blank line below the titlebar as extra editing space.
|
||||
# set morespace
|
||||
|
||||
## Enable mouse support, if available for your system. When enabled,
|
||||
## mouse clicks can be used to place the cursor, set the mark (with a
|
||||
## double click), and execute shortcuts. The mouse will work in the X
|
||||
## Window System, and on the console when gpm is running.
|
||||
##
|
||||
# set mouse
|
||||
|
||||
## Allow multiple file buffers (inserting a file will put it into a
|
||||
## separate buffer). You must have configured with --enable-multibuffer
|
||||
## for this to work.
|
||||
##
|
||||
# set multibuffer
|
||||
|
||||
## Don't convert files from DOS/Mac format.
|
||||
# set noconvert
|
||||
|
||||
## Don't follow symlinks when writing files.
|
||||
# set nofollow
|
||||
|
||||
## Don't display the helpful shortcut lists at the bottom of the screen.
|
||||
# set nohelp
|
||||
|
||||
## Don't add newlines to the ends of files.
|
||||
# set nonewlines
|
||||
|
||||
## Don't wrap text at all.
|
||||
# set nowrap
|
||||
|
||||
## Set operating directory. nano will not read or write files outside
|
||||
## this directory and its subdirectories. Also, the current directory
|
||||
## is changed to here, so any files are inserted from this dir. A blank
|
||||
## string means the operating directory feature is turned off.
|
||||
##
|
||||
# set operatingdir ""
|
||||
|
||||
## Preserve the XON and XOFF keys (^Q and ^S).
|
||||
# set preserve
|
||||
|
||||
## The characters treated as closing punctuation when justifying
|
||||
## paragraphs. They cannot contain blank characters. Only closing
|
||||
## punctuation, optionally followed by closing brackets, can end
|
||||
## sentences.
|
||||
##
|
||||
# set punct "!.?"
|
||||
|
||||
## Do quick statusbar blanking. Statusbar messages will disappear after
|
||||
## 1 keystroke instead of 26. Note that "const" overrides this.
|
||||
##
|
||||
# set quickblank
|
||||
|
||||
## The email-quote string, used to justify email-quoted paragraphs.
|
||||
## This is an extended regular expression if your system supports them,
|
||||
## otherwise a literal string. Default:
|
||||
# set quotestr "^([ ]*[#:>\|}])+"
|
||||
## if you have extended regular expression support, otherwise:
|
||||
# set quotestr "> "
|
||||
|
||||
## Fix Backspace/Delete confusion problem.
|
||||
# set rebinddelete
|
||||
|
||||
## Fix numeric keypad key confusion problem.
|
||||
# set rebindkeypad
|
||||
|
||||
## Do extended regular expression searches by default.
|
||||
# set regexp
|
||||
|
||||
## Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
## very beginning of non-whitespace characters on a line, the cursor
|
||||
## will jump to that beginning (either forwards or backwards). If the
|
||||
## cursor is already at that position, it will jump to the true
|
||||
## beginning of the line.
|
||||
# set smarthome
|
||||
|
||||
## Use smooth scrolling as the default.
|
||||
# set smooth
|
||||
|
||||
## Use this spelling checker instead of the internal one. This option
|
||||
## does not properly have a default value.
|
||||
##
|
||||
# set speller "aspell -x -c"
|
||||
|
||||
## Allow nano to be suspended.
|
||||
# set suspend
|
||||
|
||||
## Use this tab size instead of the default; it must be greater than 0.
|
||||
# set tabsize 8
|
||||
|
||||
## Convert typed tabs to spaces.
|
||||
# set tabstospaces
|
||||
|
||||
## Save automatically on exit, don't prompt.
|
||||
# set tempfile
|
||||
|
||||
## Disallow file modification; why would you want this in an rcfile? ;)
|
||||
# set view
|
||||
|
||||
## The two single-column characters used to display the first characters
|
||||
## of tabs and spaces. 187 in ISO 8859-1 (0000BB in Unicode) and 183 in
|
||||
## ISO-8859-1 (0000B7 in Unicode) 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.
|
||||
##
|
||||
## Valid colors: white, black, red, blue, green, yellow, magenta, cyan.
|
||||
## For foreground colors, you may use the prefix "bright" to get a
|
||||
## stronger highlight.
|
||||
##
|
||||
## To use multi-line regexes, use the start="regex" end="regex"
|
||||
## [start="regex" end="regex"...] format.
|
||||
##
|
||||
## If your system supports transparency, not specifying a background
|
||||
## color will use a transparent color. If you don't want this, be sure
|
||||
## to set the background color to black or white.
|
||||
##
|
||||
## If you wish, you may put your syntaxes in separate files. You can
|
||||
## make use of such files (which can only include "syntax", "color", and
|
||||
## "icolor" commands) as follows:
|
||||
##
|
||||
## include "/path/to/syntax_file.nanorc"
|
||||
##
|
||||
## Unless otherwise noted, the name of the syntax file (without the
|
||||
## ".nanorc" extension) should be the same as the "short description"
|
||||
## name inside that file. These names are kept fairly short to make
|
||||
## them easier to remember and faster to type using nano's -Y option.
|
||||
##
|
||||
## All regexes should be extended regular expressions.
|
||||
|
||||
|
||||
## Nanorc files
|
||||
# include "@PKGDATADIR@/nanorc.nanorc"
|
||||
|
||||
## C/C++
|
||||
# include "@PKGDATADIR@/c.nanorc"
|
||||
|
||||
## HTML
|
||||
# include "@PKGDATADIR@/html.nanorc"
|
||||
|
||||
## TeX
|
||||
# include "@PKGDATADIR@/tex.nanorc"
|
||||
|
||||
## Quoted emails (under e.g. mutt)
|
||||
# include "@PKGDATADIR@/mutt.nanorc"
|
||||
|
||||
## Patch files
|
||||
# include "@PKGDATADIR@/patch.nanorc"
|
||||
|
||||
## Manpages
|
||||
# include "@PKGDATADIR@/man.nanorc"
|
||||
|
||||
## Groff
|
||||
# include "@PKGDATADIR@/groff.nanorc"
|
||||
|
||||
## Perl
|
||||
# include "@PKGDATADIR@/perl.nanorc"
|
||||
|
||||
## Python
|
||||
# include "@PKGDATADIR@/python.nanorc"
|
||||
|
||||
## Ruby
|
||||
# include "@PKGDATADIR@/ruby.nanorc"
|
||||
|
||||
## Java
|
||||
# include "@PKGDATADIR@/java.nanorc"
|
||||
|
||||
## Assembler
|
||||
# include "@PKGDATADIR@/asm.nanorc"
|
||||
|
||||
## Bourne shell scripts
|
||||
# include "@PKGDATADIR@/sh.nanorc"
|
||||
2
doc/syntax/.cvsignore
Normal file
2
doc/syntax/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
16
doc/syntax/Makefile.am
Normal file
16
doc/syntax/Makefile.am
Normal file
@@ -0,0 +1,16 @@
|
||||
pkgdata_DATA = asm.nanorc \
|
||||
c.nanorc \
|
||||
groff.nanorc \
|
||||
html.nanorc \
|
||||
java.nanorc \
|
||||
man.nanorc \
|
||||
mutt.nanorc \
|
||||
nanorc.nanorc \
|
||||
patch.nanorc \
|
||||
perl.nanorc \
|
||||
python.nanorc \
|
||||
ruby.nanorc \
|
||||
sh.nanorc \
|
||||
tex.nanorc
|
||||
|
||||
EXTRA_DIST = $(pkgdata_DATA)
|
||||
15
doc/syntax/asm.nanorc
Normal file
15
doc/syntax/asm.nanorc
Normal file
@@ -0,0 +1,15 @@
|
||||
## Here is an example for assembler.
|
||||
##
|
||||
syntax "asm" "\.(S|s|asm)$"
|
||||
color red "\<[A-Z_]{2,}\>"
|
||||
color brightgreen "\.(data|subsection|text)"
|
||||
color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
|
||||
color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
|
||||
icolor brightred "^[[:space:]]*[.0-9A-Z_]*:"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
## Highlight strings (note: VERY resource intensive)
|
||||
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
|
||||
color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
|
||||
## Highlight comments
|
||||
color brightblue "//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
27
doc/syntax/c.nanorc
Normal file
27
doc/syntax/c.nanorc
Normal file
@@ -0,0 +1,27 @@
|
||||
## Here is an example for C/C++.
|
||||
##
|
||||
syntax "c" "\.(c|C|cc|cpp|cxx|h|H|hh|hpp|hxx)$"
|
||||
color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
||||
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)\>"
|
||||
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-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
|
||||
##
|
||||
## GCC builtins
|
||||
color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||
##
|
||||
## String highlighting. You will in general want your comments and
|
||||
## strings to come last, because syntax highlighting rules will be
|
||||
## applied in the order they are read in.
|
||||
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
|
||||
##
|
||||
## This string is VERY resource intensive!
|
||||
color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
|
||||
|
||||
## Comment highlighting
|
||||
color brightblue "//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
24
doc/syntax/groff.nanorc
Normal file
24
doc/syntax/groff.nanorc
Normal file
@@ -0,0 +1,24 @@
|
||||
## Here is an example for groff.
|
||||
##
|
||||
syntax "groff" "\.m[ems]$" "\.rof" "\.tmac$" "^tmac."
|
||||
## The argument of .ds or .nr
|
||||
color cyan "^\.(ds|nr) [^[[:space:]]]*"
|
||||
## Single character escapes
|
||||
color brightmagenta "\\."
|
||||
## Highlight the argument of \f or \s in the same color
|
||||
color brightmagenta "\\f." "\\f\(.." "\\s(\+|\-)?[0-9]"
|
||||
## Newlines
|
||||
color cyan "(\\|\\\\)n(.|\(..)"
|
||||
color cyan start="(\\|\\\\)n\[" end="]"
|
||||
## Requests
|
||||
color brightgreen "^\.[[:space:]]*[^[[:space:]]]*"
|
||||
## Comments
|
||||
color yellow "^\.\\".*$"
|
||||
## Strings
|
||||
color green "(\\|\\\\)\*(.|\(..)"
|
||||
color green start="(\\|\\\\)\*\[" end="]"
|
||||
## Characters
|
||||
color brightred "\\\(.."
|
||||
color brightred start="\\\[" end="]"
|
||||
## Macro arguments
|
||||
color brightcyan "\\\\\$[1-9]"
|
||||
5
doc/syntax/html.nanorc
Normal file
5
doc/syntax/html.nanorc
Normal file
@@ -0,0 +1,5 @@
|
||||
## Here is a short example for HTML.
|
||||
##
|
||||
syntax "html" "\.html$"
|
||||
color blue start="<" end=">"
|
||||
color red "&[^;[[:space:]]]*;"
|
||||
12
doc/syntax/java.nanorc
Normal file
12
doc/syntax/java.nanorc
Normal file
@@ -0,0 +1,12 @@
|
||||
## Here is an example for Java.
|
||||
##
|
||||
syntax "java" "\.java$"
|
||||
color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
|
||||
color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
|
||||
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
|
||||
color red ""[^"]*""
|
||||
color yellow "\<(true|false|null)\>"
|
||||
color blue "//.*"
|
||||
color blue start="/\*" end="\*/"
|
||||
color brightblue start="/\*\*" end="\*/"
|
||||
color ,green "[[:space:]]+$"
|
||||
9
doc/syntax/man.nanorc
Normal file
9
doc/syntax/man.nanorc
Normal file
@@ -0,0 +1,9 @@
|
||||
## Here is an example for manpages.
|
||||
##
|
||||
syntax "man" "\.[1-9]x?$"
|
||||
color green "\.(S|T)H.*$"
|
||||
color brightgreen "\.(S|T)H" "\.TP"
|
||||
color brightred "\.(BR?|I[PR]?).*$"
|
||||
color brightblue "\.(BR?|I[PR]?|PP)"
|
||||
color brightwhite "\\f[BIPR]"
|
||||
color yellow "\.(br|DS|RS|RE|PD)"
|
||||
4
doc/syntax/mutt.nanorc
Normal file
4
doc/syntax/mutt.nanorc
Normal file
@@ -0,0 +1,4 @@
|
||||
## Here is an example for quoted emails (under e.g. mutt).
|
||||
##
|
||||
syntax "mutt"
|
||||
color green "^>.*"
|
||||
16
doc/syntax/nanorc.nanorc
Normal file
16
doc/syntax/nanorc.nanorc
Normal file
@@ -0,0 +1,16 @@
|
||||
## Here is an example for nanorc files.
|
||||
##
|
||||
syntax "nanorc" "\.?nanorc$"
|
||||
## Possible errors and parameters
|
||||
icolor brightwhite "^[[:space:]]*((un)?set|include|syntax|i?color).*$"
|
||||
## Keywords
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
|
||||
icolor green "^[[:space:]]*(set|unset|include|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))?\>"
|
||||
icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
|
||||
## Strings
|
||||
icolor white ""(\\.|[^"])*""
|
||||
## Comments
|
||||
icolor brightblue "^[[:space:]]*#.*$"
|
||||
icolor cyan "^[[:space:]]*##.*$"
|
||||
10
doc/syntax/patch.nanorc
Normal file
10
doc/syntax/patch.nanorc
Normal file
@@ -0,0 +1,10 @@
|
||||
## Here is an example for patch files.
|
||||
##
|
||||
syntax "patch" "\.(patch|diff)$"
|
||||
color brightgreen "^\+.*"
|
||||
color green "^\+\+\+.*"
|
||||
color brightblue "^ .*"
|
||||
color brightred "^-.*"
|
||||
color red "^---.*"
|
||||
color brightyellow "^@@.*"
|
||||
color magenta "^diff.*"
|
||||
11
doc/syntax/perl.nanorc
Normal file
11
doc/syntax/perl.nanorc
Normal file
@@ -0,0 +1,11 @@
|
||||
## Here is an example for Perl.
|
||||
##
|
||||
syntax "perl" "\.p[lm]$"
|
||||
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
|
||||
icolor cyan start="[$@%]" end="( |[^0-9A-Z_]|-)"
|
||||
color yellow "".*"|qq\|.*\|"
|
||||
color white "[sm]/.*/"
|
||||
color white start="(^use| = new)" end=";"
|
||||
color green "#.*"
|
||||
color yellow start="<< 'STOP'" end="STOP"
|
||||
8
doc/syntax/python.nanorc
Normal file
8
doc/syntax/python.nanorc
Normal file
@@ -0,0 +1,8 @@
|
||||
## Here is an example for Python.
|
||||
##
|
||||
syntax "python" "\.py$"
|
||||
icolor brightblue "def [0-9A-Z_]+"
|
||||
color brightcyan "\<(and|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|while)\>"
|
||||
color brightgreen "["'].*[^\\]["']" "["']{3}.*[^\\]["']{3}"
|
||||
color brightgreen start=""""[^"]" end=""""" start="'''[^']" end="'''"
|
||||
color brightred "#.*$"
|
||||
29
doc/syntax/ruby.nanorc
Normal file
29
doc/syntax/ruby.nanorc
Normal file
@@ -0,0 +1,29 @@
|
||||
## Here is an example for Ruby.
|
||||
syntax "ruby" "\.rb$"
|
||||
## Asciibetical list of reserved words
|
||||
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
|
||||
## Constants
|
||||
color brightblue "(\$|@|@@)?[A-Z]+[0-9A-Z_a-z]*"
|
||||
## Ruby "symbols"
|
||||
icolor magenta "([ ]|^):[0-9A-Z_]+\>"
|
||||
## Some unique things we want to stand out
|
||||
color brightyellow "\<(__FILE__|__LINE__)\>"
|
||||
## Regular expressions
|
||||
color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
|
||||
## Shell command expansion is in `backticks` or like %x{this}. These are
|
||||
## "double-quotish" (to use a perlism).
|
||||
color brightblue "`[^`]*`" "%x\{[^}]*\}"
|
||||
## Strings, double-quoted
|
||||
color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
|
||||
## Expression substitution. These go inside double-quoted strings,
|
||||
## "like #{this}".
|
||||
color brightgreen "#\{[^}]*\}"
|
||||
## Strings, single-quoted
|
||||
color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
|
||||
## Comments
|
||||
color cyan "#[^{].*$" "#$"
|
||||
color brightcyan "##[^{].*$" "##$"
|
||||
## "Here" docs
|
||||
color green start="<<-?'?EOT'?" end="^EOT"
|
||||
## Some common markers
|
||||
color brightcyan "(XXX|TODO|FIXME|\?\?\?)"
|
||||
12
doc/syntax/sh.nanorc
Normal file
12
doc/syntax/sh.nanorc
Normal file
@@ -0,0 +1,12 @@
|
||||
## Here is an example for Bourne shell scripts.
|
||||
##
|
||||
syntax "sh" "\.sh$"
|
||||
icolor brightgreen "^[0-9A-Z_]+\(\)"
|
||||
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 "-[Ldefgruwx]\>"
|
||||
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 "\$\{?[0-9A-Z_!@#$*?-]+\}?"
|
||||
color cyan "(^|[[:space:]])#.*$"
|
||||
color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
|
||||
6
doc/syntax/tex.nanorc
Normal file
6
doc/syntax/tex.nanorc
Normal file
@@ -0,0 +1,6 @@
|
||||
## Here is a short example for TeX files.
|
||||
##
|
||||
syntax "tex" "\.tex$"
|
||||
icolor green "\\.|\\[A-Z]*"
|
||||
color magenta "[{}]"
|
||||
color blue "%.*"
|
||||
@@ -1,4 +1,5 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
nano.info
|
||||
nano.html
|
||||
texinfo.tex
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
@c %**end of header
|
||||
|
||||
@c This file has the new style title page commands.
|
||||
@c Run `makeinfo' rather than `texinfo-format-buffer'.
|
||||
@c Run 'makeinfo' rather than 'texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.3.10
|
||||
@set UPDATED 28 Nov 2005
|
||||
@set VERSION 1.3.12
|
||||
@set UPDATED 20 Jun 2006
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.3.10
|
||||
@subtitle version 1.3.12
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -33,28 +33,11 @@ editor.
|
||||
|
||||
This manual is part of the GNU @code{nano} distribution.@*
|
||||
@sp4
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Chris Allegretta.
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by Chris
|
||||
Allegretta.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
@iftex
|
||||
Permission is granted to process this file through @TeX{} and print the
|
||||
results, provided the printed document carries copying permission notice
|
||||
identical to this one except for the removal of this paragraph (this
|
||||
paragraph not being relevant to the printed manual).
|
||||
@end iftex
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation
|
||||
approved by the Foundation.
|
||||
This is free documentation, see the latest version of the GNU General
|
||||
Public License for copying conditions. There is NO warranty.
|
||||
|
||||
You may contact the author by
|
||||
e-mail: @email{chrisa@@asty.org}@*
|
||||
@@ -70,6 +53,7 @@ editor.
|
||||
* Editor Basics::
|
||||
* Online Help::
|
||||
* Feature Toggles::
|
||||
* Nanorc Files::
|
||||
* The File Browser::
|
||||
* Pico Compatibility::
|
||||
* Building and Configure Options::
|
||||
@@ -80,8 +64,8 @@ editor.
|
||||
|
||||
GNU @code{nano} is a small and friendly text editor. Besides basic text
|
||||
editing, @code{nano} offers many extra features like an interactive
|
||||
search and replace, goto line number, auto-indentation, feature toggles,
|
||||
internationalization support, and filename tab completion.
|
||||
search and replace, go to line number, auto-indentation, feature
|
||||
toggles, internationalization support, and filename tab completion.
|
||||
|
||||
@menu
|
||||
* Overview::
|
||||
@@ -91,12 +75,27 @@ internationalization support, and filename tab completion.
|
||||
@node Overview, Command Line Options, Introduction, Introduction
|
||||
@section Overview
|
||||
|
||||
@code{nano} +LINE,COLUMN [GNU long option] [option] [ @var{file ...} ]
|
||||
|
||||
The original goal for @code{nano} was a complete bug-for-bug compatible
|
||||
emulation of Pico, but @code{nano}'s main goal is to be as compatible as
|
||||
possible while offering a superset of Pico's functionality. Also see
|
||||
@xref{Pico Compatibility}, for other differences.
|
||||
emulation of Pico, but @code{nano}'s current goal is to be as compatible
|
||||
as possible while offering a superset of Pico's functionality. See
|
||||
@xref{Pico Compatibility}, for more info.
|
||||
|
||||
The usual way to invoke @code{nano} is:
|
||||
|
||||
@quotation
|
||||
@code{nano [OPTION]@dots{} [FILE]}
|
||||
@end quotation
|
||||
|
||||
But it is also possible to edit several files in a row. Additionally,
|
||||
the cursor can be put on a desired line number by adding this number
|
||||
with a plus sign before any filename, and even in a desired column by
|
||||
adding it with a comma. So the complete synopsis is:
|
||||
|
||||
@quotation
|
||||
@code{nano [OPTION]@dots{} [[+LINE] FILE]@dots{}}
|
||||
|
||||
@code{nano [OPTION]@dots{} [[+LINE,COLUMN] FILE]@dots{}}
|
||||
@end quotation
|
||||
|
||||
Email bug reports to @email{nano@@nano-editor.org}.
|
||||
|
||||
@@ -106,7 +105,7 @@ Email bug reports to @email{nano@@nano-editor.org}.
|
||||
@code{nano} takes the following options from the command line:
|
||||
|
||||
@table @code
|
||||
@item +LINE,COLUMN
|
||||
@item +LINE[,COLUMN]
|
||||
Start at line number LINE and column number COLUMN instead of the
|
||||
default of line 1, column 1.
|
||||
|
||||
@@ -124,16 +123,23 @@ line.
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
|
||||
@item -C, --backupdir=[dir]
|
||||
@item -C <dir>, --backupdir=<dir>
|
||||
Set the directory where @code{nano} puts unique backup files if file
|
||||
backups are enabled.
|
||||
|
||||
@item -D, --boldtext
|
||||
Use bold text instead of reverse video text.
|
||||
|
||||
@item -E, --tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
|
||||
@item -F, --multibuffer
|
||||
Enable multiple file buffers, if available.
|
||||
|
||||
@item -H, --historylog
|
||||
Log search and replace strings to ~/.nano_history, so they can be
|
||||
retrieved in later sessions, if nanorc support is available.
|
||||
|
||||
@item -I, --ignorercfiles
|
||||
Don't look at SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
|
||||
available.
|
||||
@@ -149,48 +155,49 @@ Don't add newlines to the ends of files.
|
||||
@item -N, --noconvert
|
||||
Don't convert files from DOS/Mac format.
|
||||
|
||||
@item -Q [str], --quotestr [str]
|
||||
Set the quoting string for justifying. The default is
|
||||
@item -Q <str>, --quotestr=<str>
|
||||
Set the quoting string for justifying. The default value is
|
||||
|
||||
@quotation
|
||||
@code{^([ \t]*[|>:@}#])+}
|
||||
@end quotation
|
||||
|
||||
if regular expression support is available, or ``> '' otherwise. Note
|
||||
that @code{\t} above stands for a literal Tab character.
|
||||
if extended regular expression support is available, or "> " otherwise.
|
||||
Note that @code{\t} above stands for a literal Tab character.
|
||||
|
||||
@item -R, --restricted
|
||||
Restricted mode: Don't read or write to any file not specified on the
|
||||
command line, read any nanorc files, allow suspending, or allow a file
|
||||
to be appended to, prepended to, or saved under a different name if it
|
||||
already has one. Also accessible by invoking @code{nano} with any name
|
||||
beginning with 'r' (e.g. "rnano").
|
||||
Restricted mode: don't read or write to any file not specified on the
|
||||
command line; read any nanorc files; allow suspending; allow a file to
|
||||
be appended to, prepended to, or saved under a different name if it
|
||||
already has one; or use backup files or spell checking. Also accessible
|
||||
by invoking @code{nano} with any name beginning with 'r' (e.g. "rnano").
|
||||
|
||||
@item -S, --smooth
|
||||
Enable smooth scrolling.
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
|
||||
@item -T [num], --tabsize=[#cols]
|
||||
@item -T <#cols>, --tabsize=<#cols>
|
||||
Set the displayed tab length to #cols columns. The value of #cols must
|
||||
be greater than 0. The default value is 8.
|
||||
|
||||
@item -U, --quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25. Note that -c cancels this out.
|
||||
keystroke instead of 25. Note that -c overrides this.
|
||||
|
||||
@item -V, --version
|
||||
Print the version number and copyright and quit.
|
||||
Show the current version number and exit.
|
||||
|
||||
@item -W, --wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
|
||||
@item -Y, --syntax=[str]
|
||||
@item -Y <str>, --syntax=<str>
|
||||
Specify a specific syntax highlighting from the nanorc to use, if
|
||||
available.
|
||||
available. See @xref{Nanorc Files}, for more info.
|
||||
|
||||
@item -c, --const
|
||||
Constantly display the cursor position and line number on the statusbar.
|
||||
Note that this cancels out -U.
|
||||
Note that this overrides -U.
|
||||
|
||||
@item -d, --rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
@@ -198,7 +205,7 @@ work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
|
||||
@item -h, --help
|
||||
Print the usage and exit.
|
||||
Show a summary of command line options and exit.
|
||||
|
||||
@item -i, --autoindent
|
||||
Automatically indent new lines to the same number of spaces and tabs as
|
||||
@@ -212,10 +219,12 @@ When writing files, if the given file is a symbolic link, it is removed
|
||||
and a new file is created.
|
||||
|
||||
@item -m, --mouse
|
||||
Enables the use of the mouse to select text (currently only useful for
|
||||
running under the X Window System).
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
clicks can be used to place the cursor, set the mark (with a double
|
||||
click), and execute shortcuts. The mouse will work in the X Window
|
||||
System, and on the console when gpm is running.
|
||||
|
||||
@item -o [dir], --operatingdir=[dir]
|
||||
@item -o <dir>, --operatingdir=<dir>
|
||||
Set operating directory. Makes @code{nano} set up something similar to
|
||||
a chroot.
|
||||
|
||||
@@ -223,32 +232,23 @@ a chroot.
|
||||
Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent to the
|
||||
editor can be can be stopped and started.
|
||||
|
||||
@item -r [#cols], --fill=[#cols].
|
||||
@item -r <#cols>, --fill=<#cols>
|
||||
Wrap lines at column #cols. If this value is 0 or less, wrapping will
|
||||
occur at #cols less the width of the screen, allowing it to vary along
|
||||
occur at the width of the screen less #cols, allowing it to vary along
|
||||
with the width of the screen if the screen is resized. The default
|
||||
value is -8.
|
||||
|
||||
@item -s [prog], --speller=[prog]
|
||||
Invoke [prog] as the spell checker. By default, @code{nano} uses the
|
||||
command specified in the SPELL environment variable, or, if SPELL is not
|
||||
set, its own interactive spell checker that requires the @code{spell}
|
||||
program to be installed on your system.
|
||||
@item -s <prog>, --speller=<prog>
|
||||
Invoke the given program as the spell checker. By default, @code{nano}
|
||||
uses the command specified in the SPELL environment variable, or, if
|
||||
SPELL is not set, its own interactive spell checker that requires the
|
||||
@code{spell} program to be installed on your system.
|
||||
|
||||
@item -t, --tempfile
|
||||
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.
|
||||
|
||||
@anchor{Expert Mode}
|
||||
@item -x, --nohelp
|
||||
In Expert Mode, the Shortcut Lists will not appear at the bottom of the
|
||||
screen. This affects the location of the statusbar as well, as in
|
||||
Expert Mode it is located at the very bottom of the editor.
|
||||
|
||||
Note: When accessing the help system, Expert Mode is temporarily
|
||||
disabled to display the help system navigation keys.
|
||||
|
||||
@item -v, --view
|
||||
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
|
||||
@@ -258,6 +258,15 @@ implement a read-only file.
|
||||
Don't wrap long lines at any length. This option overrides any value
|
||||
for -r.
|
||||
|
||||
@anchor{Expert Mode}
|
||||
@item -x, --nohelp
|
||||
Expert Mode: don't show the Shortcut Lists at the bottom of the screen.
|
||||
This affects the location of the statusbar as well, as in Expert Mode it
|
||||
is located at the very bottom of the editor.
|
||||
|
||||
Note: When accessing the help system, Expert Mode is temporarily
|
||||
disabled to display the help system navigation keys.
|
||||
|
||||
@item -z, --suspend
|
||||
Enable @code{nano}'s suspend ability using the system's suspend
|
||||
keystroke (usually ^Z).
|
||||
@@ -266,6 +275,7 @@ keystroke (usually ^Z).
|
||||
Ignored, for compatibility with Pico.
|
||||
@end table
|
||||
|
||||
|
||||
@node Editor Basics, Online Help, Introduction, Top
|
||||
@chapter Editor Basics
|
||||
@menu
|
||||
@@ -274,38 +284,39 @@ Ignored, for compatibility with Pico.
|
||||
* The Titlebar::
|
||||
* The Statusbar::
|
||||
* Shortcut Lists::
|
||||
* Using the Mouse::
|
||||
@end menu
|
||||
|
||||
@node Entering Text, Special Functions, Editor Basics, Editor Basics
|
||||
@section Entering Text
|
||||
|
||||
All key sequences in @code{nano} are entered using the keyboard.
|
||||
@code{nano} is a ``modeless'' editor. All keys with the exception of
|
||||
Control and Meta key sequences will enter text into the file being
|
||||
@code{nano} is a "modeless" editor. All keys, with the exception of
|
||||
Control and Meta key sequences, will enter text into the file being
|
||||
edited.
|
||||
|
||||
@node Special Functions, The Titlebar, Entering Text, Editor Basics
|
||||
@section Special Functions
|
||||
|
||||
Special functions use the Control key (displayed in the help and
|
||||
shortcut lists as ^), the Meta key (displayed as M), or the Esc key.
|
||||
Special functions use the Control (Ctrl) key, displayed in the help and
|
||||
shortcut lists as ^; the Meta key, displayed as M; or the Escape (Esc)
|
||||
key.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Control key sequences are entered by holding down the Control key and
|
||||
Control key sequences are entered by holding down the Ctrl key and
|
||||
pressing the desired key, or by pressing the Esc key twice and pressing
|
||||
the desired key.
|
||||
@item
|
||||
Pressing Esc twice and then typing a three-digit number from 000 to 255
|
||||
will enter the character with the corresponding ASCII code.
|
||||
will enter the character with the corresponding value.
|
||||
@item
|
||||
Meta key sequences can be entered in a number of possible ways: Pressing
|
||||
the Escape key, then releasing it and pressing the desired key, or
|
||||
holding down the Alt key while pressing the desired key. This varies
|
||||
from keyboard to keyboard, and certain commercial operating systems
|
||||
``swallow'' the Alt key so that it never reaches the application. If
|
||||
your operating system does this, you should use the Escape key to
|
||||
generate Meta key sequences.
|
||||
Meta key sequences are entered by holding down the Meta key (normally
|
||||
the Alt key) and pressing the desired key, or by pressing the Esc key
|
||||
once and pressing the desired key. Certain operating systems "swallow"
|
||||
the Alt key so that it never reaches the application; if your operating
|
||||
system does this, you should use the Esc key to generate Meta key
|
||||
sequences.
|
||||
@end itemize
|
||||
|
||||
@node The Titlebar, The Statusbar, Special Functions, Editor Basics
|
||||
@@ -314,32 +325,42 @@ generate Meta key sequences.
|
||||
The titlebar is the line displayed at the top of the editor. There are
|
||||
three sections: left, center and right. The section on the left
|
||||
displays the version of @code{nano} being used. The center section
|
||||
displays the current file name, or ``New Buffer'' if the file has not
|
||||
yet been named. The section on the right will display ``Modified'' if
|
||||
the file has been modified since it was last saved or opened.
|
||||
displays the current filename, or "New Buffer" if the file has not yet
|
||||
been named. The section on the right will display "Modified" if the
|
||||
file has been modified since it was last saved or opened.
|
||||
|
||||
Special modes: When @code{nano} is in ``File browser'' mode, the center
|
||||
section will display the current directory instead of the filename.
|
||||
@xref{The File Browser}.
|
||||
Special modes: When @code{nano} is in "File browser" mode, the center
|
||||
section will display the current directory instead of the filename. See
|
||||
@xref{The File Browser}, for more info.
|
||||
|
||||
@node The Statusbar, Shortcut Lists, The Titlebar, Editor Basics
|
||||
@section The Statusbar
|
||||
|
||||
The statusbar is located three lines from the bottom of the screen (or
|
||||
the bottom line in Expert Mode. @xref{Expert Mode}, for more info).
|
||||
The statusbar is the third line from the bottom of the screen, or the
|
||||
bottom line in Expert Mode. See @xref{Expert Mode}, for more info. It
|
||||
shows important and informational messages. Any error messages that
|
||||
occur from using the editor will appear on the statusbar. Any questions
|
||||
that are asked of the user will be asked on the statusbar, and any user
|
||||
input (search strings, filenames, etc.) will be input on the statusbar.
|
||||
|
||||
The Statusbar shows important and informational messages. Any error
|
||||
messages that occur from using the editor will appear on the statusbar.
|
||||
Any questions that are asked of the user will be asked on the statusbar,
|
||||
and any user input (search strings, file names, etc) will be input on
|
||||
the statusbar.
|
||||
|
||||
@node Shortcut Lists, , The Statusbar, Editor Basics
|
||||
@node Shortcut Lists, Using the Mouse, The Statusbar, Editor Basics
|
||||
@section Shortcut Lists
|
||||
|
||||
The Shortcut Lists are the two lines at the bottom of the screen which
|
||||
show some of the more commonly used functions in the editor.
|
||||
|
||||
@node Using the Mouse, , Shortcut Lists, Editor Basics
|
||||
@section Using the Mouse
|
||||
|
||||
When mouse support has been configured and enabled, a single mouse click
|
||||
places the cursor at the indicated position. Clicking a second time in
|
||||
the same position toggles the mark. Clicking in the shortcut list
|
||||
executes the selected shortcut.
|
||||
|
||||
The mouse will work in the X Window System, and on the console when gpm
|
||||
is running.
|
||||
|
||||
|
||||
@node Online Help, Feature Toggles, Editor Basics, Top
|
||||
@chapter Online Help
|
||||
|
||||
@@ -349,13 +370,13 @@ editor and available keystrokes. Navigation is via the ^Y (Page Up)
|
||||
and ^V (Page Down) keys. ^X exits the help system.
|
||||
|
||||
|
||||
@node Feature Toggles, The File Browser, Online Help, Top
|
||||
@node Feature Toggles, Nanorc Files, Online Help, Top
|
||||
@chapter Feature Toggles
|
||||
|
||||
Toggles allow you to change certain aspects of the editor that
|
||||
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:
|
||||
Toggles allow you to change certain aspects of the editor that would
|
||||
normally be done via command line options. They are invoked via Meta
|
||||
key sequences. See @xref{Special Functions}, for more info. The
|
||||
following global toggles are available:
|
||||
|
||||
@table @code
|
||||
|
||||
@@ -391,7 +412,7 @@ 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. See @xref{Nanorc Files}, for more info.
|
||||
|
||||
@item Tabs to Spaces Toggle (Meta-Q)
|
||||
toggles the -E (@code{--tabstospaces}) command line option.
|
||||
@@ -404,7 +425,7 @@ 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. See @xref{Nanorc Files}, for more info.
|
||||
|
||||
@item Suspend Toggle (Meta-Z)
|
||||
toggles the -z (@code{--suspend}) command line option.
|
||||
@@ -412,19 +433,257 @@ toggles the -z (@code{--suspend}) command line option.
|
||||
@end table
|
||||
|
||||
|
||||
@node The File Browser, Pico Compatibility, Feature Toggles, Top
|
||||
@node Nanorc Files, The File Browser, Feature Toggles, Top
|
||||
@chapter Nanorc Files
|
||||
|
||||
The nanorc files contain the default settings for @code{nano}. They
|
||||
should not be in DOS or Mac format. During startup, @code{nano} will
|
||||
first read its system-wide settings from SYSCONFDIR/nanorc, and then
|
||||
user-specific settings from ~/.nanorc.
|
||||
|
||||
A nanorc file accepts a series of "set" and "unset" commands, which can
|
||||
be used to configure @code{nano} on startup without using the command
|
||||
line options. Additionally, the "syntax", "color", and "icolor"
|
||||
keywords are used to define syntax highlighting rules for different text
|
||||
patterns. @code{nano} will read one command per line.
|
||||
|
||||
Options in nanorc files take precedence over @code{nano}'s defaults, and
|
||||
command line options override nanorc settings. Options are also unset
|
||||
by default, except for those that take arguments.
|
||||
|
||||
Quotes inside string parameters don't have to be escaped with
|
||||
backslashes. The last double quote in the string will be treated as its
|
||||
end. For example, for the "brackets" option,
|
||||
|
||||
@quotation
|
||||
@code{""')>]@}"}
|
||||
@end quotation
|
||||
|
||||
will match @code{"}, @code{'}, @code{)}, @code{>}, @code{]}, and
|
||||
@code{@}}.
|
||||
|
||||
The supported commands and arguments are:
|
||||
|
||||
@table @code
|
||||
|
||||
@item set/unset autoindent
|
||||
Use auto-indentation.
|
||||
|
||||
@item set/unset backup
|
||||
Create backup files in "filename~".
|
||||
|
||||
@item set backupdir "directory"
|
||||
Set the directory where @code{nano} puts unique backup files if file
|
||||
backups are enabled.
|
||||
|
||||
@item set/unset backwards
|
||||
Do backwards searches by default.
|
||||
|
||||
@item set/unset boldtext
|
||||
Use bold text instead of reverse video text.
|
||||
|
||||
@item set brackets "string"
|
||||
Set the characters treated as closing brackets when justifying
|
||||
paragraphs. They cannot contain blank characters. Only closing
|
||||
punctuation, optionally followed by closing brackets, can end sentences.
|
||||
The default value is
|
||||
|
||||
@quotation
|
||||
@code{""')>]@}"}
|
||||
@end quotation
|
||||
|
||||
@item set/unset casesensitive
|
||||
Do case sensitive searches by default.
|
||||
|
||||
@item set/unset const
|
||||
Constantly display the cursor position in the status bar.
|
||||
|
||||
@item set/unset cut
|
||||
Use cut to end of line by default, instead of cutting the whole line.
|
||||
|
||||
@item set fill "n"
|
||||
Wrap lines at column number "n". If "n" is 0 or less, the maximum line
|
||||
length will be the screen width less "n" columns. The default value is
|
||||
-8.
|
||||
|
||||
@item set/unset historylog
|
||||
Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
|
||||
@item set matchbrackets "string"
|
||||
Set the opening and closing brackets that can be found by bracket
|
||||
searches. They cannot contain blank characters. The former set must
|
||||
come before the latter set, and both must be in the same order. The
|
||||
default value is
|
||||
|
||||
@quotation
|
||||
@code{"(<[@{)>]@}"}
|
||||
@end quotation
|
||||
|
||||
@item set/unset morespace
|
||||
Allow use of the blank line below the titlebar as extra editing space.
|
||||
|
||||
@item set/unset mouse
|
||||
Enable mouse support, so that mouse clicks can be used to place the
|
||||
cursor, set the mark (with a double click), or execute shortcuts.
|
||||
|
||||
@item set/unset multibuffer
|
||||
Allow inserting files into their own buffers.
|
||||
|
||||
@item set/unset noconvert
|
||||
Don't convert files from DOS/Mac format.
|
||||
|
||||
@item set/unset nofollow
|
||||
Don't follow symlinks when writing files.
|
||||
|
||||
@item set/unset nohelp
|
||||
Don't display the help lists at the bottom of the screen.
|
||||
|
||||
@item set/unset nonewlines
|
||||
Don't add newlines to the ends of files.
|
||||
|
||||
@item set/unset nowrap
|
||||
Don't wrap text at all.
|
||||
|
||||
@item set operatingdir "directory"
|
||||
@code{nano} will only read and write files inside "directory" and its
|
||||
subdirectories. Also, the current directory is changed to here, so
|
||||
files are inserted from this directory. By default, the operating
|
||||
directory feature is turned off.
|
||||
|
||||
@item set/unset preserve
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
|
||||
@item set punct "string"
|
||||
Set the characters treated as closing punctuation when justifying
|
||||
paragraphs. They cannot contain blank characters. Only closing
|
||||
punctuation, optionally followed by closing brackets, can end sentences.
|
||||
The default value is @code{"!.?"}.
|
||||
|
||||
@item set/unset quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
|
||||
@item set quotestr "string"
|
||||
The email-quote string, used to justify email-quoted paragraphs. This
|
||||
is an extended regular expression if your system supports them,
|
||||
otherwise a literal string. The default value is
|
||||
|
||||
@quotation
|
||||
@code{"^([ \\t]*[#:>\\|@}])+"}
|
||||
@end quotation
|
||||
|
||||
if you have extended regular expression support, or "> " otherwise.
|
||||
Note that '\\t' stands for a literal Tab character.
|
||||
|
||||
@item set/unset rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
|
||||
@item 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.
|
||||
|
||||
@item set/unset regexp
|
||||
Do extended regular expression searches by default.
|
||||
|
||||
@item set/unset smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
|
||||
@item set/unset smooth
|
||||
Use smooth scrolling by default.
|
||||
|
||||
@item set speller "spellprog"
|
||||
Use spelling checker "spellprog" instead of the built-in one, which
|
||||
calls "spell".
|
||||
|
||||
@item set/unset suspend
|
||||
Allow @code{nano} to be suspended.
|
||||
|
||||
@item set tabsize "n"
|
||||
Use a tab size of "n" columns. The value of "n" must be greater than 0.
|
||||
The default value is 8.
|
||||
|
||||
@item set/unset tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
|
||||
@item set/unset tempfile
|
||||
Save automatically on exit, don't prompt.
|
||||
|
||||
@item set/unset view
|
||||
Disallow file modification.
|
||||
|
||||
@item set whitespace "string"
|
||||
Set the two characters used to display the first characters of tabs and
|
||||
spaces. They must be single-column characters.
|
||||
|
||||
@item set/unset wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
|
||||
@item syntax "str" ["fileregex" @dots{} ]
|
||||
Defines a syntax named "str" which can be activated via the -Y/--syntax
|
||||
command line option, or will be automatically activated if the current
|
||||
filename matches the extended regular expression "fileregex". All
|
||||
following "color" and "icolor" statements will apply to "syntax" until a
|
||||
new syntax is defined.
|
||||
|
||||
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 "fileregex", and applies to files that don't match any other
|
||||
syntax's "fileregex".
|
||||
|
||||
@item color fgcolor,bgcolor "regex" @dots{}
|
||||
For the currently defined syntax, display all expressions matching the
|
||||
extended regular expression "regex" with foreground color "fgcolor" and
|
||||
background color "bgcolor", at least one of which must be specified.
|
||||
Legal colors for foreground and background color are: white, black, red,
|
||||
blue, green, yellow, magenta, and cyan. You may use the prefix "bright"
|
||||
to force a stronger color highlight for the foreground. If your
|
||||
terminal supports transparency, not specifying a "bgcolor" tells "nano"
|
||||
to attempt to use a transparent background.
|
||||
|
||||
@item icolor fgcolor,bgcolor "regex" @dots{}
|
||||
Same as above, except that the expression matching is case insensitive.
|
||||
|
||||
@item color fgcolor,bgcolor start="sr" end="er"
|
||||
Display expressions which start with the extended regular expression
|
||||
"sr" and end with the extended regular expression "er" with foreground
|
||||
color "fgcolor" and background color "bgcolor", at least one of which
|
||||
must be specified. This allows syntax highlighting to span multiple
|
||||
lines. Note that all subsequent instances of "sr" after an initial "sr"
|
||||
is found will be highlighted until the first instance of "er".
|
||||
|
||||
@item icolor fgcolor,bgcolor start="sr" end="er"
|
||||
Same as above, except that the expression matching is case insensitive.
|
||||
|
||||
@item include "syntaxfile"
|
||||
Read in self-contained color syntaxes from "syntaxfile". Note that
|
||||
"syntaxfile" can only contain "syntax", "color", and "icolor" commands.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node The File Browser, Pico Compatibility, Nanorc Files, Top
|
||||
@chapter The File Browser
|
||||
|
||||
When reading or writing files, pressing ^T will invoke the file browser.
|
||||
Here, one can navigate directories in a graphical manner in order to
|
||||
find the desired file.
|
||||
|
||||
Basic movement in the file browser is accomplished with the arrow keys
|
||||
and page up/down. The behavior of the enter (or `s') key varies by what
|
||||
is currently selected. If the currently selected object is a directory,
|
||||
the file browser will enter and display the contents of the directory.
|
||||
If the object is a file, this filename and path are copied to the
|
||||
statusbar and the file browser is exited.
|
||||
Basic movement in the file browser is accomplished with the arrow keys,
|
||||
page up, and page down. More advanced movement is accomplished by
|
||||
searching via ^W (or 'w') and changing directories via ^_ (or 'g'). The
|
||||
behavior of the Enter (or 's') key varies by what is currently selected.
|
||||
If the currently selected object is a directory, the file browser will
|
||||
enter and display the contents of the directory. If the object is a
|
||||
file, this filename and path are copied to the statusbar, and the file
|
||||
browser exits.
|
||||
|
||||
@node Pico Compatibility, Building and Configure Options, The File Browser, Top
|
||||
@chapter Pico Compatibility
|
||||
@@ -443,22 +702,22 @@ 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} 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.
|
||||
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
|
||||
Text selected using the Control-Caret (^^) key can be written out or
|
||||
appended to a new or existing file using the Writeout key (^O).
|
||||
@item Writing, Appending, or Prepending Selected Text to Files
|
||||
Text selected using the marking key (^^) can be written out, appended,
|
||||
or prepended to a new or existing file using the WriteOut key (^O).
|
||||
|
||||
@item Toggles
|
||||
Many options which alter the functionality of the program can be
|
||||
"toggled" on or off using Meta key sequences, meaning the program does
|
||||
not have to be restarted to turn a particular feature of the editor on
|
||||
or off. Please see the internal help function (^G) for a list of what
|
||||
functions can be toggled for a particular version of @code{nano}. Also
|
||||
see @xref{Feature Toggles}, though this may be out of date.
|
||||
functions can be toggled for a particular version of @code{nano}. See
|
||||
@xref{Feature Toggles}, for more info.
|
||||
|
||||
@item Cursor Position Display
|
||||
The output of the "Display Cursor Position" in @code{nano} displays
|
||||
@@ -466,11 +725,11 @@ the given column position, as well as the row and total character
|
||||
position of the cursor.
|
||||
|
||||
@item Interactive Replace and Spell Checker
|
||||
It is worth noting that the @code{nano} replace function is interactive,
|
||||
It is worth noting that @code{nano}'s replace function is interactive,
|
||||
i.e, it does not stop after one search string is found and automatically
|
||||
replace it. The @code{nano} implementation will stop at each search
|
||||
replace it. The @code{nano} implementation will pause at each search
|
||||
string found and query whether to replace this instance or not. The
|
||||
internal spell checker operates similarly. Note that these is no way to
|
||||
internal spell checker operates similarly. Note that there is no way to
|
||||
force these functions to behave in the Pico fashion. As of version
|
||||
1.1.99pre1, misspelled words are sorted and trimmed for uniqueness in
|
||||
the internal spell checker such that the words 'apple' and 'Apple' will
|
||||
@@ -492,8 +751,9 @@ familiar with compiling programs with autoconf support:
|
||||
@item make install
|
||||
@end itemize
|
||||
|
||||
@table @code
|
||||
The possible options to @code{./configure} are:
|
||||
|
||||
@table @code
|
||||
|
||||
@item --disable-browser
|
||||
Disable the mini file browser when reading or writing files.
|
||||
@@ -539,9 +799,8 @@ 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.
|
||||
Enable support for syntax coloring of files using the nanorc file. This
|
||||
enables nanorc support as well.
|
||||
|
||||
@item --enable-multibuffer
|
||||
Enable support for opening multiple files at a time and switching
|
||||
@@ -550,7 +809,8 @@ 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.
|
||||
line options to get desired behavior. See @xref{Nanorc Files}, for
|
||||
more info.
|
||||
|
||||
@item --enable-all
|
||||
Shortcut for enabling the above four features (extra, color,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
EXTRA_DIST = codeset.m4 gettext.m4 glib-2.0.m4 glibc21.m4 iconv.m4 \
|
||||
intdiv0.m4 inttypes_h.m4 inttypes.m4 inttypes-pri.m4 \
|
||||
isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 \
|
||||
lib-prefix.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 \
|
||||
ulonglong.m4
|
||||
EXTRA_DIST = ac_define_dir.m4 codeset.m4 gettext.m4 glib-2.0.m4 \
|
||||
glibc21.m4 iconv.m4 intdiv0.m4 inttypes_h.m4 \
|
||||
inttypes.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 \
|
||||
lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 \
|
||||
stdint_h.m4 uintmax_t.m4 ulonglong.m4
|
||||
|
||||
34
m4/ac_define_dir.m4
Normal file
34
m4/ac_define_dir.m4
Normal file
@@ -0,0 +1,34 @@
|
||||
dnl @synopsis AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
|
||||
dnl
|
||||
dnl This macro sets VARNAME to the expansion of the DIR variable,
|
||||
dnl taking care of fixing up ${prefix} and such.
|
||||
dnl
|
||||
dnl VARNAME is then offered as both an output variable and a C
|
||||
dnl preprocessor symbol.
|
||||
dnl
|
||||
dnl Example:
|
||||
dnl
|
||||
dnl AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.])
|
||||
dnl
|
||||
dnl @category Misc
|
||||
dnl @author Stepan Kasal <kasal@ucw.cz>
|
||||
dnl @author Andreas Schwab <schwab@suse.de>
|
||||
dnl @author Guido Draheim <guidod@gmx.de>
|
||||
dnl @author Alexandre Oliva
|
||||
dnl @version 2005-07-29
|
||||
dnl @license AllPermissive
|
||||
|
||||
AC_DEFUN([AC_DEFINE_DIR], [
|
||||
prefix_NONE=
|
||||
exec_prefix_NONE=
|
||||
test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
|
||||
test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
|
||||
dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
|
||||
dnl refers to ${prefix}. Thus we have to use `eval' twice.
|
||||
eval ac_define_dir="\"[$]$2\""
|
||||
eval ac_define_dir="\"$ac_define_dir\""
|
||||
AC_SUBST($1, "$ac_define_dir")
|
||||
AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
|
||||
test "$prefix_NONE" && prefix=NONE
|
||||
test "$exec_prefix_NONE" && exec_prefix=NONE
|
||||
])
|
||||
@@ -8,7 +8,7 @@ Version : %{ver}
|
||||
Release : %{rel}
|
||||
Copyright : GPL
|
||||
Group : Console/Editors
|
||||
URL : http://www.nano-editor.org
|
||||
URL : http://www.nano-editor.org/
|
||||
Source : http://www.nano-editor.org/dist/v1.3/%{name}-%{ver}.tar.gz
|
||||
BuildRoot : /var/tmp/%{name}-buildroot
|
||||
Requires : ncurses
|
||||
@@ -34,6 +34,7 @@ make DESTDIR="$RPM_BUILD_ROOT" install
|
||||
%{_bindir}/*
|
||||
%{_mandir}/*/*
|
||||
%{_datadir}/locale/*/LC_MESSAGES/nano.mo
|
||||
%{_datadir}/nano/*
|
||||
%{_infodir}/nano.info*
|
||||
|
||||
%changelog
|
||||
|
||||
58
po/ChangeLog
58
po/ChangeLog
@@ -1,3 +1,61 @@
|
||||
2006-06-20 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* hu.po: Updated Hungarian translation by Gabor Kelemen.
|
||||
* nl.po: Updated Dutch translation by Benno Schulenberg.
|
||||
|
||||
2006-06-20 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* fr.po: Fixed incorrect "Project-Id-Version" entry.
|
||||
* hu.po: Fixed incorrect "Project-Id-Version" entry.
|
||||
* it.po: Fixed incorrect "Project-Id-Version" entry.
|
||||
|
||||
2006-06-19 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* bg.po: Updated Bulgarian translation by Anton Zinoviev.
|
||||
* ga.po: Updated Irish translation by Kevin Patrick Scannell.
|
||||
|
||||
2006-06-17 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* de.po: Updated German translation by Michael Piefel.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* hu.po: Updated Hungarian translation by Gabor Kelemen.
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* nl.po: Updated Dutch translation by Benno Schulenberg.
|
||||
|
||||
2006-06-12 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* hu.po: Updated Hungarian translation by Gabor Kelemen.
|
||||
|
||||
2006-06-09 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* ga.po: Updated Irish translation by Kevin Patrick Scannell.
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* nl.po: Updated Dutch translation by Benno Schulenberg.
|
||||
|
||||
2006-05-17 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* LINGUAS: Added "ga".
|
||||
* ga.po: New Irish translation by
|
||||
Kevin Patrick Scannell <scannell@SLU.EDU>.
|
||||
|
||||
2006-05-10 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* nl.po: Updated Dutch translation by Benno Schulenberg.
|
||||
|
||||
2006-03-15 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* sv.po: Updated Swedish translation by Daniel Nylander.
|
||||
|
||||
2006-03-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Vietnamese translation by
|
||||
Phan Vinh Thinh.
|
||||
|
||||
2005-12-21 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* bg.po: Updated Bulgarian translation by Anton Zinoviev.
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
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
|
||||
bg ca cs da de es eu fi fr ga gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk vi zh_TW
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
localedir = $(datadir)/locale
|
||||
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
INCLUDES = -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
@@ -26,3 +26,5 @@ nano_LDADD = @GLIB_LIBS@ @LIBINTL@
|
||||
|
||||
install-exec-hook:
|
||||
cd $(DESTDIR)$(bindir) && rm -f rnano && $(LN_S) nano rnano
|
||||
uninstall-hook:
|
||||
cd $(DESTDIR)$(bindir) && rm -f rnano
|
||||
|
||||
934
src/browser.c
934
src/browser.c
File diff suppressed because it is too large
Load Diff
159
src/chars.c
159
src/chars.c
@@ -3,7 +3,7 @@
|
||||
* chars.c *
|
||||
* *
|
||||
* Copyright (C) 2001-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <wctype.h>
|
||||
#endif
|
||||
|
||||
static bool use_utf8 = FALSE;
|
||||
/* Whether we've enabled UTF-8 support. */
|
||||
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
|
||||
@@ -41,6 +43,18 @@ static const wchar_t bad_wchar = 0xFFFD;
|
||||
* match to it. */
|
||||
static const char *bad_mbchar = "\xEF\xBF\xBD";
|
||||
static const int bad_mbchar_len = 3;
|
||||
|
||||
/* Enable UTF-8 support. */
|
||||
void utf8_init(void)
|
||||
{
|
||||
use_utf8 = TRUE;
|
||||
}
|
||||
|
||||
/* Is UTF-8 support enabled? */
|
||||
bool using_utf8(void)
|
||||
{
|
||||
return use_utf8;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ISBLANK
|
||||
@@ -72,7 +86,7 @@ bool is_alnum_mbchar(const char *c)
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
@@ -92,7 +106,7 @@ bool is_blank_mbchar(const char *c)
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
@@ -106,6 +120,13 @@ bool is_blank_mbchar(const char *c)
|
||||
return isblank((unsigned char)*c);
|
||||
}
|
||||
|
||||
/* This function is equivalent to iscntrl(), except in that it only
|
||||
* handles non-high-bit control characters. */
|
||||
bool is_ascii_cntrl_char(int c)
|
||||
{
|
||||
return (0 <= c && c < 32);
|
||||
}
|
||||
|
||||
/* This function is equivalent to iscntrl(), except in that it also
|
||||
* handles high-bit control characters. */
|
||||
bool is_cntrl_char(int c)
|
||||
@@ -132,7 +153,7 @@ bool is_cntrl_mbchar(const char *c)
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
@@ -152,7 +173,7 @@ bool is_punct_mbchar(const char *c)
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
@@ -219,7 +240,7 @@ char *control_mbrep(const char *c, char *crep, int *crep_len)
|
||||
assert(c != NULL && crep != NULL && crep_len != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
@@ -253,7 +274,7 @@ 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)) {
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
/* Reject invalid Unicode characters. */
|
||||
@@ -286,7 +307,7 @@ int mbwidth(const char *c)
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
int width;
|
||||
|
||||
@@ -313,7 +334,7 @@ int mb_cur_max(void)
|
||||
{
|
||||
return
|
||||
#ifdef ENABLE_UTF8
|
||||
ISSET(USE_UTF8) ? MB_CUR_MAX :
|
||||
use_utf8 ? MB_CUR_MAX :
|
||||
#endif
|
||||
1;
|
||||
}
|
||||
@@ -330,7 +351,7 @@ char *make_mbchar(long chr, int *chr_mb_len)
|
||||
assert(chr_mb_len != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
chr_mb = charalloc(MB_CUR_MAX);
|
||||
*chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
|
||||
|
||||
@@ -361,7 +382,7 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
assert(buf != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
/* Get the number of bytes in the multibyte character. */
|
||||
buf_mb_len = mblen(buf, MB_CUR_MAX);
|
||||
|
||||
@@ -505,7 +526,7 @@ int nstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
char *s1_mb = charalloc(MB_CUR_MAX);
|
||||
char *s2_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t ws1, ws2;
|
||||
@@ -598,7 +619,7 @@ const char *nstrcasestr(const char *haystack, const char *needle)
|
||||
const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t wr, wq;
|
||||
@@ -704,7 +725,7 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
const char *rev_start)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t wr, wq;
|
||||
@@ -792,7 +813,7 @@ size_t mbstrnlen(const char *s, size_t maxlen)
|
||||
assert(s != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
size_t n = 0;
|
||||
int s_mb_len;
|
||||
|
||||
@@ -813,34 +834,14 @@ 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
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
|
||||
/* This function is equivalent to strchr() for multibyte strings. */
|
||||
char *mbstrchr(const char *s, char *c)
|
||||
char *mbstrchr(const char *s, const char *c)
|
||||
{
|
||||
assert(s != NULL && c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
bool bad_s_mb = FALSE, bad_c_mb = FALSE;
|
||||
char *s_mb = charalloc(MB_CUR_MAX);
|
||||
const char *q = s;
|
||||
@@ -879,8 +880,80 @@ char *mbstrchr(const char *s, char *c)
|
||||
#endif
|
||||
return strchr(s, *c);
|
||||
}
|
||||
#endif /* !NANO_TINY || !DISABLE_JUSTIFY */
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifndef NANO_TINY
|
||||
/* This function is equivalent to strpbrk() for multibyte strings. */
|
||||
char *mbstrpbrk(const char *s, const char *accept)
|
||||
{
|
||||
assert(s != NULL && accept != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
while (*s != '\0') {
|
||||
if (mbstrchr(accept, s) != NULL)
|
||||
return (char *)s;
|
||||
|
||||
s += move_mbright(s, 0);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
} else
|
||||
#endif
|
||||
return strpbrk(s, accept);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* This function is equivalent to strpbrk() for multibyte strings,
|
||||
* except in that it scans the string in reverse, starting at
|
||||
* rev_start. */
|
||||
char *mbrevstrpbrk(const char *s, const char *accept, const char
|
||||
*rev_start)
|
||||
{
|
||||
assert(s != NULL && accept != NULL && rev_start != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
bool begin_line = FALSE;
|
||||
|
||||
while (!begin_line) {
|
||||
const char *q = (*rev_start == '\0') ? NULL :
|
||||
mbstrchr(accept, rev_start);
|
||||
|
||||
if (q != NULL)
|
||||
return (char *)rev_start;
|
||||
|
||||
if (rev_start == s)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
rev_start = s + move_mbleft(s, rev_start - s);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
} else
|
||||
#endif
|
||||
return revstrpbrk(s, accept, rev_start);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
|
||||
/* Return TRUE if the string s contains one or more blank characters,
|
||||
* and FALSE otherwise. */
|
||||
bool has_blank_chars(const char *s)
|
||||
@@ -902,7 +975,7 @@ bool has_blank_mbchars(const char *s)
|
||||
assert(s != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
if (use_utf8) {
|
||||
char *chr_mb = charalloc(MB_CUR_MAX);
|
||||
bool retval = FALSE;
|
||||
|
||||
@@ -926,8 +999,7 @@ bool has_blank_mbchars(const char *s)
|
||||
#endif
|
||||
return has_blank_chars(s);
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
#endif /* ENABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
|
||||
@@ -948,10 +1020,9 @@ bool is_valid_mbstring(const char *s)
|
||||
|
||||
return
|
||||
#ifdef ENABLE_UTF8
|
||||
ISSET(USE_UTF8) ?
|
||||
use_utf8 ?
|
||||
(mbstowcs(NULL, s, 0) != (size_t)-1) :
|
||||
#endif
|
||||
|
||||
TRUE;
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* color.c *
|
||||
* *
|
||||
* Copyright (C) 2001-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -72,7 +72,7 @@ void color_init(void)
|
||||
start_color();
|
||||
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
/* Add in colors, if available. */
|
||||
/* Use the default colors, if available. */
|
||||
defok = (use_default_colors() != ERR);
|
||||
#endif
|
||||
|
||||
@@ -142,7 +142,7 @@ void color_update(void)
|
||||
* syntax names elsewhere.) Skip over it here, but keep
|
||||
* track of its color regexes. */
|
||||
if (strcmp(tmpsyntax->desc, "default") == 0) {
|
||||
defcolor = syntaxes->color;
|
||||
defcolor = tmpsyntax->color;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
153
src/cut.c
153
src/cut.c
@@ -3,7 +3,7 @@
|
||||
* cut.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -38,9 +38,9 @@ void cutbuffer_reset(void)
|
||||
keep_cutbuffer = FALSE;
|
||||
}
|
||||
|
||||
/* 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
|
||||
/* If we aren't on the last line of the file, move all the text of the
|
||||
* current line, plus the newline at the end, into the cutbuffer. If we
|
||||
* are, move all of the text of the current line into the cutbuffer. In
|
||||
* both cases, set the current place we want to the beginning of the
|
||||
* current line. */
|
||||
void cut_line(void)
|
||||
@@ -55,8 +55,8 @@ void cut_line(void)
|
||||
}
|
||||
|
||||
#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. */
|
||||
/* Move all currently marked text into the cutbuffer, and set the
|
||||
* current place we want to where the text used to start. */
|
||||
void cut_marked(void)
|
||||
{
|
||||
filestruct *top, *bot;
|
||||
@@ -69,11 +69,11 @@ void cut_marked(void)
|
||||
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 last line of the file, move the newline at the
|
||||
* end to the cutbuffer, and set the current place we want to where the
|
||||
/* If we aren't 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, into the cutbuffer. If we are, and
|
||||
* we're not on the last line of the file, move the newline at the end
|
||||
* into the cutbuffer, and set the current place we want to where the
|
||||
* newline used to be. */
|
||||
void cut_to_eol(void)
|
||||
{
|
||||
@@ -84,27 +84,53 @@ void cut_to_eol(void)
|
||||
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. */
|
||||
* the end, into the cutbuffer. */
|
||||
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. */
|
||||
* end, into the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->current->next, 0);
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
|
||||
/* Move all the text from the current cursor position to the end of the
|
||||
* file into the cutbuffer. */
|
||||
void cut_to_eof(void)
|
||||
{
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->filebot,
|
||||
strlen(openfile->filebot->data));
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Move text from the current filestruct into the cutbuffer. */
|
||||
void do_cut_text(void)
|
||||
/* Move text from the current filestruct into the cutbuffer. If
|
||||
* copy_text is TRUE, copy the text back into the filestruct afterward.
|
||||
* If cut_till_end is TRUE, move all text from the current cursor
|
||||
* position to the end of the file into the cutbuffer. */
|
||||
void do_cut_text(
|
||||
#ifndef NANO_TINY
|
||||
bool copy_text, bool cut_till_end
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
)
|
||||
{
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
#ifndef NANO_TINY
|
||||
filestruct *cb_save = NULL;
|
||||
/* The current end of the cutbuffer, before we add text to
|
||||
* it. */
|
||||
size_t cb_save_len = 0;
|
||||
/* The length of the string at the current end of the cutbuffer,
|
||||
* before we add text to it. */
|
||||
bool old_no_newlines = ISSET(NO_NEWLINES);
|
||||
#endif
|
||||
|
||||
check_statusblank();
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
/* If keep_cutbuffer is FALSE and the cutbuffer isn't empty, blow
|
||||
* away the text in the cutbuffer. */
|
||||
@@ -116,14 +142,33 @@ void do_cut_text(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (copy_text) {
|
||||
if (cutbuffer != NULL) {
|
||||
/* If the cutbuffer isn't empty, save where it currently
|
||||
* ends. This is where the new text will be added. */
|
||||
cb_save = cutbottom;
|
||||
cb_save_len = strlen(cutbottom->data);
|
||||
}
|
||||
|
||||
/* Set NO_NEWLINES to TRUE, so that we don't disturb the last
|
||||
* line of the file when moving text to the cutbuffer. */
|
||||
SET(NO_NEWLINES);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set keep_cutbuffer to TRUE, so that the text we're going to move
|
||||
* into the cutbuffer will be added to the text already in the
|
||||
* cutbuffer instead of replacing it. */
|
||||
keep_cutbuffer = TRUE;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set) {
|
||||
/* If the mark is on, move the marked text to the cutbuffer and
|
||||
if (cut_till_end) {
|
||||
/* If cut_till_end is TRUE, move all text up to the end of the
|
||||
* file into the cutbuffer. */
|
||||
cut_to_eof();
|
||||
} else if (openfile->mark_set) {
|
||||
/* If the mark is on, move the marked text to the cutbuffer, and
|
||||
* turn the mark off. */
|
||||
cut_marked();
|
||||
openfile->mark_set = FALSE;
|
||||
@@ -136,32 +181,61 @@ void do_cut_text(void)
|
||||
/* Otherwise, move the entire line into the cutbuffer. */
|
||||
cut_line();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (copy_text) {
|
||||
/* Copy the text in the cutbuffer, starting at its saved end if
|
||||
* there is one, back into the filestruct. This effectively
|
||||
* uncuts the text we just cut without marking the file as
|
||||
* modified. */
|
||||
if (cutbuffer != NULL) {
|
||||
if (cb_save != NULL) {
|
||||
cb_save->data += cb_save_len;
|
||||
copy_from_filestruct(cb_save, cutbottom);
|
||||
cb_save->data -= cb_save_len;
|
||||
} else
|
||||
copy_from_filestruct(cutbuffer, cutbottom);
|
||||
}
|
||||
|
||||
/* Set NO_NEWLINES back to what it was before, since we're done
|
||||
* disturbing the text. */
|
||||
if (!old_no_newlines)
|
||||
UNSET(NO_NEWLINES);
|
||||
} else
|
||||
#endif
|
||||
/* Leave the text in the cutbuffer, and mark the file as
|
||||
* modified. */
|
||||
set_modified();
|
||||
|
||||
/* Update the screen. */
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_filestruct(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Move text from the current filestruct into the cutbuffer. */
|
||||
void do_cut_text_void(void)
|
||||
{
|
||||
do_cut_text(
|
||||
#ifndef NANO_TINY
|
||||
FALSE, FALSE
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Move text from the current filestruct into the cutbuffer, and copy it
|
||||
* back into the filestruct afterward. */
|
||||
void do_copy_text(void)
|
||||
{
|
||||
do_cut_text(TRUE, FALSE);
|
||||
}
|
||||
|
||||
/* Cut from the current cursor position to the end of the file. */
|
||||
void do_cut_till_end(void)
|
||||
{
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
check_statusblank();
|
||||
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->filebot,
|
||||
strlen(openfile->filebot->data));
|
||||
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_filestruct(cutbuffer);
|
||||
#endif
|
||||
do_cut_text(FALSE, TRUE);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -170,12 +244,6 @@ void do_uncut_text(void)
|
||||
{
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
check_statusblank();
|
||||
|
||||
/* If the cutbuffer is empty, get out. */
|
||||
if (cutbuffer == NULL)
|
||||
return;
|
||||
@@ -188,9 +256,12 @@ void do_uncut_text(void)
|
||||
* cutbuffer ends. */
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
edit_refresh();
|
||||
/* Mark the file as modified. */
|
||||
set_modified();
|
||||
|
||||
/* Update the screen. */
|
||||
edit_refresh();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_filestruct_reverse();
|
||||
#endif
|
||||
|
||||
209
src/files.c
209
src/files.c
@@ -3,7 +3,7 @@
|
||||
* files.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -599,10 +599,11 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
||||
return -1;
|
||||
} else if (S_ISDIR(fileinfo.st_mode) || S_ISCHR(fileinfo.st_mode) ||
|
||||
S_ISBLK(fileinfo.st_mode)) {
|
||||
/* Don't open character or block files. Sorry, /dev/sndstat! */
|
||||
/* Don't open directories, character files, or block files.
|
||||
* Sorry, /dev/sndstat! */
|
||||
statusbar(S_ISDIR(fileinfo.st_mode) ?
|
||||
_("\"%s\" is a directory") :
|
||||
_("File \"%s\" is a device file"), filename);
|
||||
_("\"%s\" is a device file"), filename);
|
||||
beep();
|
||||
return -1;
|
||||
} else if ((fd = open(filename, O_RDONLY)) == -1) {
|
||||
@@ -610,8 +611,7 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
||||
beep();
|
||||
return -1;
|
||||
} else {
|
||||
/* File is A-OK. Open it in binary mode for our own end-of-line
|
||||
* character munging. */
|
||||
/* The file is A-OK. Open it. */
|
||||
*f = fdopen(fd, "rb");
|
||||
|
||||
if (*f == NULL) {
|
||||
@@ -687,32 +687,31 @@ void do_insertfile(
|
||||
bool at_edittop = FALSE;
|
||||
/* Whether we're at the top of the edit window. */
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
while (TRUE) {
|
||||
#ifndef NANO_TINY
|
||||
if (execute) {
|
||||
msg =
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
ISSET(MULTIBUFFER) ?
|
||||
N_("Command to execute in new buffer [from %s] ") :
|
||||
_("Command to execute in new buffer [from %s] ") :
|
||||
#endif
|
||||
N_("Command to execute [from %s] ");
|
||||
_("Command to execute [from %s] ");
|
||||
} else {
|
||||
#endif
|
||||
msg =
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
ISSET(MULTIBUFFER) ?
|
||||
N_("File to insert into new buffer [from %s] ") :
|
||||
_("File to insert into new buffer [from %s] ") :
|
||||
#endif
|
||||
N_("File to insert [from %s] ");
|
||||
_("File to insert [from %s] ");
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
i = do_prompt(TRUE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
execute ? extcmd_list :
|
||||
#endif
|
||||
@@ -720,10 +719,10 @@ void do_insertfile(
|
||||
#ifndef NANO_TINY
|
||||
NULL,
|
||||
#endif
|
||||
_(msg),
|
||||
edit_refresh, msg,
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
operating_dir != NULL && strcmp(operating_dir, ".") != 0 ?
|
||||
operating_dir :
|
||||
operating_dir != NULL && strcmp(operating_dir,
|
||||
".") != 0 ? operating_dir :
|
||||
#endif
|
||||
"./");
|
||||
|
||||
@@ -1058,11 +1057,11 @@ char *safe_tempfile(FILE **f)
|
||||
|
||||
assert(f != NULL);
|
||||
|
||||
/* If $TMPDIR is set and non-empty, set tempdir to it, run it
|
||||
* through get_full_path(), and save the result in full_tempdir.
|
||||
* Otherwise, leave full_tempdir set to NULL. */
|
||||
/* If $TMPDIR is set, set tempdir to it, run it through
|
||||
* get_full_path(), and save the result in full_tempdir. Otherwise,
|
||||
* leave full_tempdir set to NULL. */
|
||||
tmpdir_env = getenv("TMPDIR");
|
||||
if (tmpdir_env != NULL && tmpdir_env[0] != '\0')
|
||||
if (tmpdir_env != NULL)
|
||||
full_tempdir = check_writable_directory(tmpdir_env);
|
||||
|
||||
/* If $TMPDIR is unset, empty, or not a writable directory, and
|
||||
@@ -1303,7 +1302,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
/* Save the state of file at the end of the symlink (if there is
|
||||
/* Save the state of the file at the end of the symlink (if there is
|
||||
* one). */
|
||||
realexists = (stat(realname, &st) != -1);
|
||||
|
||||
@@ -1333,7 +1332,10 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
statusbar(_("Error reading %s: %s"), realname,
|
||||
strerror(errno));
|
||||
beep();
|
||||
goto cleanup_and_exit;
|
||||
/* If we can't read from the original file, go on, since
|
||||
* only saving the original file is better than saving
|
||||
* nothing. */
|
||||
goto skip_backup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1372,8 +1374,10 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
_("Too many backup files?"));
|
||||
free(backuptemp);
|
||||
free(backupname);
|
||||
fclose(f);
|
||||
goto cleanup_and_exit;
|
||||
/* If we can't write to the backup, go on, since only
|
||||
* saving the original file is better than saving
|
||||
* nothing. */
|
||||
goto skip_backup;
|
||||
} else {
|
||||
free(backupname);
|
||||
backupname = backuptemp;
|
||||
@@ -1395,8 +1399,9 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
free(backupname);
|
||||
if (backup_file != NULL)
|
||||
fclose(backup_file);
|
||||
fclose(f);
|
||||
goto cleanup_and_exit;
|
||||
/* If we can't write to the backup, go on, since only saving
|
||||
* the original file is better than saving nothing. */
|
||||
goto skip_backup;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -1406,12 +1411,11 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
/* Copy the file. */
|
||||
copy_status = copy_file(f, backup_file);
|
||||
|
||||
/* And set metadata. */
|
||||
/* And set its metadata. */
|
||||
if (copy_status != 0 || chown(backupname,
|
||||
openfile->current_stat->st_uid,
|
||||
openfile->current_stat->st_gid) == -1 ||
|
||||
utime(backupname, &filetime) == -1) {
|
||||
free(backupname);
|
||||
if (copy_status == -1) {
|
||||
statusbar(_("Error reading %s: %s"), realname,
|
||||
strerror(errno));
|
||||
@@ -1419,11 +1423,15 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
} else
|
||||
statusbar(_("Error writing %s: %s"), backupname,
|
||||
strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
/* If we can't read from or write to the backup, go on,
|
||||
* since only saving the original file is better than saving
|
||||
* nothing. */
|
||||
}
|
||||
|
||||
free(backupname);
|
||||
}
|
||||
|
||||
skip_backup:
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* If NOFOLLOW_SYMLINKS is set and the file is a link, we aren't
|
||||
@@ -1451,10 +1459,21 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
int fd_source;
|
||||
FILE *f_source = NULL;
|
||||
|
||||
if (f == NULL) {
|
||||
f = fopen(realname, "rb");
|
||||
|
||||
if (f == NULL) {
|
||||
statusbar(_("Error reading %s: %s"), realname,
|
||||
strerror(errno));
|
||||
beep();
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
}
|
||||
|
||||
tempname = safe_tempfile(&f);
|
||||
|
||||
if (tempname == NULL) {
|
||||
statusbar(_("Prepending to %s failed: %s"), realname,
|
||||
statusbar(_("Error writing temp file: %s"),
|
||||
strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
@@ -1599,11 +1618,8 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
} else if (fclose(f) == EOF) {
|
||||
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||
unlink(tempname);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
} else
|
||||
fclose(f);
|
||||
|
||||
if (!tmp && append == OVERWRITE) {
|
||||
if (!nonamechange) {
|
||||
@@ -1732,31 +1748,39 @@ int do_writeout(bool exiting)
|
||||
const char *formatstr, *backupstr;
|
||||
|
||||
formatstr = (openfile->fmt == DOS_FILE) ?
|
||||
N_(" [DOS Format]") : (openfile->fmt == MAC_FILE) ?
|
||||
N_(" [Mac Format]") : "";
|
||||
_(" [DOS Format]") : (openfile->fmt == MAC_FILE) ?
|
||||
_(" [Mac Format]") : "";
|
||||
|
||||
backupstr = ISSET(BACKUP_FILE) ? N_(" [Backup]") : "";
|
||||
backupstr = ISSET(BACKUP_FILE) ? _(" [Backup]") : "";
|
||||
|
||||
if (openfile->mark_set && !exiting)
|
||||
msg = (append == PREPEND) ?
|
||||
N_("Prepend Selection to File") : (append == APPEND) ?
|
||||
N_("Append Selection to File") :
|
||||
N_("Write Selection to File");
|
||||
_("Prepend Selection to File") : (append == APPEND) ?
|
||||
_("Append Selection to File") :
|
||||
_("Write Selection to File");
|
||||
else
|
||||
#endif /* !NANO_TINY */
|
||||
msg = (append == PREPEND) ? N_("File Name to Prepend to") :
|
||||
(append == APPEND) ? N_("File Name to Append to") :
|
||||
N_("File Name to Write");
|
||||
msg = (append == PREPEND) ? _("File Name to Prepend to") :
|
||||
(append == APPEND) ? _("File Name to Append to") :
|
||||
_("File Name to Write");
|
||||
|
||||
/* If we're using restricted mode, the filename isn't blank,
|
||||
* and we're at the "Write File" prompt, disable tab
|
||||
* completion. */
|
||||
i = do_prompt(!ISSET(RESTRICTED) ||
|
||||
openfile->filename[0] == '\0', writefile_list, ans,
|
||||
openfile->filename[0] == '\0',
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
writefile_list, ans,
|
||||
#ifndef NANO_TINY
|
||||
NULL, "%s%s%s", _(msg), formatstr, backupstr
|
||||
NULL,
|
||||
#endif
|
||||
edit_refresh, "%s%s%s", msg,
|
||||
#ifndef NANO_TINY
|
||||
formatstr, backupstr
|
||||
#else
|
||||
"%s", _(msg)
|
||||
"", ""
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -1771,8 +1795,6 @@ int do_writeout(bool exiting)
|
||||
if (i == NANO_TOFILES_KEY) {
|
||||
char *tmp = do_browse_from(answer);
|
||||
|
||||
currshortcut = writefile_list;
|
||||
|
||||
if (tmp == NULL)
|
||||
continue;
|
||||
|
||||
@@ -1811,8 +1833,14 @@ int do_writeout(bool exiting)
|
||||
#endif
|
||||
|
||||
#ifdef NANO_EXTRA
|
||||
if (exiting && !ISSET(TEMP_FILE) &&
|
||||
strcasecmp(answer, "zzy") == 0 && !did_credits) {
|
||||
/* If the current file has been modified, we've pressed
|
||||
* Ctrl-X at the edit window to exit, we've pressed "y" at
|
||||
* the "Save modified buffer" prompt to save, we've entered
|
||||
* "zzy" as the filename to save under (hence "xyzzy"), and
|
||||
* this is the first time we've done this, show an Easter
|
||||
* egg. Display the credits. */
|
||||
if (!did_credits && exiting && !ISSET(TEMP_FILE) &&
|
||||
strcasecmp(answer, "zzy") == 0) {
|
||||
do_credits();
|
||||
did_credits = TRUE;
|
||||
retval = -1;
|
||||
@@ -1859,7 +1887,7 @@ int do_writeout(bool exiting)
|
||||
|
||||
break;
|
||||
}
|
||||
} /* while (TRUE) */
|
||||
}
|
||||
|
||||
free(ans);
|
||||
|
||||
@@ -1935,6 +1963,10 @@ int diralphasort(const void *va, const void *vb)
|
||||
if (!aisdir && bisdir)
|
||||
return 1;
|
||||
|
||||
/* Standard function brain damage: We should be sorting
|
||||
* alphabetically and case-insensitively according to the current
|
||||
* locale, but there's no standard strcasecoll() function, so we
|
||||
* have to use multibyte strcasecmp() instead, */
|
||||
return mbstrcasecmp(a, b);
|
||||
}
|
||||
|
||||
@@ -1942,6 +1974,8 @@ int diralphasort(const void *va, const void *vb)
|
||||
* elements. */
|
||||
void free_chararray(char **array, size_t len)
|
||||
{
|
||||
assert(array != NULL);
|
||||
|
||||
for (; len > 0; len--)
|
||||
free(array[len - 1]);
|
||||
free(array);
|
||||
@@ -1954,15 +1988,14 @@ int is_dir(const char *buf)
|
||||
{
|
||||
char *dirptr = real_dir_from_tilde(buf);
|
||||
struct stat fileinfo;
|
||||
|
||||
int ret = (stat(dirptr, &fileinfo) != -1 &&
|
||||
int retval = (stat(dirptr, &fileinfo) != -1 &&
|
||||
S_ISDIR(fileinfo.st_mode));
|
||||
|
||||
assert(buf != NULL && dirptr != buf);
|
||||
|
||||
free(dirptr);
|
||||
|
||||
return ret;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* These functions, username_tab_completion(), cwd_tab_completion()
|
||||
@@ -2007,8 +2040,8 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||
continue;
|
||||
#endif
|
||||
|
||||
matches = (char **)nrealloc(matches,
|
||||
(*num_matches + 1) * sizeof(char *));
|
||||
matches = (char **)nrealloc(matches, (*num_matches + 1) *
|
||||
sizeof(char *));
|
||||
matches[*num_matches] =
|
||||
charalloc(strlen(userdata->pw_name) + 2);
|
||||
sprintf(matches[*num_matches], "~%s", userdata->pw_name);
|
||||
@@ -2022,8 +2055,8 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||
|
||||
/* We consider the first buflen characters of buf for filename tab
|
||||
* completion. */
|
||||
char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
|
||||
buflen)
|
||||
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||
*num_matches, size_t buflen)
|
||||
{
|
||||
char *dirname = mallocstrcpy(NULL, buf), *filename;
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
@@ -2073,36 +2106,41 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
|
||||
filenamelen = strlen(filename);
|
||||
|
||||
while ((nextdir = readdir(dir)) != NULL) {
|
||||
bool skip_match = FALSE;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Comparing \'%s\'\n", nextdir->d_name);
|
||||
#endif
|
||||
/* See if this matches. */
|
||||
if (strncmp(nextdir->d_name, filename, filenamelen) == 0 &&
|
||||
(*filename == '.' ||
|
||||
(strcmp(nextdir->d_name, ".") != 0 &&
|
||||
strcmp(nextdir->d_name, "..") != 0))) {
|
||||
(*filename == '.' || (strcmp(nextdir->d_name, ".") !=
|
||||
0 && strcmp(nextdir->d_name, "..") != 0))) {
|
||||
/* Cool, found a match. Add it to the list. This makes a
|
||||
* lot more sense to me (Chris) this way... */
|
||||
|
||||
char *tmp = charalloc(strlen(dirname) +
|
||||
strlen(nextdir->d_name) + 1);
|
||||
sprintf(tmp, "%s%s", dirname, nextdir->d_name);
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
/* ...unless the match exists outside the operating
|
||||
* directory, in which case just go to the next match. To
|
||||
* properly do operating directory checking, we have to add
|
||||
* the directory name to the beginning of the proposed match
|
||||
* before we check it. */
|
||||
char *tmp2 = charalloc(strlen(dirname) +
|
||||
strlen(nextdir->d_name) + 1);
|
||||
|
||||
sprintf(tmp2, "%s%s", dirname, nextdir->d_name);
|
||||
if (check_operating_dir(tmp2, TRUE)) {
|
||||
free(tmp2);
|
||||
continue;
|
||||
}
|
||||
free(tmp2);
|
||||
* directory, in which case just go to the next match. */
|
||||
if (check_operating_dir(tmp, TRUE))
|
||||
skip_match = TRUE;
|
||||
#endif
|
||||
|
||||
matches = (char **)nrealloc(matches,
|
||||
(*num_matches + 1) * sizeof(char *));
|
||||
/* ...or unless the match isn't a directory and allow_files
|
||||
* isn't set, in which case just go to the next match. */
|
||||
if (!allow_files && !is_dir(tmp))
|
||||
skip_match = TRUE;
|
||||
|
||||
free(tmp);
|
||||
|
||||
if (skip_match)
|
||||
continue;
|
||||
|
||||
matches = (char **)nrealloc(matches, (*num_matches + 1) *
|
||||
sizeof(char *));
|
||||
matches[*num_matches] = mallocstrcpy(NULL, nextdir->d_name);
|
||||
++(*num_matches);
|
||||
}
|
||||
@@ -2116,13 +2154,15 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
|
||||
}
|
||||
|
||||
/* Do tab completion. place refers to how much the statusbar cursor
|
||||
* position should be advanced. */
|
||||
char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list)
|
||||
* position should be advanced. refresh_func is the function we will
|
||||
* call to refresh the edit window. */
|
||||
char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
*lastwastab, void (*refresh_func)(void), bool *list)
|
||||
{
|
||||
size_t num_matches = 0;
|
||||
char **matches = NULL;
|
||||
|
||||
assert(buf != NULL && place != NULL && *place <= strlen(buf) && lastwastab != NULL && list != NULL);
|
||||
assert(buf != NULL && place != NULL && *place <= strlen(buf) && lastwastab != NULL && refresh_func != NULL && list != NULL);
|
||||
|
||||
*list = FALSE;
|
||||
|
||||
@@ -2138,7 +2178,8 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list)
|
||||
|
||||
/* Match against files relative to the current working directory. */
|
||||
if (matches == NULL)
|
||||
matches = cwd_tab_completion(buf, &num_matches, *place);
|
||||
matches = cwd_tab_completion(buf, allow_files, &num_matches,
|
||||
*place);
|
||||
|
||||
if (num_matches <= 0)
|
||||
beep();
|
||||
@@ -2279,7 +2320,7 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list)
|
||||
/* Only refresh the edit window if we don't have a list of filename
|
||||
* matches on it. */
|
||||
if (*list == FALSE)
|
||||
edit_refresh();
|
||||
refresh_func();
|
||||
|
||||
/* Enable el cursor. */
|
||||
curs_set(1);
|
||||
@@ -2326,7 +2367,7 @@ void load_history(void)
|
||||
|
||||
/* Assume do_rcfile() has reported a missing home directory. */
|
||||
if (nanohist != NULL) {
|
||||
FILE *hist = fopen(nanohist, "r");
|
||||
FILE *hist = fopen(nanohist, "rb");
|
||||
|
||||
if (hist == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
@@ -2335,7 +2376,7 @@ void load_history(void)
|
||||
rcfile_error(N_("Error reading %s: %s"), nanohist,
|
||||
strerror(errno));
|
||||
fprintf(stderr,
|
||||
_("\nPress Enter to continue starting nano\n"));
|
||||
_("\nPress Enter to continue starting nano.\n"));
|
||||
while (getchar() != '\n')
|
||||
;
|
||||
}
|
||||
|
||||
975
src/global.c
975
src/global.c
File diff suppressed because it is too large
Load Diff
242
src/help.c
242
src/help.c
@@ -3,7 +3,7 @@
|
||||
* help.c *
|
||||
* *
|
||||
* Copyright (C) 2000-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -32,28 +32,29 @@
|
||||
static char *help_text = NULL;
|
||||
/* The text displayed in the help window. */
|
||||
|
||||
/* Our dynamic, shortcut-list-compliant help function. */
|
||||
void do_help(void)
|
||||
/* Our dynamic, shortcut list-compliant help function. refresh_func is
|
||||
* the function we will call to refresh the edit window.*/
|
||||
void do_help(void (*refresh_func)(void))
|
||||
{
|
||||
int line = 0;
|
||||
size_t 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. */
|
||||
size_t last_line = 0;
|
||||
/* The line number in help_text of the last help line. This
|
||||
* variable is zero-based. */
|
||||
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
|
||||
const char *ptr;
|
||||
|
||||
curs_set(0);
|
||||
blank_edit();
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
wattroff(bottomwin, reverse_attr);
|
||||
blank_statusbar();
|
||||
|
||||
/* Set help_text as the string to display. */
|
||||
@@ -76,11 +77,24 @@ void do_help(void)
|
||||
|
||||
bottombars(help_list);
|
||||
|
||||
/* Get the last line of the help text. */
|
||||
ptr = help_text;
|
||||
|
||||
for (; *ptr != '\0'; last_line++) {
|
||||
ptr += help_line_len(ptr);
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
if (last_line > 0)
|
||||
last_line--;
|
||||
|
||||
do {
|
||||
int i;
|
||||
int old_line = line;
|
||||
size_t i;
|
||||
/* Generic loop variable. */
|
||||
size_t old_line = line;
|
||||
/* We redisplay the help only if it moved. */
|
||||
const char *ptr = help_text;
|
||||
|
||||
ptr = help_text;
|
||||
|
||||
switch (kbinput) {
|
||||
#ifndef DISABLE_MOUSE
|
||||
@@ -91,17 +105,17 @@ void do_help(void)
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case NANO_REFRESH_KEY:
|
||||
total_redraw();
|
||||
break;
|
||||
case NANO_PREVPAGE_KEY:
|
||||
case NANO_PREVPAGE_FKEY:
|
||||
if (line > 0) {
|
||||
if (line > editwinrows - 2)
|
||||
line -= editwinrows - 2;
|
||||
if (line < 0)
|
||||
line = 0;
|
||||
}
|
||||
else
|
||||
line = 0;
|
||||
break;
|
||||
case NANO_NEXTPAGE_KEY:
|
||||
case NANO_NEXTPAGE_FKEY:
|
||||
if (!no_more)
|
||||
if (line + (editwinrows - 2) <= last_line)
|
||||
line += editwinrows - 2;
|
||||
break;
|
||||
case NANO_PREVLINE_KEY:
|
||||
@@ -109,20 +123,26 @@ void do_help(void)
|
||||
line--;
|
||||
break;
|
||||
case NANO_NEXTLINE_KEY:
|
||||
if (!no_more)
|
||||
if (line + editwinrows <= last_line)
|
||||
line++;
|
||||
break;
|
||||
case NANO_FIRSTLINE_ALTKEY:
|
||||
if (meta_key)
|
||||
line = 0;
|
||||
break;
|
||||
case NANO_LASTLINE_ALTKEY:
|
||||
if (meta_key) {
|
||||
if (line + (editwinrows - 1) < last_line)
|
||||
line = last_line - (editwinrows - 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (kbinput == NANO_REFRESH_KEY)
|
||||
/* Redraw the screen. */
|
||||
total_redraw();
|
||||
else {
|
||||
if (kbinput != ERR && line == old_line)
|
||||
goto skip_redisplay;
|
||||
if ((kbinput != ERR && line == old_line) || kbinput ==
|
||||
NANO_REFRESH_KEY)
|
||||
goto skip_redisplay;
|
||||
|
||||
blank_edit();
|
||||
}
|
||||
blank_edit();
|
||||
|
||||
/* Calculate where in the text we should be, based on the
|
||||
* page. */
|
||||
@@ -140,11 +160,11 @@ void do_help(void)
|
||||
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);
|
||||
parse_help_input(&kbinput, &meta_key, &func_key);
|
||||
} while (kbinput != NANO_EXIT_KEY);
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
currshortcut = oldshortcut;
|
||||
@@ -159,7 +179,7 @@ void do_help(void)
|
||||
bottombars(currshortcut);
|
||||
|
||||
curs_set(1);
|
||||
edit_refresh();
|
||||
refresh_func();
|
||||
|
||||
/* The help_init() at the beginning allocated help_text. Since
|
||||
* help_text has now been written to the screen, we don't need it
|
||||
@@ -168,6 +188,20 @@ void do_help(void)
|
||||
help_text = NULL;
|
||||
}
|
||||
|
||||
/* Start the help browser for the edit window. */
|
||||
void do_help_void(void)
|
||||
{
|
||||
do_help(&edit_refresh);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
/* Start the help browser for the file browser. */
|
||||
void do_browser_help(void)
|
||||
{
|
||||
do_help(&browser_refresh);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function allocates help_text, and stores the help string in it.
|
||||
* help_text should be NULL initially. */
|
||||
void help_init(void)
|
||||
@@ -256,6 +290,19 @@ void help_init(void)
|
||||
"in the file browser:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
} else if (currshortcut == whereis_file_list) {
|
||||
htx[0] = N_("Browser 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.\n\n");
|
||||
htx[1] = N_(" The following function keys are available in "
|
||||
"Browser Search mode:\n\n");
|
||||
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 "
|
||||
@@ -267,7 +314,7 @@ void help_init(void)
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#ifndef DISABLE_SPELLER
|
||||
else if (currshortcut == spell_list) {
|
||||
htx[0] = N_("Spell Check Help Text\n\n "
|
||||
@@ -277,25 +324,25 @@ void help_init(void)
|
||||
"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 "
|
||||
"the selected text.\n\n The following function keys "
|
||||
"are available in Spell Check mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* !DISABLE_SPELLER */
|
||||
#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 "
|
||||
"This mode 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");
|
||||
"command.\n\n The following function keys are "
|
||||
"available in Execute Command mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_TINY */
|
||||
else {
|
||||
/* Default to the main help list. */
|
||||
htx[0] = N_(" nano help text\n\n "
|
||||
@@ -308,8 +355,8 @@ void help_init(void)
|
||||
"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: "
|
||||
"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. "
|
||||
@@ -336,20 +383,21 @@ void help_init(void)
|
||||
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);
|
||||
/* Count the shortcut help text. Each entry has up to three keys,
|
||||
* which fill 24 columns, plus translated text, plus one or two
|
||||
* \n's. */
|
||||
for (s = currshortcut; s != NULL; s = s->next)
|
||||
allocsize += (24 * mb_cur_max()) + strlen(s->help) + 2;
|
||||
|
||||
#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'. */
|
||||
* Each entry has "M-%c\t\t\t", which fills 24 columns, plus a
|
||||
* space, plus translated text, plus one or two '\n's. */
|
||||
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;
|
||||
allocsize += strlen(t->desc) + endis_len + 9;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -373,8 +421,8 @@ void help_init(void)
|
||||
/* 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. */
|
||||
* not control characters. We can display a maximum of three
|
||||
* shortcut entries. */
|
||||
for (s = currshortcut; s != NULL; s = s->next) {
|
||||
int entries = 0;
|
||||
|
||||
@@ -384,9 +432,22 @@ void help_init(void)
|
||||
/* 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,
|
||||
char *space_ptr = display_string(_("Space"), 0, 14,
|
||||
FALSE);
|
||||
|
||||
if (s->funcval == NANO_NO_KEY && (s->metaval ==
|
||||
NANO_NO_KEY || s->miscval == NANO_NO_KEY)) {
|
||||
/* If we're here, we have at least two entries worth
|
||||
* of blank space. If this entry takes up more than
|
||||
* one entry's worth of space, use two to display
|
||||
* it. */
|
||||
if (mbstrlen(space_ptr) > 6)
|
||||
entries++;
|
||||
} else
|
||||
/* Otherwise, truncate it so that it takes up only
|
||||
* one entry's worth of space. */
|
||||
space_ptr[6] = '\0';
|
||||
|
||||
ptr += sprintf(ptr, "^%s", space_ptr);
|
||||
|
||||
free(space_ptr);
|
||||
@@ -422,9 +483,15 @@ void help_init(void)
|
||||
/* 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,
|
||||
char *space_ptr = display_string(_("Space"), 0, 13,
|
||||
FALSE);
|
||||
|
||||
/* If we're here, we have at least two entries worth of
|
||||
* blank space. If this entry takes up more than one
|
||||
* entry's worth of space, use two to display it. */
|
||||
if (mbstrlen(space_ptr) > 5)
|
||||
entries++;
|
||||
|
||||
ptr += sprintf(ptr, "M-%s", space_ptr);
|
||||
|
||||
free(space_ptr);
|
||||
@@ -447,35 +514,33 @@ void help_init(void)
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
|
||||
/* Make sure all the help text starts at the same place. */
|
||||
while (entries < 3) {
|
||||
entries++;
|
||||
*(ptr++) = '\t';
|
||||
/* If this entry isn't blank, make sure all the help text starts
|
||||
* at the same place. */
|
||||
if (s->ctrlval != NANO_NO_KEY || s->funcval != NANO_NO_KEY ||
|
||||
s->metaval != NANO_NO_KEY || s->miscval !=
|
||||
NANO_NO_KEY) {
|
||||
while (entries < 3) {
|
||||
entries++;
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
}
|
||||
|
||||
assert(s->help != NULL);
|
||||
/* The shortcut's help text. */
|
||||
ptr += sprintf(ptr, "%s\n", s->help);
|
||||
|
||||
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");
|
||||
if (s->blank_after)
|
||||
ptr += sprintf(ptr, "\n");
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* And the toggles... */
|
||||
if (currshortcut == main_list) {
|
||||
for (t = toggles; t != NULL; t = t->next) {
|
||||
ptr += sprintf(ptr, "M-%c\t\t\t%s %s\n",
|
||||
toupper(t->val), t->desc, _("enable/disable"));
|
||||
|
||||
assert(t->desc != NULL);
|
||||
|
||||
ptr += sprintf(ptr, "M-%c\t\t\t%s %s\n", toupper(t->val),
|
||||
t->desc, _("enable/disable"));
|
||||
if (t->blank_after)
|
||||
ptr += sprintf(ptr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,24 +555,51 @@ void help_init(void)
|
||||
assert(strlen(help_text) <= allocsize + 1);
|
||||
}
|
||||
|
||||
/* Determine the shortcut key corresponding to the values of kbinput
|
||||
* (the key itself), meta_key (whether the key is a meta sequence), and
|
||||
* func_key (whether the key is a function key), if any. In the
|
||||
* process, convert certain non-shortcut keys into their corresponding
|
||||
* shortcut keys. */
|
||||
void parse_help_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||
{
|
||||
get_shortcut(help_list, kbinput, meta_key, func_key);
|
||||
|
||||
if (*meta_key == FALSE) {
|
||||
switch (*kbinput) {
|
||||
/* For consistency with the file browser. */
|
||||
case ' ':
|
||||
*kbinput = NANO_NEXTPAGE_KEY;
|
||||
break;
|
||||
case '-':
|
||||
*kbinput = NANO_PREVPAGE_KEY;
|
||||
break;
|
||||
/* Cancel is equivalent to Exit here. */
|
||||
case NANO_CANCEL_KEY:
|
||||
*kbinput = NANO_EXIT_KEY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
int help_cols = (COLS > 24) ? COLS - 1 : 24;
|
||||
|
||||
/* Try to break the line at (COLS - 8) columns if we have more than
|
||||
/* Try to break the line at (COLS - 1) columns if we have more than
|
||||
* 24 columns, and at 24 columns otherwise. */
|
||||
size_t retval = break_line(ptr, help_cols, TRUE);
|
||||
ssize_t wrap_loc = break_line(ptr, help_cols, TRUE);
|
||||
size_t retval = (wrap_loc < 0) ? 0 : wrap_loc;
|
||||
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
|
||||
/* If the entire line doesn't go more than 1 column beyond where we
|
||||
* tried to break it, we should display it as-is. Otherwise, we
|
||||
* should display it only up to the break. */
|
||||
if (strnlenpt(ptr, retval) > help_cols + 8)
|
||||
if (strnlenpt(ptr, retval) > help_cols + 1)
|
||||
retval = retval_save;
|
||||
|
||||
return retval;
|
||||
|
||||
60
src/move.c
60
src/move.c
@@ -3,7 +3,7 @@
|
||||
* move.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -32,8 +32,6 @@ void do_first_line(void)
|
||||
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;
|
||||
@@ -47,8 +45,6 @@ void do_last_line(void)
|
||||
const filestruct *current_save = openfile->current;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
openfile->current = openfile->filebot;
|
||||
openfile->current_x = strlen(openfile->filebot->data);
|
||||
openfile->placewewant = xplustabs();
|
||||
@@ -62,12 +58,6 @@ void do_page_up(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#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. */
|
||||
@@ -103,12 +93,6 @@ void do_page_down(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#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. */
|
||||
@@ -149,8 +133,6 @@ 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;
|
||||
@@ -183,8 +165,6 @@ 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;
|
||||
@@ -233,8 +213,6 @@ bool do_next_word(bool allow_punct, bool allow_update)
|
||||
|
||||
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
|
||||
@@ -331,8 +309,6 @@ bool do_prev_word(bool allow_punct, bool allow_update)
|
||||
|
||||
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
|
||||
@@ -454,14 +430,12 @@ void do_prev_word_void(void)
|
||||
|
||||
/* 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 aren't 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;
|
||||
@@ -490,8 +464,6 @@ void do_end(void)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
@@ -502,12 +474,6 @@ void do_end(void)
|
||||
/* Move up one line. */
|
||||
void do_up(void)
|
||||
{
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
/* If we're at the top of the file, get out. */
|
||||
if (openfile->current == openfile->fileage)
|
||||
return;
|
||||
@@ -542,12 +508,6 @@ void do_up(void)
|
||||
/* 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;
|
||||
@@ -567,12 +527,6 @@ void do_scroll_up(void)
|
||||
/* Move down one line. */
|
||||
void do_down(void)
|
||||
{
|
||||
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;
|
||||
@@ -607,12 +561,6 @@ void do_down(void)
|
||||
/* Scroll down one line without scrolling the cursor. */
|
||||
void do_scroll_down(void)
|
||||
{
|
||||
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;
|
||||
@@ -634,8 +582,6 @@ 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);
|
||||
@@ -655,8 +601,6 @@ void do_right(void)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
assert(openfile->current_x <= strlen(openfile->current->data));
|
||||
|
||||
if (openfile->current->data[openfile->current_x] != '\0')
|
||||
|
||||
396
src/nano.c
396
src/nano.c
@@ -3,7 +3,7 @@
|
||||
* nano.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -30,33 +30,24 @@
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <locale.h>
|
||||
#include <termios.h>
|
||||
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
#include <termios.h>
|
||||
#ifdef ENABLE_NANORC
|
||||
static bool no_rcfiles = FALSE;
|
||||
/* Should we ignore all rcfiles? */
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
|
||||
static struct termios oldterm;
|
||||
/* The user's original terminal settings. */
|
||||
static struct sigaction act;
|
||||
/* For all our fun signal handlers. */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
static sigjmp_buf jmpbuf;
|
||||
/* Used to return to main() after a SIGWINCH. */
|
||||
#endif
|
||||
|
||||
/* Create a new filestruct node. Note that we specifically do not set
|
||||
* prevnode->next equal to the new line. */
|
||||
filestruct *make_new_node(filestruct *prevnode)
|
||||
@@ -166,7 +157,7 @@ void renumber(filestruct *fileptr)
|
||||
{
|
||||
ssize_t line;
|
||||
|
||||
assert(fileptr != NULL && fileptr->prev != NULL);
|
||||
assert(fileptr != NULL);
|
||||
|
||||
line = (fileptr->prev == NULL) ? 0 : fileptr->prev->lineno;
|
||||
|
||||
@@ -540,13 +531,14 @@ void finish(void)
|
||||
blank_statusbar();
|
||||
|
||||
wrefresh(bottomwin);
|
||||
|
||||
endwin();
|
||||
|
||||
/* Restore the old terminal settings. */
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
||||
if (!no_rcfiles && ISSET(HISTORYLOG))
|
||||
save_history();
|
||||
#endif
|
||||
|
||||
@@ -563,7 +555,6 @@ void die(const char *msg, ...)
|
||||
va_list ap;
|
||||
|
||||
endwin();
|
||||
curses_ended = TRUE;
|
||||
|
||||
/* Restore the old terminal settings. */
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
@@ -674,27 +665,40 @@ void window_init(void)
|
||||
}
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
/* Initialize mouse support. */
|
||||
/* Disable mouse support. */
|
||||
void disable_mouse_support(void)
|
||||
{
|
||||
mousemask(0, NULL);
|
||||
}
|
||||
|
||||
/* Enable mouse support. */
|
||||
void enable_mouse_support(void)
|
||||
{
|
||||
mousemask(BUTTON1_RELEASED, NULL);
|
||||
mouseinterval(50);
|
||||
}
|
||||
|
||||
/* Initialize mouse support. Enable it if the USE_MOUSE flag is set,
|
||||
* and disable it otherwise. */
|
||||
void mouse_init(void)
|
||||
{
|
||||
if (ISSET(USE_MOUSE)) {
|
||||
mousemask(BUTTON1_RELEASED, NULL);
|
||||
mouseinterval(50);
|
||||
} else
|
||||
mousemask(0, NULL);
|
||||
if (ISSET(USE_MOUSE))
|
||||
enable_mouse_support();
|
||||
else
|
||||
disable_mouse_support();
|
||||
}
|
||||
#endif
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
#define print1opt(shortflag, longflag, desc) print1opt_full(shortflag, longflag, desc)
|
||||
#define print_opt(shortflag, longflag, desc) print_opt_full(shortflag, longflag, desc)
|
||||
#else
|
||||
#define print1opt(shortflag, longflag, desc) print1opt_full(shortflag, desc)
|
||||
#define print_opt(shortflag, longflag, desc) print_opt_full(shortflag, desc)
|
||||
#endif
|
||||
|
||||
/* Print one usage string to the screen. This cuts down on duplicate
|
||||
* strings to translate, and leaves out the parts that shouldn't be
|
||||
* translatable (the flag names). */
|
||||
void print1opt_full(const char *shortflag
|
||||
void print_opt_full(const char *shortflag
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
, const char *longflag
|
||||
#endif
|
||||
@@ -720,108 +724,111 @@ void print1opt_full(const char *shortflag
|
||||
/* Explain how to properly use nano and its command line options. */
|
||||
void usage(void)
|
||||
{
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
printf(_("Usage: nano [OPTIONS] [[+LINE[,COLUMN]] FILE]...\n\n"));
|
||||
printf(
|
||||
_("Usage: nano [+LINE,COLUMN] [GNU long option] [option] [file]\n\n"));
|
||||
printf(_("Option\t\tLong option\t\tMeaning\n"));
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
_("Option\t\tGNU long option\t\tMeaning\n")
|
||||
#else
|
||||
printf(_("Usage: nano [+LINE,COLUMN] [option] [file]\n\n"));
|
||||
printf(_("Option\t\tMeaning\n"));
|
||||
_("Option\t\tMeaning\n")
|
||||
#endif
|
||||
|
||||
print1opt("-h, -?", "--help", N_("Show this message"));
|
||||
print1opt(_("+LINE,COLUMN"), "",
|
||||
);
|
||||
print_opt("-h, -?", "--help", N_("Show this message"));
|
||||
print_opt(_("+LINE[,COLUMN]"), "",
|
||||
N_("Start at line LINE, column COLUMN"));
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-A", "--smarthome", N_("Enable smart home key"));
|
||||
print1opt("-B", "--backup", N_("Save backups of existing files"));
|
||||
print1opt(_("-C [dir]"), _("--backupdir=[dir]"),
|
||||
print_opt("-A", "--smarthome", N_("Enable smart home key"));
|
||||
print_opt("-B", "--backup", N_("Save backups of existing files"));
|
||||
print_opt(_("-C <dir>"), _("--backupdir=<dir>"),
|
||||
N_("Directory for saving unique backup files"));
|
||||
print1opt("-E", "--tabstospaces",
|
||||
#endif
|
||||
print_opt("-D", "--boldtext",
|
||||
N_("Use bold instead of reverse video text"));
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-E", "--tabstospaces",
|
||||
N_("Convert typed tabs to spaces"));
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
print1opt("-F", "--multibuffer", N_("Enable multiple file buffers"));
|
||||
print_opt("-F", "--multibuffer", N_("Enable multiple file buffers"));
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-H", "--historylog",
|
||||
print_opt("-H", "--historylog",
|
||||
N_("Log & read search/replace string history"));
|
||||
#endif
|
||||
print1opt("-I", "--ignorercfiles",
|
||||
print_opt("-I", "--ignorercfiles",
|
||||
N_("Don't look at nanorc files"));
|
||||
#endif
|
||||
print1opt("-K", "--rebindkeypad",
|
||||
print_opt("-K", "--rebindkeypad",
|
||||
N_("Fix numeric keypad key confusion problem"));
|
||||
print1opt("-L", "--nonewlines",
|
||||
print_opt("-L", "--nonewlines",
|
||||
N_("Don't add newlines to the ends of files"));
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-N", "--noconvert",
|
||||
print_opt("-N", "--noconvert",
|
||||
N_("Don't convert files from DOS/Mac format"));
|
||||
#endif
|
||||
print1opt("-O", "--morespace", N_("Use more space for editing"));
|
||||
print_opt("-O", "--morespace", N_("Use more space for editing"));
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
print1opt(_("-Q [str]"), _("--quotestr=[str]"),
|
||||
print_opt(_("-Q <str>"), _("--quotestr=<str>"),
|
||||
N_("Quoting string"));
|
||||
#endif
|
||||
print1opt("-R", "--restricted", N_("Restricted mode"));
|
||||
print_opt("-R", "--restricted", N_("Restricted mode"));
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-S", "--smooth", N_("Smooth scrolling"));
|
||||
print_opt("-S", "--smooth", N_("Smooth scrolling"));
|
||||
#endif
|
||||
print1opt(_("-T [#cols]"), _("--tabsize=[#cols]"),
|
||||
print_opt(_("-T <#cols>"), _("--tabsize=<#cols>"),
|
||||
N_("Set width of a tab in cols to #cols"));
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-U", "--quickblank", N_("Do quick statusbar blanking"));
|
||||
print_opt("-U", "--quickblank", N_("Do quick statusbar blanking"));
|
||||
#endif
|
||||
print1opt("-V", "--version",
|
||||
print_opt("-V", "--version",
|
||||
N_("Print version information and exit"));
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-W", "--wordbounds",
|
||||
print_opt("-W", "--wordbounds",
|
||||
N_("Detect word boundaries more accurately"));
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
print1opt(_("-Y [str]"), _("--syntax=[str]"),
|
||||
print_opt(_("-Y <str>"), _("--syntax=<str>"),
|
||||
N_("Syntax definition to use"));
|
||||
#endif
|
||||
print1opt("-c", "--const", N_("Constantly show cursor position"));
|
||||
print1opt("-d", "--rebinddelete",
|
||||
print_opt("-c", "--const", N_("Constantly show cursor position"));
|
||||
print_opt("-d", "--rebinddelete",
|
||||
N_("Fix Backspace/Delete confusion problem"));
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-i", "--autoindent",
|
||||
print_opt("-i", "--autoindent",
|
||||
N_("Automatically indent new lines"));
|
||||
print1opt("-k", "--cut", N_("Cut from cursor to end of line"));
|
||||
print_opt("-k", "--cut", N_("Cut from cursor to end of line"));
|
||||
#endif
|
||||
print1opt("-l", "--nofollow",
|
||||
print_opt("-l", "--nofollow",
|
||||
N_("Don't follow symbolic links, overwrite"));
|
||||
#ifndef DISABLE_MOUSE
|
||||
print1opt("-m", "--mouse", N_("Enable mouse"));
|
||||
print_opt("-m", "--mouse", N_("Enable the use of the mouse"));
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
print1opt(_("-o [dir]"), _("--operatingdir=[dir]"),
|
||||
print_opt(_("-o <dir>"), _("--operatingdir=<dir>"),
|
||||
N_("Set operating directory"));
|
||||
#endif
|
||||
print1opt("-p", "--preserve",
|
||||
print_opt("-p", "--preserve",
|
||||
N_("Preserve XON (^Q) and XOFF (^S) keys"));
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
print1opt(_("-r [#cols]"), _("--fill=[#cols]"),
|
||||
print_opt(_("-r <#cols>"), _("--fill=<#cols>"),
|
||||
N_("Set fill cols to (wrap lines at) #cols"));
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
print1opt(_("-s [prog]"), _("--speller=[prog]"),
|
||||
print_opt(_("-s <prog>"), _("--speller=<prog>"),
|
||||
N_("Enable alternate speller"));
|
||||
#endif
|
||||
print1opt("-t", "--tempfile",
|
||||
print_opt("-t", "--tempfile",
|
||||
N_("Auto save on exit, don't prompt"));
|
||||
print1opt("-v", "--view", N_("View (read only) mode"));
|
||||
print_opt("-v", "--view", N_("View (read only) mode"));
|
||||
#ifndef DISABLE_WRAPPING
|
||||
print1opt("-w", "--nowrap", N_("Don't wrap long lines"));
|
||||
print_opt("-w", "--nowrap", N_("Don't wrap long lines"));
|
||||
#endif
|
||||
print1opt("-x", "--nohelp", N_("Don't show help window"));
|
||||
print1opt("-z", "--suspend", N_("Enable suspend"));
|
||||
print_opt("-x", "--nohelp", N_("Don't show the two help lines"));
|
||||
print_opt("-z", "--suspend", N_("Enable suspension"));
|
||||
|
||||
/* This is a special case. */
|
||||
print1opt("-a, -b, -e,", "", NULL);
|
||||
print1opt("-f, -g, -j", "", N_("(ignored, for Pico compatibility)"));
|
||||
print_opt("-a, -b, -e,", "", NULL);
|
||||
print_opt("-f, -g, -j", "", N_("(ignored, for Pico compatibility)"));
|
||||
|
||||
exit(0);
|
||||
}
|
||||
@@ -999,8 +1006,18 @@ RETSIGTYPE handle_hupterm(int signal)
|
||||
/* Handler for SIGTSTP (suspend). */
|
||||
RETSIGTYPE do_suspend(int signal)
|
||||
{
|
||||
endwin();
|
||||
printf("\n\n\n\n\n%s\n", _("Use \"fg\" to return to nano"));
|
||||
#ifndef DISABLE_MOUSE
|
||||
/* Turn mouse support off. */
|
||||
disable_mouse_support();
|
||||
#endif
|
||||
|
||||
/* Blank the screen, and move the cursor to the last line of it. */
|
||||
erase();
|
||||
move(LINES - 1, 0);
|
||||
refresh();
|
||||
|
||||
/* Display our helpful message. */
|
||||
printf(_("Use \"fg\" to return to nano.\n"));
|
||||
fflush(stdout);
|
||||
|
||||
/* Restore the old terminal settings. */
|
||||
@@ -1019,13 +1036,27 @@ RETSIGTYPE do_suspend(int signal)
|
||||
/* Handler for SIGCONT (continue after suspend). */
|
||||
RETSIGTYPE do_continue(int signal)
|
||||
{
|
||||
#ifndef DISABLE_MOUSE
|
||||
/* Turn mouse support back on if it was on before. */
|
||||
if (ISSET(USE_MOUSE))
|
||||
enable_mouse_support();
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Perhaps the user resized the window while we slept. Handle it,
|
||||
* and update the screen in the process. */
|
||||
* and restore the terminal to its previous state and update the
|
||||
* screen in the process. */
|
||||
handle_sigwinch(0);
|
||||
#else
|
||||
/* Reenter curses mode, and update the screen in the process. */
|
||||
doupdate();
|
||||
/* Restore the terminal to its previous state. */
|
||||
terminal_init();
|
||||
|
||||
/* Turn the cursor back on for sure. */
|
||||
curs_set(1);
|
||||
|
||||
/* Redraw the contents of the windows that need it. */
|
||||
blank_statusbar();
|
||||
total_refresh();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1047,10 +1078,10 @@ RETSIGTYPE handle_sigwinch(int signal)
|
||||
if (result == -1)
|
||||
return;
|
||||
|
||||
/* Could check whether the COLS or LINES changed, and return
|
||||
* otherwise. EXCEPT, that COLS and LINES are ncurses global
|
||||
* variables, and in some cases ncurses has already updated them.
|
||||
* But not in all cases, argh. */
|
||||
/* We could check whether the COLS or LINES changed, and return
|
||||
* otherwise. However, COLS and LINES are curses global variables,
|
||||
* and in some cases curses has already updated them. But not in
|
||||
* all cases. Argh. */
|
||||
COLS = win.ws_col;
|
||||
LINES = win.ws_row;
|
||||
|
||||
@@ -1058,16 +1089,6 @@ RETSIGTYPE handle_sigwinch(int signal)
|
||||
if (filepart != NULL)
|
||||
unpartition_filestruct(&filepart);
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* If the justify buffer isn't empty, blow away the text in it and
|
||||
* display the shortcut list with UnCut. */
|
||||
if (jusbuffer != NULL) {
|
||||
free_filestruct(jusbuffer);
|
||||
jusbuffer = NULL;
|
||||
shortcut_init(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLANG
|
||||
/* Slang curses emulation brain damage, part 1: If we just do what
|
||||
* curses does here, it'll only work properly if the resize made the
|
||||
@@ -1098,11 +1119,9 @@ RETSIGTYPE handle_sigwinch(int signal)
|
||||
currshortcut = main_list;
|
||||
total_refresh();
|
||||
|
||||
/* Reset all the input routines that rely on character sequences. */
|
||||
reset_kbinput();
|
||||
|
||||
/* Jump back to the main loop. */
|
||||
siglongjmp(jmpbuf, 1);
|
||||
/* Jump back to either main() or the unjustify routine in
|
||||
* do_justify(). */
|
||||
siglongjmp(jump_buf, 1);
|
||||
}
|
||||
|
||||
/* If allow is TRUE, block any SIGWINCH signals that we get, so that we
|
||||
@@ -1237,13 +1256,32 @@ void enable_flow_control(void)
|
||||
* interpretation of the flow control characters too. */
|
||||
void terminal_init(void)
|
||||
{
|
||||
cbreak();
|
||||
nonl();
|
||||
noecho();
|
||||
disable_extended_io();
|
||||
disable_signals();
|
||||
if (!ISSET(PRESERVE))
|
||||
disable_flow_control();
|
||||
#ifdef USE_SLANG
|
||||
/* Slang curses emulation brain damage, part 2: Slang doesn't
|
||||
* implement nonl() or noecho() properly, so there's no way to
|
||||
* properly reinitialize the terminal using them. We have to save
|
||||
* the terminal state after the first call and restore it on
|
||||
* subsequent calls. */
|
||||
static struct termios newterm;
|
||||
static bool newterm_set = FALSE;
|
||||
|
||||
if (!newterm_set) {
|
||||
#endif
|
||||
|
||||
cbreak();
|
||||
nonl();
|
||||
noecho();
|
||||
disable_extended_io();
|
||||
disable_signals();
|
||||
if (!ISSET(PRESERVE))
|
||||
disable_flow_control();
|
||||
|
||||
#ifdef USE_SLANG
|
||||
tcgetattr(0, &newterm);
|
||||
newterm_set = TRUE;
|
||||
} else
|
||||
tcsetattr(0, TCSANOW, &newterm);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Read in a character, interpret it as a shortcut or toggle if
|
||||
@@ -1264,6 +1302,8 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
/* The input buffer. */
|
||||
static size_t kbinput_len = 0;
|
||||
/* The length of the input buffer. */
|
||||
bool cut_copy = FALSE;
|
||||
/* Are we cutting or copying text? */
|
||||
const shortcut *s;
|
||||
bool have_shortcut;
|
||||
#ifndef NANO_TINY
|
||||
@@ -1279,13 +1319,18 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
input = get_kbinput(edit, meta_key, func_key);
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
/* If we got a mouse click and it was on a shortcut, read in the
|
||||
* shortcut character. */
|
||||
if (allow_funcs && *func_key == TRUE && input == KEY_MOUSE) {
|
||||
if (do_mouse())
|
||||
input = get_kbinput(edit, meta_key, func_key);
|
||||
else
|
||||
input = ERR;
|
||||
if (allow_funcs) {
|
||||
/* If we got a mouse click and it was on a shortcut, read in the
|
||||
* shortcut character. */
|
||||
if (*func_key == TRUE && input == KEY_MOUSE) {
|
||||
if (do_mouse())
|
||||
input = get_kbinput(edit, meta_key, func_key);
|
||||
else {
|
||||
*meta_key = FALSE;
|
||||
*func_key = FALSE;
|
||||
input = ERR;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1313,6 +1358,19 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
#endif
|
||||
);
|
||||
|
||||
/* If we got a non-high-bit control key, a meta key sequence, or a
|
||||
* function key, and it's not a shortcut or toggle, throw it out. */
|
||||
if (*s_or_t == FALSE) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key == TRUE ||
|
||||
*func_key == TRUE) {
|
||||
statusbar(_("Unknown Command"));
|
||||
beep();
|
||||
*meta_key = FALSE;
|
||||
*func_key = FALSE;
|
||||
input = ERR;
|
||||
}
|
||||
}
|
||||
|
||||
if (allow_funcs) {
|
||||
/* If we got a character, and it isn't a shortcut or toggle,
|
||||
* it's a normal text character. Display the warning if we're
|
||||
@@ -1331,10 +1389,19 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
|
||||
/* If we got a shortcut or toggle, or if there aren't any other
|
||||
* characters waiting after the one we read in, we need to
|
||||
* display all the characters in the input buffer if it isn't
|
||||
* output all the characters in the input buffer if it isn't
|
||||
* empty. Note that it should be empty if we're in view
|
||||
* mode. */
|
||||
if (*s_or_t == TRUE || get_key_buffer_len() == 0) {
|
||||
#ifndef DISABLE_WRAPPING
|
||||
/* If we got a shortcut or toggle, and it's not the shortcut
|
||||
* for verbatim input, turn off prepending of wrapped
|
||||
* text. */
|
||||
if (*s_or_t == TRUE && (!have_shortcut || s == NULL ||
|
||||
s->func != do_verbatim_input))
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
if (kbinput != NULL) {
|
||||
/* Display all the characters in the input buffer at
|
||||
* once, filtering out control characters. */
|
||||
@@ -1360,27 +1427,30 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
switch (input) {
|
||||
/* Handle the "universal" edit window shortcuts. */
|
||||
case NANO_XON_KEY:
|
||||
statusbar(_("XON ignored, mumble mumble."));
|
||||
statusbar(_("XON ignored, mumble mumble"));
|
||||
break;
|
||||
case NANO_XOFF_KEY:
|
||||
statusbar(_("XOFF ignored, mumble mumble."));
|
||||
statusbar(_("XOFF ignored, mumble mumble"));
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
case NANO_SUSPEND_KEY:
|
||||
if (ISSET(SUSPEND))
|
||||
do_suspend(0);
|
||||
break;
|
||||
#endif
|
||||
/* Handle the normal edit window shortcuts, setting
|
||||
* ran_func to TRUE if we try to run their associated
|
||||
* functions and setting finished to TRUE to indicate
|
||||
* that we're done after running or trying to run their
|
||||
* associated functions. */
|
||||
default:
|
||||
/* Blow away the text in the cutbuffer if we aren't
|
||||
* cutting text. */
|
||||
if (s->func != do_cut_text)
|
||||
cutbuffer_reset();
|
||||
/* If the function associated with this shortcut is
|
||||
* cutting or copying text, indicate this. */
|
||||
if (s->func == do_cut_text_void
|
||||
#ifndef NANO_TINY
|
||||
|| s->func == do_copy_text || s->func ==
|
||||
do_cut_till_end
|
||||
#endif
|
||||
)
|
||||
cut_copy = TRUE;
|
||||
|
||||
if (s->func != NULL) {
|
||||
*ran_func = TRUE;
|
||||
@@ -1395,20 +1465,18 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
}
|
||||
#ifndef NANO_TINY
|
||||
else if (have_toggle) {
|
||||
/* Blow away the text in the cutbuffer, since we aren't
|
||||
* cutting text. */
|
||||
cutbuffer_reset();
|
||||
/* Toggle the flag associated with this shortcut. */
|
||||
if (allow_funcs)
|
||||
do_toggle(t);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
/* Blow away the text in the cutbuffer, since we aren't
|
||||
* cutting text. */
|
||||
cutbuffer_reset();
|
||||
}
|
||||
|
||||
/* If we aren't cutting or copying text, blow away the text in the
|
||||
* cutbuffer. */
|
||||
if (!cut_copy)
|
||||
cutbuffer_reset();
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
@@ -1464,15 +1532,15 @@ bool do_mouse(void)
|
||||
}
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
|
||||
/* The user typed ouuput_len multibyte characters. Add them to the edit
|
||||
* buffer, filtering out all control characters if allow_cntrls is
|
||||
/* The user typed output_len multibyte characters. Add them to the edit
|
||||
* buffer, filtering out all ASCII control characters if allow_cntrls is
|
||||
* TRUE. */
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
{
|
||||
size_t current_len, i = 0;
|
||||
bool do_refresh = FALSE;
|
||||
/* Do we have to call edit_refresh(), or can we get away with
|
||||
* update_line()? */
|
||||
* just update_line()? */
|
||||
|
||||
char *char_buf = charalloc(mb_cur_max());
|
||||
int char_buf_len;
|
||||
@@ -1483,7 +1551,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
|
||||
while (i < output_len) {
|
||||
/* If allow_cntrls is FALSE, filter out nulls and newlines,
|
||||
* since they're control characters. */
|
||||
* since they're ASCII control characters. */
|
||||
if (allow_cntrls) {
|
||||
/* Null to newline, if needed. */
|
||||
if (output[i] == '\0')
|
||||
@@ -1501,8 +1569,10 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
|
||||
i += char_buf_len;
|
||||
|
||||
/* If allow_cntrls is FALSE, filter out a control character. */
|
||||
if (!allow_cntrls && is_cntrl_mbchar(output + i - char_buf_len))
|
||||
/* If allow_cntrls is FALSE, filter out an ASCII control
|
||||
* character. */
|
||||
if (!allow_cntrls && is_ascii_cntrl_char(*(output + i -
|
||||
char_buf_len)))
|
||||
continue;
|
||||
|
||||
/* If the NO_NEWLINES flag isn't set, when a character is
|
||||
@@ -1588,6 +1658,7 @@ int main(int argc, char **argv)
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
const struct option long_options[] = {
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"boldtext", 0, NULL, 'D'},
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
{"multibuffer", 0, NULL, 'F'},
|
||||
#endif
|
||||
@@ -1654,10 +1725,10 @@ int main(int argc, char **argv)
|
||||
|
||||
if (locale != NULL && (strcasestr(locale, "UTF8") != NULL ||
|
||||
strcasestr(locale, "UTF-8") != NULL)) {
|
||||
SET(USE_UTF8);
|
||||
#ifdef USE_SLANG
|
||||
SLutf8_enable(TRUE);
|
||||
#endif
|
||||
utf8_init();
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -1679,11 +1750,11 @@ int main(int argc, char **argv)
|
||||
while ((optchr =
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
getopt_long(argc, argv,
|
||||
"h?ABC:EFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz",
|
||||
"h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz",
|
||||
long_options, NULL)
|
||||
#else
|
||||
getopt(argc, argv,
|
||||
"h?ABC:EFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz")
|
||||
"h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz")
|
||||
#endif
|
||||
) != -1) {
|
||||
switch (optchr) {
|
||||
@@ -1705,6 +1776,11 @@ int main(int argc, char **argv)
|
||||
case 'C':
|
||||
backup_dir = mallocstrcpy(backup_dir, optarg);
|
||||
break;
|
||||
#endif
|
||||
case 'D':
|
||||
SET(BOLD_TEXT);
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
case 'E':
|
||||
SET(TABS_TO_SPACES);
|
||||
break;
|
||||
@@ -1721,7 +1797,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
#endif
|
||||
case 'I':
|
||||
SET(NO_RCFILE);
|
||||
no_rcfiles = TRUE;
|
||||
break;
|
||||
#endif
|
||||
case 'K':
|
||||
@@ -1753,7 +1829,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
case 'T':
|
||||
if (!parse_num(optarg, &tabsize) || tabsize <= 0) {
|
||||
fprintf(stderr, _("Requested tab size %s invalid"), optarg);
|
||||
fprintf(stderr, _("Requested tab size \"%s\" is invalid"), optarg);
|
||||
fprintf(stderr, "\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -1809,7 +1885,7 @@ int main(int argc, char **argv)
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
case 'r':
|
||||
if (!parse_num(optarg, &wrap_at)) {
|
||||
fprintf(stderr, _("Requested fill size %s invalid"), optarg);
|
||||
fprintf(stderr, _("Requested fill size \"%s\" is invalid"), optarg);
|
||||
fprintf(stderr, "\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -1854,14 +1930,16 @@ int main(int argc, char **argv)
|
||||
if (ISSET(RESTRICTED)) {
|
||||
UNSET(SUSPEND);
|
||||
UNSET(BACKUP_FILE);
|
||||
SET(NO_RCFILE);
|
||||
#ifdef ENABLE_NANORC
|
||||
no_rcfiles = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* We've read through the command line options. Now back up the flags
|
||||
* and values that are set, and read the rcfile(s). If the values
|
||||
* haven't changed afterward, restore the backed-up values. */
|
||||
#ifdef ENABLE_NANORC
|
||||
if (!ISSET(NO_RCFILE)) {
|
||||
if (!no_rcfiles) {
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
char *operating_dir_cpy = operating_dir;
|
||||
#endif
|
||||
@@ -1933,10 +2011,16 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* If we're using bold text instead of reverse video text, set it up
|
||||
* now. */
|
||||
if (ISSET(BOLD_TEXT))
|
||||
reverse_attr = A_BOLD;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Set up the search/replace history. */
|
||||
history_init();
|
||||
#ifdef ENABLE_NANORC
|
||||
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
||||
if (!no_rcfiles && ISSET(HISTORYLOG))
|
||||
load_history();
|
||||
#endif
|
||||
#endif
|
||||
@@ -1958,16 +2042,19 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* If punct wasn't specified, set its default value. */
|
||||
if (punct == NULL)
|
||||
punct = mallocstrcpy(NULL, ".?!");
|
||||
punct = mallocstrcpy(NULL, "!.?");
|
||||
|
||||
/* If brackets wasn't specified, set its default value. */
|
||||
if (brackets == NULL)
|
||||
brackets = mallocstrcpy(NULL, "'\")}]>");
|
||||
brackets = mallocstrcpy(NULL, "\"')>]}");
|
||||
|
||||
/* If quotestr wasn't specified, set its default value. */
|
||||
if (quotestr == NULL)
|
||||
quotestr = mallocstrcpy(NULL,
|
||||
#ifdef HAVE_REGEX_H
|
||||
"^([ \t]*[|>:}#])+"
|
||||
"^([ \t]*[#:>|}])+"
|
||||
#else
|
||||
"> "
|
||||
#endif
|
||||
@@ -2003,6 +2090,12 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If matchbrackets wasn't specified, set its default value. */
|
||||
if (matchbrackets == NULL)
|
||||
matchbrackets = mallocstrcpy(NULL, "(<[{)>]}");
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
/* If whitespace wasn't specified, set its default value. */
|
||||
if (whitespace == NULL) {
|
||||
@@ -2043,6 +2136,7 @@ int main(int argc, char **argv)
|
||||
shortcut_init(FALSE);
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
/* Initialize mouse support. */
|
||||
mouse_init();
|
||||
#endif
|
||||
|
||||
@@ -2119,11 +2213,6 @@ int main(int argc, char **argv)
|
||||
|
||||
display_main_list();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Return here after a SIGWINCH. */
|
||||
sigsetjmp(jmpbuf, 1);
|
||||
#endif
|
||||
|
||||
display_buffer();
|
||||
|
||||
while (TRUE) {
|
||||
@@ -2132,6 +2221,17 @@ int main(int argc, char **argv)
|
||||
/* Make sure the cursor is in the edit window. */
|
||||
reset_cursor();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (!jump_buf_main) {
|
||||
/* If we haven't already, we're going to set jump_buf so
|
||||
* that we return here after a SIGWINCH. Indicate this. */
|
||||
jump_buf_main = TRUE;
|
||||
|
||||
/* Return here after a SIGWINCH. */
|
||||
sigsetjmp(jump_buf, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If constant cursor position display is on, and there are no
|
||||
* keys waiting in the input buffer, display the current cursor
|
||||
* position on the statusbar. */
|
||||
|
||||
375
src/nano.h
375
src/nano.h
@@ -3,7 +3,7 @@
|
||||
* nano.h *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -40,6 +40,10 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
/* Macros for flags. */
|
||||
#define SET(bit) flags |= bit
|
||||
#define UNSET(bit) flags &= ~bit
|
||||
@@ -52,12 +56,6 @@
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
|
||||
|
||||
/* Other macros. */
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#undef regexec
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) safe_regexec(preg, string, nmatch, pmatch, eflags)
|
||||
#endif
|
||||
|
||||
/* Set a default value for PATH_MAX if there isn't one. */
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
@@ -66,7 +64,7 @@
|
||||
#ifdef USE_SLANG
|
||||
/* Slang support. */
|
||||
#include <slcurses.h>
|
||||
/* Slang curses emulation brain damage, part 2: Slang doesn't define the
|
||||
/* Slang curses emulation brain damage, part 3: 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
|
||||
@@ -79,6 +77,7 @@
|
||||
#endif /* CURSES_H */
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
/* Native language support. */
|
||||
#ifdef HAVE_LIBINTL_H
|
||||
#include <libintl.h>
|
||||
#endif
|
||||
@@ -100,6 +99,9 @@
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
/* If no vsnprintf(), use the version from glib 2.x. */
|
||||
@@ -136,8 +138,6 @@
|
||||
#define getline ngetline
|
||||
#endif
|
||||
|
||||
#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
|
||||
@@ -292,6 +292,15 @@ typedef struct openfilestruct {
|
||||
} openfilestruct;
|
||||
|
||||
typedef struct shortcut {
|
||||
const char *desc;
|
||||
/* The function's description, e.g. "Page Up". */
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help;
|
||||
/* The help file entry text for this function. */
|
||||
#endif
|
||||
bool blank_after;
|
||||
/* Whether there should be a blank line after the help entry
|
||||
* text for this function. */
|
||||
/* Key values that aren't used should be set to NANO_NO_KEY. */
|
||||
int ctrlval;
|
||||
/* The special sentinel key or control key we want bound, if
|
||||
@@ -306,12 +315,6 @@ typedef struct shortcut {
|
||||
/* 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;
|
||||
/* The help file entry text for this function. */
|
||||
#endif
|
||||
struct shortcut *next;
|
||||
/* Next shortcut. */
|
||||
} shortcut;
|
||||
@@ -321,8 +324,11 @@ typedef struct toggle {
|
||||
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. */
|
||||
/* The description of the toggle, e.g. "Cut to end"; we'll
|
||||
* append Enabled or Disabled to it. */
|
||||
bool blank_after;
|
||||
/* Whether there should be a blank line after the description of
|
||||
* the toggle. */
|
||||
long flag;
|
||||
/* Which flag actually gets toggled. */
|
||||
struct toggle *next;
|
||||
@@ -341,38 +347,37 @@ typedef struct rcoption {
|
||||
|
||||
/* Bitwise flags so that we can save space (or, more correctly, not
|
||||
* waste it). */
|
||||
#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)
|
||||
#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_COLOR_SYNTAX (1<<19)
|
||||
#define PRESERVE (1<<20)
|
||||
#define HISTORYLOG (1<<21)
|
||||
#define RESTRICTED (1<<22)
|
||||
#define SMART_HOME (1<<23)
|
||||
#define WHITESPACE_DISPLAY (1<<24)
|
||||
#define MORE_SPACE (1<<25)
|
||||
#define TABS_TO_SPACES (1<<26)
|
||||
#define QUICK_BLANK (1<<27)
|
||||
#define WORD_BOUNDS (1<<28)
|
||||
#define NO_NEWLINES (1<<29)
|
||||
#define BOLD_TEXT (1<<30)
|
||||
|
||||
/* Control key sequences. Changing these would be very, very bad. */
|
||||
#define NANO_CONTROL_SPACE 0
|
||||
@@ -409,20 +414,26 @@ typedef struct rcoption {
|
||||
#define NANO_CONTROL_7 31
|
||||
#define NANO_CONTROL_8 127
|
||||
|
||||
/* Meta key sequences. */
|
||||
#define NANO_ALT_SPACE ' '
|
||||
#define NANO_ALT_LPAREN '('
|
||||
#define NANO_ALT_RPAREN ')'
|
||||
#define NANO_ALT_LPARENTHESIS '('
|
||||
#define NANO_ALT_RPARENTHESIS ')'
|
||||
#define NANO_ALT_PLUS '+'
|
||||
#define NANO_ALT_COMMA ','
|
||||
#define NANO_ALT_MINUS '-'
|
||||
#define NANO_ALT_PERIOD '.'
|
||||
#define NANO_ALT_9 '9'
|
||||
#define NANO_ALT_SLASH '/'
|
||||
#define NANO_ALT_0 '0'
|
||||
#define NANO_ALT_LCARAT '<'
|
||||
#define NANO_ALT_6 '6'
|
||||
#define NANO_ALT_9 '9'
|
||||
#define NANO_ALT_LCARET '<'
|
||||
#define NANO_ALT_EQUALS '='
|
||||
#define NANO_ALT_RCARAT '>'
|
||||
#define NANO_ALT_RCARET '>'
|
||||
#define NANO_ALT_QUESTION '?'
|
||||
#define NANO_ALT_BACKSLASH '\\'
|
||||
#define NANO_ALT_RBRACKET ']'
|
||||
#define NANO_ALT_USCORE '_'
|
||||
#define NANO_ALT_CARET '^'
|
||||
#define NANO_ALT_UNDERSCORE '_'
|
||||
#define NANO_ALT_A 'a'
|
||||
#define NANO_ALT_B 'b'
|
||||
#define NANO_ALT_C 'c'
|
||||
@@ -449,131 +460,159 @@ typedef struct rcoption {
|
||||
#define NANO_ALT_X 'x'
|
||||
#define NANO_ALT_Y 'y'
|
||||
#define NANO_ALT_Z 'z'
|
||||
#define NANO_ALT_LCURLYBRACKET '{'
|
||||
#define NANO_ALT_PIPE '|'
|
||||
#define NANO_ALT_RCURLYBRACKET '}'
|
||||
|
||||
/* 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. */
|
||||
|
||||
/* No key at all. */
|
||||
#define NANO_NO_KEY -2
|
||||
#define NANO_NO_KEY -2
|
||||
|
||||
/* Normal keys. */
|
||||
#define NANO_XON_KEY NANO_CONTROL_Q
|
||||
#define NANO_XOFF_KEY NANO_CONTROL_S
|
||||
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
||||
#define NANO_EXIT_KEY NANO_CONTROL_X
|
||||
#define NANO_EXIT_FKEY KEY_F(2)
|
||||
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
||||
#define NANO_INSERTFILE_FKEY KEY_F(5)
|
||||
#define NANO_TOOTHERINSERT_KEY NANO_CONTROL_X
|
||||
#define NANO_WRITEOUT_KEY NANO_CONTROL_O
|
||||
#define NANO_WRITEOUT_FKEY KEY_F(3)
|
||||
#define NANO_GOTOLINE_KEY NANO_CONTROL_7
|
||||
#define NANO_GOTOLINE_FKEY KEY_F(13)
|
||||
#define NANO_GOTOLINE_ALTKEY NANO_ALT_G
|
||||
#define NANO_TOGOTOLINE_KEY NANO_CONTROL_T
|
||||
#define NANO_HELP_KEY NANO_CONTROL_G
|
||||
#define NANO_HELP_FKEY KEY_F(1)
|
||||
#define NANO_WHEREIS_KEY NANO_CONTROL_W
|
||||
#define NANO_WHEREIS_FKEY KEY_F(6)
|
||||
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
|
||||
#define NANO_WHEREIS_NEXT_FKEY KEY_F(16)
|
||||
#define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T
|
||||
#define NANO_REGEXP_KEY NANO_ALT_R
|
||||
#define NANO_REPLACE_KEY NANO_CONTROL_4
|
||||
#define NANO_REPLACE_FKEY KEY_F(14)
|
||||
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
||||
#define NANO_TOOTHERSEARCH_KEY NANO_CONTROL_R
|
||||
#define NANO_PREVPAGE_KEY NANO_CONTROL_Y
|
||||
#define NANO_PREVPAGE_FKEY KEY_F(7)
|
||||
#define NANO_NEXTPAGE_KEY NANO_CONTROL_V
|
||||
#define NANO_NEXTPAGE_FKEY KEY_F(8)
|
||||
#define NANO_CUT_KEY NANO_CONTROL_K
|
||||
#define NANO_CUT_FKEY KEY_F(9)
|
||||
#define NANO_UNCUT_KEY NANO_CONTROL_U
|
||||
#define NANO_UNCUT_FKEY KEY_F(10)
|
||||
#define NANO_CURSORPOS_KEY NANO_CONTROL_C
|
||||
#define NANO_CURSORPOS_FKEY KEY_F(11)
|
||||
#define NANO_SPELL_KEY NANO_CONTROL_T
|
||||
#define NANO_SPELL_FKEY KEY_F(12)
|
||||
#define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY
|
||||
#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY
|
||||
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
||||
#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY
|
||||
#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_PREVLINE_KEY NANO_CONTROL_P
|
||||
#define NANO_NEXTLINE_KEY NANO_CONTROL_N
|
||||
#define NANO_FORWARD_KEY NANO_CONTROL_F
|
||||
#define NANO_BACK_KEY NANO_CONTROL_B
|
||||
#define NANO_MARK_KEY NANO_CONTROL_6
|
||||
#define NANO_MARK_ALTKEY NANO_ALT_A
|
||||
#define NANO_MARK_FKEY KEY_F(15)
|
||||
#define NANO_HOME_KEY NANO_CONTROL_A
|
||||
#define NANO_END_KEY NANO_CONTROL_E
|
||||
#define NANO_DELETE_KEY NANO_CONTROL_D
|
||||
#define NANO_BACKSPACE_KEY NANO_CONTROL_H
|
||||
#define NANO_TAB_KEY NANO_CONTROL_I
|
||||
#define NANO_SUSPEND_KEY NANO_CONTROL_Z
|
||||
#define NANO_ENTER_KEY NANO_CONTROL_M
|
||||
#define NANO_TOFILES_KEY NANO_CONTROL_T
|
||||
#define NANO_APPEND_KEY NANO_ALT_A
|
||||
#define NANO_PREPEND_KEY NANO_ALT_P
|
||||
#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
|
||||
#define NANO_PARABEGIN_ALTKEY1 NANO_ALT_LPAREN
|
||||
#define NANO_PARABEGIN_ALTKEY2 NANO_ALT_9
|
||||
#define NANO_PARAEND_KEY NANO_CONTROL_O
|
||||
#define NANO_PARAEND_ALTKEY1 NANO_ALT_RPAREN
|
||||
#define NANO_PARAEND_ALTKEY2 NANO_ALT_0
|
||||
#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U
|
||||
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||
#define NANO_XON_KEY NANO_CONTROL_Q
|
||||
#define NANO_XOFF_KEY NANO_CONTROL_S
|
||||
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
||||
#define NANO_EXIT_KEY NANO_CONTROL_X
|
||||
#define NANO_EXIT_FKEY KEY_F(2)
|
||||
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
||||
#define NANO_INSERTFILE_FKEY KEY_F(5)
|
||||
#define NANO_TOOTHERINSERT_KEY NANO_CONTROL_X
|
||||
#define NANO_WRITEOUT_KEY NANO_CONTROL_O
|
||||
#define NANO_WRITEOUT_FKEY KEY_F(3)
|
||||
#define NANO_GOTOLINE_KEY NANO_CONTROL_7
|
||||
#define NANO_GOTOLINE_FKEY KEY_F(13)
|
||||
#define NANO_GOTOLINE_ALTKEY NANO_ALT_G
|
||||
#define NANO_GOTODIR_KEY NANO_CONTROL_7
|
||||
#define NANO_GOTODIR_FKEY KEY_F(13)
|
||||
#define NANO_GOTODIR_ALTKEY NANO_ALT_G
|
||||
#define NANO_TOGOTOLINE_KEY NANO_CONTROL_T
|
||||
#define NANO_HELP_KEY NANO_CONTROL_G
|
||||
#define NANO_HELP_FKEY KEY_F(1)
|
||||
#define NANO_WHEREIS_KEY NANO_CONTROL_W
|
||||
#define NANO_WHEREIS_FKEY KEY_F(6)
|
||||
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
|
||||
#define NANO_WHEREIS_NEXT_FKEY KEY_F(16)
|
||||
#define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T
|
||||
#define NANO_REGEXP_KEY NANO_ALT_R
|
||||
#define NANO_REPLACE_KEY NANO_CONTROL_4
|
||||
#define NANO_REPLACE_FKEY KEY_F(14)
|
||||
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
||||
#define NANO_TOOTHERSEARCH_KEY NANO_CONTROL_R
|
||||
#define NANO_PREVPAGE_KEY NANO_CONTROL_Y
|
||||
#define NANO_PREVPAGE_FKEY KEY_F(7)
|
||||
#define NANO_NEXTPAGE_KEY NANO_CONTROL_V
|
||||
#define NANO_NEXTPAGE_FKEY KEY_F(8)
|
||||
#define NANO_CUT_KEY NANO_CONTROL_K
|
||||
#define NANO_CUT_FKEY KEY_F(9)
|
||||
#define NANO_COPY_KEY NANO_ALT_CARET
|
||||
#define NANO_COPY_ALTKEY NANO_ALT_6
|
||||
#define NANO_UNCUT_KEY NANO_CONTROL_U
|
||||
#define NANO_UNCUT_FKEY KEY_F(10)
|
||||
#define NANO_CURSORPOS_KEY NANO_CONTROL_C
|
||||
#define NANO_CURSORPOS_FKEY KEY_F(11)
|
||||
#define NANO_SPELL_KEY NANO_CONTROL_T
|
||||
#define NANO_SPELL_FKEY KEY_F(12)
|
||||
#define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY
|
||||
#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY
|
||||
#define NANO_FIRSTLINE_ALTKEY NANO_ALT_BACKSLASH
|
||||
#define NANO_FIRSTLINE_ALTKEY2 NANO_ALT_PIPE
|
||||
#define NANO_FIRSTFILE_KEY NANO_FIRSTLINE_KEY
|
||||
#define NANO_FIRSTFILE_FKEY NANO_FIRSTLINE_FKEY
|
||||
#define NANO_FIRSTFILE_ALTKEY NANO_FIRSTLINE_ALTKEY
|
||||
#define NANO_FIRSTFILE_ALTKEY2 NANO_FIRSTLINE_ALTKEY2
|
||||
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
||||
#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY
|
||||
#define NANO_LASTLINE_ALTKEY NANO_ALT_SLASH
|
||||
#define NANO_LASTLINE_ALTKEY2 NANO_ALT_QUESTION
|
||||
#define NANO_LASTFILE_KEY NANO_LASTLINE_KEY
|
||||
#define NANO_LASTFILE_FKEY NANO_LASTLINE_FKEY
|
||||
#define NANO_LASTFILE_ALTKEY NANO_LASTLINE_ALTKEY
|
||||
#define NANO_LASTFILE_ALTKEY2 NANO_LASTLINE_ALTKEY2
|
||||
#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
|
||||
#define NANO_UNJUSTIFY_FKEY NANO_UNCUT_FKEY
|
||||
#define NANO_PREVLINE_KEY NANO_CONTROL_P
|
||||
#define NANO_NEXTLINE_KEY NANO_CONTROL_N
|
||||
#define NANO_FORWARD_KEY NANO_CONTROL_F
|
||||
#define NANO_BACK_KEY NANO_CONTROL_B
|
||||
#define NANO_MARK_KEY NANO_CONTROL_6
|
||||
#define NANO_MARK_ALTKEY NANO_ALT_A
|
||||
#define NANO_MARK_FKEY KEY_F(15)
|
||||
#define NANO_HOME_KEY NANO_CONTROL_A
|
||||
#define NANO_END_KEY NANO_CONTROL_E
|
||||
#define NANO_DELETE_KEY NANO_CONTROL_D
|
||||
#define NANO_BACKSPACE_KEY NANO_CONTROL_H
|
||||
#define NANO_TAB_KEY NANO_CONTROL_I
|
||||
#define NANO_INDENTMARKED_KEY NANO_ALT_RCURLYBRACKET
|
||||
#define NANO_UNINDENTMARKED_KEY NANO_ALT_LCURLYBRACKET
|
||||
#define NANO_SUSPEND_KEY NANO_CONTROL_Z
|
||||
#define NANO_ENTER_KEY NANO_CONTROL_M
|
||||
#define NANO_TOFILES_KEY NANO_CONTROL_T
|
||||
#define NANO_APPEND_KEY NANO_ALT_A
|
||||
#define NANO_PREPEND_KEY NANO_ALT_P
|
||||
#define NANO_PREVFILE_KEY NANO_ALT_LCARET
|
||||
#define NANO_PREVFILE_ALTKEY NANO_ALT_COMMA
|
||||
#define NANO_NEXTFILE_KEY NANO_ALT_RCARET
|
||||
#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_UNDERSCORE
|
||||
#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
|
||||
#define NANO_PARABEGIN_ALTKEY NANO_ALT_LPARENTHESIS
|
||||
#define NANO_PARABEGIN_ALTKEY2 NANO_ALT_9
|
||||
#define NANO_PARAEND_KEY NANO_CONTROL_O
|
||||
#define NANO_PARAEND_ALTKEY NANO_ALT_RPARENTHESIS
|
||||
#define NANO_PARAEND_ALTKEY2 NANO_ALT_0
|
||||
#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U
|
||||
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||
|
||||
/* Toggles do not exist if NANO_TINY is defined. */
|
||||
#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
|
||||
#define TOGGLE_NOHELP_KEY NANO_ALT_X
|
||||
#define TOGGLE_MOUSE_KEY NANO_ALT_M
|
||||
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
||||
#define TOGGLE_WRAP_KEY NANO_ALT_L
|
||||
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
||||
#define TOGGLE_CASE_KEY NANO_ALT_C
|
||||
#define TOGGLE_MULTIBUFFER_KEY NANO_ALT_F
|
||||
#define TOGGLE_DOS_KEY NANO_ALT_D
|
||||
#define TOGGLE_MAC_KEY NANO_ALT_M
|
||||
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
||||
#define TOGGLE_NOCONVERT_KEY NANO_ALT_N
|
||||
#define TOGGLE_BACKUP_KEY NANO_ALT_B
|
||||
#define TOGGLE_SYNTAX_KEY NANO_ALT_Y
|
||||
#define TOGGLE_SMARTHOME_KEY NANO_ALT_H
|
||||
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
|
||||
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
|
||||
#define TOGGLE_TABSTOSPACES_KEY NANO_ALT_Q
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#define MAIN_VISIBLE 12
|
||||
/* No toggle at all. */
|
||||
#define TOGGLE_NO_KEY -2
|
||||
|
||||
/* Normal toggles. */
|
||||
#define TOGGLE_NOHELP_KEY NANO_ALT_X
|
||||
#define TOGGLE_CONST_KEY NANO_ALT_C
|
||||
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
|
||||
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
||||
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
|
||||
#define TOGGLE_SYNTAX_KEY NANO_ALT_Y
|
||||
#define TOGGLE_SMARTHOME_KEY NANO_ALT_H
|
||||
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
||||
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
||||
#define TOGGLE_WRAP_KEY NANO_ALT_L
|
||||
#define TOGGLE_TABSTOSPACES_KEY NANO_ALT_Q
|
||||
#define TOGGLE_BACKUP_KEY NANO_ALT_B
|
||||
#define TOGGLE_MULTIBUFFER_KEY NANO_ALT_F
|
||||
#define TOGGLE_MOUSE_KEY NANO_ALT_M
|
||||
#define TOGGLE_NOCONVERT_KEY NANO_ALT_N
|
||||
#define TOGGLE_SUSPEND_KEY NANO_ALT_Z
|
||||
#define TOGGLE_CASE_KEY NANO_ALT_C
|
||||
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
||||
#define TOGGLE_DOS_KEY NANO_ALT_D
|
||||
#define TOGGLE_MAC_KEY NANO_ALT_M
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#define VIEW TRUE
|
||||
#define NOVIEW FALSE
|
||||
|
||||
/* The maximum number of entries displayed in the main shortcut list. */
|
||||
#define MAIN_VISIBLE 12
|
||||
|
||||
/* The minimum editor window columns and rows required for nano to work
|
||||
* correctly. */
|
||||
#define MIN_EDITOR_COLS 4
|
||||
@@ -590,7 +629,7 @@ typedef struct rcoption {
|
||||
* counting the blank lines at their ends. */
|
||||
#define MAX_SEARCH_HISTORY 100
|
||||
|
||||
/* The maximum number of bytes we read from a file at one time. */
|
||||
/* The maximum number of bytes buffered at one time. */
|
||||
#define MAX_BUF_SIZE 128
|
||||
|
||||
#endif /* !NANO_H */
|
||||
|
||||
434
src/prompt.c
434
src/prompt.c
@@ -3,7 +3,7 @@
|
||||
* prompt.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -28,15 +28,14 @@
|
||||
#include <string.h>
|
||||
|
||||
static char *prompt = NULL;
|
||||
/* The prompt string for statusbar
|
||||
* questions. */
|
||||
/* The prompt string for statusbar questions. */
|
||||
static size_t statusbar_x = (size_t)-1;
|
||||
/* The cursor position in answer. */
|
||||
/* The cursor position in answer. */
|
||||
static size_t statusbar_pww = (size_t)-1;
|
||||
/* The place we want in answer. */
|
||||
/* The place we want in answer. */
|
||||
static bool reset_statusbar_x = FALSE;
|
||||
/* Should we reset the cursor position
|
||||
* at the statusbar prompt? */
|
||||
/* Should we reset the cursor position at the statusbar
|
||||
* prompt? */
|
||||
|
||||
/* Read in a character, interpret it as a shortcut or toggle if
|
||||
* necessary, and return it. Set meta_key to TRUE if the character is a
|
||||
@@ -46,9 +45,11 @@ static bool reset_statusbar_x = FALSE;
|
||||
* shortcut key, and set finished to TRUE if we're done after running
|
||||
* or trying to run a function associated with a shortcut key. If
|
||||
* allow_funcs is FALSE, don't actually run any functions associated
|
||||
* with shortcut keys. */
|
||||
* with shortcut keys. refresh_func is the function we will call to
|
||||
* refresh the edit window. */
|
||||
int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
bool *ran_func, bool *finished, bool allow_funcs)
|
||||
bool *ran_func, bool *finished, bool allow_funcs, void
|
||||
(*refresh_func)(void))
|
||||
{
|
||||
int input;
|
||||
/* The character we read in. */
|
||||
@@ -67,13 +68,18 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
input = get_kbinput(bottomwin, meta_key, func_key);
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
/* If we got a mouse click and it was on a shortcut, read in the
|
||||
* shortcut character. */
|
||||
if (allow_funcs && *func_key == TRUE && input == KEY_MOUSE) {
|
||||
if (do_statusbar_mouse())
|
||||
input = get_kbinput(bottomwin, meta_key, func_key);
|
||||
else
|
||||
input = ERR;
|
||||
if (allow_funcs) {
|
||||
/* If we got a mouse click and it was on a shortcut, read in the
|
||||
* shortcut character. */
|
||||
if (*func_key == TRUE && input == KEY_MOUSE) {
|
||||
if (do_statusbar_mouse())
|
||||
input = get_kbinput(bottomwin, meta_key, func_key);
|
||||
else {
|
||||
*meta_key = FALSE;
|
||||
*func_key = FALSE;
|
||||
input = ERR;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -82,27 +88,36 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
|
||||
/* If we got a shortcut from the current list, or a "universal"
|
||||
* statusbar prompt shortcut, set have_shortcut to TRUE. */
|
||||
have_shortcut = (s != NULL || input == NANO_REFRESH_KEY ||
|
||||
input == NANO_HOME_KEY || input == NANO_END_KEY ||
|
||||
input == NANO_BACK_KEY || input == NANO_FORWARD_KEY ||
|
||||
input == NANO_BACKSPACE_KEY || input == NANO_DELETE_KEY ||
|
||||
input == NANO_CUT_KEY ||
|
||||
have_shortcut = (s != NULL || input == NANO_TAB_KEY || input ==
|
||||
NANO_ENTER_KEY || input == NANO_REFRESH_KEY || input ==
|
||||
NANO_HOME_KEY || input == NANO_END_KEY || input ==
|
||||
NANO_BACK_KEY || input == NANO_FORWARD_KEY || input ==
|
||||
NANO_BACKSPACE_KEY || input == NANO_DELETE_KEY || input ==
|
||||
NANO_CUT_KEY ||
|
||||
#ifndef NANO_TINY
|
||||
input == NANO_NEXTWORD_KEY ||
|
||||
input == NANO_NEXTWORD_KEY ||
|
||||
#endif
|
||||
(*meta_key == TRUE && (
|
||||
(*meta_key == TRUE && (
|
||||
#ifndef NANO_TINY
|
||||
input == NANO_PREVWORD_KEY ||
|
||||
input == NANO_PREVWORD_KEY || input == NANO_BRACKET_KEY ||
|
||||
#endif
|
||||
input == NANO_VERBATIM_KEY
|
||||
#ifndef NANO_TINY
|
||||
|| input == NANO_BRACKET_KEY
|
||||
#endif
|
||||
)));
|
||||
input == NANO_VERBATIM_KEY)));
|
||||
|
||||
/* Set s_or_t to TRUE if we got a shortcut. */
|
||||
*s_or_t = have_shortcut;
|
||||
|
||||
/* If we got a non-high-bit control key, a meta key sequence, or a
|
||||
* function key, and it's not a shortcut or toggle, throw it out. */
|
||||
if (*s_or_t == FALSE) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key == TRUE ||
|
||||
*func_key == TRUE) {
|
||||
beep();
|
||||
*meta_key = FALSE;
|
||||
*func_key = FALSE;
|
||||
input = ERR;
|
||||
}
|
||||
}
|
||||
|
||||
if (allow_funcs) {
|
||||
/* If we got a character, and it isn't a shortcut or toggle,
|
||||
* it's a normal text character. Display the warning if we're
|
||||
@@ -152,36 +167,11 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
if (have_shortcut) {
|
||||
switch (input) {
|
||||
/* Handle the "universal" statusbar prompt shortcuts. */
|
||||
case NANO_TAB_KEY:
|
||||
case NANO_ENTER_KEY:
|
||||
break;
|
||||
case NANO_REFRESH_KEY:
|
||||
total_refresh();
|
||||
break;
|
||||
case NANO_HOME_KEY:
|
||||
do_statusbar_home();
|
||||
break;
|
||||
case NANO_END_KEY:
|
||||
do_statusbar_end();
|
||||
break;
|
||||
case NANO_BACK_KEY:
|
||||
do_statusbar_left();
|
||||
break;
|
||||
case NANO_FORWARD_KEY:
|
||||
do_statusbar_right();
|
||||
break;
|
||||
case NANO_BACKSPACE_KEY:
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable Backspace. */
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||
'\0' || currshortcut != writefile_list)
|
||||
do_statusbar_backspace();
|
||||
break;
|
||||
case NANO_DELETE_KEY:
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable Delete. */
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||
'\0' || currshortcut != writefile_list)
|
||||
do_statusbar_delete();
|
||||
total_statusbar_refresh(refresh_func);
|
||||
break;
|
||||
case NANO_CUT_KEY:
|
||||
/* If we're using restricted mode, the filename
|
||||
@@ -191,6 +181,12 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
'\0' || currshortcut != writefile_list)
|
||||
do_statusbar_cut_text();
|
||||
break;
|
||||
case NANO_FORWARD_KEY:
|
||||
do_statusbar_right();
|
||||
break;
|
||||
case NANO_BACK_KEY:
|
||||
do_statusbar_left();
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
case NANO_NEXTWORD_KEY:
|
||||
do_statusbar_next_word(FALSE);
|
||||
@@ -199,6 +195,18 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
if (*meta_key == TRUE)
|
||||
do_statusbar_prev_word(FALSE);
|
||||
break;
|
||||
#endif
|
||||
case NANO_HOME_KEY:
|
||||
do_statusbar_home();
|
||||
break;
|
||||
case NANO_END_KEY:
|
||||
do_statusbar_end();
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
case NANO_BRACKET_KEY:
|
||||
if (*meta_key == TRUE)
|
||||
do_statusbar_find_bracket();
|
||||
break;
|
||||
#endif
|
||||
case NANO_VERBATIM_KEY:
|
||||
if (*meta_key == TRUE) {
|
||||
@@ -223,12 +231,22 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
case NANO_BRACKET_KEY:
|
||||
if (*meta_key == TRUE)
|
||||
do_statusbar_find_bracket();
|
||||
case NANO_DELETE_KEY:
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable Delete. */
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||
'\0' || currshortcut != writefile_list)
|
||||
do_statusbar_delete();
|
||||
break;
|
||||
case NANO_BACKSPACE_KEY:
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable Backspace. */
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||
'\0' || currshortcut != writefile_list)
|
||||
do_statusbar_backspace();
|
||||
break;
|
||||
#endif
|
||||
/* Handle the normal statusbar prompt shortcuts, setting
|
||||
* ran_func to TRUE if we try to run their associated
|
||||
* functions and setting finished to TRUE to indicate
|
||||
@@ -290,7 +308,8 @@ bool do_statusbar_mouse(void)
|
||||
|
||||
/* The user typed output_len multibyte characters. Add them to the
|
||||
* statusbar prompt, setting got_enter to TRUE if we get a newline, and
|
||||
* filtering out all control characters if allow_cntrls is TRUE. */
|
||||
* filtering out all ASCII control characters if allow_cntrls is
|
||||
* TRUE. */
|
||||
void do_statusbar_output(char *output, size_t output_len, bool
|
||||
*got_enter, bool allow_cntrls)
|
||||
{
|
||||
@@ -305,7 +324,7 @@ void do_statusbar_output(char *output, size_t output_len, bool
|
||||
|
||||
while (i < output_len) {
|
||||
/* If allow_cntrls is FALSE, filter out nulls and newlines,
|
||||
* since they're control characters. */
|
||||
* since they're ASCII control characters. */
|
||||
if (allow_cntrls) {
|
||||
/* Null to newline, if needed. */
|
||||
if (output[i] == '\0')
|
||||
@@ -327,8 +346,10 @@ void do_statusbar_output(char *output, size_t output_len, bool
|
||||
|
||||
i += char_buf_len;
|
||||
|
||||
/* If allow_cntrls is FALSE, filter out a control character. */
|
||||
if (!allow_cntrls && is_cntrl_mbchar(output + i - char_buf_len))
|
||||
/* If allow_cntrls is FALSE, filter out an ASCII control
|
||||
* character. */
|
||||
if (!allow_cntrls && is_ascii_cntrl_char(*(output + i -
|
||||
char_buf_len)))
|
||||
continue;
|
||||
|
||||
/* More dangerousness fun =) */
|
||||
@@ -672,7 +693,7 @@ bool find_statusbar_bracket_match(bool reverse, const char
|
||||
{
|
||||
const char *rev_start = NULL, *found = NULL;
|
||||
|
||||
assert(strlen(bracket_set) == 2);
|
||||
assert(mbstrlen(bracket_set) == 2);
|
||||
|
||||
/* rev_start might end up 1 character before the start or after the
|
||||
* end of the line. This won't be a problem because we'll skip over
|
||||
@@ -687,8 +708,8 @@ bool find_statusbar_bracket_match(bool reverse, const char
|
||||
* is found. */
|
||||
found = ((rev_start > answer && *(rev_start - 1) == '\0') ||
|
||||
rev_start < answer) ? NULL : (reverse ?
|
||||
revstrpbrk(answer, bracket_set, rev_start) :
|
||||
strpbrk(rev_start, bracket_set));
|
||||
mbrevstrpbrk(answer, bracket_set, rev_start) :
|
||||
mbstrpbrk(rev_start, bracket_set));
|
||||
|
||||
/* We've found a potential match. */
|
||||
if (found != NULL)
|
||||
@@ -711,48 +732,91 @@ bool find_statusbar_bracket_match(bool reverse, const char
|
||||
void do_statusbar_find_bracket(void)
|
||||
{
|
||||
size_t statusbar_x_save, pww_save;
|
||||
const char *bracket_list = "()<>[]{}";
|
||||
/* The list of brackets we can find matches to. */
|
||||
const char *pos;
|
||||
/* The location in bracket_list of the bracket at the current
|
||||
const char *ch;
|
||||
/* The location in matchbrackets of the bracket at the current
|
||||
* cursor position. */
|
||||
char ch;
|
||||
/* The bracket at the current cursor position. */
|
||||
char wanted_ch;
|
||||
/* The bracket complementing the bracket at the current cursor
|
||||
* position. */
|
||||
char bracket_set[3];
|
||||
int ch_len;
|
||||
/* The length of ch in bytes. */
|
||||
const char *wanted_ch;
|
||||
/* The location in matchbrackets of the bracket complementing
|
||||
* the bracket at the current cursor position. */
|
||||
int wanted_ch_len;
|
||||
/* The length of wanted_ch in bytes. */
|
||||
char *bracket_set;
|
||||
/* The pair of characters in ch and wanted_ch. */
|
||||
size_t i;
|
||||
/* Generic loop variable. */
|
||||
size_t matchhalf;
|
||||
/* The number of single-byte characters in one half of
|
||||
* matchbrackets. */
|
||||
size_t mbmatchhalf;
|
||||
/* The number of multibyte characters in one half of
|
||||
* matchbrackets. */
|
||||
size_t count = 1;
|
||||
/* The initial bracket count. */
|
||||
bool reverse;
|
||||
/* The direction we search. */
|
||||
char *found_ch;
|
||||
/* The character we find. */
|
||||
|
||||
assert(strlen(bracket_list) % 2 == 0);
|
||||
assert(mbstrlen(matchbrackets) % 2 == 0);
|
||||
|
||||
ch = answer[statusbar_x];
|
||||
ch = answer + statusbar_x;
|
||||
|
||||
if (ch == '\0' || (pos = strchr(bracket_list, ch)) == NULL)
|
||||
if (ch == '\0' || (ch = mbstrchr(matchbrackets, ch)) == NULL)
|
||||
return;
|
||||
|
||||
/* Save where we are. */
|
||||
statusbar_x_save = statusbar_x;
|
||||
pww_save = statusbar_pww;
|
||||
|
||||
/* If we're on an opening bracket, we want to search forwards for a
|
||||
* closing bracket, and if we're on a closing bracket, we want to
|
||||
* search backwards for an opening bracket. */
|
||||
reverse = ((pos - bracket_list) % 2 != 0);
|
||||
wanted_ch = reverse ? *(pos - 1) : *(pos + 1);
|
||||
bracket_set[0] = ch;
|
||||
bracket_set[1] = wanted_ch;
|
||||
bracket_set[2] = '\0';
|
||||
/* If we're on an opening bracket, which must be in the first half
|
||||
* of matchbrackets, we want to search forwards for a closing
|
||||
* bracket. If we're on a closing bracket, which must be in the
|
||||
* second half of matchbrackets, we want to search backwards for an
|
||||
* opening bracket. */
|
||||
matchhalf = 0;
|
||||
mbmatchhalf = mbstrlen(matchbrackets) / 2;
|
||||
|
||||
for (i = 0; i < mbmatchhalf; i++)
|
||||
matchhalf += parse_mbchar(matchbrackets + matchhalf, NULL,
|
||||
NULL);
|
||||
|
||||
reverse = ((ch - matchbrackets) >= matchhalf);
|
||||
|
||||
/* If we're on an opening bracket, set wanted_ch to the character
|
||||
* that's matchhalf characters after ch. If we're on a closing
|
||||
* bracket, set wanted_ch to the character that's matchhalf
|
||||
* characters before ch. */
|
||||
wanted_ch = ch;
|
||||
|
||||
while (mbmatchhalf > 0) {
|
||||
if (reverse)
|
||||
wanted_ch = matchbrackets + move_mbleft(matchbrackets,
|
||||
wanted_ch - matchbrackets);
|
||||
else
|
||||
wanted_ch += move_mbright(wanted_ch, 0);
|
||||
|
||||
mbmatchhalf--;
|
||||
}
|
||||
|
||||
ch_len = parse_mbchar(ch, NULL, NULL);
|
||||
wanted_ch_len = parse_mbchar(wanted_ch, NULL, NULL);
|
||||
|
||||
/* Fill bracket_set in with the values of ch and wanted_ch. */
|
||||
bracket_set = charalloc((mb_cur_max() * 2) + 1);
|
||||
strncpy(bracket_set, ch, ch_len);
|
||||
strncpy(bracket_set + ch_len, wanted_ch, wanted_ch_len);
|
||||
null_at(&bracket_set, ch_len + wanted_ch_len);
|
||||
|
||||
found_ch = charalloc(mb_cur_max() + 1);
|
||||
|
||||
while (TRUE) {
|
||||
if (find_statusbar_bracket_match(reverse, bracket_set)) {
|
||||
/* If we found an identical bracket, increment count. If we
|
||||
* found a complementary bracket, decrement it. */
|
||||
count += (answer[statusbar_x] == ch) ? 1 : -1;
|
||||
parse_mbchar(answer + statusbar_x, found_ch, NULL);
|
||||
count += (strncmp(found_ch, ch, ch_len) == 0) ? 1 : -1;
|
||||
|
||||
/* If count is zero, we've found a matching bracket. Update
|
||||
* the statusbar prompt and get out. */
|
||||
@@ -769,6 +833,10 @@ void do_statusbar_find_bracket(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up. */
|
||||
free(bracket_set);
|
||||
free(found_ch);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -794,10 +862,19 @@ size_t get_statusbar_page_start(size_t start_col, size_t column)
|
||||
start_col - 1);
|
||||
}
|
||||
|
||||
/* Put the cursor in the statusbar prompt at statusbar_x. */
|
||||
void reset_statusbar_cursor(void)
|
||||
{
|
||||
size_t start_col = strlenpt(prompt) + 1;
|
||||
size_t xpt = statusbar_xplustabs();
|
||||
|
||||
wmove(bottomwin, 0, start_col + 1 + xpt -
|
||||
get_statusbar_page_start(start_col, start_col + xpt));
|
||||
}
|
||||
|
||||
/* Repaint the statusbar when getting a character in
|
||||
* get_prompt_string(). The statusbar text line will be displayed
|
||||
* starting with curranswer[index]. Assume the A_REVERSE attribute is
|
||||
* turned off. */
|
||||
* starting with curranswer[index]. */
|
||||
void update_statusbar_line(const char *curranswer, size_t index)
|
||||
{
|
||||
size_t start_col, page_start;
|
||||
@@ -809,7 +886,7 @@ void update_statusbar_line(const char *curranswer, size_t index)
|
||||
index = strnlenpt(curranswer, index);
|
||||
page_start = get_statusbar_page_start(start_col, start_col + index);
|
||||
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
wattron(bottomwin, reverse_attr);
|
||||
|
||||
blank_statusbar();
|
||||
|
||||
@@ -824,17 +901,7 @@ void update_statusbar_line(const char *curranswer, size_t index)
|
||||
|
||||
reset_statusbar_cursor();
|
||||
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
}
|
||||
|
||||
/* Put the cursor in the statusbar prompt at statusbar_x. */
|
||||
void reset_statusbar_cursor(void)
|
||||
{
|
||||
size_t start_col = strlenpt(prompt) + 1;
|
||||
size_t xpt = statusbar_xplustabs();
|
||||
|
||||
wmove(bottomwin, 0, start_col + 1 + xpt -
|
||||
get_statusbar_page_start(start_col, start_col + xpt));
|
||||
wattroff(bottomwin, reverse_attr);
|
||||
}
|
||||
|
||||
/* Return TRUE if we need an update after moving horizontally, and FALSE
|
||||
@@ -848,19 +915,31 @@ bool need_statusbar_horizontal_update(size_t old_pww)
|
||||
get_statusbar_page_start(start_col, start_col + statusbar_pww);
|
||||
}
|
||||
|
||||
/* Unconditionally redraw the entire screen, and then refresh it using
|
||||
* refresh_func(). */
|
||||
void total_statusbar_refresh(void (*refresh_func)(void))
|
||||
{
|
||||
total_redraw();
|
||||
refresh_func();
|
||||
}
|
||||
|
||||
/* Get a string of input at the statusbar prompt. This should only be
|
||||
* called from do_prompt(). */
|
||||
int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
int get_prompt_string(bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool allow_files,
|
||||
#endif
|
||||
const char *curranswer,
|
||||
#ifndef NANO_TINY
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const shortcut *s
|
||||
void (*refresh_func)(void), const shortcut *s
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, bool *list
|
||||
#endif
|
||||
)
|
||||
{
|
||||
int kbinput;
|
||||
int kbinput = ERR;
|
||||
bool meta_key, func_key, s_or_t, ran_func, finished;
|
||||
size_t curranswer_len;
|
||||
#ifndef DISABLE_TABCOMP
|
||||
@@ -910,10 +989,9 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
* to files not specified on the command line. In this case,
|
||||
* disable all keys that would change the text if the filename isn't
|
||||
* blank and we're at the "Write File" prompt. */
|
||||
while ((kbinput = do_statusbar_input(&meta_key, &func_key,
|
||||
&s_or_t, &ran_func, &finished, TRUE)) != NANO_CANCEL_KEY &&
|
||||
while ((kbinput = do_statusbar_input(&meta_key, &func_key, &s_or_t,
|
||||
&ran_func, &finished, TRUE, refresh_func)) != NANO_CANCEL_KEY &&
|
||||
kbinput != NANO_ENTER_KEY) {
|
||||
|
||||
assert(statusbar_x <= strlen(answer));
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
@@ -938,8 +1016,8 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
} else
|
||||
#endif /* !NANO_TINY */
|
||||
if (allow_tabs)
|
||||
answer = input_tab(answer, &statusbar_x, &tabbed,
|
||||
list);
|
||||
answer = input_tab(answer, allow_files,
|
||||
&statusbar_x, &tabbed, refresh_func, list);
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
break;
|
||||
@@ -996,9 +1074,27 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
}
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
|
||||
/* This key has a shortcut list entry when it's used
|
||||
* to move to a newer search, which means that
|
||||
* finished has been set to TRUE. Set it back to
|
||||
* FALSE here, so that we aren't kicked out of the
|
||||
* statusbar prompt. */
|
||||
finished = FALSE;
|
||||
}
|
||||
break;
|
||||
#endif /* !NANO_TINY */
|
||||
case NANO_HELP_KEY:
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
|
||||
/* This key has a shortcut list entry when it's used to
|
||||
* go to the help browser or display a message
|
||||
* indicating that help is disabled, which means that
|
||||
* finished has been set to TRUE. Set it back to FALSE
|
||||
* here, so that we aren't kicked out of the statusbar
|
||||
* prompt. */
|
||||
finished = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we have a shortcut with an associated function, break out
|
||||
@@ -1040,16 +1136,23 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
* static prompt, which should be NULL initially, and the answer will be
|
||||
* stored in the answer global. Returns -1 on aborted enter, -2 on a
|
||||
* blank string, and 0 otherwise, the valid shortcut key caught.
|
||||
* curranswer is any editable text that we want to put up by default.
|
||||
* curranswer is any editable text that we want to put up by default,
|
||||
* and refresh_func is the function we want to call to refresh the edit
|
||||
* window.
|
||||
*
|
||||
* The allow_tabs parameter indicates whether we should allow tabs to be
|
||||
* interpreted. */
|
||||
int do_prompt(bool allow_tabs, const shortcut *s, const char
|
||||
*curranswer,
|
||||
* interpreted. The allow_files parameter indicates whether we should
|
||||
* allow all files (as opposed to just directories) to be tab
|
||||
* completed. */
|
||||
int do_prompt(bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool allow_files,
|
||||
#endif
|
||||
const shortcut *s, const char *curranswer,
|
||||
#ifndef NANO_TINY
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const char *msg, ...)
|
||||
void (*refresh_func)(void), const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int retval;
|
||||
@@ -1071,15 +1174,19 @@ int do_prompt(bool allow_tabs, const shortcut *s, const char
|
||||
va_end(ap);
|
||||
null_at(&prompt, actual_x(prompt, COLS - 4));
|
||||
|
||||
retval = get_prompt_string(allow_tabs, curranswer,
|
||||
#ifndef NANO_TINY
|
||||
history_list,
|
||||
#endif
|
||||
s
|
||||
retval = get_prompt_string(allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, &list
|
||||
allow_files,
|
||||
#endif
|
||||
);
|
||||
curranswer,
|
||||
#ifndef NANO_TINY
|
||||
history_list,
|
||||
#endif
|
||||
refresh_func, s
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, &list
|
||||
#endif
|
||||
);
|
||||
|
||||
free(prompt);
|
||||
prompt = NULL;
|
||||
@@ -1109,7 +1216,7 @@ int do_prompt(bool allow_tabs, const shortcut *s, const char
|
||||
* matches on the edit window at this point. Make sure that they're
|
||||
* cleared off. */
|
||||
if (list)
|
||||
edit_refresh();
|
||||
refresh_func();
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
@@ -1138,9 +1245,10 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
/* yesstr, nostr, and allstr are strings of any length. Each string
|
||||
* consists of all single-byte characters accepted as valid
|
||||
* characters for that value. The first value will be the one
|
||||
* displayed in the shortcuts. Translators: if possible, specify
|
||||
* both the shortcuts for your language and English. For example,
|
||||
* in French: "OoYy" for "Oui". */
|
||||
* displayed in the shortcuts. */
|
||||
/* TRANSLATORS: For the next three strings, if possible, specify
|
||||
* the single-byte shortcuts for both your language and English.
|
||||
* For example, in French: "OoYy" for "Oui". */
|
||||
yesstr = _("Yy");
|
||||
nostr = _("Nn");
|
||||
allstr = _("Aa");
|
||||
@@ -1173,12 +1281,12 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
onekey("^C", _("Cancel"), width);
|
||||
}
|
||||
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
wattron(bottomwin, reverse_attr);
|
||||
|
||||
blank_statusbar();
|
||||
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
||||
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
wattroff(bottomwin, reverse_attr);
|
||||
|
||||
/* Refresh the edit window and the statusbar before getting
|
||||
* input. */
|
||||
@@ -1194,24 +1302,23 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
|
||||
kbinput = get_kbinput(bottomwin, &meta_key, &func_key);
|
||||
|
||||
if (kbinput == NANO_REFRESH_KEY) {
|
||||
total_redraw();
|
||||
continue;
|
||||
} else if (kbinput == NANO_CANCEL_KEY)
|
||||
ok = -1;
|
||||
switch (kbinput) {
|
||||
case NANO_CANCEL_KEY:
|
||||
ok = -1;
|
||||
break;
|
||||
#ifndef DISABLE_MOUSE
|
||||
else if (kbinput == KEY_MOUSE) {
|
||||
get_mouseinput(&mouse_x, &mouse_y, FALSE);
|
||||
case KEY_MOUSE:
|
||||
get_mouseinput(&mouse_x, &mouse_y, FALSE);
|
||||
|
||||
if (mouse_x != -1 && mouse_y != -1 && !ISSET(NO_HELP) &&
|
||||
wenclose(bottomwin, mouse_y, mouse_x) &&
|
||||
mouse_x < (width * 2) && mouse_y - (2 -
|
||||
no_more_space()) - editwinrows - 1 >= 0) {
|
||||
int x = mouse_x / width;
|
||||
if (mouse_x != -1 && mouse_y != -1 && !ISSET(NO_HELP) &&
|
||||
wenclose(bottomwin, mouse_y, mouse_x) &&
|
||||
mouse_x < (width * 2) && mouse_y - (2 -
|
||||
no_more_space()) - editwinrows - 1 >= 0) {
|
||||
int x = mouse_x / width;
|
||||
/* Calculate the x-coordinate relative to the
|
||||
* two columns of the Yes/No/All shortcuts in
|
||||
* bottomwin. */
|
||||
int y = mouse_y - (2 - no_more_space()) -
|
||||
int y = mouse_y - (2 - no_more_space()) -
|
||||
editwinrows - 1;
|
||||
/* Calculate the y-coordinate relative to the
|
||||
* beginning of the Yes/No/All shortcuts in
|
||||
@@ -1219,25 +1326,30 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
* edit, and the first line of bottomwin
|
||||
* subtracted out. */
|
||||
|
||||
assert(0 <= x && x <= 1 && 0 <= y && y <= 1);
|
||||
assert(0 <= x && x <= 1 && 0 <= y && y <= 1);
|
||||
|
||||
/* x == 0 means they clicked Yes or No. y == 0 means
|
||||
* Yes or All. */
|
||||
ok = -2 * x * y + x - y + 1;
|
||||
/* x == 0 means they clicked Yes or No. y == 0
|
||||
* means Yes or All. */
|
||||
ok = -2 * x * y + x - y + 1;
|
||||
|
||||
if (ok == 2 && !all)
|
||||
ok = -2;
|
||||
}
|
||||
if (ok == 2 && !all)
|
||||
ok = -2;
|
||||
}
|
||||
break;
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
case NANO_REFRESH_KEY:
|
||||
total_redraw();
|
||||
continue;
|
||||
default:
|
||||
/* Look for the kbinput in the Yes, No and (optionally)
|
||||
* All strings. */
|
||||
if (strchr(yesstr, kbinput) != NULL)
|
||||
ok = 1;
|
||||
else if (strchr(nostr, kbinput) != NULL)
|
||||
ok = 0;
|
||||
else if (all && strchr(allstr, kbinput) != NULL)
|
||||
ok = 2;
|
||||
}
|
||||
#endif
|
||||
/* Look for the kbinput in the Yes, No and (optionally) All
|
||||
* strings. */
|
||||
else if (strchr(yesstr, kbinput) != NULL)
|
||||
ok = 1;
|
||||
else if (strchr(nostr, kbinput) != NULL)
|
||||
ok = 0;
|
||||
else if (all && strchr(allstr, kbinput) != NULL)
|
||||
ok = 2;
|
||||
} while (ok == -2);
|
||||
|
||||
return ok;
|
||||
|
||||
148
src/proto.h
148
src/proto.h
@@ -3,7 +3,7 @@
|
||||
* proto.h *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -27,6 +27,11 @@
|
||||
#include "nano.h"
|
||||
|
||||
/* Public externs. See global.c for descriptions of them. */
|
||||
#ifndef NANO_TINY
|
||||
extern sigjmp_buf jump_buf;
|
||||
extern bool jump_buf_main;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
extern ssize_t fill;
|
||||
extern ssize_t wrap_at;
|
||||
@@ -48,6 +53,10 @@ extern filestruct *jusbuffer;
|
||||
extern partition *filepart;
|
||||
extern openfilestruct *openfile;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
extern char *matchbrackets;
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
extern char *whitespace;
|
||||
extern int whitespace_len[2];
|
||||
@@ -100,6 +109,7 @@ extern shortcut *spell_list;
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
extern shortcut *browser_list;
|
||||
extern shortcut *whereis_file_list;
|
||||
extern shortcut *gotodir_list;
|
||||
#endif
|
||||
|
||||
@@ -127,20 +137,33 @@ extern regex_t search_regexp;
|
||||
extern regmatch_t regmatches[10];
|
||||
#endif
|
||||
|
||||
extern bool curses_ended;
|
||||
extern int reverse_attr;
|
||||
|
||||
extern char *homedir;
|
||||
|
||||
/* 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 browser_init(const char *path, DIR *dir);
|
||||
void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key);
|
||||
void browser_refresh(void);
|
||||
int filesearch_init(void);
|
||||
bool findnextfile(bool no_sameline, size_t begin, const char *needle);
|
||||
void findnextfile_wrap_reset(void);
|
||||
void filesearch_abort(void);
|
||||
void do_filesearch(void);
|
||||
void do_fileresearch(void);
|
||||
void do_first_file(void);
|
||||
void do_last_file(void);
|
||||
void striponedir(char *path);
|
||||
#endif
|
||||
|
||||
/* Public functions in chars.c. */
|
||||
#ifdef ENABLE_UTF8
|
||||
void utf8_init(void);
|
||||
bool using_utf8(void);
|
||||
#endif
|
||||
#ifndef HAVE_ISBLANK
|
||||
bool nisblank(int c);
|
||||
#endif
|
||||
@@ -150,6 +173,7 @@ bool niswblank(wchar_t wc);
|
||||
bool is_byte(int c);
|
||||
bool is_alnum_mbchar(const char *c);
|
||||
bool is_blank_mbchar(const char *c);
|
||||
bool is_ascii_cntrl_char(int c);
|
||||
bool is_cntrl_char(int c);
|
||||
#ifdef ENABLE_UTF8
|
||||
bool is_cntrl_wchar(wchar_t wc);
|
||||
@@ -196,17 +220,20 @@ 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);
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
|
||||
char *mbstrchr(const char *s, const char *c);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
char *mbstrpbrk(const char *s, const char *accept);
|
||||
char *revstrpbrk(const char *s, const char *accept, const char
|
||||
*rev_start);
|
||||
char *mbrevstrpbrk(const char *s, const char *accept, const char
|
||||
*rev_start);
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
char *mbstrchr(const char *s, char *c);
|
||||
#ifdef ENABLE_NANORC
|
||||
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
|
||||
bool has_blank_chars(const char *s);
|
||||
bool has_blank_mbchars(const char *s);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENABLE_UTF8
|
||||
bool is_valid_unicode(wchar_t wc);
|
||||
#endif
|
||||
@@ -227,9 +254,18 @@ void cut_line(void);
|
||||
#ifndef NANO_TINY
|
||||
void cut_marked(void);
|
||||
void cut_to_eol(void);
|
||||
void cut_to_eof(void);
|
||||
#endif
|
||||
void do_cut_text(void);
|
||||
void do_cut_text(
|
||||
#ifndef NANO_TINY
|
||||
bool copy_text, bool cut_till_end
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
);
|
||||
void do_cut_text_void(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_copy_text(void);
|
||||
void do_cut_till_end(void);
|
||||
#endif
|
||||
void do_uncut_text(void);
|
||||
@@ -289,9 +325,10 @@ void free_chararray(char **array, size_t len);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||
size_t buflen);
|
||||
char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
|
||||
buflen);
|
||||
char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
|
||||
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||
*num_matches, size_t buflen);
|
||||
char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
*lastwastab, void (*refresh_func)(void), bool *list);
|
||||
#endif
|
||||
const char *tail(const char *foo);
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
@@ -304,15 +341,16 @@ void save_history(void);
|
||||
/* Public functions in global.c. */
|
||||
size_t length_of_list(const shortcut *s);
|
||||
#ifndef NANO_TINY
|
||||
void toggle_init_one(int val, const char *desc, long flag);
|
||||
void toggle_init_one(int val, const char *desc, bool blank_after, long
|
||||
flag);
|
||||
void toggle_init(void);
|
||||
#endif
|
||||
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||
void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help,
|
||||
#endif
|
||||
int metaval, int funcval, int miscval, bool view, void
|
||||
(*func)(void));
|
||||
bool blank_after, int metaval, int funcval, int miscval, bool
|
||||
view, void (*func)(void));
|
||||
void shortcut_init(bool unjustify);
|
||||
void free_shortcutage(shortcut **shortcutage);
|
||||
#ifdef DEBUG
|
||||
@@ -321,8 +359,13 @@ void thanks_for_all_the_fish(void);
|
||||
|
||||
/* Public functions in help.c. */
|
||||
#ifndef DISABLE_HELP
|
||||
void do_help(void);
|
||||
void do_help(void (*refresh_func)(void));
|
||||
void do_help_void(void);
|
||||
#ifndef DISABLE_BROWSER
|
||||
void do_browser_help(void);
|
||||
#endif
|
||||
void help_init(void);
|
||||
void parse_help_input(int *kbinput, bool *meta_key, bool *func_key);
|
||||
size_t help_line_len(const char *ptr);
|
||||
#endif
|
||||
|
||||
@@ -386,9 +429,11 @@ void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename);
|
||||
void window_init(void);
|
||||
#ifndef DISABLE_MOUSE
|
||||
void disable_mouse_support(void);
|
||||
void enable_mouse_support(void);
|
||||
void mouse_init(void);
|
||||
#endif
|
||||
void print1opt_full(const char *shortflag
|
||||
void print_opt_full(const char *shortflag
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
, const char *longflag
|
||||
#endif
|
||||
@@ -427,7 +472,8 @@ 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);
|
||||
bool *ran_func, bool *finished, bool allow_funcs, void
|
||||
(*refresh_func)(void));
|
||||
#ifndef DISABLE_MOUSE
|
||||
bool do_statusbar_mouse(void);
|
||||
#endif
|
||||
@@ -452,24 +498,32 @@ 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);
|
||||
void update_statusbar_line(const char *curranswer, size_t index);
|
||||
bool need_statusbar_horizontal_update(size_t old_pww);
|
||||
int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
void total_statusbar_refresh(void (*refresh_func)(void));
|
||||
int get_prompt_string(bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool allow_files,
|
||||
#endif
|
||||
const char *curranswer,
|
||||
#ifndef NANO_TINY
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const shortcut *s
|
||||
void (*refresh_func)(void), const shortcut *s
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, bool *list
|
||||
#endif
|
||||
);
|
||||
int do_prompt(bool allow_tabs, const shortcut *s, const char
|
||||
*curranswer,
|
||||
int do_prompt(bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool allow_files,
|
||||
#endif
|
||||
const shortcut *s, const char *curranswer,
|
||||
#ifndef NANO_TINY
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
void (*refresh_func)(void), const char *msg, ...);
|
||||
void do_prompt_abort(void);
|
||||
int do_yesno_prompt(bool all, const char *msg);
|
||||
|
||||
@@ -479,13 +533,18 @@ void rcfile_error(const char *msg, ...);
|
||||
char *parse_next_word(char *ptr);
|
||||
char *parse_argument(char *ptr);
|
||||
#ifdef ENABLE_COLOR
|
||||
short color_to_short(const char *colorname, bool *bright);
|
||||
char *parse_next_regex(char *ptr);
|
||||
bool nregcomp(const char *regex, int eflags);
|
||||
void parse_syntax(char *ptr);
|
||||
void parse_include(char *ptr);
|
||||
short color_to_short(const char *colorname, bool *bright);
|
||||
void parse_colors(char *ptr, bool icase);
|
||||
#endif
|
||||
void parse_rcfile(FILE *rcstream);
|
||||
void parse_rcfile(FILE *rcstream
|
||||
#ifdef ENABLE_COLOR
|
||||
, bool syntax_only
|
||||
#endif
|
||||
);
|
||||
void do_rcfile(void);
|
||||
#endif
|
||||
|
||||
@@ -552,6 +611,11 @@ void do_mark(void);
|
||||
void do_delete(void);
|
||||
void do_backspace(void);
|
||||
void do_tab(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_indent_marked(ssize_t cols);
|
||||
void do_indent_marked_void(void);
|
||||
void do_unindent_marked_void(void);
|
||||
#endif
|
||||
void do_enter(void);
|
||||
#ifndef NANO_TINY
|
||||
RETSIGTYPE cancel_command(int signal);
|
||||
@@ -615,10 +679,6 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
|
||||
#endif
|
||||
#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
|
||||
@@ -644,42 +704,28 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
#endif
|
||||
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_TINY
|
||||
void reset_kbinput(void);
|
||||
#endif
|
||||
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_TINY
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
||||
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_TINY
|
||||
, bool reset
|
||||
int parse_escape_seq_kbinput(int kbinput, bool *ignore_seq);
|
||||
int get_byte_kbinput(int kbinput);
|
||||
#ifdef ENABLE_UTF8
|
||||
long add_unicode_digit(int kbinput, long factor, long *uni);
|
||||
long get_unicode_kbinput(int kbinput);
|
||||
#endif
|
||||
);
|
||||
long get_unicode_kbinput(int kbinput
|
||||
#ifndef NANO_TINY
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
int get_control_kbinput(int kbinput);
|
||||
void unparse_kbinput(char *output, size_t output_len);
|
||||
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
|
||||
|
||||
311
src/rcfile.c
311
src/rcfile.c
@@ -3,7 +3,7 @@
|
||||
* rcfile.c *
|
||||
* *
|
||||
* Copyright (C) 2001-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -33,6 +33,7 @@
|
||||
#ifdef ENABLE_NANORC
|
||||
|
||||
const static rcoption rcopts[] = {
|
||||
{"boldtext", BOLD_TEXT},
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
{"brackets", 0},
|
||||
#endif
|
||||
@@ -81,6 +82,7 @@ const static rcoption rcopts[] = {
|
||||
{"casesensitive", CASE_SENSITIVE},
|
||||
{"cut", CUT_TO_END},
|
||||
{"historylog", HISTORYLOG},
|
||||
{"matchbrackets", 0},
|
||||
{"noconvert", NO_CONVERT},
|
||||
{"quickblank", QUICK_BLANK},
|
||||
{"smarthome", SMART_HOME},
|
||||
@@ -107,7 +109,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 Enter to continue starting up nano. */
|
||||
* make the user hit Enter to continue starting nano. */
|
||||
void rcfile_error(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -144,16 +146,13 @@ char *parse_next_word(char *ptr)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* The keywords operatingdir, backupdir, fill, tabsize, speller, punct,
|
||||
* brackets, quotestr, and whitespace take an argument when set. Among
|
||||
* these, operatingdir, backupdir, speller, punct, brackets, quotestr,
|
||||
* and whitespace have to allow tabs and spaces in the argument. Thus,
|
||||
* if the next word starts with a ", we say it ends with the last " of
|
||||
* the line. Otherwise, the word is interpreted as usual. That is so
|
||||
* the arguments can contain "s too. */
|
||||
/* Parse an argument, with optional quotes, after a keyword that takes
|
||||
* one. If the next word starts with a ", we say that it ends with the
|
||||
* last " of the line. Otherwise, we interpret it as usual, so that the
|
||||
* arguments can contain "'s too. */
|
||||
char *parse_argument(char *ptr)
|
||||
{
|
||||
const char *ptr_bak = ptr;
|
||||
const char *ptr_save = ptr;
|
||||
char *last_quote = NULL;
|
||||
|
||||
assert(ptr != NULL);
|
||||
@@ -172,7 +171,7 @@ char *parse_argument(char *ptr)
|
||||
ptr = NULL;
|
||||
else
|
||||
*ptr++ = '\0';
|
||||
rcfile_error(N_("Argument %s has unterminated \""), ptr_bak);
|
||||
rcfile_error(N_("Argument '%s' has an unterminated \""), ptr_save);
|
||||
} else {
|
||||
*last_quote = '\0';
|
||||
ptr = last_quote + 1;
|
||||
@@ -184,45 +183,6 @@ char *parse_argument(char *ptr)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
/* 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)
|
||||
{
|
||||
short mcolor = -1;
|
||||
|
||||
assert(colorname != NULL && bright != NULL);
|
||||
|
||||
if (strncasecmp(colorname, "bright", 6) == 0) {
|
||||
*bright = TRUE;
|
||||
colorname += 6;
|
||||
}
|
||||
|
||||
if (strcasecmp(colorname, "green") == 0)
|
||||
mcolor = COLOR_GREEN;
|
||||
else if (strcasecmp(colorname, "red") == 0)
|
||||
mcolor = COLOR_RED;
|
||||
else if (strcasecmp(colorname, "blue") == 0)
|
||||
mcolor = COLOR_BLUE;
|
||||
else if (strcasecmp(colorname, "white") == 0)
|
||||
mcolor = COLOR_WHITE;
|
||||
else if (strcasecmp(colorname, "yellow") == 0)
|
||||
mcolor = COLOR_YELLOW;
|
||||
else if (strcasecmp(colorname, "cyan") == 0)
|
||||
mcolor = COLOR_CYAN;
|
||||
else if (strcasecmp(colorname, "magenta") == 0)
|
||||
mcolor = COLOR_MAGENTA;
|
||||
else if (strcasecmp(colorname, "black") == 0)
|
||||
mcolor = COLOR_BLACK;
|
||||
else
|
||||
rcfile_error(N_("Color %s not understood.\n"
|
||||
"Valid colors are \"green\", \"red\", \"blue\",\n"
|
||||
"\"white\", \"yellow\", \"cyan\", \"magenta\" and\n"
|
||||
"\"black\", with the optional prefix \"bright\"\n"
|
||||
"for foreground colors."), colorname);
|
||||
|
||||
return mcolor;
|
||||
}
|
||||
|
||||
/* Parse the next regex string from the line at ptr, and return it. */
|
||||
char *parse_next_regex(char *ptr)
|
||||
{
|
||||
@@ -277,7 +237,7 @@ bool nregcomp(const char *regex, int eflags)
|
||||
void parse_syntax(char *ptr)
|
||||
{
|
||||
const char *fileregptr = NULL, *nameptr = NULL;
|
||||
const syntaxtype *tmpsyntax;
|
||||
syntaxtype *tmpsyntax;
|
||||
exttype *endext = NULL;
|
||||
/* The end of the extensions list for this syntax. */
|
||||
|
||||
@@ -302,11 +262,16 @@ void parse_syntax(char *ptr)
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
/* Search for a duplicate syntax name. If we find one, free it, so
|
||||
* that we always use the last syntax with a given name. */
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcmp(nameptr, tmpsyntax->desc) == 0) {
|
||||
rcfile_error(N_("Duplicate syntax name %s"), nameptr);
|
||||
return;
|
||||
syntaxtype *prev_syntax = tmpsyntax;
|
||||
|
||||
tmpsyntax = tmpsyntax->next;
|
||||
free(prev_syntax);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,6 +346,104 @@ void parse_syntax(char *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
/* Read and parse additional syntax files. */
|
||||
void parse_include(char *ptr)
|
||||
{
|
||||
struct stat rcinfo;
|
||||
FILE *rcstream;
|
||||
char *option, *full_option, *nanorc_save = nanorc;
|
||||
size_t lineno_save = lineno;
|
||||
|
||||
option = ptr;
|
||||
if (*option == '"')
|
||||
option++;
|
||||
ptr = parse_argument(ptr);
|
||||
|
||||
/* Get the specified file's full path. */
|
||||
full_option = get_full_path(option);
|
||||
|
||||
if (full_option == NULL) {
|
||||
rcfile_error(_("Error reading %s: %s"), option, strerror(errno));
|
||||
goto cleanup_include;
|
||||
}
|
||||
|
||||
/* Don't open directories, character files, or block files. */
|
||||
if (stat(nanorc, &rcinfo) != -1) {
|
||||
if (S_ISDIR(rcinfo.st_mode) || S_ISCHR(rcinfo.st_mode) ||
|
||||
S_ISBLK(rcinfo.st_mode)) {
|
||||
rcfile_error(S_ISDIR(rcinfo.st_mode) ?
|
||||
_("\"%s\" is a directory") :
|
||||
_("\"%s\" is a device file"), nanorc);
|
||||
goto cleanup_include;
|
||||
}
|
||||
}
|
||||
|
||||
/* Open the new syntax file. */
|
||||
if ((rcstream = fopen(full_option, "rb")) == NULL) {
|
||||
rcfile_error(_("Error reading %s: %s"), full_option,
|
||||
strerror(errno));
|
||||
goto cleanup_include;
|
||||
}
|
||||
|
||||
/* Use the name and line number position of the new syntax file
|
||||
* while parsing it, so we can know where any errors in it are. */
|
||||
nanorc = full_option;
|
||||
lineno = 0;
|
||||
|
||||
parse_rcfile(rcstream
|
||||
#ifdef ENABLE_COLOR
|
||||
, TRUE
|
||||
#endif
|
||||
);
|
||||
|
||||
/* We're done with the new syntax file. Restore the original
|
||||
* filename and line number position. */
|
||||
nanorc = nanorc_save;
|
||||
lineno = lineno_save;
|
||||
|
||||
cleanup_include:
|
||||
free(full_option);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
short mcolor = -1;
|
||||
|
||||
assert(colorname != NULL && bright != NULL);
|
||||
|
||||
if (strncasecmp(colorname, "bright", 6) == 0) {
|
||||
*bright = TRUE;
|
||||
colorname += 6;
|
||||
}
|
||||
|
||||
if (strcasecmp(colorname, "green") == 0)
|
||||
mcolor = COLOR_GREEN;
|
||||
else if (strcasecmp(colorname, "red") == 0)
|
||||
mcolor = COLOR_RED;
|
||||
else if (strcasecmp(colorname, "blue") == 0)
|
||||
mcolor = COLOR_BLUE;
|
||||
else if (strcasecmp(colorname, "white") == 0)
|
||||
mcolor = COLOR_WHITE;
|
||||
else if (strcasecmp(colorname, "yellow") == 0)
|
||||
mcolor = COLOR_YELLOW;
|
||||
else if (strcasecmp(colorname, "cyan") == 0)
|
||||
mcolor = COLOR_CYAN;
|
||||
else if (strcasecmp(colorname, "magenta") == 0)
|
||||
mcolor = COLOR_MAGENTA;
|
||||
else if (strcasecmp(colorname, "black") == 0)
|
||||
mcolor = COLOR_BLACK;
|
||||
else
|
||||
rcfile_error(N_("Color \"%s\" not understood.\n"
|
||||
"Valid colors are \"green\", \"red\", \"blue\",\n"
|
||||
"\"white\", \"yellow\", \"cyan\", \"magenta\" and\n"
|
||||
"\"black\", with the optional prefix \"bright\"\n"
|
||||
"for foreground colors."), colorname);
|
||||
|
||||
return mcolor;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
@@ -392,6 +455,12 @@ void parse_colors(char *ptr, bool icase)
|
||||
|
||||
assert(ptr != NULL);
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
rcfile_error(
|
||||
N_("Cannot add a color command without a syntax command"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing color name"));
|
||||
return;
|
||||
@@ -413,7 +482,7 @@ void parse_colors(char *ptr, bool icase)
|
||||
}
|
||||
if (strncasecmp(bgcolorname, "bright", 6) == 0) {
|
||||
rcfile_error(
|
||||
N_("Background color %s cannot be bright"),
|
||||
N_("Background color \"%s\" cannot be bright"),
|
||||
bgcolorname);
|
||||
return;
|
||||
}
|
||||
@@ -430,12 +499,6 @@ void parse_colors(char *ptr, bool icase)
|
||||
} else
|
||||
fg = -1;
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
rcfile_error(
|
||||
N_("Cannot add a color directive without a syntax line"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing regex string"));
|
||||
return;
|
||||
@@ -539,9 +602,14 @@ void parse_colors(char *ptr, bool icase)
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
/* Parse the rcfile, once it has been opened successfully at
|
||||
* rcstream. */
|
||||
void parse_rcfile(FILE *rcstream)
|
||||
/* Parse the rcfile, once it has been opened successfully at rcstream,
|
||||
* and close it afterwards. If syntax_only is TRUE, only allow the file
|
||||
* to contain color syntax commands: syntax, color, and icolor. */
|
||||
void parse_rcfile(FILE *rcstream
|
||||
#ifdef ENABLE_COLOR
|
||||
, bool syntax_only
|
||||
#endif
|
||||
)
|
||||
{
|
||||
char *buf = NULL;
|
||||
ssize_t len;
|
||||
@@ -549,10 +617,12 @@ void parse_rcfile(FILE *rcstream)
|
||||
|
||||
while ((len = getline(&buf, &n, rcstream)) > 0) {
|
||||
char *ptr, *keyword, *option;
|
||||
int set = 0, i;
|
||||
int set = 0;
|
||||
size_t i;
|
||||
|
||||
/* Ignore the \n. */
|
||||
buf[len - 1] = '\0';
|
||||
/* Ignore the newline. */
|
||||
if (buf[len - 1] == '\n')
|
||||
buf[len - 1] = '\0';
|
||||
|
||||
lineno++;
|
||||
ptr = buf;
|
||||
@@ -569,20 +639,45 @@ void parse_rcfile(FILE *rcstream)
|
||||
ptr = parse_next_word(ptr);
|
||||
|
||||
/* Try to parse the keyword. */
|
||||
if (strcasecmp(keyword, "set") == 0)
|
||||
set = 1;
|
||||
else if (strcasecmp(keyword, "unset") == 0)
|
||||
set = -1;
|
||||
if (strcasecmp(keyword, "set") == 0) {
|
||||
#ifdef ENABLE_COLOR
|
||||
else if (strcasecmp(keyword, "syntax") == 0)
|
||||
if (syntax_only)
|
||||
rcfile_error(
|
||||
N_("Command \"%s\" not allowed in included file"),
|
||||
keyword);
|
||||
else
|
||||
#endif
|
||||
set = 1;
|
||||
} else if (strcasecmp(keyword, "unset") == 0) {
|
||||
#ifdef ENABLE_COLOR
|
||||
if (syntax_only)
|
||||
rcfile_error(
|
||||
N_("Command \"%s\" not allowed in included file"),
|
||||
keyword);
|
||||
else
|
||||
#endif
|
||||
set = -1;
|
||||
}
|
||||
#ifdef ENABLE_COLOR
|
||||
else if (strcasecmp(keyword, "include") == 0) {
|
||||
if (syntax_only)
|
||||
rcfile_error(
|
||||
N_("Command \"%s\" not allowed in included file"),
|
||||
keyword);
|
||||
else
|
||||
parse_include(ptr);
|
||||
} else if (strcasecmp(keyword, "syntax") == 0) {
|
||||
if (endsyntax != NULL && endcolor == NULL)
|
||||
rcfile_error(N_("Syntax \"%s\" has no color commands"),
|
||||
endsyntax->desc);
|
||||
parse_syntax(ptr);
|
||||
else if (strcasecmp(keyword, "color") == 0)
|
||||
} else if (strcasecmp(keyword, "color") == 0)
|
||||
parse_colors(ptr, FALSE);
|
||||
else if (strcasecmp(keyword, "icolor") == 0)
|
||||
parse_colors(ptr, TRUE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
else
|
||||
rcfile_error(N_("Command %s not understood"), keyword);
|
||||
rcfile_error(N_("Command \"%s\" not understood"), keyword);
|
||||
|
||||
if (set == 0)
|
||||
continue;
|
||||
@@ -607,10 +702,10 @@ void parse_rcfile(FILE *rcstream)
|
||||
SET(rcopts[i].flag);
|
||||
else {
|
||||
/* This option doesn't have a flag, so it takes
|
||||
* an argument. */
|
||||
* an argument. */
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(
|
||||
N_("Option %s requires an argument"),
|
||||
N_("Option \"%s\" requires an argument"),
|
||||
rcopts[i].name);
|
||||
break;
|
||||
}
|
||||
@@ -641,7 +736,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
if (strcasecmp(rcopts[i].name, "fill") == 0) {
|
||||
if (!parse_num(option, &wrap_at)) {
|
||||
rcfile_error(
|
||||
N_("Requested fill size %s invalid"),
|
||||
N_("Requested fill size \"%s\" is invalid"),
|
||||
option);
|
||||
wrap_at = -CHARS_FROM_EOL;
|
||||
} else
|
||||
@@ -649,7 +744,17 @@ void parse_rcfile(FILE *rcstream)
|
||||
} else
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
||||
if (strcasecmp(rcopts[i].name,
|
||||
"matchbrackets") == 0) {
|
||||
matchbrackets = option;
|
||||
if (has_blank_mbchars(matchbrackets)) {
|
||||
rcfile_error(
|
||||
N_("Non-blank characters required"));
|
||||
free(matchbrackets);
|
||||
matchbrackets = NULL;
|
||||
}
|
||||
} else if (strcasecmp(rcopts[i].name,
|
||||
"whitespace") == 0) {
|
||||
whitespace = option;
|
||||
if (mbstrlen(whitespace) != 2 ||
|
||||
strlenpt(whitespace) != 2) {
|
||||
@@ -706,7 +811,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
if (!parse_num(option, &tabsize) ||
|
||||
tabsize <= 0) {
|
||||
rcfile_error(
|
||||
N_("Requested tab size %s invalid"),
|
||||
N_("Requested tab size \"%s\" is invalid"),
|
||||
option);
|
||||
tabsize = -1;
|
||||
} else
|
||||
@@ -720,22 +825,27 @@ void parse_rcfile(FILE *rcstream)
|
||||
} else if (rcopts[i].flag != 0)
|
||||
UNSET(rcopts[i].flag);
|
||||
else
|
||||
rcfile_error(N_("Cannot unset flag %s"),
|
||||
rcfile_error(N_("Cannot unset flag \"%s\""),
|
||||
rcopts[i].name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rcopts[i].name == NULL)
|
||||
rcfile_error(N_("Unknown flag %s"), option);
|
||||
rcfile_error(N_("Unknown flag \"%s\""), option);
|
||||
}
|
||||
|
||||
if (endsyntax != NULL && endcolor == NULL)
|
||||
rcfile_error(N_("Syntax \"%s\" has no color commands"),
|
||||
endsyntax->desc);
|
||||
|
||||
free(buf);
|
||||
fclose(rcstream);
|
||||
lineno = 0;
|
||||
|
||||
if (errors) {
|
||||
errors = FALSE;
|
||||
fprintf(stderr, _("\nPress Enter to continue starting nano\n"));
|
||||
fprintf(stderr,
|
||||
_("\nPress Enter to continue starting nano.\n"));
|
||||
while (getchar() != '\n')
|
||||
;
|
||||
}
|
||||
@@ -744,18 +854,31 @@ void parse_rcfile(FILE *rcstream)
|
||||
}
|
||||
|
||||
/* The main rcfile function. It tries to open the system-wide rcfile,
|
||||
* followed by the local rcfile. */
|
||||
* followed by the current user's rcfile. */
|
||||
void do_rcfile(void)
|
||||
{
|
||||
struct stat rcinfo;
|
||||
FILE *rcstream;
|
||||
|
||||
#ifdef SYSCONFDIR
|
||||
nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");
|
||||
|
||||
/* Don't open directories, character files, or block files. */
|
||||
if (stat(nanorc, &rcinfo) != -1) {
|
||||
if (S_ISDIR(rcinfo.st_mode) || S_ISCHR(rcinfo.st_mode) ||
|
||||
S_ISBLK(rcinfo.st_mode))
|
||||
rcfile_error(S_ISDIR(rcinfo.st_mode) ?
|
||||
_("\"%s\" is a directory") :
|
||||
_("\"%s\" is a device file"), nanorc);
|
||||
}
|
||||
|
||||
/* Try to open the system-wide nanorc. */
|
||||
rcstream = fopen(nanorc, "r");
|
||||
rcstream = fopen(nanorc, "rb");
|
||||
if (rcstream != NULL)
|
||||
parse_rcfile(rcstream);
|
||||
parse_rcfile(rcstream
|
||||
#ifdef ENABLE_COLOR
|
||||
, FALSE
|
||||
#endif
|
||||
);
|
||||
|
||||
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
|
||||
/* We've already read SYSCONFDIR/nanorc, if it's there. If we're
|
||||
@@ -772,15 +895,29 @@ void do_rcfile(void)
|
||||
else {
|
||||
nanorc = charealloc(nanorc, strlen(homedir) + 9);
|
||||
sprintf(nanorc, "%s/.nanorc", homedir);
|
||||
rcstream = fopen(nanorc, "r");
|
||||
|
||||
/* Don't open directories, character files, or block files. */
|
||||
if (stat(nanorc, &rcinfo) != -1) {
|
||||
if (S_ISDIR(rcinfo.st_mode) || S_ISCHR(rcinfo.st_mode) ||
|
||||
S_ISBLK(rcinfo.st_mode))
|
||||
rcfile_error(S_ISDIR(rcinfo.st_mode) ?
|
||||
_("\"%s\" is a directory") :
|
||||
_("\"%s\" is a device file"), nanorc);
|
||||
}
|
||||
|
||||
/* Try to open the current user's nanorc. */
|
||||
rcstream = fopen(nanorc, "rb");
|
||||
if (rcstream == NULL) {
|
||||
/* Don't complain about the file's not existing. */
|
||||
if (errno != ENOENT)
|
||||
rcfile_error(N_("Error reading %s: %s"), nanorc,
|
||||
strerror(errno));
|
||||
} else
|
||||
parse_rcfile(rcstream);
|
||||
parse_rcfile(rcstream
|
||||
#ifdef ENABLE_COLOR
|
||||
, FALSE
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
free(nanorc);
|
||||
|
||||
213
src/search.c
213
src/search.c
@@ -3,7 +3,7 @@
|
||||
* search.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -123,11 +123,11 @@ void search_init_globals(void)
|
||||
}
|
||||
|
||||
/* Set up the system variables for a search or replace. If use_answer
|
||||
* is TRUE, only set backupstring to answer. Return -2 to run opposite
|
||||
* program (search -> replace, replace -> search), return -1 if the
|
||||
* search should be canceled (due to Cancel, Go to Line, or a failed
|
||||
* regcomp()), return 0 on success, and return 1 on rerun calling
|
||||
* program.
|
||||
* is TRUE, only set backupstring to answer. Return -2 to run the
|
||||
* opposite program (search -> replace, replace -> search), return -1 if
|
||||
* the search should be canceled (due to Cancel, a blank search string,
|
||||
* Go to Line, or a failed regcomp()), return 0 on success, and return 1
|
||||
* on rerun calling program.
|
||||
*
|
||||
* replacing is TRUE if we call from do_replace(), and FALSE if called
|
||||
* from do_search(). */
|
||||
@@ -168,41 +168,37 @@ int search_init(bool replacing, bool use_answer)
|
||||
buf = mallocstrcpy(NULL, "");
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
i = do_prompt(FALSE, replacing ? replace_list : whereis_list,
|
||||
backupstring,
|
||||
i = do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
replacing ? replace_list : whereis_list, backupstring,
|
||||
#ifndef NANO_TINY
|
||||
&search_history,
|
||||
#endif
|
||||
"%s%s%s%s%s%s", _("Search"),
|
||||
|
||||
edit_refresh, "%s%s%s%s%s%s", _("Search"),
|
||||
#ifndef NANO_TINY
|
||||
/* This string is just a modifier for the search prompt; no
|
||||
* grammar is implied. */
|
||||
/* TRANSLATORS: This string is just a modifier for the search
|
||||
* prompt; no grammar is implied. */
|
||||
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") :
|
||||
#endif
|
||||
"",
|
||||
|
||||
"",
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* This string is just a modifier for the search prompt; no
|
||||
* grammar is implied. */
|
||||
/* TRANSLATORS: This string is just a modifier for the search
|
||||
* prompt; no grammar is implied. */
|
||||
ISSET(USE_REGEXP) ? _(" [Regexp]") :
|
||||
#endif
|
||||
"",
|
||||
|
||||
"",
|
||||
#ifndef NANO_TINY
|
||||
/* This string is just a modifier for the search prompt; no
|
||||
* grammar is implied. */
|
||||
/* TRANSLATORS: This string is just a modifier for the search
|
||||
* prompt; no grammar is implied. */
|
||||
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") :
|
||||
#endif
|
||||
"",
|
||||
|
||||
replacing ?
|
||||
"", replacing ?
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark_set ? _(" (to replace) in selection") :
|
||||
openfile->mark_set ? _(" (to replace) in selection") :
|
||||
#endif
|
||||
_(" (to replace)") : "",
|
||||
|
||||
buf);
|
||||
_(" (to replace)") : "", buf);
|
||||
|
||||
/* Release buf now that we don't need it anymore. */
|
||||
free(buf);
|
||||
@@ -273,25 +269,25 @@ bool findnextstr(
|
||||
bool no_sameline, const filestruct *begin, size_t begin_x, const
|
||||
char *needle, size_t *needle_len)
|
||||
{
|
||||
filestruct *fileptr = openfile->current;
|
||||
const char *rev_start = NULL, *found = NULL;
|
||||
size_t found_len;
|
||||
/* The length of the match we found. */
|
||||
/* The length of the match we find. */
|
||||
size_t current_x_find = 0;
|
||||
/* The location in the current line of the match we found. */
|
||||
/* The location in the current line of the match we find. */
|
||||
ssize_t current_y_find = openfile->current_y;
|
||||
filestruct *fileptr = openfile->current;
|
||||
const char *rev_start = fileptr->data, *found = NULL;
|
||||
|
||||
/* rev_start might end up 1 character before the start or after the
|
||||
* end of the line. This won't be a problem because strstrwrapper()
|
||||
* will return immediately and say that no match was found, and
|
||||
* rev_start will be properly set when the search continues on the
|
||||
* previous or next line. */
|
||||
rev_start =
|
||||
rev_start +=
|
||||
#ifndef NANO_TINY
|
||||
ISSET(BACKWARDS_SEARCH) ?
|
||||
fileptr->data + (openfile->current_x - 1) :
|
||||
openfile->current_x - 1 :
|
||||
#endif
|
||||
fileptr->data + (openfile->current_x + 1);
|
||||
openfile->current_x + 1;
|
||||
|
||||
/* Look for needle in the current line we're searching. */
|
||||
while (TRUE) {
|
||||
@@ -343,6 +339,7 @@ bool findnextstr(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Move to the previous or next line in the file. */
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
fileptr = fileptr->prev;
|
||||
@@ -428,19 +425,18 @@ void do_search(void)
|
||||
int i;
|
||||
bool didfind;
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
i = search_init(FALSE, FALSE);
|
||||
if (i == -1) /* Cancel, Go to Line, blank search string, or
|
||||
* regcomp() failed. */
|
||||
|
||||
if (i == -1)
|
||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
||||
* failed. */
|
||||
search_replace_abort();
|
||||
else if (i == -2) /* Replace. */
|
||||
else if (i == -2)
|
||||
/* Replace. */
|
||||
do_replace();
|
||||
#if !defined(NANO_TINY) || defined(HAVE_REGEX_H)
|
||||
else if (i == 1) /* Case Sensitive, Backwards, or Regexp search
|
||||
* toggle. */
|
||||
else if (i == 1)
|
||||
/* Case Sensitive, Backwards, or Regexp search toggle. */
|
||||
do_search();
|
||||
#endif
|
||||
|
||||
@@ -510,10 +506,6 @@ void do_research(void)
|
||||
size_t old_pww = openfile->placewewant;
|
||||
bool didfind;
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
search_init_globals();
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
@@ -891,15 +883,17 @@ void do_replace(void)
|
||||
}
|
||||
|
||||
i = search_init(TRUE, FALSE);
|
||||
if (i == -1) { /* Cancel, Go to Line, blank search
|
||||
* string, or regcomp() failed. */
|
||||
if (i == -1) {
|
||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
||||
* failed. */
|
||||
search_replace_abort();
|
||||
return;
|
||||
} else if (i == -2) { /* No Replace. */
|
||||
} else if (i == -2) {
|
||||
/* No Replace. */
|
||||
do_search();
|
||||
return;
|
||||
} else if (i == 1) /* Case Sensitive, Backwards, or Regexp
|
||||
* search toggle. */
|
||||
} else if (i == 1)
|
||||
/* Case Sensitive, Backwards, or Regexp search toggle. */
|
||||
do_replace();
|
||||
|
||||
if (i != 0)
|
||||
@@ -916,11 +910,15 @@ void do_replace(void)
|
||||
|
||||
last_replace = mallocstrcpy(last_replace, "");
|
||||
|
||||
i = do_prompt(FALSE, replace_list_2, last_replace,
|
||||
i = do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
replace_list_2, last_replace,
|
||||
#ifndef NANO_TINY
|
||||
&replace_history,
|
||||
#endif
|
||||
_("Replace with"));
|
||||
edit_refresh, _("Replace with"));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Add this replace string to the replace history list. i == 0
|
||||
@@ -980,11 +978,15 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
char *ans = mallocstrcpy(NULL, answer);
|
||||
|
||||
/* Ask for it. */
|
||||
int i = do_prompt(FALSE, gotoline_list, use_answer ? ans : "",
|
||||
int i = do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
gotoline_list, use_answer ? ans : "",
|
||||
#ifndef NANO_TINY
|
||||
NULL,
|
||||
#endif
|
||||
_("Enter line number, column number"));
|
||||
edit_refresh, _("Enter line number, column number"));
|
||||
|
||||
free(ans);
|
||||
|
||||
@@ -1076,7 +1078,7 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
const char *rev_start = NULL, *found = NULL;
|
||||
ssize_t current_y_find = openfile->current_y;
|
||||
|
||||
assert(strlen(bracket_set) == 2);
|
||||
assert(mbstrlen(bracket_set) == 2);
|
||||
|
||||
/* rev_start might end up 1 character before the start or after the
|
||||
* end of the line. This won't be a problem because we'll skip over
|
||||
@@ -1091,8 +1093,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
while (TRUE) {
|
||||
found = ((rev_start > fileptr->data && *(rev_start - 1) ==
|
||||
'\0') || rev_start < fileptr->data) ? NULL : (reverse ?
|
||||
revstrpbrk(fileptr->data, bracket_set, rev_start) :
|
||||
strpbrk(rev_start, bracket_set));
|
||||
mbrevstrpbrk(fileptr->data, bracket_set, rev_start) :
|
||||
mbstrpbrk(rev_start, bracket_set));
|
||||
|
||||
/* We've found a potential match. */
|
||||
if (found != NULL)
|
||||
@@ -1130,28 +1132,38 @@ void do_find_bracket(void)
|
||||
{
|
||||
filestruct *current_save;
|
||||
size_t current_x_save, pww_save;
|
||||
const char *bracket_list = "()<>[]{}";
|
||||
/* The list of brackets we can find matches to. */
|
||||
const char *pos;
|
||||
/* The location in bracket_list of the bracket at the current
|
||||
const char *ch;
|
||||
/* The location in matchbrackets of the bracket at the current
|
||||
* cursor position. */
|
||||
char ch;
|
||||
/* The bracket at the current cursor position. */
|
||||
char wanted_ch;
|
||||
/* The bracket complementing the bracket at the current cursor
|
||||
* position. */
|
||||
char bracket_set[3];
|
||||
int ch_len;
|
||||
/* The length of ch in bytes. */
|
||||
const char *wanted_ch;
|
||||
/* The location in matchbrackets of the bracket complementing
|
||||
* the bracket at the current cursor position. */
|
||||
int wanted_ch_len;
|
||||
/* The length of wanted_ch in bytes. */
|
||||
char *bracket_set;
|
||||
/* The pair of characters in ch and wanted_ch. */
|
||||
size_t i;
|
||||
/* Generic loop variable. */
|
||||
size_t matchhalf;
|
||||
/* The number of single-byte characters in one half of
|
||||
* matchbrackets. */
|
||||
size_t mbmatchhalf;
|
||||
/* The number of multibyte characters in one half of
|
||||
* matchbrackets. */
|
||||
size_t count = 1;
|
||||
/* The initial bracket count. */
|
||||
bool reverse;
|
||||
/* The direction we search. */
|
||||
char *found_ch;
|
||||
/* The character we find. */
|
||||
|
||||
assert(strlen(bracket_list) % 2 == 0);
|
||||
assert(mbstrlen(matchbrackets) % 2 == 0);
|
||||
|
||||
ch = openfile->current->data[openfile->current_x];
|
||||
ch = openfile->current->data + openfile->current_x;
|
||||
|
||||
if (ch == '\0' || (pos = strchr(bracket_list, ch)) == NULL) {
|
||||
if (ch == '\0' || (ch = mbstrchr(matchbrackets, ch)) == NULL) {
|
||||
statusbar(_("Not a bracket"));
|
||||
return;
|
||||
}
|
||||
@@ -1161,21 +1173,54 @@ void do_find_bracket(void)
|
||||
current_x_save = openfile->current_x;
|
||||
pww_save = openfile->placewewant;
|
||||
|
||||
/* If we're on an opening bracket, we want to search forwards for a
|
||||
* closing bracket, and if we're on a closing bracket, we want to
|
||||
* search backwards for an opening bracket. */
|
||||
reverse = ((pos - bracket_list) % 2 != 0);
|
||||
wanted_ch = reverse ? *(pos - 1) : *(pos + 1);
|
||||
bracket_set[0] = ch;
|
||||
bracket_set[1] = wanted_ch;
|
||||
bracket_set[2] = '\0';
|
||||
/* If we're on an opening bracket, which must be in the first half
|
||||
* of matchbrackets, we want to search forwards for a closing
|
||||
* bracket. If we're on a closing bracket, which must be in the
|
||||
* second half of matchbrackets, we want to search backwards for an
|
||||
* opening bracket. */
|
||||
matchhalf = 0;
|
||||
mbmatchhalf = mbstrlen(matchbrackets) / 2;
|
||||
|
||||
for (i = 0; i < mbmatchhalf; i++)
|
||||
matchhalf += parse_mbchar(matchbrackets + matchhalf, NULL,
|
||||
NULL);
|
||||
|
||||
reverse = ((ch - matchbrackets) >= matchhalf);
|
||||
|
||||
/* If we're on an opening bracket, set wanted_ch to the character
|
||||
* that's matchhalf characters after ch. If we're on a closing
|
||||
* bracket, set wanted_ch to the character that's matchhalf
|
||||
* characters before ch. */
|
||||
wanted_ch = ch;
|
||||
|
||||
while (mbmatchhalf > 0) {
|
||||
if (reverse)
|
||||
wanted_ch = matchbrackets + move_mbleft(matchbrackets,
|
||||
wanted_ch - matchbrackets);
|
||||
else
|
||||
wanted_ch += move_mbright(wanted_ch, 0);
|
||||
|
||||
mbmatchhalf--;
|
||||
}
|
||||
|
||||
ch_len = parse_mbchar(ch, NULL, NULL);
|
||||
wanted_ch_len = parse_mbchar(wanted_ch, NULL, NULL);
|
||||
|
||||
/* Fill bracket_set in with the values of ch and wanted_ch. */
|
||||
bracket_set = charalloc((mb_cur_max() * 2) + 1);
|
||||
strncpy(bracket_set, ch, ch_len);
|
||||
strncpy(bracket_set + ch_len, wanted_ch, wanted_ch_len);
|
||||
null_at(&bracket_set, ch_len + wanted_ch_len);
|
||||
|
||||
found_ch = charalloc(mb_cur_max() + 1);
|
||||
|
||||
while (TRUE) {
|
||||
if (find_bracket_match(reverse, bracket_set)) {
|
||||
/* If we found an identical bracket, increment count. If we
|
||||
* found a complementary bracket, decrement it. */
|
||||
count += (openfile->current->data[openfile->current_x] ==
|
||||
ch) ? 1 : -1;
|
||||
parse_mbchar(openfile->current->data + openfile->current_x,
|
||||
found_ch, NULL);
|
||||
count += (strncmp(found_ch, ch, ch_len) == 0) ? 1 : -1;
|
||||
|
||||
/* If count is zero, we've found a matching bracket. Update
|
||||
* the screen and get out. */
|
||||
@@ -1193,6 +1238,10 @@ void do_find_bracket(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up. */
|
||||
free(bracket_set);
|
||||
free(found_ch);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
|
||||
280
src/text.c
280
src/text.c
@@ -3,7 +3,7 @@
|
||||
* text.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -68,7 +68,7 @@ void do_delete(void)
|
||||
{
|
||||
bool do_refresh = FALSE;
|
||||
/* Do we have to call edit_refresh(), or can we get away with
|
||||
* update_line()? */
|
||||
* just update_line()? */
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL && openfile->current_x <= strlen(openfile->current->data));
|
||||
|
||||
@@ -124,9 +124,6 @@ void do_delete(void)
|
||||
delete_node(foo);
|
||||
renumber(openfile->current);
|
||||
openfile->totsize--;
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
/* If the NO_NEWLINES flag isn't set, and text has been added to
|
||||
* the magicline as a result of deleting at the end of the line
|
||||
@@ -152,7 +149,8 @@ void do_delete(void)
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
/* Backspace over one character. */
|
||||
/* Backspace over one character. That is, move the cursor left one
|
||||
* character, and then delete the character there. */
|
||||
void do_backspace(void)
|
||||
{
|
||||
if (openfile->current != openfile->fileage ||
|
||||
@@ -192,6 +190,176 @@ void do_tab(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Indent or unindent all lines covered by the mark len columns,
|
||||
* depending on whether len is positive or negative. If the
|
||||
* TABS_TO_SPACES flag is set, indent/unindent by len spaces.
|
||||
* Otherwise, indent/unindent by (len / tabsize) tabs and (len %
|
||||
* tabsize) spaces. */
|
||||
void do_indent_marked(ssize_t cols)
|
||||
{
|
||||
bool indent_changed = FALSE;
|
||||
/* Whether any indenting or unindenting was done. */
|
||||
bool unindent = FALSE;
|
||||
/* Whether we're unindenting text. */
|
||||
char *line_indent = NULL;
|
||||
/* The text added to each line in order to indent it. */
|
||||
size_t line_indent_len = 0;
|
||||
/* The length of the text added to each line in order to indent
|
||||
* it. */
|
||||
filestruct *top, *bot, *f;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
/* If the mark isn't on, indicate it on the statusbar and get
|
||||
* out. */
|
||||
if (!openfile->mark_set) {
|
||||
statusbar(_("No lines selected, nothing to do!"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* If cols is zero, get out. */
|
||||
if (cols == 0)
|
||||
return;
|
||||
|
||||
/* If cols is negative, make it positive and set unindent to
|
||||
* TRUE. */
|
||||
if (cols < 0) {
|
||||
cols = -cols;
|
||||
unindent = TRUE;
|
||||
/* Otherwise, we're indenting, in which case the file will always be
|
||||
* modified, so set indent_changed to TRUE. */
|
||||
} else
|
||||
indent_changed = TRUE;
|
||||
|
||||
/* Get the coordinates of the marked text. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
|
||||
if (!unindent) {
|
||||
/* Set up the text we'll be using as indentation. */
|
||||
line_indent = charalloc(cols + 1);
|
||||
|
||||
if (ISSET(TABS_TO_SPACES)) {
|
||||
/* Set the indentation to cols spaces. */
|
||||
charset(line_indent, ' ', cols);
|
||||
line_indent_len = cols;
|
||||
} else {
|
||||
/* Set the indentation to (cols / tabsize) tabs and (cols %
|
||||
* tabsize) spaces. */
|
||||
size_t num_tabs = cols / tabsize;
|
||||
size_t num_spaces = cols % tabsize;
|
||||
|
||||
charset(line_indent, '\t', num_tabs);
|
||||
charset(line_indent + num_tabs, ' ', num_spaces);
|
||||
|
||||
line_indent_len = num_tabs + num_spaces;
|
||||
}
|
||||
|
||||
line_indent[line_indent_len] = '\0';
|
||||
}
|
||||
|
||||
/* Go through each line of the marked text. */
|
||||
for (f = top; f != bot->next; f = f->next) {
|
||||
size_t line_len = strlen(f->data);
|
||||
size_t indent_len = indent_length(f->data);
|
||||
|
||||
if (!unindent) {
|
||||
/* If we're indenting, add the characters in line_indent to
|
||||
* the beginning of the non-whitespace text of this line. */
|
||||
f->data = charealloc(f->data, line_len +
|
||||
line_indent_len + 1);
|
||||
charmove(&f->data[indent_len + line_indent_len],
|
||||
&f->data[indent_len], line_len - indent_len + 1);
|
||||
strncpy(f->data + indent_len, line_indent, line_indent_len);
|
||||
openfile->totsize += line_indent_len;
|
||||
|
||||
/* Keep track of the change in the current line. */
|
||||
if (f == openfile->mark_begin && openfile->mark_begin_x >=
|
||||
indent_len)
|
||||
openfile->mark_begin_x += line_indent_len;
|
||||
|
||||
if (f == openfile->current && openfile->current_x >=
|
||||
indent_len)
|
||||
openfile->current_x += line_indent_len;
|
||||
|
||||
/* If the NO_NEWLINES flag isn't set, and this is the
|
||||
* magicline, add a new magicline. */
|
||||
if (!ISSET(NO_NEWLINES) && f == openfile->filebot)
|
||||
new_magicline();
|
||||
} else {
|
||||
size_t indent_col = strnlenpt(f->data, indent_len);
|
||||
/* The length in columns of the indentation on this
|
||||
* line. */
|
||||
|
||||
if (cols <= indent_col) {
|
||||
size_t indent_new = actual_x(f->data, indent_col -
|
||||
cols);
|
||||
/* The length of the indentation remaining on
|
||||
* this line after we unindent. */
|
||||
size_t indent_shift = indent_len - indent_new;
|
||||
/* The change in the indentation on this line
|
||||
* after we unindent. */
|
||||
|
||||
/* If we're unindenting, and there's at least cols
|
||||
* columns' worth of indentation at the beginning of the
|
||||
* non-whitespace text of this line, remove it. */
|
||||
charmove(&f->data[indent_new], &f->data[indent_len],
|
||||
line_len - indent_shift - indent_new + 1);
|
||||
null_at(&f->data, line_len - indent_shift + 1);
|
||||
openfile->totsize -= indent_shift;
|
||||
|
||||
/* Keep track of the change in the current line. */
|
||||
if (f == openfile->mark_begin &&
|
||||
openfile->mark_begin_x > indent_new) {
|
||||
if (openfile->mark_begin_x <= indent_len)
|
||||
openfile->mark_begin_x = indent_new;
|
||||
else
|
||||
openfile->mark_begin_x -= indent_shift;
|
||||
}
|
||||
|
||||
if (f == openfile->current && openfile->current_x >
|
||||
indent_new) {
|
||||
if (openfile->current_x <= indent_len)
|
||||
openfile->current_x = indent_new;
|
||||
else
|
||||
openfile->current_x -= indent_shift;
|
||||
}
|
||||
|
||||
/* We've unindented, so set indent_changed to TRUE. */
|
||||
if (!indent_changed)
|
||||
indent_changed = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!unindent)
|
||||
/* Clean up. */
|
||||
free(line_indent);
|
||||
|
||||
if (indent_changed) {
|
||||
/* Mark the file as modified. */
|
||||
set_modified();
|
||||
|
||||
/* Update the screen. */
|
||||
edit_refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/* Indent all lines covered by the mark tabsize columns. */
|
||||
void do_indent_marked_void(void)
|
||||
{
|
||||
do_indent_marked(tabsize);
|
||||
}
|
||||
|
||||
/* Unindent all lines covered by the mark tabsize columns. */
|
||||
void do_unindent_marked_void(void)
|
||||
{
|
||||
do_indent_marked(-tabsize);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Someone hits Enter *gasp!* */
|
||||
void do_enter(void)
|
||||
{
|
||||
@@ -292,7 +460,7 @@ bool execute_command(const char *command)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* Else continue as parent. */
|
||||
/* Continue as parent. */
|
||||
close(fd[1]);
|
||||
|
||||
if (pid == -1) {
|
||||
@@ -348,7 +516,7 @@ bool execute_command(const char *command)
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
/* Clear the prepend_wrap flag. We need to do this as soon as we do
|
||||
/* Unset the prepend_wrap flag. We need to do this as soon as we do
|
||||
* something other than type text. */
|
||||
void wrap_reset(void)
|
||||
{
|
||||
@@ -356,8 +524,8 @@ void wrap_reset(void)
|
||||
}
|
||||
|
||||
/* We wrap the given line. Precondition: we assume the cursor has been
|
||||
* moved forward since the last typed character. Return value: whether
|
||||
* we wrapped. */
|
||||
* moved forward since the last typed character. Return TRUE if we
|
||||
* wrapped, and FALSE otherwise. */
|
||||
bool do_wrap(filestruct *line)
|
||||
{
|
||||
size_t line_len;
|
||||
@@ -391,8 +559,8 @@ bool do_wrap(filestruct *line)
|
||||
/* Step 1, finding where to wrap. We are going to add a new line
|
||||
* after a blank character. In this step, we call break_line() to
|
||||
* get the location of the last blank we can break the line at, and
|
||||
* and set wrap_loc to the location of the character after it, so
|
||||
* that the blank is preserved at the end of the line.
|
||||
* set wrap_loc to the location of the character after it, so that
|
||||
* the blank is preserved at the end of the line.
|
||||
*
|
||||
* If there is no legal wrap point, or we reach the last character
|
||||
* of the line while trying to find one, we should return without
|
||||
@@ -438,9 +606,8 @@ bool do_wrap(filestruct *line)
|
||||
/* Step 2, making the new wrap line. It will consist of indentation
|
||||
* followed by the text after the wrap point, optionally followed by
|
||||
* a space (if the text after the wrap point doesn't end in a blank)
|
||||
* and the text of the next line, if they can fit without
|
||||
* wrapping, the next line exists, and the prepend_wrap flag is
|
||||
* set. */
|
||||
* and the text of the next line, if they can fit without wrapping,
|
||||
* the next line exists, and the prepend_wrap flag is set. */
|
||||
|
||||
/* after_break is the text that will be wrapped to the next line. */
|
||||
after_break = line->data + wrap_loc;
|
||||
@@ -552,8 +719,8 @@ bool do_wrap(filestruct *line)
|
||||
* be prepended to the next line. */
|
||||
prepend_wrap = TRUE;
|
||||
|
||||
/* Each line knows its line number. We recalculate these if we
|
||||
* inserted a new line. */
|
||||
/* Each line knows its number. We recalculate these if we inserted
|
||||
* a new line. */
|
||||
if (!prepending)
|
||||
renumber(line);
|
||||
|
||||
@@ -606,14 +773,14 @@ ssize_t break_line(const char *line, ssize_t goal
|
||||
* found with short enough display width. */
|
||||
ssize_t cur_loc = 0;
|
||||
/* Current index in line. */
|
||||
size_t cur_pos = 0;
|
||||
/* Current column position in line. */
|
||||
int line_len;
|
||||
|
||||
assert(line != NULL);
|
||||
|
||||
while (*line != '\0' && goal >= 0) {
|
||||
size_t pos = 0;
|
||||
|
||||
line_len = parse_mbchar(line, NULL, &pos);
|
||||
while (*line != '\0' && goal >= cur_pos) {
|
||||
line_len = parse_mbchar(line, NULL, &cur_pos);
|
||||
|
||||
if (is_blank_mbchar(line)
|
||||
#ifndef DISABLE_HELP
|
||||
@@ -628,12 +795,11 @@ ssize_t break_line(const char *line, ssize_t goal
|
||||
#endif
|
||||
}
|
||||
|
||||
goal -= pos;
|
||||
line += line_len;
|
||||
cur_loc += line_len;
|
||||
}
|
||||
|
||||
if (goal >= 0)
|
||||
if (goal >= cur_pos)
|
||||
/* In fact, the whole line displays shorter than goal. */
|
||||
return cur_loc;
|
||||
|
||||
@@ -674,6 +840,11 @@ ssize_t break_line(const char *line, ssize_t goal
|
||||
|| (newline && *line == '\n')
|
||||
#endif
|
||||
)) {
|
||||
#ifndef DISABLE_HELP
|
||||
if (newline && *line == '\n')
|
||||
break;
|
||||
#endif
|
||||
|
||||
line_len = parse_mbchar(line, NULL, NULL);
|
||||
|
||||
line += line_len;
|
||||
@@ -746,8 +917,8 @@ void justify_format(filestruct *paragraph, size_t skip)
|
||||
while (*end != '\0') {
|
||||
int end_len;
|
||||
|
||||
/* If this character is blank, make sure that it's a space with
|
||||
* no blanks after it. */
|
||||
/* If this character is blank, change it to a space if
|
||||
* necessary, and skip over all blanks after it. */
|
||||
if (is_blank_mbchar(end)) {
|
||||
end_len = parse_mbchar(end, NULL, NULL);
|
||||
|
||||
@@ -770,9 +941,9 @@ void justify_format(filestruct *paragraph, size_t skip)
|
||||
#endif
|
||||
}
|
||||
/* If this character is punctuation optionally followed by a
|
||||
* bracket and then followed by blanks, make sure there are no
|
||||
* more than two blanks after it, and make sure that the blanks
|
||||
* are spaces. */
|
||||
* bracket and then followed by blanks, change no more than two
|
||||
* of the blanks to spaces if necessary, and skip over all
|
||||
* blanks after them. */
|
||||
} else if (mbstrchr(punct, end) != NULL) {
|
||||
end_len = parse_mbchar(end, NULL, NULL);
|
||||
|
||||
@@ -825,7 +996,7 @@ void justify_format(filestruct *paragraph, size_t skip)
|
||||
#endif
|
||||
}
|
||||
/* If this character is neither blank nor punctuation, leave it
|
||||
* alone. */
|
||||
* unchanged. */
|
||||
} else {
|
||||
end_len = parse_mbchar(end, NULL, NULL);
|
||||
|
||||
@@ -842,7 +1013,7 @@ void justify_format(filestruct *paragraph, size_t skip)
|
||||
|
||||
*new_end = *end;
|
||||
|
||||
/* Make sure that there are no spaces at the end of the line. */
|
||||
/* If there are spaces at the end of the line, remove them. */
|
||||
while (new_end > new_paragraph_data + skip &&
|
||||
*(new_end - 1) == ' ') {
|
||||
new_end--;
|
||||
@@ -1075,7 +1246,7 @@ void backup_lines(filestruct *first_line, size_t par_len)
|
||||
/* Find the beginning of the current paragraph if we're in one, or the
|
||||
* beginning of the next paragraph if we're not. Afterwards, save the
|
||||
* quote length and paragraph length in *quote and *par. Return TRUE if
|
||||
* we found a paragraph, or FALSE if there was an error or we didn't
|
||||
* we found a paragraph, and FALSE if there was an error or we didn't
|
||||
* find a paragraph.
|
||||
*
|
||||
* See the comment at begpar() for more about when a line is the
|
||||
@@ -1275,7 +1446,7 @@ void do_justify(bool full_justify)
|
||||
indent_string = mallocstrcpy(NULL, "");
|
||||
|
||||
/* Find the first indentation in the paragraph that doesn't
|
||||
* match the indentation of the first line, and save it in
|
||||
* match the indentation of the first line, and save it in
|
||||
* indent_string. If all the indentations are the same, save
|
||||
* the indentation of the first line in indent_string. */
|
||||
{
|
||||
@@ -1482,6 +1653,15 @@ void do_justify(bool full_justify)
|
||||
|
||||
edit_refresh();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* We're going to set jump_buf so that we return here after a
|
||||
* SIGWINCH instead of to main(). Indicate this. */
|
||||
jump_buf_main = FALSE;
|
||||
|
||||
/* Return here after a SIGWINCH. */
|
||||
sigsetjmp(jump_buf, 1);
|
||||
#endif
|
||||
|
||||
statusbar(_("Can now UnJustify!"));
|
||||
|
||||
/* If constant cursor position display is on, make sure the current
|
||||
@@ -1498,8 +1678,7 @@ void do_justify(bool full_justify)
|
||||
kbinput = do_input(&meta_key, &func_key, &s_or_t, &ran_func,
|
||||
&finished, FALSE);
|
||||
|
||||
if (!meta_key && !func_key && s_or_t &&
|
||||
kbinput == NANO_UNJUSTIFY_KEY) {
|
||||
if (s_or_t && kbinput == NANO_UNJUSTIFY_KEY) {
|
||||
/* Splice the justify buffer back into the file, but only if we
|
||||
* actually justified something. */
|
||||
if (first_par_line != NULL) {
|
||||
@@ -1667,11 +1846,15 @@ bool do_int_spell_fix(const char *word)
|
||||
do_replace_highlight(TRUE, exp_word);
|
||||
|
||||
/* Allow all instances of the word to be corrected. */
|
||||
canceled = (do_prompt(FALSE, spell_list, word,
|
||||
#ifndef NANO_TINY
|
||||
NULL,
|
||||
canceled = (do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
_("Edit a replacement")) == -1);
|
||||
spell_list, word,
|
||||
#ifndef NANO_TINY
|
||||
NULL,
|
||||
#endif
|
||||
edit_refresh, _("Edit a replacement")) == -1);
|
||||
|
||||
do_replace_highlight(FALSE, exp_word);
|
||||
|
||||
@@ -2128,7 +2311,7 @@ void do_spell(void)
|
||||
const char *spell_msg;
|
||||
|
||||
if (temp == NULL) {
|
||||
statusbar(_("Could not create temp file: %s"), strerror(errno));
|
||||
statusbar(_("Error writing temp file: %s"), strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2150,6 +2333,8 @@ void do_spell(void)
|
||||
unlink(temp);
|
||||
free(temp);
|
||||
|
||||
currshortcut = main_list;
|
||||
|
||||
/* If the spell-checker printed any error messages onscreen, make
|
||||
* sure that they're cleared off. */
|
||||
total_refresh();
|
||||
@@ -2240,16 +2425,23 @@ void do_verbatim_input(void)
|
||||
size_t kbinput_len, i;
|
||||
char *output;
|
||||
|
||||
/* TRANSLATORS: This is displayed when the next keystroke will be
|
||||
* inserted verbatim. */
|
||||
statusbar(_("Verbatim Input"));
|
||||
|
||||
/* If constant cursor position display is on, make sure the current
|
||||
* cursor position will be properly displayed on the statusbar. */
|
||||
if (ISSET(CONST_UPDATE))
|
||||
do_cursorpos(TRUE);
|
||||
|
||||
/* Read in all the verbatim characters. */
|
||||
kbinput = get_verbatim_kbinput(edit, &kbinput_len);
|
||||
|
||||
/* If constant cursor position display is on, make sure the current
|
||||
* cursor position will be properly displayed on the statusbar.
|
||||
* Otherwise, blank the statusbar. */
|
||||
if (ISSET(CONST_UPDATE))
|
||||
do_cursorpos(TRUE);
|
||||
else {
|
||||
blank_statusbar();
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
|
||||
/* Display all the verbatim characters at once, not filtering out
|
||||
* control characters. */
|
||||
output = charalloc(kbinput_len + 1);
|
||||
|
||||
68
src/utils.c
68
src/utils.c
@@ -3,7 +3,7 @@
|
||||
* utils.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005-2006 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) *
|
||||
@@ -33,12 +33,10 @@
|
||||
/* Return the number of decimal digits in n. */
|
||||
int digits(size_t n)
|
||||
{
|
||||
int i = 1;
|
||||
int i;
|
||||
|
||||
while (n > 10) {
|
||||
n /= 10;
|
||||
i++;
|
||||
}
|
||||
for (i = 1; n >= 10; n /= 10, i++)
|
||||
;
|
||||
|
||||
return i;
|
||||
}
|
||||
@@ -81,9 +79,9 @@ bool parse_num(const char *str, ssize_t *val)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Read an int and a ssize_t, separated by a comma, from str, and store
|
||||
* them in *line and *column (if they're not both NULL). On error, we
|
||||
* return FALSE. Otherwise, we return TRUE. */
|
||||
/* Read two ssize_t's, separated by a comma, from str, and store them in
|
||||
* *line and *column (if they're not both NULL). Return FALSE on error,
|
||||
* or TRUE otherwise. */
|
||||
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||
{
|
||||
bool retval = TRUE;
|
||||
@@ -197,7 +195,11 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
int c;
|
||||
|
||||
/* Sanity checks. */
|
||||
assert(lineptr != NULL && n != NULL && stream != NULL);
|
||||
if (lineptr == NULL || n == NULL || stream == NULL ||
|
||||
fileno(stream) == -1) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Allocate the line the first time. */
|
||||
if (*lineptr == NULL) {
|
||||
@@ -238,18 +240,6 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
#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)
|
||||
@@ -258,7 +248,7 @@ bool regexp_bol_or_eol(const regex_t *preg, const char *string)
|
||||
regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
|
||||
REG_NOMATCH);
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
/* Is the word starting at position pos in buf a whole word? */
|
||||
@@ -351,17 +341,15 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
return mbstrcasestr(start, needle);
|
||||
}
|
||||
|
||||
/* This is a wrapper for the perror() function. The wrapper takes care
|
||||
* of curses, calls perror() (which writes to stderr), and then
|
||||
* refreshes the screen. Note that nperror() causes the window to
|
||||
* flicker once. */
|
||||
/* This is a wrapper for the perror() function. The wrapper temporarily
|
||||
* leaves curses mode, calls perror() (which writes to stderr), and then
|
||||
* reenters curses mode, updating the screen in the process. Note that
|
||||
* nperror() causes the window to flicker once. */
|
||||
void nperror(const char *s)
|
||||
{
|
||||
/* Leave curses mode and go to the terminal. */
|
||||
if (endwin() != ERR) {
|
||||
perror(s); /* Print the error. */
|
||||
total_refresh(); /* Return to curses and refresh. */
|
||||
}
|
||||
endwin();
|
||||
perror(s);
|
||||
doupdate();
|
||||
}
|
||||
|
||||
/* This is a wrapper for the malloc() function that properly handles
|
||||
@@ -593,22 +581,6 @@ size_t get_totsize(const filestruct *begin, const filestruct *end)
|
||||
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)
|
||||
|
||||
1020
src/winio.c
1020
src/winio.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user