Compare commits
985 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 960ff2f3bf | |||
| 75f480ba10 | |||
| 1e08853a8b | |||
| c47c742e88 | |||
| cb1507bdd4 | |||
| e13b24e0ce | |||
|
|
fdcafb83e3 | ||
|
|
b8ead3b511 | ||
|
|
ffff664918 | ||
|
|
bf984ecb9b | ||
|
|
f1e238a9af | ||
|
|
5290a85afd | ||
|
|
b5157dd9cb | ||
|
|
94812d17c8 | ||
|
|
7681090c12 | ||
|
|
866490c41f | ||
|
|
0662fc4d42 | ||
|
|
078d612b9e | ||
|
|
26025f79ce | ||
|
|
1c307bc1be | ||
|
|
7abddbd752 | ||
|
|
51c9f7270c | ||
|
|
b896670e85 | ||
|
|
69dd0c40bb | ||
|
|
c374c773ad | ||
|
|
2fd7888a51 | ||
|
|
d19915ea44 | ||
|
|
549e37d218 | ||
|
|
7b48a9f671 | ||
|
|
344db835e4 | ||
|
|
04353acccf | ||
|
|
c33f0b7d8d | ||
|
|
fd51fee424 | ||
|
|
c8b44816fe | ||
|
|
6e88389fb8 | ||
|
|
298447e22d | ||
|
|
a3c7de8a50 | ||
|
|
264f305d94 | ||
|
|
f8ec08a928 | ||
|
|
f09e6c183e | ||
|
|
3791ed86a3 | ||
|
|
7f772693eb | ||
|
|
5771f1ea14 | ||
|
|
0f4db1ed0d | ||
|
|
4b35626aec | ||
|
|
846588ee81 | ||
|
|
4f92b12a6a | ||
|
|
4b4b20f8a9 | ||
|
|
e26fe9bddd | ||
|
|
972be2df04 | ||
|
|
374cb6a7f8 | ||
|
|
923d6300ad | ||
|
|
baa4edc6ca | ||
|
|
9875311bcc | ||
|
|
c3a453512a | ||
|
|
e413ed8e1d | ||
|
|
858f411447 | ||
|
|
19c8cea8e5 | ||
|
|
1ae10b1487 | ||
|
|
35cde9f8d7 | ||
|
|
d4d2840f5d | ||
|
|
119ec47072 | ||
|
|
ceb305a780 | ||
|
|
1dc2a75cb6 | ||
|
|
8d7b716ea7 | ||
|
|
034af70a65 | ||
|
|
162c213e7b | ||
|
|
6fde7d8a51 | ||
|
|
e4abef5768 | ||
|
|
3922b531a8 | ||
|
|
0d1438a731 | ||
|
|
7eb66d3e09 | ||
|
|
c7a600063d | ||
|
|
5b654ce9fb | ||
|
|
98e9a881c0 | ||
|
|
f420f7c177 | ||
|
|
50954a4b6a | ||
|
|
567310e698 | ||
|
|
f90b710c9b | ||
|
|
bdaec3f934 | ||
|
|
8198fd9c58 | ||
|
|
358a10e3cc | ||
|
|
7b935e0d40 | ||
|
|
7034c3cc47 | ||
|
|
e30eadb4de | ||
|
|
3e3f4a167a | ||
|
|
c98528f8d3 | ||
|
|
75e5f885e5 | ||
|
|
40b9e68e02 | ||
|
|
e7491920fd | ||
|
|
9904aa5538 | ||
|
|
41b89aef8c | ||
|
|
3925c137a4 | ||
|
|
97fa42c82b | ||
|
|
ccabaac5a0 | ||
|
|
80f7852941 | ||
|
|
6243831dfb | ||
|
|
4f9abb52a4 | ||
|
|
7bab8780ad | ||
|
|
d0dc270eec | ||
|
|
cd9402075a | ||
|
|
b1f3bdfcbd | ||
|
|
541a2dbc88 | ||
|
|
d1e28417d5 | ||
|
|
9410a55679 | ||
|
|
25ceefbd89 | ||
|
|
a37c4bb59e | ||
|
|
ee1f8a0494 | ||
|
|
2c5459a1b7 | ||
|
|
b561c386c3 | ||
|
|
a374dd0359 | ||
|
|
aba4f4e0e2 | ||
|
|
210c94d82f | ||
|
|
c410ba4d42 | ||
|
|
f3738fe164 | ||
|
|
04a08fe6a5 | ||
|
|
69d33ec170 | ||
|
|
40a4225ed8 | ||
|
|
801622ce19 | ||
|
|
67750a30ba | ||
|
|
2f25b6a650 | ||
|
|
5a3bd329d6 | ||
|
|
8b4bf2bb8d | ||
|
|
2a515058be | ||
|
|
3785f762fc | ||
|
|
5cee9f183b | ||
|
|
958ec294b2 | ||
|
|
3a781fd719 | ||
|
|
f4a2e7efe2 | ||
|
|
027365503f | ||
|
|
e31d59ebc8 | ||
|
|
11178e14ab | ||
|
|
0bcbd0015f | ||
|
|
271bd5d3ba | ||
|
|
74d252a68f | ||
|
|
4b928b466a | ||
|
|
10b4d0c8ad | ||
|
|
433dd92196 | ||
|
|
78d284881c | ||
|
|
a36b726bde | ||
|
|
83629b9991 | ||
|
|
405c66e864 | ||
|
|
e5df84a9ed | ||
|
|
614a977259 | ||
|
|
f1651abdac | ||
|
|
05a06048fc | ||
|
|
c599bc9bff | ||
|
|
54ded4527a | ||
|
|
4f433cd601 | ||
|
|
accecb9863 | ||
|
|
079588cac5 | ||
|
|
1d10ee71bf | ||
|
|
0520cbdccb | ||
|
|
3d3270c1b2 | ||
|
|
b60a26d40b | ||
|
|
36fcdce886 | ||
|
|
b760388bbf | ||
|
|
bb18524cce | ||
|
|
05eaa0f0d7 | ||
|
|
d4a1dbd4a9 | ||
|
|
0e9bef3429 | ||
|
|
34238dc119 | ||
|
|
18a40caa48 | ||
|
|
1980f1b2ba | ||
|
|
ec0c13afda | ||
|
|
ed41b3cefa | ||
|
|
80a924edfa | ||
|
|
98f9518bf2 | ||
|
|
1de47610f4 | ||
|
|
25ba7712f7 | ||
|
|
a6b534d760 | ||
|
|
494b191d55 | ||
|
|
450bfa7a75 | ||
|
|
a52ac1375a | ||
|
|
4990713e9e | ||
|
|
c022c4cc6d | ||
|
|
6257dec0a7 | ||
|
|
ea9d49b9d8 | ||
|
|
42c7bfcf8a | ||
|
|
e67d1bfeb8 | ||
|
|
e2f444cfdf | ||
|
|
03b85df4eb | ||
|
|
7db5c2f225 | ||
|
|
603ce231d0 | ||
|
|
940b5eaad1 | ||
|
|
fdd946c02c | ||
|
|
81e5b57d74 | ||
|
|
b568705eec | ||
|
|
fe42eb7a1a | ||
|
|
df7b0a6d97 | ||
|
|
fcf598e797 | ||
|
|
d9cb12f6e3 | ||
|
|
0f23729253 | ||
|
|
3def429290 | ||
|
|
803ea0d7a0 | ||
|
|
9b014876cd | ||
|
|
9ccf85eaa8 | ||
|
|
93fa53c3e8 | ||
|
|
eea3e1f0b2 | ||
|
|
e6e22ea976 | ||
|
|
80c2000f87 | ||
|
|
15a0a129c8 | ||
|
|
51bd04b541 | ||
|
|
18ba7f60c1 | ||
|
|
5c3e00d70a | ||
|
|
6c4c77971e | ||
|
|
67adef8f6c | ||
|
|
ed60e16974 | ||
|
|
47c11ae83d | ||
|
|
8173b1bfbe | ||
|
|
93400ec8a1 | ||
|
|
0d85a798e5 | ||
|
|
d4d534925f | ||
|
|
a1ba7ee786 | ||
|
|
756cd4a4b8 | ||
|
|
1b186fcff3 | ||
|
|
165da9b447 | ||
|
|
aea10ed383 | ||
|
|
8fccb31436 | ||
|
|
89bb88e4f5 | ||
|
|
a58efa70bc | ||
|
|
fe1fecc5da | ||
|
|
87612582ff | ||
|
|
c3a53cffbc | ||
|
|
aeea83703b | ||
|
|
27c8f13fc9 | ||
|
|
c6ddae70f7 | ||
|
|
e4ecd03e3f | ||
|
|
a6dc5c963c | ||
|
|
989e6a9a7e | ||
|
|
c28048d20f | ||
|
|
a24e72f972 | ||
|
|
a29aa31e93 | ||
|
|
8546139997 | ||
|
|
a61586947e | ||
|
|
5e4645b082 | ||
|
|
f9f0a8fd67 | ||
|
|
637a2eeb66 | ||
|
|
13caef2de0 | ||
|
|
61c6d43231 | ||
|
|
a04f6e0165 | ||
|
|
3f494e359d | ||
|
|
8a06f70379 | ||
|
|
2290152743 | ||
|
|
3b657a26a6 | ||
|
|
ff5084479b | ||
|
|
97f4a3f4eb | ||
|
|
1ca1732d32 | ||
|
|
accd2308f1 | ||
|
|
10eec2fe17 | ||
|
|
d69cd759cb | ||
|
|
f261a8aca5 | ||
|
|
bdf64d660b | ||
|
|
2fd30ee095 | ||
|
|
9bc6f1797e | ||
|
|
32e63fe1b8 | ||
|
|
1c074cc8cc | ||
|
|
ebf6228f21 | ||
|
|
4a1db96db8 | ||
|
|
16ee4636bc | ||
|
|
6831b37b43 | ||
|
|
4d16f26ba4 | ||
|
|
4a7bc73e03 | ||
|
|
caf583ec4b | ||
|
|
e20880da21 | ||
|
|
19ff9a507b | ||
|
|
33ba6be91f | ||
|
|
9c1c6c18ae | ||
|
|
fae5f823e1 | ||
|
|
bdf8e41a72 | ||
|
|
c00c12b64b | ||
|
|
02d77ad5ad | ||
|
|
7ab903f072 | ||
|
|
266ed0612f | ||
|
|
27af34a853 | ||
|
|
abafc2ba14 | ||
|
|
1f0eb8d915 | ||
|
|
48a19178b8 | ||
|
|
e542e5943e | ||
|
|
44836e77be | ||
|
|
5cec57719b | ||
|
|
d6f101daef | ||
|
|
350cdd9827 | ||
|
|
5dc48d54f2 | ||
|
|
41975265bf | ||
|
|
598f13107d | ||
|
|
248ebf9117 | ||
|
|
1c6f6ba212 | ||
|
|
58cba6a7c6 | ||
|
|
b55474788b | ||
|
|
5c8de3e39f | ||
|
|
8aaa57a573 | ||
|
|
19e743c7e4 | ||
|
|
56aacb3e32 | ||
|
|
f2c9aed16c | ||
|
|
7c6d3942c4 | ||
|
|
27aff84f74 | ||
|
|
a43ee17ad0 | ||
|
|
abd4c47acf | ||
|
|
b87722ab2d | ||
|
|
b5448615b9 | ||
|
|
d14d9069cd | ||
|
|
93df6ab385 | ||
|
|
be87f110ce | ||
|
|
9ebee362a5 | ||
|
|
27928e47be | ||
|
|
79def643a3 | ||
|
|
9a8d9ef496 | ||
|
|
7336c28ca8 | ||
|
|
6a521da437 | ||
|
|
6d828cf470 | ||
|
|
511a2850a1 | ||
|
|
be61aad935 | ||
|
|
c06f7d43e9 | ||
|
|
3638fb9da4 | ||
|
|
2fc1f08573 | ||
|
|
90946c5e9e | ||
|
|
9a778f9a00 | ||
|
|
8d6b468cdc | ||
|
|
0941185fcf | ||
|
|
8850015822 | ||
|
|
3be4ea0dc1 | ||
|
|
3eda0135bc | ||
|
|
9c9de85afb | ||
|
|
addac49465 | ||
|
|
839d29be3f | ||
|
|
b2f0721b69 | ||
|
|
b228c9fe6c | ||
|
|
8e7738e22e | ||
|
|
84f8445b7b | ||
|
|
5cf412320d | ||
|
|
c9fb1cf85a | ||
|
|
bbed065fa8 | ||
|
|
dde74dee78 | ||
|
|
966da68228 | ||
|
|
f147131e7c | ||
|
|
7785c3f7cf | ||
|
|
9d3d354bd4 | ||
|
|
51a5f33b5b | ||
|
|
8aea8625be | ||
|
|
931bf96c1d | ||
|
|
956a1c2327 | ||
|
|
4f15890105 | ||
|
|
0afe38d81a | ||
|
|
3dfd798d51 | ||
|
|
1235a5a365 | ||
|
|
c772e1cb6b | ||
|
|
e35b6636ab | ||
|
|
bd4eed9cb1 | ||
|
|
2b0bcc7cee | ||
|
|
3b5f650621 | ||
|
|
b66a040828 | ||
|
|
f757c4a512 | ||
|
|
06ad77895f | ||
|
|
2cbd4d29a0 | ||
|
|
d93a5594cd | ||
|
|
a2a00577cd | ||
|
|
b92b9e5cac | ||
|
|
d19842ed73 | ||
|
|
0655c8aa6c | ||
|
|
30595dd2bb | ||
|
|
b76b5b9967 | ||
|
|
1007ca5af8 | ||
|
|
f3fab1440f | ||
|
|
affca9b523 | ||
|
|
2f53760689 | ||
|
|
3409cb2b77 | ||
|
|
be6860b33e | ||
|
|
3a94a0bb89 | ||
|
|
8234c22c1e | ||
|
|
496dad696c | ||
|
|
a623f5836c | ||
|
|
f42821293e | ||
|
|
0363703073 | ||
|
|
dfbe3ce6dc | ||
|
|
e4a247f7c9 | ||
|
|
69b2467a9a | ||
|
|
cc24e8b86b | ||
|
|
27f170815f | ||
|
|
d3c7e9d2f6 | ||
|
|
ea4bbf4285 | ||
|
|
308d6e73e3 | ||
|
|
167c93b85c | ||
|
|
13c5bcb4d8 | ||
|
|
c692a6ca70 | ||
|
|
0346e63c20 | ||
|
|
9e982f3283 | ||
|
|
11fec6f63c | ||
|
|
d0c2c1e6b9 | ||
|
|
fab4d0afcb | ||
|
|
d9e42cb274 | ||
|
|
4d9be13316 | ||
|
|
7365ef4092 | ||
|
|
13edbedc79 | ||
|
|
fc5d58ad97 | ||
|
|
a373fa500a | ||
|
|
8da098f5e0 | ||
|
|
52d4b96639 | ||
|
|
83f94a88df | ||
|
|
8762e04631 | ||
|
|
256a0d670e | ||
|
|
50106266bc | ||
|
|
ba093b0b48 | ||
|
|
33041d0ad5 | ||
|
|
b46c8c586b | ||
|
|
0e1d45dc36 | ||
|
|
1cd92458e9 | ||
|
|
7bd68365ec | ||
|
|
485eb18d83 | ||
|
|
375b30507e | ||
|
|
7691527f35 | ||
|
|
3313fac8eb | ||
|
|
e52c81f5db | ||
|
|
9b419d0bff | ||
|
|
0f40752139 | ||
|
|
d57bfc057f | ||
|
|
918ce1afa3 | ||
|
|
5d285ca896 | ||
|
|
f368e2732d | ||
|
|
ad13746da9 | ||
|
|
440f39e558 | ||
|
|
108c84daf8 | ||
|
|
e63fe3be69 | ||
|
|
bc4a141cba | ||
|
|
0dbe857ba2 | ||
|
|
483538f8f3 | ||
|
|
1f36d5411a | ||
|
|
46f76ca8b8 | ||
|
|
3a09577e0c | ||
|
|
b9f472a905 | ||
|
|
557d8131ca | ||
|
|
89fd11109d | ||
|
|
badf3edc55 | ||
|
|
36e3284979 | ||
|
|
4ac932bd21 | ||
|
|
f9468fa987 | ||
|
|
fb7c12f644 | ||
|
|
9341c96def | ||
|
|
74fd78adb1 | ||
|
|
c8ab81dd1c | ||
|
|
185e4d6b12 | ||
|
|
99607a5bbe | ||
|
|
7e807cdd2f | ||
|
|
e51f6596d4 | ||
|
|
42610db847 | ||
|
|
6018de2466 | ||
|
|
af757d3b3f | ||
|
|
30abc02277 | ||
|
|
9a9714fe0c | ||
|
|
77457fa6e9 | ||
|
|
9c45b5da6c | ||
|
|
e9f0597e2e | ||
|
|
87cde1590d | ||
|
|
65d81c60cd | ||
|
|
3d6dcb9568 | ||
|
|
1ca2911b84 | ||
|
|
8ef74b3aac | ||
|
|
aeae4fb4b9 | ||
|
|
bc22b3c876 | ||
|
|
64c9d3c143 | ||
|
|
bec0cdcb54 | ||
|
|
ba9e5ac05d | ||
|
|
46b5f83601 | ||
|
|
6d5b16562f | ||
|
|
508301a2ef | ||
|
|
2f216281e7 | ||
|
|
9459030d66 | ||
|
|
f545735638 | ||
|
|
bb8f40989f | ||
|
|
675ad6386d | ||
|
|
6ce3487b65 | ||
|
|
bc7e7d847e | ||
|
|
71a73a1a10 | ||
|
|
c2790a8af3 | ||
|
|
fde86518ae | ||
|
|
61b3aa6626 | ||
|
|
6799bc69a6 | ||
|
|
0c01227d86 | ||
|
|
c74fd81302 | ||
|
|
4b30cfb8f8 | ||
|
|
36b6416a7b | ||
|
|
e0334e861d | ||
|
|
b07fb5a811 | ||
|
|
9ab49658d7 | ||
|
|
bb3d367716 | ||
|
|
26c0a7962e | ||
|
|
a2b20a1915 | ||
|
|
2087c20a83 | ||
|
|
5512c63bdd | ||
|
|
d31cf1da68 | ||
|
|
ce656cfca8 | ||
|
|
46cdf8b745 | ||
|
|
fdc0b0ac24 | ||
|
|
42b7dea14b | ||
|
|
239c794503 | ||
|
|
189960c467 | ||
|
|
04f8aa83ef | ||
|
|
802a20b222 | ||
|
|
88f7ec38f8 | ||
|
|
baaff48547 | ||
|
|
0010cd4443 | ||
|
|
7d6ffd9e78 | ||
|
|
b8daf1fb0b | ||
|
|
fe5f05f037 | ||
|
|
5cedb53c62 | ||
|
|
650dc14e0f | ||
|
|
43ebabe05d | ||
|
|
b6366411dc | ||
|
|
914921887e | ||
|
|
64a8f1930e | ||
|
|
0ac2dfd920 | ||
|
|
aa553ee5d6 | ||
|
|
a8961c561f | ||
|
|
abce19b0e4 | ||
|
|
fc317660cb | ||
|
|
949fcde6f7 | ||
|
|
9f24b6ea65 | ||
|
|
c6ba4ae89a | ||
|
|
dab3f95c71 | ||
|
|
840ad5890f | ||
|
|
ae61bab60b | ||
|
|
d3a7f3abed | ||
|
|
694cd9ddd4 | ||
|
|
47c8e627f4 | ||
|
|
f429ebe34d | ||
|
|
083bbae0e4 | ||
|
|
eaff5ec9e5 | ||
|
|
51eb938fea | ||
|
|
296c5a32c7 | ||
|
|
ef6ccc47c8 | ||
|
|
eea2dfce48 | ||
|
|
85682abbd5 | ||
|
|
4005ee3284 | ||
|
|
9ead4c87a7 | ||
|
|
1b5d9171f2 | ||
|
|
50543300d9 | ||
|
|
d9469b894f | ||
|
|
6b9c24f7dd | ||
|
|
5954eeaff2 | ||
|
|
c84a769733 | ||
|
|
e3ef778756 | ||
|
|
806e8e439f | ||
|
|
30aaea2d04 | ||
|
|
d0cb64650b | ||
|
|
0694255893 | ||
|
|
5563c710d0 | ||
|
|
177e4e5805 | ||
|
|
8d1a666dcf | ||
|
|
fc01c5a10e | ||
|
|
896f174f94 | ||
|
|
7b4a835df4 | ||
|
|
ac85e16458 | ||
|
|
45420968ee | ||
|
|
3c35538e8b | ||
|
|
4f981cd5d9 | ||
|
|
44a6c4963b | ||
|
|
622bfb5b83 | ||
|
|
a2cb22faab | ||
|
|
9f8309fba8 | ||
|
|
bf7954bdb7 | ||
|
|
0371dd1bde | ||
|
|
7c53b133a1 | ||
|
|
b1e5f9d9a8 | ||
|
|
424969258a | ||
|
|
6d0fc38285 | ||
|
|
984c9e1078 | ||
|
|
101dc4e805 | ||
|
|
d7e3226158 | ||
|
|
74c6bdac9f | ||
|
|
73168bb1b9 | ||
|
|
f895f1beba | ||
|
|
e2e8bf0a3e | ||
|
|
3f340836a6 | ||
|
|
092c62ccb8 | ||
|
|
97dd505647 | ||
|
|
635977fe33 | ||
|
|
6ab70c2b0a | ||
|
|
3a86b24a3e | ||
|
|
77ca8735ab | ||
|
|
3a0922799d | ||
|
|
b27efce732 | ||
|
|
8974430c11 | ||
|
|
e044284998 | ||
|
|
4f9d55bb15 | ||
|
|
89adacff3d | ||
|
|
2314a1932f | ||
|
|
fb5eb4856b | ||
|
|
f857959b8e | ||
|
|
405c2162b5 | ||
|
|
8797ada815 | ||
|
|
30bafc70cc | ||
|
|
b38f0cbaf4 | ||
|
|
ceaae49b2d | ||
|
|
d1957819c4 | ||
|
|
7993fc8b12 | ||
|
|
51adf02d34 | ||
|
|
f23e98dd3a | ||
|
|
6472a6b828 | ||
|
|
b741b1c985 | ||
|
|
5f87ed5644 | ||
|
|
8d974cd292 | ||
|
|
2cf28f9db7 | ||
|
|
36ffb5f0ac | ||
|
|
07fd4c4598 | ||
|
|
44fb3e9991 | ||
|
|
088557c516 | ||
|
|
4712d46462 | ||
|
|
c01b13a32c | ||
|
|
b368faf11c | ||
|
|
7303f0c7b4 | ||
|
|
eb3cc3a32d | ||
|
|
02df950240 | ||
|
|
a69a8ce3ca | ||
|
|
8a03d55c53 | ||
|
|
544351f3be | ||
|
|
96ebaf8ab4 | ||
|
|
6b7c661fb7 | ||
|
|
6823831c06 | ||
|
|
ec82530125 | ||
|
|
a45e1f89c0 | ||
|
|
c1cd813dcb | ||
|
|
c96e62e33a | ||
|
|
6283557d2f | ||
|
|
af90f03ac5 | ||
|
|
588022ab8c | ||
|
|
cf0820549b | ||
|
|
f54bc6c7d6 | ||
|
|
2cdff6c32c | ||
|
|
49d8b99e4f | ||
|
|
bb81932422 | ||
|
|
5efb6836a8 | ||
|
|
48fa14acc0 | ||
|
|
eb7181b35e | ||
|
|
8db42023bb | ||
|
|
018a8e12ca | ||
|
|
b4a5aedc6c | ||
|
|
d6ed174d09 | ||
|
|
78f92e044a | ||
|
|
f11931a0dd | ||
|
|
31a6931be9 | ||
|
|
debb288115 | ||
|
|
c75a3839da | ||
|
|
b6a32fbd5f | ||
|
|
09e4c86606 | ||
|
|
20eb422829 | ||
|
|
90c6b572d0 | ||
|
|
712b574fb7 | ||
|
|
fd023d6dcf | ||
|
|
9c16be32d7 | ||
|
|
c3cdb099da | ||
|
|
682a088fb8 | ||
|
|
8c25bd0e94 | ||
|
|
20e122ef41 | ||
|
|
0dcac9188f | ||
|
|
1c010d8ec9 | ||
|
|
b020937475 | ||
|
|
e3f46b066a | ||
|
|
df7fe1280d | ||
|
|
929770191e | ||
|
|
66d9d6c6d2 | ||
|
|
de816840cb | ||
|
|
74fcc3be79 | ||
|
|
b6909d3737 | ||
|
|
823d79b36c | ||
|
|
735757b0c1 | ||
|
|
09b919a68f | ||
|
|
2f718e11a7 | ||
|
|
77da54c6c6 | ||
|
|
6bf52dcc8d | ||
|
|
3d9e803aed | ||
|
|
ede64d7ea0 | ||
|
|
e8db390d6f | ||
|
|
0c1bf429e8 | ||
|
|
f6357a73f0 | ||
|
|
49ca7e5aa8 | ||
|
|
be9b1a1887 | ||
|
|
bb74aacf2d | ||
|
|
b72d9af52c | ||
|
|
a9ccd99b90 | ||
|
|
ac5e5179fb | ||
|
|
a543f8cd8f | ||
|
|
d7853df8b6 | ||
|
|
1e9d12abc5 | ||
|
|
3bce9fb755 | ||
|
|
0a57da42e0 | ||
|
|
73067e0e16 | ||
|
|
b9328d0eac | ||
|
|
0596b875f0 | ||
|
|
b94dcfd34b | ||
|
|
4238564673 | ||
|
|
764ab96bda | ||
|
|
f0cc59bead | ||
|
|
282f438967 | ||
|
|
1b01adfa9f | ||
|
|
87fe73ddaa | ||
|
|
c2746c0bb2 | ||
|
|
399a024857 | ||
|
|
d131c2d438 | ||
|
|
eb0962fb06 | ||
|
|
7bf253702e | ||
|
|
76742cc193 | ||
|
|
37717baeed | ||
|
|
ade2fafbd3 | ||
|
|
53fe7ba26a | ||
|
|
7e04fea92b | ||
|
|
1fdd23d347 | ||
|
|
5ea930e25f | ||
|
|
45defd25f3 | ||
|
|
0d11964503 | ||
|
|
7545eb5bbf | ||
|
|
878bd53d11 | ||
|
|
e0a4ee0148 | ||
|
|
d3fbc4d498 | ||
|
|
a8e2a24f60 | ||
|
|
36855544d1 | ||
|
|
dc745c0b77 | ||
|
|
a8ed1d7a9a | ||
|
|
94c371a38f | ||
|
|
36618f1dca | ||
|
|
3ea2694d9c | ||
|
|
85cc99a2a3 | ||
|
|
befe4ea5de | ||
|
|
43d94692ce | ||
|
|
1364b41dc9 | ||
|
|
7d3a555464 | ||
|
|
0508520b47 | ||
|
|
6cbb7bc443 | ||
|
|
055e262b56 | ||
|
|
9d8388e836 | ||
|
|
895de17a58 | ||
|
|
b202966d30 | ||
|
|
a19a7820f9 | ||
|
|
0122119a44 | ||
|
|
64bf03b0d9 | ||
|
|
4bc6d67052 | ||
|
|
7519a458b2 | ||
|
|
bc36813349 | ||
|
|
9bd7d62c10 | ||
|
|
735a608e80 | ||
|
|
71402bb7e9 | ||
|
|
9266fa6657 | ||
|
|
6360e4170a | ||
|
|
dcb072d04b | ||
|
|
4c6ce3c39d | ||
|
|
41fd09706d | ||
|
|
24e5f956d0 | ||
|
|
f602613a9a | ||
|
|
ba124ffa5d | ||
|
|
d30ddf0add | ||
|
|
e66c7d0f8d | ||
|
|
7b9567719c | ||
|
|
04d33e7981 | ||
|
|
c62d12ca93 | ||
|
|
297633d086 | ||
|
|
10b99d8ac0 | ||
|
|
0693d6974a | ||
|
|
5129e718d7 | ||
|
|
8c406bc875 | ||
|
|
c53da9aa5b | ||
|
|
e7a420eca7 | ||
|
|
1236341746 | ||
|
|
c96c343fac | ||
|
|
02f1fec497 | ||
|
|
a102e45e90 | ||
|
|
86c9b9b54e | ||
|
|
e14127b843 | ||
|
|
67cdd71352 | ||
|
|
6a88fe8807 | ||
|
|
90f6f25e31 | ||
|
|
0f4bb64eaf | ||
|
|
45efe28f05 | ||
|
|
c8c7986f65 | ||
|
|
f437117bf2 | ||
|
|
33e882e6f8 | ||
|
|
bad591d43d | ||
|
|
7b48458380 | ||
|
|
1e16a3f411 | ||
|
|
6a3ba2ab50 | ||
|
|
1878168ae3 | ||
|
|
545709a165 | ||
|
|
ca398fdfdf | ||
|
|
d0bceb1449 | ||
|
|
caef3128eb | ||
|
|
856a6ecde3 | ||
|
|
e353203010 | ||
|
|
f1fc66060f | ||
|
|
ba4f4bdc64 | ||
|
|
2b6c08b955 | ||
|
|
b86f7868d1 | ||
|
|
54995defd2 | ||
|
|
b89bc2cce6 | ||
|
|
8f24ffaaef | ||
|
|
d31cc373de | ||
|
|
f52f503c38 | ||
|
|
8939163659 | ||
|
|
265bdd94f1 | ||
|
|
d1c412d200 | ||
|
|
5c4c30e26b | ||
|
|
1b65d39722 | ||
|
|
96e4fec31c | ||
|
|
208146f2f2 | ||
|
|
89e84e76c3 | ||
|
|
c44a5e960e | ||
|
|
c1bd54dd47 | ||
|
|
3efb9c3a2e | ||
|
|
b87d7f69fc | ||
|
|
8ba653f395 | ||
|
|
c6501beba7 | ||
|
|
dbf522b750 | ||
|
|
651e97ceef | ||
|
|
d8500f0467 | ||
|
|
a9bc118178 | ||
|
|
903942b4f0 | ||
|
|
7ebf5f52b8 | ||
|
|
4f7593b704 | ||
|
|
2157738a18 | ||
|
|
681d11c0cf | ||
|
|
d96f296b8e | ||
|
|
048ab0ee0b | ||
|
|
16dff06a4c | ||
|
|
c3900e90f0 | ||
|
|
0f334f8ee4 | ||
|
|
587e6e2c88 | ||
|
|
a3a1391a51 | ||
|
|
a4675acdba | ||
|
|
00ac41f632 | ||
|
|
fe22da6b2a | ||
|
|
0c87a4ba41 | ||
|
|
39705c60df | ||
|
|
9da23799ff | ||
|
|
29276d1d3a | ||
|
|
13b839734f | ||
|
|
63bb1b62b7 | ||
|
|
743100feab | ||
|
|
d3d2d324d2 | ||
|
|
925a1a11f9 | ||
|
|
5918ca6cab | ||
|
|
dc907bfe43 | ||
|
|
687efd210c | ||
|
|
b7539ea985 | ||
|
|
7d35f71c87 | ||
|
|
7f184ee2ba | ||
|
|
ec9fc5d320 | ||
|
|
3c2eb96243 | ||
|
|
de313586ab | ||
|
|
e96bda4b9f | ||
|
|
d9944c03c4 | ||
|
|
b9d6d547b8 | ||
|
|
622b031e27 | ||
|
|
26f5c8b9d5 | ||
|
|
e1601d2eb5 | ||
|
|
bc14fc35d7 | ||
|
|
f660f22623 | ||
|
|
300f67d78f | ||
|
|
8a3ecfe5c1 | ||
|
|
ced0019b6c | ||
|
|
5d88528fe4 | ||
|
|
1572248866 | ||
|
|
d26916199b | ||
|
|
2e9fb7d840 | ||
|
|
7a086bef08 | ||
|
|
777082a7b8 | ||
|
|
a4e3d88c67 | ||
|
|
06b903f807 | ||
|
|
d2869ab348 | ||
|
|
072c8aa39b | ||
|
|
5bd92d4c60 | ||
|
|
d6c194265f | ||
|
|
3f938e29b6 | ||
|
|
037b77555e | ||
|
|
51b9e86d13 | ||
|
|
cbf6fd021a | ||
|
|
b093d19262 | ||
|
|
7c698a9c3a | ||
|
|
17f531890a | ||
|
|
dac58bb651 | ||
|
|
4a403ae00f | ||
|
|
2c41600957 | ||
|
|
58a3293efc | ||
|
|
0906181d75 | ||
|
|
d5fcc9271a | ||
|
|
844c671bf1 | ||
|
|
7ff6b97e5c | ||
|
|
d679bbc802 | ||
|
|
6d88281357 | ||
|
|
32787a9f22 | ||
|
|
9709dfd563 | ||
|
|
6dd5a75d13 | ||
|
|
9c04d0c956 | ||
|
|
c3e74f02c2 | ||
|
|
cb56cd70f5 | ||
|
|
de0395bee9 | ||
|
|
abb5b14281 | ||
|
|
2289bb7c19 | ||
|
|
746ef89745 | ||
|
|
ffc0b4863b | ||
|
|
89f8d71001 | ||
|
|
a2878bff67 | ||
|
|
34cfa55f58 | ||
|
|
7dd5484cb5 | ||
|
|
37f1d43ce3 | ||
|
|
07b5d97a3a | ||
|
|
cb841de3fc | ||
|
|
e12f397140 | ||
|
|
3a22028042 | ||
|
|
f12264723d | ||
|
|
65f14624c8 | ||
|
|
30016a7e19 | ||
|
|
e8abbc7045 | ||
|
|
235f92ce09 | ||
|
|
22fc10911a | ||
|
|
11ae201d71 | ||
|
|
8586efda0b | ||
|
|
9e382ba691 | ||
|
|
accb645d3f | ||
|
|
620496f5cd | ||
|
|
73cd96838e | ||
|
|
82080b044b | ||
|
|
93b25ce014 | ||
|
|
f883465263 | ||
|
|
ba049fcaf8 | ||
|
|
ba47abb473 | ||
|
|
b9a1a586c0 | ||
|
|
7b19b4114c | ||
|
|
3e9c2ecc85 | ||
|
|
3940032cd3 | ||
|
|
d2d0c665b1 | ||
|
|
50aa3587d4 | ||
|
|
0bc834e6f3 | ||
|
|
dd24f6a18d | ||
|
|
462e9d4822 | ||
|
|
48ac0a64c6 | ||
|
|
cf4901da2d | ||
|
|
9f20fadee1 | ||
|
|
0f7a309adc | ||
|
|
c771167b6a | ||
|
|
e1cf93640c | ||
|
|
1716f140b7 | ||
|
|
586a7d22e7 | ||
|
|
cab9294f62 | ||
|
|
98a24fc8f9 | ||
|
|
bbc7c59563 | ||
|
|
b122d3b8e5 | ||
|
|
46e769a113 | ||
|
|
79545187b8 | ||
|
|
413a83c2e2 | ||
|
|
ab08eebfc1 | ||
|
|
ac4c56f636 | ||
|
|
1db7d57a24 | ||
|
|
e32ca98ccf | ||
|
|
5a635db262 | ||
|
|
c87bc1d55f | ||
|
|
5c63975097 | ||
|
|
fee905a34a | ||
|
|
070c9c60ec | ||
|
|
63ac050733 | ||
|
|
3ade8b29cc | ||
|
|
51a6d5897e | ||
|
|
785d28d5d1 | ||
|
|
4873cc26f2 | ||
|
|
0f8423eb4c | ||
|
|
b60fec5db3 | ||
|
|
7ffbf01607 | ||
|
|
f6b4c243d8 | ||
|
|
0287be7660 | ||
|
|
e6709d684b | ||
|
|
aa257ef58e | ||
|
|
8daa7cbda0 | ||
|
|
8a5449cebe | ||
|
|
9229834935 | ||
|
|
6469e9668b | ||
|
|
68d71f649e | ||
|
|
71752f47cb | ||
|
|
51f27d3f0c | ||
|
|
b38265cfb8 | ||
|
|
b5fb41e963 | ||
|
|
a14c894325 | ||
|
|
bc6b9bf955 | ||
|
|
4b6090ded3 | ||
|
|
fb98f0ced7 | ||
|
|
d09055db43 | ||
|
|
50b61bef6f | ||
|
|
3d0bfb0a00 | ||
|
|
3cb55c8b27 | ||
|
|
306906a8a7 |
4
AUTHORS
4
AUTHORS
@@ -8,7 +8,9 @@ Chris Allegretta <chrisa@asty.org>
|
|||||||
Benno Schulenberg <bensberg@telfort.nl>
|
Benno Schulenberg <bensberg@telfort.nl>
|
||||||
* An array of small bug fixes, the cut-word and block-jump
|
* An array of small bug fixes, the cut-word and block-jump
|
||||||
routines, text selection by holding Shift, macro recording
|
routines, text selection by holding Shift, macro recording
|
||||||
and replay, plus some key bindings. Current maintainer.
|
and replay, extra key bindings, the --indicator, --minibar,
|
||||||
|
and --zero options, and braced functions in string binds.
|
||||||
|
Current maintainer.
|
||||||
|
|
||||||
David Lawrence Ramsey <pooka109@gmail.com>
|
David Lawrence Ramsey <pooka109@gmail.com>
|
||||||
* Former stable series maintainer. Multiple buffer support,
|
* Former stable series maintainer. Multiple buffer support,
|
||||||
|
|||||||
17
IMPROVEMENTS
17
IMPROVEMENTS
@@ -1,7 +1,24 @@
|
|||||||
Improvements in GNU nano
|
Improvements in GNU nano
|
||||||
========================
|
========================
|
||||||
|
|
||||||
|
Since 7.0:
|
||||||
|
- String binds may contain bindable function names between braces.
|
||||||
|
- Word completion looks for candidates in all open buffers.
|
||||||
|
- Unicode codes can be entered without leading zeroes.
|
||||||
|
|
||||||
|
Since 6.0:
|
||||||
|
- Option --zero hides the interface and uses the whole terminal for editing.
|
||||||
|
- Colors can be given also in #rgb hexadecimal, to select the nearest color
|
||||||
|
from the 6x6x6 color-cube palette available on 256-color terminals.
|
||||||
|
- Fourteen new color names are available, from rosy to crimson.
|
||||||
|
|
||||||
Since 5.0:
|
Since 5.0:
|
||||||
|
- A search briefly spotlights the found text, in black on yellow by default.
|
||||||
|
- Option --minibar reduces the interface to a bottom bar with basic info.
|
||||||
|
- The cursor skips over combining characters, <Del> deletes them together
|
||||||
|
with the character they combine with, but <Bsp> deletes them separately.
|
||||||
|
- For using libmagic the option --magic or -! or 'set magic' is required.
|
||||||
|
- With --stateflags the state of some things is shown in the title bar.
|
||||||
- M-Bsp deletes a word leftward.
|
- M-Bsp deletes a word leftward.
|
||||||
- With --indicator a "scrollbar" is shown, indicating position+portion.
|
- With --indicator a "scrollbar" is shown, indicating position+portion.
|
||||||
- M-Ins places an anchor, M-PgUp/M-PgDn jump to the nearest anchor.
|
- M-Ins places an anchor, M-PgUp/M-PgDn jump to the nearest anchor.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ if USE_COLOR
|
|||||||
SUBDIRS += syntax
|
SUBDIRS += syntax
|
||||||
endif
|
endif
|
||||||
|
|
||||||
EXTRA_DIST = IMPROVEMENTS README.GIT
|
EXTRA_DIST = IMPROVEMENTS
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
|
|||||||
472
NEWS
472
NEWS
@@ -1,3 +1,162 @@
|
|||||||
|
2023.01.18 - GNU nano 7.2 "Boer doe mij 't hekke lös!"
|
||||||
|
• <Shift+Insert> is prevented from pasting in view mode.
|
||||||
|
|
||||||
|
2022.12.14 - GNU nano 7.1 "And the devices shall be made of wood"
|
||||||
|
• When --autoindent and --breaklonglines are combined, pressing
|
||||||
|
<Enter> at a specific position no longer eats characters.
|
||||||
|
|
||||||
|
2022.11.15 - GNU nano 7.0 "Una existencia simple bajo el sol"
|
||||||
|
• String binds may contain bindable function names between braces.
|
||||||
|
For example, to move the current line down to after the next one:
|
||||||
|
bind ^D "{cut}{down}{paste}{up}" main. Of course, braced function
|
||||||
|
names may be mixed with literal text. If an existing string bind
|
||||||
|
contains a literal {, replace it with {{}.
|
||||||
|
• Unicode codes can be entered (via M-V) without leading zeroes,
|
||||||
|
by finishing short codes with <Space> or <Enter>.
|
||||||
|
• Word completion (^]) looks for candidates in all open buffers.
|
||||||
|
• No regular expression matches the final empty line any more.
|
||||||
|
|
||||||
|
|
||||||
|
2022.08.02 - GNU nano 6.4 "Regentag Dunkelbunt Hundertwasser"
|
||||||
|
• The file browser does not crash when moving up to the root folder.
|
||||||
|
• Softwrapping very long lines is done more efficiently.
|
||||||
|
• Invoking the formatter does not blink the screen.
|
||||||
|
|
||||||
|
2022.04.28 - GNU nano 6.3 "Wat zullen we drinken? Wat een dorst!"
|
||||||
|
• For multiline regexes, text is now colored as soon as a start match
|
||||||
|
is found, also when there is no end match at all.
|
||||||
|
• The colorizing of any line is stopped after two thousand bytes,
|
||||||
|
to avoid frustrating delays.
|
||||||
|
• When environment variable NO_COLOR is set, the two default colors
|
||||||
|
(yellow for the spotlight, red for error messages) are suppressed
|
||||||
|
when no interface colors are specified in a nanorc file.
|
||||||
|
• Full justification and piping the whole buffer through a command
|
||||||
|
now keep the cursor at the same line number.
|
||||||
|
• Utility 'xsel' can be used to copy a marked region to the system's
|
||||||
|
clipboard. See doc/sample.nanorc for an example.
|
||||||
|
|
||||||
|
2022.02.18 - GNU nano 6.2 "Kamperfoelie"
|
||||||
|
• The file browser clears the prompt bar also when using --minibar.
|
||||||
|
• Linting now works also with a newer 'pyflakes'.
|
||||||
|
|
||||||
|
2022.02.09 - GNU nano 6.1 "Rețelele de socializare sunt ca un frigider"
|
||||||
|
• The behavior of ^K at a prompt has been enhanced: when there is some
|
||||||
|
text after the cursor, just this text is erased. In the most common
|
||||||
|
situation, when the cursor is at the end of the answer, the behavior
|
||||||
|
is as before: the whole answer is erased.
|
||||||
|
• At a prompt, M-6 copies the current answer into the cutbuffer.
|
||||||
|
• Large external pastes into nano are handled more quickly.
|
||||||
|
|
||||||
|
2021.12.15 - GNU nano 6.0 "Humor heeft ook zijn leuke kanten"
|
||||||
|
• Option --zero hides the title bar, status bar and help lines, and
|
||||||
|
uses all rows of the terminal as editing area. The title bar and
|
||||||
|
status bar can be toggled with M-Z.
|
||||||
|
• Colors can now be specified also as three-digit hexadecimal numbers,
|
||||||
|
in the format #rgb. This picks from the 216 index colors (that most
|
||||||
|
terminals know) the color that is nearest to the given values.
|
||||||
|
• For users who dislike numbers, there are fourteen new color names:
|
||||||
|
rosy, beet, plum, sea, sky, slate, teal, sage, brown, ocher, sand,
|
||||||
|
tawny, brick, and crimson.
|
||||||
|
• Suspension is enabled by default, invokable with ^T^Z. The options
|
||||||
|
-z, --suspendable, and 'set suspendable' are obsolete and ignored.
|
||||||
|
(In case you want to be able to suspend nano with a single keystroke,
|
||||||
|
you can put 'bind ^Z suspend main' in your nanorc.)
|
||||||
|
• When automatic hard-wrapping is in effect, pasting just a few words
|
||||||
|
(without a line break) will now hard-wrap the line when needed.
|
||||||
|
• Toggling Append or Prepend clears the current filename.
|
||||||
|
• The word count as shown by M-D is now affected by option --wordbounds;
|
||||||
|
with it, nano counts words as 'wc' does; without it (the new default),
|
||||||
|
words are counted in a more human way: seeing punctuation as space.
|
||||||
|
• The YAML syntax file is now actually included in the tarball.
|
||||||
|
|
||||||
|
|
||||||
|
2021.10.06 - GNU nano 5.9 "El manicomio ha decidido: mañana sol!"
|
||||||
|
• The extension of a filename is added to the name of a corresponding
|
||||||
|
temporary file, so that spell checking a C file, for example, will
|
||||||
|
check only the comments and strings (when using 'aspell').
|
||||||
|
• The process number is added to the name of an emergency save file,
|
||||||
|
so that when multiple nanos die they will not fight over a filename.
|
||||||
|
• Undoing a cutting operation will restore an anchor that was located
|
||||||
|
in the cut area to its original line.
|
||||||
|
• When using --locking, saving a new buffer will create a lock file.
|
||||||
|
• Syntax highlighting for YAML files has been added.
|
||||||
|
|
||||||
|
2021.06.15 - GNU nano 5.8 "Why is it necessary to be special?"
|
||||||
|
• After a search, the spotlighting is dropped after 1.5 seconds (0.8
|
||||||
|
seconds with --quick) to avoid the idea that the text is selected.
|
||||||
|
• A + and a space before a filename on the command line will put the
|
||||||
|
cursor at the end of the corresponding buffer.
|
||||||
|
• Linter messages no longer include filename and line/column numbers.
|
||||||
|
• Color name "grey" or "gray" can be used instead of "lightblack".
|
||||||
|
• The color of the minibar can be chosen with 'set minicolor'.
|
||||||
|
|
||||||
|
2021.04.29 - GNU nano 5.7 "Toți ceilalți arau câmpurile"
|
||||||
|
• The output of --constantshow (without --minibar) is more stable.
|
||||||
|
• When opening multiple buffers and there is an error message, this
|
||||||
|
message is shown again upon first switch to the relevant buffer.
|
||||||
|
• The position and size of the indicator now follow actual lines,
|
||||||
|
instead of visual lines when in softwrap mode, meaning that the
|
||||||
|
size of the indicator can change when scrolling in softwrap mode.
|
||||||
|
|
||||||
|
2021.03.03 - GNU nano 5.6.1 "Geelgors"
|
||||||
|
• Search matches are properly colorized in softwrap mode too.
|
||||||
|
• Option 'highlightcolor' has been renamed to 'spotlightcolor'.
|
||||||
|
|
||||||
|
2021.02.24 - GNU nano 5.6 "Wielewaal"
|
||||||
|
• A search match gets highlighted (in black on yellow by default),
|
||||||
|
in addition to placing the cursor at the start of the match.
|
||||||
|
The color combination can be changed with 'set highlightcolor'.
|
||||||
|
By default the cursor is hidden until the next keystroke, but
|
||||||
|
it can be forced on with --showcursor / 'set showcursor'.
|
||||||
|
• Option --markmatch / 'set markmatch' has been removed.
|
||||||
|
• Cursor position and character code are displayed in the minibar
|
||||||
|
only when option --constantshow / 'set constantshow' is used,
|
||||||
|
and their display can be toggled with M-C.
|
||||||
|
• The state flags are displayed in the minibar only when option
|
||||||
|
--stateflags / 'set stateflags' is used.
|
||||||
|
|
||||||
|
2021.01.14 - GNU nano 5.5 "Rebecca"
|
||||||
|
• Option 'set minibar' makes nano suppress the title bar and instead
|
||||||
|
show a bar with basic editing information at the bottom: file name
|
||||||
|
(plus an asterisk when the buffer is modified), the cursor position
|
||||||
|
(line,column), the character under the cursor (U+xxxx), the flags
|
||||||
|
that --stateflags normally shows, plus the percentage of the buffer
|
||||||
|
that is above the cursor.
|
||||||
|
• With 'set promptcolor' the color combination of the prompt bar can
|
||||||
|
be changed, to allow contrasting it with the mini bar (which always
|
||||||
|
has the same color as the title bar).
|
||||||
|
• Option 'set markmatch' highlights the result of a successful search
|
||||||
|
by putting the mark at the end of the match, making the match more
|
||||||
|
visible. It also suppresses the cursor until the next keystroke.
|
||||||
|
(If you dislike the hiding of the cursor, use 'set showcursor'.)
|
||||||
|
• The bindable toggle 'nowrap' has been renamed to 'breaklonglines',
|
||||||
|
to match the corresponding option, like for all other toggles.
|
||||||
|
• Support for Slang has been removed.
|
||||||
|
|
||||||
|
2020.12.02 - GNU nano 5.4 "Terre des hommes"
|
||||||
|
• Moving the cursor now skips over combining characters (and other
|
||||||
|
zero-width characters). Deleting a character deletes also any
|
||||||
|
succeeding zero-width characters, but backspacing deletes just
|
||||||
|
one character at a time.
|
||||||
|
• Workarounds for older ncurses and older libvtes were removed.
|
||||||
|
|
||||||
|
2020.10.07 - GNU nano 5.3 "Revolution!"
|
||||||
|
• Option 'set stateflags' makes nano show the state of auto-indenting,
|
||||||
|
the mark, hard-wrapping, macro recording, and soft-wrapping in the
|
||||||
|
title bar. The flags take the place of "Modified", and a modified
|
||||||
|
buffer is instead indicated by an asterisk (*) after its name.
|
||||||
|
• Nano no longer by default tries using libmagic to determine the type
|
||||||
|
of a file (when neither filename nor first line gave a clue), because
|
||||||
|
in most cases it is a waste of time. It requires using the option
|
||||||
|
--magic or -! or 'set magic' to make nano try libmagic.
|
||||||
|
• The color of the indicator can be changed with 'set scrollercolor'.
|
||||||
|
|
||||||
|
2020.08.24 - GNU nano 5.2 "Ranrapalca"
|
||||||
|
• Making certain replacements after a large paste does not crash.
|
||||||
|
• Hitting a toggle at the Search prompt does not clear the answer.
|
||||||
|
• Using --positionlog does not complain at the first start.
|
||||||
|
• A macro containing a Search command will not sometimes fail.
|
||||||
|
|
||||||
2020.08.12 - GNU nano 5.1 "Cantabria"
|
2020.08.12 - GNU nano 5.1 "Cantabria"
|
||||||
• M-Bsp (Alt+Backspace) deletes a word backwards, like in Bash.
|
• M-Bsp (Alt+Backspace) deletes a word backwards, like in Bash.
|
||||||
• M-[ has become bindable. (Be careful, though: as it is the
|
• M-[ has become bindable. (Be careful, though: as it is the
|
||||||
@@ -100,7 +259,7 @@
|
|||||||
It allows running a syntax-specific command on the contents of
|
It allows running a syntax-specific command on the contents of
|
||||||
the buffer.
|
the buffer.
|
||||||
• ^T will try to run 'hunspell' before 'spell', because it checks
|
• ^T will try to run 'hunspell' before 'spell', because it checks
|
||||||
spellling for the locale's language and understands UTF-8.
|
spelling for the locale's language and understands UTF-8.
|
||||||
• Multiple errors or warnings on startup will no longer slow nano
|
• Multiple errors or warnings on startup will no longer slow nano
|
||||||
down but will be indicated on the status bar with trailing dots.
|
down but will be indicated on the status bar with trailing dots.
|
||||||
|
|
||||||
@@ -119,6 +278,7 @@
|
|||||||
|
|
||||||
2019.06.18 - GNU nano 4.3 "Musa Kart"
|
2019.06.18 - GNU nano 4.3 "Musa Kart"
|
||||||
• The ability to read from and write to a FIFO has been regained.
|
• The ability to read from and write to a FIFO has been regained.
|
||||||
|
• Opening a file no longer triggers an inotify CLOSE_WRITE event.
|
||||||
• Startup time is reduced by fully parsing a syntax only when needed.
|
• Startup time is reduced by fully parsing a syntax only when needed.
|
||||||
• Asking for help (^G) when using --operatingdir does not crash.
|
• Asking for help (^G) when using --operatingdir does not crash.
|
||||||
• The reading of a huge or slow file can be stopped with ^C.
|
• The reading of a huge or slow file can be stopped with ^C.
|
||||||
@@ -523,7 +683,7 @@
|
|||||||
|
|
||||||
2016.02.12 - GNU nano 2.5.2 is carrying too many dogs. This release
|
2016.02.12 - GNU nano 2.5.2 is carrying too many dogs. This release
|
||||||
includes several fixes for various memory leaks, position-
|
includes several fixes for various memory leaks, position-
|
||||||
history size growth, and a long standing issue with using
|
history size growth, and a long-standing issue with using
|
||||||
nano under sudo creating root-owned files. There are also
|
nano under sudo creating root-owned files. There are also
|
||||||
the usual bevy of documentation and other miscellaneous
|
the usual bevy of documentation and other miscellaneous
|
||||||
fixes and touchups. Upgrade today while supplies last,
|
fixes and touchups. Upgrade today while supplies last,
|
||||||
@@ -641,22 +801,22 @@
|
|||||||
the undo implementation and the default syntax config are
|
the undo implementation and the default syntax config are
|
||||||
also included. As always, Share and Enjoy!
|
also included. As always, Share and Enjoy!
|
||||||
|
|
||||||
2014.05.28 - GNU nano 2.3.3 is in its right place. This release contains
|
2014.05.28 - GNU nano 2.3.3 is in its right place. This release
|
||||||
many many improvements to the core system, including
|
contains many many improvements to the core system,
|
||||||
substantial improvements to the undo/redo code, UTF-8
|
including substantial improvements to the undo/redo code,
|
||||||
handling, the configure script, and display of shortcuts
|
UTF-8 handling, the configure script, and display of
|
||||||
on very wide terminals. New features include the
|
shortcuts on very wide terminals. New features include
|
||||||
ability to write to named pipes (--noread), as well as
|
the ability to write to named pipes (--noread), as well
|
||||||
linter support (see the nanorc man page for details). Also
|
as linter support (see the nanorc man page for details).
|
||||||
included are much improved syntax highlighting code, and
|
Also included are much improved syntax highlighting code,
|
||||||
configurations for JSON, texinfo, Go, and a default syntax
|
and configurations for JSON, texinfo, Go, and a default
|
||||||
for catch-all highlighting. Finally, nano now has the
|
syntax for catch-all highlighting. Finally, nano now has
|
||||||
ability to set the color of the title bar, status bar, and
|
the ability to set the color of the title bar, status bar,
|
||||||
shortcut keys (e.g. "^X") and their descriptions. Again
|
and shortcut keys (e.g. "^X") and their descriptions.
|
||||||
see the nanorc page for details. There's much more, too
|
Again see the nanorc page for details. There's much more,
|
||||||
much to include here, but please keep those reports and
|
too much to include here, but please keep those reports
|
||||||
general feedback coming! Thank you for helping us help
|
and general feedback coming! Thank you for helping us
|
||||||
you help us all.
|
help you help us all.
|
||||||
|
|
||||||
2013.03.22 - GNU nano 2.3.2 "Annoy your coworkers for fun and profit" is
|
2013.03.22 - GNU nano 2.3.2 "Annoy your coworkers for fun and profit" is
|
||||||
released. This release introduces vim-style file locking
|
released. This release introduces vim-style file locking
|
||||||
@@ -765,28 +925,27 @@
|
|||||||
|
|
||||||
2009.11.30 - GNU nano 2.2.0 "Doc Brown" is released! The culmination
|
2009.11.30 - GNU nano 2.2.0 "Doc Brown" is released! The culmination
|
||||||
of almost two years of development and hot on the heels
|
of almost two years of development and hot on the heels
|
||||||
of nano's 10th birthday is available for all your
|
of nano's 10th birthday is available for all your editing
|
||||||
editing needs! Bugs fixed since the last release
|
needs! Bugs fixed since the last release include several
|
||||||
include several fixes for tiny mode (involving both
|
fixes for tiny mode (involving both the help keys and
|
||||||
the help keys and replace menu text), more 'final'
|
replace menu text), more 'final' fixes for soft wrapping,
|
||||||
fixes for soft wrapping, and several typo and documentation
|
and several typo and documentation updates including nanorc
|
||||||
updates including nanorc tweaks and a new syntax
|
tweaks and a new syntax highlighting file for makefiles.
|
||||||
highlighting file for makefiles. Also included is a long
|
Also included is a long-standing fix for random crashing
|
||||||
standing fix for random crashing when using nanorc on
|
when using nanorc on FreeBSD, and nano will no longer clear
|
||||||
FreeBSD, and nano will no longer clear the screen on
|
the screen on suspend to maintain compatibility with other
|
||||||
suspend to maintain compatibility with other *nix editors.
|
*nix editors. For those who haven't been playing along at
|
||||||
For those who haven't been playing along at home, please
|
home, please see the official web page for the summary of
|
||||||
see the official web page for the summary of new
|
new features since 2.0. Special thanks to all who have
|
||||||
features since 2.0. Special thanks to all who have
|
submitted bug reports recently in support of our new stable
|
||||||
submitted bug reports recently in support of our new
|
release, and apologies for all those bugs we didn't yet
|
||||||
stable release, and apologies for all those bugs we
|
find :-) Peace to all.
|
||||||
didn't yet find :-) Peace to all.
|
|
||||||
|
|
||||||
|
|
||||||
2009.11.21 - GNU nano 2.1.99pre2 is available for a special pre-Black
|
2009.11.21 - GNU nano 2.1.99pre2 is available for a special pre-Black
|
||||||
Friday discount. Included are some (hopefully final)
|
Friday discount. Included are some (hopefully final)
|
||||||
fixes for issues with last page display caused by the
|
fixes for issues with last page display caused by the
|
||||||
soft wrapping code, and a fix for a long standing issue
|
soft wrapping code, and a fix for a long-standing issue
|
||||||
with hitting the Home key when going through the search
|
with hitting the Home key when going through the search
|
||||||
history. On the features front, nano will now attempt to
|
history. On the features front, nano will now attempt to
|
||||||
retain the proper ownership and permissions when trying
|
retain the proper ownership and permissions when trying
|
||||||
@@ -796,13 +955,13 @@
|
|||||||
the command line will now override any related .nanorc
|
the command line will now override any related .nanorc
|
||||||
entries. Speak now or forever hold your bugs!
|
entries. Speak now or forever hold your bugs!
|
||||||
|
|
||||||
2009.11.15 - GNU nano 2.1.99pre1 "take a bow" is out there, man, it's
|
2009.11.15 - GNU nano 2.1.99pre1 "take a bow" is out there, man,
|
||||||
out there all right. This release contains mainly
|
it's out there all right. This release contains mainly
|
||||||
bugfixes, underscoring that we are preparing for the
|
bugfixes, underscoring that we are preparing for the
|
||||||
next stable series release. Included are many fixes
|
next stable series release. Included are many fixes
|
||||||
for the new soft wrapping code, compiler warning tweaks,
|
for the new soft wrapping code, compiler warning tweaks,
|
||||||
and the modification time warning no longer triggers
|
and the modification time warning no longer triggers
|
||||||
when saving a file as a new name. Also include are
|
when saving a file with a new name. Also included are
|
||||||
some fixes for various nanorc options, and there are
|
some fixes for various nanorc options, and there are
|
||||||
surely more bugs to find before we call the code base
|
surely more bugs to find before we call the code base
|
||||||
stable, so please keep those reports coming!
|
stable, so please keep those reports coming!
|
||||||
@@ -914,31 +1073,31 @@
|
|||||||
and not saving the search history when compiled with
|
and not saving the search history when compiled with
|
||||||
configure options.
|
configure options.
|
||||||
|
|
||||||
2008.04.24 - GNU nano 2.1.2 "New York City" is released. This release
|
2008.06.24 - GNU nano 2.1.2 "New York City" is released. This
|
||||||
contains fixes for binding bad keys, some
|
release contains fixes for binding bad keys, some
|
||||||
configure-specific compilation failures, and more issues
|
configure-specific compilation failures, and more
|
||||||
with the new input back end and in particular the status
|
issues with the new input back end and in particular
|
||||||
bar. Also fixed are some long standing issues with
|
the status bar. Also fixed are some long-standing
|
||||||
compiling on AIX, and a segfault when making the terminal
|
issues with compiling on AIX, and a segfault when
|
||||||
window too small. Rest in Peace Tim and George!
|
making the terminal window too small. Rest in Peace
|
||||||
|
Tim and George!
|
||||||
|
|
||||||
2008.04.01 - GNU nano 2.1.1 won't get fooled again. This release contains
|
2008.04.01 - GNU nano 2.1.1 won't get fooled again. This release
|
||||||
fixes for the new user-rebindable keys (in particular
|
contains fixes for the new user-rebindable keys (in
|
||||||
bracket match which was mis-bound), and various
|
particular bracket match which was mis-bound), and
|
||||||
problems with translations and configure-related
|
various problems with translations and configure-
|
||||||
compilation problems are now fixed as well.
|
related compilation problems are now fixed as well.
|
||||||
It also contains new syntax highlighting
|
It also contains new syntax highlighting definitions
|
||||||
definitions for TCL, PHP, Gentoo and Debian-related
|
for Tcl, PHP, Gentoo and Debian-related files, and
|
||||||
files, and some documentation updates as well.
|
some documentation updates as well. Please continue to
|
||||||
Please continue to send reports with the key
|
send reports with the key binding code to the Savannah
|
||||||
binding code to the Savannah page
|
page (https://savannah.gnu.org/bugs/?group=nano).
|
||||||
(https://savannah.gnu.org/bugs/?group=nano).
|
|
||||||
|
|
||||||
2008.03.18 - GNU nano 2.1.0 "under old mismanagement" is released.
|
2008.03.18 - GNU nano 2.1.0 "under old mismanagement" is released.
|
||||||
This first release in the 2.1 development series
|
This first release in the 2.1 development series
|
||||||
introduces rebindable keys for most actions inside
|
introduces rebindable keys for most actions inside
|
||||||
the editor. Please see the nanorc(5) page for
|
the editor. Please see the nanorc(5) page for more
|
||||||
more information on configuring key bindings. Please
|
information on configuring key bindings. Please
|
||||||
also report all keybinding bugs (crashes, missing
|
also report all keybinding bugs (crashes, missing
|
||||||
menu functions) using the Savannah bug tracker URL,
|
menu functions) using the Savannah bug tracker URL,
|
||||||
https://savannah.gnu.org/bugs/?group=nano and
|
https://savannah.gnu.org/bugs/?group=nano and
|
||||||
@@ -1099,7 +1258,7 @@
|
|||||||
|
|
||||||
2005.12.23 - GNU nano 1.3.10 rises to the surface. This release
|
2005.12.23 - GNU nano 1.3.10 rises to the surface. This release
|
||||||
contains several new features as well as fixes for
|
contains several new features as well as fixes for
|
||||||
several longstanding bugs. The former include the
|
several long-standing bugs. The former include the
|
||||||
ability to scroll up or down single lines without
|
ability to scroll up or down single lines without
|
||||||
scrolling the cursor, reworked bracket searching code
|
scrolling the cursor, reworked bracket searching code
|
||||||
that doesn't require regular expression support,
|
that doesn't require regular expression support,
|
||||||
@@ -1136,9 +1295,9 @@
|
|||||||
Have fun with it.
|
Have fun with it.
|
||||||
|
|
||||||
2005.06.30 - GNU nano 1.3.8 floats at its own level. This release
|
2005.06.30 - GNU nano 1.3.8 floats at its own level. This release
|
||||||
contains several new features. Among other things, you
|
contains several new features. Among other things,
|
||||||
can now move to a specified column number as well as
|
you can now move to a specified column number as well
|
||||||
line number within a file, file backups saved in a
|
as line number within a file, file backups saved in a
|
||||||
backup directory will have unique names, the search and
|
backup directory will have unique names, the search and
|
||||||
replace history routines should work more consistently,
|
replace history routines should work more consistently,
|
||||||
you can get a word count by pressing Meta-D at the edit
|
you can get a word count by pressing Meta-D at the edit
|
||||||
@@ -1149,8 +1308,8 @@
|
|||||||
screen updates, UTF-8 display, and flow control; a fix
|
screen updates, UTF-8 display, and flow control; a fix
|
||||||
for a segfault when displaying some lines ending with
|
for a segfault when displaying some lines ending with
|
||||||
tabs; better handling of constant cursor position
|
tabs; better handling of constant cursor position
|
||||||
display; improved color parsing in the rcfile; and
|
display; improved color parsing in the rcfile;
|
||||||
support for the "Regexp" toggle in tiny mode
|
and support for the "Regexp" toggle in tiny mode
|
||||||
(-R/--regexp is gone, and --restricted's short option
|
(-R/--regexp is gone, and --restricted's short option
|
||||||
has been changed to -R), among other things. Enjoy.
|
has been changed to -R), among other things. Enjoy.
|
||||||
|
|
||||||
@@ -1321,38 +1480,37 @@
|
|||||||
and enjoy GNU nano 1.2.0.
|
and enjoy GNU nano 1.2.0.
|
||||||
|
|
||||||
|
|
||||||
2003.02.13 - GNU nano 1.1.99pre3 "The last testing version, no
|
2003.02.13 - GNU nano 1.1.99pre3 "The last testing version, no really!"
|
||||||
really!" is released. This release includes fixes for
|
is released. This release includes fixes for wrapping
|
||||||
wrapping (again), resizing, color syntax highlighting,
|
(again), resizing, color syntax highlighting, rcfile
|
||||||
rcfile parsing, the mouse code, more memory leaks, and
|
parsing, the mouse code, more memory leaks, and some
|
||||||
some reversion of the code to get the user's home
|
reversion of the code to get the user's home directory
|
||||||
directory (nano will now again rely on $HOME). There
|
(nano will now again rely on $HOME). There are also
|
||||||
are also translation updates, a new manual page for the
|
translation updates, a new manual page for the nanorc
|
||||||
nanorc file, and an UPGRADE file detailing the changes
|
file, and an UPGRADE file detailing the changes since
|
||||||
since version 1.0. Please submit reports for any bugs
|
version 1.0. Please submit reports for any bugs you
|
||||||
you might find to the development team
|
might find to the development team (nano-devel@gnu.org),
|
||||||
(nano-devel@gnu.org), and enjoy nano almost-1.2.0 ;-)
|
and enjoy nano almost-1.2.0 ;-)
|
||||||
|
|
||||||
2003.02.03 - GNU nano 1.1.99pre2 "bugs in my pockets, bugs in my
|
2003.02.03 - GNU nano 1.1.99pre2 "bugs in my pockets, bugs in my shoes"
|
||||||
shoes" is released. There are, not surprisingly, only
|
is released. There are, not surprisingly, only bugfixes
|
||||||
bugfixes in this release as we move toward the stable
|
in this release as we move toward the stable 1.2.0
|
||||||
1.2.0 release. Fixes are included for translatable
|
release. Fixes are included for translatable string
|
||||||
string format, subexpression replacement, constant
|
format, subexpression replacement, constant cursor
|
||||||
cursor position, invalid search regexes, justify, screen
|
position, invalid search regexes, justify, screen state on
|
||||||
state on SIGHUP and SIGTERM, cutting to end cuts with
|
SIGHUP and SIGTERM, cutting to end cuts with long lines,
|
||||||
long lines, many file browser and operating directory
|
many file browser and operating directory bugs, memory and
|
||||||
bugs, memory and file descriptor leaks, marker code,
|
file descriptor leaks, marker code, spell checker, the
|
||||||
spell checker, the mouse code with long lines, multiple
|
mouse code with long lines, multiple buffers and non-file
|
||||||
buffers and non-file open errors, replacement string
|
open errors, replacement string length, and a silly but
|
||||||
length, and a silly but serious history message crash.
|
serious history message crash. There is also a drastic
|
||||||
There is also a drastic improvement in CPU utilization
|
improvement in CPU utilization for the color regex code.
|
||||||
for the color regex code.
|
Depending on the number of bugs found in this release,
|
||||||
Depending on the number of bugs found in this
|
there may be a 1.1.99pre3 or RC1, or just a 1.2.0 release.
|
||||||
release, there may be a 1.1.99pre3 or RC1, or just a
|
Most of the major bugs seem to have been worked out, so if
|
||||||
1.2.0 release. Most of the major bugs seem to have been
|
you are waiting for a good time to test nano before the
|
||||||
worked out, so if you are waiting for a good time to
|
official 1.2.0 release, this would be the one to use.
|
||||||
test nano before the official 1.2.0 release, this would
|
Happy bug hunting!
|
||||||
be the one to use. Happy bug hunting!
|
|
||||||
|
|
||||||
2003.01.17 - GNU nano 1.1.99pre1 "enough already" has been released.
|
2003.01.17 - GNU nano 1.1.99pre1 "enough already" has been released.
|
||||||
This release is, barring bug fixes and documentation
|
This release is, barring bug fixes and documentation
|
||||||
@@ -1413,19 +1571,19 @@
|
|||||||
word and next word, nanorc parser and line wrapping
|
word and next word, nanorc parser and line wrapping
|
||||||
code. Have fun!
|
code. Have fun!
|
||||||
|
|
||||||
2002.07.25 - At long last! GNU nano 1.1.10 "What didn't we break?" is
|
2002.07.25 - At long last! GNU nano 1.1.10 "What didn't we break?"
|
||||||
released. This version of GNU nano features version
|
is released. This version of GNU nano features version
|
||||||
0.11.2 of gettext, building with automake 1.6, some new
|
0.11.2 of gettext, building with automake 1.6, some new
|
||||||
code for displaying control characters, browser
|
code for displaying control characters, browser
|
||||||
improvements, a new backup file option (-B, --backup), a
|
improvements, a new backup file option (-B, --backup),
|
||||||
new option to ignore rc files (-I, --ignorercfiles),
|
a new option to ignore rc files (-I, --ignorercfiles),
|
||||||
compatibility with -pedantic, handling null characters
|
compatibility with -pedantic, handling null characters
|
||||||
before EOF, a slightly sportier nanorc.sample and more.
|
before EOF, a slightly sportier nanorc.sample and more.
|
||||||
Fixes are included for justification,
|
Fixes are included for justification, the reading
|
||||||
the reading and writing file routines, resizing and fill
|
and writing file routines, resizing and fill length,
|
||||||
length, millions of memory leaks, the usage screen was
|
millions of memory leaks, the usage screen was updated,
|
||||||
updated, and the --quotestr and --regexp really work
|
and the --quotestr and --regexp really work now ;-)
|
||||||
now ;-) Enjoy :)
|
Enjoy :)
|
||||||
|
|
||||||
2002.05.12 - GNU nano 1.1.9 is released, happy Mother's Day! This
|
2002.05.12 - GNU nano 1.1.9 is released, happy Mother's Day! This
|
||||||
release includes many new features, including a prepend
|
release includes many new features, including a prepend
|
||||||
@@ -1695,27 +1853,26 @@
|
|||||||
|
|
||||||
2000.11.23 - Happy Thanksgiving! Nano 0.9.21 is our "last version was
|
2000.11.23 - Happy Thanksgiving! Nano 0.9.21 is our "last version was
|
||||||
a big turkey" release. It fixes several bugs introduced
|
a big turkey" release. It fixes several bugs introduced
|
||||||
by the previous version, as well as a few long- standing
|
by the previous version, as well as a few long-standing
|
||||||
display bugs. All 0.9.20 users are strongly encouraged
|
display bugs. All 0.9.20 users are strongly encouraged
|
||||||
to upgrade to this release.
|
to upgrade to this release.
|
||||||
|
|
||||||
2000.11.18 - Nano 0.9.20 is finally out the door. Probably the biggest
|
2000.11.18 - Nano 0.9.20 is finally out the door. Probably the biggest
|
||||||
change is the brand new way nano displays previous
|
change is the brand new way nano displays previous search
|
||||||
search and replace strings (they are now editable!)
|
and replace strings (they are now editable!) This is a
|
||||||
This is a break from Pico's (inconsistent) interface, so
|
break from Pico's (inconsistent) interface, so if you
|
||||||
if you don't like the new way, "Pico" mode (-p on the
|
don't like the new way, "Pico" mode (-p on the command
|
||||||
command line or Meta-P within nano) still works the
|
line or Meta-P within nano) still works the "old" way.
|
||||||
"old" way.
|
|
||||||
Other new features include being able to deal with
|
Other new features include being able to deal with
|
||||||
search strings of any length, a new internal spell
|
search strings of any length, a new internal spell feature
|
||||||
feature (courtesy of Mr. Rocco Corsi) and tab completion
|
(courtesy of Mr. Rocco Corsi) and tab completion when
|
||||||
when reading in or writing out files! There's also the
|
reading in or writing out files! There's also the usual
|
||||||
usual billion or so bug fixes. Feedback on this release
|
billion or so bug fixes. Feedback on this release is
|
||||||
is welcome because so much has changed, especially with
|
welcome because so much has changed, especially with the
|
||||||
the previous string display in search and replace.
|
previous string display in search and replace. Email
|
||||||
Email -> nano@nano-editor.org <-. If you like
|
-> nano@nano-editor.org <-. If you like something,
|
||||||
something, don't like something, or just want to order a
|
don't like something, or just want to order a pizza,
|
||||||
pizza, let us know!
|
let us know!
|
||||||
|
|
||||||
2000.10.02 - Nano 0.9.19 is the "Chris is getting married in less than
|
2000.10.02 - Nano 0.9.19 is the "Chris is getting married in less than
|
||||||
a week and needs a distraction" release. There are only
|
a week and needs a distraction" release. There are only
|
||||||
@@ -1916,19 +2073,19 @@
|
|||||||
it is yours to take care of and keep up to date.
|
it is yours to take care of and keep up to date.
|
||||||
|
|
||||||
2000.03.01 - Well, to continue my trend of going back on my previous
|
2000.03.01 - Well, to continue my trend of going back on my previous
|
||||||
release's comments, nano 0.8.7 is released. The
|
release's comments, nano 0.8.7 is released. The crashing
|
||||||
crashing behavior was still occurring, and this most
|
behavior was still occurring, and this most recent fix
|
||||||
recent fix also fixes some other wrapping problems, so
|
also fixes some other wrapping problems, so here you go.
|
||||||
here you go. There may be another release soon, there
|
There may be another release soon, there may not be, is
|
||||||
may not be, is that vague enough? =)
|
that vague enough? =)
|
||||||
|
|
||||||
2000.02.25 - More minor bugfixes in 0.8.6, the bizarre behavior at the
|
2000.02.25 - More minor bugfixes in 0.8.6, the bizarre behavior at the
|
||||||
end of a page has ceased, thankfully. I'm also moving
|
end of a page has ceased, thankfully. I'm also moving
|
||||||
next weekend, so don't be shocked if you don't see a new
|
next weekend, so don't be shocked if you don't see a new
|
||||||
version of nano next week =-)
|
version of nano next week =-)
|
||||||
|
|
||||||
2000.02.11 - Okay, here we go again. Aside from a few minor fixes and
|
2000.02.11 - Okay, here we go again. Aside from a few minor fixes
|
||||||
some under-the-hood changes, you won't notice much
|
and some under-the-hood changes, you won't notice much
|
||||||
different in this version of nano. I haven't gotten
|
different in this version of nano. I haven't gotten
|
||||||
much feedback on the help feature, is it simply amazing
|
much feedback on the help feature, is it simply amazing
|
||||||
or does no one care? Write and let me know! =)
|
or does no one care? Write and let me know! =)
|
||||||
@@ -1943,23 +2100,22 @@
|
|||||||
address nano@asty.org for bugs, etc.
|
address nano@asty.org for bugs, etc.
|
||||||
|
|
||||||
2000.02.02 - Okay, I hate to go back on what I said in the last release,
|
2000.02.02 - Okay, I hate to go back on what I said in the last release,
|
||||||
but I may be changing jobs very soon. I will release
|
but I may be changing jobs very soon. I will release version
|
||||||
version 0.8.2 as is (no i18n, no help menu (yet)). I
|
0.8.2 as is (no i18n, no help menu (yet)). I expect things
|
||||||
expect things to settle down by the end of next week,
|
to settle down by the end of next week, and then I can try to
|
||||||
and then I can try to start on the i18n support and help
|
start on the i18n support and help menu; look for these new
|
||||||
menu; look for these new features in version 0.8.5 to
|
features in version 0.8.5 to 0.9.0.
|
||||||
0.9.0.
|
|
||||||
|
|
||||||
2000.01.28 - Nano 0.8.1 marks our first official step toward
|
2000.01.28 - Nano 0.8.1 marks our first official step toward
|
||||||
internationalization (i18n) and the help system (^G). I
|
internationalization (i18n) and the help system (^G).
|
||||||
will be merging in Jordi's patches for initial i18n in
|
I will be merging in Jordi's patches for initial i18n
|
||||||
the next version, and will implement the help system
|
in the next version, and will implement the help system
|
||||||
with i18n built into it shortly after that. Please
|
with i18n built into it shortly after that. Please
|
||||||
don't hesitate to send bug reports, as long as you're
|
don't hesitate to send bug reports, as long as you're
|
||||||
sure the fault lies with nano =-).
|
sure the fault lies with nano =-).
|
||||||
|
|
||||||
2000.01.25 - Nano 0.8.0 is officially the 'let's try and be at least a
|
2000.01.25 - Nano 0.8.0 is officially the "let's try and be at least
|
||||||
little portable, mmmmkay?' release. There are many
|
a little portable, mmmmkay?" release. There are many
|
||||||
portability checks and fixes; many thanks to Andy Kahn
|
portability checks and fixes; many thanks to Andy Kahn
|
||||||
for his patches. I removed the broken do_spell behavior
|
for his patches. I removed the broken do_spell behavior
|
||||||
with the 'spell' program; for now, we only try to call
|
with the 'spell' program; for now, we only try to call
|
||||||
@@ -1969,31 +2125,29 @@
|
|||||||
2000.01.24 - Nano 0.7.9 features many new features. Among them are a
|
2000.01.24 - Nano 0.7.9 features many new features. Among them are a
|
||||||
new autoindent feature (-i, --autoindent), tempfile flag
|
new autoindent feature (-i, --autoindent), tempfile flag
|
||||||
like Pico's -t flag (-t, --tempfile), and preliminary
|
like Pico's -t flag (-t, --tempfile), and preliminary
|
||||||
spelling program support. The spelling function tries
|
spelling program support. The spelling function tries to
|
||||||
to run 'spell' and then 'ispell' in that order, but you
|
run 'spell' and then 'ispell' in that order, but you can
|
||||||
can specify another spelling program with -s or
|
specify another spelling program with -s or --speller.
|
||||||
--speller.
|
|
||||||
|
|
||||||
2000.01.17 - Nano 0.7.7 is officially the 'way too much stuff changed this
|
2000.01.17 - Nano 0.7.7 is officially the "way too much stuff changed
|
||||||
release' release. It's the busy time at work for me, so
|
this release" release. It's the busy time at work for me,
|
||||||
please don't get offended if your patch doesn't get
|
so please don't get offended if your patch doesn't get
|
||||||
included in the next immediate version of nano. I'm
|
included in the next immediate version of nano. I'm sure
|
||||||
sure all the changes in this release will cause a few
|
all the changes in this release will cause a few bugs, so
|
||||||
bugs, so 0.7.8 will primarily be about fixing those
|
0.7.8 will primarily be about fixing those bugs.
|
||||||
bugs.
|
|
||||||
|
|
||||||
Things added this release include resizability (kinda),
|
Things added this release include resizability (kinda),
|
||||||
new -x and -c flags (see nano -h for help), long command
|
new -x and -c flags (see nano -h for help), long command
|
||||||
line flag support, and the usual array of bugfixes.
|
line flag support, and the usual array of bugfixes.
|
||||||
|
|
||||||
2000.01.15 - Nano 0.7.6 is officially the 'lightning' release. It now
|
2000.01.15 - Nano 0.7.6 is officially the "lightning" release.
|
||||||
loads large files much faster than previous versions,
|
It now loads large files much faster than previous
|
||||||
and is even much faster than Pico or vi in some rather
|
versions, and is even much faster than Pico or vi
|
||||||
rudimentary tests. Many thanks to Adam Rogoyski for the
|
in some rather rudimentary tests. Many thanks to
|
||||||
read_byte patch!
|
Adam Rogoyski for the read_byte patch!
|
||||||
|
|
||||||
2000.01.09 - As of this version (0.7.4), TIP has officially been renamed
|
2000.01.09 - As of this version (0.7.4), TIP has officially
|
||||||
to nano. The new homepage is at
|
been renamed to nano. The new homepage is at
|
||||||
http://faculty.plattsburgh.edu/astyanax/nano. Please
|
http://faculty.plattsburgh.edu/astyanax/nano.
|
||||||
update your bookmarks, tell your friends, and all that
|
Please update your bookmarks, tell your friends,
|
||||||
jazz.
|
and all that jazz.
|
||||||
|
|||||||
97
README
97
README
@@ -1,10 +1,42 @@
|
|||||||
|
|
||||||
GNU nano -- a simple editor, inspired by Pico
|
GNU nano -- a simple editor, inspired by Pico
|
||||||
|
|
||||||
Overview
|
Purpose
|
||||||
|
|
||||||
The nano project was started because of a few "problems" with the
|
Nano is a small and simple text editor for use on the terminal.
|
||||||
wonderfully easy-to-use and friendly Pico text editor.
|
It copied the interface and key bindings of the Pico editor but
|
||||||
|
added several missing features: undo/redo, syntax highlighting,
|
||||||
|
line numbers, softwrapping, multiple buffers, selecting text by
|
||||||
|
holding Shift, search-and-replace with regular expressions, and
|
||||||
|
several other conveniences.
|
||||||
|
|
||||||
|
Appearance
|
||||||
|
|
||||||
|
In rough ASCII graphics, this is what nano's screen looks like:
|
||||||
|
|
||||||
|
____________________________________________________________________
|
||||||
|
| GNU nano 7.2 filename Modified |
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
| This is the text window, displaying the contents of a 'buffer', |
|
||||||
|
| the contents of the file you are editing. |
|
||||||
|
| |
|
||||||
|
| The top row of the screen is the 'title bar'; it shows nano's |
|
||||||
|
| version, the name of the file, and whether you modified it. |
|
||||||
|
| The two bottom rows display the most important shortcuts; in |
|
||||||
|
| those lines ^ means Ctrl. The third row from the bottom shows |
|
||||||
|
| some feedback message, or gets replaced with a prompt bar when |
|
||||||
|
| you tell nano to do something that requires extra input. |
|
||||||
|
| |
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
| [ Some status message ] |
|
||||||
|
|^G Help ^O Write Out ^W Where Is ^K Cut ^T Execute |
|
||||||
|
|^X Exit ^R Read File ^\ Replace ^U Paste ^J Justify |
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
|
||||||
|
Origin
|
||||||
|
|
||||||
|
The nano project was started in 1999 because of a few "problems"
|
||||||
|
with the wonderfully easy-to-use and friendly Pico text editor.
|
||||||
|
|
||||||
First and foremost was its license: the Pine suite does not use
|
First and foremost was its license: the Pine suite does not use
|
||||||
the GPL, and (before using the Apache License) it had unclear
|
the GPL, and (before using the Apache License) it had unclear
|
||||||
@@ -23,9 +55,22 @@ Overview
|
|||||||
The nano editor is an official GNU package. For more information on
|
The nano editor is an official GNU package. For more information on
|
||||||
GNU and the Free Software Foundation, please see https://www.gnu.org/.
|
GNU and the Free Software Foundation, please see https://www.gnu.org/.
|
||||||
|
|
||||||
|
License
|
||||||
|
|
||||||
|
Nano's code and documentation are covered by the GPL version 3 or
|
||||||
|
(at your option) any later version, except for two functions that
|
||||||
|
were copied from busybox which are under a BSD license. Nano's
|
||||||
|
documentation is additionally covered by the GNU Free Documentation
|
||||||
|
License version 1.2 or (at your option) any later version. See the
|
||||||
|
files COPYING and COPYING.DOC for the full text of these licenses.
|
||||||
|
|
||||||
|
When in any file of this package a copyright notice mentions a
|
||||||
|
year range (such as 1999-2011), it is a shorthand for a list of
|
||||||
|
all the years in that interval.
|
||||||
|
|
||||||
How to compile and install nano
|
How to compile and install nano
|
||||||
|
|
||||||
Download the latest nano source tarball, then:
|
Download the latest nano source tarball, and then:
|
||||||
|
|
||||||
tar -xvf nano-x.y.tar.gz
|
tar -xvf nano-x.y.tar.gz
|
||||||
cd nano-x.y
|
cd nano-x.y
|
||||||
@@ -33,12 +78,13 @@ How to compile and install nano
|
|||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
|
|
||||||
It's that simple. Use --prefix with configure to override the
|
You will need the header files of ncurses installed for ./configure
|
||||||
default installation directory of /usr/local.
|
to succeed -- get them from libncurses-dev (Debian) or ncurses-devel
|
||||||
|
(Fedora) or a similarly named package. Use --prefix with ./configure
|
||||||
|
to override the default installation directory of /usr/local.
|
||||||
|
|
||||||
If you haven't configured with the --disable-nanorc option, after
|
After installation you may want to copy the doc/sample.nanorc file
|
||||||
installation you may want to copy the doc/sample.nanorc file to
|
to your home directory, rename it to ".nanorc", and then edit it
|
||||||
your home directory, rename it to ".nanorc", and then edit it
|
|
||||||
according to your taste.
|
according to your taste.
|
||||||
|
|
||||||
Web Page
|
Web Page
|
||||||
@@ -49,31 +95,28 @@ Mailing Lists
|
|||||||
|
|
||||||
There are three nano-related mailing-lists.
|
There are three nano-related mailing-lists.
|
||||||
|
|
||||||
+ info-nano@gnu.org is a very low traffic list used to announce
|
* <info-nano@gnu.org> is a very low traffic list used to announce
|
||||||
new nano versions or other important info about the project.
|
new nano versions or other important info about the project.
|
||||||
+ help-nano@gnu.org is for those seeking to get help without
|
|
||||||
|
* <help-nano@gnu.org> is for those seeking to get help without
|
||||||
wanting to hear about the technical details of its development.
|
wanting to hear about the technical details of its development.
|
||||||
+ nano-devel@gnu.org is the list used by the people that make nano
|
|
||||||
|
* <nano-devel@gnu.org> is the list used by the people that make nano
|
||||||
and a general development discussion list, with moderate traffic.
|
and a general development discussion list, with moderate traffic.
|
||||||
|
|
||||||
To subscribe, send email to <name>-request@gnu.org with a subject
|
To subscribe, send email to <name>-request@gnu.org with a subject
|
||||||
of "subscribe", where <name> is the list you want to subscribe to.
|
of "subscribe", where <name> is the list you want to subscribe to.
|
||||||
|
|
||||||
|
The archives of the development and help mailing lists are here:
|
||||||
|
|
||||||
|
https://lists.gnu.org/archive/html/nano-devel/
|
||||||
|
https://lists.gnu.org/archive/html/help-nano/
|
||||||
|
|
||||||
Bug Reports
|
Bug Reports
|
||||||
|
|
||||||
To report a bug, please file a description of the problem on nano's
|
If you find a bug, please file a detailed description of the problem
|
||||||
bug tracker (https://savannah.gnu.org/bugs/?group=nano -- hover on
|
on nano's issue tracker: https://savannah.gnu.org/bugs/?group=nano
|
||||||
"Bugs", then click "Submit new"). The issue may have already been
|
(you will need an account to be able to do so), or send an email
|
||||||
reported, so please look first.
|
to the nano-devel list (no need to subscribe, but mention it if
|
||||||
|
you want to be CC'ed on an answer).
|
||||||
|
|
||||||
Current Status
|
|
||||||
|
|
||||||
Since version 2.5.0, GNU nano has abandoned the distinction between
|
|
||||||
a stable and a development branch: it is now on a "rolling" release
|
|
||||||
-- fixing bugs and adding new features go hand in hand.
|
|
||||||
|
|
||||||
Copyright Years
|
|
||||||
|
|
||||||
When in any file of this package a copyright notice mentions a
|
|
||||||
year range (such as 1999-2011), it is a shorthand for a list of
|
|
||||||
all the years in that interval.
|
|
||||||
|
|||||||
@@ -8,35 +8,34 @@ building this needs a bit more care than the official tarballs.
|
|||||||
Prerequisites
|
Prerequisites
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
To successfully compile GNU nano from git, you'll need the following
|
To successfully compile GNU nano from git, you'll need the following:
|
||||||
packages:
|
|
||||||
|
|
||||||
- autoconf (version >= 2.69)
|
autoconf (version >= 2.69)
|
||||||
- automake (version >= 1.14)
|
automake (version >= 1.14)
|
||||||
- autopoint (version >= 0.18.3)
|
autopoint (version >= 0.18.3)
|
||||||
- gcc (version >= 5.0)
|
gcc (version >= 5.0)
|
||||||
- gettext (version >= 0.18.3)
|
gettext (version >= 0.18.3)
|
||||||
- git (version >= 2.7.4)
|
git (version >= 2.7.4)
|
||||||
- groff (version >= 1.12)
|
groff (version >= 1.12)
|
||||||
- make (any version)
|
make (any version)
|
||||||
- pkg-config (version >= 0.22)
|
pkg-config (version >= 0.22)
|
||||||
- texinfo (version >= 4.0)
|
texinfo (version >= 4.0)
|
||||||
|
|
||||||
If you want UTF-8 support, you will also need libncursesw5-dev installed
|
You will also need to have the header files for ncurses installed,
|
||||||
(version >= 5.7), or libslang2-dev (version >= 2.0) if you use --with-slang.
|
from libncurses-dev on Debian, ncurses-devel on Fedora, or similar.
|
||||||
|
|
||||||
These should all be available in your distro's package manager or software
|
These should all be available in your distro's package manager or
|
||||||
center, or otherwise on any GNU mirror.
|
software center, or otherwise on any GNU mirror.
|
||||||
|
|
||||||
|
|
||||||
Download the source
|
Clone the source
|
||||||
-------------------
|
----------------
|
||||||
|
|
||||||
To obtain the current nano development branch (called 'master'), use the
|
To obtain the current nano development branch (called 'master'), use the
|
||||||
following command. It will create in your current working directory a
|
following command. It will create in your current working directory a
|
||||||
subdirectory called 'nano' containing a copy of all of the files:
|
subdirectory called 'nano' containing a copy of all of the files:
|
||||||
|
|
||||||
$ git clone git://git.savannah.gnu.org/nano.git nano
|
$ git clone git://git.savannah.gnu.org/nano.git
|
||||||
|
|
||||||
|
|
||||||
Generate the configure script
|
Generate the configure script
|
||||||
@@ -114,3 +113,11 @@ to include 'set tabsize 4', or you could use -T4 on the command line.
|
|||||||
To make git display things as intended, you can do:
|
To make git display things as intended, you can do:
|
||||||
|
|
||||||
$ git config --local core.pager "less -x1,5"
|
$ git config --local core.pager "less -x1,5"
|
||||||
|
|
||||||
|
To see all types that are used in nano's source code colorized as types,
|
||||||
|
you can add these lines to your ~/.nanorc:
|
||||||
|
|
||||||
|
extendsyntax c color green "\<struct (dirent|option|passwd)\>"
|
||||||
|
extendsyntax c color green "\<struct (sigaction|stat|termios)\>"
|
||||||
|
extendsyntax c color green "\<struct (timespec|vt_stat|winsize)\>"
|
||||||
|
extendsyntax c color green "\<([[:lower:]_]+(struct|type)|va_list)\>"
|
||||||
6
THANKS
6
THANKS
@@ -6,8 +6,9 @@ Translations:
|
|||||||
============
|
============
|
||||||
Pedro Albuquerque <palbuquerque73@gmail.com> Portuguese
|
Pedro Albuquerque <palbuquerque73@gmail.com> Portuguese
|
||||||
Josef Andersson <josef.andersson@fripost.org> Swedish
|
Josef Andersson <josef.andersson@fripost.org> Swedish
|
||||||
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian
|
|
||||||
Mario Blättermann <mario.blaettermann@gmail.com> German
|
Mario Blättermann <mario.blaettermann@gmail.com> German
|
||||||
|
Besnik Bleta <besnik@programeshqip.org> Albanian
|
||||||
|
Laurențiu Buzdugan <buzdugan@voyager.net> Romanian
|
||||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish
|
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish
|
||||||
Antonio Ceballos <aceballos@gmail.com> Spanish
|
Antonio Ceballos <aceballos@gmail.com> Spanish
|
||||||
Wei-Lun CHAO <chaoweilun@pcmail.com.tw> Chinese (traditional)
|
Wei-Lun CHAO <chaoweilun@pcmail.com.tw> Chinese (traditional)
|
||||||
@@ -18,6 +19,8 @@ Mihai Cristescu <mihai.cristescu@archlinux.info> Romanian
|
|||||||
Yavor Doganov <yavor@doganov.org> Bulgarian
|
Yavor Doganov <yavor@doganov.org> Bulgarian
|
||||||
Karl Eichwalder <keichwa@gmx.net> German
|
Karl Eichwalder <keichwa@gmx.net> German
|
||||||
A. Murat EREN <meren@comu.edu.tr> Turkish
|
A. Murat EREN <meren@comu.edu.tr> Turkish
|
||||||
|
Sveinn í Felli <sv1@fellsnet.is> Icelandic
|
||||||
|
Marek Felšöci <marek@felsoci.sk> Slovak
|
||||||
Doruk Fisek <dfisek@fisek.com.tr> Turkish
|
Doruk Fisek <dfisek@fisek.com.tr> Turkish
|
||||||
Rafael Fontenelle <rffontenelle@gmail.com> Brazilian Portuguese
|
Rafael Fontenelle <rffontenelle@gmail.com> Brazilian Portuguese
|
||||||
Pavel Fric <pavelfric@seznam.cz> Czech
|
Pavel Fric <pavelfric@seznam.cz> Czech
|
||||||
@@ -73,6 +76,7 @@ Johnny A. Solbu <johnny@solbu.net> Norwegian Bokmål
|
|||||||
Pierre Tane <tanep@bigfoot.com> French
|
Pierre Tane <tanep@bigfoot.com> French
|
||||||
Yasuaki Taniguchi <yasuakit@gmail.com> Japanese
|
Yasuaki Taniguchi <yasuakit@gmail.com> Japanese
|
||||||
Jacobo Tarrío <jtarrio@trasno.net> Galician
|
Jacobo Tarrío <jtarrio@trasno.net> Galician
|
||||||
|
Andika Triwidada <andika@gmail.com> Indonesian
|
||||||
Francisco Javier Tsao Santín <tsao@members.fsf.org> Galician
|
Francisco Javier Tsao Santín <tsao@members.fsf.org> Galician
|
||||||
Balázs Úr <urbalazs@gmail.com> Hungarian
|
Balázs Úr <urbalazs@gmail.com> Hungarian
|
||||||
Miquel Vidal <miquel@sindominio.net> Catalan
|
Miquel Vidal <miquel@sindominio.net> Catalan
|
||||||
|
|||||||
27
autogen.sh
27
autogen.sh
@@ -2,7 +2,7 @@
|
|||||||
# Generate configure & friends for GIT users.
|
# Generate configure & friends for GIT users.
|
||||||
|
|
||||||
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
||||||
gnulib_hash="50bf1b6fe4fe406568884bce97ddcff935571a0a"
|
gnulib_hash="2cf7f442f52f70b3df6eb396eb93ea08e54883c5"
|
||||||
|
|
||||||
modules="
|
modules="
|
||||||
futimens
|
futimens
|
||||||
@@ -13,6 +13,7 @@ modules="
|
|||||||
isblank
|
isblank
|
||||||
iswblank
|
iswblank
|
||||||
lstat
|
lstat
|
||||||
|
mkstemps
|
||||||
nl_langinfo
|
nl_langinfo
|
||||||
regex
|
regex
|
||||||
sigaction
|
sigaction
|
||||||
@@ -35,14 +36,26 @@ fi
|
|||||||
cd gnulib >/dev/null || exit 1
|
cd gnulib >/dev/null || exit 1
|
||||||
curr_hash=$(git log -1 --format=%H)
|
curr_hash=$(git log -1 --format=%H)
|
||||||
if [ "${gnulib_hash}" != "${curr_hash}" ]; then
|
if [ "${gnulib_hash}" != "${curr_hash}" ]; then
|
||||||
|
echo "Pulling..."
|
||||||
git pull
|
git pull
|
||||||
git checkout -f ${gnulib_hash}
|
git checkout --force ${gnulib_hash}
|
||||||
fi
|
fi
|
||||||
cd .. >/dev/null || exit 1
|
cd .. >/dev/null || exit 1
|
||||||
|
|
||||||
rm -rf lib
|
echo "Autopoint..."
|
||||||
./gnulib/gnulib-tool \
|
autopoint --force
|
||||||
--import \
|
|
||||||
${modules}
|
|
||||||
|
|
||||||
autoreconf -f -i -s
|
rm -rf lib
|
||||||
|
echo "Gnulib-tool..."
|
||||||
|
./gnulib/gnulib-tool --import ${modules}
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "Aclocal..."
|
||||||
|
aclocal -I m4
|
||||||
|
echo "Autoconf..."
|
||||||
|
autoconf
|
||||||
|
echo "Autoheader..."
|
||||||
|
autoheader
|
||||||
|
echo "Automake..."
|
||||||
|
automake --add-missing
|
||||||
|
echo "Done."
|
||||||
|
|||||||
404
configure.ac
404
configure.ac
@@ -1,6 +1,6 @@
|
|||||||
# Configuration for GNU nano - a small and user-friendly text editor
|
# Configuration for GNU nano - a small and user-friendly text editor
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc.
|
# Copyright (C) 1999-2011, 2013-2023 Free Software Foundation, Inc.
|
||||||
# Copyright (C) 2014, 2017 Mike Frysinger
|
# Copyright (C) 2014, 2017 Mike Frysinger
|
||||||
#
|
#
|
||||||
# GNU nano is free software: you can redistribute it and/or modify
|
# GNU nano is free software: you can redistribute it and/or modify
|
||||||
@@ -16,10 +16,11 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see https://www.gnu.org/licenses/.
|
# along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
|
|
||||||
AC_INIT([GNU nano], [5.1], [nano-devel@gnu.org], [nano])
|
AC_INIT([GNU nano], [7.2], [nano-devel@gnu.org], [nano])
|
||||||
AC_CONFIG_SRCDIR([src/nano.c])
|
AC_CONFIG_SRCDIR([src/nano.c])
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
AM_INIT_AUTOMAKE([1.14])
|
AM_INIT_AUTOMAKE([1.14])
|
||||||
|
AM_MAINTAINER_MODE([enable])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
|
||||||
dnl Make sure the ONCE macros are available.
|
dnl Make sure the ONCE macros are available.
|
||||||
@@ -36,12 +37,12 @@ gl_cv_glob_lists_symlinks=yes
|
|||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
|
|
||||||
AC_GNU_SOURCE
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
gl_EARLY
|
gl_EARLY
|
||||||
gl_INIT
|
gl_INIT
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_ISC_POSIX
|
AC_SEARCH_LIBS([strerror], [cposix])
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
PKG_PROG_PKG_CONFIG
|
PKG_PROG_PKG_CONFIG
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
|
|||||||
dnl Whether this is a git repository.
|
dnl Whether this is a git repository.
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether building from git])
|
AC_MSG_CHECKING([whether building from git])
|
||||||
if test -f roll-a-release.sh ; then
|
if test -f "$srcdir/roll-a-release.sh" ; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
from_git=yes
|
from_git=yes
|
||||||
else
|
else
|
||||||
@@ -73,14 +74,14 @@ dnl Checks for pkg-config and gettext when building from git.
|
|||||||
if test x$from_git = xyes; then
|
if test x$from_git = xyes; then
|
||||||
if test ! -f $(aclocal --print-ac-dir)/pkg.m4; then
|
if test ! -f $(aclocal --print-ac-dir)/pkg.m4; then
|
||||||
AC_MSG_ERROR([
|
AC_MSG_ERROR([
|
||||||
*** The pkg.m4 macros are missing. ***
|
*** The pkg.m4 macros are missing.
|
||||||
*** The pkg-config package needs to be installed when building from git. ***
|
*** The pkg-config package needs to be installed when building from git.
|
||||||
*** After fixing this problem, rerun ./autogen.sh. ***])
|
*** After fixing this problem, rerun ./autogen.sh.])
|
||||||
fi
|
fi
|
||||||
if test "$ac_cv_path_MSGFMT" = ":"; then
|
if test "$ac_cv_path_MSGFMT" = ":"; then
|
||||||
AC_MSG_ERROR([
|
AC_MSG_ERROR([
|
||||||
*** The msgfmt program is missing. ***
|
*** The msgfmt program is missing.
|
||||||
*** The gettext package needs to be installed when building from git. ***])
|
*** The gettext package needs to be installed when building from git.])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -90,12 +91,6 @@ AC_CHECK_HEADERS(libintl.h limits.h pwd.h termios.h sys/param.h)
|
|||||||
|
|
||||||
dnl Checks for options.
|
dnl Checks for options.
|
||||||
|
|
||||||
if test "x$with_slang" = xyes; then
|
|
||||||
if test "x$enable_tiny" != xyes; then
|
|
||||||
AC_MSG_ERROR([--with-slang is supported only together with --enable-tiny])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(browser,
|
AC_ARG_ENABLE(browser,
|
||||||
AS_HELP_STRING([--disable-browser], [Disable the built-in file browser]))
|
AS_HELP_STRING([--disable-browser], [Disable the built-in file browser]))
|
||||||
if test "x$enable_tiny" = xyes; then
|
if test "x$enable_tiny" = xyes; then
|
||||||
@@ -112,7 +107,8 @@ AS_HELP_STRING([--disable-color], [Disable color and syntax highlighting]))
|
|||||||
if test "x$enable_tiny" = xyes; then
|
if test "x$enable_tiny" = xyes; then
|
||||||
if test "x$enable_color" = xyes; then
|
if test "x$enable_color" = xyes; then
|
||||||
if test "x$enable_nanorc" != xyes; then
|
if test "x$enable_nanorc" != xyes; then
|
||||||
AC_MSG_ERROR([--enable-color needs --enable-nanorc to work])
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-color needs --enable-nanorc to work])
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
enable_color=no
|
enable_color=no
|
||||||
@@ -120,7 +116,8 @@ if test "x$enable_tiny" = xyes; then
|
|||||||
fi
|
fi
|
||||||
if test "x$enable_nanorc" = xno; then
|
if test "x$enable_nanorc" = xno; then
|
||||||
if test "x$enable_color" = xyes; then
|
if test "x$enable_color" = xyes; then
|
||||||
AC_MSG_ERROR([--enable-color cannot work with --disable-nanorc])
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-color cannot work with --disable-nanorc])
|
||||||
else
|
else
|
||||||
# Disabling nanorc silently disables color support.
|
# Disabling nanorc silently disables color support.
|
||||||
enable_color=no
|
enable_color=no
|
||||||
@@ -131,11 +128,26 @@ if test "x$enable_color" != xno; then
|
|||||||
color_support=yes
|
color_support=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(folding,
|
||||||
|
AS_HELP_STRING([--disable-folding], [Disable line folding support]))
|
||||||
|
if test "x$enable_tiny" = xyes; then
|
||||||
|
if test "x$enable_folding" = xyes; then
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-folding cannot work with --enable-tiny])
|
||||||
|
else
|
||||||
|
enable_folding=no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "x$enable_folding" != xno; then
|
||||||
|
AC_DEFINE(ENABLE_FOLDING, 1, [Define this to have line folding support.])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(comment,
|
AC_ARG_ENABLE(comment,
|
||||||
AS_HELP_STRING([--disable-comment], [Disable the comment/uncomment function]))
|
AS_HELP_STRING([--disable-comment], [Disable the comment/uncomment function]))
|
||||||
if test "x$enable_tiny" = xyes; then
|
if test "x$enable_tiny" = xyes; then
|
||||||
if test "x$enable_comment" = xyes; then
|
if test "x$enable_comment" = xyes; then
|
||||||
AC_MSG_ERROR([--enable-comment cannot work with --enable-tiny])
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-comment cannot work with --enable-tiny])
|
||||||
else
|
else
|
||||||
enable_comment=no
|
enable_comment=no
|
||||||
fi
|
fi
|
||||||
@@ -155,12 +167,37 @@ if test "x$enable_extra" != xno; then
|
|||||||
AC_DEFINE(ENABLE_EXTRA, 1, [Define this to have an Easter egg.])
|
AC_DEFINE(ENABLE_EXTRA, 1, [Define this to have an Easter egg.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(formatter,
|
||||||
|
AS_HELP_STRING([--disable-formatter], [Disable the formatting tool]))
|
||||||
|
if test "x$enable_tiny" = xyes; then
|
||||||
|
if test "x$enable_formatter" = xyes; then
|
||||||
|
if test "x$enable_color" != xyes; then
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-formatter needs both --enable-color and --enable-nanorc to work])
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
enable_formatter=no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "x$enable_color" = xno; then
|
||||||
|
if test "x$enable_formatter" = xyes; then
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-formatter cannot work with --disable-color nor --disable-nanorc])
|
||||||
|
else
|
||||||
|
enable_formatter=no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "x$enable_formatter" != xno; then
|
||||||
|
AC_DEFINE(ENABLE_FORMATTER, 1, [Define this to have access to a formatter.])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(help,
|
AC_ARG_ENABLE(help,
|
||||||
AS_HELP_STRING([--disable-help], [Disable the built-in help texts]))
|
AS_HELP_STRING([--disable-help], [Disable the built-in help texts]))
|
||||||
if test "x$enable_tiny" = xyes; then
|
if test "x$enable_tiny" = xyes; then
|
||||||
if test "x$enable_help" = xyes; then
|
if test "x$enable_help" = xyes; then
|
||||||
if test "x$enable_multibuffer" != xyes; then
|
if test "x$enable_multibuffer" != xyes; then
|
||||||
AC_MSG_ERROR([--enable-help needs --enable-multibuffer to work])
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-help needs --enable-multibuffer to work])
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
enable_help=no
|
enable_help=no
|
||||||
@@ -168,7 +205,8 @@ if test "x$enable_tiny" = xyes; then
|
|||||||
fi
|
fi
|
||||||
if test "x$enable_multibuffer" = xno; then
|
if test "x$enable_multibuffer" = xno; then
|
||||||
if test "x$enable_help" = xyes; then
|
if test "x$enable_help" = xyes; then
|
||||||
AC_MSG_ERROR([--enable-help cannot work with --disable-multibuffer])
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-help cannot work with --disable-multibuffer])
|
||||||
else
|
else
|
||||||
# Disabling multibuffer silently disables the help texts.
|
# Disabling multibuffer silently disables the help texts.
|
||||||
enable_help=no
|
enable_help=no
|
||||||
@@ -202,6 +240,42 @@ fi
|
|||||||
|
|
||||||
AC_ARG_ENABLE(libmagic,
|
AC_ARG_ENABLE(libmagic,
|
||||||
AS_HELP_STRING([--disable-libmagic], [Disable detection of file types via libmagic]))
|
AS_HELP_STRING([--disable-libmagic], [Disable detection of file types via libmagic]))
|
||||||
|
if test "x$enable_libmagic" = xyes; then
|
||||||
|
if test "x$enable_tiny" = xyes; then
|
||||||
|
if test "x$enable_color" != xyes; then
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-libmagic needs both --enable-color and --enable-nanorc to work])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "x$enable_color" = xno; then
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-libmagic cannot work with --disable-color nor --disable-nanorc])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(linter,
|
||||||
|
AS_HELP_STRING([--disable-linter], [Disable the linting tool]))
|
||||||
|
if test "x$enable_tiny" = xyes; then
|
||||||
|
if test "x$enable_linter" = xyes; then
|
||||||
|
if test "x$enable_color" != xyes; then
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-linter needs both --enable-color and --enable-nanorc to work])
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
enable_linter=no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "x$enable_color" = xno; then
|
||||||
|
if test "x$enable_linter" = xyes; then
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-linter cannot work with --disable-color nor --disable-nanorc])
|
||||||
|
else
|
||||||
|
enable_linter=no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "x$enable_linter" != xno; then
|
||||||
|
AC_DEFINE(ENABLE_LINTER, 1, [Define this to have access to a linter.])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(linenumbers,
|
AC_ARG_ENABLE(linenumbers,
|
||||||
AS_HELP_STRING([--disable-linenumbers], [Disable line numbering]))
|
AS_HELP_STRING([--disable-linenumbers], [Disable line numbering]))
|
||||||
@@ -260,14 +334,14 @@ if test "x$enable_operatingdir" != xno; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(speller,
|
AC_ARG_ENABLE(speller,
|
||||||
AS_HELP_STRING([--disable-speller], [Disable the spell-checker functions]))
|
AS_HELP_STRING([--disable-speller], [Disable the spell-checking tool]))
|
||||||
if test "x$enable_tiny" = xyes; then
|
if test "x$enable_tiny" = xyes; then
|
||||||
if test "x$enable_speller" != xyes; then
|
if test "x$enable_speller" != xyes; then
|
||||||
enable_speller=no
|
enable_speller=no
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if test "x$enable_speller" != xno; then
|
if test "x$enable_speller" != xno; then
|
||||||
AC_DEFINE(ENABLE_SPELLER, 1, [Define this to have the spell-checker functions.])
|
AC_DEFINE(ENABLE_SPELLER, 1, [Define this to have access to a spell checker.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(tabcomp,
|
AC_ARG_ENABLE(tabcomp,
|
||||||
@@ -285,7 +359,8 @@ AC_ARG_ENABLE(wordcomp,
|
|||||||
AS_HELP_STRING([--disable-wordcomp], [Disable the word-completion function]))
|
AS_HELP_STRING([--disable-wordcomp], [Disable the word-completion function]))
|
||||||
if test "x$enable_tiny" = xyes; then
|
if test "x$enable_tiny" = xyes; then
|
||||||
if test "x$enable_wordcomp" = xyes; then
|
if test "x$enable_wordcomp" = xyes; then
|
||||||
AC_MSG_ERROR([--enable-wordcomp cannot work with --enable-tiny])
|
AC_MSG_ERROR([
|
||||||
|
*** --enable-wordcomp cannot work with --enable-tiny])
|
||||||
else
|
else
|
||||||
enable_wordcomp=no
|
enable_wordcomp=no
|
||||||
fi
|
fi
|
||||||
@@ -335,209 +410,19 @@ AS_HELP_STRING([--enable-altrcname], [Specify an alternate rcfile name (default:
|
|||||||
AC_DEFINE_UNQUOTED(RCFILE_NAME, "$enableval", [Specify an alternate rcfile name (default: .nanorc).]) rcfilename=$enableval
|
AC_DEFINE_UNQUOTED(RCFILE_NAME, "$enableval", [Specify an alternate rcfile name (default: .nanorc).]) rcfilename=$enableval
|
||||||
fi])
|
fi])
|
||||||
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to use slang])
|
|
||||||
CURSES_LIB_NAME=""
|
|
||||||
AC_ARG_WITH(slang,
|
|
||||||
AS_HELP_STRING([--with-slang[=DIR]], [Use the slang library instead of curses]),
|
|
||||||
[ case "$with_slang" in
|
|
||||||
no)
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
# Add additional search path.
|
|
||||||
LDFLAGS="-L$with_slang/lib $LDFLAGS"
|
|
||||||
CPPFLAGS="-I$with_slang/include $CPPFLAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x$enable_utf8" != xno; then
|
|
||||||
AC_CHECK_HEADER(slcurses.h,
|
|
||||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang])
|
|
||||||
_libs=$LIBS
|
|
||||||
LIBS="$LIBS -lslang"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLutf8_enable(1);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
|
|
||||||
CURSES_LIB_WIDE=yes
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)
|
|
||||||
|
|
||||||
# We might need the term library.
|
|
||||||
for termlib in ncurses curses termcap terminfo termlib; do
|
|
||||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
|
||||||
test -n "$tcap" && break
|
|
||||||
done
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
|
|
||||||
LIBS="$LIBS $tcap"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLutf8_enable(1);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
|
|
||||||
CURSES_LIB_WIDE=yes
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang $tcap"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)
|
|
||||||
|
|
||||||
# We might need the math library.
|
|
||||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
|
|
||||||
LIBS="$LIBS -lm"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLutf8_enable(1);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
|
|
||||||
CURSES_LIB_WIDE=yes
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang $tcap -lm"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
|
||||||
AC_MSG_ERROR([
|
|
||||||
*** The header file slcurses.h was not found. This header file
|
|
||||||
*** is required if you wish to use Slang support. Please either
|
|
||||||
*** install a version of Slang that includes the slcurses.h file
|
|
||||||
*** or do not call the configure script with --with-slang.]))
|
|
||||||
fi
|
|
||||||
|
|
||||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
|
||||||
# Reset libs if the above slang tests failed.
|
|
||||||
if test "x$enable_utf8" != xno; then
|
|
||||||
LIBS=$_libs
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CHECK_HEADER(slcurses.h,
|
|
||||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
|
|
||||||
_libs=$LIBS
|
|
||||||
LIBS="$LIBS -lslang"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLtt_initialize(NULL);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)
|
|
||||||
|
|
||||||
# We might need the term library.
|
|
||||||
for termlib in ncurses curses termcap terminfo termlib; do
|
|
||||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
|
||||||
test -n "$tcap" && break
|
|
||||||
done
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
|
|
||||||
LIBS="$LIBS $tcap"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLtt_initialize(NULL);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang $tcap"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)
|
|
||||||
|
|
||||||
# We might need the math library.
|
|
||||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
|
||||||
LIBS="$LIBS -lm"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLtt_initialize(NULL);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define this to use the slang wrappers for curses instead of native curses.])
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang $tcap -lm"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
|
||||||
AC_MSG_ERROR([
|
|
||||||
*** The header file slcurses.h was not found. This header file
|
|
||||||
*** is required if you wish to use Slang support. Please either
|
|
||||||
*** install a version of Slang that includes the slcurses.h file
|
|
||||||
*** or do not call the configure script with --with-slang.]))
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "${_libs+set}" = "set"; then
|
|
||||||
LIBS=$_libs
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
LDFLAGS=${_ldflags}
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac], [AC_MSG_RESULT(no)])
|
|
||||||
|
|
||||||
dnl Checks for functions.
|
dnl Checks for functions.
|
||||||
|
|
||||||
if test "x$enable_utf8" != xno; then
|
if test "x$enable_utf8" != xno; then
|
||||||
AC_CHECK_FUNCS(iswalnum iswpunct mblen mbstowcs mbtowc wctomb)
|
AC_CHECK_FUNCS(iswalpha iswalnum iswpunct mbstowcs wctomb)
|
||||||
fi
|
fi
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
||||||
|
AC_CHECK_FUNCS_ONCE(chmod chown fchmod fchown flockfile funlockfile
|
||||||
|
fork fsync geteuid pipe wait waitpid)
|
||||||
|
|
||||||
dnl Checks for available flags.
|
dnl Checks for available flags.
|
||||||
|
|
||||||
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"], [], [])
|
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"], [], [])
|
||||||
|
|
||||||
dnl Checks for library functions.
|
|
||||||
|
|
||||||
AC_TYPE_SIGNAL
|
|
||||||
|
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
|
|
||||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||||
@@ -567,9 +452,9 @@ if eval "test x$CURSES_LIB_NAME = x"; then
|
|||||||
CURSES_LIB=`$NCURSESW_CONFIG --libs`
|
CURSES_LIB=`$NCURSESW_CONFIG --libs`
|
||||||
LIBS="$CURSES_LIB $LIBS"
|
LIBS="$CURSES_LIB $LIBS"
|
||||||
CPPFLAGS="`$NCURSESW_CONFIG --cflags` $CPPFLAGS"
|
CPPFLAGS="`$NCURSESW_CONFIG --cflags` $CPPFLAGS"
|
||||||
AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
AC_CHECK_LIB(ncursesw, wget_wch, [CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||||
else
|
else
|
||||||
AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
AC_CHECK_LIB(ncursesw, wget_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||||
fi
|
fi
|
||||||
LIBS="$OLDLIBS"
|
LIBS="$OLDLIBS"
|
||||||
fi
|
fi
|
||||||
@@ -583,7 +468,7 @@ if eval "test x$CURSES_LIB_NAME = x"; then
|
|||||||
AC_CHECK_HEADERS(curses.h)
|
AC_CHECK_HEADERS(curses.h)
|
||||||
|
|
||||||
if test "x$enable_utf8" != xno; then
|
if test "x$enable_utf8" != xno; then
|
||||||
AC_CHECK_LIB(curses, get_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE=yes])
|
AC_CHECK_LIB(curses, wget_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE=yes])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||||
@@ -594,7 +479,7 @@ fi
|
|||||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||||
AC_MSG_ERROR([
|
AC_MSG_ERROR([
|
||||||
*** No curses lib was found. Please install the curses header files
|
*** No curses lib was found. Please install the curses header files
|
||||||
*** from libncursesw5-dev (Debian), ncurses-devel (Fedora), or similar.
|
*** from libncurses-dev (Debian), ncurses-devel (Fedora), or similar.
|
||||||
*** (Or install ncurses from https://ftp.gnu.org/gnu/ncurses/.)])
|
*** (Or install ncurses from https://ftp.gnu.org/gnu/ncurses/.)])
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([ The curses library to be used is: $CURSES_LIB_NAME])
|
AC_MSG_RESULT([ The curses library to be used is: $CURSES_LIB_NAME])
|
||||||
@@ -610,36 +495,31 @@ AC_CHECK_LIB([$CURSES_LIB_NAME], [key_defined],
|
|||||||
[AC_DEFINE(HAVE_KEY_DEFINED, 1, [Define this if your curses library has the key_defined() function.])],
|
[AC_DEFINE(HAVE_KEY_DEFINED, 1, [Define this if your curses library has the key_defined() function.])],
|
||||||
[], [$CURSES_LIB])
|
[], [$CURSES_LIB])
|
||||||
|
|
||||||
dnl Parse any configure options.
|
|
||||||
|
|
||||||
LIBS="$LIBS $CURSES_LIB"
|
LIBS="$LIBS $CURSES_LIB"
|
||||||
|
|
||||||
AC_SUBST(CURSES_LIB)
|
AC_SUBST(CURSES_LIB)
|
||||||
|
|
||||||
if test "x$enable_utf8" != xno && \
|
if test "x$enable_utf8" != xno && \
|
||||||
test x$CURSES_LIB_WIDE = xyes && \
|
test x$CURSES_LIB_WIDE = xyes && \
|
||||||
|
test x$ac_cv_func_iswalpha = xyes && \
|
||||||
test x$ac_cv_func_iswalnum = xyes && \
|
test x$ac_cv_func_iswalnum = xyes && \
|
||||||
test x$ac_cv_func_iswpunct = xyes && \
|
test x$ac_cv_func_iswpunct = xyes && \
|
||||||
test x$ac_cv_func_mblen = xyes && \
|
|
||||||
test x$ac_cv_func_mbstowcs = xyes && \
|
test x$ac_cv_func_mbstowcs = xyes && \
|
||||||
test x$ac_cv_func_mbtowc = xyes && \
|
|
||||||
test x$ac_cv_func_wctomb = xyes; then
|
test x$ac_cv_func_wctomb = xyes; then
|
||||||
AC_DEFINE(ENABLE_UTF8, 1, [Define this if your system has sufficient UTF-8 support.])
|
AC_DEFINE(ENABLE_UTF8, 1, [Define this if your system has sufficient UTF-8 support.])
|
||||||
else
|
else
|
||||||
if test "x$enable_utf8" = xyes; then
|
if test "x$enable_utf8" = xyes; then
|
||||||
AC_MSG_ERROR([
|
AC_MSG_ERROR([
|
||||||
*** UTF-8 support was requested, but insufficient UTF-8 support was
|
*** UTF-8 support was requested, but insufficient support was
|
||||||
*** detected in your curses and/or C libraries. Please verify that
|
*** detected in your curses and/or C libraries. Please verify
|
||||||
*** your Slang was built with UTF-8 support or your curses was built
|
*** that both your curses library and your C library were built
|
||||||
*** with wide-character support, and that your C library was built
|
|
||||||
*** with wide-character support.])
|
*** with wide-character support.])
|
||||||
elif test "x$enable_utf8" != xno; then
|
elif test "x$enable_utf8" != xno; then
|
||||||
AC_MSG_WARN([
|
AC_MSG_WARN([
|
||||||
*** Insufficient UTF-8 support was detected in your curses and/or C
|
*** Insufficient UTF-8 support was detected in your curses
|
||||||
*** libraries. If you want UTF-8 support, please verify that your
|
*** and/or C libraries. If you want UTF-8 support, please
|
||||||
*** Slang was built with UTF-8 support or your curses was built with
|
*** verify that both your curses library and your C library
|
||||||
*** wide-character support, and that your C library was built with
|
*** were built with wide-character support.])
|
||||||
*** wide-character support.])
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -666,16 +546,16 @@ AC_DEFINE_UNQUOTED(NANO_REG_EXTENDED, $nano_reg_extended,
|
|||||||
[Flag(s) to use to get the full range of extended regular expressions])
|
[Flag(s) to use to get the full range of extended regular expressions])
|
||||||
|
|
||||||
if test x$color_support = xyes; then
|
if test x$color_support = xyes; then
|
||||||
# if test x$CURSES_LIB_NAME = xcurses; then
|
AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
|
||||||
AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int testcolor = COLOR_WHITE;
|
int testcolor = COLOR_WHITE;
|
||||||
return 0;
|
return 0;
|
||||||
}], AC_MSG_RESULT(no),
|
}]])],
|
||||||
AC_TRY_RUN([
|
AC_MSG_RESULT(no),
|
||||||
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||||
#ifndef _XOPEN_SOURCE_EXTENDED
|
#ifndef _XOPEN_SOURCE_EXTENDED
|
||||||
#define _XOPEN_SOURCE_EXTENDED 1
|
#define _XOPEN_SOURCE_EXTENDED 1
|
||||||
#endif
|
#endif
|
||||||
@@ -684,35 +564,23 @@ int main(void)
|
|||||||
{
|
{
|
||||||
int testcolor = COLOR_WHITE;
|
int testcolor = COLOR_WHITE;
|
||||||
return 0;
|
return 0;
|
||||||
}],
|
}]])],
|
||||||
AC_DEFINE(NEED_XOPEN_SOURCE_EXTENDED, 1, [Define this if you need the _XOPEN_SOURCE_EXTENDED macro for color support.])
|
AC_DEFINE(NEED_XOPEN_SOURCE_EXTENDED, 1, [Define this if you need the _XOPEN_SOURCE_EXTENDED macro for color support.])
|
||||||
AC_MSG_RESULT(yes),
|
AC_MSG_RESULT(yes),
|
||||||
AC_MSG_RESULT(not sure)
|
AC_MSG_RESULT(not sure)
|
||||||
AC_MSG_WARN([*** Couldn't successfully compile basic color test with or without _XOPEN_SOURCE_EXTENDED])
|
AC_MSG_WARN([
|
||||||
AC_MSG_WARN([*** This build may not compile. Consider configuring with --disable-color or installing ncurses])),
|
*** Couldn't successfully compile basic color test with or without
|
||||||
AC_MSG_WARN([*** Can't check need for _XOPEN_SOURCE_EXTENDED when cross-compiling]))
|
*** _XOPEN_SOURCE_EXTENDED. This build may not compile. Consider
|
||||||
# fi
|
*** configuring with --disable-color or installing ncurses.])),
|
||||||
|
AC_MSG_WARN([
|
||||||
|
*** Can't check need for _XOPEN_SOURCE_EXTENDED when cross-compiling.]))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether LINES and COLS can be redefined])
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <curses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
LINES = 80;
|
|
||||||
COLS = 25;
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
AC_DEFINE(REDEFINING_MACROS_OK, 1, [Define this if you know your curses library allows LINES and COLS to be redefined to deal with a resizing bug.])
|
|
||||||
AC_MSG_RESULT(yes),
|
|
||||||
AC_MSG_RESULT(no),
|
|
||||||
AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling]))
|
|
||||||
|
|
||||||
AS_IF([test "x$enable_libmagic" != "xno"], [
|
AS_IF([test "x$enable_libmagic" != "xno"], [
|
||||||
AC_CHECK_HEADERS([magic.h])
|
AC_CHECK_HEADERS([magic.h])
|
||||||
AC_CHECK_LIB(magic, magic_open)
|
AC_CHECK_LIB(magic, magic_open)
|
||||||
AC_CHECK_HEADERS([zlib.h])
|
AC_CHECK_HEADERS([zlib.h])
|
||||||
AC_CHECK_LIB(z, inflate)
|
AC_CHECK_LIB(z, inflate)
|
||||||
])
|
])
|
||||||
|
|
||||||
# Check for groff html support.
|
# Check for groff html support.
|
||||||
@@ -721,8 +589,8 @@ groff -t -mandoc -Thtml </dev/null >/dev/null
|
|||||||
if test $? -ne 0 ; then
|
if test $? -ne 0 ; then
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
AC_MSG_WARN([
|
AC_MSG_WARN([
|
||||||
*** Will not generate HTML version of man pages. ***
|
*** Will not generate HTML version of man pages. Consider
|
||||||
*** Consider installing a newer version of groff with HTML support. ***])
|
*** installing a newer version of groff with HTML support.])
|
||||||
groff_html_support=no
|
groff_html_support=no
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>Cheatsheet for nano</title>
|
<title>Cheatsheet for GNU nano</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<meta name="description" content="A concise overview of the command shortcuts of the GNU nano editor, grouped by category.">
|
<meta name="description" content="A concise overview of the command shortcuts for nano, the editor, grouped by category.">
|
||||||
<meta name="keywords" content="cheatsheet, nano, editor, shortcuts, keystrokes, functions, operations, commands">
|
<meta name="keywords" content="cheatsheet, nano, editor, shortcuts, keystrokes, functions, operations, commands">
|
||||||
<meta name="author" content="Benno Schulenberg">
|
<meta name="author" content="Benno Schulenberg">
|
||||||
</head>
|
</head>
|
||||||
@@ -55,15 +55,15 @@
|
|||||||
<table><tbody>
|
<table><tbody>
|
||||||
<tr><td>Ctrl+H</td><td>Delete character before cursor </td></tr>
|
<tr><td>Ctrl+H</td><td>Delete character before cursor </td></tr>
|
||||||
<tr><td>Ctrl+D</td><td>Delete character under cursor</td></tr>
|
<tr><td>Ctrl+D</td><td>Delete character under cursor</td></tr>
|
||||||
<tr><td>Ctrl+Shift+Del </td><td>Delete word to the left</td></tr>
|
<tr><td>Alt+Bsp</td><td>Delete word to the left</td></tr>
|
||||||
<tr><td>Ctrl+Del</td><td>Delete word to the right</td></tr>
|
<tr><td>Ctrl+Del </td><td>Delete word to the right</td></tr>
|
||||||
<tr><td>Alt+Del</td><td>Delete current line</td></tr>
|
<tr><td>Alt+Del</td><td>Delete current line</td></tr>
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<b>Operations</b>
|
<b>Operations</b>
|
||||||
<table><tbody>
|
<table><tbody>
|
||||||
<tr><td>Ctrl+T </td><td>Run a spell check</td></tr>
|
<tr><td>Ctrl+T </td><td>Execute some command</td></tr>
|
||||||
<tr><td>Ctrl+J</td><td>Justify paragraph or region</td></tr>
|
<tr><td>Ctrl+J</td><td>Justify paragraph or region</td></tr>
|
||||||
<tr><td>Alt+J</td><td>Justify entire buffer</td></tr>
|
<tr><td>Alt+J</td><td>Justify entire buffer</td></tr>
|
||||||
<tr><td>Alt+B</td><td>Run a syntax check</td></tr>
|
<tr><td>Alt+B</td><td>Run a syntax check</td></tr>
|
||||||
@@ -79,14 +79,14 @@
|
|||||||
<table><tbody>
|
<table><tbody>
|
||||||
<tr><td>Ctrl+B </td><td>One character backward</td></tr>
|
<tr><td>Ctrl+B </td><td>One character backward</td></tr>
|
||||||
<tr><td>Ctrl+F</td><td>One character forward</td></tr>
|
<tr><td>Ctrl+F</td><td>One character forward</td></tr>
|
||||||
<tr><td>Ctrl+<b>←</b></td><td>One word backward</td></tr>
|
<tr><td>Ctrl+<b>←</b></td><td>One word backward</td></tr>
|
||||||
<tr><td>Ctrl+<b>→</b></td><td>One word forward</td></tr>
|
<tr><td>Ctrl+<b>→</b></td><td>One word forward</td></tr>
|
||||||
<tr><td>Ctrl+A</td><td>To start of line</td></tr>
|
<tr><td>Ctrl+A</td><td>To start of line</td></tr>
|
||||||
<tr><td>Ctrl+E</td><td>To end of line</td></tr>
|
<tr><td>Ctrl+E</td><td>To end of line</td></tr>
|
||||||
<tr><td>Ctrl+P</td><td>One line up</td></tr>
|
<tr><td>Ctrl+P</td><td>One line up</td></tr>
|
||||||
<tr><td>Ctrl+N</td><td>One line down</td></tr>
|
<tr><td>Ctrl+N</td><td>One line down</td></tr>
|
||||||
<tr><td>Ctrl+<b>↑</b></td><td>To previous block</td></tr>
|
<tr><td>Ctrl+<b>↑</b></td><td>To previous block</td></tr>
|
||||||
<tr><td>Ctrl+<b>↓</b></td><td>To next block</td></tr>
|
<tr><td>Ctrl+<b>↓</b></td><td>To next block</td></tr>
|
||||||
<tr><td>Ctrl+Y</td><td>One page up</td></tr>
|
<tr><td>Ctrl+Y</td><td>One page up</td></tr>
|
||||||
<tr><td>Ctrl+V</td><td>One page down</td></tr>
|
<tr><td>Ctrl+V</td><td>One page down</td></tr>
|
||||||
<tr><td>Alt+\</td><td>To top of buffer</td></tr>
|
<tr><td>Alt+\</td><td>To top of buffer</td></tr>
|
||||||
@@ -98,8 +98,8 @@
|
|||||||
<table><tbody>
|
<table><tbody>
|
||||||
<tr><td>Alt+G </td><td>Go to specified line</td></tr>
|
<tr><td>Alt+G </td><td>Go to specified line</td></tr>
|
||||||
<tr><td>Alt+]</td><td>Go to complementary bracket</td></tr>
|
<tr><td>Alt+]</td><td>Go to complementary bracket</td></tr>
|
||||||
<tr><td>Alt+<b>↑</b></td><td>Scroll viewport up</td></tr>
|
<tr><td>Alt+<b>↑</b></td><td>Scroll viewport up</td></tr>
|
||||||
<tr><td>Alt+<b>↓</b></td><td>Scroll viewport down</td></tr>
|
<tr><td>Alt+<b>↓</b></td><td>Scroll viewport down</td></tr>
|
||||||
<tr><td>Alt+<</td><td>Switch to preceding buffer</td></tr>
|
<tr><td>Alt+<</td><td>Switch to preceding buffer</td></tr>
|
||||||
<tr><td>Alt+></td><td>Switch to succeeding buffer</td></tr>
|
<tr><td>Alt+></td><td>Switch to succeeding buffer</td></tr>
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
<b>Information</b>
|
<b>Information</b>
|
||||||
<table><tbody>
|
<table><tbody>
|
||||||
<tr><td>Ctrl+C </td><td>Report cursor position</td></tr>
|
<tr><td>Ctrl+C </td><td>Report cursor position</td></tr>
|
||||||
<tr><td>Alt+D</td><td>Report word/line/char count</td></tr>
|
<tr><td>Alt+D</td><td>Report line/word/character count</td></tr>
|
||||||
<tr><td>Ctrl+G</td><td>Display help text</td></tr>
|
<tr><td>Ctrl+G</td><td>Display help text</td></tr>
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
<br>
|
<br>
|
||||||
@@ -118,11 +118,11 @@
|
|||||||
<tr><td>Alt+A</td><td>Turn the mark on/off</td></tr>
|
<tr><td>Alt+A</td><td>Turn the mark on/off</td></tr>
|
||||||
<tr><td>Tab</td><td>Indent marked region</td></tr>
|
<tr><td>Tab</td><td>Indent marked region</td></tr>
|
||||||
<tr><td>Shift+Tab </td><td>Unindent marked region</td></tr>
|
<tr><td>Shift+Tab </td><td>Unindent marked region</td></tr>
|
||||||
|
<tr><td>Alt+V</td><td>Enter next keystroke verbatim</td></tr>
|
||||||
<tr><td>Alt+N</td><td>Turn line numbers on/off</td></tr>
|
<tr><td>Alt+N</td><td>Turn line numbers on/off</td></tr>
|
||||||
<tr><td>Alt+P</td><td>Turn visible whitespace on/off</td></tr>
|
<tr><td>Alt+P</td><td>Turn visible whitespace on/off</td></tr>
|
||||||
<tr><td>Alt+V</td><td>Enter next keystroke verbatim</td></tr>
|
<tr><td>Alt+X</td><td>Hide or unhide the help lines</td></tr>
|
||||||
<tr><td>Ctrl+L</td><td>Refresh the screen</td></tr>
|
<tr><td>Ctrl+L</td><td>Refresh the screen</td></tr>
|
||||||
<tr><td>Ctrl+Z</td><td>Suspend nano</td></tr>
|
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|||||||
114
doc/faq.html
114
doc/faq.html
@@ -5,6 +5,9 @@
|
|||||||
<title>The GNU nano editor FAQ</title>
|
<title>The GNU nano editor FAQ</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<meta name="description" content="The genesis story of the nano editor, plus the solution to some common problems.">
|
<meta name="description" content="The genesis story of the nano editor, plus the solution to some common problems.">
|
||||||
|
<style type="text/css">
|
||||||
|
.indented { margin-left: 2em; font-family: courier; font-size: 110%; }
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
|
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
|
||||||
@@ -24,7 +27,7 @@
|
|||||||
<a href="#2.1">2.1. FTP and WWW sites that carry nano.</a><br>
|
<a href="#2.1">2.1. FTP and WWW sites that carry nano.</a><br>
|
||||||
<a href="#2.2">2.2. RedHat and derivatives (.rpm) packages.</a><br>
|
<a href="#2.2">2.2. RedHat and derivatives (.rpm) packages.</a><br>
|
||||||
<a href="#2.3">2.3. Debian (.deb) packages.</a><br>
|
<a href="#2.3">2.3. Debian (.deb) packages.</a><br>
|
||||||
<a href="#2.4">2.4. By GIT (for the brave).</a>
|
<a href="#2.4">2.4. By git (for the brave).</a>
|
||||||
</p></blockquote>
|
</p></blockquote>
|
||||||
<h3><a href="#3">3. Installation and Configuration</a></h3>
|
<h3><a href="#3">3. Installation and Configuration</a></h3>
|
||||||
<blockquote><p>
|
<blockquote><p>
|
||||||
@@ -40,8 +43,8 @@
|
|||||||
</p></blockquote>
|
</p></blockquote>
|
||||||
<h3><a href="#4">4. Running</a></h3>
|
<h3><a href="#4">4. Running</a></h3>
|
||||||
<blockquote><p>
|
<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.1">4.1. Alt+Up does nothing on a Linux console. How can I make it scroll?</a><br>
|
||||||
<a href="#4.2">4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</a><br>
|
<a href="#4.2">4.2. How can I make Ctrl+Shift+Left/Right select words on urxvt?</a><br>
|
||||||
<a href="#4.3">4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</a><br>
|
<a href="#4.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. With what keystroke can I paste text from the clipboard into nano?</a><br>
|
<a href="#4.4">4.4. With what keystroke can I paste text from the clipboard into nano?</a><br>
|
||||||
<a href="#4.5">4.5. How do I select text for or paste text from the clipboard when nano's mouse support is turned on?</a><br>
|
<a href="#4.5">4.5. How do I select text for or paste text from the clipboard when nano's mouse support is turned on?</a><br>
|
||||||
@@ -69,7 +72,7 @@
|
|||||||
<a href="#7.2">7.2. How do I submit a bug report or patch?</a><br>
|
<a href="#7.2">7.2. How do I submit a bug report or patch?</a><br>
|
||||||
<a href="#7.3">7.3. I want to send the development team a big load of cash (or just a thank you).</a><br>
|
<a href="#7.3">7.3. I want to send the development team a big load of cash (or just a thank you).</a><br>
|
||||||
<a href="#7.4">7.4. How do I join the development team?</a><br>
|
<a href="#7.4">7.4. How do I join the development team?</a><br>
|
||||||
<a href="#7.5">7.5. Can I have write access to the GIT tree?</a>
|
<a href="#7.5">7.5. Can I have write access to the git tree?</a>
|
||||||
</p></blockquote>
|
</p></blockquote>
|
||||||
<hr width="100%">
|
<hr width="100%">
|
||||||
|
|
||||||
@@ -89,7 +92,7 @@
|
|||||||
<h3><a name="1.3"></a>1.3. Why the name change from TIP?</h3>
|
<h3><a name="1.3"></a>1.3. Why the name change from TIP?</h3>
|
||||||
<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>
|
<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>
|
||||||
<h3><a name="1.4"></a>1.4. What is the current version of nano?</h3>
|
<h3><a name="1.4"></a>1.4. What is the current version of nano?</h3>
|
||||||
<blockquote><p>The current version of nano <i>should</i> be <b>5.1</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
<blockquote><p>The current version of nano <i>should</i> be <b>7.2</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||||
<h3><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h3>
|
<h3><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h3>
|
||||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="https://nano-editor.org/dist/latest/nano.1.html">here</a>.</p></blockquote>
|
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="https://nano-editor.org/dist/latest/nano.1.html">here</a>.</p></blockquote>
|
||||||
<hr width="100%">
|
<hr width="100%">
|
||||||
@@ -118,8 +121,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<p>You can also have a look at the <a href="http://ftp.debian.org/debian/pool/main/n/nano/">Package Pool</a> to see all the available binary and source packages.</p>
|
<p>You can also have a look at the <a href="http://ftp.debian.org/debian/pool/main/n/nano/">Package Pool</a> to see all the available binary and source packages.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<h3><a name="2.4"></a>2.4. By GIT (for the brave).</h3>
|
<h3><a name="2.4"></a>2.4. By git (for the brave).</h3>
|
||||||
<blockquote><p>For the 'bleeding edge' current version of nano, you can use GIT to download the current source code. <b>Note:</b> believe it or not, by downloading code that has not yet stabilized into an official release, there could quite possibly be bugs, in fact the code may not even compile! Anyway, see <a href="http://git.savannah.gnu.org/cgit/nano.git/tree/README.GIT">the nano GIT document</a> for info on anonymous GIT access to the nano source.</p></blockquote>
|
<blockquote><p>For the "bleeding edge" current version of nano, you can use <b>git</b> to download the current source code. <i>Note:</i> believe it or not, by downloading code that has not yet stabilized into an official release, there could quite possibly be bugs, in fact the code may not even compile! Anyway, see <a href="http://git.savannah.gnu.org/cgit/nano.git/tree/README.hacking">the hacking document</a> for info on getting and building nano from git.</p></blockquote>
|
||||||
<hr width="100%">
|
<hr width="100%">
|
||||||
|
|
||||||
<h1><a name="3"></a>3. Installation and Configuration</h1>
|
<h1><a name="3"></a>3. Installation and Configuration</h1>
|
||||||
@@ -127,39 +130,41 @@
|
|||||||
<blockquote><p>It's simple really! As root, type <b>rpm -Uvh nano-x.y-1*.rpm</b> if you have a RedHat-ish system or <b>dpkg -i nano_x.y-1*.deb</b> if you have a Debian-ish system, where <b>x.y</b> is the version number of nano. There are other programs to install packages, and if you wish to use those, knock yourself out.</p></blockquote>
|
<blockquote><p>It's simple really! As root, type <b>rpm -Uvh nano-x.y-1*.rpm</b> if you have a RedHat-ish system or <b>dpkg -i nano_x.y-1*.deb</b> if you have a Debian-ish system, where <b>x.y</b> is the version number of nano. There are other programs to install packages, and if you wish to use those, knock yourself out.</p></blockquote>
|
||||||
<h3><a name="3.2"></a>3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</h3>
|
<h3><a name="3.2"></a>3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</h3>
|
||||||
<blockquote><p>Okay, take a deep breath, this really isn't hard. Unpack the nano source with a command like:</p>
|
<blockquote><p>Okay, take a deep breath, this really isn't hard. Unpack the nano source with a command like:</p>
|
||||||
<p><b>tar -xvf nano-x.y.tar.gz</b></p>
|
<p class="indented"><b>tar -xvf nano-x.y.tar.gz</b></p>
|
||||||
<p>Then you need to run <b>configure</b> with any options you might want (if any).</p>
|
<p>Then you need to run <b>configure</b> with any options you might want (if any).</p>
|
||||||
<p>The average case is this:</p>
|
<p>The average case is this:</p>
|
||||||
<p><b>cd nano-x.y/</b><br>
|
<p class="indented"><b>cd nano-x.y/</b><br>
|
||||||
<b>./configure</b><br>
|
<b>./configure</b><br>
|
||||||
<b>make</b><br>
|
<b>make</b><br>
|
||||||
<b>make install</b> (as root, of course)</p></blockquote>
|
<b>make install</b> #(as root, of course)</p></blockquote>
|
||||||
<h3><a name="3.3"></a>3.3. Why does everything go into /usr/local?</h3>
|
<h3><a name="3.3"></a>3.3. Why does everything go into /usr/local?</h3>
|
||||||
<blockquote><p>Well, that's what the <b>configure</b> script defaults to. If you wish to change this, simply do this:</p>
|
<blockquote><p>Well, that's what the <b>configure</b> script defaults to. If you wish to change this, simply do this:</p>
|
||||||
<p><b>./configure --prefix=/usr</b></p>
|
<p class="indented"><b>./configure --prefix=/usr</b></p>
|
||||||
<p>This will put nano into /usr/bin when you run <b>make install</b>.</p></blockquote>
|
<p>This will put nano into /usr/bin when you run <b>make install</b>.</p></blockquote>
|
||||||
<h3><a name="3.4"></a>3.4. nano should automatically run strip on the binary when installing it!</h3>
|
<h3><a name="3.4"></a>3.4. nano should automatically run strip on the binary when installing it!</h3>
|
||||||
<blockquote><p>It does when you use <b>make install-strip</b>. The default <b>make install</b> does not, and will not, run strip automatically.</p></blockquote>
|
<blockquote><p>It does when you use <b>make install-strip</b>. The default <b>make install</b> does not, and will not, run strip automatically.</p></blockquote>
|
||||||
<h3><a name="3.5"></a>3.5. How can I make the executable smaller? This is too bloated!</h3>
|
<h3><a name="3.5"></a>3.5. How can I make the executable smaller? This is too bloated!</h3>
|
||||||
<blockquote><p>Actually, there are several parts of the editor that can be disabled. You can pass arguments to the <b>configure</b> script that disable certain features. Here's a brief list:</p>
|
<blockquote><p>Actually, there are several parts of the editor that can be disabled. You can pass arguments to the <b>configure</b> script that disable certain features. Here's a brief list:</p>
|
||||||
<pre>
|
<pre>
|
||||||
<b>--disable-browser</b> Disable the built-in file browser
|
<b>--disable-browser</b> Disable the built-in file browser
|
||||||
<b>--disable-color</b> Disable color and syntax highlighting
|
<b>--disable-color</b> Disable color and syntax highlighting
|
||||||
<b>--disable-comment</b> Disable the comment/uncomment function
|
<b>--disable-comment</b> Disable the comment/uncomment function
|
||||||
<b>--disable-extra</b> Disable the easter egg
|
<b>--disable-extra</b> Disable the easter egg
|
||||||
<b>--disable-help</b> Disable the built-in help texts
|
<b>--disable-formatter</b> Disable the formatting tool
|
||||||
<b>--disable-histories</b> Disable the saving of search strings and cursor positions
|
<b>--disable-help</b> Disable the built-in help texts
|
||||||
<b>--disable-justify</b> Disable the justify/unjustify functions
|
<b>--disable-histories</b> Disable the saving of search strings and cursor positions
|
||||||
<b>--disable-libmagic</b> Disable the use of libmagic for determining a file's syntax
|
<b>--disable-justify</b> Disable the justify/unjustify functions
|
||||||
<b>--disable-linenumbers</b> Disable line numbering
|
<b>--disable-libmagic</b> Disable the use of libmagic for determining a file's syntax
|
||||||
<b>--disable-mouse</b> Disable mouse support
|
<b>--disable-linenumbers</b> Disable line numbering
|
||||||
<b>--disable-multibuffer</b> Disable the opening of multiple file buffers
|
<b>--disable-linter</b> Disable the linting tool
|
||||||
<b>--disable-nanorc</b> Disable the use of .nanorc files
|
<b>--disable-mouse</b> Disable mouse support
|
||||||
<b>--disable-operatingdir</b> Disable the setting of an operating directory
|
<b>--disable-multibuffer</b> Disable the opening of multiple file buffers
|
||||||
<b>--disable-speller</b> Disable the spell-checker functions
|
<b>--disable-nanorc</b> Disable the use of .nanorc files
|
||||||
<b>--disable-tabcomp</b> Disable the tab-completion functions
|
<b>--disable-operatingdir</b> Disable the setting of an operating directory
|
||||||
<b>--disable-wordcomp</b> Disable the word-completion function
|
<b>--disable-speller</b> Disable the spell-checking tool
|
||||||
<b>--disable-wrapping</b> Disable all hard-wrapping of text</pre>
|
<b>--disable-tabcomp</b> Disable the tab-completion functions
|
||||||
|
<b>--disable-wordcomp</b> Disable the word-completion function
|
||||||
|
<b>--disable-wrapping</b> Disable all hard-wrapping of text</pre>
|
||||||
<p>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the undo/redo code and the code for selecting text). Also, if you know you don't need other languages, you can use <b>--disable-nls</b> to disable internationalization and save a few kilobytes. And finally, there's always good old <b>strip</b> to remove all unneeded symbols.</p>
|
<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 undo/redo code and the code for selecting text). Also, if you know you don't need other languages, you can use <b>--disable-nls</b> to disable internationalization and save a few kilobytes. And finally, there's always good old <b>strip</b> to remove all unneeded symbols.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<h3><a name="3.6"></a>3.6. Tell me more about this multibuffer stuff!</h3>
|
<h3><a name="3.6"></a>3.6. Tell me more about this multibuffer stuff!</h3>
|
||||||
@@ -175,17 +180,40 @@
|
|||||||
<hr width="100%">
|
<hr width="100%">
|
||||||
|
|
||||||
<h1><a name="4"></a>4. Running</h1>
|
<h1><a name="4"></a>4. Running</h1>
|
||||||
<h3><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h3>
|
<h3><a name="4.1"></a>4.1. Alt+Up does nothing on a Linux console. How can I make it scroll?</h3>
|
||||||
<blockquote><p>If a command-line argument that begins with '+' is followed by another argument, the former is always treated as a starting line (plus column number), and the latter always as a filename. If a command-line argument that begins with '+' isn't followed by another argument, it's treated as a filename. Examples:</p>
|
<blockquote><p>On Debian and its derivatives, the <b>Alt+Up</b> keystroke on a Linux console
|
||||||
<p>To open '+filename.txt': <b>nano +filename.txt</b><br>
|
produces by default a 'KeyboardSignal', which normally does absolutely nothing and is useless
|
||||||
To open '+filename.txt' starting on line 10: <b>nano +10 +filename.txt</b><br>
|
for the average user. To get the keystroke to do what it ought to do (scroll the viewport
|
||||||
To open '+filename.txt' starting on line 1, column 20: <b>nano +,20 +filename.txt</b><br>
|
one row up), run this in a Linux console:</p>
|
||||||
To open '+filename.txt' starting on line 10, column 20: <b>nano +10,20 +filename.txt</b><br>
|
<p class="indented"><b>dumpkeys --full | sed s/KeyboardSignal/Up/ | sudo loadkeys -</b></p>
|
||||||
To open '+filename.txt' starting on line 1 and 'filename.txt' starting on line 40: <b>nano +1 +filename.txt +40 filename.txt</b></p></blockquote>
|
<p>You will need to run this command whenever you first switch to a Linux console.</p>
|
||||||
<h3><a name="4.2"></a>4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</h3>
|
<p>Or you can (as root) execute the following little script just once:</p>
|
||||||
<blockquote><p>Try setting your $TERM variable to 'vt100'. nano doesn't yet support every term entry under the sun.</p>
|
<p class="indented"><b>for file in /etc/console-setup/cached*.kmap.gz; do<br>
|
||||||
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
|
gunzip $file;<br>
|
||||||
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
|
sed -i 's/KeyboardSignal/Up/' ${file%.gz};<br>
|
||||||
|
gzip ${file%.gz};<br>
|
||||||
|
done</b></p></blockquote>
|
||||||
|
<h3><a name="4.2"></a>4.2. How can I make Ctrl+Shift+Left/Right select words on urxvt?</h3>
|
||||||
|
<blockquote><p>The urxvt terminal emulator produces non-standard escape sequences for the modified cursor keys. These deviant sequences are not listed in the terminfo database, which means that ncurses does not recognize them. The easiest way around this is to tell urxvt to produce xterm-compatible escape sequences for the relevant keystrokes. To achieve this, add the following lines to your ~/.Xresources file:</p>
|
||||||
|
<pre>
|
||||||
|
URxvt.iso14755_52: False
|
||||||
|
|
||||||
|
URxvt.keysym.C-S-Up: \033[1;6A
|
||||||
|
URxvt.keysym.C-S-Down: \033[1;6B
|
||||||
|
URxvt.keysym.C-S-Right: \033[1;6C
|
||||||
|
URxvt.keysym.C-S-Left: \033[1;6D
|
||||||
|
|
||||||
|
URxvt.keysym.M-Up: \033[1;3A
|
||||||
|
URxvt.keysym.M-Down: \033[1;3B
|
||||||
|
URxvt.keysym.M-Right: \033[1;3C
|
||||||
|
URxvt.keysym.M-Left: \033[1;3D
|
||||||
|
|
||||||
|
URxvt.keysym.M-Insert: \033[2;3~
|
||||||
|
URxvt.keysym.M-Delete: \033[3;3~
|
||||||
|
|
||||||
|
URxvt.keysym.M-Page_Up: \033[5;3~
|
||||||
|
URxvt.keysym.M-Page_Down: \033[6;3~</pre>
|
||||||
|
<p>Then run <b>xrdb ~/.Xresources</b> and restart your urxvt terminal. Now <b>Ctrl+Shift+Left</b> and <b>Ctrl+Shift+Right</b> will select words, <b>Alt+Up</b> and <b>Alt+Down</b> will scroll the text without moving the cursor, and several such things more.</p></blockquote>
|
||||||
<h3><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?</h3>
|
<h3><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?</h3>
|
||||||
<blockquote><p>You can use the <b>-K</b> or <b>--rawsequences</b> option on the command line, or add the line <b>set rawsequences</b> to your .nanorc. However, nano's mouse support will be disabled if you do any of these things.</p></blockquote>
|
<blockquote><p>You can use the <b>-K</b> or <b>--rawsequences</b> option on the command line, or add the line <b>set rawsequences</b> to your .nanorc. However, nano's mouse support will be disabled if you do any of these things.</p></blockquote>
|
||||||
<h3><a name="4.4"></a>4.4. With what keystroke can I paste text from the clipboard into nano?</h3>
|
<h3><a name="4.4"></a>4.4. With what keystroke can I paste text from the clipboard into nano?</h3>
|
||||||
@@ -202,16 +230,16 @@
|
|||||||
<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. Several example configurations are in the <b>syntax/</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano/</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9">3.9</a>.</p></blockquote>
|
<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. Several example configurations are in the <b>syntax/</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano/</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9">3.9</a>.</p></blockquote>
|
||||||
<h3><a name="4.9"></a>4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</h3>
|
<h3><a name="4.9"></a>4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</h3>
|
||||||
<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>
|
<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 class="indented"><b>export EDITOR=/usr/local/bin/nano</b></p>
|
||||||
<p>or, if you use tcsh, put this in your <b>.cshrc</b> file:</p>
|
<p>or, if you use tcsh, put this in your <b>.cshrc</b> file:</p>
|
||||||
<p><b>setenv EDITOR /usr/local/bin/nano</b></p>
|
<p class="indented"><b>setenv EDITOR /usr/local/bin/nano</b></p>
|
||||||
<p>Change /usr/local/bin/nano to wherever nano is installed on your system. Type "which nano" to find out. This will not take effect until the next time you log in. So log out and back in again.</p>
|
<p>Change /usr/local/bin/nano to wherever nano is installed on your system. Type "which nano" to find out. This will not take effect until the next time you log in. So log out and back in again.</p>
|
||||||
<p>Then, on top of that, if you use Pine, you must go into setup (type <b>S</b> at the main menu), and then configure (type <b>C</b>). Hit Enter on the lines that say:</p>
|
<p>Then, on top of that, if you use Pine, you must go into setup (type <b>S</b> at the main menu), and then configure (type <b>C</b>). Hit Enter on the lines that say:</p>
|
||||||
<p><b>[ ] enable-alternate-editor-cmd</b><br>
|
<p class="indented"><b>[ ] enable-alternate-editor-cmd</b><br>
|
||||||
<b>[ ] enable-alternate-editor-implicitly</b></p>
|
<b>[ ] enable-alternate-editor-implicitly</b></p>
|
||||||
<p>Then exit (<b>E</b>) and select Yes (<b>Y</b>).</p>
|
<p>Then exit (<b>E</b>) and select Yes (<b>Y</b>).</p>
|
||||||
<p>If you're a mutt user, you should see an effect immediately the next time you log in. No further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
|
<p>If you're a mutt user, you should see an effect immediately the next time you log in. No further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
|
||||||
<p><b>my_hdr X-Composer: nano-x.y</b></p>
|
<p class="indented"><b>my_hdr X-Composer: nano-x.y</b></p>
|
||||||
<p>Again, replace x.y with the version of nano you use.</p></blockquote>
|
<p>Again, replace x.y with the version of nano you use.</p></blockquote>
|
||||||
<hr width="100%">
|
<hr width="100%">
|
||||||
|
|
||||||
|
|||||||
126
doc/nano.1
126
doc/nano.1
@@ -1,4 +1,4 @@
|
|||||||
.\" Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc.
|
.\" Copyright (C) 1999-2011, 2013-2023 Free Software Foundation, Inc.
|
||||||
.\"
|
.\"
|
||||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||||
.\" under the terms of either of the following licenses:
|
.\" under the terms of either of the following licenses:
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
.\" Documentation License along with this program. If not, see
|
.\" Documentation License along with this program. If not, see
|
||||||
.\" <https://www.gnu.org/licenses/>.
|
.\" <https://www.gnu.org/licenses/>.
|
||||||
.\"
|
.\"
|
||||||
.TH NANO 1 "version 5.1" "August 2020"
|
.TH NANO 1 "version 7.2" "January 2023"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
nano \- Nano's ANOther editor, inspired by Pico
|
nano \- Nano's ANOther editor, inspired by Pico
|
||||||
@@ -25,22 +25,11 @@ nano \- Nano's ANOther editor, inspired by Pico
|
|||||||
.B nano
|
.B nano
|
||||||
.RI [ options "] [[\fB+" line [\fB, column "]] " file ]...
|
.RI [ options "] [[\fB+" line [\fB, column "]] " file ]...
|
||||||
.sp
|
.sp
|
||||||
|
.B nano
|
||||||
|
.RI [ options "] [" file [\fB: line [\fB: column "]]]..."
|
||||||
|
.sp
|
||||||
.BR nano " [" \fIoptions "] [[" + [ crCR ]( / | ? ) \fIstring "] " \fIfile ]...
|
.BR nano " [" \fIoptions "] [[" + [ crCR ]( / | ? ) \fIstring "] " \fIfile ]...
|
||||||
|
|
||||||
.SH NOTICE
|
|
||||||
Since version 4.0, \fBnano\fR by default:
|
|
||||||
.sp
|
|
||||||
.RS 4
|
|
||||||
\(bu does not automatically hard-wrap lines that become overlong,
|
|
||||||
.br
|
|
||||||
\(bu includes the line below the title bar in the editing area,
|
|
||||||
.br
|
|
||||||
\(bu does linewise (smooth) scrolling.
|
|
||||||
.RE
|
|
||||||
.sp
|
|
||||||
If you want the old, Pico behavior back, you can use \fB\-\-breaklonglines\fR,
|
|
||||||
\fB\-\-emptyline\fR, and \fB\-\-jumpyscrolling\fR (or \fB\-bej\fR for short).
|
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fBnano\fP is a small and friendly editor. It copies the look and feel
|
\fBnano\fP is a small and friendly editor. It copies the look and feel
|
||||||
of Pico, but is free software, and implements several features that Pico
|
of Pico, but is free software, and implements several features that Pico
|
||||||
@@ -50,7 +39,11 @@ syntax coloring, line numbering, and soft-wrapping overlong lines.
|
|||||||
When giving a filename on the command line, the cursor can be put on a
|
When giving a filename on the command line, the cursor can be put on a
|
||||||
specific line by adding the line number with a plus sign (\fB+\fR) before
|
specific line by adding the line number with a plus sign (\fB+\fR) before
|
||||||
the filename, and even in a specific column by adding it with a comma.
|
the filename, and even in a specific column by adding it with a comma.
|
||||||
(Negative numbers count from the end of the file or line.)
|
Negative numbers count from the end of the file or line.
|
||||||
|
The line and column numbers may also be specified by gluing them with colons
|
||||||
|
after the filename. (When a filename contains a colon followed by digits,
|
||||||
|
escape the colon by preceding it with a triple backslash.)
|
||||||
|
.sp
|
||||||
The cursor can be put on the first or last occurrence of a specific string
|
The cursor can be put on the first or last occurrence of a specific string
|
||||||
by specifying that string after \fB+/\fR or \fB+?\fR before the filename.
|
by specifying that string after \fB+/\fR or \fB+?\fR before the filename.
|
||||||
The string can be made case sensitive and/or caused to be interpreted as a
|
The string can be made case sensitive and/or caused to be interpreted as a
|
||||||
@@ -58,7 +51,7 @@ regular expression by inserting \fBc\fR and/or \fBr\fR after the \fB+\fR sign.
|
|||||||
These search modes can be explicitly disabled by using the uppercase variant
|
These search modes can be explicitly disabled by using the uppercase variant
|
||||||
of those letters: \fBC\fR and/or \fBR\fR. When the string contains spaces,
|
of those letters: \fBC\fR and/or \fBR\fR. When the string contains spaces,
|
||||||
it needs to be enclosed in quotes. To give an example: to open a file at
|
it needs to be enclosed in quotes. To give an example: to open a file at
|
||||||
the first occurrence of the word "Foo", one would do:
|
the first occurrence of the word "Foo", you would do:
|
||||||
.sp
|
.sp
|
||||||
.RS 4
|
.RS 4
|
||||||
.BI "nano +c/Foo " file
|
.BI "nano +c/Foo " file
|
||||||
@@ -77,17 +70,23 @@ Any cursor movement or executing any other command will cause the next
|
|||||||
\fB^K\fR to overwrite the cutbuffer. A \fB^U\fR will paste the current
|
\fB^K\fR to overwrite the cutbuffer. A \fB^U\fR will paste the current
|
||||||
contents of the cutbuffer at the current cursor position.
|
contents of the cutbuffer at the current cursor position.
|
||||||
.sp
|
.sp
|
||||||
When a more precise piece of text needs to be cut or copied, one can mark
|
When a more precise piece of text needs to be cut or copied, you can mark
|
||||||
its start with \fB^6\fR, move the cursor to its end (the marked text will be
|
its start with \fB^6\fR, move the cursor to its end (the marked text will be
|
||||||
highlighted), and then use \fB^K\fR to cut it, or \fBM\-6\fR to copy it to the
|
highlighted), and then use \fB^K\fR to cut it, or \fBM\-6\fR to copy it to the
|
||||||
cutbuffer. One can also save the marked text to a file with \fB^O\fR, or
|
cutbuffer. You can also save the marked text to a file with \fB^O\fR, or
|
||||||
spell check it with \fB^T\fR.
|
spell check it with \fB^T^T\fR.
|
||||||
.sp
|
.sp
|
||||||
On some terminals, text can be selected also by holding down Shift while
|
On some terminals, text can be selected also by holding down Shift while
|
||||||
using the arrow keys. Holding down the Ctrl or Alt key too will increase
|
using the arrow keys. Holding down the Ctrl or Alt key too will increase
|
||||||
the stride.
|
the stride.
|
||||||
Any cursor movement without Shift being held will cancel such a selection.
|
Any cursor movement without Shift being held will cancel such a selection.
|
||||||
.sp
|
.sp
|
||||||
|
Any valid Unicode code point can be inserted into the buffer by typing
|
||||||
|
\fBM\-V\fR followed by the hexadecimal digits of the code point (concluded
|
||||||
|
with \fB<Space>\fR or \fB<Enter>\fR when it are fewer than six digits).
|
||||||
|
A literal control code (except \fB^J\fR) can be inserted by typing
|
||||||
|
\fBM\-V\fR followed by the pertinent keystroke.
|
||||||
|
.sp
|
||||||
The two lines at the bottom of the screen show some important commands;
|
The two lines at the bottom of the screen show some important commands;
|
||||||
the built-in help (\fB^G\fR) lists all the available ones.
|
the built-in help (\fB^G\fR) lists all the available ones.
|
||||||
The default key bindings can be changed via a \fInanorc\fR file -- see
|
The default key bindings can be changed via a \fInanorc\fR file -- see
|
||||||
@@ -118,7 +117,9 @@ by setting the options \fBtitlecolor\fP, \fBstatuscolor\fP, \fBkeycolor\fP,
|
|||||||
nanorc file. See \fBnanorc\fR(5).
|
nanorc file. See \fBnanorc\fR(5).
|
||||||
.TP
|
.TP
|
||||||
.BR \-E ", " \-\-tabstospaces
|
.BR \-E ", " \-\-tabstospaces
|
||||||
Convert typed tabs to spaces.
|
Convert each typed tab to spaces -- to the number of spaces
|
||||||
|
that a tab at that position would take up.
|
||||||
|
(Note: pasted tabs are not converted.)
|
||||||
.TP
|
.TP
|
||||||
.BR \-F ", " \-\-multibuffer
|
.BR \-F ", " \-\-multibuffer
|
||||||
Read a file into a new buffer by default.
|
Read a file into a new buffer by default.
|
||||||
@@ -139,10 +140,12 @@ text. (The color of the stripe can be changed with \fBset stripecolor\fR
|
|||||||
in your \fInanorc\fR file.)
|
in your \fInanorc\fR file.)
|
||||||
.TP
|
.TP
|
||||||
.BR \-K ", " \-\-rawsequences
|
.BR \-K ", " \-\-rawsequences
|
||||||
Interpret escape sequences directly (instead of asking \fBncurses\fR to
|
Interpret escape sequences directly, instead of asking \fBncurses\fR
|
||||||
translate them). If you need this option to get your keyboard to work
|
to translate them. (If you need this option to get some keys to work
|
||||||
properly, please report a bug. Using this option disables \fBnano\fR's
|
properly, it means that the terminfo terminal description that is used
|
||||||
mouse support.
|
does not fully match the actual behavior of your terminal. This can
|
||||||
|
happen when you ssh into a BSD machine, for example.)
|
||||||
|
Using this option disables \fBnano\fR's mouse support.
|
||||||
.TP
|
.TP
|
||||||
.BR \-L ", " \-\-nonewlines
|
.BR \-L ", " \-\-nonewlines
|
||||||
Don't automatically add a newline when a text does not end with one.
|
Don't automatically add a newline when a text does not end with one.
|
||||||
@@ -165,7 +168,7 @@ and place it at that position again upon reopening such a file.
|
|||||||
.TP
|
.TP
|
||||||
.BR "\-Q ""\fIregex\fB""" ", " "\-\-quotestr=""" \fIregex """
|
.BR "\-Q ""\fIregex\fB""" ", " "\-\-quotestr=""" \fIregex """
|
||||||
Set the regular expression for matching the quoting part of a line.
|
Set the regular expression for matching the quoting part of a line.
|
||||||
The default value is \fB"^([\ \\t]*([!#%:;>|}]|//))+"\fP.
|
The default value is "\fB^([\ \\t]*([!#%:;>|}]|//))+\fR".
|
||||||
(Note that \fB\\t\fP stands for an actual Tab.)
|
(Note that \fB\\t\fP stands for an actual Tab.)
|
||||||
This makes it possible to rejustify blocks of quoted text when composing
|
This makes it possible to rejustify blocks of quoted text when composing
|
||||||
email, and to rewrap blocks of line comments when writing source code.
|
email, and to rewrap blocks of line comments when writing source code.
|
||||||
@@ -187,12 +190,15 @@ the screen's edge, by using also \fB\-\-atblanks\fR.)
|
|||||||
.TP
|
.TP
|
||||||
.BR \-T\ \fInumber ", " \-\-tabsize= \fInumber
|
.BR \-T\ \fInumber ", " \-\-tabsize= \fInumber
|
||||||
Set the size (width) of a tab to \fInumber\fP columns. The value of
|
Set the size (width) of a tab to \fInumber\fP columns. The value of
|
||||||
\fInumber\fP must be greater than 0. The default value is 8.
|
\fInumber\fR must be greater than 0. The default value is \fB8\fR.
|
||||||
.TP
|
.TP
|
||||||
.BR \-U ", " \-\-quickblank
|
.BR \-U ", " \-\-quickblank
|
||||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
Make status-bar messages disappear after 1 keystroke instead of after 20.
|
||||||
keystroke instead of 25. Note that option \fB\-c\fR (\fB\-\-constantshow\fR)
|
Note that option \fB\-c\fR (\fB\-\-constantshow\fR) overrides this.
|
||||||
overrides this.
|
When option \fB\-\-minibar\fR or \fB\-\-zero\fR is in effect,
|
||||||
|
\fB\-\-quickblank\fR makes a message disappear after
|
||||||
|
0.8 seconds instead of after the default 1.5 seconds.
|
||||||
|
.
|
||||||
.TP
|
.TP
|
||||||
.BR \-V ", " \-\-version
|
.BR \-V ", " \-\-version
|
||||||
Show the current version number and exit.
|
Show the current version number and exit.
|
||||||
@@ -295,15 +301,14 @@ Set the target width for justifying and automatic hard-wrapping at this
|
|||||||
\fInumber\fR of columns. If the value is 0 or less, wrapping will occur
|
\fInumber\fR of columns. If the value is 0 or less, wrapping will occur
|
||||||
at the width of the screen minus \fInumber\fR columns, allowing the wrap
|
at the width of the screen minus \fInumber\fR columns, allowing the wrap
|
||||||
point to vary along with the width of the screen if the screen is resized.
|
point to vary along with the width of the screen if the screen is resized.
|
||||||
The default value is \-8.
|
The default value is \fB\-8\fR.
|
||||||
.TP
|
.TP
|
||||||
.B "\-s ""\fIprogram\fR [\fIargument \fR...]\fB""\fR, \fB\-\-speller=""\fIprogram\fR [\fIargument \fR...]\fB"""
|
.B "\-s ""\fIprogram\fR [\fIargument \fR...]\fB""\fR, \fB\-\-speller=""\fIprogram\fR [\fIargument \fR...]\fB"""
|
||||||
Use this command to perform spell checking and correcting, instead of
|
Use this command to perform spell checking and correcting, instead of
|
||||||
using the built-in corrector that calls \fBhunspell\fR or GNU \fBspell\fR.
|
using the built-in corrector that calls \fBhunspell\fR(1) or \fBspell\fR(1).
|
||||||
.TP
|
.TP
|
||||||
.BR \-t ", " \-\-saveonexit
|
.BR \-t ", " \-\-saveonexit
|
||||||
Save a changed buffer without prompting (when exiting with \fB^X\fR).
|
Save a changed buffer without prompting (when exiting with \fB^X\fR).
|
||||||
(The old form of the long option, \fB\-\-tempfile\fR, is deprecated.)
|
|
||||||
.TP
|
.TP
|
||||||
.BR \-u ", " \-\-unix
|
.BR \-u ", " \-\-unix
|
||||||
Save a file by default in Unix format. This overrides nano's
|
Save a file by default in Unix format. This overrides nano's
|
||||||
@@ -319,7 +324,6 @@ unless \fB\-\-restricted\fR is given too.
|
|||||||
Do not automatically hard-wrap the current line when it becomes overlong.
|
Do not automatically hard-wrap the current line when it becomes overlong.
|
||||||
This is the default. (This option is the opposite of \fB\-b\fR
|
This is the default. (This option is the opposite of \fB\-b\fR
|
||||||
(\fB\-\-breaklonglines\fR) -- the last one given takes effect.)
|
(\fB\-\-breaklonglines\fR) -- the last one given takes effect.)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR \-x ", " \-\-nohelp
|
.BR \-x ", " \-\-nohelp
|
||||||
Don't show the two help lines at the bottom of the screen.
|
Don't show the two help lines at the bottom of the screen.
|
||||||
@@ -327,8 +331,42 @@ Don't show the two help lines at the bottom of the screen.
|
|||||||
.BR \-y ", " \-\-afterends
|
.BR \-y ", " \-\-afterends
|
||||||
Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings.
|
Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings.
|
||||||
.TP
|
.TP
|
||||||
.BR \-z ", " \-\-suspendable
|
.BR \-! ", " \-\-magic
|
||||||
Allow the user to suspend the editor (with \fB^Z\fR by default).
|
When neither the file's name nor its first line give a clue,
|
||||||
|
try using libmagic to determine the applicable syntax.
|
||||||
|
.TP
|
||||||
|
.BR \-% ", " \-\-stateflags
|
||||||
|
Use the top-right corner of the screen for showing some state flags:
|
||||||
|
\fBI\fR when auto-indenting, \fBM\fR when the mark is on, \fBL\fR when
|
||||||
|
hard-wrapping (breaking long lines), \fBR\fR when recording a macro,
|
||||||
|
and \fBS\fR when soft-wrapping.
|
||||||
|
When the buffer is modified, a star (\fB*\fR) is shown after the
|
||||||
|
filename in the center of the title bar.
|
||||||
|
.TP
|
||||||
|
.BR \-_ ", " \-\-minibar
|
||||||
|
Suppress the title bar and instead show information about
|
||||||
|
the current buffer at the bottom of the screen, in the space
|
||||||
|
for the status bar. In this "minibar" the filename is shown
|
||||||
|
on the left, followed by an asterisk if the buffer has been modified.
|
||||||
|
On the right are displayed the current line and column number, the
|
||||||
|
code of the character under the cursor (in Unicode format: U+xxxx),
|
||||||
|
the same flags as are shown by \fB\-\-stateflags\fR, and a percentage
|
||||||
|
that expresses how far the cursor is into the file (linewise).
|
||||||
|
When a file is loaded or saved, and also when switching between buffers,
|
||||||
|
the number of lines in the buffer is displayed after the filename.
|
||||||
|
This number is cleared upon the next keystroke, or replaced with an
|
||||||
|
[i/n] counter when multiple buffers are open.
|
||||||
|
The line plus column numbers and the character code are displayed only when
|
||||||
|
\fB\-\-constantshow\fR is used, and can be toggled on and off with \fBM\-C\fR.
|
||||||
|
The state flags are displayed only when \fB\-\-stateflags\fR is used.
|
||||||
|
.TP
|
||||||
|
.BR \-0 ", " \-\-zero
|
||||||
|
Hide all elements of the interface (title bar, status bar, and help lines)
|
||||||
|
and use all rows of the terminal for showing the contents of the buffer.
|
||||||
|
The status bar appears only when there is a significant message,
|
||||||
|
and disappears after 1.5 seconds or upon the next keystroke.
|
||||||
|
With \fBM\-Z\fR the title bar plus status bar can be toggled.
|
||||||
|
With \fBM\-X\fR the help lines.
|
||||||
|
|
||||||
.SH TOGGLES
|
.SH TOGGLES
|
||||||
Several of the above options can be switched on and off also while
|
Several of the above options can be switched on and off also while
|
||||||
@@ -351,8 +389,19 @@ exists), either \fI~/.nanorc\fR or \fI$XDG_CONFIG_HOME/nano/nanorc\fR
|
|||||||
or \fI~/.config/nano/nanorc\fR, whichever is encountered first. See
|
or \fI~/.config/nano/nanorc\fR, whichever is encountered first. See
|
||||||
.BR nanorc (5)
|
.BR nanorc (5)
|
||||||
for more information on the possible contents of those files.
|
for more information on the possible contents of those files.
|
||||||
|
.sp
|
||||||
|
See \fI/usr/share/nano/\fR and \fI/usr/share/nano/extra/\fR
|
||||||
|
for available syntax-coloring definitions.
|
||||||
|
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
|
Option \fB\-z\fR (\fB\-\-suspendable\fR) has been removed.
|
||||||
|
Suspension is enabled by default, reachable via \fB^T^Z\fR.
|
||||||
|
(If you want a plain \fB^Z\fR to suspend nano, add
|
||||||
|
\fBbind ^Z suspend main\fR to your nanorc.)
|
||||||
|
.sp
|
||||||
|
When you want to copy marked text from \fBnano\fR to the system's clipboard,
|
||||||
|
see one of the examples in the \fBnanorc\fR(5) man page.
|
||||||
|
.sp
|
||||||
If no alternative spell checker command is specified on the command
|
If no alternative spell checker command is specified on the command
|
||||||
line nor in one of the \fInanorc\fP files, \fBnano\fP will check the
|
line nor in one of the \fInanorc\fP files, \fBnano\fP will check the
|
||||||
\fBSPELL\fP environment variable for one.
|
\fBSPELL\fP environment variable for one.
|
||||||
@@ -366,6 +415,9 @@ that name already exists in the current directory, it will add ".save"
|
|||||||
plus a number (e.g.\& ".save.1") to the current filename in order to make
|
plus a number (e.g.\& ".save.1") to the current filename in order to make
|
||||||
it unique. In multibuffer mode, \fBnano\fP will write all the open
|
it unique. In multibuffer mode, \fBnano\fP will write all the open
|
||||||
buffers to their respective emergency files.
|
buffers to their respective emergency files.
|
||||||
|
.sp
|
||||||
|
If you have any question about how to use \fBnano\fR in some specific
|
||||||
|
situation, you can ask on \fIhelp-nano@gnu.org\fR.
|
||||||
|
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
The recording and playback of keyboard macros works correctly only on a
|
The recording and playback of keyboard macros works correctly only on a
|
||||||
|
|||||||
1109
doc/nano.texi
1109
doc/nano.texi
File diff suppressed because it is too large
Load Diff
299
doc/nanorc.5
299
doc/nanorc.5
@@ -1,4 +1,4 @@
|
|||||||
.\" Copyright (C) 2003-2011, 2013-2020 Free Software Foundation, Inc.
|
.\" Copyright (C) 2003-2011, 2013-2023 Free Software Foundation, Inc.
|
||||||
.\"
|
.\"
|
||||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||||
.\" under the terms of either of the following licenses:
|
.\" under the terms of either of the following licenses:
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
.\" Documentation License along with this program. If not, see
|
.\" Documentation License along with this program. If not, see
|
||||||
.\" <https://www.gnu.org/licenses/>.
|
.\" <https://www.gnu.org/licenses/>.
|
||||||
.\"
|
.\"
|
||||||
.TH NANORC 5 "version 5.1" "August 2020"
|
.TH NANORC 5 "version 7.2" "January 2023"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
nanorc \- GNU nano's configuration file
|
nanorc \- GNU nano's configuration file
|
||||||
@@ -32,20 +32,6 @@ or from \fI~/.config/nano/nanorc\fR, whichever is encountered first.
|
|||||||
If \fB\-\-rcfile\fR is given, \fBnano\fR will read just the specified
|
If \fB\-\-rcfile\fR is given, \fBnano\fR will read just the specified
|
||||||
settings file.
|
settings file.
|
||||||
|
|
||||||
.SH NOTICE
|
|
||||||
Since version 4.0, \fBnano\fR by default:
|
|
||||||
.sp
|
|
||||||
.RS 4
|
|
||||||
\(bu does not automatically hard-wrap lines that become overlong,
|
|
||||||
.br
|
|
||||||
\(bu includes the line below the title bar in the editing area,
|
|
||||||
.br
|
|
||||||
\(bu does linewise (smooth) scrolling.
|
|
||||||
.RE
|
|
||||||
.sp
|
|
||||||
To get the old, Pico behavior back, you can use \fBset breaklonglines\fR,
|
|
||||||
\fBset emptyline\fR, and \fBset jumpyscrolling\fR.
|
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
The configuration file accepts a series of \fBset\fP and \fBunset\fP
|
The configuration file accepts a series of \fBset\fP and \fBunset\fP
|
||||||
commands, which can be used to configure nano on startup without using
|
commands, which can be used to configure nano on startup without using
|
||||||
@@ -65,7 +51,6 @@ Quotes inside the \fIcharacters\fR parameters below should not be escaped.
|
|||||||
The last double quote on the line will be seen as the closing quote.
|
The last double quote on the line will be seen as the closing quote.
|
||||||
.sp
|
.sp
|
||||||
The supported commands and arguments are:
|
The supported commands and arguments are:
|
||||||
|
|
||||||
.TP 3
|
.TP 3
|
||||||
.B set afterends
|
.B set afterends
|
||||||
Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings.
|
Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings.
|
||||||
@@ -108,7 +93,7 @@ beginning of a paragraph (unless auto-indenting is on).
|
|||||||
Set the characters treated as closing brackets when justifying
|
Set the characters treated as closing brackets when justifying
|
||||||
paragraphs. This may not include blank characters. Only closing
|
paragraphs. This may not include blank characters. Only closing
|
||||||
punctuation (see \fBset punct\fP), optionally followed by the specified
|
punctuation (see \fBset punct\fP), optionally followed by the specified
|
||||||
closing brackets, can end sentences. The default value is "\fB"')>]}\fP".
|
closing brackets, can end sentences. The default value is "\fB\(dq')>]}\fR".
|
||||||
.TP
|
.TP
|
||||||
.B set breaklonglines
|
.B set breaklonglines
|
||||||
Automatically hard-wrap the current line when it becomes overlong.
|
Automatically hard-wrap the current line when it becomes overlong.
|
||||||
@@ -128,7 +113,7 @@ Do not use the line below the title bar, leaving it entirely blank.
|
|||||||
.TP
|
.TP
|
||||||
.B set errorcolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
.B set errorcolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
||||||
Use this color combination for the status bar when an error message is displayed.
|
Use this color combination for the status bar when an error message is displayed.
|
||||||
The default value is \fBbrightwhite,red\fR.
|
The default value is \fBbold,white,red\fR.
|
||||||
See \fBset titlecolor\fR for valid color names.
|
See \fBset titlecolor\fR for valid color names.
|
||||||
.TP
|
.TP
|
||||||
.B set fill \fInumber\fR
|
.B set fill \fInumber\fR
|
||||||
@@ -139,7 +124,7 @@ point to vary along with the width of the screen if the screen is resized.
|
|||||||
The default value is \fB\-8\fR.
|
The default value is \fB\-8\fR.
|
||||||
.TP
|
.TP
|
||||||
.B set functioncolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
.B set functioncolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
||||||
Specify the color combination to use for the function descriptions
|
Use this color combination for the concise function descriptions
|
||||||
in the two help lines at the bottom of the screen.
|
in the two help lines at the bottom of the screen.
|
||||||
See \fBset titlecolor\fR for more details.
|
See \fBset titlecolor\fR for more details.
|
||||||
.TP
|
.TP
|
||||||
@@ -160,7 +145,7 @@ and how much of the buffer is covered by the viewport.
|
|||||||
Scroll the buffer contents per half-screen instead of per line.
|
Scroll the buffer contents per half-screen instead of per line.
|
||||||
.TP
|
.TP
|
||||||
.B set keycolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
.B set keycolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
||||||
Specify the color combination to use for the shortcut key combos
|
Use this color combination for the shortcut key combos
|
||||||
in the two help lines at the bottom of the screen.
|
in the two help lines at the bottom of the screen.
|
||||||
See \fBset titlecolor\fR for more details.
|
See \fBset titlecolor\fR for more details.
|
||||||
.TP
|
.TP
|
||||||
@@ -171,15 +156,39 @@ Display line numbers to the left of the text area.
|
|||||||
.B set locking
|
.B set locking
|
||||||
Enable vim-style lock-files for when editing files.
|
Enable vim-style lock-files for when editing files.
|
||||||
.TP
|
.TP
|
||||||
|
.B set magic
|
||||||
|
When neither the file's name nor its first line give a clue,
|
||||||
|
try using libmagic to determine the applicable syntax.
|
||||||
|
(Calling libmagic can be relatively time consuming.
|
||||||
|
It is therefore not done by default.)
|
||||||
|
.TP
|
||||||
.BI "set matchbrackets """ characters """
|
.BI "set matchbrackets """ characters """
|
||||||
Set the opening and closing brackets that can be found by bracket
|
Specify the opening and closing brackets that can be found by bracket
|
||||||
searches. This may not include blank characters. The opening set must
|
searches. This may not include blank characters. The opening set must
|
||||||
come before the closing set, and the two sets must be in the same order.
|
come before the closing set, and the two sets must be in the same order.
|
||||||
The default value is "\fB(<[{)>]}\fP".
|
The default value is "\fB(<[{)>]}\fP".
|
||||||
.TP
|
.TP
|
||||||
.B set morespace
|
.B set minibar
|
||||||
Deprecated option since it has become the default setting.
|
Suppress the title bar and instead show information about
|
||||||
When needed, use \fBunset emptyline\fR instead.
|
the current buffer at the bottom of the screen, in the space
|
||||||
|
for the status bar. In this "minibar" the filename is shown
|
||||||
|
on the left, followed by an asterisk if the buffer has been modified.
|
||||||
|
On the right are displayed the current line and column number, the
|
||||||
|
code of the character under the cursor (in Unicode format: U+xxxx),
|
||||||
|
the same flags as are shown by \fBset stateflags\fR, and a percentage
|
||||||
|
that expresses how far the cursor is into the file (linewise).
|
||||||
|
When a file is loaded or saved, and also when switching between buffers,
|
||||||
|
the number of lines in the buffer is displayed after the filename.
|
||||||
|
This number is cleared upon the next keystroke, or replaced with an
|
||||||
|
[i/n] counter when multiple buffers are open.
|
||||||
|
The line plus column numbers and the character code are displayed only when
|
||||||
|
\fBset constantshow\fR is used, and can be toggled on and off with \fBM\-C\fR.
|
||||||
|
The state flags are displayed only when \fBset stateflags\fR is used.
|
||||||
|
.TP
|
||||||
|
.B set minicolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
||||||
|
Use this color combination for the minibar.
|
||||||
|
(When this option is not specified, the colors of the title bar are used.)
|
||||||
|
See \fBset titlecolor\fR for more details.
|
||||||
.TP
|
.TP
|
||||||
.B set mouse
|
.B set mouse
|
||||||
Enable mouse support, if available for your system. When enabled, mouse
|
Enable mouse support, if available for your system. When enabled, mouse
|
||||||
@@ -201,15 +210,12 @@ Don't display the two help lines at the bottom of the screen.
|
|||||||
Don't automatically add a newline when a text does not end with one.
|
Don't automatically add a newline when a text does not end with one.
|
||||||
(This can cause you to save non-POSIX text files.)
|
(This can cause you to save non-POSIX text files.)
|
||||||
.TP
|
.TP
|
||||||
.B set nopauses
|
|
||||||
Obsolete option. Ignored.
|
|
||||||
.TP
|
|
||||||
.B set nowrap
|
.B set nowrap
|
||||||
Deprecated option since it has become the default setting.
|
Deprecated option since it has become the default setting.
|
||||||
When needed, use \fBunset breaklonglines\fR instead.
|
When needed, use \fBunset breaklonglines\fR instead.
|
||||||
.TP
|
.TP
|
||||||
.B set numbercolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
.B set numbercolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
||||||
Specify the color combination to use for line numbers.
|
Use this color combination for line numbers.
|
||||||
See \fBset titlecolor\fR for more details.
|
See \fBset titlecolor\fR for more details.
|
||||||
.TP
|
.TP
|
||||||
.B set operatingdir "\fIdirectory\fP"
|
.B set operatingdir "\fIdirectory\fP"
|
||||||
@@ -225,6 +231,11 @@ The cursor position is remembered for the 200 most-recently edited files.
|
|||||||
.B set preserve
|
.B set preserve
|
||||||
Preserve the XON and XOFF keys (\fB^Q\fR and \fB^S\fR).
|
Preserve the XON and XOFF keys (\fB^Q\fR and \fB^S\fR).
|
||||||
.TP
|
.TP
|
||||||
|
.B set promptcolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
||||||
|
Use this color combination for the prompt bar.
|
||||||
|
(When this option is not specified, the colors of the title bar are used.)
|
||||||
|
See \fBset titlecolor\fR for more details.
|
||||||
|
.TP
|
||||||
.BI "set punct """ characters """
|
.BI "set punct """ characters """
|
||||||
Set the characters treated as closing punctuation when justifying
|
Set the characters treated as closing punctuation when justifying
|
||||||
paragraphs. This may not include blank characters. Only the
|
paragraphs. This may not include blank characters. Only the
|
||||||
@@ -232,8 +243,11 @@ specfified closing punctuation, optionally followed by closing brackets
|
|||||||
(see \fBbrackets\fP), can end sentences. The default value is "\fB!.?\fP".
|
(see \fBbrackets\fP), can end sentences. The default value is "\fB!.?\fP".
|
||||||
.TP
|
.TP
|
||||||
.B set quickblank
|
.B set quickblank
|
||||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
Make status-bar messages disappear after 1 keystroke instead of after 20.
|
||||||
keystroke instead of 25. The option \fBconstantshow\fR overrides this.
|
Note that option \fBconstantshow\fR overrides this.
|
||||||
|
When option \fBminibar\fR or \fBzero\fR is in effect,
|
||||||
|
\fBquickblank\fR makes a message disappear after
|
||||||
|
0.8 seconds instead of after the default 1.5 seconds.
|
||||||
.TP
|
.TP
|
||||||
.BI "set quotestr """ regex """
|
.BI "set quotestr """ regex """
|
||||||
Set the regular expression for matching the quoting part of a line.
|
Set the regular expression for matching the quoting part of a line.
|
||||||
@@ -243,10 +257,12 @@ This makes it possible to rejustify blocks of quoted text when composing
|
|||||||
email, and to rewrap blocks of line comments when writing source code.
|
email, and to rewrap blocks of line comments when writing source code.
|
||||||
.TP
|
.TP
|
||||||
.B set rawsequences
|
.B set rawsequences
|
||||||
Interpret escape sequences directly (instead of asking \fBncurses\fR to
|
Interpret escape sequences directly, instead of asking \fBncurses\fR
|
||||||
translate them). If you need this option to get your keyboard to work
|
to translate them. (If you need this option to get some keys to work
|
||||||
properly, please report a bug. Using this option disables \fBnano\fR's
|
properly, it means that the terminfo terminal description that is used
|
||||||
mouse support.
|
does not fully match the actual behavior of your terminal. This can
|
||||||
|
happen when you ssh into a BSD machine, for example.)
|
||||||
|
Using this option disables \fBnano\fR's mouse support.
|
||||||
.TP
|
.TP
|
||||||
.B set rebinddelete
|
.B set rebinddelete
|
||||||
Interpret the Delete and Backspace keys differently so that both Backspace
|
Interpret the Delete and Backspace keys differently so that both Backspace
|
||||||
@@ -259,15 +275,21 @@ Regular expressions in \fBnano\fR are of the extended type (ERE).
|
|||||||
.TP
|
.TP
|
||||||
.B set saveonexit
|
.B set saveonexit
|
||||||
Save a changed buffer automatically on exit (\fB^X\fR); don't prompt.
|
Save a changed buffer automatically on exit (\fB^X\fR); don't prompt.
|
||||||
(The old form of this option, \fBset tempfile\fR, is deprecated.)
|
.TP
|
||||||
|
.B set scrollercolor \fIfgcolor\fB,\fIbgcolor\fR
|
||||||
|
Use this color combination for the indicator alias "scrollbar".
|
||||||
|
(On terminal emulators that link to a libvte older than version 0.55,
|
||||||
|
using a background color here does not work correctly.)
|
||||||
|
See \fBset titlecolor\fR for more details.
|
||||||
.TP
|
.TP
|
||||||
.B set selectedcolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
.B set selectedcolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
||||||
Specify the color combination to use for selected text.
|
Use this color combination for selected text.
|
||||||
See \fBset titlecolor\fR for more details.
|
See \fBset titlecolor\fR for more details.
|
||||||
.TP
|
.TP
|
||||||
.B set showcursor
|
.B set showcursor
|
||||||
Put the cursor on the highlighted item in the file browser, to aid
|
Put the cursor on the highlighted item in the file browser, and show
|
||||||
braille users.
|
the cursor in the help viewer, to aid braille users and people with
|
||||||
|
poor vision.
|
||||||
.TP
|
.TP
|
||||||
.B set smarthome
|
.B set smarthome
|
||||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||||
@@ -276,10 +298,6 @@ 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
|
already at that position, it will jump to the true beginning of the
|
||||||
line.
|
line.
|
||||||
.TP
|
.TP
|
||||||
.B set smooth
|
|
||||||
Deprecated option since it has become the default setting.
|
|
||||||
When needed, use \fBunset jumpyscrolling\fR instead.
|
|
||||||
.TP
|
|
||||||
.B set softwrap
|
.B set softwrap
|
||||||
Display lines that exceed the screen's width over multiple screen lines.
|
Display lines that exceed the screen's width over multiple screen lines.
|
||||||
(You can make this soft-wrapping occur at whitespace instead of rudely at
|
(You can make this soft-wrapping occur at whitespace instead of rudely at
|
||||||
@@ -287,38 +305,60 @@ the screen's edge, by using also \fBset atblanks\fR.)
|
|||||||
.TP
|
.TP
|
||||||
.B set speller """\fIprogram\fR [\fIargument \fR...]\fB"""
|
.B set speller """\fIprogram\fR [\fIargument \fR...]\fB"""
|
||||||
Use the given \fIprogram\fR to do spell checking and correcting, instead of
|
Use the given \fIprogram\fR to do spell checking and correcting, instead of
|
||||||
using the built-in corrector that calls \fBhunspell\fR or GNU \fBspell\fR.
|
using the built-in corrector that calls \fBhunspell\fR(1) or \fBspell\fR(1).
|
||||||
.TP
|
.TP
|
||||||
.B set statuscolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
.B set spotlightcolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
||||||
Specify the color combination to use for the status bar.
|
Use this color combination for highlighting a search match.
|
||||||
|
The default value is \fBblack,lightyellow\fR.
|
||||||
|
See \fBset titlecolor\fR for valid color names.
|
||||||
|
.TP
|
||||||
|
.B set stateflags
|
||||||
|
Use the top-right corner of the screen for showing some state flags:
|
||||||
|
\fBI\fR when auto-indenting, \fBM\fR when the mark is on, \fBL\fR when
|
||||||
|
hard-wrapping (breaking long lines), \fBR\fR when recording a macro,
|
||||||
|
and \fBS\fR when soft-wrapping.
|
||||||
|
When the buffer is modified, a star (\fB*\fR) is shown after the
|
||||||
|
filename in the center of the title bar.
|
||||||
|
.TP
|
||||||
|
.B set statuscolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
||||||
|
Use this color combination for the status bar.
|
||||||
See \fBset titlecolor\fR for more details.
|
See \fBset titlecolor\fR for more details.
|
||||||
.TP
|
.TP
|
||||||
.B set stripecolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
.B set stripecolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
||||||
Specify the color combination to use for the vertical guiding stripe.
|
Use this color combination for the vertical guiding stripe.
|
||||||
See \fBset titlecolor\fR for more details.
|
See \fBset titlecolor\fR for more details.
|
||||||
.TP
|
.TP
|
||||||
.B set suspendable
|
|
||||||
Allow \fBnano\fP to be suspended (with \fB^Z\fR by default).
|
|
||||||
.TP
|
|
||||||
.B set tabsize \fInumber\fR
|
.B set tabsize \fInumber\fR
|
||||||
Use a tab size of \fInumber\fR columns. The value of \fInumber\fP must be
|
Use a tab size of \fInumber\fR columns. The value of \fInumber\fP must be
|
||||||
greater than 0. The default value is \fB8\fR.
|
greater than 0. The default value is \fB8\fR.
|
||||||
.TP
|
.TP
|
||||||
.B set tabstospaces
|
.B set tabstospaces
|
||||||
Convert typed tabs to spaces.
|
Convert each typed tab to spaces -- to the number of spaces
|
||||||
|
that a tab at that position would take up.
|
||||||
|
(Note: pasted tabs are not converted.)
|
||||||
.TP
|
.TP
|
||||||
.B set titlecolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
.B set titlecolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR
|
||||||
Specify the color combination to use for the title bar.
|
Use this color combination for the title bar.
|
||||||
Valid names for the foreground and background colors are:
|
Valid names for the foreground and background colors are:
|
||||||
.BR red ", " green ", " blue ", " magenta ", " yellow ", " cyan ", "
|
.BR red ", " green ", " blue ", " magenta ", " yellow ", " cyan ", "
|
||||||
.BR white ", and " black .
|
.BR white ", and " black .
|
||||||
Each of these eight names may be prefixed with the word \fBlight\fR
|
Each of these eight names may be prefixed with the word \fBlight\fR
|
||||||
to get a brighter version of that color.
|
to get a brighter version of that color.
|
||||||
|
The word \fBgrey\fR or \fBgray\fR may be used
|
||||||
|
as a synonym for \fBlightblack\fR.
|
||||||
On terminal emulators that can do at least 256 colors,
|
On terminal emulators that can do at least 256 colors,
|
||||||
other valid (but unprefixable) color names are:
|
other valid (but unprefixable) color names are:
|
||||||
.BR pink ", " purple ", " mauve ", " lagoon ", " mint ", "
|
.BR pink ", " purple ", " mauve ", " lagoon ", " mint ", "
|
||||||
.BR lime ", " peach ", " orange ", " latte ", and " normal
|
.BR lime ", " peach ", " orange ", " latte ", "
|
||||||
|
.BR rosy ", " beet ", " plum ", " sea ", " sky ", " slate ", "
|
||||||
|
.BR teal ", " sage ", " brown ", " ocher ", " sand ", " tawny ", "
|
||||||
|
.BR brick ", " crimson ", and " normal
|
||||||
-- where \fBnormal\fR means the default foreground or background color.
|
-- where \fBnormal\fR means the default foreground or background color.
|
||||||
|
On such emulators, the color may also be specified as a three-digit hexadecimal
|
||||||
|
number prefixed with \fB#\fR, with the digits representing the amounts of red,
|
||||||
|
green, and blue, respectively. This tells \fBnano\fR to select from the
|
||||||
|
available palette the color that approximates the given values.
|
||||||
|
|
||||||
Either "\fIfgcolor\fR" or "\fB,\fIbgcolor\fR" may be left out,
|
Either "\fIfgcolor\fR" or "\fB,\fIbgcolor\fR" may be left out,
|
||||||
and the pair may be preceded by \fBbold\fR and/or \fBitalic\fR
|
and the pair may be preceded by \fBbold\fR and/or \fBitalic\fR
|
||||||
(separated by commas) to get a bold and/or slanting typeface,
|
(separated by commas) to get a bold and/or slanting typeface,
|
||||||
@@ -333,11 +373,6 @@ Save a file by default in Unix format. This overrides nano's
|
|||||||
default behavior of saving a file in the format that it had.
|
default behavior of saving a file in the format that it had.
|
||||||
(This option has no effect when you also use \fBset noconvert\fR.)
|
(This option has no effect when you also use \fBset noconvert\fR.)
|
||||||
.TP
|
.TP
|
||||||
.B set view
|
|
||||||
Disallow file modification: read-only mode.
|
|
||||||
This mode allows the user to open also other files for viewing,
|
|
||||||
unless \fB\-\-restricted\fR is given on the command line.
|
|
||||||
.TP
|
|
||||||
.BI "set whitespace """ characters """
|
.BI "set whitespace """ characters """
|
||||||
Set the two characters used to indicate the presence of tabs and
|
Set the two characters used to indicate the presence of tabs and
|
||||||
spaces. They must be single-column characters. The default pair
|
spaces. They must be single-column characters. The default pair
|
||||||
@@ -355,6 +390,14 @@ probably want to unset \fBwordbounds\fR.
|
|||||||
.B set zap
|
.B set zap
|
||||||
Let an unmodified Backspace or Delete erase the marked region
|
Let an unmodified Backspace or Delete erase the marked region
|
||||||
(instead of a single character, and without affecting the cutbuffer).
|
(instead of a single character, and without affecting the cutbuffer).
|
||||||
|
.TP
|
||||||
|
.B set zero
|
||||||
|
Hide all elements of the interface (title bar, status bar, and help lines)
|
||||||
|
and use all rows of the terminal for showing the contents of the buffer.
|
||||||
|
The status bar appears only when there is a significant message,
|
||||||
|
and disappears after 1.5 seconds or upon the next keystroke.
|
||||||
|
With \fBM\-Z\fR the title bar plus status bar can be toggled.
|
||||||
|
With \fBM\-X\fR the help lines.
|
||||||
|
|
||||||
.SH SYNTAX HIGHLIGHTING
|
.SH SYNTAX HIGHLIGHTING
|
||||||
Coloring the different syntactic elements of a file
|
Coloring the different syntactic elements of a file
|
||||||
@@ -378,6 +421,14 @@ It also means that lookahead and lookbehind are not possible.
|
|||||||
A complete explanation can be found in the manual page of GNU grep:
|
A complete explanation can be found in the manual page of GNU grep:
|
||||||
\fBman grep\fR.
|
\fBman grep\fR.
|
||||||
.sp
|
.sp
|
||||||
|
Each regular expression in a \fBnanorc\fR file should be wrapped in
|
||||||
|
double quotes (\fB""\fR). Multiple regular expressions can follow
|
||||||
|
each other on a line by separating them with blanks. This means that
|
||||||
|
a regular expression cannot contain a double quote followed by a blank.
|
||||||
|
When you need this combination inside a regular expression,
|
||||||
|
then either the double quote or the blank should be put
|
||||||
|
between square brackets (\fB[]\fR).
|
||||||
|
.sp
|
||||||
For each kind of file a separate syntax can be defined
|
For each kind of file a separate syntax can be defined
|
||||||
via the following commands:
|
via the following commands:
|
||||||
.TP
|
.TP
|
||||||
@@ -386,13 +437,14 @@ Start the definition of a syntax with this \fIname\fR.
|
|||||||
All subsequent \fBcolor\fR and other such commands
|
All subsequent \fBcolor\fR and other such commands
|
||||||
will be added to this syntax, until a new \fBsyntax\fR
|
will be added to this syntax, until a new \fBsyntax\fR
|
||||||
command is encountered.
|
command is encountered.
|
||||||
|
.sp
|
||||||
When \fBnano\fR is run, this syntax will be automatically
|
When \fBnano\fR is run, this syntax will be automatically
|
||||||
activated if the current filename matches the extended regular
|
activated (for the relevant buffer) if the absolute filename
|
||||||
expression \fIfileregex\fR. Or the syntax can be explicitly
|
matches the extended regular expression \fIfileregex\fR.
|
||||||
activated by using the \fB\-Y\fR or \fB\-\-syntax\fR
|
Or the syntax can be explicitly activated (for all buffers)
|
||||||
|
by using the \fB\-Y\fR or \fB\-\-syntax\fR
|
||||||
command-line option followed by the \fIname\fR.
|
command-line option followed by the \fIname\fR.
|
||||||
|
.sp
|
||||||
The syntax \fBdefault\fP is special: it takes no \fIfileregex\fR,
|
The syntax \fBdefault\fP is special: it takes no \fIfileregex\fR,
|
||||||
and applies to files that don't match any syntax's regexes.
|
and applies to files that don't match any syntax's regexes.
|
||||||
The syntax \fBnone\fP is reserved; specifying it on the command line
|
The syntax \fBnone\fP is reserved; specifying it on the command line
|
||||||
@@ -413,9 +465,6 @@ system and will be silently ignored otherwise.)
|
|||||||
.TP
|
.TP
|
||||||
.BI formatter " program " \fR[ "argument " \fR...]
|
.BI formatter " program " \fR[ "argument " \fR...]
|
||||||
Run the given \fIprogram\fR on the full contents of the current buffer.
|
Run the given \fIprogram\fR on the full contents of the current buffer.
|
||||||
(The current buffer is written out to a temporary file, the program is
|
|
||||||
run on it, and then the temporary file is read back in, replacing the
|
|
||||||
contents of the buffer.)
|
|
||||||
.TP
|
.TP
|
||||||
.BI linter " program " \fR[ "argument " \fR...]
|
.BI linter " program " \fR[ "argument " \fR...]
|
||||||
Use the given \fIprogram\fR to run a syntax check on the current buffer.
|
Use the given \fIprogram\fR to run a syntax check on the current buffer.
|
||||||
@@ -444,11 +493,21 @@ one of which must be specified. Valid color names are:
|
|||||||
.BR white ", and " black .
|
.BR white ", and " black .
|
||||||
Each of these eight names may be prefixed with the word \fBlight\fR
|
Each of these eight names may be prefixed with the word \fBlight\fR
|
||||||
to get a brighter version of that color.
|
to get a brighter version of that color.
|
||||||
|
The word \fBgrey\fR or \fBgray\fR may be used
|
||||||
|
as a synonym for \fBlightblack\fR.
|
||||||
On terminal emulators that can do at least 256 colors,
|
On terminal emulators that can do at least 256 colors,
|
||||||
other valid (but unprefixable) color names are:
|
other valid (but unprefixable) color names are:
|
||||||
.BR pink ", " purple ", " mauve ", " lagoon ", " mint ", "
|
.BR pink ", " purple ", " mauve ", " lagoon ", " mint ", "
|
||||||
.BR lime ", " peach ", " orange ", " latte ", and " normal
|
.BR lime ", " peach ", " orange ", " latte ", "
|
||||||
|
.BR rosy ", " beet ", " plum ", " sea ", " sky ", " slate ", "
|
||||||
|
.BR teal ", " sage ", " brown ", " ocher ", " sand ", " tawny ", "
|
||||||
|
.BR brick ", " crimson ", and " normal
|
||||||
-- where \fBnormal\fR means the default foreground or background color.
|
-- where \fBnormal\fR means the default foreground or background color.
|
||||||
|
On such emulators, the color may also be specified as a three-digit hexadecimal
|
||||||
|
number prefixed with \fB#\fR, with the digits representing the amounts of red,
|
||||||
|
green, and blue, respectively. This tells \fBnano\fR to select from the
|
||||||
|
available palette the color that approximates the given values.
|
||||||
|
|
||||||
The color pair may be preceded by \fBbold\fR and/or \fBitalic\fR
|
The color pair may be preceded by \fBbold\fR and/or \fBitalic\fR
|
||||||
(separated by commas) to get a bold and/or slanting typeface,
|
(separated by commas) to get a bold and/or slanting typeface,
|
||||||
if your terminal can do those.
|
if your terminal can do those.
|
||||||
@@ -496,14 +555,23 @@ Rebinds the given \fIkey\fP to the given \fIfunction\fP in the given \fImenu\fP
|
|||||||
.BI bind " key " """" string """" " menu"
|
.BI bind " key " """" string """" " menu"
|
||||||
Makes the given \fIkey\fR produce the given \fIstring\fR in the given
|
Makes the given \fIkey\fR produce the given \fIstring\fR in the given
|
||||||
\fImenu\fR (or in all menus where the key exists when \fBall\fR is used).
|
\fImenu\fR (or in all menus where the key exists when \fBall\fR is used).
|
||||||
The \fIstring\fR can consist of text or commands or a mix of them.
|
Besides literal text and/or control codes, the \fIstring\fR may contain
|
||||||
(To enter a command into the \fIstring\fR, precede its keystroke
|
function names between braces. These functions will be invoked when
|
||||||
with \fBM\-V\fR.)
|
the key is typed. To include a literal opening brace, use \fB{{}\fR.
|
||||||
.TP
|
.TP
|
||||||
.BI unbind " key menu"
|
.BI unbind " key menu"
|
||||||
Unbinds the given \fIkey\fP from the given \fImenu\fP (or from all
|
Unbinds the given \fIkey\fP from the given \fImenu\fP (or from all
|
||||||
menus where the key exists when \fBall\fP is used).
|
menus where the key exists when \fBall\fP is used).
|
||||||
.RE
|
.RE
|
||||||
|
.sp
|
||||||
|
Note that \fBbind \fIkey\fR \fB"{\fIfunction\fB}"\fR \fImenu\fR is equivalent
|
||||||
|
to \fBbind \fIkey\fR \fIfunction\fR \fImenu\fR, except that for the latter form
|
||||||
|
\fBnano\fR will check the availability of the \fIfunction\fR in the given \fImenu\fR
|
||||||
|
at startup time (and report an error if it does not exist there), whereas for the
|
||||||
|
first form \fBnano\fR will check at execution time that the \fIfunction\fR exists
|
||||||
|
but not whether it makes any sense in the current menu. The user has to take care
|
||||||
|
that a function name between braces (or any sequence of them) is appropriate.
|
||||||
|
Strange behavior can result when it is not.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
The format of \fIkey\fP should be one of:
|
The format of \fIkey\fP should be one of:
|
||||||
@@ -529,11 +597,10 @@ no longer be the case, for all letters.
|
|||||||
where \fIN\fR is a numeric value from 1 to 24.
|
where \fIN\fR is a numeric value from 1 to 24.
|
||||||
Example: F10.
|
Example: F10.
|
||||||
(Often, \fBF13\fR to \fBF24\fR can be typed as \fBF1\fR to \fBF12\fR with Shift.)
|
(Often, \fBF13\fR to \fBF24\fR can be typed as \fBF1\fR to \fBF12\fR with Shift.)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR Ins " or " Del .
|
.BR Ins " or " Del .
|
||||||
.RE
|
.RE
|
||||||
|
.sp
|
||||||
Rebinding \fB^M\fR (Enter) or \fB^I\fR (Tab) is probably not a good idea.
|
Rebinding \fB^M\fR (Enter) or \fB^I\fR (Tab) is probably not a good idea.
|
||||||
Rebinding \fB^[\fR (Esc) is not possible, because its keycode
|
Rebinding \fB^[\fR (Esc) is not possible, because its keycode
|
||||||
is the starter byte of Meta keystrokes and escape sequences.
|
is the starter byte of Meta keystrokes and escape sequences.
|
||||||
@@ -616,47 +683,56 @@ Or, when it is set, unsets the mark.
|
|||||||
.B location
|
.B location
|
||||||
Reports the current position of the cursor in the buffer:
|
Reports the current position of the cursor in the buffer:
|
||||||
the line, column, and character positions.
|
the line, column, and character positions.
|
||||||
(The old name of this function, 'curpos', is deprecated.)
|
|
||||||
.TP
|
.TP
|
||||||
.B wordcount
|
.B wordcount
|
||||||
Counts the number of words, lines and characters in the current buffer.
|
Counts and reports on the status bar the number of lines, words,
|
||||||
|
and characters in the current buffer (or in the marked region).
|
||||||
.TP
|
.TP
|
||||||
.B execute
|
.B execute
|
||||||
Prompts for a program to execute. The program's output will be inserted
|
Prompts for a program to execute. The program's output will be inserted
|
||||||
into the current buffer (or into a new buffer when \fBM-F\fR is toggled).
|
into the current buffer (or into a new buffer when \fBM\-F\fR is toggled).
|
||||||
.TP
|
.TP
|
||||||
.B speller
|
.B speller
|
||||||
Invokes a spell-checking program, either the default \fBhunspell\fR or GNU
|
Invokes a spell-checking program, either the default \fBhunspell\fR(1) or GNU
|
||||||
\fBspell\fR, or the one defined by \fB\-\-speller\fR or \fBset speller\fR.
|
\fBspell\fR(1), or the one defined by \fB\-\-speller\fR or \fBset speller\fR.
|
||||||
.TP
|
.TP
|
||||||
.B formatter
|
.B formatter
|
||||||
Invokes a full-buffer-processing program (if the active syntax defines one).
|
Invokes a full-buffer-processing program (if the active syntax defines one).
|
||||||
|
(The current buffer is written out to a temporary file, the program
|
||||||
|
is run on it, and then the temporary file is read back in, replacing
|
||||||
|
the contents of the buffer.)
|
||||||
.TP
|
.TP
|
||||||
.B linter
|
.B linter
|
||||||
Invokes a syntax-checking program (if the active syntax defines one).
|
Invokes a syntax-checking program (if the active syntax defines one).
|
||||||
|
If this program produces lines of the form "filename:linenum:charnum:
|
||||||
|
some message", then the cursor will be put at the indicated position
|
||||||
|
in the mentioned file while showing "some message" on the status bar.
|
||||||
|
You can move from message to message with <PgUp> and <PgDn>,
|
||||||
|
and leave linting mode with \fB^C\fR or <Enter>.
|
||||||
.TP
|
.TP
|
||||||
.B justify
|
.B justify
|
||||||
Justifies the current paragraph. A paragraph is a group of contiguous lines
|
Justifies the current paragraph (or the marked region).
|
||||||
that, apart from possibly the first line, all have the same indentation. The
|
A paragraph is a group of contiguous lines that, apart from possibly
|
||||||
beginning of a paragraph is detected by either this lone line with a differing
|
the first line, all have the same indentation. The beginning of a
|
||||||
|
paragraph is detected by either this lone line with a differing
|
||||||
indentation or by a preceding blank line.
|
indentation or by a preceding blank line.
|
||||||
.TP
|
.TP
|
||||||
.B fulljustify
|
.B fulljustify
|
||||||
Justifies the entire current buffer.
|
Justifies the entire current buffer (or the marked region).
|
||||||
.TP
|
.TP
|
||||||
.B indent
|
.B indent
|
||||||
Indents (shifts to the right) the currently marked text.
|
Indents (shifts to the right) the current line or the marked lines.
|
||||||
.TP
|
.TP
|
||||||
.B unindent
|
.B unindent
|
||||||
Unindents (shifts to the left) the currently marked text.
|
Unindents (shifts to the left) the current line or the marked lines.
|
||||||
.TP
|
.TP
|
||||||
.B comment
|
.B comment
|
||||||
Comments or uncomments the current line or marked lines, using the comment
|
Comments or uncomments the current line or the marked lines,
|
||||||
style specified in the active syntax.
|
using the comment style specified in the active syntax.
|
||||||
.TP
|
.TP
|
||||||
.B complete
|
.B complete
|
||||||
Completes the fragment before the cursor to a full word found elsewhere
|
Completes (when possible) the fragment before the cursor
|
||||||
in the current buffer.
|
to a full word found elsewhere in the current buffer.
|
||||||
.TP
|
.TP
|
||||||
.B left
|
.B left
|
||||||
Goes left one position (in the editor or browser).
|
Goes left one position (in the editor or browser).
|
||||||
@@ -673,10 +749,15 @@ Goes one line down (in the editor or browser).
|
|||||||
.B scrollup
|
.B scrollup
|
||||||
Scrolls the viewport up one row (meaning that the text slides down)
|
Scrolls the viewport up one row (meaning that the text slides down)
|
||||||
while keeping the cursor in the same text position, if possible.
|
while keeping the cursor in the same text position, if possible.
|
||||||
|
(This function is bound by default to <Alt+Up>.
|
||||||
|
If <Alt+Up> does nothing on your Linux console, see the FAQ:
|
||||||
|
.UR https://nano\-editor.org/dist/latest/faq.html#4.1
|
||||||
|
.UE .)
|
||||||
.TP
|
.TP
|
||||||
.B scrolldown
|
.B scrolldown
|
||||||
Scrolls the viewport down one row (meaning that the text slides up)
|
Scrolls the viewport down one row (meaning that the text slides up)
|
||||||
while keeping the cursor in the same text position, if possible.
|
while keeping the cursor in the same text position, if possible.
|
||||||
|
(This function is bound by default to <Alt+Down>.)
|
||||||
.TP
|
.TP
|
||||||
.B center
|
.B center
|
||||||
Scrolls the line with the cursor to the middle of the screen.
|
Scrolls the line with the cursor to the middle of the screen.
|
||||||
@@ -723,8 +804,8 @@ Goes to a specific line (and column if specified). Negative numbers count
|
|||||||
from the end of the file (and end of the line).
|
from the end of the file (and end of the line).
|
||||||
.TP
|
.TP
|
||||||
.B findbracket
|
.B findbracket
|
||||||
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
|
Moves the cursor to the bracket (or brace or parenthesis, etc.) that matches
|
||||||
(pairs) with the one under the cursor.
|
(pairs) with the one under the cursor. See \fBset matchbrackets\fR.
|
||||||
.TP
|
.TP
|
||||||
.B anchor
|
.B anchor
|
||||||
Places an anchor at the current line, or removes it when already present.
|
Places an anchor at the current line, or removes it when already present.
|
||||||
@@ -743,7 +824,8 @@ Switches to editing/viewing the previous buffer when multiple buffers are open.
|
|||||||
Switches to editing/viewing the next buffer when multiple buffers are open.
|
Switches to editing/viewing the next buffer when multiple buffers are open.
|
||||||
.TP
|
.TP
|
||||||
.B verbatim
|
.B verbatim
|
||||||
Inserts the next keystroke verbatim into the file.
|
Inserts the next keystroke verbatim into the file, or begins Unicode input
|
||||||
|
when a hexadecimal digit is typed.
|
||||||
.TP
|
.TP
|
||||||
.B tab
|
.B tab
|
||||||
Inserts a tab at the current cursor location.
|
Inserts a tab at the current cursor location.
|
||||||
@@ -774,8 +856,8 @@ Redoes the last undone action (i.e., it undoes an undo).
|
|||||||
Refreshes the screen.
|
Refreshes the screen.
|
||||||
.TP
|
.TP
|
||||||
.B suspend
|
.B suspend
|
||||||
Suspends the editor (if the suspending function is enabled, see the
|
Suspends the editor and returns control to the shell
|
||||||
\fBsuspendable\fR toggle item below).
|
(until you tell the process to resume execution with \fBfg\fR).
|
||||||
.TP
|
.TP
|
||||||
.B casesens
|
.B casesens
|
||||||
Toggles whether searching/replacing ignores or respects the case of
|
Toggles whether searching/replacing ignores or respects the case of
|
||||||
@@ -853,6 +935,9 @@ Toggles the presence of the two-line list of key bindings at the bottom of the s
|
|||||||
(This toggle is special: it is available in all menus except the help viewer
|
(This toggle is special: it is available in all menus except the help viewer
|
||||||
and the linter. All further toggles are available in the main menu only.)
|
and the linter. All further toggles are available in the main menu only.)
|
||||||
.TP
|
.TP
|
||||||
|
.B zero
|
||||||
|
Toggles the presence of title bar and status bar.
|
||||||
|
.TP
|
||||||
.B constantshow
|
.B constantshow
|
||||||
Toggles the constant display of the current line, column, and character positions.
|
Toggles the constant display of the current line, column, and character positions.
|
||||||
.TP
|
.TP
|
||||||
@@ -880,19 +965,15 @@ is the beginning of a paragraph.
|
|||||||
Toggles whether cutting text will cut the whole line or just from the current cursor
|
Toggles whether cutting text will cut the whole line or just from the current cursor
|
||||||
position to the end of the line.
|
position to the end of the line.
|
||||||
.TP
|
.TP
|
||||||
.B nowrap
|
.B breaklonglines
|
||||||
Toggles whether long lines will be hard-wrapped to the next line.
|
Toggles whether long lines will be hard-wrapped to the next line.
|
||||||
|
(The old name of this function, 'nowrap', is deprecated.)
|
||||||
.TP
|
.TP
|
||||||
.B tabstospaces
|
.B tabstospaces
|
||||||
Toggles whether typed tabs will be converted to spaces.
|
Toggles whether typed tabs will be converted to spaces.
|
||||||
.TP
|
.TP
|
||||||
.B mouse
|
.B mouse
|
||||||
Toggles mouse support.
|
Toggles mouse support.
|
||||||
.TP
|
|
||||||
.B suspendable
|
|
||||||
Toggles whether the suspend keystroke (\fB^Z\fR by default)
|
|
||||||
will actually suspend the editor.
|
|
||||||
(The old name of this function, 'suspendenable', is deprecated.)
|
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
@@ -940,7 +1021,6 @@ The 'go to directory' menu in the file browser.
|
|||||||
The menu for inserting the output from an external command,
|
The menu for inserting the output from an external command,
|
||||||
or for filtering the buffer (or the marked region) through
|
or for filtering the buffer (or the marked region) through
|
||||||
an external command, or for executing one of several tools.
|
an external command, or for executing one of several tools.
|
||||||
(The old form of this menu name, 'extcmd', is deprecated.)
|
|
||||||
.TP
|
.TP
|
||||||
.B spell
|
.B spell
|
||||||
The menu of the integrated spell checker where the user can edit a misspelled word.
|
The menu of the integrated spell checker where the user can edit a misspelled word.
|
||||||
@@ -954,6 +1034,20 @@ For \fBbind\fR it means all menus where the specified \fIfunction\fR exists;
|
|||||||
for \fBunbind\fR it means all menus where the specified \fIkey\fR exists.
|
for \fBunbind\fR it means all menus where the specified \fIkey\fR exists.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
.SH EXAMPLES
|
||||||
|
To make \fBCtrl+Z\fR suspend nano:
|
||||||
|
.sp
|
||||||
|
.RS
|
||||||
|
.B bind ^Z suspend main
|
||||||
|
.RE
|
||||||
|
.sp
|
||||||
|
To make \fBShift+Alt+C\fR copy the marked region to the system's clipboard:
|
||||||
|
.sp
|
||||||
|
.RS
|
||||||
|
.B bind Sh-M-C """{execute}| xsel -ib {enter}{undo}""" main
|
||||||
|
.RE
|
||||||
|
.sp
|
||||||
|
|
||||||
.SH FILES
|
.SH FILES
|
||||||
.TP
|
.TP
|
||||||
.I /etc/nanorc
|
.I /etc/nanorc
|
||||||
@@ -961,6 +1055,13 @@ System-wide configuration file.
|
|||||||
.TP
|
.TP
|
||||||
.IR ~/.nanorc " or " $XDG_CONFIG_HOME/nano/nanorc " or " ~/.config/nano/nanorc
|
.IR ~/.nanorc " or " $XDG_CONFIG_HOME/nano/nanorc " or " ~/.config/nano/nanorc
|
||||||
Per-user configuration file.
|
Per-user configuration file.
|
||||||
|
.TP
|
||||||
|
.I /usr/share/nano/*
|
||||||
|
Syntax definitions for the syntax coloring of common file types
|
||||||
|
(and for less common file types in the \fIextra/\fR subdirectory).
|
||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR nano (1)
|
.BR nano (1)
|
||||||
|
.TP
|
||||||
|
.I https://nano-editor.org/cheatsheet.html
|
||||||
|
An overview of the default key bindings.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.\" Copyright (C) 2002-2007, 2014-2020 Free Software Foundation, Inc.
|
.\" Copyright (C) 2002-2007, 2014-2023 Free Software Foundation, Inc.
|
||||||
.\"
|
.\"
|
||||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||||
.\" under the terms of either of the following licenses:
|
.\" under the terms of either of the following licenses:
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
.\" Documentation License along with this program. If not, see
|
.\" Documentation License along with this program. If not, see
|
||||||
.\" <https://www.gnu.org/licenses/>.
|
.\" <https://www.gnu.org/licenses/>.
|
||||||
.\"
|
.\"
|
||||||
.TH RNANO 1 "version 5.1" "August 2020"
|
.TH RNANO 1 "version 7.2" "January 2023"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
rnano \- a restricted nano
|
rnano \- a restricted nano
|
||||||
|
|||||||
@@ -44,8 +44,7 @@
|
|||||||
## Do case-sensitive searches by default.
|
## Do case-sensitive searches by default.
|
||||||
# set casesensitive
|
# set casesensitive
|
||||||
|
|
||||||
## Constantly display the cursor position in the status bar. Note that
|
## Constantly display the cursor position in the status bar or minibar.
|
||||||
## this overrides "quickblank".
|
|
||||||
# set constantshow
|
# set constantshow
|
||||||
|
|
||||||
## Use cut-from-cursor-to-end-of-line by default.
|
## Use cut-from-cursor-to-end-of-line by default.
|
||||||
@@ -59,6 +58,10 @@
|
|||||||
## will be the terminal's width minus this number.
|
## will be the terminal's width minus this number.
|
||||||
# set fill -8
|
# set fill -8
|
||||||
|
|
||||||
|
## Draw a vertical stripe at the given column, to help judge text width.
|
||||||
|
## (This option does not have a default value.)
|
||||||
|
# set guidestripe 75
|
||||||
|
|
||||||
## Remember the used search/replace strings for the next session.
|
## Remember the used search/replace strings for the next session.
|
||||||
# set historylog
|
# set historylog
|
||||||
|
|
||||||
@@ -76,15 +79,22 @@
|
|||||||
## no plans to implement vim-style undo state in these files.
|
## no plans to implement vim-style undo state in these files.
|
||||||
# set locking
|
# set locking
|
||||||
|
|
||||||
## The opening and closing brackets that can be found by bracket
|
## Fall back to slow libmagic to try and determine an applicable syntax.
|
||||||
## searches. They cannot contain blank characters. The former set must
|
# set magic
|
||||||
## come before the latter set, and both must be in the same order.
|
|
||||||
|
## The opening and closing brackets that are found by a matching-bracket
|
||||||
|
## search. This may not contain blank characters. The opening brackets
|
||||||
|
## must come before the closing ones, and they must be in the same order.
|
||||||
# set matchbrackets "(<[{)>]}"
|
# set matchbrackets "(<[{)>]}"
|
||||||
|
|
||||||
|
## Suppress the title bar and show the filename plus a cursor-position
|
||||||
|
## percentage in the space of the status bar.
|
||||||
|
# set minibar
|
||||||
|
|
||||||
## Enable mouse support, if available for your system. When enabled,
|
## Enable mouse support, if available for your system. When enabled,
|
||||||
## mouse clicks can be used to place the cursor, set the mark (with a
|
## mouse clicks can be used to place the cursor, set the mark (with a
|
||||||
## double click), and execute shortcuts. The mouse will work in the X
|
## double click), and execute shortcuts. The mouse will work in the
|
||||||
## Window System, and on the console when gpm is running.
|
## X Window System, and on the console when gpm is running.
|
||||||
# set mouse
|
# set mouse
|
||||||
|
|
||||||
## Switch on multiple file buffers (inserting a file will put it into
|
## Switch on multiple file buffers (inserting a file will put it into
|
||||||
@@ -112,14 +122,12 @@
|
|||||||
## Preserve the XON and XOFF keys (^Q and ^S).
|
## Preserve the XON and XOFF keys (^Q and ^S).
|
||||||
# set preserve
|
# set preserve
|
||||||
|
|
||||||
## The characters treated as closing punctuation when justifying
|
## The characters treated as closing punctuation when justifying paragraphs.
|
||||||
## paragraphs. They cannot contain blank characters. Only closing
|
## This may not contain blank characters. Only these closing punctuations,
|
||||||
## punctuation, optionally followed by closing brackets, can end
|
## optionally followed by closing brackets, can end sentences.
|
||||||
## sentences.
|
|
||||||
# set punct "!.?"
|
# set punct "!.?"
|
||||||
|
|
||||||
## Do quick status-bar blanking. Status-bar messages will disappear after
|
## Make status-bar messages disappear after 1 keystroke instead of after 20.
|
||||||
## 1 keystroke instead of 26. Note that "constantshow" overrides this.
|
|
||||||
# set quickblank
|
# set quickblank
|
||||||
|
|
||||||
## The regular expression that matches quoting characters in email
|
## The regular expression that matches quoting characters in email
|
||||||
@@ -138,18 +146,17 @@
|
|||||||
|
|
||||||
## Save a changed buffer automatically on exit; don't prompt.
|
## Save a changed buffer automatically on exit; don't prompt.
|
||||||
# set saveonexit
|
# set saveonexit
|
||||||
## (The old form of this option, 'set tempfile', is deprecated.)
|
|
||||||
|
|
||||||
## Put the cursor on the highlighted item in the file browser, and show
|
## Put the cursor on the highlighted item in the file browser, and
|
||||||
## the cursor in the help viewer; useful for people who use a braille
|
## show the cursor in the help viewer; useful for people who use a
|
||||||
## display and people with poor vision.
|
## braille display and people with poor vision.
|
||||||
# set showcursor
|
# set showcursor
|
||||||
|
|
||||||
## Make the Home key smarter. When Home is pressed anywhere but at the
|
## Make the Home key smarter: when Home is pressed anywhere but at the
|
||||||
## very beginning of non-whitespace characters on a line, the cursor
|
## very beginning of non-whitespace characters on a line, the cursor
|
||||||
## will jump to that beginning (either forwards or backwards). If the
|
## will jump to that beginning (either forwards or backwards). If the
|
||||||
## cursor is already at that position, it will jump to the true
|
## cursor is already at that position, it will jump to the true start
|
||||||
## beginning of the line.
|
## of the line (the left edge).
|
||||||
# set smarthome
|
# set smarthome
|
||||||
|
|
||||||
## Spread overlong lines over multiple screen lines.
|
## Spread overlong lines over multiple screen lines.
|
||||||
@@ -159,21 +166,21 @@
|
|||||||
## does not have a default value.
|
## does not have a default value.
|
||||||
# set speller "aspell -x -c"
|
# set speller "aspell -x -c"
|
||||||
|
|
||||||
## Allow nano to be suspended (with ^Z by default).
|
## Use the end of the title bar for some state flags: I = auto-indenting,
|
||||||
# set suspendable
|
## M = mark, L = hard-wrapping long lines, R = recording, S = soft-wrapping.
|
||||||
## (The old form of this option, 'set suspend', is deprecated.)
|
# set stateflags
|
||||||
|
|
||||||
## Use this tab size instead of the default; it must be greater than 0.
|
## Use this tab size instead of the default; it must be greater than 0.
|
||||||
# set tabsize 8
|
# set tabsize 8
|
||||||
|
|
||||||
## Convert typed tabs to spaces.
|
## Convert each typed tab to the fitting number of spaces.
|
||||||
# set tabstospaces
|
# set tabstospaces
|
||||||
|
|
||||||
## Snip whitespace at the end of lines when justifying or hard-wrapping.
|
## Snip whitespace at the end of lines when justifying or hard-wrapping.
|
||||||
# set trimblanks
|
# set trimblanks
|
||||||
|
|
||||||
## Disallow file modification. Why would you want this in an rcfile? ;)
|
## Save files by default in Unix format (also when they were DOS or Mac).
|
||||||
# set view
|
# set unix
|
||||||
|
|
||||||
## The two single-column characters used to display the first characters
|
## The two single-column characters used to display the first characters
|
||||||
## of tabs and spaces. 187 in ISO 8859-1 (0000BB in Unicode) and 183 in
|
## of tabs and spaces. 187 in ISO 8859-1 (0000BB in Unicode) and 183 in
|
||||||
@@ -196,22 +203,33 @@
|
|||||||
## of a single character, and without affecting the cutbuffer).
|
## of a single character, and without affecting the cutbuffer).
|
||||||
# set zap
|
# set zap
|
||||||
|
|
||||||
## Paint the interface elements of nano. These are examples;
|
## Hide the bars plus help lines and use the whole terminal as edit area.
|
||||||
## by default there are no colors, except for errorcolor.
|
# set zero
|
||||||
# set titlecolor bold,lightwhite,blue
|
|
||||||
# set statuscolor bold,lightwhite,green
|
|
||||||
# set errorcolor bold,lightwhite,red
|
## Paint the interface elements of nano. These are examples; there are
|
||||||
|
## no colors by default, except for errorcolor and spotlightcolor.
|
||||||
|
# set titlecolor bold,white,blue
|
||||||
|
# set promptcolor lightwhite,grey
|
||||||
|
# set statuscolor bold,white,green
|
||||||
|
# set errorcolor bold,white,red
|
||||||
|
# set spotlightcolor black,lightyellow
|
||||||
# set selectedcolor lightwhite,magenta
|
# set selectedcolor lightwhite,magenta
|
||||||
# set stripecolor ,yellow
|
# set stripecolor ,yellow
|
||||||
|
# set scrollercolor cyan
|
||||||
# set numbercolor cyan
|
# set numbercolor cyan
|
||||||
# set keycolor cyan
|
# set keycolor cyan
|
||||||
# set functioncolor green
|
# set functioncolor green
|
||||||
|
|
||||||
## In root's .nanorc you might want to use:
|
## In root's .nanorc you might want to use:
|
||||||
# set titlecolor bold,lightwhite,magenta
|
# set titlecolor bold,white,magenta
|
||||||
# set statuscolor bold,lightwhite,magenta
|
# set promptcolor black,yellow
|
||||||
# set errorcolor bold,lightwhite,red
|
# set statuscolor bold,white,magenta
|
||||||
|
# set errorcolor bold,white,red
|
||||||
|
# set spotlightcolor black,orange
|
||||||
# set selectedcolor lightwhite,cyan
|
# set selectedcolor lightwhite,cyan
|
||||||
# set stripecolor ,yellow
|
# set stripecolor ,yellow
|
||||||
|
# set scrollercolor magenta
|
||||||
# set numbercolor magenta
|
# set numbercolor magenta
|
||||||
# set keycolor lightmagenta
|
# set keycolor lightmagenta
|
||||||
# set functioncolor magenta
|
# set functioncolor magenta
|
||||||
@@ -220,7 +238,7 @@
|
|||||||
## === Syntax coloring ===
|
## === Syntax coloring ===
|
||||||
## For all details, see 'man nanorc', section SYNTAX HIGHLIGHTING.
|
## For all details, see 'man nanorc', section SYNTAX HIGHLIGHTING.
|
||||||
|
|
||||||
## To include all existing syntax definitions, you can do:
|
## To include most of the existing syntax definitions, you can do:
|
||||||
# include "@PKGDATADIR@/*.nanorc"
|
# include "@PKGDATADIR@/*.nanorc"
|
||||||
|
|
||||||
## Or you can select just the ones you need. For example:
|
## Or you can select just the ones you need. For example:
|
||||||
@@ -229,7 +247,8 @@
|
|||||||
# include "@PKGDATADIR@/sh.nanorc"
|
# include "@PKGDATADIR@/sh.nanorc"
|
||||||
|
|
||||||
## In @PKGDATADIR@/extra/ you can find some syntaxes that are
|
## In @PKGDATADIR@/extra/ you can find some syntaxes that are
|
||||||
## specific for certain distros or for less common languages.
|
## specific for certain distros or for some less common languages.
|
||||||
|
|
||||||
|
|
||||||
## If <Tab> should always produce four spaces when editing a Python file,
|
## If <Tab> should always produce four spaces when editing a Python file,
|
||||||
## independent of the settings of 'tabsize' and 'tabstospaces':
|
## independent of the settings of 'tabsize' and 'tabstospaces':
|
||||||
@@ -242,6 +261,9 @@
|
|||||||
## === Key bindings ===
|
## === Key bindings ===
|
||||||
## For all details, see 'man nanorc', section REBINDING KEYS.
|
## For all details, see 'man nanorc', section REBINDING KEYS.
|
||||||
|
|
||||||
|
## If you want to suspend nano with one keystroke (instead of with ^T^Z):
|
||||||
|
# bind ^Z suspend main
|
||||||
|
|
||||||
## The <Ctrl+Delete> keystroke deletes the word to the right of the cursor.
|
## The <Ctrl+Delete> keystroke deletes the word to the right of the cursor.
|
||||||
## On some terminals the <Ctrl+Backspace> keystroke produces ^H, which is
|
## On some terminals the <Ctrl+Backspace> keystroke produces ^H, which is
|
||||||
## the ASCII character for backspace, so it is bound by default to the
|
## the ASCII character for backspace, so it is bound by default to the
|
||||||
@@ -251,13 +273,39 @@
|
|||||||
## <Ctrl+Backspace> delete the word to the left of the cursor with:
|
## <Ctrl+Backspace> delete the word to the left of the cursor with:
|
||||||
# bind ^H chopwordleft main
|
# bind ^H chopwordleft main
|
||||||
|
|
||||||
|
## For a more mnemonic Comment keystroke (overriding Cut-from-cursor):
|
||||||
|
# bind M-K comment main
|
||||||
|
|
||||||
|
## If you want ^L to just refresh the screen and not center the cursor:
|
||||||
|
# bind ^L refresh main
|
||||||
|
|
||||||
|
## When you sometimes type M-J instead of M-K, or M-T instead of M-R:
|
||||||
|
# unbind M-J main
|
||||||
|
# unbind M-T main
|
||||||
|
## (Those functions are still accessible through ^T^J and ^T^V.)
|
||||||
|
|
||||||
|
## For quickly uppercasing or lowercasing the word under or after the cursor.
|
||||||
|
## (These effectively select a word and pipe it through a sed command.)
|
||||||
|
#bind Sh-M-U "{nextword}{mark}{prevword}{execute}|sed 's/.*/\U&/'{enter}" main
|
||||||
|
#bind Sh-M-L "{nextword}{mark}{prevword}{execute}|sed 's/.*/\L&/'{enter}" main
|
||||||
|
|
||||||
|
## For copying a marked region to the system clipboard:
|
||||||
|
# bind Sh-M-T "{execute}|xsel -ib{enter}{undo}" main
|
||||||
|
|
||||||
|
## For snipping trailing blanks when you save a file:
|
||||||
|
# bind ^S "{execute}| sed 's/\s\+$//' {enter}{savefile}" main
|
||||||
|
|
||||||
## If you would like nano to have keybindings that are more "usual",
|
## If you would like nano to have keybindings that are more "usual",
|
||||||
## such as ^O for Open, ^F for Find, ^H for Help, and ^Q for Quit,
|
## such as ^O for Open, ^F for Find, ^H for Help, and ^Q for Quit,
|
||||||
## then uncomment these:
|
## then uncomment these:
|
||||||
|
#bind ^X cut main
|
||||||
|
#bind ^C copy main
|
||||||
|
#bind ^V paste all
|
||||||
#bind ^Q exit all
|
#bind ^Q exit all
|
||||||
#bind ^S savefile main
|
#bind ^S savefile main
|
||||||
#bind ^W writeout main
|
#bind ^W writeout main
|
||||||
#bind ^O insert main
|
#bind ^O insert main
|
||||||
|
#set multibuffer
|
||||||
#bind ^H help all
|
#bind ^H help all
|
||||||
#bind ^H exit help
|
#bind ^H exit help
|
||||||
#bind ^F whereis all
|
#bind ^F whereis all
|
||||||
@@ -265,23 +313,19 @@
|
|||||||
#bind ^B wherewas all
|
#bind ^B wherewas all
|
||||||
#bind ^D findprevious all
|
#bind ^D findprevious all
|
||||||
#bind ^R replace main
|
#bind ^R replace main
|
||||||
#bind M-X flipnewbuffer all
|
|
||||||
#bind ^X cut all
|
|
||||||
#bind ^C copy main
|
|
||||||
#bind ^V paste all
|
|
||||||
#bind ^P location main
|
|
||||||
#bind ^A mark main
|
|
||||||
#unbind ^K main
|
|
||||||
#unbind ^U all
|
#unbind ^U all
|
||||||
#unbind ^N main
|
#unbind ^N main
|
||||||
#unbind ^Y all
|
#unbind ^Y all
|
||||||
#unbind M-J main
|
#unbind M-J main
|
||||||
#unbind M-T main
|
#unbind M-T main
|
||||||
|
#bind ^A mark main
|
||||||
|
#bind ^P location main
|
||||||
#bind ^T gotoline main
|
#bind ^T gotoline main
|
||||||
#bind ^T gotodir browser
|
#bind ^T gotodir browser
|
||||||
#bind ^Y speller main
|
#bind ^T cutrestoffile execute
|
||||||
#bind M-U undo main
|
#bind ^L linter execute
|
||||||
#bind M-R redo main
|
#bind ^E execute main
|
||||||
#bind ^U undo main
|
#bind ^K "{mark}{end}{zap}" main
|
||||||
#bind ^E redo main
|
#bind ^U "{mark}{home}{zap}" main
|
||||||
#set multibuffer
|
#bind ^Z undo main
|
||||||
|
#bind ^Y redo main
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# List of available languages.
|
# List of available languages.
|
||||||
bg ca cs da de eo es eu fi fr ga gl hr hu id it ja ko ms nb nl nn pl pt pt_BR ro ru sl sr sv tr uk vi zh_CN zh_TW
|
bg ca cs da de eo es eu fi fr ga gl hr hu id is it ja ka ko ms nb nl pl pt pt_BR ro ru sk sl sq sr sv tr uk vi zh_CN zh_TW
|
||||||
|
|||||||
2099
po/nn.po → po/ka.po
2099
po/nn.po → po/ka.po
File diff suppressed because it is too large
Load Diff
1521
po/nano.pot
1521
po/nano.pot
File diff suppressed because it is too large
Load Diff
1585
po/pt_BR.po
1585
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,9 @@ rm *.po
|
|||||||
wget --recursive --level=1 --accept=po --no-directories --no-verbose \
|
wget --recursive --level=1 --accept=po --no-directories --no-verbose \
|
||||||
https://translationproject.org/latest/nano/ || exit 2
|
https://translationproject.org/latest/nano/ || exit 2
|
||||||
|
|
||||||
|
# This PO file is less than twenty percent translated:
|
||||||
|
rm -v nn.po
|
||||||
|
|
||||||
# Are there now PO files that are not in git yet?
|
# Are there now PO files that are not in git yet?
|
||||||
NEWSTUFF=$(git status --porcelain *.po | grep "^??")
|
NEWSTUFF=$(git status --porcelain *.po | grep "^??")
|
||||||
|
|
||||||
@@ -26,6 +29,11 @@ for pofile in *.po; do
|
|||||||
msgattrib --no-obsolete --no-fuzzy $pofile >trimmed.po || exit 4
|
msgattrib --no-obsolete --no-fuzzy $pofile >trimmed.po || exit 4
|
||||||
mv trimmed.po $pofile || exit 4
|
mv trimmed.po $pofile || exit 4
|
||||||
done
|
done
|
||||||
|
echo
|
||||||
|
|
||||||
|
if grep "[[:cntrl:]]" ./*.po; then
|
||||||
|
echo "*** PO file contains control character"; exit 5;
|
||||||
|
fi
|
||||||
|
|
||||||
# If needed, fix a problem in the Makefile template.
|
# If needed, fix a problem in the Makefile template.
|
||||||
grep -q '^datarootdir' Makefile.in.in || \
|
grep -q '^datarootdir' Makefile.in.in || \
|
||||||
|
|||||||
1580
po/zh_CN.po
1580
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
1571
po/zh_TW.po
1571
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
VERSION="5.1"
|
VERSION="7.2"
|
||||||
|
|
||||||
./configure -C --enable-tiny && make && ./configure -C &&
|
./configure -C --enable-tiny && make && ./configure -C &&
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ po/update_linguas.sh &&
|
|||||||
|
|
||||||
make distcheck && make dist-xz &&
|
make distcheck && make dist-xz &&
|
||||||
|
|
||||||
git add po/*.po po/nano.pot &&
|
git add po/*.po po/nano.pot po/LINGUAS &&
|
||||||
git commit -m "$(git log -1 --grep 'po: up' | grep o: | sed 's/^ //')" &&
|
git commit -m "$(git log -1 --grep 'po: up' | grep o: | sed 's/^ //')" &&
|
||||||
|
|
||||||
gpg -a -b nano-$VERSION.tar.gz &&
|
gpg -a -b nano-$VERSION.tar.gz &&
|
||||||
@@ -20,7 +20,7 @@ gpg -a -b nano-$VERSION.tar.xz &&
|
|||||||
gpg --verify nano-$VERSION.tar.gz.asc &&
|
gpg --verify nano-$VERSION.tar.gz.asc &&
|
||||||
gpg --verify nano-$VERSION.tar.xz.asc &&
|
gpg --verify nano-$VERSION.tar.xz.asc &&
|
||||||
|
|
||||||
git tag -u A0ACE884 -a v$VERSION -m "the nano $VERSION release" &&
|
git tag -u B8E1961F -a v$VERSION -m "the nano $VERSION release" &&
|
||||||
|
|
||||||
make pdf && rm -rf doc/nano.t2p &&
|
make pdf && rm -rf doc/nano.t2p &&
|
||||||
scp doc/nano.pdf bens@wh0rd.org:nano.pdf &&
|
scp doc/nano.pdf bens@wh0rd.org:nano.pdf &&
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ CLEANFILES = revision.h
|
|||||||
if BUILDING_FROM_GIT
|
if BUILDING_FROM_GIT
|
||||||
SOMETHING = "REVISION \"`git describe --tags 2>/dev/null`\""
|
SOMETHING = "REVISION \"`git describe --tags 2>/dev/null`\""
|
||||||
else
|
else
|
||||||
SOMETHING = "NOTHING \"from tarball\""
|
SOMETHING = "PLAINBUILD \"from tarball\""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
nano.o: revision.h
|
nano.o: revision.h
|
||||||
@@ -16,7 +16,8 @@ winio.o: revision.h
|
|||||||
# only when the revision actually changed.
|
# only when the revision actually changed.
|
||||||
revision.h: FORCE
|
revision.h: FORCE
|
||||||
@[ -f $@ ] || touch $@
|
@[ -f $@ ] || touch $@
|
||||||
@echo "#define $(SOMETHING)" | cmp -s $@ - || \
|
@! git describe >/dev/null 2>&1 || \
|
||||||
|
echo "#define $(SOMETHING)" | cmp -s $@ - || \
|
||||||
echo "#define $(SOMETHING)" > $@
|
echo "#define $(SOMETHING)" > $@
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ nano_SOURCES = \
|
|||||||
color.c \
|
color.c \
|
||||||
cut.c \
|
cut.c \
|
||||||
files.c \
|
files.c \
|
||||||
|
folding.c \
|
||||||
global.c \
|
global.c \
|
||||||
help.c \
|
help.c \
|
||||||
history.c \
|
history.c \
|
||||||
|
|||||||
918
src/browser.c
918
src/browser.c
File diff suppressed because it is too large
Load Diff
266
src/chars.c
266
src/chars.c
@@ -1,8 +1,8 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* chars.c -- This file is part of GNU nano. *
|
* chars.c -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 2001-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 2001-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* Copyright (C) 2016-2019 Benno Schulenberg *
|
* Copyright (C) 2016-2021 Benno Schulenberg *
|
||||||
* *
|
* *
|
||||||
* GNU nano is free software: you can redistribute it and/or modify *
|
* GNU nano is free software: you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published *
|
* it under the terms of the GNU General Public License as published *
|
||||||
@@ -51,7 +51,7 @@ bool is_alpha_char(const char *c)
|
|||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
if (mbtowide(&wc, c) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return iswalpha(wc);
|
return iswalpha(wc);
|
||||||
@@ -67,7 +67,7 @@ bool is_alnum_char(const char *c)
|
|||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
if (mbtowide(&wc, c) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return iswalnum(wc);
|
return iswalnum(wc);
|
||||||
@@ -85,7 +85,7 @@ bool is_blank_char(const char *c)
|
|||||||
if ((signed char)*c >= 0)
|
if ((signed char)*c >= 0)
|
||||||
return (*c == ' ' || *c == '\t');
|
return (*c == ' ' || *c == '\t');
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
if (mbtowide(&wc, c) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return iswblank(wc);
|
return iswblank(wc);
|
||||||
@@ -112,7 +112,7 @@ bool is_punct_char(const char *c)
|
|||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
if (mbtowide(&wc, c) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return iswpunct(wc);
|
return iswpunct(wc);
|
||||||
@@ -176,56 +176,123 @@ char control_mbrep(const char *c, bool isdata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
/* Return the width in columns of the given (multibyte) character. */
|
/* Convert the given multibyte sequence c to wide character wc, and return
|
||||||
int mbwidth(const char *c)
|
* the number of bytes in the sequence, or -1 for an invalid sequence. */
|
||||||
|
int mbtowide(wchar_t *wc, const char *c)
|
||||||
{
|
{
|
||||||
/* Ask for the width only when the character isn't plain ASCII. */
|
if ((signed char)*c < 0 && use_utf8) {
|
||||||
if ((signed char)*c <= 0) {
|
unsigned char v1 = (unsigned char)c[0];
|
||||||
wchar_t wc;
|
unsigned char v2 = (unsigned char)c[1] ^ 0x80;
|
||||||
int width;
|
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
if (v2 > 0x3F || v1 < 0xC2)
|
||||||
return 1;
|
return -1;
|
||||||
|
|
||||||
width = wcwidth(wc);
|
if (v1 < 0xE0) {
|
||||||
|
*wc = (((unsigned int)(v1 & 0x1F) << 6) | (unsigned int)v2);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (width < 0)
|
unsigned char v3 = (unsigned char)c[2] ^ 0x80;
|
||||||
return 1;
|
|
||||||
|
|
||||||
return width;
|
if (v3 > 0x3F)
|
||||||
} else
|
return -1;
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert the given Unicode value to a multibyte character, if possible.
|
if (v1 < 0xF0) {
|
||||||
* If the conversion succeeds, return the (dynamically allocated) multibyte
|
if ((v1 > 0xE0 || v2 >= 0x20) && (v1 != 0xED || v2 < 0x20)) {
|
||||||
* character and its length. Otherwise, return a length of zero. */
|
*wc = (((unsigned int)(v1 & 0x0F) << 12) |
|
||||||
char *make_mbchar(long code, int *length)
|
((unsigned int)v2 << 6) | (unsigned int)v3);
|
||||||
{
|
return 3;
|
||||||
char *mb_char = charalloc(MAXCHARLEN);
|
} else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
*length = wctomb(mb_char, (wchar_t)code);
|
unsigned char v4 = (unsigned char)c[3] ^ 0x80;
|
||||||
|
|
||||||
/* Reject invalid Unicode characters. */
|
if (v4 > 0x3F || v1 > 0xF4)
|
||||||
if (*length < 0 || !is_valid_unicode((wchar_t)code)) {
|
return -1;
|
||||||
IGNORE_CALL_RESULT(wctomb(NULL, 0));
|
|
||||||
*length = 0;
|
if ((v1 > 0xF0 || v2 >= 0x10) && (v1 != 0xF4 || v2 < 0x10)) {
|
||||||
|
*wc = (((unsigned int)(v1 & 0x07) << 18) | ((unsigned int)v2 << 12) |
|
||||||
|
((unsigned int)v3 << 6) | (unsigned int)v4);
|
||||||
|
return 4;
|
||||||
|
} else
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mb_char;
|
*wc = (unsigned int)*c;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return TRUE when the given character occupies two cells. */
|
||||||
|
bool is_doublewidth(const char *ch)
|
||||||
|
{
|
||||||
|
wchar_t wc;
|
||||||
|
|
||||||
|
/* Only from U+1100 can code points have double width. */
|
||||||
|
if ((unsigned char)*ch < 0xE1 || !use_utf8)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (mbtowide(&wc, ch) < 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return (wcwidth(wc) == 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return TRUE when the given character occupies zero cells. */
|
||||||
|
bool is_zerowidth(const char *ch)
|
||||||
|
{
|
||||||
|
wchar_t wc;
|
||||||
|
|
||||||
|
/* Only from U+0300 can code points have zero width. */
|
||||||
|
if ((unsigned char)*ch < 0xCC || !use_utf8)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (mbtowide(&wc, ch) < 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
/* Work around an OpenBSD bug -- see https://sv.gnu.org/bugs/?60393. */
|
||||||
|
if (wc >= 0xF0000)
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return (wcwidth(wc) == 0);
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_UTF8 */
|
#endif /* ENABLE_UTF8 */
|
||||||
|
|
||||||
/* Return the length (in bytes) of the character located at *pointer. */
|
/* Return the number of bytes in the character that starts at *pointer. */
|
||||||
int char_length(const char *pointer)
|
int char_length(const char *pointer)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
/* If possibly a multibyte character, get its length; otherwise, it's 1. */
|
if ((unsigned char)*pointer > 0xC1 && use_utf8) {
|
||||||
if ((signed char)*pointer < 0) {
|
unsigned char c1 = (unsigned char)pointer[0];
|
||||||
int length = mblen(pointer, MAXCHARLEN);
|
unsigned char c2 = (unsigned char)pointer[1];
|
||||||
|
|
||||||
return (length < 0 ? 1 : length);
|
if ((c2 ^ 0x80) > 0x3F)
|
||||||
} else
|
return 1;
|
||||||
|
|
||||||
|
if (c1 < 0xE0)
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
if (((unsigned char)pointer[2] ^ 0x80) > 0x3F)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (c1 < 0xF0) {
|
||||||
|
if ((c1 > 0xE0 || c2 >= 0xA0) && (c1 != 0xED || c2 < 0xA0))
|
||||||
|
return 3;
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((unsigned char)pointer[3] ^ 0x80) > 0x3F)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (c1 > 0xF4)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if ((c1 > 0xF0 || c2 >= 0x90) && (c1 != 0xF4 || c2 < 0x90))
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -236,15 +303,7 @@ size_t mbstrlen(const char *pointer)
|
|||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
|
|
||||||
while (*pointer != '\0') {
|
while (*pointer != '\0') {
|
||||||
#ifdef ENABLE_UTF8
|
pointer += char_length(pointer);
|
||||||
if ((signed char)*pointer < 0) {
|
|
||||||
int length = mblen(pointer, MAXCHARLEN);
|
|
||||||
|
|
||||||
pointer += (length < 0 ? 1 : length);
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
pointer++;
|
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,19 +314,7 @@ size_t mbstrlen(const char *pointer)
|
|||||||
* given string, and return a copy of this character in *thechar. */
|
* given string, and return a copy of this character in *thechar. */
|
||||||
int collect_char(const char *string, char *thechar)
|
int collect_char(const char *string, char *thechar)
|
||||||
{
|
{
|
||||||
int charlen;
|
int charlen = char_length(string);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
|
||||||
/* If this is a UTF-8 starter byte, get the number of bytes of the character. */
|
|
||||||
if ((signed char)*string < 0) {
|
|
||||||
charlen = mblen(string, MAXCHARLEN);
|
|
||||||
|
|
||||||
/* When the multibyte sequence is invalid, only take the first byte. */
|
|
||||||
if (charlen <= 0)
|
|
||||||
charlen = 1;
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
charlen = 1;
|
|
||||||
|
|
||||||
for (int i = 0; i < charlen; i++)
|
for (int i = 0; i < charlen; i++)
|
||||||
thechar[i] = string[i];
|
thechar[i] = string[i];
|
||||||
@@ -280,20 +327,29 @@ int collect_char(const char *string, char *thechar)
|
|||||||
int advance_over(const char *string, size_t *column)
|
int advance_over(const char *string, size_t *column)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if ((signed char)*string < 0) {
|
if ((signed char)*string < 0 && use_utf8) {
|
||||||
int charlen = mblen(string, MAXCHARLEN);
|
/* A UTF-8 upper control code has two bytes and takes two columns. */
|
||||||
|
if (((unsigned char)string[0] == 0xC2 && (signed char)string[1] < -96)) {
|
||||||
if (charlen > 0) {
|
*column += 2;
|
||||||
if (is_cntrl_char(string))
|
return 2;
|
||||||
*column += 2;
|
|
||||||
else
|
|
||||||
*column += mbwidth(string);
|
|
||||||
} else {
|
} else {
|
||||||
charlen = 1;
|
wchar_t wc;
|
||||||
*column += 1;
|
int charlen = mbtowide(&wc, string);
|
||||||
}
|
|
||||||
|
|
||||||
return charlen;
|
if (charlen < 0) {
|
||||||
|
*column += 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int width = wcwidth(wc);
|
||||||
|
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
*column += (width < 0 || wc >= 0xF0000) ? 1 : width;
|
||||||
|
#else
|
||||||
|
*column += (width < 0) ? 1 : width;
|
||||||
|
#endif
|
||||||
|
return charlen;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -302,12 +358,8 @@ int advance_over(const char *string, size_t *column)
|
|||||||
*column += tabsize - *column % tabsize;
|
*column += tabsize - *column % tabsize;
|
||||||
else
|
else
|
||||||
*column += 2;
|
*column += 2;
|
||||||
} else if (*string == 0x7F)
|
} else if (0x7E < (unsigned char)*string && (unsigned char)*string < 0xA0)
|
||||||
*column += 2;
|
*column += 2;
|
||||||
#ifndef ENABLE_UTF8
|
|
||||||
else if (0x7F < (unsigned char)*string && (unsigned char)*string < 0xA0)
|
|
||||||
*column += 2;
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
*column += 1;
|
*column += 1;
|
||||||
|
|
||||||
@@ -374,8 +426,24 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
|||||||
wchar_t wc1, wc2;
|
wchar_t wc1, wc2;
|
||||||
|
|
||||||
while (*s1 != '\0' && *s2 != '\0' && n > 0) {
|
while (*s1 != '\0' && *s2 != '\0' && n > 0) {
|
||||||
bool bad1 = (mbtowc(&wc1, s1, MAXCHARLEN) < 0);
|
if ((signed char)*s1 >= 0 && (signed char)*s2 >= 0) {
|
||||||
bool bad2 = (mbtowc(&wc2, s2, MAXCHARLEN) < 0);
|
if ('A' <= (*s1 & 0x5F) && (*s1 & 0x5F) <= 'Z') {
|
||||||
|
if ('A' <= (*s2 & 0x5F) && (*s2 & 0x5F) <= 'Z') {
|
||||||
|
if ((*s1 & 0x5F) != (*s2 & 0x5F))
|
||||||
|
return ((*s1 & 0x5F) - (*s2 & 0x5F));
|
||||||
|
} else
|
||||||
|
return ((*s1 | 0x20) - *s2);
|
||||||
|
} else if ('A' <= (*s2 & 0x5F) && (*s2 & 0x5F) <= 'Z')
|
||||||
|
return (*s1 - (*s2 | 0x20));
|
||||||
|
else if (*s1 != *s2)
|
||||||
|
return (*s1 - *s2);
|
||||||
|
|
||||||
|
s1++; s2++; n--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool bad1 = (mbtowide(&wc1, s1) < 0);
|
||||||
|
bool bad2 = (mbtowide(&wc2, s2) < 0);
|
||||||
|
|
||||||
if (bad1 || bad2) {
|
if (bad1 || bad2) {
|
||||||
if (*s1 != *s2)
|
if (*s1 != *s2)
|
||||||
@@ -430,7 +498,7 @@ char *revstrstr(const char *haystack, const char *needle,
|
|||||||
size_t tail_len = strlen(pointer);
|
size_t tail_len = strlen(pointer);
|
||||||
|
|
||||||
if (tail_len < needle_len)
|
if (tail_len < needle_len)
|
||||||
pointer += tail_len - needle_len;
|
pointer -= (needle_len - tail_len);
|
||||||
|
|
||||||
while (pointer >= haystack) {
|
while (pointer >= haystack) {
|
||||||
if (strncmp(pointer, needle, needle_len) == 0)
|
if (strncmp(pointer, needle, needle_len) == 0)
|
||||||
@@ -450,7 +518,7 @@ char *revstrcasestr(const char *haystack, const char *needle,
|
|||||||
size_t tail_len = strlen(pointer);
|
size_t tail_len = strlen(pointer);
|
||||||
|
|
||||||
if (tail_len < needle_len)
|
if (tail_len < needle_len)
|
||||||
pointer += tail_len - needle_len;
|
pointer -= (needle_len - tail_len);
|
||||||
|
|
||||||
while (pointer >= haystack) {
|
while (pointer >= haystack) {
|
||||||
if (strncasecmp(pointer, needle, needle_len) == 0)
|
if (strncasecmp(pointer, needle, needle_len) == 0)
|
||||||
@@ -472,7 +540,7 @@ char *mbrevstrcasestr(const char *haystack, const char *needle,
|
|||||||
size_t tail_len = mbstrlen(pointer);
|
size_t tail_len = mbstrlen(pointer);
|
||||||
|
|
||||||
if (tail_len < needle_len)
|
if (tail_len < needle_len)
|
||||||
pointer += tail_len - needle_len;
|
pointer -= (needle_len - tail_len);
|
||||||
|
|
||||||
if (pointer < haystack)
|
if (pointer < haystack)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -500,13 +568,13 @@ char *mbstrchr(const char *string, const char *chr)
|
|||||||
bool bad_s = FALSE, bad_c = FALSE;
|
bool bad_s = FALSE, bad_c = FALSE;
|
||||||
wchar_t ws, wc;
|
wchar_t ws, wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, chr, MAXCHARLEN) < 0) {
|
if (mbtowide(&wc, chr) < 0) {
|
||||||
wc = (unsigned char)*chr;
|
wc = (unsigned char)*chr;
|
||||||
bad_c = TRUE;
|
bad_c = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*string != '\0') {
|
while (*string != '\0') {
|
||||||
int symlen = mbtowc(&ws, string, MAXCHARLEN);
|
int symlen = mbtowide(&ws, string);
|
||||||
|
|
||||||
if (symlen < 0) {
|
if (symlen < 0) {
|
||||||
ws = (unsigned char)*string;
|
ws = (unsigned char)*string;
|
||||||
@@ -568,22 +636,15 @@ char *mbrevstrpbrk(const char *head, const char *accept, const char *pointer)
|
|||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || defined(ENABLE_JUSTIFY))
|
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || defined(ENABLE_JUSTIFY))
|
||||||
/* Return TRUE if the given string contains at least one blank character,
|
/* Return TRUE if the given string contains at least one blank character. */
|
||||||
* and FALSE otherwise. */
|
|
||||||
bool has_blank_char(const char *string)
|
bool has_blank_char(const char *string)
|
||||||
{
|
{
|
||||||
char symbol[MAXCHARLEN];
|
while (*string != '\0' && !is_blank_char(string))
|
||||||
|
string += char_length(string);
|
||||||
|
|
||||||
while (*string != '\0') {
|
return *string;
|
||||||
string += collect_char(string, symbol);
|
|
||||||
|
|
||||||
if (is_blank_char(symbol))
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_NANORC && (!NANO_TINY || ENABLE_JUSTIFY) */
|
#endif
|
||||||
|
|
||||||
/* Return TRUE when the given string is empty or consists of only blanks. */
|
/* Return TRUE when the given string is empty or consists of only blanks. */
|
||||||
bool white_string(const char *string)
|
bool white_string(const char *string)
|
||||||
@@ -593,14 +654,3 @@ bool white_string(const char *string)
|
|||||||
|
|
||||||
return !*string;
|
return !*string;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
|
||||||
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
|
|
||||||
bool is_valid_unicode(wchar_t wc)
|
|
||||||
{
|
|
||||||
return ((0 <= wc && wc <= 0xD7FF) ||
|
|
||||||
(0xE000 <= wc && wc <= 0xFDCF) ||
|
|
||||||
(0xFDF0 <= wc && wc <= 0xFFFD) ||
|
|
||||||
(0xFFFF < wc && wc <= 0x10FFFF && (wc & 0xFFFF) <= 0xFFFD));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
167
src/color.c
167
src/color.c
@@ -1,8 +1,8 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* color.c -- This file is part of GNU nano. *
|
* color.c -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 2001-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 2001-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
* Copyright (C) 2014-2017, 2020, 2021 Benno Schulenberg *
|
||||||
* *
|
* *
|
||||||
* GNU nano is free software: you can redistribute it and/or modify *
|
* GNU nano is free software: you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published *
|
* it under the terms of the GNU General Public License as published *
|
||||||
@@ -29,15 +29,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* For early versions of ncurses-6.0, use an additional A_PROTECT attribute
|
|
||||||
* for all colors, in order to work around an ncurses miscoloring bug. */
|
|
||||||
#if defined(NCURSES_VERSION_MAJOR) && (NCURSES_VERSION_MAJOR == 6) && \
|
|
||||||
(NCURSES_VERSION_MINOR == 0) && (NCURSES_VERSION_PATCH < 20151017)
|
|
||||||
#define A_BANDAID A_PROTECT
|
|
||||||
#else
|
|
||||||
#define A_BANDAID A_NORMAL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static bool defaults_allowed = FALSE;
|
static bool defaults_allowed = FALSE;
|
||||||
/* Whether ncurses accepts -1 to mean "default color". */
|
/* Whether ncurses accepts -1 to mean "default color". */
|
||||||
|
|
||||||
@@ -61,23 +52,32 @@ void set_interface_colorpairs(void)
|
|||||||
combo->bg = COLOR_BLACK;
|
combo->bg = COLOR_BLACK;
|
||||||
}
|
}
|
||||||
init_pair(index + 1, combo->fg, combo->bg);
|
init_pair(index + 1, combo->fg, combo->bg);
|
||||||
interface_color_pair[index] = COLOR_PAIR(index + 1) | A_BANDAID |
|
interface_color_pair[index] = COLOR_PAIR(index + 1) | combo->attributes;
|
||||||
combo->attributes;
|
rescind_colors = FALSE;
|
||||||
} else {
|
} else {
|
||||||
if (index == FUNCTION_TAG)
|
if (index == FUNCTION_TAG || index == SCROLL_BAR)
|
||||||
interface_color_pair[index] = A_NORMAL;
|
interface_color_pair[index] = A_NORMAL;
|
||||||
else if (index == GUIDE_STRIPE)
|
else if (index == GUIDE_STRIPE)
|
||||||
interface_color_pair[index] = A_REVERSE;
|
interface_color_pair[index] = A_REVERSE;
|
||||||
|
else if (index == SPOTLIGHTED) {
|
||||||
|
init_pair(index + 1, COLOR_BLACK, COLOR_YELLOW + (COLORS > 15 ? 8 : 0));
|
||||||
|
interface_color_pair[index] = COLOR_PAIR(index + 1);
|
||||||
|
} else if (index == MINI_INFOBAR || index == PROMPT_BAR)
|
||||||
|
interface_color_pair[index] = interface_color_pair[TITLE_BAR];
|
||||||
else if (index == ERROR_MESSAGE) {
|
else if (index == ERROR_MESSAGE) {
|
||||||
init_pair(index + 1, COLOR_WHITE, COLOR_RED);
|
init_pair(index + 1, COLOR_WHITE, COLOR_RED);
|
||||||
interface_color_pair[index] = COLOR_PAIR(index + 1) |
|
interface_color_pair[index] = COLOR_PAIR(index + 1) | A_BOLD;
|
||||||
A_BOLD | A_BANDAID;
|
|
||||||
} else
|
} else
|
||||||
interface_color_pair[index] = hilite_attribute;
|
interface_color_pair[index] = hilite_attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(color_combo[index]);
|
free(color_combo[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rescind_colors) {
|
||||||
|
interface_color_pair[SPOTLIGHTED] = A_REVERSE;
|
||||||
|
interface_color_pair[ERROR_MESSAGE] = A_REVERSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assign a pair number to each of the foreground/background color combinations
|
/* Assign a pair number to each of the foreground/background color combinations
|
||||||
@@ -102,7 +102,7 @@ void set_syntax_colorpairs(syntaxtype *sntx)
|
|||||||
|
|
||||||
ink->pairnum = (older != ink) ? older->pairnum : ++number;
|
ink->pairnum = (older != ink) ? older->pairnum : ++number;
|
||||||
|
|
||||||
ink->attributes |= COLOR_PAIR(ink->pairnum) | A_BANDAID;
|
ink->attributes |= COLOR_PAIR(ink->pairnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,19 +125,9 @@ void prepare_palette(void)
|
|||||||
* the list starting at head. Return TRUE upon success. */
|
* the list starting at head. Return TRUE upon success. */
|
||||||
bool found_in_list(regexlisttype *head, const char *shibboleth)
|
bool found_in_list(regexlisttype *head, const char *shibboleth)
|
||||||
{
|
{
|
||||||
regexlisttype *item;
|
for (regexlisttype *item = head; item != NULL; item = item->next)
|
||||||
regex_t rgx;
|
if (regexec(item->one_rgx, shibboleth, 0, NULL, 0) == 0)
|
||||||
|
|
||||||
for (item = head; item != NULL; item = item->next) {
|
|
||||||
regcomp(&rgx, item->full_regex, NANO_REG_EXTENDED);
|
|
||||||
|
|
||||||
if (regexec(&rgx, shibboleth, 0, NULL, 0) == 0) {
|
|
||||||
regfree(&rgx);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
regfree(&rgx);
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -189,8 +179,8 @@ void find_and_prime_applicable_syntax(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBMAGIC
|
#ifdef HAVE_LIBMAGIC
|
||||||
/* If we still don't have an answer, try using magic. */
|
/* If we still don't have an answer, try using magic (when requested). */
|
||||||
if (sntx == NULL && !inhelp) {
|
if (sntx == NULL && !inhelp && ISSET(USE_MAGIC)) {
|
||||||
struct stat fileinfo;
|
struct stat fileinfo;
|
||||||
magic_t cookie = NULL;
|
magic_t cookie = NULL;
|
||||||
const char *magicstring = NULL;
|
const char *magicstring = NULL;
|
||||||
@@ -240,15 +230,6 @@ void find_and_prime_applicable_syntax(void)
|
|||||||
openfile->syntax = sntx;
|
openfile->syntax = sntx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate and initialize (for the given line) the cache for multiline info. */
|
|
||||||
void set_up_multicache(linestruct *line)
|
|
||||||
{
|
|
||||||
line->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
|
|
||||||
|
|
||||||
for (short index = 0; index < openfile->syntax->nmultis; index++)
|
|
||||||
line->multidata[index] = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Determine whether the matches of multiline regexes are still the same,
|
/* Determine whether the matches of multiline regexes are still the same,
|
||||||
* and if not, schedule a screen refresh, so things will be repainted. */
|
* and if not, schedule a screen refresh, so things will be repainted. */
|
||||||
void check_the_multis(linestruct *line)
|
void check_the_multis(linestruct *line)
|
||||||
@@ -262,8 +243,10 @@ void check_the_multis(linestruct *line)
|
|||||||
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0)
|
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (line->multidata == NULL)
|
if (line->multidata == NULL) {
|
||||||
set_up_multicache(line);
|
refresh_needed = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
|
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
|
||||||
/* If it's not a multiline regex, skip. */
|
/* If it's not a multiline regex, skip. */
|
||||||
@@ -275,23 +258,29 @@ void check_the_multis(linestruct *line)
|
|||||||
anend = (regexec(ink->end, afterstart, 1, &endmatch, 0) == 0);
|
anend = (regexec(ink->end, afterstart, 1, &endmatch, 0) == 0);
|
||||||
|
|
||||||
/* Check whether the multidata still matches the current situation. */
|
/* Check whether the multidata still matches the current situation. */
|
||||||
if (line->multidata[ink->id] == CNONE ||
|
if (line->multidata[ink->id] == NOTHING) {
|
||||||
line->multidata[ink->id] == CWHOLELINE) {
|
if (!astart)
|
||||||
if (!astart && !anend)
|
|
||||||
continue;
|
continue;
|
||||||
} else if (line->multidata[ink->id] == CSTARTENDHERE) {
|
} else if (line->multidata[ink->id] == WHOLELINE) {
|
||||||
if (astart && anend && startmatch.rm_so < endmatch.rm_so)
|
/* Ensure that a detected start match is not actually an end match. */
|
||||||
|
if (!anend && (!astart || regexec(ink->end, line->data, 1,
|
||||||
|
&endmatch, 0) != 0))
|
||||||
continue;
|
continue;
|
||||||
} else if (line->multidata[ink->id] == CBEGINBEFORE) {
|
} else if (line->multidata[ink->id] == JUSTONTHIS) {
|
||||||
if (!astart && anend)
|
if (astart && anend && regexec(ink->start, line->data + startmatch.rm_eo +
|
||||||
|
endmatch.rm_eo, 1, &startmatch, 0) != 0)
|
||||||
continue;
|
continue;
|
||||||
} else if (line->multidata[ink->id] == CENDAFTER) {
|
} else if (line->multidata[ink->id] == STARTSHERE) {
|
||||||
if (astart && !anend)
|
if (astart && !anend)
|
||||||
continue;
|
continue;
|
||||||
|
} else if (line->multidata[ink->id] == ENDSHERE) {
|
||||||
|
if (!astart && anend)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There is a mismatch, so something changed: repaint. */
|
/* There is a mismatch, so something changed: repaint. */
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
|
perturbed = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -304,13 +293,19 @@ void precalc_multicolorinfo(void)
|
|||||||
regmatch_t startmatch, endmatch;
|
regmatch_t startmatch, endmatch;
|
||||||
linestruct *line, *tailline;
|
linestruct *line, *tailline;
|
||||||
|
|
||||||
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0 ||
|
if (!openfile->syntax || openfile->syntax->nmultis == 0 || ISSET(NO_SYNTAX))
|
||||||
openfile->filetop->multidata || ISSET(NO_SYNTAX))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//#define TIMEPRECALC 123
|
||||||
|
#ifdef TIMEPRECALC
|
||||||
|
#include <time.h>
|
||||||
|
clock_t start = clock();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* For each line, allocate cache space for the multiline-regex info. */
|
/* For each line, allocate cache space for the multiline-regex info. */
|
||||||
for (line = openfile->filetop; line != NULL; line = line->next)
|
for (line = openfile->filetop; line != NULL; line = line->next)
|
||||||
set_up_multicache(line);
|
if (!line->multidata)
|
||||||
|
line->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short));
|
||||||
|
|
||||||
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
|
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
|
||||||
/* If this is not a multi-line regex, skip it. */
|
/* If this is not a multi-line regex, skip it. */
|
||||||
@@ -321,66 +316,64 @@ void precalc_multicolorinfo(void)
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
/* Assume nothing applies until proven otherwise below. */
|
/* Assume nothing applies until proven otherwise below. */
|
||||||
line->multidata[ink->id] = CNONE;
|
line->multidata[ink->id] = NOTHING;
|
||||||
|
|
||||||
/* For an unpaired start match, mark all remaining lines. */
|
/* When the line contains a start match, look for an end,
|
||||||
if (line->prev && line->prev->multidata[ink->id] == CWOULDBE) {
|
* and if found, mark all the lines that are affected. */
|
||||||
line->multidata[ink->id] = CWOULDBE;
|
while (regexec(ink->start, line->data + index, 1, &startmatch,
|
||||||
continue;
|
(index == 0) ? 0 : REG_NOTBOL) == 0) {
|
||||||
}
|
|
||||||
|
|
||||||
/* When the line contains a start match, look for an end, and if
|
|
||||||
* found, mark all the lines that are affected. */
|
|
||||||
while (regexec(ink->start, line->data + index, 1,
|
|
||||||
&startmatch, (index == 0) ? 0 : REG_NOTBOL) == 0) {
|
|
||||||
/* Begin looking for an end match after the start match. */
|
/* Begin looking for an end match after the start match. */
|
||||||
index += startmatch.rm_eo;
|
index += startmatch.rm_eo;
|
||||||
|
|
||||||
/* If there is an end match on this line, mark the line, but
|
/* If there is an end match on this same line, mark the line,
|
||||||
* continue looking for other starts after it. */
|
* but continue looking for other starts after it. */
|
||||||
if (regexec(ink->end, line->data + index, 1,
|
if (regexec(ink->end, line->data + index, 1, &endmatch,
|
||||||
&endmatch, (index == 0) ? 0 : REG_NOTBOL) == 0) {
|
(index == 0) ? 0 : REG_NOTBOL) == 0) {
|
||||||
line->multidata[ink->id] = CSTARTENDHERE;
|
line->multidata[ink->id] = JUSTONTHIS;
|
||||||
|
|
||||||
index += endmatch.rm_eo;
|
index += endmatch.rm_eo;
|
||||||
/* If both start and end are mere anchors, step ahead. */
|
|
||||||
if (startmatch.rm_so == startmatch.rm_eo &&
|
/* If the total match has zero length, force an advance. */
|
||||||
endmatch.rm_so == endmatch.rm_eo) {
|
if (startmatch.rm_eo - startmatch.rm_so + endmatch.rm_eo == 0) {
|
||||||
/* When at end-of-line, we're done. */
|
/* When at end-of-line, there is no other start. */
|
||||||
if (line->data[index] == '\0')
|
if (line->data[index] == '\0')
|
||||||
break;
|
break;
|
||||||
index = step_right(line->data, index);
|
index = step_right(line->data, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look for an end match on later lines. */
|
/* Look for an end match on later lines. */
|
||||||
tailline = line->next;
|
tailline = line->next;
|
||||||
|
|
||||||
while (tailline != NULL) {
|
while (tailline && regexec(ink->end, tailline->data,
|
||||||
if (regexec(ink->end, tailline->data, 1, &endmatch, 0) == 0)
|
1, &endmatch, 0) != 0)
|
||||||
break;
|
|
||||||
tailline = tailline->next;
|
tailline = tailline->next;
|
||||||
}
|
|
||||||
|
line->multidata[ink->id] = STARTSHERE;
|
||||||
|
|
||||||
|
// Note that this also advances the line in the main loop.
|
||||||
|
for (line = line->next; line != tailline; line = line->next)
|
||||||
|
line->multidata[ink->id] = WHOLELINE;
|
||||||
|
|
||||||
if (tailline == NULL) {
|
if (tailline == NULL) {
|
||||||
line->multidata[ink->id] = CWOULDBE;
|
line = openfile->filebot;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We found it, we found it, la la la la la. Mark all
|
tailline->multidata[ink->id] = ENDSHERE;
|
||||||
* the lines in between and the end properly. */
|
|
||||||
line->multidata[ink->id] = CENDAFTER;
|
|
||||||
|
|
||||||
for (line = line->next; line != tailline; line = line->next)
|
/* Look for a possible new start after the end match. */
|
||||||
line->multidata[ink->id] = CWHOLELINE;
|
|
||||||
|
|
||||||
tailline->multidata[ink->id] = CBEGINBEFORE;
|
|
||||||
|
|
||||||
/* Begin looking for a new start after the end match. */
|
|
||||||
index = endmatch.rm_eo;
|
index = endmatch.rm_eo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TIMEPRECALC
|
||||||
|
statusline(INFO, "Precalculation: %.1f ms", 1000 * (double)(clock() - start) / CLOCKS_PER_SEC);
|
||||||
|
napms(1200);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ENABLE_COLOR */
|
#endif /* ENABLE_COLOR */
|
||||||
|
|||||||
148
src/cut.c
148
src/cut.c
@@ -1,9 +1,9 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* cut.c -- This file is part of GNU nano. *
|
* cut.c -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 1999-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* Copyright (C) 2014 Mark Majeres *
|
* Copyright (C) 2014 Mark Majeres *
|
||||||
* Copyright (C) 2016, 2018, 2019 Benno Schulenberg *
|
* Copyright (C) 2016, 2018-2020 Benno Schulenberg *
|
||||||
* *
|
* *
|
||||||
* GNU nano is free software: you can redistribute it and/or modify *
|
* GNU nano is free software: you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published *
|
* it under the terms of the GNU General Public License as published *
|
||||||
@@ -34,7 +34,7 @@ void do_deletion(undo_type action)
|
|||||||
int charlen = char_length(openfile->current->data + openfile->current_x);
|
int charlen = char_length(openfile->current->data + openfile->current_x);
|
||||||
size_t line_len = strlen(openfile->current->data + openfile->current_x);
|
size_t line_len = strlen(openfile->current->data + openfile->current_x);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
size_t old_amount = openfile->current->extrarows;
|
size_t old_amount = ISSET(SOFTWRAP) ? extra_chunks_in(openfile->current) : 0;
|
||||||
|
|
||||||
/* If the type of action changed or the cursor moved to a different
|
/* If the type of action changed or the cursor moved to a different
|
||||||
* line, create a new undo item, otherwise update the existing item. */
|
* line, create a new undo item, otherwise update the existing item. */
|
||||||
@@ -48,14 +48,11 @@ void do_deletion(undo_type action)
|
|||||||
memmove(&openfile->current->data[openfile->current_x],
|
memmove(&openfile->current->data[openfile->current_x],
|
||||||
&openfile->current->data[openfile->current_x + charlen],
|
&openfile->current->data[openfile->current_x + charlen],
|
||||||
line_len - charlen + 1);
|
line_len - charlen + 1);
|
||||||
|
UNFOLD_SEGMENT(openfile->current);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* When softwrapping, recompute the number of chunks in the line,
|
/* When softwrapping, a changed number of chunks requires a refresh. */
|
||||||
* and schedule a refresh if the number changed. */
|
if (ISSET(SOFTWRAP) && extra_chunks_in(openfile->current) != old_amount)
|
||||||
if (ISSET(SOFTWRAP)) {
|
refresh_needed = TRUE;
|
||||||
openfile->current->extrarows = extra_chunks_in(openfile->current);
|
|
||||||
if (openfile->current->extrarows != old_amount)
|
|
||||||
refresh_needed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adjust the mark if it is after the cursor on the current line. */
|
/* Adjust the mark if it is after the cursor on the current line. */
|
||||||
if (openfile->mark == openfile->current &&
|
if (openfile->mark == openfile->current &&
|
||||||
@@ -66,6 +63,9 @@ void do_deletion(undo_type action)
|
|||||||
} else if (openfile->current != openfile->filebot) {
|
} else if (openfile->current != openfile->filebot) {
|
||||||
linestruct *joining = openfile->current->next;
|
linestruct *joining = openfile->current->next;
|
||||||
|
|
||||||
|
UNFOLD_SEGMENT(openfile->current);
|
||||||
|
UNFOLD_SEGMENT(joining);
|
||||||
|
|
||||||
/* If there is a magic line, and we're before it: don't eat it. */
|
/* If there is a magic line, and we're before it: don't eat it. */
|
||||||
if (joining == openfile->filebot && openfile->current_x != 0 &&
|
if (joining == openfile->filebot && openfile->current_x != 0 &&
|
||||||
!ISSET(NO_NEWLINES)) {
|
!ISSET(NO_NEWLINES)) {
|
||||||
@@ -88,16 +88,12 @@ void do_deletion(undo_type action)
|
|||||||
openfile->current->has_anchor |= joining->has_anchor;
|
openfile->current->has_anchor |= joining->has_anchor;
|
||||||
#endif
|
#endif
|
||||||
/* Add the content of the next line to that of the current one. */
|
/* Add the content of the next line to that of the current one. */
|
||||||
openfile->current->data = charealloc(openfile->current->data,
|
openfile->current->data = nrealloc(openfile->current->data,
|
||||||
strlen(openfile->current->data) + strlen(joining->data) + 1);
|
strlen(openfile->current->data) + strlen(joining->data) + 1);
|
||||||
strcat(openfile->current->data, joining->data);
|
strcat(openfile->current->data, joining->data);
|
||||||
|
|
||||||
unlink_node(joining);
|
unlink_node(joining);
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
if (ISSET(SOFTWRAP))
|
|
||||||
openfile->current->extrarows = extra_chunks_in(openfile->current);
|
|
||||||
#endif
|
|
||||||
/* Two lines were joined, so do a renumbering and refresh the screen. */
|
/* Two lines were joined, so do a renumbering and refresh the screen. */
|
||||||
renumber_from(openfile->current);
|
renumber_from(openfile->current);
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
@@ -105,6 +101,13 @@ void do_deletion(undo_type action)
|
|||||||
/* We're at the end-of-file: nothing to do. */
|
/* We're at the end-of-file: nothing to do. */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
if (!refresh_needed)
|
||||||
|
check_the_multis(openfile->current);
|
||||||
|
#endif
|
||||||
|
if (!refresh_needed)
|
||||||
|
update_line(openfile->current, openfile->current_x);
|
||||||
|
|
||||||
/* Adjust the file size, and remember it for a possible redo. */
|
/* Adjust the file size, and remember it for a possible redo. */
|
||||||
openfile->totsize--;
|
openfile->totsize--;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
@@ -121,7 +124,14 @@ void do_delete(void)
|
|||||||
zap_text();
|
zap_text();
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
do_deletion(DEL);
|
do_deletion(DEL);
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
while (openfile->current->data[openfile->current_x] != '\0' &&
|
||||||
|
is_zerowidth(openfile->current->data + openfile->current_x))
|
||||||
|
do_deletion(DEL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Backspace over one character. That is, move the cursor left one
|
/* Backspace over one character. That is, move the cursor left one
|
||||||
@@ -133,8 +143,12 @@ void do_backspace(void)
|
|||||||
zap_text();
|
zap_text();
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (openfile->current_x > 0 || openfile->current != openfile->filetop) {
|
if (openfile->current_x > 0) {
|
||||||
do_left();
|
openfile->current_x = step_left(openfile->current->data, openfile->current_x);
|
||||||
|
do_deletion(BACK);
|
||||||
|
} else if (openfile->current != openfile->filetop) {
|
||||||
|
openfile->current = openfile->current->prev;
|
||||||
|
openfile->current_x = strlen(openfile->current->data);
|
||||||
do_deletion(BACK);
|
do_deletion(BACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,7 +197,7 @@ void chop_word(bool forward)
|
|||||||
* on the edge of the original line, then put the cursor on that
|
* on the edge of the original line, then put the cursor on that
|
||||||
* edge instead, so that lines will not be joined unexpectedly. */
|
* edge instead, so that lines will not be joined unexpectedly. */
|
||||||
if (!forward) {
|
if (!forward) {
|
||||||
do_prev_word(ISSET(WORD_BOUNDS));
|
do_prev_word(ALLOW_FOLDED);
|
||||||
if (openfile->current != is_current) {
|
if (openfile->current != is_current) {
|
||||||
if (is_current_x > 0) {
|
if (is_current_x > 0) {
|
||||||
openfile->current = is_current;
|
openfile->current = is_current;
|
||||||
@@ -192,13 +206,14 @@ void chop_word(bool forward)
|
|||||||
openfile->current_x = strlen(openfile->current->data);
|
openfile->current_x = strlen(openfile->current->data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
do_next_word(ISSET(AFTER_ENDS), ISSET(WORD_BOUNDS));
|
do_next_word(ISSET(AFTER_ENDS), ALLOW_FOLDED);
|
||||||
if (openfile->current != is_current &&
|
if (openfile->current != is_current &&
|
||||||
is_current->data[is_current_x] != '\0') {
|
is_current->data[is_current_x] != '\0') {
|
||||||
openfile->current = is_current;
|
openfile->current = is_current;
|
||||||
openfile->current_x = strlen(is_current->data);
|
openfile->current_x = strlen(is_current->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
UNFOLD_SEGMENT(openfile->current);
|
||||||
|
|
||||||
/* Set the mark at the start of that word. */
|
/* Set the mark at the start of that word. */
|
||||||
openfile->mark = openfile->current;
|
openfile->mark = openfile->current;
|
||||||
@@ -247,27 +262,33 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
|
|||||||
bool same_line = (openfile->mark == top);
|
bool same_line = (openfile->mark == top);
|
||||||
bool post_marked = (openfile->mark && (openfile->mark->lineno > top->lineno ||
|
bool post_marked = (openfile->mark && (openfile->mark->lineno > top->lineno ||
|
||||||
(same_line && openfile->mark_x > top_x)));
|
(same_line && openfile->mark_x > top_x)));
|
||||||
bool was_anchored = top->has_anchor;
|
static bool inherited_anchor = FALSE;
|
||||||
|
bool had_anchor = top->has_anchor;
|
||||||
|
|
||||||
if (top == bot && top_x == bot_x)
|
if (top == bot && top_x == bot_x)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (top != bot)
|
if (top != bot) {
|
||||||
for (linestruct *line = top->next; line != bot->next; line = line->next)
|
UNFOLD_SEGMENT(top);
|
||||||
was_anchored |= line->has_anchor;
|
for (linestruct *line = top->next; line != bot->next; line = line->next) {
|
||||||
|
UNFOLD_SEGMENT(line);
|
||||||
|
had_anchor |= line->has_anchor;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (top == bot) {
|
if (top == bot) {
|
||||||
taken = make_new_node(NULL);
|
taken = make_new_node(NULL);
|
||||||
taken->data = measured_copy(top->data + top_x, bot_x - top_x);
|
taken->data = measured_copy(top->data + top_x, bot_x - top_x);
|
||||||
memmove(top->data + top_x, top->data + bot_x,
|
memmove(top->data + top_x, top->data + bot_x, strlen(top->data + bot_x) + 1);
|
||||||
strlen(top->data + bot_x) + 1);
|
|
||||||
last = taken;
|
last = taken;
|
||||||
} else if (top_x == 0 && bot_x == 0) {
|
} else if (top_x == 0 && bot_x == 0) {
|
||||||
taken = top;
|
taken = top;
|
||||||
last = make_new_node(NULL);
|
last = make_new_node(NULL);
|
||||||
last->data = copy_of("");
|
last->data = copy_of("");
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
last->has_anchor = bot->has_anchor;
|
||||||
|
#endif
|
||||||
last->prev = bot->prev;
|
last->prev = bot->prev;
|
||||||
bot->prev->next = last;
|
bot->prev->next = last;
|
||||||
last->next = NULL;
|
last->next = NULL;
|
||||||
@@ -289,7 +310,7 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
|
|||||||
if (bot->next)
|
if (bot->next)
|
||||||
bot->next->prev = top;
|
bot->next->prev = top;
|
||||||
|
|
||||||
top->data = charealloc(top->data, top_x + strlen(bot->data + bot_x) + 1);
|
top->data = nrealloc(top->data, top_x + strlen(bot->data + bot_x) + 1);
|
||||||
strcpy(top->data + top_x, bot->data + bot_x);
|
strcpy(top->data + top_x, bot->data + bot_x);
|
||||||
|
|
||||||
last = bot;
|
last = bot;
|
||||||
@@ -307,11 +328,17 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
|
|||||||
if (cutbuffer == NULL) {
|
if (cutbuffer == NULL) {
|
||||||
cutbuffer = taken;
|
cutbuffer = taken;
|
||||||
cutbottom = last;
|
cutbottom = last;
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
inherited_anchor = taken->has_anchor;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
cutbottom->data = charealloc(cutbottom->data,
|
cutbottom->data = nrealloc(cutbottom->data,
|
||||||
strlen(cutbottom->data) + strlen(taken->data) + 1);
|
strlen(cutbottom->data) + strlen(taken->data) + 1);
|
||||||
strcat(cutbottom->data, taken->data);
|
strcat(cutbottom->data, taken->data);
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
cutbottom->has_anchor = taken->has_anchor && !inherited_anchor;
|
||||||
|
inherited_anchor |= taken->has_anchor;
|
||||||
|
#endif
|
||||||
cutbottom->next = taken->next;
|
cutbottom->next = taken->next;
|
||||||
delete_node(taken);
|
delete_node(taken);
|
||||||
|
|
||||||
@@ -324,10 +351,7 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
|
|||||||
openfile->current_x = top_x;
|
openfile->current_x = top_x;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
openfile->current->has_anchor = was_anchored;
|
openfile->current->has_anchor = had_anchor;
|
||||||
|
|
||||||
if (ISSET(SOFTWRAP))
|
|
||||||
openfile->current->extrarows = extra_chunks_in(openfile->current);
|
|
||||||
|
|
||||||
if (post_marked || same_line)
|
if (post_marked || same_line)
|
||||||
openfile->mark = openfile->current;
|
openfile->mark = openfile->current;
|
||||||
@@ -364,6 +388,8 @@ void ingraft_buffer(linestruct *topline)
|
|||||||
#endif
|
#endif
|
||||||
linestruct *botline = topline;
|
linestruct *botline = topline;
|
||||||
|
|
||||||
|
UNFOLD_SEGMENT(line);
|
||||||
|
|
||||||
while (botline->next != NULL)
|
while (botline->next != NULL)
|
||||||
botline = botline->next;
|
botline = botline->next;
|
||||||
|
|
||||||
@@ -375,16 +401,12 @@ void ingraft_buffer(linestruct *topline)
|
|||||||
|
|
||||||
if (extralen > 0) {
|
if (extralen > 0) {
|
||||||
/* Insert the text of topline at the current cursor position. */
|
/* Insert the text of topline at the current cursor position. */
|
||||||
line->data = charealloc(line->data, length + extralen + 1);
|
line->data = nrealloc(line->data, length + extralen + 1);
|
||||||
memmove(line->data + xpos + extralen, line->data + xpos, length - xpos + 1);
|
memmove(line->data + xpos + extralen, line->data + xpos, length - xpos + 1);
|
||||||
strncpy(line->data + xpos, topline->data, extralen);
|
strncpy(line->data + xpos, topline->data, extralen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topline != botline) {
|
if (topline != botline) {
|
||||||
#ifndef NANO_TINY
|
|
||||||
/* First compute the softwrapped chunks for each line in the graft. */
|
|
||||||
compute_the_extra_rows_per_line_from(topline);
|
|
||||||
#endif
|
|
||||||
/* When inserting at end-of-buffer, update the relevant pointer. */
|
/* When inserting at end-of-buffer, update the relevant pointer. */
|
||||||
if (line->next == NULL)
|
if (line->next == NULL)
|
||||||
openfile->filebot = botline;
|
openfile->filebot = botline;
|
||||||
@@ -401,7 +423,7 @@ void ingraft_buffer(linestruct *topline)
|
|||||||
/* Add the text after the cursor position at the end of botline. */
|
/* Add the text after the cursor position at the end of botline. */
|
||||||
length = strlen(botline->data);
|
length = strlen(botline->data);
|
||||||
extralen = strlen(tailtext);
|
extralen = strlen(tailtext);
|
||||||
botline->data = charealloc(botline->data, length + extralen + 1);
|
botline->data = nrealloc(botline->data, length + extralen + 1);
|
||||||
strcpy(botline->data + length, tailtext);
|
strcpy(botline->data + length, tailtext);
|
||||||
|
|
||||||
/* Put the cursor at the end of the grafted text. */
|
/* Put the cursor at the end of the grafted text. */
|
||||||
@@ -417,11 +439,6 @@ void ingraft_buffer(linestruct *topline)
|
|||||||
openfile->mark_x += length - xpos;
|
openfile->mark_x += length - xpos;
|
||||||
} else if (mark_follows)
|
} else if (mark_follows)
|
||||||
openfile->mark_x += extralen;
|
openfile->mark_x += extralen;
|
||||||
|
|
||||||
if (ISSET(SOFTWRAP)) {
|
|
||||||
line->extrarows = extra_chunks_in(line);
|
|
||||||
openfile->current->extrarows = extra_chunks_in(openfile->current);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete_node(topline);
|
delete_node(topline);
|
||||||
@@ -437,9 +454,19 @@ void ingraft_buffer(linestruct *topline)
|
|||||||
/* Meld a copy of the given buffer into the current file buffer. */
|
/* Meld a copy of the given buffer into the current file buffer. */
|
||||||
void copy_from_buffer(linestruct *somebuffer)
|
void copy_from_buffer(linestruct *somebuffer)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
size_t threshold = openfile->edittop->lineno + editwinrows - 1;
|
||||||
|
#endif
|
||||||
linestruct *the_copy = copy_buffer(somebuffer);
|
linestruct *the_copy = copy_buffer(somebuffer);
|
||||||
|
|
||||||
ingraft_buffer(the_copy);
|
ingraft_buffer(the_copy);
|
||||||
|
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
if (openfile->current->lineno > threshold || ISSET(SOFTWRAP))
|
||||||
|
recook = TRUE;
|
||||||
|
else
|
||||||
|
perturbed = TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
@@ -487,7 +514,7 @@ void do_snip(bool marked, bool until_eof, bool append)
|
|||||||
/* When not at the end of a line, move the rest of this line into
|
/* When not at the end of a line, move the rest of this line into
|
||||||
* the cutbuffer. Otherwise, when not at the end of the buffer,
|
* the cutbuffer. Otherwise, when not at the end of the buffer,
|
||||||
* move just the "line separator" into the cutbuffer. */
|
* move just the "line separator" into the cutbuffer. */
|
||||||
if (openfile->current_x < strlen(openfile->current->data))
|
if (line->data[openfile->current_x] != '\0')
|
||||||
extract_segment(line, openfile->current_x, line, strlen(line->data));
|
extract_segment(line, openfile->current_x, line, strlen(line->data));
|
||||||
else if (openfile->current != openfile->filebot) {
|
else if (openfile->current != openfile->filebot) {
|
||||||
extract_segment(line, openfile->current_x, line->next, 0);
|
extract_segment(line, openfile->current_x, line->next, 0);
|
||||||
@@ -511,6 +538,9 @@ void do_snip(bool marked, bool until_eof, bool append)
|
|||||||
|
|
||||||
set_modified();
|
set_modified();
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
perturbed = TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move text from the current buffer into the cutbuffer. */
|
/* Move text from the current buffer into the cutbuffer. */
|
||||||
@@ -696,15 +726,21 @@ void copy_text(void)
|
|||||||
/* Copy text from the cutbuffer into the current buffer. */
|
/* Copy text from the cutbuffer into the current buffer. */
|
||||||
void paste_text(void)
|
void paste_text(void)
|
||||||
{
|
{
|
||||||
|
#if defined(ENABLE_WRAPPING) || !defined(NANO_TINY)
|
||||||
|
/* Remember where the paste started. */
|
||||||
|
linestruct *was_current = openfile->current;
|
||||||
|
#endif
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
bool had_anchor = was_current->has_anchor;
|
||||||
|
#endif
|
||||||
ssize_t was_lineno = openfile->current->lineno;
|
ssize_t was_lineno = openfile->current->lineno;
|
||||||
/* The line number where we started the paste. */
|
|
||||||
size_t was_leftedge = 0;
|
size_t was_leftedge = 0;
|
||||||
/* The leftedge where we started the paste. */
|
|
||||||
|
|
||||||
if (cutbuffer == NULL) {
|
if (cutbuffer == NULL) {
|
||||||
statusbar(_("Cutbuffer is empty"));
|
statusline(AHEM, _("Cutbuffer is empty"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
UNFOLD_SEGMENT(openfile->current);
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
add_undo(PASTE, NULL);
|
add_undo(PASTE, NULL);
|
||||||
@@ -718,12 +754,28 @@ void paste_text(void)
|
|||||||
copy_from_buffer(cutbuffer);
|
copy_from_buffer(cutbuffer);
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
/* Wipe any anchors in the pasted text, so that they don't proliferate. */
|
||||||
|
for (linestruct *line = was_current; line != openfile->current->next; line = line->next)
|
||||||
|
line->has_anchor = FALSE;
|
||||||
|
|
||||||
|
was_current->has_anchor = had_anchor;
|
||||||
|
|
||||||
update_undo(PASTE);
|
update_undo(PASTE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_WRAPPING
|
||||||
|
/* When still on the same line and doing hard-wrapping, limit the width. */
|
||||||
|
if (openfile->current == was_current && ISSET(BREAK_LONG_LINES))
|
||||||
|
do_wrap();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If we pasted less than a screenful, don't center the cursor. */
|
/* If we pasted less than a screenful, don't center the cursor. */
|
||||||
if (less_than_a_screenful(was_lineno, was_leftedge))
|
if (less_than_a_screenful(was_lineno, was_leftedge))
|
||||||
focusing = FALSE;
|
focusing = FALSE;
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
else
|
||||||
|
precalc_multicolorinfo();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set the desired x position to where the pasted text ends. */
|
/* Set the desired x position to where the pasted text ends. */
|
||||||
openfile->placewewant = xplustabs();
|
openfile->placewewant = xplustabs();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* definitions.h -- This file is part of GNU nano. *
|
* definitions.h -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 1999-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||||
* *
|
* *
|
||||||
* GNU nano is free software: you can redistribute it and/or modify *
|
* GNU nano is free software: you can redistribute it and/or modify *
|
||||||
@@ -29,6 +29,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__HAIKU__) && !defined(_DEFAULT_SOURCE)
|
||||||
|
#define _DEFAULT_SOURCE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __TANDEM
|
#ifdef __TANDEM
|
||||||
/* Tandem NonStop Kernel support. */
|
/* Tandem NonStop Kernel support. */
|
||||||
#include <floss.h>
|
#include <floss.h>
|
||||||
@@ -41,10 +45,55 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Set a default value for PATH_MAX if there isn't one. */
|
||||||
|
#ifndef PATH_MAX
|
||||||
|
#define PATH_MAX 4096
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SYS_PARAM_H
|
#ifdef HAVE_SYS_PARAM_H
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <regex.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
/* Prefer wide ncurses over normal ncurses over curses. */
|
||||||
|
#if defined(HAVE_NCURSESW_NCURSES_H)
|
||||||
|
#include <ncursesw/ncurses.h>
|
||||||
|
#elif defined(HAVE_NCURSES_H)
|
||||||
|
#include <ncurses.h>
|
||||||
|
#else
|
||||||
|
#include <curses.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Native language support. */
|
||||||
|
#ifdef ENABLE_NLS
|
||||||
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
#include <libintl.h>
|
||||||
|
#endif
|
||||||
|
#define _(string) gettext(string)
|
||||||
|
#define P_(singular, plural, number) ngettext(singular, plural, number)
|
||||||
|
#else
|
||||||
|
#define _(string) (string)
|
||||||
|
#define P_(singular, plural, number) (number == 1 ? singular : plural)
|
||||||
|
#endif
|
||||||
|
/* For marking a string on which gettext() will be called later. */
|
||||||
|
#define gettext_noop(string) (string)
|
||||||
|
#define N_(string) gettext_noop(string)
|
||||||
|
|
||||||
|
/* If we aren't using an ncurses with mouse support, then
|
||||||
|
* exclude the mouse routines, as they are useless then. */
|
||||||
|
#ifndef NCURSES_MOUSE_VERSION
|
||||||
|
#undef ENABLE_MOUSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ENABLE_WRAPPING) || defined(ENABLE_JUSTIFY)
|
||||||
|
#define ENABLED_WRAPORJUSTIFY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Suppress warnings for __attribute__((warn_unused_result)). */
|
/* Suppress warnings for __attribute__((warn_unused_result)). */
|
||||||
#define IGNORE_CALL_RESULT(call) do { if (call) {} } while(0)
|
#define IGNORE_CALL_RESULT(call) do { if (call) {} } while(0)
|
||||||
|
|
||||||
@@ -56,77 +105,17 @@
|
|||||||
#define ISSET(flag) ((FLAGS(flag) & FLAGMASK(flag)) != 0)
|
#define ISSET(flag) ((FLAGS(flag) & FLAGMASK(flag)) != 0)
|
||||||
#define TOGGLE(flag) FLAGS(flag) ^= FLAGMASK(flag)
|
#define TOGGLE(flag) FLAGS(flag) ^= FLAGMASK(flag)
|
||||||
|
|
||||||
/* Macros for allocation of character strings. */
|
|
||||||
#define charalloc(howmuch) (char *)nmalloc(howmuch)
|
|
||||||
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, howmuch)
|
|
||||||
|
|
||||||
/* In UTF-8 a character is at most six bytes long. */
|
|
||||||
#ifdef ENABLE_UTF8
|
|
||||||
#define MAXCHARLEN 6
|
|
||||||
#else
|
|
||||||
#define MAXCHARLEN 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set a default value for PATH_MAX if there isn't one. */
|
|
||||||
#ifndef PATH_MAX
|
|
||||||
#define PATH_MAX 4096
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_SLANG
|
|
||||||
/* Slang support. */
|
|
||||||
#include <slcurses.h>
|
|
||||||
/* Slang curses emulation brain damage, part 3: Slang doesn't define the
|
|
||||||
* curses equivalents of the Insert or Delete keys. */
|
|
||||||
#define KEY_DC SL_KEY_DELETE
|
|
||||||
#define KEY_IC SL_KEY_IC
|
|
||||||
/* Ncurses support. */
|
|
||||||
#elif defined(HAVE_NCURSESW_NCURSES_H)
|
|
||||||
#include <ncursesw/ncurses.h>
|
|
||||||
#elif defined(HAVE_NCURSES_H)
|
|
||||||
#include <ncurses.h>
|
|
||||||
#else
|
|
||||||
/* Curses support. */
|
|
||||||
#include <curses.h>
|
|
||||||
#endif /* CURSES_H */
|
|
||||||
|
|
||||||
#if defined(NCURSES_VERSION_MAJOR) && (NCURSES_VERSION_MAJOR < 6)
|
|
||||||
#define USING_OLD_NCURSES yes
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
|
||||||
/* Native language support. */
|
|
||||||
#ifdef HAVE_LIBINTL_H
|
|
||||||
#include <libintl.h>
|
|
||||||
#endif
|
|
||||||
#define _(string) gettext(string)
|
|
||||||
#define P_(singular, plural, number) ngettext(singular, plural, number)
|
|
||||||
#else
|
|
||||||
#define _(string) (string)
|
|
||||||
#define P_(singular, plural, number) (number == 1 ? singular : plural)
|
|
||||||
#endif
|
|
||||||
#define gettext_noop(string) (string)
|
|
||||||
#define N_(string) gettext_noop(string)
|
|
||||||
/* Mark a string that will be sent to gettext() later. */
|
|
||||||
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <regex.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
/* If we aren't using an ncurses with mouse support, exclude any
|
|
||||||
* mouse routines, as they are useless then. */
|
|
||||||
#ifndef NCURSES_MOUSE_VERSION
|
|
||||||
#undef ENABLE_MOUSE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ENABLE_WRAPPING) || defined(ENABLE_JUSTIFY)
|
|
||||||
#define ENABLED_WRAPORJUSTIFY 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BACKWARD FALSE
|
#define BACKWARD FALSE
|
||||||
#define FORWARD TRUE
|
#define FORWARD TRUE
|
||||||
|
|
||||||
|
#define YESORNO FALSE
|
||||||
|
#define YESORALLORNO TRUE
|
||||||
|
|
||||||
|
#define YES 1
|
||||||
|
#define ALL 2
|
||||||
|
#define NO 0
|
||||||
|
#define CANCEL -1
|
||||||
|
|
||||||
#define BLIND FALSE
|
#define BLIND FALSE
|
||||||
#define VISIBLE TRUE
|
#define VISIBLE TRUE
|
||||||
|
|
||||||
@@ -134,30 +123,178 @@
|
|||||||
#define REPLACING 1
|
#define REPLACING 1
|
||||||
#define INREGION 2
|
#define INREGION 2
|
||||||
|
|
||||||
|
#define NORMAL TRUE
|
||||||
|
#define SPECIAL FALSE
|
||||||
|
#define TEMPORARY FALSE
|
||||||
|
|
||||||
|
#define ANNOTATE TRUE
|
||||||
|
#define NONOTES FALSE
|
||||||
|
|
||||||
|
#define PRUNE_DUPLICATE TRUE
|
||||||
|
#define IGNORE_DUPLICATES FALSE
|
||||||
|
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
/* In UTF-8 a valid character is at most four bytes long. */
|
||||||
|
#define MAXCHARLEN 4
|
||||||
|
#else
|
||||||
|
#define MAXCHARLEN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The default width of a tab in spaces. */
|
||||||
|
#define WIDTH_OF_TAB 8
|
||||||
|
|
||||||
|
/* The default number of columns from end of line where wrapping occurs. */
|
||||||
|
#define COLUMNS_FROM_EOL 8
|
||||||
|
|
||||||
|
/* The default comment character when a syntax does not specify any. */
|
||||||
|
#define GENERAL_COMMENT_CHARACTER "#"
|
||||||
|
|
||||||
|
/* The maximum number of search/replace history strings saved. */
|
||||||
|
#define MAX_SEARCH_HISTORY 100
|
||||||
|
|
||||||
|
/* The largest size_t number that doesn't have the high bit set. */
|
||||||
|
#define HIGHEST_POSITIVE ((~(size_t)0) >> 1)
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
#define THE_DEFAULT -1
|
#define THE_DEFAULT -1
|
||||||
#define BAD_COLOR -2
|
#define BAD_COLOR -2
|
||||||
|
|
||||||
|
/* Flags for indicating how a multiline regex pair apply to a line. */
|
||||||
|
#define NOTHING (1<<1)
|
||||||
|
/* The start/end regexes don't cover this line at all. */
|
||||||
|
#define STARTSHERE (1<<2)
|
||||||
|
/* The start regex matches on this line, the end regex on a later one. */
|
||||||
|
#define WHOLELINE (1<<3)
|
||||||
|
/* The start regex matches on an earlier line, the end regex on a later one. */
|
||||||
|
#define ENDSHERE (1<<4)
|
||||||
|
/* The start regex matches on an earlier line, the end regex on this one. */
|
||||||
|
#define JUSTONTHIS (1<<5)
|
||||||
|
/* Both the start and end regexes match within this line. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STANDARD_INPUT 0
|
/* Basic control codes. */
|
||||||
|
#define ESC_CODE 0x1B
|
||||||
|
#define DEL_CODE 0x7F
|
||||||
|
|
||||||
|
/* Codes for "modified" Arrow keys, beyond KEY_MAX of ncurses. */
|
||||||
|
#define CONTROL_LEFT 0x401
|
||||||
|
#define CONTROL_RIGHT 0x402
|
||||||
|
#define CONTROL_UP 0x403
|
||||||
|
#define CONTROL_DOWN 0x404
|
||||||
|
#define CONTROL_HOME 0x405
|
||||||
|
#define CONTROL_END 0x406
|
||||||
|
#define CONTROL_DELETE 0x40D
|
||||||
|
#define SHIFT_CONTROL_LEFT 0x411
|
||||||
|
#define SHIFT_CONTROL_RIGHT 0x412
|
||||||
|
#define SHIFT_CONTROL_UP 0x413
|
||||||
|
#define SHIFT_CONTROL_DOWN 0x414
|
||||||
|
#define SHIFT_CONTROL_HOME 0x415
|
||||||
|
#define SHIFT_CONTROL_END 0x416
|
||||||
|
#define CONTROL_SHIFT_DELETE 0x41D
|
||||||
|
#define ALT_LEFT 0x421
|
||||||
|
#define ALT_RIGHT 0x422
|
||||||
|
#define ALT_UP 0x423
|
||||||
|
#define ALT_DOWN 0x424
|
||||||
|
#define ALT_PAGEUP 0x427
|
||||||
|
#define ALT_PAGEDOWN 0x428
|
||||||
|
#define ALT_INSERT 0x42C
|
||||||
|
#define ALT_DELETE 0x42D
|
||||||
|
#define SHIFT_ALT_LEFT 0x431
|
||||||
|
#define SHIFT_ALT_RIGHT 0x432
|
||||||
|
#define SHIFT_ALT_UP 0x433
|
||||||
|
#define SHIFT_ALT_DOWN 0x434
|
||||||
|
//#define SHIFT_LEFT 0x451
|
||||||
|
//#define SHIFT_RIGHT 0x452
|
||||||
|
#define SHIFT_UP 0x453
|
||||||
|
#define SHIFT_DOWN 0x454
|
||||||
|
#define SHIFT_HOME 0x455
|
||||||
|
#define SHIFT_END 0x456
|
||||||
|
#define SHIFT_PAGEUP 0x457
|
||||||
|
#define SHIFT_PAGEDOWN 0x458
|
||||||
|
#define SHIFT_DELETE 0x45D
|
||||||
|
#define SHIFT_TAB 0x45F
|
||||||
|
|
||||||
|
/* Special keycodes for when a string bind has been partially implanted
|
||||||
|
* or has an unpaired opening brace, or when a function in a string bind
|
||||||
|
* needs execution or a specified function name is invalid. */
|
||||||
|
#define MORE_PLANTS 0x4EA
|
||||||
|
#define MISSING_BRACE 0x4EB
|
||||||
|
#define PLANTED_COMMAND 0x4EC
|
||||||
|
#define NO_SUCH_FUNCTION 0x4EF
|
||||||
|
|
||||||
|
/* A special keycode for when <Tab> is pressed while the mark is on. */
|
||||||
|
#define INDENT_KEY 0x4F1
|
||||||
|
|
||||||
|
/* A special keycode to signal the beginning and end of a bracketed paste. */
|
||||||
|
#define BRACKETED_PASTE_MARKER 0x4FB
|
||||||
|
|
||||||
|
/* A special keycode for when a key produces an unknown escape sequence. */
|
||||||
|
#define FOREIGN_SEQUENCE 0x4FC
|
||||||
|
|
||||||
|
/* A special keycode for plugging into the input stream after a suspension. */
|
||||||
|
#define KEY_FRESH 0x4FE
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
/* A special keycode for when we get a SIGWINCH (a window resize). */
|
||||||
|
#define KEY_WINCH -2
|
||||||
|
|
||||||
|
/* Some extra flags for the undo function. */
|
||||||
|
#define WAS_BACKSPACE_AT_EOF (1<<1)
|
||||||
|
#define WAS_WHOLE_LINE (1<<2)
|
||||||
|
#define INCLUDED_LAST_LINE (1<<3)
|
||||||
|
#define MARK_WAS_SET (1<<4)
|
||||||
|
#define CURSOR_WAS_AT_HEAD (1<<5)
|
||||||
|
#define HAD_ANCHOR_AT_START (1<<6)
|
||||||
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
|
/* Identifiers for the different menus. */
|
||||||
|
#define MMAIN (1<<0)
|
||||||
|
#define MWHEREIS (1<<1)
|
||||||
|
#define MREPLACE (1<<2)
|
||||||
|
#define MREPLACEWITH (1<<3)
|
||||||
|
#define MGOTOLINE (1<<4)
|
||||||
|
#define MWRITEFILE (1<<5)
|
||||||
|
#define MINSERTFILE (1<<6)
|
||||||
|
#define MEXECUTE (1<<7)
|
||||||
|
#define MHELP (1<<8)
|
||||||
|
#define MSPELL (1<<9)
|
||||||
|
#define MBROWSER (1<<10)
|
||||||
|
#define MWHEREISFILE (1<<11)
|
||||||
|
#define MGOTODIR (1<<12)
|
||||||
|
#define MYESNO (1<<13)
|
||||||
|
#define MLINTER (1<<14)
|
||||||
|
#define MFINDINHELP (1<<15)
|
||||||
|
/* This is an abbreviation for all menus except Help and Browser and YesNo. */
|
||||||
|
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
|
||||||
|
MEXECUTE|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
#define MSOME MMOST|MBROWSER
|
||||||
|
#else
|
||||||
|
#define MSOME MMAIN|MBROWSER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
#define UNFOLD_SEGMENT(line) unfold_folded_segment(line)
|
||||||
|
#else
|
||||||
|
#define UNFOLD_SEGMENT(line)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ALLOW_FOLDED TRUE
|
||||||
|
#define DISALLOW_FOLDED FALSE
|
||||||
|
|
||||||
/* Enumeration types. */
|
/* Enumeration types. */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NIX_FILE, DOS_FILE, MAC_FILE
|
UNSPECIFIED, NIX_FILE, DOS_FILE, MAC_FILE
|
||||||
} format_type;
|
} format_type;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VACUUM, HUSH, NOTICE, MILD, ALERT
|
VACUUM, HUSH, REMARK, INFO, NOTICE, AHEM, MILD, ALERT
|
||||||
} message_type;
|
} message_type;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
OVERWRITE, APPEND, PREPEND
|
OVERWRITE, APPEND, PREPEND
|
||||||
} kind_of_writing_type;
|
} kind_of_writing_type;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
SOFTMARK, HARDMARK
|
|
||||||
} mark_type;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CENTERING, FLOWING, STATIONARY
|
CENTERING, FLOWING, STATIONARY
|
||||||
} update_type;
|
} update_type;
|
||||||
@@ -176,6 +313,82 @@ typedef enum {
|
|||||||
COUPLE_BEGIN, COUPLE_END, OTHER
|
COUPLE_BEGIN, COUPLE_END, OTHER
|
||||||
} undo_type;
|
} undo_type;
|
||||||
|
|
||||||
|
/* The elements of the interface that can be colored differently. */
|
||||||
|
enum {
|
||||||
|
TITLE_BAR = 0,
|
||||||
|
LINE_NUMBER,
|
||||||
|
GUIDE_STRIPE,
|
||||||
|
SCROLL_BAR,
|
||||||
|
SELECTED_TEXT,
|
||||||
|
SPOTLIGHTED,
|
||||||
|
MINI_INFOBAR,
|
||||||
|
PROMPT_BAR,
|
||||||
|
STATUS_BAR,
|
||||||
|
ERROR_MESSAGE,
|
||||||
|
KEY_COMBO,
|
||||||
|
FUNCTION_TAG,
|
||||||
|
NUMBER_OF_ELEMENTS
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Enumeration used in the flags array. See the definition of FLAGMASK. */
|
||||||
|
enum {
|
||||||
|
DONTUSE = 0,
|
||||||
|
CASE_SENSITIVE,
|
||||||
|
CONSTANT_SHOW,
|
||||||
|
NO_HELP,
|
||||||
|
NO_WRAP,
|
||||||
|
AUTOINDENT,
|
||||||
|
VIEW_MODE,
|
||||||
|
USE_MOUSE,
|
||||||
|
USE_REGEXP,
|
||||||
|
SAVE_ON_EXIT,
|
||||||
|
CUT_FROM_CURSOR,
|
||||||
|
BACKWARDS_SEARCH,
|
||||||
|
MULTIBUFFER,
|
||||||
|
REBIND_DELETE,
|
||||||
|
RAW_SEQUENCES,
|
||||||
|
NO_CONVERT,
|
||||||
|
MAKE_BACKUP,
|
||||||
|
INSECURE_BACKUP,
|
||||||
|
NO_SYNTAX,
|
||||||
|
PRESERVE,
|
||||||
|
HISTORYLOG,
|
||||||
|
RESTRICTED,
|
||||||
|
SMART_HOME,
|
||||||
|
WHITESPACE_DISPLAY,
|
||||||
|
TABS_TO_SPACES,
|
||||||
|
QUICK_BLANK,
|
||||||
|
WORD_BOUNDS,
|
||||||
|
NO_NEWLINES,
|
||||||
|
BOLD_TEXT,
|
||||||
|
SOFTWRAP,
|
||||||
|
POSITIONLOG,
|
||||||
|
LOCKING,
|
||||||
|
NOREAD_MODE,
|
||||||
|
MAKE_IT_UNIX,
|
||||||
|
TRIM_BLANKS,
|
||||||
|
SHOW_CURSOR,
|
||||||
|
LINE_NUMBERS,
|
||||||
|
AT_BLANKS,
|
||||||
|
AFTER_ENDS,
|
||||||
|
LET_THEM_ZAP,
|
||||||
|
BREAK_LONG_LINES,
|
||||||
|
JUMPY_SCROLLING,
|
||||||
|
EMPTY_LINE,
|
||||||
|
INDICATOR,
|
||||||
|
BOOKSTYLE,
|
||||||
|
STATEFLAGS,
|
||||||
|
USE_MAGIC,
|
||||||
|
MINIBAR,
|
||||||
|
ZERO
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
FOUND_BRACKET = 0,
|
||||||
|
NOT_FOUND_BRACKET,
|
||||||
|
NOT_A_BRACKET
|
||||||
|
} bracket_search_result;
|
||||||
|
|
||||||
/* Structure types. */
|
/* Structure types. */
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
typedef struct colortype {
|
typedef struct colortype {
|
||||||
@@ -198,8 +411,8 @@ typedef struct colortype {
|
|||||||
} colortype;
|
} colortype;
|
||||||
|
|
||||||
typedef struct regexlisttype {
|
typedef struct regexlisttype {
|
||||||
char *full_regex;
|
regex_t *one_rgx;
|
||||||
/* A regex string to match things that imply a certain syntax. */
|
/* A regex to match things that imply a certain syntax. */
|
||||||
struct regexlisttype *next;
|
struct regexlisttype *next;
|
||||||
/* The next regex. */
|
/* The next regex. */
|
||||||
} regexlisttype;
|
} regexlisttype;
|
||||||
@@ -222,7 +435,7 @@ typedef struct syntaxtype {
|
|||||||
/* File where the syntax is defined, or NULL if not an included file. */
|
/* File where the syntax is defined, or NULL if not an included file. */
|
||||||
size_t lineno;
|
size_t lineno;
|
||||||
/* The line number where the 'syntax' command was found. */
|
/* The line number where the 'syntax' command was found. */
|
||||||
struct augmentstruct *augmentations;
|
augmentstruct *augmentations;
|
||||||
/* List of extendsyntax commands to apply when loaded. */
|
/* List of extendsyntax commands to apply when loaded. */
|
||||||
regexlisttype *extensions;
|
regexlisttype *extensions;
|
||||||
/* The list of extensions that this syntax applies to. */
|
/* The list of extensions that this syntax applies to. */
|
||||||
@@ -234,7 +447,7 @@ typedef struct syntaxtype {
|
|||||||
/* The command with which to lint this type of file. */
|
/* The command with which to lint this type of file. */
|
||||||
char *formatter;
|
char *formatter;
|
||||||
/* The command with which to format/modify/arrange this type of file. */
|
/* The command with which to format/modify/arrange this type of file. */
|
||||||
char *tab;
|
char *tabstring;
|
||||||
/* What the Tab key should produce; NULL for default behavior. */
|
/* What the Tab key should produce; NULL for default behavior. */
|
||||||
#ifdef ENABLE_COMMENT
|
#ifdef ENABLE_COMMENT
|
||||||
char *comment;
|
char *comment;
|
||||||
@@ -262,20 +475,6 @@ typedef struct lintstruct {
|
|||||||
struct lintstruct *prev;
|
struct lintstruct *prev;
|
||||||
/* Previous error. */
|
/* Previous error. */
|
||||||
} lintstruct;
|
} lintstruct;
|
||||||
|
|
||||||
/* Flags that indicate how a multiline regex applies to a line. */
|
|
||||||
#define CNONE (1<<1)
|
|
||||||
/* Yay, regex doesn't apply to this line at all! */
|
|
||||||
#define CBEGINBEFORE (1<<2)
|
|
||||||
/* Regex starts on an earlier line, ends on this one. */
|
|
||||||
#define CENDAFTER (1<<3)
|
|
||||||
/* Regex starts on this line and ends on a later one. */
|
|
||||||
#define CWHOLELINE (1<<4)
|
|
||||||
/* Whole line engulfed by the regex, start < me, end > me. */
|
|
||||||
#define CSTARTENDHERE (1<<5)
|
|
||||||
/* Regex starts and ends within this line. */
|
|
||||||
#define CWOULDBE (1<<6)
|
|
||||||
/* An unpaired start match on or before this line. */
|
|
||||||
#endif /* ENABLE_COLOR */
|
#endif /* ENABLE_COLOR */
|
||||||
|
|
||||||
/* More structure types. */
|
/* More structure types. */
|
||||||
@@ -284,10 +483,6 @@ typedef struct linestruct {
|
|||||||
/* The text of this line. */
|
/* The text of this line. */
|
||||||
ssize_t lineno;
|
ssize_t lineno;
|
||||||
/* The number of this line. */
|
/* The number of this line. */
|
||||||
#ifndef NANO_TINY
|
|
||||||
ssize_t extrarows;
|
|
||||||
/* The extra rows that this line occupies when softwrapping. */
|
|
||||||
#endif
|
|
||||||
struct linestruct *next;
|
struct linestruct *next;
|
||||||
/* Next node. */
|
/* Next node. */
|
||||||
struct linestruct *prev;
|
struct linestruct *prev;
|
||||||
@@ -300,6 +495,10 @@ typedef struct linestruct {
|
|||||||
bool has_anchor;
|
bool has_anchor;
|
||||||
/* Whether the user has placed an anchor at this line. */
|
/* Whether the user has placed an anchor at this line. */
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
bool folded;
|
||||||
|
/* Whether or not this line is in a fold segment */
|
||||||
|
#endif
|
||||||
} linestruct;
|
} linestruct;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
@@ -345,11 +544,11 @@ typedef struct undostruct {
|
|||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
typedef struct poshiststruct {
|
typedef struct poshiststruct {
|
||||||
char *filename;
|
char *filename;
|
||||||
/* The file. */
|
/* The full path plus name of the file. */
|
||||||
ssize_t lineno;
|
ssize_t linenumber;
|
||||||
/* Line number we left off on. */
|
/* The line where the cursor was when we closed the file. */
|
||||||
ssize_t xno;
|
ssize_t columnnumber;
|
||||||
/* The x position in the file we left off on. */
|
/* The column where the cursor was. */
|
||||||
struct poshiststruct *next;
|
struct poshiststruct *next;
|
||||||
/* The next item of position history. */
|
/* The next item of position history. */
|
||||||
} poshiststruct;
|
} poshiststruct;
|
||||||
@@ -388,8 +587,8 @@ typedef struct openfilestruct {
|
|||||||
/* The line in the file where the mark is set; NULL if not set. */
|
/* The line in the file where the mark is set; NULL if not set. */
|
||||||
size_t mark_x;
|
size_t mark_x;
|
||||||
/* The mark's x position in the above line. */
|
/* The mark's x position in the above line. */
|
||||||
mark_type kind_of_mark;
|
bool softmark;
|
||||||
/* Whether it is a soft (with Shift) or a hard mark. */
|
/* Whether a marked region was made by holding Shift. */
|
||||||
format_type fmt;
|
format_type fmt;
|
||||||
/* The file's format -- Unix or DOS or Mac. */
|
/* The file's format -- Unix or DOS or Mac. */
|
||||||
char *lock_filename;
|
char *lock_filename;
|
||||||
@@ -410,6 +609,8 @@ typedef struct openfilestruct {
|
|||||||
/* The syntax that applies to this file, if any. */
|
/* The syntax that applies to this file, if any. */
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
|
char *errormessage;
|
||||||
|
/* The ALERT message (if any) that occurred when opening the file. */
|
||||||
struct openfilestruct *next;
|
struct openfilestruct *next;
|
||||||
/* The next open file, if any. */
|
/* The next open file, if any. */
|
||||||
struct openfilestruct *prev;
|
struct openfilestruct *prev;
|
||||||
@@ -453,210 +654,23 @@ typedef struct keystruct {
|
|||||||
typedef struct funcstruct {
|
typedef struct funcstruct {
|
||||||
void (*func)(void);
|
void (*func)(void);
|
||||||
/* The actual function to call. */
|
/* The actual function to call. */
|
||||||
|
const char *tag;
|
||||||
|
/* The function's help-line label, for example "Where Is". */
|
||||||
|
#ifdef ENABLE_HELP
|
||||||
|
const char *phrase;
|
||||||
|
/* The function's description for in the help viewer. */
|
||||||
|
bool blank_after;
|
||||||
|
/* Whether to distance this function from the next in the help viewer. */
|
||||||
|
#endif
|
||||||
int menus;
|
int menus;
|
||||||
/* In what menus this function applies. */
|
/* In what menus this function applies. */
|
||||||
const char *desc;
|
|
||||||
/* The function's short description, for example "Where Is". */
|
|
||||||
#ifdef ENABLE_HELP
|
|
||||||
const char *help;
|
|
||||||
/* The help-screen text for this function. */
|
|
||||||
bool blank_after;
|
|
||||||
/* Whether there should be a blank line after the help text
|
|
||||||
* for this function. */
|
|
||||||
#endif
|
|
||||||
bool viewok;
|
|
||||||
/* Is this function allowed when in view mode? */
|
|
||||||
long toggle;
|
|
||||||
/* If this is a toggle, which toggle to affect. */
|
|
||||||
struct funcstruct *next;
|
struct funcstruct *next;
|
||||||
/* Next item in the list. */
|
/* Next item in the list. */
|
||||||
} funcstruct;
|
} funcstruct;
|
||||||
|
|
||||||
#ifdef ENABLE_WORDCOMPLETION
|
#ifdef ENABLE_WORDCOMPLETION
|
||||||
typedef struct completion_word {
|
typedef struct completionstruct {
|
||||||
char *word;
|
char *word;
|
||||||
struct completion_word *next;
|
struct completionstruct *next;
|
||||||
} completion_word;
|
} completionstruct;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The elements of the interface that can be colored differently. */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
TITLE_BAR = 0,
|
|
||||||
LINE_NUMBER,
|
|
||||||
GUIDE_STRIPE,
|
|
||||||
SELECTED_TEXT,
|
|
||||||
STATUS_BAR,
|
|
||||||
ERROR_MESSAGE,
|
|
||||||
KEY_COMBO,
|
|
||||||
FUNCTION_TAG,
|
|
||||||
NUMBER_OF_ELEMENTS
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Enumeration used in the flags array. See the definition of FLAGMASK. */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
DONTUSE,
|
|
||||||
CASE_SENSITIVE,
|
|
||||||
CONSTANT_SHOW,
|
|
||||||
NO_HELP,
|
|
||||||
SUSPENDABLE,
|
|
||||||
NO_WRAP,
|
|
||||||
AUTOINDENT,
|
|
||||||
VIEW_MODE,
|
|
||||||
USE_MOUSE,
|
|
||||||
USE_REGEXP,
|
|
||||||
SAVE_ON_EXIT,
|
|
||||||
CUT_FROM_CURSOR,
|
|
||||||
BACKWARDS_SEARCH,
|
|
||||||
MULTIBUFFER,
|
|
||||||
SMOOTH_SCROLL,
|
|
||||||
REBIND_DELETE,
|
|
||||||
RAW_SEQUENCES,
|
|
||||||
NO_CONVERT,
|
|
||||||
MAKE_BACKUP,
|
|
||||||
INSECURE_BACKUP,
|
|
||||||
NO_SYNTAX,
|
|
||||||
PRESERVE,
|
|
||||||
HISTORYLOG,
|
|
||||||
RESTRICTED,
|
|
||||||
SMART_HOME,
|
|
||||||
WHITESPACE_DISPLAY,
|
|
||||||
MORE_SPACE,
|
|
||||||
TABS_TO_SPACES,
|
|
||||||
QUICK_BLANK,
|
|
||||||
WORD_BOUNDS,
|
|
||||||
NO_NEWLINES,
|
|
||||||
BOLD_TEXT,
|
|
||||||
SOFTWRAP,
|
|
||||||
POSITIONLOG,
|
|
||||||
LOCKING,
|
|
||||||
NOREAD_MODE,
|
|
||||||
MAKE_IT_UNIX,
|
|
||||||
TRIM_BLANKS,
|
|
||||||
SHOW_CURSOR,
|
|
||||||
LINE_NUMBERS,
|
|
||||||
NO_PAUSES,
|
|
||||||
AT_BLANKS,
|
|
||||||
AFTER_ENDS,
|
|
||||||
LET_THEM_ZAP,
|
|
||||||
BREAK_LONG_LINES,
|
|
||||||
JUMPY_SCROLLING,
|
|
||||||
EMPTY_LINE,
|
|
||||||
INDICATOR,
|
|
||||||
BOOKSTYLE
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Flags for the menus in which a given function should be present. */
|
|
||||||
#define MMAIN (1<<0)
|
|
||||||
#define MWHEREIS (1<<1)
|
|
||||||
#define MREPLACE (1<<2)
|
|
||||||
#define MREPLACEWITH (1<<3)
|
|
||||||
#define MGOTOLINE (1<<4)
|
|
||||||
#define MWRITEFILE (1<<5)
|
|
||||||
#define MINSERTFILE (1<<6)
|
|
||||||
#define MEXECUTE (1<<7)
|
|
||||||
#define MHELP (1<<8)
|
|
||||||
#define MSPELL (1<<9)
|
|
||||||
#define MBROWSER (1<<10)
|
|
||||||
#define MWHEREISFILE (1<<11)
|
|
||||||
#define MGOTODIR (1<<12)
|
|
||||||
#define MYESNO (1<<13)
|
|
||||||
#define MLINTER (1<<14)
|
|
||||||
#define MFINDINHELP (1<<15)
|
|
||||||
/* This is an abbreviation for all menus except Help and Browser and YesNo. */
|
|
||||||
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
|
|
||||||
MEXECUTE|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
#define MSOME MMOST|MBROWSER
|
|
||||||
#else
|
|
||||||
#define MSOME MMAIN|MBROWSER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Basic control codes. */
|
|
||||||
#define ESC_CODE 0x1B
|
|
||||||
#define DEL_CODE 0x7F
|
|
||||||
|
|
||||||
/* Codes for "modified" Arrow keys, beyond KEY_MAX of ncurses. */
|
|
||||||
#define CONTROL_LEFT 0x401
|
|
||||||
#define CONTROL_RIGHT 0x402
|
|
||||||
#define CONTROL_UP 0x403
|
|
||||||
#define CONTROL_DOWN 0x404
|
|
||||||
#define CONTROL_HOME 0x405
|
|
||||||
#define CONTROL_END 0x406
|
|
||||||
#define CONTROL_DELETE 0x40D
|
|
||||||
#define SHIFT_CONTROL_LEFT 0x411
|
|
||||||
#define SHIFT_CONTROL_RIGHT 0x412
|
|
||||||
#define SHIFT_CONTROL_UP 0x413
|
|
||||||
#define SHIFT_CONTROL_DOWN 0x414
|
|
||||||
#define SHIFT_CONTROL_HOME 0x415
|
|
||||||
#define SHIFT_CONTROL_END 0x416
|
|
||||||
#define CONTROL_SHIFT_DELETE 0x41D
|
|
||||||
#define ALT_LEFT 0x421
|
|
||||||
#define ALT_RIGHT 0x422
|
|
||||||
#define ALT_UP 0x423
|
|
||||||
#define ALT_DOWN 0x424
|
|
||||||
#define ALT_PAGEUP 0x427
|
|
||||||
#define ALT_PAGEDOWN 0x428
|
|
||||||
#define ALT_INSERT 0x42C
|
|
||||||
#define ALT_DELETE 0x42D
|
|
||||||
#define SHIFT_ALT_LEFT 0x431
|
|
||||||
#define SHIFT_ALT_RIGHT 0x432
|
|
||||||
#define SHIFT_ALT_UP 0x433
|
|
||||||
#define SHIFT_ALT_DOWN 0x434
|
|
||||||
//#define SHIFT_LEFT 0x451
|
|
||||||
//#define SHIFT_RIGHT 0x452
|
|
||||||
#define SHIFT_UP 0x453
|
|
||||||
#define SHIFT_DOWN 0x454
|
|
||||||
#define SHIFT_HOME 0x455
|
|
||||||
#define SHIFT_END 0x456
|
|
||||||
#define SHIFT_PAGEUP 0x457
|
|
||||||
#define SHIFT_PAGEDOWN 0x458
|
|
||||||
#define SHIFT_DELETE 0x45D
|
|
||||||
#define SHIFT_TAB 0x45F
|
|
||||||
|
|
||||||
/* A special keycode for when <Tab> is pressed while the mark is on. */
|
|
||||||
#define INDENT_KEY 0x4F1
|
|
||||||
|
|
||||||
/* A special keycode to signal the beginning and end of a bracketed paste. */
|
|
||||||
#define BRACKETED_PASTE_MARKER 0x4FB
|
|
||||||
|
|
||||||
/* A special keycode for when a key produces an unknown escape sequence. */
|
|
||||||
#define FOREIGN_SEQUENCE 0x4FC
|
|
||||||
|
|
||||||
#ifdef USE_SLANG
|
|
||||||
#ifdef ENABLE_UTF8
|
|
||||||
#define KEY_BAD 0xFF /* Clipped error code. */
|
|
||||||
#endif
|
|
||||||
#define KEY_FLUSH 0x91 /* User-definable control code. */
|
|
||||||
#else
|
|
||||||
#define KEY_FLUSH KEY_F0 /* Nonexistent function key. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
/* An imaginary key for when we get a SIGWINCH (window resize). */
|
|
||||||
#define KEY_WINCH -2
|
|
||||||
|
|
||||||
/* Some extra flags for the undo function. */
|
|
||||||
#define WAS_BACKSPACE_AT_EOF (1<<1)
|
|
||||||
#define WAS_WHOLE_LINE (1<<2)
|
|
||||||
#define INCLUDED_LAST_LINE (1<<3)
|
|
||||||
#define MARK_WAS_SET (1<<4)
|
|
||||||
#define CURSOR_WAS_AT_HEAD (1<<5)
|
|
||||||
#endif /* !NANO_TINY */
|
|
||||||
|
|
||||||
/* The default number of columns from end of line where wrapping occurs. */
|
|
||||||
#define COLUMNS_FROM_EOL 8
|
|
||||||
|
|
||||||
/* The default width of a tab in spaces. */
|
|
||||||
#define WIDTH_OF_TAB 8
|
|
||||||
|
|
||||||
/* The default comment character when a syntax does not specify any. */
|
|
||||||
#define GENERAL_COMMENT_CHARACTER "#"
|
|
||||||
|
|
||||||
/* The maximum number of search/replace history strings saved, not
|
|
||||||
* counting the blank lines at their ends. */
|
|
||||||
#define MAX_SEARCH_HISTORY 100
|
|
||||||
|
|
||||||
/* The largest size_t number that doesn't have the high bit set. */
|
|
||||||
#define HIGHEST_POSITIVE ((~(size_t)0) >> 1)
|
|
||||||
|
|||||||
875
src/files.c
875
src/files.c
File diff suppressed because it is too large
Load Diff
138
src/folding.c
Normal file
138
src/folding.c
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
* folding.c -- This file is part of GNU nano. *
|
||||||
|
* *
|
||||||
|
* Copyright (C) 2022 rexy712 *
|
||||||
|
* *
|
||||||
|
* 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 3 of the License, *
|
||||||
|
* 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. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||||
|
* *
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "prototypes.h"
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
/* isspace */
|
||||||
|
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
|
||||||
|
/* Remove a folded segment from the given line until end of segment */
|
||||||
|
void unfold_folded_segment_from(linestruct *line)
|
||||||
|
{
|
||||||
|
if (line != NULL)
|
||||||
|
refresh_needed = TRUE;
|
||||||
|
for(;line != NULL && line->folded;line = line->next)
|
||||||
|
line->folded = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove a folded segment containing the given line */
|
||||||
|
void unfold_folded_segment(linestruct *line)
|
||||||
|
{
|
||||||
|
unfold_folded_segment_from(get_start_of_folded_segment(line));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the first member of the folded segment */
|
||||||
|
linestruct *get_start_of_folded_segment(linestruct *line)
|
||||||
|
{
|
||||||
|
if (!line->folded)
|
||||||
|
return line;
|
||||||
|
|
||||||
|
while (line->prev != NULL && line->prev->folded)
|
||||||
|
line = line->prev;
|
||||||
|
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
/* Get the last member of the folded segment */
|
||||||
|
linestruct *get_end_of_folded_segment(linestruct *line)
|
||||||
|
{
|
||||||
|
if (!line->folded)
|
||||||
|
return line;
|
||||||
|
|
||||||
|
while (line->next != NULL && line->next->folded)
|
||||||
|
line = line->next;
|
||||||
|
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the span length of a folded_segment */
|
||||||
|
int get_folded_segment_length(linestruct *line)
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
|
||||||
|
if (!line->folded)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
line = get_start_of_folded_segment(line);
|
||||||
|
for (;line->next != NULL && line->next->folded;line = line->next)
|
||||||
|
++i;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Remove any folded_segments within the range [top, bottom].
|
||||||
|
* Returns true if any segments are removed. */
|
||||||
|
bool do_unfold_segment(linestruct *line)
|
||||||
|
{
|
||||||
|
/* Attempt to find a bracketed region first.
|
||||||
|
* If not, top is unmodified. */
|
||||||
|
if (!line->folded) {
|
||||||
|
linestruct *bot;
|
||||||
|
find_bracketed_region(openfile->current, &line, &bot);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line->folded) {
|
||||||
|
unfold_folded_segment(line);
|
||||||
|
move_cursor_to_proper_column();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fold the currently selected lines unless the current selection
|
||||||
|
* already contains a folded_segment. In that case, remove any
|
||||||
|
* segments that are selected. */
|
||||||
|
void do_fold_segment(void)
|
||||||
|
{
|
||||||
|
linestruct *top, *bot;
|
||||||
|
get_range(&top, &bot);
|
||||||
|
|
||||||
|
if (top == bot) {
|
||||||
|
/* First try to unfold if this line/bracketed region is folded */
|
||||||
|
if (do_unfold_segment(top))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* When not selecting multiple lines, try to find bounding
|
||||||
|
* brackets to act as top and bot. */
|
||||||
|
if (!find_bracketed_region(openfile->current, &top, &bot)) {
|
||||||
|
statusline(AHEM, _("No valid region found for automatic fold"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (linestruct* line = top;line != bot->next;line = line->next)
|
||||||
|
line->folded = TRUE;
|
||||||
|
|
||||||
|
if (top->lineno < openfile->edittop->lineno &&
|
||||||
|
bot->lineno > openfile->edittop->lineno)
|
||||||
|
openfile->edittop = top;
|
||||||
|
|
||||||
|
/* Place the cursor at the start of the fold segment.
|
||||||
|
* Anywhere else within the segment is invalid. */
|
||||||
|
if (openfile->current->folded)
|
||||||
|
openfile->current = get_start_of_folded_segment(top);
|
||||||
|
openfile->mark = NULL;
|
||||||
|
|
||||||
|
refresh_needed = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ENABLE_FOLDING */
|
||||||
819
src/global.c
819
src/global.c
File diff suppressed because it is too large
Load Diff
108
src/help.c
108
src/help.c
@@ -1,7 +1,7 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* help.c -- This file is part of GNU nano. *
|
* help.c -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 2000-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 2000-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* Copyright (C) 2017 Rishabh Dave *
|
* Copyright (C) 2017 Rishabh Dave *
|
||||||
* Copyright (C) 2014-2019 Benno Schulenberg *
|
* Copyright (C) 2014-2019 Benno Schulenberg *
|
||||||
* *
|
* *
|
||||||
@@ -50,7 +50,7 @@ void help_init(void)
|
|||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
/* First, set up the initial help text for the current function. */
|
/* First, set up the initial help text for the current function. */
|
||||||
if (currmenu == MWHEREIS || currmenu == MREPLACE || currmenu == MREPLACEWITH) {
|
if (currmenu & (MWHEREIS|MREPLACE)) {
|
||||||
htx[0] = N_("Search Command Help Text\n\n "
|
htx[0] = N_("Search Command Help Text\n\n "
|
||||||
"Enter the words or characters you would like to "
|
"Enter the words or characters you would like to "
|
||||||
"search for, and then press Enter. If there is a "
|
"search for, and then press Enter. If there is a "
|
||||||
@@ -65,6 +65,13 @@ void help_init(void)
|
|||||||
"will be replaced.\n\n The following function keys are "
|
"will be replaced.\n\n The following function keys are "
|
||||||
"available in Search mode:\n\n");
|
"available in Search mode:\n\n");
|
||||||
htx[2] = NULL;
|
htx[2] = NULL;
|
||||||
|
} else if (currmenu == MREPLACEWITH) {
|
||||||
|
htx[0] = N_("=== Replacement ===\n\n "
|
||||||
|
"Type the characters that should replace the characters that "
|
||||||
|
"you typed at the previous prompt, and press Enter.\n\n");
|
||||||
|
htx[1] = N_(" The following function keys "
|
||||||
|
"are available at this prompt:\n\n");
|
||||||
|
htx[2] = NULL;
|
||||||
} else if (currmenu == MGOTOLINE) {
|
} else if (currmenu == MGOTOLINE) {
|
||||||
htx[0] = N_("Go To Line Help Text\n\n "
|
htx[0] = N_("Go To Line Help Text\n\n "
|
||||||
"Enter the line number that you wish to go to and hit "
|
"Enter the line number that you wish to go to and hit "
|
||||||
@@ -126,8 +133,8 @@ void help_init(void)
|
|||||||
"shown in brackets after the search prompt. Hitting "
|
"shown in brackets after the search prompt. Hitting "
|
||||||
"Enter without entering any text will perform the "
|
"Enter without entering any text will perform the "
|
||||||
"previous search.\n\n");
|
"previous search.\n\n");
|
||||||
htx[1] = N_(" The following function keys are available in "
|
htx[1] = N_(" The following function keys "
|
||||||
"Browser Search mode:\n\n");
|
"are available at this prompt:\n\n");
|
||||||
htx[2] = NULL;
|
htx[2] = NULL;
|
||||||
} else if (currmenu == MGOTODIR) {
|
} else if (currmenu == MGOTODIR) {
|
||||||
htx[0] = N_("Browser Go To Directory Help Text\n\n "
|
htx[0] = N_("Browser Go To Directory Help Text\n\n "
|
||||||
@@ -167,8 +174,8 @@ void help_init(void)
|
|||||||
htx[1] = N_("If you just need another blank buffer, do not enter any "
|
htx[1] = N_("If you just need another blank buffer, do not enter any "
|
||||||
"command.\n\n You can also pick one of four tools, or cut a "
|
"command.\n\n You can also pick one of four tools, or cut a "
|
||||||
"large piece of the buffer, or put the editor to sleep.\n\n");
|
"large piece of the buffer, or put the editor to sleep.\n\n");
|
||||||
htx[2] = N_(" The following function keys are "
|
htx[2] = N_(" The following function keys "
|
||||||
"available in Execute Command mode:\n\n");
|
"are available at this prompt:\n\n");
|
||||||
} else if (currmenu == MLINTER) {
|
} else if (currmenu == MLINTER) {
|
||||||
htx[0] = N_("=== Linter ===\n\n "
|
htx[0] = N_("=== Linter ===\n\n "
|
||||||
"In this mode, the status bar shows an error message or "
|
"In this mode, the status bar shows an error message or "
|
||||||
@@ -224,7 +231,7 @@ void help_init(void)
|
|||||||
* plus translated text, plus one or two \n's. */
|
* plus translated text, plus one or two \n's. */
|
||||||
for (f = allfuncs; f != NULL; f = f->next)
|
for (f = allfuncs; f != NULL; f = f->next)
|
||||||
if (f->menus & currmenu)
|
if (f->menus & currmenu)
|
||||||
allocsize += strlen(_(f->help)) + 21;
|
allocsize += strlen(_(f->phrase)) + 21;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* If we're on the main list, we also count the toggle help text.
|
/* If we're on the main list, we also count the toggle help text.
|
||||||
@@ -234,13 +241,13 @@ void help_init(void)
|
|||||||
size_t onoff_len = strlen(_("enable/disable"));
|
size_t onoff_len = strlen(_("enable/disable"));
|
||||||
|
|
||||||
for (s = sclist; s != NULL; s = s->next)
|
for (s = sclist; s != NULL; s = s->next)
|
||||||
if (s->func == do_toggle_void)
|
if (s->func == do_toggle)
|
||||||
allocsize += strlen(_(flagtostr(s->toggle))) + onoff_len + 9;
|
allocsize += strlen(_(epithet_of_flag(s->toggle))) + onoff_len + 9;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Allocate memory for the help text. */
|
/* Allocate memory for the help text. */
|
||||||
help_text = charalloc(allocsize + 1);
|
help_text = nmalloc(allocsize + 1);
|
||||||
|
|
||||||
/* Now add the text we want. */
|
/* Now add the text we want. */
|
||||||
strcpy(help_text, htx[0]);
|
strcpy(help_text, htx[0]);
|
||||||
@@ -282,7 +289,7 @@ void help_init(void)
|
|||||||
ptr += 10;
|
ptr += 10;
|
||||||
|
|
||||||
/* The shortcut's description. */
|
/* The shortcut's description. */
|
||||||
ptr += sprintf(ptr, "%s\n", _(f->help));
|
ptr += sprintf(ptr, "%s\n", _(f->phrase));
|
||||||
|
|
||||||
if (f->blank_after)
|
if (f->blank_after)
|
||||||
ptr += sprintf(ptr, "\n");
|
ptr += sprintf(ptr, "\n");
|
||||||
@@ -303,26 +310,34 @@ void help_init(void)
|
|||||||
for (s = sclist; s != NULL; s = s->next)
|
for (s = sclist; s != NULL; s = s->next)
|
||||||
if (s->toggle && s->ordinal == counter) {
|
if (s->toggle && s->ordinal == counter) {
|
||||||
ptr += sprintf(ptr, "%s\t\t %s %s\n", (s->menus & MMAIN ? s->keystr : ""),
|
ptr += sprintf(ptr, "%s\t\t %s %s\n", (s->menus & MMAIN ? s->keystr : ""),
|
||||||
_(flagtostr(s->toggle)), _("enable/disable"));
|
_(epithet_of_flag(s->toggle)), _("enable/disable"));
|
||||||
if (s->toggle == NO_SYNTAX || s->toggle == TABS_TO_SPACES)
|
/* Add a blank like between two groups. */
|
||||||
|
if (s->toggle == NO_SYNTAX)
|
||||||
ptr += sprintf(ptr, "\n");
|
ptr += sprintf(ptr, "\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hard-wrap the concatenated help text, and write it into a new buffer. */
|
/* Hard-wrap the concatenated help text, and write it into a new buffer. */
|
||||||
void wrap_help_text_into_buffer(void)
|
void wrap_help_text_into_buffer(void)
|
||||||
{
|
{
|
||||||
size_t sum = 0;
|
|
||||||
/* Avoid overtight and overwide paragraphs in the introductory text. */
|
/* Avoid overtight and overwide paragraphs in the introductory text. */
|
||||||
size_t wrapping_point = ((COLS < 40) ? 40 : (COLS > 74) ? 74 : COLS) - thebar;
|
size_t wrapping_point = ((COLS < 40) ? 40 : (COLS > 74) ? 74 : COLS) - thebar;
|
||||||
const char *ptr = start_of_body;
|
const char *ptr = start_of_body;
|
||||||
|
size_t sum = 0;
|
||||||
|
|
||||||
make_new_buffer();
|
make_new_buffer();
|
||||||
|
|
||||||
|
/* Ensure there is a blank line at the top of the text, for esthetics. */
|
||||||
|
if ((ISSET(MINIBAR) || !ISSET(EMPTY_LINE)) && LINES > 6) {
|
||||||
|
openfile->current->data = mallocstrcpy(openfile->current->data, " ");
|
||||||
|
openfile->current->next = make_new_node(openfile->current);
|
||||||
|
openfile->current = openfile->current->next;
|
||||||
|
}
|
||||||
|
|
||||||
/* Copy the help text into the just-created new buffer. */
|
/* Copy the help text into the just-created new buffer. */
|
||||||
while (*ptr != '\0') {
|
while (*ptr != '\0') {
|
||||||
int length, shim;
|
int length, shim;
|
||||||
@@ -381,7 +396,7 @@ void wrap_help_text_into_buffer(void)
|
|||||||
void show_help(void)
|
void show_help(void)
|
||||||
{
|
{
|
||||||
int kbinput = ERR;
|
int kbinput = ERR;
|
||||||
functionptrtype func;
|
functionptrtype function;
|
||||||
/* The function of the key the user typed in. */
|
/* The function of the key the user typed in. */
|
||||||
int oldmenu = currmenu;
|
int oldmenu = currmenu;
|
||||||
/* The menu we were called from. */
|
/* The menu we were called from. */
|
||||||
@@ -403,8 +418,9 @@ void show_help(void)
|
|||||||
memcpy(stash, flags, sizeof(flags));
|
memcpy(stash, flags, sizeof(flags));
|
||||||
|
|
||||||
/* Ensure that the help screen's shortcut list can be displayed. */
|
/* Ensure that the help screen's shortcut list can be displayed. */
|
||||||
if (ISSET(NO_HELP) && LINES > 4) {
|
if (ISSET(NO_HELP) || ISSET(ZERO)) {
|
||||||
UNSET(NO_HELP);
|
UNSET(NO_HELP);
|
||||||
|
UNSET(ZERO);
|
||||||
window_init();
|
window_init();
|
||||||
} else
|
} else
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
@@ -415,10 +431,8 @@ void show_help(void)
|
|||||||
UNSET(USE_REGEXP);
|
UNSET(USE_REGEXP);
|
||||||
|
|
||||||
UNSET(WHITESPACE_DISPLAY);
|
UNSET(WHITESPACE_DISPLAY);
|
||||||
UNSET(NOREAD_MODE);
|
|
||||||
|
|
||||||
#ifdef ENABLE_LINENUMBERS
|
#ifdef ENABLE_LINENUMBERS
|
||||||
UNSET(LINE_NUMBERS);
|
|
||||||
editwincols = COLS - thebar;
|
editwincols = COLS - thebar;
|
||||||
margin = 0;
|
margin = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -456,38 +470,40 @@ void show_help(void)
|
|||||||
focusing = TRUE;
|
focusing = TRUE;
|
||||||
|
|
||||||
/* Show the cursor when we searched and found something. */
|
/* Show the cursor when we searched and found something. */
|
||||||
kbinput = get_kbinput(edit, didfind == 1 || ISSET(SHOW_CURSOR));
|
kbinput = get_kbinput(midwin, didfind == 1 || ISSET(SHOW_CURSOR));
|
||||||
|
|
||||||
didfind = 0;
|
didfind = 0;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
spotlighted = FALSE;
|
||||||
|
|
||||||
if (bracketed_paste || kbinput == BRACKETED_PASTE_MARKER) {
|
if (bracketed_paste || kbinput == BRACKETED_PASTE_MARKER) {
|
||||||
beep();
|
beep();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
func = interpret(&kbinput);
|
function = interpret(kbinput);
|
||||||
|
|
||||||
if (func == full_refresh) {
|
if (function == full_refresh) {
|
||||||
full_refresh();
|
full_refresh();
|
||||||
} else if (ISSET(SHOW_CURSOR) && (func == do_left || func == do_right ||
|
} else if (ISSET(SHOW_CURSOR) && (function == do_left || function == do_right ||
|
||||||
func == do_up || func == do_down)) {
|
function == do_up || function == do_down)) {
|
||||||
func();
|
function();
|
||||||
} else if (func == do_up || func == do_scroll_up) {
|
} else if (function == do_up || function == do_scroll_up) {
|
||||||
do_scroll_up();
|
do_scroll_up();
|
||||||
} else if (func == do_down || func == do_scroll_down) {
|
} else if (function == do_down || function == do_scroll_down) {
|
||||||
if (openfile->edittop->lineno + editwinrows - 1 <
|
if (openfile->edittop->lineno + editwinrows - 1 < openfile->filebot->lineno)
|
||||||
openfile->filebot->lineno)
|
|
||||||
do_scroll_down();
|
do_scroll_down();
|
||||||
} else if (func == do_page_up || func == do_page_down ||
|
} else if (function == do_page_up || function == do_page_down ||
|
||||||
func == to_first_line || func == to_last_line ||
|
function == to_first_line || function == to_last_line) {
|
||||||
func == do_findprevious || func == do_findnext) {
|
function();
|
||||||
func();
|
} else if (function == do_search_backward || function == do_search_forward ||
|
||||||
} else if (func == do_search_forward || func == do_search_backward) {
|
function == do_findprevious || function == do_findnext) {
|
||||||
func();
|
function();
|
||||||
bottombars(MHELP);
|
bottombars(MHELP);
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
} else if (func == (functionptrtype)implant) {
|
} else if (function == (functionptrtype)implant) {
|
||||||
implant(first_sc_for(MHELP, func)->expansion);
|
implant(first_sc_for(MHELP, function)->expansion);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MOUSE
|
#ifdef ENABLE_MOUSE
|
||||||
} else if (kbinput == KEY_MOUSE) {
|
} else if (kbinput == KEY_MOUSE) {
|
||||||
@@ -498,12 +514,11 @@ void show_help(void)
|
|||||||
} else if (kbinput == KEY_WINCH) {
|
} else if (kbinput == KEY_WINCH) {
|
||||||
; /* Nothing to do. */
|
; /* Nothing to do. */
|
||||||
#endif
|
#endif
|
||||||
} else if (func == do_exit) {
|
} else if (function == do_exit) {
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
unbound_key(kbinput);
|
unbound_key(kbinput);
|
||||||
|
|
||||||
currmenu = MHELP;
|
|
||||||
edit_refresh();
|
edit_refresh();
|
||||||
|
|
||||||
location = 0;
|
location = 0;
|
||||||
@@ -541,16 +556,15 @@ void show_help(void)
|
|||||||
|
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
|
|
||||||
if (ISSET(NO_HELP)) {
|
if (ISSET(NO_HELP) || ISSET(ZERO))
|
||||||
currmenu = oldmenu;
|
|
||||||
window_init();
|
window_init();
|
||||||
} else {
|
else
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
bottombars(oldmenu);
|
|
||||||
}
|
bottombars(oldmenu);
|
||||||
|
|
||||||
#ifdef ENABLE_BROWSER
|
#ifdef ENABLE_BROWSER
|
||||||
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
|
if (oldmenu & (MBROWSER|MWHEREISFILE|MGOTODIR))
|
||||||
browser_refresh();
|
browser_refresh();
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -568,8 +582,8 @@ void do_help(void)
|
|||||||
#ifdef ENABLE_HELP
|
#ifdef ENABLE_HELP
|
||||||
show_help();
|
show_help();
|
||||||
#else
|
#else
|
||||||
if (currmenu == MMAIN)
|
if (currmenu & (MMAIN|MBROWSER))
|
||||||
say_there_is_no_help();
|
statusbar(_("^W = Ctrl+W M-W = Alt+W"));
|
||||||
else
|
else
|
||||||
beep();
|
beep();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
298
src/history.c
298
src/history.c
@@ -1,7 +1,7 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* history.c -- This file is part of GNU nano. *
|
* history.c -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 2003-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 2003-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* Copyright (C) 2016, 2017, 2019 Benno Schulenberg *
|
* Copyright (C) 2016, 2017, 2019 Benno Schulenberg *
|
||||||
* *
|
* *
|
||||||
* GNU nano is free software: you can redistribute it and/or modify *
|
* GNU nano is free software: you can redistribute it and/or modify *
|
||||||
@@ -63,21 +63,21 @@ void history_init(void)
|
|||||||
executebot = execute_history;
|
executebot = execute_history;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the current position in the given history list to the bottom. */
|
/* Reset the pointer into the history list that contains item to the bottom. */
|
||||||
void history_reset(const linestruct *list)
|
void reset_history_pointer_for(const linestruct *item)
|
||||||
{
|
{
|
||||||
if (list == search_history)
|
if (item == search_history)
|
||||||
search_history = searchbot;
|
search_history = searchbot;
|
||||||
else if (list == replace_history)
|
else if (item == replace_history)
|
||||||
replace_history = replacebot;
|
replace_history = replacebot;
|
||||||
else if (list == execute_history)
|
else if (item == execute_history)
|
||||||
execute_history = executebot;
|
execute_history = executebot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return from the history list that starts at start and ends at end
|
/* Return from the history list that starts at start and ends at end
|
||||||
* the first node that contains the first len characters of the given
|
* the first node that contains the first len characters of the given
|
||||||
* text, or NULL if there is no such node. */
|
* text, or NULL if there is no such node. */
|
||||||
linestruct *find_history(const linestruct *start, const linestruct *end,
|
linestruct *find_in_history(const linestruct *start, const linestruct *end,
|
||||||
const char *text, size_t len)
|
const char *text, size_t len)
|
||||||
{
|
{
|
||||||
const linestruct *item;
|
const linestruct *item;
|
||||||
@@ -92,9 +92,10 @@ linestruct *find_history(const linestruct *start, const linestruct *end,
|
|||||||
|
|
||||||
/* Update a history list (the one in which item is the current position)
|
/* Update a history list (the one in which item is the current position)
|
||||||
* with a fresh string text. That is: add text, or move it to the end. */
|
* with a fresh string text. That is: add text, or move it to the end. */
|
||||||
void update_history(linestruct **item, const char *text)
|
void update_history(linestruct **item, const char *text, bool avoid_duplicates)
|
||||||
{
|
{
|
||||||
linestruct **htop = NULL, **hbot = NULL, *thesame;
|
linestruct **htop = NULL, **hbot = NULL;
|
||||||
|
linestruct *thesame = NULL;
|
||||||
|
|
||||||
if (*item == search_history) {
|
if (*item == search_history) {
|
||||||
htop = &searchtop;
|
htop = &searchtop;
|
||||||
@@ -107,11 +108,12 @@ void update_history(linestruct **item, const char *text)
|
|||||||
hbot = &executebot;
|
hbot = &executebot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if the string is already in the history. */
|
/* When requested, check if the string is already in the history. */
|
||||||
thesame = find_history(*hbot, *htop, text, HIGHEST_POSITIVE);
|
if (avoid_duplicates)
|
||||||
|
thesame = find_in_history(*hbot, *htop, text, HIGHEST_POSITIVE);
|
||||||
|
|
||||||
/* If an identical string was found, delete that item. */
|
/* If an identical string was found, delete that item. */
|
||||||
if (thesame != NULL) {
|
if (thesame) {
|
||||||
linestruct *after = thesame->next;
|
linestruct *after = thesame->next;
|
||||||
|
|
||||||
/* If the string is at the head of the list, move the head. */
|
/* If the string is at the head of the list, move the head. */
|
||||||
@@ -145,98 +147,67 @@ void update_history(linestruct **item, const char *text)
|
|||||||
*item = *hbot;
|
*item = *hbot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move h to the string in the history list just before it, and return
|
|
||||||
* that string. If there isn't one, don't move h and return NULL. */
|
|
||||||
char *get_history_older(linestruct **h)
|
|
||||||
{
|
|
||||||
if ((*h)->prev == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
*h = (*h)->prev;
|
|
||||||
|
|
||||||
return (*h)->data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move h to the string in the history list just after it, and return
|
|
||||||
* that string. If there isn't one, don't move h and return NULL. */
|
|
||||||
char *get_history_newer(linestruct **h)
|
|
||||||
{
|
|
||||||
if ((*h)->next == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
*h = (*h)->next;
|
|
||||||
|
|
||||||
return (*h)->data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Two empty placeholder functions. */
|
|
||||||
void get_history_older_void(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
void get_history_newer_void(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_TABCOMP
|
#ifdef ENABLE_TABCOMP
|
||||||
/* Go backward through one of three history lists, starting at its item h,
|
/* Go backward through one of three history lists, starting at item *here,
|
||||||
* searching for a string that is a tab completion of the given string s,
|
* searching for a string that is a tab completion of the given string,
|
||||||
* looking at only the first len characters of s. When found, make h point
|
* looking at only its first len characters. When found, make *here point
|
||||||
* at it and return that string; otherwise, don't move h and return s. */
|
* at the item and return its string; otherwise, just return the string. */
|
||||||
char *get_history_completion(linestruct **h, char *s, size_t len)
|
char *get_history_completion(linestruct **here, char *string, size_t len)
|
||||||
{
|
{
|
||||||
linestruct *htop = NULL, *hbot = NULL, *p;
|
linestruct *htop = NULL, *hbot = NULL;
|
||||||
|
linestruct *item;
|
||||||
|
|
||||||
if (*h == search_history) {
|
if (*here == search_history) {
|
||||||
htop = searchtop;
|
htop = searchtop;
|
||||||
hbot = searchbot;
|
hbot = searchbot;
|
||||||
} else if (*h == replace_history) {
|
} else if (*here == replace_history) {
|
||||||
htop = replacetop;
|
htop = replacetop;
|
||||||
hbot = replacebot;
|
hbot = replacebot;
|
||||||
} else if (*h == execute_history) {
|
} else if (*here == execute_history) {
|
||||||
htop = executetop;
|
htop = executetop;
|
||||||
hbot = executebot;
|
hbot = executebot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First search from the current position to the top of the list
|
/* First search from the current position to the top of the list
|
||||||
* for a match of len characters. Skip over an exact match. */
|
* for a match of len characters. Skip over an exact match. */
|
||||||
p = find_history((*h)->prev, htop, s, len);
|
item = find_in_history((*here)->prev, htop, string, len);
|
||||||
|
|
||||||
while (p != NULL && strcmp(p->data, s) == 0)
|
while (item != NULL && strcmp(item->data, string) == 0)
|
||||||
p = find_history(p->prev, htop, s, len);
|
item = find_in_history(item->prev, htop, string, len);
|
||||||
|
|
||||||
if (p != NULL) {
|
if (item) {
|
||||||
*h = p;
|
*here = item;
|
||||||
return mallocstrcpy(s, (*h)->data);
|
return mallocstrcpy(string, item->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now search from the bottom of the list to the original position. */
|
/* Now search from the bottom of the list to the original position. */
|
||||||
p = find_history(hbot, *h, s, len);
|
item = find_in_history(hbot, *here, string, len);
|
||||||
|
|
||||||
while (p != NULL && strcmp(p->data, s) == 0)
|
while (item != NULL && strcmp(item->data, string) == 0)
|
||||||
p = find_history(p->prev, *h, s, len);
|
item = find_in_history(item->prev, *here, string, len);
|
||||||
|
|
||||||
if (p != NULL) {
|
if (item) {
|
||||||
*h = p;
|
*here = item;
|
||||||
return mallocstrcpy(s, (*h)->data);
|
return mallocstrcpy(string, item->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When no useful match was found, simply return the given string. */
|
/* When no useful match was found, simply return the given string. */
|
||||||
return (char *)s;
|
return (char *)string;
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_TABCOMP */
|
#endif /* ENABLE_TABCOMP */
|
||||||
|
|
||||||
/* Check whether we have or could make a directory for history files. */
|
/* Check whether we have or could make a directory for history files. */
|
||||||
bool have_statedir(void)
|
bool have_statedir(void)
|
||||||
{
|
{
|
||||||
struct stat dirstat;
|
|
||||||
const char *xdgdatadir;
|
const char *xdgdatadir;
|
||||||
|
struct stat dirinfo;
|
||||||
|
|
||||||
get_homedir();
|
get_homedir();
|
||||||
|
|
||||||
if (homedir != NULL) {
|
if (homedir != NULL) {
|
||||||
statedir = concatenate(homedir, "/.nano/");
|
statedir = concatenate(homedir, "/.nano/");
|
||||||
|
|
||||||
if (stat(statedir, &dirstat) == 0 && S_ISDIR(dirstat.st_mode)) {
|
if (stat(statedir, &dirinfo) == 0 && S_ISDIR(dirinfo.st_mode)) {
|
||||||
poshistname = concatenate(statedir, POSITION_HISTORY);
|
poshistname = concatenate(statedir, POSITION_HISTORY);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -253,7 +224,7 @@ bool have_statedir(void)
|
|||||||
else
|
else
|
||||||
statedir = concatenate(homedir, "/.local/share/nano/");
|
statedir = concatenate(homedir, "/.local/share/nano/");
|
||||||
|
|
||||||
if (stat(statedir, &dirstat) == -1) {
|
if (stat(statedir, &dirinfo) == -1) {
|
||||||
if (xdgdatadir == NULL) {
|
if (xdgdatadir == NULL) {
|
||||||
char *statepath = concatenate(homedir, "/.local");
|
char *statepath = concatenate(homedir, "/.local");
|
||||||
mkdir(statepath, S_IRWXU | S_IRWXG | S_IRWXO);
|
mkdir(statepath, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
@@ -269,7 +240,7 @@ bool have_statedir(void)
|
|||||||
statedir, strerror(errno));
|
statedir, strerror(errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else if (!S_ISDIR(dirstat.st_mode)) {
|
} else if (!S_ISDIR(dirinfo.st_mode)) {
|
||||||
jot_error(N_("Path %s is not a directory and needs to be.\n"
|
jot_error(N_("Path %s is not a directory and needs to be.\n"
|
||||||
"Nano will be unable to load or save "
|
"Nano will be unable to load or save "
|
||||||
"search history or cursor positions.\n"),
|
"search history or cursor positions.\n"),
|
||||||
@@ -299,17 +270,17 @@ void load_history(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
linestruct **history = &search_history;
|
linestruct **history = &search_history;
|
||||||
char *line = NULL;
|
char *stanza = NULL;
|
||||||
size_t buf_len = 0;
|
size_t dummy = 0;
|
||||||
ssize_t read;
|
ssize_t read;
|
||||||
|
|
||||||
/* Load the three history lists (first search, then replace, then execute)
|
/* Load the three history lists (first search, then replace, then execute)
|
||||||
* from oldest entry to newest. Between two lists there is an empty line. */
|
* from oldest entry to newest. Between two lists there is an empty line. */
|
||||||
while ((read = getline(&line, &buf_len, histfile)) > 0) {
|
while ((read = getline(&stanza, &dummy, histfile)) > 0) {
|
||||||
line[--read] = '\0';
|
stanza[--read] = '\0';
|
||||||
if (read > 0) {
|
if (read > 0) {
|
||||||
recode_NUL_to_LF(line, read);
|
recode_NUL_to_LF(stanza, read);
|
||||||
update_history(history, line);
|
update_history(history, stanza, IGNORE_DUPLICATES);
|
||||||
} else if (history == &search_history)
|
} else if (history == &search_history)
|
||||||
history = &replace_history;
|
history = &replace_history;
|
||||||
else
|
else
|
||||||
@@ -320,7 +291,7 @@ void load_history(void)
|
|||||||
jot_error(N_("Error reading %s: %s"), histname, strerror(errno));
|
jot_error(N_("Error reading %s: %s"), histname, strerror(errno));
|
||||||
|
|
||||||
free(histname);
|
free(histname);
|
||||||
free(line);
|
free(stanza);
|
||||||
|
|
||||||
/* Reading in the lists has marked them as changed; undo this side effect. */
|
/* Reading in the lists has marked them as changed; undo this side effect. */
|
||||||
history_changed = FALSE;
|
history_changed = FALSE;
|
||||||
@@ -333,12 +304,10 @@ bool write_list(const linestruct *head, FILE *histfile)
|
|||||||
const linestruct *item;
|
const linestruct *item;
|
||||||
|
|
||||||
for (item = head; item != NULL; item = item->next) {
|
for (item = head; item != NULL; item = item->next) {
|
||||||
size_t length = strlen(item->data);
|
|
||||||
|
|
||||||
/* Decode 0x0A bytes as embedded NULs. */
|
/* Decode 0x0A bytes as embedded NULs. */
|
||||||
recode_LF_to_NUL(item->data);
|
size_t length = recode_LF_to_NUL(item->data);
|
||||||
|
|
||||||
if (fwrite(item->data, sizeof(char), length, histfile) < length)
|
if (fwrite(item->data, 1, length, histfile) < length)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (putc('\n', histfile) == EOF)
|
if (putc('\n', histfile) == EOF)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -361,20 +330,21 @@ void save_history(void)
|
|||||||
histfile = fopen(histname, "wb");
|
histfile = fopen(histname, "wb");
|
||||||
|
|
||||||
if (histfile == NULL) {
|
if (histfile == NULL) {
|
||||||
jot_error(N_("Error writing %s: %s\n"), histname, strerror(errno));
|
jot_error(N_("Error writing %s: %s"), histname, strerror(errno));
|
||||||
free(histname);
|
free(histname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't allow others to read or write the history file. */
|
/* Don't allow others to read or write the history file. */
|
||||||
chmod(histname, S_IRUSR | S_IWUSR);
|
if (chmod(histname, S_IRUSR | S_IWUSR) < 0)
|
||||||
|
jot_error(N_("Cannot limit permissions on %s: %s"), histname, strerror(errno));
|
||||||
|
|
||||||
if (!write_list(searchtop, histfile) || !write_list(replacetop, histfile) ||
|
if (!write_list(searchtop, histfile) || !write_list(replacetop, histfile) ||
|
||||||
!write_list(executetop, histfile))
|
!write_list(executetop, histfile))
|
||||||
jot_error(N_("Error writing %s: %s\n"), histname, strerror(errno));
|
jot_error(N_("Error writing %s: %s"), histname, strerror(errno));
|
||||||
|
|
||||||
if (fclose(histfile) == EOF)
|
if (fclose(histfile) == EOF)
|
||||||
jot_error(N_("Error writing %s: %s\n"), histname, strerror(errno));
|
jot_error(N_("Error writing %s: %s"), histname, strerror(errno));
|
||||||
|
|
||||||
free(histname);
|
free(histname);
|
||||||
}
|
}
|
||||||
@@ -393,43 +363,46 @@ void load_poshistory(void)
|
|||||||
if (histfile == NULL)
|
if (histfile == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char *line = NULL, *lineptr, *xptr;
|
poshiststruct *lastitem = NULL;
|
||||||
size_t buf_len = 0;
|
poshiststruct *newitem;
|
||||||
ssize_t read, count = 0;
|
char *lineptr, *columnptr;
|
||||||
|
char *stanza = NULL;
|
||||||
struct stat fileinfo;
|
struct stat fileinfo;
|
||||||
poshiststruct *record_ptr = NULL, *newrecord;
|
size_t dummy = 0;
|
||||||
|
ssize_t count = 0;
|
||||||
|
ssize_t read;
|
||||||
|
|
||||||
/* Read and parse each line, and store the extracted data. */
|
/* Read and parse each line, and store the extracted data. */
|
||||||
while ((read = getline(&line, &buf_len, histfile)) > 5) {
|
while ((read = getline(&stanza, &dummy, histfile)) > 5) {
|
||||||
/* Decode NULs as embedded newlines. */
|
/* Decode NULs as embedded newlines. */
|
||||||
recode_NUL_to_LF(line, read);
|
recode_NUL_to_LF(stanza, read);
|
||||||
|
|
||||||
/* Find where the x index and line number are in the line. */
|
/* Find the spaces before column number and line number. */
|
||||||
xptr = revstrstr(line, " ", line + read - 3);
|
columnptr = revstrstr(stanza, " ", stanza + read - 3);
|
||||||
if (xptr == NULL)
|
if (columnptr == NULL)
|
||||||
continue;
|
continue;
|
||||||
lineptr = revstrstr(line, " ", xptr - 2);
|
lineptr = revstrstr(stanza, " ", columnptr - 2);
|
||||||
if (lineptr == NULL)
|
if (lineptr == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Now separate the three elements of the line. */
|
/* Now separate the three elements of the line. */
|
||||||
*(xptr++) = '\0';
|
*(columnptr++) = '\0';
|
||||||
*(lineptr++) = '\0';
|
*(lineptr++) = '\0';
|
||||||
|
|
||||||
/* Create a new position record. */
|
/* Create a new position record. */
|
||||||
newrecord = (poshiststruct *)nmalloc(sizeof(poshiststruct));
|
newitem = nmalloc(sizeof(poshiststruct));
|
||||||
newrecord->filename = copy_of(line);
|
newitem->filename = copy_of(stanza);
|
||||||
newrecord->lineno = atoi(lineptr);
|
newitem->linenumber = atoi(lineptr);
|
||||||
newrecord->xno = atoi(xptr);
|
newitem->columnnumber = atoi(columnptr);
|
||||||
newrecord->next = NULL;
|
newitem->next = NULL;
|
||||||
|
|
||||||
/* Add the record to the list. */
|
/* Add the record to the list. */
|
||||||
if (position_history == NULL)
|
if (position_history == NULL)
|
||||||
position_history = newrecord;
|
position_history = newitem;
|
||||||
else
|
else
|
||||||
record_ptr->next = newrecord;
|
lastitem->next = newitem;
|
||||||
|
|
||||||
record_ptr = newrecord;
|
lastitem = newitem;
|
||||||
|
|
||||||
/* Impose a limit, so the file will not grow indefinitely. */
|
/* Impose a limit, so the file will not grow indefinitely. */
|
||||||
if (++count > 200) {
|
if (++count > 200) {
|
||||||
@@ -445,88 +418,83 @@ void load_poshistory(void)
|
|||||||
if (fclose(histfile) == EOF)
|
if (fclose(histfile) == EOF)
|
||||||
jot_error(N_("Error reading %s: %s"), poshistname, strerror(errno));
|
jot_error(N_("Error reading %s: %s"), poshistname, strerror(errno));
|
||||||
|
|
||||||
free(line);
|
free(stanza);
|
||||||
|
|
||||||
if (stat(poshistname, &fileinfo) == -1)
|
if (stat(poshistname, &fileinfo) == 0)
|
||||||
jot_error(N_("Error reading %s: %s\n"), poshistname, strerror(errno));
|
|
||||||
else
|
|
||||||
latest_timestamp = fileinfo.st_mtime;
|
latest_timestamp = fileinfo.st_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the recorded cursor positions for files that were edited. */
|
/* Save the recorded cursor positions for files that were edited. */
|
||||||
void save_poshistory(void)
|
void save_poshistory(void)
|
||||||
{
|
{
|
||||||
poshiststruct *posptr;
|
|
||||||
struct stat fileinfo;
|
|
||||||
FILE *histfile = fopen(poshistname, "wb");
|
FILE *histfile = fopen(poshistname, "wb");
|
||||||
|
struct stat fileinfo;
|
||||||
|
poshiststruct *item;
|
||||||
|
|
||||||
if (histfile == NULL) {
|
if (histfile == NULL) {
|
||||||
jot_error(N_("Error writing %s: %s\n"), poshistname, strerror(errno));
|
jot_error(N_("Error writing %s: %s"), poshistname, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't allow others to read or write the history file. */
|
/* Don't allow others to read or write the history file. */
|
||||||
chmod(poshistname, S_IRUSR | S_IWUSR);
|
if (chmod(poshistname, S_IRUSR | S_IWUSR) < 0)
|
||||||
|
jot_error(N_("Cannot limit permissions on %s: %s"), poshistname, strerror(errno));
|
||||||
|
|
||||||
for (posptr = position_history; posptr != NULL; posptr = posptr->next) {
|
for (item = position_history; item != NULL; item = item->next) {
|
||||||
char *path_and_place;
|
char *path_and_place;
|
||||||
size_t length;
|
size_t length;
|
||||||
|
|
||||||
/* Assume 20 decimal positions each for line and column number,
|
/* Assume 20 decimal positions each for line and column number,
|
||||||
* plus two spaces, plus the line feed, plus the null byte. */
|
* plus two spaces, plus the line feed, plus the null byte. */
|
||||||
path_and_place = charalloc(strlen(posptr->filename) + 44);
|
path_and_place = nmalloc(strlen(item->filename) + 44);
|
||||||
sprintf(path_and_place, "%s %zd %zd\n",
|
sprintf(path_and_place, "%s %zd %zd\n",
|
||||||
posptr->filename, posptr->lineno, posptr->xno);
|
item->filename, item->linenumber, item->columnnumber);
|
||||||
length = strlen(path_and_place);
|
|
||||||
|
|
||||||
/* Encode newlines in filenames as NULs. */
|
/* Encode newlines in filenames as NULs. */
|
||||||
recode_LF_to_NUL(path_and_place);
|
length = recode_LF_to_NUL(path_and_place);
|
||||||
/* Restore the terminating newline. */
|
/* Restore the terminating newline. */
|
||||||
path_and_place[length - 1] = '\n';
|
path_and_place[length - 1] = '\n';
|
||||||
|
|
||||||
if (fwrite(path_and_place, sizeof(char), length, histfile) < length)
|
if (fwrite(path_and_place, 1, length, histfile) < length)
|
||||||
jot_error(N_("Error writing %s: %s\n"), poshistname, strerror(errno));
|
jot_error(N_("Error writing %s: %s"), poshistname, strerror(errno));
|
||||||
|
|
||||||
free(path_and_place);
|
free(path_and_place);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fclose(histfile) == EOF)
|
if (fclose(histfile) == EOF)
|
||||||
jot_error(N_("Error writing %s: %s\n"), poshistname, strerror(errno));
|
jot_error(N_("Error writing %s: %s"), poshistname, strerror(errno));
|
||||||
|
|
||||||
if (stat(poshistname, &fileinfo) == -1)
|
if (stat(poshistname, &fileinfo) == 0)
|
||||||
jot_error(N_("Error writing %s: %s\n"), poshistname, strerror(errno));
|
|
||||||
else
|
|
||||||
latest_timestamp = fileinfo.st_mtime;
|
latest_timestamp = fileinfo.st_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reload the position history file if it has been modified since last load. */
|
/* Reload the position history file if it has been modified since last load. */
|
||||||
void reload_positions_if_needed(void)
|
void reload_positions_if_needed(void)
|
||||||
{
|
{
|
||||||
|
poshiststruct *item, *nextone;
|
||||||
struct stat fileinfo;
|
struct stat fileinfo;
|
||||||
|
|
||||||
if (stat(poshistname, &fileinfo) == -1)
|
if (stat(poshistname, &fileinfo) != 0 || fileinfo.st_mtime == latest_timestamp)
|
||||||
jot_error(N_("Error reading %s: %s\n"), poshistname, strerror(errno));
|
return;
|
||||||
else if (fileinfo.st_mtime != latest_timestamp) {
|
|
||||||
poshiststruct *item, *nextone;
|
|
||||||
|
|
||||||
for (item = position_history; item != NULL; item = nextone) {
|
for (item = position_history; item != NULL; item = nextone) {
|
||||||
nextone = item->next;
|
nextone = item->next;
|
||||||
free(item->filename);
|
free(item->filename);
|
||||||
free(item);
|
free(item);
|
||||||
}
|
|
||||||
|
|
||||||
position_history = NULL;
|
|
||||||
|
|
||||||
load_poshistory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
position_history = NULL;
|
||||||
|
|
||||||
|
load_poshistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the recorded last file positions with the current position in the
|
/* Update the recorded last file positions with the current position in the
|
||||||
* current buffer. If no existing entry is found, add a new one at the end. */
|
* current buffer. If no existing entry is found, add a new one at the end. */
|
||||||
void update_poshistory(void)
|
void update_poshistory(void)
|
||||||
{
|
{
|
||||||
poshiststruct *posptr, *theone, *posprev = NULL;
|
|
||||||
char *fullpath = get_full_path(openfile->filename);
|
char *fullpath = get_full_path(openfile->filename);
|
||||||
|
poshiststruct *previous = NULL;
|
||||||
|
poshiststruct *item, *theone;
|
||||||
|
|
||||||
if (fullpath == NULL || openfile->filename[0] == '\0') {
|
if (fullpath == NULL || openfile->filename[0] == '\0') {
|
||||||
free(fullpath);
|
free(fullpath);
|
||||||
@@ -536,51 +504,51 @@ void update_poshistory(void)
|
|||||||
reload_positions_if_needed();
|
reload_positions_if_needed();
|
||||||
|
|
||||||
/* Look for a matching filename in the list. */
|
/* Look for a matching filename in the list. */
|
||||||
for (posptr = position_history; posptr != NULL; posptr = posptr->next) {
|
for (item = position_history; item != NULL; item = item->next) {
|
||||||
if (!strcmp(posptr->filename, fullpath))
|
if (!strcmp(item->filename, fullpath))
|
||||||
break;
|
break;
|
||||||
posprev = posptr;
|
previous = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't record files that have the default cursor position. */
|
/* Don't record files that have the default cursor position. */
|
||||||
if (openfile->current->lineno == 1 && openfile->current_x == 0) {
|
if (openfile->current->lineno == 1 && openfile->current_x == 0) {
|
||||||
if (posptr != NULL) {
|
if (item != NULL) {
|
||||||
if (posprev == NULL)
|
if (previous == NULL)
|
||||||
position_history = posptr->next;
|
position_history = item->next;
|
||||||
else
|
else
|
||||||
posprev->next = posptr->next;
|
previous->next = item->next;
|
||||||
free(posptr->filename);
|
free(item->filename);
|
||||||
free(posptr);
|
free(item);
|
||||||
save_poshistory();
|
save_poshistory();
|
||||||
}
|
}
|
||||||
free(fullpath);
|
free(fullpath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
theone = posptr;
|
theone = item;
|
||||||
|
|
||||||
/* If we didn't find it, make a new node; otherwise, if we're
|
/* If we didn't find it, make a new node; otherwise, if we're
|
||||||
* not at the end, move the matching one to the end. */
|
* not at the end, move the matching one to the end. */
|
||||||
if (theone == NULL) {
|
if (theone == NULL) {
|
||||||
theone = (poshiststruct *)nmalloc(sizeof(poshiststruct));
|
theone = nmalloc(sizeof(poshiststruct));
|
||||||
theone->filename = copy_of(fullpath);
|
theone->filename = copy_of(fullpath);
|
||||||
if (position_history == NULL)
|
if (position_history == NULL)
|
||||||
position_history = theone;
|
position_history = theone;
|
||||||
else
|
else
|
||||||
posprev->next = theone;
|
previous->next = theone;
|
||||||
} else if (posptr->next != NULL) {
|
} else if (item->next != NULL) {
|
||||||
if (posprev == NULL)
|
if (previous == NULL)
|
||||||
position_history = posptr->next;
|
position_history = item->next;
|
||||||
else
|
else
|
||||||
posprev->next = posptr->next;
|
previous->next = item->next;
|
||||||
while (posptr->next != NULL)
|
while (item->next != NULL)
|
||||||
posptr = posptr->next;
|
item = item->next;
|
||||||
posptr->next = theone;
|
item->next = theone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the last cursor position. */
|
/* Store the last cursor position. */
|
||||||
theone->lineno = openfile->current->lineno;
|
theone->linenumber = openfile->current->lineno;
|
||||||
theone->xno = xplustabs() + 1;
|
theone->columnnumber = xplustabs() + 1;
|
||||||
theone->next = NULL;
|
theone->next = NULL;
|
||||||
|
|
||||||
free(fullpath);
|
free(fullpath);
|
||||||
@@ -593,25 +561,25 @@ void update_poshistory(void)
|
|||||||
* set line and column to the retrieved values. */
|
* set line and column to the retrieved values. */
|
||||||
bool has_old_position(const char *file, ssize_t *line, ssize_t *column)
|
bool has_old_position(const char *file, ssize_t *line, ssize_t *column)
|
||||||
{
|
{
|
||||||
poshiststruct *posptr;
|
|
||||||
char *fullpath = get_full_path(file);
|
char *fullpath = get_full_path(file);
|
||||||
|
poshiststruct *item;
|
||||||
|
|
||||||
if (fullpath == NULL)
|
if (fullpath == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
reload_positions_if_needed();
|
reload_positions_if_needed();
|
||||||
|
|
||||||
posptr = position_history;
|
item = position_history;
|
||||||
while (posptr != NULL && strcmp(posptr->filename, fullpath) != 0)
|
while (item != NULL && strcmp(item->filename, fullpath) != 0)
|
||||||
posptr = posptr->next;
|
item = item->next;
|
||||||
|
|
||||||
free(fullpath);
|
free(fullpath);
|
||||||
|
|
||||||
if (posptr == NULL)
|
if (item == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*line = posptr->lineno;
|
*line = item->linenumber;
|
||||||
*column = posptr->xno;
|
*column = item->columnnumber;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_HISTORIES */
|
#endif /* ENABLE_HISTORIES */
|
||||||
|
|||||||
213
src/move.c
213
src/move.c
@@ -1,7 +1,7 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* move.c -- This file is part of GNU nano. *
|
* move.c -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 1999-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* Copyright (C) 2014-2018 Benno Schulenberg *
|
* Copyright (C) 2014-2018 Benno Schulenberg *
|
||||||
* *
|
* *
|
||||||
* GNU nano is free software: you can redistribute it and/or modify *
|
* GNU nano is free software: you can redistribute it and/or modify *
|
||||||
@@ -37,13 +37,22 @@ void to_first_line(void)
|
|||||||
void to_last_line(void)
|
void to_last_line(void)
|
||||||
{
|
{
|
||||||
openfile->current = openfile->filebot;
|
openfile->current = openfile->filebot;
|
||||||
openfile->current_x = (inhelp) ? 0 : strlen(openfile->filebot->data);
|
#ifdef ENABLE_FOLDING
|
||||||
|
if (openfile->current->folded) {
|
||||||
|
openfile->current = get_start_of_folded_segment(openfile->current);
|
||||||
|
openfile->current_x = 0;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
openfile->current_x = (inhelp) ? 0 : strlen(openfile->filebot->data);
|
||||||
openfile->placewewant = xplustabs();
|
openfile->placewewant = xplustabs();
|
||||||
|
|
||||||
/* Set the last line of the screen as the target for the cursor. */
|
/* Set the last line of the screen as the target for the cursor. */
|
||||||
openfile->current_y = editwinrows - 1;
|
openfile->current_y = editwinrows - 1;
|
||||||
|
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
recook |= perturbed;
|
||||||
|
#endif
|
||||||
focusing = FALSE;
|
focusing = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,8 +104,8 @@ size_t proper_x(linestruct *line, size_t *leftedge, bool forward,
|
|||||||
* the middle of a tab that crosses a row boundary. */
|
* the middle of a tab that crosses a row boundary. */
|
||||||
void set_proper_index_and_pww(size_t *leftedge, size_t target, bool forward)
|
void set_proper_index_and_pww(size_t *leftedge, size_t target, bool forward)
|
||||||
{
|
{
|
||||||
bool shifted = FALSE;
|
|
||||||
size_t was_edge = *leftedge;
|
size_t was_edge = *leftedge;
|
||||||
|
bool shifted = FALSE;
|
||||||
|
|
||||||
openfile->current_x = proper_x(openfile->current, leftedge, forward,
|
openfile->current_x = proper_x(openfile->current, leftedge, forward,
|
||||||
actual_last_column(*leftedge, target), &shifted);
|
actual_last_column(*leftedge, target), &shifted);
|
||||||
@@ -109,12 +118,22 @@ void set_proper_index_and_pww(size_t *leftedge, size_t target, bool forward)
|
|||||||
openfile->placewewant = *leftedge + target;
|
openfile->placewewant = *leftedge + target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Move the cursor position on the current line to the desired column */
|
||||||
|
void move_cursor_to_proper_column(void)
|
||||||
|
{
|
||||||
|
size_t leftedge;
|
||||||
|
size_t target_column;
|
||||||
|
get_edge_and_target(&leftedge, &target_column);
|
||||||
|
set_proper_index_and_pww(&leftedge, target_column, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Move up almost one screenful. */
|
/* Move up almost one screenful. */
|
||||||
void do_page_up(void)
|
void do_page_up(void)
|
||||||
{
|
{
|
||||||
int mustmove = (editwinrows < 3) ? 1 : editwinrows - 2;
|
int mustmove = (editwinrows < 3) ? 1 : editwinrows - 2;
|
||||||
size_t leftedge, target_column;
|
size_t leftedge, target_column;
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
/* If we're not in smooth scrolling mode, put the cursor at the
|
/* 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. */
|
* beginning of the top line of the edit window, as Pico does. */
|
||||||
if (ISSET(JUMPY_SCROLLING)) {
|
if (ISSET(JUMPY_SCROLLING)) {
|
||||||
@@ -123,6 +142,7 @@ void do_page_up(void)
|
|||||||
openfile->current_y = 0;
|
openfile->current_y = 0;
|
||||||
target_column = 0;
|
target_column = 0;
|
||||||
} else
|
} else
|
||||||
|
#endif
|
||||||
get_edge_and_target(&leftedge, &target_column);
|
get_edge_and_target(&leftedge, &target_column);
|
||||||
|
|
||||||
/* Move up the required number of lines or chunks. If we can't, we're
|
/* Move up the required number of lines or chunks. If we can't, we're
|
||||||
@@ -145,6 +165,7 @@ void do_page_down(void)
|
|||||||
int mustmove = (editwinrows < 3) ? 1 : editwinrows - 2;
|
int mustmove = (editwinrows < 3) ? 1 : editwinrows - 2;
|
||||||
size_t leftedge, target_column;
|
size_t leftedge, target_column;
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
/* If we're not in smooth scrolling mode, put the cursor at the
|
/* 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. */
|
* beginning of the top line of the edit window, as Pico does. */
|
||||||
if (ISSET(JUMPY_SCROLLING)) {
|
if (ISSET(JUMPY_SCROLLING)) {
|
||||||
@@ -153,6 +174,7 @@ void do_page_down(void)
|
|||||||
openfile->current_y = 0;
|
openfile->current_y = 0;
|
||||||
target_column = 0;
|
target_column = 0;
|
||||||
} else
|
} else
|
||||||
|
#endif
|
||||||
get_edge_and_target(&leftedge, &target_column);
|
get_edge_and_target(&leftedge, &target_column);
|
||||||
|
|
||||||
/* Move down the required number of lines or chunks. If we can't, we're
|
/* Move down the required number of lines or chunks. If we can't, we're
|
||||||
@@ -218,6 +240,9 @@ void to_para_end(void)
|
|||||||
openfile->current_x = strlen(openfile->current->data);
|
openfile->current_x = strlen(openfile->current->data);
|
||||||
|
|
||||||
edit_redraw(was_current, CENTERING);
|
edit_redraw(was_current, CENTERING);
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
recook |= perturbed;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_JUSTIFY */
|
#endif /* ENABLE_JUSTIFY */
|
||||||
|
|
||||||
@@ -225,19 +250,29 @@ void to_para_end(void)
|
|||||||
void to_prev_block(void)
|
void to_prev_block(void)
|
||||||
{
|
{
|
||||||
linestruct *was_current = openfile->current;
|
linestruct *was_current = openfile->current;
|
||||||
|
linestruct *line_step = get_prev_visible_line(openfile->current);
|
||||||
bool is_text = FALSE, seen_text = FALSE;
|
bool is_text = FALSE, seen_text = FALSE;
|
||||||
|
|
||||||
/* Skip backward until first blank line after some nonblank line(s). */
|
/* Skip backward until first blank line after some nonblank line(s). */
|
||||||
while (openfile->current->prev != NULL && (!seen_text || is_text)) {
|
while (line_step != NULL && (!seen_text || is_text)) {
|
||||||
openfile->current = openfile->current->prev;
|
openfile->current = line_step;
|
||||||
|
line_step = get_prev_visible_line(line_step);
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
/* Skip over the visibly drawn line of the folded segment */
|
||||||
|
if (openfile->current->folded)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
is_text = !white_string(openfile->current->data);
|
is_text = !white_string(openfile->current->data);
|
||||||
seen_text = seen_text || is_text;
|
seen_text = seen_text || is_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Step forward one line again if we passed text but this line is blank. */
|
/* Step forward one line again if we passed text but this line is blank. */
|
||||||
if (seen_text && openfile->current->next != NULL &&
|
line_step = get_next_visible_line(openfile->current);
|
||||||
white_string(openfile->current->data))
|
if (seen_text && line_step != NULL &&
|
||||||
openfile->current = openfile->current->next;
|
white_string(openfile->current->data)) {
|
||||||
|
openfile->current = line_step;
|
||||||
|
line_step = get_next_visible_line(line_step);
|
||||||
|
}
|
||||||
|
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
edit_redraw(was_current, CENTERING);
|
edit_redraw(was_current, CENTERING);
|
||||||
@@ -247,33 +282,59 @@ void to_prev_block(void)
|
|||||||
void to_next_block(void)
|
void to_next_block(void)
|
||||||
{
|
{
|
||||||
linestruct *was_current = openfile->current;
|
linestruct *was_current = openfile->current;
|
||||||
|
linestruct *line_step = get_next_visible_line(openfile->current);
|
||||||
bool is_white = white_string(openfile->current->data);
|
bool is_white = white_string(openfile->current->data);
|
||||||
bool seen_white = is_white;
|
bool seen_white = is_white;
|
||||||
|
|
||||||
/* Skip forward until first nonblank line after some blank line(s). */
|
/* Skip forward until first nonblank line after some blank line(s). */
|
||||||
while (openfile->current->next != NULL && (!seen_white || is_white)) {
|
while (line_step != NULL && (!seen_white || is_white)) {
|
||||||
openfile->current = openfile->current->next;
|
openfile->current = line_step;
|
||||||
|
line_step = get_next_visible_line(line_step);
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
/* Skip over the visibly drawn line of the folded segment */
|
||||||
|
if (openfile->current->folded)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
is_white = white_string(openfile->current->data);
|
is_white = white_string(openfile->current->data);
|
||||||
seen_white = seen_white || is_white;
|
seen_white = seen_white || is_white;
|
||||||
}
|
}
|
||||||
|
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
edit_redraw(was_current, CENTERING);
|
edit_redraw(was_current, CENTERING);
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
recook |= perturbed;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move to the previous word. If allow_punct is TRUE, treat punctuation
|
/* Move to the previous word.
|
||||||
* as part of a word. */
|
* when allow_folded is true, will move to previous word even if inside
|
||||||
void do_prev_word(bool allow_punct)
|
* a folded segment */
|
||||||
|
void do_prev_word(bool allow_folded)
|
||||||
{
|
{
|
||||||
|
bool punctuation_as_letters = ISSET(WORD_BOUNDS);
|
||||||
bool seen_a_word = FALSE, step_forward = FALSE;
|
bool seen_a_word = FALSE, step_forward = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
if (!allow_folded && openfile->current->folded) {
|
||||||
|
openfile->current = get_prev_visible_line(openfile->current);
|
||||||
|
openfile->current_x = strlen(openfile->current->data);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* Move backward until we pass over the start of a word. */
|
/* Move backward until we pass over the start of a word. */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
/* If at the head of a line, move to the end of the preceding one. */
|
/* If at the head of a line, move to the end of the preceding one. */
|
||||||
if (openfile->current_x == 0) {
|
if (openfile->current_x == 0) {
|
||||||
if (openfile->current->prev == NULL)
|
if (openfile->current->prev == NULL)
|
||||||
break;
|
break;
|
||||||
openfile->current = openfile->current->prev;
|
#ifdef ENABLE_FOLDING
|
||||||
|
if (!allow_folded) {
|
||||||
|
openfile->current = get_prev_visible_line(openfile->current);
|
||||||
|
if (openfile->current->folded)
|
||||||
|
openfile->current = openfile->current->prev;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
openfile->current = openfile->current->prev;
|
||||||
openfile->current_x = strlen(openfile->current->data);
|
openfile->current_x = strlen(openfile->current->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,11 +343,15 @@ void do_prev_word(bool allow_punct)
|
|||||||
openfile->current_x);
|
openfile->current_x);
|
||||||
|
|
||||||
if (is_word_char(openfile->current->data + openfile->current_x,
|
if (is_word_char(openfile->current->data + openfile->current_x,
|
||||||
allow_punct)) {
|
punctuation_as_letters)) {
|
||||||
seen_a_word = TRUE;
|
seen_a_word = TRUE;
|
||||||
/* If at the head of a line now, this surely is a word start. */
|
/* If at the head of a line now, this surely is a word start. */
|
||||||
if (openfile->current_x == 0)
|
if (openfile->current_x == 0)
|
||||||
break;
|
break;
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
} else if (is_zerowidth(openfile->current->data + openfile->current_x)) {
|
||||||
|
; /* skip */
|
||||||
|
#endif
|
||||||
} else if (seen_a_word) {
|
} else if (seen_a_word) {
|
||||||
/* This is space now: we've overshot the start of the word. */
|
/* This is space now: we've overshot the start of the word. */
|
||||||
step_forward = TRUE;
|
step_forward = TRUE;
|
||||||
@@ -298,20 +363,28 @@ void do_prev_word(bool allow_punct)
|
|||||||
/* Move one character forward again to sit on the start of the word. */
|
/* Move one character forward again to sit on the start of the word. */
|
||||||
openfile->current_x = step_right(openfile->current->data,
|
openfile->current_x = step_right(openfile->current->data,
|
||||||
openfile->current_x);
|
openfile->current_x);
|
||||||
|
UNFOLD_SEGMENT(openfile->current);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move to the next word. If after_ends is TRUE, stop at the ends of words
|
/* Move to the next word. If after_ends is TRUE, stop at the ends of words
|
||||||
* instead of their beginnings. If allow_punct is TRUE, treat punctuation as
|
* instead of at their beginnings. If allow_folded is true, go to next word
|
||||||
* part of a word. Return TRUE if we started on a word, and FALSE otherwise. */
|
* even if it's inside a folded segment. Return TRUE if we started on a word. */
|
||||||
bool do_next_word(bool after_ends, bool allow_punct)
|
bool do_next_word(bool after_ends, bool allow_folded)
|
||||||
{
|
{
|
||||||
|
bool punctuation_as_letters = ISSET(WORD_BOUNDS);
|
||||||
bool started_on_word = is_word_char(openfile->current->data +
|
bool started_on_word = is_word_char(openfile->current->data +
|
||||||
openfile->current_x, allow_punct);
|
openfile->current_x, punctuation_as_letters);
|
||||||
bool seen_space = !started_on_word;
|
bool seen_space = !started_on_word;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
bool seen_word = started_on_word;
|
bool seen_word = started_on_word;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
if (!allow_folded && openfile->current->folded) {
|
||||||
|
openfile->current = get_next_visible_line(openfile->current);
|
||||||
|
openfile->current_x = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* Move forward until we reach the start of a word. */
|
/* Move forward until we reach the start of a word. */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
/* If at the end of a line, move to the beginning of the next one. */
|
/* If at the end of a line, move to the beginning of the next one. */
|
||||||
@@ -319,7 +392,18 @@ bool do_next_word(bool after_ends, bool allow_punct)
|
|||||||
/* When at end of file, stop. */
|
/* When at end of file, stop. */
|
||||||
if (openfile->current->next == NULL)
|
if (openfile->current->next == NULL)
|
||||||
break;
|
break;
|
||||||
openfile->current = openfile->current->next;
|
#ifdef ENABLE_FOLDING
|
||||||
|
if (!allow_folded) {
|
||||||
|
openfile->current = get_next_visible_line(openfile->current);
|
||||||
|
if (openfile->current->folded) {
|
||||||
|
/* get_next_visible_line() gives the start of a folded segment,
|
||||||
|
* so skip to the end */
|
||||||
|
openfile->current = get_end_of_folded_segment(openfile->current);
|
||||||
|
openfile->current = openfile->current->next;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
openfile->current = openfile->current->next;
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
seen_space = TRUE;
|
seen_space = TRUE;
|
||||||
} else {
|
} else {
|
||||||
@@ -333,45 +417,54 @@ bool do_next_word(bool after_ends, bool allow_punct)
|
|||||||
/* If this is a word character, continue; else it's a separator,
|
/* If this is a word character, continue; else it's a separator,
|
||||||
* and if we've already seen a word, then it's a word end. */
|
* and if we've already seen a word, then it's a word end. */
|
||||||
if (is_word_char(openfile->current->data + openfile->current_x,
|
if (is_word_char(openfile->current->data + openfile->current_x,
|
||||||
allow_punct))
|
punctuation_as_letters))
|
||||||
seen_word = TRUE;
|
seen_word = TRUE;
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
else if (is_zerowidth(openfile->current->data + openfile->current_x))
|
||||||
|
; /* skip */
|
||||||
|
#endif
|
||||||
else if (seen_word)
|
else if (seen_word)
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
if (is_zerowidth(openfile->current->data + openfile->current_x))
|
||||||
|
; /* skip */
|
||||||
|
else
|
||||||
|
#endif
|
||||||
/* If this is not a word character, then it's a separator; else
|
/* If this is not a word character, then it's a separator; else
|
||||||
* if we've already seen a separator, then it's a word start. */
|
* if we've already seen a separator, then it's a word start. */
|
||||||
if (!is_word_char(openfile->current->data + openfile->current_x,
|
if (!is_word_char(openfile->current->data + openfile->current_x,
|
||||||
allow_punct))
|
punctuation_as_letters))
|
||||||
seen_space = TRUE;
|
seen_space = TRUE;
|
||||||
else if (seen_space)
|
else if (seen_space)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UNFOLD_SEGMENT(openfile->current);
|
||||||
|
|
||||||
return started_on_word;
|
return started_on_word;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move to the previous word in the file, treating punctuation as part of a
|
/* Move to the previous word in the file, and update the screen afterwards. */
|
||||||
* word if the WORD_BOUNDS flag is set, and update the screen afterwards. */
|
|
||||||
void to_prev_word(void)
|
void to_prev_word(void)
|
||||||
{
|
{
|
||||||
linestruct *was_current = openfile->current;
|
linestruct *was_current = openfile->current;
|
||||||
|
|
||||||
do_prev_word(ISSET(WORD_BOUNDS));
|
do_prev_word(DISALLOW_FOLDED);
|
||||||
|
|
||||||
edit_redraw(was_current, FLOWING);
|
edit_redraw(was_current, FLOWING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move to the next word in the file. If the AFTER_ENDS flag is set, stop
|
/* Move to the next word in the file. If the AFTER_ENDS flag is set, stop
|
||||||
* at word ends instead of beginnings. If the WORD_BOUNDS flag is set, treat
|
* at word ends instead of beginnings. Update the screen afterwards. */
|
||||||
* punctuation as part of a word. Update the screen afterwards. */
|
|
||||||
void to_next_word(void)
|
void to_next_word(void)
|
||||||
{
|
{
|
||||||
linestruct *was_current = openfile->current;
|
linestruct *was_current = openfile->current;
|
||||||
|
|
||||||
do_next_word(ISSET(AFTER_ENDS), ISSET(WORD_BOUNDS));
|
do_next_word(ISSET(AFTER_ENDS), DISALLOW_FOLDED);
|
||||||
|
|
||||||
edit_redraw(was_current, FLOWING);
|
edit_redraw(was_current, FLOWING);
|
||||||
}
|
}
|
||||||
@@ -386,12 +479,17 @@ void do_home(void)
|
|||||||
bool moved_off_chunk = TRUE;
|
bool moved_off_chunk = TRUE;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
bool moved = FALSE;
|
bool moved = FALSE;
|
||||||
size_t leftedge = 0, leftedge_x = 0;
|
size_t leftedge = 0;
|
||||||
|
size_t left_x = 0;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
if (openfile->current->folded)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ISSET(SOFTWRAP)) {
|
if (ISSET(SOFTWRAP)) {
|
||||||
leftedge = leftedge_for(was_column, openfile->current);
|
leftedge = leftedge_for(was_column, openfile->current);
|
||||||
leftedge_x = proper_x(openfile->current, &leftedge, FALSE, leftedge,
|
left_x = proper_x(openfile->current, &leftedge, FALSE, leftedge, NULL);
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISSET(SMART_HOME)) {
|
if (ISSET(SMART_HOME)) {
|
||||||
@@ -404,7 +502,7 @@ void do_home(void)
|
|||||||
if (openfile->current_x == indent_x) {
|
if (openfile->current_x == indent_x) {
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
moved = TRUE;
|
moved = TRUE;
|
||||||
} else if (!ISSET(SOFTWRAP) || leftedge_x <= indent_x) {
|
} else if (left_x <= indent_x) {
|
||||||
openfile->current_x = indent_x;
|
openfile->current_x = indent_x;
|
||||||
moved = TRUE;
|
moved = TRUE;
|
||||||
}
|
}
|
||||||
@@ -414,10 +512,10 @@ void do_home(void)
|
|||||||
if (!moved && ISSET(SOFTWRAP)) {
|
if (!moved && ISSET(SOFTWRAP)) {
|
||||||
/* If already at the left edge of the screen, move fully home.
|
/* If already at the left edge of the screen, move fully home.
|
||||||
* Otherwise, move to the left edge. */
|
* Otherwise, move to the left edge. */
|
||||||
if (openfile->current_x == leftedge_x)
|
if (openfile->current_x == left_x)
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
else {
|
else {
|
||||||
openfile->current_x = leftedge_x;
|
openfile->current_x = left_x;
|
||||||
openfile->placewewant = leftedge;
|
openfile->placewewant = leftedge;
|
||||||
moved_off_chunk = FALSE;
|
moved_off_chunk = FALSE;
|
||||||
}
|
}
|
||||||
@@ -446,13 +544,19 @@ void do_end(void)
|
|||||||
size_t line_len = strlen(openfile->current->data);
|
size_t line_len = strlen(openfile->current->data);
|
||||||
bool moved_off_chunk = TRUE;
|
bool moved_off_chunk = TRUE;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
if (openfile->current->folded)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (ISSET(SOFTWRAP)) {
|
if (ISSET(SOFTWRAP)) {
|
||||||
|
bool kickoff = TRUE;
|
||||||
bool last_chunk = FALSE;
|
bool last_chunk = FALSE;
|
||||||
size_t leftedge = leftedge_for(was_column, openfile->current);
|
size_t leftedge = leftedge_for(was_column, openfile->current);
|
||||||
size_t rightedge = get_softwrap_breakpoint(openfile->current->data,
|
size_t rightedge = get_softwrap_breakpoint(openfile->current->data,
|
||||||
leftedge, &last_chunk);
|
leftedge, &kickoff, &last_chunk);
|
||||||
size_t rightedge_x;
|
size_t right_x;
|
||||||
|
|
||||||
/* If we're on the last chunk, we're already at the end of the line.
|
/* If we're on the last chunk, we're already at the end of the line.
|
||||||
* Otherwise, we're one column past the end of the line. Shifting
|
* Otherwise, we're one column past the end of the line. Shifting
|
||||||
@@ -461,14 +565,14 @@ void do_end(void)
|
|||||||
if (!last_chunk)
|
if (!last_chunk)
|
||||||
rightedge--;
|
rightedge--;
|
||||||
|
|
||||||
rightedge_x = actual_x(openfile->current->data, rightedge);
|
right_x = actual_x(openfile->current->data, rightedge);
|
||||||
|
|
||||||
/* If already at the right edge of the screen, move fully to
|
/* If already at the right edge of the screen, move fully to
|
||||||
* the end of the line. Otherwise, move to the right edge. */
|
* the end of the line. Otherwise, move to the right edge. */
|
||||||
if (openfile->current_x == rightedge_x)
|
if (openfile->current_x == right_x)
|
||||||
openfile->current_x = line_len;
|
openfile->current_x = line_len;
|
||||||
else {
|
else {
|
||||||
openfile->current_x = rightedge_x;
|
openfile->current_x = right_x;
|
||||||
openfile->placewewant = rightedge;
|
openfile->placewewant = rightedge;
|
||||||
moved_off_chunk = FALSE;
|
moved_off_chunk = FALSE;
|
||||||
}
|
}
|
||||||
@@ -577,11 +681,17 @@ void do_left(void)
|
|||||||
{
|
{
|
||||||
linestruct *was_current = openfile->current;
|
linestruct *was_current = openfile->current;
|
||||||
|
|
||||||
if (openfile->current_x > 0)
|
if (openfile->current_x > 0) {
|
||||||
openfile->current_x = step_left(openfile->current->data,
|
openfile->current_x = step_left(openfile->current->data,
|
||||||
openfile->current_x);
|
openfile->current_x);
|
||||||
else if (openfile->current != openfile->filetop) {
|
#ifdef ENABLE_UTF8
|
||||||
openfile->current = openfile->current->prev;
|
while (openfile->current_x > 0 &&
|
||||||
|
is_zerowidth(openfile->current->data + openfile->current_x))
|
||||||
|
openfile->current_x = step_left(openfile->current->data,
|
||||||
|
openfile->current_x);
|
||||||
|
#endif
|
||||||
|
} else if (openfile->current != openfile->filetop) {
|
||||||
|
openfile->current = get_prev_visible_line(openfile->current);
|
||||||
openfile->current_x = strlen(openfile->current->data);
|
openfile->current_x = strlen(openfile->current->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,11 +703,24 @@ void do_right(void)
|
|||||||
{
|
{
|
||||||
linestruct *was_current = openfile->current;
|
linestruct *was_current = openfile->current;
|
||||||
|
|
||||||
if (openfile->current->data[openfile->current_x] != '\0')
|
#ifdef ENABLE_FOLDING
|
||||||
|
if (openfile->current->folded) {
|
||||||
|
openfile->current = get_next_visible_line(openfile->current);
|
||||||
|
if (openfile->current == NULL)
|
||||||
|
openfile->current = was_current;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
if (openfile->current->data[openfile->current_x] != '\0') {
|
||||||
openfile->current_x = step_right(openfile->current->data,
|
openfile->current_x = step_right(openfile->current->data,
|
||||||
openfile->current_x);
|
openfile->current_x);
|
||||||
else if (openfile->current != openfile->filebot) {
|
#ifdef ENABLE_UTF8
|
||||||
openfile->current = openfile->current->next;
|
while (openfile->current->data[openfile->current_x] != '\0' &&
|
||||||
|
is_zerowidth(openfile->current->data + openfile->current_x))
|
||||||
|
openfile->current_x = step_right(openfile->current->data,
|
||||||
|
openfile->current_x);
|
||||||
|
#endif
|
||||||
|
} else if (openfile->current != openfile->filebot) {
|
||||||
|
openfile->current = get_next_visible_line(openfile->current);
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
859
src/nano.c
859
src/nano.c
File diff suppressed because it is too large
Load Diff
624
src/prompt.c
624
src/prompt.c
@@ -1,8 +1,8 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* prompt.c -- This file is part of GNU nano. *
|
* prompt.c -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 1999-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* Copyright (C) 2016, 2018 Benno Schulenberg *
|
* Copyright (C) 2016, 2018, 2020, 2022 Benno Schulenberg *
|
||||||
* *
|
* *
|
||||||
* GNU nano is free software: you can redistribute it and/or modify *
|
* GNU nano is free software: you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published *
|
* it under the terms of the GNU General Public License as published *
|
||||||
@@ -41,6 +41,33 @@ void do_statusbar_end(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
/* Move to the previous word in the answer. */
|
||||||
|
void do_statusbar_prev_word(void)
|
||||||
|
{
|
||||||
|
bool seen_a_word = FALSE, step_forward = FALSE;
|
||||||
|
|
||||||
|
/* Move backward until we pass over the start of a word. */
|
||||||
|
while (typing_x != 0) {
|
||||||
|
typing_x = step_left(answer, typing_x);
|
||||||
|
|
||||||
|
if (is_word_char(answer + typing_x, FALSE))
|
||||||
|
seen_a_word = TRUE;
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
else if (is_zerowidth(answer + typing_x))
|
||||||
|
; /* skip */
|
||||||
|
#endif
|
||||||
|
else if (seen_a_word) {
|
||||||
|
/* This is space now: we've overshot the start of the word. */
|
||||||
|
step_forward = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step_forward)
|
||||||
|
/* Move one character forward again to sit on the start of the word. */
|
||||||
|
typing_x = step_right(answer, typing_x);
|
||||||
|
}
|
||||||
|
|
||||||
/* Move to the next word in the answer. */
|
/* Move to the next word in the answer. */
|
||||||
void do_statusbar_next_word(void)
|
void do_statusbar_next_word(void)
|
||||||
{
|
{
|
||||||
@@ -57,9 +84,18 @@ void do_statusbar_next_word(void)
|
|||||||
* and if we've already seen a word, then it's a word end. */
|
* and if we've already seen a word, then it's a word end. */
|
||||||
if (is_word_char(answer + typing_x, FALSE))
|
if (is_word_char(answer + typing_x, FALSE))
|
||||||
seen_word = TRUE;
|
seen_word = TRUE;
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
else if (is_zerowidth(answer + typing_x))
|
||||||
|
; /* skip */
|
||||||
|
#endif
|
||||||
else if (seen_word)
|
else if (seen_word)
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
if (is_zerowidth(answer + typing_x))
|
||||||
|
; /* skip */
|
||||||
|
else
|
||||||
|
#endif
|
||||||
/* If this is not a word character, then it's a separator; else
|
/* If this is not a word character, then it's a separator; else
|
||||||
* if we've already seen a separator, then it's a word start. */
|
* if we've already seen a separator, then it's a word start. */
|
||||||
if (!is_word_char(answer + typing_x, FALSE))
|
if (!is_word_char(answer + typing_x, FALSE))
|
||||||
@@ -69,43 +105,41 @@ void do_statusbar_next_word(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move to the previous word in the answer. */
|
|
||||||
void do_statusbar_prev_word(void)
|
|
||||||
{
|
|
||||||
bool seen_a_word = FALSE, step_forward = FALSE;
|
|
||||||
|
|
||||||
/* Move backward until we pass over the start of a word. */
|
|
||||||
while (typing_x != 0) {
|
|
||||||
typing_x = step_left(answer, typing_x);
|
|
||||||
|
|
||||||
if (is_word_char(answer + typing_x, FALSE))
|
|
||||||
seen_a_word = TRUE;
|
|
||||||
else if (seen_a_word) {
|
|
||||||
/* This is space now: we've overshot the start of the word. */
|
|
||||||
step_forward = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (step_forward)
|
|
||||||
/* Move one character forward again to sit on the start of the word. */
|
|
||||||
typing_x = step_right(answer, typing_x);
|
|
||||||
}
|
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
/* Move left one character in the answer. */
|
/* Move left one character in the answer. */
|
||||||
void do_statusbar_left(void)
|
void do_statusbar_left(void)
|
||||||
{
|
{
|
||||||
if (typing_x > 0)
|
if (typing_x > 0) {
|
||||||
typing_x = step_left(answer, typing_x);
|
typing_x = step_left(answer, typing_x);
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
while (typing_x > 0 && is_zerowidth(answer + typing_x))
|
||||||
|
typing_x = step_left(answer, typing_x);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move right one character in the answer. */
|
/* Move right one character in the answer. */
|
||||||
void do_statusbar_right(void)
|
void do_statusbar_right(void)
|
||||||
{
|
{
|
||||||
if (answer[typing_x] != '\0')
|
if (answer[typing_x] != '\0') {
|
||||||
typing_x = step_right(answer, typing_x);
|
typing_x = step_right(answer, typing_x);
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
while (answer[typing_x] != '\0' && is_zerowidth(answer + typing_x))
|
||||||
|
typing_x = step_right(answer, typing_x);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Backspace over one character in the answer. */
|
||||||
|
void do_statusbar_backspace(void)
|
||||||
|
{
|
||||||
|
if (typing_x > 0) {
|
||||||
|
size_t was_x = typing_x;
|
||||||
|
|
||||||
|
typing_x = step_left(answer, typing_x);
|
||||||
|
memmove(answer + typing_x, answer + was_x, strlen(answer) - was_x + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete one character in the answer. */
|
/* Delete one character in the answer. */
|
||||||
@@ -116,43 +150,47 @@ void do_statusbar_delete(void)
|
|||||||
|
|
||||||
memmove(answer + typing_x, answer + typing_x + charlen,
|
memmove(answer + typing_x, answer + typing_x + charlen,
|
||||||
strlen(answer) - typing_x - charlen + 1);
|
strlen(answer) - typing_x - charlen + 1);
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
if (is_zerowidth(answer + typing_x))
|
||||||
|
do_statusbar_delete();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Backspace over one character in the answer. */
|
/* Zap the part of the answer after the cursor, or the whole answer. */
|
||||||
void do_statusbar_backspace(void)
|
void lop_the_answer(void)
|
||||||
{
|
{
|
||||||
if (typing_x > 0) {
|
if (answer[typing_x] == '\0')
|
||||||
typing_x = step_left(answer, typing_x);
|
|
||||||
do_statusbar_delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Zap some or all text from the answer. */
|
|
||||||
void do_statusbar_cut_text(void)
|
|
||||||
{
|
|
||||||
if (!ISSET(CUT_FROM_CURSOR))
|
|
||||||
typing_x = 0;
|
typing_x = 0;
|
||||||
|
|
||||||
answer[typing_x] = '\0';
|
answer[typing_x] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
/* Copy the current answer (if any) into the cutbuffer. */
|
||||||
|
void copy_the_answer(void)
|
||||||
|
{
|
||||||
|
if (*answer) {
|
||||||
|
free_lines(cutbuffer);
|
||||||
|
cutbuffer = make_new_node(NULL);
|
||||||
|
cutbuffer->data = copy_of(answer);
|
||||||
|
typing_x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Paste the first line of the cutbuffer into the current answer. */
|
/* Paste the first line of the cutbuffer into the current answer. */
|
||||||
void paste_into_answer(void)
|
void paste_into_answer(void)
|
||||||
{
|
{
|
||||||
size_t pastelen = strlen(cutbuffer->data);
|
size_t pastelen = strlen(cutbuffer->data);
|
||||||
char *fusion = charalloc(strlen(answer) + pastelen + 1);
|
|
||||||
|
|
||||||
/* Concatenate: the current answer before the cursor, the first line
|
answer = nrealloc(answer, strlen(answer) + pastelen + 1);
|
||||||
* of the cutbuffer, plus the rest of the current answer. */
|
memmove(answer + typing_x + pastelen, answer + typing_x,
|
||||||
strncpy(fusion, answer, typing_x);
|
strlen(answer) - typing_x + 1);
|
||||||
strncpy(fusion + typing_x, cutbuffer->data, pastelen);
|
strncpy(answer + typing_x, cutbuffer->data, pastelen);
|
||||||
strcpy(fusion + typing_x + pastelen, answer + typing_x);
|
|
||||||
|
|
||||||
free(answer);
|
|
||||||
answer = fusion;
|
|
||||||
typing_x += pastelen;
|
typing_x += pastelen;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_MOUSE
|
#ifdef ENABLE_MOUSE
|
||||||
/* Handle a mouse click on the status-bar prompt or the shortcut list. */
|
/* Handle a mouse click on the status-bar prompt or the shortcut list. */
|
||||||
@@ -162,7 +200,7 @@ int do_statusbar_mouse(void)
|
|||||||
int retval = get_mouseinput(&click_row, &click_col, TRUE);
|
int retval = get_mouseinput(&click_row, &click_col, TRUE);
|
||||||
|
|
||||||
/* We can click on the status-bar window text to move the cursor. */
|
/* We can click on the status-bar window text to move the cursor. */
|
||||||
if (retval == 0 && wmouse_trafo(bottomwin, &click_row, &click_col, FALSE)) {
|
if (retval == 0 && wmouse_trafo(footwin, &click_row, &click_col, FALSE)) {
|
||||||
size_t start_col = breadth(prompt) + 2;
|
size_t start_col = breadth(prompt) + 2;
|
||||||
|
|
||||||
/* Move to where the click occurred. */
|
/* Move to where the click occurred. */
|
||||||
@@ -184,10 +222,10 @@ void inject_into_answer(char *burst, size_t count)
|
|||||||
if (burst[index] == '\0')
|
if (burst[index] == '\0')
|
||||||
burst[index] = '\n';
|
burst[index] = '\n';
|
||||||
|
|
||||||
answer = charealloc(answer, strlen(answer) + count + 1);
|
answer = nrealloc(answer, strlen(answer) + count + 1);
|
||||||
memmove(answer + typing_x + count, answer + typing_x,
|
memmove(answer + typing_x + count, answer + typing_x,
|
||||||
strlen(answer) - typing_x + 1);
|
strlen(answer) - typing_x + 1);
|
||||||
strncpy(answer + typing_x, burst , count);
|
strncpy(answer + typing_x, burst, count);
|
||||||
|
|
||||||
typing_x += count;
|
typing_x += count;
|
||||||
}
|
}
|
||||||
@@ -198,7 +236,7 @@ void do_statusbar_verbatim_input(void)
|
|||||||
size_t count = 1;
|
size_t count = 1;
|
||||||
char *bytes;
|
char *bytes;
|
||||||
|
|
||||||
bytes = get_verbatim_kbinput(bottomwin, &count);
|
bytes = get_verbatim_kbinput(footwin, &count);
|
||||||
|
|
||||||
if (0 < count && count < 999)
|
if (0 < count && count < 999)
|
||||||
inject_into_answer(bytes, count);
|
inject_into_answer(bytes, count);
|
||||||
@@ -208,127 +246,92 @@ void do_statusbar_verbatim_input(void)
|
|||||||
free(bytes);
|
free(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read in a keystroke, interpret it if it is a shortcut or toggle, and
|
/* Add the given input to the input buffer when it's a normal byte,
|
||||||
* return it. Set finished to TRUE if we're done after running
|
* and inject the gathered bytes into the answer when ready. */
|
||||||
* or trying to run a function associated with a shortcut key. */
|
void absorb_character(int input, functionptrtype function)
|
||||||
int do_statusbar_input(bool *finished)
|
|
||||||
{
|
{
|
||||||
int input;
|
|
||||||
/* The character we read in. */
|
|
||||||
static char *puddle = NULL;
|
static char *puddle = NULL;
|
||||||
/* The input buffer. */
|
/* The input buffer. */
|
||||||
|
static size_t capacity = 8;
|
||||||
|
/* The size of the input buffer; gets doubled whenever needed. */
|
||||||
static size_t depth = 0;
|
static size_t depth = 0;
|
||||||
/* The length of the input buffer. */
|
/* The length of the input buffer. */
|
||||||
const keystruct *shortcut;
|
|
||||||
|
|
||||||
*finished = FALSE;
|
|
||||||
|
|
||||||
/* Read in a character. */
|
|
||||||
input = get_kbinput(bottomwin, VISIBLE);
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
if (input == KEY_WINCH)
|
|
||||||
return KEY_WINCH;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_MOUSE
|
|
||||||
/* If we got a mouse click and it was on a shortcut, read in the
|
|
||||||
* shortcut character. */
|
|
||||||
if (input == KEY_MOUSE) {
|
|
||||||
if (do_statusbar_mouse() == 1)
|
|
||||||
input = get_kbinput(bottomwin, BLIND);
|
|
||||||
else
|
|
||||||
return ERR;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Check for a shortcut in the current list. */
|
|
||||||
shortcut = get_shortcut(&input);
|
|
||||||
|
|
||||||
/* If not a command, discard anything that is not a normal character byte.
|
/* If not a command, discard anything that is not a normal character byte.
|
||||||
* Apart from that, only accept input when not in restricted mode, or when
|
* Apart from that, only accept input when not in restricted mode, or when
|
||||||
* not at the "Write File" prompt, or when there is no filename yet. */
|
* not at the "Write File" prompt, or when there is no filename yet. */
|
||||||
if (shortcut == NULL) {
|
if (!function) {
|
||||||
if (input < 0x20 || input > 0xFF || meta_key)
|
if (input < 0x20 || input > 0xFF || meta_key)
|
||||||
beep();
|
beep();
|
||||||
else if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
|
else if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
|
||||||
openfile->filename[0] == '\0') {
|
openfile->filename[0] == '\0') {
|
||||||
puddle = charealloc(puddle, depth + 2);
|
/* When the input buffer (plus room for terminating NUL) is full,
|
||||||
|
* extend it; otherwise, if it does not exist yet, create it. */
|
||||||
|
if (depth + 1 == capacity) {
|
||||||
|
capacity = 2 * capacity;
|
||||||
|
puddle = nrealloc(puddle, capacity);
|
||||||
|
} else if (!puddle)
|
||||||
|
puddle = nmalloc(capacity);
|
||||||
|
|
||||||
puddle[depth++] = (char)input;
|
puddle[depth++] = (char)input;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we got a shortcut, or if there aren't any other keystrokes waiting,
|
/* If there are gathered bytes and we have a command or no other key codes
|
||||||
* it's time to insert all characters in the input buffer (if not empty)
|
* are waiting, it's time to insert these bytes into the answer. */
|
||||||
* into the answer, and then clear the input buffer. */
|
if (depth > 0 && (function || waiting_keycodes() == 0)) {
|
||||||
if ((shortcut || get_key_buffer_len() == 0) && puddle != NULL) {
|
|
||||||
puddle[depth] = '\0';
|
puddle[depth] = '\0';
|
||||||
|
|
||||||
inject_into_answer(puddle, depth);
|
inject_into_answer(puddle, depth);
|
||||||
|
|
||||||
free(puddle);
|
|
||||||
puddle = NULL;
|
|
||||||
depth = 0;
|
depth = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (shortcut) {
|
/* Handle any editing shortcut, and return TRUE when handled. */
|
||||||
if (shortcut->func == do_tab || shortcut->func == do_enter)
|
bool handle_editing(functionptrtype function)
|
||||||
;
|
{
|
||||||
#ifdef ENABLE_HISTORIES
|
if (function == do_left)
|
||||||
else if (shortcut->func == get_history_older_void ||
|
do_statusbar_left();
|
||||||
shortcut->func == get_history_newer_void)
|
else if (function == do_right)
|
||||||
;
|
do_statusbar_right();
|
||||||
#endif
|
|
||||||
else if (shortcut->func == do_left)
|
|
||||||
do_statusbar_left();
|
|
||||||
else if (shortcut->func == do_right)
|
|
||||||
do_statusbar_right();
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (shortcut->func == to_prev_word)
|
else if (function == to_prev_word)
|
||||||
do_statusbar_prev_word();
|
do_statusbar_prev_word();
|
||||||
else if (shortcut->func == to_next_word)
|
else if (function == to_next_word)
|
||||||
do_statusbar_next_word();
|
do_statusbar_next_word();
|
||||||
#endif
|
#endif
|
||||||
else if (shortcut->func == do_home)
|
else if (function == do_home)
|
||||||
do_statusbar_home();
|
do_statusbar_home();
|
||||||
else if (shortcut->func == do_end)
|
else if (function == do_end)
|
||||||
do_statusbar_end();
|
do_statusbar_end();
|
||||||
/* When in restricted mode at the "Write File" prompt and the
|
/* When in restricted mode at the "Write File" prompt and the
|
||||||
* filename isn't blank, disallow any input and deletion. */
|
* filename isn't blank, disallow any input and deletion. */
|
||||||
else if (ISSET(RESTRICTED) && currmenu == MWRITEFILE &&
|
else if (ISSET(RESTRICTED) && currmenu == MWRITEFILE &&
|
||||||
openfile->filename[0] != '\0' &&
|
openfile->filename[0] != '\0' &&
|
||||||
(shortcut->func == do_verbatim_input ||
|
(function == do_verbatim_input ||
|
||||||
shortcut->func == cut_text ||
|
function == do_delete || function == do_backspace ||
|
||||||
shortcut->func == paste_text ||
|
function == cut_text || function == paste_text))
|
||||||
shortcut->func == do_delete ||
|
;
|
||||||
shortcut->func == do_backspace))
|
else if (function == do_verbatim_input)
|
||||||
;
|
do_statusbar_verbatim_input();
|
||||||
#ifdef ENABLE_NANORC
|
else if (function == do_delete)
|
||||||
else if (shortcut->func == (functionptrtype)implant)
|
do_statusbar_delete();
|
||||||
implant(shortcut->expansion);
|
else if (function == do_backspace)
|
||||||
#endif
|
do_statusbar_backspace();
|
||||||
else if (shortcut->func == do_verbatim_input)
|
else if (function == cut_text)
|
||||||
do_statusbar_verbatim_input();
|
lop_the_answer();
|
||||||
else if (shortcut->func == cut_text)
|
#ifndef NANO_TINY
|
||||||
do_statusbar_cut_text();
|
else if (function == copy_text)
|
||||||
else if (shortcut->func == do_delete)
|
copy_the_answer();
|
||||||
do_statusbar_delete();
|
else if (function == paste_text) {
|
||||||
else if (shortcut->func == do_backspace)
|
if (cutbuffer != NULL)
|
||||||
do_statusbar_backspace();
|
paste_into_answer();
|
||||||
else if (shortcut->func == paste_text) {
|
|
||||||
if (cutbuffer != NULL)
|
|
||||||
paste_into_answer();
|
|
||||||
} else {
|
|
||||||
/* Handle any other shortcut in the current menu, setting finished
|
|
||||||
* to TRUE to indicate that we're done after running or trying to
|
|
||||||
* run its associated function. */
|
|
||||||
if (!ISSET(VIEW_MODE) || okay_for_view(shortcut))
|
|
||||||
shortcut->func();
|
|
||||||
*finished = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
return input;
|
/* Don't handle any handled function again. */
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the column number of the first character of the answer that is
|
/* Return the column number of the first character of the answer that is
|
||||||
@@ -351,41 +354,45 @@ void put_cursor_at_end_of_answer(void)
|
|||||||
typing_x = HIGHEST_POSITIVE;
|
typing_x = HIGHEST_POSITIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Redraw the promptbar and place the cursor at the right spot. */
|
/* Redraw the prompt bar and place the cursor at the right spot. */
|
||||||
void draw_the_promptbar(void)
|
void draw_the_promptbar(void)
|
||||||
{
|
{
|
||||||
size_t base = breadth(prompt) + 2;
|
size_t base = breadth(prompt) + 2;
|
||||||
size_t the_page, end_page, column;
|
size_t column = base + wideness(answer, typing_x);
|
||||||
|
size_t the_page, end_page;
|
||||||
char *expanded;
|
char *expanded;
|
||||||
|
|
||||||
the_page = get_statusbar_page_start(base, base + wideness(answer, typing_x));
|
the_page = get_statusbar_page_start(base, column);
|
||||||
end_page = get_statusbar_page_start(base, base + breadth(answer) - 1);
|
end_page = get_statusbar_page_start(base, base + breadth(answer) - 1);
|
||||||
|
|
||||||
/* Color the promptbar over its full width. */
|
/* Color the prompt bar over its full width. */
|
||||||
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
|
wattron(footwin, interface_color_pair[PROMPT_BAR]);
|
||||||
mvwprintw(bottomwin, 0, 0, "%*s", COLS, " ");
|
mvwprintw(footwin, 0, 0, "%*s", COLS, " ");
|
||||||
|
|
||||||
mvwaddstr(bottomwin, 0, 0, prompt);
|
mvwaddstr(footwin, 0, 0, prompt);
|
||||||
waddch(bottomwin, ':');
|
waddch(footwin, ':');
|
||||||
waddch(bottomwin, (the_page == 0) ? ' ' : '<');
|
waddch(footwin, (the_page == 0) ? ' ' : '<');
|
||||||
|
|
||||||
expanded = display_string(answer, the_page, COLS - base, FALSE, TRUE);
|
expanded = display_string(answer, the_page, COLS - base, FALSE, TRUE);
|
||||||
waddstr(bottomwin, expanded);
|
waddstr(footwin, expanded);
|
||||||
free(expanded);
|
free(expanded);
|
||||||
|
|
||||||
if (base + breadth(answer) != COLS && the_page < end_page)
|
if (the_page < end_page && base + breadth(answer) - the_page > COLS)
|
||||||
mvwaddch(bottomwin, 0, COLS - 1, '>');
|
mvwaddch(footwin, 0, COLS - 1, '>');
|
||||||
|
|
||||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
|
wattroff(footwin, interface_color_pair[PROMPT_BAR]);
|
||||||
|
|
||||||
/* Work around a cursor-misplacement bug in VTEs. */
|
#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH < 20210220)
|
||||||
wmove(bottomwin, 0, 0);
|
/* Work around a cursor-misplacement bug -- https://sv.gnu.org/bugs/?59808. */
|
||||||
wrefresh(bottomwin);
|
if (ISSET(NO_HELP)) {
|
||||||
|
wmove(footwin, 0, 0);
|
||||||
|
wrefresh(footwin);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Place the cursor at the right spot. */
|
/* Place the cursor at the right spot. */
|
||||||
column = base + wideness(answer, typing_x);
|
wmove(footwin, 0, column - the_page);
|
||||||
wmove(bottomwin, 0, column - get_statusbar_page_start(base, column));
|
wnoutrefresh(footwin);
|
||||||
wnoutrefresh(bottomwin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
@@ -393,11 +400,11 @@ void draw_the_promptbar(void)
|
|||||||
void add_or_remove_pipe_symbol_from_answer(void)
|
void add_or_remove_pipe_symbol_from_answer(void)
|
||||||
{
|
{
|
||||||
if (answer[0] == '|') {
|
if (answer[0] == '|') {
|
||||||
memmove(answer, answer + 1, strlen(answer) + 1);
|
memmove(answer, answer + 1, strlen(answer));
|
||||||
if (typing_x > 0)
|
if (typing_x > 0)
|
||||||
typing_x--;
|
typing_x--;
|
||||||
} else {
|
} else {
|
||||||
answer = charealloc(answer, strlen(answer) + 2);
|
answer = nrealloc(answer, strlen(answer) + 2);
|
||||||
memmove(answer + 1, answer, strlen(answer) + 1);
|
memmove(answer + 1, answer, strlen(answer) + 1);
|
||||||
answer[0] = '|';
|
answer[0] = '|';
|
||||||
typing_x++;
|
typing_x++;
|
||||||
@@ -409,21 +416,19 @@ void add_or_remove_pipe_symbol_from_answer(void)
|
|||||||
functionptrtype acquire_an_answer(int *actual, bool *listed,
|
functionptrtype acquire_an_answer(int *actual, bool *listed,
|
||||||
linestruct **history_list, void (*refresh_func)(void))
|
linestruct **history_list, void (*refresh_func)(void))
|
||||||
{
|
{
|
||||||
int kbinput = ERR;
|
|
||||||
bool finished;
|
|
||||||
functionptrtype func;
|
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
char *history = NULL;
|
char *stored_string = NULL;
|
||||||
/* The current history string. */
|
/* Whatever the answer was before the user foraged into history. */
|
||||||
char *magichistory = NULL;
|
|
||||||
/* The (partial) answer that was typed at the prompt, if any. */
|
|
||||||
#ifdef ENABLE_TABCOMP
|
#ifdef ENABLE_TABCOMP
|
||||||
bool previous_was_tab = FALSE;
|
bool previous_was_tab = FALSE;
|
||||||
/* Whether the previous keystroke was an attempt at tab completion. */
|
/* Whether the previous keystroke was an attempt at tab completion. */
|
||||||
size_t fragment_length = 0;
|
size_t fragment_length = 0;
|
||||||
/* The length of the fragment that the user tries to tab complete. */
|
/* The length of the fragment that the user tries to tab complete. */
|
||||||
#endif
|
#endif
|
||||||
#endif /* ENABLE_HISTORIES */
|
#endif
|
||||||
|
const keystruct *shortcut;
|
||||||
|
functionptrtype function;
|
||||||
|
int input;
|
||||||
|
|
||||||
if (typing_x > strlen(answer))
|
if (typing_x > strlen(answer))
|
||||||
typing_x = strlen(answer);
|
typing_x = strlen(answer);
|
||||||
@@ -431,27 +436,40 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
draw_the_promptbar();
|
draw_the_promptbar();
|
||||||
|
|
||||||
kbinput = do_statusbar_input(&finished);
|
/* Read in one keystroke. */
|
||||||
|
input = get_kbinput(footwin, VISIBLE);
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* If the window size changed, go reformat the prompt string. */
|
/* If the window size changed, go reformat the prompt string. */
|
||||||
if (kbinput == KEY_WINCH) {
|
if (input == KEY_WINCH) {
|
||||||
refresh_func();
|
refresh_func(); /* Only needed when in file browser. */
|
||||||
*actual = KEY_WINCH;
|
*actual = KEY_WINCH;
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
free(magichistory);
|
free(stored_string);
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif
|
||||||
|
#ifdef ENABLE_MOUSE
|
||||||
|
/* For a click on a shortcut, read in the resulting keycode. */
|
||||||
|
if (input == KEY_MOUSE && do_statusbar_mouse() == 1)
|
||||||
|
input = get_kbinput(footwin, BLIND);
|
||||||
|
if (input == KEY_MOUSE)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
func = func_from_key(&kbinput);
|
/* Check for a shortcut in the current list. */
|
||||||
|
shortcut = get_shortcut(input);
|
||||||
|
function = (shortcut ? shortcut->func : NULL);
|
||||||
|
|
||||||
if (func == do_cancel || func == do_enter)
|
/* When it's a normal character, add it to the answer. */
|
||||||
|
absorb_character(input, function);
|
||||||
|
|
||||||
|
if (function == do_cancel || function == do_enter)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_TABCOMP
|
#ifdef ENABLE_TABCOMP
|
||||||
if (func == do_tab) {
|
if (function == do_tab) {
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
if (history_list != NULL) {
|
if (history_list != NULL) {
|
||||||
if (!previous_was_tab)
|
if (!previous_was_tab)
|
||||||
@@ -465,82 +483,82 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
/* Allow tab completion of filenames, but not in restricted mode. */
|
/* Allow tab completion of filenames, but not in restricted mode. */
|
||||||
if ((currmenu == MINSERTFILE || currmenu == MWRITEFILE ||
|
if ((currmenu & (MINSERTFILE|MWRITEFILE|MGOTODIR)) && !ISSET(RESTRICTED))
|
||||||
currmenu == MGOTODIR) && !ISSET(RESTRICTED))
|
|
||||||
answer = input_tab(answer, &typing_x, refresh_func, listed);
|
answer = input_tab(answer, &typing_x, refresh_func, listed);
|
||||||
} else
|
} else
|
||||||
#endif /* ENABLE_TABCOMP */
|
#endif
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
if (func == get_history_older_void) {
|
if (function == get_older_item && history_list != NULL) {
|
||||||
if (history_list != NULL) {
|
/* If this is the first step into history, start at the bottom. */
|
||||||
/* If we're scrolling up at the bottom of the history list
|
if (stored_string == NULL)
|
||||||
* and answer isn't blank, save answer in magichistory. */
|
reset_history_pointer_for(*history_list);
|
||||||
if ((*history_list)->next == NULL && *answer != '\0')
|
|
||||||
magichistory = mallocstrcpy(magichistory, answer);
|
|
||||||
|
|
||||||
/* Get the older search from the history list and save it in
|
/* When moving up from the bottom, remember the current answer. */
|
||||||
* answer. If there is no older search, don't do anything. */
|
if ((*history_list)->next == NULL)
|
||||||
if ((history = get_history_older(history_list)) != NULL) {
|
stored_string = mallocstrcpy(stored_string, answer);
|
||||||
answer = mallocstrcpy(answer, history);
|
|
||||||
typing_x = strlen(answer);
|
/* If there is an older item, move to it and copy its string. */
|
||||||
}
|
if ((*history_list)->prev != NULL) {
|
||||||
|
*history_list = (*history_list)->prev;
|
||||||
|
answer = mallocstrcpy(answer, (*history_list)->data);
|
||||||
|
typing_x = strlen(answer);
|
||||||
|
}
|
||||||
|
} else if (function == get_newer_item && history_list != NULL) {
|
||||||
|
/* If there is a newer item, move to it and copy its string. */
|
||||||
|
if ((*history_list)->next != NULL) {
|
||||||
|
*history_list = (*history_list)->next;
|
||||||
|
answer = mallocstrcpy(answer, (*history_list)->data);
|
||||||
|
typing_x = strlen(answer);
|
||||||
}
|
}
|
||||||
} else if (func == get_history_newer_void) {
|
|
||||||
if (history_list != NULL) {
|
|
||||||
/* Get the newer search from the history list and save it in
|
|
||||||
* answer. If there is no newer search, don't do anything. */
|
|
||||||
if ((history = get_history_newer(history_list)) != NULL) {
|
|
||||||
answer = mallocstrcpy(answer, history);
|
|
||||||
typing_x = strlen(answer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we've reached the bottom of the history list, and answer
|
/* When at the bottom of the history list, restore the old answer. */
|
||||||
* is blank, and magichistory is set, restore the old answer. */
|
if ((*history_list)->next == NULL && stored_string && *answer == '\0') {
|
||||||
if ((*history_list)->next == NULL &&
|
answer = mallocstrcpy(answer, stored_string);
|
||||||
*answer == '\0' && magichistory != NULL) {
|
typing_x = strlen(answer);
|
||||||
answer = mallocstrcpy(answer, magichistory);
|
|
||||||
typing_x = strlen(answer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* ENABLE_HISTORIES */
|
#endif /* ENABLE_HISTORIES */
|
||||||
/* If we ran a function that should not exit from the prompt... */
|
if (function == do_help || function == full_refresh)
|
||||||
if (func == do_help || func == full_refresh)
|
function();
|
||||||
finished = FALSE;
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (func == do_nothing)
|
else if (function == do_toggle && shortcut->toggle == NO_HELP) {
|
||||||
finished = FALSE;
|
|
||||||
else if (func == do_toggle_void) {
|
|
||||||
TOGGLE(NO_HELP);
|
TOGGLE(NO_HELP);
|
||||||
window_init();
|
window_init();
|
||||||
focusing = FALSE;
|
focusing = FALSE;
|
||||||
refresh_func();
|
refresh_func();
|
||||||
bottombars(currmenu);
|
bottombars(currmenu);
|
||||||
finished = FALSE;
|
} else if (function == do_nothing)
|
||||||
}
|
;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLE_NANORC
|
||||||
/* If we have a shortcut with an associated function, break out if
|
else if (function == (functionptrtype)implant)
|
||||||
* we're finished after running or trying to run the function. */
|
implant(shortcut->expansion);
|
||||||
if (finished)
|
#endif
|
||||||
break;
|
else if (function && !handle_editing(function)) {
|
||||||
|
/* When it's a permissible shortcut, run it and done. */
|
||||||
|
if (!ISSET(VIEW_MODE) || !changes_something(function)) {
|
||||||
|
function();
|
||||||
|
break;
|
||||||
|
} else
|
||||||
|
beep();
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_HISTORIES) && defined(ENABLE_TABCOMP)
|
#if defined(ENABLE_HISTORIES) && defined(ENABLE_TABCOMP)
|
||||||
previous_was_tab = (func == do_tab);
|
previous_was_tab = (function == do_tab);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
/* Set the current position in the history list to the bottom. */
|
/* If the history pointer was moved, point it at the bottom again. */
|
||||||
if (history_list != NULL) {
|
if (stored_string != NULL) {
|
||||||
history_reset(*history_list);
|
reset_history_pointer_for(*history_list);
|
||||||
free(magichistory);
|
free(stored_string);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*actual = kbinput;
|
*actual = input;
|
||||||
|
|
||||||
return func;
|
return function;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ask a question on the status bar. Return 0 when text was entered,
|
/* Ask a question on the status bar. Return 0 when text was entered,
|
||||||
@@ -550,10 +568,10 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
int do_prompt(int menu, const char *provided, linestruct **history_list,
|
int do_prompt(int menu, const char *provided, linestruct **history_list,
|
||||||
void (*refresh_func)(void), const char *msg, ...)
|
void (*refresh_func)(void), const char *msg, ...)
|
||||||
{
|
{
|
||||||
|
functionptrtype function = NULL;
|
||||||
|
bool listed = FALSE;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int retval;
|
int retval;
|
||||||
functionptrtype func = NULL;
|
|
||||||
bool listed = FALSE;
|
|
||||||
/* Save a possible current status-bar x position and prompt. */
|
/* Save a possible current status-bar x position and prompt. */
|
||||||
size_t was_typing_x = typing_x;
|
size_t was_typing_x = typing_x;
|
||||||
char *saved_prompt = prompt;
|
char *saved_prompt = prompt;
|
||||||
@@ -566,7 +584,7 @@ int do_prompt(int menu, const char *provided, linestruct **history_list,
|
|||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
redo_theprompt:
|
redo_theprompt:
|
||||||
#endif
|
#endif
|
||||||
prompt = charalloc((COLS * MAXCHARLEN) + 1);
|
prompt = nmalloc((COLS * MAXCHARLEN) + 1);
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
vsnprintf(prompt, COLS * MAXCHARLEN, msg, ap);
|
vsnprintf(prompt, COLS * MAXCHARLEN, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
@@ -575,25 +593,23 @@ int do_prompt(int menu, const char *provided, linestruct **history_list,
|
|||||||
|
|
||||||
lastmessage = VACUUM;
|
lastmessage = VACUUM;
|
||||||
|
|
||||||
func = acquire_an_answer(&retval, &listed, history_list, refresh_func);
|
function = acquire_an_answer(&retval, &listed, history_list, refresh_func);
|
||||||
free(prompt);
|
free(prompt);
|
||||||
prompt = saved_prompt;
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (retval == KEY_WINCH)
|
if (retval == KEY_WINCH)
|
||||||
goto redo_theprompt;
|
goto redo_theprompt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If we're done with this prompt, restore the x position to what
|
/* Restore a possible previous prompt and maybe the typing position. */
|
||||||
* it was at a possible previous prompt. */
|
prompt = saved_prompt;
|
||||||
if (func == do_cancel || func == do_enter)
|
if (function == do_cancel || function == do_enter)
|
||||||
typing_x = was_typing_x;
|
typing_x = was_typing_x;
|
||||||
|
|
||||||
/* If we left the prompt via Cancel or Enter, set the return value
|
/* Set the proper return value for Cancel and Enter. */
|
||||||
* properly. */
|
if (function == do_cancel)
|
||||||
if (func == do_cancel)
|
|
||||||
retval = -1;
|
retval = -1;
|
||||||
else if (func == do_enter)
|
else if (function == do_enter)
|
||||||
retval = (*answer == '\0') ? -2 : 0;
|
retval = (*answer == '\0') ? -2 : 0;
|
||||||
|
|
||||||
if (lastmessage == VACUUM)
|
if (lastmessage == VACUUM)
|
||||||
@@ -608,20 +624,24 @@ int do_prompt(int menu, const char *provided, linestruct **history_list,
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ask a simple Yes/No (and optionally All) question, specified in msg,
|
#define UNDECIDED -2
|
||||||
* on the status bar. Return 1 for Yes, 0 for No, 2 for All (if all is
|
|
||||||
* TRUE when passed in), and -1 for Cancel. */
|
/* Ask a simple Yes/No (and optionally All) question on the status bar
|
||||||
int do_yesno_prompt(bool all, const char *msg)
|
* and return the choice -- either YES or NO or ALL or CANCEL. */
|
||||||
|
int ask_user(bool withall, const char *question)
|
||||||
{
|
{
|
||||||
int choice = -2, width = 16;
|
int choice = UNDECIDED;
|
||||||
|
int width = 16;
|
||||||
/* TRANSLATORS: For the next three strings, specify the starting letters
|
/* TRANSLATORS: For the next three strings, specify the starting letters
|
||||||
* of the translations for "Yes"/"No"/"All". The first letter of each of
|
* of the translations for "Yes"/"No"/"All". The first letter of each of
|
||||||
* these strings MUST be a single-byte letter; others may be multi-byte. */
|
* these strings MUST be a single-byte letter; others may be multi-byte. */
|
||||||
const char *yesstr = _("Yy");
|
const char *yesstr = _("Yy");
|
||||||
const char *nostr = _("Nn");
|
const char *nostr = _("Nn");
|
||||||
const char *allstr = _("Aa");
|
const char *allstr = _("Aa");
|
||||||
|
const keystruct *shortcut;
|
||||||
|
functionptrtype function;
|
||||||
|
|
||||||
while (choice == -2) {
|
while (choice == UNDECIDED) {
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
char letter[MAXCHARLEN + 1];
|
char letter[MAXCHARLEN + 1];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
@@ -642,42 +662,44 @@ int do_yesno_prompt(bool all, const char *msg)
|
|||||||
|
|
||||||
/* Now show the ones for "Yes", "No", "Cancel" and maybe "All". */
|
/* Now show the ones for "Yes", "No", "Cancel" and maybe "All". */
|
||||||
sprintf(shortstr, " %c", yesstr[0]);
|
sprintf(shortstr, " %c", yesstr[0]);
|
||||||
wmove(bottomwin, 1, 0);
|
wmove(footwin, 1, 0);
|
||||||
post_one_key(shortstr, _("Yes"), width);
|
post_one_key(shortstr, _("Yes"), width);
|
||||||
|
|
||||||
shortstr[1] = nostr[0];
|
shortstr[1] = nostr[0];
|
||||||
wmove(bottomwin, 2, 0);
|
wmove(footwin, 2, 0);
|
||||||
post_one_key(shortstr, _("No"), width);
|
post_one_key(shortstr, _("No"), width);
|
||||||
|
|
||||||
if (all) {
|
if (withall) {
|
||||||
shortstr[1] = allstr[0];
|
shortstr[1] = allstr[0];
|
||||||
wmove(bottomwin, 1, width);
|
wmove(footwin, 1, width);
|
||||||
post_one_key(shortstr, _("All"), width);
|
post_one_key(shortstr, _("All"), width);
|
||||||
}
|
}
|
||||||
|
|
||||||
wmove(bottomwin, 2, width);
|
wmove(footwin, 2, width);
|
||||||
post_one_key(cancelshortcut->keystr, _("Cancel"), width);
|
post_one_key(cancelshortcut->keystr, _("Cancel"), width);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Color the promptbar over its full width and display the question. */
|
/* Color the prompt bar over its full width and display the question. */
|
||||||
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
|
wattron(footwin, interface_color_pair[PROMPT_BAR]);
|
||||||
mvwprintw(bottomwin, 0, 0, "%*s", COLS, " ");
|
mvwprintw(footwin, 0, 0, "%*s", COLS, " ");
|
||||||
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
mvwaddnstr(footwin, 0, 0, question, actual_x(question, COLS - 1));
|
||||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
|
wattroff(footwin, interface_color_pair[PROMPT_BAR]);
|
||||||
wnoutrefresh(bottomwin);
|
wnoutrefresh(footwin);
|
||||||
|
|
||||||
currmenu = MYESNO;
|
currmenu = MYESNO;
|
||||||
|
|
||||||
/* When not replacing, show the cursor while waiting for a key. */
|
/* When not replacing, show the cursor while waiting for a key. */
|
||||||
kbinput = get_kbinput(bottomwin, !all);
|
kbinput = get_kbinput(footwin, !withall);
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (kbinput == KEY_WINCH)
|
if (kbinput == KEY_WINCH)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Accept the first character of an external paste. */
|
/* Accept first character of an external paste and ignore the rest. */
|
||||||
if (bracketed_paste && kbinput == BRACKETED_PASTE_MARKER)
|
if (bracketed_paste)
|
||||||
kbinput = get_kbinput(bottomwin, BLIND);
|
kbinput = get_kbinput(footwin, BLIND);
|
||||||
|
while (bracketed_paste)
|
||||||
|
get_kbinput(footwin, BLIND);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
@@ -688,41 +710,60 @@ int do_yesno_prompt(bool all, const char *msg)
|
|||||||
if (using_utf8() && 0xC0 <= kbinput && kbinput <= 0xF7) {
|
if (using_utf8() && 0xC0 <= kbinput && kbinput <= 0xF7) {
|
||||||
int extras = (kbinput / 16) % 4 + (kbinput <= 0xCF ? 1 : 0);
|
int extras = (kbinput / 16) % 4 + (kbinput <= 0xCF ? 1 : 0);
|
||||||
|
|
||||||
while (extras <= get_key_buffer_len() && extras-- > 0)
|
while (extras <= waiting_keycodes() && extras-- > 0)
|
||||||
letter[index++] = (unsigned char)get_kbinput(bottomwin, !all);
|
letter[index++] = (unsigned char)get_kbinput(footwin, !withall);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
letter[index] = '\0';
|
letter[index] = '\0';
|
||||||
|
|
||||||
/* See if the typed letter is in the Yes, No, or All strings. */
|
/* See if the typed letter is in the Yes, No, or All strings. */
|
||||||
if (strstr(yesstr, letter) != NULL)
|
if (strstr(yesstr, letter) != NULL)
|
||||||
choice = 1;
|
choice = YES;
|
||||||
else if (strstr(nostr, letter) != NULL)
|
else if (strstr(nostr, letter) != NULL)
|
||||||
choice = 0;
|
choice = NO;
|
||||||
else if (all && strstr(allstr, letter) != NULL)
|
else if (withall && strstr(allstr, letter) != NULL)
|
||||||
choice = 2;
|
choice = ALL;
|
||||||
else
|
else
|
||||||
#endif /* ENABLE_NLS */
|
#endif /* ENABLE_NLS */
|
||||||
if (strchr("Yy", kbinput) != NULL)
|
if (strchr("Yy", kbinput) != NULL)
|
||||||
choice = 1;
|
choice = YES;
|
||||||
else if (strchr("Nn", kbinput) != NULL)
|
else if (strchr("Nn", kbinput) != NULL)
|
||||||
choice = 0;
|
choice = NO;
|
||||||
else if (all && strchr("Aa", kbinput) != NULL)
|
else if (withall && strchr("Aa", kbinput) != NULL)
|
||||||
choice = 2;
|
choice = ALL;
|
||||||
else if (func_from_key(&kbinput) == do_cancel)
|
|
||||||
choice = -1;
|
if (choice != UNDECIDED)
|
||||||
|
break;
|
||||||
|
|
||||||
|
shortcut = get_shortcut(kbinput);
|
||||||
|
function = (shortcut ? shortcut->func : NULL);
|
||||||
|
|
||||||
|
if (function == do_cancel)
|
||||||
|
choice = CANCEL;
|
||||||
|
else if (function == full_refresh)
|
||||||
|
full_refresh();
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
else if (function == do_toggle && shortcut->toggle == NO_HELP) {
|
||||||
|
TOGGLE(NO_HELP);
|
||||||
|
window_init();
|
||||||
|
titlebar(NULL);
|
||||||
|
focusing = FALSE;
|
||||||
|
edit_refresh();
|
||||||
|
focusing = TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* Interpret ^N and ^Q as "No", to allow exiting in anger. */
|
/* Interpret ^N and ^Q as "No", to allow exiting in anger. */
|
||||||
else if (kbinput == '\x0E' || kbinput == '\x11')
|
else if (kbinput == '\x0E' || kbinput == '\x11')
|
||||||
choice = 0;
|
choice = NO;
|
||||||
/* And interpret ^Y as "Yes". */
|
/* And interpret ^Y as "Yes". */
|
||||||
else if (kbinput == '\x19')
|
else if (kbinput == '\x19')
|
||||||
choice = 1;
|
choice = YES;
|
||||||
#ifdef ENABLE_MOUSE
|
#ifdef ENABLE_MOUSE
|
||||||
else if (kbinput == KEY_MOUSE) {
|
else if (kbinput == KEY_MOUSE) {
|
||||||
int mouse_x, mouse_y;
|
int mouse_x, mouse_y;
|
||||||
/* We can click on the Yes/No/All shortcuts to select an answer. */
|
/* We can click on the Yes/No/All shortcuts to select an answer. */
|
||||||
if (get_mouseinput(&mouse_y, &mouse_x, FALSE) == 0 &&
|
if (get_mouseinput(&mouse_y, &mouse_x, FALSE) == 0 &&
|
||||||
wmouse_trafo(bottomwin, &mouse_y, &mouse_x, FALSE) &&
|
wmouse_trafo(footwin, &mouse_y, &mouse_x, FALSE) &&
|
||||||
mouse_x < (width * 2) && mouse_y > 0) {
|
mouse_x < (width * 2) && mouse_y > 0) {
|
||||||
int x = mouse_x / width;
|
int x = mouse_x / width;
|
||||||
int y = mouse_y - 1;
|
int y = mouse_y - 1;
|
||||||
@@ -730,30 +771,13 @@ int do_yesno_prompt(bool all, const char *msg)
|
|||||||
/* x == 0 means Yes or No, y == 0 means Yes or All. */
|
/* x == 0 means Yes or No, y == 0 means Yes or All. */
|
||||||
choice = -2 * x * y + x - y + 1;
|
choice = -2 * x * y + x - y + 1;
|
||||||
|
|
||||||
if (choice == 2 && !all)
|
if (choice == ALL && !withall)
|
||||||
choice = -2;
|
choice = UNDECIDED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_MOUSE */
|
|
||||||
else if (func_from_key(&kbinput) == full_refresh)
|
|
||||||
full_refresh();
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
else if (func_from_key(&kbinput) == do_toggle_void) {
|
|
||||||
TOGGLE(NO_HELP);
|
|
||||||
window_init();
|
|
||||||
titlebar(NULL);
|
|
||||||
focusing = FALSE;
|
|
||||||
edit_refresh();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
beep();
|
beep();
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
/* Ignore the rest of an external paste. */
|
|
||||||
while (bracketed_paste)
|
|
||||||
kbinput = get_kbinput(bottomwin, BLIND);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return choice;
|
return choice;
|
||||||
|
|||||||
172
src/prototypes.h
172
src/prototypes.h
@@ -1,7 +1,7 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* prototypes.h -- This file is part of GNU nano. *
|
* prototypes.h -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 1999-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* *
|
* *
|
||||||
* GNU nano is free software: you can redistribute it and/or modify *
|
* GNU nano is free software: you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published *
|
* it under the terms of the GNU General Public License as published *
|
||||||
@@ -36,7 +36,7 @@ extern bool bracketed_paste;
|
|||||||
|
|
||||||
extern bool we_are_running;
|
extern bool we_are_running;
|
||||||
extern bool more_than_one;
|
extern bool more_than_one;
|
||||||
|
extern bool report_size;
|
||||||
extern bool ran_a_tool;
|
extern bool ran_a_tool;
|
||||||
|
|
||||||
extern bool inhelp;
|
extern bool inhelp;
|
||||||
@@ -87,8 +87,8 @@ extern size_t wrap_at;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern WINDOW *topwin;
|
extern WINDOW *topwin;
|
||||||
extern WINDOW *edit;
|
extern WINDOW *midwin;
|
||||||
extern WINDOW *bottomwin;
|
extern WINDOW *footwin;
|
||||||
extern int editwinrows;
|
extern int editwinrows;
|
||||||
extern int editwincols;
|
extern int editwincols;
|
||||||
extern int margin;
|
extern int margin;
|
||||||
@@ -141,6 +141,9 @@ extern char *alt_speller;
|
|||||||
extern syntaxtype *syntaxes;
|
extern syntaxtype *syntaxes;
|
||||||
extern char *syntaxstr;
|
extern char *syntaxstr;
|
||||||
extern bool have_palette;
|
extern bool have_palette;
|
||||||
|
extern bool rescind_colors;
|
||||||
|
extern bool perturbed;
|
||||||
|
extern bool recook;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern bool refresh_needed;
|
extern bool refresh_needed;
|
||||||
@@ -178,6 +181,9 @@ extern char *startup_problem;
|
|||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
extern char *custom_nanorc;
|
extern char *custom_nanorc;
|
||||||
|
|
||||||
|
extern char *commandname;
|
||||||
|
extern keystruct *planted_shortcut;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern bool spotlighted;
|
extern bool spotlighted;
|
||||||
@@ -186,15 +192,12 @@ extern size_t light_to_col;
|
|||||||
|
|
||||||
typedef void (*functionptrtype)(void);
|
typedef void (*functionptrtype)(void);
|
||||||
|
|
||||||
/* Most functions in browser.c. */
|
/* The two needed functions from browser.c. */
|
||||||
#ifdef ENABLE_BROWSER
|
#ifdef ENABLE_BROWSER
|
||||||
char *browse_in(const char *inpath);
|
|
||||||
void read_the_list(const char *path, DIR *dir);
|
|
||||||
void browser_refresh(void);
|
void browser_refresh(void);
|
||||||
void browser_select_dirname(const char *needle);
|
char *browse_in(const char *inpath);
|
||||||
void do_filesearch(bool forwards);
|
void to_first_file(void);
|
||||||
void do_fileresearch(bool forwards);
|
void to_last_file(void);
|
||||||
char *strip_last_component(const char *path);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Most functions in chars.c. */
|
/* Most functions in chars.c. */
|
||||||
@@ -208,8 +211,9 @@ bool is_cntrl_char(const char *c);
|
|||||||
bool is_word_char(const char *c, bool allow_punct);
|
bool is_word_char(const char *c, bool allow_punct);
|
||||||
char control_mbrep(const char *c, bool isdata);
|
char control_mbrep(const char *c, bool isdata);
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
int mbwidth(const char *c);
|
int mbtowide(wchar_t *wc, const char *c);
|
||||||
char *make_mbchar(long code, int *length);
|
bool is_doublewidth(const char *ch);
|
||||||
|
bool is_zerowidth(const char *ch);
|
||||||
#endif
|
#endif
|
||||||
int char_length(const char *pointer);
|
int char_length(const char *pointer);
|
||||||
size_t mbstrlen(const char *pointer);
|
size_t mbstrlen(const char *pointer);
|
||||||
@@ -233,16 +237,12 @@ char *mbrevstrpbrk(const char *head, const char *accept, const char *pointer);
|
|||||||
bool has_blank_char(const char *string);
|
bool has_blank_char(const char *string);
|
||||||
#endif
|
#endif
|
||||||
bool white_string(const char *string);
|
bool white_string(const char *string);
|
||||||
#ifdef ENABLE_UTF8
|
|
||||||
bool is_valid_unicode(wchar_t wc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Most functions in color.c. */
|
/* Most functions in color.c. */
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
void set_interface_colorpairs(void);
|
void set_interface_colorpairs(void);
|
||||||
void prepare_palette(void);
|
void prepare_palette(void);
|
||||||
void find_and_prime_applicable_syntax(void);
|
void find_and_prime_applicable_syntax(void);
|
||||||
void set_up_multicache(linestruct *line);
|
|
||||||
void check_the_multis(linestruct *line);
|
void check_the_multis(linestruct *line);
|
||||||
void precalc_multicolorinfo(void);
|
void precalc_multicolorinfo(void);
|
||||||
#endif
|
#endif
|
||||||
@@ -287,7 +287,7 @@ void close_buffer(void);
|
|||||||
void read_file(FILE *f, int fd, const char *filename, bool undoable);
|
void read_file(FILE *f, int fd, const char *filename, bool undoable);
|
||||||
int open_file(const char *filename, bool new_one, FILE **f);
|
int open_file(const char *filename, bool new_one, FILE **f);
|
||||||
char *get_next_filename(const char *name, const char *suffix);
|
char *get_next_filename(const char *name, const char *suffix);
|
||||||
void do_insertfile_void(void);
|
void do_insertfile(void);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
void do_execute(void);
|
void do_execute(void);
|
||||||
#endif
|
#endif
|
||||||
@@ -301,14 +301,14 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp);
|
|||||||
void init_backup_dir(void);
|
void init_backup_dir(void);
|
||||||
#endif
|
#endif
|
||||||
int copy_file(FILE *inn, FILE *out, bool close_out);
|
int copy_file(FILE *inn, FILE *out, bool close_out);
|
||||||
bool write_file(const char *name, FILE *thefile, bool tmp,
|
bool write_file(const char *name, FILE *thefile, bool normal,
|
||||||
kind_of_writing_type method, bool fullbuffer);
|
kind_of_writing_type method, bool annotate);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
bool write_marked_file(const char *name, FILE *stream, bool tmp,
|
bool write_region_to_file(const char *name, FILE *stream, bool normal,
|
||||||
kind_of_writing_type method);
|
kind_of_writing_type method);
|
||||||
#endif
|
#endif
|
||||||
int do_writeout(bool exiting, bool withprompt);
|
int write_it_out(bool exiting, bool withprompt);
|
||||||
void do_writeout_void(void);
|
void do_writeout(void);
|
||||||
void do_savefile(void);
|
void do_savefile(void);
|
||||||
char *real_dir_from_tilde(const char *path);
|
char *real_dir_from_tilde(const char *path);
|
||||||
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||||
@@ -319,16 +319,16 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Some functions in global.c. */
|
/* Some functions in global.c. */
|
||||||
const keystruct *first_sc_for(int menu, void (*func)(void));
|
const keystruct *first_sc_for(int menu, void (*function)(void));
|
||||||
size_t shown_entries_for(int menu);
|
size_t shown_entries_for(int menu);
|
||||||
const keystruct *get_shortcut(int *keycode);
|
const keystruct *get_shortcut(const int keycode);
|
||||||
functionptrtype func_from_key(int *keycode);
|
functionptrtype func_from_key(const int keycode);
|
||||||
#if defined(ENABLE_BROWSER) || defined(ENABLE_HELP)
|
#if defined(ENABLE_BROWSER) || defined(ENABLE_HELP)
|
||||||
functionptrtype interpret(int *keycode);
|
functionptrtype interpret(const int keycode);
|
||||||
#endif
|
#endif
|
||||||
int keycode_from_string(const char *keystring);
|
int keycode_from_string(const char *keystring);
|
||||||
void shortcut_init(void);
|
void shortcut_init(void);
|
||||||
const char *flagtostr(int flag);
|
const char *epithet_of_flag(int flag);
|
||||||
|
|
||||||
/* Some functions in help.c. */
|
/* Some functions in help.c. */
|
||||||
#ifdef ENABLE_HELP
|
#ifdef ENABLE_HELP
|
||||||
@@ -339,12 +339,8 @@ void do_help(void);
|
|||||||
/* Most functions in history.c. */
|
/* Most functions in history.c. */
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
void history_init(void);
|
void history_init(void);
|
||||||
void history_reset(const linestruct *list);
|
void reset_history_pointer_for(const linestruct *list);
|
||||||
void update_history(linestruct **item, const char *text);
|
void update_history(linestruct **item, const char *text, bool avoid_duplicates);
|
||||||
char *get_history_older(linestruct **h);
|
|
||||||
char *get_history_newer(linestruct **h);
|
|
||||||
void get_history_older_void(void);
|
|
||||||
void get_history_newer_void(void);
|
|
||||||
#ifdef ENABLE_TABCOMP
|
#ifdef ENABLE_TABCOMP
|
||||||
char *get_history_completion(linestruct **h, char *s, size_t len);
|
char *get_history_completion(linestruct **h, char *s, size_t len);
|
||||||
#endif
|
#endif
|
||||||
@@ -369,8 +365,8 @@ void to_para_end(void);
|
|||||||
#endif
|
#endif
|
||||||
void to_prev_block(void);
|
void to_prev_block(void);
|
||||||
void to_next_block(void);
|
void to_next_block(void);
|
||||||
void do_prev_word(bool allow_punct);
|
void do_prev_word(bool allow_folded);
|
||||||
bool do_next_word(bool after_ends, bool allow_punct);
|
bool do_next_word(bool after_ends, bool allow_folded);
|
||||||
void to_prev_word(void);
|
void to_prev_word(void);
|
||||||
void to_next_word(void);
|
void to_next_word(void);
|
||||||
void do_home(void);
|
void do_home(void);
|
||||||
@@ -384,6 +380,7 @@ void do_center(void);
|
|||||||
#endif
|
#endif
|
||||||
void do_left(void);
|
void do_left(void);
|
||||||
void do_right(void);
|
void do_right(void);
|
||||||
|
void move_cursor_to_proper_column(void);
|
||||||
|
|
||||||
/* Most functions in nano.c. */
|
/* Most functions in nano.c. */
|
||||||
linestruct *make_new_node(linestruct *prevnode);
|
linestruct *make_new_node(linestruct *prevnode);
|
||||||
@@ -395,8 +392,8 @@ void free_lines(linestruct *src);
|
|||||||
void renumber_from(linestruct *line);
|
void renumber_from(linestruct *line);
|
||||||
void print_view_warning(void);
|
void print_view_warning(void);
|
||||||
bool in_restricted_mode(void);
|
bool in_restricted_mode(void);
|
||||||
#ifndef ENABLE_HELP
|
#ifndef NANO_TINY
|
||||||
void say_there_is_no_help(void);
|
void suggest_ctrlT_ctrlZ(void);
|
||||||
#endif
|
#endif
|
||||||
void finish(void);
|
void finish(void);
|
||||||
void close_and_go(void);
|
void close_and_go(void);
|
||||||
@@ -405,21 +402,22 @@ void die(const char *msg, ...);
|
|||||||
void window_init(void);
|
void window_init(void);
|
||||||
void install_handler_for_Ctrl_C(void);
|
void install_handler_for_Ctrl_C(void);
|
||||||
void restore_handler_for_Ctrl_C(void);
|
void restore_handler_for_Ctrl_C(void);
|
||||||
|
#ifndef NANO_TINY
|
||||||
void reconnect_and_store_state(void);
|
void reconnect_and_store_state(void);
|
||||||
RETSIGTYPE handle_hupterm(int signal);
|
|
||||||
#ifndef DEBUG
|
|
||||||
RETSIGTYPE handle_crash(int signal);
|
|
||||||
#endif
|
#endif
|
||||||
RETSIGTYPE do_suspend(int signal);
|
void handle_hupterm(int signal);
|
||||||
RETSIGTYPE do_continue(int signal);
|
#ifndef DEBUG
|
||||||
|
void handle_crash(int signal);
|
||||||
|
#endif
|
||||||
|
void suspend_nano(int signal);
|
||||||
|
void do_suspend(void);
|
||||||
|
void continue_nano(int signal);
|
||||||
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER) || defined(ENABLE_COLOR)
|
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER) || defined(ENABLE_COLOR)
|
||||||
void block_sigwinch(bool blockit);
|
void block_sigwinch(bool blockit);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
RETSIGTYPE handle_sigwinch(int signal);
|
void handle_sigwinch(int signal);
|
||||||
void compute_the_extra_rows_per_line_from(linestruct *fromline);
|
|
||||||
void regenerate_screen(void);
|
void regenerate_screen(void);
|
||||||
void do_toggle(int flag);
|
|
||||||
#endif
|
#endif
|
||||||
void disable_kb_interrupt(void);
|
void disable_kb_interrupt(void);
|
||||||
void enable_kb_interrupt(void);
|
void enable_kb_interrupt(void);
|
||||||
@@ -430,7 +428,7 @@ void terminal_init(void);
|
|||||||
void confirm_margin(void);
|
void confirm_margin(void);
|
||||||
#endif
|
#endif
|
||||||
void unbound_key(int code);
|
void unbound_key(int code);
|
||||||
bool okay_for_view(const keystruct *shortcut);
|
bool changes_something(functionptrtype f);
|
||||||
void inject(char *burst, size_t count);
|
void inject(char *burst, size_t count);
|
||||||
|
|
||||||
/* Most functions in prompt.c. */
|
/* Most functions in prompt.c. */
|
||||||
@@ -439,7 +437,7 @@ void put_cursor_at_end_of_answer(void);
|
|||||||
void add_or_remove_pipe_symbol_from_answer(void);
|
void add_or_remove_pipe_symbol_from_answer(void);
|
||||||
int do_prompt(int menu, const char *provided, linestruct **history_list,
|
int do_prompt(int menu, const char *provided, linestruct **history_list,
|
||||||
void (*refresh_func)(void), const char *msg, ...);
|
void (*refresh_func)(void), const char *msg, ...);
|
||||||
int do_yesno_prompt(bool all, const char *msg);
|
int ask_user(bool withall, const char *question);
|
||||||
|
|
||||||
/* Most functions in rcfile.c. */
|
/* Most functions in rcfile.c. */
|
||||||
#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
|
#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
|
||||||
@@ -447,6 +445,7 @@ void display_rcfile_errors(void);
|
|||||||
void jot_error(const char *msg, ...);
|
void jot_error(const char *msg, ...);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
|
keystruct *strtosc(const char *input);
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
void parse_one_include(char *file, syntaxtype *syntax);
|
void parse_one_include(char *file, syntaxtype *syntax);
|
||||||
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
|
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
|
||||||
@@ -471,11 +470,16 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
|||||||
const linestruct *real_current, size_t *real_current_x);
|
const linestruct *real_current, size_t *real_current_x);
|
||||||
void do_replace(void);
|
void do_replace(void);
|
||||||
void ask_for_and_do_replacements(void);
|
void ask_for_and_do_replacements(void);
|
||||||
|
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER) || defined (ENABLE_LINTER) || defined (ENABLE_FORMATTER)
|
||||||
void goto_line_posx(ssize_t line, size_t pos_x);
|
void goto_line_posx(ssize_t line, size_t pos_x);
|
||||||
void do_gotolinecolumn(ssize_t line, ssize_t column, bool retain_answer,
|
#endif
|
||||||
|
void goto_line_and_column(ssize_t line, ssize_t column, bool retain_answer,
|
||||||
bool interactive);
|
bool interactive);
|
||||||
void do_gotolinecolumn_void(void);
|
void do_gotolinecolumn(void);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
int find_matching_bracket_pos(linestruct **line, size_t *xpos);
|
||||||
|
bool find_bracketed_region(linestruct *in_region,
|
||||||
|
linestruct **top, linestruct **bot);
|
||||||
void do_find_bracket(void);
|
void do_find_bracket(void);
|
||||||
void put_or_lift_anchor(void);
|
void put_or_lift_anchor(void);
|
||||||
void to_prev_anchor(void);
|
void to_prev_anchor(void);
|
||||||
@@ -504,7 +508,7 @@ void update_multiline_undo(ssize_t lineno, char *indentation);
|
|||||||
void update_undo(undo_type action);
|
void update_undo(undo_type action);
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
#ifdef ENABLE_WRAPPING
|
#ifdef ENABLE_WRAPPING
|
||||||
bool do_wrap(void);
|
void do_wrap(void);
|
||||||
#endif
|
#endif
|
||||||
#if defined(ENABLE_HELP) || defined(ENABLED_WRAPORJUSTIFY)
|
#if defined(ENABLE_HELP) || defined(ENABLED_WRAPORJUSTIFY)
|
||||||
ssize_t break_line(const char *textstart, ssize_t goal, bool snap_at_nl);
|
ssize_t break_line(const char *textstart, ssize_t goal, bool snap_at_nl);
|
||||||
@@ -516,34 +520,35 @@ size_t indent_length(const char *line);
|
|||||||
size_t quote_length(const char *line);
|
size_t quote_length(const char *line);
|
||||||
bool begpar(const linestruct *const line, int depth);
|
bool begpar(const linestruct *const line, int depth);
|
||||||
bool inpar(const linestruct *const line);
|
bool inpar(const linestruct *const line);
|
||||||
void do_justify(bool full_justify);
|
void do_justify(void);
|
||||||
void do_justify_void(void);
|
|
||||||
void do_full_justify(void);
|
void do_full_justify(void);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_SPELLER
|
#ifdef ENABLE_SPELLER
|
||||||
void do_spell(void);
|
void do_spell(void);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_LINTER
|
||||||
void do_linter(void);
|
void do_linter(void);
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_FORMATTER
|
||||||
void do_formatter(void);
|
void do_formatter(void);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
void do_wordlinechar_count(void);
|
void count_lines_words_and_characters(void);
|
||||||
#endif
|
#endif
|
||||||
void do_verbatim_input(void);
|
void do_verbatim_input(void);
|
||||||
|
#ifdef ENABLE_WORDCOMPLETION
|
||||||
void complete_a_word(void);
|
void complete_a_word(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* All functions in utils.c. */
|
/* All functions in utils.c. */
|
||||||
void get_homedir(void);
|
void get_homedir(void);
|
||||||
const char *tail(const char *path);
|
const char *tail(const char *path);
|
||||||
char *concatenate(const char *path, const char *name);
|
char *concatenate(const char *path, const char *name);
|
||||||
#ifdef ENABLE_LINENUMBERS
|
|
||||||
int digits(ssize_t n);
|
int digits(ssize_t n);
|
||||||
#endif
|
|
||||||
bool parse_num(const char *str, ssize_t *result);
|
bool parse_num(const char *str, ssize_t *result);
|
||||||
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
|
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
|
||||||
void recode_NUL_to_LF(char *string, size_t length);
|
void recode_NUL_to_LF(char *string, size_t length);
|
||||||
void recode_LF_to_NUL(char *string);
|
size_t recode_LF_to_NUL(char *string);
|
||||||
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||||
void free_chararray(char **array, size_t len);
|
void free_chararray(char **array, size_t len);
|
||||||
#endif
|
#endif
|
||||||
@@ -573,18 +578,23 @@ void get_region(linestruct **top, size_t *top_x, linestruct **bot, size_t *bot_x
|
|||||||
void get_range(linestruct **top, linestruct **bot);
|
void get_range(linestruct **top, linestruct **bot);
|
||||||
#endif
|
#endif
|
||||||
size_t number_of_characters_in(const linestruct *begin, const linestruct *end);
|
size_t number_of_characters_in(const linestruct *begin, const linestruct *end);
|
||||||
#ifndef NANO_TINY
|
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER) || defined (ENABLE_LINTER) || defined (ENABLE_FORMATTER)
|
||||||
linestruct *line_from_number(ssize_t number);
|
linestruct *line_from_number(ssize_t number);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Most functions in winio.c. */
|
/* Most functions in winio.c. */
|
||||||
|
linestruct *get_next_visible_line(linestruct *line);
|
||||||
|
linestruct *get_prev_visible_line(linestruct *line);
|
||||||
|
#ifndef NANO_TINY
|
||||||
void record_macro(void);
|
void record_macro(void);
|
||||||
void run_macro(void);
|
void run_macro(void);
|
||||||
size_t get_key_buffer_len(void);
|
#endif
|
||||||
|
void reserve_space_for(size_t newsize);
|
||||||
|
size_t waiting_keycodes(void);
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
void implant(const char *string);
|
void implant(const char *string);
|
||||||
#endif
|
#endif
|
||||||
int parse_kbinput(WINDOW *win);
|
int get_input(WINDOW *win);
|
||||||
int get_kbinput(WINDOW *win, bool showcursor);
|
int get_kbinput(WINDOW *win, bool showcursor);
|
||||||
char *get_verbatim_kbinput(WINDOW *win, size_t *count);
|
char *get_verbatim_kbinput(WINDOW *win, size_t *count);
|
||||||
#ifdef ENABLE_MOUSE
|
#ifdef ENABLE_MOUSE
|
||||||
@@ -595,15 +605,18 @@ void blank_statusbar(void);
|
|||||||
void wipe_statusbar(void);
|
void wipe_statusbar(void);
|
||||||
void blank_bottombars(void);
|
void blank_bottombars(void);
|
||||||
void check_statusblank(void);
|
void check_statusblank(void);
|
||||||
|
void set_blankdelay_to_one(void);
|
||||||
char *display_string(const char *buf, size_t column, size_t span,
|
char *display_string(const char *buf, size_t column, size_t span,
|
||||||
bool isdata, bool isprompt);
|
bool isdata, bool isprompt);
|
||||||
void titlebar(const char *path);
|
void titlebar(const char *path);
|
||||||
|
void minibar(void);
|
||||||
void statusline(message_type importance, const char *msg, ...);
|
void statusline(message_type importance, const char *msg, ...);
|
||||||
void statusbar(const char *msg);
|
void statusbar(const char *msg);
|
||||||
void warn_and_briefly_pause(const char *msg);
|
void warn_and_briefly_pause(const char *msg);
|
||||||
void bottombars(int menu);
|
void bottombars(int menu);
|
||||||
void post_one_key(const char *keystroke, const char *tag, int width);
|
void post_one_key(const char *keystroke, const char *tag, int width);
|
||||||
void place_the_cursor(void);
|
void place_the_cursor(void);
|
||||||
|
int update_line_at(linestruct *line, size_t index, int row);
|
||||||
int update_line(linestruct *line, size_t index);
|
int update_line(linestruct *line, size_t index);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
int update_softwrapped_line(linestruct *line);
|
int update_softwrapped_line(linestruct *line);
|
||||||
@@ -614,8 +627,8 @@ int go_forward_chunks(int nrows, linestruct **line, size_t *leftedge);
|
|||||||
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
|
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
|
||||||
void edit_scroll(bool direction);
|
void edit_scroll(bool direction);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
|
size_t get_softwrap_breakpoint(const char *linedata, size_t leftedge,
|
||||||
bool *end_of_line);
|
bool *kickoff, bool *end_of_line);
|
||||||
size_t get_chunk_and_edge(size_t column, linestruct *line, size_t *leftedge);
|
size_t get_chunk_and_edge(size_t column, linestruct *line, size_t *leftedge);
|
||||||
size_t chunk_for(size_t column, linestruct *line);
|
size_t chunk_for(size_t column, linestruct *line);
|
||||||
size_t leftedge_for(size_t column, linestruct *line);
|
size_t leftedge_for(size_t column, linestruct *line);
|
||||||
@@ -633,9 +646,6 @@ void spotlight(size_t from_col, size_t to_col);
|
|||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
void spotlight_softwrapped(size_t from_col, size_t to_col);
|
void spotlight_softwrapped(size_t from_col, size_t to_col);
|
||||||
#endif
|
#endif
|
||||||
void do_suspend_void(void);
|
|
||||||
void disable_waiting(void);
|
|
||||||
void enable_waiting(void);
|
|
||||||
#ifdef ENABLE_EXTRA
|
#ifdef ENABLE_EXTRA
|
||||||
void do_credits(void);
|
void do_credits(void);
|
||||||
#endif
|
#endif
|
||||||
@@ -644,22 +654,24 @@ void do_credits(void);
|
|||||||
void case_sens_void(void);
|
void case_sens_void(void);
|
||||||
void regexp_void(void);
|
void regexp_void(void);
|
||||||
void backwards_void(void);
|
void backwards_void(void);
|
||||||
|
#ifdef ENABLE_HISTORIES
|
||||||
|
void get_older_item(void);
|
||||||
|
void get_newer_item(void);
|
||||||
|
#endif
|
||||||
void flip_replace(void);
|
void flip_replace(void);
|
||||||
void flip_goto(void);
|
void flip_goto(void);
|
||||||
#ifdef ENABLE_BROWSER
|
#ifdef ENABLE_BROWSER
|
||||||
void to_files(void);
|
void to_files(void);
|
||||||
void to_first_file(void);
|
|
||||||
void to_last_file(void);
|
|
||||||
void goto_dir(void);
|
void goto_dir(void);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
void do_nothing(void);
|
void do_nothing(void);
|
||||||
void do_toggle_void(void);
|
void do_toggle(void);
|
||||||
void dos_format_void(void);
|
void dos_format(void);
|
||||||
void mac_format_void(void);
|
void mac_format(void);
|
||||||
void append_void(void);
|
void append_it(void);
|
||||||
void prepend_void(void);
|
void prepend_it(void);
|
||||||
void backup_file_void(void);
|
void back_it_up(void);
|
||||||
void flip_execute(void);
|
void flip_execute(void);
|
||||||
void flip_pipe(void);
|
void flip_pipe(void);
|
||||||
void flip_convert(void);
|
void flip_convert(void);
|
||||||
@@ -669,3 +681,13 @@ void flip_newbuffer(void);
|
|||||||
#endif
|
#endif
|
||||||
void discard_buffer(void);
|
void discard_buffer(void);
|
||||||
void do_cancel(void);
|
void do_cancel(void);
|
||||||
|
|
||||||
|
/* Most functions in folding.c. */
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
void do_fold_segment(void);
|
||||||
|
void unfold_folded_segment(linestruct *line);
|
||||||
|
void unfold_folded_segment_from(linestruct *line);
|
||||||
|
linestruct *get_start_of_folded_segment(linestruct* line);
|
||||||
|
linestruct *get_end_of_folded_segment(linestruct* line);
|
||||||
|
int get_folded_segment_length(linestruct *line);
|
||||||
|
#endif
|
||||||
|
|||||||
343
src/rcfile.c
343
src/rcfile.c
@@ -1,10 +1,10 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* rcfile.c -- This file is part of GNU nano. *
|
* rcfile.c -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 2001-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 2001-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* Copyright (C) 2014 Mike Frysinger *
|
* Copyright (C) 2014 Mike Frysinger *
|
||||||
* Copyright (C) 2019 Brand Huntsman *
|
* Copyright (C) 2019 Brand Huntsman *
|
||||||
* Copyright (C) 2014-2020 Benno Schulenberg *
|
* Copyright (C) 2014-2021 Benno Schulenberg *
|
||||||
* *
|
* *
|
||||||
* GNU nano is free software: you can redistribute it and/or modify *
|
* GNU nano is free software: you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published *
|
* it under the terms of the GNU General Public License as published *
|
||||||
@@ -48,18 +48,18 @@ static const rcoption rcopts[] = {
|
|||||||
#endif
|
#endif
|
||||||
{"casesensitive", CASE_SENSITIVE},
|
{"casesensitive", CASE_SENSITIVE},
|
||||||
{"constantshow", CONSTANT_SHOW},
|
{"constantshow", CONSTANT_SHOW},
|
||||||
{"emptyline", EMPTY_LINE},
|
|
||||||
#ifdef ENABLED_WRAPORJUSTIFY
|
#ifdef ENABLED_WRAPORJUSTIFY
|
||||||
{"fill", 0},
|
{"fill", 0},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
{"historylog", HISTORYLOG},
|
{"historylog", HISTORYLOG},
|
||||||
#endif
|
#endif
|
||||||
{"jumpyscrolling", JUMPY_SCROLLING},
|
|
||||||
#ifdef ENABLE_LINENUMBERS
|
#ifdef ENABLE_LINENUMBERS
|
||||||
{"linenumbers", LINE_NUMBERS},
|
{"linenumbers", LINE_NUMBERS},
|
||||||
#endif
|
#endif
|
||||||
{"morespace", MORE_SPACE}, /* Deprecated; remove in 2021. */
|
#ifdef HAVE_LIBMAGIC
|
||||||
|
{"magic", USE_MAGIC},
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_MOUSE
|
#ifdef ENABLE_MOUSE
|
||||||
{"mouse", USE_MOUSE},
|
{"mouse", USE_MOUSE},
|
||||||
#endif
|
#endif
|
||||||
@@ -68,9 +68,8 @@ static const rcoption rcopts[] = {
|
|||||||
#endif
|
#endif
|
||||||
{"nohelp", NO_HELP},
|
{"nohelp", NO_HELP},
|
||||||
{"nonewlines", NO_NEWLINES},
|
{"nonewlines", NO_NEWLINES},
|
||||||
{"nopauses", NO_PAUSES}, /* Obsolete; remove in 2021. */
|
|
||||||
#ifdef ENABLE_WRAPPING
|
#ifdef ENABLE_WRAPPING
|
||||||
{"nowrap", NO_WRAP}, /* Deprecated; remove in 2021. */
|
{"nowrap", NO_WRAP}, /* Deprecated; remove in 2024. */
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_OPERATINGDIR
|
#ifdef ENABLE_OPERATINGDIR
|
||||||
{"operatingdir", 0},
|
{"operatingdir", 0},
|
||||||
@@ -91,11 +90,6 @@ static const rcoption rcopts[] = {
|
|||||||
#ifdef ENABLE_SPELLER
|
#ifdef ENABLE_SPELLER
|
||||||
{"speller", 0},
|
{"speller", 0},
|
||||||
#endif
|
#endif
|
||||||
{"suspend", SUSPENDABLE}, /* Deprecated; remove in 2022. */
|
|
||||||
{"suspendable", SUSPENDABLE},
|
|
||||||
{"tabsize", 0},
|
|
||||||
{"tempfile", SAVE_ON_EXIT}, /* Deprecated; remove in 2022. */
|
|
||||||
{"view", VIEW_MODE},
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
{"afterends", AFTER_ENDS},
|
{"afterends", AFTER_ENDS},
|
||||||
{"allow_insecure_backup", INSECURE_BACKUP},
|
{"allow_insecure_backup", INSECURE_BACKUP},
|
||||||
@@ -105,15 +99,19 @@ static const rcoption rcopts[] = {
|
|||||||
{"backupdir", 0},
|
{"backupdir", 0},
|
||||||
{"bookstyle", BOOKSTYLE},
|
{"bookstyle", BOOKSTYLE},
|
||||||
{"cutfromcursor", CUT_FROM_CURSOR},
|
{"cutfromcursor", CUT_FROM_CURSOR},
|
||||||
|
{"emptyline", EMPTY_LINE},
|
||||||
{"guidestripe", 0},
|
{"guidestripe", 0},
|
||||||
{"indicator", INDICATOR},
|
{"indicator", INDICATOR},
|
||||||
|
{"jumpyscrolling", JUMPY_SCROLLING},
|
||||||
{"locking", LOCKING},
|
{"locking", LOCKING},
|
||||||
{"matchbrackets", 0},
|
{"matchbrackets", 0},
|
||||||
|
{"minibar", MINIBAR},
|
||||||
{"noconvert", NO_CONVERT},
|
{"noconvert", NO_CONVERT},
|
||||||
{"showcursor", SHOW_CURSOR},
|
{"showcursor", SHOW_CURSOR},
|
||||||
{"smarthome", SMART_HOME},
|
{"smarthome", SMART_HOME},
|
||||||
{"smooth", SMOOTH_SCROLL}, /* Deprecated; remove in 2021. */
|
|
||||||
{"softwrap", SOFTWRAP},
|
{"softwrap", SOFTWRAP},
|
||||||
|
{"stateflags", STATEFLAGS},
|
||||||
|
{"tabsize", 0},
|
||||||
{"tabstospaces", TABS_TO_SPACES},
|
{"tabstospaces", TABS_TO_SPACES},
|
||||||
{"trimblanks", TRIM_BLANKS},
|
{"trimblanks", TRIM_BLANKS},
|
||||||
{"unix", MAKE_IT_UNIX},
|
{"unix", MAKE_IT_UNIX},
|
||||||
@@ -121,12 +119,17 @@ static const rcoption rcopts[] = {
|
|||||||
{"wordbounds", WORD_BOUNDS},
|
{"wordbounds", WORD_BOUNDS},
|
||||||
{"wordchars", 0},
|
{"wordchars", 0},
|
||||||
{"zap", LET_THEM_ZAP},
|
{"zap", LET_THEM_ZAP},
|
||||||
|
{"zero", ZERO},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
{"titlecolor", 0},
|
{"titlecolor", 0},
|
||||||
{"numbercolor", 0},
|
{"numbercolor", 0},
|
||||||
{"stripecolor", 0},
|
{"stripecolor", 0},
|
||||||
|
{"scrollercolor", 0},
|
||||||
{"selectedcolor", 0},
|
{"selectedcolor", 0},
|
||||||
|
{"spotlightcolor", 0},
|
||||||
|
{"minicolor", 0},
|
||||||
|
{"promptcolor", 0},
|
||||||
{"statuscolor", 0},
|
{"statuscolor", 0},
|
||||||
{"errorcolor", 0},
|
{"errorcolor", 0},
|
||||||
{"keycolor", 0},
|
{"keycolor", 0},
|
||||||
@@ -150,18 +153,6 @@ static bool seen_color_command = FALSE;
|
|||||||
static colortype *lastcolor = NULL;
|
static colortype *lastcolor = NULL;
|
||||||
/* The end of the color list for the current syntax. */
|
/* The end of the color list for the current syntax. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NUMBER_OF_MENUS 17 /* Remove the deprecated 'extcmd' in 2022. */
|
|
||||||
char *menunames[NUMBER_OF_MENUS] = { "main", "search", "replace", "replacewith",
|
|
||||||
"yesno", "gotoline", "writeout", "insert",
|
|
||||||
"execute", "extcmd", "help", "spell", "linter",
|
|
||||||
"browser", "whereisfile", "gotodir",
|
|
||||||
"all" };
|
|
||||||
int menusymbols[NUMBER_OF_MENUS] = { MMAIN, MWHEREIS, MREPLACE, MREPLACEWITH,
|
|
||||||
MYESNO, MGOTOLINE, MWRITEFILE, MINSERTFILE,
|
|
||||||
MEXECUTE, MEXECUTE, MHELP, MSPELL, MLINTER,
|
|
||||||
MBROWSER, MWHEREISFILE, MGOTODIR,
|
|
||||||
MMOST|MBROWSER|MHELP|MYESNO };
|
|
||||||
#endif /* ENABLE_NANORC */
|
#endif /* ENABLE_NANORC */
|
||||||
|
|
||||||
#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
|
#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
|
||||||
@@ -237,11 +228,11 @@ keystruct *strtosc(const char *input)
|
|||||||
else if (!strcmp(input, "discardbuffer"))
|
else if (!strcmp(input, "discardbuffer"))
|
||||||
s->func = discard_buffer;
|
s->func = discard_buffer;
|
||||||
else if (!strcmp(input, "writeout"))
|
else if (!strcmp(input, "writeout"))
|
||||||
s->func = do_writeout_void;
|
s->func = do_writeout;
|
||||||
else if (!strcmp(input, "savefile"))
|
else if (!strcmp(input, "savefile"))
|
||||||
s->func = do_savefile;
|
s->func = do_savefile;
|
||||||
else if (!strcmp(input, "insert"))
|
else if (!strcmp(input, "insert"))
|
||||||
s->func = do_insertfile_void;
|
s->func = do_insertfile;
|
||||||
else if (!strcmp(input, "whereis"))
|
else if (!strcmp(input, "whereis"))
|
||||||
s->func = do_search_forward;
|
s->func = do_search_forward;
|
||||||
else if (!strcmp(input, "wherewas"))
|
else if (!strcmp(input, "wherewas"))
|
||||||
@@ -273,20 +264,21 @@ keystruct *strtosc(const char *input)
|
|||||||
!strcmp(input, "speller"))
|
!strcmp(input, "speller"))
|
||||||
s->func = do_spell;
|
s->func = do_spell;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_LINTER
|
||||||
else if (!strcmp(input, "linter"))
|
else if (!strcmp(input, "linter"))
|
||||||
s->func = do_linter;
|
s->func = do_linter;
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_FORMATTER
|
||||||
else if (!strcmp(input, "formatter"))
|
else if (!strcmp(input, "formatter"))
|
||||||
s->func = do_formatter;
|
s->func = do_formatter;
|
||||||
#endif
|
#endif
|
||||||
else if (!strcmp(input, "location") ||
|
else if (!strcmp(input, "location"))
|
||||||
!strcmp(input, "curpos")) /* Deprecated; remove in 2022. */
|
|
||||||
s->func = report_cursor_position;
|
s->func = report_cursor_position;
|
||||||
else if (!strcmp(input, "gotoline"))
|
else if (!strcmp(input, "gotoline"))
|
||||||
s->func = do_gotolinecolumn_void;
|
s->func = do_gotolinecolumn;
|
||||||
#ifdef ENABLE_JUSTIFY
|
#ifdef ENABLE_JUSTIFY
|
||||||
else if (!strcmp(input, "justify"))
|
else if (!strcmp(input, "justify"))
|
||||||
s->func = do_justify_void;
|
s->func = do_justify;
|
||||||
else if (!strcmp(input, "fulljustify"))
|
else if (!strcmp(input, "fulljustify"))
|
||||||
s->func = do_full_justify;
|
s->func = do_full_justify;
|
||||||
else if (!strcmp(input, "beginpara"))
|
else if (!strcmp(input, "beginpara"))
|
||||||
@@ -307,16 +299,14 @@ keystruct *strtosc(const char *input)
|
|||||||
s->func = do_indent;
|
s->func = do_indent;
|
||||||
else if (!strcmp(input, "unindent"))
|
else if (!strcmp(input, "unindent"))
|
||||||
s->func = do_unindent;
|
s->func = do_unindent;
|
||||||
else if (!strcmp(input, "chopwordleft") ||
|
else if (!strcmp(input, "chopwordleft"))
|
||||||
!strcmp(input, "cutwordleft")) /* Deprecated; remove in 2021. */
|
|
||||||
s->func = chop_previous_word;
|
s->func = chop_previous_word;
|
||||||
else if (!strcmp(input, "chopwordright") ||
|
else if (!strcmp(input, "chopwordright"))
|
||||||
!strcmp(input, "cutwordright")) /* Deprecated; remove in 2021. */
|
|
||||||
s->func = chop_next_word;
|
s->func = chop_next_word;
|
||||||
else if (!strcmp(input, "findbracket"))
|
else if (!strcmp(input, "findbracket"))
|
||||||
s->func = do_find_bracket;
|
s->func = do_find_bracket;
|
||||||
else if (!strcmp(input, "wordcount"))
|
else if (!strcmp(input, "wordcount"))
|
||||||
s->func = do_wordlinechar_count;
|
s->func = count_lines_words_and_characters;
|
||||||
else if (!strcmp(input, "recordmacro"))
|
else if (!strcmp(input, "recordmacro"))
|
||||||
s->func = record_macro;
|
s->func = record_macro;
|
||||||
else if (!strcmp(input, "runmacro"))
|
else if (!strcmp(input, "runmacro"))
|
||||||
@@ -392,8 +382,10 @@ keystruct *strtosc(const char *input)
|
|||||||
s->func = do_backspace;
|
s->func = do_backspace;
|
||||||
else if (!strcmp(input, "refresh"))
|
else if (!strcmp(input, "refresh"))
|
||||||
s->func = full_refresh;
|
s->func = full_refresh;
|
||||||
|
#ifndef NANO_TINY
|
||||||
else if (!strcmp(input, "suspend"))
|
else if (!strcmp(input, "suspend"))
|
||||||
s->func = do_suspend_void;
|
s->func = do_suspend;
|
||||||
|
#endif
|
||||||
else if (!strcmp(input, "casesens"))
|
else if (!strcmp(input, "casesens"))
|
||||||
s->func = case_sens_void;
|
s->func = case_sens_void;
|
||||||
else if (!strcmp(input, "regexp"))
|
else if (!strcmp(input, "regexp"))
|
||||||
@@ -406,21 +398,21 @@ keystruct *strtosc(const char *input)
|
|||||||
s->func = flip_goto;
|
s->func = flip_goto;
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
else if (!strcmp(input, "older"))
|
else if (!strcmp(input, "older"))
|
||||||
s->func = get_history_older_void;
|
s->func = get_older_item;
|
||||||
else if (!strcmp(input, "newer"))
|
else if (!strcmp(input, "newer"))
|
||||||
s->func = get_history_newer_void;
|
s->func = get_newer_item;
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (!strcmp(input, "dosformat"))
|
else if (!strcmp(input, "dosformat"))
|
||||||
s->func = dos_format_void;
|
s->func = dos_format;
|
||||||
else if (!strcmp(input, "macformat"))
|
else if (!strcmp(input, "macformat"))
|
||||||
s->func = mac_format_void;
|
s->func = mac_format;
|
||||||
else if (!strcmp(input, "append"))
|
else if (!strcmp(input, "append"))
|
||||||
s->func = append_void;
|
s->func = append_it;
|
||||||
else if (!strcmp(input, "prepend"))
|
else if (!strcmp(input, "prepend"))
|
||||||
s->func = prepend_void;
|
s->func = prepend_it;
|
||||||
else if (!strcmp(input, "backup"))
|
else if (!strcmp(input, "backup"))
|
||||||
s->func = backup_file_void;
|
s->func = back_it_up;
|
||||||
else if (!strcmp(input, "flipexecute"))
|
else if (!strcmp(input, "flipexecute"))
|
||||||
s->func = flip_execute;
|
s->func = flip_execute;
|
||||||
else if (!strcmp(input, "flippipe"))
|
else if (!strcmp(input, "flippipe"))
|
||||||
@@ -445,9 +437,11 @@ keystruct *strtosc(const char *input)
|
|||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
s->func = do_toggle_void;
|
s->func = do_toggle;
|
||||||
if (!strcmp(input, "nohelp"))
|
if (!strcmp(input, "nohelp"))
|
||||||
s->toggle = NO_HELP;
|
s->toggle = NO_HELP;
|
||||||
|
else if (!strcmp(input, "zero"))
|
||||||
|
s->toggle = ZERO;
|
||||||
else if (!strcmp(input, "constantshow"))
|
else if (!strcmp(input, "constantshow"))
|
||||||
s->toggle = CONSTANT_SHOW;
|
s->toggle = CONSTANT_SHOW;
|
||||||
else if (!strcmp(input, "softwrap"))
|
else if (!strcmp(input, "softwrap"))
|
||||||
@@ -469,7 +463,8 @@ keystruct *strtosc(const char *input)
|
|||||||
else if (!strcmp(input, "cutfromcursor"))
|
else if (!strcmp(input, "cutfromcursor"))
|
||||||
s->toggle = CUT_FROM_CURSOR;
|
s->toggle = CUT_FROM_CURSOR;
|
||||||
#ifdef ENABLE_WRAPPING
|
#ifdef ENABLE_WRAPPING
|
||||||
else if (!strcmp(input, "nowrap"))
|
else if (!strcmp(input, "breaklonglines") ||
|
||||||
|
!strcmp(input, "nowrap")) /* Deprecated; remove in 2024. */
|
||||||
s->toggle = BREAK_LONG_LINES;
|
s->toggle = BREAK_LONG_LINES;
|
||||||
#endif
|
#endif
|
||||||
else if (!strcmp(input, "tabstospaces"))
|
else if (!strcmp(input, "tabstospaces"))
|
||||||
@@ -478,9 +473,6 @@ keystruct *strtosc(const char *input)
|
|||||||
else if (!strcmp(input, "mouse"))
|
else if (!strcmp(input, "mouse"))
|
||||||
s->toggle = USE_MOUSE;
|
s->toggle = USE_MOUSE;
|
||||||
#endif
|
#endif
|
||||||
else if (!strcmp(input, "suspendable") ||
|
|
||||||
!strcmp(input, "suspendenable")) /* Deprecated; remove in 2022. */
|
|
||||||
s->toggle = SUSPENDABLE;
|
|
||||||
else
|
else
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
{
|
{
|
||||||
@@ -491,6 +483,18 @@ keystruct *strtosc(const char *input)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define NUMBER_OF_MENUS 16
|
||||||
|
char *menunames[NUMBER_OF_MENUS] = { "main", "search", "replace", "replacewith",
|
||||||
|
"yesno", "gotoline", "writeout", "insert",
|
||||||
|
"execute", "help", "spell", "linter",
|
||||||
|
"browser", "whereisfile", "gotodir",
|
||||||
|
"all" };
|
||||||
|
int menusymbols[NUMBER_OF_MENUS] = { MMAIN, MWHEREIS, MREPLACE, MREPLACEWITH,
|
||||||
|
MYESNO, MGOTOLINE, MWRITEFILE, MINSERTFILE,
|
||||||
|
MEXECUTE, MHELP, MSPELL, MLINTER,
|
||||||
|
MBROWSER, MWHEREISFILE, MGOTODIR,
|
||||||
|
MMOST|MBROWSER|MHELP|MYESNO };
|
||||||
|
|
||||||
/* Return the symbol that corresponds to the given menu name. */
|
/* Return the symbol that corresponds to the given menu name. */
|
||||||
int name_to_menu(const char *name)
|
int name_to_menu(const char *name)
|
||||||
{
|
{
|
||||||
@@ -500,7 +504,7 @@ int name_to_menu(const char *name)
|
|||||||
if (strcmp(name, menunames[index]) == 0)
|
if (strcmp(name, menunames[index]) == 0)
|
||||||
return menusymbols[index];
|
return menusymbols[index];
|
||||||
|
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the name that corresponds to the given menu symbol. */
|
/* Return the name that corresponds to the given menu symbol. */
|
||||||
@@ -612,14 +616,12 @@ bool compile(const char *expression, int rex_flags, regex_t **packed)
|
|||||||
|
|
||||||
if (outcome != 0) {
|
if (outcome != 0) {
|
||||||
size_t length = regerror(outcome, compiled, NULL, 0);
|
size_t length = regerror(outcome, compiled, NULL, 0);
|
||||||
char *message = charalloc(length);
|
char *message = nmalloc(length);
|
||||||
|
|
||||||
regerror(outcome, compiled, message, length);
|
regerror(outcome, compiled, message, length);
|
||||||
jot_error(N_("Bad regex \"%s\": %s"), expression, message);
|
jot_error(N_("Bad regex \"%s\": %s"), expression, message);
|
||||||
free(message);
|
free(message);
|
||||||
}
|
|
||||||
|
|
||||||
if (packed == NULL || outcome != 0) {
|
|
||||||
regfree(compiled);
|
regfree(compiled);
|
||||||
free(compiled);
|
free(compiled);
|
||||||
} else
|
} else
|
||||||
@@ -662,7 +664,7 @@ void begin_new_syntax(char *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize a new syntax struct. */
|
/* Initialize a new syntax struct. */
|
||||||
live_syntax = (syntaxtype *)nmalloc(sizeof(syntaxtype));
|
live_syntax = nmalloc(sizeof(syntaxtype));
|
||||||
live_syntax->name = copy_of(nameptr);
|
live_syntax->name = copy_of(nameptr);
|
||||||
live_syntax->filename = copy_of(nanorc);
|
live_syntax->filename = copy_of(nanorc);
|
||||||
live_syntax->lineno = lineno;
|
live_syntax->lineno = lineno;
|
||||||
@@ -672,7 +674,7 @@ void begin_new_syntax(char *ptr)
|
|||||||
live_syntax->magics = NULL;
|
live_syntax->magics = NULL;
|
||||||
live_syntax->linter = NULL;
|
live_syntax->linter = NULL;
|
||||||
live_syntax->formatter = NULL;
|
live_syntax->formatter = NULL;
|
||||||
live_syntax->tab = NULL;
|
live_syntax->tabstring = NULL;
|
||||||
#ifdef ENABLE_COMMENT
|
#ifdef ENABLE_COMMENT
|
||||||
live_syntax->comment = copy_of(GENERAL_COMMENT_CHARACTER);
|
live_syntax->comment = copy_of(GENERAL_COMMENT_CHARACTER);
|
||||||
#endif
|
#endif
|
||||||
@@ -785,6 +787,12 @@ void parse_binding(char *ptr, bool dobind)
|
|||||||
goto free_things;
|
goto free_things;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menu = name_to_menu(menuptr);
|
||||||
|
if (menu == 0) {
|
||||||
|
jot_error(N_("Unknown menu: %s"), menuptr);
|
||||||
|
goto free_things;
|
||||||
|
}
|
||||||
|
|
||||||
if (dobind) {
|
if (dobind) {
|
||||||
/* If the thing to bind starts with a double quote, it is a string,
|
/* If the thing to bind starts with a double quote, it is a string,
|
||||||
* otherwise it is the name of a function. */
|
* otherwise it is the name of a function. */
|
||||||
@@ -799,17 +807,11 @@ void parse_binding(char *ptr, bool dobind)
|
|||||||
newsc = strtosc(funcptr);
|
newsc = strtosc(funcptr);
|
||||||
|
|
||||||
if (newsc == NULL) {
|
if (newsc == NULL) {
|
||||||
jot_error(N_("Cannot map name \"%s\" to a function"), funcptr);
|
jot_error(N_("Unknown function: %s"), funcptr);
|
||||||
goto free_things;
|
goto free_things;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
menu = name_to_menu(menuptr);
|
|
||||||
if (menu < 1) {
|
|
||||||
jot_error(N_("Cannot map name \"%s\" to a menu"), menuptr);
|
|
||||||
goto free_things;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wipe the given shortcut from the given menu. */
|
/* Wipe the given shortcut from the given menu. */
|
||||||
for (keystruct *s = sclist; s != NULL; s = s->next)
|
for (keystruct *s = sclist; s != NULL; s = s->next)
|
||||||
if ((s->menus & menu) && s->keycode == keycode)
|
if ((s->menus & menu) && s->keycode == keycode)
|
||||||
@@ -824,9 +826,9 @@ void parse_binding(char *ptr, bool dobind)
|
|||||||
if (is_universal(newsc->func))
|
if (is_universal(newsc->func))
|
||||||
menu &= MMOST|MBROWSER;
|
menu &= MMOST|MBROWSER;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (newsc->func == do_toggle_void && newsc->toggle == NO_HELP)
|
else if (newsc->func == do_toggle && newsc->toggle == NO_HELP)
|
||||||
menu &= (MMOST|MBROWSER|MYESNO) & ~MFINDINHELP;
|
menu &= (MMOST|MBROWSER|MYESNO) & ~MFINDINHELP;
|
||||||
else if (newsc->func == do_toggle_void)
|
else if (newsc->func == do_toggle)
|
||||||
menu &= MMAIN;
|
menu &= MMAIN;
|
||||||
#endif
|
#endif
|
||||||
else if (newsc->func == full_refresh)
|
else if (newsc->func == full_refresh)
|
||||||
@@ -864,9 +866,9 @@ void parse_binding(char *ptr, bool dobind)
|
|||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* If this is a toggle, find and copy its sequence number. */
|
/* If this is a toggle, find and copy its sequence number. */
|
||||||
if (newsc->func == do_toggle_void) {
|
if (newsc->func == do_toggle) {
|
||||||
for (keystruct *s = sclist; s != NULL; s = s->next)
|
for (keystruct *s = sclist; s != NULL; s = s->next)
|
||||||
if (s->func == do_toggle_void && s->toggle == newsc->toggle)
|
if (s->func == do_toggle && s->toggle == newsc->toggle)
|
||||||
newsc->ordinal = s->ordinal;
|
newsc->ordinal = s->ordinal;
|
||||||
} else
|
} else
|
||||||
newsc->ordinal = 0;
|
newsc->ordinal = 0;
|
||||||
@@ -897,7 +899,7 @@ bool is_good_file(char *file)
|
|||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
/* Partially parse the syntaxes in the given file, or (when syntax
|
/* Partially parse the syntaxes in the given file, or (when syntax
|
||||||
* is not NULL) fully parse one specific syntax from the file . */
|
* is not NULL) fully parse one specific syntax from the file. */
|
||||||
void parse_one_include(char *file, syntaxtype *syntax)
|
void parse_one_include(char *file, syntaxtype *syntax)
|
||||||
{
|
{
|
||||||
char *was_nanorc = nanorc;
|
char *was_nanorc = nanorc;
|
||||||
@@ -906,7 +908,7 @@ void parse_one_include(char *file, syntaxtype *syntax)
|
|||||||
FILE *rcstream;
|
FILE *rcstream;
|
||||||
|
|
||||||
/* Don't open directories, character files, or block files. */
|
/* Don't open directories, character files, or block files. */
|
||||||
if (!is_good_file(file))
|
if (access(file, R_OK) == 0 && !is_good_file(file))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rcstream = fopen(file, "rb");
|
rcstream = fopen(file, "rb");
|
||||||
@@ -974,7 +976,7 @@ void parse_includes(char *ptr)
|
|||||||
|
|
||||||
/* Expand a tilde first, then try to match the globbing pattern. */
|
/* Expand a tilde first, then try to match the globbing pattern. */
|
||||||
expanded = real_dir_from_tilde(pattern);
|
expanded = real_dir_from_tilde(pattern);
|
||||||
result = glob(expanded, GLOB_ERR, NULL, &files);
|
result = glob(expanded, GLOB_ERR|GLOB_NOCHECK, NULL, &files);
|
||||||
|
|
||||||
/* If there are matches, process each of them. Otherwise, only
|
/* If there are matches, process each of them. Otherwise, only
|
||||||
* report an error if it's something other than zero matches. */
|
* report an error if it's something other than zero matches. */
|
||||||
@@ -988,19 +990,52 @@ void parse_includes(char *ptr)
|
|||||||
free(expanded);
|
free(expanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char hues[9][7] = { "pink", "purple", "mauve", "lagoon", "mint",
|
/* Return the index of the color that is closest to the given RGB levels,
|
||||||
"lime", "peach", "orange", "latte" };
|
* assuming that the terminal uses the 6x6x6 color cube of xterm-256color. */
|
||||||
short indices[9] = { 204, 163, 134, 38, 48, 148, 215, 208, 137 };
|
short closest_index_color(short red, short green, short blue)
|
||||||
|
{
|
||||||
|
/* Translation table, from 16 intended levels to 6 available levels. */
|
||||||
|
static const short level[] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 };
|
||||||
|
|
||||||
|
if (COLORS == 256)
|
||||||
|
return (36 * level[red] + 6 * level[green] + level[blue] + 16);
|
||||||
|
else
|
||||||
|
return THE_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define COLORCOUNT 34
|
||||||
|
|
||||||
|
const char hues[COLORCOUNT][8] = { "red", "green", "blue",
|
||||||
|
"yellow", "cyan", "magenta",
|
||||||
|
"white", "black", "normal",
|
||||||
|
"pink", "purple", "mauve",
|
||||||
|
"lagoon", "mint", "lime",
|
||||||
|
"peach", "orange", "latte",
|
||||||
|
"rosy", "beet", "plum",
|
||||||
|
"sea", "sky", "slate",
|
||||||
|
"teal", "sage", "brown",
|
||||||
|
"ocher", "sand", "tawny",
|
||||||
|
"brick", "crimson",
|
||||||
|
"grey", "gray" };
|
||||||
|
|
||||||
|
short indices[COLORCOUNT] = { COLOR_RED, COLOR_GREEN, COLOR_BLUE,
|
||||||
|
COLOR_YELLOW, COLOR_CYAN, COLOR_MAGENTA,
|
||||||
|
COLOR_WHITE, COLOR_BLACK, THE_DEFAULT,
|
||||||
|
204, 163, 134, 38, 48, 148, 215, 208, 137,
|
||||||
|
175, 127, 98, 32, 111, 66, 35, 107, 100,
|
||||||
|
142, 186, 136, 166, 161,
|
||||||
|
COLOR_BLACK + 8, COLOR_BLACK + 8 };
|
||||||
|
|
||||||
/* Return the short value corresponding to the given color name, and set
|
/* Return the short value corresponding to the given color name, and set
|
||||||
* vivid to TRUE for a lighter color, and thick for a heavier typeface. */
|
* vivid to TRUE for a lighter color, and thick for a heavier typeface. */
|
||||||
short color_to_short(const char *colorname, bool *vivid, bool *thick)
|
short color_to_short(const char *colorname, bool *vivid, bool *thick)
|
||||||
{
|
{
|
||||||
if (strncmp(colorname, "bright", 6) == 0) { /* Deprecated; remove in 2023. */
|
if (strncmp(colorname, "bright", 6) == 0 && colorname[6] != '\0') {
|
||||||
|
/* Prefix "bright" is deprecated; remove in 2024. */
|
||||||
*vivid = TRUE;
|
*vivid = TRUE;
|
||||||
*thick = TRUE;
|
*thick = TRUE;
|
||||||
colorname += 6;
|
colorname += 6;
|
||||||
} else if (strncmp(colorname, "light", 5) == 0) {
|
} else if (strncmp(colorname, "light", 5) == 0 && colorname[5] != '\0') {
|
||||||
*vivid = TRUE;
|
*vivid = TRUE;
|
||||||
*thick = FALSE;
|
*thick = FALSE;
|
||||||
colorname += 5;
|
colorname += 5;
|
||||||
@@ -1009,35 +1044,28 @@ short color_to_short(const char *colorname, bool *vivid, bool *thick)
|
|||||||
*thick = FALSE;
|
*thick = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(colorname, "green") == 0)
|
if (colorname[0] == '#' && strlen(colorname) == 4) {
|
||||||
return COLOR_GREEN;
|
unsigned short r, g, b;
|
||||||
else if (strcmp(colorname, "red") == 0)
|
|
||||||
return COLOR_RED;
|
if (*vivid) {
|
||||||
else if (strcmp(colorname, "blue") == 0)
|
jot_error(N_("Color '%s' takes no prefix"), colorname);
|
||||||
return COLOR_BLUE;
|
return BAD_COLOR;
|
||||||
else if (strcmp(colorname, "white") == 0)
|
}
|
||||||
return COLOR_WHITE;
|
|
||||||
else if (strcmp(colorname, "yellow") == 0)
|
if (sscanf(colorname, "#%1hX%1hX%1hX", &r, &g, &b) == 3)
|
||||||
return COLOR_YELLOW;
|
return closest_index_color(r, g, b);
|
||||||
else if (strcmp(colorname, "cyan") == 0)
|
}
|
||||||
return COLOR_CYAN;
|
|
||||||
else if (strcmp(colorname, "magenta") == 0)
|
for (int index = 0; index < COLORCOUNT; index++)
|
||||||
return COLOR_MAGENTA;
|
if (strcmp(colorname, hues[index]) == 0) {
|
||||||
else if (strcmp(colorname, "black") == 0)
|
if (index > 7 && *vivid) {
|
||||||
return COLOR_BLACK;
|
jot_error(N_("Color '%s' takes no prefix"), colorname);
|
||||||
else if (strcmp(colorname, "normal") == 0)
|
return BAD_COLOR;
|
||||||
return THE_DEFAULT;
|
} else if (index > 8 && COLORS < 255)
|
||||||
else
|
return THE_DEFAULT;
|
||||||
for (int index = 0; index < 9; index++)
|
else
|
||||||
if (strcmp(colorname, hues[index]) == 0) {
|
return indices[index];
|
||||||
if (*vivid) {
|
}
|
||||||
jot_error(N_("Color '%s' takes no prefix"), colorname);
|
|
||||||
return BAD_COLOR;
|
|
||||||
} else if (COLORS < 255)
|
|
||||||
return THE_DEFAULT;
|
|
||||||
else
|
|
||||||
return indices[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
jot_error(N_("Color \"%s\" not understood"), colorname);
|
jot_error(N_("Color \"%s\" not understood"), colorname);
|
||||||
return BAD_COLOR;
|
return BAD_COLOR;
|
||||||
@@ -1165,7 +1193,7 @@ void parse_rule(char *ptr, int rex_flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a rule, fill in the data, and link it into the list. */
|
/* Allocate a rule, fill in the data, and link it into the list. */
|
||||||
newcolor = (colortype *)nmalloc(sizeof(colortype));
|
newcolor = nmalloc(sizeof(colortype));
|
||||||
|
|
||||||
newcolor->start = start_rgx;
|
newcolor->start = start_rgx;
|
||||||
newcolor->end = end_rgx;
|
newcolor->end = end_rgx;
|
||||||
@@ -1195,14 +1223,11 @@ colortype *parse_interface_color(char *combostr)
|
|||||||
{
|
{
|
||||||
colortype *trio = nmalloc(sizeof(colortype));
|
colortype *trio = nmalloc(sizeof(colortype));
|
||||||
|
|
||||||
if (parse_combination(combostr, &trio->fg, &trio->bg, &trio->attributes)) {
|
if (!parse_combination(combostr, &trio->fg, &trio->bg, &trio->attributes)) {
|
||||||
free(combostr);
|
|
||||||
return trio;
|
|
||||||
} else {
|
|
||||||
free(combostr);
|
|
||||||
free(trio);
|
free(trio);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
} else
|
||||||
|
return trio;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read regex strings enclosed in double quotes from the line pointed at
|
/* Read regex strings enclosed in double quotes from the line pointed at
|
||||||
@@ -1236,6 +1261,8 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
|
|||||||
|
|
||||||
/* Now gather any valid regexes and add them to the linked list. */
|
/* Now gather any valid regexes and add them to the linked list. */
|
||||||
while (*ptr != '\0') {
|
while (*ptr != '\0') {
|
||||||
|
regex_t *packed_rgx = NULL;
|
||||||
|
|
||||||
regexstring = ++ptr;
|
regexstring = ++ptr;
|
||||||
ptr = parse_next_regex(ptr);
|
ptr = parse_next_regex(ptr);
|
||||||
|
|
||||||
@@ -1243,12 +1270,12 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* If the regex string is malformed, skip it. */
|
/* If the regex string is malformed, skip it. */
|
||||||
if (!compile(regexstring, NANO_REG_EXTENDED | REG_NOSUB, NULL))
|
if (!compile(regexstring, NANO_REG_EXTENDED | REG_NOSUB, &packed_rgx))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Copy the regex into a struct, and hook this in at the end. */
|
/* Copy the regex into a struct, and hook this in at the end. */
|
||||||
newthing = (regexlisttype *)nmalloc(sizeof(regexlisttype));
|
newthing = nmalloc(sizeof(regexlisttype));
|
||||||
newthing->full_regex = copy_of(regexstring);
|
newthing->one_rgx = packed_rgx;
|
||||||
newthing->next = NULL;
|
newthing->next = NULL;
|
||||||
|
|
||||||
if (lastthing == NULL)
|
if (lastthing == NULL)
|
||||||
@@ -1298,7 +1325,7 @@ bool parse_syntax_commands(char *keyword, char *ptr)
|
|||||||
pick_up_name("comment", ptr, &live_syntax->comment);
|
pick_up_name("comment", ptr, &live_syntax->comment);
|
||||||
#endif
|
#endif
|
||||||
} else if (strcmp(keyword, "tabgives") == 0) {
|
} else if (strcmp(keyword, "tabgives") == 0) {
|
||||||
pick_up_name("tabgives", ptr, &live_syntax->tab);
|
pick_up_name("tabgives", ptr, &live_syntax->tabstring);
|
||||||
} else if (strcmp(keyword, "linter") == 0)
|
} else if (strcmp(keyword, "linter") == 0)
|
||||||
pick_up_name("linter", ptr, &live_syntax->linter);
|
pick_up_name("linter", ptr, &live_syntax->linter);
|
||||||
else if (strcmp(keyword, "formatter") == 0)
|
else if (strcmp(keyword, "formatter") == 0)
|
||||||
@@ -1323,7 +1350,7 @@ static void check_vitals_mapped(void)
|
|||||||
if (f->func == vitals[v] && f->menus & inmenus[v]) {
|
if (f->func == vitals[v] && f->menus & inmenus[v]) {
|
||||||
if (first_sc_for(inmenus[v], f->func) == NULL) {
|
if (first_sc_for(inmenus[v], f->func) == NULL) {
|
||||||
jot_error(N_("No key is bound to function '%s' in menu '%s'. "
|
jot_error(N_("No key is bound to function '%s' in menu '%s'. "
|
||||||
" Exiting.\n"), f->desc, menu_to_name(inmenus[v]));
|
" Exiting.\n"), f->tag, menu_to_name(inmenus[v]));
|
||||||
die(_("If needed, use nano with the -I option "
|
die(_("If needed, use nano with the -I option "
|
||||||
"to adjust your nanorc settings.\n"));
|
"to adjust your nanorc settings.\n"));
|
||||||
} else
|
} else
|
||||||
@@ -1505,7 +1532,7 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rcopts[i].name == NULL) {
|
if (rcopts[i].name == NULL) {
|
||||||
jot_error(N_("Unknown option \"%s\""), option);
|
jot_error(N_("Unknown option: %s"), option);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1541,8 +1568,6 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
argument = copy_of(argument);
|
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
if (strcmp(option, "titlecolor") == 0)
|
if (strcmp(option, "titlecolor") == 0)
|
||||||
color_combo[TITLE_BAR] = parse_interface_color(argument);
|
color_combo[TITLE_BAR] = parse_interface_color(argument);
|
||||||
@@ -1550,8 +1575,16 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
|
|||||||
color_combo[LINE_NUMBER] = parse_interface_color(argument);
|
color_combo[LINE_NUMBER] = parse_interface_color(argument);
|
||||||
else if (strcmp(option, "stripecolor") == 0)
|
else if (strcmp(option, "stripecolor") == 0)
|
||||||
color_combo[GUIDE_STRIPE] = parse_interface_color(argument);
|
color_combo[GUIDE_STRIPE] = parse_interface_color(argument);
|
||||||
|
else if (strcmp(option, "scrollercolor") == 0)
|
||||||
|
color_combo[SCROLL_BAR] = parse_interface_color(argument);
|
||||||
else if (strcmp(option, "selectedcolor") == 0)
|
else if (strcmp(option, "selectedcolor") == 0)
|
||||||
color_combo[SELECTED_TEXT] = parse_interface_color(argument);
|
color_combo[SELECTED_TEXT] = parse_interface_color(argument);
|
||||||
|
else if (strcmp(option, "spotlightcolor") == 0)
|
||||||
|
color_combo[SPOTLIGHTED] = parse_interface_color(argument);
|
||||||
|
else if (strcmp(option, "minicolor") == 0)
|
||||||
|
color_combo[MINI_INFOBAR] = parse_interface_color(argument);
|
||||||
|
else if (strcmp(option, "promptcolor") == 0)
|
||||||
|
color_combo[PROMPT_BAR] = parse_interface_color(argument);
|
||||||
else if (strcmp(option, "statuscolor") == 0)
|
else if (strcmp(option, "statuscolor") == 0)
|
||||||
color_combo[STATUS_BAR] = parse_interface_color(argument);
|
color_combo[STATUS_BAR] = parse_interface_color(argument);
|
||||||
else if (strcmp(option, "errorcolor") == 0)
|
else if (strcmp(option, "errorcolor") == 0)
|
||||||
@@ -1564,7 +1597,7 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_OPERATINGDIR
|
#ifdef ENABLE_OPERATINGDIR
|
||||||
if (strcmp(option, "operatingdir") == 0)
|
if (strcmp(option, "operatingdir") == 0)
|
||||||
operating_dir = argument;
|
operating_dir = mallocstrcpy(operating_dir, argument);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLED_WRAPORJUSTIFY
|
#ifdef ENABLED_WRAPORJUSTIFY
|
||||||
@@ -1573,31 +1606,21 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
|
|||||||
jot_error(N_("Requested fill size \"%s\" is invalid"), argument);
|
jot_error(N_("Requested fill size \"%s\" is invalid"), argument);
|
||||||
fill = -COLUMNS_FROM_EOL;
|
fill = -COLUMNS_FROM_EOL;
|
||||||
}
|
}
|
||||||
free(argument);
|
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (strcmp(option, "guidestripe") == 0) {
|
if (strcmp(option, "matchbrackets") == 0) {
|
||||||
if (!parse_num(argument, &stripe_column) || stripe_column <= 0) {
|
if (has_blank_char(argument))
|
||||||
jot_error(N_("Guide column \"%s\" is invalid"), argument);
|
|
||||||
stripe_column = 0;
|
|
||||||
}
|
|
||||||
free(argument);
|
|
||||||
} else if (strcmp(option, "matchbrackets") == 0) {
|
|
||||||
if (has_blank_char(argument)) {
|
|
||||||
jot_error(N_("Non-blank characters required"));
|
jot_error(N_("Non-blank characters required"));
|
||||||
free(argument);
|
else if (mbstrlen(argument) % 2 != 0)
|
||||||
} else if (mbstrlen(argument) % 2 != 0) {
|
|
||||||
jot_error(N_("Even number of characters required"));
|
jot_error(N_("Even number of characters required"));
|
||||||
free(argument);
|
else
|
||||||
} else
|
matchbrackets = mallocstrcpy(matchbrackets, argument);
|
||||||
matchbrackets = argument;
|
|
||||||
} else if (strcmp(option, "whitespace") == 0) {
|
} else if (strcmp(option, "whitespace") == 0) {
|
||||||
if (mbstrlen(argument) != 2 || breadth(argument) != 2) {
|
if (mbstrlen(argument) != 2 || breadth(argument) != 2)
|
||||||
jot_error(N_("Two single-column characters required"));
|
jot_error(N_("Two single-column characters required"));
|
||||||
free(argument);
|
else {
|
||||||
} else {
|
whitespace = mallocstrcpy(whitespace, argument);
|
||||||
whitespace = argument;
|
|
||||||
whitelen[0] = char_length(whitespace);
|
whitelen[0] = char_length(whitespace);
|
||||||
whitelen[1] = char_length(whitespace + whitelen[0]);
|
whitelen[1] = char_length(whitespace + whitelen[0]);
|
||||||
}
|
}
|
||||||
@@ -1605,41 +1628,43 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_JUSTIFY
|
#ifdef ENABLE_JUSTIFY
|
||||||
if (strcmp(option, "punct") == 0) {
|
if (strcmp(option, "punct") == 0) {
|
||||||
if (has_blank_char(argument)) {
|
if (has_blank_char(argument))
|
||||||
jot_error(N_("Non-blank characters required"));
|
jot_error(N_("Non-blank characters required"));
|
||||||
free(argument);
|
else
|
||||||
} else
|
punct = mallocstrcpy(punct, argument);
|
||||||
punct = argument;
|
|
||||||
} else if (strcmp(option, "brackets") == 0) {
|
} else if (strcmp(option, "brackets") == 0) {
|
||||||
if (has_blank_char(argument)) {
|
if (has_blank_char(argument))
|
||||||
jot_error(N_("Non-blank characters required"));
|
jot_error(N_("Non-blank characters required"));
|
||||||
free(argument);
|
else
|
||||||
} else
|
brackets = mallocstrcpy(brackets, argument);
|
||||||
brackets = argument;
|
|
||||||
} else if (strcmp(option, "quotestr") == 0)
|
} else if (strcmp(option, "quotestr") == 0)
|
||||||
quotestr = argument;
|
quotestr = mallocstrcpy(quotestr, argument);
|
||||||
else
|
|
||||||
#endif
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
if (strcmp(option, "backupdir") == 0)
|
|
||||||
backup_dir = argument;
|
|
||||||
else
|
|
||||||
if (strcmp(option, "wordchars") == 0)
|
|
||||||
word_chars = argument;
|
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_SPELLER
|
#ifdef ENABLE_SPELLER
|
||||||
if (strcmp(option, "speller") == 0)
|
if (strcmp(option, "speller") == 0)
|
||||||
alt_speller = argument;
|
alt_speller = mallocstrcpy(alt_speller, argument);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (strcmp(option, "tabsize") == 0) {
|
#ifndef NANO_TINY
|
||||||
|
if (strcmp(option, "backupdir") == 0)
|
||||||
|
backup_dir = mallocstrcpy(backup_dir, argument);
|
||||||
|
else if (strcmp(option, "wordchars") == 0)
|
||||||
|
word_chars = mallocstrcpy(word_chars, argument);
|
||||||
|
else if (strcmp(option, "guidestripe") == 0) {
|
||||||
|
if (!parse_num(argument, &stripe_column) || stripe_column <= 0) {
|
||||||
|
jot_error(N_("Guide column \"%s\" is invalid"), argument);
|
||||||
|
stripe_column = 0;
|
||||||
|
}
|
||||||
|
} else if (strcmp(option, "tabsize") == 0) {
|
||||||
if (!parse_num(argument, &tabsize) || tabsize <= 0) {
|
if (!parse_num(argument, &tabsize) || tabsize <= 0) {
|
||||||
jot_error(N_("Requested tab size \"%s\" is invalid"), argument);
|
jot_error(N_("Requested tab size \"%s\" is invalid"), argument);
|
||||||
tabsize = -1;
|
tabsize = -1;
|
||||||
}
|
}
|
||||||
free(argument);
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
; /* Properly terminate any earlier 'else'. */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intros_only)
|
if (intros_only)
|
||||||
@@ -1682,7 +1707,7 @@ void do_rcfiles(void)
|
|||||||
{
|
{
|
||||||
if (custom_nanorc) {
|
if (custom_nanorc) {
|
||||||
nanorc = get_full_path(custom_nanorc);
|
nanorc = get_full_path(custom_nanorc);
|
||||||
if (access(nanorc, F_OK) != 0)
|
if (nanorc == NULL || access(nanorc, F_OK) != 0)
|
||||||
die(_("Specified rcfile does not exist\n"));
|
die(_("Specified rcfile does not exist\n"));
|
||||||
} else
|
} else
|
||||||
nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");
|
nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");
|
||||||
|
|||||||
532
src/search.c
532
src/search.c
@@ -1,8 +1,8 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* search.c -- This file is part of GNU nano. *
|
* search.c -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 1999-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* Copyright (C) 2015-2019 Benno Schulenberg *
|
* Copyright (C) 2015-2020, 2022 Benno Schulenberg *
|
||||||
* *
|
* *
|
||||||
* GNU nano is free software: you can redistribute it and/or modify *
|
* GNU nano is free software: you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published *
|
* it under the terms of the GNU General Public License as published *
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
static bool came_full_circle = FALSE;
|
static bool came_full_circle = FALSE;
|
||||||
/* Have we reached the starting line again while searching? */
|
/* Have we reached the starting line again while searching? */
|
||||||
@@ -38,10 +39,10 @@ bool regexp_init(const char *regexp)
|
|||||||
/* If regex compilation failed, show the error message. */
|
/* If regex compilation failed, show the error message. */
|
||||||
if (value != 0) {
|
if (value != 0) {
|
||||||
size_t len = regerror(value, &search_regexp, NULL, 0);
|
size_t len = regerror(value, &search_regexp, NULL, 0);
|
||||||
char *str = charalloc(len);
|
char *str = nmalloc(len);
|
||||||
|
|
||||||
regerror(value, &search_regexp, str, len);
|
regerror(value, &search_regexp, str, len);
|
||||||
statusline(ALERT, _("Bad regex \"%s\": %s"), regexp, str);
|
statusline(AHEM, _("Bad regex \"%s\": %s"), regexp, str);
|
||||||
free(str);
|
free(str);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -64,6 +65,9 @@ void tidy_up_after_search(void)
|
|||||||
if (openfile->mark)
|
if (openfile->mark)
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
recook |= perturbed;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare the prompt and ask the user what to search for. Keep looping
|
/* Prepare the prompt and ask the user what to search for. Keep looping
|
||||||
@@ -78,16 +82,16 @@ void search_init(bool replacing, bool retain_answer)
|
|||||||
if (*last_search != '\0') {
|
if (*last_search != '\0') {
|
||||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE, FALSE);
|
char *disp = display_string(last_search, 0, COLS / 3, FALSE, FALSE);
|
||||||
|
|
||||||
thedefault = charalloc(strlen(disp) + 7);
|
thedefault = nmalloc(strlen(disp) + 7);
|
||||||
/* We use (COLS / 3) here because we need to see more on the line. */
|
/* We use (COLS / 3) here because we need to see more on the line. */
|
||||||
sprintf(thedefault, " [%s%s]", disp,
|
sprintf(thedefault, " [%s%s]", disp,
|
||||||
(breadth(last_search) > COLS / 3) ? "..." : "");
|
(breadth(last_search) > COLS / 3) ? "..." : "");
|
||||||
free(disp);
|
free(disp);
|
||||||
} else
|
} else
|
||||||
thedefault = copy_of("");
|
thedefault = copy_of("");
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
functionptrtype func;
|
functionptrtype function;
|
||||||
/* Ask the user what to search for (or replace). */
|
/* Ask the user what to search for (or replace). */
|
||||||
int response = do_prompt(
|
int response = do_prompt(
|
||||||
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
|
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
|
||||||
@@ -117,7 +121,7 @@ void search_init(bool replacing, bool retain_answer)
|
|||||||
if (*answer != '\0') {
|
if (*answer != '\0') {
|
||||||
last_search = mallocstrcpy(last_search, answer);
|
last_search = mallocstrcpy(last_search, answer);
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
update_history(&search_history, answer);
|
update_history(&search_history, answer, PRUNE_DUPLICATE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,24 +136,26 @@ void search_init(bool replacing, bool retain_answer)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
func = func_from_key(&response);
|
retain_answer = TRUE;
|
||||||
|
|
||||||
|
function = func_from_key(response);
|
||||||
|
|
||||||
/* If we're here, one of the five toggles was pressed, or
|
/* If we're here, one of the five toggles was pressed, or
|
||||||
* a shortcut was executed. */
|
* a shortcut was executed. */
|
||||||
if (func == case_sens_void)
|
if (function == case_sens_void)
|
||||||
TOGGLE(CASE_SENSITIVE);
|
TOGGLE(CASE_SENSITIVE);
|
||||||
else if (func == backwards_void)
|
else if (function == backwards_void)
|
||||||
TOGGLE(BACKWARDS_SEARCH);
|
TOGGLE(BACKWARDS_SEARCH);
|
||||||
else if (func == regexp_void)
|
else if (function == regexp_void)
|
||||||
TOGGLE(USE_REGEXP);
|
TOGGLE(USE_REGEXP);
|
||||||
else if (func == flip_replace) {
|
else if (function == flip_replace) {
|
||||||
if (ISSET(VIEW_MODE)) {
|
if (ISSET(VIEW_MODE)) {
|
||||||
print_view_warning();
|
print_view_warning();
|
||||||
napms(600);
|
napms(600);
|
||||||
} else
|
} else
|
||||||
replacing = !replacing;
|
replacing = !replacing;
|
||||||
} else if (func == flip_goto) {
|
} else if (function == flip_goto) {
|
||||||
do_gotolinecolumn(openfile->current->lineno,
|
goto_line_and_column(openfile->current->lineno,
|
||||||
openfile->placewewant + 1, TRUE, TRUE);
|
openfile->placewewant + 1, TRUE, TRUE);
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
@@ -183,35 +189,12 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
|||||||
/* The time we last looked at the keyboard. */
|
/* The time we last looked at the keyboard. */
|
||||||
|
|
||||||
/* Set non-blocking input so that we can just peek for a Cancel. */
|
/* Set non-blocking input so that we can just peek for a Cancel. */
|
||||||
disable_waiting();
|
nodelay(midwin, TRUE);
|
||||||
|
|
||||||
if (begin == NULL)
|
if (begin == NULL)
|
||||||
came_full_circle = FALSE;
|
came_full_circle = FALSE;
|
||||||
|
|
||||||
/* Start searching through the lines, looking for the needle. */
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
/* Glance at the keyboard once every second. */
|
|
||||||
if (time(NULL) - lastkbcheck > 0) {
|
|
||||||
int input = parse_kbinput(edit);
|
|
||||||
|
|
||||||
lastkbcheck = time(NULL);
|
|
||||||
|
|
||||||
/* Consume all waiting keystrokes until a Cancel. */
|
|
||||||
while (input != ERR) {
|
|
||||||
if (func_from_key(&input) == do_cancel) {
|
|
||||||
statusbar(_("Cancelled"));
|
|
||||||
enable_waiting();
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
input = parse_kbinput(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (++feedback > 0)
|
|
||||||
/* TRANSLATORS: This is shown when searching takes
|
|
||||||
* more than half a second. */
|
|
||||||
statusbar(_("Searching..."));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* When starting a new search, skip the first character, then
|
/* When starting a new search, skip the first character, then
|
||||||
* (in either case) search for the needle in the current line. */
|
* (in either case) search for the needle in the current line. */
|
||||||
if (skipone) {
|
if (skipone) {
|
||||||
@@ -239,37 +222,40 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* The match is valid. */
|
/* When not on the magic line, the match is valid. */
|
||||||
break;
|
if (line->next || line->data[0])
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
if (the_window_resized) {
|
||||||
|
regenerate_screen();
|
||||||
|
nodelay(midwin, TRUE);
|
||||||
|
statusbar(_("Searching..."));
|
||||||
|
feedback = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* If we're back at the beginning, then there is no needle. */
|
/* If we're back at the beginning, then there is no needle. */
|
||||||
if (came_full_circle) {
|
if (came_full_circle) {
|
||||||
enable_waiting();
|
nodelay(midwin, FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move to the previous or next line in the file. */
|
/* Move to the previous or next line in the file. */
|
||||||
if (ISSET(BACKWARDS_SEARCH))
|
line = (ISSET(BACKWARDS_SEARCH)) ? line->prev : line->next;
|
||||||
line = line->prev;
|
|
||||||
else
|
|
||||||
line = line->next;
|
|
||||||
|
|
||||||
/* If we've reached the start or end of the buffer, wrap around;
|
/* If we've reached the start or end of the buffer, wrap around;
|
||||||
* but stop when spell-checking or replacing in a region. */
|
* but stop when spell-checking or replacing in a region. */
|
||||||
if (line == NULL) {
|
if (line == NULL) {
|
||||||
if (whole_word_only || modus == INREGION) {
|
if (whole_word_only || modus == INREGION) {
|
||||||
enable_waiting();
|
nodelay(midwin, FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISSET(BACKWARDS_SEARCH))
|
line = (ISSET(BACKWARDS_SEARCH)) ? openfile->filebot : openfile->filetop;
|
||||||
line = openfile->filebot;
|
|
||||||
else
|
|
||||||
line = openfile->filetop;
|
|
||||||
|
|
||||||
if (modus == JUSTFIND) {
|
if (modus == JUSTFIND) {
|
||||||
statusbar(_("Search Wrapped"));
|
statusline(REMARK, _("Search Wrapped"));
|
||||||
/* Delay the "Searching..." message for at least two seconds. */
|
/* Delay the "Searching..." message for at least two seconds. */
|
||||||
feedback = -2;
|
feedback = -2;
|
||||||
}
|
}
|
||||||
@@ -283,11 +269,50 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
|||||||
from = line->data;
|
from = line->data;
|
||||||
if (ISSET(BACKWARDS_SEARCH))
|
if (ISSET(BACKWARDS_SEARCH))
|
||||||
from += strlen(line->data);
|
from += strlen(line->data);
|
||||||
|
|
||||||
|
/* Glance at the keyboard once every second, to check for a Cancel. */
|
||||||
|
if (time(NULL) - lastkbcheck > 0) {
|
||||||
|
int input = wgetch(midwin);
|
||||||
|
|
||||||
|
lastkbcheck = time(NULL);
|
||||||
|
|
||||||
|
/* Consume any queued-up keystrokes, until a Cancel or nothing. */
|
||||||
|
while (input != ERR) {
|
||||||
|
if (input == ESC_CODE) {
|
||||||
|
napms(20);
|
||||||
|
input = wgetch(midwin);
|
||||||
|
meta_key = TRUE;
|
||||||
|
} else
|
||||||
|
meta_key = FALSE;
|
||||||
|
|
||||||
|
if (func_from_key(input) == do_cancel) {
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
if (the_window_resized)
|
||||||
|
regenerate_screen();
|
||||||
|
#endif
|
||||||
|
statusbar(_("Cancelled"));
|
||||||
|
/* Clear out the key buffer (in case a macro is running). */
|
||||||
|
while (input != ERR)
|
||||||
|
input = get_input(NULL);
|
||||||
|
nodelay(midwin, FALSE);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
input = wgetch(midwin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (++feedback > 0)
|
||||||
|
/* TRANSLATORS: This is shown when searching takes
|
||||||
|
* more than half a second. */
|
||||||
|
statusbar(_("Searching..."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UNFOLD_SEGMENT(line);
|
||||||
|
|
||||||
found_x = found - line->data;
|
found_x = found - line->data;
|
||||||
|
|
||||||
enable_waiting();
|
nodelay(midwin, FALSE);
|
||||||
|
|
||||||
/* Ensure that the found occurrence is not beyond the starting x. */
|
/* Ensure that the found occurrence is not beyond the starting x. */
|
||||||
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && (found_x > begin_x ||
|
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && (found_x > begin_x ||
|
||||||
@@ -303,11 +328,17 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
|||||||
if (match_len != NULL)
|
if (match_len != NULL)
|
||||||
*match_len = found_len;
|
*match_len = found_len;
|
||||||
|
|
||||||
/* Wipe the "Searching..." message and unsuppress cursor-position display. */
|
#ifndef NANO_TINY
|
||||||
if (feedback > 0) {
|
if (modus == JUSTFIND && (!openfile->mark || openfile->softmark)) {
|
||||||
wipe_statusbar();
|
spotlighted = TRUE;
|
||||||
lastmessage = VACUUM;
|
light_from_col = xplustabs();
|
||||||
|
light_to_col = wideness(line->data, found_x + found_len);
|
||||||
|
refresh_needed = TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (feedback > 0)
|
||||||
|
wipe_statusbar();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -337,7 +368,7 @@ void do_research(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (*last_search == '\0') {
|
if (*last_search == '\0') {
|
||||||
statusbar(_("No current search pattern"));
|
statusline(AHEM, _("No current search pattern"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,7 +378,8 @@ void do_research(void)
|
|||||||
/* Use the search-menu key bindings, to allow cancelling. */
|
/* Use the search-menu key bindings, to allow cancelling. */
|
||||||
currmenu = MWHEREIS;
|
currmenu = MWHEREIS;
|
||||||
|
|
||||||
wipe_statusbar();
|
if (LINES > 1)
|
||||||
|
wipe_statusbar();
|
||||||
|
|
||||||
go_looking();
|
go_looking();
|
||||||
|
|
||||||
@@ -374,7 +406,7 @@ void not_found_msg(const char *str)
|
|||||||
char *disp = display_string(str, 0, (COLS / 2) + 1, FALSE, FALSE);
|
char *disp = display_string(str, 0, (COLS / 2) + 1, FALSE, FALSE);
|
||||||
size_t numchars = actual_x(disp, wideness(disp, COLS / 2));
|
size_t numchars = actual_x(disp, wideness(disp, COLS / 2));
|
||||||
|
|
||||||
statusline(HUSH, _("\"%.*s%s\" not found"), numchars, disp,
|
statusline(AHEM, _("\"%.*s%s\" not found"), numchars, disp,
|
||||||
(disp[numchars] == '\0') ? "" : "...");
|
(disp[numchars] == '\0') ? "" : "...");
|
||||||
free(disp);
|
free(disp);
|
||||||
}
|
}
|
||||||
@@ -400,13 +432,13 @@ void go_looking(void)
|
|||||||
/* If we found something, and we're back at the exact same spot
|
/* If we found something, and we're back at the exact same spot
|
||||||
* where we started searching, then this is the only occurrence. */
|
* where we started searching, then this is the only occurrence. */
|
||||||
if (didfind == 1 && openfile->current == was_current &&
|
if (didfind == 1 && openfile->current == was_current &&
|
||||||
openfile->current_x == was_current_x)
|
openfile->current_x == was_current_x)
|
||||||
statusbar(_("This is the only occurrence"));
|
statusline(REMARK, _("This is the only occurrence"));
|
||||||
else if (didfind == 0)
|
else if (didfind == 0)
|
||||||
not_found_msg(last_search);
|
not_found_msg(last_search);
|
||||||
|
|
||||||
#ifdef TIMEIT
|
#ifdef TIMEIT
|
||||||
statusline(HUSH, "Took: %.2f", (double)(clock() - start) / CLOCKS_PER_SEC);
|
statusline(INFO, "Took: %.2f", (double)(clock() - start) / CLOCKS_PER_SEC);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
edit_redraw(was_current, CENTERING);
|
edit_redraw(was_current, CENTERING);
|
||||||
@@ -417,8 +449,8 @@ void go_looking(void)
|
|||||||
* text in the passed string only when create is TRUE. */
|
* text in the passed string only when create is TRUE. */
|
||||||
int replace_regexp(char *string, bool create)
|
int replace_regexp(char *string, bool create)
|
||||||
{
|
{
|
||||||
const char *c = answer;
|
|
||||||
size_t replacement_size = 0;
|
size_t replacement_size = 0;
|
||||||
|
const char *c = answer;
|
||||||
|
|
||||||
/* Iterate through the replacement text to handle subexpression
|
/* Iterate through the replacement text to handle subexpression
|
||||||
* replacement using \1, \2, \3, etc. */
|
* replacement using \1, \2, \3, etc. */
|
||||||
@@ -442,8 +474,7 @@ int replace_regexp(char *string, bool create)
|
|||||||
/* And if create is TRUE, append the result of the
|
/* And if create is TRUE, append the result of the
|
||||||
* subexpression match to the new line. */
|
* subexpression match to the new line. */
|
||||||
if (create) {
|
if (create) {
|
||||||
strncpy(string, openfile->current->data +
|
strncpy(string, openfile->current->data + regmatches[num].rm_so, i);
|
||||||
regmatches[num].rm_so, i);
|
|
||||||
string += i;
|
string += i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -471,7 +502,7 @@ char *replace_line(const char *needle)
|
|||||||
new_size += strlen(answer) - match_len;
|
new_size += strlen(answer) - match_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
copy = charalloc(new_size);
|
copy = nmalloc(new_size);
|
||||||
|
|
||||||
/* Copy the head of the original line. */
|
/* Copy the head of the original line. */
|
||||||
strncpy(copy, openfile->current->data, openfile->current_x);
|
strncpy(copy, openfile->current->data, openfile->current_x);
|
||||||
@@ -488,18 +519,6 @@ char *replace_line(const char *needle)
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
|
||||||
/* Reset the multiline coloring info and then recalculate it. */
|
|
||||||
void wipe_and_recalculate_colorinfo(void)
|
|
||||||
{
|
|
||||||
for (linestruct *line = openfile->filetop; line != NULL; line = line->next)
|
|
||||||
for (short index = 0; index < openfile->syntax->nmultis; index++)
|
|
||||||
line->multidata[index] = -1;
|
|
||||||
|
|
||||||
precalc_multicolorinfo();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Step through each occurrence of the search string and prompt the user
|
/* Step through each occurrence of the search string and prompt the user
|
||||||
* before replacing it. We seek for needle, and replace it with answer.
|
* before replacing it. We seek for needle, and replace it with answer.
|
||||||
* The parameters real_current and real_current_x are needed in order to
|
* The parameters real_current and real_current_x are needed in order to
|
||||||
@@ -509,11 +528,11 @@ void wipe_and_recalculate_colorinfo(void)
|
|||||||
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||||
const linestruct *real_current, size_t *real_current_x)
|
const linestruct *real_current, size_t *real_current_x)
|
||||||
{
|
{
|
||||||
|
bool skipone = ISSET(BACKWARDS_SEARCH);
|
||||||
|
bool replaceall = FALSE;
|
||||||
|
int modus = REPLACING;
|
||||||
ssize_t numreplaced = -1;
|
ssize_t numreplaced = -1;
|
||||||
size_t match_len;
|
size_t match_len;
|
||||||
bool replaceall = FALSE;
|
|
||||||
bool skipone = ISSET(BACKWARDS_SEARCH);
|
|
||||||
int modus = REPLACING;
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
linestruct *was_mark = openfile->mark;
|
linestruct *was_mark = openfile->mark;
|
||||||
linestruct *top, *bot;
|
linestruct *top, *bot;
|
||||||
@@ -535,12 +554,12 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
|||||||
openfile->current_x = bot_x;
|
openfile->current_x = bot_x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif
|
||||||
|
|
||||||
came_full_circle = FALSE;
|
came_full_circle = FALSE;
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
int choice = 0;
|
int choice = NO;
|
||||||
int result = findnextstr(needle, whole_word_only, modus,
|
int result = findnextstr(needle, whole_word_only, modus,
|
||||||
&match_len, skipone, real_current, *real_current_x);
|
&match_len, skipone, real_current, *real_current_x);
|
||||||
|
|
||||||
@@ -576,32 +595,31 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
|||||||
edit_refresh();
|
edit_refresh();
|
||||||
|
|
||||||
/* TRANSLATORS: This is a prompt. */
|
/* TRANSLATORS: This is a prompt. */
|
||||||
choice = do_yesno_prompt(TRUE, _("Replace this instance?"));
|
choice = ask_user(YESORALLORNO, _("Replace this instance?"));
|
||||||
|
|
||||||
spotlighted = FALSE;
|
spotlighted = FALSE;
|
||||||
|
|
||||||
if (choice == -1) /* The replacing was cancelled. */
|
if (choice == CANCEL)
|
||||||
break;
|
break;
|
||||||
else if (choice == 2)
|
|
||||||
replaceall = TRUE;
|
replaceall = (choice == ALL);
|
||||||
|
|
||||||
/* When "No" or moving backwards, the search routine should
|
/* When "No" or moving backwards, the search routine should
|
||||||
* first move one character further before continuing. */
|
* first move one character further before continuing. */
|
||||||
skipone = (choice == 0 || ISSET(BACKWARDS_SEARCH));
|
skipone = (choice == 0 || ISSET(BACKWARDS_SEARCH));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (choice == 1 || replaceall) { /* Yes, replace it. */
|
if (choice == YES || replaceall) {
|
||||||
char *copy;
|
|
||||||
size_t length_change;
|
size_t length_change;
|
||||||
|
char *altered;
|
||||||
|
|
||||||
|
altered = replace_line(needle);
|
||||||
|
|
||||||
|
length_change = strlen(altered) - strlen(openfile->current->data);
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
add_undo(REPLACE, NULL);
|
add_undo(REPLACE, NULL);
|
||||||
#endif
|
|
||||||
copy = replace_line(needle);
|
|
||||||
|
|
||||||
length_change = strlen(copy) - strlen(openfile->current->data);
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
/* If the mark was on and it was located after the cursor,
|
/* If the mark was on and it was located after the cursor,
|
||||||
* then adjust its x position for any text length changes. */
|
* then adjust its x position for any text length changes. */
|
||||||
if (was_mark && !right_side_up) {
|
if (was_mark && !right_side_up) {
|
||||||
@@ -617,8 +635,9 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
|||||||
|
|
||||||
/* If the mark was not on or it was before the cursor, then
|
/* If the mark was not on or it was before the cursor, then
|
||||||
* adjust the cursor's x position for any text length changes. */
|
* adjust the cursor's x position for any text length changes. */
|
||||||
if (!was_mark || right_side_up) {
|
if (!was_mark || right_side_up)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
if (openfile->current == real_current &&
|
if (openfile->current == real_current &&
|
||||||
openfile->current_x < *real_current_x) {
|
openfile->current_x < *real_current_x) {
|
||||||
if (*real_current_x < openfile->current_x + match_len)
|
if (*real_current_x < openfile->current_x + match_len)
|
||||||
@@ -626,8 +645,8 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
|||||||
*real_current_x += length_change;
|
*real_current_x += length_change;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
bot_x = *real_current_x;
|
bot_x = *real_current_x;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't find the same zero-length or BOL match again. */
|
/* Don't find the same zero-length or BOL match again. */
|
||||||
@@ -640,20 +659,13 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
|||||||
openfile->current_x += match_len + length_change;
|
openfile->current_x += match_len + length_change;
|
||||||
|
|
||||||
/* Update the file size, and put the changed line into place. */
|
/* Update the file size, and put the changed line into place. */
|
||||||
openfile->totsize += mbstrlen(copy) - mbstrlen(openfile->current->data);
|
openfile->totsize += mbstrlen(altered) - mbstrlen(openfile->current->data);
|
||||||
free(openfile->current->data);
|
free(openfile->current->data);
|
||||||
openfile->current->data = copy;
|
openfile->current->data = altered;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
if (ISSET(SOFTWRAP))
|
|
||||||
openfile->current->extrarows = extra_chunks_in(openfile->current);
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
/* Check whether the replacement requires a change in the coloring. */
|
|
||||||
check_the_multis(openfile->current);
|
check_the_multis(openfile->current);
|
||||||
|
refresh_needed = FALSE;
|
||||||
if (refresh_needed && !replaceall)
|
|
||||||
wipe_and_recalculate_colorinfo();
|
|
||||||
#endif
|
#endif
|
||||||
set_modified();
|
set_modified();
|
||||||
as_an_at = TRUE;
|
as_an_at = TRUE;
|
||||||
@@ -664,11 +676,6 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
|||||||
if (numreplaced == -1)
|
if (numreplaced == -1)
|
||||||
not_found_msg(needle);
|
not_found_msg(needle);
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
|
||||||
if (refresh_needed)
|
|
||||||
wipe_and_recalculate_colorinfo();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
openfile->mark = was_mark;
|
openfile->mark = was_mark;
|
||||||
#endif
|
#endif
|
||||||
@@ -701,13 +708,13 @@ void ask_for_and_do_replacements(void)
|
|||||||
size_t begin_x = openfile->current_x;
|
size_t begin_x = openfile->current_x;
|
||||||
ssize_t numreplaced;
|
ssize_t numreplaced;
|
||||||
int response = do_prompt(MREPLACEWITH, "", &replace_history,
|
int response = do_prompt(MREPLACEWITH, "", &replace_history,
|
||||||
/* TRANSLATORS: This is a prompt. */
|
/* TRANSLATORS: This is a prompt. */
|
||||||
edit_refresh, _("Replace with"));
|
edit_refresh, _("Replace with"));
|
||||||
|
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
/* When not "", add the replace string to the replace history list. */
|
/* When not "", add the replace string to the replace history list. */
|
||||||
if (response == 0)
|
if (response == 0)
|
||||||
update_history(&replace_history, answer);
|
update_history(&replace_history, answer, PRUNE_DUPLICATE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* When cancelled, or when a function was run, get out. */
|
/* When cancelled, or when a function was run, get out. */
|
||||||
@@ -724,31 +731,42 @@ void ask_for_and_do_replacements(void)
|
|||||||
openfile->firstcolumn = was_firstcolumn;
|
openfile->firstcolumn = was_firstcolumn;
|
||||||
openfile->current = beginline;
|
openfile->current = beginline;
|
||||||
openfile->current_x = begin_x;
|
openfile->current_x = begin_x;
|
||||||
|
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
|
|
||||||
if (numreplaced >= 0)
|
if (numreplaced >= 0)
|
||||||
statusline(HUSH, P_("Replaced %zd occurrence",
|
statusline(REMARK, P_("Replaced %zd occurrence",
|
||||||
"Replaced %zd occurrences", numreplaced), numreplaced);
|
"Replaced %zd occurrences", numreplaced), numreplaced);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER) || defined (ENABLE_LINTER) || defined (ENABLE_FORMATTER)
|
||||||
/* Go to the specified line and x position. */
|
/* Go to the specified line and x position. */
|
||||||
void goto_line_posx(ssize_t line, size_t pos_x)
|
void goto_line_posx(ssize_t linenumber, size_t pos_x)
|
||||||
{
|
{
|
||||||
for (openfile->current = openfile->filetop; line > 1 &&
|
#ifdef ENABLE_COLOR
|
||||||
openfile->current != openfile->filebot; line--)
|
if (linenumber > openfile->edittop->lineno + editwinrows ||
|
||||||
openfile->current = openfile->current->next;
|
(ISSET(SOFTWRAP) && linenumber > openfile->current->lineno))
|
||||||
|
recook |= perturbed;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (linenumber < openfile->filebot->lineno)
|
||||||
|
openfile->current = line_from_number(linenumber);
|
||||||
|
else
|
||||||
|
openfile->current = openfile->filebot;
|
||||||
|
|
||||||
openfile->current_x = pos_x;
|
openfile->current_x = pos_x;
|
||||||
openfile->placewewant = xplustabs();
|
openfile->placewewant = xplustabs();
|
||||||
|
UNFOLD_SEGMENT(openfile->current);
|
||||||
|
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Go to the specified line and column, or ask for them if interactive
|
/* Go to the specified line and column, or ask for them if interactive
|
||||||
* is TRUE. In the latter case also update the screen afterwards.
|
* is TRUE. In the latter case also update the screen afterwards.
|
||||||
* Note that both the line and column number should be one-based. */
|
* Note that both the line and column number should be one-based. */
|
||||||
void do_gotolinecolumn(ssize_t line, ssize_t column, bool retain_answer,
|
void goto_line_and_column(ssize_t line, ssize_t column, bool retain_answer,
|
||||||
bool interactive)
|
bool interactive)
|
||||||
{
|
{
|
||||||
if (interactive) {
|
if (interactive) {
|
||||||
/* Ask for the line and column. */
|
/* Ask for the line and column. */
|
||||||
@@ -762,7 +780,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool retain_answer,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (func_from_key(&response) == flip_goto) {
|
if (func_from_key(response) == flip_goto) {
|
||||||
UNSET(BACKWARDS_SEARCH);
|
UNSET(BACKWARDS_SEARCH);
|
||||||
/* Switch to searching but retain what the user typed so far. */
|
/* Switch to searching but retain what the user typed so far. */
|
||||||
search_init(FALSE, TRUE);
|
search_init(FALSE, TRUE);
|
||||||
@@ -775,7 +793,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool retain_answer,
|
|||||||
|
|
||||||
/* Try to extract one or two numbers from the user's response. */
|
/* Try to extract one or two numbers from the user's response. */
|
||||||
if (!parse_line_column(answer, &line, &column)) {
|
if (!parse_line_column(answer, &line, &column)) {
|
||||||
statusline(ALERT, _("Invalid line or column number"));
|
statusline(AHEM, _("Invalid line or column number"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -792,11 +810,28 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool retain_answer,
|
|||||||
if (line < 1)
|
if (line < 1)
|
||||||
line = 1;
|
line = 1;
|
||||||
|
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
#ifdef ENABLE_FOLDING
|
||||||
|
linestruct *edit_bottom = openfile->edittop;
|
||||||
|
for (int i = 0;edit_bottom != openfile->filebot && i < editwinrows;++i)
|
||||||
|
edit_bottom = get_next_visible_line(edit_bottom);
|
||||||
|
if (line > edit_bottom->lineno ||
|
||||||
|
(ISSET(SOFTWRAP) && line > openfile->current->lineno))
|
||||||
|
recook |= perturbed;
|
||||||
|
#else
|
||||||
|
if (line > openfile->edittop->lineno + editwinrows ||
|
||||||
|
(ISSET(SOFTWRAP) && line > openfile->current->lineno))
|
||||||
|
recook |= perturbed;
|
||||||
|
#endif /* ENABLE_FOLDING */
|
||||||
|
#endif /* ENABLE_COLOR */
|
||||||
|
|
||||||
/* Iterate to the requested line. */
|
/* Iterate to the requested line. */
|
||||||
for (openfile->current = openfile->filetop; line > 1 &&
|
for (openfile->current = openfile->filetop; line > 1 &&
|
||||||
openfile->current != openfile->filebot; line--)
|
openfile->current != openfile->filebot; line--)
|
||||||
openfile->current = openfile->current->next;
|
openfile->current = openfile->current->next;
|
||||||
|
|
||||||
|
UNFOLD_SEGMENT(openfile->current);
|
||||||
|
|
||||||
/* Take a negative column number to mean: from the end of the line. */
|
/* Take a negative column number to mean: from the end of the line. */
|
||||||
if (column < 0)
|
if (column < 0)
|
||||||
column = breadth(openfile->current->data) + column + 2;
|
column = breadth(openfile->current->data) + column + 2;
|
||||||
@@ -813,9 +848,9 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool retain_answer,
|
|||||||
openfile->placewewant = breadth(openfile->current->data);
|
openfile->placewewant = breadth(openfile->current->data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* When the position was manually given, center the target line. */
|
/* When a line number was manually given, center the target line. */
|
||||||
if (interactive) {
|
if (interactive) {
|
||||||
adjust_viewport(CENTERING);
|
adjust_viewport((*answer == ',') ? STATIONARY : CENTERING);
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
} else {
|
} else {
|
||||||
int rows_from_tail;
|
int rows_from_tail;
|
||||||
@@ -844,30 +879,117 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool retain_answer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Go to the specified line and column, asking for them beforehand. */
|
/* Go to the specified line and column, asking for them beforehand. */
|
||||||
void do_gotolinecolumn_void(void)
|
void do_gotolinecolumn(void)
|
||||||
{
|
{
|
||||||
do_gotolinecolumn(openfile->current->lineno,
|
goto_line_and_column(openfile->current->lineno,
|
||||||
openfile->placewewant + 1, FALSE, TRUE);
|
openfile->placewewant + 1, FALSE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
/* Search backwards for a line ending with a bracket, including the current line.
|
||||||
|
* top is an in/out parameter. The passed value is the start line for searching.
|
||||||
|
* xpos is an out parameter. It is the position in the line where the bracket is
|
||||||
|
* found. bracket_half is the halfway mark in the matchbrackets array. This way in
|
||||||
|
* a loop the halfway value isn't recomputed. */
|
||||||
|
bool find_start_of_bracketed_region(linestruct **top, size_t *xpos, size_t bracket_half)
|
||||||
|
{
|
||||||
|
/* Search backwards for a line ending with a bracket, including the current line */
|
||||||
|
for (;(*top) != NULL;*top = (*top)->prev) {
|
||||||
|
char *found;
|
||||||
|
const char *bracket;
|
||||||
|
int len = strlen((*top)->data);
|
||||||
|
|
||||||
|
/* Find the last bracket on the search line */
|
||||||
|
found = mbrevstrpbrk((*top)->data, matchbrackets, (*top)->data + len);
|
||||||
|
if (found == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
*xpos = found - (*top)->data;
|
||||||
|
bracket = mbstrchr(matchbrackets, found);
|
||||||
|
|
||||||
|
/* We're looking for opening braces, not closing */
|
||||||
|
if (bracket >= matchbrackets + bracket_half)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Check if this is the last character in the line */
|
||||||
|
char *next = (*top)->data + step_right((*top)->data, *xpos);
|
||||||
|
if (*next == '\0')
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
*xpos = 0;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the halfway point in matchbrackets, where open and close
|
||||||
|
* brackets meet. */
|
||||||
|
size_t get_matchbrackets_halfway(void)
|
||||||
|
{
|
||||||
|
size_t charcount = mbstrlen(matchbrackets) / 2;
|
||||||
|
size_t halfway = 0;
|
||||||
|
|
||||||
|
for (size_t i = 0;i < charcount;++i)
|
||||||
|
halfway += char_length(matchbrackets + halfway);
|
||||||
|
return halfway;
|
||||||
|
}
|
||||||
|
/* Get a region surrounding the line in_region. A region here is defined
|
||||||
|
* as a block of text starting with an opening bracket at the end of a line,
|
||||||
|
* and ending with a matching closing bracket.
|
||||||
|
* top and bot are out parameters. Returns the top/bottom line of the region.
|
||||||
|
* top_pos and bot_pos are out parameters. Returns the position within the
|
||||||
|
* top and bottom lines where the brackets are found. */
|
||||||
|
bool find_bracketed_region(linestruct *in_region,
|
||||||
|
linestruct **top, linestruct **bot)
|
||||||
|
{
|
||||||
|
size_t bracket_half = get_matchbrackets_halfway();
|
||||||
|
size_t top_pos;
|
||||||
|
size_t bot_pos;
|
||||||
|
linestruct *was_top = *top;
|
||||||
|
linestruct *was_bot = *bot;
|
||||||
|
*top = in_region;
|
||||||
|
|
||||||
|
for (;find_start_of_bracketed_region(top, &top_pos, bracket_half)
|
||||||
|
;*top = (*top)->prev)
|
||||||
|
{
|
||||||
|
*bot = *top;
|
||||||
|
bot_pos = top_pos;
|
||||||
|
|
||||||
|
if (!find_matching_bracket_pos(bot, &bot_pos)) {
|
||||||
|
if ((*bot)->lineno < in_region->lineno)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int linedist = (*bot)->lineno - (*top)->lineno;
|
||||||
|
|
||||||
|
if (linedist >= 2) {
|
||||||
|
*top = (*top)->next;
|
||||||
|
*bot = (*bot)->prev;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*top = was_top;
|
||||||
|
*bot = was_bot;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Search, starting from the current position, for any of the two characters
|
/* Search, starting from the current position, for any of the two characters
|
||||||
* in bracket_pair. If reverse is TRUE, search backwards, otherwise forwards.
|
* in bracket_pair. If reverse is TRUE, search backwards, otherwise forwards.
|
||||||
* Return TRUE when one of the brackets was found, and FALSE otherwise. */
|
* Return TRUE when one of the brackets was found, and FALSE otherwise. */
|
||||||
bool find_a_bracket(bool reverse, const char *bracket_pair)
|
bool find_a_bracket(bool reverse, const char *bracket_pair,
|
||||||
|
linestruct **inout_line, size_t *xpos)
|
||||||
{
|
{
|
||||||
linestruct *line = openfile->current;
|
linestruct *line = *inout_line;
|
||||||
const char *pointer, *found;
|
const char *pointer, *found;
|
||||||
|
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
/* First step away from the current bracket. */
|
/* First step away from the current bracket. */
|
||||||
if (openfile->current_x == 0) {
|
if (*xpos == 0) {
|
||||||
line = line->prev;
|
line = line->prev;
|
||||||
if (line == NULL)
|
if (line == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
pointer = line->data + strlen(line->data);
|
pointer = line->data + strlen(line->data);
|
||||||
} else
|
} else
|
||||||
pointer = line->data + step_left(line->data, openfile->current_x);
|
pointer = line->data + step_left(line->data, *xpos);
|
||||||
|
|
||||||
/* Now seek for any of the two brackets we are interested in. */
|
/* Now seek for any of the two brackets we are interested in. */
|
||||||
while (!(found = mbrevstrpbrk(line->data, bracket_pair, pointer))) {
|
while (!(found = mbrevstrpbrk(line->data, bracket_pair, pointer))) {
|
||||||
@@ -877,7 +999,7 @@ bool find_a_bracket(bool reverse, const char *bracket_pair)
|
|||||||
pointer = line->data + strlen(line->data);
|
pointer = line->data + strlen(line->data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pointer = line->data + step_right(line->data, openfile->current_x);
|
pointer = line->data + step_right(line->data, *xpos);
|
||||||
|
|
||||||
while (!(found = mbstrpbrk(pointer, bracket_pair))) {
|
while (!(found = mbstrpbrk(pointer, bracket_pair))) {
|
||||||
line = line->next;
|
line = line->next;
|
||||||
@@ -887,45 +1009,24 @@ bool find_a_bracket(bool reverse, const char *bracket_pair)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the current position to the found bracket. */
|
/* Set the found position to the found bracket. */
|
||||||
openfile->current = line;
|
*inout_line = line;
|
||||||
openfile->current_x = found - line->data;
|
*xpos = found - line->data;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for a match to the bracket at the current cursor position, if
|
/* Search for the given bracket's compliment within matchbrackets.
|
||||||
* there is one. */
|
* ch must be a pointer to within matchbrackets.
|
||||||
void do_find_bracket(void)
|
* reverse is true if the found compliment came before ch in matchbrackets. */
|
||||||
|
const char *get_bracket_compliment(const char *ch, bool *reverse)
|
||||||
{
|
{
|
||||||
linestruct *was_current = openfile->current;
|
|
||||||
size_t was_current_x = openfile->current_x;
|
|
||||||
/* The current cursor position, in case we don't find a complement. */
|
|
||||||
const char *ch;
|
|
||||||
/* The location in matchbrackets of the bracket under the cursor. */
|
|
||||||
int ch_len;
|
|
||||||
/* The length of ch in bytes. */
|
|
||||||
const char *wanted_ch;
|
|
||||||
/* The location in matchbrackets of the complementing bracket. */
|
|
||||||
int wanted_ch_len;
|
|
||||||
/* The length of wanted_ch in bytes. */
|
|
||||||
char bracket_pair[MAXCHARLEN * 2 + 1];
|
|
||||||
/* The pair of characters in ch and wanted_ch. */
|
|
||||||
size_t halfway = 0;
|
|
||||||
/* The index in matchbrackets where the closing brackets start. */
|
|
||||||
size_t charcount = mbstrlen(matchbrackets) / 2;
|
size_t charcount = mbstrlen(matchbrackets) / 2;
|
||||||
/* Half the number of characters in matchbrackets. */
|
/* Half the number of characters in matchbrackets. */
|
||||||
size_t balance = 1;
|
const char *wanted_ch;
|
||||||
/* The initial bracket count. */
|
/* The location in matchbrackets of the complementing bracket. */
|
||||||
bool reverse;
|
size_t halfway = 0;
|
||||||
/* The direction we search. */
|
/* The index in matchbrackets where the closing brackets start. */
|
||||||
|
|
||||||
ch = mbstrchr(matchbrackets, openfile->current->data + openfile->current_x);
|
|
||||||
|
|
||||||
if (ch == NULL) {
|
|
||||||
statusbar(_("Not a bracket"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the halfway point in matchbrackets, where the closing ones start. */
|
/* Find the halfway point in matchbrackets, where the closing ones start. */
|
||||||
for (size_t i = 0; i < charcount; i++)
|
for (size_t i = 0; i < charcount; i++)
|
||||||
@@ -933,19 +1034,35 @@ void do_find_bracket(void)
|
|||||||
|
|
||||||
/* When on a closing bracket, we have to search backwards for a matching
|
/* When on a closing bracket, we have to search backwards for a matching
|
||||||
* opening bracket; otherwise, forward for a matching closing bracket. */
|
* opening bracket; otherwise, forward for a matching closing bracket. */
|
||||||
reverse = (ch >= (matchbrackets + halfway));
|
*reverse = (ch >= (matchbrackets + halfway));
|
||||||
|
|
||||||
/* Step half the number of total characters either backwards or forwards
|
/* Step half the number of total characters either backwards or forwards
|
||||||
* through matchbrackets to find the wanted complementary bracket. */
|
* through matchbrackets to find the wanted complementary bracket. */
|
||||||
wanted_ch = ch;
|
wanted_ch = ch;
|
||||||
while (charcount-- > 0) {
|
while (charcount-- > 0) {
|
||||||
if (reverse)
|
if (*reverse)
|
||||||
wanted_ch = matchbrackets + step_left(matchbrackets,
|
wanted_ch = matchbrackets + step_left(matchbrackets,
|
||||||
wanted_ch - matchbrackets);
|
wanted_ch - matchbrackets);
|
||||||
else
|
else
|
||||||
wanted_ch += char_length(wanted_ch);
|
wanted_ch += char_length(wanted_ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return wanted_ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create a bracket pair string from the given bracket in ch, assigning
|
||||||
|
* the result to bracket_pair. Reverse is set to true if we need to
|
||||||
|
* search backward for a match. */
|
||||||
|
void create_bracket_pair(char *bracket_pair, const char *ch,
|
||||||
|
int ch_len, bool* reverse)
|
||||||
|
{
|
||||||
|
const char *wanted_ch;
|
||||||
|
/* The location in matchbrackets of the complementing bracket. */
|
||||||
|
int wanted_ch_len;
|
||||||
|
/* The length of wanted_ch in bytes. */
|
||||||
|
|
||||||
|
wanted_ch = get_bracket_compliment(ch, reverse);
|
||||||
|
|
||||||
ch_len = char_length(ch);
|
ch_len = char_length(ch);
|
||||||
wanted_ch_len = char_length(wanted_ch);
|
wanted_ch_len = char_length(wanted_ch);
|
||||||
|
|
||||||
@@ -953,24 +1070,65 @@ void do_find_bracket(void)
|
|||||||
strncpy(bracket_pair, ch, ch_len);
|
strncpy(bracket_pair, ch, ch_len);
|
||||||
strncpy(bracket_pair + ch_len, wanted_ch, wanted_ch_len);
|
strncpy(bracket_pair + ch_len, wanted_ch, wanted_ch_len);
|
||||||
bracket_pair[ch_len + wanted_ch_len] = '\0';
|
bracket_pair[ch_len + wanted_ch_len] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
while (find_a_bracket(reverse, bracket_pair)) {
|
/* Get the bracket match position for the character currently under the cursor.
|
||||||
/* Increment/decrement balance for an identical/other bracket. */
|
* If there is no bracket beneath the cursor, return NOT_A_BRACKET. If there is
|
||||||
balance += (strncmp(openfile->current->data + openfile->current_x,
|
* no match found, return NOT_FOUND_BRACKET. Otherwise returns FOUND_BRACKET
|
||||||
ch, ch_len) == 0) ? 1 : -1;
|
* and sets line and xpos to the found line and offset respectively. */
|
||||||
|
int find_matching_bracket_pos(linestruct **line, size_t *xpos)
|
||||||
|
{
|
||||||
|
const char *br_ch;
|
||||||
|
/* The location in matchbrackets of the bracket under the cursor. */
|
||||||
|
int br_ch_len;
|
||||||
|
/* The length of br_ch in bytes. */
|
||||||
|
char bracket_pair[MAXCHARLEN * 2 + 1];
|
||||||
|
/* The pair of characters in ch and wanted_ch. */
|
||||||
|
size_t balance = 1;
|
||||||
|
/* The initial bracket count. */
|
||||||
|
bool reversed;
|
||||||
|
/* The direction we search. */
|
||||||
|
|
||||||
/* When balance reached zero, we've found the complementary bracket. */
|
br_ch = mbstrchr(matchbrackets, (*line)->data + (*xpos));
|
||||||
if (balance == 0) {
|
|
||||||
edit_redraw(was_current, FLOWING);
|
if (br_ch == NULL)
|
||||||
return;
|
return NOT_A_BRACKET;
|
||||||
}
|
|
||||||
|
br_ch_len = char_length(br_ch);
|
||||||
|
create_bracket_pair(bracket_pair, br_ch, br_ch_len, &reversed);
|
||||||
|
|
||||||
|
|
||||||
|
while (find_a_bracket(reversed, bracket_pair, line, xpos)) {
|
||||||
|
balance += (strncmp((*line)->data + *xpos,
|
||||||
|
br_ch, br_ch_len) == 0) ? 1 : -1;
|
||||||
|
if (balance == 0)
|
||||||
|
return FOUND_BRACKET;
|
||||||
|
|
||||||
|
}
|
||||||
|
return NOT_FOUND_BRACKET;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Search for a match to the bracket at the current cursor position, if
|
||||||
|
* there is one. */
|
||||||
|
void do_find_bracket(void)
|
||||||
|
{
|
||||||
|
linestruct *was_current = openfile->current;
|
||||||
|
size_t was_current_x = openfile->current_x;
|
||||||
|
|
||||||
|
int res = find_matching_bracket_pos(&openfile->current,
|
||||||
|
&openfile->current_x);
|
||||||
|
if (res == FOUND_BRACKET) {
|
||||||
|
UNFOLD_SEGMENT(openfile->current);
|
||||||
|
edit_redraw(was_current, FLOWING);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
statusbar(_("No matching bracket"));
|
|
||||||
|
|
||||||
/* Restore the cursor position. */
|
|
||||||
openfile->current = was_current;
|
openfile->current = was_current;
|
||||||
openfile->current_x = was_current_x;
|
openfile->current_x = was_current_x;
|
||||||
|
|
||||||
|
statusline(AHEM, res == NOT_FOUND_BRACKET ?
|
||||||
|
_("No matching bracket") :
|
||||||
|
_("Not a bracket"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Place an anchor at the current line when none exists, otherwise remove it. */
|
/* Place an anchor at the current line when none exists, otherwise remove it. */
|
||||||
@@ -981,9 +1139,9 @@ void put_or_lift_anchor(void)
|
|||||||
update_line(openfile->current, openfile->current_x);
|
update_line(openfile->current, openfile->current_x);
|
||||||
|
|
||||||
if (openfile->current->has_anchor)
|
if (openfile->current->has_anchor)
|
||||||
statusbar(_("Placed anchor"));
|
statusline(REMARK, _("Placed anchor"));
|
||||||
else
|
else
|
||||||
statusbar(_("Removed anchor"));
|
statusline(REMARK, _("Removed anchor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make the given line the current line, or report the anchoredness. */
|
/* Make the given line the current line, or report the anchoredness. */
|
||||||
@@ -994,12 +1152,18 @@ void go_to_and_confirm(linestruct *line)
|
|||||||
if (line != openfile->current) {
|
if (line != openfile->current) {
|
||||||
openfile->current = line;
|
openfile->current = line;
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
|
UNFOLD_SEGMENT(openfile->current);
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
if (line->lineno > openfile->edittop->lineno + editwinrows ||
|
||||||
|
(ISSET(SOFTWRAP) && line->lineno > was_current->lineno))
|
||||||
|
recook |= perturbed;
|
||||||
|
#endif
|
||||||
edit_redraw(was_current, CENTERING);
|
edit_redraw(was_current, CENTERING);
|
||||||
statusbar(_("Jumped to anchor"));
|
statusbar(_("Jumped to anchor"));
|
||||||
} else if (openfile->current->has_anchor)
|
} else if (openfile->current->has_anchor)
|
||||||
statusbar(_("This is the only anchor"));
|
statusline(REMARK, _("This is the only anchor"));
|
||||||
else
|
else
|
||||||
statusbar(_("There are no anchors"));
|
statusline(AHEM, _("There are no anchors"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Jump to the first anchor before the current line; wrap around at the top. */
|
/* Jump to the first anchor before the current line; wrap around at the top. */
|
||||||
|
|||||||
673
src/text.c
673
src/text.c
File diff suppressed because it is too large
Load Diff
94
src/utils.c
94
src/utils.c
@@ -1,7 +1,7 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* utils.c -- This file is part of GNU nano. *
|
* utils.c -- This file is part of GNU nano. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
* Copyright (C) 1999-2011, 2013-2023 Free Software Foundation, Inc. *
|
||||||
* Copyright (C) 2016, 2017, 2019 Benno Schulenberg *
|
* Copyright (C) 2016, 2017, 2019 Benno Schulenberg *
|
||||||
* *
|
* *
|
||||||
* GNU nano is free software: you can redistribute it and/or modify *
|
* GNU nano is free software: you can redistribute it and/or modify *
|
||||||
@@ -61,14 +61,14 @@ const char *tail(const char *path)
|
|||||||
if (slash == NULL)
|
if (slash == NULL)
|
||||||
return path;
|
return path;
|
||||||
else
|
else
|
||||||
return ++slash;
|
return slash + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a copy of the two given strings, welded together. */
|
/* Return a copy of the two given strings, welded together. */
|
||||||
char *concatenate(const char *path, const char *name)
|
char *concatenate(const char *path, const char *name)
|
||||||
{
|
{
|
||||||
size_t pathlen = strlen(path);
|
size_t pathlen = strlen(path);
|
||||||
char *joined = charalloc(pathlen + strlen(name) + 1);
|
char *joined = nmalloc(pathlen + strlen(name) + 1);
|
||||||
|
|
||||||
strcpy(joined, path);
|
strcpy(joined, path);
|
||||||
strcpy(joined + pathlen, name);
|
strcpy(joined + pathlen, name);
|
||||||
@@ -76,7 +76,6 @@ char *concatenate(const char *path, const char *name)
|
|||||||
return joined;
|
return joined;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_LINENUMBERS
|
|
||||||
/* Return the number of digits that the given integer n takes up. */
|
/* Return the number of digits that the given integer n takes up. */
|
||||||
int digits(ssize_t n)
|
int digits(ssize_t n)
|
||||||
{
|
{
|
||||||
@@ -106,21 +105,20 @@ int digits(ssize_t n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Read an integer from str. If it parses okay, store it in *result
|
/* Read an integer from the given string. If it parses okay,
|
||||||
* and return TRUE; otherwise, return FALSE. */
|
* store it in *result and return TRUE; otherwise, return FALSE. */
|
||||||
bool parse_num(const char *str, ssize_t *result)
|
bool parse_num(const char *string, ssize_t *result)
|
||||||
{
|
{
|
||||||
char *first_error;
|
|
||||||
ssize_t value;
|
ssize_t value;
|
||||||
|
char *excess;
|
||||||
|
|
||||||
/* The manual page for strtol() says this is required. */
|
/* Clear the error number so that we can check it afterward. */
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
value = (ssize_t)strtol(str, &first_error, 10);
|
value = (ssize_t)strtol(string, &excess, 10);
|
||||||
|
|
||||||
if (errno == ERANGE || *str == '\0' || *first_error != '\0')
|
if (errno == ERANGE || *string == '\0' || *excess != '\0')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*result = value;
|
*result = value;
|
||||||
@@ -132,14 +130,14 @@ bool parse_num(const char *str, ssize_t *result)
|
|||||||
* *line and *column. Return FALSE on error, and TRUE otherwise. */
|
* *line and *column. Return FALSE on error, and TRUE otherwise. */
|
||||||
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||||
{
|
{
|
||||||
bool retval;
|
|
||||||
char *firstpart;
|
|
||||||
const char *comma;
|
const char *comma;
|
||||||
|
char *firstpart;
|
||||||
|
bool retval;
|
||||||
|
|
||||||
while (*str == ' ')
|
while (*str == ' ')
|
||||||
str++;
|
str++;
|
||||||
|
|
||||||
comma = strpbrk(str, "m,. /;");
|
comma = strpbrk(str, ",.:");
|
||||||
|
|
||||||
if (comma == NULL)
|
if (comma == NULL)
|
||||||
return parse_num(str, line);
|
return parse_num(str, line);
|
||||||
@@ -170,14 +168,19 @@ void recode_NUL_to_LF(char *string, size_t length)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In the given string, recode each embedded newline as a NUL. */
|
/* In the given string, recode each embedded newline as a NUL,
|
||||||
void recode_LF_to_NUL(char *string)
|
* and return the number of bytes in the string. */
|
||||||
|
size_t recode_LF_to_NUL(char *string)
|
||||||
{
|
{
|
||||||
|
char *beginning = string;
|
||||||
|
|
||||||
while (*string != '\0') {
|
while (*string != '\0') {
|
||||||
if (*string == '\n')
|
if (*string == '\n')
|
||||||
*string = '\0';
|
*string = '\0';
|
||||||
string++;
|
string++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (string - beginning);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||||
@@ -195,22 +198,18 @@ void free_chararray(char **array, size_t len)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_SPELLER
|
#ifdef ENABLE_SPELLER
|
||||||
/* Is the word starting at the given position in buf and of the given length
|
/* Is the word starting at the given position in 'text' and of the given
|
||||||
* a separate word? That is: is it not part of a longer word?*/
|
* length a separate word? That is: is it not part of a longer word? */
|
||||||
bool is_separate_word(size_t position, size_t length, const char *buf)
|
bool is_separate_word(size_t position, size_t length, const char *text)
|
||||||
{
|
{
|
||||||
char before[MAXCHARLEN], after[MAXCHARLEN];
|
const char *before = text + step_left(text, position);
|
||||||
size_t word_end = position + length;
|
const char *after = text + position + length;
|
||||||
|
|
||||||
/* Get the characters before and after the word, if any. */
|
|
||||||
collect_char(buf + step_left(buf, position), before);
|
|
||||||
collect_char(buf + word_end, after);
|
|
||||||
|
|
||||||
/* If the word starts at the beginning of the line OR the character before
|
/* If the word starts at the beginning of the line OR the character before
|
||||||
* the word isn't a letter, and if the word ends at the end of the line OR
|
* the word isn't a letter, and if the word ends at the end of the line OR
|
||||||
* the character after the word isn't a letter, we have a whole word. */
|
* the character after the word isn't a letter, we have a whole word. */
|
||||||
return ((position == 0 || !is_alpha_char(before)) &&
|
return ((position == 0 || !is_alpha_char(before)) &&
|
||||||
(buf[word_end] == '\0' || !is_alpha_char(after)));
|
(*after == '\0' || !is_alpha_char(after)));
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_SPELLER */
|
#endif /* ENABLE_SPELLER */
|
||||||
|
|
||||||
@@ -288,28 +287,26 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
|||||||
return mbstrcasestr(start, needle);
|
return mbstrcasestr(start, needle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a wrapper for the malloc() function that properly handles
|
/* Allocate the given amount of memory and return a pointer to it. */
|
||||||
* things when we run out of memory. */
|
|
||||||
void *nmalloc(size_t howmuch)
|
void *nmalloc(size_t howmuch)
|
||||||
{
|
{
|
||||||
void *r = malloc(howmuch);
|
void *section = malloc(howmuch);
|
||||||
|
|
||||||
if (r == NULL && howmuch != 0)
|
if (section == NULL)
|
||||||
die(_("Nano is out of memory!\n"));
|
die(_("Nano is out of memory!\n"));
|
||||||
|
|
||||||
return r;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a wrapper for the realloc() function that properly handles
|
/* Reallocate the given section of memory to have the given size. */
|
||||||
* things when we run out of memory. */
|
void *nrealloc(void *section, size_t howmuch)
|
||||||
void *nrealloc(void *ptr, size_t howmuch)
|
|
||||||
{
|
{
|
||||||
void *r = realloc(ptr, howmuch);
|
section = realloc(section, howmuch);
|
||||||
|
|
||||||
if (r == NULL && howmuch != 0)
|
if (section == NULL)
|
||||||
die(_("Nano is out of memory!\n"));
|
die(_("Nano is out of memory!\n"));
|
||||||
|
|
||||||
return r;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return an appropriately reallocated dest string holding a copy of src.
|
/* Return an appropriately reallocated dest string holding a copy of src.
|
||||||
@@ -318,7 +315,7 @@ char *mallocstrcpy(char *dest, const char *src)
|
|||||||
{
|
{
|
||||||
size_t count = strlen(src) + 1;
|
size_t count = strlen(src) + 1;
|
||||||
|
|
||||||
dest = charealloc(dest, count);
|
dest = nrealloc(dest, count);
|
||||||
strncpy(dest, src, count);
|
strncpy(dest, src, count);
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
@@ -328,7 +325,7 @@ char *mallocstrcpy(char *dest, const char *src)
|
|||||||
* of the given string, and NUL-terminate the copy. */
|
* of the given string, and NUL-terminate the copy. */
|
||||||
char *measured_copy(const char *string, size_t count)
|
char *measured_copy(const char *string, size_t count)
|
||||||
{
|
{
|
||||||
char *thecopy = charalloc(count + 1);
|
char *thecopy = nmalloc(count + 1);
|
||||||
|
|
||||||
memcpy(thecopy, string, count);
|
memcpy(thecopy, string, count);
|
||||||
thecopy[count] = '\0';
|
thecopy[count] = '\0';
|
||||||
@@ -349,14 +346,12 @@ char *free_and_assign(char *dest, char *src)
|
|||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When not in softwrap mode, nano scrolls horizontally within a line in
|
/* When not softwrapping, nano scrolls the current line horizontally by
|
||||||
* chunks (a bit smaller than the chunks used in softwrapping). Return the
|
* chunks ("pages"). Return the column number of the first character
|
||||||
* column number of the first character displayed in the edit window when the
|
* displayed in the edit window when the cursor is at the given column. */
|
||||||
* cursor is at the given column. Note that (0 <= column -
|
|
||||||
* get_page_start(column) < COLS). */
|
|
||||||
size_t get_page_start(size_t column)
|
size_t get_page_start(size_t column)
|
||||||
{
|
{
|
||||||
if (column + 2 < editwincols || ISSET(SOFTWRAP) || column == 0)
|
if (column == 0 || column + 2 < editwincols || ISSET(SOFTWRAP))
|
||||||
return 0;
|
return 0;
|
||||||
else if (editwincols > 8)
|
else if (editwincols > 8)
|
||||||
return column - 6 - (column - 6) % (editwincols - 8);
|
return column - 6 - (column - 6) % (editwincols - 8);
|
||||||
@@ -431,9 +426,6 @@ void new_magicline(void)
|
|||||||
openfile->filebot->next = make_new_node(openfile->filebot);
|
openfile->filebot->next = make_new_node(openfile->filebot);
|
||||||
openfile->filebot->next->data = copy_of("");
|
openfile->filebot->next->data = copy_of("");
|
||||||
openfile->filebot = openfile->filebot->next;
|
openfile->filebot = openfile->filebot->next;
|
||||||
#ifndef NANO_TINY
|
|
||||||
openfile->filebot->extrarows = 0;
|
|
||||||
#endif
|
|
||||||
openfile->totsize++;
|
openfile->totsize++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,7 +489,9 @@ void get_range(linestruct **top, linestruct **bot)
|
|||||||
also_the_last = TRUE;
|
also_the_last = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
|
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER) || defined (ENABLE_LINTER) || defined (ENABLE_FORMATTER)
|
||||||
/* Return a pointer to the line that has the given line number. */
|
/* Return a pointer to the line that has the given line number. */
|
||||||
linestruct *line_from_number(ssize_t number)
|
linestruct *line_from_number(ssize_t number)
|
||||||
{
|
{
|
||||||
@@ -512,7 +506,7 @@ linestruct *line_from_number(ssize_t number)
|
|||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif
|
||||||
|
|
||||||
/* Count the number of characters from begin to end, and return it. */
|
/* Count the number of characters from begin to end, and return it. */
|
||||||
size_t number_of_characters_in(const linestruct *begin, const linestruct *end)
|
size_t number_of_characters_in(const linestruct *begin, const linestruct *end)
|
||||||
|
|||||||
2031
src/winio.c
2031
src/winio.c
File diff suppressed because it is too large
Load Diff
@@ -36,13 +36,12 @@ pkgdata_DATA = asm.nanorc \
|
|||||||
tcl.nanorc \
|
tcl.nanorc \
|
||||||
tex.nanorc \
|
tex.nanorc \
|
||||||
texinfo.nanorc \
|
texinfo.nanorc \
|
||||||
xml.nanorc
|
xml.nanorc \
|
||||||
|
yaml.nanorc
|
||||||
|
|
||||||
nobase_pkgdata_DATA = \
|
nobase_pkgdata_DATA = \
|
||||||
extra/ada.nanorc \
|
extra/ada.nanorc \
|
||||||
extra/debian.nanorc \
|
|
||||||
extra/fortran.nanorc \
|
extra/fortran.nanorc \
|
||||||
extra/gentoo.nanorc \
|
|
||||||
extra/haskell.nanorc \
|
extra/haskell.nanorc \
|
||||||
extra/povray.nanorc \
|
extra/povray.nanorc \
|
||||||
extra/spec.nanorc
|
extra/spec.nanorc
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ color red "\<[A-Z_]{2,}\>"
|
|||||||
color brightgreen "\.(data|subsection|text)"
|
color brightgreen "\.(data|subsection|text)"
|
||||||
color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
|
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)"
|
color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
|
||||||
color brightred "^[[:space:]]*[.0-9A-Za-z_]*:"
|
color brightred "^[[:blank:]]*[.0-9A-Za-z_]*:"
|
||||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
color brightcyan "^[[:blank:]]*#[[:blank:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||||
|
|
||||||
# Strings.
|
# Strings and names of included files.
|
||||||
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
|
color brightyellow ""([^"\]|\\.)*"|<[^= ]*>"
|
||||||
|
|
||||||
# Comments.
|
# Comments.
|
||||||
color brightblue "//.*"
|
color brightblue "//.*"
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
## Syntax highlighting for Autoconf.
|
## Syntax highlighting for Autoconf.
|
||||||
|
|
||||||
|
## Original author: Benno Schulenberg
|
||||||
|
## License: GPL version 3 or newer
|
||||||
|
|
||||||
syntax autoconf "\.(ac|m4)$"
|
syntax autoconf "\.(ac|m4)$"
|
||||||
comment "#"
|
comment "#"
|
||||||
|
|
||||||
@@ -14,13 +17,13 @@ color cyan "\<[[:upper:]_[:digit:]]+\>"
|
|||||||
color red "\<[-_.0-9]+\>"
|
color red "\<[-_.0-9]+\>"
|
||||||
|
|
||||||
# Strings:
|
# Strings:
|
||||||
color red ""[^"]*"" "'[^']*'"
|
color red ""[^"]*"|'[^']*'"
|
||||||
|
|
||||||
# Backticks:
|
# Backticks:
|
||||||
color green "`[^`]*`"
|
color green "`[^`]*`"
|
||||||
|
|
||||||
# Error lines:
|
# Error lines:
|
||||||
color brightred "^[[:space:]]*\*\*\*.*"
|
color brightred "^[[:blank:]]*\*\*\*.*"
|
||||||
|
|
||||||
# Brackets:
|
# Brackets:
|
||||||
color magenta "\[|\]|\(|\)"
|
color magenta "\[|\]|\(|\)"
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ color magenta "\<(and|compl|lshift|or|rshift|xor)\>"
|
|||||||
color magenta "\<(bindtextdomain|dcgettext|dcngettext)\>"
|
color magenta "\<(bindtextdomain|dcgettext|dcngettext)\>"
|
||||||
|
|
||||||
# Strings.
|
# Strings.
|
||||||
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
|
color brightyellow ""([^"\]|\\.)*""
|
||||||
# Comments.
|
# Comments.
|
||||||
color brightblue "(^|[[:space:]])#.*$"
|
color brightblue "(^|[[:blank:]])#.*"
|
||||||
|
|
||||||
# Trailing whitespace.
|
# Trailing whitespace.
|
||||||
color ,green "[[:space:]]+$"
|
color ,green "[[:space:]]+$"
|
||||||
|
|||||||
@@ -1,33 +1,39 @@
|
|||||||
## Syntax highlighting for C and C++ files.
|
## Syntax highlighting for C and C++ files.
|
||||||
|
|
||||||
syntax c "\.([ch](pp|xx)?|C|cc|c\+\+|cu|H|hh|ii?)$"
|
syntax c "\.([ch](pp|xx)?|C|cc|c\+\+|cu|H|hh|ii?)$"
|
||||||
header "-\*-.*\<C(\+\+)?((;|\s).*)?-\*-"
|
header "-\*-.*\<C(\+\+)?((;|[[:blank:]]).*)?-\*-"
|
||||||
magic "^(C|C\+\+) (source|program)"
|
magic "^(C|C\+\+) (source|program)"
|
||||||
comment "//"
|
comment "//"
|
||||||
|
|
||||||
# Constants.
|
# Constants.
|
||||||
color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
color brightred "\<[A-Z_][0-9A-Z_]*\>"
|
||||||
# Labels.
|
# Labels.
|
||||||
color brightmagenta "^[[:space:]]*[A-Z_a-z]+:[[:space:]]*$"
|
color brightmagenta "^[[:blank:]]*[A-Z_a-z][0-9A-Z_a-z]*:[[:blank:]]*$"
|
||||||
|
color normal ":[[:blank:]]*$"
|
||||||
|
|
||||||
color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|auto|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
|
# Types and related keywords.
|
||||||
|
color green "\<(auto|bool|char|const|double|enum|extern|float|inline|int|long|restrict|short|signed|sizeof|static|struct|typedef|union|unsigned|void)\>"
|
||||||
color green "\<([[:lower:]][[:lower:]_]*|(u_?)?int(8|16|32|64))_t\>"
|
color green "\<([[:lower:]][[:lower:]_]*|(u_?)?int(8|16|32|64))_t\>"
|
||||||
color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|override|using|mutable|volatile|register|explicit)\>"
|
color green "\<(_(Alignas|Alignof|Atomic|Bool|Complex|Generic|Imaginary|Noreturn|Static_assert|Thread_local))\>"
|
||||||
color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
|
color green "\<(class|explicit|friend|mutable|namespace|override|private|protected|public|register|template|this|typename|using|virtual|volatile)\>"
|
||||||
|
|
||||||
|
# Flow control.
|
||||||
|
color brightyellow "\<(if|else|for|while|do|switch|case|default)\>"
|
||||||
color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||||
color magenta "\<(goto|continue|break|return)\>"
|
color magenta "\<(break|continue|goto|return)\>"
|
||||||
color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
|
|
||||||
|
# Single-quoted stuff (characters, backslash escapes, hex and octal byte codes).
|
||||||
|
color brightmagenta "'([^'\]|\\(["'\abfnrtv]|x[[:xdigit:]]{1,2}|[0-3]?[0-7]{1,2}))'"
|
||||||
|
|
||||||
# GCC builtins.
|
# GCC builtins.
|
||||||
color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||||
|
|
||||||
# Strings. In general you will want your strings and comments to come last,
|
# Strings and names of included files.
|
||||||
# because highlighting rules are applied in the order they are read in.
|
color brightyellow ""([^"]|\\")*"|#[[:blank:]]*include[[:blank:]]*<[^>]+>"
|
||||||
color brightyellow ""([^"]|\\")*"" "#[[:space:]]*include[[:space:]]+<[^[:blank:]=]*>"
|
|
||||||
|
|
||||||
# Preprocessor directives.
|
# Preprocessor directives.
|
||||||
color brightcyan start="^[[:space:]]*#[[:space:]]*(if(n?def)?|elif|warning|error|pragma)\>" end="(\`|[^\\])$"
|
color brightcyan start="^[[:blank:]]*#[[:blank:]]*(if(n?def)?|elif|warning|error|pragma)\>" end="(\`|[^\])$"
|
||||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|else|endif|include(_next)?|undef)\>"
|
color brightcyan "^[[:blank:]]*#[[:blank:]]*((define|else|endif|include(_next)?|line|undef)\>|$)"
|
||||||
|
|
||||||
# Comments.
|
# Comments.
|
||||||
color brightblue "//.*"
|
color brightblue "//.*"
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
## Syntax highlighting for Changelogs.
|
## Syntax highlighting for Changelogs.
|
||||||
|
|
||||||
|
## Original author: Benno Schulenberg
|
||||||
|
## License: GPL version 3 or newer
|
||||||
|
|
||||||
syntax changelog "Change[Ll]og[^/]*$"
|
syntax changelog "Change[Ll]og[^/]*$"
|
||||||
|
|
||||||
# Author lines.
|
# Author lines.
|
||||||
@@ -10,13 +13,13 @@ color red "^(19|20)[0-9-]{8}"
|
|||||||
color yellow "<[^>]*@[^>]*>"
|
color yellow "<[^>]*@[^>]*>"
|
||||||
|
|
||||||
# Command-line options.
|
# Command-line options.
|
||||||
color cyan "[[:space:]]-[a-zA-Z\$]" "--[8a-z-]+"
|
color cyan "[[:blank:]]-[a-zA-Z\$]|--[8a-z-]+"
|
||||||
# Bug and patch numbers.
|
# Bug and patch numbers.
|
||||||
color cyan "(BZ|bug|patch)[ ]#[0-9]+" "PR [[:alnum:]]+/[0-9]+"
|
color cyan "(BZ|bug|patch)[ ]#[0-9]+|PR [[:alnum:]]+/[0-9]+"
|
||||||
# Probable constants, for variety.
|
# Probable constants, for variety.
|
||||||
color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
||||||
# Key sequences.
|
# Key sequences.
|
||||||
color brightblue "\^[A-Z^\]" "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
|
color brightblue "\^[A-Z^\]|\<M-.|\<F1?[0-9]|(\^|M-)Space"
|
||||||
|
|
||||||
# Changed files.
|
# Changed files.
|
||||||
color magenta start="^( | {8})\* " end="(:( |$)|^$)"
|
color magenta start="^( | {8})\* " end="(:( |$)|^$)"
|
||||||
|
|||||||
@@ -3,17 +3,20 @@
|
|||||||
syntax cmake "(CMakeLists\.txt|\.cmake)$"
|
syntax cmake "(CMakeLists\.txt|\.cmake)$"
|
||||||
comment "#"
|
comment "#"
|
||||||
|
|
||||||
color green "^[[:space:]]*[0-9A-Za-z_]+"
|
color green "^[[:blank:]]*[0-9A-Za-z_]+"
|
||||||
icolor brightyellow "^[[:space:]]*(include|include_directories|include_external_msproject)\>"
|
icolor brightyellow "^[[:blank:]]*(include|include_directories|include_external_msproject)\>"
|
||||||
|
|
||||||
icolor brightgreen "^[[:space:]]*((else|end)?if|else|(end)?while|(end)?foreach|break)\>"
|
icolor brightgreen "^[[:blank:]]*((else|end)?if|else|(end)?while|(end)?foreach|break)\>"
|
||||||
color brightgreen "\<(NOT|COMMAND|POLICY|TARGET|EXISTS|IS_(DIRECTORY|ABSOLUTE)|DEFINED)[[:space:]]"
|
color brightgreen "\<(NOT|COMMAND|POLICY|TARGET|EXISTS|IS_(DIRECTORY|ABSOLUTE)|DEFINED)[[:blank:]]"
|
||||||
color brightgreen "[[:space:]](OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS|GREATER|EQUAL))[[:space:]]"
|
color brightgreen "[[:blank:]](OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS|GREATER|EQUAL))[[:blank:]]"
|
||||||
|
|
||||||
icolor brightred "^[[:space:]]*((end)?(function|macro)|return)"
|
icolor brightred "^[[:blank:]]*((end)?(function|macro)|return)"
|
||||||
|
|
||||||
icolor cyan start="\$(ENV)?\{" end="\}"
|
icolor cyan start="\$(ENV)?\{" end="\}"
|
||||||
color magenta "\<(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\>"
|
color magenta "\<(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\>"
|
||||||
|
|
||||||
color brightblue "(^|[[:space:]])#.*"
|
# Comments.
|
||||||
|
color brightblue "(^|[[:blank:]])#.*"
|
||||||
|
|
||||||
|
# Trailing whitespace.
|
||||||
color ,green "[[:space:]]+$"
|
color ,green "[[:space:]]+$"
|
||||||
|
|||||||
@@ -4,17 +4,17 @@ syntax css "\.css$"
|
|||||||
comment "/*|*/"
|
comment "/*|*/"
|
||||||
|
|
||||||
# First make everything red:
|
# First make everything red:
|
||||||
color brightred "."
|
color brightred "."
|
||||||
# Then everything between braces yellow:
|
# Then everything between braces yellow:
|
||||||
color brightyellow start="\{" end="\}"
|
color brightyellow start="\{" end="\}"
|
||||||
# Then everything after a colon white:
|
# Then everything after a colon white:
|
||||||
color brightwhite start=":" end="([;^{]|$)"
|
color brightwhite start=":" end="([;^{]|$)"
|
||||||
|
|
||||||
# Pseudo-classes:
|
# Pseudo-classes:
|
||||||
color brightcyan ":(active|checked|focus|hover|link|visited|after|before)\>"
|
color brightcyan ":(active|checked|focus|hover|link|visited|after|before)\>"
|
||||||
|
|
||||||
# Comments:
|
# Comments:
|
||||||
color brightblue start="/\*" end="\*/"
|
color brightblue start="/\*" end="\*/"
|
||||||
|
|
||||||
# Syntactic characters:
|
# Syntactic characters:
|
||||||
color green ";|:|\{|\}"
|
color green ";|:|\{|\}"
|
||||||
|
|||||||
@@ -4,20 +4,27 @@
|
|||||||
syntax default
|
syntax default
|
||||||
comment "#"
|
comment "#"
|
||||||
|
|
||||||
# Comments.
|
|
||||||
color cyan "^[[:space:]]*#.*"
|
|
||||||
|
|
||||||
# Spaces in front of tabs.
|
# Spaces in front of tabs.
|
||||||
color ,red " + +"
|
color ,red " + +"
|
||||||
|
|
||||||
# Nano's name, including version.
|
# Nano's release motto, then name plus version.
|
||||||
color brightred "(GNU )?[Nn]ano [1-5]\.[0-9][-.[:alnum:]]*\>"
|
color italic,lime "\<[Nn]ano [1-7]\.[0-9][-.[:alnum:]]* "[^"]+""
|
||||||
|
color brightred "\<(GNU )?[Nn]ano [1-7]\.[0-9][-.[:alnum:]]*\>"
|
||||||
|
|
||||||
|
# Dates
|
||||||
|
color latte "\<[12][0-9]{3}\.(0[1-9]|1[012])\.(0[1-9]|[12][0-9]|3[01])\>"
|
||||||
|
|
||||||
# Email addresses.
|
# Email addresses.
|
||||||
color magenta "<[[:alnum:].%_+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,}>"
|
color magenta "<[[:alnum:].%_+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,}>"
|
||||||
|
|
||||||
|
# URLs.
|
||||||
|
color lightblue "\<https?://\S+\.\S+[^])>[:space:],.]"
|
||||||
|
|
||||||
# Bracketed captions in certain config files.
|
# Bracketed captions in certain config files.
|
||||||
color brightgreen "^\[[^][]+\]$"
|
color brightgreen "^\[[^][]+\]$"
|
||||||
|
|
||||||
|
# Comments.
|
||||||
|
color cyan "^[[:blank:]]*#.*"
|
||||||
|
|
||||||
# Control codes.
|
# Control codes.
|
||||||
color latte "[[:cntrl:]]"
|
color orange "[[:cntrl:]]"
|
||||||
|
|||||||
@@ -28,6 +28,6 @@ color brightred "\<(t|nil)\>"
|
|||||||
color blue ":(\w|[?-])+"
|
color blue ":(\w|[?-])+"
|
||||||
# Strings
|
# Strings
|
||||||
color yellow start="^[[:blank:]]+"" end="[^\]""
|
color yellow start="^[[:blank:]]+"" end="[^\]""
|
||||||
color yellow ""(\\.|[^"])*""
|
color yellow ""([^"\]|\\.)*""
|
||||||
# Comments
|
# Comments
|
||||||
color cyan "(^|[[:space:]]);.*"
|
color cyan "(^|[[:blank:]]);.*"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ color yellow "^> ?> ?>.*"
|
|||||||
color brightmagenta "<[^@]+@[^@]+>"
|
color brightmagenta "<[^@]+@[^@]+>"
|
||||||
|
|
||||||
# URLs.
|
# URLs.
|
||||||
color brightblue "(https?|ftp)://\S+\.\S+[^\s.)]"
|
color brightblue "(https?|ftp)://\S+\.\S+[^[:space:].)]"
|
||||||
|
|
||||||
# Signatures, even quoted ones.
|
# Signatures, even quoted ones.
|
||||||
color yellow start="^>* ?-- $" end="^>* ?$"
|
color yellow start="^>* ?-- $" end="^>* ?$"
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ color cyan "'[[:alnum:]]+"
|
|||||||
color green "\<[0-9][0-9A-Fa-f_#.+-]*"
|
color green "\<[0-9][0-9A-Fa-f_#.+-]*"
|
||||||
|
|
||||||
# Characters / Strings
|
# Characters / Strings
|
||||||
color red "'.'" ""[^"]*""
|
color red "'.'|"[^"]*""
|
||||||
|
|
||||||
# Comments
|
# Comments
|
||||||
color brightblue "--.*"
|
color brightblue "--.*"
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
## Syntax highlighting for apt's sources.list.
|
|
||||||
|
|
||||||
syntax sources.list "sources\.list(\.d/.*\.list)?(~|\.old|\.save)?$"
|
|
||||||
comment "#"
|
|
||||||
|
|
||||||
# Coloring the deb lines, working from tail to head. First the
|
|
||||||
# components -- well, everything, and thus also the components.
|
|
||||||
color brightmagenta "^deb.*"
|
|
||||||
# Distribution -- well, everything, except the components.
|
|
||||||
color brightred "^deb(-src)?\s+.*((ftp|https?|rsh|ssh|copy|file|spacewalk|tor):/\S+|cdrom:\[.+\]/)\s+\S+"
|
|
||||||
# URIs.
|
|
||||||
color brightgreen "^deb(-src)?\s+.*(ftp|https?|rsh|ssh|copy|file|spacewalk|tor):/\S+"
|
|
||||||
# CDroms.
|
|
||||||
color brightgreen "^deb(-src)?\s+.*cdrom:\[.+\]/"
|
|
||||||
# Options.
|
|
||||||
color brightcyan "^deb(-src)?\s+\[.+\]\s+"
|
|
||||||
# And finally the initial deb tag.
|
|
||||||
color yellow "^deb(-src)?"
|
|
||||||
|
|
||||||
# Comments.
|
|
||||||
color brightblue "#.*"
|
|
||||||
@@ -34,7 +34,7 @@ icolor yellow "\<(.or.|repeat|select case|then|where|while)\>"
|
|||||||
icolor magenta "\<(continue|cycle|exit|go?to|result|return)\>"
|
icolor magenta "\<(continue|cycle|exit|go?to|result|return)\>"
|
||||||
|
|
||||||
# Strings.
|
# Strings.
|
||||||
color yellow "<[^= ]*>" ""(\\.|[^"])*""
|
color yellow ""([^"\]|\\.)*""
|
||||||
|
|
||||||
# Comments.
|
# Comments.
|
||||||
color blue "!.*"
|
color blue "!.*"
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
## Syntax highlighting for Gentoo ebuilds/eclasses,
|
|
||||||
## and (further down) for Portage control files.
|
|
||||||
|
|
||||||
syntax ebuild "\.e(build|class|blit)$"
|
|
||||||
comment "#"
|
|
||||||
|
|
||||||
## All the standard portage functions:
|
|
||||||
color brightgreen "(^|\<default_)src_(unpack|prepare|configure|compile|install|test)\>"
|
|
||||||
color brightgreen "^pkg_(config|nofetch|info|pretend|setup|(pre|post)(inst|rm))\>"
|
|
||||||
color brightgreen "\<default(_pkg_nofetch|_src_(unpack|prepare|configure|compile|test))?\>"
|
|
||||||
## Bash-related syntax:
|
|
||||||
color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"
|
|
||||||
color green "\<(declare|eval|exec|export|let|local)\>"
|
|
||||||
color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
|
|
||||||
color green "-[defhnrsuwxzL]\>"
|
|
||||||
color green "-(eq|ne|gt|lt|ge|le)\>"
|
|
||||||
## Variables... official portage ones in red, all others in bright red:
|
|
||||||
color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*"
|
|
||||||
color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:digit:]]|@)+\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
|
|
||||||
color red "\<(EAPI|ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|[BHPR]?DEPEND|PROVIDE|PROPERTIES|REQUIRED_USE|RESTRICT|USERLAND)\>"
|
|
||||||
color red "\<(S|E?D|T|PV|PF|P|PN|PR|PVR|A|CATEGORY|DISTDIR|FILESDIR|EPREFIX|E?ROOT|WORKDIR)\>"
|
|
||||||
color red "\<(AS|C(PP|XX)?|LD)FLAGS\>" "\<C(HOST|TARGET|BUILD)\>" "\<(MERGE_TYPE|REPLACING_VERSIONS|REPLACED_BY_VERSION)\>"
|
|
||||||
color red "\<EBUILD_PHASE(_FUNC)?\>"
|
|
||||||
color red "\<QA_((TEXTRELS|EXECSTACK|WX_LOAD)(_[a-zA-Z_0-9]+)?|DT_HASH|PRESTRIPPED)\>"
|
|
||||||
color red "\<(PATCHES|(HTML_)?DOCS)\>" "\<WANT_(AUTO(CONF|MAKE)|LIBTOOL)\>" "\<AT_M4DIR\>"
|
|
||||||
## Portage commands:
|
|
||||||
color magenta "\<(use(_(with|enable|if_iuse)|x)?|in_iuse) [!a-zA-Z0-9_+ -]*" "inherit.*"
|
|
||||||
color brightblue "\<e(begin|end|conf|install|make|qmake4|ant|(qa)?warn|infon?|error|log|patch(_user)?|new(group|user))\>"
|
|
||||||
color brightblue "\<e(pause|beep|mktemp|(cvs|svn)_clean|punt_cxx)\>" "\<e(aclocal|auto(reconf|header|conf|make)|libtoolize)\>"
|
|
||||||
color brightblue "\<e(stack|shopts|umask)_(push|pop)\>" "\<version_is_at_least\>"
|
|
||||||
color brightblue "\<make_desktop_entry\>" "\<unpack(_(makeself|pdv))?\>"
|
|
||||||
color brightblue "\<(die|hasv?|inherit|nonfatal)\>" "\<(use(_(with|enable|if_iuse)|x)?|in_iuse)\>" "\<(has|best)_version\>"
|
|
||||||
color brightblue "\<(do|new)(ins|(games)?s?bin|doc|lib(\.so|\.a)?|man|info|exe|initd|confd|envd|pam|menu|icon)\>"
|
|
||||||
color brightblue "\<do(compress|header|python|sed|dir|hard|sym|html|jar|mo)\>" "\<keepdir\>"
|
|
||||||
color brightblue "\<prepall(docs|info|man|strip)?\>" "\<prep(info|lib|lib\.(so|a)|man|strip|gamesdirs)\>"
|
|
||||||
color brightblue "\<(doc|ins|exe)?into\>" "\<(f|games)(owners|perms)\>" "\<(exe|ins|dir)opts\>"
|
|
||||||
color brightblue "\<tc-get(BUILD_)?(AR|AS|CC|CPP|CXX|LD|NM|OBJCOPY|PKG_CONFIG|RANLIB)\>"
|
|
||||||
color brightblue "\<tc-(arch(-kernel)?|export|has-(tls|openmp))\>"
|
|
||||||
## Common commands used in ebuilds:
|
|
||||||
color blue "\<(awk|cat|cd|chmod|chown|cp|echo|env|find|e?grep|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|tar|touch|unset|xargs)\>"
|
|
||||||
## Comments (doesn't work that well):
|
|
||||||
color yellow "(^|[[:space:]])#.*"
|
|
||||||
## Strings (doesn't work that well):
|
|
||||||
color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
|
|
||||||
## Trailing space is bad!
|
|
||||||
color ,green "[[:space:]]+$"
|
|
||||||
## Mixed whitespace is also bad.
|
|
||||||
color ,green " "
|
|
||||||
|
|
||||||
|
|
||||||
syntax /etc/portage "\.(accept_keywords|env|keywords|mask|unmask|use)(/.+)?$"
|
|
||||||
comment "#"
|
|
||||||
|
|
||||||
## Base text:
|
|
||||||
color green ".+"
|
|
||||||
## Likely version and slot numbers:
|
|
||||||
color magenta "-[[:digit:].]+(_(alpha|beta|pre|rc|p)[[:digit:]]*)*(-r[[:digit:]]+)?([:[:space:]]|$)"
|
|
||||||
color magenta ":[^[:space:]]+([[:space:]]|$)"
|
|
||||||
## Use flags (must come after version/slot):
|
|
||||||
color brightred "[[:space:]]+\+?[A-Za-z0-9+_@-]+"
|
|
||||||
color brightblue "[[:space:]]+-[A-Za-z0-9+_@-]+"
|
|
||||||
## Accepted arches:
|
|
||||||
color white "[~-]?\<(alpha|amd64|arm(64)?|hppa|ia64|m68k|mips|nios2|ppc(64)?|riscv|s390|sh|sparc|x86)(-(aix|(f|free|net|open)bsd|cygwin|hpux|interix|linux|macos|mint|solaris|winnt))?\>"
|
|
||||||
color white "[[:space:]][*~-]?\*"
|
|
||||||
## Categories:
|
|
||||||
color cyan "^[[:space:]]*[^/]*/"
|
|
||||||
## Masking regulators:
|
|
||||||
color brightmagenta "^[[:space:]]*(=|~|<|<=|>|>=)"
|
|
||||||
## Comments:
|
|
||||||
color yellow "#.*"
|
|
||||||
## Trailing space is bad!
|
|
||||||
color ,green "[[:space:]]+$"
|
|
||||||
## Mixed whitespace is also bad.
|
|
||||||
color ,green " "
|
|
||||||
@@ -28,9 +28,9 @@ color magenta "\<(Bounded|Data|Enum|Eq|Floating|Fractional|Functor|Integral|Mona
|
|||||||
color brightred "undefined"
|
color brightred "undefined"
|
||||||
|
|
||||||
# Strings
|
# Strings
|
||||||
color yellow ""([^\"]|\\.)*""
|
color yellow ""([^"\]|\\.)*""
|
||||||
# Characters
|
# Characters
|
||||||
color brightyellow "'([^\']|\\.)'"
|
color brightyellow "'([^'\]|\\.)'"
|
||||||
|
|
||||||
# Comments
|
# Comments
|
||||||
color green "--.*"
|
color green "--.*"
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
## Syntax highlighting for Go.
|
## Syntax highlighting for Go.
|
||||||
|
|
||||||
|
## Original author: Robert Clausecker
|
||||||
|
## License: CC0 (public domain)
|
||||||
|
|
||||||
syntax go "\.go$"
|
syntax go "\.go$"
|
||||||
comment "//"
|
comment "//"
|
||||||
|
|
||||||
@@ -8,7 +11,7 @@ formatter gofmt -w
|
|||||||
# Types.
|
# Types.
|
||||||
color green "\<(bool|u?int(8|16|32|64)?|float(32|64)|complex(64|128)|byte|rune|uintptr|string|error)\>"
|
color green "\<(bool|u?int(8|16|32|64)?|float(32|64)|complex(64|128)|byte|rune|uintptr|string|error)\>"
|
||||||
color green "\<(chan|const|func|interface|map|struct|type|var)\>"
|
color green "\<(chan|const|func|interface|map|struct|type|var)\>"
|
||||||
color green "<-[[:space:]]*chan\>|\<chan[[:space:]]*<-"
|
color green "<-[[:blank:]]*chan\>|\<chan[[:blank:]]*<-"
|
||||||
|
|
||||||
# Predefined functions.
|
# Predefined functions.
|
||||||
color blue "\<(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\>"
|
color blue "\<(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\>"
|
||||||
@@ -23,24 +26,23 @@ color magenta "\<(break|continue|fallthrough|goto|return)\>"
|
|||||||
color brightcyan "\<(package|import)\>"
|
color brightcyan "\<(package|import)\>"
|
||||||
|
|
||||||
# Literals.
|
# Literals.
|
||||||
color red "\<([1-9][0-9]*|0[0-7]*|0[xX][0-9A-Fa-f]+)\>"
|
color red "\<(true|false|nil|iota|_)\>"
|
||||||
|
color red "\<([1-9][0-9]*|0[0-7]*|0[xX][[:xdigit:]]+)\>"
|
||||||
color red "\<[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?i?\>"
|
color red "\<[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?i?\>"
|
||||||
color red "\<[0-9]+[eE][+-]?[0-9]+i?\>"
|
color red "\<[0-9]+[eE][+-]?[0-9]+i?\>"
|
||||||
color red "\B\.[0-9]+([eE][+-]?[0-9]+)?i?\>"
|
color red "\B\.[0-9]+([eE][+-]?[0-9]+)?i?\>"
|
||||||
color red "\<[0-9]+i\>"
|
color red "\<[0-9]+i\>"
|
||||||
|
|
||||||
# Strings and characters; slightly fuzzy.
|
# Strings and characters; slightly fuzzy.
|
||||||
color red "\<(true|false|nil|iota|_)\>"
|
color red ""([^"\]|\\.)*"|'([^'\]|\\.)+'"
|
||||||
color red "'(\\.|[^'])+'"
|
color red start=""([^"\]|\\.)*\\[[:blank:]]*$" end="^([^"\]|\\.)*""
|
||||||
color red ""(\\.|[^"])*""
|
|
||||||
color red start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
|
|
||||||
|
|
||||||
# Comments.
|
# Comments.
|
||||||
color brightblue "//.*"
|
color brightblue "//.*"
|
||||||
color brightblue start="/\*" end="\*/"
|
color brightblue start="/\*" end="\*/"
|
||||||
|
|
||||||
# Special comments.
|
# Special comments.
|
||||||
color brightcyan "//[[:space:]]*\+build[[:space:]]+(([a-zA-Z_0-9]+[[:space:]]*)+,[[:space:]]*)*[a-zA-Z_0-9]+"
|
color brightcyan "//[[:blank:]]*\+build[[:blank:]]+(([a-zA-Z_0-9]+[[:blank:]]*)+,[[:blank:]]*)*[a-zA-Z_0-9]+"
|
||||||
|
|
||||||
# Trailing whitespace.
|
# Trailing whitespace.
|
||||||
color ,green "[[:space:]]+$"
|
color ,green "[[:space:]]+$"
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
## Syntax highlighting for groff.
|
## Syntax highlighting for groff.
|
||||||
|
|
||||||
syntax groff "(/tmac\.[^/]+$|\.(m[ems]|rof|tmac)$)"
|
syntax groff "\.(m[ems]|rof|tmac)$|/tmac\.[^/]+$"
|
||||||
comment ".\""
|
comment ".\""
|
||||||
|
|
||||||
# The argument of .ds or .nr
|
# The setting of a string or register
|
||||||
color cyan "^\.(ds|nr) [^[:space:]]*"
|
color cyan "^\.(ds|nr) [^[:space:]]*"
|
||||||
# Single-character escapes
|
# Single-character escapes
|
||||||
color brightmagenta "\\."
|
color brightmagenta "\\."
|
||||||
# The argument of \f or \s in the same color
|
# The argument of \f or \s in the same color
|
||||||
color brightmagenta "\\f(.|\(..)" "\\s(\+|\-)?[0-9]"
|
color brightmagenta "\\f(.|\(..)|\\s(\+|\-)?[0-9]"
|
||||||
# Newlines
|
# References to registers
|
||||||
color cyan "\\(\\)?n(.|\(..)"
|
color cyan "\\(\\)?n(.|\(..)"
|
||||||
color cyan start="\\(\\)?n\[" end="]"
|
color cyan start="\\(\\)?n\[" end="]"
|
||||||
# Requests
|
# Requests
|
||||||
color brightgreen "^\.[[:space:]]*[^[:space:]]*"
|
color brightgreen "^\.[[:blank:]]*[^[:space:]]*"
|
||||||
# Comments
|
# Comments
|
||||||
color yellow "^\.\\".*"
|
color yellow "^\.\\".*"
|
||||||
# Strings
|
# References to strings
|
||||||
color green "\\(\\)?\*(.|\(..)"
|
color green "\\(\\)?\*(.|\(..)"
|
||||||
color green start="\\(\\)?\*\[" end="]"
|
color green start="\\(\\)?\*\[" end="]"
|
||||||
# Characters
|
# Special characters
|
||||||
color brightred "\\\(.."
|
color brightred "\\\(.."
|
||||||
color brightred start="\\\[" end="]"
|
color brightred start="\\\[" end="]"
|
||||||
# Macro arguments
|
# Macro arguments
|
||||||
|
|||||||
@@ -11,14 +11,13 @@ color brightcyan "\<define(-macro|-module|-public|-syntax)?\>"
|
|||||||
# Quoted symbols
|
# Quoted symbols
|
||||||
color brightyellow "'\<(\w|-)+\>"
|
color brightyellow "'\<(\w|-)+\>"
|
||||||
# Chars
|
# Chars
|
||||||
color brightmagenta "#\\."
|
color brightmagenta "#\\(.|\w+)"
|
||||||
color brightmagenta "#\\\w+\>"
|
|
||||||
# Booleans
|
# Booleans
|
||||||
color brightred "(#t|#f)\>"
|
color brightred "(#t|#f)\>"
|
||||||
# Keywords
|
# Keywords
|
||||||
color blue "#?:(\w|[?-])+"
|
color blue "#?:(\w|[?-])+"
|
||||||
# Strings
|
# Strings
|
||||||
color yellow start="^[[:blank:]]+"" end="[^\]""
|
color yellow start="^[[:blank:]]+"" end="[^\]""
|
||||||
color yellow ""(\\.|[^"])*""
|
color yellow ""([^"\]|\\.)*""
|
||||||
# Comments
|
# Comments
|
||||||
color cyan "(^|[[:space:]]);.*"
|
color cyan "(^|[[:blank:]]);.*"
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ formatter tidy -m -q
|
|||||||
|
|
||||||
# Tags:
|
# Tags:
|
||||||
color cyan "<[[:alpha:]/!?][^>]*>"
|
color cyan "<[[:alpha:]/!?][^>]*>"
|
||||||
# Bold, italic, and underlined:
|
# Bold, italic, underlined, emphasis, and importance:
|
||||||
color brightmagenta "</?[biu]>"
|
color brightmagenta "</?(b|i|u|em|strong)>"
|
||||||
|
|
||||||
# Named character references:
|
# Named character references:
|
||||||
color red "&[^;[:space:]]*;"
|
color red "&[^;[:space:]]*;"
|
||||||
@@ -25,7 +25,7 @@ color red "\<(rows(pan)?|rules|scheme|scope|scrolling|selected|shape|size|span|s
|
|||||||
color red "\<(tabindex|target|text|title|type|usemap|valign|value(type)?|vlink|vspace|width|xmlns|xml:space)="
|
color red "\<(tabindex|target|text|title|type|usemap|valign|value(type)?|vlink|vspace|width|xmlns|xml:space)="
|
||||||
|
|
||||||
# Strings:
|
# Strings:
|
||||||
color green ""(\\.|[^"])*""
|
color green ""([^"\]|\\.)*""
|
||||||
|
|
||||||
# Comments:
|
# Comments:
|
||||||
color yellow start="<!--" end="-->"
|
color yellow start="<!--" end="-->"
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ color brightyellow "\<(await|export|import|throw|try|catch|finally|new|delete)\>
|
|||||||
color magenta "\<(break|continue|return|yield)\>"
|
color magenta "\<(break|continue|return|yield)\>"
|
||||||
|
|
||||||
# Octal/decimal and hexadecimal numbers.
|
# Octal/decimal and hexadecimal numbers.
|
||||||
color cyan "\<([0-9]+|0x[0-9A-Fa-f]+)\>"
|
color cyan "\<([0-9]+|0x[[:xdigit:]]+)\>"
|
||||||
# Special values.
|
# Special values.
|
||||||
color cyan "\<(true|false|null|undefined)\>"
|
color cyan "\<(true|false|null|undefined)\>"
|
||||||
|
|
||||||
# Strings.
|
# Strings.
|
||||||
color brightmagenta ""(\\.|[^"])*"" "'(\\.|[^'])*'" "`(\\.|[^`])*`"
|
color brightmagenta ""([^"\]|\\.)*"|'([^'\]|\\.)*'|`([^`\]|\\.)*`"
|
||||||
# Comments.
|
# Comments.
|
||||||
color brightblue "(^|[[:space:]])//.*"
|
color brightblue "(^|[[:blank:]])//.*"
|
||||||
color brightblue start="/\*" end="\*/"
|
color brightblue start="/\*" end="\*/"
|
||||||
|
|
||||||
# Trailing whitespace.
|
# Trailing whitespace.
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user