Compare commits
492 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bec01bd97d | ||
|
|
3dd744f392 | ||
|
|
adc30a839b | ||
|
|
8974efa27b | ||
|
|
d96ee5260a | ||
|
|
ba1ab86db5 | ||
|
|
1fc55a268f | ||
|
|
543ecf65a6 | ||
|
|
735b30c13f | ||
|
|
40e211bcec | ||
|
|
9bd56204ee | ||
|
|
d456bfa10d | ||
|
|
22a3564a2e | ||
|
|
d44a005e3d | ||
|
|
df21a2cbdf | ||
|
|
b349c80f0d | ||
|
|
85616c499b | ||
|
|
b9ddb80123 | ||
|
|
27f2b258d3 | ||
|
|
102d01da6c | ||
|
|
fd81a7189b | ||
|
|
efec641a82 | ||
|
|
77abec7ecf | ||
|
|
ba5b12c1fa | ||
|
|
40ea2a2ea0 | ||
|
|
496488c5d2 | ||
|
|
a17a130d6c | ||
|
|
2161fa6254 | ||
|
|
bb0060eb96 | ||
|
|
631242dd96 | ||
|
|
4dc5838ccc | ||
|
|
0099a8f45c | ||
|
|
38156d4491 | ||
|
|
666644efbc | ||
|
|
15540051ac | ||
|
|
7b918c76ee | ||
|
|
7d7e7d58ad | ||
|
|
f0195a8839 | ||
|
|
08c70ae1e9 | ||
|
|
9389ca29cf | ||
|
|
af40eeaa06 | ||
|
|
b159605a5b | ||
|
|
801a8b51d1 | ||
|
|
ff4a487efa | ||
|
|
9ec5db8b42 | ||
|
|
8d0d3abb72 | ||
|
|
7f9ed903ec | ||
|
|
96b21be5cf | ||
|
|
7253929a55 | ||
|
|
e9ac1d7930 | ||
|
|
59fe758a10 | ||
|
|
cefd29e9fe | ||
|
|
bca59d6ac0 | ||
|
|
800dd18fa4 | ||
|
|
b1d9b418b8 | ||
|
|
e0fb4d5641 | ||
|
|
55dfc3d3e9 | ||
|
|
6e60db6989 | ||
|
|
202d3c2f97 | ||
|
|
40f11ae622 | ||
|
|
3cf525d46f | ||
|
|
23f7e1b138 | ||
|
|
256a8908aa | ||
|
|
b199caef7d | ||
|
|
c275dc575a | ||
|
|
9d69169072 | ||
|
|
09b1c02c62 | ||
|
|
5f9acfeee5 | ||
|
|
9adace8c76 | ||
|
|
bd2eb289fb | ||
|
|
e6bbee8fe4 | ||
|
|
7e110bd28f | ||
|
|
eb4d81f3c1 | ||
|
|
aed09427f8 | ||
|
|
5d2ab88f0e | ||
|
|
65ef166a40 | ||
|
|
b6e79fddaf | ||
|
|
0c23aed600 | ||
|
|
ad96aff50d | ||
|
|
60e329e3b2 | ||
|
|
32f56814c7 | ||
|
|
45edf361a8 | ||
|
|
4c75faa211 | ||
|
|
7d367710ae | ||
|
|
b680326c37 | ||
|
|
e1c16b3744 | ||
|
|
bc14941e34 | ||
|
|
1b9d3f9898 | ||
|
|
2724c88717 | ||
|
|
54dca7b7b3 | ||
|
|
0df875a45d | ||
|
|
d7ca85c86c | ||
|
|
d9661dc301 | ||
|
|
0b80f936bf | ||
|
|
65e6ecb1d4 | ||
|
|
daa533a767 | ||
|
|
3eeb823f92 | ||
|
|
2921be2f38 | ||
|
|
d15de73bf3 | ||
|
|
798e67e0a1 | ||
|
|
96de1b0650 | ||
|
|
23c44504ad | ||
|
|
7c60eab744 | ||
|
|
3f9c63589e | ||
|
|
14ace1711d | ||
|
|
3e93c63e60 | ||
|
|
83ba47a964 | ||
|
|
345260c624 | ||
|
|
3ee4cf3027 | ||
|
|
17b8a36d17 | ||
|
|
42abfe057e | ||
|
|
159bdfdc60 | ||
|
|
122ae849b8 | ||
|
|
5040666fbb | ||
|
|
b80077dae3 | ||
|
|
314be2cfa9 | ||
|
|
21954765ca | ||
|
|
2bd22761ac | ||
|
|
d23277fbc9 | ||
|
|
4ce3b49597 | ||
|
|
5cc14f2f9a | ||
|
|
637b8bb36c | ||
|
|
65658ef574 | ||
|
|
18d616f253 | ||
|
|
c5e21dafb7 | ||
|
|
3a1fc8f0ab | ||
|
|
721fe6704a | ||
|
|
63d8f2b42f | ||
|
|
776cf3771d | ||
|
|
ce0451348c | ||
|
|
31055b3ba8 | ||
|
|
7801d7bed9 | ||
|
|
d24fbb760d | ||
|
|
1fe2eebf74 | ||
|
|
52e5f23184 | ||
|
|
b3aeb13682 | ||
|
|
c4c45aa532 | ||
|
|
e3013e3ed0 | ||
|
|
f6e4d33afc | ||
|
|
1bdccc5281 | ||
|
|
9b95ca8c29 | ||
|
|
8eb9c029be | ||
|
|
8f2906ba61 | ||
|
|
5508cc5b0a | ||
|
|
49ff08b251 | ||
|
|
116c828c50 | ||
|
|
78dadd4550 | ||
|
|
ea9370f231 | ||
|
|
610929c6ed | ||
|
|
c1e3d941a5 | ||
|
|
487d08cad0 | ||
|
|
0c9df578ea | ||
|
|
8a31afdc55 | ||
|
|
4c6956b433 | ||
|
|
b54155c4a4 | ||
|
|
775d46daf9 | ||
|
|
cac0293bce | ||
|
|
577298a3f9 | ||
|
|
f4a799aaec | ||
|
|
35e9713543 | ||
|
|
d96851f534 | ||
|
|
12054fe11b | ||
|
|
1307aae01a | ||
|
|
6d594a9cbb | ||
|
|
9ac20c85b0 | ||
|
|
0251bdb0a5 | ||
|
|
8ec1e2d903 | ||
|
|
851bea2ccd | ||
|
|
bbd63e136d | ||
|
|
28e19f8bbc | ||
|
|
9dffac90e7 | ||
|
|
930b1d7809 | ||
|
|
913db834d2 | ||
|
|
b6fbdd00cf | ||
|
|
d90d64f718 | ||
|
|
179f0ea742 | ||
|
|
22e5eff432 | ||
|
|
4d709f351c | ||
|
|
68e3016557 | ||
|
|
2524a70a49 | ||
|
|
f647c48035 | ||
|
|
f0a53f02a1 | ||
|
|
423326fc71 | ||
|
|
956da0d0e1 | ||
|
|
6e1cd06b96 | ||
|
|
1b1e8b632f | ||
|
|
d9ad76ba3c | ||
|
|
11c83d3ed3 | ||
|
|
b8a2a6d7e5 | ||
|
|
08cd7ef274 | ||
|
|
4840cb557f | ||
|
|
295d172f2d | ||
|
|
c13b7f0699 | ||
|
|
3e81914b82 | ||
|
|
0d847aadd9 | ||
|
|
f282428a42 | ||
|
|
4d97a588e6 | ||
|
|
c8ade44741 | ||
|
|
a9b9913c6b | ||
|
|
c195820456 | ||
|
|
6a643cd596 | ||
|
|
a35bdd1f03 | ||
|
|
4fd76bab73 | ||
|
|
fe3627ddfd | ||
|
|
61a71403f4 | ||
|
|
7ddca3a9a6 | ||
|
|
1903ace275 | ||
|
|
93c4a5656b | ||
|
|
9ec76e5573 | ||
|
|
fc693210d5 | ||
|
|
c0b9d19ed7 | ||
|
|
415b5d91cf | ||
|
|
3ba9c3512c | ||
|
|
f3bea022d6 | ||
|
|
6a2f068c7f | ||
|
|
e750fe68cf | ||
|
|
4564170c61 | ||
|
|
6eea1473b4 | ||
|
|
fbba5bf249 | ||
|
|
6a2f58e2ef | ||
|
|
78ea5e4a8a | ||
|
|
164bf36ea8 | ||
|
|
c2ac02ff46 | ||
|
|
abc9423709 | ||
|
|
60448895f6 | ||
|
|
263240c7c7 | ||
|
|
32085a88e8 | ||
|
|
eae97caa83 | ||
|
|
43953bba6f | ||
|
|
91851f3e60 | ||
|
|
bed32a370b | ||
|
|
f812e4f7d9 | ||
|
|
10820de467 | ||
|
|
98b61e3702 | ||
|
|
95a0224820 | ||
|
|
eb711b034b | ||
|
|
bfcba16761 | ||
|
|
2c70a4e608 | ||
|
|
bce3aad885 | ||
|
|
f326ed7910 | ||
|
|
846658eb6b | ||
|
|
c41285fb0b | ||
|
|
9c3edc026b | ||
|
|
7483571f7f | ||
|
|
68ebb61fb1 | ||
|
|
fc54d6e431 | ||
|
|
c0e42bd3c5 | ||
|
|
3ece0b9aeb | ||
|
|
1483ee3db1 | ||
|
|
63e73cbd14 | ||
|
|
53d3db4ba6 | ||
|
|
832db768a4 | ||
|
|
6ecbdd30b1 | ||
|
|
40a6c8cb64 | ||
|
|
800ee0d3f9 | ||
|
|
7a6fb48cf5 | ||
|
|
62a217d35d | ||
|
|
c109549a7e | ||
|
|
15dbc6ef07 | ||
|
|
c82997d460 | ||
|
|
08eab72517 | ||
|
|
e08765dca5 | ||
|
|
ca018c3e23 | ||
|
|
2dbcc801bf | ||
|
|
698263ca5c | ||
|
|
12642edfc9 | ||
|
|
5b3dd0f423 | ||
|
|
329d6a3259 | ||
|
|
8a2c0ba4b6 | ||
|
|
eeec999548 | ||
|
|
cc89513f14 | ||
|
|
6e738ac712 | ||
|
|
d994ad5284 | ||
|
|
304129315c | ||
|
|
4d6ec37676 | ||
|
|
bc3b92605e | ||
|
|
93c8405bfa | ||
|
|
b5a7a5a2d6 | ||
|
|
962202e4fa | ||
|
|
2c86dc6dc9 | ||
|
|
3de81bc33d | ||
|
|
3f35864b10 | ||
|
|
74d87073f0 | ||
|
|
e56d936bd4 | ||
|
|
831c640e62 | ||
|
|
b908a36d60 | ||
|
|
b75763e07e | ||
|
|
188f169e1d | ||
|
|
c0d3b20bdc | ||
|
|
42ca620e11 | ||
|
|
69a90c6b3b | ||
|
|
d7b632560c | ||
|
|
55381aa614 | ||
|
|
f6159047bc | ||
|
|
4db3d0adf7 | ||
|
|
6b769e5f5b | ||
|
|
0317c86a8a | ||
|
|
a98fd75b32 | ||
|
|
8091d334a3 | ||
|
|
9df069cc5f | ||
|
|
97b9046239 | ||
|
|
036a3d4646 | ||
|
|
4a3879f1ed | ||
|
|
56cf034a12 | ||
|
|
649b431171 | ||
|
|
bfb98f8bd4 | ||
|
|
8001e27e67 | ||
|
|
907725fde8 | ||
|
|
8781fc62cb | ||
|
|
1f1ebb85b7 | ||
|
|
e3016d90aa | ||
|
|
6299b0d752 | ||
|
|
2c31540fa9 | ||
|
|
fd9da07e6c | ||
|
|
fdd3becc1e | ||
|
|
c136f75f62 | ||
|
|
a084ad94f7 | ||
|
|
c15802f8c3 | ||
|
|
7105cf4f8e | ||
|
|
02085d7b92 | ||
|
|
50af6ea21e | ||
|
|
8ae06a86b8 | ||
|
|
29f446ec40 | ||
|
|
eb5d8383c8 | ||
|
|
00cca05ebb | ||
|
|
8c16bacbbf | ||
|
|
bde3e0e294 | ||
|
|
cb09337993 | ||
|
|
46c604a14e | ||
|
|
90e59c1a18 | ||
|
|
93eb293fbb | ||
|
|
d5402232ac | ||
|
|
0432e70850 | ||
|
|
78d644a635 | ||
|
|
1c293d2e28 | ||
|
|
31f99361b6 | ||
|
|
3d67c11473 | ||
|
|
b73c0c0b09 | ||
|
|
1539837fe0 | ||
|
|
dcc201b5b2 | ||
|
|
f643fc2149 | ||
|
|
f978f040bd | ||
|
|
8cbd4cb67f | ||
|
|
07e2589f80 | ||
|
|
be246c008b | ||
|
|
3e0c8a614d | ||
|
|
84d0d59cbb | ||
|
|
164c79883b | ||
|
|
e1ee22fba2 | ||
|
|
40bdb686aa | ||
|
|
29f03dcff9 | ||
|
|
182b2c936f | ||
|
|
6d9aa085d1 | ||
|
|
99869f54b5 | ||
|
|
4a1fc558cf | ||
|
|
1e1f572c51 | ||
|
|
4b4b608806 | ||
|
|
8381fdd83a | ||
|
|
d402e71a2f | ||
|
|
2e83a50e95 | ||
|
|
3d002ed602 | ||
|
|
add65085d6 | ||
|
|
e5e88fd9f2 | ||
|
|
85f8f46c40 | ||
|
|
687776b1a8 | ||
|
|
7a97e18667 | ||
|
|
59f5e04fa8 | ||
|
|
ace1037faf | ||
|
|
77b284af68 | ||
|
|
233f336112 | ||
|
|
d4ca9f2acb | ||
|
|
9bf486fe5d | ||
|
|
410efe9a47 | ||
|
|
1758640682 | ||
|
|
0ff01a92bc | ||
|
|
cc823ab6d6 | ||
|
|
cfa4a9c4fe | ||
|
|
e93e03e1dc | ||
|
|
c151b475e7 | ||
|
|
da952f8ded | ||
|
|
2690bafa15 | ||
|
|
e7c4168ee1 | ||
|
|
9abd1d18e4 | ||
|
|
7975408f66 | ||
|
|
c59979f067 | ||
|
|
bf1346f342 | ||
|
|
6a715b69a7 | ||
|
|
ca92becf9d | ||
|
|
2c4e34cfce | ||
|
|
d9fb3e6bde | ||
|
|
1601c28976 | ||
|
|
fe65657f6f | ||
|
|
484352241e | ||
|
|
2eb745939e | ||
|
|
3288925efb | ||
|
|
9819ed031b | ||
|
|
27fbc69ec4 | ||
|
|
53752e8f9a | ||
|
|
b802e70208 | ||
|
|
db85ac7564 | ||
|
|
cbc13a2a62 | ||
|
|
c6899cb734 | ||
|
|
2cc2a57dea | ||
|
|
381d483986 | ||
|
|
6be5339265 | ||
|
|
439fbe3e93 | ||
|
|
9cf7b28248 | ||
|
|
4b7e3c3efa | ||
|
|
fc965a4869 | ||
|
|
1f204c0204 | ||
|
|
4e8e495301 | ||
|
|
a870ca2d72 | ||
|
|
5780b24759 | ||
|
|
e53181d423 | ||
|
|
646bf9111c | ||
|
|
49d5c1bf1c | ||
|
|
731e7f28e7 | ||
|
|
1929982ec3 | ||
|
|
b6377c9d14 | ||
|
|
b112fe627d | ||
|
|
d93ee682c0 | ||
|
|
3497666a21 | ||
|
|
491cad3e5d | ||
|
|
f3b10e8e05 | ||
|
|
6b1c2adc86 | ||
|
|
7cfea8bb8c | ||
|
|
28caf14863 | ||
|
|
211dc82738 | ||
|
|
b6d97c15ac | ||
|
|
487149e713 | ||
|
|
045883aa34 | ||
|
|
056c5ef4a6 | ||
|
|
b49daec3f2 | ||
|
|
4dd723a095 | ||
|
|
d532f197b0 | ||
|
|
e663dcd6aa | ||
|
|
4c9e8f4211 | ||
|
|
77e02a3e74 | ||
|
|
951d7148d1 | ||
|
|
f1c395da79 | ||
|
|
3e189a8b9c | ||
|
|
7c1f17ab6d | ||
|
|
360191c434 | ||
|
|
ca744153fd | ||
|
|
be908f6992 | ||
|
|
e5d8f32834 | ||
|
|
47e82b1752 | ||
|
|
04a8d1c040 | ||
|
|
03225330dc | ||
|
|
25884f3bdb | ||
|
|
9bab9ff5b4 | ||
|
|
670a56c241 | ||
|
|
9b6e476a46 | ||
|
|
1e7297116b | ||
|
|
b77ec62cde | ||
|
|
45f971d69b | ||
|
|
eb16f43cf9 | ||
|
|
72d8e54f6e | ||
|
|
09b34ed34e | ||
|
|
f3ca80e11d | ||
|
|
013344c4c5 | ||
|
|
d08348b99c | ||
|
|
e6ef8b9bb9 | ||
|
|
807657b0fe | ||
|
|
f887298c6e | ||
|
|
db6015c7d7 | ||
|
|
fd73c462f4 | ||
|
|
12d5b2f6bd | ||
|
|
c7ca28a6ba | ||
|
|
6ccf0e2386 | ||
|
|
1a5c4c691c | ||
|
|
02517e0a0f | ||
|
|
8bf08097ee | ||
|
|
1fabded68f | ||
|
|
30d82b787d | ||
|
|
cc79a9ae96 | ||
|
|
66e19ba5f3 | ||
|
|
2a60ea8fe3 | ||
|
|
4aece064db | ||
|
|
6da969e44b | ||
|
|
146bb6026a | ||
|
|
c510042bcd | ||
|
|
50c7f2de2f | ||
|
|
0c4c58e457 | ||
|
|
20b83508f4 | ||
|
|
d1322107a5 | ||
|
|
fe0d366ce2 | ||
|
|
a16b27f102 | ||
|
|
dfca1c4ea6 | ||
|
|
a0b5ba2f7f | ||
|
|
19420aac9d | ||
|
|
013e8d1eb1 |
@@ -11,6 +11,7 @@ config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.status
|
||||
config.rpath
|
||||
configure
|
||||
config.guess
|
||||
config.sub
|
||||
|
||||
21
AUTHORS
21
AUTHORS
@@ -1,16 +1,16 @@
|
||||
$Id$
|
||||
This file lists people who have made significant contribution to the nano
|
||||
editor. Please see the ChangeLog for specific changes by author.
|
||||
This file lists people who have made significant contribution to the
|
||||
nano editor. Please see the ChangeLog for specific changes by author.
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Chris Allegretta <chrisa@asty.org>
|
||||
* Original program author, stable series maintainer.
|
||||
|
||||
David Lawrence Ramsey <pooka_regent@sluggy.net>
|
||||
* Development series maintainer. Multiple buffer support,
|
||||
operating dir (-o) option, bug fixes for display routines,
|
||||
wrapping code, spelling fixes, const mode and various other
|
||||
fixes.
|
||||
* Development series maintainer. Multiple buffer support,
|
||||
operating dir (-o) option, bug fixes for display routines,
|
||||
wrapping code, spelling fixes, const mode, parts of the UTF-8
|
||||
support, and various other fixes.
|
||||
|
||||
Jordi Mallach <jordi@sindominio.net>
|
||||
* Debian package maintainer, fellow bug squasher.
|
||||
@@ -27,10 +27,11 @@ Robert Siemborski <rjs3@andrew.cmu.edu>
|
||||
edit display routines.
|
||||
|
||||
Rocco Corsi <rocco.corsi@sympatico.ca>
|
||||
* Internal spelling code, many optimizations and bug fixes for
|
||||
findnextstr and search-related functions, various display and
|
||||
file handling fixes.
|
||||
* Internal spelling code, many optimizations and bug fixes for
|
||||
findnextstr() and search-related functions, various display
|
||||
and file handling fixes.
|
||||
|
||||
David Benbennick <dbenbenn@math.cornell.edu>
|
||||
* Wrap and justify bugfixes/enhancements, new color syntax
|
||||
code, memleak fixes and other miscellaneous fixes.
|
||||
code, memleak fixes, parts of the UTF-8 support, and other
|
||||
miscellaneous fixes.
|
||||
|
||||
815
ChangeLog
815
ChangeLog
@@ -1,3 +1,808 @@
|
||||
GNU nano 1.3.6 - 2005.03.20
|
||||
- General:
|
||||
- More int -> bool conversions. (DLR and David Benbennick)
|
||||
- Overhaul the cutting and uncutting routines to use the
|
||||
partitioning code, as it greatly simplifies how they work.
|
||||
New functions move_to_filestruct(), copy_from_filestruct(),
|
||||
cut_line(), cut_marked(), and cut_to_eol(); changes to
|
||||
add_to_cutbuffer(), do_cut_text(), do_uncut_text(), etc.;
|
||||
removal of functions get_cutbottom(), add_to_cutbuffer(), and
|
||||
cut_marked_segment(). (DLR)
|
||||
- Overhaul the justify-related routines to back up and restore
|
||||
unjustified text to use the partitioning code, as it greatly
|
||||
simplifies how they work, and to store such text in its own
|
||||
buffer rather than the cutbuffer. Changes to backup_lines(),
|
||||
do_justify(), etc. (DLR)
|
||||
- Overhaul the multibuffer routines to increase efficiency, most
|
||||
importantly making them use a doubly linked list for the open
|
||||
files so that switching between them is no longer O(N), and
|
||||
only including free_openfilestruct() when --enable-debug is
|
||||
used. Also use some of the same efficiency tweaks when
|
||||
dealing with filestruct nodes. New function
|
||||
open_prevnext_file(); changes to make_new_opennode(),
|
||||
splice_opennode(), unlink_opennode(), delete_opennode(),
|
||||
free_openfilestruct(), add_open_file(), load_open_file(),
|
||||
close_open_file(), shortcut_init(), die(), make_new_node(),
|
||||
copy_node(), splice_node(), delete_node(), and
|
||||
free_filestruct(); removal of open_prevfile() and
|
||||
open_nextfile(). (David Benbennick, minor tweaks and additions
|
||||
by DLR)
|
||||
- Change references to "open files" to "open file buffers", for
|
||||
consistency. (DLR)
|
||||
- Add flag to disable UTF-8 sequence interpretation, so that
|
||||
people using single-byte encodings such as KOI8-R can type
|
||||
properly again. (DLR, found by Arthur Ivanov)
|
||||
- Massively overhaul the input and output routines to support
|
||||
buffered input and output, the first steps toward
|
||||
wide/multibyte character input and output, and verbatim input
|
||||
of double-byte Unicode characters instead of single-byte ASCII
|
||||
characters. New functions is_byte(), get_buffer(),
|
||||
get_buffer_len(), buffer_to_keys(), unget_input(),
|
||||
get_input(), parse_kbinput(), and parse_verbatim_kbinput();
|
||||
new macro charcpy(); changes to do_char() (renamed to
|
||||
do_output()), get_edit_input() (renamed to do_input() and
|
||||
moved to nano.c), get_edit_mouse() (renamed do_mouse() and
|
||||
moved to nano.c), do_verbatim_input(), do_tab(), main(), and
|
||||
get_ascii_kbinput() (renamed to get_byte_kbinput()). The wide
|
||||
version of ncurses is required in order for wide/multibyte
|
||||
input and output to work properly. (DLR; buffered input/output
|
||||
based on ideas from mutt 1.4.2.1; input of Unicode characters
|
||||
in hexadecimal suggested by Michael Piefel)
|
||||
- More steps toward wide character/multibyte character support.
|
||||
New functions control_rep(), parse_char(), move_left(), and
|
||||
move_right(); changes to do_left(), do_right(), do_delete(),
|
||||
breakable(), break_line(), do_output(), get_buffer(),
|
||||
unget_input(), actual_x(), strnlenpt(), display_string(),
|
||||
titlebar(), statusbar(), onekey(), edit_add(),
|
||||
do_replace_highlight(), and do_credits(). (David Benbennick
|
||||
and DLR)
|
||||
- Overhaul the high-level input routines for the statusbar to
|
||||
make them read the shortcut lists for functions instead of
|
||||
manually running them, to make nanogetstr() less complex, and
|
||||
to increase flexibility. Note that currshortcut is now used
|
||||
regardless of #ifdefs, and that cutting text at the statusbar
|
||||
now respects the CUT_TO_END flag. Changes to shortcut_init()
|
||||
and nanogetstr(); new functions do_statusbar_input(),
|
||||
do_statusbar_mouse(), do_statusbar_home(), do_statusbar_end(),
|
||||
do_statusbar_right(), do_statusbar_left(),
|
||||
do_statusbar_backspace(), do_statusbar_delete(),
|
||||
do_statusbar_cut_text(), and do_statusbar_output(). (DLR)
|
||||
- Even more steps toward wide character/multibyte character
|
||||
support. Movement and cursor display at the statusbar prompt
|
||||
should now (mostly) work properly with a string containing
|
||||
multibyte characters, and text display of such strings should
|
||||
now (mostly) work properly as well. Changes to search_init(),
|
||||
nanoget_repaint(), do_statusbar_right(), do_statusbar_left(),
|
||||
do_statusbar_backspace(), and do_statusbar_delete(). (David
|
||||
Benbennick and DLR)
|
||||
- Implement cutting from the current position to the end of the
|
||||
file, using Ctrl-X from the search prompt and Meta-T from the
|
||||
edit window. New function do_cut_till_end(). Note that this
|
||||
is disabled when NANO_SMALL is defined. (DLR, based on ideas
|
||||
from a patch for Pico by Eduardo Chappa, suggested by Ryan
|
||||
Dlugosz and Paul Adams)
|
||||
- Implement verbatim input for the statusbar prompt. Changes to
|
||||
do_statusbar_input() and do_statusbar_output(); new functions
|
||||
keys_to_buffer(), unparse_kbinput(), and
|
||||
do_statusbar_verbatim_input(). (DLR)
|
||||
- Yet more steps toward full wide character/multibyte character
|
||||
support. Overhaul the functions that already have support for
|
||||
them to work with multibyte strings as much as possible, add
|
||||
support to a few more functions as well, and move multibyte
|
||||
character-specific functions to their own source file. New
|
||||
file chars.c; new functions is_alnum_char(),
|
||||
is_alnum_mbchar(), is_alnum_wchar(), is_blank_mbchar(),
|
||||
is_blank_wchar(), is_cntrl_mbchar(), is_cntrl_wchar(),
|
||||
control_mbrep(), control_wrep(), mbwidth(), mb_cur_max(),
|
||||
make_mbchar(), mbstrlen(), mbstrnlen(), mbstrcasecmp(),
|
||||
mbstrncasecmp(), mbstrcasestr(), and mbrevstrcasestr();
|
||||
changes to help_init(), do_wrap(), break_line(), is_byte()
|
||||
(moved to chars.c), is_blank_char() (moved to chars.c),
|
||||
is_cntrl_char() (moved to chars.c), nstricmp() (renamed
|
||||
nstrcasecmp() and moved to chars.c), nstrnicmp() (renamed
|
||||
nstrncasecmp() and moved to chars.c), nstristr() (renamed
|
||||
nstrcasestr() and moved to chars.c), revstrstr() (moved to
|
||||
chars.c), revstristr() (renamed revstrcasestr() and moved to
|
||||
chars.c), nstrnlen() (moved to chars.c), parse_char() (renamed
|
||||
parse_mbchar() and moved to chars.c), move_left() (renamed
|
||||
move_mbleft() and moved to chars.c), move_right() (renamed
|
||||
move_mbright() and moved to chars.c), do_home(),
|
||||
do_verbatim_input(), do_delete(), do_tab(), do_enter(),
|
||||
indent_length(), do_next_word(), do_prev_word(), do_wrap(),
|
||||
do_input(), do_output(), is_whole_word(), strstrwrapper(),
|
||||
get_buffer(), unget_input(), unget_kbinput(), get_input(),
|
||||
parse_kbinput(), unparse_kbinput(), parse_verbatim_kbinput(),
|
||||
do_statusbar_input(), do_statusbar_home(),
|
||||
do_statusbar_verbatim_kbinput(), do_statusbar_output(),
|
||||
do_help(), help_line_len(), and display_string(); removal of
|
||||
buffer_to_keys() and keys_to_buffer(). (DLR)
|
||||
- Add -O/--morespace command line option, plus a corresponding
|
||||
Meta-O toggle and a "morespace" rcfile option. When these are
|
||||
used, the normally-unused blank line below the titlebar will
|
||||
be treated as part of the edit window. New functions
|
||||
no_more_space() and blank_topbar(); changes to global_init(),
|
||||
window_init(), handle_sigwinch(), do_toggle(), do_mouse(),
|
||||
get_mouseinput(), etc. (DLR; suggested by Mike Frysinger,
|
||||
Rocco, and Robert Schultz)
|
||||
- Add support for moving to the next or previous word at the
|
||||
statusbar prompt. New functions do_statusbar_next_word() and
|
||||
do_statusbar_prev_word(); changes to do_statusbar_input().
|
||||
(DLR)
|
||||
- Make resizing more flexible. We now can work with as few as
|
||||
one row, and with no limit on the number of columns (except of
|
||||
course the curses-imposed limit that it be greater than zero).
|
||||
New function resize_variables(); changes to die_too_small()
|
||||
(renamed check_die_too_small()), global_init(), window_init(),
|
||||
and handle_sigwinch(). (David Benbennick)
|
||||
- Use void instead of RETSIGTYPE, as signal handlers are
|
||||
supposed to return void anyway. Also, the value of RETSIGTYPE
|
||||
is sometimes misdetected as int, leading to compilation
|
||||
warnings or errors. Changes to cancel_fork(),
|
||||
handle_hupterm(), do_suspend(), and do_cont(). (David
|
||||
Benbennick)
|
||||
- Change flags to an unsigned long, and totsize to a size_t.
|
||||
(DLR)
|
||||
- Store the number of multibyte characters instead of the number
|
||||
of single-byte characters in totsize, and use get_totals() to
|
||||
get the value of totsize in a few more places. Changes to
|
||||
read_line(), read_file(), do_delete(), do_input(),
|
||||
get_totals(), and do_cursorpos(). (DLR)
|
||||
- Overhaul the tab completion code, the file browser code, and
|
||||
related functions to increase efficiency and support multibyte
|
||||
characters. New function is_dir(); changes to
|
||||
get_full_path(), check_writable_directory(), safe_tempnam(),
|
||||
diralphasort(), username_tab_completion(),
|
||||
cwd_tab_completion(), input_tab(), tail(), striponedir(),
|
||||
browser_init(), do_browser(), and do_browse_from(); removal of
|
||||
append_slash_if_dir(), readable_dir(), and
|
||||
check_wildcard_match(). (David Benbennick) DLR: Move the
|
||||
routine to get the current user's home directory into the new
|
||||
function get_homedir(), and use it where necessary. Also add
|
||||
a few miscellaneous tweaks.
|
||||
- Overhaul the rcfile parsing code to make it simpler and more
|
||||
accurate, remove now-redundant checks from the color code,
|
||||
change the COLOR_SYNTAX toggle to the NO_COLOR_SYMTAX toggle,
|
||||
and improve various debugging messsages. Changes to
|
||||
set_colorpairs(), do_colorinit(), parse_next_word(),
|
||||
parse_argument(), colortoint(), parse_next_regex(),
|
||||
parse_syntax(), parse_colors(), parse_rcfile(), do_rcfile(),
|
||||
etc. (David Benbennick) DLR: Rename colortoint() to
|
||||
color_to_int(), and add a few miscellaneous tweaks.
|
||||
- Overhaul the paragraph-searching code to make it use the
|
||||
paragraph-searching utility functions when possible instead of
|
||||
duplicating code. Also overhaul the justify code to make it
|
||||
leave the right number of spaces at the ends of the lines of a
|
||||
paragraph, to make it support multibyte characters, and to
|
||||
make it simpler. Also, don't remove a space after a duplicate
|
||||
character in punct anymore, as it doesn't really make us more
|
||||
compatible with Pico. New functions mbstrchr(),
|
||||
do_para_begin_void(), and do_para_end_void(); changes to
|
||||
justify_format(), do_para_begin(), inpar(), do_para_end(),
|
||||
break_line(), do_para_search() (renamed find_paragraph()), and
|
||||
do_justify(); removal of breakable(). (DLR)
|
||||
- Still more steps toward full wide/multibyte character support.
|
||||
Make sure all rcfile arguments are valid multibyte strings,
|
||||
make whitespace display mode work with multibyte characters,
|
||||
and add a few related documentation updates. New function
|
||||
make_mbstring(); changes to make_mbchar(), make_mbstring(),
|
||||
main(), parse_rcfile(), display_string(), and do_help(). (DLR)
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- If keep_cutbuffer is FALSE, only blow away the text in the
|
||||
cutbuffer if the cutbuffer isn't empty. (DLR)
|
||||
do_uncut_text()
|
||||
- No longer duplicate Pico's adding an extra magicline to the
|
||||
file if uncutting leaves the cursor on the current one. This
|
||||
behavior appears to be a bug, as inserting a file in the same
|
||||
manner doesn't add an extra magicline. (DLR)
|
||||
- files.c:
|
||||
get_full_path()
|
||||
- Remove unneeded NANO_SMALL #ifdef, so that it's included
|
||||
whenever its prototype is, and so it can compile when
|
||||
DISABLE_OPERATINGDIR isn't defined and NANO_SMALL is. (DLR)
|
||||
do_browser()
|
||||
- Refresh the screen when Ctrl-L is pressed in the file browser,
|
||||
as Pico does. (DLR)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Fix misplaced #endif keeping the "Full Justify" shortcut in
|
||||
the search shortcut list from being included when NANO_SMALL
|
||||
is defined but DISABLE_JUSTIFY isn't. (DLR)
|
||||
- Use NULL instead of 0 when a shortcut has no associated
|
||||
function. (DLR)
|
||||
thanks_for_all_the_fish()
|
||||
- Free the justify buffer if it isn't empty. (DLR)
|
||||
- nano.c:
|
||||
help_init()
|
||||
- Clarify the text describing double-escape character input.
|
||||
Since ASCII is technically only seven bits wide, characters
|
||||
128-255 aren't ASCII. (DLR, suggested by Michael Piefel)
|
||||
do_toggle()
|
||||
- When we get the whitespace display toggle, update the titlebar
|
||||
as well as the edit window, in case the filename displayed on
|
||||
the titlebar contains spaces or tabs. (DLR)
|
||||
handle_sigwinch()
|
||||
- If the justify buffer isn't empty, blow it away and don't
|
||||
display "UnJustify" in the shortcut list anymore. (DLR)
|
||||
usage()
|
||||
- Typo fix. (DLR)
|
||||
do_wrap()
|
||||
- Make wrap_loc and word_back ssize_t's, to match fill. (DLR)
|
||||
break_line()
|
||||
- Fix compilation problem caused by its returning int when it
|
||||
should return ssize_t according to its prototype. (Jeremy
|
||||
Huddleston)
|
||||
indent_length()
|
||||
- Make the #ifdef around it match that of its prototype to avoid
|
||||
compilation problems when compiling with --enable-tiny and
|
||||
without DISABLE_JUSTIFY's being defined. (DLR)
|
||||
do_justify()
|
||||
- For consistency, preserve placewewant if we didn't unjustify
|
||||
instead of setting it to 0. (DLR)
|
||||
- When justifying the entire file, properly break out of the
|
||||
loop if we've found at least one paragraph, there are no more
|
||||
paragraphs after the current one, and the paragraph search
|
||||
left us on the magicline. This avoids a segfault. (DLR)
|
||||
do_input()
|
||||
- Add finished parameter, used to indicate when we run or try to
|
||||
run a function associated with a shortcut. (DLR)
|
||||
main()
|
||||
- Try to automatically detect whether UTF-8 support is needed by
|
||||
setting the NO_UTF8 flag if setlocale() returns a string that
|
||||
doesn't contain "UTF8" or "UTF-8", case insensitively. When
|
||||
using slang 2.x, enable UTF-8 support with SLutf8_enable().
|
||||
(DLR, string checks beyond case-sensitive "UTF-8" adapted from
|
||||
Debian's UTF-8 patch for slang)
|
||||
- nano.h:
|
||||
- Remove now-unneeded #defines for functions that now have
|
||||
multibyte equivalents. (DLR)
|
||||
- Remove now-unneeded MIN_EDITOR_COLS. (David Benbennick)
|
||||
- utils.c:
|
||||
regexec_safe()
|
||||
- Remove redundant regexec #define, and move the regexec #undef
|
||||
to nano.h. (DLR)
|
||||
is_blank_char()
|
||||
- Rewrite to use ctype functions instead of checking directly
|
||||
for spaces and tabs. (DLR)
|
||||
revstrstr(), revstristr()
|
||||
- Add asserts. (DLR)
|
||||
- winio.c:
|
||||
get_buffer()
|
||||
- If we get ERR when using blocking input, it means that the
|
||||
input source that we were using is gone. In this case, call
|
||||
handle_hupterm(), so that nano dies gracefully instead of
|
||||
going into an infinite loop. (DLR, found by Jim Uhl)
|
||||
titlebar()
|
||||
- Rename some variables for consistency, make space an int
|
||||
instead of a size_t, properly handle the case where the prefix
|
||||
length plus the path length is greater than the amount of
|
||||
space available, and fix a typo in an assert. (DLR)
|
||||
unget_kbinput()
|
||||
- Remove the wide character handling, as it didn't work properly
|
||||
with respect to function keys. (DLR)
|
||||
get_kbinput(), get_translated_kbinput(), get_ascii_kbinput(),
|
||||
get_untranslated_kbinput()
|
||||
- Make the ascii_digits variables ints instead of size_t's,
|
||||
since they will only hold very small values. (DLR)
|
||||
get_kbinput()
|
||||
- Remove the wide character handling, as it didn't work properly
|
||||
with respect to adding multiple wide characters at once, and
|
||||
ungetting them just caused other problems elsewhere. (DLR)
|
||||
get_translated_kbinput()
|
||||
- Remove the wide character handling, as it didn't work properly
|
||||
with respect to adding multiple wide characters at once, and
|
||||
ungetting them just caused other problems elsewhere. (DLR)
|
||||
- Use if statements instead of switch/case statements to handle
|
||||
ASCII character sequence mode, as they take up less room.
|
||||
get_ascii_kbinput()
|
||||
- Use if statements instead of switch/case statements to handle
|
||||
ASCII character sequence mode, as they take up less room.
|
||||
get_verbatim_kbinput()
|
||||
- Don't pass v_kbinput in as a parameter, since we're
|
||||
dynamically allocating it and then returning it. (DLR)
|
||||
- Remove v_first parameter, and go back to the old behavior of
|
||||
putting back the first character of the escape sequence, as it
|
||||
worked just as well and was less complicated. (DLR)
|
||||
get_mouseinput()
|
||||
- Return TRUE instead of FALSE only when we have a control key,
|
||||
a prinary meta key sequence, or both. (DLR)
|
||||
get_shortcut()
|
||||
- Add a debug message. (DLR)
|
||||
- Take kbinput as a reference instead of a value, so that it's
|
||||
translated when the key is translated to its equivalent
|
||||
control key or meta key shortcut. (DLR)
|
||||
- Return s instead of NULL only when we have a control key, a
|
||||
prinary meta key sequence, or both. (DLR)
|
||||
get_toggle()
|
||||
- Add a debug message. (DLR)
|
||||
bottombars()
|
||||
- Initialize foo, in case a keystroke meets none of the handled
|
||||
cases. (DLR)
|
||||
total_refresh()
|
||||
- Refresh bottomwin using the value of currshortcut, and change
|
||||
the code around do_refresh() calls to accommodate this. (DLR)
|
||||
- Split out the code that updates the screen before refreshing
|
||||
it into the new function total_update().
|
||||
do_help()
|
||||
- Refresh the screen when Ctrl-L is pressed in the help browser,
|
||||
as Pico does. (DLR)
|
||||
- configure.ac:
|
||||
- Remove specific references to control key shortcuts. (DLR)
|
||||
- Check for the wide versions of ncurses or slang, without which
|
||||
multibyte strings don't seem to be displayed properly, and
|
||||
associated multibyte/wide character functions. (DLR)
|
||||
- Check for wchar.h, for those systems that need it for the
|
||||
wcwidth() prototype. (DLR)
|
||||
- Remove checks for all include files that we include
|
||||
unconditionally. (DLR)
|
||||
- Remove references to termio.h here and elsewhere, since it's
|
||||
obsolete and it defines a struct termio that we don't use
|
||||
anywhere. (DLR)
|
||||
- Typo fixes. (DLR)
|
||||
- Add checks for isascii(), iswalnum(), iswblank() or
|
||||
iswspace(), mblen(), and wctype.h. (DLR)
|
||||
- README:
|
||||
- Updated for the 1.3 branch. (DLR)
|
||||
- README.CVS:
|
||||
- Updated to mention the need for a wide character-supporting
|
||||
version of curses or slang if UTF-8 support is desired. (DLR)
|
||||
- doc/faq.html:
|
||||
- Remove now-inaccurate note about verbatim input's not working
|
||||
at prompts, and update its description to mention that it
|
||||
handles hexadecimal values now. (DLR)
|
||||
- Add question about opening files with names beginning with
|
||||
'+'s, and add a few more miscellaneous cosmetic fixes.
|
||||
- nanorc.sample:
|
||||
- Add return to the "c-file" regexes. (DLR)
|
||||
- Clarify the text describing good values for whitespace
|
||||
display. Since ASCII is technically only seven bits wide,
|
||||
characters 128-255 aren't ASCII. (DLR, suggested by Michael
|
||||
Piefel)
|
||||
- Add the "morespace" option. (DLR)
|
||||
- Add support for characters to the "c-file" regexes. (DLR)
|
||||
- Add the hexadecimal equivalents of the decimal values
|
||||
suggested for whitespace display, now that it can handle
|
||||
multibyte characters. (DLR)
|
||||
- Add "manpage" regex. (Mike Frysinger, minor tweaks by DLR)
|
||||
- nano.1. nanorc.5, nano.texi:
|
||||
- Add the "morespace" option, and sync with the descriptions in
|
||||
nanorc.sample in a few places. (DLR)
|
||||
- Miscellaneous wording tweaks. (DLR)
|
||||
- src/Makefile.am:
|
||||
- Add chars.c to nano_SOURCES. (DLR)
|
||||
- If we're installing and the "rnano" symlink already exists,
|
||||
remove it so that we can create it again without an error.
|
||||
(DLR)
|
||||
- AUTHORS:
|
||||
- Updated to mention UTF-8 support.
|
||||
|
||||
GNU nano 1.3.5 - 2004.11.22
|
||||
- General:
|
||||
- Convert more ints that hold only TRUE and FALSE values to
|
||||
bools. (DLR)
|
||||
- Consolidate the code for finding and running a shortcut in a
|
||||
shortcut list, the code for finding and toggling a toggle in a
|
||||
toggle list, and the code for doing both of those and
|
||||
interpreting mouse clicks in the edit window. Also move the
|
||||
code for do_mouse() to get_edit_mouse() and tweak it to
|
||||
properly handle cases where a shortcut isn't clicked. New
|
||||
functions get_shortcut(), get_toggle(), get_edit_input(), and
|
||||
get_edit_mouse(); changes to do_browser(), do_justify(),
|
||||
do_help(), and main(). (DLR)
|
||||
- Simplify a few more translated messages. (DLR)
|
||||
- Translation updates (see po/ChangeLog for details).
|
||||
- Remove reference to @includedir@ in src/Makefile.am, as it's
|
||||
unneeded and can break cross-compilation. (DLR, found by Mike
|
||||
Frysinger)
|
||||
- Overhaul the file opening, reading, and loading operations to
|
||||
increase efficiency, avoid problems on invalid filenames
|
||||
specified on the command line, and eliminate corner cases that
|
||||
erroneously leave edittop or current NULL when they shouldn't
|
||||
be. Also split out the code to execute a command into a
|
||||
separate function, eliminate a workaround for one of the
|
||||
aforementioned corner cases, handle files with a mix of DOS
|
||||
and Mac format lines, and remove the code to turn on the
|
||||
NO_CONVERT flag when opening a binary file, as it's not always
|
||||
reliable and will cause problems with UTF-8 text files. New
|
||||
functions open_file(), execute_command(), and mallocstrassn();
|
||||
changes to read_line(), load_file(), read_file(), open_file(),
|
||||
get_next_filename(), do_insertfile(), do_insertfile_void(),
|
||||
do_alt_speller(), and edit_refresh(). (David Benbennick) DLR:
|
||||
Add a few minor fixes to make sure that current is set
|
||||
properly in all cases, indicate on the statusbar when the file
|
||||
has a mix of DOS and Mac format lines, move the test for DOS
|
||||
line endings from read_line() to read_file() to avoid
|
||||
inaccurate statusbar messages and to reduce fileformat to a
|
||||
local variable in read_file(), eliminate another workaround in
|
||||
edit_update(), rename open_the_file() to open_file() since the
|
||||
latter has been removed, and rename load_a_file() to
|
||||
load_buffer().
|
||||
- Add alternative shortcuts to the main and search shortcut
|
||||
lists for moving to the beginning and end of a paragraph and
|
||||
justifying the entire file: Meta-( (Meta-9), Meta-) (Meta-0),
|
||||
and Meta-J, respectively. Do this because Pico's practice of
|
||||
putting these shortcuts only in the search shortcut list is
|
||||
rather odd. (DLR)
|
||||
- Turn off extended input processing (the IEXTEN termios flag)
|
||||
as nano 1.2.x does. New function disable_extended_input();
|
||||
changes to terminal_init(). (DLR)
|
||||
- Remove redundant include of limits.h from nano.c. nano.c
|
||||
includes nano.h and nano.h includes limits.h. (DLR)
|
||||
- Add a func_key flag to the low-level input functions and the
|
||||
currently existing high-level input functions, to indicate
|
||||
extended keypad values. This is needed for UTF-8 support.
|
||||
Changes to unget_kbinput(), get_kbinput(),
|
||||
get_translated_kbinput(), get_shortcut(), get_edit_input(),
|
||||
etc. (DLR)
|
||||
- Add a multibuffer mode toggle to the "Execute Command" prompt,
|
||||
for consistency with the "Read File" prompt. Changes to
|
||||
do_insertfile() and shortcut_init(). (DLR)
|
||||
- Add an ^X toggle to the "Execute Command" prompt to go back to
|
||||
the "Insert File" prompt, and add a ^T toggle to the "Go To
|
||||
Line" prompt to go back to the "Where Is" prompt. Changes to
|
||||
do_insertfile(), shortcut_init(), do_gotoline(), etc.
|
||||
- Make sure a few uninitialized static variables are initialized
|
||||
to sane values. (DLR)
|
||||
- After reading in a file and detecting the format it's in, set
|
||||
the file format flags (DOS_FILE and MAC_FILE) to match, and
|
||||
preserve them across multiple file buffers. Changes to
|
||||
read_file(), add_open_file(), and load_open_file(). (DLR,
|
||||
suggested by Bill Soudan)
|
||||
- Remove the -D/--dos and -M/--mac command line options, as they
|
||||
aren't much use with the new file format autodetection. Also
|
||||
remove the global versions of the toggles, so that they can
|
||||
only be used at the "Write File" prompt as similar options
|
||||
can. Finally, change the Mac format toggle to Meta-M, since
|
||||
that no longer conflicts with the global -m/--mouse toggle.
|
||||
(DLR)
|
||||
- Add support for reading in UTF-8 sequences to the low-level
|
||||
input routines. Changes to get_kbinput() and
|
||||
get_translated_kbinput(). (DLR)
|
||||
- Reduce search_last_line to a static variable in search.c, and
|
||||
allow it to be set to FALSE via a function. New function
|
||||
findnextstr_wrap_reset(); changes to do_int_spell_fix(),
|
||||
findnextstr(), do_search(), do_research(), do_replace_loop(),
|
||||
do_replace(), and do_find_bracket(). (DLR, problem with making
|
||||
search_last_line local to findnextstr() found by Rocco)
|
||||
- When saving or changing file positions, be sure not to ignore
|
||||
placewewant. Changes to do_int_spell_fix(), findnextstr(),
|
||||
do_replace_loop(), and do_replace(). (DLR)
|
||||
- Convert current_x and mark_beginx to size_t's, and convert
|
||||
some functions that use them as a parameter to use size_t as
|
||||
well. Also change some related assertions to handle them.
|
||||
(David Benbennick and DLR)
|
||||
- Add code to partition a filestruct between a set of arbitrary
|
||||
coordinates. Given the coordinates of the beginning and end
|
||||
of the mark, this allows proper and easier handling of saving
|
||||
marked selections, replacing text only in marked selections
|
||||
(suggested by Joseph Birthisel), and spell-checking marked
|
||||
selections using either the internal or alternate spell
|
||||
checker. Do all these using a global partition structure.
|
||||
New functions partition_filestruct(),
|
||||
unpartition_filestruct(), remove_magicline(), and
|
||||
get_totals(); changes to write_marked(), do_int_spell_fix(),
|
||||
do_alt_speller(), handle_sigwinch(), and do_replace_loop().
|
||||
(DLR)
|
||||
- Remove most redundant includes of sys/stat.h. It's included
|
||||
in nano.h, so it doesn't need to be included in files that
|
||||
include nano.h. (DLR)
|
||||
- Remove the DOS_FILE and MAC_FILE flags, as they're only used
|
||||
in files.c, and replace them with a static file_format enum.
|
||||
Change the openfilestruct structure accordingly in order to
|
||||
handle this. (DLR)
|
||||
- Convert some ints with predefined boundaries to enums. (DLR)
|
||||
- Include config.h only if HAVE_CONFIG_H. (Jordi)
|
||||
- cut.c:
|
||||
cut_marked_segment()
|
||||
- Respect concatenate_cut, as we need to use it if we do a
|
||||
marked cut and immediately follow it with a cut-to-end (which
|
||||
uses this function). (DLR)
|
||||
do_cut_text()
|
||||
- Set concatenate_cut to TRUE unconditionally when doing a
|
||||
marked cut. This fixes an incompatibility with Pico where an
|
||||
extra line is uncut if we do a marked cut that includes the
|
||||
magicline and immediately follow it with an unmarked cut.
|
||||
(DLR)
|
||||
do_uncut_text()
|
||||
- Maintain current_y's value when uncutting blocks so that
|
||||
smooth scrolling works correctly. (DLR)
|
||||
- files.c:
|
||||
read_file()
|
||||
- Rename variable fileformat to format, to avoid confusion with
|
||||
the file_format enum type. (DLR)
|
||||
load_buffer()
|
||||
- Don't change the file format when we insert another file into
|
||||
the current one. (DLR)
|
||||
do_insertfile()
|
||||
- Simplify by reusing variables whereever possible, and add a
|
||||
parameter execute to indicate whether or not to be in "Execute
|
||||
Command" mode. (DLR)
|
||||
- Rework so that goto is no longer needed, using do_writeout()
|
||||
as a model. (DLR)
|
||||
- If file browsing succeeds, call statusq_abort() so that the
|
||||
cursor position at the statusbar is reset. (DLR)
|
||||
- Add missing #ifdefs around the wrap_reset() call so that nano
|
||||
compiles with wrapping disabled again. (DLR)
|
||||
- If we're not inserting a file into a new buffer, partition the
|
||||
current buffer so that it's effectively a new buffer just
|
||||
before inserting the file, and only restore placewewant
|
||||
afterwards. This is the same behavior we would get if we
|
||||
opened the file, added all of it to the cutbuffer, closed the
|
||||
file, and uncut at the current cursor position. (DLR)
|
||||
- Maintain current_y's value when inserting so that smooth
|
||||
scrolling works correctly. (DLR)
|
||||
do_writeout()
|
||||
- Restructure if blocks for greater efficiency, using
|
||||
do_insertfile() as a model. (DLR)
|
||||
- Simplify where possible, and use an int retval to hold the
|
||||
return value instead of i. (DLR)
|
||||
- If file browsing succeeds, call statusq_abort() so that the
|
||||
cursor position at the statusbar is reset. (DLR)
|
||||
- Remove unneeded calls to display_main_list(). (DLR)
|
||||
do_writeout_void()
|
||||
- Call display_main_list(), for consistency with
|
||||
do_insertfile_void(). (DLR)
|
||||
write_file()
|
||||
- If we've tried to write to an unwritable file and we're not
|
||||
prepending, tempname is NULL when it's passed to unlink().
|
||||
This can cause problems if unlink() can't handle NULL, so
|
||||
don't call it in that case. (David Benbennick)
|
||||
write_marked()
|
||||
- Remove check for MARK_ISSET's not being set. (DLR)
|
||||
open_prevfile(), open_nextfile()
|
||||
- Translate the "New Buffer" string when displaying "Switched
|
||||
to" messages on the statusbar. (DLR)
|
||||
input_tab()
|
||||
- Fix snprintf() call so that we don't segfault when trying to
|
||||
complete a filename containing %'s. (Ulf Härnhammar)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Remove redundant NANO_SMALL #ifdef. (DLR)
|
||||
- Change an erroneous _() around the "New Buffer" string to
|
||||
N_(). (DLR)
|
||||
- Add new key aliases: F15 for "Mark Text" (DLR) and F16 for
|
||||
"Where Is Next" (Chris).
|
||||
- Leave "Mark Text" and "Where Is Next" out entirely when
|
||||
NANO_SMALL is defined. Since they aren't in the visible main
|
||||
list, there's no point in having them in but disabled. (DLR)
|
||||
- In the search prompt shortcut list, move "Full Justify" to
|
||||
after "History", so that the latter is visible onscreen
|
||||
again. (DLR)
|
||||
- nano.c:
|
||||
die_save_file()
|
||||
- Clarify the error message when there are too many backup files
|
||||
and the current one can't be written. (DLR)
|
||||
help_init()
|
||||
- Rework to be a bit more flexible. Only add tabs for shortcut
|
||||
key entries if those entries exist, and if there's only one
|
||||
entry left but there's room for more than one, add enough tabs
|
||||
to put that entry at the end. Also, make sure a function key
|
||||
is displayed in the middle if it's the first entry. These
|
||||
changes allow e.g. the miscellaneous meta key sequence to be
|
||||
displayed in a shortcut that has a control key, a primary meta
|
||||
key sequence, and a miscellaneous meta key sequence, but no
|
||||
function key. (DLR)
|
||||
- Update the help text to mention replacing and spell checking
|
||||
only selected text, and also add a few cosmetic fixes to it.
|
||||
(DLR)
|
||||
- Update the help text to mention how to get a blank buffer at
|
||||
the "Execute Command" prompt. (DLR)
|
||||
do_prev_word()
|
||||
- Tweak to avoid an infinite loop, since current_x is now a
|
||||
size_t and hence is unsigned. (DLR)
|
||||
do_int_spell_fix()
|
||||
- Move the REVERSE_SEARCH flag toggling into the NANO_SMALL
|
||||
#ifdef, since the tiny version of nano doesn't support reverse
|
||||
searching. Move the CASE_SENSITIVE flag toggling out in order
|
||||
to allow the internal spell checker to work properly when
|
||||
NANO_SMALL is defined and DISABLE_SPELLER isn't. Also, turn
|
||||
the USE_REGEXP flag off during spell checking in order to
|
||||
avoid a potential segfault. (DLR)
|
||||
- Fix a problem where if the cursor is in the middle of a file,
|
||||
the spell checker will sometimes only correct the misspelled
|
||||
word instances that appear before the cursor position and then
|
||||
stop. (Rocco)
|
||||
- Use do_replace_loop()'s canceled parameter in order to ensure
|
||||
that the spell checking stops if we canceled at the replace
|
||||
prompt. (DLR)
|
||||
do_alt_speller()
|
||||
- Call terminal_init() unconditionally after running the
|
||||
alternate spell checker, so that the terminal state is
|
||||
properly restored in all cases. (DLR)
|
||||
justify_format()
|
||||
- For more compatibility with Pico, remove extra space after a
|
||||
character in punct if that character is the same as the one
|
||||
before it. For example, with the default values of punct and
|
||||
brackets, only one space will be left after "...". (DLR)
|
||||
do_para_begin(), do_para_end()
|
||||
- Maintain current_y's value when moving up or down lines so
|
||||
that smooth scrolling works correctly. (DLR)
|
||||
breakable(), break_line()
|
||||
- Make goal a ssize_t instead of an int, since fill is now a
|
||||
ssize_t, and the position at which a line is broken can be
|
||||
greater than COLS. (DLR)
|
||||
main()
|
||||
- Tweak the command line parsing routine so that multiple +LINE
|
||||
flags are properly interpreted in multibuffer mode. (DLR)
|
||||
- nano.h:
|
||||
- Add WIDTH_OF_TAB #define, containing the default width of a
|
||||
tab. (DLR)
|
||||
- Move the PATH_MAX #define here from files.c.
|
||||
- Remove unused COPYFILEBLOCKSIZE #define. (DLR)
|
||||
- proto.h:
|
||||
- Add missing NANO_SMALL #ifdef around the cut_marked_segment()
|
||||
prototype. (DLR)
|
||||
- rcfile.c:
|
||||
parse_rcfile()
|
||||
- Add missing brackets around an if statement block so that
|
||||
parsing the numeric argument after "tabsize" works properly
|
||||
again. (DLR, found by Mike Frysinger)
|
||||
- Since flag values are longs, use "%ld" instead of "%d" in the
|
||||
debugging messages indicating when a flag is set or unset.
|
||||
(DLR)
|
||||
- search.c:
|
||||
regexp_init()
|
||||
- If NANO_SMALL is defined, don't bother checking the
|
||||
CASE_SENSITIVE flag or using its value when compiling a list
|
||||
of matching regular expressions. (DLR)
|
||||
search_init()
|
||||
- Add parameter use_answer. When it's TRUE, only set
|
||||
backupstring to answer. This is needed to preserve the text
|
||||
of the statusbar when switching to the search prompt from
|
||||
the "Go To Line" prompt. Also, set backupstring before doing
|
||||
anything else, add one minor efficiency tweak, and preserve
|
||||
the text of the statusbar no matter what when switching from
|
||||
the search prompt to the "Go To Line" prompt, since the
|
||||
toggling works both ways now and non-numeric text shouldn't be
|
||||
lost when going only one of those ways. (DLR)
|
||||
- When we're replacing and the mark is on, display a prompt
|
||||
indicating that we're replacing text only in the selection
|
||||
instead of the usual prompt. (DLR)
|
||||
findnextstr()
|
||||
- Take the no_sameline parameter after can_display_wrap and
|
||||
wholewords, not after all other parameters. (DLR)
|
||||
- Maintain current_y's value when moving up or down lines so
|
||||
that smooth scrolling works correctly. (DLR)
|
||||
- Fix handling of the wholewords flag so that it works with
|
||||
regular expressions and in conjunction with the no_sameline
|
||||
flag, and add new parameter needle_len (used to return the
|
||||
length of the match). (DLR)
|
||||
do_replace_loop()
|
||||
- Miscellaneous cleanups: treat real_current as current and
|
||||
real_current_x as current_x, only turn the mark off and call
|
||||
edit_refresh() if the mark was originally on, and make
|
||||
length_change a ssize_t. (DLR)
|
||||
- Return ssize_t instead of int. (DLR)
|
||||
- Add new parameter canceled, set to TRUE if we canceled at the
|
||||
prompt and FALSE otherwise. (DLR)
|
||||
- utils.c:
|
||||
regexp_bol_or_eol()
|
||||
- Don't assume any longer that string will be found if
|
||||
REG_NOTBOL and REG_NOTEOL are not set. (DLR)
|
||||
mallocstrncpy()
|
||||
- New function, used as a malloc()ing equivalent of strncpy().
|
||||
(DLR)
|
||||
mallocstrcpy()
|
||||
- Refactor to be a wrapper for mallocstrncpy(). (DLR)
|
||||
mark_order()
|
||||
- Add new parameter right_side_up. Set it to TRUE If the mark
|
||||
begins with (mark_beginbuf, mark_beginx) and ends with
|
||||
(current, current_x), or FALSE otherwise. (DLR)
|
||||
- winio.c:
|
||||
unget_kbinput()
|
||||
- New function used as a wrapper for ungetch(). (DLR)
|
||||
get_kbinput()
|
||||
- When reading an escape sequence, set get_verbatim_kbinput()'s
|
||||
new first parameter to the first character of the sequence
|
||||
instead of putting that character back and reading the entire
|
||||
sequence afterwards. (DLR)
|
||||
get_escape_seq_kbinput()
|
||||
- Make the escape_seq parameter a const int*, since it's never
|
||||
modified. (DLR)
|
||||
- Support the escape sequences for F15 and F16. (DLR)
|
||||
get_verbatim_kbinput()
|
||||
- Add new parameter first. If first isn't ERR, make it the
|
||||
first character in the returned sequence instead of reading
|
||||
the first character in via blocking input. (DLR)
|
||||
get_mouseinput()
|
||||
- Consolidate two if statements to increase efficiency. (DLR)
|
||||
- Check kbinput against metaval instead of (erroneously) ctrlval
|
||||
when putting back a meta sequence. (DLR)
|
||||
- If there are more than MAIN_VISIBLE shortcuts available, only
|
||||
register clicks on the first MAIN_VISIBLE shortcuts, since
|
||||
bottombars() only shows that many shortcuts. (DLR)
|
||||
check_statblank()
|
||||
- Rename to check_statusblank(), and rename its associated
|
||||
global int statusblank too. (DLR)
|
||||
nanogetstr()
|
||||
- Refresh the screen when Ctrl-L is pressed at the statusbar
|
||||
prompt, as Pico does. (DLR)
|
||||
- Always return the key pressed by the user. (DLR)
|
||||
statusq()
|
||||
- Rework slightly to reset the cursor position when the user
|
||||
hits Enter as well as Cancel. This means that resetstatuspos
|
||||
no longer needs to be global. (DLR)
|
||||
statusq_abort()
|
||||
- New function to set resetstatuspos to FALSE when we don't
|
||||
properly exit the statusbar prompt, e.g. when we get a file
|
||||
from the file browser). (DLR)
|
||||
bottombars()
|
||||
- For efficiency, no longer dynamically allocate space for each
|
||||
visible shortcut, as they're all of a constant short length.
|
||||
(David Benbennick)
|
||||
reset_cursor()
|
||||
- If this is called before any files have been opened, as it can
|
||||
be by statusbar(), put the cursor at the top left corner of
|
||||
the edit window before getting out. (DLR)
|
||||
edit_refresh()
|
||||
- Call edit_update() with NONE instead of CENTER when smooth
|
||||
scrolling is on, for consistency with the movement routines.
|
||||
(DLR)
|
||||
edit_update()
|
||||
- Simplify so as not to require the fileptr parameter anymore,
|
||||
since it's set to current in all calls. (DLR)
|
||||
- Add comments better explaining what the update actually does,
|
||||
and avoid an infinite loop when location is NONE and current_y
|
||||
is greater than (editwinrows - 1). (DLR)
|
||||
do_yesno()
|
||||
- Don't bother assigning the value of get_mouseinput() to
|
||||
anything. Since allow_shortcuts is FALSE, its return value
|
||||
will always be FALSE. (DLR)
|
||||
- configure.ac:
|
||||
- When calling AC_TRY_RUN() to test for a broken regexec()
|
||||
function, set the fourth parameter to default to "no" (since
|
||||
it apparently only occurs on glibc 2.2.3-based systems) so
|
||||
that cross-compiling will work. (DLR, found by Mike Frysinger)
|
||||
- Simplify the curses library tests by only checking for
|
||||
initscr(), which ncurses, curses, and pdcurses should all
|
||||
have, and not tgetent(), which is a termcap-specific function.
|
||||
(DLR)
|
||||
- Check only for glib 2.x, as it's much more common than
|
||||
glib 1.2.x now, and it has a better v?snprintf()
|
||||
implementation. (DLR, suggested by Jordi)
|
||||
- nanorc.sample:
|
||||
- Remove specific references to control key shortcuts other than
|
||||
XON and XOFF. (DLR)
|
||||
- Add continue and goto to the "c-file" regexes. (DLR)
|
||||
- Change the included speller value to "aspell -x -c". The -x
|
||||
option makes aspell not create backup files, and this is
|
||||
consistent with the internal spell checker's behavior. (DLR)
|
||||
- doc/man/fr/nano.1, doc/man/fr/nanorc.1:
|
||||
- Updated manpage translations by Jean-Philippe Guérard.
|
||||
- README.CVS:
|
||||
- Mention the requirement for glib 2.x on systems lacking
|
||||
v?snprintf(), and add minor formatting changes.
|
||||
- Mention the requirement for groff in order to create html
|
||||
versions of the manpages. (DLR)
|
||||
- Update the given cvs commands so that they work again, and
|
||||
mention the need for ssh to do cvs checkouts. (DLR)
|
||||
- List sh as an example of a Bourne shell. (DLR)
|
||||
- faq.html:
|
||||
- Fixed inaccuracy: Pico compatibility mode was made the default
|
||||
in nano 1.1.99pre1, not 1.2.2. (DLR)
|
||||
- Added question about how to type F13-F16 on terminals lacking
|
||||
keys past F12 (suggested by Chris), question about how to
|
||||
select text for the clipboard in X terminals with nano's mouse
|
||||
support turned on (answer found by Joseph Birthisel), and
|
||||
miscellaneous fixes and link updates. (DLR)
|
||||
- nano.1:
|
||||
- Eliminate references to the now removed -D/--dos and -M/--mac
|
||||
command line options. (DLR)
|
||||
- nano.texi:
|
||||
- Eliminate references to the now removed -D/--dos and -M/--mac
|
||||
command line options, and their corresponding toggles. (DLR)
|
||||
- m4/Makefile.am:
|
||||
- Add glib-2.0.m4 to EXTRA_DIST, so that nano builds from CVS
|
||||
with automake 1.7.x again. For some reason, automake 1.9.x
|
||||
didn't have a problem with its (erroneously) being left out.
|
||||
(DLR, problem found by Chris)
|
||||
- m4/glib-2.0.m4:
|
||||
- New file imported from glib 2.4.7. This is needed to detect
|
||||
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)
|
||||
|
||||
GNU nano 1.3.4 - 2004.08.17
|
||||
- General:
|
||||
- More minor comment cleanups. (DLR)
|
||||
@@ -80,7 +885,7 @@ GNU nano 1.3.4 - 2004.08.17
|
||||
- Consolidate some if blocks to remove some redundant code.
|
||||
(David Benbennick)
|
||||
- Fix warnings when compiling with ENABLE_NLS undefined and with
|
||||
-the fwritable-strings option. (David Benbennick)
|
||||
the fwritable-strings option. (David Benbennick)
|
||||
- Add various #ifdefs to fix warnings and compilation problems
|
||||
when compiling with every option manually turned on, including
|
||||
NANO_SMALL. (David Benbennick)
|
||||
@@ -110,7 +915,7 @@ GNU nano 1.3.4 - 2004.08.17
|
||||
write_file()
|
||||
- For consistency with nano 1.2.x and with other editors, make
|
||||
the mode of newly created files 666 instead of 600 before
|
||||
it's modified by the umask. (DLR)
|
||||
it's modified by the umask. (DLR, found by Toni Suokas)
|
||||
do_writeout()
|
||||
- If we're in restricted mode and the current filename isn't
|
||||
blank, we can't change it, so disable tab completion in that
|
||||
@@ -704,7 +1509,6 @@ GNU nano 1.3.3 - 2004.06.28
|
||||
- config.rpath:
|
||||
- Replace usage of egrep with grep -E, avoiding a XSI:ism (David
|
||||
Weinehall)
|
||||
|
||||
- faq.html:
|
||||
- Removed question about the NumLock glitch, as it's no longer
|
||||
needed. (DLR)
|
||||
@@ -1460,8 +2264,8 @@ GNU nano 1.2.1 - 2003.04.19
|
||||
- General:
|
||||
- Translation updates (see po/ChangeLog for details).
|
||||
- Work around broken regexec() on some systems that segfaults
|
||||
when passed an empty string. New function regexec_safe().
|
||||
(David Benbennick)
|
||||
when passed an empty string. This is known to be in glibc
|
||||
2.2.3. New function regexec_safe(). (David Benbennick)
|
||||
- Fix various bugs with search string history logging: don't
|
||||
print a broken error message and freeze if ~/.nano_history is
|
||||
unreadable, actually show an error message in save_history()
|
||||
@@ -2657,6 +3461,7 @@ GNU nano 1.1.9 - 05/12/2002
|
||||
- Indonesian translation updates (Tedi Heriyanto).
|
||||
- po/sv.po:
|
||||
- Swedish translation updates (Christian Rose).
|
||||
|
||||
GNU nano 1.1.8 - 03/30/2002
|
||||
- General
|
||||
- Type misalignments and mem leaks in renumber_all, do_justify
|
||||
|
||||
@@ -3,7 +3,6 @@ AUTOMAKE_OPTIONS = gnu no-dependencies
|
||||
|
||||
SUBDIRS = doc m4 po src
|
||||
|
||||
|
||||
EXTRA_DIST = ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS \
|
||||
README THANKS TODO UPGRADE config.rpath install-sh missing \
|
||||
mkinstalldirs nano.spec
|
||||
|
||||
39
NEWS
39
NEWS
@@ -1,3 +1,42 @@
|
||||
2005.03.20 - GNU nano 1.3.6 "shout it from the rooftops" is released.
|
||||
This release finally includes the long-awaited support
|
||||
for UTF-8. Other new features include the ability to
|
||||
insert UTF-8 characters using verbatim input; the
|
||||
ability to delete all text from the cursor position to
|
||||
the end of the file via ^W^X as (patched) Pico does;
|
||||
improvements to input and output so that pasted text
|
||||
displays faster, improvements to the statusbar prompt so
|
||||
that more edit window shortcuts, including verbatim
|
||||
input and previous/next word search, work in it; a new
|
||||
option to allow using the formerly always-blank second
|
||||
line of the screen as part of the edit window; and the
|
||||
ability to refresh the help browser and file browser
|
||||
windows via Ctrl-L. Notable bug fixes include a fix for
|
||||
a segfault when using full justify, and a fix for the
|
||||
long-standing bug where nano would keep running if the
|
||||
terminal it was in died unexpectedly. Enjoy.
|
||||
|
||||
2004.11.22 - GNU nano 1.3.5 hurls itself forward. New features in this
|
||||
release include the ability to replace only marked text
|
||||
when the mark is on, improvements to smooth scrolling so
|
||||
that it applies everywhere instead of just affecting the
|
||||
movement keys, improvements to how files are opened so
|
||||
that they are no longer displayed unnecessarily, support
|
||||
for multiple +LINE arguments in addition to multiple
|
||||
filenames on the command line, autodetection of the
|
||||
format to save a file in based on the format it was in
|
||||
when it was opened, the ability to toggle both ways
|
||||
between the "Read File" and "Execute Command" prompts
|
||||
and the "Search" and "Go to Line" prompts, and support
|
||||
for cross-compiling nano. As for bug fixes, the
|
||||
"tabsize" nanorc option works again, mouse clicks on the
|
||||
shortcut list trigger the right shortcuts again,
|
||||
tab-completing a filename with %'s in it no longer
|
||||
causes a segfault, the internal spell checker no longer
|
||||
skips words after the cursor position when the cursor is
|
||||
in the middle of the file, and spell checking of only
|
||||
marked text now works properly. Have fun with it.
|
||||
|
||||
2004.08.17 - GNU nano 1.3.4 marches forth after a false start. This
|
||||
release mainly features fixes for the bugs that crept
|
||||
into the last release. Among other things, nano now
|
||||
|
||||
9
README
9
README
@@ -35,7 +35,7 @@ How to compile and install nano
|
||||
|
||||
Web Page
|
||||
|
||||
http://www.nano-editor.org
|
||||
http://www.nano-editor.org/
|
||||
|
||||
Mailing List and Bug Reports
|
||||
|
||||
@@ -60,10 +60,9 @@ Mailing List and Bug Reports
|
||||
|
||||
Current Status
|
||||
|
||||
GNU nano has reached its second major milestone, 1.2.x.
|
||||
Development of new features will continue in the 1.3.x branch,
|
||||
while 1.2.x versions will be dedicated to bugfixing and
|
||||
polishing.
|
||||
GNU nano has reached its second stable milestone, 1.2.x.
|
||||
Development of new features continues in the 1.3.x branch, while
|
||||
1.2.x versions are dedicated to bug-fixing and polishing.
|
||||
|
||||
Chris Allegretta (chrisa@asty.org)
|
||||
|
||||
|
||||
44
README.CVS
44
README.CVS
@@ -1,38 +1,46 @@
|
||||
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.
|
||||
GNU nano is available from CVS, but building this needs a bit more care
|
||||
than the official stable and unstable tarballs.
|
||||
|
||||
To successfully compile GNU nano from CVS, you'll need the
|
||||
following packages:
|
||||
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
|
||||
- texinfo
|
||||
- cvs
|
||||
- glib (if your system doesn't have snprintf() and/or vsnprintf())
|
||||
- make, gcc and the normal development libraries (ncurses, etc)
|
||||
These should be available on your GNU mirror.
|
||||
- ssh (with support for the SSH version 2 protocol)
|
||||
- glib 2.x (if your system doesn't have snprintf() and/or vsnprintf())
|
||||
- make, gcc and the normal development libraries (curses or slang, etc.)
|
||||
|
||||
These should be available on your GNU mirror. Note that you'll need a
|
||||
version of curses or slang with wide character support if you want nano
|
||||
to use UTF-8.
|
||||
|
||||
To download the CVS tree, execute the following command:
|
||||
$ cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/nano login
|
||||
and press enter at the password prompt.
|
||||
Then, do
|
||||
$ cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/nano checkout nano
|
||||
and the nano tree will download.
|
||||
If you want to checkout the stable CVS branch, append -r nano_1_0_branch:
|
||||
$ cvs -z3 -d:pserver:anonymous@subversions.gnu.org:/cvsroot/nano checkout -r nano_1_0_branch nano
|
||||
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:ext:anoncvs@savannah.gnu.org:/cvsroot/nano checkout nano
|
||||
|
||||
If you want to download the stable CVS branch, add "-r nano_1_0_branch":
|
||||
$ cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/nano checkout -r nano_1_0_branch nano
|
||||
|
||||
Once you have the sources in the "nano" directory, cd into it, and
|
||||
execute the "autogen.sh" script in the top dir. This will setup a
|
||||
configure script and Makefile.in, and you will be ready to compile with
|
||||
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
|
||||
|
||||
Once it's done compiling,
|
||||
$ make install
|
||||
(as root) should put the required files in their respective directories.
|
||||
|
||||
|
||||
Please submit any bugs in the CVS branch to nano-devel@gnu.org.
|
||||
|
||||
14
TODO
14
TODO
@@ -2,20 +2,20 @@ TODO file (? means the feature may be implemented, but not definitely)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
For version 1.4:
|
||||
- UTF-8 support.
|
||||
- UTF-8 support. [DONE except for the NO_CONVERT flag, which should
|
||||
allow editing UTF-8 as raw bytes.]
|
||||
- Support for paragraph searches. [DONE]
|
||||
- Support for justifying the entire file at once. [DONE]
|
||||
- Support for filename searches in the file browser.
|
||||
- Undo/Redo key?
|
||||
- Rebindable keys?
|
||||
- Keystroke to implement "Add next sequence as raw" like vi's ^V.
|
||||
[DONE for edit window, needs to be done for statusbar prompt]
|
||||
- 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) re-enter their
|
||||
- Make "To Line" (^W^T) and "Read from Command" (^R^X) reenter their
|
||||
parent menu when their keystroke is entered a second time (^W^T^T and
|
||||
(^R^X^X)(requires figuring out when to keep cursor pos and when not
|
||||
to).
|
||||
- Fix resetstatuspos global which we shouldn't have.
|
||||
(^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:
|
||||
|
||||
513
config.rpath
513
config.rpath
@@ -1,513 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2002 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||
# should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
# All known linkers require a `.a' archive for static linking (except M$VC,
|
||||
# which needs '.lib').
|
||||
libext=a
|
||||
shlibext=
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
wl='-Wl,'
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3* | aix4* | aix5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
linux*)
|
||||
echo '__INTEL_COMPILER' > conftest.$ac_ext
|
||||
if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null
|
||||
then
|
||||
:
|
||||
else
|
||||
# Intel icc
|
||||
wl='-Qoption,ld,'
|
||||
fi
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
solaris*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sunos4*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
if test "x$host_vendor" = xsni; then
|
||||
wl='-LD'
|
||||
else
|
||||
wl='-Wl,'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$GCC" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
case "$host_os" in
|
||||
aix3* | aix4* | aix5*)
|
||||
# On AIX, the GNU linker is very broken
|
||||
ld_shlibs=no
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
|
||||
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||
# to version 4, is to share data among multiple programs linked
|
||||
# with the same dynamic library. Since this doesn't match the
|
||||
# behavior of shared libraries on other platforms, we can use
|
||||
# them.
|
||||
ld_shlibs=no
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
solaris* | sysv5*)
|
||||
if $LD -v 2>&1 | grep -E 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$ld_shlibs" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$GCC" = yes; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
else
|
||||
aix_use_runtimelinking=no
|
||||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
esac
|
||||
fi
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
if test "$GCC" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
hardcode_direct=yes
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
esac
|
||||
fi
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
else
|
||||
hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# see comment about different semantics on the GNU ld section
|
||||
ld_shlibs=no
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
libext=lib
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd1*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
freebsd2.2*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
freebsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes # Not in the search PATH, but as the default
|
||||
# location of the library.
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
netbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
newsos6)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
openbsd*)
|
||||
hardcode_direct=yes
|
||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
else
|
||||
case "$host_os" in
|
||||
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
osf3*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
osf4* | osf5*)
|
||||
if test "$GCC" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
# Both cc and cxx compiler support -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
sco3.2v5*)
|
||||
;;
|
||||
solaris*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
sysv4)
|
||||
if test "x$host_vendor" = xsno; then
|
||||
hardcode_direct=yes # is this really true???
|
||||
else
|
||||
hardcode_direct=no # Motorola manual says yes, but my tests say they lie
|
||||
fi
|
||||
;;
|
||||
sysv4.3*)
|
||||
;;
|
||||
sysv5*)
|
||||
hardcode_libdir_flag_spec=
|
||||
;;
|
||||
uts4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
dgux*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
sysv4.2uw2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=no
|
||||
;;
|
||||
sysv5uw7* | unixware7*)
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
libname_spec='lib$name'
|
||||
sys_lib_dlsearch_path_spec="/lib /usr/lib"
|
||||
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
shlibext=so
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
shlibext=so
|
||||
;;
|
||||
amigaos*)
|
||||
shlibext=ixlibrary
|
||||
;;
|
||||
beos*)
|
||||
shlibext=so
|
||||
;;
|
||||
bsdi4*)
|
||||
shlibext=so
|
||||
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
|
||||
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
case $GCC,$host_os in
|
||||
yes,cygwin*)
|
||||
shlibext=dll.a
|
||||
;;
|
||||
yes,mingw*)
|
||||
shlibext=dll
|
||||
sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
|
||||
;;
|
||||
yes,pw32*)
|
||||
shlibext=dll
|
||||
;;
|
||||
*)
|
||||
shlibext=dll
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shlibext=dylib
|
||||
;;
|
||||
freebsd1*)
|
||||
;;
|
||||
freebsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
gnu*)
|
||||
shlibext=so
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
shlibext=sl
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
shlibext=so
|
||||
case "$host_os" in
|
||||
irix5*)
|
||||
libsuff= shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 ") libsuff= shlibsuff= ;;
|
||||
*-n32|*"-n32 ") libsuff=32 shlibsuff=N32 ;;
|
||||
*-64|*"-64 ") libsuff=64 shlibsuff=64 ;;
|
||||
*) libsuff= shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
|
||||
sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
|
||||
;;
|
||||
linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
|
||||
;;
|
||||
linux-gnu*)
|
||||
shlibext=so
|
||||
;;
|
||||
netbsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
newsos6)
|
||||
shlibext=so
|
||||
;;
|
||||
openbsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
os2*)
|
||||
libname_spec='$name'
|
||||
shlibext=dll
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
shlibext=so
|
||||
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
|
||||
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
|
||||
;;
|
||||
sco3.2v5*)
|
||||
shlibext=so
|
||||
;;
|
||||
solaris*)
|
||||
shlibext=so
|
||||
;;
|
||||
sunos4*)
|
||||
shlibext=so
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
shlibext=so
|
||||
case "$host_vendor" in
|
||||
motorola)
|
||||
sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
uts4*)
|
||||
shlibext=so
|
||||
;;
|
||||
dgux*)
|
||||
shlibext=so
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
shlibext=so
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
|
||||
sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl="$escaped_wl"
|
||||
|
||||
# Static library suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Shared library suffix (normally "so").
|
||||
shlibext="$shlibext"
|
||||
|
||||
# Flag to hardcode \$libdir into a binary during linking.
|
||||
# This must work even if \$libdir does not exist.
|
||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||
|
||||
# Whether we need a single -rpath flag with a separated argument.
|
||||
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||
|
||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_direct="$hardcode_direct"
|
||||
|
||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_minus_L="$hardcode_minus_L"
|
||||
|
||||
# Compile-time system search path for libraries
|
||||
sys_lib_search_path_spec="$escaped_sys_lib_search_path_spec"
|
||||
|
||||
# Run-time system search path for libraries
|
||||
sys_lib_dlsearch_path_spec="$escaped_sys_lib_dlsearch_path_spec"
|
||||
|
||||
EOF
|
||||
153
configure.ac
153
configure.ac
@@ -19,10 +19,11 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [1.3.4], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [1.3.6], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER([config.h:config.h.in])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
AC_PREREQ(2.54)
|
||||
|
||||
@@ -39,7 +40,7 @@ AM_GNU_GETTEXT([external], [need-ngettext])
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h regex.h termio.h termios.h unistd.h)
|
||||
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])
|
||||
AC_TRY_RUN([
|
||||
@@ -56,9 +57,9 @@ int main(void)
|
||||
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.])
|
||||
)
|
||||
)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions.]),
|
||||
AC_MSG_RESULT([cross-compiling; assuming no])))
|
||||
|
||||
dnl options
|
||||
AC_ARG_ENABLE(debug,
|
||||
@@ -84,7 +85,7 @@ AC_ARG_ENABLE(tiny,
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(NANO_SMALL, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in (crappy) file browser.])
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the ^G help menu.])
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
|
||||
@@ -99,9 +100,9 @@ AC_ARG_ENABLE(browser,
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(help,
|
||||
[ --disable-help Disable help function (^G)],
|
||||
[ --disable-help Disable help function],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the ^G help menu.])
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(justify,
|
||||
@@ -152,7 +153,6 @@ AC_ARG_ENABLE(color,
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
|
||||
AC_MSG_WARN([
|
||||
|
||||
***********************************************************************
|
||||
*** WARNING: Color support is far from perfect, but functional. ***
|
||||
*** Be careful with syntax in your .nanorc or nano may malfunction. ***
|
||||
@@ -180,7 +180,6 @@ AC_ARG_ENABLE(all,
|
||||
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. ***
|
||||
@@ -206,12 +205,31 @@ AC_ARG_WITH(slang,
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang])
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLutf8_enable(TRUE);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
else
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
@@ -224,19 +242,39 @@ int main(void)
|
||||
else
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang], [
|
||||
AC_MSG_RESULT(no)
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the term library
|
||||
for termlib in ncurses curses termcap terminfo termlib; do
|
||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
||||
test -n "$tcap" && break
|
||||
done
|
||||
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
|
||||
LIBS="$LIBS $tcap"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLutf8_enable(TRUE);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
@@ -249,14 +287,33 @@ int main(void)
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang], [
|
||||
AC_MSG_RESULT(no)
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the math library
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLutf8_enable(TRUE);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
@@ -272,7 +329,10 @@ int main(void)
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
@@ -290,16 +350,15 @@ AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
esac], [AC_MSG_RESULT(no)])
|
||||
|
||||
dnl Checks for functions
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf isblank strcasecmp strncasecmp strcasestr strnlen getline getdelim)
|
||||
if test "x$ac_cv_func_snprintf" = "xno" -o "xac_cv_func_vsnprintf" = "xno"
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf isblank iswalnum iswblank iswspace strcasecmp strncasecmp strcasestr strnlen getline getdelim mblen mbtowc wctomb wcwidth)
|
||||
if test "x$ac_cv_func_snprintf" = "xno" -o "x$ac_cv_func_vsnprintf" = "xno"
|
||||
then
|
||||
AM_PATH_GLIB_2_0(2.0.0,,
|
||||
[AM_PATH_GLIB(1.2.4,,
|
||||
[AC_MSG_ERROR([
|
||||
*** snprintf() and/or vsnprintf() not found. GLIB not found either.
|
||||
AC_MSG_ERROR([
|
||||
*** snprintf() and/or vsnprintf() not found. GLIB 2.x not found either.
|
||||
*** You need both snprintf() and vsnprintf(). Alternatively you can
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.])],
|
||||
glib)])
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
|
||||
glib)
|
||||
fi
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
@@ -310,44 +369,39 @@ AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS(getopt_long)
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_HEADERS(curses.h ncurses.h)
|
||||
AC_CHECK_LIB(ncurses, tgetent, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
|
||||
AC_CHECK_HEADERS(ncurses.h)
|
||||
AC_CHECK_LIB(ncursesw, wget_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE="yes"])
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
|
||||
fi
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(curses, tgetent, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
|
||||
fi
|
||||
|
||||
# Fallback for PDCurses and less useful curses libs...
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(termcap, tgetent, [CURSES_LIB="-ltermcap" CURSES_LIB_NAME=termcap])
|
||||
AC_CHECK_HEADERS(curses.h)
|
||||
AC_CHECK_LIB(curses, wget_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE="yes"])
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
|
||||
fi
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_MSG_WARN([
|
||||
*** No termcap lib available, consider getting the official ncurses
|
||||
*** No curses lib available. Consider getting the official ncurses
|
||||
*** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
|
||||
*** errors compiling nano.])
|
||||
else
|
||||
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the termcap library])
|
||||
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
|
||||
fi
|
||||
|
||||
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.]))
|
||||
|
||||
dnl Parse any configure options
|
||||
dnl Parse any configure options.
|
||||
|
||||
LIBS="$LIBS $CURSES_LIB"
|
||||
|
||||
@@ -362,6 +416,13 @@ then
|
||||
LDFLAGS="$LDFLAGS $GLIB_LIBS"
|
||||
fi
|
||||
|
||||
if test "x$CURSES_LIB_WIDE" = "xyes" -a "x$ac_cv_func_iswalnum" = "xyes" -a "x$ac_cv_func_mblen" = "xyes" -a "x$ac_cv_func_mbtowc" = "xyes" -a "x$ac_cv_func_wctomb" = "xyes" -a "x$ac_cv_func_wcwidth" = "xyes" && test "x$ac_cv_func_iswspace" = "xyes" -o "x$ac_cv_func_iswblank" = "xyes"
|
||||
then
|
||||
AC_DEFINE(NANO_WIDE, 1, [Define this if your system has sufficient wide character support (a wide curses library, iswalnum(), iswspace() or iswblank(), mblen(), mbtowc(), wctomb(), and wcwidth()).])
|
||||
else
|
||||
AC_MSG_WARN([Insufficient wide character support found. nano will not be able to support UTF-8.])
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
doc/Makefile
|
||||
|
||||
93
doc/faq.html
93
doc/faq.html
@@ -3,10 +3,9 @@
|
||||
<head>
|
||||
<title>The GNU nano editor FAQ</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en] (X11; U; Linux 2.2.16 i586) [Netscape]">
|
||||
</head>
|
||||
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
|
||||
<h1>The nano FAQ</h1>
|
||||
<h1>The GNU nano editor FAQ</h1>
|
||||
<h2>Table of Contents</h2>
|
||||
<h2><a href="#1">1. General</a></h2>
|
||||
<blockquote><p><a href="#1.1">1.1 About this FAQ</a><br>
|
||||
@@ -25,21 +24,24 @@
|
||||
<blockquote><p><a href="#3.1">3.1. How do I install the RPM or DEB package?</a><br>
|
||||
<a href="#3.2">3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</a><br>
|
||||
<a href="#3.3">3.3. Why does everything go into /usr/local?</a><br>
|
||||
<a href="#3.4">3.4. I get errors about 'bindtextdomain','gettext' and/or 'gettextdomain'. What can I do about it?</a><br>
|
||||
<a href="#3.4">3.4. I get errors about 'bindtextdomain','gettext', and/or 'gettextdomain'. What can I do about it?</a><br>
|
||||
<a href="#3.5">3.5. Nano should automatically run strip on the binary when installing it!</a><br>
|
||||
<a href="#3.6">3.6. How can I make the executable smaller? This is too bloated!</a><br>
|
||||
<a href="#3.7">3.7. Tell me more about this multibuffer stuff!</a><br>
|
||||
<a href="#3.8">3.8. Tell me more about this verbatim input stuff!</a><br>
|
||||
<a href="#3.9">3.9. How do I make a .nanorc file that nano will read when I start it?</a></p></blockquote>
|
||||
<h2><a href="#4">4. Running</a></h2>
|
||||
<blockquote><p><a href="#4.1">4.1. 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. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.3">4.3. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.4">4.4. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.5a">4.5a. [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.5b">4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.6">4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.7">4.7. I've compiled nano with color support, but I don't see any color when I run it!</a></p></blockquote>
|
||||
<blockquote><p><a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
|
||||
<a href="#4.2">4.2. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</a><br>
|
||||
<a href="#4.3">4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.4">4.4. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.5">4.5. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.6">4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.7a">4.7a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
|
||||
<a href="#4.7b">4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.8">4.8. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.9">4.9. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.10">4.10. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a></p></blockquote>
|
||||
<h2><a href="#5">5. Internationalization</a></h2>
|
||||
<blockquote><p><a href="#5.1">5.1. There's no translation for my language!</a><br>
|
||||
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a></p></blockquote>
|
||||
@@ -51,7 +53,7 @@
|
||||
<a href="#6.5">6.5. Why doesn't UW simply change their license?</a><br>
|
||||
<a href="#6.6">6.6. What if tomorrow UW changes the license to be truly Free Software?</a></p></blockquote>
|
||||
<h2><a href="#7">7. Miscellaneous</a></h2>
|
||||
<blockquote><p><a href="#7.1">7.1. Nano related mailing lists.</a><br>
|
||||
<blockquote><p><a href="#7.1">7.1. Nano-related mailing lists.</a><br>
|
||||
<a href="#7.2">7.2. I want to send the development team a big load of cash (or just a thank you).</a><br>
|
||||
<a href="#7.3">7.3. How do I submit a patch?</a><br>
|
||||
<a href="#7.4">7.4. How do I join the development team?</a><br>
|
||||
@@ -78,9 +80,9 @@
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "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.4. 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.6. 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.2/nano.1.html">here</a>.</p></blockquote>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.3/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="2"></a>2. Where to get GNU nano.</h1>
|
||||
<h2><a name="2.1"></a>2.1. FTP and WWW sites that carry nano.</h2>
|
||||
@@ -133,56 +135,65 @@
|
||||
<blockquote><p>Well, that's what the <b>configure</b> script defaults to. If you wish to change this, simply do this:</p>
|
||||
<p><b>./configure --prefix=/usr</b></p>
|
||||
<p>to put nano into /usr/bin when you run <b>make install</b>.</p></blockquote>
|
||||
<h2><a name="3.4"></a>3.4. I get errors about 'bindtextdomain', 'gettext' and/or 'gettextdomain'. What can I do about it?</h2>
|
||||
<h2><a name="3.4"></a>3.4. I get errors about 'bindtextdomain', 'gettext', and/or 'gettextdomain'. What can I do about it?</h2>
|
||||
<blockquote><p>Try doing a <b>./configure --with-included-gettext</b> and see if that solves your problem. You may need to do a <b>make clean; make</b> to get it to work fully.</p></blockquote>
|
||||
<h2><a name="3.5"></a>3.5. Nano should automatically run strip on the binary when installing it!</h2>
|
||||
<blockquote><p>Actually, it does, but you have to use <b>make install-strip</b>. The default make install does not, and will not, run strip automatically.</p></blockquote>
|
||||
<h2><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h2>
|
||||
<blockquote><p>Actually, there are several parts of the editor that can be disabled. You can pass arguments to the <b>configure</b> script that disable certain features. Here's a brief list:</p>
|
||||
<pre>
|
||||
<b>--disable-tabcomp</b> Disables tab completion code for a smaller binary
|
||||
<b>--disable-tabcomp</b> Disable tab completion code for a smaller
|
||||
binary
|
||||
<b>--disable-justify</b> Disable justify/unjustify function
|
||||
<b>--disable-speller</b> Disables spell checker function
|
||||
<b>--disable-help</b> Disables help function (^G)
|
||||
<b>--disable-browser</b> Disables mini file browser
|
||||
<b>--disable-wrapping</b> Disables all wrapping of text (and -w flag)
|
||||
<b>--disable-mouse</b> Disables mouse support (and -m flag)
|
||||
<b>--disable-speller</b> Disable spell checker function
|
||||
<b>--disable-help</b> Disable help function
|
||||
<b>--disable-browser</b> Disable mini file browser
|
||||
<b>--disable-wrapping</b> Disable all wrapping of text (and -w flag)
|
||||
<b>--disable-mouse</b> Disable mouse support (and -m flag)
|
||||
<b>--disable-operatingdir</b> Disable setting of operating directory</pre>
|
||||
<p>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the marker code that you use Control-^ to select with). Also, if you know you aren't going to be using other languages you can use <b>--disable-nls</b> to disable internationalization and save a few K to a few dozen K depending on if you have locale support on your system. And finally there's always good old <b>strip</b> to strip all debugging code and code that exists in libraries on your system.</p>
|
||||
<p>If, on the other hand, you can't live without bells and whistles, you could try:</p>
|
||||
<pre>
|
||||
<b>--enable-extra</b> Enable extra functions, including easter eggs
|
||||
<b>--enable-nanorc</b> Enable use of .nanorc file
|
||||
<b>--enable-color</b> Enables color and syntax highlighting
|
||||
<b>--enable-multibuffer</b> Enables having multiple file buffers open
|
||||
<b>--enable-all</b> Enables all of the above features</pre></blockquote>
|
||||
<b>--enable-color</b> Enable color and syntax highlighting
|
||||
<b>--enable-multibuffer</b> Enable having multiple file buffers open
|
||||
<b>--enable-all</b> Enable all of the above features
|
||||
<b>--disable-wrapping-as-root</b>
|
||||
Turn off wrapping of text by default when the
|
||||
user is root</pre></blockquote>
|
||||
<h2><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h2>
|
||||
<blockquote><p>To use multiple file buffers, you must be using nano 1.1.0 or newer, and you must have configured nano with <b>--enable-multibuffer</b> or <b>--enable-extra</b> (use nano -V to check). Then when you want to enable inserting a file into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<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 three-digit ASCII code from 000 to 255, and the character with that ASCII code will be inserted instead.</p>
|
||||
<p><b>NOTE:</b> Verbatim input doesn't work at prompts right now. This will be fixed soon.</p></blockquote>
|
||||
<p>Alternatively, you can press <b>Meta-V</b> and then type a four-digit hexadecimal code from 0000 to ffff (case-insensitive), and the character with the corresponding value will be inserted instead.</p></blockquote>
|
||||
<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%">
|
||||
<h1><a name="4"></a>4. Running</h1>
|
||||
<h2><a name="4.1"></a>4.1. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</h2>
|
||||
<h2><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h2>
|
||||
<blockquote><p>If a command line option that begins with '+' is followed by another option, the former is always treated as a starting line number and the latter is always treated as a filename. If a command line option that begins with '+' isn't followed by another option, it's always treated as a filename. Examples:</p>
|
||||
<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>
|
||||
<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 (like bash): <b>export TERM=vt100</b><br>
|
||||
<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.2"></a>4.2. Nano crashes when I type <insert keystroke here>!</h2>
|
||||
<h2><a name="4.3"></a>4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
|
||||
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, or Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
|
||||
<h2><a name="4.4"></a>4.4. Nano crashes when I type <insert keystroke here>!</h2>
|
||||
<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.3"></a>4.3. Nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<h2><a name="4.5"></a>4.5. 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.4"></a>4.4. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
|
||||
<h2><a name="4.6"></a>4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
|
||||
<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>
|
||||
<a name="4.5"></a>
|
||||
<h2><a name="4.5a"></a>4.5a. [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.7a"></a>4.7a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
|
||||
<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.5b"></a>4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<h2><a name="4.7b"></a>4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<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.6"></a>4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<h2><a name="4.8"></a>4.8. 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>
|
||||
@@ -195,8 +206,10 @@
|
||||
<p>Mutt users should see an effect immediately the next time you log in, no further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
|
||||
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
|
||||
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
|
||||
<h2><a name="4.7"></a>4.7. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<h2><a name="4.9"></a>4.9. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Some example configurations are in the <b>nanorc.sample</b> that comes with the nano source or your nano package. See Section <a href="#3.9">3.9</a>.</p></blockquote>
|
||||
<h2><a name="4.10"></a>4.10. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
|
||||
<blockquote><p>Try holding down the Shift key and selecting the text as you normally would.</p></blockquote>
|
||||
<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>
|
||||
@@ -221,13 +234,13 @@
|
||||
<blockquote><p>Honestly nothing would make me happier than to see that happen. Nano would continue to be developed independently until such time as Pico had all the features nano did or the projects merged. That just does not seem very likely given that there has been no sign of any changes in the past few years in a positive direction.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="7"></a>7. Miscellaneous</h1>
|
||||
<h2><a name="7.1"></a>7.1. Nano related mailing lists.</h2>
|
||||
<h2><a name="7.1"></a>7.1. Nano-related mailing lists.</h2>
|
||||
<blockquote><p>There are three mailing lists for nano hosted at <a href="http://savannah.gnu.org/">Savannah</a>, info-nano, help-nano and nano-devel. Info-nano is a very low traffic list where new versions of nano are announced (surprise!) Help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. Nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
|
||||
<p>info-nano - <a href="http://mail.gnu.org/mailman/listinfo/info-nano/">http://mail.gnu.org/mailman/listinfo/info-nano/</a><br>
|
||||
help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
|
||||
nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
|
||||
<h2><a name="7.2"></a>7.2. I want to send the development team a big load of cash (or just a thank you).</h2>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v1.2/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v1.2/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v1.3/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v1.3/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<h2><a name="7.3"></a>7.3. How do I submit a patch?</h2>
|
||||
<blockquote><p>See Section <a href="#7.2">7.2</a>.</p></blockquote>
|
||||
<h2><a name="7.4"></a>7.4. How do I join the development team?</h2>
|
||||
@@ -237,6 +250,10 @@
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote>
|
||||
<p>
|
||||
2005/03/09 - Added question about opening files with names beginning with '+'s, and added a few more miscellaneous cosmetic fixes. (DLR)<br>
|
||||
2005/01/03 - Removed now-inaccurate note about verbatim input's not working at prompts, and update its description to mention that it handles hexadecimal values now. (DLR)<br>
|
||||
2004/11/21 - Listed sh as an example of a Bourne shell. (DLR)<br>
|
||||
2004/11/05 - Fixed inaccuracy: Pico compatibility mode was made the default in nano 1.1.99pre1, not 1.2.2. Also added question about how to type F13-F16 on terminals lacking keys past F12 (suggested by Chris), question about how to select text for the clipboard in X terminals with nano's mouse support turned on (answer found by Joseph Birthisel), and misc. fixes and link updates. (DLR)<br>
|
||||
2004/04/07 - Removed NumLock glitch question, as it's no longer needed. (DLR)<br>
|
||||
2004/01/30 - Fixed inaccuracy: multibuffer mode was first in nano 1.1.0, not 1.1.12. (DLR)<br>
|
||||
2003/12/31 - Added question about the new verbatim input function, and a few minor fixes. Removed reference to "set pico" (DLR).<br>
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003 by
|
||||
.\" Chris Allegretta <chrisa@asty.org>
|
||||
.\"
|
||||
.\" (c) 2003 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" (c) 2003-2004 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.
|
||||
.\" 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
|
||||
.\" licence publique générale GNU (GNU GPL) pour connaître ses
|
||||
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
|
||||
.\"
|
||||
.TH NANO 1 "19 juin 2003 (v.f. du 25 août 2003)"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.4" "17 août 2004"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\"
|
||||
|
||||
|
||||
.SH NOM
|
||||
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
|
||||
@@ -25,23 +28,31 @@ nano \- NAno un NOuvel
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement la commande \fBnano\fP.
|
||||
Cette page de manuel décrit brièvement la commande \fBnano\fR.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" respectively.
|
||||
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à remplacer
|
||||
Pico, l'éditeur par défaut du paquet non-libre Pine. \fBnano\fP ne se
|
||||
contentant pas de copier l'interface et l'ergonomie de Pico, il offre
|
||||
également certaines fonctionnalités manquantes (ou désactivées par
|
||||
défaut) de Pico. Ces fonctionnalités sont, par exemple, les fonctions de
|
||||
recherche et de remplacement, et la possibilité de sauter directement à
|
||||
un numéro de ligne.
|
||||
\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
|
||||
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.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILIGNE\fP
|
||||
Démarre avec le curseur positionné à la ligne numéro \fILIGNE\fP.
|
||||
.B \+\fILIGNE\fR
|
||||
Démarre avec le curseur positionné à la ligne numéro \fILIGNE\fR.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
Active le fonctionnement évolué de la touche «\ Début\ ». Lorsque cette
|
||||
touche est pressée à n'importe quel endroit excepté au tout début du
|
||||
texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur se
|
||||
positionnera à ce début de ligne (qu'il soit en avant ou en arrière). Si
|
||||
le curseur est déjà au tout début de la ligne, il se placera au vrai
|
||||
début de la ligne.
|
||||
.TP
|
||||
.B \-B (\-\-backup)
|
||||
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
|
||||
@@ -50,55 +61,46 @@ version pr
|
||||
.B \-D (\-\-dos)
|
||||
Écrit le fichier au format DOS.
|
||||
.TP
|
||||
.B \-E \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
|
||||
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
|
||||
de sécurité si celles-ci sont activées.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
Active le mode multifichiers, autorisant l'édition simultanée de
|
||||
plusieurs fichiers, si ce mode est disponible.
|
||||
Active le mode multifichier, autorisant l'édition simultanée de plusieurs
|
||||
fichiers, si ce mode est disponible.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
|
||||
remplacement dans le fichier
|
||||
.I ~/.nano_history
|
||||
afin de permettre leur réutilisation. Ceci n'est possible que si
|
||||
.B nano
|
||||
est capable d'utiliser les fichiers
|
||||
nanorc.
|
||||
remplacement dans le fichier \fI~/.nano_history\fR afin de permettre leur
|
||||
réutilisation. Ceci n'est possible que si \fBnano\fR est configuré pour
|
||||
utiliser les fichiers nanorc.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
N'utilise pas les fichiers
|
||||
.I $SYSCONFDIR/nanorc
|
||||
et
|
||||
.IR ~/.nanorc ,
|
||||
même si
|
||||
.B nano
|
||||
est capable de les utiliser.
|
||||
.TP
|
||||
.B \-K (\-\-keypad)
|
||||
Essaie au maximum de ne pas utiliser les appels keypad() de ncurses.
|
||||
Utilisez ce paramètre si vous vous apercevez que les flèches du pavé
|
||||
numérique ne fonctionnent pas sous nano.
|
||||
N'utilise pas les fichiers \fISYSCONFDIR/nanorc\fR et \fI~/.nanorc\fR, même si
|
||||
\fBnano\fR est capable de les utiliser.
|
||||
.TP
|
||||
.B \-M (\-\-mac)
|
||||
Écrit le fichier au format Mac.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
Désactive la conversion automatique des fichiers depuis les
|
||||
formats Mac et DOS.
|
||||
Désactive la conversion automatique des fichiers depuis les formats Mac et
|
||||
DOS.
|
||||
.TP
|
||||
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
|
||||
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
|
||||
pour réaliser une justification correcte des citations.
|
||||
Si nano est capable d'utiliser des expressions rationnelles, le préfixe
|
||||
par défaut sera "^([\ \\t]*[|>:}#])+", sinon, ce sera ">\ ".
|
||||
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
|
||||
pour réaliser une justification correcte des citations. Si nano est
|
||||
capable d'utiliser des expressions rationnelles, le préfixe par défaut
|
||||
sera "^([\ \\t]*[|>:}#])+", sinon, ce sera ">\ ".
|
||||
.TP
|
||||
.B \-R (\-\-regexp)
|
||||
Active l'utilisation d'expressions rationnelles lors des recherches,
|
||||
ainsi que la possibilité d'utiliser \\\fIn\fP dans les chaînes de
|
||||
remplacement pour faire référence à la \fIn\fP-ième sous-expression du
|
||||
motif de recherche, si cette fonction est disponible.
|
||||
Active l'utilisation d'expressions rationnelles lors des recherches, ainsi
|
||||
que la possibilité d'utiliser \\n dans les chaînes de remplacement pour
|
||||
faire référence à la n-ième sous-expression du motif de recherche, si
|
||||
cette fonction est disponible.
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Active le défilement progressif. Le texte défilera ligne-par-ligne au
|
||||
lieu de défiler morceau-par-morceau.
|
||||
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
|
||||
de défiler morceau-par-morceau.
|
||||
.TP
|
||||
.B \-T \fInombre\fP (\-\-tabsize=\fInombre\fP)
|
||||
Définit la taille (largeur) des tabulations.
|
||||
@@ -108,55 +110,68 @@ Affiche le num
|
||||
.TP
|
||||
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
|
||||
Indique quel mode de colorisation syntaxique adopter, parmi les modes
|
||||
définis dans le fichier
|
||||
.IR .nanorc ,
|
||||
si cette fonctionnalité est disponible.
|
||||
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
|
||||
disponible.
|
||||
.TP
|
||||
.B \-Z (\-\-restricted)
|
||||
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
|
||||
sur la ligne de commande, pas de lecture des fichiers nanorc,
|
||||
interdiction de suspendre et interdiction de sauvegarder (ou d'ajouter
|
||||
en tête ou en fin) un fichier ayant déjà un nom sous un nom différent.
|
||||
Cette option peut aussi être activée en appelant \fBnano\fP sous un nom
|
||||
commençant par «\ r\ » (par exemple «\ rnano\ »).
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Affiche en permanence la position du curseur.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous devriez n'avoir besoin de cette option que si la touche
|
||||
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
|
||||
sur votre système.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Affiche de la liste des options disponibles en ligne de commande.
|
||||
Affiche un résumé des options disponibles en ligne de commande.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
Indentation automatique. Commence chaque nouvelle ligne au même niveau
|
||||
que la ligne précédente. Utile pour l'édition de code source.
|
||||
Indentation automatique. Commence chaque nouvelle ligne au même niveau que
|
||||
la ligne précédente. Utile pour l'édition de code source.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
^K coupe le texte du curseur à la fin de la ligne, au lieu de couper la
|
||||
^K coupe le texte du curseur à la fin de la ligne, au lieu de couper la
|
||||
ligne entière.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
Si le fichier édité est un lien symbolique, remplace le lien par le
|
||||
nouveau fichier, sans le suivre. Ce mode ne serait-il pas utile pour
|
||||
éditer les fichiers de
|
||||
.IR /tmp \ ?
|
||||
Si le fichier édité est un lien symbolique, remplace le lien par le
|
||||
nouveau fichier, sans le suivre. Ce mode ne serait-il pas utile pour éditer
|
||||
les fichiers de \fI/tmp\fR ?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Active l'utilisation de la souris (si elle est disponible sur votre
|
||||
Active l'utilisation de la souris (si elle est disponible sur votre
|
||||
système).
|
||||
.TP
|
||||
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
|
||||
Définit le répertoire de travail. Demande à nano de mettre en place
|
||||
quelque-chose de similaire à une cage chroot.
|
||||
Définit le répertoire de travail. Demande à nano de mettre en place
|
||||
quelque chose de similaire à un environnement d'exécution restreint
|
||||
(\fIchroot\fR).
|
||||
.TP
|
||||
.B \-p (\-\-preserve)
|
||||
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient
|
||||
reçues par le terminal.
|
||||
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient reçues
|
||||
par le terminal.
|
||||
.TP
|
||||
.B \-r \fIcolonne\fP (\-\-fill=\fIcolonne\fP)
|
||||
Passe automatiquement à la ligne à la colonne \fIcolonne\fP. Par défaut,
|
||||
le passage à la ligne se fait à la taille de l'écran moins huit. Si la
|
||||
valeur indiquée est négative, le point de passage à la ligne sera
|
||||
calculé relativement au bord droit de l'écran. Cela permet de faire
|
||||
varier le point de passage à la ligne lorsque l'on change la taille de
|
||||
l'écran.
|
||||
Passe automatiquement à la ligne à la colonne \fIcolonne\fR. Par défaut, le
|
||||
passage à la ligne se fait à la taille de l'écran moins huit. Si la
|
||||
valeur indiquée est négative, le point de passage à la ligne sera
|
||||
calculé relativement au bord droit de l'écran. Cela permet de faire varier
|
||||
le point de passage à la ligne lorsque l'on change la taille de l'écran.
|
||||
.TP
|
||||
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
|
||||
Choix d'un correcteur orthographique de remplacement.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
|
||||
demande de confirmation. Identique à l'option -t de Pico.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
@@ -174,56 +189,58 @@ Autorise
|
||||
.B \-a, \-b, \-e, \-f, \-g, \-j
|
||||
Ignoré, pour être compatible avec Pico.
|
||||
|
||||
.SH FICHIERS D'INITIALISATION
|
||||
\fBnano\fP lit les fichiers d'initialisation dans l'ordre suivant\ :
|
||||
\fI$SYSCONFDIR/nanorc\fP, puis \fI~/.nanorc\fP. Reportez-vous à la page
|
||||
de manuel de \fBnanorc\fP(5) et au fichier-exemple \fInanorc.sample\fP
|
||||
qui devrait être livré avec \fBnano\fP.
|
||||
.SH "FICHIERS D'INITIALISATION"
|
||||
\fBnano\fR lit les fichiers d'initialisation dans l'ordre suivant\ :
|
||||
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de manuel
|
||||
de \fBnanorc\fR(5) et au fichier-exemple \fInanorc.sample\fR qui devrait être
|
||||
livré avec \fBnano\fR.
|
||||
|
||||
.SH NOTES
|
||||
Dans certains cas, \fBnano\fP essaiera de sauvegarder le fichier en
|
||||
cours d'édition dans un fichier de secours. Cela arrivera
|
||||
principalement si \fBnano\fP reçoit un signal SIGHUP ou SIGTERM, ou
|
||||
bien se trouve à court de mémoire. Le nom de ce fichier de secours sera
|
||||
\fInano.save\fP si le fichier en cours n'avait pas encore de nom, ou
|
||||
sera composé du nom du fichier en cours suivi du suffixe «\ .save\ ». Si
|
||||
un fichier de ce nom existe déjà dans le répertoire, un «\ .save\ » et
|
||||
un nombre seront ajoutée à la fin du nom du fichier en cours afin de le
|
||||
rendre unique (par exemple, «\ .save.1\ »). En mode multifichiers,
|
||||
\fBnano\fP réalisera une sauvegarde de tous les fichiers en cours dans
|
||||
leurs fichiers de secours respectifs.
|
||||
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
|
||||
ligne de commande ou dans le fichier nanorc, \fBnano\fR prendra
|
||||
la commande indiquée par la variable d'environnement \fBSPELL\fR si
|
||||
elle est définie.
|
||||
|
||||
Dans certains cas, \fBnano\fR essaiera de sauvegarder le fichier en cours
|
||||
d'édition dans un fichier de secours. Cela arrivera principalement si
|
||||
\fBnano\fR reçoit un signal SIGHUP ou SIGTERM, ou bien se trouve à court de
|
||||
mémoire. Le nom de ce fichier de secours sera \fInano.save\fR si le fichier en
|
||||
cours n'avait pas encore de nom, ou sera composé du nom du fichier en cours
|
||||
suivi du suffixe «\ .save\ ». Si un fichier de ce nom existe déjà dans
|
||||
le répertoire, un «\ .save\ » et un nombre seront ajoutés à la fin du
|
||||
nom du fichier en cours afin de le rendre unique (par exemple,
|
||||
«\ .save.1\ »). En mode multifichier, \fBnano\fR réalisera une
|
||||
sauvegarde de tous les fichiers en cours dans leurs fichiers de secours
|
||||
respectifs.
|
||||
|
||||
.SH BOGUES
|
||||
Merci de nous faire parvenir vos commentaires et de nous signaler les
|
||||
bogues, en écrivant, en anglais, à
|
||||
.BR nano@nano-editor.org .
|
||||
Merci de nous faire parvenir vos commentaires et de nous signaler les
|
||||
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
|
||||
|
||||
N'hésitez pas à faire parvenir vos suggestions et commentaires relatifs
|
||||
à la version française de \fBnano\fP à
|
||||
.BR jean-philippe.guerard@corbeaunoir.org .
|
||||
La liste de discussion anglophone \fBnano\fR est disponible via
|
||||
\fBnano-devel@gnu.org\fR.
|
||||
|
||||
La liste de discussion anglophone \fBnano\fP est disponible via
|
||||
.BR nano-devel@gnu.org .
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
.BR nano-devel-request@gnu.org ,
|
||||
ayant pour objet «\ subscribe\ ».
|
||||
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
|
||||
|
||||
.SH SITE INTERNET
|
||||
.SH "SITE INTERNET"
|
||||
http://www.nano-editor.org/
|
||||
|
||||
.SH VOIR AUSSI
|
||||
.SH "VOIR AUSSI"
|
||||
.PD 0
|
||||
.TP
|
||||
\fBnanorc\fP(5)
|
||||
\fBnanorc\fR(5)
|
||||
.PP
|
||||
\fI/usr/share/doc/nano/\fP (ou son équivalent sur votre système)
|
||||
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fP et \fITHANKS\fP pour plus d'information). Cette page de
|
||||
manuel a été initialement rédigée par Jordi Mallach
|
||||
<jordi@sindominio.net> pour le système GNU Debian (mais elle peut être
|
||||
utilisée par d'autres).
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fR et \fITHANKS\fR pour plus d'information). Cette page de manuel a
|
||||
été initialement rédigée par Jordi Mallach
|
||||
<jordi@sindominio.net> pour le système GNU Debian (mais elle peut
|
||||
être utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>, 2003.
|
||||
|
||||
Adaptation française du 4\ septembre\ 2004 par
|
||||
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" (c) 2003 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" (c) 2003-2004 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
|
||||
@@ -11,11 +11,12 @@
|
||||
.\" licence publique générale GNU (GNU GPL) pour connaître ses
|
||||
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
|
||||
.\"
|
||||
.TH NANORC 5 "19 juin 2003 (v.f. du 25 août 2003)"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 1.3.4" "17 août 2004"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
|
||||
.SH NAME
|
||||
.SH NOM
|
||||
nanorc \- fichier de configuration de l'éditeur nano du projet GNU
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -32,7 +33,7 @@ sauter directement
|
||||
.PP
|
||||
Le fichier \fInanorc\fP contient les paramètres par défaut de
|
||||
\fBnano\fP. Lors de son démarrage, nano commence par lire le fichier de
|
||||
configuration général \fI$SYSCONFDIR/nanorc\fP, puis lit le fichier de
|
||||
configuration général \fISYSCONFDIR/nanorc\fP, puis lit le fichier de
|
||||
configuration personnel de l'utilisateur \fI~/.nanorc\fP.
|
||||
|
||||
.SH OPTIONS
|
||||
@@ -44,9 +45,9 @@ De plus, les mots clefs
|
||||
sont utilisés pour définir les règles de colorisation pour différents
|
||||
motifs de texte. Nano lira une commande par ligne.
|
||||
|
||||
Les options du fichier de configuration ont priorité sur les valeurs par
|
||||
défaut utilisées par nano. Les options données sur la ligne de commande
|
||||
permettent d'outrepasser les 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.
|
||||
@@ -58,16 +59,15 @@ Les commandes et arguments reconnus sont\ :
|
||||
Active l'indentation automatique.
|
||||
.TP
|
||||
\fBset/unset backup\fP
|
||||
Crée des copie de sécurité appelées
|
||||
Crée des copie de sécurité nommées
|
||||
.IR nom_du_fichier~ .
|
||||
.TP
|
||||
\fBset/unset const\fP
|
||||
Affiche en permanence la position du curseur dans la barre
|
||||
d'information.
|
||||
Affiche en permanence la position du curseur dans la ligne d'état.
|
||||
.TP
|
||||
\fBset/unset cut\fP
|
||||
Par défaut, utilise ^K pour couper le texte du curseur à la fin de la
|
||||
ligne, au lieu de couper la ligne entière.
|
||||
Par défaut, ^K coupe le texte du curseur jusqu'à la fin de la ligne, au
|
||||
lieu de couper la ligne entière.
|
||||
.TP
|
||||
\fBset fill \fIn\fP\fP
|
||||
Passe automatiquement à la ligne à la colonne \fIn\fP. Si la valeur
|
||||
@@ -80,11 +80,9 @@ Active l'utilisation de
|
||||
pour enregistrer et relire les chaînes ayant fait l'objet d'une
|
||||
recherche ou d'un remplacement.
|
||||
.TP
|
||||
\fBset/unset keypad\fP
|
||||
Utilise l'autre gestion du pavé numérique.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
Permet de charger simultanément plusieurs fichiers.
|
||||
Mode multifichier\ : permet de charger les fichiers dans leur propre
|
||||
espace.
|
||||
.TP
|
||||
\fBset/unset noconvert\fP
|
||||
Pas de conversion depuis les formats DOS et Mac.
|
||||
@@ -93,7 +91,7 @@ Pas de conversion depuis les formats DOS et Mac.
|
||||
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
|
||||
.TP
|
||||
\fBset/unset nohelp\fP
|
||||
Désactive la barre d'aide affichée en bas de l'écran.
|
||||
Désactive les lignes d'aide affichée en bas de l'écran.
|
||||
.TP
|
||||
\fBset/unset nowrap\fP
|
||||
Désactive le passage automatique à la ligne.
|
||||
@@ -101,12 +99,24 @@ D
|
||||
\fBset operatingdir "\fIrépertoire\fP"\fP
|
||||
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
|
||||
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
|
||||
le répertoire courant, afin que les fichiers soient écrits dans ce
|
||||
dossier. Par défaut, cette fonction est désactivée.
|
||||
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
|
||||
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 d'espaces ou de tabulations. Seules les
|
||||
ponctuations terminales, éventuellement suivies de crochets fermants,
|
||||
peuvent terminer une phrase.
|
||||
|
||||
(N.D.T.\ : ce réglage permet de conserver 2\ espaces au lieu d'une
|
||||
derrière les ponctuations terminales lors de la justification, ce qui
|
||||
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.)
|
||||
.TP
|
||||
\fBset quotestr "\fIchaîne\fP"\fP
|
||||
Définit le préfixe par défaut utilisé pour les citations dans les
|
||||
courriers électroniques. Ce préfixe est utilisé pour réaliser une
|
||||
@@ -120,9 +130,24 @@ expressions rationnelles, la valeur par d
|
||||
Sinon, ce sera ">\ ". Notez que le «\ \\t\ » ci-dessus correspond à un
|
||||
caractère de tabulation.
|
||||
.TP
|
||||
\fBset/unset rebinddelete\fP
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous devriez uniquement avoir besoin de cette option si la touche
|
||||
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
|
||||
sur votre système.
|
||||
.TP
|
||||
\fBset/unset regexp\fP
|
||||
Utilise par défaut des expressions rationnelles pour les recherches.
|
||||
.TP
|
||||
\fBset/unset smarthome\fP
|
||||
Active le fonctionnement évolué de la touche «\ Début\ ». Lorsque cette
|
||||
touche est pressée à n'importe quel endroit excepté au tout début du
|
||||
texte d'une ligne (i.\ e. au premier caractère non-blanc), le curseur se
|
||||
positionnera à ce début de ligne (qu'il soit en avant ou en arrière). Si
|
||||
le curseur est déjà au tout début de la ligne, il se placera au vrai
|
||||
début de la ligne.
|
||||
.TP
|
||||
\fBset/unset smooth\fP
|
||||
Active le défilement ligne-par-ligne du texte.
|
||||
.TP
|
||||
@@ -138,18 +163,23 @@ Utilise une largeur de tabulation de \fIn\fP au lieu de la valeur par
|
||||
défaut (8). Cette valeur doit être supérieur à 0.
|
||||
.TP
|
||||
\fBset/unset tempfile\fP
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement
|
||||
sans demande de confirmation.
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement en
|
||||
quittant, sans demande de confirmation.
|
||||
.TP
|
||||
\fBset/unset view\fP
|
||||
Interdit la modification du fichier.
|
||||
.TP
|
||||
\fBset whitespace "\fIchaîne\fP"\fP
|
||||
Définit les deux caractères utilisés pour afficher les premiers
|
||||
caractères de tabulations et d'espaces. Cela ne doit pas être
|
||||
des caractère de contrôle.
|
||||
.TP
|
||||
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
|
||||
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
|
||||
l'option \fB-Y\fP, ou qui sera automatiquement activé si le nom du
|
||||
fichier en cours correspond au \fImotif_de_fichier\fP. Toutes les
|
||||
instructions de colorisation \fBcolor\fP suivantes s'appliqueront à cette
|
||||
syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
|
||||
instructions suivantes de colorisation \fBcolor\fP s'appliqueront à
|
||||
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
|
||||
.TP
|
||||
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
|
||||
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
|
||||
@@ -170,7 +200,7 @@ par \fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
|
||||
et éventuellement la couleur de fond \fIcouleur_fond\fP. Cela permet à
|
||||
la colorisation syntaxique de s'étendre sur plusieurs lignes. Notez que
|
||||
toutes les occurrences successives de \fImotif_début\fP après le
|
||||
\fImotif_début\fP initial seront colorées jusqu'à la prochaine instance
|
||||
\fImotif_début\fP initial seront surlignées jusqu'à la prochaine instance
|
||||
de \fImotif_fin\fP.
|
||||
|
||||
.SH FICHIERS
|
||||
@@ -195,4 +225,6 @@ Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
manuel a été rédigée par Jordi Mallach <jordi@gnu.org>.
|
||||
|
||||
.SH TRADUCTION
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>, 2003.
|
||||
|
||||
Adaptation française du 4\ septembre\ 2004 par
|
||||
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003 by
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by
|
||||
.\" Chris Allegretta <chrisa@asty.org>
|
||||
.\"
|
||||
.\" 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.4" "August 17, 2004"
|
||||
.TH NANO 1 "version 1.3.6" "March 11, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -46,9 +46,6 @@ line.
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
.TP
|
||||
.B \-D (\-\-dos)
|
||||
Write file in DOS format.
|
||||
.TP
|
||||
.B \-E \fIdir\fP (\-\-backupdir=\fIdir\fP)
|
||||
Set the directory where \fBnano\fP puts the backup files if file backups
|
||||
are enabled.
|
||||
@@ -69,12 +66,12 @@ or
|
||||
.IR ~/.nanorc ,
|
||||
if nanorc support is available.
|
||||
.TP
|
||||
.B \-M (\-\-mac)
|
||||
Write file in Mac format.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.B \-O (\-\-morespace)
|
||||
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
|
||||
@@ -122,11 +119,11 @@ Indent new lines to the previous line's indentation. Useful when
|
||||
editing source code.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
Enable cut from cursor to end of line with ^K.
|
||||
Enable cut from cursor to end of line.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
If the file being edited is a symbolic link, replace the link with
|
||||
a new file, do not follow it. Good for editing files in
|
||||
a new file instead of following it. Good for editing files in
|
||||
.IR /tmp ,
|
||||
perhaps?
|
||||
.TP
|
||||
@@ -151,7 +148,7 @@ to vary along with the screen width if resized.
|
||||
Enable alternative spell checker command.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
Always save changed buffer without prompting. Same as Pico -t option.
|
||||
Always save changed buffer without prompting. Same as Pico's -t option.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
View file (read only) mode.
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
.\" nanorc.5 is Copyright (C) 2003, 2004, 2005 Free Software
|
||||
.\" Foundation, Inc.
|
||||
.\"
|
||||
.\" 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.4" "August 17, 2004"
|
||||
.TH NANORC 5 "version 1.3.6" "March 11, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -59,7 +60,7 @@ closing brackets, can end sentences.
|
||||
Constantly display the cursor position in the status bar.
|
||||
.TP
|
||||
\fBset/unset cut\fP
|
||||
Use cut to end of line with ^K by default.
|
||||
Use cut to end of line by default.
|
||||
.TP
|
||||
\fBset fill \fIn\fP\fP
|
||||
Wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the line
|
||||
@@ -70,6 +71,13 @@ Enable
|
||||
.I ~/.nano_history
|
||||
for saving and reading search/replace strings.
|
||||
.TP
|
||||
\fBset/unset morespace\fP
|
||||
Allow use of the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
\fBset/unset mouse\fP
|
||||
Enable mouse support, so that mouse clicks can be used to set the mark
|
||||
and run shortcuts.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
Allow inserting files into their own buffers.
|
||||
.TP
|
||||
@@ -132,7 +140,7 @@ Use spelling checker \fIspellprog\fP instead of the built-in one, which
|
||||
calls \fIspell\fP.
|
||||
.TP
|
||||
\fBset/unset suspend\fP
|
||||
Allow nano to be suspended with ^Z.
|
||||
Allow nano to be suspended.
|
||||
.TP
|
||||
\fBset tabsize \fIn\fP\fP
|
||||
Use a tab size of \fIn\fP columns instead of the default (8); must be
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
## Constantly display the cursor position in the status bar.
|
||||
# set const
|
||||
|
||||
## Use cut to end of line with ^K by default.
|
||||
## Use cut to end of line by default.
|
||||
# set cut
|
||||
|
||||
## Set the line length for wrapping text and justifying paragraphs.
|
||||
@@ -38,13 +38,16 @@
|
||||
## Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
# set historylog
|
||||
|
||||
## Enable mouse support so that mouse clicks can be used to set the mark
|
||||
## and run shortcuts.
|
||||
## 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 (using ^R will insert into a separate
|
||||
## buffer). You must have configured with --enable-multibuffer or
|
||||
## --enable-extra for this to work.
|
||||
## Allow multiple file buffers (inserting a file will put it into a
|
||||
## separate buffer). You must have configured with --enable-multibuffer
|
||||
## or --enable-extra for this to work.
|
||||
##
|
||||
# set multibuffer
|
||||
|
||||
@@ -104,9 +107,9 @@
|
||||
## Use this spelling checker instead of the internal one. This option
|
||||
## does not properly have a default value.
|
||||
##
|
||||
# set speller "aspell -c"
|
||||
# set speller "aspell -x -c"
|
||||
|
||||
## Allow nano to be suspended with ^Z.
|
||||
## Allow nano to be suspended.
|
||||
# set suspend
|
||||
|
||||
## Use this tab size instead of the default; it must be greater than 0.
|
||||
@@ -115,11 +118,12 @@
|
||||
## Save automatically on exit, don't prompt.
|
||||
# set tempfile
|
||||
|
||||
## Disallow file modification, why would you want this in an rc file? ;)
|
||||
## Disallow file modification; why would you want this in an rcfile? ;)
|
||||
# set view
|
||||
|
||||
## The two characters used to display the first characters of tabs and
|
||||
## spaces. ASCII 187 and ASCII 183 seem to be good values for these.
|
||||
## spaces. 187 decimal (00BB hexadecimal) and 183 decimal (00B7
|
||||
## hexadecimal) seem to be good values for these.
|
||||
# set whitespace " "
|
||||
|
||||
## Color setup
|
||||
@@ -139,8 +143,9 @@
|
||||
# syntax "c-file" "\.(c|h)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# color green "\<(float|double|char|int|short|long|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|switch|break)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|switch|goto|continue|break|return)\>"
|
||||
# color brightcyan "^ *# *(define|undef|include|ifn?def|endif|elif|else|if)"
|
||||
# color brightmagenta "'([^\]|(\\['abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
|
||||
##
|
||||
## You will in general want your comments and strings to come last,
|
||||
## because syntax highlighting rules will be applied in the order they
|
||||
@@ -236,18 +241,28 @@
|
||||
# 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 your .nanorc
|
||||
##
|
||||
#syntax "nanorc" "(\.|/|)nanorc$"
|
||||
# syntax "nanorc" "(\.|/|)nanorc$"
|
||||
## highlight possible errors and parameters
|
||||
#color brightwhite "^ *(set|unset|syntax|color).*$"
|
||||
# color brightwhite "^ *(set|unset|syntax|color).*$"
|
||||
## set, unset and syntax
|
||||
#color cyan "^ *(set|unset) +(autoindent|backup|backupdir|brackets|const|cut|fill|historylog|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quotestr|rebinddelete|regexp|smarthome|smooth|speller|suspend|tabsize|tempfile|view|whitespace)"
|
||||
#color green "^ *(set|unset|syntax)\>"
|
||||
# color cyan "^ *(set|unset) +(autoindent|backup|backupdir|brackets|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quotestr|rebinddelete|regexp|smarthome|smooth|speller|suspend|tabsize|tempfile|view|whitespace)"
|
||||
# color green "^ *(set|unset|syntax)\>"
|
||||
## colors
|
||||
#color yellow "^ *color +(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
#color magenta "^ *color\>" "\<(start|end)="
|
||||
# color yellow "^ *color +(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
# color magenta "^ *color\>" "\<(start|end)="
|
||||
## strings
|
||||
#color white "\"(\\.|[^\"])*\""
|
||||
# color white "\"(\\.|[^\"])*\""
|
||||
## comments
|
||||
#color blue "^ *#.*$"
|
||||
# color blue "^ *#.*$"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
info_TEXINFOS = nano.texi
|
||||
|
||||
MAKEINFO = makeinfo --no-split
|
||||
|
||||
EXTRA_DIST = nano.info
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
@c Run `makeinfo' rather than `texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.3.4
|
||||
@set UPDATED 17 Aug 2004
|
||||
@set VERSION 1.3.6
|
||||
@set UPDATED 11 Mar 2005
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.3.4
|
||||
@subtitle version 1.3.6
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -33,7 +33,7 @@ editor.
|
||||
|
||||
This manual is part of the GNU @code{nano} distribution.@*
|
||||
@sp4
|
||||
Copyright (C) 1999, 2000, 2001, 2002 Chris Allegretta.
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Chris Allegretta.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
@@ -118,9 +118,6 @@ line.
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
|
||||
@item -D, --dos
|
||||
Write file in DOS format.
|
||||
|
||||
@item -E, --backupdir=[dir]
|
||||
Set the directory where @code{nano} puts the backup files if file
|
||||
backups are enabled.
|
||||
@@ -132,9 +129,6 @@ Enable multiple file buffers, if available.
|
||||
Don't look at SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
|
||||
available.
|
||||
|
||||
@item -M, --mac
|
||||
Write file in Mac format.
|
||||
|
||||
@item -N, --noconvert
|
||||
Do not convert files from DOS/Mac format.
|
||||
|
||||
@@ -187,16 +181,15 @@ Automatically indent new lines to the same number of spaces and tabs as
|
||||
the previous line.
|
||||
|
||||
@item -k, --cut
|
||||
Makes ^K cut from the current cursor position to the end of the current
|
||||
line.
|
||||
Cut from the current cursor position to the end of the current line.
|
||||
|
||||
@item -l, --nofollow
|
||||
When writing files, if the given file is a symbolic link it is removed
|
||||
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).
|
||||
running under the X Window System).
|
||||
|
||||
@item -o [dir], --operatingdir=[dir]
|
||||
Set operating directory. Makes @code{nano} set up something similar to
|
||||
@@ -348,16 +341,13 @@ The following global toggles are available:
|
||||
@item Backup File Toggle (Meta-B)
|
||||
toggles the -B (@code{--backup}) command line flag.
|
||||
|
||||
@item DOS Format Toggle (Meta-D)
|
||||
toggles the -D (@code{--dos}) command line flag.
|
||||
|
||||
@item Multiple Files Toggle (Meta-F)
|
||||
@item Multiple File Buffers Toggle (Meta-F)
|
||||
toggles the -F (@code{--multibuffer}) command line flag.
|
||||
|
||||
@item Backup File Toggle (Meta-H)
|
||||
toggles the -A (@code{--smarthome}) command line flag.
|
||||
|
||||
@item AutoIndent Toggle (Meta-I)
|
||||
@item Auto Indent Toggle (Meta-I)
|
||||
toggles the -i (@code{--autoindent}) command line flag.
|
||||
|
||||
@item Cut To End Toggle (Meta-K)
|
||||
@@ -369,8 +359,8 @@ toggles the -w (@code{--nowrap}) command line flag.
|
||||
@item Mouse Toggle (Meta-M)
|
||||
toggles the -m (@code{--mouse}) command line flag.
|
||||
|
||||
@item Mac Format Toggle (Meta-O)
|
||||
toggles the -M (@code{--mac}) command line flag.
|
||||
@item More Space Toggle (Meta-O)
|
||||
toggles the -O (@code{--morespace}) command line flag.
|
||||
|
||||
@item Smooth Scrolling Toggle (Meta-S)
|
||||
toggles the -S (@code{--smooth}) command line flag.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
EXTRA_DIST = ulonglong.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 \
|
||||
stdint_h.m4 uintmax_t.m4 isc-posix.m4 lib-ld.m4 lib-link.m4 \
|
||||
lib-prefix.m4 codeset.m4 glibc21.m4 progtest.m4 gettext.m4 \
|
||||
iconv.m4 lcmessage.m4
|
||||
iconv.m4 lcmessage.m4 glib-2.0.m4
|
||||
|
||||
212
m4/glib-2.0.m4
Normal file
212
m4/glib-2.0.m4
Normal file
@@ -0,0 +1,212 @@
|
||||
# Configure paths for GLIB
|
||||
# Owen Taylor 1997-2001
|
||||
|
||||
dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
|
||||
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
|
||||
dnl gthread is specified in MODULES, pass to pkg-config
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_GLIB_2_0],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from pkg-config
|
||||
dnl
|
||||
AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
|
||||
, enable_glibtest=yes)
|
||||
|
||||
pkg_config_args=glib-2.0
|
||||
for module in . $4
|
||||
do
|
||||
case "$module" in
|
||||
gmodule)
|
||||
pkg_config_args="$pkg_config_args gmodule-2.0"
|
||||
;;
|
||||
gobject)
|
||||
pkg_config_args="$pkg_config_args gobject-2.0"
|
||||
;;
|
||||
gthread)
|
||||
pkg_config_args="$pkg_config_args gthread-2.0"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||
|
||||
no_glib=""
|
||||
|
||||
if test x$PKG_CONFIG != xno ; then
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
|
||||
:
|
||||
else
|
||||
echo *** pkg-config too old; version 0.7 or better required.
|
||||
no_glib=yes
|
||||
PKG_CONFIG=no
|
||||
fi
|
||||
else
|
||||
no_glib=yes
|
||||
fi
|
||||
|
||||
min_glib_version=ifelse([$1], ,2.0.0,$1)
|
||||
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
|
||||
|
||||
if test x$PKG_CONFIG != xno ; then
|
||||
## don't try to run the test against uninstalled libtool libs
|
||||
if $PKG_CONFIG --uninstalled $pkg_config_args; then
|
||||
echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
|
||||
enable_glibtest=no
|
||||
fi
|
||||
|
||||
if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
|
||||
:
|
||||
else
|
||||
no_glib=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x"$no_glib" = x ; then
|
||||
GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
|
||||
GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
|
||||
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
|
||||
|
||||
GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
|
||||
GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
|
||||
glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_glibtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$GLIB_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
|
||||
dnl checks the results of pkg-config to some extent)
|
||||
dnl
|
||||
rm -f conf.glibtest
|
||||
AC_TRY_RUN([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.glibtest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = g_strdup("$min_glib_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_glib_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((glib_major_version != $glib_config_major_version) ||
|
||||
(glib_minor_version != $glib_config_minor_version) ||
|
||||
(glib_micro_version != $glib_config_micro_version))
|
||||
{
|
||||
printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
|
||||
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf ("*** was found! If pkg-config was correct, then it is best\n");
|
||||
printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
|
||||
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||
printf("*** required on your system.\n");
|
||||
printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
|
||||
printf("*** to point to the correct configuration files\n");
|
||||
}
|
||||
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
|
||||
(glib_minor_version != GLIB_MINOR_VERSION) ||
|
||||
(glib_micro_version != GLIB_MICRO_VERSION))
|
||||
{
|
||||
printf("*** GLIB header files (version %d.%d.%d) do not match\n",
|
||||
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((glib_major_version > major) ||
|
||||
((glib_major_version == major) && (glib_minor_version > minor)) ||
|
||||
((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
|
||||
major, minor, micro);
|
||||
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
|
||||
printf("***\n");
|
||||
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||
printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
|
||||
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||
printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
|
||||
printf("*** correct copy of pkg-config. (In this case, you will have to\n");
|
||||
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||
printf("*** so that the correct libraries are found at run-time))\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_glib" = x ; then
|
||||
AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$PKG_CONFIG" = "no" ; then
|
||||
echo "*** A new enough version of pkg-config was not found."
|
||||
echo "*** See http://www.freedesktop.org/software/pkgconfig/"
|
||||
else
|
||||
if test -f conf.glibtest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run GLIB test program, checking why..."
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$LIBS $GLIB_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
|
||||
echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
GLIB_CFLAGS=""
|
||||
GLIB_LIBS=""
|
||||
GLIB_GENMARSHAL=""
|
||||
GOBJECT_QUERY=""
|
||||
GLIB_MKENUMS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
AC_SUBST(GLIB_GENMARSHAL)
|
||||
AC_SUBST(GOBJECT_QUERY)
|
||||
AC_SUBST(GLIB_MKENUMS)
|
||||
rm -f conf.glibtest
|
||||
])
|
||||
67
po/ChangeLog
67
po/ChangeLog
@@ -1,3 +1,70 @@
|
||||
2005-03-11 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by
|
||||
Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2005-01-17 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* pt_BR.po: Updated Brazilian Portuguese translation by
|
||||
Joao Victor Duarte Martins.
|
||||
|
||||
2004-12-15 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
|
||||
2004-12-15 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* sv.po: Updated Swedish translation by Christian Rose.
|
||||
|
||||
2004-12-13 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* sv.po: Updated Swedish translation by Christian Rose.
|
||||
|
||||
2004-12-07 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* it.po: Updated Italian translation by
|
||||
Marco Colombo.
|
||||
* ro.po: Updated Romanian translation by
|
||||
Laurentiu Buzdugan.
|
||||
|
||||
2004-12-01 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* nb: Updated Norwegian bokmål translation by
|
||||
Geir Helland.
|
||||
* fr.po: Updated French translation by
|
||||
Jean-Philippe Guérard.
|
||||
|
||||
2004-11-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by
|
||||
Jean-Philippe Guérard.
|
||||
|
||||
2004-11-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by
|
||||
Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2004-10-07 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* eu.po: Updated Basque translation by
|
||||
Mikel Olasagasti.
|
||||
|
||||
2004-08-31 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* es.po: Updated Spanish translation by
|
||||
Ricardo Javier Cárdenes Medina.
|
||||
|
||||
2004-08-31 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated Catalan translation by
|
||||
Jean-Philippe Guérard.
|
||||
|
||||
2004-08-27 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* de.po: Updated German translation by Michael Piefel.
|
||||
|
||||
2004-06-01 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* zh_TW.po: Added Traditional Chinese translation by
|
||||
|
||||
2463
po/pt_BR.po
2463
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
# Tranditional Chinese Messages for the nano editor
|
||||
# Traditional Chinese Messages for the nano editor
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the nano package.
|
||||
# 趙惟倫 <chaoweilun@pcmail.com.tw>, 2004
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
DEFS= -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
localedir = $(datadir)/locale
|
||||
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
|
||||
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
bin_PROGRAMS = nano
|
||||
nano_SOURCES = color.c \
|
||||
nano_SOURCES = chars.c \
|
||||
color.c \
|
||||
cut.c \
|
||||
files.c \
|
||||
global.c \
|
||||
@@ -21,4 +21,4 @@ nano_SOURCES = color.c \
|
||||
nano_LDADD = @GLIB_LIBS@ @LIBINTL@
|
||||
|
||||
install-exec-hook:
|
||||
cd $(DESTDIR)$(bindir) && $(LN_S) nano rnano
|
||||
cd $(DESTDIR)$(bindir) && rm -f rnano && $(LN_S) nano rnano
|
||||
|
||||
836
src/chars.c
Normal file
836
src/chars.c
Normal file
@@ -0,0 +1,836 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* chars.c *
|
||||
* *
|
||||
* Copyright (C) 2005 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef HAVE_WCHAR_H
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
#ifdef HAVE_WCTYPE_H
|
||||
#include <wctype.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Return TRUE if the value of c is in byte range, and FALSE
|
||||
* otherwise. */
|
||||
bool is_byte(int c)
|
||||
{
|
||||
return ((unsigned int)c == (unsigned char)c);
|
||||
}
|
||||
|
||||
/* This function is equivalent to isalnum(). */
|
||||
bool is_alnum_char(int c)
|
||||
{
|
||||
return isalnum(c);
|
||||
}
|
||||
|
||||
/* This function is equivalent to isalnum() for multibyte characters. */
|
||||
bool is_alnum_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
return is_alnum_wchar(wc);
|
||||
} else
|
||||
#endif
|
||||
return is_alnum_char((unsigned char)*c);
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* This function is equivalent to isalnum() for wide characters. */
|
||||
bool is_alnum_wchar(wchar_t wc)
|
||||
{
|
||||
return iswalnum(wc);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to isblank(). */
|
||||
bool is_blank_char(int c)
|
||||
{
|
||||
return
|
||||
#ifdef HAVE_ISBLANK
|
||||
isblank(c)
|
||||
#else
|
||||
isspace(c) && (c == '\t' || !is_cntrl_char(c))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
/* This function is equivalent to isblank() for multibyte characters. */
|
||||
bool is_blank_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
return is_blank_wchar(wc);
|
||||
} else
|
||||
#endif
|
||||
return is_blank_char((unsigned char)*c);
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* This function is equivalent to isblank() for wide characters. */
|
||||
bool is_blank_wchar(wchar_t wc)
|
||||
{
|
||||
return
|
||||
#ifdef HAVE_ISWBLANK
|
||||
iswblank(wc)
|
||||
#else
|
||||
iswspace(wc) && (wc == '\t' || !is_cntrl_wchar(wc))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to iscntrl(), except in that it also
|
||||
* handles control characters with their high bits set. */
|
||||
bool is_cntrl_char(int c)
|
||||
{
|
||||
return (-128 <= c && c < -96) || (0 <= c && c < 32) ||
|
||||
(127 <= c && c < 160);
|
||||
}
|
||||
|
||||
/* This function is equivalent to iscntrl() for multibyte characters,
|
||||
* except in that it also handles multibyte control characters with
|
||||
* their high bits set. */
|
||||
bool is_cntrl_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
return is_cntrl_wchar(wc);
|
||||
} else
|
||||
#endif
|
||||
return is_cntrl_char((unsigned char)*c);
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* This function is equivalent to iscntrl() for wide characters, except
|
||||
* in that it also handles wide control characters with their high bits
|
||||
* set. */
|
||||
bool is_cntrl_wchar(wchar_t wc)
|
||||
{
|
||||
return (0 <= wc && wc < 32) || (127 <= wc && wc < 160);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* c is a control character. It displays as ^@, ^?, or ^[ch] where ch
|
||||
* is c + 64. We return that character. */
|
||||
unsigned char control_rep(unsigned char c)
|
||||
{
|
||||
/* Treat newlines embedded in a line as encoded nulls. */
|
||||
if (c == '\n')
|
||||
return '@';
|
||||
else if (c == NANO_CONTROL_8)
|
||||
return '?';
|
||||
else
|
||||
return c + 64;
|
||||
}
|
||||
|
||||
/* c is a multibyte control character. It displays as ^@, ^?, or ^[ch]
|
||||
* where ch is c + 64. We return that multibyte character. */
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
wchar_t wc, wcrep;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX), crep_mb_len;
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
wcrep = control_wrep(wc);
|
||||
|
||||
crep_mb_len = wctomb(crep, wcrep);
|
||||
|
||||
if (crep_mb_len <= 0) {
|
||||
wctomb(NULL, 0);
|
||||
crep_mb_len = 0;
|
||||
}
|
||||
|
||||
*crep_len = crep_mb_len;
|
||||
|
||||
return crep;
|
||||
} else {
|
||||
#endif
|
||||
*crep_len = 1;
|
||||
*crep = control_rep((unsigned char)*c);
|
||||
|
||||
return crep;
|
||||
#ifdef NANO_WIDE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* c is a wide control character. It displays as ^@, ^?, or ^[ch] where
|
||||
* ch is c + 64. We return that wide character. */
|
||||
wchar_t control_wrep(wchar_t wc)
|
||||
{
|
||||
/* Treat newlines embedded in a line as encoded nulls. */
|
||||
if (wc == '\n')
|
||||
return '@';
|
||||
else if (wc == NANO_CONTROL_8)
|
||||
return '?';
|
||||
else
|
||||
return wc + 64;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to wcwidth() for multibyte characters. */
|
||||
int mbwidth(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX), width;
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
width = wcwidth(wc);
|
||||
if (width == -1)
|
||||
width++;
|
||||
|
||||
return width;
|
||||
} else
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return the maximum width in bytes of a multibyte character. */
|
||||
int mb_cur_max(void)
|
||||
{
|
||||
return
|
||||
#ifdef NANO_WIDE
|
||||
!ISSET(NO_UTF8) ? MB_CUR_MAX :
|
||||
#endif
|
||||
1;
|
||||
}
|
||||
|
||||
/* Convert the value in chr to a multibyte character with the same
|
||||
* wide character value as chr. Return the (dynamically allocated)
|
||||
* multibyte character and its length. */
|
||||
char *make_mbchar(int chr, int *chr_mb_len)
|
||||
{
|
||||
char *chr_mb;
|
||||
|
||||
assert(chr_mb != NULL && chr_mb_len != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
chr_mb = charalloc(MB_CUR_MAX);
|
||||
*chr_mb_len = wctomb(chr_mb, chr);
|
||||
|
||||
if (*chr_mb_len <= 0) {
|
||||
wctomb(NULL, 0);
|
||||
*chr_mb_len = 0;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
*chr_mb_len = 1;
|
||||
chr_mb = charalloc(1);
|
||||
*chr_mb = (char)chr;
|
||||
#ifdef NANO_WIDE
|
||||
}
|
||||
#endif
|
||||
|
||||
return chr_mb;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_NANORC) || defined(ENABLE_EXTRA)
|
||||
/* Convert the string str to a valid multibyte string with the same wide
|
||||
* character values as str. Return the (dynamically allocated)
|
||||
* multibyte string. */
|
||||
char *make_mbstring(const char *str)
|
||||
{
|
||||
assert(str != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
char *chr_mb = charalloc(MB_CUR_MAX);
|
||||
int chr_mb_len;
|
||||
char *str_mb = charalloc((MB_CUR_MAX * strlen(str)) + 1);
|
||||
size_t str_mb_len = 0;
|
||||
|
||||
while (*str != '\0') {
|
||||
bool bad_char;
|
||||
int i;
|
||||
|
||||
chr_mb_len = parse_mbchar(str, chr_mb, &bad_char, NULL);
|
||||
|
||||
if (bad_char) {
|
||||
char *bad_chr_mb;
|
||||
int bad_chr_mb_len;
|
||||
|
||||
bad_chr_mb = make_mbchar((unsigned char)*chr_mb,
|
||||
&bad_chr_mb_len);
|
||||
|
||||
for (i = 0; i < bad_chr_mb_len; i++)
|
||||
str_mb[str_mb_len + i] = bad_chr_mb[i];
|
||||
str_mb_len += bad_chr_mb_len;
|
||||
|
||||
free(bad_chr_mb);
|
||||
} else {
|
||||
for (i = 0; i < chr_mb_len; i++)
|
||||
str_mb[str_mb_len + i] = chr_mb[i];
|
||||
str_mb_len += chr_mb_len;
|
||||
}
|
||||
|
||||
str += chr_mb_len;
|
||||
}
|
||||
|
||||
free(chr_mb);
|
||||
null_at(&str_mb, str_mb_len);
|
||||
|
||||
return str_mb;
|
||||
} else
|
||||
#endif
|
||||
return mallocstrcpy(NULL, str);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Parse a multibyte character from buf. Return the number of bytes
|
||||
* used. If chr isn't NULL, store the multibyte character in it. If
|
||||
* bad_chr isn't NULL, set it to TRUE if we have a bad multibyte
|
||||
* character. If col isn't NULL, store the new display width in it. If
|
||||
* *str is '\t', we expect col to have the current display width. */
|
||||
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
|
||||
*col)
|
||||
{
|
||||
int buf_mb_len;
|
||||
|
||||
assert(buf != NULL);
|
||||
|
||||
if (bad_chr != NULL)
|
||||
*bad_chr = FALSE;
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
/* Get the number of bytes in the multibyte character. */
|
||||
buf_mb_len = mblen(buf, MB_CUR_MAX);
|
||||
|
||||
/* If buf contains a null byte or an invalid multibyte
|
||||
* character, set bad_chr to TRUE (if it contains the latter)
|
||||
* and interpret buf's first byte. */
|
||||
if (buf_mb_len <= 0) {
|
||||
mblen(NULL, 0);
|
||||
if (buf_mb_len < 0 && bad_chr != NULL)
|
||||
*bad_chr = TRUE;
|
||||
buf_mb_len = 1;
|
||||
}
|
||||
|
||||
/* Save the multibyte character in chr. */
|
||||
if (chr != NULL) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < buf_mb_len; i++)
|
||||
chr[i] = buf[i];
|
||||
}
|
||||
|
||||
/* Save the column width of the wide character in col. */
|
||||
if (col != NULL) {
|
||||
/* If we have a tab, get its width in columns using the
|
||||
* current value of col. */
|
||||
if (*buf == '\t')
|
||||
*col += tabsize - *col % tabsize;
|
||||
/* If we have a control character, get its width using one
|
||||
* column for the "^" that will be displayed in front of it,
|
||||
* and the width in columns of its visible equivalent as
|
||||
* returned by control_mbrep(). */
|
||||
else if (is_cntrl_mbchar(buf)) {
|
||||
char *ctrl_buf_mb = charalloc(MB_CUR_MAX);
|
||||
int ctrl_buf_mb_len;
|
||||
|
||||
(*col)++;
|
||||
|
||||
ctrl_buf_mb = control_mbrep(buf, ctrl_buf_mb,
|
||||
&ctrl_buf_mb_len);
|
||||
|
||||
*col += mbwidth(ctrl_buf_mb);
|
||||
|
||||
free(ctrl_buf_mb);
|
||||
/* If we have a normal character, get its width in columns
|
||||
* normally. */
|
||||
} else
|
||||
*col += mbwidth(buf);
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
/* Get the number of bytes in the byte character. */
|
||||
buf_mb_len = 1;
|
||||
|
||||
/* Save the byte character in chr. */
|
||||
if (chr != NULL)
|
||||
*chr = *buf;
|
||||
|
||||
if (col != NULL) {
|
||||
/* If we have a tab, get its width in columns using the
|
||||
* current value of col. */
|
||||
if (*buf == '\t')
|
||||
*col += tabsize - *col % tabsize;
|
||||
/* If we have a control character, it's two columns wide:
|
||||
* one column for the "^" that will be displayed in front of
|
||||
* it, and one column for its visible equivalent as returned
|
||||
* by control_mbrep(). */
|
||||
else if (is_cntrl_char((unsigned char)*buf))
|
||||
*col += 2;
|
||||
/* If we have a normal character, it's one column wide. */
|
||||
else
|
||||
(*col)++;
|
||||
}
|
||||
#ifdef NANO_WIDE
|
||||
}
|
||||
#endif
|
||||
|
||||
return buf_mb_len;
|
||||
}
|
||||
|
||||
/* Return the index in buf of the beginning of the multibyte character
|
||||
* before the one at pos. */
|
||||
size_t move_mbleft(const char *buf, size_t pos)
|
||||
{
|
||||
size_t pos_prev = pos;
|
||||
|
||||
assert(str != NULL && pos <= strlen(buf));
|
||||
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. Here is the naive, O(pos) way to do it. */
|
||||
while (TRUE) {
|
||||
int buf_mb_len = parse_mbchar(buf + pos - pos_prev, NULL, NULL,
|
||||
NULL);
|
||||
|
||||
if (pos_prev <= (size_t)buf_mb_len)
|
||||
break;
|
||||
|
||||
pos_prev -= buf_mb_len;
|
||||
}
|
||||
|
||||
return pos - pos_prev;
|
||||
}
|
||||
|
||||
/* Return the index in buf of the beginning of the multibyte character
|
||||
* after the one at pos. */
|
||||
size_t move_mbright(const char *buf, size_t pos)
|
||||
{
|
||||
return pos + parse_mbchar(buf + pos, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
/* This function is equivalent to strcasecmp(). */
|
||||
int nstrcasecmp(const char *s1, const char *s2)
|
||||
{
|
||||
return strncasecmp(s1, s2, (size_t)-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to strcasecmp() for multibyte strings. */
|
||||
int mbstrcasecmp(const char *s1, const char *s2)
|
||||
{
|
||||
return mbstrncasecmp(s1, s2, (size_t)-1);
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
/* This function is equivalent to strncasecmp(). */
|
||||
int nstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
|
||||
for (; n > 0 && *s1 != '\0' && *s2 != '\0'; n--, s1++, s2++) {
|
||||
if (tolower(*s1) != tolower(*s2))
|
||||
break;
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
return (tolower(*s1) - tolower(*s2));
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to strncasecmp() for multibyte
|
||||
* strings. */
|
||||
int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
char *s1_mb = charalloc(MB_CUR_MAX);
|
||||
char *s2_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t ws1, ws2;
|
||||
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
|
||||
while (n > 0 && *s1 != '\0' && *s2 != '\0') {
|
||||
int s1_mb_len, s2_mb_len;
|
||||
|
||||
s1_mb_len = parse_mbchar(s1, s1_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&ws1, s1_mb, s1_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws1 = (unsigned char)*s1_mb;
|
||||
}
|
||||
|
||||
s2_mb_len = parse_mbchar(s2, s2_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&ws2, s2_mb, s2_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws2 = (unsigned char)*s2_mb;
|
||||
}
|
||||
|
||||
if (n == 0 || towlower(ws1) != towlower(ws2))
|
||||
break;
|
||||
|
||||
s1 += s1_mb_len;
|
||||
s2 += s2_mb_len;
|
||||
n--;
|
||||
}
|
||||
|
||||
free(s1_mb);
|
||||
free(s2_mb);
|
||||
|
||||
return (towlower(ws1) - towlower(ws2));
|
||||
} else
|
||||
#endif
|
||||
return strncasecmp(s1, s2, n);
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRCASESTR
|
||||
/* This function is equivalent to strcasestr(). It was adapted from
|
||||
* mutt's mutt_stristr() function. */
|
||||
const char *nstrcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
assert(haystack != NULL && needle != NULL);
|
||||
|
||||
for (; *haystack != '\0'; haystack++) {
|
||||
const char *r = haystack, *q = needle;
|
||||
|
||||
for (; tolower(*r) == tolower(*q) && *q != '\0'; r++, q++)
|
||||
;
|
||||
|
||||
if (*q == '\0')
|
||||
return haystack;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to strcasestr() for multibyte strings. */
|
||||
const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t wr, wq;
|
||||
bool found_needle = FALSE;
|
||||
|
||||
assert(haystack != NULL && needle != NULL);
|
||||
|
||||
while (*haystack != '\0') {
|
||||
const char *r = haystack, *q = needle;
|
||||
int r_mb_len, q_mb_len;
|
||||
|
||||
while (*q != '\0') {
|
||||
r_mb_len = parse_mbchar(r, r_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&wr, r_mb, r_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wr = (unsigned char)*r;
|
||||
}
|
||||
|
||||
q_mb_len = parse_mbchar(q, q_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wq = (unsigned char)*q;
|
||||
}
|
||||
|
||||
if (towlower(wr) != towlower(wq))
|
||||
break;
|
||||
|
||||
r += r_mb_len;
|
||||
q += q_mb_len;
|
||||
}
|
||||
|
||||
if (*q == '\0') {
|
||||
found_needle = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
haystack += move_mbright(haystack, 0);
|
||||
}
|
||||
|
||||
free(r_mb);
|
||||
free(q_mb);
|
||||
|
||||
return found_needle ? haystack : NULL;
|
||||
} else
|
||||
#endif
|
||||
return strcasestr(haystack, needle);
|
||||
}
|
||||
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
|
||||
/* This function is equivalent to strstr(), except in that it scans the
|
||||
* string in reverse, starting at rev_start. */
|
||||
const char *revstrstr(const char *haystack, const char *needle, const
|
||||
char *rev_start)
|
||||
{
|
||||
assert(haystack != NULL && needle != NULL && rev_start != NULL);
|
||||
|
||||
for (; rev_start >= haystack; rev_start--) {
|
||||
const char *r, *q;
|
||||
|
||||
for (r = rev_start, q = needle; *r == *q && *q != '\0'; r++, q++)
|
||||
;
|
||||
|
||||
if (*q == '\0')
|
||||
return rev_start;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* This function is equivalent to strcasestr(), except in that it scans
|
||||
* the string in reverse, starting at rev_start. */
|
||||
const char *revstrcasestr(const char *haystack, const char *needle,
|
||||
const char *rev_start)
|
||||
{
|
||||
assert(haystack != NULL && needle != NULL && rev_start != NULL);
|
||||
|
||||
for (; rev_start >= haystack; rev_start--) {
|
||||
const char *r = rev_start, *q = needle;
|
||||
|
||||
for (; tolower(*r) == tolower(*q) && *q != '\0'; r++, q++)
|
||||
;
|
||||
|
||||
if (*q == '\0')
|
||||
return rev_start;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This function is equivalent to strcasestr() for multibyte strings,
|
||||
* except in that it scans the string in reverse, starting at
|
||||
* rev_start. */
|
||||
const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
const char *rev_start)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t wr, wq;
|
||||
bool begin_line = FALSE, found_needle = FALSE;
|
||||
|
||||
assert(haystack != NULL && needle != NULL && rev_start != NULL);
|
||||
|
||||
while (!begin_line) {
|
||||
const char *r = rev_start, *q = needle;
|
||||
int r_mb_len, q_mb_len;
|
||||
|
||||
while (*q != '\0') {
|
||||
r_mb_len = parse_mbchar(r, r_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&wr, r_mb, r_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wr = (unsigned char)*r;
|
||||
}
|
||||
|
||||
q_mb_len = parse_mbchar(q, q_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wq = (unsigned char)*q;
|
||||
}
|
||||
|
||||
if (towlower(wr) != towlower(wq))
|
||||
break;
|
||||
|
||||
r += r_mb_len;
|
||||
q += q_mb_len;
|
||||
}
|
||||
|
||||
if (*q == '\0') {
|
||||
found_needle = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rev_start == haystack)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
rev_start = haystack + move_mbleft(haystack, rev_start -
|
||||
haystack);
|
||||
}
|
||||
|
||||
free(r_mb);
|
||||
free(q_mb);
|
||||
|
||||
return found_needle ? rev_start : NULL;
|
||||
} else
|
||||
#endif
|
||||
return revstrcasestr(haystack, needle, rev_start);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to strlen() for multibyte strings. */
|
||||
size_t mbstrlen(const char *s)
|
||||
{
|
||||
return mbstrnlen(s, (size_t)-1);
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRNLEN
|
||||
/* This function is equivalent to strnlen(). */
|
||||
size_t nstrnlen(const char *s, size_t maxlen)
|
||||
{
|
||||
size_t n = 0;
|
||||
|
||||
assert(s != NULL);
|
||||
|
||||
for (; maxlen > 0 && *s != '\0'; maxlen--, n++, s++)
|
||||
;
|
||||
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to strnlen() for multibyte strings. */
|
||||
size_t mbstrnlen(const char *s, size_t maxlen)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
size_t n = 0;
|
||||
char *s_mb = charalloc(MB_CUR_MAX);
|
||||
int s_mb_len;
|
||||
|
||||
while (*s != '\0') {
|
||||
s_mb_len = parse_mbchar(s, s_mb, NULL, NULL);
|
||||
|
||||
if (maxlen == 0)
|
||||
break;
|
||||
|
||||
maxlen--;
|
||||
s += s_mb_len;
|
||||
n++;
|
||||
}
|
||||
|
||||
free(s_mb);
|
||||
|
||||
return n;
|
||||
} else
|
||||
#endif
|
||||
return strnlen(s, maxlen);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* This function is equivalent to strchr() for multibyte strings. */
|
||||
char *mbstrchr(const char *s, char *c)
|
||||
{
|
||||
assert(s != NULL && c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
char *s_mb = charalloc(MB_CUR_MAX);
|
||||
const char *q = s;
|
||||
wchar_t ws, wc;
|
||||
int s_mb_len, c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
while (*s != '\0') {
|
||||
s_mb_len = parse_mbchar(s, s_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&ws, s_mb, s_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws = (unsigned char)*s;
|
||||
}
|
||||
|
||||
if (ws == wc)
|
||||
break;
|
||||
|
||||
s += s_mb_len;
|
||||
q += s_mb_len;
|
||||
}
|
||||
|
||||
free(s_mb);
|
||||
|
||||
if (ws != wc)
|
||||
q = NULL;
|
||||
|
||||
return (char *)q;
|
||||
} else
|
||||
#endif
|
||||
return strchr(s, *c);
|
||||
}
|
||||
#endif
|
||||
38
src/color.c
38
src/color.c
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* color.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -19,13 +19,14 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
@@ -45,14 +46,14 @@ void set_colorpairs(void)
|
||||
for (; this_color != NULL; this_color = this_color->next) {
|
||||
const colortype *beforenow = this_syntax->color;
|
||||
|
||||
for (; beforenow != NULL && beforenow != this_color &&
|
||||
(beforenow->fg != this_color->fg ||
|
||||
beforenow->bg != this_color->bg ||
|
||||
beforenow->bright != this_color->bright);
|
||||
beforenow = beforenow->next)
|
||||
for (; beforenow != this_color &&
|
||||
(beforenow->fg != this_color->fg ||
|
||||
beforenow->bg != this_color->bg ||
|
||||
beforenow->bright != this_color->bright);
|
||||
beforenow = beforenow->next)
|
||||
;
|
||||
|
||||
if (beforenow != NULL && beforenow != this_color)
|
||||
if (beforenow != this_color)
|
||||
this_color->pairnum = beforenow->pairnum;
|
||||
else {
|
||||
this_color->pairnum = color_pair;
|
||||
@@ -67,14 +68,14 @@ void do_colorinit(void)
|
||||
if (has_colors()) {
|
||||
const colortype *tmpcolor = NULL;
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
int defok;
|
||||
bool defok;
|
||||
#endif
|
||||
|
||||
start_color();
|
||||
/* Add in colors, if available */
|
||||
|
||||
/* Add in colors, if available. */
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
defok = use_default_colors() != ERR;
|
||||
defok = (use_default_colors() != ERR);
|
||||
#endif
|
||||
|
||||
for (tmpcolor = colorstrings; tmpcolor != NULL;
|
||||
@@ -90,8 +91,8 @@ void do_colorinit(void)
|
||||
init_pair(tmpcolor->pairnum, tmpcolor->fg, background);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Running %s with fg = %d and bg = %d\n",
|
||||
"init_pair()", tmpcolor->fg, tmpcolor->bg);
|
||||
fprintf(stderr, "init_pair(): fg = %d, bg = %d\n",
|
||||
tmpcolor->fg, tmpcolor->bg);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -103,11 +104,12 @@ void update_color(void)
|
||||
const syntaxtype *tmpsyntax;
|
||||
|
||||
colorstrings = NULL;
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL; tmpsyntax = tmpsyntax->next) {
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
const exttype *e;
|
||||
|
||||
for (e = tmpsyntax->extensions; e != NULL; e = e->next) {
|
||||
/* Set colorstrings if we matched the extension regex */
|
||||
/* Set colorstrings if we matched the extension regex. */
|
||||
if (regexec(&e->val, filename, 0, NULL, 0) == 0)
|
||||
colorstrings = tmpsyntax->color;
|
||||
|
||||
@@ -116,10 +118,10 @@ void update_color(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* if we haven't found a match, use the override string */
|
||||
/* If we haven't found a match, use the override string. */
|
||||
if (colorstrings == NULL && syntaxstr != NULL) {
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcasecmp(tmpsyntax->desc, syntaxstr) == 0)
|
||||
colorstrings = tmpsyntax->color;
|
||||
}
|
||||
|
||||
477
src/cut.c
477
src/cut.c
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* cut.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -19,7 +19,9 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -30,13 +32,6 @@
|
||||
|
||||
static bool keep_cutbuffer = FALSE;
|
||||
/* Should we keep the contents of the cutbuffer? */
|
||||
static int marked_cut;
|
||||
/* Is the cutbuffer from a mark? 0 means whole-line cut, 1
|
||||
* means mark, and 2 means cut-from-cursor. */
|
||||
#ifndef NANO_SMALL
|
||||
static bool concatenate_cut;
|
||||
/* Should we add this cut string to the end of the last one? */
|
||||
#endif
|
||||
static filestruct *cutbottom = NULL;
|
||||
/* Pointer to end of cutbuffer. */
|
||||
|
||||
@@ -45,423 +40,153 @@ void cutbuffer_reset(void)
|
||||
keep_cutbuffer = FALSE;
|
||||
}
|
||||
|
||||
filestruct *get_cutbottom(void)
|
||||
/* If we're not on the magicline, move all the text of the current line,
|
||||
* plus the newline at the end, to the cutbuffer. */
|
||||
void cut_line(void)
|
||||
{
|
||||
return cutbottom;
|
||||
}
|
||||
|
||||
void add_to_cutbuffer(filestruct *inptr, bool allow_concat)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "add_to_cutbuffer(): inptr->data = %s\n", inptr->data);
|
||||
#endif
|
||||
|
||||
if (cutbuffer == NULL)
|
||||
cutbuffer = inptr;
|
||||
#ifndef NANO_SMALL
|
||||
else if (allow_concat && concatenate_cut) {
|
||||
/* Just tack the text in inptr onto the text in cutbottom,
|
||||
* unless allow_concat is FALSE. */
|
||||
cutbottom->data = charealloc(cutbottom->data,
|
||||
strlen(cutbottom->data) + strlen(inptr->data) + 1);
|
||||
strcat(cutbottom->data, inptr->data);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
cutbottom->next = inptr;
|
||||
inptr->prev = cutbottom;
|
||||
}
|
||||
cutbottom = inptr;
|
||||
cutbottom->next = NULL;
|
||||
if (current->next != NULL)
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, 0,
|
||||
current->next, 0);
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Cut a marked segment instead of a whole line.
|
||||
*
|
||||
* The first cut character is top->data[top_x]. Unless top == bot, the
|
||||
* last cut line has length bot_x. That is, if bot_x > 0 then we cut to
|
||||
* bot->data[bot_x - 1].
|
||||
*
|
||||
* We maintain totsize, totlines, filebot, the magicline, and line
|
||||
* numbers. Also, we set current and current_x so the cursor will be on
|
||||
* the first character after what was cut. We do not do any screen
|
||||
* updates.
|
||||
*
|
||||
* Note cutbuffer might not be NULL if cut to end is used. */
|
||||
void cut_marked_segment(void)
|
||||
/* Move all currently marked text to the cutbuffer, and set the current
|
||||
* place we want to where the text used to start. */
|
||||
void cut_marked(void)
|
||||
{
|
||||
filestruct *top;
|
||||
filestruct *bot;
|
||||
filestruct *tmp;
|
||||
size_t top_x;
|
||||
size_t bot_x;
|
||||
size_t newsize;
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
/* If the mark doesn't cover any text, get out. */
|
||||
if (current == mark_beginbuf && current_x == mark_beginx)
|
||||
return;
|
||||
assert(current != NULL && mark_beginbuf != NULL);
|
||||
|
||||
/* Set up the top and bottom lines and coordinates of the marked
|
||||
* text. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x);
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
|
||||
/* Make the first cut line manually. Move the cut part of the top
|
||||
* line into tmp, and set newsize to that partial line's length. */
|
||||
tmp = copy_node(top);
|
||||
newsize = (top == bot ? bot_x - top_x : strlen(top->data + top_x));
|
||||
charmove(tmp->data, tmp->data + top_x, newsize);
|
||||
null_at(&tmp->data, newsize);
|
||||
|
||||
/* Add the contents of tmp to the cutbuffer. Note that cutbuffer
|
||||
* might be non-NULL if we have cut to end enabled. */
|
||||
if (cutbuffer == NULL) {
|
||||
cutbuffer = tmp;
|
||||
cutbottom = tmp;
|
||||
} else {
|
||||
cutbottom->next = tmp;
|
||||
tmp->prev = cutbottom;
|
||||
cutbottom = tmp;
|
||||
}
|
||||
|
||||
/* And make the top remainder line manually too. Update current_x
|
||||
* and totlines to account for all the cut text, and update totsize
|
||||
* to account for the length of the cut part of the first line. */
|
||||
current_x = top_x;
|
||||
totsize -= newsize;
|
||||
totlines -= bot->lineno - top->lineno;
|
||||
|
||||
/* Now set newsize to be the length of the top remainder line plus
|
||||
* the bottom remainder line, plus one for the null terminator. */
|
||||
newsize = top_x + strlen(bot->data + bot_x) + 1;
|
||||
|
||||
if (top == bot) {
|
||||
/* In this case, we're only cutting one line or part of one
|
||||
* line, so the remainder line is shorter. This means that we
|
||||
* must move text from the end forward first. */
|
||||
charmove(top->data + top_x, bot->data + bot_x, newsize - top_x);
|
||||
top->data = charealloc(top->data, newsize);
|
||||
|
||||
cutbottom->next = NULL;
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/* Update totsize to account for the cut part of the last line. */
|
||||
totsize -= bot_x + 1;
|
||||
|
||||
/* Here, the top remainder line might get longer (if the bottom
|
||||
* remainder line is added to the end of it), so we realloc() it
|
||||
* first. */
|
||||
top->data = charealloc(top->data, newsize);
|
||||
charmove(top->data + top_x, bot->data + bot_x, newsize - top_x);
|
||||
|
||||
assert(cutbottom != NULL && cutbottom->next != NULL);
|
||||
/* We're cutting multiple lines, so in particular the next line is
|
||||
* cut too. */
|
||||
cutbottom->next->prev = cutbottom;
|
||||
|
||||
/* Update totsize to account for all the complete lines that have
|
||||
* been cut. After this, totsize is fully up to date. */
|
||||
for (tmp = top->next; tmp != bot; tmp = tmp->next)
|
||||
totsize -= strlen(tmp->data) + 1;
|
||||
|
||||
/* Make the last cut line manually. */
|
||||
null_at(&bot->data, bot_x);
|
||||
|
||||
/* Move the rest of the cut text (other than the cut part of the top
|
||||
* line) from the buffer to the end of the cutbuffer, and fix the
|
||||
* edit buffer to account for the cut text. */
|
||||
top->next = bot->next;
|
||||
cutbottom = bot;
|
||||
cutbottom->next = NULL;
|
||||
if (top->next != NULL)
|
||||
top->next->prev = top;
|
||||
renumber(top);
|
||||
current = top;
|
||||
|
||||
/* If the bottom line of the cut was the magicline, set filebot
|
||||
* properly, and add a new magicline if the top remainder line
|
||||
* (which is now the new bottom line) is non-blank. */
|
||||
if (bot == filebot) {
|
||||
filebot = top;
|
||||
assert(bot_x == 0);
|
||||
if (top_x > 0)
|
||||
new_magicline();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If we're not at the end of the current line, move all the text from
|
||||
* the current cursor position to the end of the current line,
|
||||
* not counting the newline at the end, to the cutbuffer. If we are,
|
||||
* and we're not on the magicline, move the newline at the end to the
|
||||
* cutbuffer, and set the current place we want to where the newline
|
||||
* used to be. */
|
||||
void cut_to_eol(void)
|
||||
{
|
||||
size_t data_len = strlen(current->data);
|
||||
|
||||
assert(current_x <= data_len);
|
||||
|
||||
if (current_x < data_len)
|
||||
/* If we're not at the end of the line, move all the text from
|
||||
* the current position up to it, not counting the newline at
|
||||
* the end, to the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
current, data_len);
|
||||
else if (current->next != NULL) {
|
||||
/* If we're at the end of the line, and the next line isn't the
|
||||
* magicline, move all the text from the current position up to
|
||||
* the beginning of the next line, i.e, the newline at the
|
||||
* end, to the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
current->next, 0);
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
|
||||
/* Move text from the current filestruct into the cutbuffer. */
|
||||
void do_cut_text(void)
|
||||
{
|
||||
filestruct *fileptr;
|
||||
|
||||
assert(current != NULL && current->data != NULL);
|
||||
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
|
||||
if (!keep_cutbuffer) {
|
||||
/* If keep_cutbuffer is FALSE and the cutbuffer isn't empty, blow
|
||||
* away the text in the cutbuffer. */
|
||||
if (!keep_cutbuffer && cutbuffer != NULL) {
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
marked_cut = 0;
|
||||
#ifndef NANO_SMALL
|
||||
concatenate_cut = FALSE;
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Blew away cutbuffer =)\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* You can't cut the magicline except with the mark. But trying
|
||||
* does clear the cutbuffer if keep_cutbuffer is FALSE. */
|
||||
if (current == filebot
|
||||
#ifndef NANO_SMALL
|
||||
&& !ISSET(MARK_ISSET)
|
||||
#endif
|
||||
)
|
||||
return;
|
||||
|
||||
/* 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_SMALL
|
||||
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
|
||||
assert(current_x >= 0 && current_x <= strlen(current->data));
|
||||
|
||||
if (current->data[current_x] == '\0') {
|
||||
/* If the line is empty and we didn't just cut a non-blank
|
||||
* line, create a dummy blank line and add it to the
|
||||
* cutbuffer. */
|
||||
if (marked_cut != 1 && current->next != filebot) {
|
||||
filestruct *junk = make_new_node(current);
|
||||
|
||||
junk->data = charalloc(1);
|
||||
junk->data[0] = '\0';
|
||||
add_to_cutbuffer(junk, TRUE);
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
do_delete();
|
||||
marked_cut = 2;
|
||||
return;
|
||||
} else {
|
||||
SET(MARK_ISSET);
|
||||
|
||||
mark_beginx = strlen(current->data);
|
||||
mark_beginbuf = current;
|
||||
}
|
||||
}
|
||||
|
||||
if (ISSET(MARK_ISSET)) {
|
||||
cut_marked_segment();
|
||||
|
||||
placewewant = xplustabs();
|
||||
/* If the mark is on, move the marked text to the cutbuffer and
|
||||
* turn the mark off. */
|
||||
cut_marked();
|
||||
UNSET(MARK_ISSET);
|
||||
} else
|
||||
#endif
|
||||
if (ISSET(CUT_TO_END))
|
||||
/* Otherwise, if the CUT_TO_END flag is set, move all text up to
|
||||
* the end of the line into the cutbuffer. */
|
||||
cut_to_eol();
|
||||
else
|
||||
/* Otherwise, move the entire line into the cutbuffer. */
|
||||
cut_line();
|
||||
|
||||
/* If we just did a marked cut of part of a line, we should add
|
||||
* the first line of any cut done immediately afterward to the
|
||||
* end of this cut, as Pico does. */
|
||||
if (current == mark_beginbuf && current_x < strlen(current->data))
|
||||
concatenate_cut = TRUE;
|
||||
marked_cut = 1;
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
return;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
totlines--;
|
||||
totsize -= strlen(current->data) + 1;
|
||||
fileptr = current;
|
||||
current = current->next;
|
||||
current->prev = fileptr->prev;
|
||||
add_to_cutbuffer(fileptr, TRUE);
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
|
||||
if (fileptr == fileage)
|
||||
fileage = current;
|
||||
else
|
||||
current->prev->next = current;
|
||||
|
||||
if (fileptr == edittop)
|
||||
edittop = current;
|
||||
|
||||
renumber(current);
|
||||
current_x = 0;
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
marked_cut = 0;
|
||||
#ifndef NANO_SMALL
|
||||
concatenate_cut = FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Cut from the current cursor position to the end of the file. */
|
||||
void do_cut_till_end(void)
|
||||
{
|
||||
assert(current != NULL && current->data != NULL);
|
||||
|
||||
check_statusblank();
|
||||
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
filebot, 0);
|
||||
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Copy text from the cutbuffer into the current filestruct. */
|
||||
void do_uncut_text(void)
|
||||
{
|
||||
filestruct *tmp = current;
|
||||
filestruct *newbuf = NULL;
|
||||
filestruct *newend = NULL;
|
||||
assert(current != NULL && current->data != NULL);
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
if (cutbuffer == NULL || current == NULL)
|
||||
return; /* AIEEEEEEEEEEEE */
|
||||
|
||||
/* If we're uncutting a previously non-marked block, uncut to end if
|
||||
* we're not at the beginning of the line. If we are at the
|
||||
* beginning of the line, set placewewant to 0. Pico does both of
|
||||
* these. */
|
||||
if (marked_cut == 0) {
|
||||
if (current_x != 0)
|
||||
marked_cut = 2;
|
||||
else
|
||||
placewewant = 0;
|
||||
}
|
||||
check_statusblank();
|
||||
|
||||
/* If we're going to uncut on the magicline, always make a new
|
||||
* magicline in advance, as Pico does. */
|
||||
if (current->next == NULL)
|
||||
new_magicline();
|
||||
|
||||
if (marked_cut == 0 || cutbuffer->next != NULL) {
|
||||
newbuf = copy_filestruct(cutbuffer);
|
||||
for (newend = newbuf; newend->next != NULL && newend != NULL;
|
||||
newend = newend->next)
|
||||
totlines++;
|
||||
}
|
||||
|
||||
/* Hook newbuf in at current. */
|
||||
if (marked_cut != 0) {
|
||||
filestruct *hold = current;
|
||||
|
||||
/* If there's only one line in the cutbuffer... */
|
||||
if (cutbuffer->next == NULL) {
|
||||
size_t buf_len = strlen(cutbuffer->data);
|
||||
size_t cur_len = strlen(current->data);
|
||||
|
||||
current->data = charealloc(current->data, cur_len + buf_len + 1);
|
||||
charmove(current->data + current_x + buf_len,
|
||||
current->data + current_x, cur_len - current_x + 1);
|
||||
strncpy(current->data + current_x, cutbuffer->data, buf_len);
|
||||
/* Use strncpy() to not copy the null terminator. */
|
||||
|
||||
current_x += buf_len;
|
||||
totsize += buf_len;
|
||||
|
||||
placewewant = xplustabs();
|
||||
} else { /* Yuck -- no kidding! */
|
||||
char *tmpstr, *tmpstr2;
|
||||
|
||||
tmp = current->next;
|
||||
|
||||
/* New beginning. */
|
||||
tmpstr = charalloc(current_x + strlen(newbuf->data) + 1);
|
||||
strncpy(tmpstr, current->data, current_x);
|
||||
strcpy(&tmpstr[current_x], newbuf->data);
|
||||
totsize += strlen(newbuf->data) + strlen(newend->data) + 1;
|
||||
|
||||
/* New end. */
|
||||
tmpstr2 = charalloc(strlen(newend->data) +
|
||||
strlen(¤t->data[current_x]) + 1);
|
||||
strcpy(tmpstr2, newend->data);
|
||||
strcat(tmpstr2, ¤t->data[current_x]);
|
||||
|
||||
free(current->data);
|
||||
current->data = tmpstr;
|
||||
current->next = newbuf->next;
|
||||
newbuf->next->prev = current;
|
||||
delete_node(newbuf);
|
||||
|
||||
current_x = strlen(newend->data);
|
||||
placewewant = xplustabs();
|
||||
free(newend->data);
|
||||
newend->data = tmpstr2;
|
||||
|
||||
newend->next = tmp;
|
||||
|
||||
/* If tmp isn't NULL, we're in the middle: update the
|
||||
* prev pointer. If it IS NULL, we're at the end; update
|
||||
* the filebot pointer. */
|
||||
if (tmp != NULL)
|
||||
tmp->prev = newend;
|
||||
else {
|
||||
filebot = newend;
|
||||
new_magicline();
|
||||
}
|
||||
|
||||
/* Now why don't we update the totsize also? */
|
||||
for (tmp = current->next; tmp != newend; tmp = tmp->next)
|
||||
totsize += strlen(tmp->data) + 1;
|
||||
|
||||
current = newend;
|
||||
}
|
||||
|
||||
/* If marked cut == 2, it means that we're doing a cut to end
|
||||
* and we don't want anything else on the line, so we have to
|
||||
* screw up all the work we just did and separate the line. */
|
||||
if (marked_cut == 2) {
|
||||
tmp = make_new_node(current);
|
||||
tmp->data = mallocstrcpy(NULL, current->data + current_x);
|
||||
splice_node(current, tmp, current->next);
|
||||
null_at(¤t->data, current_x);
|
||||
current = current->next;
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
|
||||
/* Extra line added; update stuff. */
|
||||
totlines++;
|
||||
totsize++;
|
||||
}
|
||||
/* Renumber from BEFORE where we pasted ;) */
|
||||
renumber(hold);
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer(fileage);
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
set_modified();
|
||||
edit_refresh();
|
||||
/* If the cutbuffer is empty, get out. */
|
||||
if (cutbuffer == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
if (current != fileage) {
|
||||
tmp = current->prev;
|
||||
tmp->next = newbuf;
|
||||
newbuf->prev = tmp;
|
||||
} else
|
||||
fileage = newbuf;
|
||||
totlines++; /* Unmarked uncuts don't split lines. */
|
||||
/* Add a copy of the text in the cutbuffer to the current filestruct
|
||||
* at the current cursor position. */
|
||||
copy_from_filestruct(cutbuffer, cutbottom);
|
||||
|
||||
/* This is so uncutting at the top of the buffer will work => */
|
||||
if (current_y == 0)
|
||||
edittop = newbuf;
|
||||
/* Set the current place we want to where the text from the
|
||||
* cutbuffer ends. */
|
||||
placewewant = xplustabs();
|
||||
|
||||
/* Connect the end of the buffer to the filestruct. */
|
||||
newend->next = current;
|
||||
current->prev = newend;
|
||||
|
||||
/* Recalculate size *sigh* */
|
||||
for (tmp = newbuf; tmp != current; tmp = tmp->next)
|
||||
totsize += strlen(tmp->data) + 1;
|
||||
|
||||
renumber(newbuf);
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer_reverse();
|
||||
#endif
|
||||
|
||||
set_modified();
|
||||
}
|
||||
|
||||
3199
src/files.c
3199
src/files.c
File diff suppressed because it is too large
Load Diff
399
src/global.c
399
src/global.c
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* global.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -19,11 +19,12 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <sys/stat.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
@@ -39,9 +40,9 @@ char *last_search = NULL; /* Last string we searched for */
|
||||
char *last_replace = NULL; /* Last replacement string */
|
||||
int search_last_line; /* Is this the last search line? */
|
||||
|
||||
long flags = 0; /* Our flag containing many options */
|
||||
unsigned long flags = 0; /* Our flag containing many options */
|
||||
WINDOW *topwin; /* Top buffer */
|
||||
WINDOW *edit; /* The file portion of the editor */
|
||||
WINDOW *topwin; /* Top line of screen */
|
||||
WINDOW *bottomwin; /* Bottom buffer */
|
||||
char *filename = NULL; /* Name of the file */
|
||||
|
||||
@@ -52,24 +53,32 @@ struct stat originalfilestat; /* Stat for the file as we loaded it */
|
||||
int editwinrows = 0; /* How many rows long is the edit
|
||||
window? */
|
||||
filestruct *current; /* Current buffer pointer */
|
||||
int current_x = 0, current_y = 0; /* Current position of X and Y in
|
||||
the editor - relative to edit
|
||||
window (0,0) */
|
||||
size_t current_x = 0; /* Current x-coordinate in the edit
|
||||
window */
|
||||
int current_y = 0; /* Current y-coordinate in the edit
|
||||
window */
|
||||
filestruct *fileage = NULL; /* Our file buffer */
|
||||
filestruct *edittop = NULL; /* Pointer to the top of the edit
|
||||
buffer with respect to the
|
||||
file struct */
|
||||
filestruct *filebot = NULL; /* Last node in the file struct */
|
||||
filestruct *cutbuffer = NULL; /* A place to store cut text */
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
filestruct *jusbuffer = NULL; /* A place to store unjustified text */
|
||||
#endif
|
||||
partition *filepart = NULL; /* A place to store a portion of the
|
||||
file struct */
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
openfilestruct *open_files = NULL; /* The list of open files */
|
||||
openfilestruct *open_files = NULL; /* The list of open file
|
||||
buffers */
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
char *whitespace = NULL; /* Characters used when displaying
|
||||
the first characters of tabs and
|
||||
spaces. */
|
||||
int whitespace_len[2]; /* The length of the characters. */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -93,11 +102,10 @@ size_t quotelen; /* strlen(quotestr) */
|
||||
char *backup_dir = NULL; /* Backup directory. */
|
||||
#endif
|
||||
|
||||
int resetstatuspos; /* Hack for resetting the status bar
|
||||
cursor position */
|
||||
char *answer = NULL; /* Answer str to many questions */
|
||||
int totlines = 0; /* Total number of lines in the file */
|
||||
long totsize = 0; /* Total number of bytes in the file */
|
||||
size_t totsize = 0; /* Total number of characters in the
|
||||
file */
|
||||
size_t placewewant = 0; /* The column we'd like the cursor
|
||||
to jump to when we go to the
|
||||
next or previous line */
|
||||
@@ -114,7 +122,7 @@ char *help_text; /* The text in the help window */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
filestruct *mark_beginbuf; /* The begin marker buffer */
|
||||
int mark_beginx; /* X value in the string to start */
|
||||
size_t mark_beginx; /* X value in the string to start */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
@@ -130,7 +138,7 @@ shortcut *main_list = NULL;
|
||||
shortcut *whereis_list = NULL;
|
||||
shortcut *replace_list = NULL;
|
||||
shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */
|
||||
shortcut *goto_list = NULL;
|
||||
shortcut *gotoline_list = NULL;
|
||||
shortcut *writefile_list = NULL;
|
||||
shortcut *insertfile_list = NULL;
|
||||
#ifndef DISABLE_HELP
|
||||
@@ -153,9 +161,7 @@ syntaxtype *syntaxes = NULL;
|
||||
char *syntaxstr = NULL;
|
||||
#endif
|
||||
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
|
||||
const shortcut *currshortcut; /* Current shortcut list we're using */
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
toggle *toggles = NULL;
|
||||
@@ -178,9 +184,7 @@ bool curses_ended = FALSE; /* Indicates to statusbar() to simply
|
||||
* write to stderr, since endwin() has
|
||||
* ended curses mode. */
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
char *homedir = NULL; /* $HOME or from /etc/passwd. */
|
||||
#endif
|
||||
|
||||
size_t length_of_list(const shortcut *s)
|
||||
{
|
||||
@@ -196,7 +200,7 @@ void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help,
|
||||
#endif
|
||||
int metaval, int funcval, int miscval, int view, void
|
||||
int metaval, int funcval, int miscval, bool view, void
|
||||
(*func)(void))
|
||||
{
|
||||
shortcut *s;
|
||||
@@ -224,7 +228,7 @@ void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
|
||||
s->next = NULL;
|
||||
}
|
||||
|
||||
void shortcut_init(int unjustify)
|
||||
void shortcut_init(bool unjustify)
|
||||
{
|
||||
const char *get_help_msg = N_("Get Help");
|
||||
const char *exit_msg = N_("Exit");
|
||||
@@ -235,6 +239,14 @@ void shortcut_init(int unjustify)
|
||||
const char *cancel_msg = N_("Cancel");
|
||||
const char *first_line_msg = N_("First Line");
|
||||
const char *last_line_msg = N_("Last Line");
|
||||
#ifndef NANO_SMALL
|
||||
const char *cut_till_end_msg = N_("CutTillEnd");
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *beg_of_par_msg = N_("Beg of Par");
|
||||
const char *end_of_par_msg = N_("End of Par");
|
||||
const char *fulljstify_msg = N_("FullJstify");
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
const char *case_sens_msg = N_("Case Sens");
|
||||
const char *direction_msg = N_("Direction");
|
||||
@@ -242,6 +254,9 @@ void shortcut_init(int unjustify)
|
||||
const char *regexp_msg = N_("Regexp");
|
||||
#endif
|
||||
const char *history_msg = N_("History");
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *new_buffer_msg = N_("New Buffer");
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
#ifndef DISABLE_BROWSER
|
||||
const char *to_files_msg = N_("To Files");
|
||||
@@ -269,8 +284,12 @@ void shortcut_init(int unjustify)
|
||||
N_("Uncut from the cutbuffer into the current line");
|
||||
const char *nano_cursorpos_msg = N_("Show the position of the cursor");
|
||||
const char *nano_spell_msg = N_("Invoke the spell checker, if available");
|
||||
const char *nano_goto_msg = N_("Go to a specific line number");
|
||||
const char *nano_gotoline_msg = N_("Go to a specific line number");
|
||||
const char *nano_replace_msg = N_("Replace text within the editor");
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_mark_msg = N_("Mark text at the cursor position");
|
||||
const char *nano_whereis_next_msg = N_("Repeat last search");
|
||||
#endif
|
||||
const char *nano_prevline_msg = N_("Move to the previous line");
|
||||
const char *nano_nextline_msg = N_("Move to the next line");
|
||||
const char *nano_forward_msg = N_("Move forward one character");
|
||||
@@ -278,38 +297,41 @@ void shortcut_init(int unjustify)
|
||||
const char *nano_home_msg = N_("Move to the beginning of the current line");
|
||||
const char *nano_end_msg = N_("Move to the end of the current line");
|
||||
const char *nano_refresh_msg = N_("Refresh (redraw) the current screen");
|
||||
const char *nano_mark_msg = N_("Mark text at the current cursor location");
|
||||
const char *nano_delete_msg = N_("Delete the character under the cursor");
|
||||
const char *nano_backspace_msg =
|
||||
N_("Delete the character to the left of the cursor");
|
||||
const char *nano_tab_msg = N_("Insert a tab character");
|
||||
const char *nano_tab_msg =
|
||||
N_("Insert a tab character at the cursor position");
|
||||
const char *nano_enter_msg =
|
||||
N_("Insert a carriage return at the cursor position");
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_nextword_msg = N_("Move forward one word");
|
||||
const char *nano_prevword_msg = N_("Move backward one word");
|
||||
#endif
|
||||
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *nano_openprev_msg = N_("Switch to previous file buffer");
|
||||
const char *nano_opennext_msg = N_("Switch to next file buffer");
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *nano_bracket_msg = N_("Find other bracket");
|
||||
#endif
|
||||
const char *nano_whereis_next_msg = N_("Repeat last search");
|
||||
#endif
|
||||
const char *nano_cancel_msg = N_("Cancel the current function");
|
||||
const char *nano_firstline_msg = N_("Go to the first line of the file");
|
||||
const char *nano_lastline_msg = N_("Go to the last line of the file");
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *nano_parabegin_msg =
|
||||
N_("Go to the beginning of the current paragraph");
|
||||
const char *nano_paraend_msg =
|
||||
N_("Go to the end of the current paragraph");
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *nano_openprev_msg = N_("Switch to the previous file buffer");
|
||||
const char *nano_opennext_msg = N_("Switch to the next file buffer");
|
||||
#endif
|
||||
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_cut_till_end_msg =
|
||||
N_("Cut from the cursor position to the end of the file");
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *nano_fulljustify_msg = N_("Justify the entire file");
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
||||
const char *nano_bracket_msg = N_("Find other bracket");
|
||||
#endif
|
||||
const char *nano_cancel_msg = N_("Cancel the current function");
|
||||
const char *nano_firstline_msg = N_("Go to the first line of the file");
|
||||
const char *nano_lastline_msg = N_("Go to the last line of the file");
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_case_msg =
|
||||
N_("Make the current search/replace case (in)sensitive");
|
||||
@@ -335,7 +357,7 @@ void shortcut_init(int unjustify)
|
||||
const char *nano_backup_msg = N_("Back up original file when saving");
|
||||
const char *nano_execute_msg = N_("Execute external command");
|
||||
#endif
|
||||
#if defined(ENABLE_MULTIBUFFER) && !defined(NANO_SMALL)
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_MULTIBUFFER)
|
||||
const char *nano_multibuffer_msg = N_("Insert into new buffer");
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
@@ -366,18 +388,14 @@ void shortcut_init(int unjustify)
|
||||
#endif
|
||||
);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_EXIT_KEY,
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL))
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_EXIT_KEY, N_("Close"),
|
||||
IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_exit);
|
||||
else
|
||||
open_files != NULL && open_files != open_files->next ?
|
||||
N_("Close") :
|
||||
#endif
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_EXIT_KEY, exit_msg,
|
||||
IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_exit);
|
||||
exit_msg, IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_exit);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_WRITEOUT_KEY, N_("WriteOut"),
|
||||
@@ -409,7 +427,8 @@ void shortcut_init(int unjustify)
|
||||
#else
|
||||
NOVIEW
|
||||
#endif
|
||||
, !ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg);
|
||||
, !ISSET(RESTRICTED) ? do_insertfile_void :
|
||||
nano_disabled_msg);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_WHEREIS_KEY, N_("Where Is"),
|
||||
@@ -435,7 +454,7 @@ void shortcut_init(int unjustify)
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, N_("UnJustify"),
|
||||
IFHELP(NULL, NANO_NO_KEY), NANO_UNJUSTIFY_FKEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
NANO_NO_KEY, NOVIEW, NULL);
|
||||
else
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_UNCUT_KEY, N_("UnCut Txt"),
|
||||
@@ -459,13 +478,23 @@ void shortcut_init(int unjustify)
|
||||
#endif
|
||||
nano_disabled_msg);
|
||||
|
||||
sc_init_one(&main_list, NANO_GOTO_KEY, go_to_line_msg,
|
||||
IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
sc_init_one(&main_list, NANO_GOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_GOTOLINE_ALTKEY),
|
||||
NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg,
|
||||
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), NANO_REPLACE_FKEY,
|
||||
NANO_NO_KEY, NOVIEW, do_replace);
|
||||
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
||||
NANO_REPLACE_FKEY, NANO_NO_KEY, NOVIEW, do_replace);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
|
||||
IFHELP(nano_mark_msg, NANO_MARK_ALTKEY), NANO_MARK_FKEY,
|
||||
NANO_NO_KEY, NOVIEW, do_mark);
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"),
|
||||
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
|
||||
NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, do_research);
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list, NANO_PREVLINE_KEY, N_("Prev Line"),
|
||||
IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
@@ -495,16 +524,6 @@ void shortcut_init(int unjustify)
|
||||
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, total_refresh);
|
||||
|
||||
sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
|
||||
IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW,
|
||||
#ifndef NANO_SMALL
|
||||
do_mark
|
||||
#else
|
||||
nano_disabled_msg
|
||||
#endif
|
||||
);
|
||||
|
||||
sc_init_one(&main_list, NANO_DELETE_KEY, N_("Delete"),
|
||||
IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, do_delete);
|
||||
@@ -531,9 +550,17 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, do_prev_word);
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
|
||||
IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, do_verbatim_input);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_NO_KEY, beg_of_par_msg,
|
||||
IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin_void);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_NO_KEY, end_of_par_msg,
|
||||
IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
|
||||
@@ -545,18 +572,30 @@ void shortcut_init(int unjustify)
|
||||
NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
|
||||
IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, do_verbatim_input);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_NO_KEY, cut_till_end_msg,
|
||||
IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_NO_KEY, fulljstify_msg,
|
||||
IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"),
|
||||
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_find_bracket);
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"),
|
||||
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, VIEW, do_research);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&whereis_list);
|
||||
|
||||
sc_init_one(&whereis_list, NANO_HELP_KEY, get_help_msg,
|
||||
@@ -572,7 +611,7 @@ void shortcut_init(int unjustify)
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||
@@ -585,59 +624,63 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, replace_msg,
|
||||
sc_init_one(&whereis_list, NANO_TOOTHERSEARCH_KEY, replace_msg,
|
||||
IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_replace);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, go_to_line_msg,
|
||||
IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
sc_init_one(&whereis_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, N_("Beg of Par"),
|
||||
IFHELP(nano_parabegin_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_para_begin);
|
||||
sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, beg_of_par_msg,
|
||||
IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin_void);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_PARAEND_KEY, N_("End of Par"),
|
||||
IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_para_end);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, N_("FullJstify"),
|
||||
IFHELP(nano_fulljustify_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, do_full_justify);
|
||||
sc_init_one(&whereis_list, NANO_PARAEND_KEY, end_of_par_msg,
|
||||
IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_NO_KEY, case_sens_msg,
|
||||
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_NO_KEY, direction_msg,
|
||||
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_NO_KEY, regexp_msg,
|
||||
IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_HISTORY_KEY, history_msg,
|
||||
IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
#endif
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_CUTTILLEND_KEY, cut_till_end_msg,
|
||||
IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, fulljstify_msg,
|
||||
IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&replace_list);
|
||||
|
||||
sc_init_one(&replace_list, NANO_HELP_KEY, get_help_msg,
|
||||
@@ -652,7 +695,7 @@ void shortcut_init(int unjustify)
|
||||
|
||||
sc_init_one(&replace_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY,
|
||||
@@ -663,32 +706,32 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, N_("No Replace"),
|
||||
sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"),
|
||||
IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_search);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, go_to_line_msg,
|
||||
IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
sc_init_one(&replace_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&replace_list, NANO_NO_KEY, case_sens_msg,
|
||||
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&replace_list, NANO_NO_KEY, direction_msg,
|
||||
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg,
|
||||
IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
sc_init_one(&replace_list, NANO_HISTORY_KEY, history_msg,
|
||||
IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
free_shortcutage(&replace_list_2);
|
||||
@@ -705,7 +748,7 @@ void shortcut_init(int unjustify)
|
||||
|
||||
sc_init_one(&replace_list_2, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
@@ -718,12 +761,12 @@ void shortcut_init(int unjustify)
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&replace_list_2, NANO_HISTORY_KEY, history_msg,
|
||||
IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&goto_list);
|
||||
free_shortcutage(&gotoline_list);
|
||||
|
||||
sc_init_one(&goto_list, NANO_HELP_KEY, get_help_msg,
|
||||
sc_init_one(&gotoline_list, NANO_HELP_KEY, get_help_msg,
|
||||
IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
|
||||
NANO_NO_KEY, VIEW,
|
||||
#ifndef DISABLE_HELP
|
||||
@@ -733,40 +776,48 @@ void shortcut_init(int unjustify)
|
||||
#endif
|
||||
);
|
||||
|
||||
sc_init_one(&goto_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
sc_init_one(&gotoline_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||
sc_init_one(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_first_line);
|
||||
|
||||
sc_init_one(&goto_list, NANO_LASTLINE_KEY, last_line_msg,
|
||||
sc_init_one(&gotoline_list, NANO_LASTLINE_KEY, last_line_msg,
|
||||
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
sc_init_one(&gotoline_list, NANO_TOOTHERWHEREIS_KEY,
|
||||
N_("Go To Text"), IFHELP(nano_whereis_msg, NANO_NO_KEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
free_shortcutage(&help_list);
|
||||
|
||||
sc_init_one(&help_list, NANO_PREVPAGE_KEY, prev_page_msg,
|
||||
IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&help_list, NANO_NEXTPAGE_KEY, next_page_msg,
|
||||
IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&help_list, NANO_PREVLINE_KEY, N_("Prev Line"),
|
||||
IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&help_list, NANO_NEXTLINE_KEY, N_("Next Line"),
|
||||
IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&help_list, NANO_REFRESH_KEY, N_("Refresh"),
|
||||
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&help_list, NANO_EXIT_KEY, exit_msg,
|
||||
IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&writefile_list);
|
||||
@@ -783,7 +834,7 @@ void shortcut_init(int unjustify)
|
||||
|
||||
sc_init_one(&writefile_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
/* If we're using restricted mode, the file browser is disabled.
|
||||
@@ -792,7 +843,7 @@ void shortcut_init(int unjustify)
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&writefile_list, NANO_TOFILES_KEY, to_files_msg,
|
||||
IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
NANO_NO_KEY, NOVIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -806,33 +857,33 @@ void shortcut_init(int unjustify)
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&writefile_list, NANO_NO_KEY, N_("DOS Format"),
|
||||
IFHELP(nano_dos_msg, TOGGLE_DOS_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
NANO_NO_KEY, NOVIEW, NULL);
|
||||
|
||||
/* Translators: try to keep this string under 16 characters long */
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&writefile_list, NANO_NO_KEY, N_("Mac Format"),
|
||||
IFHELP(nano_mac_msg, TOGGLE_MAC_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
NANO_NO_KEY, NOVIEW, NULL);
|
||||
#endif
|
||||
|
||||
/* Translators: try to keep this string under 16 characters long */
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&writefile_list, NANO_NO_KEY, N_("Append"),
|
||||
IFHELP(nano_append_msg, NANO_APPEND_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
NANO_NO_KEY, NOVIEW, NULL);
|
||||
|
||||
/* Translators: try to keep this string under 16 characters long */
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&writefile_list, NANO_NO_KEY, N_("Prepend"),
|
||||
IFHELP(nano_prepend_msg, NANO_PREPEND_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
NANO_NO_KEY, NOVIEW, NULL);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Translators: try to keep this string under 16 characters long */
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&writefile_list, NANO_NO_KEY, N_("Backup File"),
|
||||
IFHELP(nano_backup_msg, TOGGLE_BACKUP_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
NANO_NO_KEY, NOVIEW, NULL);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&insertfile_list);
|
||||
@@ -849,7 +900,7 @@ void shortcut_init(int unjustify)
|
||||
|
||||
sc_init_one(&insertfile_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
/* If we're using restricted mode, the file browser is disabled.
|
||||
@@ -857,7 +908,7 @@ void shortcut_init(int unjustify)
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&insertfile_list, NANO_TOFILES_KEY, to_files_msg,
|
||||
IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
NANO_NO_KEY, NOVIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -865,18 +916,18 @@ void shortcut_init(int unjustify)
|
||||
* It's useless since inserting files is disabled. */
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, N_("Execute Command"),
|
||||
IFHELP(nano_execute_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
sc_init_one(&insertfile_list, NANO_TOOTHERINSERT_KEY,
|
||||
N_("Execute Command"), IFHELP(nano_execute_msg,
|
||||
NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* If we're using restricted mode, the multibuffer toggle is
|
||||
* disabled. It's useless since inserting files is disabled. */
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&insertfile_list, NANO_NO_KEY, _("New Buffer"),
|
||||
IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
sc_init_one(&insertfile_list, NANO_NO_KEY, new_buffer_msg,
|
||||
IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -895,7 +946,7 @@ void shortcut_init(int unjustify)
|
||||
|
||||
sc_init_one(&spell_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -913,7 +964,17 @@ void shortcut_init(int unjustify)
|
||||
|
||||
sc_init_one(&extcmd_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&extcmd_list, NANO_TOOTHERINSERT_KEY, N_("Insert File"),
|
||||
IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
sc_init_one(&extcmd_list, NANO_NO_KEY, new_buffer_msg,
|
||||
IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
@@ -931,20 +992,24 @@ void shortcut_init(int unjustify)
|
||||
|
||||
sc_init_one(&browser_list, NANO_EXIT_KEY, exit_msg,
|
||||
IFHELP(nano_exitbrowser_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&browser_list, NANO_PREVPAGE_KEY, prev_page_msg,
|
||||
IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, next_page_msg,
|
||||
IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&browser_list, NANO_REFRESH_KEY, N_("Refresh"),
|
||||
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
sc_init_one(&browser_list, NANO_GOTO_KEY, N_("Go To Dir"),
|
||||
IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
sc_init_one(&browser_list, NANO_GOTOLINE_KEY, N_("Go To Dir"),
|
||||
IFHELP(nano_gotodir_msg, NANO_GOTOLINE_ALTKEY),
|
||||
NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
free_shortcutage(&gotodir_list);
|
||||
|
||||
@@ -960,12 +1025,11 @@ void shortcut_init(int unjustify)
|
||||
|
||||
sc_init_one(&gotodir_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
|
||||
currshortcut = main_list;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
toggle_init();
|
||||
#endif
|
||||
@@ -1017,12 +1081,13 @@ void toggle_init(void)
|
||||
/* If we're using restricted mode, the multibuffer toggle is
|
||||
* disabled. It's useless since inserting files is disabled. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
toggle_init_one(TOGGLE_MULTIBUFFER_KEY, N_("Multiple file buffers"),
|
||||
MULTIBUFFER);
|
||||
toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
|
||||
N_("Multiple file buffers"), MULTIBUFFER);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_CONST_KEY, N_("Constant cursor position"),
|
||||
CONSTUPDATE);
|
||||
toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"), AUTOINDENT);
|
||||
toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"),
|
||||
AUTOINDENT);
|
||||
#ifndef DISABLE_WRAPPING
|
||||
toggle_init_one(TOGGLE_WRAP_KEY, N_("Auto line wrap"), NO_WRAP);
|
||||
#endif
|
||||
@@ -1034,29 +1099,30 @@ void toggle_init(void)
|
||||
#ifndef DISABLE_MOUSE
|
||||
toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE);
|
||||
#endif
|
||||
/* If we're using restricted mode, the no-conversion, DOS format,
|
||||
* Mac format, and backup toggles are disabled. The first, second,
|
||||
* and third are useless since inserting files is disabled, and the
|
||||
* fourth is useless since backups are disabled. */
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
/* If we're using restricted mode, the DOS/Mac conversion toggle is
|
||||
* disabled. It's useless since inserting files is disabled. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
toggle_init_one(TOGGLE_NOCONVERT_KEY,
|
||||
N_("No conversion from DOS/Mac format"), NO_CONVERT);
|
||||
toggle_init_one(TOGGLE_DOS_KEY, N_("Writing file in DOS format"),
|
||||
DOS_FILE);
|
||||
toggle_init_one(TOGGLE_MAC_KEY, N_("Writing file in Mac format"),
|
||||
MAC_FILE);
|
||||
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"), BACKUP_FILE);
|
||||
}
|
||||
toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"), SMOOTHSCROLL);
|
||||
toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"), SMART_HOME);
|
||||
/* If we're using restricted mode, the backup toggle is disabled.
|
||||
* It's useless since backups are disabled. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"),
|
||||
BACKUP_FILE);
|
||||
toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"),
|
||||
SMOOTHSCROLL);
|
||||
toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"),
|
||||
SMART_HOME);
|
||||
#ifdef ENABLE_COLOR
|
||||
toggle_init_one(TOGGLE_SYNTAX_KEY, N_("Color syntax highlighting"),
|
||||
COLOR_SYNTAX);
|
||||
NO_COLOR_SYNTAX);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"),
|
||||
WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_MORESPACE_KEY, N_("Use of more space for editing"),
|
||||
MORE_SPACE);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -1123,12 +1189,15 @@ void thanks_for_all_the_fish(void)
|
||||
free(answer);
|
||||
if (cutbuffer != NULL)
|
||||
free_filestruct(cutbuffer);
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
if (jusbuffer != NULL)
|
||||
free_filestruct(jusbuffer);
|
||||
#endif
|
||||
free_shortcutage(&main_list);
|
||||
free_shortcutage(&whereis_list);
|
||||
free_shortcutage(&replace_list);
|
||||
free_shortcutage(&replace_list_2);
|
||||
free_shortcutage(&goto_list);
|
||||
free_shortcutage(&gotoline_list);
|
||||
free_shortcutage(&writefile_list);
|
||||
free_shortcutage(&insertfile_list);
|
||||
#ifndef DISABLE_HELP
|
||||
|
||||
80
src/move.c
80
src/move.c
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* move.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -19,7 +19,9 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -30,37 +32,36 @@
|
||||
|
||||
void do_first_line(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
size_t pww_save = placewewant;
|
||||
current = fileage;
|
||||
placewewant = 0;
|
||||
current_x = 0;
|
||||
if (edittop != fileage || need_vertical_update(old_pww))
|
||||
edit_update(current, TOP);
|
||||
if (edittop != fileage || need_vertical_update(pww_save))
|
||||
edit_update(TOP);
|
||||
}
|
||||
|
||||
void do_last_line(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
size_t pww_save = placewewant;
|
||||
current = filebot;
|
||||
placewewant = 0;
|
||||
current_x = 0;
|
||||
if (edittop->lineno + (editwinrows / 2) != filebot->lineno ||
|
||||
need_vertical_update(old_pww))
|
||||
edit_update(current, CENTER);
|
||||
need_vertical_update(pww_save))
|
||||
edit_update(CENTER);
|
||||
}
|
||||
|
||||
void do_home(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
size_t pww_save = placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(SMART_HOME)) {
|
||||
int old_current_x = current_x;
|
||||
size_t current_x_save = current_x;
|
||||
|
||||
for (current_x = 0; isblank(current->data[current_x]) &&
|
||||
current->data[current_x] != '\0'; current_x++)
|
||||
;
|
||||
current_x = indent_length(current->data);
|
||||
|
||||
if (current_x == old_current_x || current->data[current_x] == '\0')
|
||||
if (current_x == current_x_save ||
|
||||
current->data[current_x] == '\0')
|
||||
current_x = 0;
|
||||
|
||||
placewewant = xplustabs();
|
||||
@@ -71,25 +72,25 @@ void do_home(void)
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
check_statblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
check_statusblank();
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_end(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
size_t pww_save = placewewant;
|
||||
current_x = strlen(current->data);
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
check_statusblank();
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_page_up(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
const filestruct *old_current = current;
|
||||
size_t pww_save = placewewant;
|
||||
const filestruct *current_save = current;
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
@@ -127,15 +128,15 @@ void do_page_up(void)
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(old_current, old_pww);
|
||||
edit_redraw(current_save, pww_save);
|
||||
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
}
|
||||
|
||||
void do_page_down(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
const filestruct *old_current = current;
|
||||
size_t pww_save = placewewant;
|
||||
const filestruct *current_save = current;
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
@@ -174,9 +175,9 @@ void do_page_down(void)
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(old_current, old_pww);
|
||||
edit_redraw(current_save, pww_save);
|
||||
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
}
|
||||
|
||||
void do_up(void)
|
||||
@@ -184,12 +185,13 @@ void do_up(void)
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
|
||||
if (current->prev == NULL)
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
|
||||
current = current->prev;
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
|
||||
@@ -217,7 +219,7 @@ void do_down(void)
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
|
||||
if (current->next == NULL)
|
||||
return;
|
||||
@@ -245,18 +247,18 @@ void do_down(void)
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_left(int allow_update)
|
||||
void do_left(bool allow_update)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
size_t pww_save = placewewant;
|
||||
if (current_x > 0)
|
||||
current_x--;
|
||||
current_x = move_mbleft(current->data, current_x);
|
||||
else if (current != fileage) {
|
||||
do_up();
|
||||
current_x = strlen(current->data);
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
check_statusblank();
|
||||
if (allow_update && need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
@@ -265,20 +267,20 @@ void do_left_void(void)
|
||||
do_left(TRUE);
|
||||
}
|
||||
|
||||
void do_right(int allow_update)
|
||||
void do_right(bool allow_update)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
size_t pww_save = placewewant;
|
||||
assert(current_x <= strlen(current->data));
|
||||
|
||||
if (current->data[current_x] != '\0')
|
||||
current_x++;
|
||||
current_x = move_mbright(current->data, current_x);
|
||||
else if (current->next != NULL) {
|
||||
do_down();
|
||||
current_x = 0;
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
check_statusblank();
|
||||
if (allow_update && need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
|
||||
3437
src/nano.c
3437
src/nano.c
File diff suppressed because it is too large
Load Diff
214
src/nano.h
214
src/nano.h
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* nano.h *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* 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,23 +34,27 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
/* Macros for the flags long... */
|
||||
/* Macros for the flags long. */
|
||||
#define SET(bit) flags |= bit
|
||||
#define UNSET(bit) flags &= ~bit
|
||||
#define ISSET(bit) ((flags & bit) != 0)
|
||||
#define TOGGLE(bit) flags ^= bit
|
||||
|
||||
/* Define charalloc as a macro rather than duplicating code */
|
||||
/* Macros for character allocation. */
|
||||
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
|
||||
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
#define charcpy(dest, src, n) memcpy(dest, src, (n) * sizeof(char))
|
||||
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#undef regexec
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* For the backup file copy ... */
|
||||
#define COPYFILEBLOCKSIZE 1024
|
||||
/* Set a default value for PATH_MAX, so we can use it in lines like
|
||||
* "path = getcwd(NULL, PATH_MAX + 1);". */
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX -1
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLANG
|
||||
@@ -67,60 +71,52 @@
|
||||
#endif /* CURSES_H */
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# ifdef HAVE_LIBINTL_H
|
||||
# include <libintl.h>
|
||||
# endif
|
||||
# define _(string) gettext(string)
|
||||
# define P_(singular, plural, number) ngettext(singular, plural, number)
|
||||
#ifdef HAVE_LIBINTL_H
|
||||
#include <libintl.h>
|
||||
#endif
|
||||
#define _(string) gettext(string)
|
||||
#define P_(singular, plural, number) ngettext(singular, plural, number)
|
||||
#else
|
||||
# define _(string) (string)
|
||||
# define P_(singular, plural, number) (number == 1 ? singular : plural)
|
||||
#define _(string) (string)
|
||||
#define P_(singular, plural, number) (number == 1 ? singular : plural)
|
||||
#endif
|
||||
#define gettext_noop(string) (string)
|
||||
#define N_(string) gettext_noop(string)
|
||||
/* Mark a string that will be sent to gettext later. */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "config.h"
|
||||
|
||||
/* If no snprintf()/vsnprintf(), use the versions from glib. */
|
||||
/* If no snprintf() or vsnprintf(), use the versions from glib. */
|
||||
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
|
||||
#include <glib.h>
|
||||
# ifndef HAVE_SNPRINTF
|
||||
# define snprintf g_snprintf
|
||||
# endif
|
||||
# ifndef HAVE_VSNPRINTF
|
||||
# define vsnprintf g_vsnprintf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If no isblank(), strcasecmp(), strncasecmp(), strcasestr(),
|
||||
* strnlen(), getdelim(), or getline(), use the versions we have. */
|
||||
#ifndef HAVE_ISBLANK
|
||||
#define isblank is_blank_char
|
||||
#ifndef HAVE_SNPRINTF
|
||||
#define snprintf g_snprintf
|
||||
#endif
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
#define vsnprintf g_vsnprintf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If no strcasecmp(), strncasecmp(), strcasestr(), strnlen(),
|
||||
* getdelim(), or getline(), use the versions we have. */
|
||||
#ifndef HAVE_STRCASECMP
|
||||
#define strcasecmp nstricmp
|
||||
#define strcasecmp nstrcasecmp
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
#define strncasecmp nstrnicmp
|
||||
#define strncasecmp nstrncasecmp
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRCASESTR
|
||||
#define strcasestr nstristr
|
||||
#define strcasestr nstrcasestr
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRNLEN
|
||||
#define strnlen nstrnlen
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETDELIM
|
||||
#define getdelim ngetdelim
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETLINE
|
||||
#define getline ngetline
|
||||
#endif
|
||||
@@ -142,6 +138,19 @@
|
||||
#define DISABLE_WRAPJUSTIFY 1
|
||||
#endif
|
||||
|
||||
/* Enumeration types. */
|
||||
typedef enum {
|
||||
NIX_FILE, DOS_FILE, MAC_FILE
|
||||
} file_format;
|
||||
|
||||
typedef enum {
|
||||
UP, DOWN
|
||||
} updown;
|
||||
|
||||
typedef enum {
|
||||
TOP, CENTER, NONE
|
||||
} topmidnone;
|
||||
|
||||
/* Structure types. */
|
||||
typedef struct filestruct {
|
||||
char *data;
|
||||
@@ -156,32 +165,43 @@ typedef struct openfilestruct {
|
||||
#ifndef NANO_SMALL
|
||||
struct stat originalfilestat;
|
||||
#endif
|
||||
struct openfilestruct *next; /* Next node. */
|
||||
struct openfilestruct *prev; /* Previous node. */
|
||||
struct filestruct *fileage; /* Current file. */
|
||||
struct filestruct *filebot; /* Current file's last line. */
|
||||
struct openfilestruct *next;
|
||||
/* Next node. */
|
||||
struct openfilestruct *prev;
|
||||
/* Previous node. */
|
||||
filestruct *fileage; /* Current file. */
|
||||
filestruct *filebot; /* Current file's last line. */
|
||||
filestruct *edittop; /* Current top of edit window. */
|
||||
filestruct *current; /* Current file's line. */
|
||||
#ifndef NANO_SMALL
|
||||
struct filestruct *file_mark_beginbuf;
|
||||
filestruct *mark_beginbuf;
|
||||
/* Current file's beginning marked
|
||||
* line. */
|
||||
int file_mark_beginx; /* Current file's beginning marked
|
||||
size_t mark_beginx; /* Current file's beginning marked
|
||||
* line's x-coordinate position. */
|
||||
#endif
|
||||
int file_current_x; /* Current file's x-coordinate
|
||||
size_t current_x; /* Current file's x-coordinate
|
||||
* position. */
|
||||
int file_current_y; /* Current file's y-coordinate
|
||||
* position. */
|
||||
long file_flags; /* Current file's flags: modification
|
||||
size_t placewewant; /* Current file's place we want. */
|
||||
int totlines; /* Current file's total number of
|
||||
* lines. */
|
||||
size_t totsize; /* Current file's total size. */
|
||||
unsigned long flags; /* Current file's flags: modification
|
||||
* status (and marking status, if
|
||||
* available). */
|
||||
size_t file_placewewant; /* Current file's place we want. */
|
||||
int file_totlines; /* Current file's total number of
|
||||
* lines. */
|
||||
long file_totsize; /* Current file's total size. */
|
||||
int file_lineno; /* Current file's line number. */
|
||||
file_format fmt; /* Current file's format. */
|
||||
} openfilestruct;
|
||||
#endif
|
||||
|
||||
typedef struct partition {
|
||||
filestruct *fileage;
|
||||
filestruct *top_prev;
|
||||
char *top_data;
|
||||
filestruct *filebot;
|
||||
filestruct *bot_next;
|
||||
char *bot_data;
|
||||
} partition;
|
||||
|
||||
typedef struct shortcut {
|
||||
/* Key values that aren't used should be set to NANO_NO_KEY. */
|
||||
int ctrlval; /* Special sentinel key or control key we want
|
||||
@@ -189,7 +209,7 @@ typedef struct shortcut {
|
||||
int metaval; /* Meta key we want bound. */
|
||||
int funcval; /* Function key we want bound. */
|
||||
int miscval; /* Other Meta key we want bound. */
|
||||
int viewok; /* Is this function legal in view mode? */
|
||||
bool viewok; /* Is this function legal in view mode? */
|
||||
void (*func)(void); /* Function to call when we catch this key. */
|
||||
const char *desc; /* Description, e.g. "Page Up". */
|
||||
#ifndef DISABLE_HELP
|
||||
@@ -208,17 +228,16 @@ typedef struct toggle {
|
||||
long flag; /* What flag actually gets toggled. */
|
||||
struct toggle *next;
|
||||
} toggle;
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
typedef struct rcoption {
|
||||
const char *name;
|
||||
long flag;
|
||||
} rcoption;
|
||||
#endif /* ENABLE_NANORC */
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
typedef struct colortype {
|
||||
int fg; /* fg color */
|
||||
int bg; /* bg color */
|
||||
@@ -240,8 +259,7 @@ typedef struct syntaxtype {
|
||||
colortype *color; /* color struct for this syntax */
|
||||
struct syntaxtype *next;
|
||||
} syntaxtype;
|
||||
|
||||
#endif /* ENABLE_COLOR */
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
typedef struct historytype {
|
||||
@@ -249,6 +267,7 @@ typedef struct historytype {
|
||||
struct historytype *prev;
|
||||
char *data;
|
||||
} historytype;
|
||||
|
||||
typedef struct historyheadtype {
|
||||
struct historytype *next; /* Keep *next and *prev members
|
||||
* together. */
|
||||
@@ -259,7 +278,7 @@ typedef struct historyheadtype {
|
||||
int count;
|
||||
int len;
|
||||
} historyheadtype;
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif
|
||||
|
||||
/* Bitwise flags so we can save space (or more correctly, not waste
|
||||
* it). */
|
||||
@@ -279,21 +298,21 @@ typedef struct historyheadtype {
|
||||
#define CUT_TO_END (1<<13)
|
||||
#define REVERSE_SEARCH (1<<14)
|
||||
#define MULTIBUFFER (1<<15)
|
||||
#define DOS_FILE (1<<16)
|
||||
#define MAC_FILE (1<<17)
|
||||
#define SMOOTHSCROLL (1<<18)
|
||||
#define DISABLE_CURPOS (1<<19) /* Damn, we still need it. */
|
||||
#define REBIND_DELETE (1<<20)
|
||||
#define NO_CONVERT (1<<21)
|
||||
#define BACKUP_FILE (1<<22)
|
||||
#define NO_RCFILE (1<<23)
|
||||
#define COLOR_SYNTAX (1<<24)
|
||||
#define PRESERVE (1<<25)
|
||||
#define HISTORY_CHANGED (1<<26)
|
||||
#define HISTORYLOG (1<<27)
|
||||
#define RESTRICTED (1<<28)
|
||||
#define SMART_HOME (1<<29)
|
||||
#define WHITESPACE_DISPLAY (1<<30)
|
||||
#define SMOOTHSCROLL (1<<16)
|
||||
#define DISABLE_CURPOS (1<<17) /* Damn, we still need it. */
|
||||
#define REBIND_DELETE (1<<18)
|
||||
#define NO_CONVERT (1<<19)
|
||||
#define BACKUP_FILE (1<<20)
|
||||
#define NO_RCFILE (1<<21)
|
||||
#define NO_COLOR_SYNTAX (1<<22)
|
||||
#define PRESERVE (1<<23)
|
||||
#define HISTORY_CHANGED (1<<24)
|
||||
#define HISTORYLOG (1<<25)
|
||||
#define RESTRICTED (1<<26)
|
||||
#define SMART_HOME (1<<27)
|
||||
#define WHITESPACE_DISPLAY (1<<28)
|
||||
#define MORE_SPACE (1<<29)
|
||||
#define NO_UTF8 (1<<30)
|
||||
|
||||
/* Control key sequences, changing these would be very very bad. */
|
||||
#define NANO_CONTROL_SPACE 0
|
||||
@@ -330,6 +349,8 @@ typedef struct historyheadtype {
|
||||
#define NANO_CONTROL_7 31
|
||||
#define NANO_CONTROL_8 127
|
||||
|
||||
#define NANO_ALT_9 '9'
|
||||
#define NANO_ALT_0 '0'
|
||||
#define NANO_ALT_A 'a'
|
||||
#define NANO_ALT_B 'b'
|
||||
#define NANO_ALT_C 'c'
|
||||
@@ -358,6 +379,8 @@ typedef struct historyheadtype {
|
||||
#define NANO_ALT_Z 'z'
|
||||
#define NANO_ALT_PERIOD '.'
|
||||
#define NANO_ALT_COMMA ','
|
||||
#define NANO_ALT_LPAREN '('
|
||||
#define NANO_ALT_RPAREN ')'
|
||||
#define NANO_ALT_LCARAT '<'
|
||||
#define NANO_ALT_RCARAT '>'
|
||||
#define NANO_ALT_RBRACKET ']'
|
||||
@@ -375,24 +398,29 @@ typedef struct historyheadtype {
|
||||
/* Normal keys. */
|
||||
#define NANO_XON_KEY NANO_CONTROL_Q
|
||||
#define NANO_XOFF_KEY NANO_CONTROL_S
|
||||
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
||||
#define NANO_INSERTFILE_FKEY KEY_F(5)
|
||||
#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_GOTO_KEY NANO_CONTROL_7
|
||||
#define NANO_GOTO_FKEY KEY_F(13)
|
||||
#define NANO_ALT_GOTO_KEY NANO_ALT_G
|
||||
#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_REPLACE_KEY NANO_CONTROL_4
|
||||
#define NANO_REPLACE_FKEY KEY_F(14)
|
||||
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
||||
#define NANO_OTHERSEARCH_KEY NANO_CONTROL_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
|
||||
@@ -409,7 +437,6 @@ typedef struct historyheadtype {
|
||||
#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY
|
||||
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
||||
#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY
|
||||
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
||||
#define NANO_REFRESH_KEY NANO_CONTROL_L
|
||||
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
|
||||
#define NANO_JUSTIFY_FKEY KEY_F(4)
|
||||
@@ -420,7 +447,8 @@ typedef struct historyheadtype {
|
||||
#define NANO_FORWARD_KEY NANO_CONTROL_F
|
||||
#define NANO_BACK_KEY NANO_CONTROL_B
|
||||
#define NANO_MARK_KEY NANO_CONTROL_6
|
||||
#define NANO_ALT_MARK_KEY NANO_ALT_A
|
||||
#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
|
||||
@@ -428,7 +456,6 @@ typedef struct historyheadtype {
|
||||
#define NANO_TAB_KEY NANO_CONTROL_I
|
||||
#define NANO_SUSPEND_KEY NANO_CONTROL_Z
|
||||
#define NANO_ENTER_KEY NANO_CONTROL_M
|
||||
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
|
||||
#define NANO_TOFILES_KEY NANO_CONTROL_T
|
||||
#define NANO_APPEND_KEY NANO_ALT_A
|
||||
#define NANO_PREPEND_KEY NANO_ALT_P
|
||||
@@ -437,12 +464,18 @@ typedef struct historyheadtype {
|
||||
#define NANO_OPENPREV_ALTKEY NANO_ALT_COMMA
|
||||
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
|
||||
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
|
||||
#define NANO_EXTCMD_KEY NANO_CONTROL_X
|
||||
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
||||
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
||||
#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
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -459,13 +492,14 @@ typedef struct historyheadtype {
|
||||
#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_O
|
||||
#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
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
#define MAIN_VISIBLE 12
|
||||
@@ -473,24 +507,16 @@ typedef struct historyheadtype {
|
||||
#define VIEW TRUE
|
||||
#define NOVIEW FALSE
|
||||
|
||||
typedef enum {
|
||||
UP, DOWN
|
||||
} updown;
|
||||
|
||||
typedef enum {
|
||||
TOP, CENTER, NONE
|
||||
} topmidnone;
|
||||
|
||||
/* Minimum editor window rows required for nano to work correctly. */
|
||||
#define MIN_EDITOR_ROWS 3
|
||||
|
||||
/* Minimum editor window cols required for nano to work correctly. */
|
||||
#define MIN_EDITOR_COLS 10
|
||||
#define MIN_EDITOR_ROWS 1
|
||||
|
||||
/* Default number of characters from end-of-line where text wrapping
|
||||
* occurs. */
|
||||
#define CHARS_FROM_EOL 8
|
||||
|
||||
/* Default width of a tab. */
|
||||
#define WIDTH_OF_TAB 8
|
||||
|
||||
/* Maximum number of search history strings saved, same value used for
|
||||
* replace history. */
|
||||
#define MAX_SEARCH_HISTORY 100
|
||||
|
||||
398
src/proto.h
398
src/proto.h
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* proto.h *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -21,8 +21,9 @@
|
||||
|
||||
/* Externs. */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
@@ -32,19 +33,21 @@
|
||||
extern ssize_t wrap_at;
|
||||
#endif
|
||||
extern int editwinrows;
|
||||
extern int current_x, current_y, totlines;
|
||||
extern size_t current_x;
|
||||
extern int current_y;
|
||||
extern int totlines;
|
||||
extern size_t placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
extern int mark_beginx;
|
||||
extern size_t mark_beginx;
|
||||
#endif
|
||||
extern long totsize;
|
||||
extern long flags;
|
||||
extern size_t totsize;
|
||||
extern unsigned long flags;
|
||||
extern ssize_t tabsize;
|
||||
extern int search_last_line;
|
||||
extern int currslen;
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
extern char *whitespace;
|
||||
extern int whitespace_len[2];
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -82,10 +85,13 @@ extern char *full_operating_dir;
|
||||
extern char *alt_speller;
|
||||
#endif
|
||||
|
||||
extern int resetstatuspos;
|
||||
extern struct stat fileinfo;
|
||||
extern filestruct *current, *fileage, *edittop, *filebot;
|
||||
extern filestruct *cutbuffer;
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
extern filestruct *jusbuffer;
|
||||
#endif
|
||||
extern partition *filepart;
|
||||
#ifndef NANO_SMALL
|
||||
extern filestruct *mark_beginbuf;
|
||||
#endif
|
||||
@@ -102,7 +108,7 @@ extern char *syntaxstr;
|
||||
|
||||
extern shortcut *shortcut_list;
|
||||
extern shortcut *main_list, *whereis_list;
|
||||
extern shortcut *replace_list, *goto_list;
|
||||
extern shortcut *replace_list, *gotoline_list;
|
||||
extern shortcut *writefile_list, *insertfile_list;
|
||||
extern shortcut *replace_list_2;
|
||||
#ifndef NANO_SMALL
|
||||
@@ -118,9 +124,7 @@ extern shortcut *spell_list;
|
||||
extern shortcut *browser_list, *gotodir_list;
|
||||
#endif
|
||||
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
|
||||
extern const shortcut *currshortcut;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
extern regex_t search_regexp;
|
||||
@@ -142,89 +146,167 @@ extern historyheadtype replace_history;
|
||||
|
||||
extern bool curses_ended;
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
extern char *homedir;
|
||||
#endif
|
||||
|
||||
/* Functions we want available. */
|
||||
|
||||
/* Public functions in color.c */
|
||||
/* Public functions in chars.c. */
|
||||
bool is_byte(int c);
|
||||
bool is_alnum_char(int c);
|
||||
bool is_alnum_mbchar(const char *c);
|
||||
#ifdef NANO_WIDE
|
||||
bool is_alnum_wchar(wchar_t wc);
|
||||
#endif
|
||||
bool is_blank_char(int c);
|
||||
bool is_blank_mbchar(const char *c);
|
||||
#ifdef NANO_WIDE
|
||||
bool is_blank_wchar(wchar_t wc);
|
||||
#endif
|
||||
bool is_cntrl_char(int c);
|
||||
bool is_cntrl_mbchar(const char *c);
|
||||
#ifdef NANO_WIDE
|
||||
bool is_cntrl_wchar(wchar_t wc);
|
||||
#endif
|
||||
unsigned char control_rep(unsigned char c);
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len);
|
||||
#ifdef NANO_WIDE
|
||||
wchar_t control_wrep(wchar_t c);
|
||||
#endif
|
||||
int mbwidth(const char *c);
|
||||
int mb_cur_max(void);
|
||||
char *make_mbchar(int chr, int *chr_mb_len);
|
||||
#if defined(ENABLE_NANORC) || defined(ENABLE_EXTRA)
|
||||
char *make_mbstring(const char *str);
|
||||
#endif
|
||||
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
|
||||
*col);
|
||||
size_t move_mbleft(const char *buf, size_t pos);
|
||||
size_t move_mbright(const char *buf, size_t pos);
|
||||
#ifndef HAVE_STRCASECMP
|
||||
int nstrcasecmp(const char *s1, const char *s2);
|
||||
#endif
|
||||
int mbstrcasecmp(const char *s1, const char *s2);
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
int nstrncasecmp(const char *s1, const char *s2, size_t n);
|
||||
#endif
|
||||
int mbstrncasecmp(const char *s1, const char *s2, size_t n);
|
||||
#ifndef HAVE_STRCASESTR
|
||||
const char *nstrcasestr(const char *haystack, const char *needle);
|
||||
#endif
|
||||
const char *mbstrcasestr(const char *haystack, const char *needle);
|
||||
#ifndef NANO_SMALL
|
||||
const char *revstrstr(const char *haystack, const char *needle, const
|
||||
char *rev_start);
|
||||
const char *revstrcasestr(const char *haystack, const char *needle,
|
||||
const char *rev_start);
|
||||
const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
const char *rev_start);
|
||||
#endif
|
||||
size_t mbstrlen(const char *s);
|
||||
#ifndef HAVE_STRNLEN
|
||||
size_t nstrnlen(const char *s, size_t maxlen);
|
||||
#endif
|
||||
size_t mbstrnlen(const char *s, size_t maxlen);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
char *mbstrchr(const char *s, char *c);
|
||||
#endif
|
||||
|
||||
/* Public functions in color.c. */
|
||||
#ifdef ENABLE_COLOR
|
||||
void set_colorpairs(void);
|
||||
void do_colorinit(void);
|
||||
void update_color(void);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
/* Public functions in cut.c */
|
||||
/* Public functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
filestruct *get_cutbottom(void);
|
||||
void add_to_cutbuffer(filestruct *inptr, bool allow_concat);
|
||||
void cut_marked_segment(void);
|
||||
void cut_line(void);
|
||||
#ifndef NANO_SMALL
|
||||
void cut_marked(void);
|
||||
#endif
|
||||
void cut_to_eol(void);
|
||||
void do_cut_text(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_cut_till_end(void);
|
||||
#endif
|
||||
void do_uncut_text(void);
|
||||
|
||||
/* Public functions in files.c */
|
||||
void load_file(int update);
|
||||
/* Public functions in files.c. */
|
||||
void new_file(void);
|
||||
filestruct *read_line(char *buf, filestruct *prev, int *line1ins, size_t
|
||||
len);
|
||||
void read_file(FILE *f, const char *filename, int quiet);
|
||||
bool open_file(const char *filename, int insert, int quiet);
|
||||
filestruct *read_line(char *buf, filestruct *prev, bool *first_line_ins,
|
||||
size_t len);
|
||||
void load_file(void);
|
||||
void read_file(FILE *f, const char *filename);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
char *get_next_filename(const char *name);
|
||||
void do_insertfile(int loading_file);
|
||||
#ifndef NANO_SMALL
|
||||
void execute_command(const char *command);
|
||||
#endif
|
||||
void load_buffer(const char *name);
|
||||
void do_insertfile(
|
||||
#ifndef NANO_SMALL
|
||||
bool execute
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
);
|
||||
void do_insertfile_void(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
openfilestruct *make_new_opennode(openfilestruct *prevnode);
|
||||
openfilestruct *make_new_opennode(void);
|
||||
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
|
||||
openfilestruct *end);
|
||||
void unlink_opennode(const openfilestruct *fileptr);
|
||||
void unlink_opennode(openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
#ifdef DEBUG
|
||||
void free_openfilestruct(openfilestruct *src);
|
||||
void add_open_file(int update);
|
||||
#endif
|
||||
void add_open_file(bool update);
|
||||
void load_open_file(void);
|
||||
void open_prevfile(int closing_file);
|
||||
void open_prevnext_file(bool next);
|
||||
void open_prevfile_void(void);
|
||||
void open_nextfile(int closing_file);
|
||||
void open_nextfile_void(void);
|
||||
int close_open_file(void);
|
||||
bool close_open_file(void);
|
||||
#endif
|
||||
#if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR)
|
||||
char *get_full_path(const char *origpath);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
char *check_writable_directory(const char *path);
|
||||
char *safe_tempnam(const char *dirname, const char *filename_prefix);
|
||||
char *safe_tempnam(void);
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
void init_operating_dir(void);
|
||||
int check_operating_dir(const char *currpath, int allow_tabcomp);
|
||||
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
void init_backup_dir(void);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out);
|
||||
int write_file(const char *name, int tmp, int append, int nonamechange);
|
||||
int write_file(const char *name, bool tmp, int append, bool
|
||||
nonamechange);
|
||||
#ifndef NANO_SMALL
|
||||
int write_marked(const char *name, int tmp, int append);
|
||||
int write_marked(const char *name, bool tmp, int append);
|
||||
#endif
|
||||
int do_writeout(int exiting);
|
||||
int do_writeout(bool exiting);
|
||||
void do_writeout_void(void);
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
|
||||
int diralphasort(const void *va, const void *vb);
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
int append_slash_if_dir(char *buf, bool *lastwastab, int *place);
|
||||
char **username_tab_completion(char *buf, int *num_matches);
|
||||
char **cwd_tab_completion(char *buf, int *num_matches);
|
||||
char *input_tab(char *buf, int place, bool *lastwastab, int *newplace,
|
||||
bool *list);
|
||||
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);
|
||||
#endif
|
||||
const char *tail(const char *foo);
|
||||
#ifndef DISABLE_BROWSER
|
||||
int diralphasort(const void *va, const void *vb);
|
||||
void free_charptrarray(char **array, size_t len);
|
||||
void striponedir(char *foo);
|
||||
int readable_dir(const char *path);
|
||||
char **browser_init(const char *path, int *longest, int *numents);
|
||||
char *do_browser(const char *inpath);
|
||||
void striponedir(char *path);
|
||||
char **browser_init(const char *path, int *longest, size_t *numents, DIR
|
||||
*dir);
|
||||
char *do_browser(char *path, DIR *dir);
|
||||
char *do_browse_from(const char *inpath);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
@@ -234,7 +316,7 @@ bool writehist(FILE *hist, historyheadtype *histhead);
|
||||
void save_history(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in global.c */
|
||||
/* Public functions in global.c. */
|
||||
size_t length_of_list(const shortcut *s);
|
||||
#ifndef NANO_SMALL
|
||||
void toggle_init_one(int val, const char *desc, long flag);
|
||||
@@ -247,15 +329,15 @@ void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help,
|
||||
#endif
|
||||
int metaval, int funcval, int miscval, int view, void
|
||||
int metaval, int funcval, int miscval, bool view, void
|
||||
(*func)(void));
|
||||
void shortcut_init(int unjustify);
|
||||
void shortcut_init(bool unjustify);
|
||||
void free_shortcutage(shortcut **shortcutage);
|
||||
#ifdef DEBUG
|
||||
void thanks_for_all_the_fish(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in move.c */
|
||||
/* Public functions in move.c. */
|
||||
void do_first_line(void);
|
||||
void do_last_line(void);
|
||||
void do_home(void);
|
||||
@@ -264,17 +346,18 @@ void do_page_up(void);
|
||||
void do_page_down(void);
|
||||
void do_up(void);
|
||||
void do_down(void);
|
||||
void do_left(int allow_update);
|
||||
void do_left(bool allow_update);
|
||||
void do_left_void(void);
|
||||
void do_right(int allow_update);
|
||||
void do_right(bool allow_update);
|
||||
void do_right_void(void);
|
||||
|
||||
/* Public functions in nano.c */
|
||||
/* Public functions in nano.c. */
|
||||
void print_view_warning(void);
|
||||
void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename);
|
||||
void die_too_small(void);
|
||||
void print_view_warning(void);
|
||||
void check_die_too_small(void);
|
||||
void resize_variables(void);
|
||||
void global_init(bool save_cutbuffer);
|
||||
void window_init(void);
|
||||
#ifndef DISABLE_MOUSE
|
||||
@@ -291,22 +374,25 @@ void unlink_node(const filestruct *fileptr);
|
||||
void delete_node(filestruct *fileptr);
|
||||
filestruct *copy_filestruct(const filestruct *src);
|
||||
void free_filestruct(filestruct *src);
|
||||
partition *partition_filestruct(filestruct *top, size_t top_x,
|
||||
filestruct *bot, size_t bot_x);
|
||||
void unpartition_filestruct(partition **p);
|
||||
void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
|
||||
void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
|
||||
void renumber_all(void);
|
||||
void renumber(filestruct *fileptr);
|
||||
void print1opt(const char *shortflag, const char *longflag, const char
|
||||
*desc);
|
||||
void usage(void);
|
||||
void version(void);
|
||||
int no_more_space(void);
|
||||
int no_help(void);
|
||||
void nano_disabled_msg(void);
|
||||
#ifndef NANO_SMALL
|
||||
RETSIGTYPE cancel_fork(int signal);
|
||||
void cancel_fork(int signal);
|
||||
bool open_pipe(const char *command);
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
void do_mouse(void);
|
||||
#endif
|
||||
void do_char(char ch);
|
||||
void do_verbatim_input(void);
|
||||
void do_backspace(void);
|
||||
void do_delete(void);
|
||||
@@ -319,7 +405,7 @@ void do_mark(void);
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
void wrap_reset(void);
|
||||
bool do_wrap(filestruct *inptr);
|
||||
bool do_wrap(filestruct *line);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool do_int_spell_fix(const char *word);
|
||||
@@ -327,34 +413,37 @@ const char *do_int_speller(const char *tempfile_name);
|
||||
const char *do_alt_speller(char *tempfile_name);
|
||||
void do_spell(void);
|
||||
#endif
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
|
||||
ssize_t break_line(const char *line, ssize_t goal, bool newline);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
|
||||
size_t indent_length(const char *line);
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
void justify_format(filestruct *line, size_t skip);
|
||||
void justify_format(filestruct *paragraph, size_t skip);
|
||||
size_t quote_length(const char *line);
|
||||
bool quotes_match(const char *a_line, size_t a_quote, const char
|
||||
*b_line);
|
||||
bool indents_match(const char *a_line, size_t a_indent, const char
|
||||
*b_line, size_t b_indent);
|
||||
bool begpar(const filestruct *const foo);
|
||||
void do_para_begin(void);
|
||||
bool inpar(const char *str);
|
||||
void do_para_end(void);
|
||||
void do_para_begin(bool allow_update);
|
||||
void do_para_begin_void(void);
|
||||
bool inpar(const filestruct *const foo);
|
||||
void do_para_end(bool allow_update);
|
||||
void do_para_end_void(void);
|
||||
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
|
||||
quote_len);
|
||||
bool breakable(const char *line, int goal);
|
||||
int break_line(const char *line, int goal, bool force);
|
||||
bool do_para_search(size_t *const quote, size_t *const par);
|
||||
bool find_paragraph(size_t *const quote, size_t *const par);
|
||||
void do_justify(bool full_justify);
|
||||
void do_justify_void(void);
|
||||
void do_full_justify(void);
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
void do_exit(void);
|
||||
void signal_init(void);
|
||||
RETSIGTYPE handle_hupterm(int signal);
|
||||
RETSIGTYPE do_suspend(int signal);
|
||||
RETSIGTYPE do_cont(int signal);
|
||||
void handle_hupterm(int signal);
|
||||
void do_suspend(int signal);
|
||||
void do_cont(int signal);
|
||||
#ifndef NANO_SMALL
|
||||
void handle_sigwinch(int s);
|
||||
void allow_pending_sigwinch(bool allow);
|
||||
@@ -362,6 +451,7 @@ void allow_pending_sigwinch(bool allow);
|
||||
#ifndef NANO_SMALL
|
||||
void do_toggle(const toggle *which);
|
||||
#endif
|
||||
void disable_extended_input(void);
|
||||
void disable_signals(void);
|
||||
#ifndef NANO_SMALL
|
||||
void enable_signals(void);
|
||||
@@ -369,16 +459,22 @@ void enable_signals(void);
|
||||
void disable_flow_control(void);
|
||||
void enable_flow_control(void);
|
||||
void terminal_init(void);
|
||||
int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
*ran_func, bool *finished, bool allow_funcs);
|
||||
#ifndef DISABLE_MOUSE
|
||||
bool do_mouse(void);
|
||||
#endif
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls);
|
||||
|
||||
/* Public functions in rcfile.c */
|
||||
/* Public functions in rcfile.c. */
|
||||
#ifdef ENABLE_NANORC
|
||||
void rcfile_error(const char *msg, ...);
|
||||
char *parse_next_word(char *ptr);
|
||||
char *parse_argument(char *ptr);
|
||||
#ifdef ENABLE_COLOR
|
||||
int colortoint(const char *colorname, int *bright);
|
||||
int color_to_int(const char *colorname, bool *bright);
|
||||
char *parse_next_regex(char *ptr);
|
||||
int nregcomp(regex_t *preg, const char *regex, int eflags);
|
||||
bool nregcomp(regex_t *preg, const char *regex, int eflags);
|
||||
void parse_syntax(char *ptr);
|
||||
void parse_colors(char *ptr);
|
||||
#endif /* ENABLE_COLOR */
|
||||
@@ -386,7 +482,7 @@ void parse_rcfile(FILE *rcstream);
|
||||
void do_rcfile(void);
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* Public functions in search.c */
|
||||
/* Public functions in search.c. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
int regexp_init(const char *regexp);
|
||||
void regexp_cleanup(void);
|
||||
@@ -394,27 +490,29 @@ void regexp_cleanup(void);
|
||||
void not_found_msg(const char *str);
|
||||
void search_abort(void);
|
||||
void search_init_globals(void);
|
||||
int search_init(int replacing);
|
||||
int is_whole_word(int curr_pos, const char *datastr, const char
|
||||
*searchword);
|
||||
int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
||||
*begin, size_t beginx, const char *needle, int no_sameline);
|
||||
int search_init(bool replacing, bool use_answer);
|
||||
bool is_whole_word(size_t pos, const char *buf, const char *word);
|
||||
bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
no_sameline, const filestruct *begin, size_t beginx, const char
|
||||
*needle, size_t *needle_len);
|
||||
void findnextstr_wrap_reset(void);
|
||||
void do_search(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_research(void);
|
||||
#endif
|
||||
void replace_abort(void);
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, int create_flag);
|
||||
int replace_regexp(char *string, bool create_flag);
|
||||
#endif
|
||||
char *replace_line(const char *needle);
|
||||
int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
size_t *real_current_x, int wholewords);
|
||||
ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
*real_current, size_t *real_current_x, bool wholewords, bool
|
||||
*canceled);
|
||||
void do_replace(void);
|
||||
void do_gotoline(int line, bool save_pos);
|
||||
void do_gotoline_void(void);
|
||||
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
|
||||
void do_gotopos(int line, int pos_x, int pos_y, size_t pos_pww);
|
||||
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
|
||||
void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww);
|
||||
#endif
|
||||
void do_find_bracket(void);
|
||||
#ifndef NANO_SMALL
|
||||
@@ -431,7 +529,7 @@ void free_history(historyheadtype *h);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Public functions in utils.c */
|
||||
/* Public functions in utils.c. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
@@ -439,34 +537,13 @@ int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
#endif
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string);
|
||||
#endif
|
||||
#ifndef HAVE_ISBLANK
|
||||
int is_blank_char(int c);
|
||||
#endif
|
||||
int is_cntrl_char(int c);
|
||||
int num_of_digits(int n);
|
||||
void get_homedir(void);
|
||||
bool parse_num(const char *str, ssize_t *val);
|
||||
void align(char **strp);
|
||||
void null_at(char **data, size_t index);
|
||||
void unsunder(char *str, size_t true_len);
|
||||
void sunder(char *str);
|
||||
#ifndef HAVE_STRCASECMP
|
||||
int nstricmp(const char *s1, const char *s2);
|
||||
#endif
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
int nstrnicmp(const char *s1, const char *s2, size_t n);
|
||||
#endif
|
||||
#ifndef HAVE_STRCASESTR
|
||||
const char *nstristr(const char *haystack, const char *needle);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
const char *revstrstr(const char *haystack, const char *needle, const
|
||||
char *rev_start);
|
||||
const char *revstristr(const char *haystack, const char *needle, const
|
||||
char *rev_start);
|
||||
#endif
|
||||
#ifndef HAVE_STRNLEN
|
||||
size_t nstrnlen(const char *s, size_t maxlen);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef HAVE_GETLINE
|
||||
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
|
||||
@@ -480,58 +557,91 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
void nperror(const char *s);
|
||||
void *nmalloc(size_t howmuch);
|
||||
void *nrealloc(void *ptr, size_t howmuch);
|
||||
char *mallocstrncpy(char *dest, const char *src, size_t n);
|
||||
char *mallocstrcpy(char *dest, const char *src);
|
||||
char *mallocstrassn(char *dest, char *src);
|
||||
void new_magicline(void);
|
||||
#ifndef NANO_SMALL
|
||||
void remove_magicline(void);
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x);
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
int check_wildcard_match(const char *text, const char *pattern);
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
#endif
|
||||
void get_totals(const filestruct *begin, const filestruct *end, int
|
||||
*lines, size_t *size);
|
||||
|
||||
/* Public functions in winio.c */
|
||||
/* Public functions in winio.c. */
|
||||
#ifndef NANO_SMALL
|
||||
void reset_kbinput(void);
|
||||
#endif
|
||||
int get_kbinput(WINDOW *win, int *meta_key);
|
||||
int get_translated_kbinput(int kbinput, int *es
|
||||
void get_buffer(WINDOW *win);
|
||||
size_t get_buffer_len(void);
|
||||
void unget_input(int *input, size_t input_len);
|
||||
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
|
||||
int *get_input(WINDOW *win, size_t input_len);
|
||||
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
||||
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
int get_ascii_kbinput(int kbinput, size_t ascii_digits
|
||||
int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
||||
*ignore_seq);
|
||||
int get_escape_seq_abcd(int kbinput);
|
||||
int get_byte_kbinput(int kbinput
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
int get_word_kbinput(int kbinput
|
||||
#ifndef NANO_SMALL
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
int get_control_kbinput(int kbinput);
|
||||
int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int
|
||||
*ignore_seq);
|
||||
int get_escape_seq_abcd(int kbinput);
|
||||
int *get_verbatim_kbinput(WINDOW *win, int *v_kbinput, size_t *v_len,
|
||||
int allow_ascii);
|
||||
int get_untranslated_kbinput(int kbinput, size_t position, int
|
||||
allow_ascii
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
#endif
|
||||
);
|
||||
void unparse_kbinput(char *output, size_t output_len);
|
||||
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
|
||||
int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
|
||||
#ifndef DISABLE_MOUSE
|
||||
int get_mouseinput(int *mouse_x, int *mouse_y, int allow_shortcuts);
|
||||
bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
||||
#endif
|
||||
const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
|
||||
*meta_key, bool *func_key);
|
||||
#ifndef NANO_SMALL
|
||||
const toggle *get_toggle(int kbinput, bool meta_key);
|
||||
#endif
|
||||
int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
bool *ran_func, bool *finished, bool allow_funcs);
|
||||
#ifndef DISABLE_MOUSE
|
||||
bool do_statusbar_mouse(void);
|
||||
#endif
|
||||
void do_statusbar_home(void);
|
||||
void do_statusbar_end(void);
|
||||
void do_statusbar_right(void);
|
||||
void do_statusbar_left(void);
|
||||
void do_statusbar_backspace(void);
|
||||
void do_statusbar_delete(void);
|
||||
void do_statusbar_cut_text(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_statusbar_next_word(void);
|
||||
void do_statusbar_prev_word(void);
|
||||
#endif
|
||||
void do_statusbar_verbatim_input(bool *got_enter);
|
||||
void do_statusbar_output(char *output, size_t output_len, bool
|
||||
*got_enter, bool allow_cntrls);
|
||||
size_t xplustabs(void);
|
||||
size_t actual_x(const char *str, size_t xplus);
|
||||
size_t strnlenpt(const char *buf, size_t size);
|
||||
size_t strlenpt(const char *buf);
|
||||
void blank_titlebar(void);
|
||||
void blank_topbar(void);
|
||||
void blank_edit(void);
|
||||
void blank_statusbar(void);
|
||||
void check_statblank(void);
|
||||
void blank_bottombars(void);
|
||||
char *display_string(const char *buf, size_t start_col, size_t len);
|
||||
void check_statusblank(void);
|
||||
char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||
dollars);
|
||||
void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
|
||||
int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
int nanogetstr(bool allow_tabs, const char *buf, const char *def,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
#endif
|
||||
@@ -540,6 +650,12 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
, bool *list
|
||||
#endif
|
||||
);
|
||||
int statusq(bool allow_tabs, const shortcut *s, const char *def,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
void statusq_abort(void);
|
||||
void titlebar(const char *path);
|
||||
void set_modified(void);
|
||||
void statusbar(const char *msg, ...);
|
||||
@@ -558,22 +674,18 @@ int need_vertical_update(size_t old_pww);
|
||||
void edit_scroll(updown direction, int nlines);
|
||||
void edit_redraw(const filestruct *old_current, size_t old_pww);
|
||||
void edit_refresh(void);
|
||||
void edit_update(filestruct *fileptr, topmidnone location);
|
||||
int statusq(int allowtabs, const shortcut *s, const char *def,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
int do_yesno(int all, const char *msg);
|
||||
void edit_update(topmidnone location);
|
||||
int do_yesno(bool all, const char *msg);
|
||||
void total_update(void);
|
||||
void total_refresh(void);
|
||||
void display_main_list(void);
|
||||
void do_cursorpos(int constant);
|
||||
void do_cursorpos(bool constant);
|
||||
void do_cursorpos_void(void);
|
||||
#ifndef DISABLE_HELP
|
||||
int help_line_len(const char *ptr);
|
||||
size_t help_line_len(const char *ptr);
|
||||
void do_help(void);
|
||||
#endif
|
||||
void do_replace_highlight(int highlight_flag, const char *word);
|
||||
void do_replace_highlight(bool highlight_flag, const char *word);
|
||||
#ifdef DEBUG
|
||||
void dump_buffer(const filestruct *inptr);
|
||||
void dump_buffer_reverse(void);
|
||||
|
||||
585
src/rcfile.c
585
src/rcfile.c
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* rcfile.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -19,7 +19,9 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
@@ -27,9 +29,6 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
@@ -62,6 +61,7 @@ const static rcoption rcopts[] = {
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
{"multibuffer", MULTIBUFFER},
|
||||
#endif
|
||||
{"morespace", MORE_SPACE},
|
||||
#ifndef NANO_SMALL
|
||||
{"noconvert", NO_CONVERT},
|
||||
#endif
|
||||
@@ -101,10 +101,16 @@ const static rcoption rcopts[] = {
|
||||
|
||||
static bool errors = FALSE;
|
||||
static int lineno = 0;
|
||||
static const char *nanorc;
|
||||
static char *nanorc = NULL;
|
||||
#ifdef ENABLE_COLOR
|
||||
static syntaxtype *endsyntax = NULL;
|
||||
/* The end of the list of syntaxes. */
|
||||
static colortype *endcolor = NULL;
|
||||
/* The end of the color list for the current syntax. */
|
||||
#endif
|
||||
|
||||
/* We have an error in some part of the rcfile; put it on stderr and
|
||||
make the user hit return to continue starting up nano. */
|
||||
/* We have an error in some part of the rcfile. Put it on stderr and
|
||||
* make the user hit return to continue starting up nano. */
|
||||
void rcfile_error(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -122,31 +128,32 @@ void rcfile_error(const char *msg, ...)
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
/* Parse the next word from the string. Returns NULL if we hit EOL. */
|
||||
/* Parse the next word from the string. Return points to '\0' if we hit
|
||||
* the end of the line. */
|
||||
char *parse_next_word(char *ptr)
|
||||
{
|
||||
while (!isblank(*ptr) && *ptr != '\n' && *ptr != '\0')
|
||||
while (!is_blank_char(*ptr) && *ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\0')
|
||||
return NULL;
|
||||
return ptr;
|
||||
|
||||
/* Null terminate and advance ptr */
|
||||
*ptr++ = 0;
|
||||
/* Null-terminate and advance ptr. */
|
||||
*ptr++ = '\0';
|
||||
|
||||
while (isblank(*ptr))
|
||||
while (is_blank_char(*ptr))
|
||||
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. */
|
||||
/* 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. */
|
||||
char *parse_argument(char *ptr)
|
||||
{
|
||||
const char *ptr_bak = ptr;
|
||||
@@ -161,7 +168,7 @@ char *parse_argument(char *ptr)
|
||||
ptr++;
|
||||
if (*ptr == '"')
|
||||
last_quote = ptr;
|
||||
} while (*ptr != '\n' && *ptr != '\0');
|
||||
} while (*ptr != '\0');
|
||||
|
||||
if (last_quote == NULL) {
|
||||
if (*ptr == '\0')
|
||||
@@ -174,22 +181,25 @@ char *parse_argument(char *ptr)
|
||||
ptr = last_quote + 1;
|
||||
}
|
||||
if (ptr != NULL)
|
||||
while (isblank(*ptr))
|
||||
while (is_blank_char(*ptr))
|
||||
ptr++;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
int colortoint(const char *colorname, int *bright)
|
||||
int color_to_int(const char *colorname, bool *bright)
|
||||
{
|
||||
int mcolor = 0;
|
||||
int mcolor = -1;
|
||||
|
||||
if (colorname == NULL)
|
||||
if (colorname == NULL) {
|
||||
rcfile_error(N_("Missing color name"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
assert(bright != NULL);
|
||||
|
||||
if (strncasecmp(colorname, "bright", 6) == 0) {
|
||||
*bright = 1;
|
||||
*bright = TRUE;
|
||||
colorname += 6;
|
||||
}
|
||||
|
||||
@@ -209,38 +219,46 @@ int colortoint(const char *colorname, int *bright)
|
||||
mcolor = COLOR_MAGENTA;
|
||||
else if (strcasecmp(colorname, "black") == 0)
|
||||
mcolor = COLOR_BLACK;
|
||||
else {
|
||||
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"
|
||||
"Valid colors are \"green\", \"red\", \"blue\",\n"
|
||||
"\"white\", \"yellow\", \"cyan\", \"magenta\" and\n"
|
||||
"\"black\", with the optional prefix \"bright\"\n"
|
||||
"for foreground colors."), colorname);
|
||||
mcolor = -1;
|
||||
}
|
||||
|
||||
return mcolor;
|
||||
}
|
||||
|
||||
char *parse_next_regex(char *ptr)
|
||||
{
|
||||
while ((*ptr != '"' || (*(ptr + 1) != ' ' && *(ptr + 1) != '\n'))
|
||||
&& *ptr != '\n' && *ptr != '\0')
|
||||
assert(ptr != NULL);
|
||||
|
||||
/* Continue until the end of the line, or a " followed by a space, a
|
||||
* blank character, or \0. */
|
||||
while ((*ptr != '"' || (!is_blank_char(*(ptr + 1)) &&
|
||||
*(ptr + 1) != '\0')) && *ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\0')
|
||||
assert(*ptr == '"' || *ptr == '\0');
|
||||
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(
|
||||
N_("Regex strings must begin and end with a \" character"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Null terminate and advance ptr. */
|
||||
*ptr++ = '\0';
|
||||
|
||||
while (isblank(*ptr))
|
||||
while (is_blank_char(*ptr))
|
||||
ptr++;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* Compile the regular expression regex to preg. Returns FALSE on
|
||||
/* Compile the regular expression regex to preg. Return FALSE on
|
||||
* success, or TRUE if the expression is invalid. */
|
||||
int nregcomp(regex_t *preg, const char *regex, int eflags)
|
||||
bool nregcomp(regex_t *preg, const char *regex, int eflags)
|
||||
{
|
||||
int rc = regcomp(preg, regex, REG_EXTENDED | eflags);
|
||||
|
||||
@@ -252,80 +270,80 @@ int nregcomp(regex_t *preg, const char *regex, int eflags)
|
||||
rcfile_error(N_("Bad regex \"%s\": %s"), regex, str);
|
||||
free(str);
|
||||
}
|
||||
return rc != 0;
|
||||
|
||||
return (rc != 0);
|
||||
}
|
||||
|
||||
void parse_syntax(char *ptr)
|
||||
{
|
||||
syntaxtype *tmpsyntax = NULL;
|
||||
const char *fileregptr = NULL, *nameptr = NULL;
|
||||
exttype *endext = NULL;
|
||||
/* The end of the extensions list for this syntax. */
|
||||
|
||||
while (*ptr == ' ')
|
||||
ptr++;
|
||||
assert(ptr != NULL);
|
||||
|
||||
if (*ptr == '\n' || *ptr == '\0')
|
||||
return;
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing syntax name"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(
|
||||
N_("Regex strings must begin and end with a \" character"));
|
||||
return;
|
||||
}
|
||||
|
||||
ptr++;
|
||||
|
||||
nameptr = ptr;
|
||||
ptr = parse_next_regex(ptr);
|
||||
|
||||
if (ptr == NULL) {
|
||||
rcfile_error(N_("Missing syntax name"));
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
syntaxes = (syntaxtype *)nmalloc(sizeof(syntaxtype));
|
||||
tmpsyntax = syntaxes;
|
||||
SET(COLOR_SYNTAX);
|
||||
endsyntax = syntaxes;
|
||||
} else {
|
||||
for (tmpsyntax = syntaxes; tmpsyntax->next != NULL;
|
||||
tmpsyntax = tmpsyntax->next)
|
||||
;
|
||||
tmpsyntax->next = (syntaxtype *)nmalloc(sizeof(syntaxtype));
|
||||
tmpsyntax = tmpsyntax->next;
|
||||
endsyntax->next = (syntaxtype *)nmalloc(sizeof(syntaxtype));
|
||||
endsyntax = endsyntax->next;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Adding new syntax after 1st\n");
|
||||
fprintf(stderr, "Adding new syntax after first one\n");
|
||||
#endif
|
||||
}
|
||||
tmpsyntax->desc = mallocstrcpy(NULL, nameptr);
|
||||
tmpsyntax->color = NULL;
|
||||
tmpsyntax->extensions = NULL;
|
||||
tmpsyntax->next = NULL;
|
||||
endsyntax->desc = mallocstrcpy(NULL, nameptr);
|
||||
endsyntax->color = NULL;
|
||||
endcolor = NULL;
|
||||
endsyntax->extensions = NULL;
|
||||
endsyntax->next = NULL;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting a new syntax type\n");
|
||||
fprintf(stderr, "string val=%s\n", nameptr);
|
||||
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
|
||||
#endif
|
||||
|
||||
/* Now load in the extensions to their part of the struct */
|
||||
while (*ptr != '\n' && *ptr != '\0') {
|
||||
/* Now load the extensions into their part of the struct. */
|
||||
while (*ptr != '\0') {
|
||||
exttype *newext;
|
||||
/* The new extension structure. */
|
||||
|
||||
while (*ptr != '"' && *ptr != '\n' && *ptr != '\0')
|
||||
while (*ptr != '"' && *ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\n' || *ptr == '\0')
|
||||
if (*ptr == '\0')
|
||||
return;
|
||||
|
||||
ptr++;
|
||||
|
||||
fileregptr = ptr;
|
||||
ptr = parse_next_regex(ptr);
|
||||
if (ptr == NULL)
|
||||
break;
|
||||
|
||||
newext = (exttype *)nmalloc(sizeof(exttype));
|
||||
if (nregcomp(&newext->val, fileregptr, REG_NOSUB) != 0)
|
||||
if (nregcomp(&newext->val, fileregptr, REG_NOSUB))
|
||||
free(newext);
|
||||
else {
|
||||
if (endext == NULL)
|
||||
tmpsyntax->extensions = newext;
|
||||
endsyntax->extensions = newext;
|
||||
else
|
||||
endext->next = newext;
|
||||
endext = newext;
|
||||
@@ -334,83 +352,83 @@ void parse_syntax(char *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the color stuff into the colorstrings array */
|
||||
/* Parse the color stuff into the colorstrings array. */
|
||||
void parse_colors(char *ptr)
|
||||
{
|
||||
int fg, bg, bright = 0;
|
||||
int expectend = 0; /* Do we expect an end= line? */
|
||||
int fg, bg;
|
||||
bool bright = FALSE;
|
||||
char *fgstr;
|
||||
colortype *tmpcolor = NULL;
|
||||
syntaxtype *tmpsyntax = NULL;
|
||||
|
||||
fgstr = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
assert(ptr != NULL);
|
||||
|
||||
if (ptr == NULL) {
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing color name"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (strstr(fgstr, ",")) {
|
||||
fgstr = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
|
||||
if (strchr(fgstr, ',') != NULL) {
|
||||
char *bgcolorname;
|
||||
strtok(fgstr, ",");
|
||||
bgcolorname = strtok(NULL, ",");
|
||||
if (strncasecmp(bgcolorname, "bright", 6) == 0) {
|
||||
rcfile_error(N_("Background color %s cannot be bright"), bgcolorname);
|
||||
rcfile_error(
|
||||
N_("Background color %s cannot be bright"),
|
||||
bgcolorname);
|
||||
return;
|
||||
}
|
||||
bg = colortoint(bgcolorname, &bright);
|
||||
bg = color_to_int(bgcolorname, &bright);
|
||||
} else
|
||||
bg = -1;
|
||||
|
||||
fg = colortoint(fgstr, &bright);
|
||||
fg = color_to_int(fgstr, &bright);
|
||||
|
||||
/* Don't try and parse screwed up fg colors */
|
||||
/* Don't try to parse screwed-up foreground colors. */
|
||||
if (fg == -1)
|
||||
return;
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
rcfile_error(N_("Cannot add a color directive without a syntax line"));
|
||||
rcfile_error(
|
||||
N_("Cannot add a color directive without a syntax line"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (tmpsyntax = syntaxes; tmpsyntax->next != NULL;
|
||||
tmpsyntax = tmpsyntax->next)
|
||||
;
|
||||
/* Now for the fun part. Start adding regexps to individual strings
|
||||
* in the colorstrings array, woo! */
|
||||
|
||||
/* Now the fun part, start adding regexps to individual strings
|
||||
in the colorstrings array, woo! */
|
||||
|
||||
while (*ptr != '\0') {
|
||||
while (ptr != NULL && *ptr != '\0') {
|
||||
colortype *newcolor;
|
||||
/* The new color structure. */
|
||||
int cancelled = 0;
|
||||
bool cancelled = FALSE;
|
||||
/* The start expression was bad. */
|
||||
|
||||
while (*ptr == ' ')
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\n' || *ptr == '\0')
|
||||
break;
|
||||
bool expectend = FALSE;
|
||||
/* Do we expect an end= line? */
|
||||
|
||||
if (strncasecmp(ptr, "start=", 6) == 0) {
|
||||
ptr += 6;
|
||||
expectend = 1;
|
||||
expectend = TRUE;
|
||||
}
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
rcfile_error(
|
||||
N_("Regex strings must begin and end with a \" character"));
|
||||
ptr = parse_next_regex(ptr);
|
||||
continue;
|
||||
}
|
||||
|
||||
ptr++;
|
||||
|
||||
newcolor = (colortype *)nmalloc(sizeof(colortype));
|
||||
fgstr = ptr;
|
||||
ptr = parse_next_regex(ptr);
|
||||
if (nregcomp(&newcolor->start, fgstr, 0) != 0) {
|
||||
if (ptr == NULL)
|
||||
break;
|
||||
|
||||
if (nregcomp(&newcolor->start, fgstr, 0)) {
|
||||
free(newcolor);
|
||||
cancelled = 1;
|
||||
cancelled = TRUE;
|
||||
} else {
|
||||
newcolor->fg = fg;
|
||||
newcolor->bg = bg;
|
||||
@@ -418,84 +436,84 @@ void parse_colors(char *ptr)
|
||||
newcolor->next = NULL;
|
||||
newcolor->end = NULL;
|
||||
|
||||
if (tmpsyntax->color == NULL) {
|
||||
tmpsyntax->color = newcolor;
|
||||
if (endcolor == NULL) {
|
||||
endsyntax->color = newcolor;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting a new colorstring for fg %d bg %d\n", fg, bg);
|
||||
fprintf(stderr, "Starting a new colorstring for fg %d, bg %d\n", fg, bg);
|
||||
#endif
|
||||
} else {
|
||||
for (tmpcolor = tmpsyntax->color; tmpcolor->next != NULL;
|
||||
tmpcolor = tmpcolor->next)
|
||||
;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Adding new entry for fg %d bg %d\n", fg, bg);
|
||||
fprintf(stderr, "Adding new entry for fg %d, bg %d\n", fg, bg);
|
||||
#endif
|
||||
tmpcolor->next = newcolor;
|
||||
endcolor->next = newcolor;
|
||||
}
|
||||
endcolor = newcolor;
|
||||
}
|
||||
|
||||
if (expectend) {
|
||||
if (ptr == NULL || strncasecmp(ptr, "end=", 4) != 0) {
|
||||
rcfile_error(N_("\"start=\" requires a corresponding \"end=\""));
|
||||
rcfile_error(
|
||||
N_("\"start=\" requires a corresponding \"end=\""));
|
||||
return;
|
||||
}
|
||||
|
||||
ptr += 4;
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
rcfile_error(
|
||||
N_("Regex strings must begin and end with a \" character"));
|
||||
continue;
|
||||
}
|
||||
|
||||
ptr++;
|
||||
|
||||
fgstr = ptr;
|
||||
ptr = parse_next_regex(ptr);
|
||||
if (ptr == NULL)
|
||||
break;
|
||||
|
||||
/* If the start regex was invalid, skip past the end regex to
|
||||
* stay in sync. */
|
||||
if (cancelled)
|
||||
continue;
|
||||
|
||||
newcolor->end = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
if (nregcomp(newcolor->end, fgstr, 0) != 0) {
|
||||
if (nregcomp(newcolor->end, fgstr, 0)) {
|
||||
free(newcolor->end);
|
||||
newcolor->end = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
/* Parse the RC file, once it has been opened successfully */
|
||||
/* Parse the rcfile, once it has been opened successfully. */
|
||||
void parse_rcfile(FILE *rcstream)
|
||||
{
|
||||
char *buf, *ptr, *keyword, *option;
|
||||
int set = 0, i;
|
||||
char *buf = NULL;
|
||||
ssize_t len;
|
||||
size_t n;
|
||||
|
||||
while ((len = getline(&buf, &n, rcstream)) > 0) {
|
||||
char *ptr, *keyword, *option;
|
||||
int set = 0, i;
|
||||
|
||||
/* Ignore the \n. */
|
||||
buf[len - 1] = '\0';
|
||||
|
||||
buf = charalloc(1024);
|
||||
while (fgets(buf, 1023, rcstream) != 0) {
|
||||
lineno++;
|
||||
ptr = buf;
|
||||
while (isblank(*ptr))
|
||||
while (is_blank_char(*ptr))
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\n' || *ptr == '\0')
|
||||
/* If we have a blank line or a comment, skip to the next
|
||||
* line. */
|
||||
if (*ptr == '\0' || *ptr == '#')
|
||||
continue;
|
||||
|
||||
if (*ptr == '#') {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s: Read a comment\n", "parse_rcfile()");
|
||||
#endif
|
||||
continue; /* Skip past commented lines */
|
||||
}
|
||||
|
||||
/* Else skip to the next space */
|
||||
/* Otherwise, skip to the next space. */
|
||||
keyword = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
if (ptr == NULL)
|
||||
continue;
|
||||
|
||||
/* Else try to parse the keyword */
|
||||
/* Try to parse the keyword. */
|
||||
if (strcasecmp(keyword, "set") == 0)
|
||||
set = 1;
|
||||
else if (strcasecmp(keyword, "unset") == 0)
|
||||
@@ -505,138 +523,155 @@ void parse_rcfile(FILE *rcstream)
|
||||
parse_syntax(ptr);
|
||||
else if (strcasecmp(keyword, "color") == 0)
|
||||
parse_colors(ptr);
|
||||
#endif /* ENABLE_COLOR */
|
||||
else {
|
||||
#endif /* ENABLE_COLOR */
|
||||
else
|
||||
rcfile_error(N_("Command %s not understood"), keyword);
|
||||
|
||||
if (set == 0)
|
||||
continue;
|
||||
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing flag"));
|
||||
continue;
|
||||
}
|
||||
|
||||
option = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
/* We don't care if ptr == NULL, as it should if using proper syntax */
|
||||
|
||||
if (set != 0) {
|
||||
for (i = 0; rcopts[i].name != NULL; i++) {
|
||||
if (strcasecmp(option, rcopts[i].name) == 0) {
|
||||
for (i = 0; rcopts[i].name != NULL; i++) {
|
||||
if (strcasecmp(option, rcopts[i].name) == 0) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s: Parsing option %s\n",
|
||||
"parse_rcfile()", rcopts[i].name);
|
||||
fprintf(stderr, "parse_rcfile(): name = \"%s\"\n", rcopts[i].name);
|
||||
#endif
|
||||
if (set == 1) {
|
||||
if (strcasecmp(rcopts[i].name, "tabsize") == 0
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
|| strcasecmp(rcopts[i].name, "operatingdir") == 0
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
|| strcasecmp(rcopts[i].name, "fill") == 0
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
|| strcasecmp(rcopts[i].name, "whitespace") == 0
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
|| strcasecmp(rcopts[i].name, "punct") == 0
|
||||
|| strcasecmp(rcopts[i].name, "brackets") == 0
|
||||
|| strcasecmp(rcopts[i].name, "quotestr") == 0
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
|| strcasecmp(rcopts[i].name, "backupdir") == 0
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
|| strcasecmp(rcopts[i].name, "speller") == 0
|
||||
#endif
|
||||
) {
|
||||
if (*ptr == '\n' || *ptr == '\0') {
|
||||
rcfile_error(N_("Option %s requires an argument"), rcopts[i].name);
|
||||
continue;
|
||||
}
|
||||
option = ptr;
|
||||
if (*option == '"')
|
||||
option++;
|
||||
ptr = parse_argument(ptr);
|
||||
if (set == 1) {
|
||||
if (rcopts[i].flag != 0)
|
||||
/* This option has a flag, so it doesn't take an
|
||||
* argument. */
|
||||
SET(rcopts[i].flag);
|
||||
else {
|
||||
/* This option doesn't have a flag, so it takes
|
||||
* an argument. */
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(
|
||||
N_("Option %s requires an argument"),
|
||||
rcopts[i].name);
|
||||
break;
|
||||
}
|
||||
option = ptr;
|
||||
if (*option == '"')
|
||||
option++;
|
||||
ptr = parse_argument(ptr);
|
||||
option = make_mbstring(option);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "option = %s\n", option);
|
||||
fprintf(stderr, "option = \"%s\"\n", option);
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (strcasecmp(rcopts[i].name, "operatingdir") == 0)
|
||||
operating_dir = mallocstrcpy(NULL, option);
|
||||
else
|
||||
if (strcasecmp(rcopts[i].name, "operatingdir") == 0)
|
||||
operating_dir = option;
|
||||
else
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
if (strcasecmp(rcopts[i].name, "fill") == 0) {
|
||||
if (!parse_num(option, &wrap_at)) {
|
||||
rcfile_error(N_("Requested fill size %s invalid"), option);
|
||||
wrap_at = -CHARS_FROM_EOL;
|
||||
}
|
||||
if (strcasecmp(rcopts[i].name, "fill") == 0) {
|
||||
if (!parse_num(option, &wrap_at)) {
|
||||
rcfile_error(
|
||||
N_("Requested fill size %s invalid"),
|
||||
option);
|
||||
wrap_at = -CHARS_FROM_EOL;
|
||||
} else
|
||||
free(option);
|
||||
} else
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
||||
size_t ws_len;
|
||||
whitespace = mallocstrcpy(NULL, option);
|
||||
ws_len = strlen(whitespace);
|
||||
if (ws_len != 2 || (ws_len == 2 && (is_cntrl_char(whitespace[0]) || is_cntrl_char(whitespace[1])))) {
|
||||
rcfile_error(N_("Two non-control characters required"));
|
||||
free(whitespace);
|
||||
whitespace = NULL;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
if (strcasecmp(rcopts[i].name, "punct") == 0) {
|
||||
punct = mallocstrcpy(NULL, option);
|
||||
if (strchr(punct, '\t') != NULL || strchr(punct, ' ') != NULL) {
|
||||
rcfile_error(N_("Non-tab and non-space characters required"));
|
||||
free(punct);
|
||||
punct = NULL;
|
||||
}
|
||||
} else if (strcasecmp(rcopts[i].name, "brackets") == 0) {
|
||||
brackets = mallocstrcpy(NULL, option);
|
||||
if (strchr(brackets, '\t') != NULL || strchr(brackets, ' ') != NULL) {
|
||||
rcfile_error(N_("Non-tab and non-space characters required"));
|
||||
free(brackets);
|
||||
brackets = NULL;
|
||||
}
|
||||
} else if (strcasecmp(rcopts[i].name, "quotestr") == 0)
|
||||
quotestr = mallocstrcpy(NULL, option);
|
||||
else
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
if (strcasecmp(rcopts[i].name, "backupdir") == 0)
|
||||
backup_dir = mallocstrcpy(NULL, option);
|
||||
else
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
if (strcasecmp(rcopts[i].name, "speller") == 0)
|
||||
alt_speller = mallocstrcpy(NULL, option);
|
||||
else
|
||||
#endif
|
||||
if (strcasecmp(rcopts[i].name, "tabsize") == 0) {
|
||||
if (!parse_num(option, &tabsize) || tabsize <= 0)
|
||||
rcfile_error(N_("Requested tab size %s invalid"), option);
|
||||
tabsize = -1;
|
||||
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
||||
whitespace = option;
|
||||
if (mbstrlen(whitespace) != 2 || strlenpt(whitespace) != 2) {
|
||||
rcfile_error(
|
||||
N_("Two single-column characters required"));
|
||||
free(whitespace);
|
||||
whitespace = NULL;
|
||||
} else {
|
||||
whitespace_len[0] =
|
||||
parse_mbchar(whitespace, NULL,
|
||||
NULL, NULL);
|
||||
whitespace_len[1] =
|
||||
parse_mbchar(whitespace +
|
||||
whitespace_len[0], NULL,
|
||||
NULL, NULL);
|
||||
}
|
||||
} else
|
||||
SET(rcopts[i].flag);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "set flag %d!\n",
|
||||
rcopts[i].flag);
|
||||
#endif
|
||||
} else {
|
||||
UNSET(rcopts[i].flag);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "unset flag %d!\n",
|
||||
rcopts[i].flag);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
if (strcasecmp(rcopts[i].name, "punct") == 0) {
|
||||
punct = option;
|
||||
if (strchr(punct, '\t') != NULL ||
|
||||
strchr(punct, ' ') != NULL) {
|
||||
rcfile_error(
|
||||
N_("Non-tab and non-space characters required"));
|
||||
free(punct);
|
||||
punct = NULL;
|
||||
}
|
||||
} else if (strcasecmp(rcopts[i].name,
|
||||
"brackets") == 0) {
|
||||
brackets = option;
|
||||
if (strchr(brackets, '\t') != NULL ||
|
||||
strchr(brackets, ' ') != NULL) {
|
||||
rcfile_error(
|
||||
N_("Non-tab and non-space characters required"));
|
||||
free(brackets);
|
||||
brackets = NULL;
|
||||
}
|
||||
} else if (strcasecmp(rcopts[i].name,
|
||||
"quotestr") == 0)
|
||||
quotestr = option;
|
||||
else
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
if (strcasecmp(rcopts[i].name,
|
||||
"backupdir") == 0)
|
||||
backup_dir = option;
|
||||
else
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
if (strcasecmp(rcopts[i].name, "speller") == 0)
|
||||
alt_speller = option;
|
||||
else
|
||||
#endif
|
||||
if (strcasecmp(rcopts[i].name,
|
||||
"tabsize") == 0) {
|
||||
if (!parse_num(option, &tabsize) ||
|
||||
tabsize <= 0) {
|
||||
rcfile_error(
|
||||
N_("Requested tab size %s invalid"),
|
||||
option);
|
||||
tabsize = -1;
|
||||
} else
|
||||
free(option);
|
||||
} else
|
||||
assert(FALSE);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "flag = %d\n", rcopts[i].flag);
|
||||
#endif
|
||||
} else if (rcopts[i].flag != 0)
|
||||
UNSET(rcopts[i].flag);
|
||||
else
|
||||
rcfile_error(N_("Cannot unset flag %s"),
|
||||
rcopts[i].name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rcopts[i].name == NULL)
|
||||
rcfile_error(N_("Unknown flag %s"), option);
|
||||
}
|
||||
|
||||
free(buf);
|
||||
fclose(rcstream);
|
||||
lineno = 0;
|
||||
|
||||
if (errors) {
|
||||
errors = FALSE;
|
||||
fprintf(stderr, _("\nPress Return to continue starting nano\n"));
|
||||
fprintf(stderr,
|
||||
_("\nPress Return to continue starting nano\n"));
|
||||
while (getchar() != '\n')
|
||||
;
|
||||
}
|
||||
@@ -651,62 +686,42 @@ void do_rcfile(void)
|
||||
|
||||
#ifdef SYSCONFDIR
|
||||
assert(sizeof(SYSCONFDIR) == strlen(SYSCONFDIR) + 1);
|
||||
nanorc = SYSCONFDIR "/nanorc";
|
||||
/* Try to open system nanorc */
|
||||
|
||||
nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");
|
||||
/* Try to open the system-wide nanorc. */
|
||||
rcstream = fopen(nanorc, "r");
|
||||
if (rcstream != NULL) {
|
||||
/* Parse it! */
|
||||
if (rcstream != NULL)
|
||||
parse_rcfile(rcstream);
|
||||
fclose(rcstream);
|
||||
}
|
||||
#endif
|
||||
|
||||
lineno = 0;
|
||||
|
||||
{
|
||||
const char *homenv = getenv("HOME");
|
||||
|
||||
/* Rely on $HOME, fall back on getpwuid() */
|
||||
if (homenv == NULL) {
|
||||
const struct passwd *userage = getpwuid(geteuid());
|
||||
|
||||
if (userage != NULL)
|
||||
homenv = userage->pw_dir;
|
||||
}
|
||||
homedir = mallocstrcpy(NULL, homenv);
|
||||
}
|
||||
|
||||
if (homedir == NULL) {
|
||||
rcfile_error(N_("I can't find my home directory! Wah!"));
|
||||
SET(NO_RCFILE);
|
||||
} else {
|
||||
size_t homelen = strlen(homedir);
|
||||
char *nanorcf = charalloc(homelen + 9);
|
||||
|
||||
nanorc = nanorcf;
|
||||
strcpy(nanorcf, homedir);
|
||||
strcpy(nanorcf + homelen, "/.nanorc");
|
||||
|
||||
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
|
||||
/* If we've already read SYSCONFDIR/nanorc (if it's there), we're
|
||||
root, and --disable-wrapping-as-root is used, turn wrapping off */
|
||||
if (geteuid() == NANO_ROOT_UID)
|
||||
SET(NO_WRAP);
|
||||
/* We've already read SYSCONFDIR/nanorc, if it's there. If we're
|
||||
* root and --disable-wrapping-as-root is used, turn wrapping
|
||||
* off now. */
|
||||
if (geteuid() == NANO_ROOT_UID)
|
||||
SET(NO_WRAP);
|
||||
#endif
|
||||
|
||||
get_homedir();
|
||||
|
||||
if (homedir == NULL)
|
||||
rcfile_error(N_("I can't find my home directory! Wah!"));
|
||||
else {
|
||||
nanorc = charealloc(nanorc, strlen(homedir) + 9);
|
||||
sprintf(nanorc, "%s/.nanorc", homedir);
|
||||
rcstream = fopen(nanorc, "r");
|
||||
|
||||
if (rcstream == NULL) {
|
||||
/* Don't complain about the file not existing */
|
||||
if (errno != ENOENT) {
|
||||
rcfile_error(N_("Error reading %s: %s"), nanorc, strerror(errno));
|
||||
SET(NO_RCFILE);
|
||||
}
|
||||
} else {
|
||||
/* 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);
|
||||
fclose(rcstream);
|
||||
}
|
||||
free(nanorcf);
|
||||
}
|
||||
lineno = 0;
|
||||
|
||||
free(nanorc);
|
||||
nanorc = NULL;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
set_colorpairs();
|
||||
|
||||
547
src/search.c
547
src/search.c
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* search.c *
|
||||
* *
|
||||
* Copyright (C) 2000-2004 Chris Allegretta *
|
||||
* Copyright (C) 2000-2005 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -19,7 +19,9 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -31,9 +33,11 @@
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
|
||||
static bool search_last_line = FALSE;
|
||||
/* Have we gone past the last line while searching? */
|
||||
#ifdef HAVE_REGEX_H
|
||||
static int regexp_compiled = FALSE;
|
||||
static bool regexp_compiled = FALSE;
|
||||
/* Have we compiled any regular expressions? */
|
||||
|
||||
/* Regular expression helper functions. */
|
||||
|
||||
@@ -42,8 +46,11 @@ static int regexp_compiled = FALSE;
|
||||
* bar. Return value 1 means success. */
|
||||
int regexp_init(const char *regexp)
|
||||
{
|
||||
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED |
|
||||
(ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE));
|
||||
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED
|
||||
#ifndef NANO_SMALL
|
||||
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
|
||||
#endif
|
||||
);
|
||||
|
||||
assert(!regexp_compiled);
|
||||
if (rc != 0) {
|
||||
@@ -76,11 +83,11 @@ void not_found_msg(const char *str)
|
||||
|
||||
assert(str != NULL);
|
||||
|
||||
disp = display_string(str, 0, (COLS / 2) + 1);
|
||||
numchars = strnlen(disp, COLS / 2);
|
||||
disp = display_string(str, 0, (COLS / 2) + 1, FALSE);
|
||||
numchars = actual_x(disp, mbstrnlen(disp, COLS / 2));
|
||||
|
||||
statusbar(_("\"%.*s%s\" not found"), numchars, disp,
|
||||
disp[numchars] == '\0' ? "" : "...");
|
||||
(disp[numchars] == '\0') ? "" : "...");
|
||||
|
||||
free(disp);
|
||||
}
|
||||
@@ -99,59 +106,60 @@ void search_abort(void)
|
||||
|
||||
void search_init_globals(void)
|
||||
{
|
||||
if (last_search == NULL) {
|
||||
last_search = charalloc(1);
|
||||
last_search[0] = '\0';
|
||||
}
|
||||
if (last_replace == NULL) {
|
||||
last_replace = charalloc(1);
|
||||
last_replace[0] = '\0';
|
||||
}
|
||||
if (last_search == NULL)
|
||||
last_search = mallocstrcpy(NULL, "");
|
||||
if (last_replace == NULL)
|
||||
last_replace = mallocstrcpy(NULL, "");
|
||||
}
|
||||
|
||||
/* Set up the system variables for a search or replace. Return -1 if
|
||||
* the search should be cancelled (due to Cancel, Go to Line, or a
|
||||
* failed regcomp()). Return 0 on success, and 1 on rerun calling
|
||||
* program. Return -2 to run opposite program (search -> replace,
|
||||
* replace -> search).
|
||||
/* 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.
|
||||
*
|
||||
* replacing = 1 if we call from do_replace(), 0 if called from
|
||||
* do_search(). */
|
||||
int search_init(int replacing)
|
||||
* replacing is TRUE if we call from do_replace(), and FALSE if called
|
||||
* from do_search(). */
|
||||
int search_init(bool replacing, bool use_answer)
|
||||
{
|
||||
int i = 0;
|
||||
char *buf;
|
||||
static char *backupstring = NULL;
|
||||
/* The search string we'll be using. */
|
||||
|
||||
/* If backupstring doesn't exist, initialize it to "". */
|
||||
if (backupstring == NULL)
|
||||
backupstring = mallocstrcpy(NULL, "");
|
||||
|
||||
/* If use_answer is TRUE, set backupstring to answer and get out. */
|
||||
if (use_answer) {
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* We display the search prompt below. If the user types a partial
|
||||
* search string and then Replace or a toggle, we will return to
|
||||
* do_search() or do_replace() and be called again. In that case,
|
||||
* we should put the same search string back up. backupstring holds
|
||||
* this string. */
|
||||
* we should put the same search string back up. */
|
||||
|
||||
search_init_globals();
|
||||
|
||||
/* If we don't already have a backupstring, set it. */
|
||||
if (backupstring == NULL)
|
||||
backupstring = mallocstrcpy(NULL, "");
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
search_history.current = (historytype *)&search_history.next;
|
||||
#endif
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
char *disp = display_string(last_search, 0, COLS / 3);
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||
|
||||
buf = charalloc(COLS / 3 + 7);
|
||||
buf = charalloc(strlen(disp) + 7);
|
||||
/* We use COLS / 3 here because we need to see more on the
|
||||
* line. */
|
||||
sprintf(buf, " [%s%s]", disp,
|
||||
strlenpt(last_search) > COLS / 3 ? "..." : "");
|
||||
free(disp);
|
||||
} else {
|
||||
buf = charalloc(1);
|
||||
buf[0] = '\0';
|
||||
}
|
||||
} else
|
||||
buf = mallocstrcpy(NULL, "");
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
i = statusq(FALSE, replacing ? replace_list : whereis_list,
|
||||
@@ -182,7 +190,16 @@ int search_init(int replacing)
|
||||
#endif
|
||||
"",
|
||||
|
||||
replacing ? _(" (to replace)") : "",
|
||||
replacing ?
|
||||
#ifndef NANO_SMALL
|
||||
(ISSET(MARK_ISSET) ? _(" (to replace) in selection") :
|
||||
#endif
|
||||
_(" (to replace)")
|
||||
#ifndef NANO_SMALL
|
||||
)
|
||||
#endif
|
||||
: "",
|
||||
|
||||
buf);
|
||||
|
||||
/* Release buf now that we don't need it anymore. */
|
||||
@@ -194,129 +211,187 @@ int search_init(int replacing)
|
||||
/* Cancel any search, or just return with no previous search. */
|
||||
if (i == -1 || (i < 0 && last_search[0] == '\0') ||
|
||||
(!replacing && i == 0 && answer[0] == '\0')) {
|
||||
statusbar(_("Search Cancelled"));
|
||||
statusbar(_("Cancelled"));
|
||||
#ifndef NANO_SMALL
|
||||
search_history.current = search_history.next;
|
||||
#endif
|
||||
return -1;
|
||||
} else {
|
||||
switch (i) {
|
||||
case -2: /* It's the same string. */
|
||||
case -2: /* It's the same string. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Since answer is "", use last_search! */
|
||||
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
|
||||
return -1;
|
||||
/* Since answer is "", use last_search! */
|
||||
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
|
||||
return -1;
|
||||
#endif
|
||||
break;
|
||||
case 0: /* They entered something new. */
|
||||
last_replace[0] = '\0';
|
||||
break;
|
||||
case 0: /* They entered something new. */
|
||||
last_replace[0] = '\0';
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP) && regexp_init(answer) == 0)
|
||||
return -1;
|
||||
if (ISSET(USE_REGEXP) && regexp_init(answer) == 0)
|
||||
return -1;
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
#ifndef NANO_SMALL
|
||||
case TOGGLE_CASE_KEY:
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
case TOGGLE_BACKWARDS_KEY:
|
||||
TOGGLE(REVERSE_SEARCH);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
case TOGGLE_CASE_KEY:
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
case TOGGLE_BACKWARDS_KEY:
|
||||
TOGGLE(REVERSE_SEARCH);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#ifdef HAVE_REGEX_H
|
||||
case TOGGLE_REGEXP_KEY:
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
case TOGGLE_REGEXP_KEY:
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
case NANO_OTHERSEARCH_KEY:
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
case NANO_FROMSEARCHTOGOTO_KEY:
|
||||
case NANO_TOOTHERSEARCH_KEY:
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
case NANO_TOGOTOLINE_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
search_history.current = search_history.next;
|
||||
search_history.current = search_history.next;
|
||||
#endif
|
||||
/* If answer parses as an integer, put it up on the
|
||||
* statusbar. */
|
||||
do_gotoline(parse_num(answer, NULL) ? -1 : 0, FALSE);
|
||||
/* Fall through. */
|
||||
default:
|
||||
return -1;
|
||||
do_gotoline(-1, FALSE); /* Put answer up on the
|
||||
* statusbar and fall
|
||||
* through. */
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int is_whole_word(int curr_pos, const char *datastr, const char
|
||||
*searchword)
|
||||
bool is_whole_word(size_t pos, const char *buf, const char *word)
|
||||
{
|
||||
size_t sln = curr_pos + strlen(searchword);
|
||||
char *p = charalloc(mb_cur_max()), *r = charalloc(mb_cur_max());
|
||||
size_t word_end = pos + strlen(word);
|
||||
bool retval;
|
||||
|
||||
/* Start of line or previous character is not a letter and end of
|
||||
* line or next character is not a letter. */
|
||||
return (curr_pos < 1 || !isalpha((int)datastr[curr_pos - 1])) &&
|
||||
(sln == strlen(datastr) || !isalpha((int)datastr[sln]));
|
||||
assert(buf != NULL && pos <= strlen(buf) && word != NULL);
|
||||
|
||||
parse_mbchar(buf + move_mbleft(buf, pos), p, NULL, NULL);
|
||||
parse_mbchar(buf + word_end, r, NULL, NULL);
|
||||
|
||||
/* If we're at the beginning of the line or the character before the
|
||||
* word isn't an alphanumeric character, and if we're at the end of
|
||||
* the line or the character after the word isn't an alphanumeric
|
||||
* character, we have a whole word. */
|
||||
retval = (pos == 0 || !is_alnum_mbchar(p)) &&
|
||||
(word_end == strlen(buf) || !is_alnum_mbchar(r));
|
||||
|
||||
free(p);
|
||||
free(r);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Look for needle, starting at current, column current_x. If
|
||||
* no_sameline is nonzero, skip over begin when looking for needle.
|
||||
* begin is the line where we first started searching, at column beginx.
|
||||
* If can_display_wrap is nonzero, we put messages on the statusbar, and
|
||||
* wrap around the file boundaries. The return value specifies whether
|
||||
* we found anything. */
|
||||
int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
||||
*begin, size_t beginx, const char *needle, int no_sameline)
|
||||
/* Look for needle, starting at (current, current_x). If no_sameline is
|
||||
* TRUE, skip over begin when looking for needle. begin is the line
|
||||
* where we first started searching, at column beginx. If
|
||||
* can_display_wrap is TRUE, we put messages on the statusbar, wrap
|
||||
* around the file boundaries. The return value specifies whether we
|
||||
* found anything. If we did, set needle_len to the length of the
|
||||
* string we found if it isn't NULL. */
|
||||
bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
no_sameline, const filestruct *begin, size_t beginx, const char
|
||||
*needle, size_t *needle_len)
|
||||
{
|
||||
filestruct *fileptr = current;
|
||||
const char *rev_start = NULL, *found = NULL;
|
||||
size_t found_len;
|
||||
/* The length of the match we found. */
|
||||
size_t current_x_find = 0;
|
||||
/* Where needle was found. */
|
||||
/* The location of the match we found. */
|
||||
int current_y_find = current_y;
|
||||
|
||||
/* 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 =
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
rev_start = fileptr->data + (current_x - 1);
|
||||
else
|
||||
ISSET(REVERSE_SEARCH) ? fileptr->data + (current_x - 1) :
|
||||
#endif
|
||||
rev_start = fileptr->data + (current_x + 1);
|
||||
fileptr->data + (current_x + 1);
|
||||
|
||||
/* Look for needle in searchstr. */
|
||||
while (TRUE) {
|
||||
found = strstrwrapper(fileptr->data, needle, rev_start);
|
||||
|
||||
if (found != NULL && (!wholeword || is_whole_word(found -
|
||||
fileptr->data, fileptr->data, needle))) {
|
||||
if (!no_sameline || fileptr != current)
|
||||
/* We've found a potential match. */
|
||||
if (found != NULL) {
|
||||
bool found_whole = FALSE;
|
||||
/* Is this potential match a whole word? */
|
||||
|
||||
/* Set found_len to the length of the potential match. */
|
||||
found_len =
|
||||
#ifdef HAVE_REGEX_H
|
||||
ISSET(USE_REGEXP) ?
|
||||
regmatches[0].rm_eo - regmatches[0].rm_so :
|
||||
#endif
|
||||
strlen(needle);
|
||||
|
||||
/* If we're searching for whole words, see if this potential
|
||||
* match is a whole word. */
|
||||
if (wholeword) {
|
||||
char *word = mallocstrncpy(NULL, found, found_len + 1);
|
||||
word[found_len] = '\0';
|
||||
|
||||
found_whole = is_whole_word(found - fileptr->data,
|
||||
fileptr->data, word);
|
||||
free(word);
|
||||
}
|
||||
|
||||
/* If we're searching for whole words and this potential
|
||||
* match isn't a whole word, or if we're not allowed to find
|
||||
* a match on the same line we started on and this potential
|
||||
* match is on that line, continue searching. */
|
||||
if ((!wholeword || found_whole) && (!no_sameline ||
|
||||
fileptr != current))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Finished processing file, get out. */
|
||||
/* We've finished processing the file, so get out. */
|
||||
if (search_last_line) {
|
||||
if (can_display_wrap)
|
||||
not_found_msg(needle);
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
fileptr =
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(REVERSE_SEARCH) ? fileptr->prev :
|
||||
#endif
|
||||
fileptr->next;
|
||||
|
||||
/* Start or end of buffer reached; wrap around. */
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
fileptr = fileptr->prev;
|
||||
current_y_find--;
|
||||
} else {
|
||||
#endif
|
||||
fileptr = fileptr->next;
|
||||
current_y_find++;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Start or end of buffer reached, so wrap around. */
|
||||
if (fileptr == NULL) {
|
||||
if (!can_display_wrap)
|
||||
return 0;
|
||||
fileptr =
|
||||
return FALSE;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(REVERSE_SEARCH) ? filebot :
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
fileptr = filebot;
|
||||
current_y_find = editwinrows - 1;
|
||||
} else {
|
||||
#endif
|
||||
fileage;
|
||||
fileptr = fileage;
|
||||
current_y_find = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
|
||||
if (can_display_wrap)
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
@@ -324,6 +399,7 @@ int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
||||
/* Original start line reached. */
|
||||
if (fileptr == begin)
|
||||
search_last_line = TRUE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
@@ -346,27 +422,40 @@ int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
||||
|
||||
if (can_display_wrap)
|
||||
not_found_msg(needle);
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Set globals now that we are sure we found something. */
|
||||
current = fileptr;
|
||||
current_x = current_x_find;
|
||||
current_y = current_y_find;
|
||||
placewewant = xplustabs();
|
||||
|
||||
return 1;
|
||||
/* needle_len holds the length of needle. */
|
||||
if (needle_len != NULL)
|
||||
*needle_len = found_len;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void findnextstr_wrap_reset(void)
|
||||
{
|
||||
search_last_line = FALSE;
|
||||
}
|
||||
|
||||
/* Search for a string. */
|
||||
void do_search(void)
|
||||
{
|
||||
size_t old_pww = placewewant, fileptr_x = current_x;
|
||||
int i, didfind;
|
||||
int i;
|
||||
bool didfind;
|
||||
filestruct *fileptr = current;
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
i = search_init(0);
|
||||
|
||||
i = search_init(FALSE, FALSE);
|
||||
if (i == -1) /* Cancel, Go to Line, blank search string, or
|
||||
* regcomp() failed. */
|
||||
search_abort();
|
||||
@@ -394,8 +483,9 @@ void do_search(void)
|
||||
update_history(&search_history, answer);
|
||||
#endif
|
||||
|
||||
search_last_line = FALSE;
|
||||
didfind = findnextstr(TRUE, FALSE, current, current_x, answer, FALSE);
|
||||
findnextstr_wrap_reset();
|
||||
didfind = findnextstr(TRUE, FALSE, FALSE, current, current_x,
|
||||
answer, NULL);
|
||||
|
||||
/* Check to see if there's only one occurrence of the string and
|
||||
* we're on it now. */
|
||||
@@ -408,8 +498,8 @@ void do_search(void)
|
||||
* which case it's the only occurrence. */
|
||||
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
|
||||
last_search)) {
|
||||
didfind = findnextstr(TRUE, FALSE, current, current_x,
|
||||
answer, TRUE);
|
||||
didfind = findnextstr(TRUE, FALSE, TRUE, current, current_x,
|
||||
answer, NULL);
|
||||
if (fileptr == current && fileptr_x == current_x && !didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
} else {
|
||||
@@ -430,12 +520,13 @@ void do_search(void)
|
||||
void do_research(void)
|
||||
{
|
||||
size_t old_pww = placewewant, fileptr_x = current_x;
|
||||
int didfind;
|
||||
bool didfind;
|
||||
filestruct *fileptr = current;
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
search_init_globals();
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
@@ -446,9 +537,9 @@ void do_research(void)
|
||||
return;
|
||||
#endif
|
||||
|
||||
search_last_line = FALSE;
|
||||
didfind = findnextstr(TRUE, FALSE, current, current_x,
|
||||
last_search, FALSE);
|
||||
findnextstr_wrap_reset();
|
||||
didfind = findnextstr(TRUE, FALSE, FALSE, current, current_x,
|
||||
last_search, NULL);
|
||||
|
||||
/* Check to see if there's only one occurrence of the string and
|
||||
* we're on it now. */
|
||||
@@ -461,8 +552,8 @@ void do_research(void)
|
||||
* found again, in which case it's the only occurrence. */
|
||||
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
|
||||
last_search)) {
|
||||
didfind = findnextstr(TRUE, FALSE, current, current_x,
|
||||
answer, TRUE);
|
||||
didfind = findnextstr(TRUE, FALSE, TRUE, current,
|
||||
current_x, answer, NULL);
|
||||
if (fileptr == current && fileptr_x == current_x && !didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
} else {
|
||||
@@ -491,9 +582,9 @@ void replace_abort(void)
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, int create_flag)
|
||||
int replace_regexp(char *string, bool create_flag)
|
||||
{
|
||||
/* Split personality here - if create_flag is zero, just calculate
|
||||
/* Split personality here - if create_flag is FALSE, just calculate
|
||||
* the size of the replacement line (necessary because of
|
||||
* subexpressions \1 to \9 in the replaced text). */
|
||||
|
||||
@@ -506,7 +597,8 @@ int replace_regexp(char *string, int create_flag)
|
||||
while (*c != '\0') {
|
||||
int num = (int)(*(c + 1) - '0');
|
||||
|
||||
if (*c != '\\' || num < 1 || num > 9 || num > search_regexp.re_nsub) {
|
||||
if (*c != '\\' || num < 1 || num > 9 ||
|
||||
num > search_regexp.re_nsub) {
|
||||
if (create_flag)
|
||||
*string++ = *c;
|
||||
c++;
|
||||
@@ -520,7 +612,7 @@ int replace_regexp(char *string, int create_flag)
|
||||
/* But add the length of the subexpression to new_size. */
|
||||
new_size += i;
|
||||
|
||||
/* And if create_flag is nonzero, append the result of the
|
||||
/* And if create_flag is TRUE, append the result of the
|
||||
* subexpression match to the new line. */
|
||||
if (create_flag) {
|
||||
strncpy(string, current->data + current_x +
|
||||
@@ -579,31 +671,51 @@ char *replace_line(const char *needle)
|
||||
}
|
||||
|
||||
/* Step through each replace word and prompt user before replacing.
|
||||
* Parameters real_current and real_current_x are needed by the internal
|
||||
* speller, to allow the cursor position to be updated when a word
|
||||
* before the cursor is replaced by a shorter word.
|
||||
* Parameters real_current and real_current_x are needed in order to
|
||||
* allow the cursor position to be updated when a word before the cursor
|
||||
* is replaced by a shorter word.
|
||||
*
|
||||
* needle is the string to seek. We replace it with answer. Return -1
|
||||
* if needle isn't found, else the number of replacements performed. */
|
||||
int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
size_t *real_current_x, int wholewords)
|
||||
* if needle isn't found, else the number of replacements performed. If
|
||||
* canceled isn't NULL, set it to TRUE if we canceled. */
|
||||
ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
*real_current, size_t *real_current_x, bool wholewords, bool
|
||||
*canceled)
|
||||
{
|
||||
int replaceall = FALSE, numreplaced = -1;
|
||||
size_t old_pww = placewewant, current_x_save = current_x;
|
||||
const filestruct *current_save = current;
|
||||
ssize_t numreplaced = -1;
|
||||
size_t match_len;
|
||||
size_t pww_save = placewewant;
|
||||
bool replaceall = FALSE;
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* The starting-line match and bol/eol regex flags. */
|
||||
int begin_line = FALSE, bol_or_eol = FALSE;
|
||||
bool begin_line = FALSE, bol_or_eol = FALSE;
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
int mark_set = ISSET(MARK_ISSET);
|
||||
bool old_mark_set = ISSET(MARK_ISSET);
|
||||
filestruct *edittop_save = edittop, *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
bool right_side_up = FALSE;
|
||||
/* TRUE if (mark_beginbuf, mark_beginx) is the top of the mark,
|
||||
* FALSE if (current, current_x) is. */
|
||||
|
||||
UNSET(MARK_ISSET);
|
||||
edit_refresh();
|
||||
if (old_mark_set) {
|
||||
/* If the mark is on, partition the filestruct so that it
|
||||
* contains only the marked text, set edittop to the top of the
|
||||
* partition, turn the mark off, and refresh the screen. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, &right_side_up);
|
||||
filepart = partition_filestruct(top, top_x, bot, bot_x);
|
||||
edittop = fileage;
|
||||
UNSET(MARK_ISSET);
|
||||
edit_refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
while (findnextstr(TRUE, wholewords, current_save, current_x_save,
|
||||
needle,
|
||||
if (canceled != NULL)
|
||||
*canceled = FALSE;
|
||||
|
||||
findnextstr_wrap_reset();
|
||||
while (findnextstr(TRUE, wholewords,
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* We should find a bol and/or eol regex only once per line. If
|
||||
* the bol_or_eol flag is set, it means that the last search
|
||||
@@ -613,10 +725,9 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
#else
|
||||
FALSE
|
||||
#endif
|
||||
) != 0) {
|
||||
, real_current, *real_current_x, needle, &match_len)) {
|
||||
|
||||
int i = 0;
|
||||
size_t match_len;
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* If the bol_or_eol flag is set, we've found a match on the
|
||||
@@ -636,19 +747,12 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
#endif
|
||||
|
||||
if (!replaceall) {
|
||||
placewewant = xplustabs();
|
||||
edit_redraw(current_save, old_pww);
|
||||
old_pww = placewewant;
|
||||
edit_redraw(real_current, pww_save);
|
||||
pww_save = placewewant;
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP))
|
||||
match_len = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
else
|
||||
#endif
|
||||
match_len = strlen(needle);
|
||||
|
||||
/* Record for the return value that we found the search string. */
|
||||
/* Record for the return value that we found the search
|
||||
* string. */
|
||||
if (numreplaced == -1)
|
||||
numreplaced = 0;
|
||||
|
||||
@@ -657,7 +761,8 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
size_t xpt = xplustabs();
|
||||
|
||||
exp_word = display_string(current->data, xpt,
|
||||
strnlenpt(current->data, match_len + current_x) - xpt);
|
||||
strnlenpt(current->data, match_len + current_x) - xpt,
|
||||
FALSE);
|
||||
|
||||
curs_set(0);
|
||||
do_replace_highlight(TRUE, exp_word);
|
||||
@@ -668,8 +773,11 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
free(exp_word);
|
||||
curs_set(1);
|
||||
|
||||
if (i == -1) /* We canceled the replace. */
|
||||
if (i == -1) { /* We canceled the replace. */
|
||||
if (canceled != NULL)
|
||||
*canceled = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
@@ -682,7 +790,7 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
|
||||
if (i > 0 || replaceall) { /* Yes, replace it!!!! */
|
||||
char *copy;
|
||||
int length_change;
|
||||
size_t length_change;
|
||||
|
||||
if (i == 2)
|
||||
replaceall = TRUE;
|
||||
@@ -692,24 +800,38 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
length_change = strlen(copy) - strlen(current->data);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (current == mark_beginbuf && mark_beginx > current_x) {
|
||||
if (mark_beginx < current_x + match_len)
|
||||
mark_beginx = current_x;
|
||||
else
|
||||
mark_beginx += length_change;
|
||||
/* If the mark was on and (mark_beginbuf, mark_begin_x) was
|
||||
* the top of it, don't change mark_beginx. */
|
||||
if (!old_mark_set || !right_side_up) {
|
||||
/* Keep mark_beginx in sync with the text changes. */
|
||||
if (current == mark_beginbuf &&
|
||||
mark_beginx > current_x) {
|
||||
if (mark_beginx < current_x + match_len)
|
||||
mark_beginx = current_x;
|
||||
else
|
||||
mark_beginx += length_change;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the mark was on and (current, current_x) was the top
|
||||
* of it, don't change real_current_x. */
|
||||
if (!old_mark_set || right_side_up) {
|
||||
#endif
|
||||
/* Keep real_current_x in sync with the text changes. */
|
||||
if (current == real_current &&
|
||||
current_x <= *real_current_x) {
|
||||
if (*real_current_x < current_x + match_len)
|
||||
*real_current_x = current_x + match_len;
|
||||
*real_current_x += length_change;
|
||||
}
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
|
||||
assert(0 <= match_len + length_change);
|
||||
if (current == real_current && current_x <= *real_current_x) {
|
||||
if (*real_current_x < current_x + match_len)
|
||||
*real_current_x = current_x + match_len;
|
||||
*real_current_x += length_change;
|
||||
}
|
||||
|
||||
/* Set the cursor at the last character of the replacement
|
||||
* text, so searching will resume after the replacement
|
||||
* text. Note that current_x might be set to -1 here. */
|
||||
* text. Note that current_x might be set to (size_t)-1
|
||||
* here. */
|
||||
#ifndef NANO_SMALL
|
||||
if (!ISSET(REVERSE_SEARCH))
|
||||
#endif
|
||||
@@ -722,7 +844,7 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
|
||||
if (!replaceall) {
|
||||
#ifdef ENABLE_COLOR
|
||||
if (ISSET(COLOR_SYNTAX))
|
||||
if (!ISSET(NO_COLOR_SYNTAX))
|
||||
edit_refresh();
|
||||
else
|
||||
#endif
|
||||
@@ -734,24 +856,32 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (old_mark_set) {
|
||||
/* If the mark was on, unpartition the filestruct so that it
|
||||
* contains all the text again, set edittop back to what it was
|
||||
* before, turn the mark back on, and refresh the screen. */
|
||||
unpartition_filestruct(&filepart);
|
||||
edittop = edittop_save;
|
||||
SET(MARK_ISSET);
|
||||
edit_refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If text has been added to the magicline, make a new magicline. */
|
||||
if (filebot->data[0] != '\0')
|
||||
new_magicline();
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (mark_set)
|
||||
SET(MARK_ISSET);
|
||||
#endif
|
||||
|
||||
return numreplaced;
|
||||
}
|
||||
|
||||
/* Replace a string. */
|
||||
void do_replace(void)
|
||||
{
|
||||
int i, numreplaced;
|
||||
int i;
|
||||
filestruct *edittop_save, *begin;
|
||||
size_t beginx;
|
||||
size_t beginx, pww_save;
|
||||
ssize_t numreplaced;
|
||||
|
||||
if (ISSET(VIEW_MODE)) {
|
||||
print_view_warning();
|
||||
@@ -759,7 +889,7 @@ void do_replace(void)
|
||||
return;
|
||||
}
|
||||
|
||||
i = search_init(1);
|
||||
i = search_init(TRUE, FALSE);
|
||||
if (i == -1) { /* Cancel, Go to Line, blank search
|
||||
* string, or regcomp() failed. */
|
||||
replace_abort();
|
||||
@@ -805,7 +935,7 @@ void do_replace(void)
|
||||
if (i == -1) { /* Cancel. */
|
||||
if (last_replace[0] != '\0')
|
||||
answer = mallocstrcpy(answer, last_replace);
|
||||
statusbar(_("Replace Cancelled"));
|
||||
statusbar(_("Cancelled"));
|
||||
}
|
||||
replace_abort();
|
||||
return;
|
||||
@@ -814,23 +944,26 @@ void do_replace(void)
|
||||
last_replace = mallocstrcpy(last_replace, answer);
|
||||
|
||||
/* Save where we are. */
|
||||
edittop_save = edittop;
|
||||
begin = current;
|
||||
beginx = current_x;
|
||||
edittop_save = edittop;
|
||||
search_last_line = FALSE;
|
||||
pww_save = placewewant;
|
||||
|
||||
numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE);
|
||||
numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE,
|
||||
NULL);
|
||||
|
||||
/* Restore where we were. */
|
||||
edittop = edittop_save;
|
||||
current = begin;
|
||||
current_x = beginx;
|
||||
placewewant = pww_save;
|
||||
|
||||
renumber_all();
|
||||
edit_refresh();
|
||||
|
||||
if (numreplaced >= 0)
|
||||
statusbar(P_("Replaced %d occurrence", "Replaced %d occurrences",
|
||||
numreplaced), numreplaced);
|
||||
statusbar(P_("Replaced %ld occurrence", "Replaced %ld occurrences",
|
||||
(long)numreplaced), (long)numreplaced);
|
||||
|
||||
replace_abort();
|
||||
}
|
||||
@@ -839,7 +972,7 @@ void do_gotoline(int line, bool save_pos)
|
||||
{
|
||||
if (line <= 0) { /* Ask for it. */
|
||||
char *ans = mallocstrcpy(NULL, answer);
|
||||
int st = statusq(FALSE, goto_list, line < 0 ? ans : "",
|
||||
int i = statusq(FALSE, gotoline_list, line < 0 ? ans : "",
|
||||
#ifndef NANO_SMALL
|
||||
NULL,
|
||||
#endif
|
||||
@@ -848,16 +981,25 @@ void do_gotoline(int line, bool save_pos)
|
||||
free(ans);
|
||||
|
||||
/* Cancel, or Enter with blank string. */
|
||||
if (st == -1 || st == -2)
|
||||
statusbar(_("Aborted"));
|
||||
if (st != 0) {
|
||||
if (i < 0) {
|
||||
statusbar(_("Cancelled"));
|
||||
display_main_list();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Bounds check. */
|
||||
if (i == NANO_TOOTHERWHEREIS_KEY) {
|
||||
/* Keep answer up on the statusbar. */
|
||||
search_init(TRUE, TRUE);
|
||||
|
||||
do_search();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Do a bounds check. Display a warning on an out-of-bounds
|
||||
* line number only if we hit Enter at the statusbar prompt. */
|
||||
if (!parse_num(answer, &line) || line < 0) {
|
||||
statusbar(_("Come on, be reasonable"));
|
||||
if (i == 0)
|
||||
statusbar(_("Come on, be reasonable"));
|
||||
display_main_list();
|
||||
return;
|
||||
}
|
||||
@@ -877,7 +1019,7 @@ void do_gotoline(int line, bool save_pos)
|
||||
|
||||
/* If save_pos is TRUE, don't change the cursor position when
|
||||
* updating the edit window. */
|
||||
edit_update(current, save_pos ? NONE : CENTER);
|
||||
edit_update(save_pos ? NONE : CENTER);
|
||||
|
||||
placewewant = 0;
|
||||
display_main_list();
|
||||
@@ -889,7 +1031,7 @@ void do_gotoline_void(void)
|
||||
}
|
||||
|
||||
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
|
||||
void do_gotopos(int line, int pos_x, int pos_y, size_t pos_pww)
|
||||
void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww)
|
||||
{
|
||||
/* Since do_gotoline() resets the x-coordinate but not the
|
||||
* y-coordinate, set the coordinates up this way. */
|
||||
@@ -913,9 +1055,9 @@ void do_find_bracket(void)
|
||||
char ch_under_cursor, wanted_ch;
|
||||
const char *pos, *brackets = "([{<>}])";
|
||||
char regexp_pat[] = "[ ]";
|
||||
size_t old_pww, current_x_save;
|
||||
size_t current_x_save, pww_save;
|
||||
int count = 1;
|
||||
long flags_save;
|
||||
unsigned long flags_save;
|
||||
filestruct *current_save;
|
||||
|
||||
ch_under_cursor = current->data[current_x];
|
||||
@@ -927,17 +1069,17 @@ void do_find_bracket(void)
|
||||
}
|
||||
|
||||
assert(strlen(brackets) % 2 == 0);
|
||||
|
||||
wanted_ch = brackets[(strlen(brackets) - 1) - (pos - brackets)];
|
||||
|
||||
old_pww = placewewant;
|
||||
current_x_save = current_x;
|
||||
current_save = current;
|
||||
current_x_save = current_x;
|
||||
pww_save = placewewant;
|
||||
flags_save = flags;
|
||||
SET(USE_REGEXP);
|
||||
|
||||
/* Apparent near redundancy with regexp_pat[] here is needed.
|
||||
* "[][]" works, "[[]]" doesn't. */
|
||||
|
||||
if (pos < brackets + (strlen(brackets) / 2)) {
|
||||
/* On a left bracket. */
|
||||
regexp_pat[1] = wanted_ch;
|
||||
@@ -951,27 +1093,28 @@ void do_find_bracket(void)
|
||||
}
|
||||
|
||||
regexp_init(regexp_pat);
|
||||
|
||||
/* We constructed regexp_pat to be a valid expression. */
|
||||
assert(regexp_compiled);
|
||||
|
||||
search_last_line = FALSE;
|
||||
findnextstr_wrap_reset();
|
||||
while (TRUE) {
|
||||
if (findnextstr(FALSE, FALSE, current, current_x, regexp_pat,
|
||||
FALSE) != 0) {
|
||||
if (findnextstr(FALSE, FALSE, FALSE, current, current_x,
|
||||
regexp_pat, NULL)) {
|
||||
/* Found identical bracket. */
|
||||
if (current->data[current_x] == ch_under_cursor)
|
||||
count++;
|
||||
/* Found complementary bracket. */
|
||||
else if (--count == 0) {
|
||||
placewewant = xplustabs();
|
||||
edit_redraw(current_save, old_pww);
|
||||
edit_redraw(current_save, pww_save);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* Didn't find either a left or right bracket. */
|
||||
statusbar(_("No matching bracket"));
|
||||
current_x = current_x_save;
|
||||
current = current_save;
|
||||
current_x = current_x_save;
|
||||
update_line(current, current_x);
|
||||
break;
|
||||
}
|
||||
|
||||
360
src/utils.c
360
src/utils.c
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* utils.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 1999-2005 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -19,12 +19,15 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
@@ -33,7 +36,6 @@
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#undef regexec
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
@@ -41,34 +43,16 @@ int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
return regexec(preg, string, nmatch, pmatch, eflags);
|
||||
return REG_NOMATCH;
|
||||
}
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#endif /* BROKEN_REGEXEC */
|
||||
#endif
|
||||
|
||||
/* Assume that string will be found by regexec() if the REG_NOTBOL and
|
||||
* REG_NOTEOL glags are not set. */
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string)
|
||||
{
|
||||
return (regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
|
||||
return (regexec(preg, string, 0, NULL, 0) == 0 &&
|
||||
regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
|
||||
REG_NOMATCH);
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
#ifndef HAVE_ISBLANK
|
||||
/* This function is equivalent to isblank(). */
|
||||
int is_blank_char(int c)
|
||||
{
|
||||
return (c == '\t' || c == ' ');
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to iscntrl(), except in that it also
|
||||
* handles control characters with their high bits set. */
|
||||
int is_cntrl_char(int c)
|
||||
{
|
||||
return (-128 <= c && c < -96) || (0 <= c && c < 32) ||
|
||||
(127 <= c && c < 160);
|
||||
}
|
||||
|
||||
int num_of_digits(int n)
|
||||
{
|
||||
int i = 1;
|
||||
@@ -84,20 +68,41 @@ int num_of_digits(int n)
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Read an int from str, and store it in *val (if val is not NULL). On
|
||||
* error, we return FALSE and don't change *val. Otherwise, we return
|
||||
* TRUE. */
|
||||
/* Return the user's home directory. We use $HOME, and if that fails,
|
||||
* we fall back on getpwuid(). */
|
||||
void get_homedir(void)
|
||||
{
|
||||
if (homedir == NULL) {
|
||||
const char *homenv = getenv("HOME");
|
||||
|
||||
if (homenv == NULL) {
|
||||
const struct passwd *userage = getpwuid(geteuid());
|
||||
|
||||
if (userage != NULL)
|
||||
homenv = userage->pw_dir;
|
||||
}
|
||||
homedir = mallocstrcpy(NULL, homenv);
|
||||
}
|
||||
}
|
||||
|
||||
/* Read a ssize_t from str, and store it in *val (if val is not NULL).
|
||||
* On error, we return FALSE and don't change *val. Otherwise, we
|
||||
* return TRUE. */
|
||||
bool parse_num(const char *str, ssize_t *val)
|
||||
{
|
||||
char *first_error;
|
||||
ssize_t j;
|
||||
|
||||
assert(str != NULL);
|
||||
|
||||
j = (ssize_t)strtol(str, &first_error, 10);
|
||||
|
||||
if (errno == ERANGE || *str == '\0' || *first_error != '\0')
|
||||
return FALSE;
|
||||
|
||||
if (val != NULL)
|
||||
*val = j;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -139,107 +144,6 @@ void sunder(char *str)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
/* This function is equivalent to strcasecmp(). */
|
||||
int nstricmp(const char *s1, const char *s2)
|
||||
{
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
|
||||
for (; *s1 != '\0' && *s2 != '\0'; s1++, s2++) {
|
||||
if (tolower(*s1) != tolower(*s2))
|
||||
break;
|
||||
}
|
||||
|
||||
return (tolower(*s1) - tolower(*s2));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
/* This function is equivalent to strncasecmp(). */
|
||||
int nstrnicmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
|
||||
for (; n > 0 && *s1 != '\0' && *s2 != '\0'; n--, s1++, s2++) {
|
||||
if (tolower(*s1) != tolower(*s2))
|
||||
break;
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
return (tolower(*s1) - tolower(*s2));
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRCASESTR
|
||||
/* This function is equivalent to strcasestr(). It was adapted from
|
||||
* mutt's mutt_stristr() function. */
|
||||
const char *nstristr(const char *haystack, const char *needle)
|
||||
{
|
||||
assert(haystack != NULL && needle != NULL);
|
||||
|
||||
for (; *haystack != '\0'; haystack++) {
|
||||
const char *p = haystack;
|
||||
const char *q = needle;
|
||||
|
||||
for (; tolower(*p) == tolower(*q) && *q != '\0'; p++, q++)
|
||||
;
|
||||
|
||||
if (*q == '\0')
|
||||
return haystack;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* None of this is needed if we're using NANO_SMALL! */
|
||||
#ifndef NANO_SMALL
|
||||
const char *revstrstr(const char *haystack, const char *needle, const
|
||||
char *rev_start)
|
||||
{
|
||||
for (; rev_start >= haystack; rev_start--) {
|
||||
const char *r, *q;
|
||||
|
||||
for (r = rev_start, q = needle ; *q == *r && *q != '\0'; r++, q++)
|
||||
;
|
||||
if (*q == '\0')
|
||||
return rev_start;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *revstristr(const char *haystack, const char *needle, const
|
||||
char *rev_start)
|
||||
{
|
||||
for (; rev_start >= haystack; rev_start--) {
|
||||
const char *r = rev_start, *q = needle;
|
||||
|
||||
for (; (tolower(*q) == tolower(*r)) && (*q != '\0') ; r++, q++)
|
||||
;
|
||||
if (*q == '\0')
|
||||
return rev_start;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
#ifndef HAVE_STRNLEN
|
||||
/* This function is equivalent to strnlen(). */
|
||||
size_t nstrnlen(const char *s, size_t maxlen)
|
||||
{
|
||||
size_t n = 0;
|
||||
|
||||
assert(s != NULL);
|
||||
|
||||
for (; maxlen > 0 && *s != '\0'; maxlen--, n++, s++)
|
||||
;
|
||||
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef HAVE_GETLINE
|
||||
/* This function is equivalent to getline(). It was adapted from
|
||||
@@ -310,7 +214,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *start)
|
||||
{
|
||||
/* start can be 1 character before the start or after the end of the
|
||||
* line. In either case, we just say there is no match found. */
|
||||
* line. In either case, we just say no match was found. */
|
||||
if ((start > haystack && *(start - 1) == '\0') || start < haystack)
|
||||
return NULL;
|
||||
assert(haystack != NULL && needle != NULL && start != NULL);
|
||||
@@ -322,7 +226,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
&& haystack + regmatches[0].rm_so <= start) {
|
||||
const char *retval = haystack + regmatches[0].rm_so;
|
||||
|
||||
/* Search forward until there is no more match. */
|
||||
/* Search forward until there are no more matches. */
|
||||
while (regexec(&search_regexp, retval + 1, 1, regmatches,
|
||||
REG_NOTBOL) == 0 && retval + 1 +
|
||||
regmatches[0].rm_so <= start)
|
||||
@@ -336,7 +240,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
} else
|
||||
#endif /* !NANO_SMALL */
|
||||
if (regexec(&search_regexp, start, 10, regmatches,
|
||||
start > haystack ? REG_NOTBOL : 0) == 0) {
|
||||
(start > haystack) ? REG_NOTBOL : 0) == 0) {
|
||||
const char *retval = start + regmatches[0].rm_so;
|
||||
|
||||
regexec(&search_regexp, retval, 10, regmatches, 0);
|
||||
@@ -345,7 +249,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
return NULL;
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
#if !defined(DISABLE_SPELLER) || !defined(NANO_SMALL)
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_SPELLER)
|
||||
if (ISSET(CASE_SENSITIVE)) {
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
@@ -357,9 +261,9 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
#endif /* !DISABLE_SPELLER || !NANO_SMALL */
|
||||
#ifndef NANO_SMALL
|
||||
else if (ISSET(REVERSE_SEARCH))
|
||||
return revstristr(haystack, needle, start);
|
||||
return mbrevstrcasestr(haystack, needle, start);
|
||||
#endif
|
||||
return strcasestr(start, needle);
|
||||
return mbstrcasestr(start, needle);
|
||||
}
|
||||
|
||||
/* This is a wrapper for the perror() function. The wrapper takes care
|
||||
@@ -395,9 +299,10 @@ void *nrealloc(void *ptr, size_t howmuch)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Copy one malloc()ed string to another pointer. Should be used as:
|
||||
* dest = mallocstrcpy(dest, src); */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
/* Copy the first n characters of one malloc()ed string to another
|
||||
* pointer. Should be used as: "dest = mallocstrncpy(dest, src,
|
||||
* n);". */
|
||||
char *mallocstrncpy(char *dest, const char *src, size_t n)
|
||||
{
|
||||
if (src == NULL)
|
||||
src = "";
|
||||
@@ -405,18 +310,33 @@ char *mallocstrcpy(char *dest, const char *src)
|
||||
if (src != dest)
|
||||
free(dest);
|
||||
|
||||
dest = charalloc(strlen(src) + 1);
|
||||
strcpy(dest, src);
|
||||
dest = charalloc(n);
|
||||
strncpy(dest, src, n);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Append a new magic-line to filebot. */
|
||||
/* Copy one malloc()ed string to another pointer. Should be used as:
|
||||
* "dest = mallocstrcpy(dest, src);". */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
{
|
||||
return mallocstrncpy(dest, src, src == NULL ? 1 : strlen(src) + 1);
|
||||
}
|
||||
|
||||
/* Free the malloc()ed string at dest and return the malloc()ed string
|
||||
* at src. Should be used as: "answer = mallocstrassn(answer,
|
||||
* real_dir_from_tilde(answer));". */
|
||||
char *mallocstrassn(char *dest, char *src)
|
||||
{
|
||||
free(dest);
|
||||
return src;
|
||||
}
|
||||
|
||||
/* Append a new magicline to filebot. */
|
||||
void new_magicline(void)
|
||||
{
|
||||
filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
filebot->next->data = charalloc(1);
|
||||
filebot->next->data[0] = '\0';
|
||||
filebot->next->data = mallocstrcpy(NULL, "");
|
||||
filebot->next->prev = filebot;
|
||||
filebot->next->next = NULL;
|
||||
filebot->next->lineno = filebot->lineno + 1;
|
||||
@@ -426,125 +346,89 @@ void new_magicline(void)
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Remove the magicline from filebot, if there is one and it isn't the
|
||||
* only line in the file. */
|
||||
void remove_magicline(void)
|
||||
{
|
||||
if (filebot->data[0] == '\0' && filebot->prev != NULL) {
|
||||
filebot = filebot->prev;
|
||||
free_filestruct(filebot->next);
|
||||
filebot->next = NULL;
|
||||
totlines--;
|
||||
totsize--;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set top_x and bot_x to the top and bottom x-coordinates of the mark,
|
||||
* respectively, based on the locations of top and bot. */
|
||||
* respectively, based on the locations of top and bot. If
|
||||
* right_side_up isn't NULL, set it to TRUE If the mark begins with
|
||||
* (mark_beginbuf, mark_beginx) and ends with (current, current_x), or
|
||||
* FALSE otherwise. */
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x)
|
||||
**bot, size_t *bot_x, bool *right_side_up)
|
||||
{
|
||||
assert(top != NULL && top_x != NULL && bot != NULL && bot_x != NULL);
|
||||
if ((current->lineno == mark_beginbuf->lineno && current_x > mark_beginx)
|
||||
|| current->lineno > mark_beginbuf->lineno) {
|
||||
|
||||
if ((current->lineno == mark_beginbuf->lineno && current_x >
|
||||
mark_beginx) || current->lineno > mark_beginbuf->lineno) {
|
||||
*top = mark_beginbuf;
|
||||
*top_x = mark_beginx;
|
||||
*bot = current;
|
||||
*bot_x = current_x;
|
||||
if (right_side_up != NULL)
|
||||
*right_side_up = TRUE;
|
||||
} else {
|
||||
*bot = mark_beginbuf;
|
||||
*bot_x = mark_beginx;
|
||||
*top = current;
|
||||
*top_x = current_x;
|
||||
if (right_side_up != NULL)
|
||||
*right_side_up = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
/*
|
||||
* Routine to see if a text string is matched by a wildcard pattern.
|
||||
* Returns TRUE if the text is matched, or FALSE if it is not matched
|
||||
* or if the pattern is invalid.
|
||||
* * matches zero or more characters
|
||||
* ? matches a single character
|
||||
* [abc] matches 'a', 'b' or 'c'
|
||||
* \c quotes character c
|
||||
* Adapted from code written by Ingo Wilken, and
|
||||
* then taken from sash, Copyright (c) 1999 by David I. Bell
|
||||
* Permission is granted to use, distribute, or modify this source,
|
||||
* provided that this copyright notice remains intact.
|
||||
* Permission to distribute this code under the GPL has been granted.
|
||||
*/
|
||||
int check_wildcard_match(const char *text, const char *pattern)
|
||||
/* Calculate the number of lines and the number of characters between
|
||||
* begin and end, and return them in lines and size, respectively. */
|
||||
void get_totals(const filestruct *begin, const filestruct *end, int
|
||||
*lines, size_t *size)
|
||||
{
|
||||
const char *retrypat;
|
||||
const char *retrytext;
|
||||
int ch;
|
||||
int found;
|
||||
int len;
|
||||
const filestruct *f;
|
||||
|
||||
retrypat = NULL;
|
||||
retrytext = NULL;
|
||||
if (lines != NULL)
|
||||
*lines = 0;
|
||||
if (size != NULL)
|
||||
*size = 0;
|
||||
|
||||
while (*text != '\0' || *pattern != '\0') {
|
||||
ch = *pattern++;
|
||||
/* Go through the lines from begin to end->prev, if we can. */
|
||||
for (f = begin; f != NULL && f != end; f = f->next) {
|
||||
/* Count this line. */
|
||||
if (lines != NULL)
|
||||
(*lines)++;
|
||||
|
||||
switch (ch) {
|
||||
case '*':
|
||||
retrypat = pattern;
|
||||
retrytext = text;
|
||||
break;
|
||||
/* Count the number of characters on this line. */
|
||||
if (size != NULL) {
|
||||
*size += mbstrlen(f->data);
|
||||
|
||||
case '[':
|
||||
found = FALSE;
|
||||
|
||||
while ((ch = *pattern++) != ']') {
|
||||
if (ch == '\\')
|
||||
ch = *pattern++;
|
||||
|
||||
if (ch == '\0')
|
||||
return FALSE;
|
||||
|
||||
if (*text == ch)
|
||||
found = TRUE;
|
||||
}
|
||||
len = strlen(text);
|
||||
if (!found && len != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
if (found) {
|
||||
if (strlen(pattern) == 0 && len == 1) {
|
||||
return TRUE;
|
||||
}
|
||||
if (len != 0) {
|
||||
text++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* fall into next case */
|
||||
|
||||
case '?':
|
||||
if (*text++ == '\0')
|
||||
return FALSE;
|
||||
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
ch = *pattern++;
|
||||
|
||||
if (ch == '\0')
|
||||
return FALSE;
|
||||
|
||||
/* fall into next case */
|
||||
|
||||
default:
|
||||
if (*text == ch) {
|
||||
if (*text != '\0')
|
||||
text++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (*text != '\0') {
|
||||
pattern = retrypat;
|
||||
text = ++retrytext;
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
(*size)++;
|
||||
}
|
||||
|
||||
if (pattern == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
/* Go through the line at end, if we can. */
|
||||
if (f != NULL) {
|
||||
/* Count this line. */
|
||||
if (lines != NULL)
|
||||
(*lines)++;
|
||||
|
||||
/* Count the number of characters on this line. */
|
||||
if (size != NULL) {
|
||||
*size += mbstrlen(f->data);
|
||||
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
(*size)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
3014
src/winio.c
3014
src/winio.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user