Compare commits
579 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a9d4935eb | ||
|
|
92dd91cd0b | ||
|
|
dad746e6dd | ||
|
|
45e3452b3e | ||
|
|
4005fc6257 | ||
|
|
90b07fc2fd | ||
|
|
7b71f573e7 | ||
|
|
4071de1989 | ||
|
|
6f5de42702 | ||
|
|
7de4dc8d08 | ||
|
|
0ed9c5fb37 | ||
|
|
37dd775f98 | ||
|
|
86b6c3e5db | ||
|
|
62a2528ab8 | ||
|
|
e283b0d638 | ||
|
|
d04499202c | ||
|
|
ec729750b0 | ||
|
|
8f36d09d18 | ||
|
|
ae4c3a6206 | ||
|
|
95ef337b1a | ||
|
|
9c4488bf0c | ||
|
|
5ab12ca761 | ||
|
|
ca37ee67d9 | ||
|
|
bdc1b9b568 | ||
|
|
cd9a5f0377 | ||
|
|
c4b854d5c7 | ||
|
|
a03d9c0ecd | ||
|
|
23bdb27155 | ||
|
|
3c4dc46fdc | ||
|
|
1c3bfa9f2b | ||
|
|
feb89db8a0 | ||
|
|
239b415786 | ||
|
|
7f26c7384d | ||
|
|
1c367b6949 | ||
|
|
f56229948d | ||
|
|
093d500e15 | ||
|
|
93bef536f7 | ||
|
|
e4e6173389 | ||
|
|
be614ec3b4 | ||
|
|
e014fbda80 | ||
|
|
7fc0ada6cc | ||
|
|
20d3cb0614 | ||
|
|
47daf0279d | ||
|
|
79d9795c80 | ||
|
|
738893f9c7 | ||
|
|
c83512ac6a | ||
|
|
111f37a853 | ||
|
|
c6836ec6d5 | ||
|
|
a8db26010b | ||
|
|
8bcf43b137 | ||
|
|
6834650570 | ||
|
|
8ad58bcde3 | ||
|
|
a9b862c804 | ||
|
|
21bec6c96d | ||
|
|
11219babbf | ||
|
|
c71e031d8a | ||
|
|
84fdb90e52 | ||
|
|
31de105eec | ||
|
|
85ea1de1c7 | ||
|
|
4fde119362 | ||
|
|
4cf2246f04 | ||
|
|
9fece9deb0 | ||
|
|
d7f0fe9243 | ||
|
|
4f03daff91 | ||
|
|
6a3ac36420 | ||
|
|
4adb37ed1d | ||
|
|
057edf7384 | ||
|
|
abd8993660 | ||
|
|
8c7a562394 | ||
|
|
8b006c2912 | ||
|
|
815fb0a2a2 | ||
|
|
6ff695c154 | ||
|
|
71dd8c1ca6 | ||
|
|
8c55d21bd6 | ||
|
|
b7bf27a509 | ||
|
|
c25ed534eb | ||
|
|
258497fb5c | ||
|
|
107e816324 | ||
|
|
6a83647a11 | ||
|
|
56e36ef7b5 | ||
|
|
bf0e47dc37 | ||
|
|
5d552195ea | ||
|
|
e796a7b5b9 | ||
|
|
492e501fb3 | ||
|
|
7aec89e9c9 | ||
|
|
d152ad378b | ||
|
|
5a584ccda3 | ||
|
|
179b1bad87 | ||
|
|
eab0fd808c | ||
|
|
04f65f2e17 | ||
|
|
db57ad757f | ||
|
|
5745c0a11f | ||
|
|
15d6857b27 | ||
|
|
4ab80154e9 | ||
|
|
c879f55691 | ||
|
|
6135bf3f6b | ||
|
|
ab73dd4816 | ||
|
|
5295cfe72c | ||
|
|
2385c1aa9b | ||
|
|
282a940745 | ||
|
|
3f4520b348 | ||
|
|
d4e3c59f27 | ||
|
|
d6c24c4133 | ||
|
|
6d8e495c37 | ||
|
|
75a29b749e | ||
|
|
96452cb60c | ||
|
|
d4defccded | ||
|
|
f9782e0437 | ||
|
|
3fe08acd27 | ||
|
|
6969c995d1 | ||
|
|
b18482e1b0 | ||
|
|
4401862e12 | ||
|
|
3f12ada4ef | ||
|
|
520a90c8d9 | ||
|
|
94d7cb6826 | ||
|
|
56d083779f | ||
|
|
c35e351dd0 | ||
|
|
22ae034f2d | ||
|
|
3d5e94560d | ||
|
|
78a81b29b1 | ||
|
|
07d5df4aeb | ||
|
|
8e94234b00 | ||
|
|
72936854c4 | ||
|
|
7ea09e540f | ||
|
|
cc8185fe2b | ||
|
|
150d889965 | ||
|
|
4e5e1ae1a3 | ||
|
|
691698a954 | ||
|
|
2a73131f0e | ||
|
|
ce78cdb722 | ||
|
|
acefd9e9b5 | ||
|
|
945a91357a | ||
|
|
27865304d7 | ||
|
|
c00513b65e | ||
|
|
c009759c23 | ||
|
|
47bb888ad2 | ||
|
|
44ca4f898c | ||
|
|
61f567378a | ||
|
|
66444c37b3 | ||
|
|
d1dc23bd78 | ||
|
|
7f343a6dc4 | ||
|
|
3a9a32996b | ||
|
|
c4037f3055 | ||
|
|
e99494f21a | ||
|
|
ca62f9fa2b | ||
|
|
38f70a5edd | ||
|
|
7866cd3ef7 | ||
|
|
03777799d4 | ||
|
|
e4b0742e9e | ||
|
|
239c3d47dd | ||
|
|
96e6d56571 | ||
|
|
826fbea8e1 | ||
|
|
e3bae98aab | ||
|
|
91d468d7fd | ||
|
|
7dc531a801 | ||
|
|
0dd50d6f62 | ||
|
|
0e581b3524 | ||
|
|
24b1563068 | ||
|
|
a0aa4df041 | ||
|
|
091068982d | ||
|
|
f7bcbeb87e | ||
|
|
de0c5eb899 | ||
|
|
dbeb503316 | ||
|
|
4c221675a8 | ||
|
|
50a33dbbb7 | ||
|
|
7eb30a8353 | ||
|
|
a7f488b51f | ||
|
|
c104ef15a6 | ||
|
|
5e146e815f | ||
|
|
157ce9120b | ||
|
|
4d46437f87 | ||
|
|
5b44f373fd | ||
|
|
8f4762a842 | ||
|
|
8f1afee813 | ||
|
|
b00f7e3c6f | ||
|
|
e5806be519 | ||
|
|
6a74c9224c | ||
|
|
cb8d845ad7 | ||
|
|
538dc352c5 | ||
|
|
a74f2f8618 | ||
|
|
8f948fa1eb | ||
|
|
26ee759503 | ||
|
|
0532296a10 | ||
|
|
443a766fe2 | ||
|
|
fa82853aea | ||
|
|
47a153f538 | ||
|
|
b802a13c5a | ||
|
|
1458891b9f | ||
|
|
d2361f0761 | ||
|
|
43cf7a1be3 | ||
|
|
f00c9612b3 | ||
|
|
a8da623410 | ||
|
|
db95802a18 | ||
|
|
0c4ca3509f | ||
|
|
e5c7e928c9 | ||
|
|
222b201afe | ||
|
|
5128de8308 | ||
|
|
16349c992a | ||
|
|
112620432a | ||
|
|
90f772b250 | ||
|
|
caa86591f4 | ||
|
|
d4dab46ebc | ||
|
|
b386a905e6 | ||
|
|
b1ce64a375 | ||
|
|
2d705caec7 | ||
|
|
1d696c0047 | ||
|
|
a0ebc813f1 | ||
|
|
56001845cd | ||
|
|
be5cdb2748 | ||
|
|
76c25f582a | ||
|
|
dbcaa3b1fb | ||
|
|
6ad59cd29b | ||
|
|
64661ac140 | ||
|
|
9d8396d340 | ||
|
|
f8cb832b50 | ||
|
|
503f278547 | ||
|
|
90573296ea | ||
|
|
826ab5a4fe | ||
|
|
d41b468975 | ||
|
|
3e0f523d59 | ||
|
|
de03989e86 | ||
|
|
757f739367 | ||
|
|
1228699f2c | ||
|
|
d72bdf17f4 | ||
|
|
9c1fef04a2 | ||
|
|
c275f068ab | ||
|
|
62d616b62b | ||
|
|
9838a5182e | ||
|
|
ec01074075 | ||
|
|
504ae90a8e | ||
|
|
405ed0f822 | ||
|
|
da50e73c40 | ||
|
|
e927ce59d1 | ||
|
|
892396bb7d | ||
|
|
658f7e6630 | ||
|
|
32263ede86 | ||
|
|
0c3d3c9fed | ||
|
|
612b41615b | ||
|
|
e3df8788b7 | ||
|
|
a549a82c32 | ||
|
|
9c3249c893 | ||
|
|
d5092294cd | ||
|
|
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 |
8
AUTHORS
8
AUTHORS
@@ -6,7 +6,7 @@ nano editor. Please see the ChangeLog for specific changes by author.
|
||||
Chris Allegretta <chrisa@asty.org>
|
||||
* Original program author, stable series maintainer.
|
||||
|
||||
David Lawrence Ramsey <pooka_regent@sluggy.net>
|
||||
David Lawrence Ramsey <pooka109@cox.net>
|
||||
* Development series maintainer. Multiple buffer support,
|
||||
operating dir (-o) option, bug fixes for display routines,
|
||||
wrapping code, spelling fixes, const mode, parts of the UTF-8
|
||||
@@ -35,3 +35,9 @@ David Benbennick <dbenbenn@math.cornell.edu>
|
||||
* Wrap and justify bugfixes/enhancements, new color syntax
|
||||
code, memleak fixes, parts of the UTF-8 support, and other
|
||||
miscellaneous fixes.
|
||||
|
||||
Mike Frysinger <vapier@gentoo.org>
|
||||
* Gentoo package maintainer. Whitespace display mode,
|
||||
--enable-utf8/--disable-utf8 configure options for ncurses,
|
||||
many new color regexes and improvements to existing color
|
||||
regexes for nanorc.sample, and miscellaneous bug fixes.
|
||||
|
||||
@@ -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
|
||||
|
||||
40
NEWS
40
NEWS
@@ -1,3 +1,43 @@
|
||||
2005.10.23 - GNU nano 1.3.9 breaks through the wall. This release
|
||||
includes major enhancements as well as bugfixes. The
|
||||
enhancements include better handling of invalid UTF-8,
|
||||
expansion of the word count option to also count lines
|
||||
and characters in the file or selection, more efficient
|
||||
screen update routines, a readded -K/--rebindkeypad
|
||||
option to work around numeric keypad problems on
|
||||
terminals that don't show the usual NumLock glitch, a
|
||||
new -W/--wordbounds option to properly detect words
|
||||
containing punctuation when moving among them, and
|
||||
massive improvements to the color code such as handling
|
||||
of unspecified foreground colors, more efficient memory
|
||||
usage for color regexes, and new reserved syntaxes
|
||||
"default" and "none". The bugfixes include fixes for
|
||||
the rewritten history code, fixes for potential line
|
||||
numbering problems on 64-bit platforms, fixes for a few
|
||||
long-standing minor display problems, a fix for erroneous
|
||||
hangups occurring while waiting for input, and a fix for
|
||||
a segfault when displaying certain overly long lines.
|
||||
Have fun with it.
|
||||
|
||||
2005.06.30 - GNU nano 1.3.8 floats at its own level. This release
|
||||
contains several new features. Among other things, you
|
||||
can now move to a specified column number as well as
|
||||
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
|
||||
|
||||
@@ -14,7 +14,7 @@ packages:
|
||||
- texinfo
|
||||
- cvs
|
||||
- ssh (with support for the SSH version 2 protocol)
|
||||
- glib 2.x (if your system doesn't have snprintf() and/or vsnprintf())
|
||||
- glib 2.x (if your system doesn't have vsnprintf())
|
||||
- make, gcc and the normal development libraries (curses or slang, etc.)
|
||||
|
||||
These should be available on your GNU mirror. Note that you'll need a
|
||||
@@ -30,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
|
||||
|
||||
20
THANKS
20
THANKS
@@ -1,24 +1,26 @@
|
||||
The following people have helped GNU nano in some way or another.
|
||||
If we missed you here, let us know!
|
||||
|
||||
|
||||
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com>
|
||||
Malay translator
|
||||
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian translator
|
||||
CHAO Wei-Lun <chaoweilun@pcmail.com.tw> Traditional Chinese translator
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish translator
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish translator
|
||||
Marco Colombo <magicdice@inwind.it> Italian translator
|
||||
Yavor Doganov <yavor@doganov.org> Bulgarian translator
|
||||
Karl Eichwalder <keichwa@gmx.net> German translator
|
||||
Doruk Fisek <dfisek@fisek.com.tr> Turkish translator
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net>
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net>
|
||||
French translator
|
||||
Geir Helland Norwegian bokmål translator
|
||||
Geir Helland Norwegian bokmål translator
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Indonesian translator
|
||||
Václav Haisman <V.Haisman@sh.cvut.cz> Czech translator
|
||||
Václav Haisman <V.Haisman@sh.cvut.cz> Czech translator
|
||||
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu>
|
||||
Hungarian translator
|
||||
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish Translator
|
||||
Eivind Kjørstad <ekj@vestdata.no> Norwegian nynorsk translator
|
||||
Florian König <floki@bigfoot.com> German translator
|
||||
Eivind Kjørstad <ekj@vestdata.no> Norwegian nynorsk translator
|
||||
Florian König <floki@bigfoot.com> German translator
|
||||
Wojciech Kotwica <wkotwica@post.pl> Polish translator
|
||||
Clement Laforet <clem_laf@wanadoo.fr> French translator
|
||||
Gergely Nagy <algernon@debian.org> Hungarian translator
|
||||
@@ -28,15 +30,17 @@ Michael Piefel <piefel@informatik.hu-berlin.de> German translator
|
||||
Sergey A. Ribalchenko <fisher@obu.ck.ua> Russian, Ukrainian translator
|
||||
Michel Robitaille <robitail@IRO.UMontreal.CA> French translator
|
||||
Christian Rose <menthos@menthos.com> Swedish translator
|
||||
Stig E Sandoe <stig@ii.uib.no> Norwegian bokmål translator
|
||||
Stig E Sandoe <stig@ii.uib.no> Norwegian bokmål translator
|
||||
Benno Schulenberg <benno@nietvergeten.nl> Dutch translator
|
||||
Danilo Segan <dsegan@gmx.net> Serbian translator
|
||||
Keld Simonsen <keld@dkuug.dk> Danish translator
|
||||
Guus Sliepen <guus@nl.linux.org> Dutch translator
|
||||
Cezary Sliwa <sliwa@cft.edu.pl> Polish translator
|
||||
Pierre Tane <tanep@bigfoot.com> French translator
|
||||
Jacobo Tarrío <jtarrio@trasno.net> Galician translator
|
||||
Jacobo Tarrío <jtarrio@trasno.net> Galician translator
|
||||
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian nynorsk translator
|
||||
Miquel Vidal <miquel@sindominio.net> Catalan translator
|
||||
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese translator
|
||||
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish translator
|
||||
Peio Ziarsolo <peio@sindominio.net> Basque translator
|
||||
|
||||
|
||||
2
TODO
2
TODO
@@ -6,7 +6,7 @@ For version 1.4:
|
||||
- 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]
|
||||
- Spell check selected text only. [DONE]
|
||||
|
||||
73
configure.ac
73
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.7], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [1.3.9], [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,10 +36,12 @@ 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 termios.h wchar.h wctype.h)
|
||||
AC_CHECK_HEADER(regex.h,
|
||||
@@ -75,17 +78,16 @@ if test x$debug_support != xyes; then
|
||||
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])
|
||||
|
||||
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_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.])
|
||||
@@ -97,7 +99,7 @@ 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.])
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(help,
|
||||
@@ -152,7 +154,7 @@ AC_ARG_ENABLE(color,
|
||||
[ --enable-color Enable color and syntax highlighting],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
|
||||
AC_MSG_WARN([
|
||||
***********************************************************************
|
||||
*** WARNING: Color support is far from perfect, but functional. ***
|
||||
@@ -177,7 +179,7 @@ AC_ARG_ENABLE(all,
|
||||
[ --enable-all Enable ALL extra nano functionality (kitchen sink option)],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
|
||||
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
|
||||
AC_MSG_WARN([
|
||||
@@ -396,25 +398,24 @@ int main(void)
|
||||
|
||||
dnl Checks for functions.
|
||||
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf isblank strcasecmp strncasecmp strcasestr strnlen getline getdelim)
|
||||
AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_FUNCS(iswalnum mblen mbtowc wctomb wcwidth iswspace iswblank)
|
||||
AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace mblen mbstowcs mbtowc wctomb wcwidth)
|
||||
fi
|
||||
|
||||
if test x$ac_cv_func_snprintf = xno -o x$ac_cv_func_vsnprintf = xno; then
|
||||
if test x$ac_cv_func_vsnprintf = xno; then
|
||||
AM_PATH_GLIB_2_0(2.0.0,,
|
||||
AC_MSG_ERROR([
|
||||
*** snprintf() and/or vsnprintf() not found. GLIB 2.x not found either.
|
||||
*** You need both snprintf() and vsnprintf(). Alternatively you can
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
|
||||
*** vsnprintf() not found. GLIB 2.x not found either. You should
|
||||
*** install the GLIB 2.x library which can be found at
|
||||
*** ftp://ftp.gtk.org/.]),
|
||||
glib)
|
||||
fi
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
|
||||
dnl Checks for library functions.
|
||||
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS(getopt_long)
|
||||
@@ -425,7 +426,7 @@ 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, wget_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||
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
|
||||
@@ -437,7 +438,7 @@ 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, wget_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE=yes])
|
||||
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
|
||||
@@ -454,7 +455,7 @@ else
|
||||
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.]))
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors() command.]))
|
||||
|
||||
dnl Parse any configure options.
|
||||
|
||||
@@ -470,14 +471,16 @@ if test "x$GLIB_LIBS" != "x"; then
|
||||
fi
|
||||
|
||||
if test x$enable_utf8 != xno && \
|
||||
test x$CURSES_LIB_WIDE = xyes -a \
|
||||
x$ac_cv_func_iswalnum = xyes -a \
|
||||
x$ac_cv_func_mblen = xyes -a \
|
||||
x$ac_cv_func_mbtowc = xyes -a \
|
||||
x$ac_cv_func_wctomb = xyes -a \
|
||||
x$ac_cv_func_wcwidth = xyes && \
|
||||
test x$ac_cv_func_iswspace = xyes -o x$ac_cv_func_iswblank = xyes; then
|
||||
AC_DEFINE(NANO_WIDE, 1, [Define this if your system has sufficient wide character support (a wide curses library, iswalnum(), iswspace() or iswblank(), mblen(), mbtowc(), wctomb(), and wcwidth()).])
|
||||
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(ENABLE_UTF8, 1, [Define this if your system has sufficient UTF-8 support (a wide curses library, iswalnum(), iswpunct(), iswblank() or iswspace(), mblen(), mbstowcs(), mbtowc(), wctomb(), and wcwidth()).])
|
||||
else
|
||||
if test x$enable_utf8 = xyes; then
|
||||
AC_MSG_ERROR([
|
||||
|
||||
61
doc/faq.html
61
doc/faq.html
@@ -33,15 +33,16 @@
|
||||
<h2><a href="#4">4. Running</a></h2>
|
||||
<blockquote><p><a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
|
||||
<a href="#4.2">4.2. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</a><br>
|
||||
<a href="#4.3">4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.4">4.4. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.5">4.5. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.6">4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.7a">4.7a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
|
||||
<a href="#4.7b">4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.8">4.8. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.9">4.9. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.10">4.10. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a></p></blockquote>
|
||||
<a href="#4.3">4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</a><br>
|
||||
<a href="#4.4">4.4. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.5">4.5. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.6">4.6. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.7">4.7. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.8a">4.8a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
|
||||
<a href="#4.8b">4.8b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.9">4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.10">4.10. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.11">4.11. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a></p></blockquote>
|
||||
<h2><a href="#5">5. Internationalization</a></h2>
|
||||
<blockquote><p><a href="#5.1">5.1. There's no translation for my language!</a><br>
|
||||
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a></p></blockquote>
|
||||
@@ -62,7 +63,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:pooka109@cox.net">pooka109@cox.net</a>>. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
|
||||
<h2><a name="1.2"></a>1.2. How do I contribute to it?</h2>
|
||||
<blockquote><p>Your best bet is to send it to the nano email address, <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a> and if it is useful enough it will be included in future versions.</p></blockquote>
|
||||
<h2><a name="1.3"></a>1.3. What is GNU nano?</h2>
|
||||
@@ -80,7 +81,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.7. 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.9. 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%">
|
||||
@@ -154,7 +155,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
|
||||
@@ -163,11 +164,11 @@
|
||||
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 four-digit hexadecimal code from 0000 to ffff (case-insensitive), and the character with the corresponding value will be inserted instead.</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 six-digit hexadecimal code from 000000 to 10FFFF (case-insensitive), and the character with the corresponding value will be inserted instead.</p></blockquote>
|
||||
<h2><a name="3.9"></a>3.9. How do I make a .nanorc file that nano will read when I start it?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your version of nano must have been compiled with <b>--enable-nanorc</b>, and again must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the word <b>set</b> and the getopt_long flag for the feature, for example "set nowrap" or "set suspend".</p></blockquote>
|
||||
<hr width="100%">
|
||||
@@ -181,19 +182,21 @@
|
||||
<blockquote><p>Try setting your $TERM variable to 'vt100'. Nano doesn't yet support every term entry under the sun.</p>
|
||||
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
|
||||
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
|
||||
<h2><a name="4.3"></a>4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
|
||||
<h2><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h2>
|
||||
<blockquote><p>You can use the <b>-K</b> or <b>--rebindkeypad</b> options on the command line, or add the line <b>set rebindkeypad</b> to your .nanorc. However, nano's mouse support won't work properly if you do any of these things.</p></blockquote>
|
||||
<h2><a name="4.4"></a>4.4. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
|
||||
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, or Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
|
||||
<h2><a name="4.4"></a>4.4. Nano crashes when I type <insert keystroke here>!</h2>
|
||||
<h2><a name="4.5"></a>4.5. Nano crashes when I type <insert keystroke here>!</h2>
|
||||
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or to <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</p></blockquote>
|
||||
<h2><a name="4.5"></a>4.5. Nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<h2><a name="4.6"></a>4.6. Nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9 would be great, 0.9.12 is recommended).</p></blockquote>
|
||||
<h2><a name="4.6"></a>4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
|
||||
<h2><a name="4.7"></a>4.7. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
|
||||
<blockquote><p>The help (^G) and justify (^J) function were among the last to be written. To show the improvements that nano had over Pico (go to line # and replace), ^_ and ^\ were put on the shortcut list. Later, ^G came back in place of ^_ as it proved to be very valuable for new Unix users. If you use the <b>-p</b> option to nano (or hit Meta-P) you will get the same shortcuts at the bottom as Pico.</p></blockquote>
|
||||
<h2><a name="4.7a"></a>4.7a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
|
||||
<h2><a name="4.8a"></a>4.8a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
|
||||
<blockquote><p>In nano version 0.9.20, the default is to have a completely consistent user interface across all user input functions. This means that regardless of whether you're being asked for a filename to insert or write, or a string to search for, the previous value is already inserted before the cursor. If you prefer the old behavior, use the Pico emulation mode (-p or --pico) or just hit Meta-P while in nano (see the ^G help text for more details).</p></blockquote>
|
||||
<h2><a name="4.7b"></a>4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<h2><a name="4.8b"></a>4.8b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<blockquote><p>It was decided that consistency was nice, but people are used to Pico's inconsistent behavior. Also, in version 1.1.99pre1, search and replace history was introduced. If you wish to edit your previous search/replace entry (or any previous entry), you can do so by hitting the up arrow to cycle through your history. This method allows the best of both worlds: You don't need to erase the previous string if you want to enter a new one, but you can with one keystroke recall previous entries for editing. Therefore there is now no "Pico mode", nano is and has always been a Pico <b>clone</b>, and clones by default should be compatible.</p></blockquote>
|
||||
<h2><a name="4.8"></a>4.8. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<h2><a name="4.9"></a>4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
|
||||
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
|
||||
<p>or if you use tcsh put this in your <b>.cshrc</b> file:</p>
|
||||
@@ -206,10 +209,10 @@
|
||||
<p>Mutt users should see an effect immediately the next time you log in, no further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
|
||||
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
|
||||
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
|
||||
<h2><a name="4.9"></a>4.9. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<h2><a name="4.10"></a>4.10. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Some example configurations are in the <b>nanorc.sample</b> that comes with the nano source or your nano package. See Section <a href="#3.9">3.9</a>.</p></blockquote>
|
||||
<h2><a name="4.10"></a>4.10. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
|
||||
<blockquote><p>Try holding down the Shift key and selecting the text as you normally would.</p></blockquote>
|
||||
<h2><a name="4.11"></a>4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
|
||||
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
<h2><a name="5.1"></a>5.1. There's no translation for my language!</h2>
|
||||
@@ -249,7 +252,13 @@
|
||||
<blockquote><p>Re-read Section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote>
|
||||
<p>
|
||||
<p>2005/08/27 - Update email address. (DLR)<br>
|
||||
2005/08/10 - Add a new section 4.3, and move all section 4 entries after it down one number, to explain how to deal with numeric keypad problems. (DLR)<br>
|
||||
2005/08/08 - Update section 3.8 to mention that verbatim input mode now takes a six-digit hexadecimal number. (DLR)<br>
|
||||
2005/07/04 - Update section 4.10 to mention that pasting from the X clipboard via the middle mouse button also works when the Shift key is used. (DLR)<br>
|
||||
2005/06/15 - Update description of --enable-extra, and add missing line breaks. (DLR)<br>
|
||||
2005/06/13 - Minor capitalization and wording fixes. (DLR)<br>
|
||||
2005/06/08 - Updated section 1.1 to mention the current maintainer. (DLR)<br>
|
||||
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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003 by
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by
|
||||
.\" Chris Allegretta <chrisa@asty.org>
|
||||
.\"
|
||||
.\" (c) 2003-2004 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" pour l'adaptation française
|
||||
.\" Adaptation française (c) 2003-2005 par
|
||||
.\" Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" Ce document est libre. Reportez-vous à la dernière version de la
|
||||
.\" licence publique générale GNU (GNU GPL) pour connaître ses
|
||||
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
|
||||
.\" conditions d'utilisation. Ce document est distribué sans
|
||||
.\" AUCUNE garantie.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.4" "17 août 2004"
|
||||
.TH NANO 1 "version 1.3.9" "23 octobre 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\"
|
||||
|
||||
|
||||
.SH NOM
|
||||
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [\+LIGNE]\ [options]\ [fichier]
|
||||
.I [\+LIGNE,COLONNE]\ [options]\ [fichier]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -43,31 +43,35 @@ num
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILIGNE\fR
|
||||
Démarre avec le curseur positionné à la ligne numéro \fILIGNE\fR.
|
||||
.B \+\fILIGNE\fP,\fICOLONNE\fP
|
||||
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
|
||||
la ligne \fILIGNE\fR au lieu de démarrer à la colonne\ 1, ligne\ 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Identique à \fB-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
Active le fonctionnement évolué de la touche «\ Début\ ». Lorsque cette
|
||||
touche est pressée à n'importe quel endroit excepté au tout début du
|
||||
texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur se
|
||||
positionnera à ce début de ligne (qu'il soit en avant ou en arrière). Si
|
||||
le curseur est déjà au tout début de la ligne, il se placera au vrai
|
||||
début de la ligne.
|
||||
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque l'on
|
||||
appuie sur cette touche à n'importe quel endroit excepté au tout début
|
||||
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
|
||||
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
|
||||
arrière). Si le curseur est déjà là, il se placera au vrai début de la
|
||||
ligne.
|
||||
.TP
|
||||
.B \-B (\-\-backup)
|
||||
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
|
||||
version précédente, en ajoutant un tilde (~) au nom du fichier.
|
||||
.TP
|
||||
.B \-D (\-\-dos)
|
||||
Écrit le fichier au format DOS.
|
||||
.TP
|
||||
.B \-E \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
|
||||
.B \-C \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
|
||||
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
|
||||
de sécurité si celles-ci sont activées.
|
||||
de sécurité uniques si celles-ci sont activées.
|
||||
.TP
|
||||
.B \-E (\-\-tabstospaces)
|
||||
Convertit les tabulations clavier en espaces.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
Active le mode multifichier, autorisant l'édition simultanée de plusieurs
|
||||
fichiers, si ce mode est disponible.
|
||||
Active le mode multifichier, autorisant l'édition simultanée de
|
||||
plusieurs fichiers, si ce mode est disponible.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
|
||||
@@ -76,60 +80,73 @@ r
|
||||
utiliser les fichiers nanorc.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
N'utilise pas les fichiers \fISYSCONFDIR/nanorc\fR et \fI~/.nanorc\fR, même si
|
||||
\fBnano\fR est capable de les utiliser.
|
||||
Ne pas utiliser pas les fichiers \fISYSCONFDIR/nanorc\fR et
|
||||
\fI~/.nanorc\fR (si \fBnano\fR est capable de les utiliser).
|
||||
.TP
|
||||
.B \-M (\-\-mac)
|
||||
Écrit le fichier au format Mac.
|
||||
.B \-K (\-\-rebindkeypad)
|
||||
Interprète les touches du pavé numérique afin qu'elles fonctionnent
|
||||
toutes correctement. Vous ne devriez utiliser cette option que si ce
|
||||
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
|
||||
correctement lorsque cette option sera activée.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
Désactive la conversion automatique des fichiers depuis les formats Mac et
|
||||
DOS.
|
||||
.TP
|
||||
.B \-O (\-\-morespace)
|
||||
Utiliser la ligne blanche située sous la ligne de titre comme
|
||||
espace supplémentaire d'édition.
|
||||
.TP
|
||||
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
|
||||
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
|
||||
pour réaliser une justification correcte des citations. Si nano est
|
||||
capable d'utiliser des expressions rationnelles, le préfixe par défaut
|
||||
sera "^([\ \\t]*[|>:}#])+", sinon, ce sera ">\ ".
|
||||
.TP
|
||||
.B \-R (\-\-regexp)
|
||||
Active l'utilisation d'expressions rationnelles lors des recherches, ainsi
|
||||
que la possibilité d'utiliser \\n dans les chaînes de remplacement pour
|
||||
faire référence à la n-ième sous-expression du motif de recherche, si
|
||||
cette fonction est disponible.
|
||||
.B \-R (\-\-restricted)
|
||||
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
|
||||
sur la ligne de commande, pas de lecture des fichiers nanorc,
|
||||
interdiction de suspendre, interdiction d'ajouter au début, à la fin
|
||||
ou de sauvegarder un fichier ayant déjà un nom sous un nom différent.
|
||||
Cette option peut aussi être activée en appelant \fBnano\fP sous un nom
|
||||
commençant par «\ r\ » (par exemple «\ rnano\ »).
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
|
||||
de défiler morceau-par-morceau.
|
||||
.TP
|
||||
.B \-T \fInombre\fP (\-\-tabsize=\fInombre\fP)
|
||||
Définit la taille (largeur) des tabulations.
|
||||
Définit la taille (largeur) des tabulations en nombre de colonnes. Le
|
||||
nombre indiqué doit être strictement supérieur à 0. La valeur par défaut
|
||||
est de 8.
|
||||
.TP
|
||||
.B \-U (\-\-quickblank)
|
||||
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
|
||||
d'état disparaîtront après une frappe clavier au lieu de 25. Notez que
|
||||
\fB-c\fP annule cette option.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Affiche le numéro de version et l'auteur.
|
||||
.TP
|
||||
.B \-W (\-\-wordbounds)
|
||||
Détection plus précise des limites de mots, obtenue en considérant les
|
||||
caractères de ponctuation comme faisant partie des mots.
|
||||
.TP
|
||||
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
|
||||
Indique quel mode de colorisation syntaxique adopter, parmi les modes
|
||||
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
|
||||
disponible.
|
||||
.TP
|
||||
.B \-Z (\-\-restricted)
|
||||
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
|
||||
sur la ligne de commande, pas de lecture des fichiers nanorc,
|
||||
interdiction de suspendre et interdiction de sauvegarder (ou d'ajouter
|
||||
en tête ou en fin) un fichier ayant déjà un nom sous un nom différent.
|
||||
Cette option peut aussi être activée en appelant \fBnano\fP sous un nom
|
||||
commençant par «\ r\ » (par exemple «\ rnano\ »).
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Affiche en permanence la position du curseur.
|
||||
Affiche en permanence la position du curseur. Notez que cette option
|
||||
annule l'option \fB-U\fP.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous devriez n'avoir besoin de cette option que si la touche
|
||||
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
|
||||
sur votre système.
|
||||
Vous ne devriez avoir besoin de cette option que si, sur votre système,
|
||||
la touche «\ Effacement arrière\ » produit l'effet de la touche
|
||||
«\ Supprimer\ ».
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Affiche un résumé des options disponibles en ligne de commande.
|
||||
@@ -139,16 +156,16 @@ Indentation automatique. Commence chaque nouvelle ligne au m
|
||||
la ligne précédente. Utile pour l'édition de code source.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
^K coupe le texte du curseur à la fin de la ligne, au lieu de couper la
|
||||
Coupe le texte du curseur à la fin de la ligne, au lieu de couper la
|
||||
ligne entière.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
Si le fichier édité est un lien symbolique, remplace le lien par le
|
||||
nouveau fichier, sans le suivre. Ce mode ne serait-il pas utile pour éditer
|
||||
les fichiers de \fI/tmp\fR ?
|
||||
Si le fichier édité est un lien symbolique, au lieu de le suivre,
|
||||
remplace le lien par le nouveau fichier. Sans doute utile pour éditer
|
||||
les fichiers de \fI/tmp\fR, non\ ?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Active l'utilisation de la souris (si elle est disponible sur votre
|
||||
Active l'utilisation de la souris (si elle est disponible pour votre
|
||||
système).
|
||||
.TP
|
||||
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
|
||||
@@ -161,18 +178,18 @@ Pr
|
||||
par le terminal.
|
||||
.TP
|
||||
.B \-r \fIcolonne\fP (\-\-fill=\fIcolonne\fP)
|
||||
Passe automatiquement à la ligne à la colonne \fIcolonne\fR. Par défaut, le
|
||||
passage à la ligne se fait à la taille de l'écran moins huit. Si la
|
||||
valeur indiquée est négative, le point de passage à la ligne sera
|
||||
calculé relativement au bord droit de l'écran. Cela permet de faire varier
|
||||
le point de passage à la ligne lorsque l'on change la taille de l'écran.
|
||||
Passe automatiquement à la ligne une fois arrivé à la colonne
|
||||
\fIcolonne\fR. Si la valeur indiquée est de 0 ou moins, le point de
|
||||
passage à la ligne aura lieu à la taille de l'écran moins \fIcolonne\fR.
|
||||
Cela permet de faire varier le point de passage à la ligne lorsque l'on
|
||||
change la taille de l'écran. La valeur par défaut est de -8.
|
||||
.TP
|
||||
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
|
||||
Choix d'un correcteur orthographique de remplacement.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
|
||||
demande de confirmation. Identique à l'option -t de Pico.
|
||||
demande de confirmation. Identique à l'option \fB-t\fP de Pico.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
Mode visualisation (lecture seule).
|
||||
@@ -190,14 +207,14 @@ Autorise
|
||||
Ignoré, pour être compatible avec Pico.
|
||||
|
||||
.SH "FICHIERS D'INITIALISATION"
|
||||
\fBnano\fR lit les fichiers d'initialisation dans l'ordre suivant\ :
|
||||
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de manuel
|
||||
de \fBnanorc\fR(5) et au fichier-exemple \fInanorc.sample\fR qui devrait être
|
||||
livré avec \fBnano\fR.
|
||||
\fBnano\fR lit les fichiers d'initialisation dans l'ordre suivant\ :
|
||||
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de
|
||||
manuel de \fBnanorc(5)\fR et au fichier d'exemple \fInanorc.sample\fR,
|
||||
qui devraient tous les deux être livrés avec \fBnano\fR.
|
||||
|
||||
.SH NOTES
|
||||
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
|
||||
ligne de commande ou dans le fichier nanorc, \fBnano\fR prendra
|
||||
ligne de commande ou dans l'un des fichiers nanorc, \fBnano\fR prendra
|
||||
la commande indiquée par la variable d'environnement \fBSPELL\fR si
|
||||
elle est définie.
|
||||
|
||||
@@ -223,6 +240,10 @@ La liste de discussion anglophone \fBnano\fR est disponible via
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
|
||||
|
||||
N'hésitez pas également à envoyez vos commentaires, suggestions et
|
||||
corrections relatives à l'adaptation française de cette page de manuel
|
||||
ou du logiciel à \fBjean-philippe.guerard@corbeaunoir.org\fR.
|
||||
|
||||
.SH "SITE INTERNET"
|
||||
http://www.nano-editor.org/
|
||||
|
||||
@@ -234,13 +255,25 @@ http://www.nano-editor.org/
|
||||
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fR et \fITHANKS\fR pour plus d'information). Cette page de manuel a
|
||||
été initialement rédigée par Jordi Mallach
|
||||
<jordi@sindominio.net> pour le système GNU Debian (mais elle peut
|
||||
être utilisée par d'autres).
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fR et \fITHANKS\fR pour plus d'information). Cette page de
|
||||
manuel a été initialement rédigée par Jordi Mallach
|
||||
<jordi@sindominio.net> pour le système GNU Debian (mais elle peut être
|
||||
utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Cette adaptation française a été réalisé par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@corbeaunoir.org> le 23\ octobre\ 2005 à partir
|
||||
de la version du 27\ septembre\ 2005 de la page de manuel de nano 1.3.9.
|
||||
Cette version a été relue par Gérard Delafond.
|
||||
|
||||
Adaptation française du 4\ septembre\ 2004 par
|
||||
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
traducteur.
|
||||
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
consultable via la commande :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
.\" nanorc.5 is Copyright (C) 2003, 2004, 2005 Free Software
|
||||
.\" Foundation, Inc.
|
||||
.\"
|
||||
.\" (c) 2003-2004 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" (c) 2003-2005 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" pour l'adaptation française
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
@@ -9,10 +10,11 @@
|
||||
.\"
|
||||
.\" Ce document est libre. Reportez-vous à la dernière version de la
|
||||
.\" licence publique générale GNU (GNU GPL) pour connaître ses
|
||||
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
|
||||
.\" conditions d'utilisation. Ce document est distribué sans
|
||||
.\" AUCUNE garantie.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 1.3.4" "17 août 2004"
|
||||
\" $Id$
|
||||
.TH NANORC 5 "version 1.3.9" "23 octobre 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
|
||||
@@ -21,27 +23,27 @@ nanorc \- fichier de configuration de l'
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement le fichier de configuration de
|
||||
l'éditeur \fBnano\fP du projet GNU.
|
||||
l'éditeur \fBnano\fP GNU.
|
||||
.PP
|
||||
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à
|
||||
remplacer Pico, l'éditeur par défaut du paquet non-libre Pine.
|
||||
remplacer Pico, l'éditeur par défaut du paquet non libre Pine.
|
||||
\fBnano\fP ne se contentant pas de copier l'interface et l'ergonomie de
|
||||
Pico, il offre également certaines fonctionnalités manquantes (ou
|
||||
désactivées par défaut) de Pico. Ces fonctionnalités sont, par exemple,
|
||||
les fonctions de recherche et de remplacement, et la possibilité de
|
||||
les fonctions de recherche et de remplacement et la possibilité de
|
||||
sauter directement à un numéro de ligne.
|
||||
.PP
|
||||
Le fichier \fInanorc\fP contient les paramètres par défaut de
|
||||
\fBnano\fP. Lors de son démarrage, nano commence par lire le fichier de
|
||||
configuration général \fISYSCONFDIR/nanorc\fP, puis lit le fichier de
|
||||
configuration personnel de l'utilisateur \fI~/.nanorc\fP.
|
||||
\fBnano\fP. Lors de son démarrage, nano commencera par lire le fichier
|
||||
de configuration général \fISYSCONFDIR/nanorc\fP, puis lira le fichier
|
||||
de configuration personnel de l'utilisateur \fI~/.nanorc\fP.
|
||||
|
||||
.SH OPTIONS
|
||||
Le fichier de configuration accepte une série de commandes «\ set\ »
|
||||
(activer) et «\ unset\ » (désactiver), qui permettent de définir la
|
||||
configuration de nano au démarrage sans avoir à utiliser d'options sur
|
||||
la ligne de commande.
|
||||
De plus, les mots clefs «\ syntax\ » (syntaxe) et «\ color\ » (couleur)
|
||||
la ligne de commande. De plus, les mots clefs «\ syntax\ » (syntaxe),
|
||||
«\ color\ » (couleur) et «\ icolor\ » (couleur insensible à la casse)
|
||||
sont utilisés pour définir les règles de colorisation pour différents
|
||||
motifs de texte. Nano lira une commande par ligne.
|
||||
|
||||
@@ -59,20 +61,42 @@ Les commandes et arguments reconnus sont\ :
|
||||
Active l'indentation automatique.
|
||||
.TP
|
||||
\fBset/unset backup\fP
|
||||
Crée des copie de sécurité nommées
|
||||
Crée des copies de sécurité nommées
|
||||
.IR nom_du_fichier~ .
|
||||
.TP
|
||||
.B set backupdir \fIrépertoire\fP
|
||||
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
|
||||
de sécurité uniques, si l'enregistrement de copies de sécurité est
|
||||
activé.
|
||||
.TP
|
||||
.B set/unset backwards
|
||||
Par défaut, les recherches se font vers l'arrière.
|
||||
.TP
|
||||
.B set brackets \fIchaîne\fP
|
||||
Définit les caractères considérés comme des fermetures de parenthèses.
|
||||
Ces caractères ne doivent pas contenir d'espaces. Seules les
|
||||
ponctuations terminales, éventuellement suivies de parenthèses
|
||||
fermantes, peuvent terminer une phrase.
|
||||
|
||||
(N.D.T.\ : reportez-vous au paragraphe sur l'option \fBpunct\fR pour
|
||||
plus d'informations.)
|
||||
.TP
|
||||
.B set/unset casesensitive
|
||||
Par défaut, les recherches ne tiennent pas compte de la casse.
|
||||
.TP
|
||||
\fBset/unset const\fP
|
||||
Affiche en permanence la position du curseur dans la ligne d'état.
|
||||
.TP
|
||||
\fBset/unset cut\fP
|
||||
Par défaut, ^K coupe le texte du curseur jusqu'à la fin de la ligne, au
|
||||
lieu de couper la ligne entière.
|
||||
Par défaut, coupe le texte du curseur à la fin de la ligne, au lieu de
|
||||
couper la ligne entière.
|
||||
.TP
|
||||
\fBset fill \fIn\fP\fP
|
||||
Passe automatiquement à la ligne à la colonne \fIn\fP. Si la valeur
|
||||
indiquée est 0 ou moins, la longueur de la ligne sera égale à la largeur
|
||||
de l'écran moins \fIn\fP. La valeur par défaut est -8.
|
||||
Passe automatiquement à la ligne une fois arrivé à la colonne \fIn\fR.
|
||||
Si la valeur indiquée est de 0 ou moins, le point de passage à la ligne
|
||||
aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de faire
|
||||
varier le point de passage à la ligne lorsque l'on change la taille de
|
||||
l'écran. La valeur par défaut est de -8.
|
||||
.TP
|
||||
\fBset/unset historylog\fP
|
||||
Active l'utilisation de
|
||||
@@ -80,6 +104,14 @@ Active l'utilisation de
|
||||
pour enregistrer et relire les chaînes ayant fait l'objet d'une
|
||||
recherche ou d'un remplacement.
|
||||
.TP
|
||||
.B set/unset morespace
|
||||
Utiliser la ligne blanche située sous la ligne de titre comme espace
|
||||
supplémentaire d'édition.
|
||||
.TP
|
||||
.B set/unset mouse
|
||||
Active l'utilisation de la souris, afin que des clics souris puissent
|
||||
être utilisés pour marquer le texte ou accéder aux raccourcis.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
Mode multifichier\ : permet de charger les fichiers dans leur propre
|
||||
espace.
|
||||
@@ -96,7 +128,7 @@ D
|
||||
\fBset/unset nowrap\fP
|
||||
Désactive le passage automatique à la ligne.
|
||||
.TP
|
||||
\fBset operatingdir "\fIrépertoire\fP"\fP
|
||||
\fBset operatingdir \fIrépertoire\fP\fP
|
||||
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
|
||||
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
|
||||
le répertoire courant, afin que les fichiers soient lus depuis ce
|
||||
@@ -105,19 +137,23 @@ r
|
||||
\fBset/unset preserve\fP
|
||||
Préserve les séquences XON et XOFF (^Q et ^S).
|
||||
.TP
|
||||
\fBset punct "\fIchaîne\fP"\fP
|
||||
\fBset punct \fIchaîne\fP\fP
|
||||
Définit les caractères interprétés comme des ponctuations terminales.
|
||||
Ces caractères ne peuvent inclure d'espaces ou de tabulations. Seules les
|
||||
ponctuations terminales, éventuellement suivies de crochets fermants,
|
||||
peuvent terminer une phrase.
|
||||
Ces caractères ne peuvent inclure de blancs. Seules les ponctuations
|
||||
terminales, éventuellement suivies de parenthèses fermantes, peuvent
|
||||
terminer une phrase.
|
||||
|
||||
(N.D.T.\ : ce réglage permet de conserver 2\ espaces au lieu d'une
|
||||
derrière les ponctuations terminales lors de la justification, ce qui
|
||||
(N.D.T.\ : ce réglage permet, lors de la justification, de conserver 2\
|
||||
espaces au lieu d'une derrière les ponctuations terminales, ce qui
|
||||
correspond aux normes typographiques anglo-saxonnes, mais n'a pas lieu
|
||||
d'être en français. Pour le français, le plus simple est d'indiquer dans
|
||||
le fichier nanorc une chaîne vide pour ce paramètre.)
|
||||
d'être en français. Pour le français, le plus simple est d'indiquer,
|
||||
dans le fichier nanorc, une chaîne vide pour ce paramètre.)
|
||||
.TP
|
||||
\fBset quotestr "\fIchaîne\fP"\fP
|
||||
.B set/unset quickblank
|
||||
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
|
||||
d'état disparaîtront après une frappe clavier au lieu de 25.
|
||||
.TP
|
||||
\fBset quotestr \fIchaîne\fP\fP
|
||||
Définit le préfixe par défaut utilisé pour les citations dans les
|
||||
courriers électroniques. Ce préfixe est utilisé pour réaliser une
|
||||
justification correcte de ces citations. Il s'agira, si votre système le
|
||||
@@ -131,22 +167,28 @@ Sinon, ce sera ">\ ". Notez que le
|
||||
caractère de tabulation.
|
||||
.TP
|
||||
\fBset/unset rebinddelete\fP
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous devriez uniquement avoir besoin de cette option si la touche
|
||||
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
|
||||
sur votre système.
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous ne devriez avoir besoin de cette option que si, sur votre système,
|
||||
la touche «\ Effacement arrière\ » produit l'effet de la touche «\
|
||||
Supprimer\ ».
|
||||
.TP
|
||||
.B set/unset rebindkeypad
|
||||
Interprète les touches du pavé numérique afin qu'elles fonctionnent
|
||||
toutes correctement. Vous ne devriez utiliser cette option que si ce
|
||||
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
|
||||
correctement lorsque cette option sera activée.
|
||||
.TP
|
||||
\fBset/unset regexp\fP
|
||||
Utilise par défaut des expressions rationnelles pour les recherches.
|
||||
.TP
|
||||
\fBset/unset smarthome\fP
|
||||
Active le fonctionnement évolué de la touche «\ Début\ ». Lorsque cette
|
||||
touche est pressée à n'importe quel endroit excepté au tout début du
|
||||
texte d'une ligne (i.\ e. au premier caractère non-blanc), le curseur se
|
||||
positionnera à ce début de ligne (qu'il soit en avant ou en arrière). Si
|
||||
le curseur est déjà au tout début de la ligne, il se placera au vrai
|
||||
début de la ligne.
|
||||
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque
|
||||
cette touche est pressée à n'importe quel endroit excepté au tout début
|
||||
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
|
||||
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
|
||||
arrière). Si le curseur est déjà là, il se placera au vrai début de la
|
||||
ligne.
|
||||
.TP
|
||||
\fBset/unset smooth\fP
|
||||
Active le défilement ligne-par-ligne du texte.
|
||||
@@ -156,52 +198,76 @@ Utilise le correcteur orthographique \fIprogramme\fP au lieu du
|
||||
correcteur intégré, qui s'appuie sur \fIspell\fP.
|
||||
.TP
|
||||
\fBset/unset suspend\fP
|
||||
Autorise à suspendre nano avec ^Z.
|
||||
Autorise à suspendre nano.
|
||||
.TP
|
||||
\fBset tabsize \fIn\fP\fP
|
||||
Utilise une largeur de tabulation de \fIn\fP au lieu de la valeur par
|
||||
défaut (8). Cette valeur doit être supérieur à 0.
|
||||
Utilise une taille de tabulation de \fIn\fP colonnes. Cette valeur doit
|
||||
être strictement supérieure à 0. La valeur par défaut est de\ 8.
|
||||
.TP
|
||||
.B set/unset tabstospaces
|
||||
Convertit les tabulations clavier en espaces.
|
||||
.TP
|
||||
\fBset/unset tempfile\fP
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement en
|
||||
quittant, sans demande de confirmation.
|
||||
.TP
|
||||
\fBset/unset view\fP
|
||||
Interdit la modification du fichier.
|
||||
Interdit de modifier les fichiers.
|
||||
.TP
|
||||
\fBset whitespace "\fIchaîne\fP"\fP
|
||||
\fBset whitespace \fIchaîne\fP\fP
|
||||
Définit les deux caractères utilisés pour afficher les premiers
|
||||
caractères de tabulations et d'espaces. Cela ne doit pas être
|
||||
des caractère de contrôle.
|
||||
caractères des tabulations et des espaces. Ces deux caractères doivent
|
||||
être mono-colonne.
|
||||
.TP
|
||||
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
|
||||
.B set/unset wordbounds
|
||||
Détection plus précise des limites de mots, obtenue en considérant les
|
||||
caractères de ponctuation comme faisant partie des mots.
|
||||
.TP
|
||||
.B syntax \fIchaîne\fP ["\fImotif_de_fichier\fP" ... ]
|
||||
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
|
||||
l'option \fB-Y\fP, ou qui sera automatiquement activé si le nom du
|
||||
l'option \fB-Y\fP ou qui sera automatiquement activée si le nom du
|
||||
fichier en cours correspond au \fImotif_de_fichier\fP. Toutes les
|
||||
instructions suivantes de colorisation \fBcolor\fP s'appliqueront à
|
||||
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
|
||||
instructions suivantes de colorisation \fBcolor\fP ou \fBicolor\fP
|
||||
s'appliqueront à cette syntaxe, jusqu'à la définition d'une nouvelle
|
||||
syntaxe.
|
||||
|
||||
La syntaxe nommée \fInone\fP (aucune) est réservée\ ; si elle est
|
||||
indiquée dans la ligne de commande, cela revient à ne définir aucune
|
||||
syntaxe. La syntaxe nommée \fIdefault\fP (par défaut) est spéciale, elle
|
||||
ne nécessite aucun motif de \fImotif_de_fichier\fP, et s'applique aux
|
||||
fichiers ne correspondant à aucun des \fImotif_de_fichier\fP des autres
|
||||
syntaxes.
|
||||
.TP
|
||||
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
|
||||
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
|
||||
l'expression rationnelle \fImotif\fP en utilisant la couleur de texte
|
||||
\fIcouleur_texte\fP et éventuellement la couleur de fond
|
||||
\fIcouleur_fond\fP. Les couleurs acceptées par \fBnano\fP pour le
|
||||
texte et le fond sont\ : \fIwhite\fP (blanc), \fIblack\fP (noir),
|
||||
\fIred\fP (rouge), \fIblue\fP (bleu), \fIgreen\fP (vert), \fIyellow\fP
|
||||
(jaune), \fImagenta\fP, et \fIcyan\fP. Vous pouvez ajouter à
|
||||
ces couleurs le préfixe \fIbright\fP pour obtenir une couleur plus
|
||||
lumineuse. Si votre terminal est capable de gérer la transparence, ne
|
||||
pas spécifier de \fIcouleur_fond\fP indique à \fBnano\fP d'essayer
|
||||
d'utiliser un fond transparent.
|
||||
\fIcouleur_texte\fP et la couleur de fond \fIcouleur_fond\fP, l'une de
|
||||
ces deux couleurs au moins devant être définie. Les couleurs acceptées
|
||||
par \fBnano\fP pour le texte et le fond sont\ : \fIwhite\fP (blanc),
|
||||
\fIblack\fP (noir), \fIred\fP (rouge), \fIblue\fP (bleu), \fIgreen\fP
|
||||
(vert), \fIyellow\fP (jaune), \fImagenta\fP, et \fIcyan\fP. Pour la
|
||||
couleur du texte, vous pouvez ajouter à ces couleurs le préfixe
|
||||
\fIbright\fP (lumineux) pour obtenir une couleur plus lumineuse. Si
|
||||
votre terminal est capable de gérer la transparence, ne pas spécifier de
|
||||
\fIcouleur_fond\fP indique à \fBnano\fP d'essayer d'utiliser un fond
|
||||
transparent.
|
||||
.TP
|
||||
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
|
||||
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
|
||||
compte de la casse.
|
||||
.TP
|
||||
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
|
||||
Affiche les expressions commençant par \fImotif_début\fP et se terminant
|
||||
par \fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
|
||||
et éventuellement la couleur de fond \fIcouleur_fond\fP. Cela permet à
|
||||
la colorisation syntaxique de s'étendre sur plusieurs lignes. Notez que
|
||||
toutes les occurrences successives de \fImotif_début\fP après le
|
||||
\fImotif_début\fP initial seront surlignées jusqu'à la prochaine instance
|
||||
de \fImotif_fin\fP.
|
||||
et la couleur de fond \fIcouleur_fond\fP, l'une de ces deux couleurs au
|
||||
moins devant être définie. Cela permet à la colorisation syntaxique de
|
||||
s'étendre sur plusieurs lignes. Notez que toutes les occurrences
|
||||
successives de \fImotif_début\fP après le \fImotif_début\fP initial
|
||||
seront surlignées jusqu'à la prochaine instance de \fImotif_fin\fP.
|
||||
.TP
|
||||
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
|
||||
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
|
||||
compte de la casse.
|
||||
|
||||
.SH FICHIERS
|
||||
.TP
|
||||
@@ -225,6 +291,18 @@ Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
manuel a été rédigée par Jordi Mallach <jordi@gnu.org>.
|
||||
|
||||
.SH TRADUCTION
|
||||
Cette adaptation française a été réalisé par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@corbeaunoir.org> le 23\ octobre\ 2005 à partir de
|
||||
la version du 27\ septembre\ 2005 de la page de manuel de nano 1.3.9.
|
||||
Cette version a été relue par Gérard Delafond.
|
||||
|
||||
Adaptation française du 4\ septembre\ 2004 par
|
||||
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
traducteur.
|
||||
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
consultable via la commande :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
|
||||
144
doc/man/nano.1
144
doc/man/nano.1
@@ -6,7 +6,7 @@
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.7" "March 26, 2005"
|
||||
.TH NANO 1 "version 1.3.9" "September 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,9 +32,9 @@ replace" and "go to line number".
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILINE\fP
|
||||
Places cursor at line number \fILINE\fP on startup, instead of the
|
||||
default of line 1.
|
||||
.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.
|
||||
@@ -50,25 +50,28 @@ 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 \-K (\-\-rebindkeypad)
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
@@ -81,34 +84,39 @@ 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 \-W (\-\-wordbounds)
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
.TP
|
||||
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
|
||||
Specify a specific syntax highlighting from the \fInanorc\fP to use, if
|
||||
available.
|
||||
.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
|
||||
@@ -128,8 +136,7 @@ Enable cut from cursor to end of line.
|
||||
.B \-l (\-\-nofollow)
|
||||
If the file being edited is a symbolic link, replace the link with
|
||||
a new file instead of following it. Good for editing files in
|
||||
.IR /tmp ,
|
||||
perhaps?
|
||||
\fI/tmp\fP, perhaps?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Enable mouse support (if available for your system).
|
||||
@@ -143,16 +150,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's -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.
|
||||
@@ -171,13 +179,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
|
||||
@@ -187,25 +191,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/
|
||||
@@ -218,10 +217,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).
|
||||
|
||||
168
doc/man/nanorc.5
168
doc/man/nanorc.5
@@ -6,7 +6,7 @@
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 1.3.7" "March 26, 2005"
|
||||
.TH NANORC 5 "version 1.3.9" "September 27, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -22,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
|
||||
@@ -41,73 +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
|
||||
.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 morespace\fP
|
||||
.B set/unset morespace
|
||||
Allow use of the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
\fBset/unset mouse\fP
|
||||
.B set/unset mouse
|
||||
Enable mouse support, so that mouse clicks can be used to set the mark
|
||||
and run shortcuts.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
.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/unset 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
|
||||
@@ -117,67 +126,91 @@ 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 rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
.TP
|
||||
.B set/unset regexp
|
||||
Do regular expression searches by default.
|
||||
.TP
|
||||
\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
|
||||
.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 must be single-column characters.
|
||||
.TP
|
||||
.B set/unset wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
.TP
|
||||
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
|
||||
Defines a syntax named \fIstr\fP which can be activated via the \fB-Y\fP
|
||||
flag, or will be automatically activated if the current filename matches
|
||||
\fIfileregex\fP. All following \fBcolor\fP 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.
|
||||
|
||||
The \fInone\fP syntax is reserved; specifying it on the command line is
|
||||
the same as not having a syntax at all. The \fIdefault\fP syntax is
|
||||
special: it takes no \fIfileregex\fP, and applies to files that don't
|
||||
match any other syntax's \fIfileregex\fP.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP[,\fIbgcolor\fP] "\fIregex\fP" ...
|
||||
.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
|
||||
@@ -194,9 +227,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
|
||||
@@ -47,7 +54,7 @@
|
||||
|
||||
## 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
|
||||
|
||||
@@ -74,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:
|
||||
@@ -91,6 +103,9 @@
|
||||
## Fix Backspace/Delete confusion problem.
|
||||
# set rebinddelete
|
||||
|
||||
## Fix numeric keypad key confusion problem.
|
||||
# set rebindkeypad
|
||||
|
||||
## Do extended regular expression searches by default.
|
||||
# set regexp
|
||||
|
||||
@@ -115,6 +130,9 @@
|
||||
## 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
|
||||
|
||||
@@ -126,37 +144,61 @@
|
||||
## (00B7 hexadecimal) seem to be good values for these.
|
||||
# set whitespace " "
|
||||
|
||||
## Detect word boundaries more accurately by treating punctuation
|
||||
## characters as part of a word.
|
||||
# set wordbounds
|
||||
|
||||
## Color setup
|
||||
##
|
||||
## Format:
|
||||
##
|
||||
## syntax "short description" ["filename regex" ...]
|
||||
##
|
||||
## (The "none" syntax is reserved; specifying it on the command line is
|
||||
## the same as not having a syntax at all. The "default" syntax is
|
||||
## special: it takes no filename regexes, and applies to files that
|
||||
## don't match any other syntax's filename regexes.)
|
||||
##
|
||||
## color foreground,background "regex" ["regex"...]
|
||||
## or
|
||||
## icolor foreground,background "regex" ["regex"...]
|
||||
##
|
||||
## ("color" will do case sensitive matches, while "icolor" will do case
|
||||
## insensitive matches.)
|
||||
##
|
||||
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
|
||||
## You may use the prefix "bright" to mean a stronger color highlight.
|
||||
## 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|C|cc|cpp|h|H|hh|hpp)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# syntax "c-file" "\.(c|C|cc|cpp|cxx|h|H|hh|hpp|hxx)$"
|
||||
# color brightred "\<[A-Z_][A-Z_0-9]+\>"
|
||||
# color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
|
||||
# color green "\<(u_?)?int(8|16|32|64|ptr)_t\>"
|
||||
# color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|default|switch|goto|continue|break|return)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
|
||||
# color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||
# color brightcyan "^ *# *(define|undef|include|ifn?def|endif|elif|else|if)"
|
||||
# color magenta "\<(goto|continue|break|return)\>"
|
||||
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
# color brightmagenta "'([^\]|(\\['abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
|
||||
##
|
||||
## GCC builtins
|
||||
##
|
||||
# color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||
##
|
||||
## You will in general want your comments and strings to come last,
|
||||
## because syntax highlighting rules will be applied in the order they
|
||||
## are read in.
|
||||
##
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
##
|
||||
## This string is VERY resource intensive!!!
|
||||
# color brightyellow start=""(\\.|[^\"])*\\ *$" end="^(\\.|[^\"])*""
|
||||
## This string is VERY resource intensive!
|
||||
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
|
||||
##
|
||||
## And we want to have some nice comment highlighting too
|
||||
# color brightblue "//.*"
|
||||
@@ -165,11 +207,11 @@
|
||||
## 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$"
|
||||
# color green "\\.|\\[A-Za-z]*"
|
||||
# icolor green "\\.|\\[A-Z]*"
|
||||
# color magenta "[{}]"
|
||||
# color blue "%.*"
|
||||
|
||||
@@ -179,10 +221,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
|
||||
@@ -194,7 +236,7 @@
|
||||
# color cyan "(\\|\\\\)n\(.."
|
||||
# color cyan start="(\\|\\\\)n\[" end="]"
|
||||
## Requests
|
||||
# color brightgreen "^\. *[^ ]*"
|
||||
# color brightgreen "^\.[[:space:]]*[^[[:space:]]]*"
|
||||
## Comments
|
||||
# color yellow "^\.\\\".*$"
|
||||
## Strings
|
||||
@@ -210,11 +252,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))\>"
|
||||
# color red "\<(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)\>"
|
||||
# color red "\<(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)?)\>"
|
||||
# color red "\<(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)\>"
|
||||
# color red "\<(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\|.*\|"
|
||||
@@ -234,7 +272,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
|
||||
##
|
||||
@@ -257,19 +295,47 @@
|
||||
# color brightwhite "\\f[BIPR]"
|
||||
# color yellow "\.(br|DS|RS|RE|PD)"
|
||||
|
||||
## Here is an example for assembler
|
||||
##
|
||||
# syntax "asm-file" "\.(S|s|asm)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# color brightgreen "\.(data|subsection|text)"
|
||||
# color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
|
||||
# color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
|
||||
# icolor brightred "^[[:space:]]*[._A-Z0-9]*:"
|
||||
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
## Highlight strings (note: VERY resource intensive)
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
|
||||
## Highlight comments
|
||||
# color brightblue "//.*"
|
||||
# color brightblue start="/\*" end="\*/"
|
||||
|
||||
## Here is an example for Bourne shell scripts
|
||||
##
|
||||
# syntax "shellscript" "\.sh$"
|
||||
# icolor brightgreen "^[_A-Z0-9]+\(\)"
|
||||
# color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>"
|
||||
# color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
|
||||
# color green "-(L|d|e|f|g|r|u|w|x)\>"
|
||||
# color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
|
||||
# color brightblue "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>"
|
||||
# icolor brightred "\$\{?[_A-Z0-9]+\}?"
|
||||
# color yellow "#.*$"
|
||||
# color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
|
||||
|
||||
## Here is an example for your .nanorc
|
||||
##
|
||||
# syntax "nanorc" "(\.|/|)nanorc$"
|
||||
## highlight possible errors and parameters
|
||||
# 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|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quotestr|rebinddelete|regexp|smarthome|smooth|speller|suspend|tabsize|tempfile)\>"
|
||||
# color cyan "^ *(set|unset) +(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:]]+(rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
|
||||
# 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.7
|
||||
@set UPDATED 26 Mar 2005
|
||||
@set VERSION 1.3.9
|
||||
@set UPDATED 27 Sep 2005
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.3.7
|
||||
@subtitle version 1.3.9
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -91,7 +91,7 @@ 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 @code{nano}'s main goal is to be as compatible as
|
||||
@@ -106,8 +106,9 @@ Email bug reports to @email{nano@@nano-editor.org}.
|
||||
@code{nano} takes the following options from the command line:
|
||||
|
||||
@table @code
|
||||
@item +LINE
|
||||
Start at line number LINE instead of the default of line 1.
|
||||
@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}.
|
||||
@@ -123,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.
|
||||
|
||||
@@ -134,6 +138,11 @@ Enable multiple file buffers, if available.
|
||||
Don't look at SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
|
||||
available.
|
||||
|
||||
@item -K, --rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
|
||||
@item -N, --noconvert
|
||||
Do not convert files from DOS/Mac format.
|
||||
|
||||
@@ -147,31 +156,38 @@ 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 -S, --smooth
|
||||
Enable smooth scrolling.
|
||||
|
||||
@item -T [num], --tabsize=[#cols]
|
||||
Set the displayed tab length to [#cols] columns.
|
||||
|
||||
@item -V, --version
|
||||
Print the version number and copyright and quit.
|
||||
|
||||
@item -Y, --syntax=[str]
|
||||
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||
available.
|
||||
|
||||
@item -Z, --restricted
|
||||
@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. 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.
|
||||
|
||||
@item -W, --wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
|
||||
@item -Y, --syntax=[str]
|
||||
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||
available.
|
||||
|
||||
@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
|
||||
@@ -205,10 +221,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
|
||||
@@ -340,13 +356,16 @@ 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 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 Auto Indent Toggle (Meta-I)
|
||||
@@ -355,21 +374,35 @@ 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 More Space Toggle (Meta-O)
|
||||
@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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
101
po/ChangeLog
101
po/ChangeLog
@@ -1,3 +1,104 @@
|
||||
2006-10-23 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* eu.po: Updated Basque translation by Mikel Olasagasti.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
* nl.po: Updated Dutch translation by Benno Schulenberg.
|
||||
* zh_TW: Updated Traditional Chinese translation by
|
||||
Wei-Lun Chao.
|
||||
|
||||
2006-08-22 Jordi Mallach <jordi@gnu.org>
|
||||
* bg.po: New Bulgarian translation by
|
||||
Yavor Doganov <yavor@doganov.org>.
|
||||
|
||||
* LINGUAS: Added "bg".
|
||||
|
||||
2005-08-16 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
|
||||
2005-08-16 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* nl.po: Updated Dutch translation by
|
||||
Benno Schulenberg and Reinout van Schouwen.
|
||||
|
||||
2005-07-24 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* POTFILES.in: Add text.c.
|
||||
|
||||
2005-07-19 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by
|
||||
Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2005-07-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by
|
||||
Jean-Philippe Guérard.
|
||||
|
||||
2005-07-07 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* ca.po: Updated Catalan translation.
|
||||
|
||||
2005-06-28 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* POTFILES.in: Remove source files that contain no translatable
|
||||
strings.
|
||||
|
||||
2005-06-19 David Lawrence Ramsey <pooka109@cox.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
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk zh_TW
|
||||
bg ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk vi zh_TW
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
# $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/text.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 ? "
|
||||
|
||||
@@ -1333,7 +1333,7 @@ msgstr ""
|
||||
"Cor %s não foi entendida.\n"
|
||||
"Cores válidas são \"green\" (verde), \"red\" (vermelho), \n"
|
||||
"\"blue\" (azul), \"yellow\" (amarelo), \"cyan\" (ciano), \n"
|
||||
"\"magente\" (maguenta) e \"black\" (preto), com o prefixo \n"
|
||||
"\"magenta\" (maguenta) e \"black\" (preto), com o prefixo \n"
|
||||
"opcional \"bright\" (claro) para cores de fundo."
|
||||
|
||||
#: src/rcfile.c:253 src/search.c:61
|
||||
|
||||
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>
|
||||
#
|
||||
|
||||
1798
po/zh_TW.po
1798
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@ nano_SOURCES = chars.c \
|
||||
proto.h \
|
||||
rcfile.c \
|
||||
search.c \
|
||||
text.c \
|
||||
utils.c \
|
||||
winio.c
|
||||
|
||||
|
||||
602
src/chars.c
602
src/chars.c
@@ -8,14 +8,15 @@
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -23,20 +24,41 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
#ifdef HAVE_WCHAR_H
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
#ifdef HAVE_WCTYPE_H
|
||||
#include <wctype.h>
|
||||
#endif
|
||||
|
||||
static const wchar_t bad_wchar = 0xFFFD;
|
||||
/* If we get an invalid multibyte sequence, we treat it as
|
||||
* Unicode FFFD (Replacement Character), unless we're
|
||||
* determining if it's a control character or searching for a
|
||||
* match to it. */
|
||||
static const char *bad_mbchar = "\xEF\xBF\xBD";
|
||||
static const int bad_mbchar_len = 3;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ISBLANK
|
||||
/* 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(ENABLE_UTF8)
|
||||
/* 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
|
||||
@@ -46,51 +68,24 @@ bool is_byte(int c)
|
||||
return ((unsigned int)c == (unsigned char)c);
|
||||
}
|
||||
|
||||
/* This function is equivalent to isalnum(). */
|
||||
bool is_alnum_char(int c)
|
||||
{
|
||||
return isalnum(c);
|
||||
}
|
||||
|
||||
/* This function is equivalent to isalnum() for multibyte characters. */
|
||||
bool is_alnum_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
return is_alnum_wchar(wc);
|
||||
return iswalnum(wc);
|
||||
} else
|
||||
#endif
|
||||
return is_alnum_char((unsigned char)*c);
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* This function is equivalent to isalnum() for wide characters. */
|
||||
bool is_alnum_wchar(wchar_t wc)
|
||||
{
|
||||
return iswalnum(wc);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to isblank(). */
|
||||
bool is_blank_char(int c)
|
||||
{
|
||||
return
|
||||
#ifdef HAVE_ISBLANK
|
||||
isblank(c)
|
||||
#else
|
||||
isspace(c) && (c == '\t' || !is_cntrl_char(c))
|
||||
#endif
|
||||
;
|
||||
return isalnum((unsigned char)*c);
|
||||
}
|
||||
|
||||
/* This function is equivalent to isblank() for multibyte characters. */
|
||||
@@ -98,68 +93,30 @@ bool is_blank_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
return is_blank_wchar(wc);
|
||||
return iswblank(wc);
|
||||
} else
|
||||
#endif
|
||||
return is_blank_char((unsigned char)*c);
|
||||
return isblank((unsigned char)*c);
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* This function is equivalent to isblank() for wide characters. */
|
||||
bool is_blank_wchar(wchar_t wc)
|
||||
{
|
||||
return
|
||||
#ifdef HAVE_ISWBLANK
|
||||
iswblank(wc)
|
||||
#else
|
||||
iswspace(wc) && (wc == '\t' || !is_cntrl_wchar(wc))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to iscntrl(), except in that it also
|
||||
* handles control characters with their high bits set. */
|
||||
* handles high-bit control characters. */
|
||||
bool is_cntrl_char(int c)
|
||||
{
|
||||
return (-128 <= c && c < -96) || (0 <= c && c < 32) ||
|
||||
(127 <= c && c < 160);
|
||||
}
|
||||
|
||||
/* This function is equivalent to iscntrl() for multibyte characters,
|
||||
* except in that it also handles multibyte control characters with
|
||||
* their high bits set. */
|
||||
bool is_cntrl_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
return is_cntrl_wchar(wc);
|
||||
} else
|
||||
#endif
|
||||
return is_cntrl_char((unsigned char)*c);
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
/* This function is equivalent to iscntrl() for wide characters, except
|
||||
* in that it also handles wide control characters with their high bits
|
||||
* set. */
|
||||
@@ -169,10 +126,66 @@ bool is_cntrl_wchar(wchar_t wc)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* c is a control character. It displays as ^@, ^?, or ^[ch] where ch
|
||||
* is c + 64. We return that character. */
|
||||
unsigned char control_rep(unsigned char c)
|
||||
/* 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 ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
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 ENABLE_UTF8
|
||||
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 = bad_wchar;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
assert(is_cntrl_char(c));
|
||||
|
||||
/* Treat newlines embedded in a line as encoded nulls. */
|
||||
if (c == '\n')
|
||||
return '@';
|
||||
@@ -182,50 +195,13 @@ unsigned char control_rep(unsigned char c)
|
||||
return c + 64;
|
||||
}
|
||||
|
||||
/* c is a multibyte control character. It displays as ^@, ^?, or ^[ch]
|
||||
* where ch is c + 64. We return that multibyte character. */
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
wchar_t wc, wcrep;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX), crep_mb_len;
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
wcrep = control_wrep(wc);
|
||||
|
||||
crep_mb_len = wctomb(crep, wcrep);
|
||||
|
||||
if (crep_mb_len <= 0) {
|
||||
wctomb(NULL, 0);
|
||||
crep_mb_len = 0;
|
||||
}
|
||||
|
||||
*crep_len = crep_mb_len;
|
||||
|
||||
return crep;
|
||||
} else {
|
||||
#endif
|
||||
*crep_len = 1;
|
||||
*crep = control_rep((unsigned char)*c);
|
||||
|
||||
return crep;
|
||||
#ifdef NANO_WIDE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* c is a wide control character. It displays as ^@, ^?, or ^[ch] where
|
||||
* ch is c + 64. We return that wide character. */
|
||||
#ifdef ENABLE_UTF8
|
||||
/* 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)
|
||||
{
|
||||
assert(is_cntrl_wchar(wc));
|
||||
|
||||
/* Treat newlines embedded in a line as encoded nulls. */
|
||||
if (wc == '\n')
|
||||
return '@';
|
||||
@@ -236,22 +212,93 @@ wchar_t control_wrep(wchar_t wc)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* c is a multibyte control character. It displays as ^@, ^?, or ^[ch],
|
||||
* where ch is (c + 64). We return that multibyte character. If crep
|
||||
* is an invalid multibyte sequence, it will be replaced with Unicode
|
||||
* 0xFFFD (Replacement Character). */
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len)
|
||||
{
|
||||
assert(c != NULL && crep != NULL && crep_len != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
*crep_len = bad_mbchar_len;
|
||||
strncpy(crep, bad_mbchar, *crep_len);
|
||||
} else {
|
||||
*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 ENABLE_UTF8
|
||||
}
|
||||
#endif
|
||||
|
||||
return crep;
|
||||
}
|
||||
|
||||
/* c is a multibyte non-control character. We return that multibyte
|
||||
* character. If crep is an invalid multibyte sequence, it will be
|
||||
* replaced with Unicode 0xFFFD (Replacement Character). */
|
||||
char *mbrep(const char *c, char *crep, int *crep_len)
|
||||
{
|
||||
assert(c != NULL && crep != NULL && crep_len != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
|
||||
/* Reject invalid Unicode characters. */
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0 || !is_valid_unicode(wc)) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
*crep_len = bad_mbchar_len;
|
||||
strncpy(crep, bad_mbchar, *crep_len);
|
||||
} else {
|
||||
*crep_len = wctomb(crep, wc);
|
||||
|
||||
if (*crep_len < 0) {
|
||||
wctomb(NULL, 0);
|
||||
*crep_len = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
*crep_len = 1;
|
||||
*crep = *c;
|
||||
#ifdef ENABLE_UTF8
|
||||
}
|
||||
#endif
|
||||
|
||||
return crep;
|
||||
}
|
||||
|
||||
/* This function is equivalent to wcwidth() for multibyte characters. */
|
||||
int mbwidth(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX), width;
|
||||
int width;
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
width = wcwidth(wc);
|
||||
|
||||
if (width == -1)
|
||||
width++;
|
||||
|
||||
@@ -265,123 +312,66 @@ int mbwidth(const char *c)
|
||||
int mb_cur_max(void)
|
||||
{
|
||||
return
|
||||
#ifdef NANO_WIDE
|
||||
!ISSET(NO_UTF8) ? MB_CUR_MAX :
|
||||
#ifdef ENABLE_UTF8
|
||||
ISSET(USE_UTF8) ? MB_CUR_MAX :
|
||||
#endif
|
||||
1;
|
||||
}
|
||||
|
||||
/* Convert the value in chr to a multibyte character with the same
|
||||
* wide character value as chr. Return the (dynamically allocated)
|
||||
* multibyte character and its length. */
|
||||
char *make_mbchar(int chr, int *chr_mb_len)
|
||||
/* Convert the Unicode value in chr to a multibyte character with the
|
||||
* same wide character value as chr, if possible. If the conversion
|
||||
* succeeds, return the (dynamically allocated) multibyte character and
|
||||
* its length. Otherwise, return an undefined (dynamically allocated)
|
||||
* multibyte character and a length of zero. */
|
||||
char *make_mbchar(long chr, int *chr_mb_len)
|
||||
{
|
||||
char *chr_mb;
|
||||
|
||||
assert(chr_mb_len != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
chr_mb = charalloc(MB_CUR_MAX);
|
||||
*chr_mb_len = wctomb(chr_mb, chr);
|
||||
*chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
|
||||
|
||||
if (*chr_mb_len <= 0) {
|
||||
/* Reject invalid Unicode characters. */
|
||||
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
|
||||
wctomb(NULL, 0);
|
||||
*chr_mb_len = 0;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
*chr_mb_len = 1;
|
||||
chr_mb = charalloc(1);
|
||||
*chr_mb = (char)chr;
|
||||
#ifdef NANO_WIDE
|
||||
chr_mb = mallocstrncpy(NULL, (char *)&chr, 1);
|
||||
#ifdef ENABLE_UTF8
|
||||
}
|
||||
#endif
|
||||
|
||||
return chr_mb;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_NANORC) || defined(ENABLE_EXTRA)
|
||||
/* Convert the string str to a valid multibyte string with the same wide
|
||||
* character values as str. Return the (dynamically allocated)
|
||||
* multibyte string. */
|
||||
char *make_mbstring(const char *str)
|
||||
{
|
||||
assert(str != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
char *chr_mb = charalloc(MB_CUR_MAX);
|
||||
int chr_mb_len;
|
||||
char *str_mb = charalloc((MB_CUR_MAX * strlen(str)) + 1);
|
||||
size_t str_mb_len = 0;
|
||||
|
||||
while (*str != '\0') {
|
||||
bool bad_char;
|
||||
int i;
|
||||
|
||||
chr_mb_len = parse_mbchar(str, chr_mb, &bad_char, NULL);
|
||||
|
||||
if (bad_char) {
|
||||
char *bad_chr_mb;
|
||||
int bad_chr_mb_len;
|
||||
|
||||
bad_chr_mb = make_mbchar((unsigned char)*chr_mb,
|
||||
&bad_chr_mb_len);
|
||||
|
||||
for (i = 0; i < bad_chr_mb_len; i++)
|
||||
str_mb[str_mb_len + i] = bad_chr_mb[i];
|
||||
str_mb_len += bad_chr_mb_len;
|
||||
|
||||
free(bad_chr_mb);
|
||||
} else {
|
||||
for (i = 0; i < chr_mb_len; i++)
|
||||
str_mb[str_mb_len + i] = chr_mb[i];
|
||||
str_mb_len += chr_mb_len;
|
||||
}
|
||||
|
||||
str += chr_mb_len;
|
||||
}
|
||||
|
||||
free(chr_mb);
|
||||
null_at(&str_mb, str_mb_len);
|
||||
|
||||
return str_mb;
|
||||
} else
|
||||
#endif
|
||||
return mallocstrcpy(NULL, str);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Parse a multibyte character from buf. Return the number of bytes
|
||||
* used. If chr isn't NULL, store the multibyte character in it. If
|
||||
* bad_chr isn't NULL, set it to TRUE if we have a bad multibyte
|
||||
* character. If col isn't NULL, store the new display width in it. If
|
||||
* *str is '\t', we expect col to have the current display width. */
|
||||
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
|
||||
*col)
|
||||
* col isn't NULL, store the new display width in it. If *buf is '\t',
|
||||
* we expect col to have the current display width. */
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
{
|
||||
int buf_mb_len;
|
||||
|
||||
assert(buf != NULL);
|
||||
|
||||
if (bad_chr != NULL)
|
||||
*bad_chr = FALSE;
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
/* Get the number of bytes in the multibyte character. */
|
||||
buf_mb_len = mblen(buf, MB_CUR_MAX);
|
||||
|
||||
/* If buf contains a null byte or an invalid multibyte
|
||||
* character, set bad_chr to TRUE (if it contains the latter)
|
||||
* and interpret buf's first byte. */
|
||||
if (buf_mb_len <= 0) {
|
||||
/* If buf contains an invalid multibyte character, set bad_chr
|
||||
* to TRUE 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;
|
||||
}
|
||||
} else if (buf_mb_len == 0)
|
||||
buf_mb_len++;
|
||||
|
||||
/* Save the multibyte character in chr. */
|
||||
if (chr != NULL) {
|
||||
@@ -442,7 +432,7 @@ int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
|
||||
else
|
||||
(*col)++;
|
||||
}
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -460,8 +450,7 @@ size_t move_mbleft(const char *buf, size_t pos)
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. Here is the naive, O(pos) way to do it. */
|
||||
while (TRUE) {
|
||||
int buf_mb_len = parse_mbchar(buf + pos - pos_prev, NULL, NULL,
|
||||
NULL);
|
||||
int buf_mb_len = parse_mbchar(buf + pos - pos_prev, NULL, NULL);
|
||||
|
||||
if (pos_prev <= (size_t)buf_mb_len)
|
||||
break;
|
||||
@@ -476,7 +465,7 @@ size_t move_mbleft(const char *buf, size_t pos)
|
||||
* after the one at pos. */
|
||||
size_t move_mbright(const char *buf, size_t pos)
|
||||
{
|
||||
return pos + parse_mbchar(buf + pos, NULL, NULL, NULL);
|
||||
return pos + parse_mbchar(buf + pos, NULL, NULL);
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
@@ -505,7 +494,7 @@ int nstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
return (tolower(*s1) - tolower(*s2));
|
||||
return tolower(*s1) - tolower(*s2);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -515,8 +504,8 @@ int nstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
* strings. */
|
||||
int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *s1_mb = charalloc(MB_CUR_MAX);
|
||||
char *s2_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t ws1, ws2;
|
||||
@@ -524,23 +513,27 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
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);
|
||||
s1_mb_len = parse_mbchar(s1, s1_mb, NULL);
|
||||
|
||||
if (mbtowc(&ws1, s1_mb, s1_mb_len) <= 0) {
|
||||
if (mbtowc(&ws1, s1_mb, s1_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws1 = (unsigned char)*s1_mb;
|
||||
bad_s1_mb = TRUE;
|
||||
}
|
||||
|
||||
s2_mb_len = parse_mbchar(s2, s2_mb, NULL, NULL);
|
||||
s2_mb_len = parse_mbchar(s2, s2_mb, NULL);
|
||||
|
||||
if (mbtowc(&ws2, s2_mb, s2_mb_len) <= 0) {
|
||||
if (mbtowc(&ws2, s2_mb, s2_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws2 = (unsigned char)*s2_mb;
|
||||
bad_s2_mb = TRUE;
|
||||
}
|
||||
|
||||
if (n == 0 || towlower(ws1) != towlower(ws2))
|
||||
if (n == 0 || bad_s1_mb != bad_s2_mb ||
|
||||
towlower(ws1) != towlower(ws2))
|
||||
break;
|
||||
|
||||
s1 += s1_mb_len;
|
||||
@@ -551,7 +544,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
free(s1_mb);
|
||||
free(s2_mb);
|
||||
|
||||
return (towlower(ws1) - towlower(ws2));
|
||||
return towlower(ws1) - towlower(ws2);
|
||||
} else
|
||||
#endif
|
||||
return strncasecmp(s1, s2, n);
|
||||
@@ -581,8 +574,8 @@ const char *nstrcasestr(const char *haystack, const char *needle)
|
||||
/* This function is equivalent to strcasestr() for multibyte strings. */
|
||||
const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t wr, wq;
|
||||
@@ -595,21 +588,26 @@ const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
int r_mb_len, q_mb_len;
|
||||
|
||||
while (*q != '\0') {
|
||||
r_mb_len = parse_mbchar(r, r_mb, NULL, NULL);
|
||||
bool bad_r_mb = FALSE, bad_q_mb = FALSE;
|
||||
|
||||
if (mbtowc(&wr, r_mb, r_mb_len) <= 0) {
|
||||
r_mb_len = parse_mbchar(r, r_mb, 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);
|
||||
q_mb_len = parse_mbchar(q, q_mb, NULL);
|
||||
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wq = (unsigned char)*q;
|
||||
bad_q_mb = TRUE;
|
||||
}
|
||||
|
||||
if (towlower(wr) != towlower(wq))
|
||||
if (bad_r_mb != bad_q_mb ||
|
||||
towlower(wr) != towlower(wq))
|
||||
break;
|
||||
|
||||
r += r_mb_len;
|
||||
@@ -653,7 +651,7 @@ const char *revstrstr(const char *haystack, const char *needle, const
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL || !DISABLE_TABCOMP */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* This function is equivalent to strcasestr(), except in that it scans
|
||||
@@ -682,8 +680,8 @@ const char *revstrcasestr(const char *haystack, const char *needle,
|
||||
const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
const char *rev_start)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t wr, wq;
|
||||
@@ -696,21 +694,26 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
int r_mb_len, q_mb_len;
|
||||
|
||||
while (*q != '\0') {
|
||||
r_mb_len = parse_mbchar(r, r_mb, NULL, NULL);
|
||||
bool bad_r_mb = FALSE, bad_q_mb = FALSE;
|
||||
|
||||
if (mbtowc(&wr, r_mb, r_mb_len) <= 0) {
|
||||
r_mb_len = parse_mbchar(r, r_mb, 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);
|
||||
q_mb_len = parse_mbchar(q, q_mb, NULL);
|
||||
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wq = (unsigned char)*q;
|
||||
bad_q_mb = TRUE;
|
||||
}
|
||||
|
||||
if (towlower(wr) != towlower(wq))
|
||||
if (bad_r_mb != bad_q_mb ||
|
||||
towlower(wr) != towlower(wq))
|
||||
break;
|
||||
|
||||
r += r_mb_len;
|
||||
@@ -737,7 +740,7 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
#endif
|
||||
return revstrcasestr(haystack, needle, rev_start);
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* This function is equivalent to strlen() for multibyte strings. */
|
||||
size_t mbstrlen(const char *s)
|
||||
@@ -765,14 +768,13 @@ size_t mbstrnlen(const char *s, size_t maxlen)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
size_t n = 0;
|
||||
char *s_mb = charalloc(MB_CUR_MAX);
|
||||
int s_mb_len;
|
||||
|
||||
while (*s != '\0') {
|
||||
s_mb_len = parse_mbchar(s, s_mb, NULL, NULL);
|
||||
s_mb_len = parse_mbchar(s, NULL, NULL);
|
||||
|
||||
if (maxlen == 0)
|
||||
break;
|
||||
@@ -782,8 +784,6 @@ size_t mbstrnlen(const char *s, size_t maxlen)
|
||||
n++;
|
||||
}
|
||||
|
||||
free(s_mb);
|
||||
|
||||
return n;
|
||||
} else
|
||||
#endif
|
||||
@@ -796,27 +796,30 @@ char *mbstrchr(const char *s, char *c)
|
||||
{
|
||||
assert(s != NULL && c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (ISSET(USE_UTF8)) {
|
||||
bool bad_c_mb = FALSE, bad_s_mb = FALSE;
|
||||
char *s_mb = charalloc(MB_CUR_MAX);
|
||||
const char *q = s;
|
||||
wchar_t ws, wc;
|
||||
int s_mb_len, c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
if (c_mb_len < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
bad_c_mb = TRUE;
|
||||
}
|
||||
|
||||
while (*s != '\0') {
|
||||
s_mb_len = parse_mbchar(s, s_mb, NULL, NULL);
|
||||
int s_mb_len = parse_mbchar(s, s_mb, NULL);
|
||||
|
||||
if (mbtowc(&ws, s_mb, s_mb_len) <= 0) {
|
||||
if (mbtowc(&ws, s_mb, s_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws = (unsigned char)*s;
|
||||
bad_s_mb = TRUE;
|
||||
}
|
||||
|
||||
if (ws == wc)
|
||||
if (bad_s_mb == bad_c_mb && ws == wc)
|
||||
break;
|
||||
|
||||
s += s_mb_len;
|
||||
@@ -833,4 +836,79 @@ char *mbstrchr(const char *s, char *c)
|
||||
#endif
|
||||
return strchr(s, *c);
|
||||
}
|
||||
|
||||
#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 ENABLE_UTF8
|
||||
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);
|
||||
|
||||
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 */
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
|
||||
bool is_valid_unicode(wchar_t wc)
|
||||
{
|
||||
return ((0 <= wc && wc <= 0x10FFFF) && (wc <= 0xD7FF || 0xE000 <=
|
||||
wc) && (wc <= 0xFDCF || 0xFDF0 <= wc) && ((wc & 0xFFFF) <=
|
||||
0xFFFD));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Check if the string s is a valid multibyte string. Return TRUE if it
|
||||
* is, and FALSE otherwise. */
|
||||
bool is_valid_mbstring(const char *s)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
return
|
||||
#ifdef ENABLE_UTF8
|
||||
ISSET(USE_UTF8) ?
|
||||
(mbstowcs(NULL, s, 0) != (size_t)-1) :
|
||||
#endif
|
||||
|
||||
TRUE;
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
142
src/color.c
142
src/color.c
@@ -8,14 +8,15 @@
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -23,13 +24,9 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
@@ -63,70 +60,147 @@ void set_colorpairs(void)
|
||||
}
|
||||
}
|
||||
|
||||
void do_colorinit(void)
|
||||
/* Initialize the color information. */
|
||||
void color_init(void)
|
||||
{
|
||||
assert(openfile != NULL);
|
||||
|
||||
if (has_colors()) {
|
||||
const colortype *tmpcolor = NULL;
|
||||
const colortype *tmpcolor;
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
bool defok;
|
||||
#endif
|
||||
|
||||
start_color();
|
||||
|
||||
/* Add in colors, if available. */
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
/* Add in colors, if available. */
|
||||
defok = (use_default_colors() != ERR);
|
||||
#endif
|
||||
|
||||
for (tmpcolor = colorstrings; tmpcolor != NULL;
|
||||
for (tmpcolor = openfile->colorstrings; tmpcolor != NULL;
|
||||
tmpcolor = tmpcolor->next) {
|
||||
short background = tmpcolor->bg;
|
||||
short foreground = tmpcolor->fg, background = tmpcolor->bg;
|
||||
if (foreground == -1) {
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
if (!defok)
|
||||
#endif
|
||||
foreground = COLOR_WHITE;
|
||||
}
|
||||
|
||||
if (background == -1)
|
||||
if (background == -1) {
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
if (!defok)
|
||||
#endif
|
||||
background = COLOR_BLACK;
|
||||
}
|
||||
|
||||
init_pair(tmpcolor->pairnum, tmpcolor->fg, background);
|
||||
init_pair(tmpcolor->pairnum, foreground, background);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "init_pair(): fg = %d, bg = %d\n",
|
||||
tmpcolor->fg, tmpcolor->bg);
|
||||
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", tmpcolor->fg, tmpcolor->bg);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the color information based on the current filename. */
|
||||
void update_color(void)
|
||||
void color_update(void)
|
||||
{
|
||||
const syntaxtype *tmpsyntax;
|
||||
colortype *tmpcolor, *defcolor = NULL;
|
||||
|
||||
colorstrings = NULL;
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
const exttype *e;
|
||||
assert(openfile != NULL);
|
||||
|
||||
for (e = tmpsyntax->extensions; e != NULL; e = e->next) {
|
||||
/* Set colorstrings if we matched the extension regex. */
|
||||
if (regexec(&e->val, filename, 0, NULL, 0) == 0)
|
||||
colorstrings = tmpsyntax->color;
|
||||
openfile->colorstrings = NULL;
|
||||
|
||||
if (colorstrings != NULL)
|
||||
/* If we specified a syntax override string, use it. */
|
||||
if (syntaxstr != NULL) {
|
||||
/* If the syntax override is "none", it's the same as not having
|
||||
* a syntax at all, so get out. */
|
||||
if (strcmp(syntaxstr, "none") == 0)
|
||||
return;
|
||||
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcmp(tmpsyntax->desc, syntaxstr) == 0)
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
|
||||
if (openfile->colorstrings != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we haven't found a match, use the override string. */
|
||||
if (colorstrings == NULL && syntaxstr != NULL) {
|
||||
/* If we didn't specify a syntax override string, or if we did and
|
||||
* there was no syntax by that name, get the syntax based on the
|
||||
* file extension. */
|
||||
if (openfile->colorstrings == NULL) {
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcasecmp(tmpsyntax->desc, syntaxstr) == 0)
|
||||
colorstrings = tmpsyntax->color;
|
||||
exttype *e;
|
||||
|
||||
/* If this is the default syntax, it has no associated
|
||||
* extensions. (We've checked for this and for duplicate
|
||||
* syntax names elsewhere.) Skip over it here, but keep
|
||||
* track of its color regexes. */
|
||||
if (strcmp(tmpsyntax->desc, "default") == 0) {
|
||||
defcolor = syntaxes->color;
|
||||
continue;
|
||||
}
|
||||
|
||||
for (e = tmpsyntax->extensions; e != NULL; e = e->next) {
|
||||
bool not_compiled = (e->ext == NULL);
|
||||
|
||||
/* e->ext_regex has already been checked for validity
|
||||
* elsewhere. Compile its specified regex if we haven't
|
||||
* already. */
|
||||
if (not_compiled) {
|
||||
e->ext = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(e->ext, e->ext_regex, REG_EXTENDED);
|
||||
}
|
||||
|
||||
/* Set colorstrings if we matched the extension
|
||||
* regex. */
|
||||
if (regexec(e->ext, openfile->filename, 0, NULL,
|
||||
0) == 0)
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
|
||||
if (openfile->colorstrings != NULL)
|
||||
break;
|
||||
|
||||
/* Decompile e->ext_regex's specified regex if we aren't
|
||||
* going to use it. */
|
||||
if (not_compiled) {
|
||||
regfree(e->ext);
|
||||
free(e->ext);
|
||||
e->ext = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If we didn't get a syntax based on the file extension, and we
|
||||
* have a default syntax, use it. */
|
||||
if (openfile->colorstrings == NULL && defcolor != NULL)
|
||||
openfile->colorstrings = defcolor;
|
||||
|
||||
for (tmpcolor = openfile->colorstrings; tmpcolor != NULL;
|
||||
tmpcolor = tmpcolor->next) {
|
||||
/* tmpcolor->start_regex and tmpcolor->end_regex have already
|
||||
* been checked for validity elsewhere. Compile their specified
|
||||
* regexes if we haven't already. */
|
||||
if (tmpcolor->start == NULL) {
|
||||
tmpcolor->start = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(tmpcolor->start, tmpcolor->start_regex,
|
||||
REG_EXTENDED | (tmpcolor->icase ? REG_ICASE : 0));
|
||||
}
|
||||
|
||||
if (tmpcolor->end_regex != NULL && tmpcolor->end == NULL) {
|
||||
tmpcolor->end = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(tmpcolor->end, tmpcolor->end_regex,
|
||||
REG_EXTENDED | (tmpcolor->icase ? REG_ICASE : 0));
|
||||
}
|
||||
}
|
||||
do_colorinit();
|
||||
}
|
||||
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
67
src/cut.c
67
src/cut.c
@@ -8,14 +8,15 @@
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -23,12 +24,9 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#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? */
|
||||
@@ -41,12 +39,15 @@ void cutbuffer_reset(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. */
|
||||
* 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)
|
||||
{
|
||||
if (current->next != NULL)
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, 0,
|
||||
current->next, 0);
|
||||
if (openfile->current->next != NULL) {
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current, 0,
|
||||
openfile->current->next, 0);
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -61,7 +62,7 @@ void cut_marked(void)
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
|
||||
placewewant = xplustabs();
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
|
||||
/* If we're not at the end of the current line, move all the text from
|
||||
@@ -72,24 +73,24 @@ void cut_marked(void)
|
||||
* used to be. */
|
||||
void cut_to_eol(void)
|
||||
{
|
||||
size_t data_len = strlen(current->data);
|
||||
size_t data_len = strlen(openfile->current->data);
|
||||
|
||||
assert(current_x <= data_len);
|
||||
assert(openfile->current_x <= data_len);
|
||||
|
||||
if (current_x < data_len)
|
||||
if (openfile->current_x < data_len)
|
||||
/* If we're not at the end of the line, move all the text from
|
||||
* the current position up to it, not counting the newline at
|
||||
* the end, to the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
current, data_len);
|
||||
else if (current->next != NULL) {
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->current, data_len);
|
||||
else if (openfile->current->next != NULL) {
|
||||
/* If we're at the end of the line, and it isn't the magicline,
|
||||
* move all the text from the current position up to the
|
||||
* beginning of the next line, i.e, the newline at the end, to
|
||||
* the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
current->next, 0);
|
||||
placewewant = xplustabs();
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->current->next, 0);
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
@@ -97,7 +98,7 @@ void cut_to_eol(void)
|
||||
/* Move text from the current filestruct into the cutbuffer. */
|
||||
void do_cut_text(void)
|
||||
{
|
||||
assert(current != NULL && current->data != NULL);
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
check_statusblank();
|
||||
|
||||
@@ -117,11 +118,11 @@ void do_cut_text(void)
|
||||
keep_cutbuffer = TRUE;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(MARK_ISSET)) {
|
||||
if (openfile->mark_set) {
|
||||
/* If the mark is on, move the marked text to the cutbuffer and
|
||||
* turn the mark off. */
|
||||
cut_marked();
|
||||
UNSET(MARK_ISSET);
|
||||
openfile->mark_set = FALSE;
|
||||
} else if (ISSET(CUT_TO_END))
|
||||
/* Otherwise, if the CUT_TO_END flag is set, move all text up to
|
||||
* the end of the line into the cutbuffer. */
|
||||
@@ -135,7 +136,7 @@ void do_cut_text(void)
|
||||
set_modified();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
dump_filestruct(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -143,18 +144,18 @@ void do_cut_text(void)
|
||||
/* Cut from the current cursor position to the end of the file. */
|
||||
void do_cut_till_end(void)
|
||||
{
|
||||
assert(current != NULL && current->data != NULL);
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
check_statusblank();
|
||||
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
filebot, 0);
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->filebot, 0);
|
||||
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
dump_filestruct(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
@@ -162,7 +163,7 @@ void do_cut_till_end(void)
|
||||
/* Copy text from the cutbuffer into the current filestruct. */
|
||||
void do_uncut_text(void)
|
||||
{
|
||||
assert(current != NULL && current->data != NULL);
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
@@ -180,12 +181,12 @@ void do_uncut_text(void)
|
||||
|
||||
/* Set the current place we want to where the text from the
|
||||
* cutbuffer ends. */
|
||||
placewewant = xplustabs();
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer_reverse();
|
||||
dump_filestruct_reverse();
|
||||
#endif
|
||||
}
|
||||
|
||||
1588
src/files.c
1588
src/files.c
File diff suppressed because it is too large
Load Diff
330
src/global.c
330
src/global.c
@@ -8,14 +8,15 @@
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -23,45 +24,29 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
/* Global variables */
|
||||
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
/* wrap_at might be set in rcfile.c or nano.c. */
|
||||
ssize_t wrap_at = -CHARS_FROM_EOL; /* Right justified fill value,
|
||||
allows resize */
|
||||
ssize_t fill = 0; /* The column where we will wrap
|
||||
* lines. */
|
||||
ssize_t wrap_at = -CHARS_FROM_EOL;
|
||||
/* The position where we will wrap
|
||||
* lines. fill is equal to this if it's
|
||||
* greater than zero, and equal to
|
||||
* (COLS + this) if it isn't. */
|
||||
#endif
|
||||
|
||||
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? */
|
||||
|
||||
unsigned long flags = 0; /* Our flag containing many options */
|
||||
WINDOW *topwin; /* Top buffer */
|
||||
long flags = 0; /* Our flag containing many options */
|
||||
WINDOW *topwin; /* Top subwindow */
|
||||
WINDOW *edit; /* The file portion of the editor */
|
||||
WINDOW *bottomwin; /* Bottom buffer */
|
||||
char *filename = NULL; /* Name of the file */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
struct stat originalfilestat; /* Stat for the file as we loaded it */
|
||||
#endif
|
||||
WINDOW *bottomwin; /* Bottom subwindow */
|
||||
|
||||
int editwinrows = 0; /* How many rows long is the edit
|
||||
window? */
|
||||
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
|
||||
window */
|
||||
filestruct *fileage = NULL; /* Our file buffer */
|
||||
filestruct *edittop = NULL; /* Pointer to the top of the edit
|
||||
buffer with respect to the
|
||||
file struct */
|
||||
filestruct *filebot = NULL; /* Last node in the file struct */
|
||||
filestruct *cutbuffer = NULL; /* A place to store cut text */
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
filestruct *jusbuffer = NULL; /* A place to store unjustified text */
|
||||
@@ -69,10 +54,8 @@ filestruct *jusbuffer = NULL; /* A place to store unjustified text */
|
||||
partition *filepart = NULL; /* A place to store a portion of the
|
||||
file struct */
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
openfilestruct *open_files = NULL; /* The list of open file
|
||||
buffers */
|
||||
#endif
|
||||
openfilestruct *openfile = NULL;
|
||||
/* The list of open file buffers */
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
char *whitespace = NULL; /* Characters used when displaying
|
||||
@@ -103,28 +86,14 @@ 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 */
|
||||
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 */
|
||||
|
||||
ssize_t tabsize = -1; /* Our internal tabsize variable. The
|
||||
default value is set in main(). */
|
||||
|
||||
char *hblank = NULL; /* A horizontal blank line */
|
||||
#ifndef DISABLE_HELP
|
||||
char *help_text; /* The text in the help window */
|
||||
#endif
|
||||
|
||||
/* More stuff for the marker select */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
filestruct *mark_beginbuf; /* The begin marker buffer */
|
||||
size_t mark_beginx; /* X value in the string to start */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
char *operating_dir = NULL; /* Operating directory, which we can't */
|
||||
char *full_operating_dir = NULL;/* go higher than */
|
||||
@@ -156,7 +125,6 @@ shortcut *gotodir_list = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
const colortype *colorstrings = NULL;
|
||||
syntaxtype *syntaxes = NULL;
|
||||
char *syntaxstr = NULL;
|
||||
#endif
|
||||
@@ -168,12 +136,15 @@ 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
|
||||
@@ -195,7 +166,8 @@ size_t length_of_list(const shortcut *s)
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Initialize a struct *without* our lovely braces =( */
|
||||
/* Create a new shortcut structure, at the end of the shortcuts linked
|
||||
* list. */
|
||||
void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help,
|
||||
@@ -239,6 +211,7 @@ 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
|
||||
@@ -249,42 +222,47 @@ 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 line 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");
|
||||
@@ -294,10 +272,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 =
|
||||
@@ -307,6 +289,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, lines, and characters");
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *nano_parabegin_msg =
|
||||
@@ -315,8 +299,10 @@ 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_prevfile_msg =
|
||||
N_("Switch to the previous file buffer");
|
||||
const char *nano_nextfile_msg =
|
||||
N_("Switch to the next file buffer");
|
||||
#endif
|
||||
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
|
||||
#ifndef NANO_SMALL
|
||||
@@ -330,20 +316,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
|
||||
@@ -354,7 +343,8 @@ 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(NANO_SMALL) && defined(ENABLE_MULTIBUFFER)
|
||||
@@ -391,7 +381,7 @@ void shortcut_init(bool unjustify)
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_EXIT_KEY,
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
open_files != NULL && open_files != open_files->next ?
|
||||
openfile != NULL && openfile != openfile->next ?
|
||||
N_("Close") :
|
||||
#endif
|
||||
exit_msg, IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
|
||||
@@ -480,7 +470,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),
|
||||
@@ -489,7 +480,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),
|
||||
@@ -506,11 +497,11 @@ void shortcut_init(bool unjustify)
|
||||
|
||||
sc_init_one(&main_list, NANO_FORWARD_KEY, N_("Forward"),
|
||||
IFHELP(nano_forward_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_right_void);
|
||||
NANO_NO_KEY, VIEW, do_right);
|
||||
|
||||
sc_init_one(&main_list, NANO_BACK_KEY, N_("Back"),
|
||||
IFHELP(nano_back_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_left_void);
|
||||
NANO_NO_KEY, VIEW, do_left);
|
||||
|
||||
sc_init_one(&main_list, NANO_HOME_KEY, N_("Home"),
|
||||
IFHELP(nano_home_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
@@ -520,7 +511,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);
|
||||
|
||||
@@ -543,11 +534,15 @@ 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_wordlinechar_count);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -564,12 +559,12 @@ void shortcut_init(bool unjustify)
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
|
||||
IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY), NANO_NO_KEY,
|
||||
NANO_OPENPREV_ALTKEY, VIEW, open_prevfile_void);
|
||||
IFHELP(nano_prevfile_msg, NANO_PREVFILE_KEY), NANO_NO_KEY,
|
||||
NANO_PREVFILE_ALTKEY, VIEW, switch_to_prev_buffer_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Next File"),
|
||||
IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY), NANO_NO_KEY,
|
||||
NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
|
||||
IFHELP(nano_nextfile_msg, NANO_NEXTFILE_KEY), NANO_NO_KEY,
|
||||
NANO_NEXTFILE_ALTKEY, VIEW, switch_to_next_buffer_void);
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
|
||||
@@ -652,27 +647,29 @@ void shortcut_init(bool unjustify)
|
||||
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, 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,
|
||||
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,
|
||||
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 /* !NANO_SMALL */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
@@ -719,20 +716,22 @@ void shortcut_init(bool unjustify)
|
||||
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
|
||||
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, NULL);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg,
|
||||
IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
sc_init_one(&replace_list, NANO_HISTORY_KEY, history_msg,
|
||||
IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg,
|
||||
IFHELP(nano_regexp_msg, NANO_REGEXP_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif
|
||||
|
||||
#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);
|
||||
|
||||
@@ -759,8 +758,8 @@ 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,
|
||||
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
|
||||
|
||||
@@ -795,6 +794,14 @@ void shortcut_init(bool unjustify)
|
||||
#ifndef DISABLE_HELP
|
||||
free_shortcutage(&help_list);
|
||||
|
||||
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, 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);
|
||||
@@ -810,14 +817,6 @@ void shortcut_init(bool unjustify)
|
||||
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);
|
||||
|
||||
sc_init_one(&help_list, NANO_REFRESH_KEY, N_("Refresh"),
|
||||
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&help_list, NANO_EXIT_KEY, exit_msg,
|
||||
IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&writefile_list);
|
||||
@@ -1002,10 +1001,6 @@ void shortcut_init(bool unjustify)
|
||||
IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&browser_list, NANO_REFRESH_KEY, N_("Refresh"),
|
||||
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
sc_init_one(&browser_list, NANO_GOTOLINE_KEY, N_("Go To Dir"),
|
||||
IFHELP(nano_gotodir_msg, NANO_GOTOLINE_ALTKEY),
|
||||
@@ -1039,6 +1034,7 @@ void shortcut_init(bool unjustify)
|
||||
void free_shortcutage(shortcut **shortcutage)
|
||||
{
|
||||
assert(shortcutage != NULL);
|
||||
|
||||
while (*shortcutage != NULL) {
|
||||
shortcut *ps = *shortcutage;
|
||||
*shortcutage = (*shortcutage)->next;
|
||||
@@ -1047,7 +1043,7 @@ void free_shortcutage(shortcut **shortcutage)
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Create one new toggle structure, at the end of the toggles linked
|
||||
/* Create a new toggle structure, at the end of the toggles linked
|
||||
* list. */
|
||||
void toggle_init_one(int val, const char *desc, long flag)
|
||||
{
|
||||
@@ -1077,28 +1073,33 @@ 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);
|
||||
#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
|
||||
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))
|
||||
@@ -1110,7 +1111,7 @@ void toggle_init(void)
|
||||
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"),
|
||||
BACKUP_FILE);
|
||||
toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"),
|
||||
SMOOTHSCROLL);
|
||||
SMOOTH_SCROLL);
|
||||
toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"),
|
||||
SMART_HOME);
|
||||
#ifdef ENABLE_COLOR
|
||||
@@ -1121,22 +1122,7 @@ void toggle_init(void)
|
||||
toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"),
|
||||
WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_MORESPACE_KEY, N_("Use of more space for editing"),
|
||||
MORE_SPACE);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* 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
|
||||
@@ -1156,7 +1142,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
|
||||
@@ -1173,8 +1160,6 @@ void thanks_for_all_the_fish(void)
|
||||
free(last_search);
|
||||
if (last_replace != NULL)
|
||||
free(last_replace);
|
||||
if (hblank != NULL)
|
||||
free(hblank);
|
||||
#ifndef DISABLE_SPELLER
|
||||
if (alt_speller != NULL)
|
||||
free(alt_speller);
|
||||
@@ -1183,8 +1168,6 @@ void thanks_for_all_the_fish(void)
|
||||
if (help_text != NULL)
|
||||
free(help_text);
|
||||
#endif
|
||||
if (filename != NULL)
|
||||
free(filename);
|
||||
if (answer != NULL)
|
||||
free(answer);
|
||||
if (cutbuffer != NULL)
|
||||
@@ -1213,24 +1196,21 @@ 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;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (open_files != NULL) {
|
||||
/* We free the memory associated with each open file. */
|
||||
while (open_files->prev != NULL)
|
||||
open_files = open_files->prev;
|
||||
free_openfilestruct(open_files);
|
||||
toggles = toggles->next;
|
||||
free(t);
|
||||
}
|
||||
#else
|
||||
free_filestruct(fileage);
|
||||
#endif
|
||||
|
||||
/* Free the memory associated with each open file buffer. */
|
||||
if (openfile != NULL)
|
||||
free_openfilestruct(openfile);
|
||||
#ifdef ENABLE_COLOR
|
||||
free(syntaxstr);
|
||||
if (syntaxstr != NULL)
|
||||
free(syntaxstr);
|
||||
while (syntaxes != NULL) {
|
||||
syntaxtype *bill = syntaxes;
|
||||
|
||||
@@ -1239,17 +1219,28 @@ void thanks_for_all_the_fish(void)
|
||||
exttype *bob = syntaxes->extensions;
|
||||
|
||||
syntaxes->extensions = bob->next;
|
||||
regfree(&bob->val);
|
||||
free(bob->ext_regex);
|
||||
if (bob->ext != NULL) {
|
||||
regfree(bob->ext);
|
||||
free(bob->ext);
|
||||
}
|
||||
free(bob);
|
||||
}
|
||||
while (syntaxes->color != NULL) {
|
||||
colortype *bob = syntaxes->color;
|
||||
|
||||
syntaxes->color = bob->next;
|
||||
regfree(&bob->start);
|
||||
if (bob->end != NULL)
|
||||
free(bob->start_regex);
|
||||
if (bob->start != NULL) {
|
||||
regfree(bob->start);
|
||||
free(bob->start);
|
||||
}
|
||||
if (bob->end_regex != NULL)
|
||||
free(bob->end_regex);
|
||||
if (bob->end != NULL) {
|
||||
regfree(bob->end);
|
||||
free(bob->end);
|
||||
free(bob->end);
|
||||
}
|
||||
free(bob);
|
||||
}
|
||||
syntaxes = syntaxes->next;
|
||||
@@ -1257,12 +1248,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 */
|
||||
|
||||
681
src/move.c
681
src/move.c
@@ -8,14 +8,15 @@
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -23,268 +24,570 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
void do_first_line(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
current = fileage;
|
||||
placewewant = 0;
|
||||
current_x = 0;
|
||||
if (edittop != fileage || need_vertical_update(pww_save))
|
||||
edit_update(TOP);
|
||||
const filestruct *current_save = openfile->current;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
openfile->current = openfile->fileage;
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
|
||||
edit_redraw(current_save, pww_save);
|
||||
}
|
||||
|
||||
void do_last_line(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
current = filebot;
|
||||
placewewant = 0;
|
||||
current_x = 0;
|
||||
if (edittop->lineno + (editwinrows / 2) != filebot->lineno ||
|
||||
need_vertical_update(pww_save))
|
||||
edit_update(CENTER);
|
||||
}
|
||||
const filestruct *current_save = openfile->current;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
void do_home(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(SMART_HOME)) {
|
||||
size_t current_x_save = current_x;
|
||||
|
||||
current_x = indent_length(current->data);
|
||||
|
||||
if (current_x == current_x_save ||
|
||||
current->data[current_x] == '\0')
|
||||
current_x = 0;
|
||||
|
||||
placewewant = xplustabs();
|
||||
} else {
|
||||
#endif
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
check_statusblank();
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_end(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
current_x = strlen(current->data);
|
||||
placewewant = xplustabs();
|
||||
check_statusblank();
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
openfile->current = openfile->filebot;
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
openfile->current_y = editwinrows - 1;
|
||||
|
||||
edit_redraw(current_save, pww_save);
|
||||
}
|
||||
|
||||
void do_page_up(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
const filestruct *current_save = current;
|
||||
int i;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
/* If the first line of the file is onscreen, move current up there
|
||||
* and put the cursor at the beginning of the line. */
|
||||
if (edittop == fileage) {
|
||||
current = fileage;
|
||||
placewewant = 0;
|
||||
} else {
|
||||
edit_scroll(UP, editwinrows - 2);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* If we're in smooth scrolling mode and there's at least one
|
||||
* page of text left, move the current line of the edit window
|
||||
* up a page. */
|
||||
if (ISSET(SMOOTHSCROLL) && current->lineno > editwinrows - 2) {
|
||||
int i;
|
||||
for (i = 0; i < editwinrows - 2; i++)
|
||||
current = current->prev;
|
||||
}
|
||||
/* If we're not in smooth scrolling mode or there isn't at least
|
||||
* one page of text left, put the cursor at the beginning of the
|
||||
* top line of the edit window, as Pico does. */
|
||||
else {
|
||||
#endif
|
||||
current = edittop;
|
||||
placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
/* If there's less than a page of text left on the screen, put the
|
||||
* cursor at the beginning of the first line of the file, and then
|
||||
* update the edit window. */
|
||||
if (openfile->current->lineno <= editwinrows - 2) {
|
||||
do_first_line();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the equivalent x-coordinate of the new line. */
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
/* If we're not in smooth scrolling mode, put the cursor at the
|
||||
* beginning of the top line of the edit window, as Pico does. */
|
||||
#ifndef NANO_SMALL
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
#endif
|
||||
openfile->current = openfile->edittop;
|
||||
openfile->placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(current_save, pww_save);
|
||||
for (i = editwinrows - 2; i > 0 && openfile->current->prev != NULL;
|
||||
i--)
|
||||
openfile->current = openfile->current->prev;
|
||||
|
||||
check_statusblank();
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window up a page. */
|
||||
edit_scroll(UP, editwinrows - 2);
|
||||
}
|
||||
|
||||
void do_page_down(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
const filestruct *current_save = current;
|
||||
int i;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
/* If the last line of the file is onscreen, move current down
|
||||
* there and put the cursor at the beginning of the line. */
|
||||
if (edittop->lineno + editwinrows > filebot->lineno) {
|
||||
current = filebot;
|
||||
placewewant = 0;
|
||||
} else {
|
||||
edit_scroll(DOWN, editwinrows - 2);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* If we're in smooth scrolling mode and there's at least one
|
||||
* page of text left, move the current line of the edit window
|
||||
* down a page. */
|
||||
if (ISSET(SMOOTHSCROLL) && current->lineno + editwinrows - 2 <=
|
||||
filebot->lineno) {
|
||||
int i;
|
||||
for (i = 0; i < editwinrows - 2; i++)
|
||||
current = current->next;
|
||||
}
|
||||
/* If we're not in smooth scrolling mode or there isn't at least
|
||||
* one page of text left, put the cursor at the beginning of the
|
||||
* top line of the edit window, as Pico does. */
|
||||
else {
|
||||
#endif
|
||||
current = edittop;
|
||||
placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
/* If there's less than a page of text left on the screen, put the
|
||||
* cursor at the beginning of the last line of the file, and then
|
||||
* update the edit window. */
|
||||
if (openfile->current->lineno + editwinrows - 2 >=
|
||||
openfile->filebot->lineno) {
|
||||
do_last_line();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the equivalent x-coordinate of the new line. */
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
/* If we're not in smooth scrolling mode, put the cursor at the
|
||||
* beginning of the top line of the edit window, as Pico does. */
|
||||
#ifndef NANO_SMALL
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
#endif
|
||||
openfile->current = openfile->edittop;
|
||||
openfile->placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(current_save, pww_save);
|
||||
for (i = editwinrows - 2; i > 0 && openfile->current->next != NULL;
|
||||
i--)
|
||||
openfile->current = openfile->current->next;
|
||||
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window down a page. */
|
||||
edit_scroll(DOWN, editwinrows - 2);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Move up to the last beginning-of-paragraph line before the current
|
||||
* line. */
|
||||
void do_para_begin(bool allow_update)
|
||||
{
|
||||
const filestruct *current_save = openfile->current;
|
||||
const size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
|
||||
if (openfile->current->prev != NULL) {
|
||||
do {
|
||||
openfile->current = openfile->current->prev;
|
||||
openfile->current_y--;
|
||||
} while (!begpar(openfile->current));
|
||||
}
|
||||
|
||||
if (allow_update)
|
||||
edit_redraw(current_save, pww_save);
|
||||
}
|
||||
|
||||
void do_para_begin_void(void)
|
||||
{
|
||||
do_para_begin(TRUE);
|
||||
}
|
||||
|
||||
/* Move down to the end of a paragraph, then one line farther. A line
|
||||
* is the last line of a paragraph if it is in a paragraph, and the next
|
||||
* line either is a beginning-of-paragraph line or isn't in a
|
||||
* paragraph. */
|
||||
void do_para_end(bool allow_update)
|
||||
{
|
||||
const filestruct *const current_save = openfile->current;
|
||||
const size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
|
||||
while (openfile->current->next != NULL && !inpar(openfile->current))
|
||||
openfile->current = openfile->current->next;
|
||||
|
||||
while (openfile->current->next != NULL &&
|
||||
inpar(openfile->current->next) &&
|
||||
!begpar(openfile->current->next)) {
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_y++;
|
||||
}
|
||||
|
||||
if (openfile->current->next != NULL)
|
||||
openfile->current = openfile->current->next;
|
||||
|
||||
if (allow_update)
|
||||
edit_redraw(current_save, pww_save);
|
||||
}
|
||||
|
||||
void do_para_end_void(void)
|
||||
{
|
||||
do_para_end(TRUE);
|
||||
}
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Move to the next word in the current filestruct. If allow_punct is
|
||||
* TRUE, treat punctuation as part of a word. If allow_update is TRUE,
|
||||
* update the screen afterward. Return TRUE if we started on a word,
|
||||
* and FALSE otherwise. */
|
||||
bool do_next_word(bool allow_punct, bool allow_update)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
const filestruct *current_save = openfile->current;
|
||||
char *char_mb;
|
||||
int char_mb_len;
|
||||
bool end_line = FALSE, started_on_word = FALSE;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
check_statusblank();
|
||||
|
||||
char_mb = charalloc(mb_cur_max());
|
||||
|
||||
/* Move forward until we find the character after the last letter of
|
||||
* the current word. */
|
||||
while (!end_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving forward through the current
|
||||
* line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
/* If we haven't found it, then we've started on a word, so set
|
||||
* started_on_word to TRUE. */
|
||||
started_on_word = TRUE;
|
||||
|
||||
if (openfile->current->data[openfile->current_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
openfile->current_x += char_mb_len;
|
||||
}
|
||||
|
||||
/* Move forward until we find the first letter of the next word. */
|
||||
if (openfile->current->data[openfile->current_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
openfile->current_x += char_mb_len;
|
||||
|
||||
for (; openfile->current != NULL;
|
||||
openfile->current = openfile->current->next) {
|
||||
while (!end_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving forward through the
|
||||
* current line. */
|
||||
if (is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
if (openfile->current->data[openfile->current_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
openfile->current_x += char_mb_len;
|
||||
}
|
||||
|
||||
/* If we've found it, stop moving forward to the beginnings of
|
||||
* subsequent lines. */
|
||||
if (!end_line)
|
||||
break;
|
||||
|
||||
if (openfile->current->next != NULL) {
|
||||
end_line = FALSE;
|
||||
openfile->current_x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
free(char_mb);
|
||||
|
||||
/* If we haven't found it, leave the cursor at the end of the
|
||||
* file. */
|
||||
if (openfile->current == NULL)
|
||||
openfile->current = openfile->filebot;
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update)
|
||||
edit_redraw(current_save, pww_save);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
return started_on_word;
|
||||
}
|
||||
|
||||
void do_next_word_void(void)
|
||||
{
|
||||
do_next_word(ISSET(WORD_BOUNDS), TRUE);
|
||||
}
|
||||
|
||||
/* Move to the previous word in the current filestruct. If allow_punct
|
||||
* is TRUE, treat punctuation as part of a word. If allow_update is
|
||||
* TRUE, update the screen afterward. Return TRUE if we started on a
|
||||
* word, and FALSE otherwise. */
|
||||
bool do_prev_word(bool allow_punct, bool allow_update)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
const filestruct *current_save = openfile->current;
|
||||
char *char_mb;
|
||||
int char_mb_len;
|
||||
bool begin_line = FALSE, started_on_word = FALSE;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
check_statusblank();
|
||||
|
||||
char_mb = charalloc(mb_cur_max());
|
||||
|
||||
/* Move backward until we find the character before the first letter
|
||||
* of the current word. */
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the current
|
||||
* line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
/* If we haven't found it, then we've started on a word, so set
|
||||
* started_on_word to TRUE. */
|
||||
started_on_word = TRUE;
|
||||
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
/* Move backward until we find the last letter of the previous
|
||||
* word. */
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
|
||||
for (; openfile->current != NULL;
|
||||
openfile->current = openfile->current->prev) {
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the
|
||||
* current line. */
|
||||
if (is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x =
|
||||
move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
/* If we've found it, stop moving backward to the ends of
|
||||
* previous lines. */
|
||||
if (!begin_line)
|
||||
break;
|
||||
|
||||
if (openfile->current->prev != NULL) {
|
||||
begin_line = FALSE;
|
||||
openfile->current_x = strlen(openfile->current->prev->data);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we haven't found it, leave the cursor at the beginning of the
|
||||
* file. */
|
||||
if (openfile->current == NULL)
|
||||
openfile->current = openfile->fileage;
|
||||
/* If we've found it, move backward until we find the character
|
||||
* before the first letter of the previous word. */
|
||||
else if (!begin_line) {
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the
|
||||
* current line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x =
|
||||
move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
/* If we've found it, move forward to the first letter of the
|
||||
* previous word. */
|
||||
if (!begin_line)
|
||||
openfile->current_x += char_mb_len;
|
||||
}
|
||||
|
||||
free(char_mb);
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update)
|
||||
edit_redraw(current_save, pww_save);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
return started_on_word;
|
||||
}
|
||||
|
||||
void do_prev_word_void(void)
|
||||
{
|
||||
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
void do_home(void)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(SMART_HOME)) {
|
||||
size_t current_x_save = openfile->current_x;
|
||||
|
||||
openfile->current_x = indent_length(openfile->current->data);
|
||||
|
||||
if (openfile->current_x == current_x_save ||
|
||||
openfile->current->data[openfile->current_x] == '\0')
|
||||
openfile->current_x = 0;
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
} else {
|
||||
#endif
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
void do_end(void)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
void do_up(void)
|
||||
{
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statusblank();
|
||||
|
||||
if (current->prev == NULL)
|
||||
/* If we're at the top of the file, get out. */
|
||||
if (openfile->current->prev == NULL)
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
||||
|
||||
current = current->prev;
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
/* Move the current line of the edit window up. */
|
||||
openfile->current = openfile->current->prev;
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* If we're on the first row of the edit window, scroll up one line
|
||||
* if we're in smooth scrolling mode, or up half a page if we're
|
||||
* not. */
|
||||
if (current_y == 0)
|
||||
/* If we're on the first line of the edit window, scroll the edit
|
||||
* window up one line if we're in smooth scrolling mode, or up half
|
||||
* a page if we're not. */
|
||||
if (openfile->current_y == 0)
|
||||
edit_scroll(UP,
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(SMOOTHSCROLL) ? 1 :
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
|
||||
/* Update the lines left alone by edit_scroll(): the line we were on
|
||||
* before and the line we're on now. The former needs to be redrawn
|
||||
* if we're not on the first page, and the latter needs to be
|
||||
* drawn. */
|
||||
if (need_vertical_update(0))
|
||||
update_line(current->next, 0);
|
||||
update_line(current, current_x);
|
||||
/* Update the line we were on before and the line we're on now. The
|
||||
* former needs to be redrawn if we're not on the first page, and
|
||||
* the latter needs to be drawn unconditionally. */
|
||||
else {
|
||||
if (need_vertical_update(0))
|
||||
update_line(openfile->current->next, 0);
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
}
|
||||
|
||||
void do_down(void)
|
||||
{
|
||||
check_statusblank();
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statusblank();
|
||||
|
||||
if (current->next == NULL)
|
||||
/* If we're at the bottom of the file, get out. */
|
||||
if (openfile->current->next == NULL)
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
current = current->next;
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
||||
|
||||
/* If we're on the last row of the edit window, scroll down one line
|
||||
* if we're in smooth scrolling mode, or down half a page if we're
|
||||
* not. */
|
||||
if (current_y == editwinrows - 1)
|
||||
/* Move the current line of the edit window down. */
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* If we're on the last line of the edit window, scroll the edit
|
||||
* window down one line if we're in smooth scrolling mode, or down
|
||||
* half a page if we're not. */
|
||||
if (openfile->current_y == editwinrows - 1)
|
||||
edit_scroll(DOWN,
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(SMOOTHSCROLL) ? 1 :
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
|
||||
/* Update the lines left alone by edit_scroll(): the line we were on
|
||||
* before and the line we're on now. The former needs to be redrawn
|
||||
* if we're not on the first page, and the latter needs to be
|
||||
* drawn. */
|
||||
if (need_vertical_update(0))
|
||||
update_line(current->prev, 0);
|
||||
update_line(current, current_x);
|
||||
/* Update the line we were on before and the line we're on now. The
|
||||
* former needs to be redrawn if we're not on the first page, and
|
||||
* the latter needs to be drawn unconditionally. */
|
||||
else {
|
||||
if (need_vertical_update(0))
|
||||
update_line(openfile->current->prev, 0);
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
}
|
||||
|
||||
void do_left(bool allow_update)
|
||||
void do_left(void)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
if (current_x > 0)
|
||||
current_x = move_mbleft(current->data, current_x);
|
||||
else if (current != fileage) {
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
|
||||
if (openfile->current_x > 0)
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
else if (openfile->current != openfile->fileage) {
|
||||
do_up();
|
||||
current_x = strlen(current->data);
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
void do_right(void)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
|
||||
check_statusblank();
|
||||
if (allow_update && need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_left_void(void)
|
||||
{
|
||||
do_left(TRUE);
|
||||
}
|
||||
assert(openfile->current_x <= strlen(openfile->current->data));
|
||||
|
||||
void do_right(bool allow_update)
|
||||
{
|
||||
size_t pww_save = placewewant;
|
||||
assert(current_x <= strlen(current->data));
|
||||
|
||||
if (current->data[current_x] != '\0')
|
||||
current_x = move_mbright(current->data, current_x);
|
||||
else if (current->next != NULL) {
|
||||
if (openfile->current->data[openfile->current_x] != '\0')
|
||||
openfile->current_x = move_mbright(openfile->current->data,
|
||||
openfile->current_x);
|
||||
else if (openfile->current->next != NULL) {
|
||||
do_down();
|
||||
current_x = 0;
|
||||
openfile->current_x = 0;
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
check_statusblank();
|
||||
if (allow_update && need_horizontal_update(pww_save))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_right_void(void)
|
||||
{
|
||||
do_right(TRUE);
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
3627
src/nano.c
3627
src/nano.c
File diff suppressed because it is too large
Load Diff
327
src/nano.h
327
src/nano.h
@@ -8,22 +8,27 @@
|
||||
* 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,17 +39,17 @@
|
||||
#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 charcpy(dest, src, n) memcpy(dest, src, (n) * sizeof(char))
|
||||
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
|
||||
|
||||
/* Other macros. */
|
||||
#ifdef BROKEN_REGEXEC
|
||||
@@ -52,8 +57,7 @@
|
||||
#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 4096
|
||||
#endif
|
||||
@@ -86,23 +90,30 @@
|
||||
/* Mark a string that will be sent to gettext() later. */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "config.h"
|
||||
|
||||
/* If no snprintf() or vsnprintf(), use the versions from glib. */
|
||||
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
|
||||
#include <glib.h>
|
||||
#ifndef HAVE_SNPRINTF
|
||||
#define snprintf g_snprintf
|
||||
#include <dirent.h>
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
/* If no vsnprintf(), use the version from glib 2.x. */
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
#include <glib.h>
|
||||
#define vsnprintf g_vsnprintf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If no 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 nisblank
|
||||
#endif
|
||||
#ifndef HAVE_ISWBLANK
|
||||
#define iswblank niswblank
|
||||
#endif
|
||||
#ifndef HAVE_STRCASECMP
|
||||
#define strcasecmp nstrcasecmp
|
||||
#endif
|
||||
@@ -124,6 +135,12 @@
|
||||
|
||||
#define VERMSG "GNU nano " VERSION
|
||||
|
||||
/* If we don't have regex support, turn the color support off, as it
|
||||
* depends on the use of regexes. */
|
||||
#ifndef HAVE_REGEX_H
|
||||
#undef ENABLE_COLOR
|
||||
#endif
|
||||
|
||||
/* If we aren't using ncurses, turn the mouse support off, as it's
|
||||
* ncurses-specific. */
|
||||
#ifndef NCURSES_MOUSE_VERSION
|
||||
@@ -140,55 +157,25 @@ typedef enum {
|
||||
} file_format;
|
||||
|
||||
typedef enum {
|
||||
UP, DOWN
|
||||
} updown;
|
||||
OVERWRITE, APPEND, PREPEND
|
||||
} append_type;
|
||||
|
||||
typedef enum {
|
||||
TOP, CENTER, NONE
|
||||
} topmidnone;
|
||||
UP, DOWN
|
||||
} scroll_dir;
|
||||
|
||||
typedef enum {
|
||||
CENTER, NONE
|
||||
} update_type;
|
||||
|
||||
/* Structure types. */
|
||||
typedef struct filestruct {
|
||||
char *data;
|
||||
struct filestruct *next; /* Next node. */
|
||||
struct filestruct *prev; /* Previous node. */
|
||||
int lineno; /* The line number. */
|
||||
ssize_t lineno; /* The line number. */
|
||||
} filestruct;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
typedef struct openfilestruct {
|
||||
char *filename;
|
||||
#ifndef NANO_SMALL
|
||||
struct stat originalfilestat;
|
||||
#endif
|
||||
struct openfilestruct *next;
|
||||
/* Next node. */
|
||||
struct openfilestruct *prev;
|
||||
/* Previous node. */
|
||||
filestruct *fileage; /* Current file. */
|
||||
filestruct *filebot; /* Current file's last line. */
|
||||
filestruct *edittop; /* Current top of edit window. */
|
||||
filestruct *current; /* Current file's line. */
|
||||
#ifndef NANO_SMALL
|
||||
filestruct *mark_beginbuf;
|
||||
/* Current file's beginning marked
|
||||
* line. */
|
||||
size_t mark_beginx; /* Current file's beginning marked
|
||||
* line's x-coordinate position. */
|
||||
#endif
|
||||
size_t current_x; /* Current file's x-coordinate
|
||||
* position. */
|
||||
size_t placewewant; /* Current file's place we want. */
|
||||
int totlines; /* Current file's total number of
|
||||
* lines. */
|
||||
size_t totsize; /* Current file's total size. */
|
||||
unsigned long flags; /* Current file's flags: modification
|
||||
* status (and marking status, if
|
||||
* available). */
|
||||
file_format fmt; /* Current file's format. */
|
||||
} openfilestruct;
|
||||
#endif
|
||||
|
||||
typedef struct partition {
|
||||
filestruct *fileage;
|
||||
filestruct *top_prev;
|
||||
@@ -198,6 +185,74 @@ typedef struct partition {
|
||||
char *bot_data;
|
||||
} partition;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
typedef struct colortype {
|
||||
short fg; /* Foreground color. */
|
||||
short bg; /* Background color. */
|
||||
bool bright; /* Is this color A_BOLD? */
|
||||
bool icase; /* Is this regex string case
|
||||
* insensitive? */
|
||||
int pairnum; /* Color pair number used for this
|
||||
* foreground/background. */
|
||||
char *start_regex; /* Start (or all) of the regex
|
||||
* string. */
|
||||
regex_t *start; /* Compiled start (or all) of the regex
|
||||
* string. */
|
||||
char *end_regex; /* End (if any) of the regex string. */
|
||||
regex_t *end; /* Compiled end (if any) of the regex
|
||||
* string. */
|
||||
struct colortype *next;
|
||||
} colortype;
|
||||
|
||||
typedef struct exttype {
|
||||
char *ext_regex; /* Extensions that match this syntax. */
|
||||
regex_t *ext; /* Compiled extensions that match this
|
||||
* syntax. */
|
||||
struct exttype *next;
|
||||
} exttype;
|
||||
|
||||
typedef struct syntaxtype {
|
||||
char *desc; /* Name of this syntax type. */
|
||||
exttype *extensions; /* List of extensions that this syntax
|
||||
* applies to. */
|
||||
colortype *color; /* Color struct for this syntax. */
|
||||
struct syntaxtype *next;
|
||||
} syntaxtype;
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
typedef struct openfilestruct {
|
||||
char *filename; /* Current file's name. */
|
||||
filestruct *fileage; /* Current file's first line. */
|
||||
filestruct *filebot; /* Current file's last line. */
|
||||
filestruct *edittop; /* Current top of edit window. */
|
||||
filestruct *current; /* Current file's line. */
|
||||
size_t totsize; /* Current file's total number of
|
||||
* characters. */
|
||||
size_t current_x; /* Current file's x-coordinate
|
||||
* position. */
|
||||
size_t placewewant; /* Current file's place we want. */
|
||||
ssize_t current_y; /* Current file's y-coordinate
|
||||
* position. */
|
||||
bool modified; /* Current file's modification
|
||||
* status. */
|
||||
#ifndef NANO_SMALL
|
||||
bool mark_set; /* Current file's marking status. */
|
||||
filestruct *mark_begin; /* Current file's beginning marked
|
||||
* line. */
|
||||
size_t mark_begin_x; /* Current file's beginning marked
|
||||
* line's x-coordinate position. */
|
||||
file_format fmt; /* Current file's format. */
|
||||
struct stat *current_stat; /* Current file's stat. */
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
colortype *colorstrings; /* Current file's associated colors. */
|
||||
#endif
|
||||
struct openfilestruct *next;
|
||||
/* Next node. */
|
||||
struct openfilestruct *prev;
|
||||
/* Previous node. */
|
||||
} openfilestruct;
|
||||
|
||||
typedef struct shortcut {
|
||||
/* Key values that aren't used should be set to NANO_NO_KEY. */
|
||||
int ctrlval; /* Special sentinel key or control key we want
|
||||
@@ -233,88 +288,41 @@ typedef struct rcoption {
|
||||
} rcoption;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
typedef struct colortype {
|
||||
int fg; /* Foreground color. */
|
||||
int bg; /* Background color. */
|
||||
int 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;
|
||||
/* Bitwise flags so that we can save space (or, more correctly, not
|
||||
* waste it). */
|
||||
#define CASE_SENSITIVE (1<<0)
|
||||
#define CONST_UPDATE (1<<1)
|
||||
#define NO_HELP (1<<2)
|
||||
#define NOFOLLOW_SYMLINKS (1<<3)
|
||||
#define SUSPEND (1<<4)
|
||||
#define NO_WRAP (1<<5)
|
||||
#define AUTOINDENT (1<<6)
|
||||
#define VIEW_MODE (1<<7)
|
||||
#define USE_MOUSE (1<<8)
|
||||
#define USE_REGEXP (1<<9)
|
||||
#define TEMP_FILE (1<<10)
|
||||
#define CUT_TO_END (1<<11)
|
||||
#define BACKWARDS_SEARCH (1<<12)
|
||||
#define MULTIBUFFER (1<<13)
|
||||
#define SMOOTH_SCROLL (1<<14)
|
||||
#define REBIND_DELETE (1<<15)
|
||||
#define REBIND_KEYPAD (1<<16)
|
||||
#define NO_CONVERT (1<<17)
|
||||
#define BACKUP_FILE (1<<18)
|
||||
#define NO_RCFILE (1<<19)
|
||||
#define NO_COLOR_SYNTAX (1<<20)
|
||||
#define PRESERVE (1<<21)
|
||||
#define HISTORYLOG (1<<22)
|
||||
#define RESTRICTED (1<<23)
|
||||
#define SMART_HOME (1<<24)
|
||||
#define WHITESPACE_DISPLAY (1<<25)
|
||||
#define MORE_SPACE (1<<26)
|
||||
#define TABS_TO_SPACES (1<<27)
|
||||
#define QUICK_BLANK (1<<28)
|
||||
#define WORD_BOUNDS (1<<29)
|
||||
#define USE_UTF8 (1<<30)
|
||||
|
||||
typedef struct exttype {
|
||||
regex_t val; /* The extensions that match this
|
||||
* syntax. */
|
||||
struct exttype *next;
|
||||
} exttype;
|
||||
|
||||
typedef struct syntaxtype {
|
||||
char *desc; /* Name of this syntax type. */
|
||||
exttype *extensions; /* List of extensions that this syntax
|
||||
* applies to. */
|
||||
colortype *color; /* Color struct for this syntax. */
|
||||
struct syntaxtype *next;
|
||||
} syntaxtype;
|
||||
#endif
|
||||
|
||||
#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 the 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). */
|
||||
#define MODIFIED (1<<0)
|
||||
#define CASE_SENSITIVE (1<<1)
|
||||
#define MARK_ISSET (1<<2)
|
||||
#define CONSTUPDATE (1<<3)
|
||||
#define NO_HELP (1<<4)
|
||||
#define NOFOLLOW_SYMLINKS (1<<5)
|
||||
#define SUSPEND (1<<6)
|
||||
#define NO_WRAP (1<<7)
|
||||
#define AUTOINDENT (1<<8)
|
||||
#define VIEW_MODE (1<<9)
|
||||
#define USE_MOUSE (1<<10)
|
||||
#define USE_REGEXP (1<<11)
|
||||
#define TEMP_FILE (1<<12)
|
||||
#define CUT_TO_END (1<<13)
|
||||
#define REVERSE_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 NO_COLOR_SYNTAX (1<<22)
|
||||
#define PRESERVE (1<<23)
|
||||
#define HISTORY_CHANGED (1<<24)
|
||||
#define HISTORYLOG (1<<25)
|
||||
#define RESTRICTED (1<<26)
|
||||
#define SMART_HOME (1<<27)
|
||||
#define WHITESPACE_DISPLAY (1<<28)
|
||||
#define MORE_SPACE (1<<29)
|
||||
#define NO_UTF8 (1<<30)
|
||||
|
||||
/* Control key sequences, changing these would be very very bad. */
|
||||
/* 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
|
||||
@@ -349,8 +357,16 @@ typedef struct historyheadtype {
|
||||
#define NANO_CONTROL_7 31
|
||||
#define NANO_CONTROL_8 127
|
||||
|
||||
#define NANO_ALT_SPACE ' '
|
||||
#define NANO_ALT_LPAREN '('
|
||||
#define NANO_ALT_RPAREN ')'
|
||||
#define NANO_ALT_COMMA ','
|
||||
#define NANO_ALT_PERIOD '.'
|
||||
#define NANO_ALT_9 '9'
|
||||
#define NANO_ALT_0 '0'
|
||||
#define NANO_ALT_LCARAT '<'
|
||||
#define NANO_ALT_RCARAT '>'
|
||||
#define NANO_ALT_RBRACKET ']'
|
||||
#define NANO_ALT_A 'a'
|
||||
#define NANO_ALT_B 'b'
|
||||
#define NANO_ALT_C 'c'
|
||||
@@ -377,14 +393,6 @@ typedef struct historyheadtype {
|
||||
#define NANO_ALT_X 'x'
|
||||
#define NANO_ALT_Y 'y'
|
||||
#define NANO_ALT_Z 'z'
|
||||
#define NANO_ALT_PERIOD '.'
|
||||
#define NANO_ALT_COMMA ','
|
||||
#define NANO_ALT_LPAREN '('
|
||||
#define NANO_ALT_RPAREN ')'
|
||||
#define NANO_ALT_LCARAT '<'
|
||||
#define NANO_ALT_RCARAT '>'
|
||||
#define NANO_ALT_RBRACKET ']'
|
||||
#define NANO_ALT_SPACE ' '
|
||||
|
||||
/* Some semi-changeable keybindings; don't play with these unless you're
|
||||
* sure you know what you're doing. Assume ERR is defined as -1. */
|
||||
@@ -392,9 +400,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
|
||||
@@ -417,6 +422,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
|
||||
@@ -459,13 +465,14 @@ typedef struct historyheadtype {
|
||||
#define NANO_TOFILES_KEY NANO_CONTROL_T
|
||||
#define NANO_APPEND_KEY NANO_ALT_A
|
||||
#define NANO_PREPEND_KEY NANO_ALT_P
|
||||
#define NANO_OPENPREV_KEY NANO_ALT_LCARAT
|
||||
#define NANO_OPENNEXT_KEY NANO_ALT_RCARAT
|
||||
#define NANO_OPENPREV_ALTKEY NANO_ALT_COMMA
|
||||
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
|
||||
#define NANO_PREVFILE_KEY NANO_ALT_LCARAT
|
||||
#define NANO_NEXTFILE_KEY NANO_ALT_RCARAT
|
||||
#define NANO_PREVFILE_ALTKEY NANO_ALT_COMMA
|
||||
#define NANO_NEXTFILE_ALTKEY NANO_ALT_PERIOD
|
||||
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
|
||||
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
||||
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
||||
#define NANO_WORDCOUNT_KEY NANO_ALT_D
|
||||
#define NANO_CUTTILLEND_KEY NANO_CONTROL_X
|
||||
#define NANO_CUTTILLEND_ALTKEY NANO_ALT_T
|
||||
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
||||
@@ -486,7 +493,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
|
||||
@@ -500,6 +506,7 @@ typedef struct historyheadtype {
|
||||
#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
|
||||
@@ -517,7 +524,11 @@ typedef struct historyheadtype {
|
||||
/* Default width of a tab. */
|
||||
#define WIDTH_OF_TAB 8
|
||||
|
||||
/* Maximum number of search/replace history strings saved. */
|
||||
/* 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 */
|
||||
|
||||
448
src/proto.h
448
src/proto.h
@@ -8,40 +8,30 @@
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/* Externs. */
|
||||
#ifndef PROTO_H
|
||||
#define PROTO_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
/* Externs. */
|
||||
#include "nano.h"
|
||||
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
extern ssize_t fill;
|
||||
extern ssize_t wrap_at;
|
||||
#endif
|
||||
extern int editwinrows;
|
||||
extern size_t current_x;
|
||||
extern int current_y;
|
||||
extern int totlines;
|
||||
extern size_t placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
extern size_t mark_beginx;
|
||||
#endif
|
||||
extern size_t totsize;
|
||||
extern unsigned long flags;
|
||||
extern long flags;
|
||||
extern ssize_t tabsize;
|
||||
extern int currslen;
|
||||
|
||||
@@ -68,10 +58,7 @@ extern char *backup_dir;
|
||||
#endif
|
||||
|
||||
extern WINDOW *topwin, *edit, *bottomwin;
|
||||
extern char *filename;
|
||||
extern struct stat originalfilestat;
|
||||
extern char *answer;
|
||||
extern char *hblank;
|
||||
#ifndef DISABLE_HELP
|
||||
extern char *help_text;
|
||||
#endif
|
||||
@@ -86,22 +73,15 @@ extern char *alt_speller;
|
||||
#endif
|
||||
|
||||
extern struct stat fileinfo;
|
||||
extern filestruct *current, *fileage, *edittop, *filebot;
|
||||
extern filestruct *cutbuffer;
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
extern filestruct *jusbuffer;
|
||||
#endif
|
||||
extern partition *filepart;
|
||||
#ifndef NANO_SMALL
|
||||
extern filestruct *mark_beginbuf;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
extern openfilestruct *open_files;
|
||||
#endif
|
||||
extern openfilestruct *openfile;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
extern const colortype *colorstrings;
|
||||
extern syntaxtype *syntaxes;
|
||||
extern char *syntaxstr;
|
||||
#endif
|
||||
@@ -140,46 +120,47 @@ 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;
|
||||
|
||||
extern char *homedir;
|
||||
|
||||
/* 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(ENABLE_UTF8)
|
||||
bool niswblank(wchar_t wc);
|
||||
#endif
|
||||
bool is_byte(int c);
|
||||
bool is_alnum_char(int c);
|
||||
bool is_alnum_mbchar(const char *c);
|
||||
#ifdef NANO_WIDE
|
||||
bool is_alnum_wchar(wchar_t wc);
|
||||
#endif
|
||||
bool is_blank_char(int c);
|
||||
bool is_blank_mbchar(const char *c);
|
||||
#ifdef NANO_WIDE
|
||||
bool is_blank_wchar(wchar_t wc);
|
||||
#endif
|
||||
bool is_cntrl_char(int c);
|
||||
bool is_cntrl_mbchar(const char *c);
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef ENABLE_UTF8
|
||||
bool is_cntrl_wchar(wchar_t wc);
|
||||
#endif
|
||||
unsigned char control_rep(unsigned char c);
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len);
|
||||
#ifdef NANO_WIDE
|
||||
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 ENABLE_UTF8
|
||||
wchar_t control_wrep(wchar_t c);
|
||||
#endif
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len);
|
||||
char *mbrep(const char *c, char *crep, int *crep_len);
|
||||
int mbwidth(const char *c);
|
||||
int mb_cur_max(void);
|
||||
char *make_mbchar(int chr, int *chr_mb_len);
|
||||
#if defined(ENABLE_NANORC) || defined(ENABLE_EXTRA)
|
||||
char *make_mbstring(const char *str);
|
||||
#endif
|
||||
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
|
||||
*col);
|
||||
char *make_mbchar(long chr, int *chr_mb_len);
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col);
|
||||
size_t move_mbleft(const char *buf, size_t pos);
|
||||
size_t move_mbright(const char *buf, size_t pos);
|
||||
#ifndef HAVE_STRCASECMP
|
||||
@@ -194,9 +175,11 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n);
|
||||
const char *nstrcasestr(const char *haystack, const char *needle);
|
||||
#endif
|
||||
const char *mbstrcasestr(const char *haystack, const char *needle);
|
||||
#ifndef NANO_SMALL
|
||||
#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,
|
||||
@@ -209,13 +192,23 @@ size_t nstrnlen(const char *s, size_t maxlen);
|
||||
size_t mbstrnlen(const char *s, size_t maxlen);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
char *mbstrchr(const char *s, char *c);
|
||||
#ifdef ENABLE_NANORC
|
||||
bool has_blank_chars(const char *s);
|
||||
bool has_blank_mbchars(const char *s);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENABLE_UTF8
|
||||
bool is_valid_unicode(wchar_t wc);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
bool is_valid_mbstring(const char *s);
|
||||
#endif
|
||||
|
||||
/* Public functions in color.c. */
|
||||
#ifdef ENABLE_COLOR
|
||||
void set_colorpairs(void);
|
||||
void do_colorinit(void);
|
||||
void update_color(void);
|
||||
void color_init(void);
|
||||
void color_update(void);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
/* Public functions in cut.c. */
|
||||
@@ -232,17 +225,22 @@ void do_cut_till_end(void);
|
||||
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);
|
||||
void load_file(void);
|
||||
void make_new_buffer(void);
|
||||
void initialize_buffer(void);
|
||||
void initialize_buffer_text(void);
|
||||
void open_buffer(const char *filename);
|
||||
void display_buffer(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void switch_to_prevnext_buffer(bool next);
|
||||
void switch_to_prev_buffer_void(void);
|
||||
void switch_to_next_buffer_void(void);
|
||||
bool close_buffer(void);
|
||||
#endif
|
||||
filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
*first_line_ins, size_t buf_len);
|
||||
void read_file(FILE *f, const char *filename);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
char *get_next_filename(const char *name);
|
||||
#ifndef NANO_SMALL
|
||||
void execute_command(const char *command);
|
||||
#endif
|
||||
void load_buffer(const char *name);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
void do_insertfile(
|
||||
#ifndef NANO_SMALL
|
||||
bool execute
|
||||
@@ -251,29 +249,9 @@ void do_insertfile(
|
||||
#endif
|
||||
);
|
||||
void do_insertfile_void(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
openfilestruct *make_new_opennode(void);
|
||||
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
|
||||
openfilestruct *end);
|
||||
void unlink_opennode(openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
#ifdef DEBUG
|
||||
void free_openfilestruct(openfilestruct *src);
|
||||
#endif
|
||||
void add_open_file(bool update);
|
||||
void load_open_file(void);
|
||||
void open_prevnext_file(bool next);
|
||||
void open_prevfile_void(void);
|
||||
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(void);
|
||||
#endif
|
||||
char *safe_tempfile(FILE **f);
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
void init_operating_dir(void);
|
||||
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
||||
@@ -282,16 +260,18 @@ bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
||||
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, append_type
|
||||
append, bool nonamechange);
|
||||
#ifndef NANO_SMALL
|
||||
int write_marked(const char *name, bool tmp, int append);
|
||||
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
append_type append);
|
||||
#endif
|
||||
int do_writeout(bool exiting);
|
||||
void do_writeout_void(void);
|
||||
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
|
||||
char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||
@@ -302,7 +282,6 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
|
||||
#endif
|
||||
const char *tail(const char *foo);
|
||||
#ifndef DISABLE_BROWSER
|
||||
void free_charptrarray(char **array, size_t len);
|
||||
void striponedir(char *path);
|
||||
char **browser_init(const char *path, int *longest, size_t *numents, DIR
|
||||
*dir);
|
||||
@@ -312,7 +291,7 @@ char *do_browse_from(const char *inpath);
|
||||
#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
|
||||
|
||||
@@ -321,9 +300,6 @@ 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
|
||||
@@ -340,32 +316,28 @@ void thanks_for_all_the_fish(void);
|
||||
/* Public functions in move.c. */
|
||||
void do_first_line(void);
|
||||
void do_last_line(void);
|
||||
void do_home(void);
|
||||
void do_end(void);
|
||||
void do_page_up(void);
|
||||
void do_page_down(void);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
void do_para_begin(bool allow_update);
|
||||
void do_para_begin_void(void);
|
||||
void do_para_end(bool allow_update);
|
||||
void do_para_end_void(void);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
bool do_next_word(bool allow_punct, bool allow_update);
|
||||
void do_next_word_void(void);
|
||||
bool do_prev_word(bool allow_punct, bool allow_update);
|
||||
void do_prev_word_void(void);
|
||||
#endif
|
||||
void do_home(void);
|
||||
void do_end(void);
|
||||
void do_up(void);
|
||||
void do_down(void);
|
||||
void do_left(bool allow_update);
|
||||
void do_left_void(void);
|
||||
void do_right(bool allow_update);
|
||||
void do_right_void(void);
|
||||
void do_left(void);
|
||||
void do_right(void);
|
||||
|
||||
/* Public functions in nano.c. */
|
||||
void print_view_warning(void);
|
||||
void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename);
|
||||
void check_die_too_small(void);
|
||||
void resize_variables(void);
|
||||
void global_init(bool save_cutbuffer);
|
||||
void window_init(void);
|
||||
#ifndef DISABLE_MOUSE
|
||||
void mouse_init(void);
|
||||
#endif
|
||||
#ifndef DISABLE_HELP
|
||||
void help_init(void);
|
||||
#endif
|
||||
filestruct *make_new_node(filestruct *prevnode);
|
||||
filestruct *copy_node(const filestruct *src);
|
||||
void splice_node(filestruct *begin, filestruct *newnode, filestruct
|
||||
@@ -374,14 +346,32 @@ void unlink_node(const filestruct *fileptr);
|
||||
void delete_node(filestruct *fileptr);
|
||||
filestruct *copy_filestruct(const filestruct *src);
|
||||
void free_filestruct(filestruct *src);
|
||||
void renumber(filestruct *fileptr);
|
||||
partition *partition_filestruct(filestruct *top, size_t top_x,
|
||||
filestruct *bot, size_t bot_x);
|
||||
void unpartition_filestruct(partition **p);
|
||||
void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
|
||||
void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
|
||||
void renumber_all(void);
|
||||
void renumber(filestruct *fileptr);
|
||||
openfilestruct *make_new_opennode(void);
|
||||
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
|
||||
openfilestruct *end);
|
||||
void unlink_opennode(openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
#ifdef DEBUG
|
||||
void free_openfilestruct(openfilestruct *src);
|
||||
#endif
|
||||
void print_view_warning(void);
|
||||
void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename);
|
||||
void window_init(void);
|
||||
#ifndef DISABLE_MOUSE
|
||||
void mouse_init(void);
|
||||
#endif
|
||||
#ifndef DISABLE_HELP
|
||||
void help_init(void);
|
||||
#endif
|
||||
void print1opt_full(const char *shortflag
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
, const char *longflag
|
||||
@@ -392,56 +382,7 @@ void version(void);
|
||||
int no_more_space(void);
|
||||
int no_help(void);
|
||||
void nano_disabled_msg(void);
|
||||
#ifndef NANO_SMALL
|
||||
void cancel_fork(int signal);
|
||||
bool open_pipe(const char *command);
|
||||
#endif
|
||||
void do_verbatim_input(void);
|
||||
void do_backspace(void);
|
||||
void do_delete(void);
|
||||
void do_tab(void);
|
||||
void do_enter(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_next_word(void);
|
||||
void do_prev_word(void);
|
||||
void do_mark(void);
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
void wrap_reset(void);
|
||||
bool do_wrap(filestruct *line);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool do_int_spell_fix(const char *word);
|
||||
const char *do_int_speller(const char *tempfile_name);
|
||||
const char *do_alt_speller(char *tempfile_name);
|
||||
void do_spell(void);
|
||||
#endif
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
|
||||
ssize_t break_line(const char *line, ssize_t goal, bool newline);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
|
||||
size_t indent_length(const char *line);
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
void justify_format(filestruct *paragraph, size_t skip);
|
||||
size_t quote_length(const char *line);
|
||||
bool quotes_match(const char *a_line, size_t a_quote, const char
|
||||
*b_line);
|
||||
bool indents_match(const char *a_line, size_t a_indent, const char
|
||||
*b_line, size_t b_indent);
|
||||
bool begpar(const filestruct *const foo);
|
||||
void do_para_begin(bool allow_update);
|
||||
void do_para_begin_void(void);
|
||||
bool inpar(const filestruct *const foo);
|
||||
void do_para_end(bool allow_update);
|
||||
void do_para_end_void(void);
|
||||
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
|
||||
quote_len);
|
||||
bool find_paragraph(size_t *const quote, size_t *const par);
|
||||
void do_justify(bool full_justify);
|
||||
void do_justify_void(void);
|
||||
void do_full_justify(void);
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
void do_exit(void);
|
||||
void signal_init(void);
|
||||
void handle_hupterm(int signal);
|
||||
@@ -454,7 +395,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);
|
||||
@@ -475,11 +416,11 @@ void rcfile_error(const char *msg, ...);
|
||||
char *parse_next_word(char *ptr);
|
||||
char *parse_argument(char *ptr);
|
||||
#ifdef ENABLE_COLOR
|
||||
int color_to_int(const char *colorname, bool *bright);
|
||||
short color_to_short(const char *colorname, bool *bright);
|
||||
char *parse_next_regex(char *ptr);
|
||||
bool nregcomp(regex_t *preg, const char *regex, int eflags);
|
||||
bool nregcomp(const char *regex, int eflags);
|
||||
void parse_syntax(char *ptr);
|
||||
void parse_colors(char *ptr);
|
||||
void parse_colors(char *ptr, bool icase);
|
||||
#endif /* ENABLE_COLOR */
|
||||
void parse_rcfile(FILE *rcstream);
|
||||
void do_rcfile(void);
|
||||
@@ -494,9 +435,8 @@ 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(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
|
||||
no_sameline, const filestruct *begin, size_t begin_x, const char
|
||||
*needle, size_t *needle_len);
|
||||
void findnextstr_wrap_reset(void);
|
||||
void do_search(void);
|
||||
@@ -505,45 +445,93 @@ 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);
|
||||
#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_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
bool interactive, bool save_pos, bool allow_update);
|
||||
void do_gotolinecolumn_void(void);
|
||||
#ifndef DISABLE_SPELLER
|
||||
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
|
||||
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);
|
||||
#ifdef HAVE_REGEX_H
|
||||
void do_find_bracket(void);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
bool history_has_changed(void);
|
||||
#endif
|
||||
void history_init(void);
|
||||
void history_reset(const filestruct *h);
|
||||
filestruct *find_history(const filestruct *h_start, const filestruct
|
||||
*h_end, const char *s, size_t len);
|
||||
void update_history(filestruct **h, const char *s);
|
||||
char *get_history_older(filestruct **h);
|
||||
char *get_history_newer(filestruct **h);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
char *get_history_completion(filestruct **h, const char *s, size_t len);
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* Public functions in text.c. */
|
||||
#ifndef NANO_SMALL
|
||||
void do_mark(void);
|
||||
#endif
|
||||
void do_delete(void);
|
||||
void do_backspace(void);
|
||||
void do_tab(void);
|
||||
void do_enter(void);
|
||||
#ifndef NANO_SMALL
|
||||
void cancel_command(int signal);
|
||||
bool execute_command(const char *command);
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
void wrap_reset(void);
|
||||
bool do_wrap(filestruct *line);
|
||||
#endif
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
|
||||
ssize_t break_line(const char *line, ssize_t goal, bool newline);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
|
||||
size_t indent_length(const char *line);
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
void justify_format(filestruct *paragraph, size_t skip);
|
||||
size_t quote_length(const char *line);
|
||||
bool quotes_match(const char *a_line, size_t a_quote, const char
|
||||
*b_line);
|
||||
bool indents_match(const char *a_line, size_t a_indent, const char
|
||||
*b_line, size_t b_indent);
|
||||
bool begpar(const filestruct *const foo);
|
||||
bool inpar(const filestruct *const foo);
|
||||
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
|
||||
quote_len);
|
||||
bool find_paragraph(size_t *const quote, size_t *const par);
|
||||
void do_justify(bool full_justify);
|
||||
void do_justify_void(void);
|
||||
void do_full_justify(void);
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool do_int_spell_fix(const char *word);
|
||||
const char *do_int_speller(const char *tempfile_name);
|
||||
const char *do_alt_speller(char *tempfile_name);
|
||||
void do_spell(void);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
void do_wordlinechar_count(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in utils.c. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags);
|
||||
#endif
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string);
|
||||
#endif
|
||||
int 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);
|
||||
@@ -555,6 +543,14 @@ ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
|
||||
ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
|
||||
#endif
|
||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags);
|
||||
#endif
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string);
|
||||
#endif
|
||||
bool is_whole_word(size_t pos, const char *buf, const char *word);
|
||||
const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *start);
|
||||
void nperror(const char *s);
|
||||
@@ -569,15 +565,14 @@ void remove_magicline(void);
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
#endif
|
||||
void get_totals(const filestruct *begin, const filestruct *end, int
|
||||
*lines, size_t *size);
|
||||
size_t get_totsize(const filestruct *begin, const filestruct *end);
|
||||
|
||||
/* 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 get_key_buffer(WINDOW *win);
|
||||
size_t get_key_buffer_len(void);
|
||||
void unget_input(int *input, size_t input_len);
|
||||
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
|
||||
int *get_input(WINDOW *win, size_t input_len);
|
||||
@@ -595,7 +590,7 @@ int get_byte_kbinput(int kbinput
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
int get_word_kbinput(int kbinput
|
||||
long get_unicode_kbinput(int kbinput
|
||||
#ifndef NANO_SMALL
|
||||
, bool reset
|
||||
#endif
|
||||
@@ -617,6 +612,8 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
#ifndef DISABLE_MOUSE
|
||||
bool do_statusbar_mouse(void);
|
||||
#endif
|
||||
void do_statusbar_output(char *output, size_t output_len, bool
|
||||
*got_enter, bool allow_cntrls);
|
||||
void do_statusbar_home(void);
|
||||
void do_statusbar_end(void);
|
||||
void do_statusbar_right(void);
|
||||
@@ -625,16 +622,15 @@ void do_statusbar_backspace(void);
|
||||
void do_statusbar_delete(void);
|
||||
void do_statusbar_cut_text(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_statusbar_next_word(void);
|
||||
void do_statusbar_prev_word(void);
|
||||
bool do_statusbar_next_word(bool allow_punct);
|
||||
bool do_statusbar_prev_word(bool allow_punct);
|
||||
#endif
|
||||
void do_statusbar_verbatim_input(bool *got_enter);
|
||||
void do_statusbar_output(char *output, size_t output_len, bool
|
||||
*got_enter, bool allow_cntrls);
|
||||
size_t xplustabs(void);
|
||||
size_t actual_x(const char *str, size_t xplus);
|
||||
size_t strnlenpt(const char *buf, size_t size);
|
||||
size_t strlenpt(const char *buf);
|
||||
void blank_line(WINDOW *win, int y, int x, int n);
|
||||
void blank_titlebar(void);
|
||||
void blank_topbar(void);
|
||||
void blank_edit(void);
|
||||
@@ -644,42 +640,39 @@ 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
|
||||
yval, size_t start);
|
||||
void update_line(const filestruct *fileptr, size_t index);
|
||||
int need_horizontal_update(size_t old_pww);
|
||||
int need_vertical_update(size_t old_pww);
|
||||
void edit_scroll(updown direction, int nlines);
|
||||
bool need_horizontal_update(size_t old_pww);
|
||||
bool need_vertical_update(size_t old_pww);
|
||||
void edit_scroll(scroll_dir direction, ssize_t nlines);
|
||||
void edit_redraw(const filestruct *old_current, size_t old_pww);
|
||||
void edit_refresh(void);
|
||||
void edit_update(topmidnone location);
|
||||
void edit_update(update_type location);
|
||||
int do_yesno(bool all, const char *msg);
|
||||
void total_update(void);
|
||||
void total_redraw(void);
|
||||
void total_refresh(void);
|
||||
void display_main_list(void);
|
||||
void do_cursorpos(bool constant);
|
||||
@@ -688,11 +681,16 @@ void do_cursorpos_void(void);
|
||||
size_t help_line_len(const char *ptr);
|
||||
void do_help(void);
|
||||
#endif
|
||||
void do_replace_highlight(bool 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);
|
||||
void dump_filestruct(const filestruct *inptr);
|
||||
void dump_filestruct_reverse(void);
|
||||
#endif
|
||||
#ifdef NANO_EXTRA
|
||||
void do_credits(void);
|
||||
#endif
|
||||
|
||||
#endif /* !PROTO_H */
|
||||
|
||||
240
src/rcfile.c
240
src/rcfile.c
@@ -8,14 +8,15 @@
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -23,38 +24,24 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#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
|
||||
@@ -62,9 +49,6 @@ const static rcoption rcopts[] = {
|
||||
{"multibuffer", MULTIBUFFER},
|
||||
#endif
|
||||
{"morespace", MORE_SPACE},
|
||||
#ifndef NANO_SMALL
|
||||
{"noconvert", NO_CONVERT},
|
||||
#endif
|
||||
{"nofollow", NOFOLLOW_SYMLINKS},
|
||||
{"nohelp", NO_HELP},
|
||||
#ifndef DISABLE_WRAPPING
|
||||
@@ -79,13 +63,10 @@ const static rcoption rcopts[] = {
|
||||
{"quotestr", 0},
|
||||
#endif
|
||||
{"rebinddelete", REBIND_DELETE},
|
||||
{"rebindkeypad", REBIND_KEYPAD},
|
||||
#ifdef HAVE_REGEX_H
|
||||
{"regexp", USE_REGEXP},
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
{"smarthome", SMART_HOME},
|
||||
{"smooth", SMOOTHSCROLL},
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
{"speller", 0},
|
||||
#endif
|
||||
@@ -94,13 +75,26 @@ 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},
|
||||
{"wordbounds", WORD_BOUNDS},
|
||||
#endif
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
static bool errors = FALSE;
|
||||
static int lineno = 0;
|
||||
static size_t lineno = 0;
|
||||
static char *nanorc = NULL;
|
||||
#ifdef ENABLE_COLOR
|
||||
static syntaxtype *endsyntax = NULL;
|
||||
@@ -110,7 +104,7 @@ static colortype *endcolor = NULL;
|
||||
#endif
|
||||
|
||||
/* We have an error in some part of the rcfile. Put it on stderr and
|
||||
* make the user hit return to continue starting up nano. */
|
||||
* make the user hit Return to continue starting up nano. */
|
||||
void rcfile_error(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -118,7 +112,7 @@ 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);
|
||||
@@ -132,7 +126,7 @@ void rcfile_error(const char *msg, ...)
|
||||
* the end of the line. */
|
||||
char *parse_next_word(char *ptr)
|
||||
{
|
||||
while (!is_blank_char(*ptr) && *ptr != '\0')
|
||||
while (!isblank(*ptr) && *ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\0')
|
||||
@@ -141,7 +135,7 @@ char *parse_next_word(char *ptr)
|
||||
/* Null-terminate and advance ptr. */
|
||||
*ptr++ = '\0';
|
||||
|
||||
while (is_blank_char(*ptr))
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
|
||||
return ptr;
|
||||
@@ -181,22 +175,17 @@ char *parse_argument(char *ptr)
|
||||
ptr = last_quote + 1;
|
||||
}
|
||||
if (ptr != NULL)
|
||||
while (is_blank_char(*ptr))
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
int color_to_int(const char *colorname, bool *bright)
|
||||
short color_to_short(const char *colorname, bool *bright)
|
||||
{
|
||||
int mcolor = -1;
|
||||
short mcolor = -1;
|
||||
|
||||
if (colorname == NULL) {
|
||||
rcfile_error(N_("Missing color name"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
assert(bright != NULL);
|
||||
assert(colorname != NULL && bright != NULL);
|
||||
|
||||
if (strncasecmp(colorname, "bright", 6) == 0) {
|
||||
*bright = TRUE;
|
||||
@@ -235,7 +224,7 @@ char *parse_next_regex(char *ptr)
|
||||
|
||||
/* Continue until the end of the line, or a " followed by a space, a
|
||||
* blank character, or \0. */
|
||||
while ((*ptr != '"' || (!is_blank_char(*(ptr + 1)) &&
|
||||
while ((*ptr != '"' || (!isblank(*(ptr + 1)) &&
|
||||
*(ptr + 1) != '\0')) && *ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
@@ -250,33 +239,37 @@ char *parse_next_regex(char *ptr)
|
||||
/* Null terminate and advance ptr. */
|
||||
*ptr++ = '\0';
|
||||
|
||||
while (is_blank_char(*ptr))
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* Compile the regular expression regex to preg. Return FALSE on
|
||||
* success, or TRUE if the expression is invalid. */
|
||||
bool nregcomp(regex_t *preg, const char *regex, int eflags)
|
||||
/* Compile the regular expression regex to see if it's valid. Return
|
||||
* TRUE if it is, or FALSE otherwise. */
|
||||
bool nregcomp(const char *regex, int eflags)
|
||||
{
|
||||
int rc = regcomp(preg, regex, REG_EXTENDED | eflags);
|
||||
regex_t preg;
|
||||
int rc = regcomp(&preg, regex, REG_EXTENDED | eflags);
|
||||
|
||||
if (rc != 0) {
|
||||
size_t len = regerror(rc, preg, NULL, 0);
|
||||
size_t len = regerror(rc, &preg, NULL, 0);
|
||||
char *str = charalloc(len);
|
||||
|
||||
regerror(rc, preg, str, len);
|
||||
regerror(rc, &preg, str, len);
|
||||
rcfile_error(N_("Bad regex \"%s\": %s"), regex, str);
|
||||
free(str);
|
||||
}
|
||||
|
||||
return (rc != 0);
|
||||
regfree(&preg);
|
||||
|
||||
return (rc == 0);
|
||||
}
|
||||
|
||||
void parse_syntax(char *ptr)
|
||||
{
|
||||
const char *fileregptr = NULL, *nameptr = NULL;
|
||||
const syntaxtype *tmpsyntax;
|
||||
exttype *endext = NULL;
|
||||
/* The end of the extensions list for this syntax. */
|
||||
|
||||
@@ -301,6 +294,14 @@ void parse_syntax(char *ptr)
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcmp(nameptr, tmpsyntax->desc) == 0) {
|
||||
rcfile_error(N_("Duplicate syntax name %s"), nameptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
syntaxes = (syntaxtype *)nmalloc(sizeof(syntaxtype));
|
||||
endsyntax = syntaxes;
|
||||
@@ -311,15 +312,31 @@ void parse_syntax(char *ptr)
|
||||
fprintf(stderr, "Adding new syntax after first one\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
endsyntax->desc = mallocstrcpy(NULL, nameptr);
|
||||
endsyntax->color = NULL;
|
||||
endcolor = NULL;
|
||||
endsyntax->extensions = NULL;
|
||||
endsyntax->next = NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
|
||||
#endif
|
||||
|
||||
/* The "none" syntax is the same as not having a syntax at all, so
|
||||
* we can't assign any extensions or colors to it. */
|
||||
if (strcmp(endsyntax->desc, "none") == 0) {
|
||||
rcfile_error(N_("The \"none\" syntax is reserved"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* The default syntax should have no associated extensions. */
|
||||
if (strcmp(endsyntax->desc, "default") == 0 && *ptr != '\0') {
|
||||
rcfile_error(
|
||||
N_("The \"default\" syntax must take no extensions"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Now load the extensions into their part of the struct. */
|
||||
while (*ptr != '\0') {
|
||||
exttype *newext;
|
||||
@@ -339,24 +356,29 @@ void parse_syntax(char *ptr)
|
||||
break;
|
||||
|
||||
newext = (exttype *)nmalloc(sizeof(exttype));
|
||||
if (nregcomp(&newext->val, fileregptr, REG_NOSUB))
|
||||
free(newext);
|
||||
else {
|
||||
|
||||
/* Save the extension regex if it's valid. */
|
||||
if (nregcomp(fileregptr, REG_NOSUB)) {
|
||||
newext->ext_regex = mallocstrcpy(NULL, fileregptr);
|
||||
newext->ext = NULL;
|
||||
|
||||
if (endext == NULL)
|
||||
endsyntax->extensions = newext;
|
||||
else
|
||||
endext->next = newext;
|
||||
endext = newext;
|
||||
endext->next = NULL;
|
||||
}
|
||||
} else
|
||||
free(newext);
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the color stuff into the colorstrings array. */
|
||||
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;
|
||||
bool bright = FALSE;
|
||||
short fg, bg;
|
||||
bool bright = FALSE, no_fgcolor = FALSE;
|
||||
char *fgstr;
|
||||
|
||||
assert(ptr != NULL);
|
||||
@@ -371,23 +393,33 @@ void parse_colors(char *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);
|
||||
return;
|
||||
}
|
||||
bg = color_to_int(bgcolorname, &bright);
|
||||
bg = color_to_short(bgcolorname, &bright);
|
||||
} else
|
||||
bg = -1;
|
||||
|
||||
fg = color_to_int(fgstr, &bright);
|
||||
if (!no_fgcolor) {
|
||||
fg = color_to_short(fgstr, &bright);
|
||||
|
||||
/* Don't try to parse screwed-up foreground 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(
|
||||
@@ -395,9 +427,13 @@ void parse_colors(char *ptr)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Now for the fun part. Start adding regexps to individual strings
|
||||
* in the colorstrings array, woo! */
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing regex string"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
@@ -420,34 +456,45 @@ void parse_colors(char *ptr)
|
||||
|
||||
ptr++;
|
||||
|
||||
newcolor = (colortype *)nmalloc(sizeof(colortype));
|
||||
fgstr = ptr;
|
||||
ptr = parse_next_regex(ptr);
|
||||
if (ptr == NULL)
|
||||
break;
|
||||
|
||||
if (nregcomp(&newcolor->start, fgstr, 0)) {
|
||||
free(newcolor);
|
||||
cancelled = TRUE;
|
||||
} else {
|
||||
newcolor = (colortype *)nmalloc(sizeof(colortype));
|
||||
|
||||
/* Save the starting regex string if it's valid, and set up the
|
||||
* color information. */
|
||||
if (nregcomp(fgstr, icase ? REG_ICASE : 0)) {
|
||||
newcolor->fg = fg;
|
||||
newcolor->bg = bg;
|
||||
newcolor->bright = bright;
|
||||
newcolor->next = NULL;
|
||||
newcolor->icase = icase;
|
||||
|
||||
newcolor->start_regex = mallocstrcpy(NULL, fgstr);
|
||||
newcolor->start = NULL;
|
||||
|
||||
newcolor->end_regex = NULL;
|
||||
newcolor->end = NULL;
|
||||
|
||||
newcolor->next = NULL;
|
||||
|
||||
if (endcolor == NULL) {
|
||||
endsyntax->color = newcolor;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting a new colorstring for fg %d, bg %d\n", fg, bg);
|
||||
fprintf(stderr, "Starting a new colorstring for fg %hd, bg %hd\n", fg, bg);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Adding new entry for fg %d, bg %d\n", fg, bg);
|
||||
fprintf(stderr, "Adding new entry for fg %hd, bg %hd\n", fg, bg);
|
||||
#endif
|
||||
endcolor->next = newcolor;
|
||||
}
|
||||
|
||||
endcolor = newcolor;
|
||||
} else {
|
||||
free(newcolor);
|
||||
cancelled = TRUE;
|
||||
}
|
||||
|
||||
if (expectend) {
|
||||
@@ -475,11 +522,9 @@ void parse_colors(char *ptr)
|
||||
if (cancelled)
|
||||
continue;
|
||||
|
||||
newcolor->end = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
if (nregcomp(newcolor->end, fgstr, 0)) {
|
||||
free(newcolor->end);
|
||||
newcolor->end = NULL;
|
||||
}
|
||||
/* Save the ending regex string if it's valid. */
|
||||
newcolor->end_regex = (nregcomp(fgstr, icase ? REG_ICASE :
|
||||
0)) ? mallocstrcpy(NULL, fgstr) : NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -501,7 +546,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
|
||||
lineno++;
|
||||
ptr = buf;
|
||||
while (is_blank_char(*ptr))
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
|
||||
/* If we have a blank line or a comment, skip to the next
|
||||
@@ -522,7 +567,9 @@ void parse_rcfile(FILE *rcstream)
|
||||
else if (strcasecmp(keyword, "syntax") == 0)
|
||||
parse_syntax(ptr);
|
||||
else if (strcasecmp(keyword, "color") == 0)
|
||||
parse_colors(ptr);
|
||||
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);
|
||||
@@ -561,10 +608,20 @@ void parse_rcfile(FILE *rcstream)
|
||||
if (*option == '"')
|
||||
option++;
|
||||
ptr = parse_argument(ptr);
|
||||
option = make_mbstring(option);
|
||||
|
||||
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
|
||||
if (strcasecmp(rcopts[i].name, "operatingdir") == 0)
|
||||
operating_dir = option;
|
||||
@@ -584,7 +641,8 @@ void parse_rcfile(FILE *rcstream)
|
||||
#ifndef NANO_SMALL
|
||||
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
||||
whitespace = option;
|
||||
if (mbstrlen(whitespace) != 2 || strlenpt(whitespace) != 2) {
|
||||
if (mbstrlen(whitespace) != 2 ||
|
||||
strlenpt(whitespace) != 2) {
|
||||
rcfile_error(
|
||||
N_("Two single-column characters required"));
|
||||
free(whitespace);
|
||||
@@ -592,31 +650,28 @@ void parse_rcfile(FILE *rcstream)
|
||||
} else {
|
||||
whitespace_len[0] =
|
||||
parse_mbchar(whitespace, NULL,
|
||||
NULL, NULL);
|
||||
NULL);
|
||||
whitespace_len[1] =
|
||||
parse_mbchar(whitespace +
|
||||
whitespace_len[0], NULL,
|
||||
NULL, NULL);
|
||||
whitespace_len[0], NULL, NULL);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
if (strcasecmp(rcopts[i].name, "punct") == 0) {
|
||||
punct = option;
|
||||
if (strchr(punct, '\t') != NULL ||
|
||||
strchr(punct, ' ') != NULL) {
|
||||
if (has_blank_mbchars(punct)) {
|
||||
rcfile_error(
|
||||
N_("Non-tab and non-space characters required"));
|
||||
N_("Non-blank characters required"));
|
||||
free(punct);
|
||||
punct = NULL;
|
||||
}
|
||||
} else if (strcasecmp(rcopts[i].name,
|
||||
"brackets") == 0) {
|
||||
brackets = option;
|
||||
if (strchr(brackets, '\t') != NULL ||
|
||||
strchr(brackets, ' ') != NULL) {
|
||||
if (has_blank_mbchars(brackets)) {
|
||||
rcfile_error(
|
||||
N_("Non-tab and non-space characters required"));
|
||||
N_("Non-blank characters required"));
|
||||
free(brackets);
|
||||
brackets = NULL;
|
||||
}
|
||||
@@ -670,8 +725,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
|
||||
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')
|
||||
;
|
||||
}
|
||||
|
||||
901
src/search.c
901
src/search.c
File diff suppressed because it is too large
Load Diff
2141
src/text.c
Normal file
2141
src/text.c
Normal file
File diff suppressed because it is too large
Load Diff
257
src/utils.c
257
src/utils.c
@@ -8,14 +8,15 @@
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -23,45 +24,18 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
/* Work around a potential segfault in glibc 2.2.3's regexec(). */
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
if (string != NULL && *string != '\0')
|
||||
return regexec(preg, string, nmatch, pmatch, eflags);
|
||||
|
||||
return REG_NOMATCH;
|
||||
}
|
||||
#endif
|
||||
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string)
|
||||
{
|
||||
return (regexec(preg, string, 0, NULL, 0) == 0 &&
|
||||
regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
|
||||
REG_NOMATCH);
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
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++;
|
||||
@@ -108,13 +82,46 @@ bool parse_num(const char *str, ssize_t *val)
|
||||
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);
|
||||
bool retval = TRUE;
|
||||
const char *comma;
|
||||
|
||||
if (*strp != NULL)
|
||||
*strp = charealloc(*strp, strlen(*strp) + 1);
|
||||
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. */
|
||||
@@ -174,15 +181,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. */
|
||||
@@ -195,8 +202,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. */
|
||||
@@ -210,6 +217,52 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
#endif
|
||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
/* Work around a potential segfault in glibc 2.2.3's regexec(). */
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
if (string != NULL && *string != '\0')
|
||||
return regexec(preg, string, nmatch, pmatch, eflags);
|
||||
|
||||
return REG_NOMATCH;
|
||||
}
|
||||
#endif
|
||||
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string)
|
||||
{
|
||||
return (regexec(preg, string, 0, NULL, 0) == 0 &&
|
||||
regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
|
||||
REG_NOMATCH);
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
/* Is the word starting at position pos in buf a whole word? */
|
||||
bool is_whole_word(size_t pos, const char *buf, const char *word)
|
||||
{
|
||||
char *p = charalloc(mb_cur_max()), *r = charalloc(mb_cur_max());
|
||||
size_t word_end = pos + strlen(word);
|
||||
bool retval;
|
||||
|
||||
assert(buf != NULL && pos <= strlen(buf) && word != NULL);
|
||||
|
||||
parse_mbchar(buf + move_mbleft(buf, pos), p, NULL);
|
||||
parse_mbchar(buf + word_end, r, NULL);
|
||||
|
||||
/* If we're at the beginning of the line or the character before the
|
||||
* word isn't a non-punctuation "word" character, and if we're at
|
||||
* the end of the line or the character after the word isn't a
|
||||
* non-punctuation "word" character, we have a whole word. */
|
||||
retval = (pos == 0 || !is_word_mbchar(p, FALSE)) &&
|
||||
(word_end == strlen(buf) || !is_word_mbchar(r, FALSE));
|
||||
|
||||
free(p);
|
||||
free(r);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* If we are searching backwards, we will find the last match that
|
||||
* starts no later than start. Otherwise we find the first match
|
||||
* starting no earlier than start. If we are doing a regexp search, we
|
||||
@@ -229,16 +282,16 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
#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. */
|
||||
@@ -260,7 +313,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
#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
|
||||
@@ -268,7 +321,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER || !NANO_SMALL */
|
||||
#ifndef NANO_SMALL
|
||||
else if (ISSET(REVERSE_SEARCH))
|
||||
else if (ISSET(BACKWARDS_SEARCH))
|
||||
return mbrevstrcasestr(haystack, needle, start);
|
||||
#endif
|
||||
return mbstrcasestr(start, needle);
|
||||
@@ -329,7 +382,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
|
||||
@@ -344,14 +398,13 @@ char *mallocstrassn(char *dest, char *src)
|
||||
/* Append a new magicline to filebot. */
|
||||
void new_magicline(void)
|
||||
{
|
||||
filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
filebot->next->data = mallocstrcpy(NULL, "");
|
||||
filebot->next->prev = filebot;
|
||||
filebot->next->next = NULL;
|
||||
filebot->next->lineno = filebot->lineno + 1;
|
||||
filebot = filebot->next;
|
||||
totlines++;
|
||||
totsize++;
|
||||
openfile->filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
openfile->filebot->next->data = mallocstrcpy(NULL, "");
|
||||
openfile->filebot->next->prev = openfile->filebot;
|
||||
openfile->filebot->next->next = NULL;
|
||||
openfile->filebot->next->lineno = openfile->filebot->lineno + 1;
|
||||
openfile->filebot = openfile->filebot->next;
|
||||
openfile->totsize++;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -359,85 +412,71 @@ void new_magicline(void)
|
||||
* only line in the file. */
|
||||
void remove_magicline(void)
|
||||
{
|
||||
if (filebot->data[0] == '\0' && filebot->prev != NULL) {
|
||||
filebot = filebot->prev;
|
||||
free_filestruct(filebot->next);
|
||||
filebot->next = NULL;
|
||||
totlines--;
|
||||
totsize--;
|
||||
if (openfile->filebot->data[0] == '\0' &&
|
||||
openfile->filebot->prev != NULL) {
|
||||
openfile->filebot = openfile->filebot->prev;
|
||||
free_filestruct(openfile->filebot->next);
|
||||
openfile->filebot->next = NULL;
|
||||
openfile->totsize--;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set top_x and bot_x to the top and bottom x-coordinates of the mark,
|
||||
* respectively, based on the locations of top and bot. If
|
||||
* right_side_up isn't NULL, set it to TRUE If the mark begins with
|
||||
* (mark_beginbuf, mark_beginx) and ends with (current, current_x), or
|
||||
* (mark_begin, mark_begin_x) and ends with (current, current_x), or
|
||||
* FALSE otherwise. */
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up)
|
||||
{
|
||||
assert(top != NULL && top_x != NULL && bot != NULL && bot_x != NULL);
|
||||
|
||||
if ((current->lineno == mark_beginbuf->lineno && current_x >
|
||||
mark_beginx) || current->lineno > mark_beginbuf->lineno) {
|
||||
*top = mark_beginbuf;
|
||||
*top_x = mark_beginx;
|
||||
*bot = current;
|
||||
*bot_x = current_x;
|
||||
if ((openfile->current->lineno == openfile->mark_begin->lineno &&
|
||||
openfile->current_x > openfile->mark_begin_x) ||
|
||||
openfile->current->lineno > openfile->mark_begin->lineno) {
|
||||
*top = openfile->mark_begin;
|
||||
*top_x = openfile->mark_begin_x;
|
||||
*bot = openfile->current;
|
||||
*bot_x = openfile->current_x;
|
||||
if (right_side_up != NULL)
|
||||
*right_side_up = TRUE;
|
||||
} else {
|
||||
*bot = mark_beginbuf;
|
||||
*bot_x = mark_beginx;
|
||||
*top = current;
|
||||
*top_x = current_x;
|
||||
*bot = openfile->mark_begin;
|
||||
*bot_x = openfile->mark_begin_x;
|
||||
*top = openfile->current;
|
||||
*top_x = openfile->current_x;
|
||||
if (right_side_up != NULL)
|
||||
*right_side_up = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Calculate the number of lines and the number of characters between
|
||||
* begin and end, and return them in lines and size, respectively. */
|
||||
void get_totals(const filestruct *begin, const filestruct *end, int
|
||||
*lines, size_t *size)
|
||||
/* Calculate the number of characters between begin and end, and return
|
||||
* it. */
|
||||
size_t get_totsize(const filestruct *begin, const filestruct *end)
|
||||
{
|
||||
size_t totsize = 0;
|
||||
const filestruct *f;
|
||||
|
||||
if (lines != NULL)
|
||||
*lines = 0;
|
||||
if (size != NULL)
|
||||
*size = 0;
|
||||
|
||||
/* Go through the lines from begin to end->prev, if we can. */
|
||||
for (f = begin; f != NULL && f != end; f = f->next) {
|
||||
/* Count this line. */
|
||||
if (lines != NULL)
|
||||
(*lines)++;
|
||||
|
||||
for (f = begin; f != end && f != NULL; f = f->next) {
|
||||
/* Count the number of characters on this line. */
|
||||
if (size != NULL) {
|
||||
*size += mbstrlen(f->data);
|
||||
totsize += mbstrlen(f->data);
|
||||
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
(*size)++;
|
||||
}
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
totsize++;
|
||||
}
|
||||
|
||||
/* Go through the line at end, if we can. */
|
||||
if (f != NULL) {
|
||||
/* Count this line. */
|
||||
if (lines != NULL)
|
||||
(*lines)++;
|
||||
|
||||
/* Count the number of characters on this line. */
|
||||
if (size != NULL) {
|
||||
*size += mbstrlen(f->data);
|
||||
totsize += mbstrlen(f->data);
|
||||
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
(*size)++;
|
||||
}
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
totsize++;
|
||||
}
|
||||
|
||||
return totsize;
|
||||
}
|
||||
|
||||
1743
src/winio.c
1743
src/winio.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user