Compare commits
673 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
665b1fbac6 | ||
|
|
5cbe08fc03 | ||
|
|
73bf89fa56 | ||
|
|
a73025d731 | ||
|
|
7bde05399f | ||
|
|
6168cb7391 | ||
|
|
44e0c03fff | ||
|
|
1aee5cc599 | ||
|
|
85c0b3c37e | ||
|
|
69163af499 | ||
|
|
f816119b36 | ||
|
|
5beae58597 | ||
|
|
4e05b755ed | ||
|
|
a96c819b50 | ||
|
|
5593e20964 | ||
|
|
651853aa21 | ||
|
|
9e21c62c68 | ||
|
|
43d3e9324b | ||
|
|
b2072b0999 | ||
|
|
9905b6ae74 | ||
|
|
3b2fdb00e4 | ||
|
|
2cf6d717f1 | ||
|
|
6ad6b85862 | ||
|
|
18d6a7ae1a | ||
|
|
5423680d67 | ||
|
|
7f7c66c237 | ||
|
|
b8351c1c8b | ||
|
|
27ae93d26b | ||
|
|
95a2db7a4a | ||
|
|
23555f29ba | ||
|
|
a899ab185f | ||
|
|
c5632a7e40 | ||
|
|
9c351e8831 | ||
|
|
23d3b7457b | ||
|
|
85f6a2daab | ||
|
|
6ea410e14e | ||
|
|
d4471ebe0e | ||
|
|
7f77e1dcdd | ||
|
|
a8824a197e | ||
|
|
059ba19ff7 | ||
|
|
bec2606ce2 | ||
|
|
9d658cec7a | ||
|
|
fe7d53e51e | ||
|
|
5e50e2f51e | ||
|
|
b2ca88cc74 | ||
|
|
7a3f49c019 | ||
|
|
bebfc6da0f | ||
|
|
0517c482e4 | ||
|
|
16799baccd | ||
|
|
d4ea5b69c5 | ||
|
|
8d5beb560c | ||
|
|
ba61cc382f | ||
|
|
3f301dd437 | ||
|
|
c3e52f16ba | ||
|
|
b725353ab7 | ||
|
|
99466bfa71 | ||
|
|
261da14301 | ||
|
|
6dd67790df | ||
|
|
01e13ea1c1 | ||
|
|
68c10963c4 | ||
|
|
d0c4d378b4 | ||
|
|
6c25819c34 | ||
|
|
bd11c0171b | ||
|
|
739fc8ac3d | ||
|
|
8d0fb01ff2 | ||
|
|
d7cf373358 | ||
|
|
e0a0d23f78 | ||
|
|
da419bcbe4 | ||
|
|
b2bff724da | ||
|
|
a62e8e3de9 | ||
|
|
483f3ac1b5 | ||
|
|
90d505cc4a | ||
|
|
9c6d78669e | ||
|
|
5290e1bc84 | ||
|
|
b5aaf72b6a | ||
|
|
1ea53709d8 | ||
|
|
0227ccca7c | ||
|
|
25799f6862 | ||
|
|
c54c4d1eea | ||
|
|
7431fe5e93 | ||
|
|
166da9c893 | ||
|
|
cd0210ff3e | ||
|
|
7098ec233c | ||
|
|
62898233ac | ||
|
|
26e637bf12 | ||
|
|
d873447f5f | ||
|
|
84635cd8e8 | ||
|
|
03987abebd | ||
|
|
c661853315 | ||
|
|
4f673d802c | ||
|
|
bf51aa4c0a | ||
|
|
954aba7430 | ||
|
|
3435a0ff64 | ||
|
|
66357b5462 | ||
|
|
e29111f7ec | ||
|
|
6399000a48 | ||
|
|
ea01474c4b | ||
|
|
077d0647c9 | ||
|
|
9b494fa90c | ||
|
|
18a89a6cef | ||
|
|
c4ca596a90 | ||
|
|
5c8197d78f | ||
|
|
62e117421f | ||
|
|
f3ecffd24d | ||
|
|
f774017801 | ||
|
|
d1cc007136 | ||
|
|
25fb1025e9 | ||
|
|
a9a3f4f599 | ||
|
|
e6a55fa1e5 | ||
|
|
95f7a7431e | ||
|
|
fa6c29cc2e | ||
|
|
b2b6976bd9 | ||
|
|
7a4aaa53a1 | ||
|
|
77d0feae05 | ||
|
|
c1b960947e | ||
|
|
4846ce7a6a | ||
|
|
34c75746c2 | ||
|
|
3129c2928b | ||
|
|
21374584e2 | ||
|
|
a2ea733e3b | ||
|
|
40ad177210 | ||
|
|
6f143c8124 | ||
|
|
072f86c5f9 | ||
|
|
f271f9c962 | ||
|
|
5a6caf0ca8 | ||
|
|
da72453859 | ||
|
|
203026c632 | ||
|
|
ed7ad33802 | ||
|
|
ff6c1997b9 | ||
|
|
a01690c410 | ||
|
|
ff1a0ea32b | ||
|
|
42e271d2d3 | ||
|
|
9c06f34ef9 | ||
|
|
ab41ab9246 | ||
|
|
2515ccc0a0 | ||
|
|
d1323e4e35 | ||
|
|
7ae1a79641 | ||
|
|
e221311f2e | ||
|
|
d26f1ebdf1 | ||
|
|
1e64db6629 | ||
|
|
ce9d299c47 | ||
|
|
bdfa927d62 | ||
|
|
789867b6a0 | ||
|
|
3a4eb48d5c | ||
|
|
bfc183ba10 | ||
|
|
6209e0eb15 | ||
|
|
e534aae701 | ||
|
|
d5d4dde1eb | ||
|
|
42af2216fe | ||
|
|
356d2482c5 | ||
|
|
399fe939f9 | ||
|
|
40c3cd1aa9 | ||
|
|
b300af3f63 | ||
|
|
30d0a81656 | ||
|
|
6a0d5b8fec | ||
|
|
7b601fdbe1 | ||
|
|
8b698f4a29 | ||
|
|
9880afc47a | ||
|
|
5ed8819f35 | ||
|
|
7291daabe3 | ||
|
|
d2edb8a538 | ||
|
|
33d07ef055 | ||
|
|
f26d386191 | ||
|
|
67287088dc | ||
|
|
d16d0bfb9a | ||
|
|
5b9f52265a | ||
|
|
a049c8364f | ||
|
|
1a76845aa5 | ||
|
|
e90f0b8a33 | ||
|
|
d232fa2fc3 | ||
|
|
e010edd1f8 | ||
|
|
19462616d4 | ||
|
|
d8640480c3 | ||
|
|
6315e2ff39 | ||
|
|
068edf44fc | ||
|
|
aeeb96e628 | ||
|
|
3db0dc3d8d | ||
|
|
c00f658026 | ||
|
|
8767da4e63 | ||
|
|
d0d5b8fc0e | ||
|
|
44491acfef | ||
|
|
8bcac8ad26 | ||
|
|
53aca71420 | ||
|
|
a9d45bba01 | ||
|
|
a644af58a3 | ||
|
|
7c78b45e76 | ||
|
|
746214d5aa | ||
|
|
0df61f1aac | ||
|
|
4428975e95 | ||
|
|
c7935e20b7 | ||
|
|
01458cd380 | ||
|
|
7bf86e1707 | ||
|
|
23d3cf4515 | ||
|
|
9af6a203fb | ||
|
|
092af14a82 | ||
|
|
3da5580c9c | ||
|
|
3925bdafda | ||
|
|
f47f150c82 | ||
|
|
457847f0fe | ||
|
|
7e62d109ba | ||
|
|
193b0e56f3 | ||
|
|
9b108c2110 | ||
|
|
da33153379 | ||
|
|
f4595bb5ae | ||
|
|
c4dbdd55f5 | ||
|
|
d29b9d5bd6 | ||
|
|
810d02c6a4 | ||
|
|
f99acbf29a | ||
|
|
6fdc81ae04 | ||
|
|
81dabf2be7 | ||
|
|
3db02389f4 | ||
|
|
cc81436f81 | ||
|
|
6529ab434a | ||
|
|
160c5fec87 | ||
|
|
81e49a0d4a | ||
|
|
c10d8ffe9f | ||
|
|
8fda94246b | ||
|
|
1addd601bc | ||
|
|
8e15674c70 | ||
|
|
5854a87070 | ||
|
|
47ae0d764e | ||
|
|
73857558ec | ||
|
|
854b71d775 | ||
|
|
cef24f2254 | ||
|
|
8d07efac66 | ||
|
|
d922f199a7 | ||
|
|
34bdc35d94 | ||
|
|
1726050ef9 | ||
|
|
8234f672d4 | ||
|
|
95778fda70 | ||
|
|
dac3bca274 | ||
|
|
e0b55138b9 | ||
|
|
5e068c6031 | ||
|
|
bec2f20da0 | ||
|
|
d20c0c34f5 | ||
|
|
0998a64fb9 | ||
|
|
527f1743f6 | ||
|
|
54b74cee91 | ||
|
|
b9b572236a | ||
|
|
df2a82509b | ||
|
|
1a1ea3d42f | ||
|
|
15aaa2c31a | ||
|
|
10796ac2fc | ||
|
|
aff5a1c6b1 | ||
|
|
217f241be5 | ||
|
|
11846fa576 | ||
|
|
32fe95d35e | ||
|
|
920e350d85 | ||
|
|
e5b23bd2ff | ||
|
|
7de678798a | ||
|
|
638cbe5407 | ||
|
|
0e0fef03c5 | ||
|
|
f1d3d9581a | ||
|
|
40e4acf55e | ||
|
|
5d8d0b19be | ||
|
|
86d8fc37d7 | ||
|
|
e8bb90bd2b | ||
|
|
e2ce2792a3 | ||
|
|
045d130cfa | ||
|
|
31b159c1b3 | ||
|
|
e4acb69611 | ||
|
|
e3970f503c | ||
|
|
16f88134f7 | ||
|
|
8b3266e83c | ||
|
|
0a8ec176e4 | ||
|
|
86a9452702 | ||
|
|
c5e9a434b1 | ||
|
|
67e3b93861 | ||
|
|
e5bc1c45ce | ||
|
|
2fba43c842 | ||
|
|
934f9687bb | ||
|
|
7ae4cc6964 | ||
|
|
0f476b99b7 | ||
|
|
30f164a015 | ||
|
|
86ce3903f9 | ||
|
|
6f25a67833 | ||
|
|
5754201944 | ||
|
|
172767187e | ||
|
|
d3d37433ae | ||
|
|
f83e5e2b13 | ||
|
|
650b39c43d | ||
|
|
9245f97960 | ||
|
|
60a9bddcf6 | ||
|
|
e1ce92c90f | ||
|
|
c5659d320e | ||
|
|
2f0cd35322 | ||
|
|
b68c01b753 | ||
|
|
50995bd024 | ||
|
|
9c8baed321 | ||
|
|
775eeba38a | ||
|
|
6e925cf330 | ||
|
|
066713e87e | ||
|
|
546f5b3d8a | ||
|
|
e781ddf3b1 | ||
|
|
6d39f4ba66 | ||
|
|
5ebd73f9a5 | ||
|
|
02173c05dc | ||
|
|
7f4dd35406 | ||
|
|
8f5e50991b | ||
|
|
340e5ca881 | ||
|
|
75f4b7cb84 | ||
|
|
5e73eec3cc | ||
|
|
0f83c89b09 | ||
|
|
6bc26a9a8b | ||
|
|
198bd592ff | ||
|
|
fcdfb7f75f | ||
|
|
e41e8dbead | ||
|
|
10f880c62f | ||
|
|
5e360dc065 | ||
|
|
6595b715d0 | ||
|
|
56c1e34e5a | ||
|
|
e4cb3158fd | ||
|
|
6439330d59 | ||
|
|
0bfec6e58d | ||
|
|
29be8031df | ||
|
|
c5fe41cec8 | ||
|
|
72bff8eee4 | ||
|
|
d4a1c0ad29 | ||
|
|
1ccada16ae | ||
|
|
5b2f17e591 | ||
|
|
3705924fc8 | ||
|
|
c596c0c4da | ||
|
|
9cf1df1f06 | ||
|
|
56074a1da6 | ||
|
|
f79a3fa51a | ||
|
|
b9180f4a82 | ||
|
|
ad11460eb7 | ||
|
|
04652518fd | ||
|
|
22425a204d | ||
|
|
e527e458f4 | ||
|
|
ac71fdde97 | ||
|
|
ffda704ef6 | ||
|
|
6a244b689f | ||
|
|
c2b07472e2 | ||
|
|
f1aed80922 | ||
|
|
95660ee4d9 | ||
|
|
ddedf2dbd4 | ||
|
|
c32a5e7b4e | ||
|
|
a3e5fad059 | ||
|
|
7accda6dd7 | ||
|
|
b9f28013a7 | ||
|
|
c504dffa39 | ||
|
|
fc0ebe982d | ||
|
|
dcb4e3a66d | ||
|
|
00762ffaeb | ||
|
|
4857728f6e | ||
|
|
c0718343f5 | ||
|
|
d9a4dedd35 | ||
|
|
de85d63520 | ||
|
|
53d7bce68a | ||
|
|
a716bf42bc | ||
|
|
403e0feced | ||
|
|
e61e2c6f49 | ||
|
|
d4a071e492 | ||
|
|
894d80fc5d | ||
|
|
612caef65f | ||
|
|
88ad64d597 | ||
|
|
aa683853d4 | ||
|
|
050469c595 | ||
|
|
4811b81456 | ||
|
|
050b13ae5d | ||
|
|
6a84684571 | ||
|
|
caac92012d | ||
|
|
32a285c1eb | ||
|
|
b80d49f071 | ||
|
|
fe605247cb | ||
|
|
78d05481db | ||
|
|
b56ca1b7bb | ||
|
|
d37f6a3f5c | ||
|
|
5f3695bdb5 | ||
|
|
d8367986ce | ||
|
|
6e0ed3c1c6 | ||
|
|
c15583da31 | ||
|
|
8ac9087d75 | ||
|
|
c8857a2c26 | ||
|
|
297851a647 | ||
|
|
cb4f14b8ce | ||
|
|
263b447323 | ||
|
|
bc6a36e40d | ||
|
|
eb5092226d | ||
|
|
cf4db89d56 | ||
|
|
4e0b1ae332 | ||
|
|
c4daf5d49e | ||
|
|
b41df4a140 | ||
|
|
a853e2d650 | ||
|
|
6b94e95ec9 | ||
|
|
aad85151ae | ||
|
|
7ec8d7c6a3 | ||
|
|
39e8ce6f8e | ||
|
|
afbcf68c1a | ||
|
|
b9dec213be | ||
|
|
928babf8a1 | ||
|
|
2d825bae79 | ||
|
|
3dfc879f63 | ||
|
|
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 |
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.
|
||||
|
||||
966
ChangeLog
966
ChangeLog
@@ -1,3 +1,965 @@
|
||||
GNU nano 1.3.8 - 2005.06.30
|
||||
- General:
|
||||
- Miscellaneous comment fixes. (DLR)
|
||||
- Various #include fixes. Since proto.h includes nano.h, only
|
||||
include the former in source files. Also add an #include
|
||||
guard to proto.h, and make the config.h #include in nano.h
|
||||
match the config.h #includes everywhere else. (DLR)
|
||||
- Change all hardcoded instances of 128 bytes to MAX_BUF_SIZE,
|
||||
and #define MAX_BUF_SIZE as 128 in nano.h. (DLR)
|
||||
- Display the key to go to the previous strings in the
|
||||
search/replace history as "^P" instead of "Up". This makes
|
||||
mouse clicks work properly on it. Changes to shortcut_init(),
|
||||
help_init(), nanogetstr(), and do_statusbar_input(). (DLR)
|
||||
- Update the Free Software Foundation's mailing address in
|
||||
various comments. (DLR)
|
||||
- Add the ability to open a file on a specified column as well
|
||||
as a specified line, by allowing an argument of the form
|
||||
+LINE,COLUMN. New function parse_line_column(); changes to
|
||||
shortcut_init(), main(), do_gotoline() (renamed
|
||||
do_gotolinecolumn()), do_gotoline_void() (renamed
|
||||
do_gotolinecolumn_void()), nano.1, and nano.texi. (DLR,
|
||||
suggested by PFTank)
|
||||
- Overhaul the history code to work more consistently, and clean
|
||||
up various parts of it. New function history_has_changed();
|
||||
changes to load_history(), writehist(),
|
||||
thanks_for_all_the_fish(), history_init(), find_node()
|
||||
(renamed find_history()), update_history(),
|
||||
get_history_older(), get_history_newer(),
|
||||
get_history_completion(), do_search(), do_replace(),
|
||||
nanogetstr(), and statusq(); removal of remove_node() and
|
||||
insert_node(). (DLR)
|
||||
- Remove all instances of charcpy() and replace them with
|
||||
strncpy(), since there's no way to be sure that a charcpy()ed
|
||||
string will always be properly null-terminated, and strcpy()'s
|
||||
null termination is the only difference between it and
|
||||
charcpy(). (DLR)
|
||||
- When using a backup directory, make sure all the filenames
|
||||
written are unique by using get_next_filename() when
|
||||
necessary. Changes to get_next_filename(), write_file(),
|
||||
die(), usage(), nano.1, nanorc.5, nanorc.sample, and
|
||||
nano.texi. (DLR, suggested by James Collings)
|
||||
- Rework the file-writing routines so that they can work
|
||||
properly with already-opened files, such as the
|
||||
mkstemp()-created files used by the spell-checking code.
|
||||
Changes to safe_tempnam() (renamed safe_tempfile()),
|
||||
write_file(), write_marked(), die(), do_spell(), and
|
||||
do_exit(). (DLR)
|
||||
- Remove the -R/--regexp command line option and enable the
|
||||
toggle at the search prompt in tiny mode, as it already
|
||||
allows the prepend and append toggles at the search prompt.
|
||||
For consistency, rename TOGGLE_REGEXP_KEY to NANO_REGEXP_KEY,
|
||||
and move it out of the toggles block to where NANO_PREPEND_KEY
|
||||
and NANO_APPEND_KEY are. Also, change the short command line
|
||||
option for --restricted from -Z to -R. Changes to
|
||||
shortcut_init(), usage(), main(), search_init(), nano.1,
|
||||
nano.texi, etc. (DLR)
|
||||
- Various cleanups and improvements in chars.c. Remove some
|
||||
unnecessary w?ctype wrappers and variables; change the wctype
|
||||
wrappers to take wint_t instead of wchar_t to match the
|
||||
functions they wrap; rename some functions for consistency;
|
||||
add functions to detect blank characters in a string, for use
|
||||
in rcfile option parsing; and don't count matches between
|
||||
valid and invalid multibyte sequences anymore, as it causes
|
||||
problems when doing a replace. New functions
|
||||
is_valid_mbstring(), has_blank_chars(), and
|
||||
has_blank_mbchars(); changes to is_alnum_mbchar(),
|
||||
is_blank_char() (renamed nisblank()), is_blank_mbchar(),
|
||||
is_blank_wchar() (renamed niswblank()), is_cntrl_wchar(),
|
||||
control_rep(), control_mbrep(), make_mbstring() (renamed
|
||||
make_valid_mbstring()), mbstrncasecmp(), mbstrcasestr(),
|
||||
mbrevstrcasestr(), etc.; removal of is_alnum_char() and
|
||||
is_alnum_wchar(). (DLR)
|
||||
- Implement word count via Meta-D at the main window. Note that
|
||||
this is disabled when NANO_SMALL is defined. Also, convert
|
||||
all word detection functions to use the same wrapper function
|
||||
for ease of maintenance, and make them return more
|
||||
information. New functions is_punct_mbchar(),
|
||||
is_word_mbchar(), do_next_word_void(), do_prev_word_void(),
|
||||
and do_word_count(); changes to shortcut_init(),
|
||||
do_next_word(), do_prev_word(), is_whole_word(),
|
||||
do_statusbar_next_word(), and do_statusbar_prev_word(). (DLR)
|
||||
- Fix #ifdefs so that nano compiles with NANO_SMALL defined and
|
||||
DISABLE_TABCOMP undefined. Changes to revstrstr() and
|
||||
free_charptrarray() (renamed free_chararray()). (DLR)
|
||||
- Change the wctype wrappers to take wchar_t's again, as they
|
||||
still work the same way with them. This also fixes
|
||||
compilation on Mac OS X 10.4.1, which doesn't seem to define a
|
||||
wint_t type. (DLR, found by Emily Jackson)
|
||||
- Add the ability to convert typed tabs to spaces using
|
||||
the -E/--tabstospaces command line options, the "tabstospaces"
|
||||
rcfile option, and the toggle Meta-Q (since QBasic did this by
|
||||
default :)). Note that this doesn't affect tabs entered using
|
||||
verbatim input, and that it's disabled when NANO_SMALL is
|
||||
defined. Also, change the short command line option for
|
||||
--backupdir from -E to -C. Changes to toggle_init(), usage(),
|
||||
do_tab(), main(), nanorc.sample, nano.1, nanorc.5, and
|
||||
nano.texi. (DLR, suggested by many people)
|
||||
- Change the CONSTUPDATE, REVERSE_SEARCH, and SMOOTHSCROLL flags
|
||||
to the CONST_UPDATE, BACKWARDS_SEARCH, and SMOOTH_SCROLL
|
||||
flags, respectively. (DLR)
|
||||
- Change the SMOOTHSCROLL flag to the SMOOTH_SCROLL flag. (DLR)
|
||||
- Change the NO_UTF8 flag to the USE_UTF8 flag, and reverse its
|
||||
meaning. (DLR)
|
||||
- Add rcfile options "casesensitive" and "backwards", to do
|
||||
case sensitive and backwards searches by default. Changes to
|
||||
nanorc.sample and nanorc.5. (DLR)
|
||||
- Since the DISABLE_CURPOS flag is only used in winio.c, reduce
|
||||
it to a static bool there. Changes to statusbar() and
|
||||
disable_cursorpos(). (DLR)
|
||||
- Add -U/--quickblank option and a "quickblank" rcfile option to
|
||||
blank the statusbar after 1 keystroke instead of 25. Note
|
||||
that this obviously has no effect when constant cursor
|
||||
position display is turned on, and that this is disabled when
|
||||
NANO_SMALL is defined. Changes to usage(), main(),
|
||||
statusbar(), nanorc.sample, nano.1, and nanorc.5. (DLR,
|
||||
suggested by CHAO Wei-Lun)
|
||||
- Add support for case insensitive expression matching when
|
||||
using color syntax highlighting, via the "icolor" directive,
|
||||
and add it to those regexes that can use it. Changes to
|
||||
parse_colors(), parse_rcfile(), nanorc.sample, and nanorc.5.
|
||||
(Brand Huntsman, minor tweaks by DLR)
|
||||
- Add various type changes to avoid problems on systems where
|
||||
int and ssize_t are different sizes. Make filestruct->lineno
|
||||
a ssize_t (so that we can avoid negative line numbers at the
|
||||
"Go To Line" prompt), current_y a ssize_t (in order to hold
|
||||
the maximum difference between two filestruct->lineno's),
|
||||
totlines a size_t, and change related variables to match.
|
||||
(DLR, initial problem with parse_line_column() found by Mike
|
||||
Frysinger)
|
||||
- Rework the credits handling to display Florian König's name
|
||||
properly whether we're in a UTF-8 locale or not, and without
|
||||
requiring a massive function that we only use once. Changes
|
||||
to do_credits(); removal of make_valid_mbstring(). (DLR)
|
||||
- chars.c:
|
||||
make_mbstring()
|
||||
- Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a
|
||||
compilation problem when --enable-nanorc isn't used and
|
||||
--enable-extra is. (DLR)
|
||||
- color.c:
|
||||
update_color()
|
||||
- Use mbstrcasecmp() instead of strcasecmp(), so that UTF-8
|
||||
color syntax names are properly detected. (DLR)
|
||||
- cut.c:
|
||||
cut_line()
|
||||
- Set placewewant properly after cutting a line, to avoid a
|
||||
problem where the screen won't be updated if (a) we're not on
|
||||
the first page when we cut the line, and (b) immediately after
|
||||
we cut the line, we hit End to move to the end of the line
|
||||
after it. (DLR)
|
||||
- files.c:
|
||||
read_line()
|
||||
- Rename variable prev to prevnode to avoid confusion. (DLR)
|
||||
- Rename variable len to buf_len, for consistency. (DLR)
|
||||
load_open_file()
|
||||
- Remove an unneeded clearok(FALSE). (DLR)
|
||||
get_next_filename()
|
||||
- Use an unsigned long instead of an int for the number
|
||||
prepended to the filename. (DLR)
|
||||
do_insertfile()
|
||||
- Set i to 0 when we get a filename via the file browser, so
|
||||
that it's read in properly when we exit the file browser.
|
||||
(DLR)
|
||||
open_prevnext_file()
|
||||
- Move up a misplaced assert. (DLR)
|
||||
- Rename variable next to next_file, to avoid confusion. (DLR)
|
||||
write_file()
|
||||
- Since lineswritten is a size_t, print its value as an unsigned
|
||||
long instead of an unsigned int. (DLR)
|
||||
- Declare the size_t i only in the loop where it's used. (DLR)
|
||||
diralphasort()
|
||||
- Use mbstrcasecmp() instead of strcasecmp(), so that UTF-8
|
||||
filenames are sorted properly. (DLR)
|
||||
cwd_tab_completion(), browser_init()
|
||||
- Rename variable next to nextdir to avoid confusion. (DLR)
|
||||
input_tab()
|
||||
- Since list is a bool, set it to FALSE instead of 0. (DLR)
|
||||
- Add multibyte/wide character support, so that we don't end up
|
||||
with a string that contains only part of a multibyte
|
||||
character during tab completion. (DLR)
|
||||
- Rename variable buflen to buf_len, for consistency. (DLR)
|
||||
do_browser()
|
||||
- Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for
|
||||
consistency. (DLR)
|
||||
- When displaying "(dir)" in the available screen space, make
|
||||
sure that the string it's stored in is always null-terminated.
|
||||
(DLR)
|
||||
- Rename variable selectedbackup to old_selected, for
|
||||
consistency. (DLR)
|
||||
- Make mouse clicks in the browser window work properly when the
|
||||
MORE_SPACE flag is set. (DLR)
|
||||
- Make foo_len a size_t instead of an int. (DLR)
|
||||
save_history()
|
||||
- Properly save history when we're in view mode. (DLR)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Move the "Refresh" and "Exit" shortcuts to the beginning of
|
||||
the help browser shortcut list, for consistency. (DLR)
|
||||
- Remove unnecessary "Refresh" placeholder in the file browser
|
||||
shortcut list. (DLR)
|
||||
- Allow the mark to be used in view mode, as Pico does. (DLR)
|
||||
- Clarify the description of ^X when --enable-multibuffer is
|
||||
used. (DLR)
|
||||
- Change the description of the Meta-B toggle at the search
|
||||
prompt from "Direction" to "Backwards", for consistency. (DLR)
|
||||
toggle_init()
|
||||
- Clarify the descriptions of M-C and M-L. (DLR)
|
||||
- Reorder the toggles to put more toggles with similar functions
|
||||
together. (DLR)
|
||||
thanks_for_all_the_fish()
|
||||
- Remove free_toggles() and move its code here verbatim, as it's
|
||||
only called here anyway. (David Benbennick)
|
||||
- Fix the code to free all open file buffers to work properly
|
||||
with the previous overhaul of the multibuffer code instead of
|
||||
going into an infinite loop. (David Benbennick)
|
||||
- Add additional checks for variables' not being NULL before we
|
||||
try to free them, to avoid assertion failures. (DLR)
|
||||
- nano.c:
|
||||
die()
|
||||
- Rename variable ret to retval for consistency. (DLR)
|
||||
- Tweak the message displayed when a backup file can't be
|
||||
written, so as to not duplicate a translated string. (DLR)
|
||||
- If the current filestruct's been partitioned, unpartition it
|
||||
before saving the associated file. (DLR)
|
||||
resize_variables()
|
||||
- Use charset() instead of memset() to initialize hblank. (DLR)
|
||||
copy_filestruct()
|
||||
- Rename variable prev to copy to avoid confusion. (DLR)
|
||||
print1opt_full()
|
||||
- If desc should be empty, allow it to be NULL instead of
|
||||
"", since the latter is not necessarily translated as "".
|
||||
(DLR, found by Jordi)
|
||||
usage()
|
||||
- Add missing N_() around one message, so that it isn't
|
||||
erroneously translated twice. (DLR)
|
||||
- Remove inaccurate default listed for -Q/--quotestr. (DLR)
|
||||
version()
|
||||
- Add --enable-utf8 to the displayed compilation options, put
|
||||
the options in alphabetical order, and handle --enable-tiny
|
||||
the same way as all the other options. (DLR)
|
||||
do_tab()
|
||||
- Remove unneeded variable kbinput. (DLR)
|
||||
do_int_spell_fix()
|
||||
- Display highlighted misspelled words using display_string(),
|
||||
as do_replace_loop() does. (DLR)
|
||||
do_alt_speller()
|
||||
- Replace a set_modified() with SET(MODIFIED) to avoid an
|
||||
unnecessary update, and remove an unneeded clearok(FALSE).
|
||||
(DLR)
|
||||
- Move the spell checking error handling block down and refactor
|
||||
it so that we go back into curses mode, reinitialize the
|
||||
terminal, turn the cursor back on, and turn the mark back on
|
||||
if necessary before returning the error message. (DLR)
|
||||
do_spell()
|
||||
- If the spell-checker printed any error messages onscreen, call
|
||||
total_refresh() to make sure they're cleared off. (DLR, found
|
||||
by CHAO Wei-Lun)
|
||||
find_paragraph()
|
||||
- Reset placewewant as well as current_x to 0, in order to avoid
|
||||
a potential screen update problem. (DLR)
|
||||
do_justify()
|
||||
- Save placewewant, and restore it if we unjustify, in order to
|
||||
avoid a potential screen update problem. (DLR)
|
||||
do_output()
|
||||
- Properly allow wrapping when we insert a tab, for consistency.
|
||||
(DLR)
|
||||
- Don't set current_len until after it's been asserted that both
|
||||
current and current->data aren't NULL. (DLR)
|
||||
do_toggle()
|
||||
- Properly treat color syntax highlighting as enabled by
|
||||
default, and only treat wrapping as enabled by default when
|
||||
DISABLE_WRAPPING isn't defined. (DLR)
|
||||
disable_extended_input()
|
||||
- Disable extended output processing as well as extended input
|
||||
processing, and rename to disable_extended_io(). (DLR)
|
||||
disable_flow_control(), enable_flow_control()
|
||||
- Only turn off flow control on output, as it might be needed
|
||||
for input on slow terminals. (DLR)
|
||||
- nano.h:
|
||||
- Add macro charset(), a wrapper that calls memset(). (DLR)
|
||||
- Readd #defines for the isblank() and iswblank() equivalents.
|
||||
(DLR)
|
||||
- In the colortype struct, make bright a bool instead of an int,
|
||||
for consistency. (DLR)
|
||||
- proto.h:
|
||||
- Add missing NANO_SMALL and HAVE_REGEX_H #ifdefs around the
|
||||
do_find_bracket() prototype. (DLR)
|
||||
- rcfile.c:
|
||||
color_to_int()
|
||||
- Since colorname's being NULL is handled elsewhere now, assert
|
||||
that it isn't NULL at the beginning of the function. (DLR)
|
||||
parse_colors()
|
||||
- Properly parse a background color without a foreground color.
|
||||
(DLR)
|
||||
- Properly generate an error if we get a color directive without
|
||||
a regex string. (DLR)
|
||||
parse_rcfile()
|
||||
- Properly generate an error if we get an invalid multibyte
|
||||
string for an option, instead of working around it. (DLR)
|
||||
- Use has_blank_mbchars() to check for blank characters in the
|
||||
"punct" and "brackets" options, and clarify the error message
|
||||
displayed when we find blank characters. (DLR)
|
||||
- search.c:
|
||||
do_gotoline()
|
||||
- Properly show an error message if we try to go to line 0,
|
||||
since the first line in the file is 1. (DLR)
|
||||
- Start the search for a line from fileage instead of current
|
||||
(again). (DLR)
|
||||
replace_regexp()
|
||||
- Rename variables create_flag and new_size to create and
|
||||
new_line_size, for consistency. (DLR)
|
||||
- Make new_line_size, search_match_count, and i size_t's, for
|
||||
consistency. (DLR)
|
||||
replace_line()
|
||||
- Make new_line_size and search_match_count size_t's, for
|
||||
consistency. (DLR)
|
||||
do_replace_loop()
|
||||
- When moving to the next match, update the screen using
|
||||
edit_refresh() instead of edit_redraw(), as the latter won't
|
||||
work properly when we've replaced one or more instances of a
|
||||
string in copy and haven't yet updated current->data to match
|
||||
copy. (DLR)
|
||||
do_find_bracket()
|
||||
- Miscellaneous cleanups: rename variables for consistency, and
|
||||
save the search direction and regexp setting in two bools
|
||||
instead of one flags variable. (DLR)
|
||||
- utils.c:
|
||||
num_of_digits()
|
||||
- Use a size_t instead of an int, and rename to digits(). (DLR)
|
||||
align()
|
||||
- Rename variable strp to str for consistency. (DLR)
|
||||
- winio.c:
|
||||
do_statusbar_output()
|
||||
- Don't set answer_len until after it's been asserted that
|
||||
answer isn't NULL. (DLR)
|
||||
display_string()
|
||||
- Avoid a memory corruption problem by allocating enough space
|
||||
for len plus a trailing multibyte character and/or tab. (DLR)
|
||||
- Don't check for multicolumn characters if the NO_UTF8 flag
|
||||
isn't set. (DLR)
|
||||
- Free buf_mb when we're done using it. (DLR)
|
||||
nanogetstr()
|
||||
- Rename variable def to curranswer to avoid confusion. (DLR)
|
||||
- Only declare and use the tabbed variable if DISABLE_TABCOMP
|
||||
isn't defined. (DLR)
|
||||
- Refactor to replace unnecessary variable answer_len with
|
||||
curranswer_len, and hence avoid an assertion failure involving
|
||||
the former. (DLR)
|
||||
statusq()
|
||||
- Rename variable which_history to history_list, for
|
||||
consistency. (DLR)
|
||||
- Rename variables def and ret to curranswer and retval to avoid
|
||||
confusion. (DLR)
|
||||
- Call wnoutrefresh(bottomwin) after getting an answer and
|
||||
blanking out the statusbar, to make sure that the blanking is
|
||||
done. This fixes a problem where the statusbar is not
|
||||
properly blanked after using the "Go To Line" prompt with the
|
||||
NO_HELP flag set. (DLR)
|
||||
titlebar()
|
||||
- Use actual_x() to calculate the number of characters VERMSG
|
||||
takes up, in case it's UTF-8. (DLR)
|
||||
do_cursorpos()
|
||||
- Properly display the value of totsize as unsigned. (DLR)
|
||||
- If constant is TRUE, only display the cursor position when
|
||||
disable_cursorpos is FALSE. Don't refuse to display it when
|
||||
the cursor position hasn't changed, as that doesn't always
|
||||
keep it properly updated. (DLR, found by Mike Frysinger)
|
||||
do_help()
|
||||
- Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for
|
||||
consistency. (DLR)
|
||||
statusbar()
|
||||
- Set statusblank to 25 instead of 26, to match current Pico.
|
||||
(DLR)
|
||||
edit_redraw()
|
||||
- Make do_refresh a bool instead of an int. (DLR)
|
||||
do_yesno()
|
||||
- Allow refreshing the screen via Ctrl-L, as Pico does. (DLR)
|
||||
- Add a missing assert, and use actual_x() to calculate the
|
||||
number of characters buf takes up, in case it's UTF-8. (DLR)
|
||||
- Get input from bottomwin instead of edit, so that the cursor
|
||||
isn't erroneously put in the edit window while we wait for an
|
||||
answer. (DLR)
|
||||
- Call wnoutrefresh(edit) to make sure that the edit window is
|
||||
refreshed before we get input, as statusq() does. (DLR)
|
||||
total_redraw()
|
||||
- Simplify to just call wrefresh() on curscr, which updates the
|
||||
entire screen in one function call without moving the cursor
|
||||
from the window it's currently in. (DLR)
|
||||
- When using slang, use SLsmg_touch_screen() and SLsmg_refresh()
|
||||
to update the screen, as slang doesn't define curscr. (DLR)
|
||||
do_replace_highlight()
|
||||
- Use waddch() instead of waddstr() to display a space when we
|
||||
have a zero-length regex. (DLR)
|
||||
- Rename variable highlight_flag to highlight, for consistency.
|
||||
(DLR)
|
||||
do_credits()
|
||||
- Save the keystroke that breaks us out of the credits (if any)
|
||||
and put it back so that it isn't lost. This is especially
|
||||
needed if the keystroke is part of a multibyte character.
|
||||
(DLR)
|
||||
- nano.1:
|
||||
- Clarify and consolidate the descriptions of --fill and
|
||||
--tabsize. (DLR)
|
||||
- nanorc.5:
|
||||
- Update the description of how the "color" regex works. (DLR)
|
||||
- Clarify descriptions of the characters that aren't allowed
|
||||
in the "punct" or "brackets" options. (DLR)
|
||||
- Use .B instead of \fB ... \fP where possible, as nano.1 does.
|
||||
(DLR)
|
||||
- Clarify and consolidate the descriptions of "fill" and
|
||||
"tabsize". (DLR)
|
||||
- nano.texi:
|
||||
- Update the "Feature Toggles" section to match current nano.
|
||||
(DLR)
|
||||
- Clarify and consolidate the descriptions of --fill and
|
||||
--tabsize. (DLR)
|
||||
- configure.ac:
|
||||
- Minor tweaks to some of the test blocks to avoid XSI:isms.
|
||||
(DLR, adapted from a Debian patch for GNU ed by David
|
||||
Weinehall)
|
||||
- Don't refer to the built-in file browser as crappy anymore.
|
||||
(DLR)
|
||||
- Check for iswpunct() and mbstowcs(). (DLR)
|
||||
- Change the behavior of --enable-extra to only define
|
||||
NANO_EXTRA, instead of defining both it and
|
||||
ENABLE_MULTIBUFFER. (DLR)
|
||||
- Check for get_wch() instead of wget_wch() to determine if
|
||||
there's a wide curses library, as it's a more generic
|
||||
function. (DLR)
|
||||
- Check for possibly unavailable functions in alphabetical
|
||||
order. (DLR)
|
||||
- doc/faq.html:
|
||||
- Update section 1.1 to mention the current maintainer. (DLR)
|
||||
- Minor capitalization and wording fixes. (DLR)
|
||||
- Update description of --enable-extra, and add missing line
|
||||
breaks. (DLR)
|
||||
- doc/nanorc.sample:
|
||||
- In the "nanorc" regexes, tweak the "color" regex to properly
|
||||
color a line that specifies a background color without a
|
||||
foreground color, and update the associated comments. (DLR)
|
||||
- Clarify descriptions of the characters that aren't allowed
|
||||
in the "punct" or "brackets" options. (DLR)
|
||||
- Update comment referring to --enable-extra. (DLR)
|
||||
- Add "cxx" and "hxx" to the list of extensions that the
|
||||
"c-file" regexes apply to, and add "warning" and "error" to
|
||||
them as well. (Mike Frysinger)
|
||||
- Add regexes for assembler files. (Mike Frysinger)
|
||||
- In the preprocessor directives regex string in the "c-file"
|
||||
regexes, cover more whitespace characters than just " " by
|
||||
using "[[:space:]]" instead. (Mike Frysinger) DLR: Extend
|
||||
this to other regex strings whenever possible.
|
||||
- Move some overly long split-up regex strings that cover
|
||||
similar areas onto the same line. (DLR)
|
||||
- Add GCC builtins to the "c-file" regexes. (Mike Frysinger)
|
||||
- Simplify the file extension regex for groff. (DLR)
|
||||
- Clarify and consolidate the descriptions of "fill" and
|
||||
"tabsize". (DLR)
|
||||
- Makefile.am, m4/Makefile.am:
|
||||
- Make sure that the files in EXTRA_DIST are in alphabetical
|
||||
order, and that the lines are wrapped at 72 characters. (DLR)
|
||||
- doc/man/fr/Makefile.am:
|
||||
- Set mandir to @mandir@/fr, so French manpages get installed
|
||||
where they belong (Jordi).
|
||||
- THANKS:
|
||||
- Add new translators to the credits.
|
||||
|
||||
GNU nano 1.3.7 - 2005.04.10
|
||||
- General:
|
||||
- Miscellaneous comment fixes. (DLR)
|
||||
- After (re)initializing the terminal, make sure the cursor is
|
||||
always turned on. Changes to do_alt_speller(),
|
||||
handle_sigwinch(), and main(). (DLR)
|
||||
- Make sure that all references to cut-to-end are left out when
|
||||
NANO_SMALL is defined. Changes to cut_to_eol(),
|
||||
do_cut_text(), and do_statusbar_cut_text(). (DLR)
|
||||
- chars.c:
|
||||
make_mbchar()
|
||||
- Remove unneeded assert. (DLR)
|
||||
move_mbleft()
|
||||
- Fix assert to reference the proper variable, so that nano
|
||||
builds with DEBUG defined again. (Mike Frysinger, found by
|
||||
Dmitri Vassilenko)
|
||||
- files.c:
|
||||
do_insertfile()
|
||||
- Fix problem where going into the help browser at the "Insert
|
||||
File" prompt would always result in the current answer's being
|
||||
used as the filename afterward. (DLR)
|
||||
get_full_path()
|
||||
- Rework handling of the results of getcwd() in order to avoid
|
||||
segfaults if they fail, and to remove uses of the nonportable
|
||||
GNU extension where passing a size of 0 will get a string as
|
||||
long as we need. (DLR)
|
||||
do_browser()
|
||||
- Rename variable lineno to fileline to avoid confusion. (DLR)
|
||||
do_browse_from()
|
||||
- Rework handling of the results of getcwd() in order to avoid
|
||||
segfaults if they fail, and to remove uses of the nonportable
|
||||
GNU extension where passing a size of 0 will get a string as
|
||||
long as we need. (DLR)
|
||||
- nano.c:
|
||||
help_init()
|
||||
- When calculating allocsize, take multibyte characters into
|
||||
account, and keep the column number limits consistent. (DLR)
|
||||
- Break htx up into three chunks, in case the string is too long
|
||||
for the compiler to handle (e.g. an ISO C89 compiler that can
|
||||
only handle up to 509 characters). (DLR)
|
||||
- Minor wording fixes. (DLR)
|
||||
print1opt()
|
||||
- Don't include longflag if HAVE_GETOPT_LONG isn't defined.
|
||||
Rename this function to print1opt_full(), leave out the
|
||||
longflag parameter if HAVE_GETOPT_LONG isn't defined, and make
|
||||
print1opt() a macro for print1opt_full() that does that
|
||||
without the need for a lot of extra #ifdefs. (David
|
||||
Benbennick) DLR: Rename print1opt_f() to print1opt_full().
|
||||
- Rework the special case of options that are ignored for Pico
|
||||
compatibility so that they display more neatly when
|
||||
HAVE_GETOPT_LONG isn't defined. (DLR)
|
||||
usage()
|
||||
- Fix erroneous #ifdef that resulted in the -d/--rebinddelete
|
||||
option's not being printed when NANO_SMALL was defined. (DLR)
|
||||
find_paragraph()
|
||||
- Fix problem where a search for the next paragraph would skip
|
||||
over certain cases of one-line paragraphs. (DLR)
|
||||
do_justify()
|
||||
- Instead of breaking a line at a space and readding the space
|
||||
afterwards, just break the line after the space, as it's more
|
||||
efficient. (DLR)
|
||||
main()
|
||||
- Change 0 to NULL in the option struct where needed. (David
|
||||
Benbennick)
|
||||
- nano.h:
|
||||
- Define PATH_MAX as 4096 if it isn't defined, as passing a size
|
||||
of 0 to get a string as long as we need is a nonportable GNU
|
||||
extension, and hence it won't work on non-GNU systems that
|
||||
don't define PATH_MAX. (DLR)
|
||||
- rcfile.c:
|
||||
parse_rcfile()
|
||||
- Fix debugging message to display the long value of a flag
|
||||
properly. (DLR)
|
||||
- utils.c:
|
||||
regexec_safe()
|
||||
- Rename to safe_regexec() for consistency. (DLR)
|
||||
- winio.c:
|
||||
nanogetstr()
|
||||
- Fix misplaced break. (DLR)
|
||||
statusq()
|
||||
- Make sure that the vsnprintf(foo) call and foo's subsequent
|
||||
null termination both take the proper number of bytes when
|
||||
using multibyte characters, so that multibyte prompt strings
|
||||
aren't prematurely cut off. (DLR)
|
||||
titlebar()
|
||||
- Make sure that the (mv)?waddnstr() calls take the proper
|
||||
number of bytes when using multibyte characters, so that
|
||||
multibyte strings aren't prematurely cut off. (DLR, found by
|
||||
Jordi)
|
||||
- Allow the "View" state to be displayed when a filename is
|
||||
passed in, in case we're in multibuffer mode and inside the
|
||||
file browser. (DLR)
|
||||
help_line_len()
|
||||
- Make the text display more flexible, and closer to what nano
|
||||
1.2.x does. (DLR)
|
||||
- configure.ac:
|
||||
- Allow more flexible handling of UTF-8 support by allowing
|
||||
the --enable-utf8 and --disable-utf8 options. (Mike
|
||||
Frysinger) DLR: Extend these options to work with slang as
|
||||
well as curses, consolidate the warning and error messages
|
||||
dealing with UTF-8 support as much as possible, and add a few
|
||||
minor consistency fixes.
|
||||
- Mention explicitly that the check for the broken regexec() is
|
||||
needed for glibc 2.2.3. (DLR)
|
||||
- nanorc.sample:
|
||||
- Fix the description for the whitespace option to mention that
|
||||
only single-column characters are allowed. (DLR)
|
||||
- Add C++ regexes. (Neil Brown, merged into c-file regexes by
|
||||
DLR)
|
||||
- Break up overly long perl and nanorc regexes into separate
|
||||
regexes of no more than 256 bytes, as POSIX-compliant regexp
|
||||
implementations can reject regexes of over 256 bytes. (DLR)
|
||||
- nano.1, nano.texi:
|
||||
- Mention the -? alias for -h/--help, and add various
|
||||
consistency fixes. (DLR)
|
||||
- nanorc.5:
|
||||
- Fix the description for the whitespace option to mention that
|
||||
only single-column characters are allowed. (DLR)
|
||||
|
||||
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_redraw().
|
||||
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
|
||||
@@ -29,7 +991,7 @@ GNU nano 1.3.5 - 2004.11.22
|
||||
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:
|
||||
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
|
||||
@@ -68,7 +1030,7 @@ GNU nano 1.3.5 - 2004.11.22
|
||||
- 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,
|
||||
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
|
||||
|
||||
@@ -3,8 +3,8 @@ 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
|
||||
EXTRA_DIST = ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS \
|
||||
README THANKS TODO UPGRADE config.rpath install-sh \
|
||||
missing mkinstalldirs nano.spec
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
52
NEWS
52
NEWS
@@ -1,3 +1,55 @@
|
||||
2005.06.30 - GNU nano 1.3.8 floats at its own level. This release
|
||||
contains several new features. Among other things, you
|
||||
can now move to a specified column number as well as
|
||||
line number within a file, file backups saved in a
|
||||
backup directory will have unique names, the search and
|
||||
replace history routines should work more consistently,
|
||||
you can get a word count by pressing Meta-D at the edit
|
||||
window, and there's a new -E/--tabstospaces option to
|
||||
convert all typed tabs to spaces (--backupdir's short
|
||||
option has been changed to -C). In terms of bugfixes,
|
||||
this release contains fixes for minor problems with
|
||||
screen updates, UTF-8 display, and flow control; a fix
|
||||
for a segfault when displaying some lines ending with
|
||||
tabs; better handling of constant cursor position
|
||||
display; improved color parsing in the rcfile; and
|
||||
support for the "Regexp" toggle in tiny mode
|
||||
(-R/--regexp is gone, and --restricted's short option
|
||||
has been changed to -R), among other things. Enjoy.
|
||||
|
||||
2005.04.10 - GNU nano 1.3.7 claws its way to the top. This release
|
||||
mostly contains bugfixes for the massive amount of new
|
||||
code in 1.3.6. Among other things, nano builds with
|
||||
debug support again; going into the help browser at the
|
||||
"Read File" prompt no longer kicks you out of the prompt
|
||||
after you exit the help browser; paragraph searching no
|
||||
longer skips over certain cases of single-line
|
||||
paragraphs; the titlebar no longer cuts off some UTF-8
|
||||
strings prematurely; and the text displayed in the help
|
||||
browser is now wrapped as it was in nano 1.2.x, taking
|
||||
UTF-8 support into account. New features include an
|
||||
--enable/disable-utf8 configure option to explicitly
|
||||
turn detection of UTF-8 support on or off, and sample
|
||||
regexes for C++ as well as C. Have fun.
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
|
||||
10
README.CVS
10
README.CVS
@@ -15,9 +15,11 @@ packages:
|
||||
- cvs
|
||||
- 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 (ncurses, etc.)
|
||||
- make, gcc and the normal development libraries (curses or slang, etc.)
|
||||
|
||||
These should be available on your GNU mirror.
|
||||
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.
|
||||
|
||||
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
|
||||
@@ -28,8 +30,8 @@ $ 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
|
||||
If you want to download the stable CVS branch, add "-r nano_1_2_branch":
|
||||
$ cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/nano checkout -r nano_1_2_branch nano
|
||||
|
||||
Once you have the sources in the "nano" directory, cd into it, and
|
||||
execute the "autogen.sh" script in the top directory. This will set up
|
||||
|
||||
2
THANKS
2
THANKS
@@ -37,6 +37,7 @@ Pierre Tane <tanep@bigfoot.com> French translator
|
||||
Jacobo Tarrío <jtarrio@trasno.net> Galician translator
|
||||
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian nynorsk translator
|
||||
Miquel Vidal <miquel@sindominio.net> Catalan translator
|
||||
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese translator
|
||||
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish translator
|
||||
Peio Ziarsolo <peio@sindominio.net> Basque translator
|
||||
|
||||
@@ -53,5 +54,4 @@ Jeremy Robichaud <robicj@yahoo.com> Beta tester
|
||||
Bill Soudan <wes0472@rit.edu> Regex code, etc
|
||||
Ken Tyler <kent@werple.net.au> Search fixes and more
|
||||
|
||||
|
||||
$Id$
|
||||
|
||||
7
TODO
7
TODO
@@ -2,14 +2,13 @@ TODO file (? means the feature may be implemented, but not definitely)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
For version 1.4:
|
||||
- UTF-8 support.
|
||||
- UTF-8 support. [DONE]
|
||||
- Support for paragraph searches. [DONE]
|
||||
- Support for justifying the entire file at once. [DONE]
|
||||
- Support for filename searches in the file browser.
|
||||
- Undo/Redo key?
|
||||
- Undo/Redo keys?
|
||||
- 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) reenter their
|
||||
parent menu when their keystroke is entered a second time (^W^T^T and
|
||||
|
||||
392
configure.ac
392
configure.ac
@@ -2,24 +2,24 @@
|
||||
#
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
#
|
||||
# GNU nano 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.
|
||||
# GNU nano 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.
|
||||
#
|
||||
# GNU nano 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.
|
||||
# GNU nano 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 GNU nano; if not, write to the Free Software
|
||||
# Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [1.3.5], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [1.3.8], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
@@ -28,6 +28,7 @@ AC_CONFIG_HEADERS([config.h])
|
||||
AC_PREREQ(2.54)
|
||||
|
||||
dnl Checks for programs.
|
||||
|
||||
AC_GNU_SOURCE
|
||||
AC_PROG_CC
|
||||
AC_PROG_LN_S
|
||||
@@ -35,14 +36,16 @@ AC_ISC_POSIX
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
dnl Internationalization macros.
|
||||
|
||||
AM_GNU_GETTEXT_VERSION(0.11.5)
|
||||
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_MSG_CHECKING([for broken regexec from glibc 2.2.3])
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
@@ -58,96 +61,94 @@ int main(void)
|
||||
}],
|
||||
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([cross-compiling; assuming no])
|
||||
)
|
||||
)
|
||||
AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions, as the one from glibc 2.2.3 does.]),
|
||||
AC_MSG_RESULT([cross-compiling; assuming no])))
|
||||
|
||||
dnl Checks for options.
|
||||
|
||||
dnl options
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Enable debugging (disabled by default)],
|
||||
[if test x$enableval = xyes; then
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
|
||||
debug_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
if test "$debug_support" != "yes"; then
|
||||
if test x$debug_support != xyes; then
|
||||
AC_DEFINE(NDEBUG, 1, [Shut up the assert warnings :-)])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(extra,
|
||||
[ --enable-extra Enable extra (optional) functions, including easter eggs],
|
||||
[ --enable-extra Enable extra features, currently only easter eggs],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(tiny,
|
||||
[ --enable-tiny Disable features for the sake of size],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(NANO_SMALL, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in (crappy) file browser.])
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the ^G help menu.])
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(browser,
|
||||
[ --disable-browser Disable mini file browser],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in (crappy) file browser.])
|
||||
fi])
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(help,
|
||||
[ --disable-help Disable help function (^G)],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the ^G help menu.])
|
||||
fi])
|
||||
[ --disable-help Disable help function],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(justify,
|
||||
[ --disable-justify Disable justify/unjustify function],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(mouse,
|
||||
[ --disable-mouse Disable mouse support (and -m flag)],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(operatingdir,
|
||||
[ --disable-operatingdir Disable setting of operating directory (chroot of sorts)],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(speller,
|
||||
[ --disable-speller Disable spell checker function],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(tabcomp,
|
||||
[ --disable-tabcomp Disable tab completion code for a smaller binary],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(wrapping,
|
||||
[ --disable-wrapping Disable all wrapping of text (and -w flag)],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable any and all text wrapping.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(wrapping-as-root,
|
||||
[ --disable-wrapping-as-root Disable wrapping of text as root by default],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_ROOTWRAP, 1, [Define this to disable wrapping as root by default.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(color,
|
||||
[ --enable-color Enable color and syntax highlighting],
|
||||
@@ -155,7 +156,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. ***
|
||||
@@ -167,13 +167,13 @@ AC_ARG_ENABLE(multibuffer,
|
||||
[ --enable-multibuffer Enable multiple file buffers],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(nanorc,
|
||||
[ --enable-nanorc Enable use of .nanorc file],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(all,
|
||||
[ --enable-all Enable ALL extra nano functionality (kitchen sink option)],
|
||||
@@ -183,14 +183,24 @@ 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. ***
|
||||
***********************************************************************
|
||||
])
|
||||
])
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING([whether to enable UTF-8 support])
|
||||
AC_ARG_ENABLE(utf8,
|
||||
[ --enable-utf8 Enable UTF-8 support],
|
||||
[if test x$enableval = xyes; then
|
||||
enable_utf8=yes
|
||||
else
|
||||
enable_utf8=no
|
||||
fi],
|
||||
[enable_utf8=auto])
|
||||
AC_MSG_RESULT($enable_utf8)
|
||||
|
||||
AC_MSG_CHECKING([whether to use slang])
|
||||
CURSES_LIB_NAME=""
|
||||
AC_ARG_WITH(slang,
|
||||
@@ -202,41 +212,105 @@ AC_ARG_WITH(slang,
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
|
||||
if test "$with_slang" != "yes"; then
|
||||
if test x$with_slang != xyes; then
|
||||
# Add additional search path
|
||||
LDFLAGS="-L$with_slang/lib $LDFLAGS"
|
||||
CPPFLAGS="-I$with_slang/include $CPPFLAGS"
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang])
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
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
|
||||
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)
|
||||
# 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_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 x$with_slang != xyes; 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 $tcap])
|
||||
LIBS="$LIBS $tcap"
|
||||
# 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 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 x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the math library
|
||||
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 x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
fi
|
||||
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_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** install a version of slang that includes the slcurses.h file or
|
||||
*** do not call the configure script with --with-slang
|
||||
]))
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
# Reset libs if the above slang tests failed
|
||||
if test x$enable_utf8 != xno; then
|
||||
LIBS=$_libs
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
@@ -247,16 +321,22 @@ int main(void)
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang], [
|
||||
AC_MSG_RESULT(no)
|
||||
# We might need the math library
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
||||
LIBS="$LIBS -lm"
|
||||
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])
|
||||
LIBS="$LIBS $tcap"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
@@ -267,41 +347,70 @@ int main(void)
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
fi
|
||||
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_RESULT(no)
|
||||
|
||||
# We might need the math library
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
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
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
fi
|
||||
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_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** install a version of slang that includes the slcurses.h file or
|
||||
*** do not call the configure script with --with-slang
|
||||
]))
|
||||
]))
|
||||
fi
|
||||
|
||||
test "${_libs+set}" = "set" && LIBS=$_libs
|
||||
if test "${_libs+set}" = "set"; then
|
||||
LIBS=$_libs
|
||||
fi
|
||||
|
||||
if test "$with_slang" != "yes"; then
|
||||
if test x$with_slang != xyes; then
|
||||
LDFLAGS=${_ldflags}
|
||||
fi
|
||||
;;
|
||||
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"
|
||||
then
|
||||
AM_PATH_GLIB_2_0(2.0.0,,
|
||||
AC_MSG_ERROR([
|
||||
dnl Checks for functions.
|
||||
|
||||
AC_CHECK_FUNCS(getdelim getline isblank snprintf strcasecmp strcasestr strncasecmp strnlen vsnprintf)
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace mblen mbstowcs mbtowc wctomb wcwidth)
|
||||
fi
|
||||
|
||||
if test x$ac_cv_func_snprintf = xno || test x$ac_cv_func_vsnprintf = xno; then
|
||||
AM_PATH_GLIB_2_0(2.0.0,,
|
||||
AC_MSG_ERROR([
|
||||
*** snprintf() and/or vsnprintf() not found. GLIB 2.x not found either.
|
||||
*** You need both snprintf() and vsnprintf(). Alternatively you can
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
|
||||
glib)
|
||||
glib)
|
||||
fi
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
@@ -312,30 +421,38 @@ 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, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_CHECK_HEADERS(ncurses.h)
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||
fi
|
||||
|
||||
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, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_CHECK_HEADERS(curses.h)
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_LIB(curses, get_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE=yes])
|
||||
fi
|
||||
|
||||
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_CHECK_LIB(termcap, tgetent, [CURSES_LIB="-ltermcap" CURSES_LIB_NAME=termcap])
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
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.]))
|
||||
@@ -346,13 +463,40 @@ LIBS="$LIBS $CURSES_LIB"
|
||||
|
||||
AC_SUBST(CURSES_LIB)
|
||||
|
||||
if test "x$GLIB_CFLAGS" != "x"
|
||||
then
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
if test "x$GLIB_CFLAGS" != "x"; then
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
fi
|
||||
if test "x$GLIB_LIBS" != "x"
|
||||
then
|
||||
LDFLAGS="$LDFLAGS $GLIB_LIBS"
|
||||
if test "x$GLIB_LIBS" != "x"; then
|
||||
LDFLAGS="$LDFLAGS $GLIB_LIBS"
|
||||
fi
|
||||
|
||||
if test x$enable_utf8 != xno && \
|
||||
test x$CURSES_LIB_WIDE = xyes && \
|
||||
test x$ac_cv_func_iswalnum = xyes && \
|
||||
test x$ac_cv_func_iswpunct = xyes && \
|
||||
(test x$ac_cv_func_iswblank = xyes || test x$ac_cv_func_iswspace = xyes) && \
|
||||
test x$ac_cv_func_mblen = xyes && \
|
||||
test x$ac_cv_func_mbstowcs = xyes && \
|
||||
test x$ac_cv_func_mbtowc = xyes && \
|
||||
test x$ac_cv_func_wctomb = xyes && \
|
||||
test x$ac_cv_func_wcwidth = xyes; then
|
||||
AC_DEFINE(NANO_WIDE, 1, [Define this if your system has sufficient wide character support (a wide curses library, iswalnum(), iswpunct(), iswblank() or iswspace(), mblen(), mbstowcs(), mbtowc(), wctomb(), and wcwidth()).])
|
||||
else
|
||||
if test x$enable_utf8 = xyes; then
|
||||
AC_MSG_ERROR([
|
||||
*** UTF-8 support was requested, but insufficient UTF-8 support was
|
||||
*** detected in your curses and/or C libraries. Please verify that your
|
||||
*** slang was built with UTF-8 support or your curses was built with
|
||||
*** wide character support, and that your C library was built with wide
|
||||
*** character support.])
|
||||
elif test x$enable_utf8 != xno; then
|
||||
AC_MSG_WARN([
|
||||
*** Insufficient UTF-8 support was detected in your curses and/or C
|
||||
*** libraries. If you want UTF-8 support, please verify that your slang
|
||||
*** was built with UTF-8 support or your curses was built with wide
|
||||
*** character support, and that your C library was built with wide
|
||||
*** character support.])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
|
||||
76
doc/faq.html
76
doc/faq.html
@@ -5,7 +5,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</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>
|
||||
@@ -24,23 +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. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.3">4.3. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.4">4.4. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.5">4.5. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.6a">4.6a. [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.6b">4.6b. [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.7">4.7. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.8">4.8. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.9">4.9. 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>
|
||||
<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>
|
||||
@@ -52,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>
|
||||
@@ -61,7 +62,7 @@
|
||||
<hr width="100%">
|
||||
<h1><a name="1"></a>1. General</h1>
|
||||
<h2><a name="1.1"></a>1.1 About this FAQ</h2>
|
||||
<blockquote><p>This FAQ was written and is maintained by Chris Allegretta <<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>>, who also happens to be the creator of nano. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
|
||||
<blockquote><p>This FAQ was originally written and maintained by Chris Allegretta <<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>>, who also happens to be the creator of nano. It is currently maintained by David Lawrence Ramsey <<a href="mailto:pooka_regent@sluggy.net">pooka_regent@sluggy.net</a>>. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
|
||||
<h2><a name="1.2"></a>1.2. How do I contribute to it?</h2>
|
||||
<blockquote><p>Your best bet is to send it to the nano email address, <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a> and if it is useful enough it will be included in future versions.</p></blockquote>
|
||||
<h2><a name="1.3"></a>1.3. What is GNU nano?</h2>
|
||||
@@ -79,7 +80,7 @@
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano *should* be 1.3.5. 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.8. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.3/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
@@ -134,7 +135,7 @@
|
||||
<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>
|
||||
@@ -153,7 +154,7 @@
|
||||
<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-extra</b> Enable extra features, currently only easter eggs
|
||||
<b>--enable-nanorc</b> Enable use of .nanorc file
|
||||
<b>--enable-color</b> Enable color and syntax highlighting
|
||||
<b>--enable-multibuffer</b> Enable having multiple file buffers open
|
||||
@@ -162,33 +163,37 @@
|
||||
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>
|
||||
<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> (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>
|
||||
<blockquote><p>To use verbatim input, you must be using nano 1.3.1 or newer. When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b>. (If you're not at a prompt, you'll get the message "Verbatim Input".) Then press the key(s) that generate the character you want.</p>
|
||||
<p>Alternatively, you can press <b>Meta-V</b> and then type a four-digit hexadecimal code from 0000 to ffff (case-insensitive), and the character with the corresponding value will be inserted instead.</p></blockquote>
|
||||
<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 (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. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
|
||||
<h2><a name="4.3"></a>4.3. 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.3"></a>4.3. Nano crashes when I type <insert keystroke here>!</h2>
|
||||
<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.4"></a>4.4. 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.5"></a>4.5. [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>
|
||||
<h2><a name="4.6a"></a>4.6a. [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.6b"></a>4.6b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<h2><a name="4.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.7"></a>4.7. 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>
|
||||
@@ -201,9 +206,9 @@
|
||||
<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.8"></a>4.8. 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.9"></a>4.9. 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>
|
||||
<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>
|
||||
@@ -229,7 +234,7 @@
|
||||
<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>
|
||||
@@ -245,7 +250,12 @@
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote>
|
||||
<p>
|
||||
2004/11/21 - List sh as an example of a Bourne shell. (DLR)
|
||||
2005/06/15 - Update description of --enable-extra, and add missing line breaks. (DLR)<br>
|
||||
2005/06/13 - Minor capitalization and wording fixes. (DLR)<br>
|
||||
2005/06/08 - Updated section 1.1 to mention the current maintainer. (DLR)<br>
|
||||
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>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
man_MANS = nano.1 nanorc.5
|
||||
|
||||
mandir = @mandir@/fr
|
||||
|
||||
BUILT_SOURCES = nano.1.html nanorc.5.html
|
||||
|
||||
nano.1.html: nano.1
|
||||
|
||||
146
doc/man/nano.1
146
doc/man/nano.1
@@ -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.5" "November 6, 2004"
|
||||
.TH NANO 1 "version 1.3.8" "June 27, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -15,7 +15,7 @@ nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [\+LINE]\ [options]\ [file]
|
||||
.I [\+LINE,COLUMN]\ [options]\ [file]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -32,8 +32,12 @@ replace" and "go to line number".
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILINE\fP
|
||||
Places cursor at \fILINE\fP on startup.
|
||||
.B \+\fILINE\fP,\fICOLUMN\fP
|
||||
Places cursor at line number \fILINE\fP and column number \fICOLUMN\fP
|
||||
on startup, instead of the default of line 1, column 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Same as \fB-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
@@ -46,62 +50,64 @@ line.
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
.TP
|
||||
.B \-E \fIdir\fP (\-\-backupdir=\fIdir\fP)
|
||||
Set the directory where \fBnano\fP puts the backup files if file backups
|
||||
are enabled.
|
||||
.B \-C \fIdir\fP (\-\-backupdir=\fIdir\fP)
|
||||
Set the directory where \fBnano\fP puts unique backup files if file
|
||||
backups are enabled.
|
||||
.TP
|
||||
.B \-E (\-\-tabstospaces)
|
||||
Convert typed tabs to spaces.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
Enable multiple file buffers, if available.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Log search and replace strings to
|
||||
.I ~/.nano_history
|
||||
so they may be stored for later editing, if nanorc support is
|
||||
configured.
|
||||
Log search and replace strings to \fI~/.nano_history\fP so they can be
|
||||
stored for later editing, if nanorc support is configured.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
Don't look at
|
||||
.I SYSCONFDIR/nanorc
|
||||
or
|
||||
.IR ~/.nanorc ,
|
||||
if nanorc support is available.
|
||||
Don't look at \fISYSCONFDIR/nanorc\fP or \fI~/.nanorc\fP, if nanorc
|
||||
support is available.
|
||||
.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
|
||||
">\ " otherwise.
|
||||
.TP
|
||||
.B \-R (\-\-regexp)
|
||||
Enable regular expression matching for search strings, as well as
|
||||
\\n subexpression replacement for replace strings, if available.
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
.TP
|
||||
.B \-T \fIcols\fP (\-\-tabsize=\fIcols\fP)
|
||||
Set the size (width) of a tab to \fIcols\fP columns.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Show the current version number and author.
|
||||
.TP
|
||||
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
|
||||
Specify a specific syntax highlighting from the
|
||||
.I nanorc
|
||||
to use, if available.
|
||||
.TP
|
||||
.B \-Z (\-\-restricted)
|
||||
.B \-R (\-\-restricted)
|
||||
Restricted mode: Don't read or write to any file not specified on the
|
||||
command line, read any nanorc files, allow suspending, or allow a file
|
||||
to be appended to, prepended to, or saved under a different name if it
|
||||
already has one. Also accessible by invoking \fBnano\fP with any name
|
||||
beginning with 'r' (e.g. "rnano").
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
.TP
|
||||
.B \-T \fIcols\fP (\-\-tabsize=\fIcols\fP)
|
||||
Set the size (width) of a tab to \fIcols\fP columns. The value of
|
||||
\fIcols\fP must be greater than 0. The default value is 8.
|
||||
.TP
|
||||
.B \-U (\-\-quickblank)
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25. Note that \fB-c\fP cancels this out.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Show the current version number and author.
|
||||
.TP
|
||||
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
|
||||
Specify a specific syntax highlighting from the \fInanorc\fP to use, if
|
||||
available.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Constantly show the cursor position.
|
||||
Constantly show the cursor position. Note that this cancels out
|
||||
\fB-U\fP.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
@@ -116,13 +122,12 @@ 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
|
||||
.IR /tmp ,
|
||||
perhaps?
|
||||
a new file instead of following it. Good for editing files in
|
||||
\fI/tmp\fP, perhaps?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Enable mouse support (if available for your system).
|
||||
@@ -136,16 +141,17 @@ Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
|
||||
by the terminal.
|
||||
.TP
|
||||
.B \-r \fIcols\fP (\-\-fill=\fIcols\fP)
|
||||
Wrap lines at column \fIcols\fP. By default, this is the width of the
|
||||
screen, less eight. If this value is negative, wrapping will occur at
|
||||
\fIcols\fP columns from the right of the screen, allowing the wrap point
|
||||
to vary along with the screen width if resized.
|
||||
Wrap lines at column \fIcols\fP. If this value is 0 or less, wrapping
|
||||
will occur at the width of the screen less \fIcols\fP columns, allowing
|
||||
the wrap point to vary along with the width of the screen if the screen
|
||||
is resized. The default value is -8.
|
||||
.TP
|
||||
.B \-s \fIprog\fP (\-\-speller=\fIprog\fP)
|
||||
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 \fB-t\fP
|
||||
option.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
View file (read only) mode.
|
||||
@@ -164,13 +170,9 @@ Ignored, for compatibility with Pico.
|
||||
|
||||
.SH INITIALIZATION FILE
|
||||
\fBnano\fP will read initialization files in the following order:
|
||||
.IR SYSCONFDIR/nanorc ,
|
||||
then
|
||||
.IR ~/.nanorc .
|
||||
Please see
|
||||
.BR nanorc (5)
|
||||
and the example file \fBnanorc.sample\fP which should be provided with
|
||||
\fBnano\fP.
|
||||
\fISYSCONFDIR/nanorc\fP, then \fI~/.nanorc\fP. Please see
|
||||
\fBnanorc(5)\fP and the example file \fBnanorc.sample\fP, both of which
|
||||
should be provided with \fBnano\fP.
|
||||
|
||||
.SH NOTES
|
||||
If no alternative spell checker command is specified on the command
|
||||
@@ -180,25 +182,20 @@ line or in one of the nanorc files, \fBnano\fP will check the
|
||||
\fBnano\fP will try to dump the buffer into an emergency file in some
|
||||
cases. Mainly, this will happen if \fBnano\fP receives a SIGHUP or
|
||||
SIGTERM or runs out of memory, when it will write the buffer into a file
|
||||
named
|
||||
.I nano.save
|
||||
if the buffer didn't have a name already, or will add a ".save" suffix
|
||||
to the current filename. If an emergency file with that name already
|
||||
exists in the current directory, ".save" and a number (e.g. ".save.1")
|
||||
will be suffixed to the current filename in order to make it unique. In
|
||||
multibuffer mode, \fBnano\fP will write all the open buffers to the
|
||||
respective emergency files.
|
||||
named \fInano.save\fP if the buffer didn't have a name already, or will
|
||||
add a ".save" suffix to the current filename. If an emergency file with
|
||||
that name already exists in the current directory, ".save" and a number
|
||||
(e.g. ".save.1") will be suffixed to the current filename in order to
|
||||
make it unique. In multibuffer mode, \fBnano\fP will write all the open
|
||||
buffers to their respective emergency files.
|
||||
|
||||
.SH BUGS
|
||||
Please send any comments or bug reports to
|
||||
.BR nano@nano-editor.org .
|
||||
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
|
||||
|
||||
The \fBnano\fP mailing list is available from
|
||||
.BR nano-devel@gnu.org .
|
||||
The \fBnano\fP mailing list is available from \fBnano-devel@gnu.org\fP.
|
||||
|
||||
To subscribe, email to
|
||||
.B nano-devel-request@gnu.org
|
||||
with a subject of "subscribe".
|
||||
To subscribe, email to \fBnano-devel-request@gnu.org\fP with a subject
|
||||
of "subscribe".
|
||||
|
||||
.SH HOMEPAGE
|
||||
http://www.nano-editor.org/
|
||||
@@ -211,10 +208,7 @@ http://www.nano-editor.org/
|
||||
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see
|
||||
.I AUTHORS
|
||||
and
|
||||
.I THANKS
|
||||
for details). This manual page was originally written by Jordi Mallach
|
||||
<jordi@sindominio.net>, for the Debian GNU system (but may be used by
|
||||
others).
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see \fIAUTHORS\fP and
|
||||
\fITHANKS\fP for details). This manual page was originally written by
|
||||
Jordi Mallach <jordi@sindominio.net>, for the Debian GNU system (but may
|
||||
be used by others).
|
||||
|
||||
166
doc/man/nanorc.5
166
doc/man/nanorc.5
@@ -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.5" "November 6, 2004"
|
||||
.TH NANORC 5 "version 1.3.8" "June 27, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -21,15 +22,14 @@ replace" and "go to line number".
|
||||
.PP
|
||||
The \fInanorc\fP file contains the default settings for \fBnano\fP.
|
||||
During startup, \fBnano\fP will first read its system-wide settings from
|
||||
.IR SYSCONFDIR/nanorc ,
|
||||
and then user-specific settings from
|
||||
.IR ~/.nanorc .
|
||||
\fISYSCONFDIR/nanorc\fP, and then user-specific settings from
|
||||
\fI~/.nanorc\fP.
|
||||
|
||||
.SH OPTIONS
|
||||
The configuration file accepts a series of "set" and "unset" commands,
|
||||
which can be used to configure nano on startup without using the
|
||||
command-line options. Additionally, the "syntax" and "color" keywords
|
||||
are used to define syntax highlighting rules for different text
|
||||
command-line options. Additionally, the "syntax", "color", and "icolor"
|
||||
keywords are used to define syntax highlighting rules for different text
|
||||
patterns. GNU nano will read one command per line.
|
||||
|
||||
Options in rcfiles take precedence over nano's defaults, and command
|
||||
@@ -40,66 +40,83 @@ Options are unset by default, except for options that take an argument.
|
||||
The supported commands and arguments are:
|
||||
|
||||
.TP 3
|
||||
\fBset/unset autoindent\fP
|
||||
.B set/unset autoindent
|
||||
Use auto-indentation.
|
||||
.TP
|
||||
\fBset/unset backup\fP
|
||||
Create backup files in
|
||||
.IR filename~ .
|
||||
.B set/unset backup
|
||||
Create backup files in \fIfilename~\fP.
|
||||
.TP
|
||||
\fBset backupdir "\fIdirectory\fP"\fP
|
||||
Set the directory where \fBnano\fP puts the backup files if file backups
|
||||
are enabled.
|
||||
\fBset brackets "\fIstring\fP"\fP
|
||||
.B set backupdir "\fIdirectory\fP"
|
||||
Set the directory where \fBnano\fP puts unique backup files if file
|
||||
backups are enabled.
|
||||
.TP
|
||||
.B set/unset backwards
|
||||
Do backwards searches by default.
|
||||
.TP
|
||||
.B set brackets "\fIstring\fP"
|
||||
Set the characters treated as closing brackets. They cannot contain
|
||||
tabs or spaces. Only closing punctuation, optionally followed by
|
||||
blank characters. Only closing punctuation, optionally followed by
|
||||
closing brackets, can end sentences.
|
||||
.TP
|
||||
\fBset/unset const\fP
|
||||
.B set/unset casesensitive
|
||||
Do case sensitive searches by default.
|
||||
.TP
|
||||
.B set/unset const
|
||||
Constantly display the cursor position in the status bar.
|
||||
.TP
|
||||
\fBset/unset cut\fP
|
||||
Use cut to end of line with ^K by default.
|
||||
.B set/unset cut
|
||||
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
|
||||
length will be the screen width less \fIn\fP. The default value is -8.
|
||||
.B set fill \fIn\fP
|
||||
Wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the
|
||||
maximum line length will be the screen width less \fIn\fP columns. The
|
||||
default value is -8.
|
||||
.TP
|
||||
\fBset/unset historylog\fP
|
||||
Enable
|
||||
.I ~/.nano_history
|
||||
for saving and reading search/replace strings.
|
||||
.B set/unset historylog
|
||||
Enable \fI~/.nano_history\fP for saving and reading search/replace
|
||||
strings.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
.B set/unset morespace
|
||||
Allow use of the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
.B set/unset mouse
|
||||
Enable mouse support, so that mouse clicks can be used to set the mark
|
||||
and run shortcuts.
|
||||
.TP
|
||||
.B set/unset multibuffer
|
||||
Allow inserting files into their own buffers.
|
||||
.TP
|
||||
\fBset/unset noconvert\fP
|
||||
.B set/unset noconvert
|
||||
Don't convert files from DOS/Mac format.
|
||||
.TP
|
||||
\fBset/unset nofollow\fP
|
||||
.B set/unset nofollow
|
||||
Don't follow symlinks when writing files.
|
||||
.TP
|
||||
\fBset/unset nohelp\fP
|
||||
.B set/unset nohelp
|
||||
Don't display the help lists at the bottom of the screen.
|
||||
.TP
|
||||
\fBset/unset nowrap\fP
|
||||
.B set/unset nowrap
|
||||
Don't wrap text at all.
|
||||
.TP
|
||||
\fBset operatingdir "\fIdirectory\fP"\fP
|
||||
.B set operatingdir "\fIdirectory\fP"
|
||||
\fBnano\fP will only read and write files inside \fIdirectory\fP and its
|
||||
subdirectories. Also, the current directory is changed to here, so
|
||||
files are inserted from this dir. By default the operating directory
|
||||
feature is turned off.
|
||||
.TP
|
||||
\fBset/unset preserve\fP
|
||||
.B set/unset preserve
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
.TP
|
||||
\fBset punct "\fIstring\fP"\fP
|
||||
.B set punct "\fIstring\fP"
|
||||
Set the characters treated as closing punctuation. They cannot contain
|
||||
tabs or spaces. Only closing punctuation, optionally followed by
|
||||
blank characters. Only closing punctuation, optionally followed by
|
||||
closing brackets, can end sentences.
|
||||
.TP
|
||||
\fBset quotestr "\fIstring\fP"\fP
|
||||
.B set quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
.TP
|
||||
.B set quotestr "\fIstring\fP"
|
||||
The email-quote string, used to justify email-quoted paragraphs. This
|
||||
is an "extended regular expression" if your system supports them,
|
||||
otherwise a literal string. The default value is
|
||||
@@ -109,67 +126,77 @@ otherwise a literal string. The default value is
|
||||
if you have regexps, otherwise set quotestr ">\ ". Note that '\\t'
|
||||
above stands for a literal Tab character.
|
||||
.TP
|
||||
\fBset/unset rebinddelete\fP
|
||||
.B set/unset rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
.TP
|
||||
\fBset/unset regexp\fP
|
||||
.B set/unset regexp
|
||||
Do regular expression searches by default.
|
||||
.TP
|
||||
\fBset/unset smarthome\fP
|
||||
.B set/unset smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
.TP
|
||||
\fBset/unset smooth\fP
|
||||
.B set/unset smooth
|
||||
Use smooth scrolling by default.
|
||||
.TP
|
||||
\fBset speller \fIspellprog\fP\fP
|
||||
.B set speller \fIspellprog\fP
|
||||
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.
|
||||
.B set/unset suspend
|
||||
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
|
||||
greater than 0.
|
||||
.B set tabsize \fIn\fP
|
||||
Use a tab size of \fIn\fP columns. The value of \fIn\fP must be greater
|
||||
than 0. The default value is 8.
|
||||
.TP
|
||||
\fBset/unset tempfile\fP
|
||||
.B set/unset tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
.TP
|
||||
.B set/unset tempfile
|
||||
Save automatically on exit, don't prompt.
|
||||
.TP
|
||||
\fBset/unset view\fP
|
||||
.B set/unset view
|
||||
Disallow file modification.
|
||||
.TP
|
||||
\fBset whitespace "\fIstring\fP"\fP
|
||||
.B set whitespace "\fIstring\fP"
|
||||
Set the two characters used to display the first characters of tabs and
|
||||
spaces. They cannot be control characters.
|
||||
spaces. They must be single-column characters.
|
||||
.TP
|
||||
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
|
||||
Defines a syntax named \fIstr\fP which can be activated via the \fB-Y\fP
|
||||
flag, or will be automatically activated if the current filename matches
|
||||
\fIfileregex\fP. All following \fBcolor\fP statements will apply to
|
||||
\fIsyntax\fP until a new syntax is defined.
|
||||
\fIfileregex\fP. All following \fBcolor\fP and \fBicolor\fP statements
|
||||
will apply to \fIsyntax\fP until a new syntax is defined.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP[,\fIbgcolor\fP] "\fIregex\fP" ...
|
||||
.B color \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
|
||||
For the currently defined syntax, display all expressions matching
|
||||
\fIregex\fP with foreground color \fIfgcolor\fP and optional background
|
||||
color \fIbgcolor\fP. Legal colors for foreground and background color
|
||||
are: white, black, red, blue, green, yellow, magenta, and cyan. You may
|
||||
use the prefix "bright" to force a stronger color highlight. If your
|
||||
terminal supports transparency, not specifying a \fIbgcolor\fP tells
|
||||
\fBnano\fP to attempt to use a transparent background.
|
||||
\fIregex\fP with foreground color \fIfgcolor\fP and background color
|
||||
\fIbgcolor\fP, at least one of which must be specified. Legal colors
|
||||
for foreground and background color are: white, black, red, blue, green,
|
||||
yellow, magenta, and cyan. You may use the prefix "bright" to force a
|
||||
stronger color highlight for the foreground. If your terminal supports
|
||||
transparency, not specifying a \fIbgcolor\fP tells \fBnano\fP to attempt
|
||||
to use a transparent background.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP[,\fIbgcolor\fP] start="\fIsr\fP" end="\fIer\fP"
|
||||
.B icolor \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
|
||||
Same as above, except that the expression matching is case insensitive.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP,\fIbgcolor\fP start="\fIsr\fP" end="\fIer\fP"
|
||||
Display expressions which start with \fIsr\fP and end with \fIer\fP
|
||||
with foreground color \fIfgcolor\fP and optional background color
|
||||
\fIbgcolor\fP. This allows syntax highlighting to span multiple lines.
|
||||
Note that all subsequent instances of \fIsr\fP after an initial \fIsr\fP
|
||||
is found will be highlighted until the first instance of \fIer\fP.
|
||||
\fI
|
||||
with foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
|
||||
at least one of which must be specified. This allows syntax
|
||||
highlighting to span multiple lines. Note that all subsequent instances
|
||||
of \fIsr\fP after an initial \fIsr\fP is found will be highlighted until
|
||||
the first instance of \fIer\fP.
|
||||
.TP
|
||||
.B icolor \fIfgcolor\fP,\fIbgcolor\fP start="\fIsr\fP" end="\fIer\fP"
|
||||
Same as above, except that the expression matching is case insensitive.
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
@@ -186,9 +213,6 @@ Per-user configuration file
|
||||
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (or equivalent on your
|
||||
system)
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see
|
||||
.I AUTHORS
|
||||
and
|
||||
.I THANKS
|
||||
for details).
|
||||
This manual page was written by Jordi Mallach <jordi@gnu.org>.
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see \fIAUTHORS\fP and
|
||||
\fITHANKS\fP for details). This manual page was written by Jordi
|
||||
Mallach <jordi@gnu.org>.
|
||||
|
||||
@@ -14,23 +14,30 @@
|
||||
## Backup files to filename~.
|
||||
# set backup
|
||||
|
||||
## The directory to put the backup files in.
|
||||
## The directory to put unique backup files in.
|
||||
# set backupdir ""
|
||||
|
||||
## The characters treated as closing brackets. They cannot contain tabs
|
||||
## or spaces. Only closing punctuation, optionally followed by closing
|
||||
## brackets, can end sentences.
|
||||
## Do backwards searches by default.
|
||||
# set backwards
|
||||
|
||||
## The characters treated as closing brackets. They cannot contain
|
||||
## blank characters. Only closing punctuation, optionally followed by
|
||||
## closing brackets, can end sentences.
|
||||
##
|
||||
# set brackets "'")}]>"
|
||||
|
||||
## Constantly display the cursor position in the status bar.
|
||||
## Do case sensitive searches by default.
|
||||
# set casesensitive
|
||||
|
||||
## Constantly display the cursor position in the statusbar. Note that
|
||||
## this cancels out "quickblank".
|
||||
# set const
|
||||
|
||||
## Use cut to end of line by default.
|
||||
# set cut
|
||||
|
||||
## Set the line length for wrapping text and justifying paragraphs.
|
||||
## If fill is negative, the line length will be the screen width less
|
||||
## If fill is 0 or less, the line length will be the screen width less
|
||||
## this number.
|
||||
##
|
||||
# set fill -8
|
||||
@@ -38,13 +45,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 (inserting a file will put it into a
|
||||
## separate buffer). You must have configured with --enable-multibuffer
|
||||
## or --enable-extra for this to work.
|
||||
## for this to work.
|
||||
##
|
||||
# set multibuffer
|
||||
|
||||
@@ -71,11 +81,16 @@
|
||||
# set preserve
|
||||
|
||||
## The characters treated as closing punctuation. They cannot contain
|
||||
## tabs or spaces. Only closing punctuation, optionally followed by
|
||||
## blank characters. Only closing punctuation, optionally followed by
|
||||
## closing brackets, can end sentences.
|
||||
##
|
||||
# set punct ".?!"
|
||||
|
||||
## Do quick statusbar blanking. Statusbar messages will disappear after
|
||||
## 1 keystroke instead of 25. Note that "const" cancels this out.
|
||||
##
|
||||
# set quickblank
|
||||
|
||||
## The email-quote string, used to justify email-quoted paragraphs.
|
||||
## This is an extended regular expression if your system supports them,
|
||||
## otherwise a literal string. Default:
|
||||
@@ -112,44 +127,64 @@
|
||||
## Use this tab size instead of the default; it must be greater than 0.
|
||||
# set tabsize 8
|
||||
|
||||
## Convert typed tabs to spaces.
|
||||
# set tabstospaces
|
||||
|
||||
## Save automatically on exit, don't prompt.
|
||||
# set tempfile
|
||||
|
||||
## Disallow file modification, why would you want this in an 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.
|
||||
## The two single-column characters used to display the first characters
|
||||
## of tabs and spaces. 187 decimal (00BB hexadecimal) and 183 decimal
|
||||
## (00B7 hexadecimal) seem to be good values for these.
|
||||
# set whitespace " "
|
||||
|
||||
## Color setup
|
||||
##
|
||||
## Format:
|
||||
##
|
||||
## syntax "short description" ["filename regex" ...]
|
||||
##
|
||||
## color foreground,background "regex" ["regex"...]
|
||||
## or
|
||||
## icolor foreground,background "regex" ["regex"...]
|
||||
##
|
||||
## "color" will do case sensitive matches, while "icolor" will do case
|
||||
## insensitive matches.
|
||||
##
|
||||
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
|
||||
## You may use the prefix "bright" to mean a stronger color highlight.
|
||||
## You may use the prefix "bright" to mean a stronger color highlight
|
||||
## for the foreground.
|
||||
##
|
||||
## To use multi-line regexes use the start="regex" end="regex" format.
|
||||
## To use multi-line regexes, use the start="regex" end="regex" format.
|
||||
##
|
||||
## If your system supports transparency, not specifying a background
|
||||
## color will use a transparent color. If you don't want this, be sure
|
||||
## to set the background color to black or white.
|
||||
##
|
||||
# syntax "c-file" "\.(c|h)$"
|
||||
# syntax "c-file" "\.(c|C|cc|cpp|cxx|h|H|hh|hpp|hxx)$"
|
||||
# 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|goto|continue|break)\>"
|
||||
# color brightcyan "^ *# *(define|undef|include|ifn?def|endif|elif|else|if)"
|
||||
# color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
|
||||
# color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|default|switch|goto|continue|break|return)\>"
|
||||
# color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
# color brightmagenta "'([^\]|(\\['abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
|
||||
##
|
||||
## GCC builtins
|
||||
##
|
||||
# color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(asm|builtin|inline|restrict|typeof)__"
|
||||
##
|
||||
## You will in general want your comments and strings to come last,
|
||||
## because syntax highlighting rules will be applied in the order they
|
||||
## are read in.
|
||||
##
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
##
|
||||
## This string is VERY resource intensive!!!
|
||||
# color brightyellow start=""(\\.|[^\"])*\\ *$" end="^(\\.|[^\"])*""
|
||||
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
|
||||
##
|
||||
## And we want to have some nice comment highlighting too
|
||||
# color brightblue "//.*"
|
||||
@@ -158,7 +193,7 @@
|
||||
## Here is a short example for HTML
|
||||
# syntax "HTML" "\.html$"
|
||||
# color blue start="<" end=">"
|
||||
# color red "&[^; ]*;"
|
||||
# color red "&[^;[[:space:]]]*;"
|
||||
|
||||
## Here is a short example for TeX files
|
||||
# syntax "TeX" "\.tex$"
|
||||
@@ -172,10 +207,10 @@
|
||||
|
||||
## Here is an example for groff
|
||||
##
|
||||
# syntax "groff" "\.ms$" "\.mm$" "\.me$" "\.tmac$" "^tmac." ".rof"
|
||||
# syntax "groff" "\.m[ems]$" "\.tmac$" "^tmac." ".rof"
|
||||
## The argument of .nr or .ds
|
||||
# color cyan "^\.ds [^ ]*"
|
||||
# color cyan "^\.nr [^ ]*"
|
||||
# color cyan "^\.ds [^[[:space:]]]*"
|
||||
# color cyan "^\.nr [^[[:space:]]]*"
|
||||
## Single character escapes
|
||||
# color brightmagenta "\\."
|
||||
## Highlight the argument of \f or \s in the same color
|
||||
@@ -187,7 +222,7 @@
|
||||
# color cyan "(\\|\\\\)n\(.."
|
||||
# color cyan start="(\\|\\\\)n\[" end="]"
|
||||
## Requests
|
||||
# color brightgreen "^\. *[^ ]*"
|
||||
# color brightgreen "^\.[[:space:]]*[^[[:space:]]]*"
|
||||
## Comments
|
||||
# color yellow "^\.\\\".*$"
|
||||
## Strings
|
||||
@@ -203,7 +238,7 @@
|
||||
## Here is an example for perl
|
||||
##
|
||||
# syntax "perl" "\.p[lm]$"
|
||||
# color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork)|get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join|keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek|seekdir|se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr|y|truncate|umask|un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
# color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
# color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
|
||||
# color cyan start="[$@%]" end="( |\\W|-)"
|
||||
# color yellow "".*"|qq\|.*\|"
|
||||
@@ -223,7 +258,7 @@
|
||||
# color blue "//.*"
|
||||
# color blue start="/\*" end="\*/"
|
||||
# color brightblue start="/\*\*" end="\*/"
|
||||
# color brightgreen,green " +$"
|
||||
# color brightgreen,green "[[:space:]]+$"
|
||||
|
||||
## Here is an example for patch files
|
||||
##
|
||||
@@ -236,18 +271,44 @@
|
||||
# color brightyellow "^@@.*"
|
||||
# color magenta "^diff.*"
|
||||
|
||||
## Here is an example for manpages
|
||||
##
|
||||
# syntax "manpage" "\.[1-9]x?$"
|
||||
# color green "\.(S|T)H.*$"
|
||||
# color brightgreen "\.(S|T)H" "\.TP"
|
||||
# color brightred "\.(BR?|I[PR]?).*$"
|
||||
# color brightblue "\.(BR?|I[PR]?|PP)"
|
||||
# color brightwhite "\\f[BIPR]"
|
||||
# color yellow "\.(br|DS|RS|RE|PD)"
|
||||
|
||||
## Here is an example for assembler
|
||||
##
|
||||
# syntax "asm-file" "\.(S|s|asm)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# color brightgreen "\.(data|subsection|text)"
|
||||
# color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
|
||||
# color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
|
||||
# icolor brightred "^[[:space:]]*[._A-Z0-9]*:"
|
||||
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
## Highlight strings (note: VERY resource intensive)
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
|
||||
## Highlight comments
|
||||
# color brightblue "//.*"
|
||||
# color brightblue start="/\*" end="\*/"
|
||||
|
||||
## Here is an example for your .nanorc
|
||||
##
|
||||
#syntax "nanorc" "(\.|/|)nanorc$"
|
||||
# syntax "nanorc" "(\.|/|)nanorc$"
|
||||
## highlight possible errors and parameters
|
||||
#color brightwhite "^ *(set|unset|syntax|color).*$"
|
||||
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?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)\>"
|
||||
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quickblank|quotestr|rebinddelete)\>" "^[[:space:]]*(set|unset)[[:space:]]+(regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace)\>"
|
||||
# icolor green "^[[:space:]]*(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)="
|
||||
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
# icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
|
||||
## strings
|
||||
#color white "\"(\\.|[^\"])*\""
|
||||
# icolor white "\"(\\.|[^\"])*\""
|
||||
## comments
|
||||
#color blue "^ *#.*$"
|
||||
# icolor blue "^[[:space:]]*#.*$"
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
@c Run `makeinfo' rather than `texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.3.5
|
||||
@set UPDATED 6 Nov 2004
|
||||
@set VERSION 1.3.8
|
||||
@set UPDATED 27 Jun 2005
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.3.5
|
||||
@subtitle version 1.3.8
|
||||
|
||||
@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
|
||||
@@ -91,10 +91,10 @@ internationalization support, and filename tab completion.
|
||||
@node Overview, Command Line Options, Introduction, Introduction
|
||||
@section Overview
|
||||
|
||||
@code{nano} +LINE [GNU long option] [option] [ @var{file ...} ]
|
||||
@code{nano} +LINE,COLUMN [GNU long option] [option] [ @var{file ...} ]
|
||||
|
||||
The original goal for @code{nano} was a complete bug-for-bug compatible
|
||||
emulation of Pico, but nano's main goal is to be as compatible as
|
||||
emulation of Pico, but @code{nano}'s main goal is to be as compatible as
|
||||
possible while offering a superset of Pico's functionality. Also see
|
||||
@xref{Pico Compatibility}, for other differences.
|
||||
|
||||
@@ -106,6 +106,12 @@ Email bug reports to @email{nano@@nano-editor.org}.
|
||||
@code{nano} takes the following options from the command line:
|
||||
|
||||
@table @code
|
||||
@item +LINE,COLUMN
|
||||
Start at line number LINE and column number COLUMN instead of the
|
||||
default of line 1, column 1.
|
||||
|
||||
@item -?
|
||||
Same as @code{-h, --help}.
|
||||
|
||||
@item -A, --smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
@@ -118,10 +124,13 @@ line.
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
|
||||
@item -E, --backupdir=[dir]
|
||||
Set the directory where @code{nano} puts the backup files if file
|
||||
@item -C, --backupdir=[dir]
|
||||
Set the directory where @code{nano} puts unique backup files if file
|
||||
backups are enabled.
|
||||
|
||||
@item -E, --tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
|
||||
@item -F, --multibuffer
|
||||
Enable multiple file buffers, if available.
|
||||
|
||||
@@ -142,14 +151,23 @@ Set the quoting string for justifying. The default is
|
||||
if regular expression support is available, or ``> '' otherwise. Note
|
||||
that @code{\t} above stands for a literal Tab character.
|
||||
|
||||
@item -R, --regexp
|
||||
Turn on regular expression search and search/replace.
|
||||
@item -R, --restricted
|
||||
Restricted mode: Don't read or write to any file not specified on the
|
||||
command line, read any nanorc files, allow suspending, or allow a file
|
||||
to be appended to, prepended to, or saved under a different name if it
|
||||
already has one. Also accessible by invoking @code{nano} with any name
|
||||
beginning with 'r' (e.g. "rnano").
|
||||
|
||||
@item -S, --smooth
|
||||
Enable smooth scrolling.
|
||||
|
||||
@item -T [num], --tabsize=[#cols]
|
||||
Set the displayed tab length to [#cols] columns.
|
||||
Set the displayed tab length to #cols columns. The value of #cols must
|
||||
be greater than 0. The default value is 8.
|
||||
|
||||
@item -U, --quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25. Note that -c cancels this out.
|
||||
|
||||
@item -V, --version
|
||||
Print the version number and copyright and quit.
|
||||
@@ -158,15 +176,9 @@ Print the version number and copyright and quit.
|
||||
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||
available.
|
||||
|
||||
@item -Z, --restricted
|
||||
Restricted mode: Don't read or write to any file not specified on the
|
||||
command line, read any nanorc files, allow suspending, or allow a file
|
||||
to be appended to, prepended to, or saved under a different name if it
|
||||
already has one. Also accessible by invoking @code{nano} with any name
|
||||
beginning with 'r' (e.g. "rnano").
|
||||
|
||||
@item -c, --const
|
||||
Constantly display the cursor position and line number on the statusbar.
|
||||
Note that this cancels out -U.
|
||||
|
||||
@item -d, --rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
@@ -181,16 +193,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
|
||||
@@ -201,10 +212,10 @@ Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent to the
|
||||
editor can be can be stopped and started.
|
||||
|
||||
@item -r [#cols], --fill=[#cols].
|
||||
Wrap lines at column #cols. By default this is the width of the screen,
|
||||
less eight. If this value is negative, wrapping will occur at #cols
|
||||
from the right of the screen, allowing it to vary along with the screen
|
||||
width if the screen is resized.
|
||||
Wrap lines at column #cols. If this value is 0 or less, wrapping will
|
||||
occur at #cols less the width of the screen, allowing it to vary along
|
||||
with the width of the screen if the screen is resized. The default
|
||||
value is -8.
|
||||
|
||||
@item -s [prog], --speller=[prog]
|
||||
Invoke [prog] as the spell checker. By default, @code{nano} uses the
|
||||
@@ -241,9 +252,6 @@ keystroke (usually ^Z).
|
||||
|
||||
@item -a, -b, -e, -f, -g, -j
|
||||
Ignored, for compatibility with Pico.
|
||||
|
||||
@item +LINE
|
||||
Start at line number LINE instead of the default of line 1.
|
||||
@end table
|
||||
|
||||
@node Editor Basics, Online Help, Introduction, Top
|
||||
@@ -339,33 +347,53 @@ The following global toggles are available:
|
||||
|
||||
@table @code
|
||||
|
||||
@item Backup File Toggle (Meta-B)
|
||||
@item Backup Files Toggle (Meta-B)
|
||||
toggles the -B (@code{--backup}) command line flag.
|
||||
|
||||
@item Multiple Files Toggle (Meta-F)
|
||||
@item Constant Cursor Position Display Toggle (Meta-C)
|
||||
toggles the -c (@code{--const}) command line flag.
|
||||
|
||||
@item Multiple File Buffers Toggle (Meta-F)
|
||||
toggles the -F (@code{--multibuffer}) command line flag.
|
||||
|
||||
@item Backup File Toggle (Meta-H)
|
||||
@item Smart Home Key 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)
|
||||
toggles the -k (@code{--cut}) command line flag.
|
||||
|
||||
@item Auto Line Wrap Toggle (Meta-L)
|
||||
@item Long Line Wrapping Toggle (Meta-L)
|
||||
toggles the -w (@code{--nowrap}) command line flag.
|
||||
|
||||
@item Mouse Toggle (Meta-M)
|
||||
@item Mouse Support Toggle (Meta-M)
|
||||
toggles the -m (@code{--mouse}) command line flag.
|
||||
|
||||
@item No Conversion From DOS/Mac Format Toggle (Meta-N)
|
||||
toggles the -N (@code{--noconvert}) command line flag.
|
||||
|
||||
@item More Space For Editing Toggle (Meta-O)
|
||||
toggles the -O (@code{--morespace}) command line flag.
|
||||
|
||||
@item Whitespace Display Toggle (Meta-P)
|
||||
toggles whitespace display mode if you have a "whitespace" option in
|
||||
your .nanorc.
|
||||
|
||||
@item Tabs to Spaces Toggle (Meta-Q)
|
||||
toggles the -E (@code{--tabstospaces}) command line flag.
|
||||
|
||||
@item Smooth Scrolling Toggle (Meta-S)
|
||||
toggles the -S (@code{--smooth}) command line flag.
|
||||
|
||||
@item Expert/Nohelp Toggle (Meta-X)
|
||||
@item Expert/No Help Toggle (Meta-X)
|
||||
toggles the -x (@code{--nohelp}) command line flag.
|
||||
|
||||
@item Color Syntax Highlighting Toggle (Meta-Y)
|
||||
toggles color syntax highlighting if you have color syntaxes in your
|
||||
.nanorc.
|
||||
|
||||
@item Suspend Toggle (Meta-Z)
|
||||
toggles the -z (@code{--suspend}) command line flag.
|
||||
|
||||
@@ -444,7 +472,8 @@ Building @code{nano} from source is fairly straightforward if you are
|
||||
familiar with compiling programs with autoconf support:
|
||||
|
||||
@itemize @bullet
|
||||
@item tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of nano)
|
||||
@item tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of
|
||||
@code{nano})
|
||||
@item cd nano-x.y.z/
|
||||
@item ./configure
|
||||
@item make
|
||||
@@ -497,9 +526,8 @@ Disables Native Language support. This will make the available GNU
|
||||
@code{nano} translations unusable.
|
||||
|
||||
@item --with-slang
|
||||
Compiling GNU @code{nano} with Slang is supported, and will make the
|
||||
binary notably smaller than if compiled with ncurses or other curses
|
||||
libraries.
|
||||
Compiling @code{nano} with Slang is supported, and will make the binary
|
||||
notably smaller than if compiled with ncurses or other curses libraries.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
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 glib-2.0.m4
|
||||
EXTRA_DIST = codeset.m4 gettext.m4 glib-2.0.m4 glibc21.m4 iconv.m4 \
|
||||
intdiv0.m4 inttypes_h.m4 inttypes.m4 inttypes-pri.m4 \
|
||||
isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 \
|
||||
lib-prefix.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 \
|
||||
ulonglong.m4
|
||||
|
||||
119
po/ChangeLog
119
po/ChangeLog
@@ -1,3 +1,120 @@
|
||||
2005-06-28 David Lawrence Ramsey <pooka_regent@sluggy.net>
|
||||
|
||||
* POTFILES.in: Remove source files that contain no translatable
|
||||
strings.
|
||||
|
||||
2005-06-19 David Lawrence Ramsey <pooka_regent@sluggy.net>
|
||||
|
||||
* pt_BR.po: Typo fix.
|
||||
|
||||
2005-06-15 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* de.po: Typo fix by Jens Seidel.
|
||||
|
||||
2005-05-23 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by
|
||||
Jean-Philippe Guérard.
|
||||
|
||||
2005-04-27 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by
|
||||
Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2005-04-22 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Norwegian bokmål translation by
|
||||
Geir Helland.
|
||||
|
||||
2005-04-20 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by
|
||||
Sharuzzaman Ahmat Raslan.
|
||||
* ro.po: Updated Romanian translation by Laurentiu Buzdugan.
|
||||
* zh_TW.po: Updated Traditional Chinese translation by
|
||||
CHAO Wei-Lun.
|
||||
|
||||
2005-04-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* vi.po: Updated Vietnamese translation by Phan Vinh Thinh.
|
||||
|
||||
2005-04-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* ro.po: Updated Romanian translation by Laurentiu Buzdugan.
|
||||
|
||||
2005-04-14 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* es.po: Updated Spanish translation by
|
||||
Ricardo Javier Cárdenes Medina.
|
||||
|
||||
2005-04-13 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* vi.po: New Vietnamese translation by Phan Vinh Thinh.
|
||||
* LINGUAS: Added "vi".
|
||||
|
||||
2005-04-09 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* zh_TW.po: Added Plural-Forms header and fix format specification
|
||||
typos.
|
||||
|
||||
2005-04-08 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* zh_TW.po: Updated Traditional Chinese translation by
|
||||
CHAO Wei-Lun.
|
||||
|
||||
2005-04-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* rw.po: New Kinyarwanda translation by Steve Murphy.
|
||||
* LINGUAS: Added "rw".
|
||||
|
||||
2005-04-05 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by
|
||||
Jean-Philippe Guérard.
|
||||
* ro.po: Updated Romanian translation by
|
||||
Laurentiu Buzdugan.
|
||||
|
||||
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
|
||||
@@ -15,7 +132,7 @@
|
||||
|
||||
2004-08-31 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation by
|
||||
* es.po: Updated Spanish translation by
|
||||
Ricardo Javier Cárdenes Medina.
|
||||
|
||||
2004-08-31 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru sr sv tr uk zh_TW
|
||||
ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk vi zh_TW
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
# $Id$
|
||||
# List of source files containing translatable strings.
|
||||
|
||||
# Package source files
|
||||
src/cut.c
|
||||
src/files.c
|
||||
src/global.c
|
||||
src/move.c
|
||||
src/nano.c
|
||||
src/rcfile.c
|
||||
src/search.c
|
||||
src/utils.c
|
||||
src/winio.c
|
||||
|
||||
# Package header files
|
||||
src/nano.h
|
||||
src/proto.h
|
||||
|
||||
2
po/de.po
2
po/de.po
@@ -174,7 +174,7 @@ msgstr "Dateiname zum Speichern"
|
||||
|
||||
#: src/files.c:1910
|
||||
msgid "File exists, OVERWRITE ? "
|
||||
msgstr "Datei exisitiert, ÜBERSCHREIBEN? "
|
||||
msgstr "Datei existiert, ÜBERSCHREIBEN? "
|
||||
|
||||
#: src/files.c:1923
|
||||
msgid "Save file under DIFFERENT NAME ? "
|
||||
|
||||
2463
po/pt_BR.po
2463
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
15
po/update.pl
15
po/update.pl
@@ -5,19 +5,20 @@
|
||||
#
|
||||
# Copyright (C) 2000 Free Software Foundation.
|
||||
#
|
||||
# This script 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 script 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 script is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# This script is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
#
|
||||
# Authors: Kenneth Christiansen <kenneth@gnu.org>
|
||||
#
|
||||
|
||||
2075
po/zh_TW.po
2075
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,8 @@ 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 \
|
||||
@@ -20,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
|
||||
|
||||
863
src/chars.c
Normal file
863
src/chars.c
Normal file
@@ -0,0 +1,863 @@
|
||||
/* $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., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef HAVE_WCHAR_H
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
#ifdef HAVE_WCTYPE_H
|
||||
#include <wctype.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ISBLANK
|
||||
/* This function is equivalent to isblank(). */
|
||||
bool nisblank(int c)
|
||||
{
|
||||
return isspace(c) && (c == '\t' || !is_cntrl_char(c));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_ISWBLANK) && defined(NANO_WIDE)
|
||||
/* This function is equivalent to iswblank(). */
|
||||
bool niswblank(wchar_t wc)
|
||||
{
|
||||
return iswspace(wc) && (wc == '\t' || !is_cntrl_wchar(wc));
|
||||
}
|
||||
#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() for multibyte characters. */
|
||||
bool is_alnum_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_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 iswalnum(wc);
|
||||
} else
|
||||
#endif
|
||||
return isalnum((unsigned char)*c);
|
||||
}
|
||||
|
||||
/* This function is equivalent to isblank() for multibyte characters. */
|
||||
bool is_blank_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_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 iswblank(wc);
|
||||
} else
|
||||
#endif
|
||||
return isblank((unsigned char)*c);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
/* 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(USE_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);
|
||||
}
|
||||
|
||||
/* This function is equivalent to ispunct() for multibyte characters. */
|
||||
bool is_punct_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_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 iswpunct(wc);
|
||||
} else
|
||||
#endif
|
||||
return ispunct((unsigned char)*c);
|
||||
}
|
||||
|
||||
/* Return TRUE for a multibyte character found in a word (currently only
|
||||
* an alphanumeric or punctuation character, and only the latter if
|
||||
* allow_punct is TRUE) and FALSE otherwise. */
|
||||
bool is_word_mbchar(const char *c, bool allow_punct)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
return is_alnum_mbchar(c) || (allow_punct ? is_punct_mbchar(c) :
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/* c is a control character. It displays as ^@, ^?, or ^[ch], where ch
|
||||
* is c + 64. We return that character. */
|
||||
char control_rep(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;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
/* 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 && crep != NULL && crep_len != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
*crep_len = wctomb(crep, control_wrep(wc));
|
||||
|
||||
if (*crep_len <= 0) {
|
||||
wctomb(NULL, 0);
|
||||
*crep_len = 0;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
*crep_len = 1;
|
||||
*crep = control_rep(*c);
|
||||
#ifdef NANO_WIDE
|
||||
}
|
||||
#endif
|
||||
|
||||
return crep;
|
||||
}
|
||||
|
||||
/* This function is equivalent to wcwidth() for multibyte characters. */
|
||||
int mbwidth(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_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(USE_UTF8) ? MB_CUR_MAX :
|
||||
#endif
|
||||
1;
|
||||
}
|
||||
|
||||
/* Convert the value in chr to a multibyte character with the same
|
||||
* wide character value as chr, if possible. If the conversion
|
||||
* succeeds, return the (dynamically allocated) multibyte character and
|
||||
* its length. Otherwise, return an undefined (dynamically allocated)
|
||||
* multibyte character and a length of zero. */
|
||||
char *make_mbchar(int chr, int *chr_mb_len)
|
||||
{
|
||||
char *chr_mb;
|
||||
|
||||
assert(chr_mb_len != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_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 = mallocstrncpy(NULL, (char *)&chr, 1);
|
||||
#ifdef NANO_WIDE
|
||||
}
|
||||
#endif
|
||||
|
||||
return chr_mb;
|
||||
}
|
||||
|
||||
/* 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(USE_UTF8)) {
|
||||
/* Get the number of bytes in the multibyte character. */
|
||||
buf_mb_len = mblen(buf, MB_CUR_MAX);
|
||||
|
||||
/* If buf contains a null byte or an invalid multibyte
|
||||
* character, set bad_chr to TRUE (if it contains the latter)
|
||||
* and interpret buf's first byte. */
|
||||
if (buf_mb_len <= 0) {
|
||||
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(buf != NULL && pos <= strlen(buf));
|
||||
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. Here is the naive, O(pos) way to do it. */
|
||||
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(USE_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') {
|
||||
bool bad_s1_mb = FALSE, bad_s2_mb = FALSE;
|
||||
int s1_mb_len, s2_mb_len;
|
||||
|
||||
s1_mb_len = parse_mbchar(s1, s1_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&ws1, s1_mb, s1_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws1 = (unsigned char)*s1_mb;
|
||||
bad_s1_mb = TRUE;
|
||||
}
|
||||
|
||||
s2_mb_len = parse_mbchar(s2, s2_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&ws2, s2_mb, s2_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws2 = (unsigned char)*s2_mb;
|
||||
bad_s2_mb = TRUE;
|
||||
}
|
||||
|
||||
if (n == 0 || bad_s1_mb != bad_s2_mb ||
|
||||
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(USE_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') {
|
||||
bool bad_r_mb = FALSE, bad_q_mb = FALSE;
|
||||
|
||||
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;
|
||||
bad_r_mb = TRUE;
|
||||
}
|
||||
|
||||
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;
|
||||
bad_q_mb = TRUE;
|
||||
}
|
||||
|
||||
if (bad_r_mb != bad_q_mb ||
|
||||
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 /* !NANO_SMALL || !DISABLE_TABCOMP */
|
||||
|
||||
#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(USE_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') {
|
||||
bool bad_r_mb = FALSE, bad_q_mb = FALSE;
|
||||
|
||||
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;
|
||||
bad_r_mb = TRUE;
|
||||
}
|
||||
|
||||
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;
|
||||
bad_q_mb = TRUE;
|
||||
}
|
||||
|
||||
if (bad_r_mb != bad_q_mb ||
|
||||
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 /* !NANO_SMALL */
|
||||
|
||||
/* 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(USE_UTF8)) {
|
||||
size_t n = 0;
|
||||
int s_mb_len;
|
||||
|
||||
while (*s != '\0') {
|
||||
s_mb_len = parse_mbchar(s, NULL, NULL, NULL);
|
||||
|
||||
if (maxlen == 0)
|
||||
break;
|
||||
|
||||
maxlen--;
|
||||
s += s_mb_len;
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
} else
|
||||
#endif
|
||||
return strnlen(s, maxlen);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Return TRUE if the string s contains one or more blank characters,
|
||||
* and FALSE otherwise. */
|
||||
bool has_blank_chars(const char *s)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
for (; *s != '\0'; s++) {
|
||||
if (isblank(*s))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Return TRUE if the multibyte string s contains one or more blank
|
||||
* multibyte characters, and FALSE otherwise. */
|
||||
bool has_blank_mbchars(const char *s)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *chr_mb = charalloc(MB_CUR_MAX);
|
||||
bool retval = FALSE;
|
||||
|
||||
while (*s != '\0') {
|
||||
int chr_mb_len;
|
||||
|
||||
chr_mb_len = parse_mbchar(s, chr_mb, NULL, NULL);
|
||||
|
||||
if (is_blank_mbchar(chr_mb)) {
|
||||
retval = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
s += chr_mb_len;
|
||||
}
|
||||
|
||||
free(chr_mb);
|
||||
|
||||
return retval;
|
||||
} else
|
||||
#endif
|
||||
return has_blank_chars(s);
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* This function is equivalent to strchr() for multibyte strings. */
|
||||
char *mbstrchr(const char *s, char *c)
|
||||
{
|
||||
assert(s != NULL && c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *s_mb = charalloc(MB_CUR_MAX);
|
||||
const char *q = s;
|
||||
wchar_t ws, wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
while (*s != '\0') {
|
||||
int s_mb_len = parse_mbchar(s, s_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&ws, s_mb, s_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws = (unsigned char)*s;
|
||||
}
|
||||
|
||||
if (ws == wc)
|
||||
break;
|
||||
|
||||
s += s_mb_len;
|
||||
q += s_mb_len;
|
||||
}
|
||||
|
||||
free(s_mb);
|
||||
|
||||
if (ws != wc)
|
||||
q = NULL;
|
||||
|
||||
return (char *)q;
|
||||
} else
|
||||
#endif
|
||||
return strchr(s, *c);
|
||||
}
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Check if the string s is a valid multibyte string. Return TRUE if it
|
||||
* is, and FALSE otherwise. */
|
||||
bool is_valid_mbstring(const char *s)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
return
|
||||
#ifdef NANO_WIDE
|
||||
ISSET(USE_UTF8) ?
|
||||
(mbstowcs(NULL, s, 0) != (size_t)-1) :
|
||||
#endif
|
||||
|
||||
TRUE;
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
47
src/color.c
47
src/color.c
@@ -2,20 +2,21 @@
|
||||
/**************************************************************************
|
||||
* 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) *
|
||||
* 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. *
|
||||
* 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. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -29,7 +30,6 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
@@ -46,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;
|
||||
@@ -68,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;
|
||||
@@ -91,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
|
||||
}
|
||||
}
|
||||
@@ -104,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;
|
||||
|
||||
@@ -117,11 +118,11 @@ 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) {
|
||||
if (strcasecmp(tmpsyntax->desc, syntaxstr) == 0)
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (mbstrcasecmp(tmpsyntax->desc, syntaxstr) == 0)
|
||||
colorstrings = tmpsyntax->color;
|
||||
}
|
||||
}
|
||||
|
||||
505
src/cut.c
505
src/cut.c
@@ -2,20 +2,21 @@
|
||||
/**************************************************************************
|
||||
* 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) *
|
||||
* 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. *
|
||||
* 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. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -28,16 +29,9 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
static bool keep_cutbuffer = FALSE;
|
||||
/* Should we keep the contents of the cutbuffer? */
|
||||
static cut_type marked_cut = CUT_LINE;
|
||||
/* What type of cut is in the cutbuffer? */
|
||||
#ifndef NANO_SMALL
|
||||
static bool concatenate_cut = FALSE;
|
||||
/* Should we add this cut string to the end of the last one? */
|
||||
#endif
|
||||
static filestruct *cutbottom = NULL;
|
||||
/* Pointer to end of cutbuffer. */
|
||||
|
||||
@@ -46,444 +40,155 @@ 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, and set the current
|
||||
* place we want to where the line used to start. */
|
||||
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) {
|
||||
/* If allow_concat is TRUE and we're concatenating, tack the
|
||||
* text in inptr onto the text in cutbottom. */
|
||||
cutbottom->data = charealloc(cutbottom->data,
|
||||
strlen(cutbottom->data) + strlen(inptr->data) + 1);
|
||||
strcat(cutbottom->data, inptr->data);
|
||||
return;
|
||||
if (current->next != NULL) {
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, 0,
|
||||
current->next, 0);
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
cutbottom->next = inptr;
|
||||
inptr->prev = cutbottom;
|
||||
}
|
||||
cutbottom = inptr;
|
||||
cutbottom->next = NULL;
|
||||
}
|
||||
|
||||
#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, NULL);
|
||||
(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 {
|
||||
if (concatenate_cut) {
|
||||
/* If we're concatenating, tack the text in the first line
|
||||
* of tmp onto the text in the bottom of the cutbuffer, and
|
||||
* move tmp one line down to where its next line begins. */
|
||||
cutbottom->data = charealloc(cutbottom->data,
|
||||
strlen(cutbottom->data) + strlen(tmp->data) + 1);
|
||||
strcat(cutbottom->data, tmp->data);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
/* Put tmp on the line after the bottom of the cutbuffer. */
|
||||
cutbottom->next = tmp;
|
||||
|
||||
if (!concatenate_cut) {
|
||||
/* Tf we're not concatenating, attach tmp to the bottom of
|
||||
* the cutbuffer, and then move the bottom of the cutbuffer
|
||||
* one line down to where tmp is. */
|
||||
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 it isn't the magicline,
|
||||
* move all the text from the current position up to the
|
||||
* beginning of the next line, i.e, the newline at the end, to
|
||||
* the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
current->next, 0);
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* Move text from the current filestruct into the cutbuffer. */
|
||||
void do_cut_text(void)
|
||||
{
|
||||
filestruct *fileptr;
|
||||
|
||||
assert(current != NULL && current->data != NULL);
|
||||
|
||||
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 = CUT_LINE;
|
||||
#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 <= 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 != CUT_MARKED && current->next != filebot) {
|
||||
filestruct *junk = make_new_node(current);
|
||||
|
||||
junk->data = mallocstrcpy(NULL, "");
|
||||
add_to_cutbuffer(junk, TRUE);
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
do_delete();
|
||||
marked_cut = CUT_TO_EOL;
|
||||
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 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
|
||||
#endif
|
||||
/* Otherwise, move the entire line into the cutbuffer. */
|
||||
cut_line();
|
||||
|
||||
marked_cut = CUT_MARKED;
|
||||
concatenate_cut = TRUE;
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
return;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
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 = CUT_LINE;
|
||||
#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 /* !NANO_SMALL */
|
||||
|
||||
/* 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_statusblank();
|
||||
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 == CUT_LINE) {
|
||||
if (current_x > 0)
|
||||
marked_cut = CUT_TO_EOL;
|
||||
else
|
||||
placewewant = 0;
|
||||
}
|
||||
|
||||
/* 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 == CUT_LINE || 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 != CUT_LINE) {
|
||||
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();
|
||||
}
|
||||
|
||||
/* Recalculate current_y and totsize. */
|
||||
for (tmp = current->next; tmp != newend; tmp = tmp->next) {
|
||||
current_y++;
|
||||
totsize += strlen(tmp->data) + 1;
|
||||
}
|
||||
|
||||
current = newend;
|
||||
}
|
||||
|
||||
/* If we're doing a cut to end, 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 == CUT_TO_EOL) {
|
||||
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;
|
||||
/* Add a copy of the text in the cutbuffer to the current filestruct
|
||||
* at the current cursor position. */
|
||||
copy_from_filestruct(cutbuffer, cutbottom);
|
||||
|
||||
totlines++; /* Unmarked uncuts don't split lines. */
|
||||
/* Set the current place we want to where the text from the
|
||||
* cutbuffer ends. */
|
||||
placewewant = xplustabs();
|
||||
|
||||
/* This is so uncutting at the top of the buffer will work => */
|
||||
if (current_y == 0)
|
||||
edittop = newbuf;
|
||||
|
||||
/* Connect the end of the buffer to the filestruct. */
|
||||
newend->next = current;
|
||||
current->prev = newend;
|
||||
|
||||
/* Recalculate current_y and totsize. */
|
||||
for (tmp = newbuf; tmp != current; tmp = tmp->next) {
|
||||
current_y++;
|
||||
totsize += strlen(tmp->data) + 1;
|
||||
}
|
||||
|
||||
renumber(newbuf);
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer_reverse();
|
||||
#endif
|
||||
|
||||
set_modified();
|
||||
}
|
||||
|
||||
2577
src/files.c
2577
src/files.c
File diff suppressed because it is too large
Load Diff
428
src/global.c
428
src/global.c
@@ -2,20 +2,21 @@
|
||||
/**************************************************************************
|
||||
* 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) *
|
||||
* 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. *
|
||||
* 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. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -26,7 +27,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
/* Global variables */
|
||||
|
||||
@@ -38,11 +38,10 @@ ssize_t wrap_at = -CHARS_FROM_EOL; /* Right justified fill value,
|
||||
|
||||
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 */
|
||||
|
||||
@@ -55,7 +54,7 @@ int editwinrows = 0; /* How many rows long is the edit
|
||||
filestruct *current; /* Current buffer pointer */
|
||||
size_t current_x = 0; /* Current x-coordinate in the edit
|
||||
window */
|
||||
int current_y = 0; /* Current y-coordinate in the edit
|
||||
ssize_t 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
|
||||
@@ -63,17 +62,22 @@ filestruct *edittop = NULL; /* Pointer to the top of the edit
|
||||
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
|
||||
@@ -98,8 +102,9 @@ char *backup_dir = NULL; /* Backup directory. */
|
||||
#endif
|
||||
|
||||
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 totlines = 0; /* Total number of lines 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 */
|
||||
@@ -155,21 +160,22 @@ 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;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype search_history;
|
||||
historyheadtype replace_history;
|
||||
filestruct *search_history = NULL;
|
||||
filestruct *searchage = NULL;
|
||||
filestruct *searchbot = NULL;
|
||||
filestruct *replace_history = NULL;
|
||||
filestruct *replaceage = NULL;
|
||||
filestruct *replacebot = NULL;
|
||||
#endif
|
||||
|
||||
/* Regular expressions */
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
regex_t search_regexp; /* Global to store compiled search regexp */
|
||||
regmatch_t regmatches[10]; /* Match positions for parenthetical
|
||||
@@ -180,9 +186,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)
|
||||
{
|
||||
@@ -198,7 +202,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;
|
||||
@@ -237,6 +241,10 @@ void shortcut_init(bool unjustify)
|
||||
const char *cancel_msg = N_("Cancel");
|
||||
const char *first_line_msg = N_("First Line");
|
||||
const char *last_line_msg = N_("Last Line");
|
||||
const char *refresh_msg = N_("Refresh");
|
||||
#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");
|
||||
@@ -244,42 +252,48 @@ void shortcut_init(bool unjustify)
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
const char *case_sens_msg = N_("Case Sens");
|
||||
const char *direction_msg = N_("Direction");
|
||||
const char *backwards_msg = N_("Backwards");
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *regexp_msg = N_("Regexp");
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
const char *history_msg = N_("History");
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *new_buffer_msg = N_("New Buffer");
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
const char *to_files_msg = N_("To Files");
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
const char *nano_help_msg = N_("Invoke the help menu");
|
||||
const char *nano_exit_msg =
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
N_("Close currently loaded file/Exit from nano")
|
||||
N_("Close the current file buffer/Exit from nano")
|
||||
#else
|
||||
N_("Exit from nano")
|
||||
#endif
|
||||
;
|
||||
const char *nano_writeout_msg = N_("Write the current file to disk");
|
||||
const char *nano_writeout_msg =
|
||||
N_("Write the current file to disk");
|
||||
const char *nano_justify_msg = N_("Justify the current paragraph");
|
||||
const char *nano_insert_msg =
|
||||
N_("Insert another file into the current one");
|
||||
const char *nano_whereis_msg = N_("Search for text within the editor");
|
||||
const char *nano_whereis_msg =
|
||||
N_("Search for text within the editor");
|
||||
const char *nano_prevpage_msg = N_("Move to the previous screen");
|
||||
const char *nano_nextpage_msg = N_("Move to the next screen");
|
||||
const char *nano_cut_msg =
|
||||
N_("Cut the current line and store it in the cutbuffer");
|
||||
const char *nano_uncut_msg =
|
||||
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_gotoline_msg = N_("Go to a specific line number");
|
||||
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_gotoline_msg =
|
||||
N_("Go to a specific line number and column 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");
|
||||
@@ -289,10 +303,14 @@ void shortcut_init(bool unjustify)
|
||||
const char *nano_nextline_msg = N_("Move to the next line");
|
||||
const char *nano_forward_msg = N_("Move forward one character");
|
||||
const char *nano_back_msg = N_("Move back one character");
|
||||
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_delete_msg = N_("Delete the character under the cursor");
|
||||
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_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 =
|
||||
@@ -302,6 +320,8 @@ void shortcut_init(bool unjustify)
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_nextword_msg = N_("Move forward one word");
|
||||
const char *nano_prevword_msg = N_("Move backward one word");
|
||||
const char *nano_wordcount_msg =
|
||||
N_("Count the number of words in the file");
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *nano_parabegin_msg =
|
||||
@@ -310,10 +330,16 @@ void shortcut_init(bool unjustify)
|
||||
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");
|
||||
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
|
||||
@@ -321,20 +347,23 @@ void shortcut_init(bool unjustify)
|
||||
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");
|
||||
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");
|
||||
const char *nano_reverse_msg =
|
||||
N_("Make the current search/replace go backwards");
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *nano_regexp_msg = N_("Use regular expressions");
|
||||
#endif
|
||||
const char *nano_editstr_msg =
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_history_msg =
|
||||
N_("Edit the previous search/replace strings");
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
const char *nano_tofiles_msg = N_("Go to file browser");
|
||||
#endif
|
||||
@@ -345,10 +374,11 @@ void shortcut_init(bool unjustify)
|
||||
const char *nano_append_msg = N_("Append to the current file");
|
||||
const char *nano_prepend_msg = N_("Prepend to the current file");
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_backup_msg = N_("Back up original file when saving");
|
||||
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
|
||||
@@ -361,9 +391,9 @@ void shortcut_init(bool unjustify)
|
||||
* point is that sc_init_one() takes 9 arguments, unless DISABLE_HELP is
|
||||
* defined, when the 4th one should not be there. */
|
||||
#ifndef DISABLE_HELP
|
||||
# define IFHELP(help, nextvar) help, nextvar
|
||||
#define IFHELP(help, nextvar) help, nextvar
|
||||
#else
|
||||
# define IFHELP(help, nextvar) nextvar
|
||||
#define IFHELP(help, nextvar) nextvar
|
||||
#endif
|
||||
|
||||
free_shortcutage(&main_list);
|
||||
@@ -379,19 +409,14 @@ void shortcut_init(bool 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"),
|
||||
@@ -450,7 +475,7 @@ void shortcut_init(bool 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"),
|
||||
@@ -476,7 +501,8 @@ void shortcut_init(bool unjustify)
|
||||
|
||||
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);
|
||||
NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW,
|
||||
do_gotolinecolumn_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg,
|
||||
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
||||
@@ -485,7 +511,7 @@ void shortcut_init(bool unjustify)
|
||||
#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);
|
||||
NANO_NO_KEY, VIEW, do_mark);
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"),
|
||||
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
|
||||
@@ -516,7 +542,7 @@ void shortcut_init(bool unjustify)
|
||||
IFHELP(nano_end_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_end);
|
||||
|
||||
sc_init_one(&main_list, NANO_REFRESH_KEY, N_("Refresh"),
|
||||
sc_init_one(&main_list, NANO_REFRESH_KEY, refresh_msg,
|
||||
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, total_refresh);
|
||||
|
||||
@@ -539,23 +565,27 @@ void shortcut_init(bool unjustify)
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&main_list, NANO_NEXTWORD_KEY, N_("Next Word"),
|
||||
IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_next_word);
|
||||
NANO_NO_KEY, VIEW, do_next_word_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Prev Word"),
|
||||
IFHELP(nano_prevword_msg, NANO_PREVWORD_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_prev_word);
|
||||
NANO_NO_KEY, VIEW, do_prev_word_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Word Count"),
|
||||
IFHELP(nano_wordcount_msg, NANO_WORDCOUNT_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_word_count);
|
||||
#endif
|
||||
|
||||
#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);
|
||||
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);
|
||||
NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
@@ -572,6 +602,13 @@ void shortcut_init(bool unjustify)
|
||||
IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, do_verbatim_input);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* 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,
|
||||
@@ -600,7 +637,7 @@ void shortcut_init(bool 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,
|
||||
@@ -615,47 +652,55 @@ void shortcut_init(bool unjustify)
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
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_TOGOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
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, beg_of_par_msg,
|
||||
IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin);
|
||||
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, end_of_par_msg,
|
||||
IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARAEND_ALTKEY2, VIEW, do_para_end);
|
||||
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,
|
||||
sc_init_one(&whereis_list, NANO_NO_KEY, backwards_msg,
|
||||
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#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);
|
||||
IFHELP(nano_regexp_msg, NANO_REGEXP_KEY), NANO_NO_KEY,
|
||||
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);
|
||||
sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg,
|
||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
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
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
@@ -663,7 +708,6 @@ void shortcut_init(bool unjustify)
|
||||
IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
free_shortcutage(&replace_list);
|
||||
|
||||
@@ -679,7 +723,7 @@ void shortcut_init(bool 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,
|
||||
@@ -692,31 +736,33 @@ void shortcut_init(bool unjustify)
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
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_TOGOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
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,
|
||||
sc_init_one(&replace_list, NANO_NO_KEY, backwards_msg,
|
||||
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#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);
|
||||
IFHELP(nano_regexp_msg, NANO_REGEXP_KEY), NANO_NO_KEY,
|
||||
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);
|
||||
#endif /* !NANO_SMALL */
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg,
|
||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&replace_list_2);
|
||||
|
||||
@@ -732,7 +778,7 @@ void shortcut_init(bool 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,
|
||||
@@ -743,9 +789,9 @@ void shortcut_init(bool unjustify)
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
#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);
|
||||
sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, history_msg,
|
||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&gotoline_list);
|
||||
@@ -762,7 +808,7 @@ void shortcut_init(bool unjustify)
|
||||
|
||||
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(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
@@ -774,30 +820,34 @@ void shortcut_init(bool unjustify)
|
||||
|
||||
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, do_search);
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
sc_init_one(&help_list, NANO_REFRESH_KEY, refresh_msg,
|
||||
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);
|
||||
|
||||
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, 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, 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, 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, NULL);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&writefile_list);
|
||||
@@ -814,7 +864,7 @@ void shortcut_init(bool 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.
|
||||
@@ -823,7 +873,7 @@ void shortcut_init(bool 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
|
||||
@@ -837,33 +887,33 @@ void shortcut_init(bool 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);
|
||||
@@ -880,7 +930,7 @@ void shortcut_init(bool 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.
|
||||
@@ -888,7 +938,7 @@ void shortcut_init(bool 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
|
||||
@@ -898,7 +948,7 @@ void shortcut_init(bool unjustify)
|
||||
if (!ISSET(RESTRICTED))
|
||||
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, 0);
|
||||
NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* If we're using restricted mode, the multibuffer toggle is
|
||||
@@ -907,7 +957,7 @@ void shortcut_init(bool unjustify)
|
||||
if (!ISSET(RESTRICTED))
|
||||
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, 0);
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -926,7 +976,7 @@ void shortcut_init(bool 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
|
||||
@@ -944,16 +994,16 @@ void shortcut_init(bool 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, 0);
|
||||
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, 0);
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -972,20 +1022,20 @@ void shortcut_init(bool 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);
|
||||
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
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, 0);
|
||||
NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
free_shortcutage(&gotodir_list);
|
||||
|
||||
@@ -1001,12 +1051,11 @@ void shortcut_init(bool 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
|
||||
@@ -1016,6 +1065,7 @@ void shortcut_init(bool unjustify)
|
||||
void free_shortcutage(shortcut **shortcutage)
|
||||
{
|
||||
assert(shortcutage != NULL);
|
||||
|
||||
while (*shortcutage != NULL) {
|
||||
shortcut *ps = *shortcutage;
|
||||
*shortcutage = (*shortcutage)->next;
|
||||
@@ -1054,60 +1104,56 @@ void toggle_init(void)
|
||||
return;
|
||||
|
||||
toggle_init_one(TOGGLE_NOHELP_KEY, N_("Help mode"), NO_HELP);
|
||||
toggle_init_one(TOGGLE_MORESPACE_KEY,
|
||||
N_("Use of more space for editing"), MORE_SPACE);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* 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);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_CONST_KEY, N_("Constant cursor position"),
|
||||
CONSTUPDATE);
|
||||
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);
|
||||
toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
|
||||
N_("Multiple file buffers"), MULTIBUFFER);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_CUTTOEND_KEY, N_("Cut to end"), CUT_TO_END);
|
||||
#ifndef DISABLE_WRAPPING
|
||||
toggle_init_one(TOGGLE_WRAP_KEY, N_("Long line wrapping"),
|
||||
NO_WRAP);
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE);
|
||||
#endif
|
||||
/* If we're using restricted mode, the suspend toggle is disabled.
|
||||
* It's useless since suspending is disabled. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
toggle_init_one(TOGGLE_SUSPEND_KEY, N_("Suspend"), SUSPEND);
|
||||
#ifndef DISABLE_MOUSE
|
||||
toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE);
|
||||
#endif
|
||||
/* If we're using restricted mode, the no-conversion and backup
|
||||
* backup toggles are disabled. The former is useless since
|
||||
* inserting files is disabled, and the latter is useless since
|
||||
* backups are disabled. */
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
toggle_init_one(TOGGLE_CONST_KEY,
|
||||
N_("Constant cursor position display"), CONST_UPDATE);
|
||||
toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"),
|
||||
AUTOINDENT);
|
||||
toggle_init_one(TOGGLE_TABSTOSPACES_KEY,
|
||||
N_("Conversion of typed tabs to spaces"), TABS_TO_SPACES);
|
||||
/* 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_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"),
|
||||
SMOOTH_SCROLL);
|
||||
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
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Deallocate all of the toggles. */
|
||||
void free_toggles(void)
|
||||
{
|
||||
while (toggles != NULL) {
|
||||
toggle *pt = toggles; /* Think "previous toggle". */
|
||||
|
||||
toggles = toggles->next;
|
||||
free(pt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* This function is called just before calling exit(). Practically, the
|
||||
@@ -1127,7 +1173,8 @@ void thanks_for_all_the_fish(void)
|
||||
free(quotestr);
|
||||
#ifdef HAVE_REGEX_H
|
||||
regfree("ereg);
|
||||
free(quoteerr);
|
||||
if (quoteerr != NULL)
|
||||
free(quoteerr);
|
||||
#endif
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
@@ -1160,7 +1207,10 @@ 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);
|
||||
@@ -1181,24 +1231,31 @@ void thanks_for_all_the_fish(void)
|
||||
free_shortcutage(&browser_list);
|
||||
free_shortcutage(&gotodir_list);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
free_toggles();
|
||||
#endif
|
||||
/* Free the memory associated with each toggle. */
|
||||
while (toggles != NULL) {
|
||||
toggle *t = toggles;
|
||||
|
||||
toggles = toggles->next;
|
||||
free(t);
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Free the memory associated with each open file buffer. */
|
||||
if (open_files != NULL) {
|
||||
/* We free the memory associated with each open file. */
|
||||
while (open_files->prev != NULL)
|
||||
open_files = open_files->prev;
|
||||
/* Make sure open_files->fileage is up to date, in case we've
|
||||
* cut the top line of the file. */
|
||||
open_files->fileage = fileage;
|
||||
|
||||
free_openfilestruct(open_files);
|
||||
}
|
||||
#else
|
||||
free_filestruct(fileage);
|
||||
if (fileage != NULL)
|
||||
free_filestruct(fileage);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
free(syntaxstr);
|
||||
if (syntaxstr != NULL)
|
||||
free(syntaxstr);
|
||||
while (syntaxes != NULL) {
|
||||
syntaxtype *bill = syntaxes;
|
||||
|
||||
@@ -1225,12 +1282,15 @@ void thanks_for_all_the_fish(void)
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
#ifndef NANO_SMALL
|
||||
/* free history lists */
|
||||
free_history(&search_history);
|
||||
free_history(&replace_history);
|
||||
/* Free the search and replace history lists. */
|
||||
if (searchage != NULL)
|
||||
free_filestruct(searchage);
|
||||
if (replaceage != NULL)
|
||||
free_filestruct(replaceage);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
free(homedir);
|
||||
if (homedir != NULL)
|
||||
free(homedir);
|
||||
#endif
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
77
src/move.c
77
src/move.c
@@ -2,20 +2,21 @@
|
||||
/**************************************************************************
|
||||
* 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) *
|
||||
* 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. *
|
||||
* 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. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -28,41 +29,39 @@
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
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))
|
||||
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))
|
||||
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)) {
|
||||
size_t 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();
|
||||
@@ -74,24 +73,24 @@ void do_home(void)
|
||||
}
|
||||
#endif
|
||||
check_statusblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
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_statusblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
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
|
||||
@@ -108,7 +107,7 @@ void do_page_up(void)
|
||||
/* If we're in smooth scrolling mode and there's at least one
|
||||
* page of text left, move the current line of the edit window
|
||||
* up a page. */
|
||||
if (ISSET(SMOOTHSCROLL) && current->lineno > editwinrows - 2) {
|
||||
if (ISSET(SMOOTH_SCROLL) && current->lineno > editwinrows - 2) {
|
||||
int i;
|
||||
for (i = 0; i < editwinrows - 2; i++)
|
||||
current = current->prev;
|
||||
@@ -129,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_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
|
||||
@@ -154,7 +153,7 @@ void do_page_down(void)
|
||||
/* If we're in smooth scrolling mode and there's at least one
|
||||
* page of text left, move the current line of the edit window
|
||||
* down a page. */
|
||||
if (ISSET(SMOOTHSCROLL) && current->lineno + editwinrows - 2 <=
|
||||
if (ISSET(SMOOTH_SCROLL) && current->lineno + editwinrows - 2 <=
|
||||
filebot->lineno) {
|
||||
int i;
|
||||
for (i = 0; i < editwinrows - 2; i++)
|
||||
@@ -176,7 +175,7 @@ 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_statusblank();
|
||||
}
|
||||
@@ -192,6 +191,7 @@ void do_up(void)
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
|
||||
current = current->prev;
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
|
||||
@@ -201,7 +201,7 @@ void do_up(void)
|
||||
if (current_y == 0)
|
||||
edit_scroll(UP,
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(SMOOTHSCROLL) ? 1 :
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
|
||||
@@ -225,6 +225,7 @@ void do_down(void)
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
|
||||
current = current->next;
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
|
||||
@@ -234,7 +235,7 @@ void do_down(void)
|
||||
if (current_y == editwinrows - 1)
|
||||
edit_scroll(DOWN,
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(SMOOTHSCROLL) ? 1 :
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
|
||||
@@ -247,18 +248,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_statusblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
if (allow_update && need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
@@ -267,20 +268,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_statusblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
if (allow_update && need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
|
||||
3456
src/nano.c
3456
src/nano.c
File diff suppressed because it is too large
Load Diff
238
src/nano.h
238
src/nano.h
@@ -2,28 +2,33 @@
|
||||
/**************************************************************************
|
||||
* 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) *
|
||||
* 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. *
|
||||
* 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. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef NANO_H
|
||||
#define NANO_H 1
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef __TANDEM
|
||||
/* Tandem NonStop Kernel */
|
||||
/* Tandem NonStop Kernel. */
|
||||
#include <floss.h>
|
||||
#define NANO_ROOT_UID 65535
|
||||
#else
|
||||
@@ -34,25 +39,27 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
/* Macros for the flags long. */
|
||||
/* Macros for flags. */
|
||||
#define SET(bit) flags |= bit
|
||||
#define UNSET(bit) flags &= ~bit
|
||||
#define ISSET(bit) ((flags & bit) != 0)
|
||||
#define TOGGLE(bit) flags ^= bit
|
||||
|
||||
/* Macros for character allocation. */
|
||||
/* Macros for character allocation, etc. */
|
||||
#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 charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
|
||||
|
||||
/* Other macros. */
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#undef regexec
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) safe_regexec(preg, string, nmatch, pmatch, eflags)
|
||||
#endif
|
||||
|
||||
/* Set a default value for PATH_MAX, so we can use it in lines like
|
||||
* "path = getcwd(NULL, PATH_MAX + 1);". */
|
||||
/* Set a default value for PATH_MAX if there isn't one. */
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX -1
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLANG
|
||||
@@ -69,69 +76,62 @@
|
||||
#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. */
|
||||
/* 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 2.x. */
|
||||
#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
|
||||
#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. */
|
||||
/* If no isblank(), iswblank(), strcasecmp(), strncasecmp(),
|
||||
* strcasestr(), strnlen(), getdelim(), or getline(), use the versions
|
||||
* we have. */
|
||||
#ifndef HAVE_ISBLANK
|
||||
#define isblank is_blank_char
|
||||
#define isblank nisblank
|
||||
#endif
|
||||
#ifndef HAVE_ISWBLANK
|
||||
#define iswblank niswblank
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
/* Assume ERR is defined as -1. To avoid duplicate case values when
|
||||
* some key definitions are missing, we have to set all of these, and
|
||||
* all of the special sentinel values below, to different negative
|
||||
* values other than -1. */
|
||||
|
||||
#define VERMSG "GNU nano " VERSION
|
||||
|
||||
/* If we aren't using ncurses, turn the mouse support off, as it's
|
||||
@@ -145,10 +145,6 @@
|
||||
#endif
|
||||
|
||||
/* Enumeration types. */
|
||||
typedef enum {
|
||||
CUT_LINE, CUT_MARKED, CUT_TO_EOL
|
||||
} cut_type;
|
||||
|
||||
typedef enum {
|
||||
NIX_FILE, DOS_FILE, MAC_FILE
|
||||
} file_format;
|
||||
@@ -161,16 +157,12 @@ typedef enum {
|
||||
TOP, CENTER, NONE
|
||||
} topmidnone;
|
||||
|
||||
typedef enum {
|
||||
NO_SEQ, ESCAPE_SEQ, UTF8_SEQ
|
||||
} seq_type;
|
||||
|
||||
/* Structure types. */
|
||||
typedef struct filestruct {
|
||||
char *data;
|
||||
struct filestruct *next; /* Next node. */
|
||||
struct filestruct *prev; /* Previous node. */
|
||||
int lineno; /* The line number. */
|
||||
ssize_t lineno; /* The line number. */
|
||||
} filestruct;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
@@ -179,30 +171,31 @@ 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. */
|
||||
size_t file_mark_beginx; /* Current file's beginning marked
|
||||
size_t mark_beginx; /* Current file's beginning marked
|
||||
* line's x-coordinate position. */
|
||||
#endif
|
||||
size_t 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. */
|
||||
size_t file_placewewant; /* Current file's place we want. */
|
||||
int file_totlines; /* Current file's total number of
|
||||
size_t placewewant; /* Current file's place we want. */
|
||||
size_t totlines; /* Current file's total number of
|
||||
* lines. */
|
||||
long file_totsize; /* Current file's total size. */
|
||||
int file_lineno; /* Current file's line number. */
|
||||
long file_flags; /* Current file's flags: modification
|
||||
size_t totsize; /* Current file's total size. */
|
||||
unsigned long flags; /* Current file's flags: modification
|
||||
* status (and marking status, if
|
||||
* available). */
|
||||
file_format file_fmt; /* Current file's format. */
|
||||
file_format fmt; /* Current file's format. */
|
||||
} openfilestruct;
|
||||
#endif
|
||||
|
||||
@@ -222,7 +215,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
|
||||
@@ -252,53 +245,38 @@ typedef struct rcoption {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
typedef struct colortype {
|
||||
int fg; /* fg color */
|
||||
int bg; /* bg color */
|
||||
int bright; /* Is this color A_BOLD? */
|
||||
int pairnum; /* Color pair number used for this fg/bg */
|
||||
regex_t start; /* Start (or all) of the regex string */
|
||||
regex_t *end; /* End of the regex string */
|
||||
int fg; /* Foreground color. */
|
||||
int bg; /* Background color. */
|
||||
bool bright; /* Is this color A_BOLD? */
|
||||
int pairnum; /* Color pair number used for this
|
||||
* foreground/background. */
|
||||
regex_t start; /* Start (or all) of the regex
|
||||
* string. */
|
||||
regex_t *end; /* End (if any) of the regex string. */
|
||||
struct colortype *next;
|
||||
} colortype;
|
||||
|
||||
typedef struct exttype {
|
||||
regex_t val; /* The extensions that match this syntax. */
|
||||
regex_t val; /* The extensions that match this
|
||||
* syntax. */
|
||||
struct exttype *next;
|
||||
} exttype;
|
||||
|
||||
typedef struct syntaxtype {
|
||||
char *desc; /* Name of this syntax type */
|
||||
exttype *extensions; /* List of extensions that this applies to */
|
||||
colortype *color; /* color struct for this syntax */
|
||||
char *desc; /* Name of this syntax type. */
|
||||
exttype *extensions; /* List of extensions that this syntax
|
||||
* applies to. */
|
||||
colortype *color; /* Color struct for this syntax. */
|
||||
struct syntaxtype *next;
|
||||
} syntaxtype;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
typedef struct historytype {
|
||||
struct historytype *next;
|
||||
struct historytype *prev;
|
||||
char *data;
|
||||
} historytype;
|
||||
|
||||
typedef struct historyheadtype {
|
||||
struct historytype *next; /* Keep *next and *prev members
|
||||
* together. */
|
||||
struct historytype *prev; /* And in same order as in
|
||||
* historytype. */
|
||||
struct historytype *tail;
|
||||
struct historytype *current;
|
||||
int count;
|
||||
int len;
|
||||
} historyheadtype;
|
||||
#endif
|
||||
|
||||
/* Bitwise flags so we can save space (or more correctly, not waste
|
||||
* it). */
|
||||
/* Bitwise flags so that we can save space (or, more correctly, not
|
||||
* waste it). */
|
||||
#define MODIFIED (1<<0)
|
||||
#define CASE_SENSITIVE (1<<1)
|
||||
#define MARK_ISSET (1<<2)
|
||||
#define CONSTUPDATE (1<<3)
|
||||
#define CONST_UPDATE (1<<3)
|
||||
#define NO_HELP (1<<4)
|
||||
#define NOFOLLOW_SYMLINKS (1<<5)
|
||||
#define SUSPEND (1<<6)
|
||||
@@ -309,23 +287,25 @@ typedef struct historyheadtype {
|
||||
#define USE_REGEXP (1<<11)
|
||||
#define TEMP_FILE (1<<12)
|
||||
#define CUT_TO_END (1<<13)
|
||||
#define REVERSE_SEARCH (1<<14)
|
||||
#define BACKWARDS_SEARCH (1<<14)
|
||||
#define MULTIBUFFER (1<<15)
|
||||
#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 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 SMOOTH_SCROLL (1<<16)
|
||||
#define REBIND_DELETE (1<<17)
|
||||
#define NO_CONVERT (1<<18)
|
||||
#define BACKUP_FILE (1<<19)
|
||||
#define NO_RCFILE (1<<20)
|
||||
#define NO_COLOR_SYNTAX (1<<21)
|
||||
#define PRESERVE (1<<22)
|
||||
#define HISTORYLOG (1<<23)
|
||||
#define RESTRICTED (1<<24)
|
||||
#define SMART_HOME (1<<25)
|
||||
#define WHITESPACE_DISPLAY (1<<26)
|
||||
#define MORE_SPACE (1<<27)
|
||||
#define TABS_TO_SPACES (1<<28)
|
||||
#define QUICK_BLANK (1<<29)
|
||||
#define USE_UTF8 (1<<30)
|
||||
|
||||
/* Control key sequences, changing these would be very very bad. */
|
||||
/* Control key sequences. Changing these would be very, very bad. */
|
||||
#define NANO_CONTROL_SPACE 0
|
||||
#define NANO_CONTROL_A 1
|
||||
#define NANO_CONTROL_B 2
|
||||
@@ -403,9 +383,6 @@ typedef struct historyheadtype {
|
||||
/* No key at all. */
|
||||
#define NANO_NO_KEY -2
|
||||
|
||||
/* Special sentinel key used for search/replace history. */
|
||||
#define NANO_HISTORY_KEY -3
|
||||
|
||||
/* Normal keys. */
|
||||
#define NANO_XON_KEY NANO_CONTROL_Q
|
||||
#define NANO_XOFF_KEY NANO_CONTROL_S
|
||||
@@ -428,6 +405,7 @@ typedef struct historyheadtype {
|
||||
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
|
||||
#define NANO_WHEREIS_NEXT_FKEY KEY_F(16)
|
||||
#define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T
|
||||
#define NANO_REGEXP_KEY NANO_ALT_R
|
||||
#define NANO_REPLACE_KEY NANO_CONTROL_4
|
||||
#define NANO_REPLACE_FKEY KEY_F(14)
|
||||
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
||||
@@ -477,6 +455,9 @@ typedef struct historyheadtype {
|
||||
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
|
||||
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
||||
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
||||
#define NANO_WORDCOUNT_KEY NANO_ALT_D
|
||||
#define NANO_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
|
||||
@@ -495,7 +476,6 @@ typedef struct historyheadtype {
|
||||
#define TOGGLE_NOHELP_KEY NANO_ALT_X
|
||||
#define TOGGLE_MOUSE_KEY NANO_ALT_M
|
||||
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
||||
#define TOGGLE_REGEXP_KEY NANO_ALT_R
|
||||
#define TOGGLE_WRAP_KEY NANO_ALT_L
|
||||
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
||||
#define TOGGLE_CASE_KEY NANO_ALT_C
|
||||
@@ -508,6 +488,8 @@ typedef struct historyheadtype {
|
||||
#define TOGGLE_SYNTAX_KEY NANO_ALT_Y
|
||||
#define TOGGLE_SMARTHOME_KEY NANO_ALT_H
|
||||
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
|
||||
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
|
||||
#define TOGGLE_TABSTOSPACES_KEY NANO_ALT_Q
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
#define MAIN_VISIBLE 12
|
||||
@@ -516,10 +498,7 @@ typedef struct historyheadtype {
|
||||
#define NOVIEW FALSE
|
||||
|
||||
/* 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. */
|
||||
@@ -528,8 +507,11 @@ typedef struct historyheadtype {
|
||||
/* Default width of a tab. */
|
||||
#define WIDTH_OF_TAB 8
|
||||
|
||||
/* Maximum number of search history strings saved, same value used for
|
||||
* replace history. */
|
||||
/* Maximum number of search/replace history strings saved, not counting
|
||||
* the blank lines at their ends. */
|
||||
#define MAX_SEARCH_HISTORY 100
|
||||
|
||||
/* Maximum number of bytes we read from a file at one time. */
|
||||
#define MAX_BUF_SIZE 128
|
||||
|
||||
#endif /* !NANO_H */
|
||||
|
||||
409
src/proto.h
409
src/proto.h
@@ -2,27 +2,32 @@
|
||||
/**************************************************************************
|
||||
* 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) *
|
||||
* 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. *
|
||||
* 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. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef PROTO_H
|
||||
#define PROTO_H 1
|
||||
|
||||
/* Externs. */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
@@ -33,19 +38,20 @@ extern ssize_t wrap_at;
|
||||
#endif
|
||||
extern int editwinrows;
|
||||
extern size_t current_x;
|
||||
extern int current_y;
|
||||
extern int totlines;
|
||||
extern ssize_t current_y;
|
||||
extern size_t totlines;
|
||||
extern size_t placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
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 currslen;
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
extern char *whitespace;
|
||||
extern int whitespace_len[2];
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -86,6 +92,9 @@ extern char *alt_speller;
|
||||
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;
|
||||
@@ -119,9 +128,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;
|
||||
@@ -137,17 +144,86 @@ extern toggle *toggles;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
extern historyheadtype search_history;
|
||||
extern historyheadtype replace_history;
|
||||
extern filestruct *search_history;
|
||||
extern filestruct *searchage;
|
||||
extern filestruct *searchbot;
|
||||
extern filestruct *replace_history;
|
||||
extern filestruct *replaceage;
|
||||
extern filestruct *replacebot;
|
||||
#endif
|
||||
|
||||
extern bool curses_ended;
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
extern char *homedir;
|
||||
#endif
|
||||
|
||||
/* Functions we want available. */
|
||||
/* The functions we want available. */
|
||||
|
||||
/* Public functions in chars.c. */
|
||||
#ifndef HAVE_ISBLANK
|
||||
bool nisblank(int c);
|
||||
#endif
|
||||
#if !defined(HAVE_ISWBLANK) && defined(NANO_WIDE)
|
||||
bool niswblank(wchar_t wc);
|
||||
#endif
|
||||
bool is_byte(int c);
|
||||
bool is_alnum_mbchar(const char *c);
|
||||
bool is_blank_mbchar(const char *c);
|
||||
bool is_cntrl_char(int c);
|
||||
#ifdef NANO_WIDE
|
||||
bool is_cntrl_wchar(wchar_t wc);
|
||||
#endif
|
||||
bool is_cntrl_mbchar(const char *c);
|
||||
bool is_punct_mbchar(const char *c);
|
||||
bool is_word_mbchar(const char *c, bool allow_punct);
|
||||
char control_rep(char c);
|
||||
#ifdef NANO_WIDE
|
||||
wchar_t control_wrep(wchar_t c);
|
||||
#endif
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len);
|
||||
int mbwidth(const char *c);
|
||||
int mb_cur_max(void);
|
||||
char *make_mbchar(int chr, int *chr_mb_len);
|
||||
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
|
||||
*col);
|
||||
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);
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
|
||||
const char *revstrstr(const char *haystack, const char *needle, const
|
||||
char *rev_start);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
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
|
||||
#ifdef ENABLE_NANORC
|
||||
bool has_blank_chars(const char *s);
|
||||
bool has_blank_mbchars(const char *s);
|
||||
#endif
|
||||
char *mbstrchr(const char *s, char *c);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
bool is_valid_mbstring(const char *s);
|
||||
#endif
|
||||
|
||||
/* Public functions in color.c. */
|
||||
#ifdef ENABLE_COLOR
|
||||
@@ -158,22 +234,25 @@ void update_color(void);
|
||||
|
||||
/* Public functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
filestruct *get_cutbottom(void);
|
||||
void add_to_cutbuffer(filestruct *inptr, bool allow_concat);
|
||||
void cut_line(void);
|
||||
#ifndef NANO_SMALL
|
||||
void cut_marked_segment(void);
|
||||
void cut_marked(void);
|
||||
void cut_to_eol(void);
|
||||
#endif
|
||||
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 new_file(void);
|
||||
filestruct *read_line(char *buf, filestruct *prev, bool *first_line_ins,
|
||||
size_t len);
|
||||
filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
*first_line_ins, size_t buf_len);
|
||||
void load_file(void);
|
||||
void read_file(FILE *f, const char *filename);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
char *get_next_filename(const char *name);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
#ifndef NANO_SMALL
|
||||
void execute_command(const char *command);
|
||||
#endif
|
||||
@@ -187,64 +266,63 @@ void do_insertfile(
|
||||
);
|
||||
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);
|
||||
#endif
|
||||
void add_open_file(bool update);
|
||||
void load_open_file(void);
|
||||
void open_prevfile(bool closing_file);
|
||||
void open_prevnext_file(bool next_file);
|
||||
void open_prevfile_void(void);
|
||||
void open_nextfile(bool closing_file);
|
||||
void open_nextfile_void(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);
|
||||
#endif
|
||||
char *safe_tempfile(FILE **f);
|
||||
#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, bool tmp, int append, bool
|
||||
nonamechange);
|
||||
int write_file(const char *name, FILE *f_open, bool tmp, int append,
|
||||
bool nonamechange);
|
||||
#ifndef NANO_SMALL
|
||||
int write_marked(const char *name, bool tmp, int append);
|
||||
int write_marked(const char *name, FILE *f_open, bool tmp, int append);
|
||||
#endif
|
||||
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);
|
||||
void free_chararray(char **array, size_t len);
|
||||
#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)
|
||||
char *histfilename(void);
|
||||
void load_history(void);
|
||||
bool writehist(FILE *hist, historyheadtype *histhead);
|
||||
bool writehist(FILE *hist, filestruct *histhead);
|
||||
void save_history(void);
|
||||
#endif
|
||||
|
||||
@@ -253,15 +331,12 @@ size_t length_of_list(const shortcut *s);
|
||||
#ifndef NANO_SMALL
|
||||
void toggle_init_one(int val, const char *desc, long flag);
|
||||
void toggle_init(void);
|
||||
#ifdef DEBUG
|
||||
void free_toggles(void);
|
||||
#endif
|
||||
#endif
|
||||
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(bool unjustify);
|
||||
void free_shortcutage(shortcut **shortcutage);
|
||||
@@ -278,17 +353,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. */
|
||||
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
|
||||
@@ -308,32 +384,41 @@ 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 print1opt_full(const char *shortflag
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
, const char *longflag
|
||||
#endif
|
||||
, 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
|
||||
void do_char(char ch);
|
||||
void do_verbatim_input(void);
|
||||
void do_backspace(void);
|
||||
void do_delete(void);
|
||||
void do_tab(void);
|
||||
void do_enter(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_next_word(void);
|
||||
void do_prev_word(void);
|
||||
bool do_next_word(bool allow_punct, bool allow_update);
|
||||
void do_next_word_void(void);
|
||||
bool do_prev_word(bool allow_punct, bool allow_update);
|
||||
void do_prev_word_void(void);
|
||||
void do_word_count(void);
|
||||
void do_mark(void);
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
void wrap_reset(void);
|
||||
bool do_wrap(filestruct *inptr);
|
||||
bool do_wrap(filestruct *line);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool do_int_spell_fix(const char *word);
|
||||
@@ -341,34 +426,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, ssize_t goal);
|
||||
ssize_t break_line(const char *line, ssize_t 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);
|
||||
@@ -376,7 +464,7 @@ void allow_pending_sigwinch(bool allow);
|
||||
#ifndef NANO_SMALL
|
||||
void do_toggle(const toggle *which);
|
||||
#endif
|
||||
void disable_extended_input(void);
|
||||
void disable_extended_io(void);
|
||||
void disable_signals(void);
|
||||
#ifndef NANO_SMALL
|
||||
void enable_signals(void);
|
||||
@@ -384,6 +472,12 @@ 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. */
|
||||
#ifdef ENABLE_NANORC
|
||||
@@ -391,11 +485,11 @@ 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);
|
||||
void parse_colors(char *ptr, bool icase);
|
||||
#endif /* ENABLE_COLOR */
|
||||
void parse_rcfile(FILE *rcstream);
|
||||
void do_rcfile(void);
|
||||
@@ -410,8 +504,7 @@ void not_found_msg(const char *str);
|
||||
void search_abort(void);
|
||||
void search_init_globals(void);
|
||||
int search_init(bool replacing, bool use_answer);
|
||||
bool 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);
|
||||
bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
no_sameline, const filestruct *begin, size_t beginx, const char
|
||||
*needle, size_t *needle_len);
|
||||
@@ -422,69 +515,54 @@ void do_research(void);
|
||||
#endif
|
||||
void replace_abort(void);
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, bool create_flag);
|
||||
int replace_regexp(char *string, bool create);
|
||||
#endif
|
||||
char *replace_line(const char *needle);
|
||||
ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
*real_current, size_t *real_current_x, bool wholewords, bool
|
||||
*canceled);
|
||||
void do_replace(void);
|
||||
void do_gotoline(int line, bool save_pos);
|
||||
void do_gotoline_void(void);
|
||||
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
bool interactive, bool save_pos);
|
||||
void do_gotolinecolumn_void(void);
|
||||
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
|
||||
void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww);
|
||||
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
|
||||
pos_pww);
|
||||
#endif
|
||||
void do_find_bracket(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef HAVE_REGEX_H
|
||||
void do_find_bracket(void);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
bool history_has_changed(void);
|
||||
#endif
|
||||
void history_init(void);
|
||||
historytype *find_node(historytype *h, const char *s);
|
||||
void remove_node(historytype *r);
|
||||
void insert_node(historytype *h, const char *s);
|
||||
void update_history(historyheadtype *h, const char *s);
|
||||
char *get_history_older(historyheadtype *h);
|
||||
char *get_history_newer(historyheadtype *h);
|
||||
char *get_history_completion(historyheadtype *h, char *s);
|
||||
#ifdef DEBUG
|
||||
void free_history(historyheadtype *h);
|
||||
#endif
|
||||
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
|
||||
char *s, size_t len);
|
||||
void update_history(filestruct **h, const char *s);
|
||||
char *get_history_older(filestruct **h);
|
||||
char *get_history_newer(filestruct **h);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
char *get_history_completion(filestruct **h, char *s, size_t len);
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* 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,
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags);
|
||||
#endif
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string);
|
||||
#endif
|
||||
#ifndef HAVE_ISBLANK
|
||||
int is_blank_char(int c);
|
||||
#endif
|
||||
int is_cntrl_char(int c);
|
||||
int num_of_digits(int n);
|
||||
int digits(size_t n);
|
||||
void get_homedir(void);
|
||||
bool parse_num(const char *str, ssize_t *val);
|
||||
void align(char **strp);
|
||||
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
|
||||
void align(char **str);
|
||||
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);
|
||||
@@ -504,89 +582,104 @@ char *mallocstrassn(char *dest, char *src);
|
||||
void new_magicline(void);
|
||||
#ifndef NANO_SMALL
|
||||
void remove_magicline(void);
|
||||
void get_totals(const filestruct *begin, const filestruct *end, int
|
||||
*lines, long *size);
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
int check_wildcard_match(const char *text, const char *pattern);
|
||||
#endif
|
||||
void get_totals(const filestruct *begin, const filestruct *end, size_t
|
||||
*lines, size_t *size);
|
||||
|
||||
/* Public functions in winio.c. */
|
||||
#ifndef NANO_SMALL
|
||||
void reset_kbinput(void);
|
||||
#endif
|
||||
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 get_translated_kbinput(int kbinput, seq_type *seq
|
||||
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
||||
#ifndef NANO_SMALL
|
||||
, 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
|
||||
, 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(const int *escape_seq, size_t es_len, bool
|
||||
*ignore_seq);
|
||||
int get_escape_seq_abcd(int kbinput);
|
||||
int *get_verbatim_kbinput(WINDOW *win, int first, int *v_kbinput, size_t
|
||||
*v_len, bool allow_ascii);
|
||||
int get_untranslated_kbinput(int kbinput, size_t position, bool
|
||||
allow_ascii
|
||||
#ifndef NANO_SMALL
|
||||
, bool 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
|
||||
bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
||||
#endif
|
||||
const shortcut *get_shortcut(const shortcut *s_list, int kbinput, bool
|
||||
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 get_edit_input(bool *meta_key, bool *func_key, bool allow_funcs);
|
||||
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 get_edit_mouse(void);
|
||||
bool do_statusbar_mouse(void);
|
||||
#endif
|
||||
void do_statusbar_home(void);
|
||||
void do_statusbar_end(void);
|
||||
void do_statusbar_right(void);
|
||||
void do_statusbar_left(void);
|
||||
void do_statusbar_backspace(void);
|
||||
void do_statusbar_delete(void);
|
||||
void do_statusbar_cut_text(void);
|
||||
#ifndef NANO_SMALL
|
||||
bool do_statusbar_next_word(bool allow_punct);
|
||||
bool do_statusbar_prev_word(bool allow_punct);
|
||||
#endif
|
||||
void do_statusbar_verbatim_input(bool *got_enter);
|
||||
void do_statusbar_output(char *output, size_t output_len, bool
|
||||
*got_enter, bool allow_cntrls);
|
||||
size_t xplustabs(void);
|
||||
size_t actual_x(const char *str, size_t xplus);
|
||||
size_t strnlenpt(const char *buf, size_t size);
|
||||
size_t strlenpt(const char *buf);
|
||||
void blank_titlebar(void);
|
||||
void blank_topbar(void);
|
||||
void blank_edit(void);
|
||||
void blank_statusbar(void);
|
||||
void check_statusblank(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(bool allow_tabs, const char *buf, const char *def,
|
||||
int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const shortcut *s
|
||||
const shortcut *s
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, bool *list
|
||||
, bool *list
|
||||
#endif
|
||||
);
|
||||
int statusq(bool allow_tabs, const shortcut *s, const char *def,
|
||||
);
|
||||
int statusq(bool allow_tabs, const shortcut *s, const char *curranswer,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
const char *msg, ...);
|
||||
void statusq_abort(void);
|
||||
void titlebar(const char *path);
|
||||
void set_modified(void);
|
||||
void statusbar(const char *msg, ...);
|
||||
void bottombars(const shortcut *s);
|
||||
void onekey(const char *keystroke, const char *desc, size_t len);
|
||||
#ifndef NDEBUG
|
||||
int check_linenumbers(const filestruct *fileptr);
|
||||
#endif
|
||||
size_t get_page_start(size_t column);
|
||||
void reset_cursor(void);
|
||||
void edit_add(const filestruct *fileptr, const char *converted, int
|
||||
@@ -599,15 +692,19 @@ void edit_redraw(const filestruct *old_current, size_t old_pww);
|
||||
void edit_refresh(void);
|
||||
void edit_update(topmidnone location);
|
||||
int do_yesno(bool all, const char *msg);
|
||||
void total_redraw(void);
|
||||
void total_refresh(void);
|
||||
void display_main_list(void);
|
||||
void do_cursorpos(bool constant);
|
||||
void do_cursorpos_void(void);
|
||||
#ifndef DISABLE_HELP
|
||||
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, const char *word);
|
||||
#ifndef NDEBUG
|
||||
int check_linenumbers(const filestruct *fileptr);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void dump_buffer(const filestruct *inptr);
|
||||
void dump_buffer_reverse(void);
|
||||
@@ -615,3 +712,5 @@ void dump_buffer_reverse(void);
|
||||
#ifdef NANO_EXTRA
|
||||
void do_credits(void);
|
||||
#endif
|
||||
|
||||
#endif /* !PROTO_H */
|
||||
|
||||
657
src/rcfile.c
657
src/rcfile.c
@@ -2,20 +2,21 @@
|
||||
/**************************************************************************
|
||||
* 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) *
|
||||
* 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. *
|
||||
* 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. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -29,43 +30,27 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
|
||||
const static rcoption rcopts[] = {
|
||||
#ifndef NANO_SMALL
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"backup", BACKUP_FILE},
|
||||
{"backupdir", 0},
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
{"brackets", 0},
|
||||
#endif
|
||||
{"const", CONSTUPDATE},
|
||||
#ifndef NANO_SMALL
|
||||
{"cut", CUT_TO_END},
|
||||
#endif
|
||||
{"const", CONST_UPDATE},
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
{"fill", 0},
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
{"historylog", HISTORYLOG},
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
{"mouse", USE_MOUSE},
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
{"multibuffer", MULTIBUFFER},
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
{"noconvert", NO_CONVERT},
|
||||
#endif
|
||||
{"morespace", MORE_SPACE},
|
||||
{"nofollow", NOFOLLOW_SYMLINKS},
|
||||
{"nohelp", NO_HELP},
|
||||
#ifndef DISABLE_WRAPPING
|
||||
@@ -83,10 +68,6 @@ const static rcoption rcopts[] = {
|
||||
#ifdef HAVE_REGEX_H
|
||||
{"regexp", USE_REGEXP},
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
{"smarthome", SMART_HOME},
|
||||
{"smooth", SMOOTHSCROLL},
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
{"speller", 0},
|
||||
#endif
|
||||
@@ -95,17 +76,35 @@ const static rcoption rcopts[] = {
|
||||
{"tempfile", TEMP_FILE},
|
||||
{"view", VIEW_MODE},
|
||||
#ifndef NANO_SMALL
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"backup", BACKUP_FILE},
|
||||
{"backupdir", 0},
|
||||
{"backwards", BACKWARDS_SEARCH},
|
||||
{"casesensitive", CASE_SENSITIVE},
|
||||
{"cut", CUT_TO_END},
|
||||
{"historylog", HISTORYLOG},
|
||||
{"noconvert", NO_CONVERT},
|
||||
{"quickblank", QUICK_BLANK},
|
||||
{"smarthome", SMART_HOME},
|
||||
{"smooth", SMOOTH_SCROLL},
|
||||
{"tabstospaces", TABS_TO_SPACES},
|
||||
{"whitespace", 0},
|
||||
#endif
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
static bool errors = FALSE;
|
||||
static int lineno = 0;
|
||||
static const char *nanorc;
|
||||
static size_t lineno = 0;
|
||||
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;
|
||||
@@ -113,7 +112,8 @@ void rcfile_error(const char *msg, ...)
|
||||
fprintf(stderr, "\n");
|
||||
if (lineno > 0) {
|
||||
errors = TRUE;
|
||||
fprintf(stderr, _("Error in %s on line %d: "), nanorc, lineno);
|
||||
fprintf(stderr, _("Error in %s on line %lu: "), nanorc,
|
||||
(unsigned long)lineno);
|
||||
}
|
||||
|
||||
va_start(ap, msg);
|
||||
@@ -123,17 +123,18 @@ 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 (!isblank(*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))
|
||||
ptr++;
|
||||
@@ -141,13 +142,13 @@ char *parse_next_word(char *ptr)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* The keywords operatingdir, backupdir, fill, tabsize, speller,
|
||||
* punct, brackets, quotestr, and whitespace take an argument when set.
|
||||
* Among these, operatingdir, backupdir, speller, punct, brackets,
|
||||
* quotestr, and whitespace have to allow tabs and spaces in the
|
||||
* argument. Thus, if the next word starts with a ", we say it ends
|
||||
* with the last " of the line. Otherwise, the word is interpreted as
|
||||
* usual. That is so the arguments can contain "s too. */
|
||||
/* 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;
|
||||
@@ -162,7 +163,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')
|
||||
@@ -181,16 +182,14 @@ char *parse_argument(char *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)
|
||||
return -1;
|
||||
assert(colorname != NULL && bright != NULL);
|
||||
|
||||
if (strncasecmp(colorname, "bright", 6) == 0) {
|
||||
*bright = 1;
|
||||
*bright = TRUE;
|
||||
colorname += 6;
|
||||
}
|
||||
|
||||
@@ -210,25 +209,33 @@ 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 != '"' || (!isblank(*(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';
|
||||
@@ -239,9 +246,9 @@ char *parse_next_regex(char *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);
|
||||
|
||||
@@ -253,80 +260,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;
|
||||
@@ -335,83 +342,98 @@ void parse_syntax(char *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the color stuff into the colorstrings array */
|
||||
void parse_colors(char *ptr)
|
||||
/* Parse the color stuff into the colorstrings array. If icase is TRUE,
|
||||
* treat the color stuff as case insensitive. */
|
||||
void parse_colors(char *ptr, bool icase)
|
||||
{
|
||||
int fg, bg, bright = 0;
|
||||
int expectend = 0; /* Do we expect an end= line? */
|
||||
int fg, bg;
|
||||
bool bright = FALSE, no_fgcolor = 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 (bgcolorname == NULL) {
|
||||
/* If we have a background color without a foreground color,
|
||||
* parse it properly. */
|
||||
bgcolorname = fgstr + 1;
|
||||
no_fgcolor = TRUE;
|
||||
}
|
||||
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);
|
||||
if (!no_fgcolor) {
|
||||
fg = color_to_int(fgstr, &bright);
|
||||
|
||||
/* Don't try and parse screwed up fg colors */
|
||||
if (fg == -1)
|
||||
return;
|
||||
/* Don't try to parse screwed-up foreground colors. */
|
||||
if (fg == -1)
|
||||
return;
|
||||
} else
|
||||
fg = -1;
|
||||
|
||||
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)
|
||||
;
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing regex string"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Now the fun part, start adding regexps to individual strings
|
||||
in the colorstrings array, woo! */
|
||||
|
||||
while (*ptr != '\0') {
|
||||
/* Now for the fun part. Start adding regexes to individual strings
|
||||
* in the colorstrings array, woo! */
|
||||
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, icase ? REG_ICASE : 0)) {
|
||||
free(newcolor);
|
||||
cancelled = 1;
|
||||
cancelled = TRUE;
|
||||
} else {
|
||||
newcolor->fg = fg;
|
||||
newcolor->bg = bg;
|
||||
@@ -419,84 +441,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, icase ? REG_ICASE : 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))
|
||||
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,140 +527,167 @@ void parse_rcfile(FILE *rcstream)
|
||||
else if (strcasecmp(keyword, "syntax") == 0)
|
||||
parse_syntax(ptr);
|
||||
else if (strcasecmp(keyword, "color") == 0)
|
||||
parse_colors(ptr);
|
||||
#endif /* ENABLE_COLOR */
|
||||
else {
|
||||
parse_colors(ptr, FALSE);
|
||||
else if (strcasecmp(keyword, "icolor") == 0)
|
||||
parse_colors(ptr, TRUE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
else
|
||||
rcfile_error(N_("Command %s not understood"), keyword);
|
||||
|
||||
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
|
||||
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 = mallocstrcpy(NULL, option);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "option = \"%s\"\n", option);
|
||||
#endif
|
||||
|
||||
/* Make sure option is a valid multibyte
|
||||
* string. */
|
||||
if (!is_valid_mbstring(option)) {
|
||||
rcfile_error(
|
||||
N_("Option is not a valid multibyte string"));
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
|| strcasecmp(rcopts[i].name, "operatingdir") == 0
|
||||
if (strcasecmp(rcopts[i].name, "operatingdir") == 0)
|
||||
operating_dir = option;
|
||||
else
|
||||
#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);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "option = %s\n", option);
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (strcasecmp(rcopts[i].name, "operatingdir") == 0)
|
||||
operating_dir = mallocstrcpy(NULL, 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 %ld!\n",
|
||||
rcopts[i].flag);
|
||||
#endif
|
||||
} else {
|
||||
UNSET(rcopts[i].flag);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "unset flag %ld!\n",
|
||||
rcopts[i].flag);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
if (strcasecmp(rcopts[i].name, "punct") == 0) {
|
||||
punct = option;
|
||||
if (has_blank_mbchars(punct)) {
|
||||
rcfile_error(
|
||||
N_("Non-blank characters required"));
|
||||
free(punct);
|
||||
punct = NULL;
|
||||
}
|
||||
} else if (strcasecmp(rcopts[i].name,
|
||||
"brackets") == 0) {
|
||||
brackets = option;
|
||||
if (has_blank_mbchars(brackets)) {
|
||||
rcfile_error(
|
||||
N_("Non-blank 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 = %ld\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')
|
||||
;
|
||||
}
|
||||
@@ -653,62 +702,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();
|
||||
|
||||
564
src/search.c
564
src/search.c
@@ -2,20 +2,21 @@
|
||||
/**************************************************************************
|
||||
* 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) *
|
||||
* 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. *
|
||||
* 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. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -31,10 +32,13 @@
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
static bool search_last_line = FALSE;
|
||||
/* Have we gone past the last line while searching? */
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
static bool history_changed = FALSE;
|
||||
/* Have any of the history lists changed? */
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
static bool regexp_compiled = FALSE;
|
||||
/* Have we compiled any regular expressions? */
|
||||
@@ -83,11 +87,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);
|
||||
}
|
||||
@@ -145,14 +149,10 @@ int search_init(bool replacing, bool use_answer)
|
||||
|
||||
search_init_globals();
|
||||
|
||||
#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,
|
||||
@@ -186,7 +186,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
#ifndef NANO_SMALL
|
||||
/* This string is just a modifier for the search prompt; no
|
||||
* grammar is implied. */
|
||||
ISSET(REVERSE_SEARCH) ? _(" [Backwards]") :
|
||||
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") :
|
||||
#endif
|
||||
"",
|
||||
|
||||
@@ -212,9 +212,6 @@ int search_init(bool replacing, bool use_answer)
|
||||
if (i == -1 || (i < 0 && last_search[0] == '\0') ||
|
||||
(!replacing && i == 0 && answer[0] == '\0')) {
|
||||
statusbar(_("Cancelled"));
|
||||
#ifndef NANO_SMALL
|
||||
search_history.current = search_history.next;
|
||||
#endif
|
||||
return -1;
|
||||
} else {
|
||||
switch (i) {
|
||||
@@ -238,47 +235,59 @@ int search_init(bool replacing, bool use_answer)
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
case TOGGLE_BACKWARDS_KEY:
|
||||
TOGGLE(REVERSE_SEARCH);
|
||||
TOGGLE(BACKWARDS_SEARCH);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
case TOGGLE_REGEXP_KEY:
|
||||
case NANO_REGEXP_KEY:
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
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;
|
||||
#endif
|
||||
/* Put answer up on the statusbar. */
|
||||
do_gotoline(-1, FALSE);
|
||||
/* Fall through. */
|
||||
do_gotolinecolumn(current->lineno, placewewant + 1,
|
||||
TRUE, TRUE, FALSE);
|
||||
/* Put answer up on the statusbar and
|
||||
* fall through. */
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool 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(datastr[curr_pos - 1])) &&
|
||||
(sln == strlen(datastr) || !isalpha(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 a non-punctuation "word" character, and if we're at
|
||||
* the end of the line or the character after the word isn't a
|
||||
* non-punctuation "word" character, we have a whole word. */
|
||||
retval = (pos == 0 || !is_word_mbchar(p, FALSE)) &&
|
||||
(word_end == strlen(buf) || !is_word_mbchar(r, FALSE));
|
||||
|
||||
free(p);
|
||||
free(r);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Look for needle, starting at current, column 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
|
||||
/* 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
|
||||
@@ -293,7 +302,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
/* The length of the match we found. */
|
||||
size_t current_x_find = 0;
|
||||
/* The location of the match we found. */
|
||||
int current_y_find = current_y;
|
||||
ssize_t 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()
|
||||
@@ -302,7 +311,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
* previous or next line. */
|
||||
rev_start =
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(REVERSE_SEARCH) ? fileptr->data + (current_x - 1) :
|
||||
ISSET(BACKWARDS_SEARCH) ? fileptr->data + (current_x - 1) :
|
||||
#endif
|
||||
fileptr->data + (current_x + 1);
|
||||
|
||||
@@ -351,7 +360,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
fileptr = fileptr->prev;
|
||||
current_y_find--;
|
||||
} else {
|
||||
@@ -368,7 +377,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
return FALSE;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
fileptr = filebot;
|
||||
current_y_find = editwinrows - 1;
|
||||
} else {
|
||||
@@ -389,7 +398,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
|
||||
rev_start = fileptr->data;
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
rev_start += strlen(fileptr->data);
|
||||
#endif
|
||||
}
|
||||
@@ -400,13 +409,12 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
/* Ensure we haven't wrapped around again! */
|
||||
if (search_last_line &&
|
||||
#ifndef NANO_SMALL
|
||||
((!ISSET(REVERSE_SEARCH) && current_x_find > beginx) ||
|
||||
(ISSET(REVERSE_SEARCH) && current_x_find < beginx))
|
||||
((!ISSET(BACKWARDS_SEARCH) && current_x_find > beginx) ||
|
||||
(ISSET(BACKWARDS_SEARCH) && current_x_find < beginx))
|
||||
#else
|
||||
current_x_find > beginx
|
||||
#endif
|
||||
) {
|
||||
|
||||
if (can_display_wrap)
|
||||
not_found_msg(needle);
|
||||
return FALSE;
|
||||
@@ -448,7 +456,7 @@ void do_search(void)
|
||||
search_abort();
|
||||
else if (i == -2) /* Replace. */
|
||||
do_replace();
|
||||
#ifndef NANO_SMALL
|
||||
#if !defined(NANO_SMALL) || defined(HAVE_REGEX_H)
|
||||
else if (i == 1) /* Case Sensitive, Backwards, or Regexp search
|
||||
* toggle. */
|
||||
do_search();
|
||||
@@ -541,7 +549,8 @@ void do_research(void)
|
||||
last_search)) {
|
||||
didfind = findnextstr(TRUE, FALSE, TRUE, current,
|
||||
current_x, answer, NULL);
|
||||
if (fileptr == current && fileptr_x == current_x && !didfind)
|
||||
if (fileptr == current && fileptr_x == current_x &&
|
||||
!didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
} else {
|
||||
#endif
|
||||
@@ -569,39 +578,41 @@ void replace_abort(void)
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, bool create_flag)
|
||||
int replace_regexp(char *string, bool create)
|
||||
{
|
||||
/* Split personality here - if create_flag is FALSE, just calculate
|
||||
* the size of the replacement line (necessary because of
|
||||
/* We have a split personality here. If create is FALSE, just
|
||||
* calculate the size of the replacement line (necessary because of
|
||||
* subexpressions \1 to \9 in the replaced text). */
|
||||
|
||||
const char *c = last_replace;
|
||||
int search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
int new_size = strlen(current->data) + 1 - search_match_count;
|
||||
size_t search_match_count =
|
||||
regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
size_t new_line_size =
|
||||
strlen(current->data) + 1 - search_match_count;
|
||||
|
||||
/* Iterate through the replacement text to handle subexpression
|
||||
* replacement using \1, \2, \3, etc. */
|
||||
while (*c != '\0') {
|
||||
int num = (int)(*(c + 1) - '0');
|
||||
|
||||
if (*c != '\\' || num < 1 || num > 9 || num >
|
||||
search_regexp.re_nsub) {
|
||||
if (create_flag)
|
||||
if (*c != '\\' || num < 1 || num > 9 ||
|
||||
num > search_regexp.re_nsub) {
|
||||
if (create)
|
||||
*string++ = *c;
|
||||
c++;
|
||||
new_size++;
|
||||
new_line_size++;
|
||||
} else {
|
||||
int i = regmatches[num].rm_eo - regmatches[num].rm_so;
|
||||
size_t i = regmatches[num].rm_eo - regmatches[num].rm_so;
|
||||
|
||||
/* Skip over the replacement expression. */
|
||||
c += 2;
|
||||
|
||||
/* But add the length of the subexpression to new_size. */
|
||||
new_size += i;
|
||||
new_line_size += i;
|
||||
|
||||
/* And if create_flag is TRUE, append the result of the
|
||||
/* And if create is TRUE, append the result of the
|
||||
* subexpression match to the new line. */
|
||||
if (create_flag) {
|
||||
if (create) {
|
||||
strncpy(string, current->data + current_x +
|
||||
regmatches[num].rm_so, i);
|
||||
string += i;
|
||||
@@ -609,24 +620,23 @@ int replace_regexp(char *string, bool create_flag)
|
||||
}
|
||||
}
|
||||
|
||||
if (create_flag)
|
||||
if (create)
|
||||
*string = '\0';
|
||||
|
||||
return new_size;
|
||||
return new_line_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
char *replace_line(const char *needle)
|
||||
{
|
||||
char *copy;
|
||||
int new_line_size;
|
||||
int search_match_count;
|
||||
size_t new_line_size, search_match_count;
|
||||
|
||||
/* Calculate the size of the new line. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
new_line_size = replace_regexp(NULL, 0);
|
||||
new_line_size = replace_regexp(NULL, FALSE);
|
||||
} else {
|
||||
#endif
|
||||
search_match_count = strlen(needle);
|
||||
@@ -652,6 +662,7 @@ char *replace_line(const char *needle)
|
||||
|
||||
/* The tail of the original line. */
|
||||
assert(current_x + search_match_count <= strlen(current->data));
|
||||
|
||||
strcat(copy, current->data + current_x + search_match_count);
|
||||
|
||||
return copy;
|
||||
@@ -671,7 +682,6 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
{
|
||||
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. */
|
||||
@@ -713,7 +723,6 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
FALSE
|
||||
#endif
|
||||
, real_current, *real_current_x, needle, &match_len)) {
|
||||
|
||||
int i = 0;
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
@@ -733,30 +742,29 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!replaceall) {
|
||||
edit_redraw(real_current, pww_save);
|
||||
pww_save = placewewant;
|
||||
}
|
||||
if (!replaceall)
|
||||
edit_refresh();
|
||||
|
||||
/* Record for the return value that we found the search
|
||||
* string. */
|
||||
/* Indicate that we found the search string. */
|
||||
if (numreplaced == -1)
|
||||
numreplaced = 0;
|
||||
|
||||
if (!replaceall) {
|
||||
char *exp_word;
|
||||
size_t xpt = xplustabs();
|
||||
|
||||
exp_word = display_string(current->data, xpt,
|
||||
strnlenpt(current->data, match_len + current_x) - xpt);
|
||||
char *exp_word = display_string(current->data, xpt,
|
||||
strnlenpt(current->data, current_x + match_len) - xpt,
|
||||
FALSE);
|
||||
|
||||
curs_set(0);
|
||||
|
||||
do_replace_highlight(TRUE, exp_word);
|
||||
|
||||
i = do_yesno(TRUE, _("Replace this instance?"));
|
||||
|
||||
do_replace_highlight(FALSE, exp_word);
|
||||
|
||||
free(exp_word);
|
||||
|
||||
curs_set(1);
|
||||
|
||||
if (i == -1) { /* We canceled the replace. */
|
||||
@@ -790,8 +798,8 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
* 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 (current == mark_beginbuf &&
|
||||
mark_beginx > current_x) {
|
||||
if (mark_beginx < current_x + match_len)
|
||||
mark_beginx = current_x;
|
||||
else
|
||||
@@ -804,8 +812,8 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
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 (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;
|
||||
@@ -819,7 +827,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
* text. Note that current_x might be set to (size_t)-1
|
||||
* here. */
|
||||
#ifndef NANO_SMALL
|
||||
if (!ISSET(REVERSE_SEARCH))
|
||||
if (!ISSET(BACKWARDS_SEARCH))
|
||||
#endif
|
||||
current_x += match_len + length_change - 1;
|
||||
|
||||
@@ -830,7 +838,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
|
||||
if (!replaceall) {
|
||||
#ifdef ENABLE_COLOR
|
||||
if (ISSET(COLOR_SYNTAX))
|
||||
if (!ISSET(NO_COLOR_SYNTAX))
|
||||
edit_refresh();
|
||||
else
|
||||
#endif
|
||||
@@ -899,11 +907,6 @@ void do_replace(void)
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
replace_history.current = (historytype *)&replace_history.next;
|
||||
last_replace = mallocstrcpy(last_replace, "");
|
||||
#endif
|
||||
|
||||
i = statusq(FALSE, replace_list_2, last_replace,
|
||||
#ifndef NANO_SMALL
|
||||
&replace_history,
|
||||
@@ -948,21 +951,26 @@ void do_replace(void)
|
||||
edit_refresh();
|
||||
|
||||
if (numreplaced >= 0)
|
||||
statusbar(P_("Replaced %ld occurrence", "Replaced %ld occurrences",
|
||||
(long)numreplaced), (long)numreplaced);
|
||||
statusbar(P_("Replaced %lu occurrence",
|
||||
"Replaced %lu occurrences", (unsigned long)numreplaced),
|
||||
(unsigned long)numreplaced);
|
||||
|
||||
replace_abort();
|
||||
}
|
||||
|
||||
void do_gotoline(int line, bool save_pos)
|
||||
/* Go to the specified line and column, or ask for them if interactive
|
||||
* is TRUE. Save the x-coordinate and y-coordinate if save_pos is TRUE.
|
||||
* Note that both the line and column numbers should be one-based. */
|
||||
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
bool interactive, bool save_pos)
|
||||
{
|
||||
if (line <= 0) { /* Ask for it. */
|
||||
if (interactive) { /* Ask for it. */
|
||||
char *ans = mallocstrcpy(NULL, answer);
|
||||
int i = statusq(FALSE, gotoline_list, line < 0 ? ans : "",
|
||||
int i = statusq(FALSE, gotoline_list, use_answer ? ans : "",
|
||||
#ifndef NANO_SMALL
|
||||
NULL,
|
||||
#endif
|
||||
_("Enter line number"));
|
||||
_("Enter line number, column number"));
|
||||
|
||||
free(ans);
|
||||
|
||||
@@ -982,52 +990,50 @@ void do_gotoline(int line, bool save_pos)
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
* line or column number only if we hit Enter at the statusbar
|
||||
* prompt. */
|
||||
if (!parse_line_column(answer, &line, &column) || line < 1 ||
|
||||
column < 1) {
|
||||
if (i == 0)
|
||||
statusbar(_("Come on, be reasonable"));
|
||||
display_main_list();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (current->lineno > line) {
|
||||
for (; current->prev != NULL && current->lineno > line;
|
||||
current = current->prev)
|
||||
;
|
||||
} else {
|
||||
for (; current->next != NULL && current->lineno < line;
|
||||
current = current->next)
|
||||
;
|
||||
if (line < 1)
|
||||
line = current->lineno;
|
||||
|
||||
if (column < 1)
|
||||
column = placewewant + 1;
|
||||
}
|
||||
|
||||
current_x = 0;
|
||||
for (current = fileage; current->next != NULL && line > 1; line--)
|
||||
current = current->next;
|
||||
|
||||
current_x = actual_x(current->data, column - 1);
|
||||
placewewant = column - 1;
|
||||
|
||||
/* If save_pos is TRUE, don't change the cursor position when
|
||||
* updating the edit window. */
|
||||
edit_update(save_pos ? NONE : CENTER);
|
||||
|
||||
placewewant = 0;
|
||||
display_main_list();
|
||||
}
|
||||
|
||||
void do_gotoline_void(void)
|
||||
void do_gotolinecolumn_void(void)
|
||||
{
|
||||
do_gotoline(0, FALSE);
|
||||
do_gotolinecolumn(current->lineno, placewewant + 1, FALSE, TRUE,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
|
||||
void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww)
|
||||
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
|
||||
pos_pww)
|
||||
{
|
||||
/* Since do_gotoline() resets the x-coordinate but not the
|
||||
/* Since do_gotolinecolumn() resets the x-coordinate but not the
|
||||
* y-coordinate, set the coordinates up this way. */
|
||||
current_y = pos_y;
|
||||
do_gotoline(line, TRUE);
|
||||
|
||||
/* Make sure that the x-coordinate is sane here. */
|
||||
current_x = strlen(current->data);
|
||||
if (pos_x < current_x)
|
||||
current_x = pos_x;
|
||||
do_gotolinecolumn(line, pos_x + 1, FALSE, FALSE, TRUE);
|
||||
|
||||
/* Set the rest of the coordinates up. */
|
||||
placewewant = pos_pww;
|
||||
@@ -1035,51 +1041,53 @@ void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef HAVE_REGEX_H
|
||||
void do_find_bracket(void)
|
||||
{
|
||||
char ch_under_cursor, wanted_ch;
|
||||
const char *pos, *brackets = "([{<>}])";
|
||||
char regexp_pat[] = "[ ]";
|
||||
const char *pos, *bracket_pat = "([{<>}])";
|
||||
char cursor_ch, wanted_ch, regexp_pat[] = "[ ]";
|
||||
size_t current_x_save, pww_save;
|
||||
int count = 1;
|
||||
long flags_save;
|
||||
bool regexp_set = ISSET(USE_REGEXP);
|
||||
bool backwards_search_set = ISSET(BACKWARDS_SEARCH);
|
||||
filestruct *current_save;
|
||||
|
||||
ch_under_cursor = current->data[current_x];
|
||||
cursor_ch = current->data[current_x];
|
||||
pos = strchr(bracket_pat, cursor_ch);
|
||||
|
||||
pos = strchr(brackets, ch_under_cursor);
|
||||
if (ch_under_cursor == '\0' || pos == NULL) {
|
||||
if (cursor_ch == '\0' || pos == NULL) {
|
||||
statusbar(_("Not a bracket"));
|
||||
return;
|
||||
}
|
||||
|
||||
assert(strlen(brackets) % 2 == 0);
|
||||
wanted_ch = brackets[(strlen(brackets) - 1) - (pos - brackets)];
|
||||
assert(strlen(bracket_pat) % 2 == 0);
|
||||
|
||||
wanted_ch =
|
||||
bracket_pat[(strlen(bracket_pat) - 1) - (pos - bracket_pat)];
|
||||
|
||||
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)) {
|
||||
if (pos < bracket_pat + (strlen(bracket_pat) / 2)) {
|
||||
/* On a left bracket. */
|
||||
regexp_pat[1] = wanted_ch;
|
||||
regexp_pat[2] = ch_under_cursor;
|
||||
UNSET(REVERSE_SEARCH);
|
||||
regexp_pat[2] = cursor_ch;
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
} else {
|
||||
/* On a right bracket. */
|
||||
regexp_pat[1] = ch_under_cursor;
|
||||
regexp_pat[1] = cursor_ch;
|
||||
regexp_pat[2] = wanted_ch;
|
||||
SET(REVERSE_SEARCH);
|
||||
SET(BACKWARDS_SEARCH);
|
||||
}
|
||||
|
||||
regexp_init(regexp_pat);
|
||||
/* We constructed regexp_pat to be a valid expression. */
|
||||
|
||||
/* We constructed regexp_pat to be a valid regular expression. */
|
||||
assert(regexp_compiled);
|
||||
|
||||
findnextstr_wrap_reset();
|
||||
@@ -1087,7 +1095,7 @@ void do_find_bracket(void)
|
||||
if (findnextstr(FALSE, FALSE, FALSE, current, current_x,
|
||||
regexp_pat, NULL)) {
|
||||
/* Found identical bracket. */
|
||||
if (current->data[current_x] == ch_under_cursor)
|
||||
if (current->data[current_x] == cursor_ch)
|
||||
count++;
|
||||
/* Found complementary bracket. */
|
||||
else if (--count == 0) {
|
||||
@@ -1106,133 +1114,201 @@ void do_find_bracket(void)
|
||||
}
|
||||
|
||||
regexp_cleanup();
|
||||
flags = flags_save;
|
||||
|
||||
/* Restore search direction. */
|
||||
if (backwards_search_set)
|
||||
SET(BACKWARDS_SEARCH);
|
||||
else
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
|
||||
/* Restore regular expression usage setting. */
|
||||
if (!regexp_set)
|
||||
UNSET(USE_REGEXP);
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Indicate whether any of the history lists have changed. */
|
||||
bool history_has_changed(void)
|
||||
{
|
||||
return history_changed;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/*
|
||||
* search and replace history list support functions
|
||||
*/
|
||||
|
||||
/* initialize search and replace history lists */
|
||||
/* Initialize the search and replace history lists. */
|
||||
void history_init(void)
|
||||
{
|
||||
search_history.next = (historytype *)&search_history.prev;
|
||||
search_history.prev = NULL;
|
||||
search_history.tail = (historytype *)&search_history.next;
|
||||
search_history.current = search_history.next;
|
||||
search_history.count = 0;
|
||||
search_history.len = 0;
|
||||
search_history = make_new_node(NULL);
|
||||
search_history->data = mallocstrcpy(NULL, "");
|
||||
searchage = search_history;
|
||||
searchbot = search_history;
|
||||
|
||||
replace_history.next = (historytype *)&replace_history.prev;
|
||||
replace_history.prev = NULL;
|
||||
replace_history.tail = (historytype *)&replace_history.next;
|
||||
replace_history.current = replace_history.next;
|
||||
replace_history.count = 0;
|
||||
replace_history.len = 0;
|
||||
replace_history = make_new_node(NULL);
|
||||
replace_history->data = mallocstrcpy(NULL, "");
|
||||
replaceage = replace_history;
|
||||
replacebot = replace_history;
|
||||
}
|
||||
|
||||
/* find first node containing string *s in history list *h */
|
||||
historytype *find_node(historytype *h, const char *s)
|
||||
/* Return the first node containing the first len characters of the
|
||||
* string s in the history list, starting at h_start and ending at
|
||||
* h_end, or NULL if there isn't one. */
|
||||
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
|
||||
char *s, size_t len)
|
||||
{
|
||||
for (; h->next != NULL; h = h->next)
|
||||
if (strcmp(s, h->data) == 0)
|
||||
return h;
|
||||
filestruct *p;
|
||||
|
||||
for (p = h_start; p != h_end->next && p != NULL; p = p->next) {
|
||||
if (strncmp(s, p->data, len) == 0)
|
||||
return p;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* remove node *r */
|
||||
void remove_node(historytype *r)
|
||||
/* Update a history list. h should be the current position in the
|
||||
* list. */
|
||||
void update_history(filestruct **h, const char *s)
|
||||
{
|
||||
r->prev->next = r->next;
|
||||
r->next->prev = r->prev;
|
||||
free(r->data);
|
||||
free(r);
|
||||
}
|
||||
filestruct **hage = NULL, **hbot = NULL, *p;
|
||||
|
||||
/* add a node after node *h */
|
||||
void insert_node(historytype *h, const char *s)
|
||||
{
|
||||
historytype *a;
|
||||
assert(h != NULL && s != NULL);
|
||||
|
||||
a = (historytype *)nmalloc(sizeof(historytype));
|
||||
a->next = h->next;
|
||||
a->prev = h;
|
||||
h->next->prev = a;
|
||||
h->next = a;
|
||||
a->data = mallocstrcpy(NULL, s);
|
||||
}
|
||||
|
||||
/* update history list */
|
||||
void update_history(historyheadtype *h, const char *s)
|
||||
{
|
||||
historytype *p;
|
||||
|
||||
if ((p = find_node(h->next, s)) != NULL) {
|
||||
if (p == h->next) /* catch delete and re-insert of
|
||||
same string in 1st node */
|
||||
goto up_hs;
|
||||
remove_node(p); /* delete identical older string */
|
||||
h->count--;
|
||||
if (*h == search_history) {
|
||||
hage = &searchage;
|
||||
hbot = &searchbot;
|
||||
} else if (*h == replace_history) {
|
||||
hage = &replaceage;
|
||||
hbot = &replacebot;
|
||||
}
|
||||
if (h->count == MAX_SEARCH_HISTORY) { /* list 'full', delete oldest */
|
||||
remove_node(h->tail);
|
||||
h->count--;
|
||||
|
||||
assert(hage != NULL && hbot != NULL);
|
||||
|
||||
/* If this string is already in the history, delete it. */
|
||||
p = find_history(*hage, *hbot, s, (size_t)-1);
|
||||
|
||||
if (p != NULL) {
|
||||
filestruct *foo, *bar;
|
||||
|
||||
/* If the string is at the beginning, move the beginning down to
|
||||
* the next string. */
|
||||
if (p == *hage)
|
||||
*hage = (*hage)->next;
|
||||
|
||||
/* Delete the string. */
|
||||
foo = p;
|
||||
bar = p->next;
|
||||
unlink_node(foo);
|
||||
delete_node(foo);
|
||||
renumber(bar);
|
||||
}
|
||||
insert_node((historytype *)h, s);
|
||||
h->count++;
|
||||
SET(HISTORY_CHANGED);
|
||||
up_hs:
|
||||
h->current = h->next;
|
||||
}
|
||||
|
||||
/* return a pointer to either the next older history or NULL if no more */
|
||||
char *get_history_older(historyheadtype *h)
|
||||
{
|
||||
if (h->current->next != NULL) { /* any older entries? */
|
||||
h->current = h->current->next; /* yes */
|
||||
return h->current->data; /* return it */
|
||||
/* If the history is full, delete the beginning entry to make room
|
||||
* for the new entry at the end. */
|
||||
if ((*hbot)->lineno == MAX_SEARCH_HISTORY + 1) {
|
||||
filestruct *foo = *hage;
|
||||
|
||||
*hage = (*hage)->next;
|
||||
unlink_node(foo);
|
||||
delete_node(foo);
|
||||
renumber(*hage);
|
||||
}
|
||||
return NULL; /* end of list */
|
||||
}
|
||||
|
||||
char *get_history_newer(historyheadtype *h)
|
||||
{
|
||||
if (h->current->prev != NULL) {
|
||||
h->current = h->current->prev;
|
||||
if (h->current->prev != NULL)
|
||||
return h->current->data;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
/* Add the new entry to the end. */
|
||||
(*hbot)->data = mallocstrcpy(NULL, s);
|
||||
splice_node(*hbot, make_new_node(*hbot), (*hbot)->next);
|
||||
*hbot = (*hbot)->next;
|
||||
(*hbot)->data = mallocstrcpy(NULL, "");
|
||||
|
||||
/* get a completion */
|
||||
char *get_history_completion(historyheadtype *h, char *s)
|
||||
{
|
||||
historytype *p;
|
||||
|
||||
for (p = h->current->next; p->next != NULL; p = p->next) {
|
||||
if (strncmp(s, p->data, h->len) == 0 && strlen(p->data) != h->len) {
|
||||
h->current = p;
|
||||
return p->data;
|
||||
}
|
||||
}
|
||||
h->current = (historytype*)h;
|
||||
null_at(&s, h->len);
|
||||
return s;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* free a history list */
|
||||
void free_history(historyheadtype *h)
|
||||
{
|
||||
historytype *p;
|
||||
|
||||
for (p = h->next; p->next != NULL; p = p->next)
|
||||
remove_node(p);
|
||||
}
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Indicate that the history's been changed. */
|
||||
history_changed = TRUE;
|
||||
#endif
|
||||
|
||||
/* end of history support functions */
|
||||
/* Set the current position in the list to the bottom. */
|
||||
*h = *hbot;
|
||||
}
|
||||
|
||||
/* Move h to the string in the history list just before it, and return
|
||||
* that string. If there isn't one, don't move h and return NULL. */
|
||||
char *get_history_older(filestruct **h)
|
||||
{
|
||||
assert(h != NULL);
|
||||
|
||||
if ((*h)->prev == NULL)
|
||||
return NULL;
|
||||
|
||||
*h = (*h)->prev;
|
||||
|
||||
return (*h)->data;
|
||||
}
|
||||
|
||||
/* Move h to the string in the history list just after it, and return
|
||||
* that string. If there isn't one, don't move h and return NULL. */
|
||||
char *get_history_newer(filestruct **h)
|
||||
{
|
||||
assert(h != NULL);
|
||||
|
||||
if ((*h)->next == NULL)
|
||||
return NULL;
|
||||
|
||||
*h = (*h)->next;
|
||||
|
||||
return (*h)->data;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
/* Move h to the next string that's a tab completion of the string s,
|
||||
* looking at only the first len characters of s, and return that
|
||||
* string. If there isn't one, or if len is 0, don't move h and return
|
||||
* s. */
|
||||
char *get_history_completion(filestruct **h, char *s, size_t len)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
if (len > 0) {
|
||||
filestruct *hage = NULL, *hbot = NULL, *p;
|
||||
|
||||
assert(h != NULL);
|
||||
|
||||
if (*h == search_history) {
|
||||
hage = searchage;
|
||||
hbot = searchbot;
|
||||
} else if (*h == replace_history) {
|
||||
hage = replaceage;
|
||||
hbot = replacebot;
|
||||
}
|
||||
|
||||
assert(hage != NULL && hbot != NULL);
|
||||
|
||||
/* Search the history list from the current position to the
|
||||
* bottom for a match of len characters. Skip over an exact
|
||||
* match. */
|
||||
p = find_history((*h)->next, hbot, s, len);
|
||||
|
||||
while (p != NULL && strcmp(p->data, s) == 0)
|
||||
p = find_history(p->next, hbot, s, len);
|
||||
|
||||
if (p != NULL) {
|
||||
*h = p;
|
||||
return (*h)->data;
|
||||
}
|
||||
|
||||
/* Search the history list from the top to the current position
|
||||
* for a match of len characters. Skip over an exact match. */
|
||||
p = find_history(hage, *h, s, len);
|
||||
|
||||
while (p != NULL && strcmp(p->data, s) == 0)
|
||||
p = find_history(p->next, *h, s, len);
|
||||
|
||||
if (p != NULL) {
|
||||
*h = p;
|
||||
return (*h)->data;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're here, we didn't find a match, we didn't find an inexact
|
||||
* match, or len is 0. Return s. */
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
443
src/utils.c
443
src/utils.c
@@ -2,20 +2,21 @@
|
||||
/**************************************************************************
|
||||
* 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) *
|
||||
* 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. *
|
||||
* 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. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -27,24 +28,24 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#undef regexec
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
/* Work around a potential segfault in glibc 2.2.3's regexec(). */
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
if (string != NULL && *string != '\0')
|
||||
return regexec(preg, string, nmatch, pmatch, eflags);
|
||||
|
||||
return REG_NOMATCH;
|
||||
}
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#endif /* BROKEN_REGEXEC */
|
||||
#endif
|
||||
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string)
|
||||
{
|
||||
@@ -54,29 +55,10 @@ int regexp_bol_or_eol(const regex_t *preg, const char *string)
|
||||
}
|
||||
#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 digits(size_t n)
|
||||
{
|
||||
int i = 1;
|
||||
|
||||
if (n < 0)
|
||||
n = -n;
|
||||
|
||||
while (n > 10) {
|
||||
n /= 10;
|
||||
i++;
|
||||
@@ -85,6 +67,23 @@ int num_of_digits(int n)
|
||||
return i;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
@@ -94,26 +93,65 @@ bool parse_num(const char *str, ssize_t *val)
|
||||
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;
|
||||
}
|
||||
|
||||
/* Fix the memory allocation for a string. */
|
||||
void align(char **strp)
|
||||
/* Read an int and a ssize_t, separated by a comma, from str, and store
|
||||
* them in *line and *column (if they're not both NULL). On error, we
|
||||
* return FALSE. Otherwise, we return TRUE. */
|
||||
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||
{
|
||||
assert(strp != NULL);
|
||||
if (*strp != NULL)
|
||||
*strp = charealloc(*strp, strlen(*strp) + 1);
|
||||
bool retval = TRUE;
|
||||
const char *comma;
|
||||
|
||||
assert(str != NULL);
|
||||
|
||||
comma = strchr(str, ',');
|
||||
|
||||
if (comma != NULL && column != NULL) {
|
||||
if (!parse_num(str + (comma - str + 1), column))
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
if (line != NULL) {
|
||||
if (comma != NULL) {
|
||||
char *str_line = mallocstrncpy(NULL, str, comma - str + 1);
|
||||
str_line[comma - str] = '\0';
|
||||
|
||||
if (str_line[0] != '\0' && !parse_num(str_line, line))
|
||||
retval = FALSE;
|
||||
|
||||
free(str_line);
|
||||
} else if (!parse_num(str, line))
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Fix the memory allocation for a string. */
|
||||
void align(char **str)
|
||||
{
|
||||
assert(str != NULL);
|
||||
|
||||
if (*str != NULL)
|
||||
*str = charealloc(*str, strlen(*str) + 1);
|
||||
}
|
||||
|
||||
/* Null a string at a certain index and align it. */
|
||||
void null_at(char **data, size_t index)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
*data = charealloc(*data, index + 1);
|
||||
(*data)[index] = '\0';
|
||||
}
|
||||
@@ -123,6 +161,7 @@ void null_at(char **data, size_t index)
|
||||
void unsunder(char *str, size_t true_len)
|
||||
{
|
||||
assert(str != NULL);
|
||||
|
||||
for (; true_len > 0; true_len--, str++) {
|
||||
if (*str == '\0')
|
||||
*str = '\n';
|
||||
@@ -134,113 +173,13 @@ void unsunder(char *str, size_t true_len)
|
||||
void sunder(char *str)
|
||||
{
|
||||
assert(str != NULL);
|
||||
|
||||
for (; *str != '\0'; str++) {
|
||||
if (*str == '\n')
|
||||
*str = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
@@ -265,15 +204,15 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
|
||||
/* Allocate the line the first time. */
|
||||
if (*lineptr == NULL) {
|
||||
*lineptr = charalloc(128);
|
||||
*n = 128;
|
||||
*lineptr = charalloc(MAX_BUF_SIZE);
|
||||
*n = MAX_BUF_SIZE;
|
||||
}
|
||||
|
||||
while ((c = getc(stream)) != EOF) {
|
||||
/* Check if more memory is needed. */
|
||||
if (indx >= *n) {
|
||||
*lineptr = charealloc(*lineptr, *n + 128);
|
||||
*n += 128;
|
||||
*lineptr = charealloc(*lineptr, *n + MAX_BUF_SIZE);
|
||||
*n += MAX_BUF_SIZE;
|
||||
}
|
||||
|
||||
/* Push the result in the line. */
|
||||
@@ -286,8 +225,8 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
|
||||
/* Make room for the null character. */
|
||||
if (indx >= *n) {
|
||||
*lineptr = charealloc(*lineptr, *n + 128);
|
||||
*n += 128;
|
||||
*lineptr = charealloc(*lineptr, *n + MAX_BUF_SIZE);
|
||||
*n += MAX_BUF_SIZE;
|
||||
}
|
||||
|
||||
/* Null terminate the buffer. */
|
||||
@@ -314,20 +253,22 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
* 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);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
if (regexec(&search_regexp, haystack, 1, regmatches, 0) == 0
|
||||
&& haystack + regmatches[0].rm_so <= start) {
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
if (regexec(&search_regexp, haystack, 1, regmatches,
|
||||
0) == 0 && haystack + regmatches[0].rm_so <= start) {
|
||||
const char *retval = haystack + regmatches[0].rm_so;
|
||||
|
||||
/* 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)
|
||||
retval += 1 + regmatches[0].rm_so;
|
||||
while (regexec(&search_regexp, retval + 1, 1,
|
||||
regmatches, REG_NOTBOL) == 0 &&
|
||||
retval + regmatches[0].rm_so + 1 <= start)
|
||||
retval += regmatches[0].rm_so + 1;
|
||||
/* Finally, put the subexpression matches in global
|
||||
* variable regmatches. The REG_NOTBOL flag doesn't
|
||||
* matter now. */
|
||||
@@ -337,7 +278,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);
|
||||
@@ -346,10 +287,10 @@ 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))
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
return revstrstr(haystack, needle, start);
|
||||
else
|
||||
#endif
|
||||
@@ -357,25 +298,26 @@ 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);
|
||||
else if (ISSET(BACKWARDS_SEARCH))
|
||||
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
|
||||
* of ncurses, calls perror (which writes to stderr), then refreshes the
|
||||
* screen. Note that nperror() causes the window to flicker once. */
|
||||
* of curses, calls perror() (which writes to stderr), and then
|
||||
* refreshes the screen. Note that nperror() causes the window to
|
||||
* flicker once. */
|
||||
void nperror(const char *s)
|
||||
{
|
||||
/* leave ncurses mode, go to the terminal */
|
||||
/* Leave curses mode and go to the terminal. */
|
||||
if (endwin() != ERR) {
|
||||
perror(s); /* print the error */
|
||||
total_refresh(); /* return to ncurses and repaint */
|
||||
perror(s); /* Print the error. */
|
||||
total_refresh(); /* Return to curses and refresh. */
|
||||
}
|
||||
}
|
||||
|
||||
/* Thanks BG, many ppl have been asking for this... */
|
||||
/* Thanks, BG, many people have been asking for this... */
|
||||
void *nmalloc(size_t howmuch)
|
||||
{
|
||||
void *r = malloc(howmuch);
|
||||
@@ -417,7 +359,8 @@ char *mallocstrncpy(char *dest, const char *src, size_t n)
|
||||
* "dest = mallocstrcpy(dest, src);". */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
{
|
||||
return mallocstrncpy(dest, src, src == NULL ? 1 : strlen(src) + 1);
|
||||
return mallocstrncpy(dest, src, (src == NULL) ? 1 :
|
||||
strlen(src) + 1);
|
||||
}
|
||||
|
||||
/* Free the malloc()ed string at dest and return the malloc()ed string
|
||||
@@ -456,51 +399,6 @@ void remove_magicline(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* 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, long *size)
|
||||
{
|
||||
const filestruct *f;
|
||||
|
||||
if (lines != NULL)
|
||||
*lines = 0;
|
||||
if (size != NULL)
|
||||
*size = 0;
|
||||
|
||||
/* Go through the lines from begin to end->prev, if we can. */
|
||||
for (f = begin; f != NULL && f != end; f = f->next) {
|
||||
/* Count this line. */
|
||||
if (lines != NULL)
|
||||
(*lines)++;
|
||||
|
||||
/* Count the number of characters on this line. */
|
||||
if (size != NULL) {
|
||||
*size += strlen(f->data);
|
||||
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
(*size)++;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 += strlen(f->data);
|
||||
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
(*size)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set top_x and bot_x to the top and bottom x-coordinates of the mark,
|
||||
* respectively, based on the locations of top and bot. If
|
||||
* right_side_up isn't NULL, set it to TRUE If the mark begins with
|
||||
@@ -512,7 +410,7 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
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) {
|
||||
mark_beginx) || current->lineno > mark_beginbuf->lineno) {
|
||||
*top = mark_beginbuf;
|
||||
*top_x = mark_beginx;
|
||||
*bot = current;
|
||||
@@ -530,104 +428,47 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
}
|
||||
#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, size_t
|
||||
*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
|
||||
|
||||
3297
src/winio.c
3297
src/winio.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user