Compare commits
835 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdf095c32f | ||
|
|
81402101d9 | ||
|
|
154742c5e3 | ||
|
|
ec569b4bd0 | ||
|
|
38743b0016 | ||
|
|
68c3aaf2df | ||
|
|
2a97cb9f41 | ||
|
|
af8ffa8c94 | ||
|
|
3ffefbfddc | ||
|
|
8637acb106 | ||
|
|
51a3f78d69 | ||
|
|
4d77e0adbb | ||
|
|
2b8a73348c | ||
|
|
576502a5c5 | ||
|
|
ec9a11c761 | ||
|
|
1c63bf0e38 | ||
|
|
4aa1678f3b | ||
|
|
c60d3bbb97 | ||
|
|
90d4b51837 | ||
|
|
302ea79d1c | ||
|
|
ebeed9c013 | ||
|
|
75dd9bee38 | ||
|
|
9151abcd45 | ||
|
|
3258bb0ff4 | ||
|
|
3f3698640b | ||
|
|
432388b23e | ||
|
|
bad618e537 | ||
|
|
7ae305fdc0 | ||
|
|
7d4f279c04 | ||
|
|
f230c46e5e | ||
|
|
bc5a225678 | ||
|
|
493b334ebb | ||
|
|
7d54207627 | ||
|
|
458933f09e | ||
|
|
2b49a19793 | ||
|
|
fc716156a4 | ||
|
|
2b9f06194f | ||
|
|
631defb8b2 | ||
|
|
a6dae403e6 | ||
|
|
b4dbbe3799 | ||
|
|
4281b6becb | ||
|
|
34b1824822 | ||
|
|
b025f67805 | ||
|
|
40f8ca0d07 | ||
|
|
aae752912e | ||
|
|
3c695664ec | ||
|
|
8a7634f070 | ||
|
|
fa88fcc8f2 | ||
|
|
c2d8641f01 | ||
|
|
3d5e51bcd0 | ||
|
|
95ae124891 | ||
|
|
1a8646393a | ||
|
|
054559dc93 | ||
|
|
fdeab9b4c9 | ||
|
|
f26c121ca9 | ||
|
|
17c16a4bf5 | ||
|
|
46566572d6 | ||
|
|
b4a5fac744 | ||
|
|
f816da413a | ||
|
|
3a0ac428ba | ||
|
|
97ab28a164 | ||
|
|
ccb739dd7d | ||
|
|
1082f2adec | ||
|
|
042b8394a0 | ||
|
|
f2d6e6fa5e | ||
|
|
5390f96900 | ||
|
|
50ed18be17 | ||
|
|
a6365707c0 | ||
|
|
6fad6a17da | ||
|
|
eb757e7c5b | ||
|
|
b554606047 | ||
|
|
e915fb1650 | ||
|
|
4e40ec057e | ||
|
|
bd0026be86 | ||
|
|
a1bef0e953 | ||
|
|
f5693d4151 | ||
|
|
e3807f00a2 | ||
|
|
022cc084a7 | ||
|
|
0f98466e2f | ||
|
|
40c067133a | ||
|
|
36270748dc | ||
|
|
1894c81412 | ||
|
|
e917ef0105 | ||
|
|
3347682fd0 | ||
|
|
7c5b104859 | ||
|
|
3b9a24a7ca | ||
|
|
7d3290fb91 | ||
|
|
df0ae2ace5 | ||
|
|
bc91af2e3c | ||
|
|
48b94d71c7 | ||
|
|
f14be47878 | ||
|
|
c51f5f4bff | ||
|
|
7f8851caa8 | ||
|
|
bfdc31fbb4 | ||
|
|
69d2045c9f | ||
|
|
c63f4c1f58 | ||
|
|
b8dc8d4a37 | ||
|
|
8749ccb469 | ||
|
|
b5c5cde0d4 | ||
|
|
d8c03cd4cd | ||
|
|
1536a76ced | ||
|
|
d2fb371fe2 | ||
|
|
34170611d3 | ||
|
|
23c36ba667 | ||
|
|
31d5cb1118 | ||
|
|
f551c07e7a | ||
|
|
2656f543f4 | ||
|
|
ba79602281 | ||
|
|
094758be15 | ||
|
|
06bbc70d4a | ||
|
|
d256d0cbc0 | ||
|
|
ab6635c3a6 | ||
|
|
416ad4c5fd | ||
|
|
0374708597 | ||
|
|
101987f5c6 | ||
|
|
ad451933c6 | ||
|
|
222e67300e | ||
|
|
d12191db5a | ||
|
|
785efc2087 | ||
|
|
557ad827f9 | ||
|
|
600f81cf98 | ||
|
|
56d98052d1 | ||
|
|
265d3245af | ||
|
|
53d4224be9 | ||
|
|
f813fd0f4d | ||
|
|
e90b40e651 | ||
|
|
07c1e72216 | ||
|
|
7338b45d36 | ||
|
|
c95e5362e6 | ||
|
|
2698a2ba68 | ||
|
|
ff0e01a69e | ||
|
|
72b13adeff | ||
|
|
481178428b | ||
|
|
9a2ef3a542 | ||
|
|
b480e7fc9c | ||
|
|
3e33d1eba6 | ||
|
|
cdb9b04980 | ||
|
|
31ff7ead73 | ||
|
|
5398d986ef | ||
|
|
b02dccc51f | ||
|
|
3158133edd | ||
|
|
acf50ae26d | ||
|
|
01b840890d | ||
|
|
9bd60e7d5d | ||
|
|
c5e46101b1 | ||
|
|
53b77cb4c6 | ||
|
|
cc4ce8d83b | ||
|
|
23c8ef70aa | ||
|
|
2a4d338d97 | ||
|
|
9c202198a3 | ||
|
|
c8dc67717b | ||
|
|
4df2f81295 | ||
|
|
78def852d1 | ||
|
|
a4933873c9 | ||
|
|
1861052234 | ||
|
|
2307b31887 | ||
|
|
108a3b0b41 | ||
|
|
e0d9b7a8af | ||
|
|
b3ace4d8f6 | ||
|
|
e9d6ceab0b | ||
|
|
5103bfe6b8 | ||
|
|
cfd17f5722 | ||
|
|
43235c2f16 | ||
|
|
b14ad451a9 | ||
|
|
cd00d0975e | ||
|
|
40f6dbc34e | ||
|
|
a9fb56a8c9 | ||
|
|
07c0d29276 | ||
|
|
310c971d50 | ||
|
|
3644d51b97 | ||
|
|
591d3170aa | ||
|
|
752dde1130 | ||
|
|
b5eda7f812 | ||
|
|
4d44b03fc8 | ||
|
|
2d16c27820 | ||
|
|
ad65b79ac7 | ||
|
|
fe5bd8cdef | ||
|
|
c848ec3d53 | ||
|
|
ab6390cad0 | ||
|
|
48124fdba4 | ||
|
|
ebd9eb346d | ||
|
|
413116e1b5 | ||
|
|
69a3d39bc4 | ||
|
|
f081fa3047 | ||
|
|
4383b01b9b | ||
|
|
b901a20a06 | ||
|
|
d6e05d8376 | ||
|
|
21e307e820 | ||
|
|
dbcf4f0cbe | ||
|
|
7b88557ef5 | ||
|
|
75a6abe6d2 | ||
|
|
ba5b85baf0 | ||
|
|
9f95fa9ce5 | ||
|
|
8853bc448d | ||
|
|
15148a5e6d | ||
|
|
7d9ad31cd9 | ||
|
|
aecbc6faa9 | ||
|
|
a06b921f12 | ||
|
|
bdf1a9d4e7 | ||
|
|
5c399dfc6e | ||
|
|
ed4b6486a1 | ||
|
|
2326bf695e | ||
|
|
a9dd73fb16 | ||
|
|
073bd3ad6e | ||
|
|
4bcc224560 | ||
|
|
f2f367ba9c | ||
|
|
48bff32ee3 | ||
|
|
304f07258b | ||
|
|
e1c2573c7a | ||
|
|
07ec7de8eb | ||
|
|
82f5fed45a | ||
|
|
a2f7e31ba2 | ||
|
|
55983ee9d1 | ||
|
|
cd274a7830 | ||
|
|
f773fa3968 | ||
|
|
288355686b | ||
|
|
f7d5a82a5d | ||
|
|
63e04ac31e | ||
|
|
0c63b50fdc | ||
|
|
94c9defde1 | ||
|
|
ee91c51e09 | ||
|
|
1e3f3a7511 | ||
|
|
8fce33afe0 | ||
|
|
4314b8ded3 | ||
|
|
52e39ae5f7 | ||
|
|
5e7ba03ad1 | ||
|
|
97fec5603f | ||
|
|
3b8847f319 | ||
|
|
a578d2706c | ||
|
|
44d38815cc | ||
|
|
b23a5d5b29 | ||
|
|
b96cc8c212 | ||
|
|
09ad0eb5f7 | ||
|
|
62ca113ed3 | ||
|
|
5cfb74650d | ||
|
|
8cd6aa0a32 | ||
|
|
fcbe41942f | ||
|
|
39e5b52734 | ||
|
|
70b347183b | ||
|
|
699cacf7a4 | ||
|
|
23cb26c58f | ||
|
|
3422ec3419 | ||
|
|
5f1d9af375 | ||
|
|
f3a441043d | ||
|
|
e6c629951f | ||
|
|
c06d5452f5 | ||
|
|
1fcb9b99cf | ||
|
|
d8c840692e | ||
|
|
8c7b6bd21a | ||
|
|
21d0755de5 | ||
|
|
bbab9e2e62 | ||
|
|
9ea1cd947c | ||
|
|
b8987a1e40 | ||
|
|
895d2b8e9c | ||
|
|
47068c3770 | ||
|
|
345cf5accc | ||
|
|
c7ca60b046 | ||
|
|
01e4f85f29 | ||
|
|
6bfbb2bcd9 | ||
|
|
d82c753ba4 | ||
|
|
0af9ce926b | ||
|
|
4e14a8a977 | ||
|
|
accd17c249 | ||
|
|
e8eb30cad6 | ||
|
|
36bd68f3ab | ||
|
|
03692363a2 | ||
|
|
0e94575c6b | ||
|
|
27cc3117e2 | ||
|
|
19f71632c8 | ||
|
|
e3f18e7a6c | ||
|
|
b55923f5ec | ||
|
|
7028adf211 | ||
|
|
d7df7c694a | ||
|
|
ce69d5be88 | ||
|
|
3da4240229 | ||
|
|
43caf7bb7b | ||
|
|
e8e30e5197 | ||
|
|
189de5ee78 | ||
|
|
c57d040e99 | ||
|
|
0adb15c7a1 | ||
|
|
1e48df388e | ||
|
|
d477775871 | ||
|
|
ed40fd8031 | ||
|
|
5c4b0b38f4 | ||
|
|
bd331b0198 | ||
|
|
cd09482231 | ||
|
|
c5955d14ce | ||
|
|
7d38379919 | ||
|
|
45bf18f8fe | ||
|
|
787dca6724 | ||
|
|
15e36956b5 | ||
|
|
967f581860 | ||
|
|
1075de1222 | ||
|
|
3457039cee | ||
|
|
ca77254968 | ||
|
|
710a600f22 | ||
|
|
843eef65b8 | ||
|
|
781c7a7a5f | ||
|
|
aa205f58ca | ||
|
|
3bf04afa6d | ||
|
|
71236e145d | ||
|
|
7be76af418 | ||
|
|
fb17929fab | ||
|
|
fea1901592 | ||
|
|
33fea90bcd | ||
|
|
f03c87c300 | ||
|
|
45b1a38b82 | ||
|
|
c3bf17a801 | ||
|
|
8582e4a6b9 | ||
|
|
9b34d0a4fb | ||
|
|
26d16ab9d1 | ||
|
|
6ca8518428 | ||
|
|
f2c61c4b9a | ||
|
|
c4e04eb682 | ||
|
|
0b257fe558 | ||
|
|
941637615b | ||
|
|
378aa8bc41 | ||
|
|
157098ee75 | ||
|
|
8d4e171d3c | ||
|
|
6f1e5912a9 | ||
|
|
28a6d9f300 | ||
|
|
f92606491c | ||
|
|
260588af1e | ||
|
|
cdc9482d8f | ||
|
|
7c1b649eb8 | ||
|
|
57b3f83cfe | ||
|
|
edbdcb9b9a | ||
|
|
a6978b54f1 | ||
|
|
8bc2d18fa9 | ||
|
|
fb10a94f35 | ||
|
|
9b30bb15cc | ||
|
|
a1669e1bfd | ||
|
|
3d6eca3f26 | ||
|
|
c025a60ce9 | ||
|
|
5e1f90d8fa | ||
|
|
7f3ffe8544 | ||
|
|
ea1016efdb | ||
|
|
f63fee79e3 | ||
|
|
2003413989 | ||
|
|
9369af77ce | ||
|
|
35d2bc6b38 | ||
|
|
b52d166afa | ||
|
|
3952dcb629 | ||
|
|
7e9dd385f5 | ||
|
|
2e81023553 | ||
|
|
b9f994b2c0 | ||
|
|
e98847200e | ||
|
|
a77b21388a | ||
|
|
58ca5fb0f3 | ||
|
|
844214b4a0 | ||
|
|
f9dfca7d5a | ||
|
|
fe40e8867d | ||
|
|
923a90cba0 | ||
|
|
5817e83e33 | ||
|
|
122cabd3ba | ||
|
|
c5d157dd9d | ||
|
|
3a65c0d192 | ||
|
|
e1c011c9a1 | ||
|
|
477ff49f66 | ||
|
|
85eb9b9a53 | ||
|
|
484523b3bb | ||
|
|
5a48edc9ae | ||
|
|
6dc8570d55 | ||
|
|
7e422402d5 | ||
|
|
5f03c20ea0 | ||
|
|
71574e7a6f | ||
|
|
821445d284 | ||
|
|
3eab405e7b | ||
|
|
423ed031b4 | ||
|
|
57390cff04 | ||
|
|
4e637cd1c7 | ||
|
|
add1159675 | ||
|
|
dbdf38cce5 | ||
|
|
47770bd321 | ||
|
|
d656b0d3b9 | ||
|
|
d9deaf9f2f | ||
|
|
b75563b88e | ||
|
|
33e1bf1435 | ||
|
|
d946f38a2b | ||
|
|
b53dffaeed | ||
|
|
6dcfcd11ce | ||
|
|
f21b094dad | ||
|
|
a521ac4ae7 | ||
|
|
d972c17050 | ||
|
|
f6e182ca72 | ||
|
|
6a83bb7508 | ||
|
|
728498fde5 | ||
|
|
05f34bbfaf | ||
|
|
b7e2da7434 | ||
|
|
8e2d03b92c | ||
|
|
308a094d8d | ||
|
|
5757aa8a0c | ||
|
|
8c5b67379f | ||
|
|
b2926eb675 | ||
|
|
ea11709564 | ||
|
|
8550c6bd93 | ||
|
|
65560a583c | ||
|
|
35a791dee5 | ||
|
|
98ffb19746 | ||
|
|
93edd12099 | ||
|
|
9a475bf2d3 | ||
|
|
b512e253b6 | ||
|
|
137c4467ef | ||
|
|
4cacb626a0 | ||
|
|
e3e81879b1 | ||
|
|
acd23551c3 | ||
|
|
2f1691079e | ||
|
|
12bf3bfce4 | ||
|
|
d7555d071f | ||
|
|
9596f7de9d | ||
|
|
20635b40f4 | ||
|
|
1128a40d42 | ||
|
|
1e2e6733df | ||
|
|
2669d3623d | ||
|
|
22fc16b2d0 | ||
|
|
372e858ec8 | ||
|
|
da8c74a44f | ||
|
|
cba9d8d05e | ||
|
|
0e29c2a24a | ||
|
|
9e182722cc | ||
|
|
4f1eb5fdd4 | ||
|
|
53352d0b26 | ||
|
|
1d3a4df3b3 | ||
|
|
afbaf8ae2d | ||
|
|
1b2018e921 | ||
|
|
26642a39c3 | ||
|
|
8723375443 | ||
|
|
82aea04c79 | ||
|
|
341601e1a2 | ||
|
|
368f1a1c9d | ||
|
|
527c6c1ca0 | ||
|
|
a9e8f88e77 | ||
|
|
0cbf1f4027 | ||
|
|
96baa70cc8 | ||
|
|
b18e2129ce | ||
|
|
e26cbdd6cd | ||
|
|
0ebfd54e17 | ||
|
|
8f1cd50f1e | ||
|
|
4fb9f298c9 | ||
|
|
c338d86843 | ||
|
|
247dd8f052 | ||
|
|
71d0847b19 | ||
|
|
c55d144748 | ||
|
|
da91a44f9e | ||
|
|
02d3a2c0fb | ||
|
|
5764619655 | ||
|
|
3c959fd038 | ||
|
|
f0bc94fd02 | ||
|
|
8720cfcce9 | ||
|
|
954c4d03ac | ||
|
|
edf6995be4 | ||
|
|
b50d5758ef | ||
|
|
6c4d0d87f0 | ||
|
|
a962bceca6 | ||
|
|
e0c5c589ad | ||
|
|
dfe87540c6 | ||
|
|
6c4f228f6f | ||
|
|
fe06ae5f48 | ||
|
|
07289f437f | ||
|
|
99d155d80f | ||
|
|
3346c5395e | ||
|
|
083218aca5 | ||
|
|
fd3b3bc1d6 | ||
|
|
9bc6bc83c0 | ||
|
|
d4468b2def | ||
|
|
404a6862cd | ||
|
|
85fc41470b | ||
|
|
2b9dd6c574 | ||
|
|
9e44a53be7 | ||
|
|
0c561f0325 | ||
|
|
e5831f81bb | ||
|
|
fa21986ecf | ||
|
|
772137cabe | ||
|
|
4c53e2f56b | ||
|
|
14140d5249 | ||
|
|
17aa9371b5 | ||
|
|
208995e4a7 | ||
|
|
b503670750 | ||
|
|
7c08e8ea69 | ||
|
|
542426f1f1 | ||
|
|
6319a86178 | ||
|
|
9888e67b20 | ||
|
|
8fe19e344f | ||
|
|
896cfcef95 | ||
|
|
d54180ad8b | ||
|
|
065afe6e0f | ||
|
|
37eccd3117 | ||
|
|
b9dd572a67 | ||
|
|
3fe17e0355 | ||
|
|
6e3a3964ce | ||
|
|
18eb7e6d21 | ||
|
|
e84a790b5d | ||
|
|
20d9070aa1 | ||
|
|
482b2814b4 | ||
|
|
e92c3110a1 | ||
|
|
1ca9241eaa | ||
|
|
0b6889cbd8 | ||
|
|
00410d83fc | ||
|
|
fcad442d80 | ||
|
|
34d22d3f00 | ||
|
|
1326af7eae | ||
|
|
11aa191bdc | ||
|
|
ea844d28fe | ||
|
|
7668bfe6f2 | ||
|
|
493f215513 | ||
|
|
723451a5ce | ||
|
|
326e41d799 | ||
|
|
3ce74eb8fe | ||
|
|
ec4883b6a9 | ||
|
|
e8f69e40d1 | ||
|
|
297fb013cb | ||
|
|
4e52c75568 | ||
|
|
192a303e40 | ||
|
|
dcec8a4112 | ||
|
|
5316f5078f | ||
|
|
286c877853 | ||
|
|
8613285321 | ||
|
|
8a4639cdd6 | ||
|
|
576c20c4e4 | ||
|
|
3a0a6b5db8 | ||
|
|
c039aaad9d | ||
|
|
145bb6e01a | ||
|
|
9cc70d2069 | ||
|
|
3604ad2950 | ||
|
|
1fe3e2ed69 | ||
|
|
baca8bb19e | ||
|
|
1c707d4f99 | ||
|
|
c0e3779453 | ||
|
|
bf6bcde078 | ||
|
|
167a8e5c09 | ||
|
|
90cbdbbe75 | ||
|
|
d83a8eb359 | ||
|
|
98cc39e8e5 | ||
|
|
b20fadd604 | ||
|
|
cdf0f8e68a | ||
|
|
f645009a5e | ||
|
|
2b2736d41a | ||
|
|
5a6029a938 | ||
|
|
8d272db4e6 | ||
|
|
70885d0f9a | ||
|
|
f1e5da6cdd | ||
|
|
d79b9823ae | ||
|
|
82f1ce8ebf | ||
|
|
50ee655f9d | ||
|
|
5459f56f6d | ||
|
|
209531a761 | ||
|
|
2552307064 | ||
|
|
5601b9a66b | ||
|
|
81dcb13783 | ||
|
|
580fd13424 | ||
|
|
790ce3791a | ||
|
|
97cd62a8fb | ||
|
|
2f68bbb5e8 | ||
|
|
55952c0984 | ||
|
|
d9cfdd364b | ||
|
|
c9605e7308 | ||
|
|
c3f97bc9b7 | ||
|
|
4399b734db | ||
|
|
b9581bd50a | ||
|
|
408f15954e | ||
|
|
f585403b36 | ||
|
|
601973ddc2 | ||
|
|
25a5fb8231 | ||
|
|
897e557ce3 | ||
|
|
81bee1f5fd | ||
|
|
691eb1145c | ||
|
|
fb04dff6d7 | ||
|
|
c224ea3ce7 | ||
|
|
2a2fe7208a | ||
|
|
3f9d8011b9 | ||
|
|
4788c5f97d | ||
|
|
a5869ba450 | ||
|
|
7bc324f276 | ||
|
|
8d40b568fa | ||
|
|
0c0afb0039 | ||
|
|
2281ec9a31 | ||
|
|
cd0917fe10 | ||
|
|
1a1519b6cd | ||
|
|
947ccbb597 | ||
|
|
671db5e1e3 | ||
|
|
acfee2538e | ||
|
|
32431cddf8 | ||
|
|
8e302738e8 | ||
|
|
aa2568858e | ||
|
|
5375403b9d | ||
|
|
b0c9809a2e | ||
|
|
19c82e6a43 | ||
|
|
84d21b0972 | ||
|
|
f8e0320722 | ||
|
|
e5a8c35104 | ||
|
|
7ad232d714 | ||
|
|
85804ec70d | ||
|
|
e473ba5e6c | ||
|
|
9120a62cdd | ||
|
|
53ecb3225f | ||
|
|
3f695b8fb7 | ||
|
|
55699dc171 | ||
|
|
fa48d523b2 | ||
|
|
92cbc7c426 | ||
|
|
6f07f2b444 | ||
|
|
f58869d072 | ||
|
|
978c121de1 | ||
|
|
f6a7983a8a | ||
|
|
a1375474d9 | ||
|
|
d0cc75f197 | ||
|
|
0fccfc0373 | ||
|
|
d0a7e6e6a6 | ||
|
|
d7a5bacf15 | ||
|
|
20facb40c3 | ||
|
|
a5498feea6 | ||
|
|
3e4edb2a5a | ||
|
|
92ad431be4 | ||
|
|
123a102c52 | ||
|
|
37477bfbb5 | ||
|
|
bc40dd645a | ||
|
|
e02c8aeb20 | ||
|
|
003ddc763e | ||
|
|
1c3953705c | ||
|
|
b58418b32f | ||
|
|
23190aa60f | ||
|
|
01e6d435fe | ||
|
|
2b21d53857 | ||
|
|
cddfcb1b9d | ||
|
|
6755b7c0a0 | ||
|
|
aac4fc46e9 | ||
|
|
04cfe5a258 | ||
|
|
954cab81b4 | ||
|
|
69601315c4 | ||
|
|
43c6bc6619 | ||
|
|
e0fab690cc | ||
|
|
513d2ae905 | ||
|
|
47f3dc75d8 | ||
|
|
5f529a48e6 | ||
|
|
d9faac618d | ||
|
|
93ee0a8a65 | ||
|
|
15959346fb | ||
|
|
902b4674f9 | ||
|
|
37be9b54ca | ||
|
|
19a833c94e | ||
|
|
169da8aec0 | ||
|
|
20514eca19 | ||
|
|
f54f122637 | ||
|
|
d5b21d7bd0 | ||
|
|
4240423b9c | ||
|
|
74752686f4 | ||
|
|
4205567bb1 | ||
|
|
a20340b5a8 | ||
|
|
932a35c072 | ||
|
|
877a649819 | ||
|
|
5d7b723c16 | ||
|
|
053244db70 | ||
|
|
f7f5514eef | ||
|
|
afa0097ceb | ||
|
|
6e960012c2 | ||
|
|
311a7138b2 | ||
|
|
0ac04347d5 | ||
|
|
610be482fa | ||
|
|
9ad3a17954 | ||
|
|
6e04d697a1 | ||
|
|
916b4d81d0 | ||
|
|
66c6eb5166 | ||
|
|
43b42246d3 | ||
|
|
40a74e46e6 | ||
|
|
c3cd0f3411 | ||
|
|
85e895508b | ||
|
|
37c8232f4d | ||
|
|
f13dd140eb | ||
|
|
de47b58dc1 | ||
|
|
a5ef013e82 | ||
|
|
70da1889ee | ||
|
|
1eb639d55e | ||
|
|
79ca3ceabf | ||
|
|
b5ca8a00af | ||
|
|
2c7d336711 | ||
|
|
15c3e924b8 | ||
|
|
1053a3c440 | ||
|
|
7c30d1fa69 | ||
|
|
031166c34d | ||
|
|
5e769686fb | ||
|
|
df4d181987 | ||
|
|
7fcf6e6068 | ||
|
|
0f9d60a386 | ||
|
|
11a66d74b8 | ||
|
|
d3fdd20471 | ||
|
|
82492ead47 | ||
|
|
00713a7c47 | ||
|
|
420fe4d1e6 | ||
|
|
322a6f46fa | ||
|
|
b6a762232e | ||
|
|
54055b6174 | ||
|
|
3270250184 | ||
|
|
cb7c8255f4 | ||
|
|
60bdac2bbc | ||
|
|
f6c767a372 | ||
|
|
6c89815e8b | ||
|
|
894aff0816 | ||
|
|
556c0a3865 | ||
|
|
4d40bea58a | ||
|
|
ee979ae7b3 | ||
|
|
401e43969c | ||
|
|
5dbd9c0043 | ||
|
|
cd9328fbf5 | ||
|
|
7811f3fc5a | ||
|
|
5f07b96d47 | ||
|
|
bc98dbcab4 | ||
|
|
252bb60036 | ||
|
|
6d34b8a5cd | ||
|
|
ad505e7fff | ||
|
|
e7557a9293 | ||
|
|
757d223064 | ||
|
|
ea4ba3a150 | ||
|
|
32d7d3900d | ||
|
|
b57336ad00 | ||
|
|
ebfe752841 | ||
|
|
14f32577ee | ||
|
|
5618189643 | ||
|
|
cf634d1aff | ||
|
|
edc0d6280a | ||
|
|
6470106eef | ||
|
|
b89540218d | ||
|
|
77c60201d5 | ||
|
|
2482cfca56 | ||
|
|
946755a307 | ||
|
|
98b1f8f059 | ||
|
|
38e3318e5f | ||
|
|
6aad99bd81 | ||
|
|
4b8bd27d08 | ||
|
|
757f558f3b | ||
|
|
1f9283ec82 | ||
|
|
2eb1960523 | ||
|
|
4bf650f021 | ||
|
|
63db58cbfd | ||
|
|
c5a72103bf | ||
|
|
da4b7e430f | ||
|
|
e771503ee5 | ||
|
|
194d18586c | ||
|
|
e1a6f58da6 | ||
|
|
0ae80ce362 | ||
|
|
0c42c51aa4 | ||
|
|
f74a120803 | ||
|
|
911eb0cf2a | ||
|
|
67873e961b | ||
|
|
50e8f8aab9 | ||
|
|
ce6f320947 | ||
|
|
4104376e7c | ||
|
|
ffa0a9ef64 | ||
|
|
eef6b2b442 | ||
|
|
16c20ad873 | ||
|
|
f9bb5382aa | ||
|
|
329b82d284 | ||
|
|
b596639f95 | ||
|
|
d0982536a7 | ||
|
|
798695ff1e | ||
|
|
15320d3b96 | ||
|
|
0e9fb6a0da | ||
|
|
34b8d58871 | ||
|
|
fb4ce71cfc | ||
|
|
7a2c851dfc | ||
|
|
4d55748999 | ||
|
|
e7198f49a4 | ||
|
|
125cc0cd74 | ||
|
|
afab65e8a8 | ||
|
|
7e152f2a48 | ||
|
|
8854ddb728 | ||
|
|
0213f412d1 | ||
|
|
dc99610c36 | ||
|
|
d3c0fe3923 | ||
|
|
997826d794 | ||
|
|
67c69b2298 | ||
|
|
72a49dbbb4 | ||
|
|
0946153b47 | ||
|
|
9b2c2697cb | ||
|
|
a57c6a6763 | ||
|
|
597d90207e | ||
|
|
b1b2369541 | ||
|
|
8a88cea256 | ||
|
|
6f23d9c18c | ||
|
|
dfbffff4b0 | ||
|
|
ea73d7fd70 | ||
|
|
55c52c50d0 | ||
|
|
77bd8c2630 | ||
|
|
3121ee4b2e | ||
|
|
762cee242a | ||
|
|
3a170d2c3e | ||
|
|
e8751d1d5c | ||
|
|
9dd6407bea | ||
|
|
670dd9bbe0 | ||
|
|
9cdc64c97a | ||
|
|
5acfa5bb7b | ||
|
|
38ca2a41f4 | ||
|
|
6e3b9ac058 | ||
|
|
41c561c5cf | ||
|
|
c0abcc6018 | ||
|
|
55537dc218 | ||
|
|
3a79766da6 | ||
|
|
0f79a42333 | ||
|
|
3b79c7168e | ||
|
|
a9b4430888 | ||
|
|
7ca20711a2 | ||
|
|
cad8493e24 | ||
|
|
6bead051d2 | ||
|
|
ac8bd2a227 | ||
|
|
0d96df7a91 | ||
|
|
e2c61d83ef | ||
|
|
9a77c997e2 | ||
|
|
2cee79fbbf | ||
|
|
2c126b201f | ||
|
|
2500debbd2 | ||
|
|
500c41b83b | ||
|
|
2c83047842 | ||
|
|
5f5682240a | ||
|
|
4a70c1393f | ||
|
|
66cd897dc4 | ||
|
|
67e6eee26e | ||
|
|
7ccdb1970a | ||
|
|
539a18e4c7 | ||
|
|
a7083d632b | ||
|
|
44ea37573a | ||
|
|
d54840c152 | ||
|
|
14c085898b | ||
|
|
fb38995d36 | ||
|
|
2cdb87ee62 | ||
|
|
ba8462a458 | ||
|
|
4af81823e2 | ||
|
|
2c28a22971 | ||
|
|
c8e5c85113 | ||
|
|
4c0572a799 | ||
|
|
9aa382e69e | ||
|
|
929e1b6809 | ||
|
|
d3f0d32e16 | ||
|
|
3f309bc36a | ||
|
|
2516b64046 | ||
|
|
0ad0dcc926 | ||
|
|
f81d174f11 | ||
|
|
4fc728b405 |
7
AUTHORS
7
AUTHORS
@@ -14,7 +14,9 @@ David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* Former stable series maintainer. Multiple buffer support,
|
||||
operating dir (-o) option, bug fixes for display routines,
|
||||
wrapping code, spelling fixes, constantshow mode, parts of
|
||||
UTF-8 support, softwrap overhaul, and various other fixes.
|
||||
UTF-8 support, softwrap overhaul, undoable (un)indentations,
|
||||
undoable justifications, justifiable regions, and numerous
|
||||
other fixes.
|
||||
|
||||
Jordi Mallach <jordi@gnu.org>
|
||||
* Debian package maintainer, fellow bug squasher.
|
||||
@@ -67,3 +69,6 @@ Rishabh Dave <rishabhddave@gmail.com>
|
||||
|
||||
Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
|
||||
* Filtering text through an external command.
|
||||
|
||||
Brand Huntsman <alpha@qzx.com>
|
||||
* The delayed parsing of syntax files.
|
||||
|
||||
886
ChangeLog
886
ChangeLog
@@ -1,3 +1,889 @@
|
||||
Changes between v4.5 and v4.6:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (128):
|
||||
bindings: allow to rebind ^/, even though it is synonymous with ^_
|
||||
bindings: don't hard-bind ^H in the help viewer or the file browser
|
||||
bindings: the 'all' keyword should encompass the browser menu too
|
||||
bindings: the 'all' keyword should include the browser menu always
|
||||
build: fix compilation for --enable-tiny --enable-histories
|
||||
build: fix compilation when configured with --disable-color
|
||||
build: slightly speed up the compilation of the tiny version
|
||||
bump version numbers and add a news item for the 4.6 release
|
||||
chars: add a faster version of the character-parsing function
|
||||
commands: rename 'fixer' to 'formatter', to be less misleading
|
||||
cutting: do nothing when trying to chop a word leftward at start of file
|
||||
display: do refresh the edit window when exiting from the help viewer
|
||||
docs: add a note saying that rebinding ^M or ^I is not advisable
|
||||
docs: add the M-F and M-N keystrokes to the cheatsheet
|
||||
docs: adjust the compilation instructions to two-digit version numbers
|
||||
docs: correct the description of the 'spell' menu
|
||||
docs: document the 'fixer' command, a per-syntax content arranger
|
||||
docs: mention that color rules are applied in the order they are listed
|
||||
docs: mention that 'hunspell' is now the first default spelling program
|
||||
docs: mention that the 'nopauses' option is obsolete
|
||||
docs: remove some excessive detail from the sample nanorc file
|
||||
docs: remove the note about the formatter having been removed
|
||||
feedback: say it when spell check or manipulation did not change anything
|
||||
files: distinguish between read error and write error when prepending
|
||||
files: don't mention the name of the temp file when reading goes wrong
|
||||
files: when opening a file for copying, it should NOT be created
|
||||
formatter: accept the formatted result also upon a nonzero exit status
|
||||
formatter: don't let output from the program pollute the screen
|
||||
gnulib: update to its current upstream state
|
||||
history: don't wait when there is something wrong with the history files
|
||||
linter: report it as an error when running the linting program fails
|
||||
rcfile: allow binding also F17...F24
|
||||
rcfile: process extensions to file-matching commands straightaway
|
||||
restored feature: a per-syntax 'fixer' command that processes the buffer
|
||||
softwrap: when switching to another buffer, re-align the starting column
|
||||
speller: prefer 'hunspell' over 'spell', because it can handle UTF-8
|
||||
speller: when 'spell' is not found, try running 'hunspell -l' instead
|
||||
statusbar: show only the first error message, with dots to indicate more
|
||||
syntax: c: recognize some C++ header files by their Emacs modeline
|
||||
syntax: default: don't colorize stuff between two pairs of brackets
|
||||
syntax: html: add a formatter command, making use of 'tidy'
|
||||
syntax: html: colorize only full attributes, and colorize strings later
|
||||
syntax: javascript: colorize also special values 'null' and 'undefined'
|
||||
syntax: javascript: colorize the boolean values 'true' and 'false' too
|
||||
syntax: nanorc: colorize all arguments of 'fixer' and 'linter' as valid
|
||||
syntax: nanorc: colorize in bright red everything that is invalid
|
||||
syntax: nanorc: colorize only lowercase keywords as valid
|
||||
syntax: nanorc: colorize the 'fixer' command as valid
|
||||
syntax: ruby: colorize also lowercase global/instance variables
|
||||
syntaxes: put the 'linter' and 'formatter' commands on a separate line
|
||||
tweaks: add a helper function without the ubiquitous NULL argument
|
||||
tweaks: add a local variable, for clarity, to not preuse another one
|
||||
tweaks: add some "fall-through" comments, and reshuffle some breaks
|
||||
tweaks: add two translator hints
|
||||
tweaks: adjust the indentation after the previous change
|
||||
tweaks: adjust the indentation after the previous change
|
||||
tweaks: adjust the indentation after the previous change, and another
|
||||
tweaks: adjust two comments, to better fit the actual functions
|
||||
tweaks: avoid setting and resetting a variable when there is no need
|
||||
tweaks: avoid three unneeded calls of umask() in the normal case
|
||||
tweaks: be explicit about which program complained
|
||||
tweaks: check the return value of copy_file() also after its other uses
|
||||
tweaks: close the unused reading ends of two more output pipes
|
||||
tweaks: condense a fragment of code by making use of a helper function
|
||||
tweaks: condense or improve some comments
|
||||
tweaks: condense two comments, and rename two parameters
|
||||
tweaks: condense two comments, and rewrap a line
|
||||
tweaks: correct a comment, and retype a variable
|
||||
tweaks: die on an impossible condition -- to be removed later
|
||||
tweaks: don't do in the parent something that only the child needs
|
||||
tweaks: don't wrap calls of statusline() that slightly overshoot 80 cols
|
||||
tweaks: drop the unneeded closing of descriptors when exiting anyway
|
||||
tweaks: elide a duplicate opening of the existing file when prepending
|
||||
tweaks: elide a function call for the plain ASCII case
|
||||
tweaks: elide another two calls of umask(), and rename two variables
|
||||
tweaks: elide an unneeded and leaky function
|
||||
tweaks: elide an unneeded check when making a backup
|
||||
tweaks: elide a variable, and add a condition to elide an assignment
|
||||
tweaks: elide a variable that is the same as another
|
||||
tweaks: exclude two fragments of code from the tiny version
|
||||
tweaks: fuse two regexes into one
|
||||
tweaks: group the closing of descriptors together, for compactness
|
||||
tweaks: group the closing of two descriptors, and reword two comments
|
||||
tweaks: harmonize a message with another
|
||||
tweaks: improve some comments, and trim some repetitive ones
|
||||
tweaks: make a function do a check so its calls don't need to
|
||||
tweaks: mark two strings for translation
|
||||
tweaks: move a call of umask() closer to where it is relevant
|
||||
tweaks: move two functions to after the one that they make use of
|
||||
tweaks: normalize the indentation after the previous change
|
||||
tweaks: order two functions more sensibly
|
||||
tweaks: pass an empty string as an answer instead of a NULL pointer
|
||||
tweaks: pass an empty string for copying instead of a non-existent one
|
||||
tweaks: pass any special undo/redo messages to the add_undo() function
|
||||
tweaks: remove a pointless updating of the title bar
|
||||
tweaks: remove a redundant check for an existing emergency file
|
||||
tweaks: remove the superfluous closing of a file descriptor
|
||||
tweaks: remove two pointless re-inclusion guards
|
||||
tweaks: remove two superfluous conditions when prepending
|
||||
tweaks: rename a function and add a parameter, so it becomes more general
|
||||
tweaks: rename a function, and elide a parameter that is always NULL
|
||||
tweaks: rename a function and elide its first parameter
|
||||
tweaks: rename a local variable, to not shadow another
|
||||
tweaks: rename a variable, to be a bit more fitting
|
||||
tweaks: rename a variable, to be distinct and visible
|
||||
tweaks: rename three variables, and reshuffle some lines
|
||||
tweaks: rename three variables, to be consistent with other linestructs
|
||||
tweaks: rename three variables, to be more descriptive
|
||||
tweaks: rename three variables, to match others elsewhere
|
||||
tweaks: rename two parameters, for contrast and to match others
|
||||
tweaks: rename two parameters plus a variable, to match others
|
||||
tweaks: rename two variables, and add a third, for more contrast
|
||||
tweaks: reshuffle a few declarations, and reduce the scope of one
|
||||
tweaks: reshuffle a fragment of code into two alternatives
|
||||
tweaks: reshuffle an 'if' to avoid a negation, and improve a comment
|
||||
tweaks: reshuffle some declarations, and rename a variable
|
||||
tweaks: reword an undo/redo string that was overlooked during the rename
|
||||
tweaks: silence a warning when configured with --enable-tiny
|
||||
tweaks: simplify the opening of files when prepending
|
||||
tweaks: slightly reword some fragments in the manual's rebinding section
|
||||
tweaks: use a better variable name for the argument of an option
|
||||
tweaks: use a literal NULL instead of a variable that is NULL
|
||||
tweaks: use a simpler positive/negative check for after copy_file()
|
||||
tweaks: use a string-copy function that checks for out-of-memory
|
||||
tweaks: use the given string instead of the found match, for clarity
|
||||
undo: don't try to copy a string that doesn't exist
|
||||
undo: put the cursor back on the original row for a full-buffer operation
|
||||
utils: don't accept NULL for the string to be copied
|
||||
|
||||
Jeroen Roovers (1):
|
||||
syntax: gentoo: highlight the BDEPEND variable as well
|
||||
|
||||
|
||||
Changes between v4.4 and v4.5:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (60):
|
||||
bindings: add a dedicated keycode for <Tab> for when a region is marked
|
||||
bump version numbers and add a news item for the 4.5 release
|
||||
color: don't concatenate an absolute path with the working directory
|
||||
docs: add two examples of the 'tabgives' command to the sample nanorc
|
||||
docs: describe the new syntax-specific 'tabgives' command
|
||||
docs: mark the undoing of justifications as done in the TODO list
|
||||
docs: mention that gcc must be at least version 5.0
|
||||
gnulib: update to its current upstream state
|
||||
mouse: make the clickable width of menu items more consistent
|
||||
new feature: a 'tabgives' command to define what the Tab key produces
|
||||
search: after search-at-startup, store the column (for vertical movement)
|
||||
tweaks: add a translator hint, and correct two others
|
||||
tweaks: add some translator hints, be more precise on permissible length
|
||||
tweaks: add two hints for translators, to try and help avoid mistakes
|
||||
tweaks: adjust indentation after previous change, reshuffle declarations
|
||||
tweaks: avoid a comparison between signed and unsigned [coverity]
|
||||
tweaks: avoid leaking memory when finding an invalid string [coverity]
|
||||
tweaks: avoid recomputing a maximum value every time round the loop
|
||||
tweaks: don't burden all menus with something meant for the WriteOut menu
|
||||
tweaks: elide a function from a non-UTF8 build
|
||||
tweaks: elide two multiplications with something that is always 1
|
||||
tweaks: frob a few comments
|
||||
tweaks: improve a bunch of comments, and reshuffle some declarations
|
||||
tweaks: improve a handful of comments, and reduce the needed padding
|
||||
tweaks: mark as 'const' a parameter that takes fixed strings [coverity]
|
||||
tweaks: meld two calls of free() into a single one, to elide an 'else'
|
||||
tweaks: move a fragment of common code into the appropriate function
|
||||
tweaks: move a function to a better file, to be amongst its kind
|
||||
tweaks: move a function to before its callers and next to its kind
|
||||
tweaks: move two functions to after the ones that they call
|
||||
tweaks: remove some timing code that has served its purpose
|
||||
tweaks: remove two superfluous macros, as sizeof(char) is always 1
|
||||
tweaks: rename a function, to be a bit more fitting
|
||||
tweaks: rename another type, again to better fit the general pattern
|
||||
tweaks: rename another type, to also better fit the general pattern
|
||||
tweaks: rename another variable, for a better fit
|
||||
tweaks: rename a type, to better fit the general pattern
|
||||
tweaks: rename a variable, normalize a comment, and reshuffle a free()
|
||||
tweaks: rename a variable, to be more compact
|
||||
tweaks: rename three variables, for contrast and more sense
|
||||
tweaks: rename three variables, for more contrast
|
||||
tweaks: rename three variables, to better indicate what they hold
|
||||
tweaks: rename two variables, away from single letters
|
||||
tweaks: rename two variables, to better describe what they contain
|
||||
tweaks: reshuffle a fragment, to group some toggles together
|
||||
tweaks: reshuffle a line, to group things better
|
||||
tweaks: reshuffle some lines, to elide an unneeded assignment
|
||||
tweaks: reshuffle some lines, to have the same order as elsewhere
|
||||
tweaks: reshuffle two fragments, to group things better
|
||||
tweaks: rewrap a line, reshuffle a declaration, and improve some comments
|
||||
tweaks: simplify a calculation, as done elsewhere
|
||||
tweaks: simplify the determination of a canonical path
|
||||
tweaks: sort two keywords strictly alphabetically
|
||||
tweaks: speed up determining the width of plain ASCII characters
|
||||
tweaks: speed up the counting of the menu entries to be shown
|
||||
tweaks: use a more effecient way to skip storing an empty file name
|
||||
tweaks: use an early return when there is no tilde
|
||||
tweaks: use 'void' in prototypes of parameterless functions [coverity]
|
||||
usage: mark the -J/--guidestripe option plus argument as translatable
|
||||
usage: properly align --help output also when it has accented characters
|
||||
|
||||
Brand Huntsman (1):
|
||||
search: accept a match at start of file when searching from command line
|
||||
|
||||
Dirkjan Ochtman (1):
|
||||
syntax: rust: add the words reserved in 2018, and remove unreserved ones
|
||||
|
||||
|
||||
Changes between v4.3 and v4.4:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (53):
|
||||
browser: draw a bar of spaces only where needed -- for the selected item
|
||||
build: exclude the search-at-startup feature from the tiny version
|
||||
bump version numbers and add a news item for the 4.4 release
|
||||
copying: do not prevent M-6 from copying emptiness into the cutbuffer
|
||||
display: blank the status bar on a successful cut or paste
|
||||
display: clear the remainder of a row only when there actually is some
|
||||
display: don't clear a row beforehand -- just clear the remainder
|
||||
display: use a somewhat faster method to clear a row
|
||||
display: when linenumbering, correctly spotlight text that spans two rows
|
||||
display: where needed, use slow blanking, but elsewhere do it much faster
|
||||
docs: change a few URLs over to https, and rewrap a couple of NEWS items
|
||||
docs: document the search-at-startup feature (+/string or +?string)
|
||||
docs: make the synopsis of --speller and 'set speller' more accurate
|
||||
docs: mention the M-N toggle instead of the obsolete M-# one
|
||||
docs: slightly reword some of the descriptions around syntax highlighting
|
||||
docs: slightly reword the descriptions of most configure options
|
||||
docs: stop mentioning the 'unjustify' function, as it no longer exists
|
||||
gnulib: update to its current upstream state
|
||||
new document: a condensed overview of nano's shortcut keystrokes
|
||||
new feature: allow specifying a search string to "jump to" at startup
|
||||
rcfile: properly handle an empty syntax before an 'include' statement
|
||||
scrolling: don't overscroll when the edit window has just one row
|
||||
search: don't wipe the status bar at startup when there was an error
|
||||
search: wipe the status bar before searching again (M-W / M-Q)
|
||||
syntax: c: allow an underscore in lowercase type names
|
||||
syntax: default: colorize bracketed section headers in some config files
|
||||
syntaxes: change some unneeded 'icolor' commands to 'color' commands
|
||||
syntaxes: recognize .ctp extension as a PHP file, and .cu as a C/C++ file
|
||||
syntax: perl: avoid recognizing embedded hash signs as a comment starter
|
||||
syntax: perl: avoid upsetting older glibcs with crafty range expression
|
||||
syntax: perl: don't color the character after a variable name
|
||||
syntax: po: colorize numbers only when they form a self-contained word
|
||||
text: copy leading quote characters when automatic hard-wrapping occurs
|
||||
tweaks: add a translator hint, to clarify four short words
|
||||
tweaks: call the correct lighting function directly when softwrapping
|
||||
tweaks: condense some comments, and drop two unneeded initializations
|
||||
tweaks: drop two parameters that are no longer needed
|
||||
tweaks: improve a comment, and drop a superfluous one
|
||||
tweaks: improve a handful of comments
|
||||
tweaks: make a function name unique, to not overlap with others
|
||||
tweaks: move a call from two different places to a single place
|
||||
tweaks: move a function to before the first one that calls it
|
||||
tweaks: move a general function to a better place
|
||||
tweaks: remove a saving and restoring that has become superfluous
|
||||
tweaks: rename a function, to suit better, and reshuffle its parameters
|
||||
tweaks: rename a parameter in three functions, to say what it points to
|
||||
tweaks: reshuffle an assignment, and trim some excessive blank lines
|
||||
tweaks: reshuffle an 'if' out of a function, and rename the function
|
||||
tweaks: reword and condense two comments, and correct another
|
||||
tweaks: rewrap two lines, and reshuffle some logic to make more sense
|
||||
tweaks: shorten two messages that translators tend to make too long
|
||||
tweaks: try the allocation of a multidata cache just once per line
|
||||
tweaks: when precalculating, allocate all the cache space upfront
|
||||
|
||||
Brand Huntsman (3):
|
||||
rcfile: for an empty syntax, show the line number of the 'syntax' command
|
||||
rcfile: report the correct command location for an invalid 'include'
|
||||
search: accept toggles for case and regex when searching at startup
|
||||
|
||||
|
||||
Changes between v4.2 and v4.3:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (235):
|
||||
bindings: at a Yes-No prompt, accept also ^N and ^Q for "No"
|
||||
bindings: at a Yes-No prompt, accept also ^Y for "Yes"
|
||||
bindings: bind the Alt+arrow keystrokes also in non-UTF-8 locales
|
||||
browser: don't show a mistaken message when exiting from help viewer
|
||||
build: avoid a warning on FreeBSD, OpenBSD, and Alpine
|
||||
build: avoid a warning when using --disable-utf8
|
||||
build: exclude the ability to open a FIFO from the tiny version
|
||||
build: fix compilation on another system
|
||||
build: fix compilation when configured with --disable-color
|
||||
build: fix compilation when configured with --enable-tiny
|
||||
build: move an #include to where it is needed
|
||||
build: remove two #includes that don't seem to be needed
|
||||
bump version numbers and add a news item for the 4.3 release
|
||||
chars: create a dedicated function for getting the length of a character
|
||||
chars: redo the speedup for plain ASCII from three commits ago
|
||||
chars: speed up case-insensitive searching by roughly one percent
|
||||
chars: speed up the determination of length and width for plain ASCII
|
||||
copying: let a copy command break a chain of cut or zap commands
|
||||
copying: make M-6 do nothing when at end of buffer
|
||||
copying: scroll just one line when M-6 is pressed on the bottom row
|
||||
cutting: clear the cutbuffer when the previous operation was copying
|
||||
cutting: ignore the mark when a word is deleted
|
||||
display: properly show all characters in a non-UTF-8 build
|
||||
docs: add a light warning to the explanation of --nonewlines
|
||||
docs: adjust the wording of the README to be factually correct
|
||||
docs: clarify that in nano regexes are extended regular expressions
|
||||
docs: mention the default value for 'errorcolor'
|
||||
docs: note Brand as the author of the delayed syntax parsing
|
||||
docs: note David as author of undoable indenting and undoable justifying
|
||||
docs: remove "--" from the default value of 'quotestr'
|
||||
docs: say thanks to the Korean translator, and trim a double space
|
||||
docs: show double quotes where they are needed
|
||||
docs: slightly reword the notice about the changed defaults since 4.0
|
||||
feedback: don't clear off possible error messages after a spell check
|
||||
feedback: don't try to represent keys outside of the seven-bit range
|
||||
feedback: make an error check work also when curses hasn't started yet
|
||||
feedback: print helpful message only when data comes from keyboard
|
||||
feedback: show a more fitting message when opening a FIFO is interrupted
|
||||
feedback: show an appropriate message when reading a file was cut short
|
||||
feedback: treat statusline() being called outside of curses mode as a bug
|
||||
feedback: when the last line is empty, don't include it in the count
|
||||
files: allow a given file to be a special file but not a directory
|
||||
files: allow to abort the reading of slow files with Ctrl+C
|
||||
files: allow to interrupt the opening of a FIFO for writing with Ctrl+C
|
||||
files: allow to interrupt the opening of a FIFO with Ctrl+C
|
||||
files: check for writability by the access bits, not by trying to append
|
||||
files: don't close a newly-created buffer when it is the only one
|
||||
files: don't save the state of the terminal a second time
|
||||
files: don't say "Error...: Success" when aborting after resizing
|
||||
files: give feedback while waiting for a FIFO to open up
|
||||
files: suppress feedback when writing an emergency or temporary file
|
||||
files: try matching a syntax after scooping data from standard input
|
||||
files: when needed, reconnect the keyboard and reenter curses mode
|
||||
gnulib: update to its current upstream state
|
||||
help: don't check for confinement when opening a temporary help-text file
|
||||
help: don't cycle through the buffers for every resizing step
|
||||
help: don't show Alt+Left and Alt+Right when running on a Linux console
|
||||
help: make the column for the first keystroke a little wider
|
||||
help: write the text directly into a new buffer, without using a tempfile
|
||||
justify: remove "--" from the quoting regex, to avoid false paragraphs
|
||||
oops: apparently the line numbers in the cutbuffer do matter
|
||||
rcfile: at terminating points, verify that a defined syntax is not empty
|
||||
rcfile: check for missing color commands only when a syntax is still open
|
||||
rcfile: close off a syntax when a non-syntax command is encountered
|
||||
rcfile: disallow extending a syntax that is defined in a main nanorc
|
||||
rcfile: fully read each included file, so all its syntaxes are seen
|
||||
search: stay in the Search menu when trying to Replace in view mode
|
||||
softwrap: use smooth scrolling when softwrapping is toggled on
|
||||
speller: be more concise and to the point when something goes wrong
|
||||
speller: don't crash when the spell-checked tempfile cannot be opened
|
||||
speller: ensure that a Shift-selected region is retained
|
||||
speller: when something goes wrong with 'sort', do not blame 'spell'
|
||||
startup: remove the now-unneeded workaround for a SIGWINCH during input
|
||||
startup: resave the terminal's state only when there were no signals
|
||||
syntax: po: colorize also escaped hex and octal codes
|
||||
syntax: python: avoid miscoloring stuff between two empty strings
|
||||
tweaks: add a missing forward declaration of make_new_buffer()
|
||||
tweaks: add a pair of braces, to silence a compiler warning
|
||||
tweaks: add a warning for something that shouldn't occur
|
||||
tweaks: adjust a comment and drop two others, and reshuffle two lines
|
||||
tweaks: adjust some indentation after the previous change
|
||||
tweaks: adjust some whitespace and rewrap a few lines
|
||||
tweaks: adjust the indentation after the previous change
|
||||
tweaks: adjust the indentation after the previous change
|
||||
tweaks: avoid an unneeded, extra stat() for temporary files
|
||||
tweaks: avoid parsing a character twice
|
||||
tweaks: be more sparing in redrawing things when exiting from help viewer
|
||||
tweaks: change a function to void, to make things more direct
|
||||
tweaks: check in a single place for files that should not be opened
|
||||
tweaks: close a buffer differently and elide a parameter
|
||||
tweaks: condense a comment and reshuffle a couple of lines
|
||||
tweaks: condense a couple of comments, and reshuffle a line
|
||||
tweaks: condense the setup of the two signal handlers for Ctrl+C
|
||||
tweaks: condense two comments, and normalize the whitespace of a label
|
||||
tweaks: consistently report failures to fork (and the like) as errors
|
||||
tweaks: delete a leftover
|
||||
tweaks: delete a now-unused function
|
||||
tweaks: delete a now-unused function
|
||||
tweaks: don't bother calling mblen() in a non-UTF-8 build
|
||||
tweaks: don't bother checking the return value of wait()
|
||||
tweaks: don't bother keeping track of whether a squeezed line has shrunk
|
||||
tweaks: don't bother renumbering the lines in the cutbuffer
|
||||
tweaks: don't bother saving and restoring 'cutbottom' all the time
|
||||
tweaks: don't bother to free the content of 'extendsyntax' commands
|
||||
tweaks: don't check the user's nanorc file for accessibility twice
|
||||
tweaks: drop an unneeded parameter from open_file()
|
||||
tweaks: drop a useless tidying-up call, as spelling does not use regexes
|
||||
tweaks: drop most of the remaining debugging code, and some timing code
|
||||
tweaks: drop some checks that were made redundant by the previous commit
|
||||
tweaks: drop two checks that were made redundant by the previous commit
|
||||
tweaks: elide a function that is an amalgam of three others
|
||||
tweaks: elide a function that is called in just one place
|
||||
tweaks: elide a function that is used just once
|
||||
tweaks: elide another parameter, and rename the function to match
|
||||
tweaks: elide an unneeded, duplicate stat() for the FIFO check
|
||||
tweaks: elide an unneeded 'if' and 'break'
|
||||
tweaks: elide an unneeded variable
|
||||
tweaks: elide a parameter and a return value
|
||||
tweaks: elide a pre-processor #else clause, by using braces instead
|
||||
tweaks: elide a variable, drop a comment, and remove unneeded braces
|
||||
tweaks: elide two unneeded variables
|
||||
tweaks: enforce the miminum amount of scrolling in a simpler way
|
||||
tweaks: exclude a bug check from the tiny version
|
||||
tweaks: exclude another bug check from the tiny version
|
||||
tweaks: factor out a fragment of code that is repeated three times
|
||||
tweaks: factor out the installing and restoring of the ^C signal handler
|
||||
tweaks: improve a couple of comments
|
||||
tweaks: improve a handful of comments
|
||||
tweaks: improve some comments, reshuffle a line, and rename a variable
|
||||
tweaks: include the enabling of SIGINT into the tiny version
|
||||
tweaks: invert a condition, in order to return earlier
|
||||
tweaks: invert two conditions, in order to elide an extra variable
|
||||
tweaks: just mark four rcfile errors for translation, like the others
|
||||
tweaks: make better use of two variables, and reshuffle two comments
|
||||
tweaks: merge two functions, as the first is called just once
|
||||
tweaks: merge two functions, as the one is used only by the other
|
||||
tweaks: merge two very similar functions into a single one
|
||||
tweaks: move a bit of timing code to where it will be needed
|
||||
tweaks: move a function to the file where it is used
|
||||
tweaks: move an assignment that is useful only when searching forward
|
||||
tweaks: move a syntax check to a better place, to reduce duplication
|
||||
tweaks: move the tyding-up-after-a-search to a single exit point
|
||||
tweaks: normalize the indentation after the previous two changes
|
||||
tweaks: place a function better, and reduce some comments to a single one
|
||||
tweaks: put some timing code back into the search function
|
||||
tweaks: really don't bother renumbering the lines in the cutbuffer
|
||||
tweaks: reduce a bit of mark-adjusting code to its essence
|
||||
tweaks: reduce the scope of a variable, and let the compiler zero it
|
||||
tweaks: remove a bit of redundant code
|
||||
tweaks: remove a check that is no longer relevant
|
||||
tweaks: remove a condition that has become superfluous
|
||||
tweaks: remove an unneeded "closing" of a syntax after extending it
|
||||
tweaks: remove an unneeded setting and unsetting of a flag
|
||||
tweaks: remove a superfluous and ineffective assignment
|
||||
tweaks: remove a superfluous condition, in three places
|
||||
tweaks: remove four unneeded pre-processor directives
|
||||
tweaks: remove some unneeded braces, and reshuffle for more symmetry
|
||||
tweaks: remove the two remaining handfuls of asserts
|
||||
tweaks: remove two more unneeded assignments
|
||||
tweaks: remove two unneeded assignments, and improve a comment
|
||||
tweaks: remove two unneeded checks for NULL
|
||||
tweaks: rename a bunch of variables, to become identical to others
|
||||
tweaks: rename a function and a variable, for contrast and variety
|
||||
tweaks: rename a function and its parameters, to be more fitting
|
||||
tweaks: rename a function, to be clearer and to stop using an old abbrev
|
||||
tweaks: rename a function, to be more fitting
|
||||
tweaks: rename a function, to better indicate what it does
|
||||
tweaks: rename a function, to better suit what it does
|
||||
tweaks: rename a parameter and a variable, to be more distinct
|
||||
tweaks: rename a struct element, to be distinct
|
||||
tweaks: rename a type, for more contrast
|
||||
tweaks: rename a type, to make more sense
|
||||
tweaks: rename a variable, reduce its scope, and use it consistently
|
||||
tweaks: rename a variable, reshuffle declarations, and drop an assert
|
||||
tweaks: rename a variable, to be shorter
|
||||
tweaks: rename a variable, to better indicate it contains two characters
|
||||
tweaks: rename a variable, to better suit its counterpart
|
||||
tweaks: rename a variable, to fit a bit better
|
||||
tweaks: rename a variable, to fit a little better
|
||||
tweaks: rename a variable, to get out of the way of the next commit
|
||||
tweaks: rename a variable, to match another with the same meaning
|
||||
tweaks: rename a variable, to match the style of its brothers
|
||||
tweaks: rename four elements of the holder struct, for more contrast
|
||||
tweaks: rename some single-letter variables to the same significant word
|
||||
tweaks: rename three variables, to get rid of a suffix or an underscore
|
||||
tweaks: rename three variables, to use full words instead of abbrevs
|
||||
tweaks: rename two functions, to be simpler
|
||||
tweaks: rename two functions, to better describe what they do
|
||||
tweaks: rename two functions, to get rid of the "mb" abbreviation
|
||||
tweaks: rename two more functions, to be simpler too
|
||||
tweaks: rename two parameters, away from single letters
|
||||
tweaks: rename two parameters, for more contrast, and elide another
|
||||
tweaks: rename two parameters, to differentiate them from function names
|
||||
tweaks: rename two variables, and frob some comments
|
||||
tweaks: rename two variables, and reshuffle their declarations
|
||||
tweaks: rename two variables, away from a single letter
|
||||
tweaks: rename two variables, for more contrast
|
||||
tweaks: rename two variables, for more contrast with the partition stuff
|
||||
tweaks: rename two variables, to be less cryptic
|
||||
tweaks: rename two variables, to be unique
|
||||
tweaks: rename two variables, to not be abbreviations
|
||||
tweaks: reorder some code, to further optimize display_string() for ASCII
|
||||
tweaks: reshuffle a bit of code, to be less intertwined
|
||||
tweaks: reshuffle a couple of lines and adjust a few comments
|
||||
tweaks: reshuffle a few lines, to be more straightforward
|
||||
tweaks: reshuffle a few things, partly to make two chunks more alike
|
||||
tweaks: reshuffle an assignment, to be able to return earlier
|
||||
tweaks: reshuffle some closing and switching to a better place
|
||||
tweaks: reshuffle some code to the one place that needs it
|
||||
tweaks: reshuffle some lines and frob some comments
|
||||
tweaks: reshuffle some lines, to group things more sensibly
|
||||
tweaks: reshuffle some lines, to put the most likely candidate first
|
||||
tweaks: reshuffle some lines, to reduce duplication
|
||||
tweaks: reshuffle two #ifdefs, to avoid an unpaired brace
|
||||
tweaks: reuse the install and restore functions for a signal handler
|
||||
tweaks: set a boolean directly, instead of using a function call
|
||||
tweaks: set a boolean directly, instead of using a function call
|
||||
tweaks: sort three translator names better
|
||||
tweaks: specifically refer to the manual of GNU grep for more regex info
|
||||
tweaks: speed up the counting of characters in mbstrlen()
|
||||
tweaks: squeeze excess spaces out of a line in situ
|
||||
tweaks: step away one character from the current bracket, not one byte
|
||||
tweaks: stop allocating and freeing a holder struct for every cut/paste
|
||||
tweaks: stop checking for a NULL result from line_from_number()
|
||||
tweaks: stop passing 'cutbuffer' and 'cutbottom' back and forth
|
||||
tweaks: switch to the preceding buffer in a cheaper way (when in help)
|
||||
tweaks: use a cheaper way to switch between buffers where possible
|
||||
tweaks: use a more direct call when a single linestruct is deleted
|
||||
tweaks: use a slightly faster function where appropriate
|
||||
tweaks: use a symbol instead of zero to refer to standard input
|
||||
tweaks: use FALSE for booleans instead of zero
|
||||
tweaks: when OR'ing, put the most likely condition first
|
||||
usage: make the --help output independent from the terminal's tab size
|
||||
zapping: disjoin a zap command from earlier ones when the mark is set
|
||||
zapping: use the 'keep_cutbuffer' logic to keep undo items apart
|
||||
|
||||
Brand Huntsman (6):
|
||||
files: block SIGWINCH while opening a FIFO for reading or writing
|
||||
rcfile: compile the color regexes just once
|
||||
rcfile: fully parse a syntax file only when needed
|
||||
rcfile: store errors and display them when nano terminates
|
||||
startup: prevent a crash when no applicable syntax is found
|
||||
tweaks: remove an unneeded pre-processor '#else' clause
|
||||
|
||||
|
||||
Changes between v4.1 and v4.2:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (23):
|
||||
build: be more specific and avoid committing accidentally changed files
|
||||
bump version numbers and add a news item for the 4.2 release
|
||||
docs: put the 'set guidestripe' option into its alphabetical position
|
||||
options: make --breaklonglines work also when --ignorercfiles is used
|
||||
speller: do not crash by trying to free something that cannot be freed
|
||||
tweaks: adjust a few comments and some indentation
|
||||
tweaks: condense and improve a handful of comments
|
||||
tweaks: declare a function as const and let its allocated string leak
|
||||
tweaks: drop an unneeded saving and restoring of a variable
|
||||
tweaks: elide an unneeded intermediate variable
|
||||
tweaks: elide an unneeded parameter, as the function already assumes it
|
||||
tweaks: elide an unneeded variable
|
||||
tweaks: exclude a bit more code from a single-buffer build
|
||||
tweaks: remove an unneeded condition
|
||||
tweaks: remove a redundant, enclosed #ifdef
|
||||
tweaks: rename a function, to be distinct and fitting
|
||||
tweaks: rename another function, to be distinct and fitting
|
||||
tweaks: rename a variable, for a little more meaning
|
||||
tweaks: rename a variable, to distinguish it from a browser function
|
||||
wrapping: add a missing space only when the remainder will be prepended
|
||||
wrapping: compute the width of a succeeding line in the correct manner
|
||||
wrapping: improve the persistence of the prepending behavior
|
||||
wrapping: trim any trailing blanks when cursor goes to next line
|
||||
|
||||
|
||||
Changes between v4.0 and v4.1:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (85):
|
||||
bindings: add easier keystrokes for the linenumber and softwrap toggles
|
||||
bindings: disallow executing an external command when in view mode
|
||||
bindings: recognize the ^W^Y and ^W^V legacy keystrokes again
|
||||
bindings: remove the jumpy-scrolling toggle entirely
|
||||
build: add gnulib modules to the list of files with translatable strings
|
||||
build: add src/cut.c to the list of files with translatable strings
|
||||
build: don't do fuzzy matching when merging PO files against the POT file
|
||||
build: remove obsolete translations from the PO files after merging
|
||||
bump version numbers and add a news item for the 4.1 release
|
||||
display: report and catch a bad state, to prevent a possible hang
|
||||
docs: for two of the toggles, mention the new instead of the old option
|
||||
docs: give the FILES section in the man page its canonical title
|
||||
docs: mention that -b is the opposite of -w also in the latter's item
|
||||
docs: mention that M-S now toggles softwrap and M-N line numbers
|
||||
docs: put paths and filenames in italics, per 'man man-pages'
|
||||
docs: remove all mention of --finalnewline, and undefault --nonewlines
|
||||
docs: remove the AUTHOR section, per advice from 'man man-pages'
|
||||
docs: re-title the temporary section about the changed defaults
|
||||
feedback: replace an assert with a check plus error message at startup
|
||||
feedback: show a message while executing an external command
|
||||
feedback: spare the user a superfluous scaring when trying to exit
|
||||
gnulib: update to its current upstream state
|
||||
help: don't doubly list toggles that have two keys assigned to them
|
||||
indenting, commenting: ensure a partial line stays displayed properly
|
||||
justify: correctly compute the number of lines to take, to avoid a crash
|
||||
options: make --nowrap override again a contrary nanorc setting
|
||||
options: remove -f (--finalnewline); go back to auto-adding this newline
|
||||
rcfile: don't break a chain of 'else if' [scan-build]
|
||||
rcfile: read the syntax files in alphabetical order when globbing
|
||||
speller: block the resizing signal again during an external spell check
|
||||
speller: block the resizing signal also during an integrated spell check
|
||||
speller: resizing can happen also when configured with --enable-tiny
|
||||
syntax: c: color as a type any lowercase word that ends with "_t"
|
||||
syntax: default: color in red also versions 4.x of nano
|
||||
syntax: man: add comments, and color all the safe lowercase macros
|
||||
syntax: man: anchor macros at start of line, as only then they are valid
|
||||
syntax: man: require the dot to be at start of line, not the comment
|
||||
syntax: nanorc: colorize also strings preceded by 'start=' or 'end='
|
||||
syntax: nanorc: require whitespace both before and after a quoted string
|
||||
tweaks: adjust the indentation after the previous change
|
||||
tweaks: condense a bit of copying code
|
||||
tweaks: consistently use .sp instead of .PP to insert a blank line
|
||||
tweaks: do a check up front instead of every time round the loop
|
||||
tweaks: don't bother copying the NUL byte -- it is set nine lines down
|
||||
tweaks: don't bother reallocating the data when a line gets hard-wrapped
|
||||
tweaks: don't bother reallocating the squeezed string, just terminate it
|
||||
tweaks: don't bother special-casing non-UTF8 when seeking a character
|
||||
tweaks: drop an assignment whose value is never used [scan-build]
|
||||
tweaks: drop two 'const' qualifiers, to silence the compiler
|
||||
tweaks: free some memory before a possible error exit [coverity]
|
||||
tweaks: free the copy of a linter message in all cases [valgrind]
|
||||
tweaks: free the result string from an invocation error [coverity]
|
||||
tweaks: initialize a boolean before it is referenced [valgrind]
|
||||
tweaks: put the unblocking of SIGWINCHes in a better place
|
||||
tweaks: remove a function that is now unused
|
||||
tweaks: remove an unneeded check for NULL and its associated message
|
||||
tweaks: remove an unneeded check for NULL [coverity]
|
||||
tweaks: remove an unpaired closing parenthesis from the NEWS file
|
||||
tweaks: remove a superfluous check for NULL plus the associated message
|
||||
tweaks: remove several unneeded bad-state checks and their messages
|
||||
tweaks: rename a cryptic type to something that makes a little sense
|
||||
tweaks: rename a function plus parameter, to stay closer to what it does
|
||||
tweaks: rename another variable, to be more descriptive
|
||||
tweaks: rename another variable, to be more fitting
|
||||
tweaks: rename an overshort type to something that makes some sense
|
||||
tweaks: rename a variable, to be more distinct and more apt
|
||||
tweaks: rename a variable, to be more distinct and more descriptive
|
||||
tweaks: rename a variable, to get out of the way for another rename
|
||||
tweaks: rename some variables, for more contrast and to match others
|
||||
tweaks: rename some variables, to be less repititious
|
||||
tweaks: rename two variables, for more contrast
|
||||
tweaks: rename two variables, to be more distinct and more fitting
|
||||
tweaks: rename two variables, to make more sense
|
||||
tweaks: rename two variables, to match others
|
||||
tweaks: reshuffle some lines, condense a comment and drop another
|
||||
tweaks: reshuffle some lines, to elide an 'if'
|
||||
tweaks: reshuffle two lines, and reword a comment
|
||||
tweaks: reword a comment, and drop an unneeded assert
|
||||
tweaks: shorten a comment to its essence
|
||||
tweaks: shorten and improve some comments, and reshuffle a few lines
|
||||
tweaks: simplify a message, and normalize the spelling of another one
|
||||
tweaks: stop doing tandem assignments (one passing through the other)
|
||||
tweaks: switch back from checking FINAL_NEWLINE to checking NO_NEWLINES
|
||||
tweaks: use a signed type for a result that could be negative [coverity]
|
||||
unindent: ensure that a partial line gets displayed properly afterwards
|
||||
|
||||
Brand Huntsman (1):
|
||||
files: block the resizing signal while reading from an external command
|
||||
|
||||
Devin Hussey (1):
|
||||
files: initialize a variable before referencing it
|
||||
|
||||
Liu Hao (1):
|
||||
syntax: c: change the highlighting of preprocessor directives
|
||||
|
||||
|
||||
Changes between v3.2 and v4.0:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (190):
|
||||
bindings: change the action of <Alt+Up>/<Alt+Down> to 'scroll linewise'
|
||||
bindings: hard-bind ASCII code 0x08 (BS) to the backspace function
|
||||
bindings: make the normal scrolling keystrokes work also in help viewer
|
||||
bindings: provide usable shortcuts for prevword/nextword in tiny version
|
||||
bindings: rename 'cutwordleft' to 'chopwordleft', and similar for right
|
||||
browser, help: make <Bsp> page up also when terminfo mismatches terminal
|
||||
browser: say "Close" instead of "Exit" for the ^X shortcut
|
||||
browser: show the ^G item again in the help lines
|
||||
build: eradicate the --disable-wrapping-as-root configure option
|
||||
build: fix compilation when configured with --disable-utf8
|
||||
build: use wget over https (instead of plain rsync) to fetch PO files
|
||||
build: verify that 'pkg.m4' is available when building from git
|
||||
bump version numbers and add a news item for the 4.0 release
|
||||
copyright: update the years for significantly changed files
|
||||
copyright: update the years for the FSF
|
||||
copyright: update the years for the FSF in the documentation too
|
||||
cutting: cover the corner cases where cut commands do not cut anything
|
||||
cutting: give feedback when otherwise nothing happens
|
||||
cutting: when ^K does not actually cut anything, do not add an undo item
|
||||
display: account for horizontal scrolling when drawing the guide stripe
|
||||
display: account for zero-width characters when reserving space for '>'
|
||||
display: change the "$" continuation character to ">" and "<"
|
||||
display: dot the stripe when it's in the last column, to defeat a VTE bug
|
||||
display: ensure that spotlighted text is not treated as a prompt answer
|
||||
display: highlight the ">"/"<" continuation characters in reverse video
|
||||
display: represent half of a double-width character with "[" and "]"
|
||||
display: scroll horizontally one column earlier
|
||||
display: show "[" for half of two-column character also when softwrapping
|
||||
display: show it in title bar when starting up in restricted mode
|
||||
display: use non-breaking space instead of dot for VTE-bug workaround
|
||||
docs: add notes to draw attention to the changed defaults
|
||||
docs: adjust and extend the Pico-compatibility section in the manual
|
||||
docs: adjust for the enhancement of the default quoting regex
|
||||
docs: correct the descriptions of 'speller' and 'linter' functions
|
||||
docs: deprecate the use of morespace, smooth, nonewlines, and nowrap
|
||||
docs: describe breaklonglines, emptyline, finalnewline, jumpyscrolling
|
||||
docs: describe the four new options (-b, -f, -j, -e)
|
||||
docs: describe the new options -J, --guidestripe, and 'set stripecolor'
|
||||
docs: harmonize the style of bindable-function descriptions
|
||||
docs: mention nano's major features directly instead of referring
|
||||
docs: mention that 'cutwordleft' is bound to <Shift+Ctrl+Delete>
|
||||
docs: mention that --morespace and --smooth are obsolete and ignored
|
||||
docs: mention that 'quotestr' enables the rewrapping of comment blocks
|
||||
docs: mention three features in their proper place
|
||||
docs: remove from the FAQ some items that are no longer relevant
|
||||
docs: remove the mentioning of --disable-wrapping-as-root from the FAQ
|
||||
docs: reword and reshuffle the description of --rawsequences
|
||||
docs: say that --rebinddelete can correct both <Backspace> and <Delete>
|
||||
docs: stop implying that nano wants to be fully compatible with Pico
|
||||
docs: stop saying that --fill switches on automatic hard-wrapping
|
||||
docs: suggest a setting for 'stripecolor' in the sample nanorc
|
||||
docs: update the links in the FAQ to the mailing-list info pages
|
||||
feedback: complete the removal of some superfluous words
|
||||
feedback: make two error messages better match the option
|
||||
feedback: remove some superfluous words from Undid/Redid messages
|
||||
files: retain a Shift-selected region when switching between buffers
|
||||
gnulib: update to its current upstream state
|
||||
help, docs: say "Delete" when things don't go into the cutbuffer
|
||||
help: don't advertise ^S and ^Q when --preserve is used
|
||||
help: don't list the obsoleted -O and -S options in the --help output
|
||||
help: don't list the unbound <Alt+Up> and <Alt+Down> in the tiny version
|
||||
help: in the tiny version, don't list an option that is the default
|
||||
help: reword the description of ^U to avoid the impression of "Undo"
|
||||
help: reword the tags for deleting a word left and right
|
||||
justify: correctly detect when we've reached end of buffer
|
||||
justify: extend the quoting regex, to cover more types of comments
|
||||
justify: move the check for a bad quoting regex to a better place
|
||||
menus: don't show ^S and ^Q in the help lines in the tiny version
|
||||
menus: move the paragraph-jumping functions from Search to Goto-Line
|
||||
menus: put the ^T toggle in Search in the same position as in Goto-Line
|
||||
menus: remove the ^Y and ^V shortcuts from the Search menus
|
||||
new feature: option --guidestripe that shows a vertical guiding bar
|
||||
options: actually rename --rebindkeypad to --rawsequences (-K)
|
||||
options: add -b, --breaklonglines, the counterpart of --nowrap
|
||||
options: add -e, --emptyline, the counterpart of --morespace
|
||||
options: add -f, --finalnewline, the counterpart of --nonewlines
|
||||
options: add -j, --jumpyscrolling, the counterpart of --smooth
|
||||
options: disable hard-wrapping and automatic newlines by default
|
||||
options: let --fill no longer imply automatic hard-wrapping
|
||||
options: make -d (--rebinddelete) work without -K (--rebindkeypad)
|
||||
options: make --rawsequences disable --mouse, to prevent entering junk
|
||||
options: rename long version of -K from --rebindkeypad to --rawsequences
|
||||
options: stop recognizing and ignoring -b, -e, -f, -j, and -q
|
||||
options: stop recognizing and mentioning --quiet and 'set quiet'
|
||||
options: warn when option -O or -S is given, and ignore them
|
||||
prompt: trim a double-width character at the screen's edge
|
||||
rcfile: add 'stripecolor' for changing the color of the guiding stripe
|
||||
rcfile: add the options that correspond to -b, -f, -j, and -e
|
||||
rcfile, docs: remove deprecated forms of two options and five bindables
|
||||
rcfile: don't report an error when the globbing pattern matches nothing
|
||||
rcfile: reject an attempt to bind ^[
|
||||
rcfile: when a keystroke is rebound, don't bother unbinding it
|
||||
rcfile: when an old flag is unset, set the corresponding new flag
|
||||
rcfile: when rebound, DO unbind a keystroke from its earlier function
|
||||
startup: check again for a Linux console after reading all files
|
||||
startup: check that a backup directory is valid also when backups are off
|
||||
startup: improve two error messages by mentioning the invalid operand
|
||||
syntax: nanorc: stop coloring 'unset fill ...' as if it were valid
|
||||
syntax: tcl: colorize comments normally, not with a background hue
|
||||
text: turn the mark off when justifying, to not confuse an undo
|
||||
tweaks: add a consistency check plus a corresponding warning
|
||||
tweaks: add an alias for a string variable, so the code makes more sense
|
||||
tweaks: add deprecation comments to the four superseded options
|
||||
tweaks: add two comments, and reduce the scope of another variable
|
||||
tweaks: adjust indentation after previous change, and rename a parameter
|
||||
tweaks: adjust the indentation after the previous change
|
||||
tweaks: avoid parsing the same character twice
|
||||
tweaks: calculate the length of a completion word in a more direct way
|
||||
tweaks: change do_para_end() to not step beyond end of paragraph
|
||||
tweaks: condense a comment, and drop two others
|
||||
tweaks: condense a couple of comments and rewrap a few lines
|
||||
tweaks: condense a handful of comments
|
||||
tweaks: condense and correct a comment
|
||||
tweaks: condense and improve a couple of comments
|
||||
tweaks: condense and improve a handful of comments, and rewrap two lines
|
||||
tweaks: condense the logic of find_paragraph()
|
||||
tweaks: condense two regexes in the Tcl syntax, and add a comment
|
||||
tweaks: correct a comment typo, and trim a few other comments
|
||||
tweaks: don't bother executing two functions that are empty
|
||||
tweaks: don't bother special-casing non-UTF8 when checking for a blank
|
||||
tweaks: don't bother trying to draw characters beyond the screen's edge
|
||||
tweaks: don't bother zeroing the x position when doing a full justify
|
||||
tweaks: don't pass a pointer when a boolean is expected
|
||||
tweaks: elide a function that is called just once
|
||||
tweaks: elide an unneeded intermediate variable
|
||||
tweaks: elide a one-line function that is used just twice
|
||||
tweaks: elide a parameter -- do the NULL checks in the caller
|
||||
tweaks: elide a parameter that is always TRUE
|
||||
tweaks: elide a tiny function by making a variable global
|
||||
tweaks: elide a variable that is a copy of another
|
||||
tweaks: elide two unneeded intermediate variables
|
||||
tweaks: escape hyphens that must be hard hyphens in the man pages
|
||||
tweaks: exclude the guide-stripe code from the tiny version
|
||||
tweaks: hard-bind ASCII DEL in a slightly more economical way
|
||||
tweaks: improve a comment, and add an intermediate variable for clarity
|
||||
tweaks: improve a comment, to better match the changed code
|
||||
tweaks: improve and condense some comments, and remove an unneeded one
|
||||
tweaks: make an assignment only when the option is valid, like elsewhere
|
||||
tweaks: move declaration of variable that does not need to be global
|
||||
tweaks: move the character/word-deletion functions to a better location
|
||||
tweaks: move the check for beginning-of-paragraph to a better place
|
||||
tweaks: move the checks for git and gettext to a far earlier point
|
||||
tweaks: reduce a bunch of repetitious comments to their essence
|
||||
tweaks: reduce the scope of a variable, and rename it
|
||||
tweaks: reduce the scope of two variables, and rename one of them
|
||||
tweaks: reduce two parameters to a single one by summing them
|
||||
tweaks: refer to the magic line as "magic line", not as "magicline"
|
||||
tweaks: remove a superfluous check for a special case
|
||||
tweaks: remove a superfluous incrementing and decrementing of a variable
|
||||
tweaks: remove a variable that is no longer used
|
||||
tweaks: remove two tag definitions that are no longer needed
|
||||
tweaks: rename a function for aptness, and two variables for shortness
|
||||
tweaks: rename a function, to be simpler and more accurate
|
||||
tweaks: rename and invert a function, to avoid double negatives
|
||||
tweaks: rename an overlooked variable from a single letter to a word
|
||||
tweaks: rename a parameter plus a variable, and reshuffle an assignment
|
||||
tweaks: rename a struct element, to make sense
|
||||
tweaks: rename a symbol, to match its corresponding option
|
||||
tweaks: rename a type, to make more sense
|
||||
tweaks: rename a variable, because it also serves as "last line"
|
||||
tweaks: rename a variable, elide another, and adjust two comments
|
||||
tweaks: rename a variable, to be more distinct
|
||||
tweaks: rename four functions, to make more sense
|
||||
tweaks: rename some variables from a single letter to meaningful word
|
||||
tweaks: rename some variables, to match others that have the same task
|
||||
tweaks: rename three functions and two symbols, to match the new wording
|
||||
tweaks: rename three variables, and reshuffle two declarations
|
||||
tweaks: rename two parameters to be more descriptive
|
||||
tweaks: rename two variables, to be less confusing
|
||||
tweaks: rename two variables, to be more descriptive
|
||||
tweaks: rename two variables, to indicate better what they mean
|
||||
tweaks: renumber some FAQ items, to compensate for the deleted ones
|
||||
tweaks: reorder some ifs, to reduce the average number of comparisons
|
||||
tweaks: reshuffle a bit of code, to have the exit point near the end
|
||||
tweaks: reshuffle a few lines, and condense some comments
|
||||
tweaks: reshuffle and frob a couple of comments, and reindent two lines
|
||||
tweaks: reshuffle some code, to require two fewer ifs
|
||||
tweaks: reword the description of the disadvantages of Pico
|
||||
tweaks: rewrap a line and improve a few comments
|
||||
tweaks: schedule a call of edit_refresh() instead calling it directly
|
||||
tweaks: slightly indent warnings and errors during the configure phase
|
||||
tweaks: slightly reword, for esthetics of the resulting Info document
|
||||
tweaks: split a variable into two, as they have different roles
|
||||
tweaks: switch from checking MORE_SPACE to checking EMPTY_LINE
|
||||
tweaks: switch from checking SMOOTH_SCROLL to checking JUMPY_SCROLLING
|
||||
tweaks: switch from referencing NO_NEWLINES to referencing FINAL_NEWLINE
|
||||
tweaks: switch from referencing NO_WRAP to referencing BREAK_LONG_LINES
|
||||
tweaks: word some comments more concisely
|
||||
undo: set the correct file size for a redo of a character deletion
|
||||
utils: retire the fixbounds() function -- it is no longer needed
|
||||
|
||||
Brand Huntsman (1):
|
||||
history: use an unfreed 'position_history' to avoid a possible crash
|
||||
|
||||
David Lawrence Ramsey (34):
|
||||
display: correctly trim an overshooting character from a prompt answer
|
||||
display: correct the logic for making room for the ">" character
|
||||
display: properly handle double-width characters when spotlighting
|
||||
display: properly trim double-width characters at the edit window's edge
|
||||
display: show the guide stripe for double-width/multi-byte characters
|
||||
docs: remove references to not being able to undo justifications
|
||||
input: properly handle <Escape>s followed by a shifted Meta+letter
|
||||
justify: handle the leading part when justifying a marked region
|
||||
justify: initialize a variable before making use of its value
|
||||
justify: put a mid-line marked region onto separate lines
|
||||
justify: when justifying a marked region, strip whitespace after the lead
|
||||
moving: make the generic paragraph movement functions work on any buffer
|
||||
new feature: marked text gets justified into a single, new paragraph
|
||||
options: exit on a bad quoting regex, instead of crashing later
|
||||
text: hook the new justify mechanism up to the undo system
|
||||
text: make do_justify() use the cutbuffer
|
||||
text: make find_paragraph() work on any buffer
|
||||
text: make justify_format() work on any buffer
|
||||
text: make justify_paragraph() work on any buffer
|
||||
text: prepare to make find_paragraph() work on any buffer
|
||||
text: properly check again for no paragraphs after the current line
|
||||
text: remove the old unjustify mechanism, to prepare for the new justify
|
||||
tweaks: adapt find_paragraph()/justify_paragraph() for multiple quotes
|
||||
tweaks: adjust indentation after the previous commit
|
||||
tweaks: adjust some indentation after the previous change
|
||||
tweaks: normalize the indentation, and remove unneeded braces
|
||||
tweaks: remove unnecessary variable initializations
|
||||
tweaks: rename a variable, to prepare for its new role
|
||||
tweaks: split justify_paragraph() into three separate functions
|
||||
tweaks: swap the names of the variables 'wrap_at' and 'fill'
|
||||
tweaks: use proper variable types in the word-completion functions
|
||||
undo: after undoing a cut, don't remove the magicline if we're on it
|
||||
undo: set and check 'xflags' in a bitwise manner
|
||||
undo: when undoing a cut, remove also the magicline if it added one
|
||||
|
||||
|
||||
Changes between v3.1 and v3.2:
|
||||
------------------------------
|
||||
|
||||
|
||||
19
IMPROVEMENTS
19
IMPROVEMENTS
@@ -1,6 +1,18 @@
|
||||
Improvements in GNU nano
|
||||
========================
|
||||
|
||||
Since 4.0:
|
||||
- What the <Tab> key produces can be specified per syntax with 'tabgives'.
|
||||
- The ability to perform a search at startup with +/string or +?string.
|
||||
- Comment characters are copied when automatic hard-wrapping occurs.
|
||||
- The ability to both read from and write to a FIFO.
|
||||
- Automatic hard-wrapping is no longer the default.
|
||||
- Addition of --guidestripe to draw a helpful vertical bar.
|
||||
- Meta-Up and Meta-Down scroll the screen linewise.
|
||||
- Continuation is shown with a highlighted ">" instead of a plain "$".
|
||||
- A marked region gets justified into a single, separate paragraph.
|
||||
- Any number of justifications can be undone.
|
||||
|
||||
Since 3.0:
|
||||
- Addition of --zap to make <Del> and <Bsp> obliterate marked text.
|
||||
- <Ctrl+Delete> wipes next word and <Shift+Ctrl+Delete> preceding word.
|
||||
@@ -23,7 +35,6 @@ Since 2.9.0:
|
||||
for the history files (of search strings and cursor positions).
|
||||
|
||||
Since 2.8.0:
|
||||
- Meta-Up/Meta-Down will search the previous/next occurrence.
|
||||
- ^U pastes the first line of the cutbuffer at a prompt.
|
||||
- Softwrapping can be done at whitespace (with --soft --atblanks).
|
||||
- The ^G help texts have become searchable (with ^W and M-W).
|
||||
@@ -54,6 +65,9 @@ Since 2.5.0:
|
||||
- On most terminals Ctrl+Left / Ctrl+Right now work for PrevWord/NextWord.
|
||||
- When in the middle of a word, PrevWord now jumps to the start of this
|
||||
word (like Pico does) instead of to the start of the preceding word.
|
||||
- The ability to delete whole words with 'cutwordleft' and 'cutwordright'.
|
||||
- The ability to save a file without prompting for its name ('savefile').
|
||||
- The ability to search backward without having to toggle the direction.
|
||||
|
||||
Since 2.4.0:
|
||||
- Replacing things in a marked region now takes place in situ, in context,
|
||||
@@ -63,9 +77,6 @@ Since 2.4.0:
|
||||
|
||||
Since 2.3.0:
|
||||
- System syntaxes can be improved upon with the 'extendsyntax' command.
|
||||
- The ability to delete whole words with 'cutwordleft' and 'cutwordright'.
|
||||
- The ability to save a file without prompting for its name ('savefile').
|
||||
- The ability to search backward without having to toggle the direction.
|
||||
- Whitespace display (M-P) does not require configuration to be useful.
|
||||
- Undo/redo is enabled by default (M-U/M-E) and works nearly everywhere
|
||||
-- just not yet for justifying and indenting/unindenting.
|
||||
|
||||
159
NEWS
159
NEWS
@@ -1,3 +1,78 @@
|
||||
2019.11.29 - GNU nano 4.6 "And don't you eat that yellow snow"
|
||||
• The 'formatter' command has returned, bound by default to M-F.
|
||||
It allows running a syntax-specific command on the contents of
|
||||
the buffer.
|
||||
• ^T will try to run 'hunspell' before 'spell', because it checks
|
||||
spellling for the locale's language and understands UTF-8.
|
||||
• Multiple errors or warnings on startup will no longer slow nano
|
||||
down but will be indicated on the status bar with trailing dots.
|
||||
|
||||
2019.10.04 - GNU nano 4.5 "Košice"
|
||||
• The new 'tabgives' command allows you to specify per syntax what
|
||||
the <Tab> key should produce: some spaces, a hard TAB, ...
|
||||
• The output of --help is properly aligned again for all languages.
|
||||
• <Tab> will indent a marked region also when M-} has been rebound.
|
||||
|
||||
2019.08.25 - GNU nano 4.4 "Hagelslag"
|
||||
• At startup, the cursor can be put on the first or last occurrence
|
||||
of a string by preceding the filename with +/string or +?string.
|
||||
• When automatic hard-wrapping occurs (--breaklonglines), any leading
|
||||
quoting characters will be automatically copied to the new line.
|
||||
• M-6 works again also when the cursor is at end of buffer.
|
||||
|
||||
2019.06.18 - GNU nano 4.3 "Musa Kart"
|
||||
• The ability to read from and write to a FIFO has been regained.
|
||||
• Startup time is reduced by fully parsing a syntax only when needed.
|
||||
• Asking for help (^G) when using --operatingdir does not crash.
|
||||
• The reading of a huge or slow file can be stopped with ^C.
|
||||
• Cut, zap, and copy operations are undone separately when intermixed.
|
||||
• M-D reports the correct number of lines (zero for an empty buffer).
|
||||
|
||||
2019.04.24 - GNU nano 4.2 "Tax the rich, pay the teachers"
|
||||
• The integrated spell checker does not crash when 'spell' is missing.
|
||||
• Option --breaklonglines works also when --ignorercfiles is used.
|
||||
• Automatic hard-wrapping is more persistent in pushing words to the
|
||||
same overflow line.
|
||||
|
||||
2019.04.15 - GNU nano 4.1 "Qué corchos será eso?"
|
||||
• By default, a newline character is again automatically added at the
|
||||
end of a buffer, to produce valid POSIX text files by default, but
|
||||
also to get back the easy adding of text at the bottom.
|
||||
• The now unneeded option --finalnewline (-f) has been removed.
|
||||
• Syntax files are read in alphabetical order when globbing, so that
|
||||
the precedence of syntaxes becomes predictable.
|
||||
• In the C syntax, preprocessor directives are highlighted differently.
|
||||
• M-S now toggles soft wrapping, and M-N toggles line numbers.
|
||||
• The jumpy-scrolling toggle has been removed.
|
||||
• The legacy keystrokes ^W^Y and ^W^V are recognized again.
|
||||
• Executing an external command is disallowed when in view mode.
|
||||
• Problems with resizing during external or speller commands were fixed.
|
||||
|
||||
2019.03.24 - GNU nano 4.0 "Thy Rope of Sands"
|
||||
• An overlong line is no longer automatically hard-wrapped.
|
||||
• Smooth scrolling (one line at a time) has become the default.
|
||||
• A newline character is no longer automatically added at end of buffer.
|
||||
• The line below the title bar is by default part of the editing space.
|
||||
• Option --breaklonglines (-b) turns automatic hard-wrapping back on.
|
||||
• Option --jumpyscrolling (-j) gives the chunky, half-screen scrolling.
|
||||
• Option --finalnewline (-f) brings back the automatic newline at EOF.
|
||||
• Option --emptyline (-e) leaves the line below the title bar unused.
|
||||
• <Alt+Up> and <Alt+Down> now do a linewise scroll instead of a findnext.
|
||||
• Any number of justifications can be undone (like all other operations).
|
||||
• When marked text is justified, it becomes a single, separate paragraph.
|
||||
• Option --guidestripe=<number> draws a vertical bar at the given column.
|
||||
• Option --fill=<number> no longer turns on automatic hard-wrapping.
|
||||
• When a line continues offscreen, it now ends with a highlighted ">".
|
||||
• The halves of a split two-column character are shown as "[" and "]".
|
||||
• A line now scrolls horizontally one column earlier.
|
||||
• The bindable functions 'cutwordleft' and 'cutwordright' were renamed
|
||||
to 'chopwordleft' and 'chopwordright' as they don't use the cutbuffer.
|
||||
• The paragraph-jumping functions were moved from Search to Go-to-Line.
|
||||
• Option --rebinddelete is able to compensate for more misbindings.
|
||||
• Options --morespace and --smooth are obsolete and thus ignored.
|
||||
• The --disable-wrapping-as-root configure option was removed.
|
||||
|
||||
|
||||
2018.11.11 - GNU nano 3.2 "Het kromme hout" changes the default binding
|
||||
for the linter to M-B so that the spell checker (^T) can
|
||||
always be used, and changes (when linting) the text in the
|
||||
@@ -562,7 +637,7 @@
|
||||
like this what could POSSIBLY go WRONG? Hahaha.
|
||||
Enjoy and if you find new bugs, as always please
|
||||
use Savannah's bug tracker.
|
||||
http://savannah.gnu.org/bugs/?func=additem&group=nano
|
||||
https://savannah.gnu.org/bugs/?func=additem&group=nano
|
||||
|
||||
2010.01.17 - GNU nano 2.2.2 is released for you, you, you. This
|
||||
release includes fixes for: crashes when writing
|
||||
@@ -645,9 +720,9 @@
|
||||
without the usual truncation and a '$' symbol at the end
|
||||
of the line. It can be enabled via Meta-$ inside the
|
||||
editor, via the -$ or --softwrap command-line flags,
|
||||
or "set softwrap" in your .nanorc). As always, please
|
||||
report any bugs to the nano Savannah project page
|
||||
(http://savannah.gnu.org/bugs/?func=additem&group=nano)
|
||||
or via "set softwrap" in your .nanorc. As always,
|
||||
please report any bugs to the nano Savannah project page
|
||||
(https://savannah.gnu.org/bugs/?func=additem&group=nano)
|
||||
Remember: data loss happens, back up your files.
|
||||
|
||||
2009.07.28 - GNU nano 2.1.10 "Ellie" is released. This version includes
|
||||
@@ -675,45 +750,41 @@
|
||||
birthday lenny!
|
||||
|
||||
2009.02.07 - GNU nano 2.1.8 "unsafe at any speed" is released. This
|
||||
release include some long overdue performance
|
||||
improvements in syntax color highlighting, the ability
|
||||
to abort running searches (useful mainly when
|
||||
editing very large files) and the ability to use nano
|
||||
like a pager for viewing standard input (i.e. "nano -").
|
||||
Additionally, there are gentoo syntax highlighting
|
||||
updates and fixes for issues with reading files
|
||||
in a directory with strange parent directory permissions.
|
||||
The key bindings code was also substantially changed
|
||||
in order to be more ISO-C compatible. Be sure to use
|
||||
the Savannah page not only for bug reports but for any
|
||||
release includes some long overdue performance improvements
|
||||
in syntax color highlighting, the ability to abort running
|
||||
searches (useful mainly when editing very large files) and
|
||||
the ability to use nano like a pager for viewing standard
|
||||
input (i.e. "nano -"). Additionally, there are gentoo
|
||||
syntax highlighting updates and fixes for issues with
|
||||
reading files in a directory with strange parent directory
|
||||
permissions. The key-bindings code was also substantially
|
||||
changed in order to be more ISO-C compatible. Be sure to
|
||||
use the Savannah page not only for bug reports but for any
|
||||
features you would like to see before the next stable
|
||||
series is released. Have fun with it!
|
||||
|
||||
2008.11.10 - GNU nano 2.1.7 "Effingham" is ready to make good on those
|
||||
campaign promises of lower bug rates and 50% more pie.
|
||||
This release includes a new check for external
|
||||
modifications when saving a file, some code and
|
||||
documentation cleanups, and more bug fixes for
|
||||
the new undo code (but we continue to welcome
|
||||
your bug reports via the Savannah bug page at
|
||||
http://savannah.gnu.org/bugs/?func=additem&group=nano).
|
||||
This release includes a new check for external modifications
|
||||
when saving a file, some code and documentation cleanups,
|
||||
and more bug fixes for the new undo code (but we continue
|
||||
to welcome your bug reports via the Savannah bug page at
|
||||
https://savannah.gnu.org/bugs/?func=additem&group=nano).
|
||||
Come get some.
|
||||
|
||||
2008.10.03 - GNU nano 2.1.6 was for new features before it was against
|
||||
them. This release includes more undo capability,
|
||||
several new syntax highlighting configurations including
|
||||
Objective C, OCaml, and Fortran, and a new capability
|
||||
to activate highlighting based on the 1st line of the
|
||||
file being edited. Also, the new default configure
|
||||
options now include color syntax highlighting, .nanorc
|
||||
support, multibuffer and extras. These items can still
|
||||
be disabled and are not enabled with --enable-tiny. Bug
|
||||
fixes include better signal handling under Cygwin, and
|
||||
that's about it. Again please remember to
|
||||
submit bug reports via Savannah at
|
||||
http://savannah.gnu.org/bugs/?func=additem&group=nano
|
||||
as undo functions certainly need more testing.
|
||||
Bon appetit.
|
||||
them. This release includes more undo capability, several
|
||||
new syntax highlighting configurations including Objective
|
||||
C, OCaml, and Fortran, and a new capability to activate
|
||||
highlighting based on the 1st line of the file being
|
||||
edited. Also, the new default configure options now
|
||||
include color syntax highlighting, .nanorc support,
|
||||
multibuffer and extras. These items can still be disabled
|
||||
and are not enabled with --enable-tiny. Bug fixes include
|
||||
better signal handling under Cygwin, and that's about it.
|
||||
Again please remember to submit bug reports via Savannah at
|
||||
https://savannah.gnu.org/bugs/?func=additem&group=nano as
|
||||
undo functions certainly need more testing. Bon appetit.
|
||||
|
||||
2008.08.30 - GNU nano 2.1.5 is ready to lead on day one. This release
|
||||
contains a better fix for incorrectly reported successful
|
||||
@@ -736,15 +807,15 @@
|
||||
are likely to run out of space; see Savannah bug #24000.
|
||||
Have fun with it!
|
||||
|
||||
2008.08.04 - GNU nano 2.1.3 "least stable version ever" is released. This
|
||||
release includes new (and experimental) undo and redo
|
||||
functionality for most text operations. The default
|
||||
key bindings are Meta-U for undo and Meta-E for redo, but
|
||||
these can be remapped using the new 2.1 keybinding code.
|
||||
Also included are some fixes for configuring using wide
|
||||
curses, crashing when invoking the help menu with
|
||||
certain locales, and not saving the search history when
|
||||
compiled with configure options.
|
||||
2008.08.04 - GNU nano 2.1.3 "least stable version ever" is released.
|
||||
This release includes new (and experimental) undo and redo
|
||||
functionality for most text operations. The default key
|
||||
bindings are Meta-U for undo and Meta-E for redo, but these
|
||||
can be remapped using the new 2.1 keybinding code. Also
|
||||
included are some fixes for configuring using wide curses,
|
||||
crashing when invoking the help menu with certain locales,
|
||||
and not saving the search history when compiled with
|
||||
configure options.
|
||||
|
||||
2008.04.24 - GNU nano 2.1.2 "New York City" is released. This release
|
||||
contains fixes for binding bad keys, some
|
||||
|
||||
27
README
27
README
@@ -1,5 +1,5 @@
|
||||
|
||||
GNU nano -- an enhanced clone of the Pico text editor
|
||||
GNU nano -- a simple editor, inspired by Pico
|
||||
|
||||
Overview
|
||||
|
||||
@@ -7,25 +7,28 @@ Overview
|
||||
wonderfully easy-to-use and friendly Pico text editor.
|
||||
|
||||
First and foremost was its license: the Pine suite does not use
|
||||
the GPL or a GPL-friendly license, and has unclear restrictions on
|
||||
redistribution. Because of this, Pine and Pico are not included
|
||||
with many GNU/Linux distributions. Also, other features (like
|
||||
go-to-line-number or search-and-replace) were unavailable until
|
||||
recently or require a command-line flag. Yuck.
|
||||
the GPL, and (before using the Apache License) it had unclear
|
||||
restrictions on redistribution. Because of this, Pine and Pico
|
||||
were not included in many GNU/Linux distributions. Furthermore,
|
||||
some features (like go-to-line-number or search-and-replace) were
|
||||
unavailable for a long time or require a command-line flag. Yuck.
|
||||
|
||||
nano aims to solve these problems by emulating the functionality of
|
||||
Pico as closely as possible while addressing the problems above and
|
||||
providing other extra functionality.
|
||||
Nano aimed to solve these problems by: 1) being truly free software
|
||||
by using the GPL, 2) emulating the functionality of Pico as closely
|
||||
as is reasonable, and 3) including extra functionality by default.
|
||||
|
||||
Nowadays, nano wants to be a generally useful editor with sensible
|
||||
defaults (linewise scrolling, no automatic line breaking).
|
||||
|
||||
The nano editor is an official GNU package. For more information on
|
||||
GNU and the Free Software Foundation, please see https://www.gnu.org/.
|
||||
|
||||
How to compile and install nano
|
||||
|
||||
Download the nano source code, then:
|
||||
Download the latest nano source tarball, then:
|
||||
|
||||
tar xvzf nano-x.y.z.tar.gz
|
||||
cd nano-x.y.z
|
||||
tar -xvf nano-x.y.tar.gz
|
||||
cd nano-x.y
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
@@ -14,13 +14,13 @@ packages:
|
||||
- autoconf (version >= 2.69)
|
||||
- automake (version >= 1.14)
|
||||
- autopoint (version >= 0.18.3)
|
||||
- gcc (version >= 5.0)
|
||||
- gettext (version >= 0.18.3)
|
||||
- git (version >= 2.7.4)
|
||||
- groff (version >= 1.12)
|
||||
- make (any version)
|
||||
- pkg-config (version >= 0.22)
|
||||
- texinfo (version >= 4.0)
|
||||
- gcc (any version)
|
||||
- make (any version)
|
||||
|
||||
If you want UTF-8 support, you will also need libncursesw5-dev installed
|
||||
(version >= 5.7), or libslang2-dev (version >= 2.0) if you use --with-slang.
|
||||
|
||||
9
THANKS
9
THANKS
@@ -11,6 +11,7 @@ Mario Blättermann <mario.blaettermann@gmail.com> German
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish
|
||||
Antonio Ceballos <aceballos@gmail.com> Spanish
|
||||
Wei-Lun CHAO <chaoweilun@pcmail.com.tw> Chinese (traditional)
|
||||
Seong-ho Cho <darkcircle.0426@gmail.com> Korean
|
||||
Yuri Chornoivan <yurchor@ukr.net> Ukrainian
|
||||
Marco Colombo <magicdice@inwind.it> Italian
|
||||
Mihai Cristescu <mihai.cristescu@archlinux.info> Romanian
|
||||
@@ -22,22 +23,22 @@ Rafael Fontenelle <rffontenelle@gmail.com> Brazilian Portuguese
|
||||
Pavel Fric <pavelfric@seznam.cz> Czech
|
||||
Jorge González <aloriel@gmail.com> Spanish
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net> French
|
||||
Geir Helland <pjallabais@users.sourceforge.net> Norwegian Bokmål
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Indonesian
|
||||
Václav Haisman <V.Haisman@sh.cvut.cz> Czech
|
||||
Takeshi Hamasaki <hmatrjp@users.sourceforge.jp> Japanese
|
||||
Geir Helland <pjallabais@users.sourceforge.net> Norwegian Bokmål
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Indonesian
|
||||
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian Nynorsk
|
||||
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu> Hungarian
|
||||
Jorma Karvonen <karvonen.jorma@gmail.com> Finnish
|
||||
Mehmet Kececi <mkececi@mehmetkececi.com> Turkish
|
||||
Mehmet Kececi <mkececi@mehmetkececi.com> Turkish
|
||||
Gabor Kelemen <kelemeng@gnome.hu> Hungarian
|
||||
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish
|
||||
Eivind Kjørstad <ekj@vestdata.no> Norwegian Nynorsk
|
||||
Florian König <floki@bigfoot.com> German
|
||||
Klemen Košir <klemen913@gmail.com> Slovenian
|
||||
Wojciech Kotwica <wkotwica@post.pl> Polish
|
||||
Ask Hjorth Larsen <asklarsen@gmail.com> Danish
|
||||
Clement Laforet <clem_laf@wanadoo.fr> French
|
||||
Ask Hjorth Larsen <asklarsen@gmail.com> Danish
|
||||
LI Daobing <lidaobing@gmail.com> Chinese (simplified)
|
||||
Jordi Mallach <jordi@gnu.org> Catalan
|
||||
João Victor Duarte Martins <jvdm@sdf.lonestar.org> Brazilian Portuguese
|
||||
|
||||
4
TODO
4
TODO
@@ -2,7 +2,6 @@ A list of desired features
|
||||
--------------------------
|
||||
|
||||
Somewhat urgent:
|
||||
- Make undo/redo work also for justifying.
|
||||
- Detect when text is being pasted, so that we can handle it faster.
|
||||
See https://savannah.gnu.org/bugs/?40060.
|
||||
- Allow color syntaxes to apply to more than just color, so that we can
|
||||
@@ -17,6 +16,9 @@ Vague musings:
|
||||
- Make matching bracket searches sophisticated enough to skip over
|
||||
brackets inside comments?
|
||||
|
||||
For version 4.0:
|
||||
- Make undo/redo work also for justifying. [DONE]
|
||||
|
||||
For version 2.9:
|
||||
- Allow piping (marked) text to an external command and replacing it with
|
||||
the command's output. That is: implement filtering. [DONE]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Generate configure & friends for GIT users.
|
||||
|
||||
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
||||
gnulib_hash="6ccfbb4ce5d4fa79f7afb48f3648f2e0401523c3"
|
||||
gnulib_hash="378d2e5e5fe4b892ac3503ab5313126b1b63341e"
|
||||
|
||||
modules="
|
||||
futimens
|
||||
|
||||
152
configure.ac
152
configure.ac
@@ -1,6 +1,6 @@
|
||||
# Configuration for GNU nano - a small and user-friendly text editor
|
||||
#
|
||||
# Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2014, 2017 Mike Frysinger
|
||||
#
|
||||
# GNU nano is free software: you can redistribute it and/or modify
|
||||
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
AC_INIT([GNU nano], [3.2], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [4.6], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE([1.14])
|
||||
@@ -56,6 +56,33 @@ dnl Data location.
|
||||
pkgdatadir=${datadir}/${PACKAGE}
|
||||
AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
|
||||
|
||||
dnl Whether this is a git repository.
|
||||
|
||||
AC_MSG_CHECKING([whether building from git])
|
||||
if test -d .git ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
from_git=yes
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
from_git=no
|
||||
fi
|
||||
AM_CONDITIONAL(BUILDING_FROM_GIT, test x$from_git = xyes)
|
||||
|
||||
dnl Checks for pkg-config and gettext when building from git.
|
||||
|
||||
if test x$from_git = xyes; then
|
||||
if test ! -f $(aclocal --print-ac-dir)/pkg.m4; then
|
||||
AC_MSG_ERROR([
|
||||
*** The pkg.m4 macros are missing. ***
|
||||
*** The pkg-config package needs to be installed when building from git. ***])
|
||||
fi
|
||||
if test "$ac_cv_path_MSGFMT" = ":"; then
|
||||
AC_MSG_ERROR([
|
||||
*** The msgfmt program is missing. ***
|
||||
*** The gettext package needs to be installed when building from git. ***])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Checks for header files.
|
||||
|
||||
AC_CHECK_HEADERS(libintl.h limits.h pwd.h termios.h sys/param.h)
|
||||
@@ -271,12 +298,6 @@ if test "x$enable_wrapping" != xno; then
|
||||
AC_DEFINE(ENABLE_WRAPPING, 1, [Define this to have hard text wrapping.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(wrapping-as-root,
|
||||
AS_HELP_STRING([--disable-wrapping-as-root], [Disable wrapping of text as root by default]))
|
||||
if test "x$enable_wrapping_as_root" = xno; then
|
||||
AC_DEFINE(DISABLE_ROOTWRAPPING, 1, [Define this to disable text wrapping as root by default.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
AS_HELP_STRING([--enable-debug], [Enable debugging (disabled by default)]))
|
||||
if test "x$enable_debug" = xyes; then
|
||||
@@ -398,10 +419,10 @@ int main(void)
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** install a version of slang that includes the slcurses.h file or
|
||||
*** do not call the configure script with --with-slang.]))
|
||||
*** 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
|
||||
@@ -479,10 +500,10 @@ int main(void)
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** install a version of slang that includes the slcurses.h file or
|
||||
*** do not call the configure script with --with-slang.]))
|
||||
*** 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
|
||||
@@ -566,9 +587,9 @@ fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_MSG_ERROR([
|
||||
*** No curses lib was found. Please install the curses header files
|
||||
*** from libncursesw5-dev (Debian), ncurses-devel (Fedora), or similar.
|
||||
*** (Or install ncurses from https://ftp.gnu.org/gnu/ncurses/.)])
|
||||
*** No curses lib was found. Please install the curses header files
|
||||
*** from libncursesw5-dev (Debian), ncurses-devel (Fedora), or similar.
|
||||
*** (Or install ncurses from https://ftp.gnu.org/gnu/ncurses/.)])
|
||||
else
|
||||
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
|
||||
fi
|
||||
@@ -601,18 +622,18 @@ if test "x$enable_utf8" != xno && \
|
||||
else
|
||||
if test "x$enable_utf8" = xyes; then
|
||||
AC_MSG_ERROR([
|
||||
*** UTF-8 support was requested, but insufficient UTF-8 support was
|
||||
*** detected in your curses and/or C libraries. Please verify that your
|
||||
*** slang was built with UTF-8 support or your curses was built with
|
||||
*** wide character support, and that your C library was built with wide
|
||||
*** character support.])
|
||||
*** UTF-8 support was requested, but insufficient UTF-8 support was
|
||||
*** detected in your curses and/or C libraries. Please verify that
|
||||
*** your Slang was built with UTF-8 support or your curses was built
|
||||
*** with wide-character support, and that your C library was built
|
||||
*** with wide-character support.])
|
||||
elif test "x$enable_utf8" != xno; then
|
||||
AC_MSG_WARN([
|
||||
*** Insufficient UTF-8 support was detected in your curses and/or C
|
||||
*** libraries. If you want UTF-8 support, please verify that your slang
|
||||
*** was built with UTF-8 support or your curses was built with wide
|
||||
*** character support, and that your C library was built with wide
|
||||
*** character support.])
|
||||
*** Insufficient UTF-8 support was detected in your curses and/or C
|
||||
*** libraries. If you want UTF-8 support, please verify that your
|
||||
*** Slang was built with UTF-8 support or your curses was built with
|
||||
*** wide-character support, and that your C library was built with
|
||||
*** wide-character support.])
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -638,55 +659,6 @@ fi
|
||||
AC_DEFINE_UNQUOTED(NANO_REG_EXTENDED, $nano_reg_extended,
|
||||
[Flag(s) to use to get the full range of extended regular expressions])
|
||||
|
||||
# Check for word-boundary support (/< and />).
|
||||
AC_MSG_CHECKING([for GNU-style word boundary regex support])
|
||||
AC_ARG_WITH(wordbounds,
|
||||
AS_HELP_STRING([--with-wordbounds], [Use GNU-style word boundary delimiters]),
|
||||
[with_wordbounds=$withval], [with_wordbounds=auto])
|
||||
if test "$with_wordbounds" != "no"; then
|
||||
dnl If we're using the bundled gnulib regex module, we know it's supported.
|
||||
if test "$ac_use_included_regex" = "yes"; then
|
||||
with_wordbounds="yes"
|
||||
fi
|
||||
|
||||
dnl We explicitly don't check if the user forced the option, because
|
||||
dnl this is needed for cross compilers and we can't test the target.
|
||||
if test "$with_wordbounds" != "yes"; then
|
||||
AC_TRY_RUN([
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
int main(void)
|
||||
{
|
||||
regex_t r;
|
||||
size_t nmatch;
|
||||
regmatch_t pmatch;
|
||||
|
||||
if (regcomp(&r, "\\\\>", $nano_reg_extended|REG_NOSUB))
|
||||
return 1;
|
||||
if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
|
||||
return 1;
|
||||
return 0;
|
||||
}],
|
||||
with_wordbounds="yes",
|
||||
with_wordbounds="no",
|
||||
with_wordbounds="cross")
|
||||
fi
|
||||
fi
|
||||
case $with_wordbounds in
|
||||
yes)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define this if the system supports GNU-style word boundaries in regexes.])
|
||||
;;
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
cross)
|
||||
AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x$color_support = xyes; then
|
||||
# if test x$CURSES_LIB_NAME = xcurses; then
|
||||
AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
|
||||
@@ -742,8 +714,9 @@ AC_MSG_CHECKING([for HTML support in groff])
|
||||
groff -t -mandoc -Thtml </dev/null >/dev/null
|
||||
if test $? -ne 0 ; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_WARN([*** Will not generate HTML version of man pages ***
|
||||
*** Consider installing a newer version of groff with HTML support ***])
|
||||
AC_MSG_WARN([
|
||||
*** Will not generate HTML version of man pages. ***
|
||||
*** Consider installing a newer version of groff with HTML support. ***])
|
||||
groff_html_support=no
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
@@ -751,25 +724,6 @@ else
|
||||
fi
|
||||
AM_CONDITIONAL(GROFF_HTML, test x$groff_html_support = xyes)
|
||||
|
||||
# Check whether this is a git repository.
|
||||
AC_MSG_CHECKING([whether building from git])
|
||||
if test -d .git ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
from_git=yes
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
from_git=no
|
||||
fi
|
||||
AM_CONDITIONAL(BUILDING_FROM_GIT, test x$from_git = xyes)
|
||||
|
||||
if test x$from_git = xyes; then
|
||||
if test "$ac_cv_path_MSGFMT" = ":"; then
|
||||
AC_MSG_ERROR([
|
||||
*** The msgfmt program is missing. ***
|
||||
*** The gettext package needs to be installed when building from git. ***])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
doc/Makefile
|
||||
|
||||
133
doc/cheatsheet.html
Normal file
133
doc/cheatsheet.html
Normal file
@@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Cheatsheet for nano</title>
|
||||
<meta name="description" content="nano">
|
||||
<meta name="keywords" content="cheatsheet, nano, editor, shortcuts, keystrokes, functions">
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
|
||||
<br>
|
||||
<h1 align="center">Overview of nano's shortcuts </h1>
|
||||
<h3 align="center">The editor's keystrokes and their functions </h3>
|
||||
<br>
|
||||
|
||||
<table align="center"><tbody>
|
||||
<tr><td>
|
||||
|
||||
<b>File handling</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+S </td><td>Save current file</td></tr>
|
||||
<tr><td>Ctrl+O </td><td> Offer to write file ("Save as")</td></tr>
|
||||
<tr><td>Ctrl+R </td><td> Insert a file into current one</td></tr>
|
||||
<tr><td>Ctrl+X </td><td> Close buffer, exit from nano</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Editing</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+K </td><td>Cut current line into cutbuffer</td></tr>
|
||||
<tr><td>Alt+6</td><td>Copy current line into cutbuffer</td></tr>
|
||||
<tr><td>Ctrl+U</td><td>Paste contents of cutbuffer</td></tr>
|
||||
<tr><td>Alt+T</td><td>Cut until end of buffer</td></tr>
|
||||
<tr><td>Ctrl+]</td><td>Complete current word</td></tr>
|
||||
<tr><td>Alt+3</td><td>Comment/uncomment line/region</td></tr>
|
||||
<tr><td>Alt+U</td><td>Undo last action</td></tr>
|
||||
<tr><td>Alt+E</td><td>Redo last undone action</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Search and replace</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+Q </td><td>Start backward search</td></tr>
|
||||
<tr><td>Ctrl+W</td><td>Start forward search</td></tr>
|
||||
<tr><td>Alt+Q</td><td>Find next occurrence backward</td></tr>
|
||||
<tr><td>Alt+W</td><td>Find next occurrence forward</td></tr>
|
||||
<tr><td>Alt+R</td><td>Start a replacing session</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Deletion</b>
|
||||
<table><tbody>
|
||||
<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+Shift+Del </td><td>Delete word to the left</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>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Operations</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+T </td><td>Run a spell check</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+B</td><td>Run a syntax check</td></tr>
|
||||
<tr><td>Alt+F</td><td>Run a formatter/fixer/arranger</td></tr>
|
||||
<tr><td>Alt+:</td><td>Start/stop recording of macro</td></tr>
|
||||
<tr><td>Alt+;</td><td>Replay macro</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
</td><td>
|
||||
|
||||
<b>Moving around</b>
|
||||
<table><tbody>
|
||||
<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+⯇</td><td>One word backward</td></tr>
|
||||
<tr><td>Ctrl+⯈</td><td>One word forward</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+P</td><td>One line up</td></tr>
|
||||
<tr><td>Ctrl+N</td><td>One line down</td></tr>
|
||||
<tr><td>Ctrl+⯅</td><td>To previous block</td></tr>
|
||||
<tr><td>Ctrl+⯆</td><td>To next block</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>Alt+\</td><td>To top of buffer</td></tr>
|
||||
<tr><td>Alt+/</td><td>To end of buffer</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Special movement</b>
|
||||
<table><tbody>
|
||||
<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>Scroll viewport up</td></tr>
|
||||
<tr><td>Alt+⯆</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 succeeding buffer</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Information</b>
|
||||
<table><tbody>
|
||||
<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>Ctrl+G</td><td>Display help text</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Various</b>
|
||||
<table><tbody>
|
||||
<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>Shift+Tab </td><td>Unindent marked region</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+V</td><td>Enter next keystroke verbatim</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>
|
||||
<br>
|
||||
|
||||
</td></tr>
|
||||
</tbody></table>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
84
doc/faq.html
84
doc/faq.html
@@ -32,25 +32,19 @@
|
||||
<a href="#3.6">3.6. How can I make the executable smaller? This is too bloated!</a><br>
|
||||
<a href="#3.7">3.7. Tell me more about this multibuffer stuff!</a><br>
|
||||
<a href="#3.8">3.8. Tell me more about this verbatim input stuff!</a><br>
|
||||
<a href="#3.9a">3.9a. How do I make a .nanorc file that nano will read when I start it?</a><br>
|
||||
<a href="#3.9b">3.9b. How about in Win32?</a>
|
||||
<a href="#3.9">3.9. How do I make a .nanorc file that nano will read when I start it?</a><br>
|
||||
</p></blockquote>
|
||||
<h3><a href="#4">4. Running</a></h3>
|
||||
<blockquote><p>
|
||||
<a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
|
||||
<a href="#4.2">4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</a><br>
|
||||
<a href="#4.3">4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</a><br>
|
||||
<a href="#4.4">4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</a><br>
|
||||
<a href="#4.5">4.5. How do I type the F13-F16 keys listed in the help viewer? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.6">4.6. nano crashes when I type <insert keystrokes here>!</a><br>
|
||||
<a href="#4.7">4.7. nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.8a">4.8a. With what keystroke can I paste text from the clipboard into nano?</a><br>
|
||||
<a href="#4.8b">4.8b. When I paste text into a document, each line gets indented further than the last. Why? And how can I stop this?</a><br>
|
||||
<a href="#4.8c">4.8c. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?<a><br>
|
||||
<a href="#4.9">4.9. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.10">4.10. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.11">4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a><br>
|
||||
<a href="#4.12">4.12. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</a>
|
||||
<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.6">4.6. When I paste text into a document, each line gets indented further than the last. Why? And how can I stop this?</a><br>
|
||||
<a href="#4.7">4.7. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?<a><br>
|
||||
<a href="#4.8">4.8. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.9">4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
</p></blockquote>
|
||||
<h3><a href="#5">5. Internationalization</a></h3>
|
||||
<blockquote><p>
|
||||
@@ -77,7 +71,7 @@
|
||||
|
||||
<h1><a name="1"></a>1. General</h1>
|
||||
<h3><a name="1.1"></a>1.1. What is GNU nano?</h3>
|
||||
<blockquote><p>GNU nano is designed to be a free replacement for the Pico text editor, part of the Pine email suite from <a href="http://www.washington.edu/pine/">The University of Washington</a>. It aims to "emulate Pico as closely as possible and then include extra functionality".</p></blockquote>
|
||||
<blockquote><p>GNU nano was designed to be a free replacement for the Pico text editor, part of the Pine email suite from <a href="http://www.washington.edu/pine/">The University of Washington</a>. It aimed to "emulate Pico as closely as is reasonable and then include extra functionality".</p></blockquote>
|
||||
<h3><a name="1.2"></a>1.2. What is the history behind nano?</h3>
|
||||
<blockquote><p>Funny you should ask!</p>
|
||||
<p><b>In the beginning...</b></p>
|
||||
@@ -91,7 +85,7 @@
|
||||
<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>
|
||||
<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>3.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>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>4.6</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>
|
||||
<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%">
|
||||
@@ -118,7 +112,7 @@
|
||||
<li><a href="https://packages.debian.org/testing/editors/nano">testing</a></li>
|
||||
<li><a href="https://packages.debian.org/unstable/editors/nano">unstable</a></li>
|
||||
</ul>
|
||||
<p>You can also have a look at the <a href="ftp://ftp.debian.org/debian/pool/main/n/nano/">Package Pool</a> to see all the available binary and source packages.</p>
|
||||
<p>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>
|
||||
<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>
|
||||
@@ -126,13 +120,13 @@
|
||||
|
||||
<h1><a name="3"></a>3. Installation and Configuration</h1>
|
||||
<h3><a name="3.1"></a>3.1. How do I install the RPM or DEB package?</h3>
|
||||
<blockquote><p>It's simple really! As root, type <b>rpm -Uvh nano-x.y.z-1.i386.rpm</b> if you have a RedHat-ish system or <b>dpkg -i nano_x.y.z-1.deb</b> if you have a Debian-ish system, where <b>x.y.z</b> is the release 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>
|
||||
<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.z.tar.gz</b></p>
|
||||
<p><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>The average case is this:</p>
|
||||
<p><b>cd nano-x.y.z/</b><br>
|
||||
<p><b>cd nano-x.y/</b><br>
|
||||
<b>./configure</b><br>
|
||||
<b>make</b><br>
|
||||
<b>make install</b> (as root, of course)</p></blockquote>
|
||||
@@ -163,7 +157,6 @@
|
||||
<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 marker code that you use with Control-^ to select text). Also, if you know you aren't going to be using other languages, you can use <b>--disable-nls</b> to disable internationalization and save a few K to a few dozen K depending on whether you have locale support on your system. And finally, there's always good old <b>strip</b> to strip all debugging code and code that exists in libraries on your system.</p>
|
||||
<p>With <b>--disable-wrapping-as-root</b> you can disable any hard-wrapping by default when the user is root, useful to prevent accidentally changing long lines in system configuration files.</p>
|
||||
</blockquote>
|
||||
<h3><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h3>
|
||||
<blockquote><p>To use multiple file buffers, you must not have configured nano with <b>--disable-multibuffer</b> nor with <b>--enable-tiny</b> (use <b>nano -V</b> to check the compilation options). Then when you want to insert a file into its own buffer instead of into the current file, just hit <b>Meta-F</b> after typing <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>-F</b> or <b>--multibuffer</b> flag when you invoke nano, or add <b>set multibuffer</b> to your .nanorc file.</p>
|
||||
@@ -171,12 +164,8 @@
|
||||
<h3><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h3>
|
||||
<blockquote><p>When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message "Verbatim Input" on the status bar), then press the key(s) that generate the character you want.</p>
|
||||
<p>Alternatively, if Unicode support is enabled (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code (from 000000 to 10FFFF, case-insensitive), and the character with the corresponding value will be inserted. The status bar will change to "Unicode Input: ......" when you do this.</p></blockquote>
|
||||
<h3><a name="3.9a"></a>3.9a. How do I make a .nanorc file that will be read when I start nano?</h3>
|
||||
<h3><a name="3.9"></a>3.9. How do I make a .nanorc file that will be read when I start nano?</h3>
|
||||
<blockquote><p>It's not hard at all! But, your nano must <b>not</b> have been compiled with <b>--disable-nanorc</b>. Then simply copy the <b>sample.nanorc</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax of the file is simple. Flags are turned on and off by using the words <b>set</b> and <b>unset</b> plus the long option name for the feature. For example, "set nowrap" or "set smarthome".</p></blockquote>
|
||||
<h3><a name="3.9b"></a>3.9b. How about in Win32?</h3>
|
||||
<blockquote><p>If you're using the official nano .zip file and have extracted all the files, you should take the file nano.rc and place it somewhere on your Win32 system (for example, if you have write permission to do so, at the top of C:\). Then you must create an Environment variable called HOME which points to the directory where you put nano.rc. In Windows XP, you can get to Environment variables by right-clicking "My Computer" either on the desktop or in the Start Menu, and selecting Properties. This should bring up the System Properties panel. Then click the Advanced Tab, and there should be a button called Environment Variables. Click that to bring up the Environment Variables section. Now, under User Variables you should be able to click the New button, and make a new Variables Name called HOME, with the Variable Value of whatever path you copied nano.rc into (just the directory name; don't add nano.rc onto the end).</p>
|
||||
<p>We're still working on documentation for enabling syntax highlighting on Win32; please bear with us.</p>
|
||||
<p>Note that the nano.rc file must remain Unix-formatted in order for nano to understand it. In other words, you should probably use only nano to edit its config file. Other programs like Wordpad and Notepad will convert the file to DOS format when saving, and the latter does not even properly read Unix-formatted files to begin with.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="4"></a>4. Running</h1>
|
||||
@@ -192,24 +181,18 @@
|
||||
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
|
||||
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
|
||||
<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>--rebindkeypad</b> option on the command line, or add the line <b>set rebindkeypad</b> to your .nanorc. However, nano's mouse support won't work properly if you do any of these things.</p></blockquote>
|
||||
<h3><a name="4.4"></a>4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</h3>
|
||||
<blockquote><p>This was a bug in how nano handled consecutive escape sequences. It should be fixed since version 2.6.0.</p></blockquote>
|
||||
<h3><a name="4.5"></a>4.5. How do I type the F13-F16 keys listed in the help viewer? My keyboard only has F1-F12!</h3>
|
||||
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, and Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
|
||||
<h3><a name="4.6"></a>4.6. nano crashes when I type <insert keystrokes here>!</h3>
|
||||
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or in the <a href="https://savannah.gnu.org/bugs/?group=nano">bug tracker</a> on Savannah.</p></blockquote>
|
||||
<h3><a name="4.7"></a>4.7. nano crashes when I resize my window. How can I fix that?</h3>
|
||||
<blockquote><p>Older versions of nano had this problem. Please upgrade to version 2.7.0 or newer.</p></blockquote>
|
||||
<h3><a name="4.8a"></a>4.8a. With what keystroke can I paste text from the clipboard into nano?</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>
|
||||
<h3><a name="4.4"></a>4.4. With what keystroke can I paste text from the clipboard into nano?</h3>
|
||||
<blockquote><p>In most desktop environments <b>Shift+Insert</b> will paste the contents of the clipboard.</p></blockquote>
|
||||
<h3><a name="4.8b"></a>4.8b. When I paste text into a document, each line gets indented further than the last. Why? And how can I stop this?</h3>
|
||||
<h3><a name="4.5"></a>4.5. How do I select text for or paste text from the clipboard when nano's mouse support is turned on?</h3>
|
||||
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
|
||||
<h3><a name="4.6"></a>4.6. When I paste text into a document, each line gets indented further than the last. Why? And how can I stop this?</h3>
|
||||
<blockquote><p>You have the <i>autoindent</i> feature turned on. Hit <b>Meta-I</b> to turn it off, paste your text, and then hit <b>Meta-I</b> again to turn it back on.</p></blockquote>
|
||||
<h3><a name="4.8c"></a>4.8c. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?</h3>
|
||||
<h3><a name="4.7"></a>4.7. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?</h3>
|
||||
<blockquote><p>When pasting from Windows, in some situations linefeeds are sent instead of carriage returns (Enters). And linefeeds are <b>^J</b>s, which make nano justify (rewrap) the current paragraph. To prevent these linefeeds from causing these unwanted justifications, add this line to your .nanorc on the remote Linux box: <b>unbind ^J main</b> or <b>bind ^J enter main</b>, depending on whether the paste contains CR + LF or only LF.</p></blockquote>
|
||||
<h3><a name="4.9"></a>4.9. I've compiled nano with color support, but I don't see any color when I run it!</h3>
|
||||
<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.9a">3.9a</a>.</p></blockquote>
|
||||
<h3><a name="4.10"></a>4.10. How do I make nano my default editor (in Pine, mutt, etc.)?</h3>
|
||||
<h3><a name="4.8"></a>4.8. I've compiled nano with color support, but I don't see any color when I run it!</h3>
|
||||
<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>
|
||||
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
|
||||
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
|
||||
<p>or, if you use tcsh, put this in your <b>.cshrc</b> file:</p>
|
||||
@@ -220,14 +203,8 @@
|
||||
<b>[ ] enable-alternate-editor-implicitly</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><b>my_hdr X-Composer: nano x.y.z</b></p>
|
||||
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
|
||||
<h3><a name="4.11"></a>4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h3>
|
||||
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
|
||||
<h3><a name="4.12"></a>4.12. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</h3>
|
||||
<blockquote><p>In nano 2.3.0, cursor-position history was introduced, and both history files now reside in a .nano subdirectory in your home directory. A newer nano will move an existing search-history file to this new location so it can continue to be used. This means that if you then try and use an earlier version of nano, it will be unable to see your current search history. To fix this, run the following command:</p>
|
||||
<p><b>ln -sf ~/.nano/search_history ~/.nano_history</b></p>
|
||||
<p>The "migration service" (moving the search-history file to its new location) has been deleted from nano in late 2017, since version 2.9.0. The search-history and position-history files will now be looked for first in ~/.nano/ and, when not found there, then in ~/.local/share/nano/.</p></blockquote>
|
||||
<p><b>my_hdr X-Composer: nano-x.y</b></p>
|
||||
<p>Again, replace x.y with the version of nano you use.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
@@ -243,10 +220,9 @@
|
||||
|
||||
<h1><a name="6"></a>6. Advocacy and Licensing</h1>
|
||||
<h3><a name="6.1"></a>6.1. Why should I use nano instead of Pico?</h3>
|
||||
<blockquote><p>There are many reasons to use nano instead of Pico. A more complete list can be found at the <a href="https://nano-editor.org/">nano homepage</a>.</p></blockquote>
|
||||
<blockquote><p>If you want features like undo/redo, syntax highlighting, line numbers, soft-wrapping, opening multiple files at once, an interface localized to your language, or search and replace with support for regular expressions, then you want nano.</p></blockquote>
|
||||
<h3><a name="6.2"></a>6.2. Why should I use Pico instead of nano?</h3>
|
||||
<blockquote><p>Again, check out the <a href="https://nano-editor.org/">nano homepage</a> for a good summary of reasons. It really is a matter of personal preference as to which editor you should use. If you're the type of person who likes using the original version of a program, then Pico is the editor for you. If you don't mind sacrificing mailer integration with Pine, and are looking for a few more features, as well as a 'better' license in terms of adding your own changes, nano is the way to go.</p>
|
||||
<p>Note that the last of these no longer applies to the new version of Pine, <a href="http://www.washington.edu/alpine/">Alpine</a>, which is under the Apache License, version 2.0.</p></blockquote>
|
||||
<blockquote><p>If you use your editor only to write emails or other texts and have no need for the above-mentioned features, then Pico will do fine for you.</p></blockquote>
|
||||
<h3><a name="6.3"></a>6.3. What is so bad about the older Pine license?</h3>
|
||||
<blockquote><p>The U of W license for older versions of Pine and Pico is not considered truly Free Software according to both the Free Software Foundation and the <a href="https://www.debian.org/social_contract#guidelines">Debian Free Software Guidelines</a>. The main problem regards the limitations on distributing derived works: according to UW, you can distribute their software, and you can modify it, but you can not do both, i.e. distribute modified binaries.</p></blockquote>
|
||||
<h3><a name="6.4"></a>6.4. Okay, well, what mail program should I use then?</h3>
|
||||
@@ -257,9 +233,9 @@
|
||||
<h1><a name="7"></a>7. Miscellaneous</h1>
|
||||
<h3><a name="7.1"></a>7.1. Where can I ask questions or send suggestions?</h3>
|
||||
<blockquote><p>There are three mailing lists for nano hosted at <a href="https://savannah.gnu.org/">Savannah</a>: info-nano, help-nano and nano-devel. info-nano is a very low traffic list where new versions of nano are announced (surprise!). help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
|
||||
<p>info-nano - <a href="https://mail.gnu.org/mailman/listinfo/info-nano/">https://mail.gnu.org/mailman/listinfo/info-nano/</a><br>
|
||||
help-nano - <a href="https://mail.gnu.org/mailman/listinfo/help-nano/">https://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
|
||||
nano-devel - <a href="https://mail.gnu.org/mailman/listinfo/nano-devel/">https://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
|
||||
<p>info-nano - <a href="https://lists.gnu.org/mailman/listinfo/info-nano/">https://lists.gnu.org/mailman/listinfo/info-nano/</a><br>
|
||||
help-nano - <a href="https://lists.gnu.org/mailman/listinfo/help-nano/">https://lists.gnu.org/mailman/listinfo/help-nano/</a><br>
|
||||
nano-devel - <a href="https://lists.gnu.org/mailman/listinfo/nano-devel/">https://lists.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
|
||||
<h3><a name="7.2"></a>7.3. How do I submit a bug report or patch?</h3>
|
||||
<blockquote>
|
||||
<p>The best way to submit bugs is through the <a href="https://savannah.gnu.org/bugs/?group=nano">Savannah bug tracker</a>, as you can check whether the bug you are reporting has already been submitted, and it makes it easier for the maintainers to keep track of them.
|
||||
|
||||
146
doc/nano.1
146
doc/nano.1
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc.
|
||||
.\" Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -16,25 +16,47 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 3.2" "November 2018"
|
||||
.TH NANO 1 "version 4.6" "November 2019"
|
||||
|
||||
.SH NAME
|
||||
nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
nano \- Nano's ANOther editor, inspired by Pico
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.RI [ options "] [[+" line [, column "]]\ " file "]..."
|
||||
.RI [ options "] [[\fB+" line [\fB, column "]] " file ]...
|
||||
.sp
|
||||
.BR nano " [" \fIoptions "] [[" + [ crCR ]( / | ? ) \fIstring "] " \fIfile ]...
|
||||
|
||||
.SH NOTICE
|
||||
Starting with version 4.0, \fBnano\fR no longer hard-wraps an overlong
|
||||
line by default. It further uses smooth scrolling by default, and by
|
||||
default includes the line below the title bar into the editing area.
|
||||
.sp
|
||||
If you want the old, Pico behavior back, you can use \fB\-\-breaklonglines\fR,
|
||||
\fB\-\-jumpyscrolling\fR, and \fB\-\-emptyline\fR (or \fB\-bje\fR for short).
|
||||
|
||||
.SH DESCRIPTION
|
||||
\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
|
||||
lacks, such as: opening multiple files, scrolling per line, undo/redo,
|
||||
syntax coloring, line numbering, and soft-wrapping overlong lines.
|
||||
|
||||
.sp
|
||||
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
|
||||
the filename, and even in a specific column by adding it with a comma.
|
||||
|
||||
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.
|
||||
The string can be made case sensitive and/or caused to be interpreted as a
|
||||
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
|
||||
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
|
||||
the first occurrence of the word "Foo", one would do:
|
||||
.sp
|
||||
.RS 4
|
||||
.BI "nano +c/Foo " file
|
||||
.RE
|
||||
.sp
|
||||
As a special case: if instead of a filename a dash (\fB\-\fR) is given,
|
||||
\fBnano\fR will read data from standard input.
|
||||
|
||||
@@ -47,18 +69,18 @@ Consecutive \fB^K\fRs will put all deleted lines together in the cutbuffer.
|
||||
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
|
||||
contents of the cutbuffer at the current cursor position.
|
||||
.PP
|
||||
.sp
|
||||
When a more precise piece of text needs to be cut or copied, one can mark
|
||||
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
|
||||
cutbuffer. One can also save the marked text to a file with \fB^O\fR, or
|
||||
spell check it with \fB^T\fR.
|
||||
.PP
|
||||
.sp
|
||||
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
|
||||
the stride.
|
||||
Any cursor movement without Shift being held will cancel such a selection.
|
||||
.PP
|
||||
.sp
|
||||
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 default key bindings can be changed via a \fInanorc\fR file -- see
|
||||
@@ -101,13 +123,20 @@ executed commands, so they can be easily reused in later sessions.
|
||||
.BR \-I ", " \-\-ignorercfiles
|
||||
Don't look at the system's \fInanorc\fR nor at the user's \fInanorc\fR.
|
||||
.TP
|
||||
.BR \-K ", " \-\-rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
.BR \-J\ \fInumber ", " \-\-guidestripe= \fInumber
|
||||
Draw a vertical stripe at the given column, to help judge the width of the
|
||||
text. (The color of the stripe can be changed with \fBset stripecolor\fR
|
||||
in your \fInanorc\fR file.)
|
||||
.TP
|
||||
.BR \-K ", " \-\-rawsequences
|
||||
Interpret escape sequences directly (instead of asking \fBncurses\fR to
|
||||
translate them). If you need this option to get your keyboard to work
|
||||
properly, please report a bug. Using this option disables \fBnano\fR's
|
||||
mouse support.
|
||||
.TP
|
||||
.BR \-L ", " \-\-nonewlines
|
||||
Don't automatically add a newline when a file 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.)
|
||||
.TP
|
||||
.BR \-M ", " \-\-trimblanks
|
||||
Snip trailing whitespace from the wrapped line when automatic
|
||||
@@ -117,7 +146,9 @@ hard-wrapping occurs or when text is justified.
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.BR \-O ", " \-\-morespace
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
Obsolete and ignored option, since the line below the title bar is included
|
||||
into the editing space by default. If you prefer to keep this line blank,
|
||||
use \fB\-e\fR or \fB\-\-emptyline\fR.
|
||||
.TP
|
||||
.BR \-P ", " \-\-positionlog
|
||||
For the 200 most recent files, log the last position of the cursor,
|
||||
@@ -125,9 +156,10 @@ and place it at that position again upon reopening such a file.
|
||||
.TP
|
||||
.BR "\-Q ""\fIregex\fB""" ", " "\-\-quotestr=""" \fIregex """
|
||||
Set the regular expression for matching the quoting part of a line.
|
||||
This is used when justifying.
|
||||
The default value is \fB"^([\ \\t]*([#:>|}]|//))+"\fP.
|
||||
Note that \fB\\t\fP stands for an actual Tab.
|
||||
The default value is \fB"^([\ \\t]*([!#%:;>|}]|//))+"\fP.
|
||||
(Note that \fB\\t\fP stands for an actual Tab.)
|
||||
This makes it possible to rejustify blocks of quoted text when composing
|
||||
email, and to rewrap blocks of line comments when writing source code.
|
||||
.TP
|
||||
.BR \-R ", " \-\-restricted
|
||||
Restricted mode: don't read or write to any file not specified on the
|
||||
@@ -139,8 +171,9 @@ Restricted mode can also be activated by invoking \fBnano\fP
|
||||
with any name beginning with 'r' (e.g. "rnano").
|
||||
.TP
|
||||
.BR \-S ", " \-\-smooth
|
||||
Use smooth scrolling: text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
Obsolete and ignored option, since smooth scrolling has become the default.
|
||||
If you prefer the chunk-by-chunk scrolling behavior,
|
||||
use \fB\-j\fR or \fB\-\-jumpyscrolling\fR.
|
||||
.TP
|
||||
.BR \-T\ \fInumber ", " \-\-tabsize= \fInumber
|
||||
Set the size (width) of a tab to \fInumber\fP columns. The value of
|
||||
@@ -175,14 +208,22 @@ Let an unmodified Backspace or Delete erase the marked region
|
||||
When doing soft line wrapping, wrap lines at whitespace
|
||||
instead of always at the edge of the screen.
|
||||
.TP
|
||||
.BR \-b ", " \-\-breaklonglines
|
||||
Automatically hard-wrap the current line when it becomes overlong.
|
||||
(This option is the opposite of \fB\-w\fR (\fB\-\-nowrap\fR) --
|
||||
the last one given takes effect.)
|
||||
.TP
|
||||
.BR \-c ", " \-\-constantshow
|
||||
Constantly show the cursor position on the status bar.
|
||||
Note that this overrides option \fB\-U\fR (\fB\-\-quickblank\fR).
|
||||
.TP
|
||||
.BR \-d ", " \-\-rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
Interpret the Delete and Backspace keys differently so that both Backspace
|
||||
and Delete work properly. You should only use this option when on your
|
||||
system either Backspace acts like Delete or Delete acts like Backspace.
|
||||
.TP
|
||||
.BR \-e ", " \-\-emptyline
|
||||
Do not use the line below the title bar, leaving it entirely blank.
|
||||
.TP
|
||||
.BR \-g ", " \-\-showcursor
|
||||
Make the cursor visible in the file browser (putting it on the
|
||||
@@ -197,6 +238,9 @@ Automatically indent a newly created line to the same number of tabs
|
||||
and/or spaces as the previous line (or as the next line if the previous
|
||||
line is the beginning of a paragraph).
|
||||
.TP
|
||||
.BR \-j ", " \-\-jumpyscrolling
|
||||
Scroll the buffer contents per half-screen instead of per line.
|
||||
.TP
|
||||
.BR \-k ", " \-\-cutfromcursor
|
||||
Make the 'Cut Text' command (normally \fB^K\fR) cut from the current cursor
|
||||
position to the end of the line, instead of cutting the entire line.
|
||||
@@ -226,18 +270,16 @@ similar to a chroot.
|
||||
Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
|
||||
by the terminal.
|
||||
.TP
|
||||
.BR \-q ", " \-\-quiet
|
||||
Obsolete option. Recognized but ignored.
|
||||
.TP
|
||||
.BR \-r\ \fInumber ", " \-\-fill= \fInumber
|
||||
Hard-wrap lines at column \fInumber\fP. If this value is 0 or less, wrapping
|
||||
will occur at the width of the screen less \fInumber\fP columns, allowing
|
||||
the wrap point to vary along with the width of the screen if the screen
|
||||
is resized. The default value is \-8. This option conflicts with
|
||||
\fB\-w\fR (\fB\-\-nowrap\fR) -- the last one given takes effect.
|
||||
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
|
||||
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.
|
||||
The default value is \-8.
|
||||
.TP
|
||||
.BR \-s\ \fIprogram ", " \-\-speller= \fIprogram
|
||||
Use this alternative spell checker command.
|
||||
.B "\-s ""\fIprogram\fR [\fIarg\fR...]\fB""\fR, \fB\-\-speller=""\fIprogram\fR [\fIarg\fR...]\fB"""
|
||||
Use this command to perform spell checking and correcting, instead of
|
||||
using the built-in corrector that calls \fBhunspell\fR or GNU \fBspell\fR.
|
||||
.TP
|
||||
.BR \-t ", " \-\-tempfile
|
||||
Save a changed buffer without prompting (when exiting with \fB^X\fR).
|
||||
@@ -250,11 +292,13 @@ default behavior of saving a file in the format that it had.
|
||||
.BR \-v ", " \-\-view
|
||||
Just view the file and disallow editing: read-only mode.
|
||||
This mode allows the user to open also other files for viewing,
|
||||
unless \fB--restricted\fR is given too.
|
||||
unless \fB\-\-restricted\fR is given too.
|
||||
.TP
|
||||
.BR \-w ", " \-\-nowrap
|
||||
Disable the hard-wrapping of long lines. This option conflicts with
|
||||
\fB\-r\fR (\fB\-\-fill\fR) -- the last one given takes effect.
|
||||
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
|
||||
(\fB\-\-breaklonglines\fR) -- the last one given takes effect.)
|
||||
|
||||
.TP
|
||||
.BR \-x ", " \-\-nohelp
|
||||
Don't show the two help lines at the bottom of the screen.
|
||||
@@ -272,23 +316,20 @@ continuing it over multiple screen lines. Since
|
||||
\&'$' normally refers to a variable in the Unix shell, you should specify
|
||||
this option last when using other options (e.g.\& 'nano \-wS$') or pass it
|
||||
separately (e.g.\& 'nano \-wS \-$').
|
||||
.TP
|
||||
.BR \-b ", " \-e ", " \-f ", " \-j
|
||||
Ignored, for compatibility with Pico.
|
||||
|
||||
.SH TOGGLES
|
||||
Several of the above options can be switched on and off also while
|
||||
\fBnano\fR is running. For example, \fBM\-L\fR toggles the
|
||||
hard-wrapping of long lines, \fBM\-$\fR toggles soft-wrapping,
|
||||
\fBM\-#\fR toggles line numbers, \fBM\-M\fR toggles the mouse,
|
||||
hard-wrapping of long lines, \fBM\-S\fR toggles soft-wrapping,
|
||||
\fBM\-N\fR toggles line numbers, \fBM\-M\fR toggles the mouse,
|
||||
\fBM\-I\fR auto-indentation, and \fBM\-X\fR the help lines.
|
||||
See at the end of the \fB^G\fR help text for a complete list.
|
||||
|
||||
.SH INITIALIZATION FILE
|
||||
.SH FILES
|
||||
\fBnano\fR will read two configuration files: first the system's
|
||||
\fInanorc\fR (if it exists), and then the user's \fInanorc\fR (if it
|
||||
exists), either \fB~/.nanorc\fR or \fI$XDG_CONFIG_HOME\fB/nano/nanorc\fR
|
||||
or \fB~/.config/nano/nanorc\fR, whichever is encountered first. See
|
||||
exists), either \fI~/.nanorc\fR or \fI$XDG_CONFIG_HOME/nano/nanorc\fR
|
||||
or \fI~/.config/nano/nanorc\fR, whichever is encountered first. See
|
||||
.BR nanorc (5)
|
||||
for more information on the possible contents of those files.
|
||||
|
||||
@@ -308,33 +349,22 @@ it unique. In multibuffer mode, \fBnano\fP will write all the open
|
||||
buffers to their respective emergency files.
|
||||
|
||||
.SH BUGS
|
||||
Justifications (\fB^J\fR)
|
||||
are not yet covered by the general undo system. So after a justification
|
||||
that is not immediately undone, earlier edits
|
||||
cannot be undone any more. The workaround is, of course, to exit without
|
||||
saving.
|
||||
.sp
|
||||
The recording and playback of keyboard macros works correctly only on a
|
||||
terminal emulator, not on a Linux console (VT), because the latter does
|
||||
not by default distinguish modified from unmodified arrow keys.
|
||||
.sp
|
||||
Please report any other bugs that you encounter via:
|
||||
.br
|
||||
\fIhttps://savannah.gnu.org/bugs/?group=nano\fR.
|
||||
.IR https://savannah.gnu.org/bugs/?group=nano .
|
||||
.sp
|
||||
When nano crashes, it will save any modified buffers to emergency .save files.
|
||||
If you are able to reproduce the crash and you want to get a backtrace, define
|
||||
the environment variable \fBNANO_NOCATCH\fR.
|
||||
|
||||
.SH HOMEPAGE
|
||||
\fIhttps://nano-editor.org/\fR
|
||||
.I https://nano\-editor.org/
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR nanorc (5)
|
||||
.PP
|
||||
.sp
|
||||
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta and others (see the files \fIAUTHORS\fR and
|
||||
\fITHANKS\fP for details). This manual page was originally written by
|
||||
Jordi Mallach for the Debian system (but may be used by others).
|
||||
|
||||
469
doc/nano.texi
469
doc/nano.texi
@@ -8,8 +8,8 @@
|
||||
|
||||
@smallbook
|
||||
@set EDITION 0.5
|
||||
@set VERSION 3.2
|
||||
@set UPDATED November 2018
|
||||
@set VERSION 4.6
|
||||
@set UPDATED November 2019
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @command{nano}
|
||||
@subtitle a small and friendly text editor
|
||||
@subtitle version 3.2
|
||||
@subtitle version 4.6
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -33,7 +33,7 @@ This manual documents the GNU @command{nano} editor.
|
||||
This manual is part of the GNU @command{nano} distribution.@*
|
||||
|
||||
@sp 4
|
||||
Copyright @copyright{} 1999-2009, 2014-2017 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1999-2009, 2014-2019 Free Software Foundation, Inc.
|
||||
|
||||
@sp 1
|
||||
This document is dual-licensed. You may distribute and/or modify it
|
||||
@@ -57,13 +57,13 @@ You may contact the author by
|
||||
e-mail: @email{chrisa@@asty.org}@*
|
||||
@end titlepage
|
||||
|
||||
|
||||
@ifnottex
|
||||
|
||||
|
||||
@node Top
|
||||
@top
|
||||
|
||||
This manual documents the GNU @command{nano} editor, version 3.2.
|
||||
This manual documents the GNU @command{nano} editor, version 4.6.
|
||||
|
||||
@menu
|
||||
* Introduction::
|
||||
@@ -84,18 +84,27 @@ This manual documents the GNU @command{nano} editor, version 3.2.
|
||||
@node Introduction
|
||||
@chapter Introduction
|
||||
|
||||
GNU @command{nano} is a small and friendly text editor. Besides basic text
|
||||
editing, @command{nano} offers many extra features, such as an interactive
|
||||
search-and-replace, undo/redo, syntax coloring, smooth scrolling,
|
||||
auto-indentation, go-to-line-and-column-number, feature toggles,
|
||||
file locking, backup files, and internationalization support.
|
||||
GNU @command{nano} is a small and friendly text editor. Besides
|
||||
basic text editing, @command{nano} offers features like undo/redo,
|
||||
syntax coloring, interactive search-and-replace, auto-indentation,
|
||||
line numbers, word completion, file locking, backup files, and
|
||||
internationalization support.
|
||||
|
||||
The original goal for @command{nano} was to be a complete bug-for-bug
|
||||
emulation of Pico. But currently the goal is to be as compatible
|
||||
as possible while offering a superset of Pico's functionality.
|
||||
as is reasonable while offering a superset of Pico's functionality.
|
||||
@xref{Pico Compatibility} for more details on how @command{nano} and
|
||||
Pico differ.
|
||||
|
||||
Starting with version 4.0, @command{nano} no longer hard-wraps an overlong
|
||||
line by default. It further uses smooth scrolling by default, and by
|
||||
default includes the line below the title bar into the editing area.
|
||||
|
||||
If you want the old, Pico behavior back, you can use the
|
||||
following options: @option{--breaklonglines},
|
||||
@option{--jumpyscrolling}, and @option{--emptyline}
|
||||
(or @option{-bje} for short).
|
||||
|
||||
Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}.
|
||||
|
||||
|
||||
@@ -118,13 +127,21 @@ But it is also possible to specify one or more options (see the next
|
||||
section), and to edit several files in a row. Additionally, the cursor
|
||||
can be put on a specific line of a file by adding the line number
|
||||
with a plus sign before the filename, and even in a specific column by
|
||||
adding it with a comma. So a more complete command synopsis is:
|
||||
adding it with a comma.
|
||||
The cursor can also be put on the first or last occurrence of a specific string
|
||||
by specifying that string after @code{+/} or @code{+?} before the filename.
|
||||
The string can be made case sensitive and/or caused to be interpreted as a
|
||||
regular expression by inserting a @code{c} and/or @code{r} after the plus sign.
|
||||
These search modes can be explicitly disabled by using the uppercase variant
|
||||
of those letters: @code{C} and/or @code{R}. When the string contains spaces,
|
||||
it needs to be enclosed in quotes.
|
||||
A more complete command synopsis thus is:
|
||||
|
||||
@iftex
|
||||
@sp 1
|
||||
@end iftex
|
||||
@example
|
||||
@code{nano [OPTION]@dots{} [[+LINE[,COLUMN]|+,COLUMN] FILE]@dots{}}
|
||||
@code{nano [OPTION]@dots{} [[+LINE[,COLUMN]|+[crCR](/|?)STRING] FILE]@dots{}}
|
||||
@end example
|
||||
@iftex
|
||||
@sp 1
|
||||
@@ -139,6 +156,7 @@ As a special case: when instead of a filename a dash is given, @command{nano}
|
||||
will read data from standard input. This means you can pipe the output of
|
||||
a command straight into a buffer, and then edit it.
|
||||
|
||||
|
||||
@node Command-line Options
|
||||
@chapter Command-line Options
|
||||
|
||||
@@ -190,15 +208,23 @@ executed commands, so they can be easily reused in later sessions.
|
||||
@itemx --ignorercfiles
|
||||
Don't look at the system's nanorc file nor at the user's nanorc.
|
||||
|
||||
@item -J
|
||||
@itemx --guidestripe
|
||||
Draw a vertical stripe at the given column, to help judge the width of the
|
||||
text. (The color of the stripe can be changed with @code{set stripecolor}
|
||||
in your nanorc file.)
|
||||
|
||||
@item -K
|
||||
@itemx --rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
@itemx --rawsequences
|
||||
Interpret escape sequences directly (instead of asking @code{ncurses} to
|
||||
translate them). If you need this option to get your keyboard to work
|
||||
properly, please report a bug. Using this option disables @command{nano}'s
|
||||
mouse support.
|
||||
|
||||
@item -L
|
||||
@itemx --nonewlines
|
||||
Don't automatically add a newline when a file 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.)
|
||||
|
||||
@item -M
|
||||
@itemx --trimblanks
|
||||
@@ -211,7 +237,9 @@ Disable automatic conversion of files from DOS/Mac format.
|
||||
|
||||
@item -O
|
||||
@itemx --morespace
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
Obsolete and ignored option, since the line below the title bar is included
|
||||
into the editing space by default. If you prefer to keep this line blank,
|
||||
use @option{-e} or @option{--emptyline}.
|
||||
|
||||
@item -P
|
||||
@itemx --positionlog
|
||||
@@ -220,9 +248,11 @@ and place it at that position again upon reopening such a file.
|
||||
|
||||
@item -Q "@var{regex}"
|
||||
@itemx --quotestr="@var{regex}"
|
||||
Set the regular expression for matching the quoting part of a line, used
|
||||
when justifying. The default value is @t{"^([@w{ }\t]*([#:>|@}]|//))+"}.
|
||||
Note that @code{\t} stands for a literal Tab character.
|
||||
Set the regular expression for matching the quoting part of a line.
|
||||
The default value is @t{"^([@w{ }\t]*([!#%:;>|@}]|//))+"}.
|
||||
(Note that @code{\t} stands for a literal Tab character.)
|
||||
This makes it possible to rejustify blocks of quoted text when composing
|
||||
email, and to rewrap blocks of line comments when writing source code.
|
||||
|
||||
@item -R
|
||||
@itemx --restricted
|
||||
@@ -236,8 +266,9 @@ any name beginning with @code{r} (e.g.@: @command{rnano}).
|
||||
|
||||
@item -S
|
||||
@itemx --smooth
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
Obsolete and ignored option, since smooth scrolling has become the default.
|
||||
If you prefer the chunk-by-chunk scrolling behavior,
|
||||
use @option{-j} or @option{--jumpyscrolling}.
|
||||
|
||||
@item -T @var{number}
|
||||
@itemx --tabsize=@var{number}
|
||||
@@ -280,6 +311,12 @@ Let an unmodified @key{Backspace} or @key{Delete} erase the marked region
|
||||
When doing soft line wrapping, wrap lines at whitespace
|
||||
instead of always at the edge of the screen.
|
||||
|
||||
@item -b
|
||||
@itemx --breaklonglines
|
||||
Automatically hard-wrap the current line when it becomes overlong.
|
||||
(This option is the opposite of @option{-w} (@option{--nowrap}) ---
|
||||
the last one given takes effect.)
|
||||
|
||||
@item -c
|
||||
@itemx --constantshow
|
||||
Constantly display the cursor position (line number, column number,
|
||||
@@ -288,9 +325,13 @@ Note that this overrides option @option{-U} (@option{--quickblank}).
|
||||
|
||||
@item -d
|
||||
@itemx --rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
Interpret the Delete and Backspace keys differently so that both Backspace
|
||||
and Delete work properly. You should only use this option when on your
|
||||
system either Backspace acts like Delete or Delete acts like Backspace.
|
||||
|
||||
@item -e
|
||||
@itemx --emptyline
|
||||
Do not use the line below the title bar, leaving it entirely blank.
|
||||
|
||||
@item -g
|
||||
@itemx --showcursor
|
||||
@@ -308,6 +349,10 @@ Automatically indent a newly created line to the same number of tabs
|
||||
and/or spaces as the previous line (or as the next line if the previous
|
||||
line is the beginning of a paragraph).
|
||||
|
||||
@item -j
|
||||
@itemx --jumpyscrolling
|
||||
Scroll the buffer contents per half-screen instead of per line.
|
||||
|
||||
@item -k
|
||||
@itemx --cutfromcursor
|
||||
Make the 'Cut Text' command (normally @kbd{^K}) cut from the current cursor
|
||||
@@ -343,27 +388,23 @@ similar to a chroot.
|
||||
Preserve the @kbd{^Q} (XON) and @kbd{^S} (XOFF) sequences so data being
|
||||
sent to the editor can be stopped and started.
|
||||
|
||||
@item -q
|
||||
@itemx --quiet
|
||||
Obsolete option. Recognized but ignored.
|
||||
|
||||
@item -r @var{number}
|
||||
@itemx --fill=@var{number}
|
||||
Hard-wrap lines at column @var{number} (by inserting a newline character).
|
||||
If the given value is 0 or less, wrapping will occur at the width of
|
||||
the screen minus the given amount, allowing the wrapping width to
|
||||
vary along with the width of the screen if and when it is resized.
|
||||
The default value is @t{-8}. This option conflicts with @option{-w}
|
||||
(@option{--nowrap}); the last one given takes effect.
|
||||
Set the target width for justifying and automatic hard-wrapping at this
|
||||
@var{number} of columns. If the value is 0 or less, wrapping will occur
|
||||
at the width of the screen minus @var{number} columns, allowing the wrap
|
||||
point to vary along with the width of the screen if the screen is resized.
|
||||
The default value is @t{-8}.
|
||||
|
||||
@anchor{@option{--speller}}
|
||||
@item -s @var{program}
|
||||
@itemx --speller=@var{program}
|
||||
@item -s "@var{program} [@var{arg} @dots{}]"
|
||||
@itemx --speller="@var{program} [@var{arg} @dots{}]"
|
||||
Use the given program to do spell checking and correcting. By default,
|
||||
@command{nano} uses the command specified in the @env{SPELL} environment
|
||||
variable. If @env{SPELL} is not set, and @option{--speller} is
|
||||
not specified either, then @command{nano} uses its own interactive spell
|
||||
corrector, which requires the GNU @command{spell} program to be installed.
|
||||
corrector, which requires either @command{hunspell} or GNU @command{spell}
|
||||
to be installed.
|
||||
|
||||
@item -t
|
||||
@itemx --tempfile
|
||||
@@ -387,8 +428,10 @@ file permissions to implement a read-only file.)
|
||||
|
||||
@item -w
|
||||
@itemx --nowrap
|
||||
Don't hard-wrap long lines at any length. This option conflicts with
|
||||
@option{-r} (@option{--fill}); the last one given takes effect.
|
||||
Do not automatically hard-wrap the current line when it becomes overlong.
|
||||
This is the default. (This option is the opposite of @option{-b}
|
||||
(@option{--breaklonglines}) --- the last one given takes effect.)
|
||||
|
||||
|
||||
@anchor{Expert Mode}
|
||||
@item -x
|
||||
@@ -418,12 +461,6 @@ continuing it over multiple screen lines. Since
|
||||
this option last when using other options (e.g.@: @code{nano -wS$}) or pass it
|
||||
separately (e.g.@: @code{nano -wS -$}).
|
||||
|
||||
@item -b
|
||||
@itemx -e
|
||||
@itemx -f
|
||||
@itemx -j
|
||||
Ignored, for compatibility with Pico.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@@ -575,16 +612,11 @@ is running.
|
||||
@node Limitations
|
||||
@section Limitations
|
||||
|
||||
Justifications (@kbd{^J})
|
||||
are not yet covered by the general undo system. So after a justification
|
||||
that is not immediately undone, earlier edits
|
||||
cannot be undone any more. The workaround is, of course, to exit without
|
||||
saving.
|
||||
|
||||
The recording and playback of keyboard macros works correctly only on a
|
||||
terminal emulator, not on a Linux console (VT), because the latter does
|
||||
not by default distinguish modified from unmodified arrow keys.
|
||||
|
||||
|
||||
@node Built-in Help
|
||||
@chapter Built-in Help
|
||||
|
||||
@@ -617,19 +649,22 @@ The following global toggles are available:
|
||||
@kbd{Meta-K} toggles the @option{-k} (@option{--cutfromcursor}) command-line option.
|
||||
|
||||
@item Long-Line Wrapping
|
||||
@kbd{Meta-L} toggles the @option{-w} (@option{--nowrap}) command-line option.
|
||||
@kbd{Meta-L} toggles the @option{-b} (@option{--breaklonglines}) command-line option.
|
||||
|
||||
@item Mouse Support
|
||||
@kbd{Meta-M} toggles the @option{-m} (@option{--mouse}) command-line option.
|
||||
|
||||
@item Line Numbers
|
||||
@kbd{Meta-N} toggles the @option{-l} (@option{--linenumbers}) command-line option.
|
||||
|
||||
@item Tabs To Spaces
|
||||
@kbd{Meta-O} toggles the @option{-E} (@option{--tabstospaces}) command-line option.
|
||||
|
||||
@item Whitespace Display
|
||||
@kbd{Meta-P} toggles the displaying of whitespace (@pxref{Whitespace}).
|
||||
|
||||
@item Smooth Scrolling
|
||||
@kbd{Meta-S} toggles the @option{-S} (@option{--smooth}) command-line option.
|
||||
@item Soft Wrapping
|
||||
@kbd{Meta-S} toggles the @option{-$} (@option{--softwrap}) command-line option.
|
||||
|
||||
@item Expert/No Help
|
||||
@kbd{Meta-X} toggles the @option{-x} (@option{--nohelp}) command-line option.
|
||||
@@ -641,12 +676,6 @@ The following global toggles are available:
|
||||
@item Suspension
|
||||
@kbd{Meta-Z} toggles the @option{-z} (@option{--suspend}) command-line option.
|
||||
|
||||
@item Line Numbers
|
||||
@kbd{Meta-#} toggles the @option{-l} (@option{--linenumbers}) command-line option.
|
||||
|
||||
@item Soft Wrapping
|
||||
@kbd{Meta-$} toggles the @option{-$} (@option{--softwrap}) command-line option.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@@ -672,10 +701,8 @@ take an argument are unset by default. So using the @code{unset} command
|
||||
is only needed when wanting to override a setting of the system's nanorc
|
||||
file in your own nanorc. Options that take an argument cannot be unset.
|
||||
|
||||
Quotes inside string parameters don't have to be escaped with
|
||||
backslashes. The last double quote in the string will be treated as its
|
||||
end. For example, for the @code{brackets} option, @t{""')>]@}"} will match
|
||||
@code{"}, @code{'}, @code{)}, @code{>}, @code{]}, and @code{@}}.
|
||||
Quotes inside the @var{characters} parameters below should not be escaped.
|
||||
The last double quote on the line will be seen as the closing quote.
|
||||
|
||||
@menu
|
||||
* Settings::
|
||||
@@ -723,13 +750,16 @@ function tags, line numbers, and selected text. This can be overridden by
|
||||
setting the options @code{titlecolor}, @code{statuscolor}, @code{keycolor},
|
||||
@code{functioncolor}, @code{numbercolor}, and @code{selectedcolor}.
|
||||
|
||||
@item set brackets "@var{string}"
|
||||
@item set brackets "@var{characters}"
|
||||
Set the characters treated as closing brackets when justifying
|
||||
paragraphs. This may not include blank characters. Only closing
|
||||
punctuation (see @code{set punct}), optionally followed by the specified
|
||||
closing brackets, can end sentences. The default value is
|
||||
@t{""')>]@}"}.
|
||||
|
||||
@item set breaklonglines
|
||||
Automatically hard-wrap the current line when it becomes overlong.
|
||||
|
||||
@item set casesensitive
|
||||
Do case-sensitive searches by default.
|
||||
|
||||
@@ -739,17 +769,21 @@ Note that this overrides @option{quickblank}.
|
||||
|
||||
@item set cutfromcursor
|
||||
Use cut-from-cursor-to-end-of-line by default, instead of cutting the whole line.
|
||||
(The old form of this option, @code{set cut}, is deprecated.)
|
||||
|
||||
@item set emptyline
|
||||
Do not use the line below the title bar, leaving it entirely blank.
|
||||
|
||||
@item set errorcolor @var{fgcolor},@var{bgcolor}
|
||||
Use this color combination for the status bar when an error message is displayed.
|
||||
The default value is @t{brightwhite,red}.
|
||||
@xref{@code{set functioncolor}} for valid color names.
|
||||
|
||||
@item set fill @var{number}
|
||||
Hard-wrap lines at column number @var{number}. If @var{number} is 0 or less,
|
||||
the maximum line length will be the screen width less @var{number} columns.
|
||||
The default value is @t{-8}. This option conflicts with
|
||||
@option{nowrap}; the last one given takes effect.
|
||||
Set the target width for justifying and automatic hard-wrapping at this
|
||||
@var{number} of columns. If the value is 0 or less, wrapping will occur
|
||||
at the width of the screen minus @var{number} columns, allowing the wrap
|
||||
point to vary along with the width of the screen if the screen is resized.
|
||||
The default value is @t{-8}.
|
||||
|
||||
@anchor{@code{set functioncolor}}
|
||||
@item set functioncolor @var{fgcolor},@var{bgcolor}
|
||||
@@ -762,10 +796,17 @@ Valid names for foreground and background color are:
|
||||
The name of the foreground color may be prefixed with @code{bright}.
|
||||
And either @var{fgcolor} or ,@var{bgcolor} may be left out.
|
||||
|
||||
@item set guidestripe @var{number}
|
||||
Draw a vertical stripe at the given column, to help judge the width of the
|
||||
text. (The color of the stripe can be changed with @code{set stripecolor}.)
|
||||
|
||||
@item set historylog
|
||||
Save the last hundred search strings and replacement strings and
|
||||
executed commands, so they can be easily reused in later sessions.
|
||||
|
||||
@item set jumpyscrolling
|
||||
Scroll the buffer contents per half-screen instead of per line.
|
||||
|
||||
@item set keycolor @var{fgcolor},@var{bgcolor}
|
||||
Use this color combination for the shortcut key combos
|
||||
in the two help lines at the bottom of the screen.
|
||||
@@ -777,14 +818,15 @@ Display line numbers to the left of the text area.
|
||||
@item set locking
|
||||
Enable vim-style lock-files for when editing files.
|
||||
|
||||
@item set matchbrackets "@var{string}"
|
||||
@item set matchbrackets "@var{characters}"
|
||||
Set the opening and closing brackets that can be found by bracket
|
||||
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.
|
||||
The default value is @t{"(<[@{)>]@}"}.
|
||||
|
||||
@item set morespace
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
Deprecated option since it has become the default setting.
|
||||
When needed, use @code{unset emptyline} instead.
|
||||
|
||||
@item set mouse
|
||||
Enable mouse support, so that mouse clicks can be used to place the
|
||||
@@ -800,15 +842,15 @@ Don't convert files from DOS/Mac format.
|
||||
Don't display the help lists at the bottom of the screen.
|
||||
|
||||
@item set nonewlines
|
||||
When a file does not end with a newline, don't automatically add 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.)
|
||||
|
||||
@item set nopauses
|
||||
Don't pause between warnings at startup. This means that only
|
||||
the last one will be visible (when there are multiple ones).
|
||||
Obsolete option. Ignored.
|
||||
|
||||
@item set nowrap
|
||||
Don't hard-wrap text at all. This option conflicts with
|
||||
@option{fill}; the last one given takes effect.
|
||||
Deprecated option since it has become the default setting.
|
||||
When needed, use @code{unset breaklonglines} instead.
|
||||
|
||||
@item set numbercolor @var{fgcolor},@var{bgcolor}
|
||||
Use this color combination for line numbers.
|
||||
@@ -827,7 +869,7 @@ The cursor position is remembered for the 200 most-recently edited files.
|
||||
@item set preserve
|
||||
Preserve the XON and XOFF keys (@kbd{^Q} and @kbd{^S}).
|
||||
|
||||
@item set punct "@var{string}"
|
||||
@item set punct "@var{characters}"
|
||||
Set the characters treated as closing punctuation when justifying
|
||||
paragraphs. This may not include blank characters. Only the
|
||||
specified closing punctuation, optionally followed by closing brackets
|
||||
@@ -838,27 +880,27 @@ The default value is @t{"!.?"}.
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25. Note that @option{constantshow} overrides this.
|
||||
|
||||
@item set quiet
|
||||
Obsolete option. Recognized but ignored.
|
||||
|
||||
@item set quotestr "@var{regex}"
|
||||
The email-quote string, used to justify email-quoted paragraphs. This
|
||||
is an extended regular expression. The default value is
|
||||
@t{"^([@w{ }\t]*([#:>|@}]|//))+"}.
|
||||
Note that @code{\t} stands for a literal Tab character.
|
||||
Set the regular expression for matching the quoting part of a line.
|
||||
The default value is @t{"^([@w{ }\t]*([!#%:;>|@}]|//))+"}.
|
||||
(Note that @code{\t} stands for a literal Tab character.)
|
||||
This makes it possible to rejustify blocks of quoted text when composing
|
||||
email, and to rewrap blocks of line comments when writing source code.
|
||||
|
||||
@item set rawsequences
|
||||
Interpret escape sequences directly (instead of asking @code{ncurses} to
|
||||
translate them). If you need this option to get your keyboard to work
|
||||
properly, please report a bug. Using this option disables @command{nano}'s
|
||||
mouse support.
|
||||
|
||||
@item set rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
|
||||
@item set rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
Interpret the Delete and Backspace keys differently so that both Backspace
|
||||
and Delete work properly. You should only use this option when on your
|
||||
system either Backspace acts like Delete or Delete acts like Backspace.
|
||||
|
||||
@item set regexp
|
||||
Do extended regular expression searches by default.
|
||||
Do regular-expression searches by default.
|
||||
Regular expressions in @command{nano} are of the extended type (ERE).
|
||||
|
||||
@item set selectedcolor @var{fgcolor},@var{bgcolor}
|
||||
Use this color combination for selected text.
|
||||
@@ -877,12 +919,13 @@ already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
|
||||
@item set smooth
|
||||
Use smooth scrolling by default.
|
||||
Deprecated option since it has become the default setting.
|
||||
When needed, use @code{unset jumpyscrolling} instead.
|
||||
|
||||
@item set softwrap
|
||||
Enable soft line wrapping for easier viewing of very long lines.
|
||||
|
||||
@item set speller "@var{program}"
|
||||
@item set speller "@var{program} [@var{arg} @dots{}]"
|
||||
Use the given program to do spell checking and correcting.
|
||||
@xref{@option{--speller}} for details.
|
||||
|
||||
@@ -890,6 +933,10 @@ Use the given program to do spell checking and correcting.
|
||||
Use this color combination for the status bar.
|
||||
@xref{@code{set functioncolor}} for valid color names.
|
||||
|
||||
@item set stripecolor @var{fgcolor},@var{bgcolor}
|
||||
Use this color combination for the vertical guiding stripe.
|
||||
@xref{@code{set functioncolor}} for valid color names.
|
||||
|
||||
@item set suspend
|
||||
Allow @command{nano} to be suspended.
|
||||
|
||||
@@ -910,7 +957,6 @@ Use this color combination for the title bar.
|
||||
@item set trimblanks
|
||||
Remove trailing whitespace from wrapped lines when automatic
|
||||
hard-wrapping occurs or when text is justified.
|
||||
(The old form of this option, @code{set justifytrim}, is deprecated.)
|
||||
|
||||
@item set unix
|
||||
Save a file by default in Unix format. This overrides nano's
|
||||
@@ -923,7 +969,7 @@ This mode allows the user to open also other files for viewing,
|
||||
unless @option{--restricted} is given on the command line.
|
||||
|
||||
@anchor{Whitespace}
|
||||
@item set whitespace "@var{string}"
|
||||
@item set whitespace "@var{characters}"
|
||||
Set the two characters used to indicate the presence of tabs and
|
||||
spaces. They must be single-column characters. The default pair
|
||||
for a UTF-8 locale is @t{"»·"}, and for other locales @t{">."}.
|
||||
@@ -932,7 +978,7 @@ for a UTF-8 locale is @t{"»·"}, and for other locales @t{">."}.
|
||||
Detect word boundaries differently by treating punctuation
|
||||
characters as part of a word.
|
||||
|
||||
@item set wordchars "@var{string}"
|
||||
@item set wordchars "@var{characters}"
|
||||
Specify which other characters (besides the normal alphanumeric ones)
|
||||
should be considered as parts of words. This overrides the option
|
||||
@code{wordbounds}.
|
||||
@@ -953,6 +999,20 @@ powerful enough to fully parse a file. Nevertheless, regular
|
||||
expressions can do a lot and are easy to make, so they are a
|
||||
good fit for a small editor like @command{nano}.
|
||||
|
||||
All regular expressions in @command{nano} are POSIX extended regular expressions
|
||||
(ERE). This means that @code{.}, @code{?}, @code{*}, @code{+}, @code{^},
|
||||
@code{$}, and several other characters are special.
|
||||
The period @code{.} matches any single character,
|
||||
@code{?} means the preceding item is optional,
|
||||
@code{*} means the preceding item may be matched zero or more times,
|
||||
@code{+} means the preceding item must be matched one or more times,
|
||||
@code{^} matches the beginning of a line, and @code{$} the end,
|
||||
@code{\<} matches the start of a word, and @code{\>} the end,
|
||||
and @code{\s} matches a blank.
|
||||
It also means that lookahead and lookbehind are not possible.
|
||||
A complete explanation can be found in the manual of GNU grep:
|
||||
@code{info grep regular}.
|
||||
|
||||
A separate syntax can be defined for each kind of file
|
||||
via the following commands in a nanorc file:
|
||||
|
||||
@@ -971,7 +1031,7 @@ activated by using the @option{-Y} or @option{--syntax}
|
||||
command-line option followed by the @var{name}.
|
||||
|
||||
The @code{default} syntax is special: it takes no @var{fileregex},
|
||||
and applies to files that don't match any syntax's @var{fileregex}.
|
||||
and applies to files that don't match any syntax's regexes.
|
||||
The @code{none} syntax is reserved; specifying it on the
|
||||
command line is the same as not having a syntax at all.
|
||||
|
||||
@@ -988,9 +1048,14 @@ file, to determine whether this syntax should be used for it.
|
||||
(This functionality only works when @code{libmagic} is installed
|
||||
on the system and will be silently ignored otherwise.)
|
||||
|
||||
@item formatter @var{program} [@var{arg} @dots{}]
|
||||
Run the given @var{program} 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.)
|
||||
|
||||
@item linter @var{program} [@var{arg} @dots{}]
|
||||
Use the given @var{program} to do a syntax check on the current buffer.
|
||||
(This overrides the speller function.)
|
||||
|
||||
@item comment "@var{string}"
|
||||
Use the given string for commenting and uncommenting lines.
|
||||
@@ -1003,26 +1068,33 @@ Python files. If empty double quotes are specified, the comment/uncomment
|
||||
functions are disabled; for example, @t{""} for JSON.
|
||||
The default value is @t{"#"}.
|
||||
|
||||
@item tabgives "@var{string}"
|
||||
Make the <Tab> key produce the given @var{string}. Useful for languages like
|
||||
Python that want to see only spaces for indentation.
|
||||
This overrides the setting of the @code{tabstospaces} option.
|
||||
|
||||
@item color @var{fgcolor},@var{bgcolor} "@var{regex}" @dots{}
|
||||
Display all pieces of text that match the
|
||||
extended regular expression "regex" with foreground color "fgcolor" and
|
||||
background color "bgcolor", at least one of which must be specified.
|
||||
Valid names for foreground and background color are:
|
||||
Paint all pieces of text that match the extended regular expression "regex"
|
||||
with the given foreground and background colors, at least one of which must
|
||||
be specified. Valid color names are:
|
||||
@code{white}, @code{black}, @code{blue}, @code{green},
|
||||
@code{red}, @code{cyan}, @code{yellow}, @code{magenta}, and @code{normal}
|
||||
--- where @code{normal} means the default foreground or background color.
|
||||
You may use the prefix @code{bright}
|
||||
to get a stronger color highlight for the foreground. If your
|
||||
terminal supports transparency, not specifying a "bgcolor" tells @command{nano}
|
||||
to attempt to use a transparent background.
|
||||
You may use the prefix @code{bright} for the foreground color to get a
|
||||
stronger highlight.
|
||||
If your terminal supports transparency, not specifying a "bgcolor"
|
||||
tells @command{nano} to attempt to use a transparent background.
|
||||
|
||||
All coloring commands are applied in the order in which they are specified,
|
||||
which means that later commands can recolor stuff that was colored earlier.
|
||||
|
||||
@item icolor @var{fgcolor},@var{bgcolor} "@var{regex}" @dots{}
|
||||
Same as above, except that the matching is case insensitive.
|
||||
|
||||
@item color @var{fgcolor},@var{bgcolor} start="@var{fromrx}" end="@var{torx}"
|
||||
Display all pieces of text whose start matches extended regular expression
|
||||
Paint all pieces of text whose start matches extended regular expression
|
||||
"fromrx" and whose end matches extended regular expression "torx" with
|
||||
foreground color "fgcolor" and background color "bgcolor", at least one of
|
||||
the given foreground and background colors, at least one of
|
||||
which must be specified. This means that, after an initial instance of
|
||||
"fromrx", all text until the first instance of "torx" will be colored.
|
||||
This allows syntax highlighting to span multiple lines.
|
||||
@@ -1038,28 +1110,12 @@ to @code{icolor}.
|
||||
@item extendsyntax @var{name} @var{command} [@var{arg} @dots{}]
|
||||
Extend the syntax previously defined as "@var{name}" with another @var{command}.
|
||||
This allows you to add a new @code{color}, @code{icolor}, @code{header},
|
||||
@code{magic}, @code{comment}, or @code{linter} command to an already
|
||||
@code{magic}, @code{comment}, @code{linter}, or @code{formatter} command to an already
|
||||
defined syntax --- useful when you want to slightly improve a syntax defined
|
||||
in one of the system-installed files (which normally are not writable).
|
||||
|
||||
@end table
|
||||
|
||||
Note: the @code{formatter} command has been removed. It was superseded by
|
||||
a more general mechanism: the filtering of buffer or marked text through
|
||||
an external command. Such filtering is done by typing @code{^R^X} and then
|
||||
preceding your formatter command with the pipe symbol (@code{|}). It has
|
||||
the added advantage that the operation can be undone.
|
||||
|
||||
If you use such a formatting command regularly, you could assign the relevant
|
||||
series of keystrokes to a single key in your nanorc:
|
||||
|
||||
@example
|
||||
bind M-F "^R^X|yourformatcommand^M" main
|
||||
@end example
|
||||
|
||||
(Note that the @key{^R}, @key{^X}, and @key{^M} are each a single, literal
|
||||
control character. You can enter them by preceding each with @key{M-V}.)
|
||||
|
||||
@node Rebinding Keys
|
||||
@section Rebinding Keys
|
||||
|
||||
@@ -1070,7 +1126,7 @@ nanorc file:
|
||||
|
||||
@item bind key function menu
|
||||
Rebinds @code{key} to @code{function} in the context of @code{menu}
|
||||
(or in all menus where the function exists by using @code{all}).
|
||||
(or in all menus where the function exists when @code{all} is used).
|
||||
|
||||
@item bind key "string" menu
|
||||
Makes @code{key} produce @code{string} in the context of @code{menu}
|
||||
@@ -1081,7 +1137,7 @@ with @kbd{M-V}.)
|
||||
|
||||
@item unbind key menu
|
||||
Unbinds @code{key} from @code{menu}
|
||||
(or from all menus where it exists by using @code{all}).
|
||||
(or from all menus where the key exists when @code{all} is used).
|
||||
|
||||
@end table
|
||||
|
||||
@@ -1090,22 +1146,29 @@ The format of @code{key} should be one of:
|
||||
|
||||
@itemize @w{}
|
||||
@item
|
||||
@code{^}@ followed by a Latin letter, by one of several ASCII characters
|
||||
(@@, ], \, ^, or _), or by the word "Space".
|
||||
@code{^@var{X}} ------ where @var{X} is a Latin letter, or one of several
|
||||
ASCII characters (@@, ], \, ^, _), or the word "Space".
|
||||
Example: @code{^C}.
|
||||
|
||||
@item
|
||||
@code{M-}@ followed by any ASCII character except [, or by the word "Space".
|
||||
@code{M-@var{X}} ------ where @var{X} is any ASCII character except [,
|
||||
or the word "Space".
|
||||
Example: @code{M-C}.
|
||||
|
||||
@item
|
||||
@code{F}@ followed by a numeric value from 1 to 16.
|
||||
@code{F@var{n}} ------ where @var{n} is a numeric value from 1 to 24.
|
||||
Example: @code{F10}.
|
||||
(Often, @code{F13} to @code{F24} can be typed as @code{F1} to @code{F12}
|
||||
with Shift.)
|
||||
|
||||
@item
|
||||
the word "Ins" or the word "Del".
|
||||
@code{Ins} or @code{Del}.
|
||||
@end itemize
|
||||
|
||||
Rebinding @code{^M} (Enter) or @code{^I} (Tab) is probably not a good idea.
|
||||
On some terminals it's not possible to rebind @code{^H} (unless @code{--raw}
|
||||
is used) because its keycode is identical to that of the Backspace key.
|
||||
|
||||
@sp 1
|
||||
Valid names for the @code{function} to be bound are:
|
||||
|
||||
@@ -1152,25 +1215,23 @@ Cuts and stores the current line (or the marked region).
|
||||
|
||||
@item copy
|
||||
Copies the current line (or the marked region) without deleting it.
|
||||
(The old form 'copytext' is deprecated.)
|
||||
|
||||
@item paste
|
||||
Pastes the currently stored text into the current buffer at the
|
||||
current cursor position.
|
||||
(The old form 'uncut' is deprecated.)
|
||||
|
||||
@item zap
|
||||
Throw away the current line (or the marked region).
|
||||
Throws away the current line (or the marked region).
|
||||
(This function is bound by default to <Meta+Delete>.)
|
||||
|
||||
@item cutwordleft
|
||||
Cuts from the cursor position to the beginning of the preceding word.
|
||||
(This function is not bound by default. If your terminal produces
|
||||
@code{^H} for <Ctrl+Backspace>, you can make <Ctrl+Backspace> delete
|
||||
@item chopwordleft
|
||||
Deletes from the cursor position to the beginning of the preceding word.
|
||||
(This function is bound by default to <Shift+Ctrl+Delete>. If your terminal
|
||||
produces @code{^H} for <Ctrl+Backspace>, you can make <Ctrl+Backspace> delete
|
||||
the word to the left of the cursor by rebinding ^H to this function.)
|
||||
|
||||
@item cutwordright
|
||||
Cuts from the cursor position to the beginning of the next word.
|
||||
@item chopwordright
|
||||
Deletes from the cursor position to the beginning of the next word.
|
||||
(This function is bound by default to <Ctrl+Delete>.)
|
||||
|
||||
@item cutrestoffile
|
||||
@@ -1187,8 +1248,15 @@ Shows the current cursor position: the line, column, and character positions.
|
||||
Counts the number of words, lines and characters in the current buffer.
|
||||
|
||||
@item speller
|
||||
Invokes a spell-checking program (or linting program,
|
||||
if the active syntax defines such a thing).
|
||||
Invokes a spell-checking program, either the default @command{hunspell}
|
||||
or GNU @command{spell}, or the one defined by @option{--speller} or
|
||||
@code{set speller}.
|
||||
|
||||
@item formatter
|
||||
Invokes a full-buffer-processing program (if the active syntax defines one).
|
||||
|
||||
@item linter
|
||||
Invokes a syntax-checking program (if the active syntax defines one).
|
||||
|
||||
@item justify
|
||||
Justifies the current paragraph. A paragraph is a group of contiguous lines
|
||||
@@ -1340,7 +1408,6 @@ Toggles between searching for something and replacing something.
|
||||
|
||||
@item flipgoto
|
||||
Toggles between searching for text and targeting a line number.
|
||||
(The form @code{gototext} is deprecated.)
|
||||
|
||||
@item flipexecute
|
||||
Toggles between inserting a file and executing a command.
|
||||
@@ -1395,10 +1462,6 @@ Toggles the presence of the two-line list of key bindings at the bottom of the s
|
||||
|
||||
@item constantshow
|
||||
Toggles the constant display of the current line, column, and character positions.
|
||||
(The form @code{constupdate} is deprecated.)
|
||||
|
||||
@item smoothscroll
|
||||
Toggles smooth scrolling (when moving around with the arrow keys).
|
||||
|
||||
@item softwrap
|
||||
Toggles the displaying of overlong lines on multiple screen lines.
|
||||
@@ -1423,7 +1486,6 @@ is the beginning of a paragraph.
|
||||
@item cutfromcursor
|
||||
Toggles whether cutting text will cut the whole line or just from the current cursor
|
||||
position to the end of the line.
|
||||
(The form @code{cuttoend} is deprecated.)
|
||||
|
||||
@item nowrap
|
||||
Toggles whether long lines will be hard-wrapped to the next line.
|
||||
@@ -1475,7 +1537,7 @@ The menu for inserting output from an external command, reached from the insert
|
||||
The help-viewer menu.
|
||||
|
||||
@item spell
|
||||
The interactive spell checker Yes/no menu.
|
||||
The menu of the integrated spell checker where the user can edit a misspelled word.
|
||||
|
||||
@item linter
|
||||
The linter menu.
|
||||
@@ -1519,11 +1581,34 @@ browser exits.
|
||||
@node Pico Compatibility
|
||||
@chapter Pico Compatibility
|
||||
|
||||
@command{nano} attempts to emulate Pico as closely as possible, but there
|
||||
are some differences between the editors:
|
||||
@command{nano} emulates Pico quite closely, but there
|
||||
are some differences between the two editors:
|
||||
|
||||
@table @code
|
||||
|
||||
@item Hard-Wrapping
|
||||
Unlike Pico, @command{nano} does not automatically hard-wrap the current
|
||||
line when it becomes overlong during typing. This hard-wrapping can be
|
||||
switched on with the @option{--breaklonglines} option. With that option,
|
||||
@command{nano} by default breaks lines at screen width minus eight columns,
|
||||
whereas Pico does it at screen width minus six columns. You can make
|
||||
@command{nano} do as Pico by using @option{--fill=-6}.
|
||||
|
||||
@item Scrolling
|
||||
By default, @command{nano} will scroll just one line (instead of half
|
||||
a screen) when the cursor is moved to a line that is just out of view.
|
||||
And when paging up or down, @command{nano} keeps the cursor in the same
|
||||
screen position as much as possible, instead always placing it on the
|
||||
first line of the viewport. The Pico-like behavior can be obtained
|
||||
with the @option{--jumpyscrolling} option.
|
||||
|
||||
@item Edit Area
|
||||
Pico never uses the line directly below the title bar, leaving it always
|
||||
blank. @command{nano} includes this line in the editing area, in order
|
||||
to not waste space, and because in this way it is slightly clearer where
|
||||
the text starts. If you are accustomed to this line being empty, you can
|
||||
get it back with the @option{--emptyline} option.
|
||||
|
||||
@item Interactive Replace
|
||||
Instead of allowing you to replace either just one occurrence of a search
|
||||
string or all of them, @command{nano}'s replace function is interactive: it
|
||||
@@ -1549,11 +1634,6 @@ The output of the "Display Cursor Position" command (@kbd{^C}) displays
|
||||
not only the current line and character position of the cursor,
|
||||
but also (between the two) the current column position.
|
||||
|
||||
@item Hard-Wrapping
|
||||
By default, @command{nano} hard-wraps lines at screen width minus eight
|
||||
columns, whereas Pico does it at screen width minus six columns. You can
|
||||
make @command{nano} do the same as Pico by using @option{--fill=-6}.
|
||||
|
||||
@item Spell Checking
|
||||
In the internal spell checker misspelled words are sorted alphabetically
|
||||
and trimmed for uniqueness, such that the words 'apple' and 'Apple' will
|
||||
@@ -1615,54 +1695,54 @@ The possible options to @code{./configure} are:
|
||||
@table @code
|
||||
|
||||
@item --disable-browser
|
||||
Disable the mini file browser that can be called with @kbd{^T} when reading
|
||||
or writing files.
|
||||
Exclude the mini file browser that can be called with @kbd{^T} when
|
||||
wanting to read or write a file.
|
||||
|
||||
@item --disable-color
|
||||
Disable support for the syntax coloring of files. This also eliminates
|
||||
the @option{-Y} command-line option, which chooses a specific syntax.
|
||||
Exclude support for syntax coloring. This also eliminates the @option{-Y}
|
||||
command-line option, which allows choosing a specific syntax.
|
||||
|
||||
@item --disable-comment
|
||||
Disable the single-keystroke comment/uncomment function (@kbd{M-3}).
|
||||
Exclude the single-keystroke comment/uncomment function (@kbd{M-3}).
|
||||
|
||||
@item --disable-extra
|
||||
Disable the Easter egg: a crawl of major contributors.
|
||||
Exclude the Easter egg: a crawl of major contributors.
|
||||
|
||||
@item --disable-help
|
||||
Disable the help function. Doing this makes the binary much smaller,
|
||||
but makes it difficult for new users to learn more than very basic
|
||||
Exclude the help texts (@kbd{^G}). This makes the binary much smaller,
|
||||
but also makes it difficult for new users to learn more than very basic
|
||||
things about using the editor.
|
||||
|
||||
@item --disable-histories
|
||||
Disable the code for the handling of the history files: the search and
|
||||
Exclude the code for handling the history files: the search and
|
||||
replace strings that were used, and the cursor position at which each
|
||||
file was closed. This also eliminates the @option{-H} and @option{-P}
|
||||
command-line options, which switch on the logging of search/replace
|
||||
strings and cursor positions.
|
||||
|
||||
@item --disable-justify
|
||||
Disable the justify and unjustify functions.
|
||||
Exclude the justify functions (@kbd{^J} and @kbd{M-J}).
|
||||
|
||||
@item --disable-libmagic
|
||||
Disable the use of the library of magic-number tests (for determining
|
||||
the file type and thus which syntax to use for colouring --- often the
|
||||
tests on filename extension and header line will be enough).
|
||||
Exclude the code for using the library of magic-number tests (for determining
|
||||
the file type and thus which syntax to use for coloring --- often the regexes
|
||||
for filename and header line will be enough).
|
||||
|
||||
@item --disable-linenumbers
|
||||
Disable the line-numbering function (@kbd{M-#}). This also eliminates the
|
||||
Exclude the line-numbering function (@kbd{M-N}). This also eliminates the
|
||||
@option{-l} command-line option, which turns line numbering on.
|
||||
|
||||
@item --disable-mouse
|
||||
Disable all mouse functionality. This also eliminates the @option{-m}
|
||||
Exclude all mouse functionality. This also eliminates the @option{-m}
|
||||
command-line option, which enables the mouse functionality.
|
||||
|
||||
@item --disable-multibuffer
|
||||
Disable support for opening multiple files at a time and switching
|
||||
Exclude support for opening multiple files at a time and switching
|
||||
between them on the fly. This also eliminates the @option{-F} command-line
|
||||
option, which causes a file to be read into a separate buffer by default.
|
||||
|
||||
@item --disable-nanorc
|
||||
Disable support for reading the nanorc files at startup. With such
|
||||
Exclude support for reading the nanorc files at startup. With such
|
||||
support, you can store custom settings in a system-wide and a per-user
|
||||
nanorc file rather than having to pass command-line options to get
|
||||
the desired behavior. @xref{Nanorc Files} for more info.
|
||||
@@ -1670,22 +1750,23 @@ Disabling this also eliminates the @option{-I} command-line option,
|
||||
which inhibits the reading of nanorc files.
|
||||
|
||||
@item --disable-operatingdir
|
||||
Disable setting the operating directory. This also eliminates the @option{-o}
|
||||
command-line option, which sets the operating directory.
|
||||
Exclude the code for setting the operating directory. This also eliminates
|
||||
the @option{-o} command-line option, which sets the operating directory.
|
||||
|
||||
@item --disable-speller
|
||||
Disable use of the spell checker. This also eliminates the @option{-s}
|
||||
Exclude the code for spell checking. This also eliminates the @option{-s}
|
||||
command-line option, which allows specifying an alternate spell checker.
|
||||
|
||||
@item --disable-tabcomp
|
||||
Disable tab completion (when nano asks for a filename or a search string).
|
||||
Exclude tab completion (when nano asks for a filename or a search string).
|
||||
|
||||
@item --disable-wordcomp
|
||||
Disable word completion (@kbd{^]}).
|
||||
Exclude word completion (@kbd{^]}).
|
||||
|
||||
@item --disable-wrapping
|
||||
Disable all hard-wrapping of overlong lines. This also eliminates the
|
||||
@option{-w} command-line option, which switches long-line wrapping off.
|
||||
Exclude all hard-wrapping of overlong lines. This also eliminates the
|
||||
@option{-b} and @option{-w} command-line options, which switch automatic
|
||||
long-line wrapping on and off, respectively.
|
||||
|
||||
@item --enable-tiny
|
||||
This option implies all of the above. It also disables some other
|
||||
@@ -1695,23 +1776,19 @@ counterpart of the above options together with @option{--enable-tiny},
|
||||
specific features can be switched back on --- but a few cannot.
|
||||
|
||||
@item --enable-debug
|
||||
Enable support for runtime debug output. This can get pretty messy, so
|
||||
Include some code for runtime debugging output. This can get pretty messy, so
|
||||
chances are you only want this feature when you're working on the nano source.
|
||||
|
||||
@item --disable-nls
|
||||
Disables Native Language support. This will disable the use of any
|
||||
Exclude Native Language support. This will disable the use of any
|
||||
available GNU @command{nano} translations.
|
||||
|
||||
@item --disable-wrapping-as-root
|
||||
Disable hard-wrapping of overlong lines by default when @command{nano}
|
||||
is run as root.
|
||||
|
||||
@item --enable-utf8
|
||||
Enable support for reading and writing Unicode files. This will require
|
||||
Include support for reading and writing Unicode files. This will require
|
||||
either a wide version of curses, or a UTF-8-enabled version of Slang.
|
||||
|
||||
@item --disable-utf8
|
||||
Disable support for reading and writing Unicode files. Normally the
|
||||
Exclude support for reading and writing Unicode files. Normally the
|
||||
configure script auto-detects whether to enable UTF-8 support or not.
|
||||
You can use this or the previous option to override that detection.
|
||||
|
||||
|
||||
276
doc/nanorc.5
276
doc/nanorc.5
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2003-2011, 2013-2017 Free Software Foundation, Inc.
|
||||
.\" Copyright (C) 2003-2011, 2013-2019 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -16,19 +16,27 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 3.2" "November 2018"
|
||||
.TH NANORC 5 "version 4.6" "November 2019"
|
||||
|
||||
.SH NAME
|
||||
nanorc \- GNU nano's configuration file
|
||||
|
||||
.SH NOTICE
|
||||
Starting with version 4.0, \fBnano\fR no longer hard-wraps an overlong
|
||||
line by default. It further uses smooth scrolling by default, and by
|
||||
default includes the line below the title bar into the editing area.
|
||||
.sp
|
||||
If you want the old, Pico behavior back, you can use \fBset breaklonglines\fR,
|
||||
\fBset jumpyscrolling\fR, and \fBset emptyline\fR.
|
||||
|
||||
.SH DESCRIPTION
|
||||
The \fInanorc\fP file contains the default settings for \fBnano\fP, a
|
||||
small and friendly editor. The file should be in Unix format, not in
|
||||
DOS or Mac format. During startup, \fBnano\fP will first read the
|
||||
system-wide settings, from \fB/etc/nanorc\fP (the exact path might be
|
||||
system-wide settings, from \fI/etc/nanorc\fP (the exact path might be
|
||||
different on your system), and then the user-specific settings, either
|
||||
from \fB~/.nanorc\fR or from \fI$XDG_CONFIG_HOME\fB/nano/nanorc\fR
|
||||
or from \fB~/.config/nano/nanorc\fR, whichever is encountered first.
|
||||
from \fI~/.nanorc\fR or from \fI$XDG_CONFIG_HOME/nano/nanorc\fR
|
||||
or from \fI~/.config/nano/nanorc\fR, whichever is encountered first.
|
||||
|
||||
.SH OPTIONS
|
||||
The configuration file accepts a series of \fBset\fP and \fBunset\fP
|
||||
@@ -36,20 +44,17 @@ commands, which can be used to configure nano on startup without using
|
||||
command-line options. Additionally, there are some commands to define
|
||||
syntax highlighting and to rebind keys -- see the two separate sections
|
||||
on those. \fBnano\fP reads one command per line.
|
||||
.PP
|
||||
.sp
|
||||
Options in \fInanorc\fP files take precedence over nano's defaults, and
|
||||
command-line options override \fInanorc\fP settings. Also, options that
|
||||
do not take an argument are unset by default. So using the \fBunset\fR
|
||||
command is only needed when wanting to override a setting of the system's
|
||||
\fInanorc\fR file in your own \fInanorc\fR. Options that take an
|
||||
argument cannot be unset.
|
||||
.PP
|
||||
Below, the \fIstring\fR parameters need to be enclosed in double quotes.
|
||||
Quotes inside these string parameters don't have to be escaped with
|
||||
backslashes. The last double quote in the string will be treated as its
|
||||
end. For example, for the \fBbrackets\fP option, "\fB"')>]}\fP" will
|
||||
match \fB"\fP, \fB'\fP, \fB)\fP, \fB>\fP, \fB]\fP, and \fB}\fP.
|
||||
.PP
|
||||
.sp
|
||||
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.
|
||||
.sp
|
||||
The supported commands and arguments are:
|
||||
|
||||
.TP 3
|
||||
@@ -86,12 +91,15 @@ function tags, line numbers, and selected text. This can be overridden by
|
||||
setting the options \fBtitlecolor\fP, \fBstatuscolor\fP, \fBkeycolor\fP,
|
||||
\fBfunctioncolor\fP, \fBnumbercolor\fP, and \fBselectedcolor\fP.
|
||||
.TP
|
||||
.B set brackets "\fIstring\fP"
|
||||
.BI "set brackets """ characters """
|
||||
Set the characters treated as closing brackets when justifying
|
||||
paragraphs. This may not include blank characters. Only closing
|
||||
punctuation (see \fBset punct\fP), optionally followed by the specified
|
||||
closing brackets, can end sentences. The default value is "\fB"')>]}\fP".
|
||||
.TP
|
||||
.B set breaklonglines
|
||||
Automatically hard-wrap the current line when it becomes overlong.
|
||||
.TP
|
||||
.B set casesensitive
|
||||
Do case-sensitive searches by default.
|
||||
.TP
|
||||
@@ -101,27 +109,38 @@ This overrides the option \fBquickblank\fR.
|
||||
.TP
|
||||
.B set cutfromcursor
|
||||
Use cut-from-cursor-to-end-of-line by default, instead of cutting the whole line.
|
||||
(The old form of this option, '\fBset cut\fR', is deprecated.)
|
||||
.TP
|
||||
.B set emptyline
|
||||
Do not use the line below the title bar, leaving it entirely blank.
|
||||
.TP
|
||||
.B set errorcolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Use this color combination for the status bar when an error message is displayed.
|
||||
The default value is \fBbrightwhite,red\fR.
|
||||
See \fBset titlecolor\fR for valid color names.
|
||||
.TP
|
||||
.B set fill \fInumber\fR
|
||||
Hard-wrap lines at column number \fInumber\fR. If \fInumber\fR is 0 or less,
|
||||
the maximum line length will be the screen width less \fInumber\fP columns.
|
||||
The default value is \fB\-8\fR. This option conflicts with
|
||||
\fBnowrap\fR -- the last one given takes effect.
|
||||
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
|
||||
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.
|
||||
The default value is \fB\-8\fR.
|
||||
.TP
|
||||
.B set functioncolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the function descriptions
|
||||
in the two help lines at the bottom of the screen.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set guidestripe \fInumber
|
||||
Draw a vertical stripe at the given column, to help judge the width of the
|
||||
text. (The color of the stripe can be changed with \fBset stripecolor\fR.)
|
||||
.TP
|
||||
.B set historylog
|
||||
Save the last hundred search strings and replacement strings and
|
||||
executed commands, so they can be easily reused in later sessions.
|
||||
.TP
|
||||
.B set jumpyscrolling
|
||||
Scroll the buffer contents per half-screen instead of per line.
|
||||
.TP
|
||||
.B set keycolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the shortcut key combos
|
||||
in the two help lines at the bottom of the screen.
|
||||
@@ -133,14 +152,15 @@ Display line numbers to the left of the text area.
|
||||
.B set locking
|
||||
Enable vim-style lock-files for when editing files.
|
||||
.TP
|
||||
.B set matchbrackets "\fIstring\fP"
|
||||
.BI "set matchbrackets """ characters """
|
||||
Set the opening and closing brackets that can be found by bracket
|
||||
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.
|
||||
The default value is "\fB(<[{)>]}\fP".
|
||||
.TP
|
||||
.B set morespace
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
Deprecated option since it has become the default setting.
|
||||
When needed, use \fBunset emptyline\fR instead.
|
||||
.TP
|
||||
.B set mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
@@ -159,15 +179,15 @@ Don't convert files from DOS/Mac format.
|
||||
Don't display the two help lines at the bottom of the screen.
|
||||
.TP
|
||||
.B set nonewlines
|
||||
When a file does not end with a newline, don't automatically add 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.)
|
||||
.TP
|
||||
.B set nopauses
|
||||
Don't pause between warnings at startup. This means that only
|
||||
the last one will be visible (when there are multiple ones).
|
||||
Obsolete option. Ignored.
|
||||
.TP
|
||||
.B set nowrap
|
||||
Don't hard-wrap text at all. This option conflicts with
|
||||
\fBfill\fR -- the last one given takes effect.
|
||||
Deprecated option since it has become the default setting.
|
||||
When needed, use \fBunset breaklonglines\fR instead.
|
||||
.TP
|
||||
.B set numbercolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for line numbers.
|
||||
@@ -186,7 +206,7 @@ The cursor position is remembered for the 200 most-recently edited files.
|
||||
.B set preserve
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
.TP
|
||||
.B set punct "\fIstring\fP"
|
||||
.BI "set punct """ characters """
|
||||
Set the characters treated as closing punctuation when justifying
|
||||
paragraphs. This may not include blank characters. Only the
|
||||
specfified closing punctuation, optionally followed by closing brackets
|
||||
@@ -196,27 +216,27 @@ specfified closing punctuation, optionally followed by closing brackets
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25. The option \fBconstantshow\fR overrides this.
|
||||
.TP
|
||||
.B set quiet
|
||||
Obsolete option. Recognized but ignored.
|
||||
.BI "set quotestr """ regex """
|
||||
Set the regular expression for matching the quoting part of a line.
|
||||
The default value is "\fB^([\ \\t]*([!#%:;>|}]|//))+\fP".
|
||||
(Note that \fB\\t\fR stands for an actual Tab character.)
|
||||
This makes it possible to rejustify blocks of quoted text when composing
|
||||
email, and to rewrap blocks of line comments when writing source code.
|
||||
.TP
|
||||
.B set quotestr "\fIregex\fP"
|
||||
The email-quote string, used to justify email-quoted paragraphs. This
|
||||
is an extended regular expression. The default value is
|
||||
"\fB^([\ \\t]*([#:>|}]|//))+\fP". Note that \fB\\t\fR stands for an actual
|
||||
Tab character.
|
||||
.B set rawsequences
|
||||
Interpret escape sequences directly (instead of asking \fBncurses\fR to
|
||||
translate them). If you need this option to get your keyboard to work
|
||||
properly, please report a bug. Using this option disables \fBnano\fR's
|
||||
mouse support.
|
||||
.TP
|
||||
.B set rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
.TP
|
||||
.B set rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
Interpret the Delete and Backspace keys differently so that both Backspace
|
||||
and Delete work properly. You should only use this option when on your
|
||||
system either Backspace acts like Delete or Delete acts like Backspace.
|
||||
.TP
|
||||
.B set regexp
|
||||
Do extended regular expression searches by default.
|
||||
Do regular-expression searches by default.
|
||||
Regular expressions in \fBnano\fR are of the extended type (ERE).
|
||||
.TP
|
||||
.B set selectedcolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for selected text.
|
||||
@@ -234,19 +254,24 @@ already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
.TP
|
||||
.B set smooth
|
||||
Use smooth scrolling by default.
|
||||
Deprecated option since it has become the default setting.
|
||||
When needed, use \fBunset jumpyscrolling\fR instead.
|
||||
.TP
|
||||
.B set softwrap
|
||||
Enable soft line wrapping for easier viewing of very long lines.
|
||||
.TP
|
||||
.B set speller "\fIprogram\fP"
|
||||
Use the given \fIprogram\fR to do spell checking and correcting,
|
||||
instead of the built-in corrector that calls \fBspell\fR.
|
||||
.B set speller """\fIprogram\fR [\fIarg\fR...]\fB"""
|
||||
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.
|
||||
.TP
|
||||
.B set statuscolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the status bar.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set stripecolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the vertical guiding stripe.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set suspend
|
||||
Allow \fBnano\fP to be suspended.
|
||||
.TP
|
||||
@@ -272,7 +297,6 @@ And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
|
||||
.B set trimblanks
|
||||
Remove trailing whitespace from wrapped lines when automatic
|
||||
hard-wrapping occurs or when text is justified.
|
||||
(The old form of this option, '\fBset justifytrim\fR', is deprecated.)
|
||||
.TP
|
||||
.B set unix
|
||||
Save a file by default in Unix format. This overrides nano's
|
||||
@@ -282,9 +306,9 @@ default behavior of saving a file in the format that it had.
|
||||
.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.
|
||||
unless \fB\-\-restricted\fR is given on the command line.
|
||||
.TP
|
||||
.B set whitespace "\fIstring\fP"
|
||||
.BI "set whitespace """ characters """
|
||||
Set the two characters used to indicate the presence of tabs and
|
||||
spaces. They must be single-column characters. The default pair
|
||||
for a UTF-8 locale is "\fB\[Fc]\[md]\fR", and for other locales "\fB>.\fR".
|
||||
@@ -293,7 +317,7 @@ for a UTF-8 locale is "\fB\[Fc]\[md]\fR", and for other locales "\fB>.\fR".
|
||||
Detect word boundaries differently by treating punctuation
|
||||
characters as parts of words.
|
||||
.TP
|
||||
.B set wordchars \fIstring\fP
|
||||
.BI "set wordchars """ characters """
|
||||
Specify which other characters (besides the normal alphanumeric ones)
|
||||
should be considered as parts of words. This overrides the option
|
||||
\fBwordbounds\fR.
|
||||
@@ -310,6 +334,20 @@ powerful enough to fully parse a file. Nevertheless, regular
|
||||
expressions can do a lot and are easy to make, so they are a
|
||||
good fit for a small editor like \fBnano\fR.
|
||||
.sp
|
||||
All regular expressions in \fBnano\fR are POSIX extended regular expressions.
|
||||
This means that \fB.\fR, \fB?\fR, \fB*\fR, \fB+\fR, \fB^\fR, \fB$\fR, and
|
||||
several other characters are special.
|
||||
The period \fB.\fR matches any single character,
|
||||
\fB?\fR means the preceding item is optional,
|
||||
\fB*\fR means the preceding item may be matched zero or more times,
|
||||
\fB+\fR means the preceding item must be matched one or more times,
|
||||
\fB^\fR matches the beginning of a line, and \fB$\fR the end,
|
||||
\fB\\<\fR matches the start of a word, and \fB\\>\fR the end,
|
||||
and \fB\\s\fR matches a blank.
|
||||
It also means that lookahead and lookbehind are not possible.
|
||||
A complete explanation can be found in the manual page of GNU grep:
|
||||
\fBman grep\fR.
|
||||
.sp
|
||||
For each kind of file a separate syntax can be defined
|
||||
via the following commands:
|
||||
.TP
|
||||
@@ -322,7 +360,7 @@ command is encountered.
|
||||
When \fBnano\fR is run, this syntax will be automatically
|
||||
activated if the current filename matches the extended regular
|
||||
expression \fIfileregex\fR. Or the syntax can be explicitly
|
||||
activated by using the \fB-Y\fR or \fB\-\-syntax\fR
|
||||
activated by using the \fB\-Y\fR or \fB\-\-syntax\fR
|
||||
command-line option followed by the \fIname\fR.
|
||||
|
||||
The syntax \fBdefault\fP is special: it takes no \fIfileregex\fR,
|
||||
@@ -343,9 +381,14 @@ file, to determine whether this syntax should be used for it.
|
||||
(This functionality only works when \fBlibmagic\fP is installed on the
|
||||
system and will be silently ignored otherwise.)
|
||||
.TP
|
||||
.BI formatter " program " \fR[ "arg " \fR...]
|
||||
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
|
||||
.BI linter " program " \fR[ "arg " \fR...]
|
||||
Use the given \fIprogram\fR to run a syntax check on the current buffer.
|
||||
(This overrides the speller function.)
|
||||
.TP
|
||||
.BI "comment """ string """
|
||||
Use the given \fIstring\fR for commenting and uncommenting lines.
|
||||
@@ -358,26 +401,32 @@ for Python files. If empty double quotes are specified, the comment/uncomment
|
||||
function is disabled; for example, "" for JSON.
|
||||
The default value is "\fB#\fP".
|
||||
.TP
|
||||
.BI "tabgives """ string """
|
||||
Make the <Tab> key produce the given \fIstring\fR. Useful for languages like
|
||||
Python that want to see only spaces for indentation.
|
||||
This overrides the setting of the \fBtabstospaces\fR option.
|
||||
.TP
|
||||
.BI "color " fgcolor , bgcolor " """ regex """ " \fR...
|
||||
Display all pieces of text that match
|
||||
the extended regular expression \fIregex\fP with foreground color
|
||||
\fIfgcolor\fP and background color \fIbgcolor\fP, at least one of which
|
||||
must be specified. Valid names for foreground and background colors are:
|
||||
Paint all pieces of text that match the extended regular expression
|
||||
\fIregex\fP with the given foreground and background colors, at least
|
||||
one of which must be specified. Valid color names are:
|
||||
.BR white ", " black ", " blue ", " green ", " red ", "
|
||||
.BR cyan ", " yellow ", " magenta ", and " normal
|
||||
-- where \fBnormal\fR means the default foreground or background color.
|
||||
You may use the prefix \fBbright\fR to get a stronger color highlight for the
|
||||
foreground. If your terminal supports transparency, not specifying a
|
||||
\fIbgcolor\fP tells \fBnano\fP to attempt to use a transparent
|
||||
background.
|
||||
You may use the prefix \fBbright\fR for the foreground color to get a
|
||||
stronger highlight. If your terminal supports transparency, not specifying
|
||||
a \fIbgcolor\fP tells \fBnano\fP to attempt to use a transparent background.
|
||||
.sp
|
||||
All coloring commands are applied in the order in which they are specified,
|
||||
which means that later commands can recolor stuff that was colored earlier.
|
||||
.TP
|
||||
.BI "icolor " fgcolor , bgcolor " """ regex """ " \fR...
|
||||
Same as above, except that the matching is case insensitive.
|
||||
.TP
|
||||
.BI "color " fgcolor , bgcolor " start=""" fromrx """ end=""" torx """
|
||||
Display all pieces of text whose start matches extended regular expression
|
||||
\fIfromrx\fP and whose end matches extended regular expression \fItorx\fP with
|
||||
foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
|
||||
Paint all pieces of text whose start matches extended regular expression
|
||||
\fIfromrx\fP and whose end matches extended regular expression \fItorx\fP
|
||||
with the given foreground and background colors,
|
||||
at least one of which must be specified. This means that, after an
|
||||
initial instance of \fIfromrx\fP, all text until the first instance of
|
||||
\fItorx\fP will be colored. This allows syntax highlighting to span
|
||||
@@ -394,70 +443,57 @@ to \fBicolor\fP.
|
||||
.BI extendsyntax " name command " \fR[ "arg " \fR...]
|
||||
Extend the syntax previously defined as \fIname\fR with another
|
||||
\fIcommand\fR. This allows adding a new \fBcolor\fP, \fBicolor\fP,
|
||||
\fBheader\fP, \fBmagic\fP, \fBcomment\fP, or \fBlinter\fP
|
||||
\fBheader\fP, \fBmagic\fP, \fBcomment\fP, \fBlinter\fP, or \fBformatter\fR
|
||||
command to an already defined syntax -- useful when you want to
|
||||
slightly improve a syntax defined in one of the system-installed
|
||||
files (which normally are not writable).
|
||||
|
||||
.P
|
||||
Note: the \fBformatter\fR command has been removed. It was superseded by
|
||||
a more general mechanism: the filtering of buffer or marked text through
|
||||
an external command. Such filtering is done by typing \fB^R^X\fR and then
|
||||
preceding your formatter command with the pipe symbol (\fB|\fR). It has
|
||||
the added advantage that the operation can be undone.
|
||||
.PP
|
||||
If you use such a formatting command regularly, you could assign the relevant
|
||||
series of keystrokes to a single key in your nanorc:
|
||||
.PP
|
||||
.RS
|
||||
.B "bind M\-F \(dq^R^X|yourformatcommand^M\(dq main"
|
||||
.RE
|
||||
.PP
|
||||
(Note that the \fB^R\fR, \fB^X\fR, and \fB^M\fR are each a single, literal
|
||||
control character. You can enter them by preceding each with \fBM-V\fR.)
|
||||
|
||||
.SH REBINDING KEYS
|
||||
Key bindings can be changed via the following three commands:
|
||||
.RS 3
|
||||
.TP
|
||||
.BI bind " key function menu"
|
||||
Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the
|
||||
context of menu \fImenu\fP (or in all menus where the function exists
|
||||
by using \fBall\fP).
|
||||
Rebinds the given \fIkey\fP to the given \fIfunction\fP in the given \fImenu\fP
|
||||
(or in all menus where the function exists when \fBall\fP is used).
|
||||
.TP
|
||||
.BI bind " key " """" string """" " menu"
|
||||
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).
|
||||
The \fIstring\fR can consist of text or commands or a mix of them.
|
||||
(To enter a command into the \fIstring\fR, precede its keystroke
|
||||
with \fBM-V\fR.)
|
||||
|
||||
with \fBM\-V\fR.)
|
||||
.TP
|
||||
.BI unbind " key menu"
|
||||
Unbinds the key \fIkey\fP from the menu named \fImenu\fP (or from all
|
||||
menus where it exists by using \fBall\fP).
|
||||
Unbinds the given \fIkey\fP from the given \fImenu\fP (or from all
|
||||
menus where the key exists when \fBall\fP is used).
|
||||
.RE
|
||||
|
||||
.TP
|
||||
The format of \fIkey\fP should be one of:
|
||||
.RS 3
|
||||
.TP 3
|
||||
.B ^
|
||||
followed by a Latin letter, by one of several ASCII characters
|
||||
(@, ], \\, ^, or _), or by the word "Space".
|
||||
.TP 5
|
||||
.BI ^ X
|
||||
where \fIX\fR is a Latin letter, or one of several ASCII characters
|
||||
(@, ], \\, ^, _), or the word "Space".
|
||||
Example: ^C.
|
||||
.TP
|
||||
.B M-
|
||||
followed by any ASCII character except [, or by the word "Space".
|
||||
Example: M-C.
|
||||
.BI M\- X
|
||||
where \fIX\fR is any ASCII character except [, or the word "Space".
|
||||
Example: M\-C.
|
||||
.TP
|
||||
.B F
|
||||
followed by a numeric value from 1 to 16.
|
||||
.BI F N
|
||||
where \fIN\fR is a numeric value from 1 to 24.
|
||||
Example: F10.
|
||||
(Often, \fBF13\fR to \fBF24\fR can be typed as \fBF1\fR to \fBF12\fR with Shift.)
|
||||
|
||||
.TP
|
||||
the word "Ins" or the word "Del".
|
||||
.BR Ins " or " Del .
|
||||
.RE
|
||||
|
||||
Rebinding \fB^M\fR (Enter) or \fB^I\fR (Tab) is probably not a good idea.
|
||||
On some terminals it's not possible to rebind \fB^H\fR (unless \fB\-\-raw\fR
|
||||
is used) because its keycode is identical to that of the Backspace key.
|
||||
|
||||
.TP
|
||||
Valid \fIfunction\fP names to be bound are:
|
||||
.RS 3
|
||||
@@ -503,25 +539,23 @@ Cuts and stores the current line (or the marked region).
|
||||
.TP
|
||||
.B copy
|
||||
Copies the current line (or the marked region) without deleting it.
|
||||
(The old form 'copytext' is deprecated.)
|
||||
.TP
|
||||
.B paste
|
||||
Pastes the currently stored text into the current buffer at the
|
||||
current cursor position.
|
||||
(The old form 'uncut' is deprecated.)
|
||||
.TP
|
||||
.B zap
|
||||
Throw away the current line (or the marked region).
|
||||
Throws away the current line (or the marked region).
|
||||
(This function is bound by default to <Meta+Delete>.)
|
||||
.TP
|
||||
.B cutwordleft
|
||||
Cuts from the cursor position to the beginning of the preceding word.
|
||||
(This function is not bound by default. If your terminal produces
|
||||
\fB^H\fR for <Ctrl+Backspace>, you can make <Ctrl+Backspace> delete
|
||||
.B chopwordleft
|
||||
Deletes from the cursor position to the beginning of the preceding word.
|
||||
(This function is bound by default to <Shift+Ctrl+Delete>. If your terminal
|
||||
produces \fB^H\fR for <Ctrl+Backspace>, you can make <Ctrl+Backspace> delete
|
||||
the word to the left of the cursor by rebinding ^H to this function.)
|
||||
.TP
|
||||
.B cutwordright
|
||||
Cuts from the cursor position to the beginning of the next word.
|
||||
.B chopwordright
|
||||
Deletes from the cursor position to the beginning of the next word.
|
||||
(This function is bound by default to <Ctrl+Delete>.)
|
||||
.TP
|
||||
.B cutrestoffile
|
||||
@@ -538,11 +572,14 @@ Shows the current cursor position: the line, column, and character positions.
|
||||
Counts the number of words, lines and characters in the current buffer.
|
||||
.TP
|
||||
.B speller
|
||||
Invokes a spell-checking program (or linting program,
|
||||
if the active syntax defines such a thing).
|
||||
Invokes a spell-checking program, either the default \fBhunspell\fR or GNU
|
||||
\fBspell\fR, or the one defined by \fB\-\-speller\fR or \fBset speller\fR.
|
||||
.TP
|
||||
.B formatter
|
||||
Invokes a full-buffer-processing program (if the active syntax defines one).
|
||||
.TP
|
||||
.B linter
|
||||
A synonym of \fBspeller\fR (for when the speller has not been configured).
|
||||
Invokes a syntax-checking program (if the active syntax defines one).
|
||||
.TP
|
||||
.B justify
|
||||
Justifies the current paragraph. A paragraph is a group of contiguous lines
|
||||
@@ -694,7 +731,6 @@ Toggles between searching for something and replacing something.
|
||||
.TP
|
||||
.B flipgoto
|
||||
Toggles between searching for text and targeting a line number.
|
||||
(The form 'gototext' is deprecated.)
|
||||
.TP
|
||||
.B flipexecute
|
||||
Toggles between inserting a file and executing a command.
|
||||
@@ -749,10 +785,6 @@ Toggles the presence of the two-line list of key bindings at the bottom of the s
|
||||
.TP
|
||||
.B constantshow
|
||||
Toggles the constant display of the current line, column, and character positions.
|
||||
(The form 'constupdate' is deprecated.)
|
||||
.TP
|
||||
.B smoothscroll
|
||||
Toggles smooth scrolling (when moving around with the arrow keys).
|
||||
.TP
|
||||
.B softwrap
|
||||
Toggles the displaying of overlong lines on multiple screen lines.
|
||||
@@ -777,7 +809,6 @@ is the beginning of a paragraph.
|
||||
.B cutfromcursor
|
||||
Toggles whether cutting text will cut the whole line or just from the current cursor
|
||||
position to the end of the line.
|
||||
(The form 'cuttoend' is deprecated.)
|
||||
.TP
|
||||
.B nowrap
|
||||
Toggles whether long lines will be hard-wrapped to the next line.
|
||||
@@ -827,7 +858,7 @@ The menu for inserting output from an external command, reached from the insert
|
||||
The help-viewer menu.
|
||||
.TP
|
||||
.B spell
|
||||
The interactive spell checker Yes/no menu.
|
||||
The menu of the integrated spell checker where the user can edit a misspelled word.
|
||||
.TP
|
||||
.B linter
|
||||
The linter menu.
|
||||
@@ -849,16 +880,11 @@ for \fBunbind\fR it means all menus where the specified \fIkey\fR exists.
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.B /etc/nanorc
|
||||
.I /etc/nanorc
|
||||
System-wide configuration file.
|
||||
.TP
|
||||
.BR ~/.nanorc " or " \fI$XDG_CONFIG_HOME\fB/nano/nanorc " or " ~/.config/nano/nanorc
|
||||
.IR ~/.nanorc " or " $XDG_CONFIG_HOME/nano/nanorc " or " ~/.config/nano/nanorc
|
||||
Per-user configuration file.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR nano (1)
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta and others (see the files \fIAUTHORS\fP and
|
||||
\fITHANKS\fP for details). This manual page was originally written by
|
||||
Jordi Mallach for the Debian system (but may be used by others).
|
||||
|
||||
22
doc/rnano.1
22
doc/rnano.1
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2002, 2005, 2006, 2007, 2014 Free Software Foundation, Inc.
|
||||
.\" Copyright (C) 2002-2007, 2014-2019 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 3.2" "November 2018"
|
||||
.TH RNANO 1 "version 4.6" "November 2019"
|
||||
|
||||
.SH NAME
|
||||
rnano \- a restricted nano
|
||||
@@ -29,7 +29,7 @@ rnano \- a restricted nano
|
||||
\fBrnano\fR runs the \fBnano\fR editor in restricted mode. This allows
|
||||
editing only the specified file or files, and doesn't allow the user
|
||||
access to the filesystem nor to a command shell.
|
||||
.PP
|
||||
.sp
|
||||
In restricted mode, \fBnano\fR will:
|
||||
.IP \[bu] 2
|
||||
not allow suspending;
|
||||
@@ -45,20 +45,16 @@ not make backup files nor do spell checking.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BR \-h ", " \-\-help
|
||||
Show a summary of command-line options and exit.
|
||||
.PP
|
||||
See the \fBnano\fP(1) manpage for all available options.
|
||||
Show the available command-line options and exit.
|
||||
.P
|
||||
For all existing options, see the \fBnano\fR(1) man page.
|
||||
|
||||
.SH BUGS
|
||||
Please report bugs via \fIhttps://savannah.gnu.org/bugs/?group=nano\fR.
|
||||
Please report bugs via
|
||||
.IR https://savannah.gnu.org/bugs/?group=nano .
|
||||
|
||||
.SH HOMEPAGE
|
||||
https://nano-editor.org/
|
||||
.I https://nano-editor.org/
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR nano (1)
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta and others (see the files \fIAUTHORS\fR and \fITHANKS\fR
|
||||
for details). This manual page was originally written by Thijs Kinkhorst
|
||||
for the Debian system (but may be used by others).
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
## For the options that take parameters, the default value is given.
|
||||
## Other options are unset by default.
|
||||
##
|
||||
## Quotes inside string parameters don't have to be escaped with
|
||||
## backslashes. The last double quote in the string will be treated as
|
||||
## its end. For example, for the "brackets" option, ""')>]}" will match
|
||||
## ", ', ), >, ], and }.
|
||||
## Inside string parameters, quotes should not be escaped. The last
|
||||
## double quote on the line will be seen as the closing quote.
|
||||
|
||||
## Make the 'nextword' function (Ctrl+Right) stop at word ends
|
||||
## instead of at beginnings.
|
||||
@@ -40,6 +38,9 @@
|
||||
## optionally followed by these closing brackets, can end sentences.
|
||||
# set brackets ""')>]}"
|
||||
|
||||
## Automatically hard-wrap the current line when it becomes overlong.
|
||||
# set breaklonglines
|
||||
|
||||
## Do case-sensitive searches by default.
|
||||
# set casesensitive
|
||||
|
||||
@@ -49,7 +50,9 @@
|
||||
|
||||
## Use cut-from-cursor-to-end-of-line by default.
|
||||
# set cutfromcursor
|
||||
## (The old form, 'cut', is deprecated.)
|
||||
|
||||
## Do not use the line below the title bar, leaving it entirely blank.
|
||||
# set emptyline
|
||||
|
||||
## Enable hard-wrapping and set the target width, both for automatic
|
||||
## line wrapping and for justifying paragraphs. If the value is 0 or
|
||||
@@ -59,6 +62,9 @@
|
||||
## Remember the used search/replace strings for the next session.
|
||||
# set historylog
|
||||
|
||||
## Scroll the buffer contents per half-screen instead of per line.
|
||||
# set jumpyscrolling
|
||||
|
||||
## Display line numbers to the left of the text.
|
||||
# set linenumbers
|
||||
|
||||
@@ -72,9 +78,6 @@
|
||||
## come before the latter set, and both must be in the same order.
|
||||
# set matchbrackets "(<[{)>]}"
|
||||
|
||||
## Use the blank line below the title bar as extra editing space.
|
||||
# set morespace
|
||||
|
||||
## Enable mouse support, if available for your system. When enabled,
|
||||
## mouse clicks can be used to place the cursor, set the mark (with a
|
||||
## double click), and execute shortcuts. The mouse will work in the X
|
||||
@@ -94,13 +97,6 @@
|
||||
## Don't automatically add a newline when a file does not end with one.
|
||||
# set nonewlines
|
||||
|
||||
## Don't pause between warnings at startup. Which means that only the
|
||||
## last one will be readable (when there are multiple ones).
|
||||
# set nopauses
|
||||
|
||||
## Do not automatically hard-wrap text.
|
||||
# set nowrap
|
||||
|
||||
## Set operating directory. nano will not read or write files outside
|
||||
## this directory and its subdirectories. Also, the current directory
|
||||
## is changed to here, so any files are inserted from this dir. A blank
|
||||
@@ -123,17 +119,18 @@
|
||||
## 1 keystroke instead of 26. Note that "constantshow" overrides this.
|
||||
# set quickblank
|
||||
|
||||
## The email-quote string, used to justify email-quoted paragraphs.
|
||||
## This is an extended regular expression. The default is:
|
||||
# set quotestr "^([ ]*([#:>|}]|//))+"
|
||||
## The regular expression that matches quoting characters in email
|
||||
## or line-comment introducers in source code. The default is:
|
||||
# set quotestr "^([ ]*([!#%:;>|}]|//))+"
|
||||
|
||||
## Try to work around a mismatching terminfo terminal description.
|
||||
# set rawsequences
|
||||
|
||||
## Fix Backspace/Delete confusion problem.
|
||||
# set rebinddelete
|
||||
|
||||
## Fix numeric keypad key confusion problem.
|
||||
# set rebindkeypad
|
||||
|
||||
## Do extended regular expression searches by default.
|
||||
## Do regular-expression searches by default.
|
||||
## Regular expressions are of the extended type (ERE).
|
||||
# set regexp
|
||||
|
||||
## Put the cursor on the highlighted item in the file browser, and show
|
||||
@@ -148,9 +145,6 @@
|
||||
## beginning of the line.
|
||||
# set smarthome
|
||||
|
||||
## Use line-by-line scrolling instead of chunk-by-chunk.
|
||||
# set smooth
|
||||
|
||||
## Enable soft line wrapping (AKA full-line display).
|
||||
# set softwrap
|
||||
|
||||
@@ -172,7 +166,6 @@
|
||||
|
||||
## Snip whitespace at the end of lines when justifying or hard-wrapping.
|
||||
# set trimblanks
|
||||
## (The old form, 'justifytrim', is deprecated.)
|
||||
|
||||
## Disallow file modification. Why would you want this in an rcfile? ;)
|
||||
# set view
|
||||
@@ -204,6 +197,7 @@
|
||||
# set statuscolor brightwhite,green
|
||||
# set errorcolor brightwhite,red
|
||||
# set selectedcolor brightwhite,magenta
|
||||
# set stripecolor ,yellow
|
||||
# set numbercolor cyan
|
||||
# set keycolor cyan
|
||||
# set functioncolor green
|
||||
@@ -212,6 +206,7 @@
|
||||
# set statuscolor brightwhite,magenta
|
||||
# set errorcolor brightwhite,red
|
||||
# set selectedcolor brightwhite,cyan
|
||||
# set stripecolor ,yellow
|
||||
# set numbercolor magenta
|
||||
# set keycolor brightmagenta
|
||||
# set functioncolor magenta
|
||||
@@ -219,49 +214,44 @@
|
||||
|
||||
## Setup of syntax coloring.
|
||||
##
|
||||
## Format:
|
||||
## syntax "name" ["filename regex" ...]
|
||||
##
|
||||
## syntax "short description" ["filename regex" ...]
|
||||
## color|icolor foreground,background "regex" ["regex"...]
|
||||
## [...]
|
||||
##
|
||||
## The "none" syntax is reserved; specifying it on the command line is
|
||||
## the same as not having a syntax at all. The "default" syntax is
|
||||
## special: it takes no filename regexes, and applies to files that
|
||||
## don't match any other syntax's filename regexes.
|
||||
##
|
||||
## color foreground,background "regex" ["regex"...]
|
||||
## or
|
||||
## icolor foreground,background "regex" ["regex"...]
|
||||
##
|
||||
## "color" will do case-sensitive matches, while "icolor" will do
|
||||
## 'color' will do case-sensitive matches, while 'icolor' will do
|
||||
## case-insensitive matches.
|
||||
##
|
||||
## Valid color names ares: white, black, normal, red, blue, green,
|
||||
## yellow, magenta, cyan. For foreground colors, you may use the
|
||||
## prefix "bright" to get a stronger highlight.
|
||||
## All color commands are applied in the order in which they are specified,
|
||||
## meaning that later commands can recolor stuff that was colored earlier.
|
||||
##
|
||||
## To use multi-line regexes, use the start="regex" end="regex"
|
||||
## [start="regex" end="regex"...] format.
|
||||
## Valid color names for foreground and background are: white, black, normal,
|
||||
## red, blue, green, yellow, magenta, cyan. For foreground colors, you may
|
||||
## use the prefix "bright" to get a stronger highlight.
|
||||
##
|
||||
## If your system supports transparency, not specifying a background
|
||||
## color will use a transparent color. If you don't want this, be sure
|
||||
## to set the background color to black or white.
|
||||
## All regexes (regular expressions) are of the extended type (ERE).
|
||||
##
|
||||
## All regexes should be extended regular expressions.
|
||||
## If the coloring rule should span multiple lines, use the following format:
|
||||
##
|
||||
## color fg,bg start="regex" end="regex"
|
||||
##
|
||||
## If you wish, you may put your syntax definitions in separate files.
|
||||
## You can make use of such files as follows:
|
||||
##
|
||||
## include "/path/to/syntax_file.nanorc"
|
||||
##
|
||||
## Unless otherwise noted, the name of the syntax file (without the
|
||||
## ".nanorc" extension) should be the same as the "short description"
|
||||
## name inside that file. These names are kept fairly short to make
|
||||
## them easier to remember and faster to type using nano's -Y option.
|
||||
## include "/path/to/syntax_file.nanorc"
|
||||
|
||||
## To include all existing syntax definitions, you can do:
|
||||
# include "@PKGDATADIR@/*.nanorc"
|
||||
|
||||
|
||||
## If <Tab> should always produce four spaces when editing a Python file,
|
||||
## independent of the settings of 'tabsize' and 'tabstospaces':
|
||||
# extendsyntax python tabgives " "
|
||||
|
||||
## If <Tab> should always produce an actual TAB when editing a Makefile:
|
||||
# extendsyntax makefile tabgives " "
|
||||
|
||||
|
||||
## Key bindings.
|
||||
## See nanorc(5) (section REBINDING KEYS) for more details on this.
|
||||
|
||||
@@ -272,7 +262,7 @@
|
||||
## keycode, which is hard-bound to the backspace function. So, if you
|
||||
## normally use <Backspace> for backspacing and not ^H, you can make
|
||||
## <Ctrl+Backspace> delete the word to the left of the cursor with:
|
||||
# bind ^H cutwordleft main
|
||||
# bind ^H chopwordleft main
|
||||
|
||||
## 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,
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
bg ca cs da de eo es eu fi fr ga gl hr hu id it ja 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 it ja ko ms nb nl nn pl pt pt_BR ro ru sl sr sv tr uk vi zh_CN zh_TW
|
||||
|
||||
11
po/Makevars
11
po/Makevars
@@ -11,15 +11,12 @@ top_builddir = ..
|
||||
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=P_:1,2
|
||||
|
||||
# This is the copyright holder that gets inserted into the header of the
|
||||
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
|
||||
# package. (Note that the msgstr strings, extracted from the package's
|
||||
# sources, belong to the copyright holder of the package.) Translators are
|
||||
# expected to transfer the copyright for their translations to this person
|
||||
# or entity, or to disclaim their copyright. The empty string stands for
|
||||
# the public domain; in this case the translators are expected to disclaim
|
||||
# their copyright.
|
||||
# $(DOMAIN).pot file. Translators are expected to disclaim their copyright.
|
||||
COPYRIGHT_HOLDER = Free Software Foundation, Inc.
|
||||
|
||||
# This is the list of locale categories, beyond LC_MESSAGES, for which the
|
||||
# message catalogs shall be used. It is usually empty.
|
||||
EXTRA_LOCALE_CATEGORIES =
|
||||
|
||||
# Don't do fuzzy matching when merging the PO files against the POT file.
|
||||
MSGMERGE_OPTIONS = --no-fuzzy-matching
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
src/browser.c
|
||||
src/color.c
|
||||
src/cut.c
|
||||
src/files.c
|
||||
src/global.c
|
||||
src/help.c
|
||||
@@ -13,3 +14,6 @@ src/search.c
|
||||
src/text.c
|
||||
src/utils.c
|
||||
src/winio.c
|
||||
|
||||
lib/getopt.c
|
||||
lib/regcomp.c
|
||||
|
||||
1546
po/nano.pot
1546
po/nano.pot
File diff suppressed because it is too large
Load Diff
1878
po/pt_BR.po
1878
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Let this be executed in the po/ subdir.
|
||||
cd "$(dirname "$0")" || exit
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
|
||||
echo "Updating translations via TP"
|
||||
rsync -Lrtvz translationproject.org::tp/latest/nano/ .
|
||||
# First remove existing PO files, as wget will not overwrite them.
|
||||
rm *.po
|
||||
wget --recursive --level=1 --accept=po --no-directories --no-verbose \
|
||||
https://translationproject.org/latest/nano/ || exit 2
|
||||
|
||||
# Are there now PO files that are not in git yet?
|
||||
NEWSTUFF=$(git status --porcelain *.po | grep "^??")
|
||||
@@ -18,8 +21,11 @@ fi
|
||||
echo "Regenerating POT file and remerging and recompiling PO files..."
|
||||
make update-po
|
||||
|
||||
# Ensure that the PO files are newer than the POT.
|
||||
touch *.po
|
||||
echo "Removing the dead weight of obsolete and fuzzy translations..."
|
||||
for pofile in *.po; do
|
||||
msgattrib --no-obsolete --no-fuzzy $pofile >trimmed.po || exit 4
|
||||
mv trimmed.po $pofile || exit 4
|
||||
done
|
||||
|
||||
# If needed, fix a problem in the Makefile template.
|
||||
grep -q '^datarootdir' Makefile.in.in || \
|
||||
|
||||
1767
po/zh_CN.po
1767
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
2620
po/zh_TW.po
2620
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION="3.2"
|
||||
VERSION="4.6"
|
||||
|
||||
./configure -C --enable-tiny && make &&
|
||||
./configure -C --disable-wrapping-as-root &&
|
||||
./configure -C --enable-tiny && make && ./configure -C &&
|
||||
|
||||
echo "Running autogen..." && ./autogen.sh &&
|
||||
rm -v -f m4/*.m4~ *.asc *.sig *.gz *.xz &&
|
||||
@@ -13,7 +12,8 @@ po/update_linguas.sh &&
|
||||
|
||||
make distcheck && make dist-xz &&
|
||||
|
||||
git commit -a -m "$(git log -1 --grep 'po: up' | grep o: | sed 's/^ //')" &&
|
||||
git add po/*.po po/nano.pot &&
|
||||
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.xz &&
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* browser.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015-2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -21,13 +21,13 @@
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef ENABLE_BROWSER
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef ENABLE_BROWSER
|
||||
|
||||
static char **filelist = NULL;
|
||||
/* The list of files to display in the file browser. */
|
||||
static size_t filelist_len = 0;
|
||||
@@ -77,8 +77,6 @@ char *do_browser(char *path)
|
||||
present_name = mallocstrcpy(present_name, filelist[selected]);
|
||||
}
|
||||
|
||||
assert(path != NULL && path[strlen(path) - 1] == '/');
|
||||
|
||||
if (dir != NULL) {
|
||||
/* Get the file list, and set longest and width in the process. */
|
||||
read_the_list(path, dir);
|
||||
@@ -223,11 +221,9 @@ char *do_browser(char *path)
|
||||
selected = filelist_len - 1;
|
||||
} else if (func == goto_dir_void) {
|
||||
/* Ask for the directory to go to. */
|
||||
int i = do_prompt(TRUE, FALSE, MGOTODIR, NULL, NULL,
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
browser_refresh, _("Go To Directory"));
|
||||
|
||||
if (i < 0) {
|
||||
if (do_prompt(TRUE, FALSE, MGOTODIR, "", NULL,
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
browser_refresh, _("Go To Directory")) < 0) {
|
||||
statusbar(_("Cancelled"));
|
||||
continue;
|
||||
}
|
||||
@@ -289,7 +285,7 @@ char *do_browser(char *path)
|
||||
|
||||
/* If it isn't a directory, a file was selected -- we're done. */
|
||||
if (!S_ISDIR(st.st_mode)) {
|
||||
retval = mallocstrcpy(NULL, filelist[selected]);
|
||||
retval = copy_of(filelist[selected]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -305,13 +301,12 @@ char *do_browser(char *path)
|
||||
} else if (func == (functionptrtype)implant) {
|
||||
implant(first_sc_for(MBROWSER, func)->expansion);
|
||||
#endif
|
||||
} else if (func == do_exit) {
|
||||
/* Exit from the file browser. */
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
} else if (kbinput == KEY_WINCH) {
|
||||
;
|
||||
; /* Nothing to do. */
|
||||
#endif
|
||||
} else if (func == do_exit) {
|
||||
break;
|
||||
} else
|
||||
unbound_key(kbinput);
|
||||
|
||||
@@ -319,7 +314,7 @@ char *do_browser(char *path)
|
||||
/* If the window resized, refresh the file list. */
|
||||
if (kbinput == KEY_WINCH) {
|
||||
/* Remember the selected file, to be able to reselect it. */
|
||||
present_name = mallocstrcpy(NULL, filelist[selected]);
|
||||
present_name = copy_of(filelist[selected]);
|
||||
/* Reread the contents of the current directory. */
|
||||
goto read_directory_contents;
|
||||
}
|
||||
@@ -394,13 +389,11 @@ void read_the_list(const char *path, DIR *dir)
|
||||
const struct dirent *nextdir;
|
||||
size_t i = 0, path_len = strlen(path);
|
||||
|
||||
assert(path != NULL && path[strlen(path) - 1] == '/' && dir != NULL);
|
||||
|
||||
longest = 0;
|
||||
|
||||
/* Find the length of the longest filename in the current folder. */
|
||||
while ((nextdir = readdir(dir)) != NULL) {
|
||||
size_t name_len = strlenpt(nextdir->d_name);
|
||||
size_t name_len = breadth(nextdir->d_name);
|
||||
|
||||
if (name_len > longest)
|
||||
longest = name_len;
|
||||
@@ -445,8 +438,6 @@ void read_the_list(const char *path, DIR *dir)
|
||||
* filelist, so record it. */
|
||||
filelist_len = i;
|
||||
|
||||
assert(filelist != NULL);
|
||||
|
||||
/* Sort the list of names. */
|
||||
qsort(filelist, filelist_len, sizeof(char *), diralphasort);
|
||||
|
||||
@@ -462,26 +453,10 @@ functionptrtype parse_browser_input(int *kbinput)
|
||||
{
|
||||
if (!meta_key) {
|
||||
switch (*kbinput) {
|
||||
case DEL_CODE:
|
||||
case '-':
|
||||
return do_page_up;
|
||||
case ' ':
|
||||
return do_page_down;
|
||||
case '?':
|
||||
return do_help_void;
|
||||
case 'E':
|
||||
case 'e':
|
||||
case 'Q':
|
||||
case 'q':
|
||||
case 'X':
|
||||
case 'x':
|
||||
return do_exit;
|
||||
case 'G':
|
||||
case 'g':
|
||||
return goto_dir_void;
|
||||
case 'S':
|
||||
case 's':
|
||||
return do_enter;
|
||||
case 'W':
|
||||
case 'w':
|
||||
case '/':
|
||||
@@ -490,6 +465,21 @@ functionptrtype parse_browser_input(int *kbinput)
|
||||
return do_findprevious;
|
||||
case 'n':
|
||||
return do_findnext;
|
||||
case 'G':
|
||||
case 'g':
|
||||
return goto_dir_void;
|
||||
case '?':
|
||||
return do_help_void;
|
||||
case 'S':
|
||||
case 's':
|
||||
return do_enter;
|
||||
case 'E':
|
||||
case 'e':
|
||||
case 'Q':
|
||||
case 'q':
|
||||
case 'X':
|
||||
case 'x':
|
||||
return do_exit;
|
||||
}
|
||||
}
|
||||
return func_from_key(kbinput);
|
||||
@@ -518,7 +508,7 @@ void browser_refresh(void)
|
||||
struct stat st;
|
||||
const char *thename = tail(filelist[i]);
|
||||
/* The filename we display, minus the path. */
|
||||
size_t namelen = strlenpt(thename);
|
||||
size_t namelen = breadth(thename);
|
||||
/* The length of the filename in columns. */
|
||||
size_t infolen;
|
||||
/* The length of the file information in columns. */
|
||||
@@ -529,20 +519,19 @@ void browser_refresh(void)
|
||||
/* Whether to put an ellipsis before the filename? We don't
|
||||
* waste space on dots when there are fewer than 15 columns. */
|
||||
char *disp = display_string(thename, dots ?
|
||||
namelen + infomaxlen + 4 - longest : 0, longest, FALSE);
|
||||
namelen + infomaxlen + 4 - longest : 0, longest, FALSE, FALSE);
|
||||
/* The filename (or a fragment of it) in displayable format.
|
||||
* When a fragment, account for dots plus one space padding. */
|
||||
|
||||
/* If this is the selected item, start its highlighting, and
|
||||
/* If this is the selected item, draw its highlighted bar upfront, and
|
||||
* remember its location to be able to place the cursor on it. */
|
||||
if (i == selected) {
|
||||
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||
mvwprintw(edit, row, col, "%*s", longest, " ");
|
||||
the_row = row;
|
||||
the_column = col;
|
||||
}
|
||||
|
||||
blank_row(edit, row, col, longest);
|
||||
|
||||
/* If the name is too long, we display something like "...ename". */
|
||||
if (dots)
|
||||
mvwaddstr(edit, row, col, "...");
|
||||
@@ -557,17 +546,17 @@ void browser_refresh(void)
|
||||
* "(dir)" for directories, and the file size for normal files. */
|
||||
if (lstat(filelist[i], &st) == -1 || S_ISLNK(st.st_mode)) {
|
||||
if (stat(filelist[i], &st) == -1 || !S_ISDIR(st.st_mode))
|
||||
info = mallocstrcpy(NULL, "--");
|
||||
info = copy_of("--");
|
||||
else
|
||||
/* TRANSLATORS: Try to keep this at most 7 characters. */
|
||||
info = mallocstrcpy(NULL, _("(dir)"));
|
||||
info = copy_of(_("(dir)"));
|
||||
} else if (S_ISDIR(st.st_mode)) {
|
||||
if (strcmp(thename, "..") == 0) {
|
||||
/* TRANSLATORS: Try to keep this at most 12 characters. */
|
||||
info = mallocstrcpy(NULL, _("(parent dir)"));
|
||||
info = copy_of(_("(parent dir)"));
|
||||
infomaxlen = 12;
|
||||
} else
|
||||
info = mallocstrcpy(NULL, _("(dir)"));
|
||||
info = copy_of(_("(dir)"));
|
||||
} else {
|
||||
off_t result = st.st_size;
|
||||
char modifier;
|
||||
@@ -598,7 +587,7 @@ void browser_refresh(void)
|
||||
}
|
||||
|
||||
/* Make sure info takes up no more than infomaxlen columns. */
|
||||
infolen = strlenpt(info);
|
||||
infolen = breadth(info);
|
||||
if (infolen > infomaxlen) {
|
||||
info[actual_x(info, infomaxlen)] = '\0';
|
||||
infolen = infomaxlen;
|
||||
@@ -667,19 +656,20 @@ int filesearch_init(bool forwards)
|
||||
|
||||
/* If something was searched for before, show it between square brackets. */
|
||||
if (*last_search != '\0') {
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE, FALSE);
|
||||
|
||||
thedefault = charalloc(strlen(disp) + 7);
|
||||
/* We use (COLS / 3) here because we need to see more on the line. */
|
||||
sprintf(thedefault, " [%s%s]", disp,
|
||||
(strlenpt(last_search) > COLS / 3) ? "..." : "");
|
||||
(breadth(last_search) > COLS / 3) ? "..." : "");
|
||||
free(disp);
|
||||
} else
|
||||
thedefault = mallocstrcpy(NULL, "");
|
||||
thedefault = copy_of("");
|
||||
|
||||
/* Now ask what to search for. */
|
||||
response = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL, &search_history,
|
||||
response = do_prompt(FALSE, FALSE, MWHEREISFILE, "", &search_history,
|
||||
browser_refresh, "%s%s%s", _("Search"),
|
||||
/* TRANSLATORS: A modifier of the Search prompt. */
|
||||
!forwards ? _(" [Backwards]") : "", thedefault);
|
||||
free(thedefault);
|
||||
|
||||
@@ -802,7 +792,7 @@ void to_last_file(void)
|
||||
* The returned string is dynamically allocated, and should be freed. */
|
||||
char *strip_last_component(const char *path)
|
||||
{
|
||||
char *copy = mallocstrcpy(NULL, path);
|
||||
char *copy = copy_of(path);
|
||||
char *last_slash = strrchr(copy, '/');
|
||||
|
||||
if (last_slash != NULL)
|
||||
|
||||
405
src/chars.c
405
src/chars.c
@@ -1,8 +1,8 @@
|
||||
/**************************************************************************
|
||||
* chars.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016-2017 Benno Schulenberg *
|
||||
* Copyright (C) 2001-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016-2018 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -70,7 +70,7 @@ bool is_alpha_mbchar(const char *c)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
||||
return 0;
|
||||
return FALSE;
|
||||
|
||||
return iswalpha(wc);
|
||||
} else
|
||||
@@ -86,7 +86,7 @@ bool is_alnum_mbchar(const char *c)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
||||
return 0;
|
||||
return FALSE;
|
||||
|
||||
return iswalnum(wc);
|
||||
} else
|
||||
@@ -102,7 +102,7 @@ bool is_blank_mbchar(const char *c)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
||||
return 0;
|
||||
return FALSE;
|
||||
|
||||
return iswblank(wc);
|
||||
} else
|
||||
@@ -139,7 +139,7 @@ bool is_punct_mbchar(const char *c)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
||||
return 0;
|
||||
return FALSE;
|
||||
|
||||
return iswpunct(wc);
|
||||
} else
|
||||
@@ -160,7 +160,7 @@ bool is_word_mbchar(const char *c, bool allow_punct)
|
||||
|
||||
if (word_chars != NULL && *word_chars != '\0') {
|
||||
char symbol[MAXCHARLEN + 1];
|
||||
int symlen = parse_mbchar(c, symbol, NULL);
|
||||
int symlen = collect_char(c, symbol);
|
||||
|
||||
symbol[symlen] = '\0';
|
||||
return (strstr(word_chars, symbol) != NULL);
|
||||
@@ -200,41 +200,12 @@ char control_mbrep(const char *c, bool isdata)
|
||||
return control_rep(*c);
|
||||
}
|
||||
|
||||
/* Assess how many bytes the given (multibyte) character occupies. Return -1
|
||||
* if the byte sequence is invalid, and return the number of bytes minus 8
|
||||
* when it encodes an invalid codepoint. Also, in the second parameter,
|
||||
* return the number of columns that the character occupies. */
|
||||
int length_of_char(const char *c, int *width)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
int charlen = mbtowc(&wc, c, MAXCHARLEN);
|
||||
|
||||
/* If the sequence is invalid... */
|
||||
if (charlen < 0)
|
||||
return -1;
|
||||
|
||||
/* If the codepoint is invalid... */
|
||||
if (!is_valid_unicode(wc))
|
||||
return charlen - 8;
|
||||
else {
|
||||
*width = wcwidth(wc);
|
||||
/* If the codepoint is unassigned, assume a width of one. */
|
||||
if (*width < 0)
|
||||
*width = 1;
|
||||
return charlen;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* This function is equivalent to wcwidth() for multibyte characters. */
|
||||
/* Return the width in columns of the given (multibyte) character. */
|
||||
int mbwidth(const char *c)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
/* Ask for the width only when the character isn't plain ASCII. */
|
||||
if ((signed char)*c <= 0) {
|
||||
wchar_t wc;
|
||||
int width;
|
||||
|
||||
@@ -243,96 +214,148 @@ int mbwidth(const char *c)
|
||||
|
||||
width = wcwidth(wc);
|
||||
|
||||
if (width == -1)
|
||||
if (width < 0)
|
||||
return 1;
|
||||
|
||||
return width;
|
||||
} else
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Convert the Unicode value in code to a multibyte character, if possible.
|
||||
* If the conversion succeeds, return the (dynamically allocated) multibyte
|
||||
* character and its length. Otherwise, return an undefined (dynamically
|
||||
* allocated) multibyte character and a length of zero. */
|
||||
char *make_mbchar(long code, int *length)
|
||||
{
|
||||
char *mb_char;
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
mb_char = charalloc(MAXCHARLEN);
|
||||
*length = wctomb(mb_char, (wchar_t)code);
|
||||
|
||||
/* Reject invalid Unicode characters. */
|
||||
if (*length < 0 || !is_valid_unicode((wchar_t)code)) {
|
||||
IGNORE_CALL_RESULT(wctomb(NULL, 0));
|
||||
*length = 0;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
mb_char = measured_copy((char *)&code, 1);
|
||||
*length = 1;
|
||||
}
|
||||
|
||||
return mb_char;
|
||||
}
|
||||
|
||||
/* Return the length (in bytes) of the character located at *pointer. */
|
||||
int char_length(const char *pointer)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
/* If possibly a multibyte character, get its length; otherwise, it's 1. */
|
||||
if ((signed char)*pointer < 0) {
|
||||
int length = mblen(pointer, MAXCHARLEN);
|
||||
|
||||
return (length < 0 ? 1 : length);
|
||||
} else
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Convert the Unicode value in chr to a multibyte character, if possible.
|
||||
* If the conversion succeeds, return the (dynamically allocated) multibyte
|
||||
* character and its length. Otherwise, return an undefined (dynamically
|
||||
* allocated) multibyte character and a length of zero. */
|
||||
char *make_mbchar(long chr, int *chr_mb_len)
|
||||
/* Return the number of (multibyte) characters in the given string. */
|
||||
size_t mbstrlen(const char *pointer)
|
||||
{
|
||||
char *chr_mb;
|
||||
size_t count = 0;
|
||||
|
||||
while (*pointer != '\0') {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
chr_mb = charalloc(MAXCHARLEN);
|
||||
*chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
|
||||
if ((signed char)*pointer < 0) {
|
||||
int length = mblen(pointer, MAXCHARLEN);
|
||||
|
||||
/* Reject invalid Unicode characters. */
|
||||
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
|
||||
IGNORE_CALL_RESULT(wctomb(NULL, 0));
|
||||
*chr_mb_len = 0;
|
||||
}
|
||||
} else
|
||||
pointer += (length < 0 ? 1 : length);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
*chr_mb_len = 1;
|
||||
chr_mb = mallocstrncpy(NULL, (char *)&chr, 1);
|
||||
pointer++;
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
return chr_mb;
|
||||
return count;
|
||||
}
|
||||
|
||||
/* Parse a multibyte character from buf. Return the number of bytes
|
||||
* used. If chr isn't NULL, store the multibyte character in it. If
|
||||
* col isn't NULL, add the character's width (in columns) to it. */
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
/* Return the length (in bytes) of the character at the start of the
|
||||
* given string, and return a copy of this character in *thechar. */
|
||||
int collect_char(const char *string, char *thechar)
|
||||
{
|
||||
int length;
|
||||
int charlen;
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* If this is a UTF-8 starter byte, get the number of bytes of the character. */
|
||||
if ((signed char)*buf < 0) {
|
||||
length = mblen(buf, MAXCHARLEN);
|
||||
if ((signed char)*string < 0) {
|
||||
charlen = mblen(string, MAXCHARLEN);
|
||||
|
||||
/* When the multibyte sequence is invalid, only take the first byte. */
|
||||
if (length <= 0)
|
||||
length = 1;
|
||||
if (charlen <= 0)
|
||||
charlen = 1;
|
||||
} else
|
||||
#endif
|
||||
length = 1;
|
||||
charlen = 1;
|
||||
|
||||
/* When requested, store the multibyte character in chr. */
|
||||
if (chr != NULL)
|
||||
for (int i = 0; i < length; i++)
|
||||
chr[i] = buf[i];
|
||||
for (int i = 0; i < charlen; i++)
|
||||
thechar[i] = string[i];
|
||||
|
||||
/* When requested, add the width of the character to col. */
|
||||
if (col != NULL) {
|
||||
/* If we have a tab, compute its width in columns based on the
|
||||
* current value of col. */
|
||||
if (*buf == '\t')
|
||||
*col += tabsize - *col % tabsize;
|
||||
/* If we have a control character, it's two columns wide: one
|
||||
* column for the "^", and one for the visible character. */
|
||||
else if (is_cntrl_mbchar(buf))
|
||||
*col += 2;
|
||||
/* If we have a normal character, get its width normally. */
|
||||
else if (length == 1)
|
||||
*col += 1;
|
||||
return charlen;
|
||||
}
|
||||
|
||||
/* Return the length (in bytes) of the character at the start of
|
||||
* the given string, and add this character's width to *column. */
|
||||
int advance_over(const char *string, size_t *column)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
else
|
||||
*col += mbwidth(buf);
|
||||
#endif
|
||||
}
|
||||
if ((signed char)*string < 0) {
|
||||
int charlen = mblen(string, MAXCHARLEN);
|
||||
|
||||
return length;
|
||||
if (charlen > 0) {
|
||||
if (is_cntrl_mbchar(string))
|
||||
*column += 2;
|
||||
else
|
||||
*column += mbwidth(string);
|
||||
} else {
|
||||
charlen = 1;
|
||||
*column += 1;
|
||||
}
|
||||
|
||||
return charlen;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((unsigned char)*string < 0x20) {
|
||||
if (*string == '\t')
|
||||
*column += tabsize - *column % tabsize;
|
||||
else
|
||||
*column += 2;
|
||||
} else if (*string == 0x7F)
|
||||
*column += 2;
|
||||
#ifndef ENABLE_UTF8
|
||||
else if (0x7F < (unsigned char)*string && (unsigned char)*string < 0xA0)
|
||||
*column += 2;
|
||||
#endif
|
||||
else
|
||||
*column += 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return the index in buf of the beginning of the multibyte character
|
||||
* before the one at pos. */
|
||||
size_t move_mbleft(const char *buf, size_t pos)
|
||||
size_t step_left(const char *buf, size_t pos)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
size_t before, char_len = 0;
|
||||
size_t before, charlen = 0;
|
||||
|
||||
if (pos < 4)
|
||||
before = 0;
|
||||
@@ -355,21 +378,21 @@ size_t move_mbleft(const char *buf, size_t pos)
|
||||
/* Move forward again until we reach the original character,
|
||||
* so we know the length of its preceding character. */
|
||||
while (before < pos) {
|
||||
char_len = parse_mbchar(buf + before, NULL, NULL);
|
||||
before += char_len;
|
||||
charlen = char_length(buf + before);
|
||||
before += charlen;
|
||||
}
|
||||
|
||||
return before - char_len;
|
||||
return before - charlen;
|
||||
} else
|
||||
#endif
|
||||
return (pos == 0 ? 0 : pos - 1);
|
||||
return (pos == 0 ? 0 : pos - 1);
|
||||
}
|
||||
|
||||
/* Return the index in buf of the beginning of the multibyte character
|
||||
* after the one at pos. */
|
||||
size_t move_mbright(const char *buf, size_t pos)
|
||||
size_t step_right(const char *buf, size_t pos)
|
||||
{
|
||||
return pos + parse_mbchar(buf + pos, NULL, NULL);
|
||||
return pos + char_length(buf + pos);
|
||||
}
|
||||
|
||||
/* This function is equivalent to strcasecmp() for multibyte strings. */
|
||||
@@ -402,8 +425,8 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
return difference;
|
||||
}
|
||||
|
||||
s1 += move_mbright(s1, 0);
|
||||
s2 += move_mbright(s2, 0);
|
||||
s1 += char_length(s1);
|
||||
s2 += char_length(s2);
|
||||
n--;
|
||||
}
|
||||
|
||||
@@ -424,13 +447,13 @@ char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
if (mbstrncasecmp(haystack, needle, needle_len) == 0)
|
||||
return (char *)haystack;
|
||||
|
||||
haystack += move_mbright(haystack, 0);
|
||||
haystack += char_length(haystack);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
} else
|
||||
#endif
|
||||
return (char *) strcasestr(haystack, needle);
|
||||
return (char *)strcasestr(haystack, needle);
|
||||
}
|
||||
|
||||
/* This function is equivalent to strstr(), except in that it scans the
|
||||
@@ -496,180 +519,116 @@ char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
if (pointer == haystack)
|
||||
return NULL;
|
||||
|
||||
pointer = haystack + move_mbleft(haystack, pointer - haystack);
|
||||
pointer = haystack + step_left(haystack, pointer - haystack);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
return revstrcasestr(haystack, needle, pointer);
|
||||
}
|
||||
|
||||
/* Count the number of (multibyte) characters in the given string. */
|
||||
size_t mbstrlen(const char *s)
|
||||
{
|
||||
size_t maxlen = (size_t)-1;
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
size_t n = 0;
|
||||
|
||||
while (*s != '\0' && maxlen > 0) {
|
||||
if ((signed char)*s < 0) {
|
||||
int length = mblen(s, MAXCHARLEN);
|
||||
|
||||
s += (length < 0 ? 1 : length);
|
||||
} else
|
||||
s++;
|
||||
|
||||
maxlen--;
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
} else
|
||||
#endif
|
||||
return strnlen(s, maxlen);
|
||||
}
|
||||
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
|
||||
/* This function is equivalent to strchr() for multibyte strings. */
|
||||
char *mbstrchr(const char *s, const char *c)
|
||||
char *mbstrchr(const char *string, const char *chr)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
bool bad_s_mb = FALSE, bad_c_mb = FALSE;
|
||||
char symbol[MAXCHARLEN];
|
||||
const char *q = s;
|
||||
bool bad_s = FALSE, bad_c = FALSE;
|
||||
wchar_t ws, wc;
|
||||
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
wc = (unsigned char)*c;
|
||||
bad_c_mb = TRUE;
|
||||
if (mbtowc(&wc, chr, MAXCHARLEN) < 0) {
|
||||
wc = (unsigned char)*chr;
|
||||
bad_c = TRUE;
|
||||
}
|
||||
|
||||
while (*s != '\0') {
|
||||
int sym_len = parse_mbchar(s, symbol, NULL);
|
||||
while (*string != '\0') {
|
||||
int symlen = mbtowc(&ws, string, MAXCHARLEN);
|
||||
|
||||
if (mbtowc(&ws, symbol, sym_len) < 0) {
|
||||
ws = (unsigned char)*s;
|
||||
bad_s_mb = TRUE;
|
||||
if (symlen < 0) {
|
||||
ws = (unsigned char)*string;
|
||||
bad_s = TRUE;
|
||||
}
|
||||
|
||||
if (bad_s_mb == bad_c_mb && ws == wc)
|
||||
if (ws == wc && bad_s == bad_c)
|
||||
break;
|
||||
|
||||
s += sym_len;
|
||||
q += sym_len;
|
||||
string += symlen;
|
||||
}
|
||||
|
||||
if (*s == '\0')
|
||||
q = NULL;
|
||||
if (*string == '\0')
|
||||
return NULL;
|
||||
|
||||
return (char *)q;
|
||||
return (char *)string;
|
||||
} else
|
||||
#endif
|
||||
return (char *) strchr(s, *c);
|
||||
return strchr(string, *chr);
|
||||
}
|
||||
#endif /* !NANO_TINY || ENABLE_JUSTIFY */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* This function is equivalent to strpbrk() for multibyte strings. */
|
||||
char *mbstrpbrk(const char *s, const char *accept)
|
||||
/* Locate, in the given string, the first occurrence of any of
|
||||
* the characters in accept, searching forward. */
|
||||
char *mbstrpbrk(const char *string, const char *accept)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
for (; *s != '\0'; s += move_mbright(s, 0)) {
|
||||
if (mbstrchr(accept, s) != NULL)
|
||||
return (char *)s;
|
||||
}
|
||||
while (*string != '\0') {
|
||||
if (mbstrchr(accept, string) != NULL)
|
||||
return (char *)string;
|
||||
|
||||
return NULL;
|
||||
} else
|
||||
#endif
|
||||
return (char *) strpbrk(s, accept);
|
||||
}
|
||||
|
||||
/* Locate, in the string that starts at head, the first occurrence of any of
|
||||
* the characters in the string accept, starting from pointer and searching
|
||||
* backwards. */
|
||||
char *revstrpbrk(const char *head, const char *accept, const char *pointer)
|
||||
{
|
||||
if (*pointer == '\0') {
|
||||
if (pointer == head)
|
||||
return NULL;
|
||||
pointer--;
|
||||
}
|
||||
|
||||
while (pointer >= head) {
|
||||
if (strchr(accept, *pointer) != NULL)
|
||||
return (char *)pointer;
|
||||
pointer--;
|
||||
string += char_length(string);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The same as the preceding function but then for multibyte strings. */
|
||||
/* Locate, in the string that starts at head, the first occurrence of any of
|
||||
* the characters in accept, starting from pointer and searching backwards. */
|
||||
char *mbrevstrpbrk(const char *head, const char *accept, const char *pointer)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
if (*pointer == '\0') {
|
||||
if (pointer == head)
|
||||
return NULL;
|
||||
pointer = head + move_mbleft(head, pointer - head);
|
||||
}
|
||||
if (*pointer == '\0') {
|
||||
if (pointer == head)
|
||||
return NULL;
|
||||
pointer = head + step_left(head, pointer - head);
|
||||
}
|
||||
|
||||
while (TRUE) {
|
||||
if (mbstrchr(accept, pointer) != NULL)
|
||||
return (char *)pointer;
|
||||
while (TRUE) {
|
||||
if (mbstrchr(accept, pointer) != NULL)
|
||||
return (char *)pointer;
|
||||
|
||||
/* If we've reached the head of the string, we found nothing. */
|
||||
if (pointer == head)
|
||||
return NULL;
|
||||
/* If we've reached the head of the string, we found nothing. */
|
||||
if (pointer == head)
|
||||
return NULL;
|
||||
|
||||
pointer = head + move_mbleft(head, pointer - head);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
return revstrpbrk(head, accept, pointer);
|
||||
pointer = head + step_left(head, pointer - head);
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || defined(ENABLE_JUSTIFY))
|
||||
/* Return TRUE if the string s contains one or more blank characters,
|
||||
/* Return TRUE if the given string contains at least one blank character,
|
||||
* and FALSE otherwise. */
|
||||
bool has_blank_chars(const char *s)
|
||||
bool has_blank_char(const char *string)
|
||||
{
|
||||
for (; *s != '\0'; s++) {
|
||||
if (isblank((unsigned char)*s))
|
||||
char symbol[MAXCHARLEN];
|
||||
|
||||
while (*string != '\0') {
|
||||
string += collect_char(string, symbol);
|
||||
|
||||
if (is_blank_mbchar(symbol))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Return TRUE if the multibyte string s contains one or more blank
|
||||
* multibyte characters, and FALSE otherwise. */
|
||||
bool has_blank_mbchars(const char *s)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
char symbol[MAXCHARLEN];
|
||||
|
||||
for (; *s != '\0'; s += move_mbright(s, 0)) {
|
||||
parse_mbchar(s, symbol, NULL);
|
||||
|
||||
if (is_blank_mbchar(symbol))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
} else
|
||||
#endif
|
||||
return has_blank_chars(s);
|
||||
}
|
||||
#endif /* ENABLE_NANORC && (!NANO_TINY || ENABLE_JUSTIFY) */
|
||||
|
||||
/* Return TRUE when the given string is empty or consists of only blanks. */
|
||||
bool white_string(const char *string)
|
||||
{
|
||||
while (*string != '\0' && (is_blank_mbchar(string) || *string == '\r'))
|
||||
string += char_length(string);
|
||||
|
||||
return !*string;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
|
||||
bool is_valid_unicode(wchar_t wc)
|
||||
|
||||
149
src/color.c
149
src/color.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* color.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -21,14 +21,13 @@
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_MAGIC_H
|
||||
#include <magic.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
/* 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. */
|
||||
@@ -39,11 +38,34 @@
|
||||
#define A_BANDAID A_NORMAL
|
||||
#endif
|
||||
|
||||
/* Assign pair numbers for the colors in the given syntax, giving identical
|
||||
* color pairs the same number. */
|
||||
void set_syntax_colorpairs(syntaxtype *sint)
|
||||
{
|
||||
int new_number = NUMBER_OF_ELEMENTS + 1;
|
||||
colortype *ink;
|
||||
|
||||
for (ink = sint->color; ink != NULL; ink = ink->next) {
|
||||
const colortype *beforenow = sint->color;
|
||||
|
||||
while (beforenow != ink && (beforenow->fg != ink->fg ||
|
||||
beforenow->bg != ink->bg))
|
||||
beforenow = beforenow->next;
|
||||
|
||||
if (beforenow != ink)
|
||||
ink->pairnum = beforenow->pairnum;
|
||||
else
|
||||
ink->pairnum = new_number++;
|
||||
|
||||
ink->attributes |= COLOR_PAIR(ink->pairnum) | A_BANDAID;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the colors for nano's interface, and assign pair numbers
|
||||
* for the colors in each syntax. */
|
||||
* for the colors in each loaded syntax. */
|
||||
void set_colorpairs(void)
|
||||
{
|
||||
const syntaxtype *sint;
|
||||
syntaxtype *sint;
|
||||
bool using_defaults = FALSE;
|
||||
size_t i;
|
||||
|
||||
@@ -70,6 +92,8 @@ void set_colorpairs(void)
|
||||
} else {
|
||||
if (i == FUNCTION_TAG)
|
||||
interface_color_pair[i] = A_NORMAL;
|
||||
else if (i == GUIDE_STRIPE)
|
||||
interface_color_pair[i] = A_REVERSE;
|
||||
else if (i == ERROR_MESSAGE) {
|
||||
init_pair(i + 1, COLOR_WHITE, COLOR_RED);
|
||||
interface_color_pair[i] = COLOR_PAIR(i + 1) | A_BOLD | A_BANDAID;
|
||||
@@ -80,27 +104,10 @@ void set_colorpairs(void)
|
||||
free(color_combo[i]);
|
||||
}
|
||||
|
||||
/* For each syntax, go through its list of colors and assign each
|
||||
* its pair number, giving identical color pairs the same number. */
|
||||
for (sint = syntaxes; sint != NULL; sint = sint->next) {
|
||||
colortype *ink;
|
||||
int new_number = NUMBER_OF_ELEMENTS + 1;
|
||||
|
||||
for (ink = sint->color; ink != NULL; ink = ink->next) {
|
||||
const colortype *beforenow = sint->color;
|
||||
|
||||
while (beforenow != ink && (beforenow->fg != ink->fg ||
|
||||
beforenow->bg != ink->bg))
|
||||
beforenow = beforenow->next;
|
||||
|
||||
if (beforenow != ink)
|
||||
ink->pairnum = beforenow->pairnum;
|
||||
else
|
||||
ink->pairnum = new_number++;
|
||||
|
||||
ink->attributes |= COLOR_PAIR(ink->pairnum) | A_BANDAID;
|
||||
}
|
||||
}
|
||||
/* For each loaded syntax, assign pair numbers to color combinations. */
|
||||
for (sint = syntaxes; sint != NULL; sint = sint->next)
|
||||
if (sint->filename == NULL)
|
||||
set_syntax_colorpairs(sint);
|
||||
}
|
||||
|
||||
/* Initialize the color information. */
|
||||
@@ -144,7 +151,7 @@ bool found_in_list(regexlisttype *head, const char *shibboleth)
|
||||
regex_t rgx;
|
||||
|
||||
for (item = head; item != NULL; item = item->next) {
|
||||
regcomp(&rgx, fixbounds(item->full_regex), NANO_REG_EXTENDED);
|
||||
regcomp(&rgx, item->full_regex, NANO_REG_EXTENDED);
|
||||
|
||||
if (regexec(&rgx, shibboleth, 0, NULL, 0) == 0) {
|
||||
regfree(&rgx);
|
||||
@@ -161,7 +168,6 @@ bool found_in_list(regexlisttype *head, const char *shibboleth)
|
||||
void color_update(void)
|
||||
{
|
||||
syntaxtype *sint = NULL;
|
||||
colortype *ink;
|
||||
|
||||
/* If the rcfiles were not read, or contained no syntaxes, get out. */
|
||||
if (syntaxes == NULL)
|
||||
@@ -185,20 +191,7 @@ void color_update(void)
|
||||
/* If no syntax-override string was specified, or it didn't match,
|
||||
* try finding a syntax based on the filename (extension). */
|
||||
if (sint == NULL && !inhelp) {
|
||||
char *reserved = charalloc(PATH_MAX + 1);
|
||||
char *currentdir = getcwd(reserved, PATH_MAX + 1);
|
||||
char *joinednames = charalloc(PATH_MAX + 1);
|
||||
char *fullname = NULL;
|
||||
|
||||
if (currentdir == NULL)
|
||||
free(reserved);
|
||||
else {
|
||||
/* Concatenate the current working directory with the
|
||||
* specified filename, and canonicalize the result. */
|
||||
sprintf(joinednames, "%s/%s", currentdir, openfile->filename);
|
||||
fullname = get_full_path(joinednames);
|
||||
free(currentdir);
|
||||
}
|
||||
char *fullname = get_full_path(openfile->filename);
|
||||
|
||||
if (fullname == NULL)
|
||||
fullname = mallocstrcpy(fullname, openfile->filename);
|
||||
@@ -208,14 +201,13 @@ void color_update(void)
|
||||
break;
|
||||
}
|
||||
|
||||
free(joinednames);
|
||||
free(fullname);
|
||||
}
|
||||
|
||||
/* If the filename didn't match anything, try the first line. */
|
||||
if (sint == NULL && !inhelp) {
|
||||
for (sint = syntaxes; sint != NULL; sint = sint->next) {
|
||||
if (found_in_list(sint->headers, openfile->fileage->data))
|
||||
if (found_in_list(sint->headers, openfile->filetop->data))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -265,27 +257,28 @@ void color_update(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* When the syntax isn't loaded yet, parse it and initialize its colors. */
|
||||
if (sint != NULL && sint->filename != NULL) {
|
||||
parse_one_include(sint->filename, sint);
|
||||
set_syntax_colorpairs(sint);
|
||||
}
|
||||
|
||||
openfile->syntax = sint;
|
||||
openfile->colorstrings = (sint == NULL ? NULL : sint->color);
|
||||
}
|
||||
|
||||
/* If a syntax was found, compile its specified regexes (which have
|
||||
* already been checked for validity when they were read in). */
|
||||
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
|
||||
if (ink->start == NULL) {
|
||||
ink->start = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(ink->start, fixbounds(ink->start_regex), ink->rex_flags);
|
||||
}
|
||||
/* 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));
|
||||
|
||||
if (ink->end_regex != NULL && ink->end == NULL) {
|
||||
ink->end = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(ink->end, fixbounds(ink->end_regex), ink->rex_flags);
|
||||
}
|
||||
}
|
||||
for (int index = 0; index < openfile->syntax->nmultis; index++)
|
||||
line->multidata[index] = -1;
|
||||
}
|
||||
|
||||
/* Determine whether the matches of multiline regexes are still the same,
|
||||
* and if not, schedule a screen refresh, so things will be repainted. */
|
||||
void check_the_multis(filestruct *line)
|
||||
void check_the_multis(linestruct *line)
|
||||
{
|
||||
const colortype *ink;
|
||||
bool astart, anend;
|
||||
@@ -296,13 +289,14 @@ void check_the_multis(filestruct *line)
|
||||
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0)
|
||||
return;
|
||||
|
||||
if (line->multidata == NULL)
|
||||
set_up_multicache(line);
|
||||
|
||||
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
|
||||
/* If it's not a multiline regex, skip. */
|
||||
if (ink->end == NULL)
|
||||
continue;
|
||||
|
||||
alloc_multidata_if_needed(line);
|
||||
|
||||
astart = (regexec(ink->start, line->data, 1, &startmatch, 0) == 0);
|
||||
afterstart = line->data + (astart ? startmatch.rm_eo : 0);
|
||||
anend = (regexec(ink->end, afterstart, 1, &endmatch, 0) == 0);
|
||||
@@ -329,43 +323,29 @@ void check_the_multis(filestruct *line)
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate (for one line) the cache space for multiline color regexes. */
|
||||
void alloc_multidata_if_needed(filestruct *fileptr)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (fileptr->multidata == NULL) {
|
||||
fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
|
||||
|
||||
for (i = 0; i < openfile->syntax->nmultis; i++)
|
||||
fileptr->multidata[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Precalculate the multi-line start and end regex info so we can
|
||||
* speed up rendering (with any hope at all...). */
|
||||
void precalc_multicolorinfo(void)
|
||||
{
|
||||
const colortype *ink;
|
||||
regmatch_t startmatch, endmatch;
|
||||
filestruct *line, *tailline;
|
||||
linestruct *line, *tailline;
|
||||
|
||||
if (openfile->colorstrings == NULL || ISSET(NO_COLOR_SYNTAX))
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Precalculating the multiline color info...\n");
|
||||
#endif
|
||||
/* For each line, allocate cache space for the multiline-regex info. */
|
||||
for (line = openfile->filetop; line != NULL; line = line->next)
|
||||
set_up_multicache(line);
|
||||
|
||||
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
|
||||
/* If this is not a multi-line regex, skip it. */
|
||||
if (ink->end == NULL)
|
||||
continue;
|
||||
|
||||
for (line = openfile->fileage; line != NULL; line = line->next) {
|
||||
for (line = openfile->filetop; line != NULL; line = line->next) {
|
||||
int index = 0;
|
||||
|
||||
alloc_multidata_if_needed(line);
|
||||
/* Assume nothing applies until proven otherwise below. */
|
||||
line->multidata[ink->id] = CNONE;
|
||||
|
||||
@@ -378,14 +358,14 @@ void precalc_multicolorinfo(void)
|
||||
/* 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) {
|
||||
&startmatch, (index == 0) ? 0 : REG_NOTBOL) == 0) {
|
||||
/* Begin looking for an end match after the start match. */
|
||||
index += startmatch.rm_eo;
|
||||
|
||||
/* If there is an end match on this line, mark the line, but
|
||||
* continue looking for other starts after it. */
|
||||
if (regexec(ink->end, line->data + index, 1,
|
||||
&endmatch, (index == 0) ? 0 : REG_NOTBOL) == 0) {
|
||||
&endmatch, (index == 0) ? 0 : REG_NOTBOL) == 0) {
|
||||
line->multidata[ink->id] = CSTARTENDHERE;
|
||||
index += endmatch.rm_eo;
|
||||
/* If both start and end are mere anchors, step ahead. */
|
||||
@@ -394,7 +374,7 @@ void precalc_multicolorinfo(void)
|
||||
/* When at end-of-line, we're done. */
|
||||
if (line->data[index] == '\0')
|
||||
break;
|
||||
index = move_mbright(line->data, index);
|
||||
index = step_right(line->data, index);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -417,12 +397,9 @@ void precalc_multicolorinfo(void)
|
||||
* the lines in between and the end properly. */
|
||||
line->multidata[ink->id] = CENDAFTER;
|
||||
|
||||
for (line = line->next; line != tailline; line = line->next) {
|
||||
alloc_multidata_if_needed(line);
|
||||
for (line = line->next; line != tailline; line = line->next)
|
||||
line->multidata[ink->id] = CWHOLELINE;
|
||||
}
|
||||
|
||||
alloc_multidata_if_needed(tailline);
|
||||
tailline->multidata[ink->id] = CBEGINBEFORE;
|
||||
|
||||
/* Begin looking for a new start after the end match. */
|
||||
|
||||
442
src/cut.c
442
src/cut.c
@@ -1,9 +1,9 @@
|
||||
/**************************************************************************
|
||||
* cut.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014 Mark Majeres *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* Copyright (C) 2016, 2018, 2019 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -24,146 +24,314 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static bool keep_cutbuffer = FALSE;
|
||||
/* Should we keep the contents of the cutbuffer? */
|
||||
|
||||
/* Indicate that we should no longer keep the contents of the cutbuffer. */
|
||||
void cutbuffer_reset(void)
|
||||
/* Delete the character under the cursor. */
|
||||
void do_deletion(undo_type action)
|
||||
{
|
||||
keep_cutbuffer = FALSE;
|
||||
#ifndef NANO_TINY
|
||||
size_t old_amount = 0;
|
||||
#endif
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
/* When in the middle of a line, delete the current character. */
|
||||
if (openfile->current->data[openfile->current_x] != '\0') {
|
||||
int charlen = char_length(openfile->current->data + openfile->current_x);
|
||||
size_t line_len = strlen(openfile->current->data + openfile->current_x);
|
||||
#ifndef NANO_TINY
|
||||
/* If the type of action changed or the cursor moved to a different
|
||||
* line, create a new undo item, otherwise update the existing item. */
|
||||
if (action != openfile->last_action ||
|
||||
openfile->current->lineno != openfile->current_undo->lineno)
|
||||
add_undo(action, NULL);
|
||||
else
|
||||
update_undo(action);
|
||||
|
||||
if (ISSET(SOFTWRAP))
|
||||
old_amount = number_of_chunks_in(openfile->current);
|
||||
#endif
|
||||
/* Move the remainder of the line "in", over the current character. */
|
||||
memmove(&openfile->current->data[openfile->current_x],
|
||||
&openfile->current->data[openfile->current_x + charlen],
|
||||
line_len - charlen + 1);
|
||||
#ifndef NANO_TINY
|
||||
/* Adjust the mark if it is after the cursor on the current line. */
|
||||
if (openfile->mark == openfile->current &&
|
||||
openfile->mark_x > openfile->current_x)
|
||||
openfile->mark_x -= charlen;
|
||||
#endif
|
||||
/* Otherwise, when not at end of buffer, join this line with the next. */
|
||||
} else if (openfile->current != openfile->filebot) {
|
||||
linestruct *joining = openfile->current->next;
|
||||
|
||||
/* If there is a magic line, and we're before it: don't eat it. */
|
||||
if (joining == openfile->filebot && openfile->current_x != 0 &&
|
||||
!ISSET(NO_NEWLINES)) {
|
||||
#ifndef NANO_TINY
|
||||
if (action == BACK)
|
||||
add_undo(BACK, NULL);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(action, NULL);
|
||||
#endif
|
||||
/* Add the contents of the next line to those of the current one. */
|
||||
openfile->current->data = charealloc(openfile->current->data,
|
||||
strlen(openfile->current->data) + strlen(joining->data) + 1);
|
||||
strcat(openfile->current->data, joining->data);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Adjust the mark if it was on the line that was "eaten". */
|
||||
if (openfile->mark == joining) {
|
||||
openfile->mark = openfile->current;
|
||||
openfile->mark_x += openfile->current_x;
|
||||
}
|
||||
#endif
|
||||
unlink_node(joining);
|
||||
renumber_from(openfile->current);
|
||||
|
||||
/* Two lines were joined, so we need to refresh the screen. */
|
||||
refresh_needed = TRUE;
|
||||
} else
|
||||
/* We're at the end-of-file: nothing to do. */
|
||||
return;
|
||||
|
||||
/* Adjust the file size, and remember it for a possible redo. */
|
||||
openfile->totsize--;
|
||||
#ifndef NANO_TINY
|
||||
openfile->current_undo->newsize = openfile->totsize;
|
||||
|
||||
/* If the number of screen rows that a softwrapped line occupies
|
||||
* has changed, we need a full refresh. */
|
||||
if (ISSET(SOFTWRAP) && refresh_needed == FALSE &&
|
||||
number_of_chunks_in(openfile->current) != old_amount)
|
||||
refresh_needed = TRUE;
|
||||
#endif
|
||||
|
||||
set_modified();
|
||||
}
|
||||
|
||||
/* If we aren't on the last line of the file, move all the text of the
|
||||
* current line, plus the newline at the end, into the cutbuffer. If we
|
||||
* are, move all of the text of the current line into the cutbuffer. In
|
||||
* both cases, set the current place we want to the beginning of the
|
||||
* current line. */
|
||||
/* Delete the character under the cursor. */
|
||||
void do_delete(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark && ISSET(LET_THEM_ZAP))
|
||||
zap_text();
|
||||
else
|
||||
#endif
|
||||
do_deletion(DEL);
|
||||
}
|
||||
|
||||
/* Backspace over one character. That is, move the cursor left one
|
||||
* character, and then delete the character under the cursor. */
|
||||
void do_backspace(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark && ISSET(LET_THEM_ZAP))
|
||||
zap_text();
|
||||
else
|
||||
#endif
|
||||
if (openfile->current != openfile->filetop || openfile->current_x > 0) {
|
||||
do_left();
|
||||
do_deletion(BACK);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Delete text from the cursor until the first start of a word to
|
||||
* the left, or to the right when forward is TRUE. */
|
||||
void chop_word(bool forward)
|
||||
{
|
||||
/* Remember the current cursor position. */
|
||||
linestruct *is_current = openfile->current;
|
||||
size_t is_current_x = openfile->current_x;
|
||||
/* Remember where the cutbuffer is, then make it seem blank. */
|
||||
linestruct *is_cutbuffer = cutbuffer;
|
||||
|
||||
cutbuffer = NULL;
|
||||
|
||||
/* Move the cursor to a word start, to the left or to the right.
|
||||
* If that word is on another line and the cursor was not already
|
||||
* on the edge of the original line, then put the cursor on that
|
||||
* edge instead, so that lines will not be joined unexpectedly. */
|
||||
if (!forward) {
|
||||
do_prev_word(ISSET(WORD_BOUNDS));
|
||||
if (openfile->current != is_current) {
|
||||
if (is_current_x > 0) {
|
||||
openfile->current = is_current;
|
||||
openfile->current_x = 0;
|
||||
} else
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
}
|
||||
} else {
|
||||
do_next_word(FALSE, ISSET(WORD_BOUNDS));
|
||||
if (openfile->current != is_current &&
|
||||
is_current->data[is_current_x] != '\0') {
|
||||
openfile->current = is_current;
|
||||
openfile->current_x = strlen(is_current->data);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the mark at the start of that word. */
|
||||
openfile->mark = openfile->current;
|
||||
openfile->mark_x = openfile->current_x;
|
||||
|
||||
/* Put the cursor back where it was, so an undo will put it there too. */
|
||||
openfile->current = is_current;
|
||||
openfile->current_x = is_current_x;
|
||||
|
||||
/* Now kill the marked region and a word is gone. */
|
||||
add_undo(CUT, NULL);
|
||||
do_snip(FALSE, TRUE, FALSE, FALSE);
|
||||
update_undo(CUT);
|
||||
|
||||
/* Discard the cut word and restore the cutbuffer. */
|
||||
free_lines(cutbuffer);
|
||||
cutbuffer = is_cutbuffer;
|
||||
}
|
||||
|
||||
/* Delete a word leftward. */
|
||||
void chop_previous_word(void)
|
||||
{
|
||||
if (openfile->current->prev == NULL && openfile->current_x == 0)
|
||||
statusbar(_("Nothing was cut"));
|
||||
else
|
||||
chop_word(BACKWARD);
|
||||
}
|
||||
|
||||
/* Delete a word rightward. */
|
||||
void chop_next_word(void)
|
||||
{
|
||||
openfile->mark = NULL;
|
||||
|
||||
if (is_cuttable(openfile->current_x > 0))
|
||||
chop_word(FORWARD);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Move the whole current line from the current buffer to the cutbuffer. */
|
||||
void cut_line(void)
|
||||
{
|
||||
/* When not on the last line of the buffer, move the text from the
|
||||
* head of this line to the head of the next line into the cutbuffer;
|
||||
* otherwise, move all of the text of this line into the cutbuffer. */
|
||||
if (openfile->current != openfile->filebot)
|
||||
extract_buffer(&cutbuffer, &cutbottom, openfile->current, 0,
|
||||
openfile->current->next, 0);
|
||||
extract(openfile->current, 0, openfile->current->next, 0);
|
||||
else
|
||||
extract_buffer(&cutbuffer, &cutbottom, openfile->current, 0,
|
||||
extract(openfile->current, 0,
|
||||
openfile->current, strlen(openfile->current->data));
|
||||
|
||||
openfile->placewewant = 0;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Move all currently marked text into the cutbuffer, and set the
|
||||
* current place we want to where the text used to start. */
|
||||
void cut_marked(bool *right_side_up)
|
||||
{
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, right_side_up);
|
||||
|
||||
extract_buffer(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
|
||||
/* If we aren't at the end of the current line, move all the text from
|
||||
* the current cursor position to the end of the current line, not
|
||||
* counting the newline at the end, into the cutbuffer. If we are, and
|
||||
* we're not on the last line of the file, move the newline at the end
|
||||
* into the cutbuffer, and set the current place we want to where the
|
||||
* newline used to be. */
|
||||
/* Move all text from the cursor position until the end of this line into
|
||||
* the cutbuffer. But when already at the end of a line, then move this
|
||||
* "newline" to the cutbuffer. */
|
||||
void cut_to_eol(void)
|
||||
{
|
||||
size_t data_len = strlen(openfile->current->data);
|
||||
|
||||
/* 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,
|
||||
* move the line separation into the cutbuffer. */
|
||||
if (openfile->current_x < data_len)
|
||||
/* If we're not at the end of the line, move all the text from
|
||||
* the current position up to it, not counting the newline at
|
||||
* the end, into the cutbuffer. */
|
||||
extract_buffer(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->current, data_len);
|
||||
extract(openfile->current, openfile->current_x,
|
||||
openfile->current, data_len);
|
||||
else if (openfile->current != openfile->filebot) {
|
||||
/* If we're at the end of the line, and it isn't the last line
|
||||
* of the file, move all the text from the current position up
|
||||
* to the beginning of the next line, i.e. the newline at the
|
||||
* end, into the cutbuffer. */
|
||||
extract_buffer(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->current->next, 0);
|
||||
extract(openfile->current, openfile->current_x,
|
||||
openfile->current->next, 0);
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
|
||||
/* Move all the text from the current cursor position to the end of the
|
||||
* file into the cutbuffer. */
|
||||
/* Move all marked text from the current buffer into the cutbuffer. */
|
||||
void cut_marked(bool *right_side_up)
|
||||
{
|
||||
linestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
get_region((const linestruct **)&top, &top_x,
|
||||
(const linestruct **)&bot, &bot_x, right_side_up);
|
||||
|
||||
extract(top, top_x, bot, bot_x);
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
|
||||
/* Move all text from the cursor position to end-of-file into the cutbuffer. */
|
||||
void cut_to_eof(void)
|
||||
{
|
||||
extract_buffer(&cutbuffer, &cutbottom,
|
||||
openfile->current, openfile->current_x,
|
||||
extract(openfile->current, openfile->current_x,
|
||||
openfile->filebot, strlen(openfile->filebot->data));
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Move text from the current buffer into the cutbuffer. If
|
||||
* copy_text is TRUE, copy the text back into the buffer afterward.
|
||||
* If cut_till_eof is TRUE, move all text from the current cursor
|
||||
* copying is TRUE, copy the text back into the buffer afterward.
|
||||
* If until_eof is TRUE, move all text from the current cursor
|
||||
* position to the end of the file into the cutbuffer. If append
|
||||
* is TRUE (when zapping), always append the cut to the cutbuffer. */
|
||||
void do_cut_text(bool copy_text, bool marked, bool cut_till_eof, bool append)
|
||||
void do_snip(bool copying, bool marked, bool until_eof, bool append)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
filestruct *cb_save = NULL;
|
||||
linestruct *was_bottom = NULL;
|
||||
/* The current end of the cutbuffer, before we add text to it. */
|
||||
size_t cb_save_len = 0;
|
||||
size_t botlen = 0;
|
||||
/* The length of the string at the current end of the cutbuffer,
|
||||
* before we add text to it. */
|
||||
bool old_no_newlines = ISSET(NO_NEWLINES);
|
||||
bool using_magicline = !ISSET(NO_NEWLINES);
|
||||
/* Whether an automatic newline should be added at end-of-buffer. */
|
||||
bool right_side_up = TRUE;
|
||||
/* There *is* no region, *or* it is marked forward. */
|
||||
#endif
|
||||
size_t was_totsize = openfile->totsize;
|
||||
static bool precedent = FALSE;
|
||||
/* Whether the previous operation was a copying operation. */
|
||||
|
||||
/* If cuts were not continuous, or when cutting a region, clear the slate. */
|
||||
if (!append && (!keep_cutbuffer || marked || cut_till_eof)) {
|
||||
free_filestruct(cutbuffer);
|
||||
if ((!keep_cutbuffer || marked || until_eof || copying != precedent) &&
|
||||
!append) {
|
||||
free_lines(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
/* After a line cut, future line cuts should add to the cutbuffer. */
|
||||
keep_cutbuffer = !marked && !cut_till_eof;
|
||||
}
|
||||
|
||||
/* After a line operation, future ones should add to the cutbuffer. */
|
||||
keep_cutbuffer = !marked && !until_eof;
|
||||
precedent = copying;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (copy_text) {
|
||||
if (copying) {
|
||||
/* If the cutbuffer isn't empty, remember where it currently ends. */
|
||||
if (cutbuffer != NULL) {
|
||||
cb_save = cutbottom;
|
||||
cb_save_len = strlen(cutbottom->data);
|
||||
was_bottom = cutbottom;
|
||||
botlen = strlen(cutbottom->data);
|
||||
}
|
||||
/* Don't add a magicline when moving text to the cutbuffer. */
|
||||
/* Don't add a magic line when moving text to the cutbuffer. */
|
||||
SET(NO_NEWLINES);
|
||||
}
|
||||
|
||||
if (cut_till_eof) {
|
||||
/* Move all text up to the end of the file into the cutbuffer. */
|
||||
/* Now move the relevant piece of text into the cutbuffer. */
|
||||
if (until_eof)
|
||||
cut_to_eof();
|
||||
} else if (openfile->mark) {
|
||||
/* Move the marked text to the cutbuffer, and turn the mark off. */
|
||||
else if (openfile->mark) {
|
||||
cut_marked(&right_side_up);
|
||||
openfile->mark = NULL;
|
||||
} else if (ISSET(CUT_FROM_CURSOR))
|
||||
/* Move all text up to the end of the line into the cutbuffer. */
|
||||
cut_to_eol();
|
||||
else
|
||||
#endif
|
||||
/* Move the entire line into the cutbuffer. */
|
||||
cut_line();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (copy_text) {
|
||||
/* Copy the text that is in the cutbuffer (starting at its saved end,
|
||||
* if there is one) back into the current buffer. This effectively
|
||||
* uncuts the text we just cut. */
|
||||
if (copying) {
|
||||
/* Copy the text that was put into the cutbuffer back into the current
|
||||
* file buffer, so that in the end nothing has been deleted. */
|
||||
if (cutbuffer != NULL) {
|
||||
if (cb_save != NULL) {
|
||||
cb_save->data += cb_save_len;
|
||||
copy_from_buffer(cb_save);
|
||||
cb_save->data -= cb_save_len;
|
||||
if (was_bottom != NULL) {
|
||||
was_bottom->data += botlen;
|
||||
copy_from_buffer(was_bottom);
|
||||
was_bottom->data -= botlen;
|
||||
} else
|
||||
copy_from_buffer(cutbuffer);
|
||||
|
||||
@@ -172,42 +340,70 @@ void do_cut_text(bool copy_text, bool marked, bool cut_till_eof, bool append)
|
||||
if (right_side_up)
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
/* Restore the magicline behavior now that we're done fiddling. */
|
||||
if (!old_no_newlines)
|
||||
/* Restore the magic-line behavior now that we're done fiddling. */
|
||||
if (using_magicline)
|
||||
UNSET(NO_NEWLINES);
|
||||
} else
|
||||
#endif /* !NANO_TINY */
|
||||
/* Only set the modification flag if actually something was cut. */
|
||||
if (openfile->totsize != was_totsize)
|
||||
#endif
|
||||
set_modified();
|
||||
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
/* Return FALSE when a cut command would not actually cut anything: when
|
||||
* on an empty line at EOF, or when the mark covers zero characters, or
|
||||
* (when test_cliff is TRUE) when the magic line would be cut. */
|
||||
bool is_cuttable(bool test_cliff)
|
||||
{
|
||||
if ((openfile->current->next == NULL && openfile->current->data[0] == '\0'
|
||||
#ifndef NANO_TINY
|
||||
&& openfile->mark == NULL) ||
|
||||
(openfile->mark == openfile->current &&
|
||||
openfile->mark_x == openfile->current_x) ||
|
||||
(test_cliff && openfile->current->data[openfile->current_x] == '\0' &&
|
||||
((ISSET(NO_NEWLINES) && openfile->current == openfile->filebot) ||
|
||||
(!ISSET(NO_NEWLINES) && openfile->current == openfile->filebot->prev))
|
||||
#endif
|
||||
)) {
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark = NULL;
|
||||
#endif
|
||||
statusbar(_("Nothing was cut"));
|
||||
return FALSE;
|
||||
} else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Move text from the current buffer into the cutbuffer. */
|
||||
void do_cut_text_void(void)
|
||||
void cut_text(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
if (!is_cuttable(ISSET(CUT_FROM_CURSOR) && openfile->mark == NULL))
|
||||
return;
|
||||
|
||||
/* Only add a new undo item when the current item is not a CUT or when
|
||||
* the current cut is not contiguous with the previous cutting. */
|
||||
if (openfile->last_action != CUT || openfile->current_undo == NULL ||
|
||||
openfile->current_undo->mark_begin_lineno != openfile->current->lineno ||
|
||||
!keep_cutbuffer)
|
||||
add_undo(CUT);
|
||||
do_cut_text(FALSE, openfile->mark, FALSE, FALSE);
|
||||
if (openfile->last_action != CUT || !keep_cutbuffer) {
|
||||
keep_cutbuffer = FALSE;
|
||||
add_undo(CUT, NULL);
|
||||
}
|
||||
|
||||
do_snip(FALSE, openfile->mark != NULL, FALSE, FALSE);
|
||||
|
||||
update_undo(CUT);
|
||||
#else
|
||||
do_cut_text(FALSE, FALSE, FALSE, FALSE);
|
||||
if (is_cuttable(FALSE))
|
||||
do_snip(FALSE, FALSE, FALSE, FALSE);
|
||||
#endif
|
||||
wipe_statusbar();
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Move text from the current buffer into the cutbuffer, and copy it
|
||||
* back into the buffer afterward. If the mark is set or the cursor
|
||||
* was moved, blow away previous contents of the cutbuffer. */
|
||||
void do_copy_text(void)
|
||||
void copy_text(void)
|
||||
{
|
||||
static filestruct *next_contiguous_line = NULL;
|
||||
bool mark_is_set = (openfile->mark != NULL);
|
||||
|
||||
/* Remember the current viewport and cursor position. */
|
||||
@@ -216,72 +412,77 @@ void do_copy_text(void)
|
||||
ssize_t is_current_lineno = openfile->current->lineno;
|
||||
size_t is_current_x = openfile->current_x;
|
||||
|
||||
if (mark_is_set || openfile->current != next_contiguous_line)
|
||||
cutbuffer_reset();
|
||||
|
||||
do_cut_text(TRUE, mark_is_set, FALSE, FALSE);
|
||||
|
||||
/* If the mark was set, blow away the cutbuffer on the next copy. */
|
||||
next_contiguous_line = (mark_is_set ? NULL : openfile->current);
|
||||
do_snip(TRUE, mark_is_set, FALSE, FALSE);
|
||||
|
||||
/* If the mark was set, restore the viewport and cursor position. */
|
||||
if (mark_is_set) {
|
||||
openfile->edittop = fsfromline(is_edittop_lineno);
|
||||
openfile->edittop = line_from_number(is_edittop_lineno);
|
||||
openfile->firstcolumn = is_firstcolumn;
|
||||
openfile->current = fsfromline(is_current_lineno);
|
||||
openfile->current = line_from_number(is_current_lineno);
|
||||
openfile->current_x = is_current_x;
|
||||
}
|
||||
} else
|
||||
focusing = FALSE;
|
||||
|
||||
openfile->last_action = OTHER;
|
||||
}
|
||||
|
||||
/* Cut from the current cursor position to the end of the file. */
|
||||
void do_cut_till_eof(void)
|
||||
void cut_till_eof(void)
|
||||
{
|
||||
add_undo(CUT_TO_EOF);
|
||||
do_cut_text(FALSE, FALSE, TRUE, FALSE);
|
||||
if ((openfile->current == openfile->filebot && openfile->current->data[0] == '\0') ||
|
||||
(!ISSET(NO_NEWLINES) && openfile->current->next == openfile->filebot &&
|
||||
openfile->current->data[openfile->current_x] == '\0')) {
|
||||
statusbar(_("Nothing was cut"));
|
||||
return;
|
||||
}
|
||||
|
||||
add_undo(CUT_TO_EOF, NULL);
|
||||
do_snip(FALSE, FALSE, TRUE, FALSE);
|
||||
update_undo(CUT_TO_EOF);
|
||||
wipe_statusbar();
|
||||
}
|
||||
|
||||
/* Erase text (current line or marked region), sending it into oblivion. */
|
||||
void zap_text(void)
|
||||
{
|
||||
/* Remember the current cutbuffer so it can be restored after the zap. */
|
||||
filestruct *was_cutbuffer = cutbuffer;
|
||||
filestruct *was_cutbottom = cutbottom;
|
||||
linestruct *was_cutbuffer = cutbuffer;
|
||||
|
||||
if (!is_cuttable(ISSET(CUT_FROM_CURSOR) && openfile->mark == NULL))
|
||||
return;
|
||||
|
||||
/* Add a new undo item only when the current item is not a ZAP or when
|
||||
* the current zap is not contiguous with the previous zapping. */
|
||||
if (openfile->last_action != ZAP || openfile->current_undo == NULL ||
|
||||
openfile->current_undo->mark_begin_lineno != openfile->current->lineno ||
|
||||
openfile->current_undo->xflags & (MARK_WAS_SET|WAS_MARKED_FORWARD))
|
||||
add_undo(ZAP);
|
||||
if (openfile->last_action != ZAP || !keep_cutbuffer)
|
||||
add_undo(ZAP, NULL);
|
||||
|
||||
/* Use the cutbuffer from the ZAP undo item, so the cut can be undone. */
|
||||
cutbuffer = openfile->current_undo->cutbuffer;
|
||||
cutbottom = openfile->current_undo->cutbottom;
|
||||
|
||||
do_cut_text(FALSE, openfile->mark, FALSE, TRUE);
|
||||
do_snip(FALSE, openfile->mark != NULL, FALSE, TRUE);
|
||||
|
||||
update_undo(ZAP);
|
||||
wipe_statusbar();
|
||||
|
||||
cutbuffer = was_cutbuffer;
|
||||
cutbottom = was_cutbottom;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Copy text from the cutbuffer into the current buffer. */
|
||||
void do_uncut_text(void)
|
||||
void paste_text(void)
|
||||
{
|
||||
ssize_t was_lineno = openfile->current->lineno;
|
||||
/* The line number where we started the paste. */
|
||||
size_t was_leftedge = 0;
|
||||
/* The leftedge where we started the paste. */
|
||||
|
||||
/* If the cutbuffer is empty, there is nothing to do. */
|
||||
if (cutbuffer == NULL)
|
||||
if (cutbuffer == NULL) {
|
||||
statusbar(_("Cutbuffer is empty"));
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(PASTE);
|
||||
add_undo(PASTE, NULL);
|
||||
|
||||
if (ISSET(SOFTWRAP))
|
||||
was_leftedge = leftedge_for(xplustabs(), openfile->current);
|
||||
@@ -303,5 +504,6 @@ void do_uncut_text(void)
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
set_modified();
|
||||
wipe_statusbar();
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
1206
src/files.c
1206
src/files.c
File diff suppressed because it is too large
Load Diff
535
src/global.c
535
src/global.c
File diff suppressed because it is too large
Load Diff
176
src/help.c
176
src/help.c
@@ -1,9 +1,9 @@
|
||||
/**************************************************************************
|
||||
* help.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2000-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2000-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2017 Rishabh Dave *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* Copyright (C) 2014-2018 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef ENABLE_HELP
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef ENABLE_HELP
|
||||
|
||||
static char *help_text = NULL;
|
||||
/* The text displayed in the help window. */
|
||||
|
||||
@@ -39,45 +39,42 @@ static char *end_of_intro = NULL;
|
||||
static size_t location;
|
||||
/* The offset (in bytes) of the topleft of the shown help text. */
|
||||
|
||||
char *tempfilename = NULL;
|
||||
/* Name of the temporary file used for wrapping the help text. */
|
||||
|
||||
/* Hard-wrap the help text, write it to the existing temporary file, and
|
||||
* read that file into a new buffer. */
|
||||
void wrap_the_help_text(bool redisplaying)
|
||||
/* Hard-wrap the concatenated help text, and write it into a new buffer. */
|
||||
void wrap_help_text_into_buffer(void)
|
||||
{
|
||||
size_t sum = 0;
|
||||
const char *ptr = start_of_body;
|
||||
FILE *tempfile = fopen(tempfilename, "w+b");
|
||||
|
||||
/* If re-opening the temporary file failed, give up. */
|
||||
if (tempfile == NULL) {
|
||||
statusline(ALERT, _("Error writing temp file: %s"), strerror(errno));
|
||||
return;
|
||||
}
|
||||
make_new_buffer();
|
||||
|
||||
/* Write the body of the help_text into the temporary file. */
|
||||
/* Copy the help text into the just-created new buffer. */
|
||||
while (*ptr != '\0') {
|
||||
int length = help_line_len(ptr);
|
||||
char *oneline = nmalloc(length + 1);
|
||||
|
||||
snprintf(oneline, length + 1, "%s", ptr);
|
||||
free(openfile->current->data);
|
||||
openfile->current->data = oneline;
|
||||
|
||||
fwrite(ptr, sizeof(char), length, tempfile);
|
||||
ptr += length;
|
||||
|
||||
/* Hard-wrap the lines in the help text. */
|
||||
if (*ptr != '\n')
|
||||
fwrite("\n", sizeof(char), 1, tempfile);
|
||||
else while (*ptr == '\n')
|
||||
fwrite(ptr++, sizeof(char), 1, tempfile);
|
||||
ptr--;
|
||||
|
||||
/* Create a new line, and then one more for each extra \n. */
|
||||
do {
|
||||
openfile->current->next = make_new_node(openfile->current);
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current->data = copy_of("");
|
||||
} while (*(++ptr) == '\n');
|
||||
}
|
||||
|
||||
fclose(tempfile);
|
||||
openfile->filebot = openfile->current;
|
||||
openfile->current = openfile->filetop;
|
||||
|
||||
if (redisplaying)
|
||||
close_buffer();
|
||||
|
||||
open_buffer(tempfilename, TRUE);
|
||||
remove_magicline();
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_update();
|
||||
#endif
|
||||
prepare_for_display();
|
||||
|
||||
/* Move to the position in the file where we were before. */
|
||||
@@ -106,26 +103,15 @@ void do_help(void)
|
||||
#ifdef ENABLE_COLOR
|
||||
char *was_syntax = syntaxstr;
|
||||
#endif
|
||||
char *saved_answer = (answer != NULL) ? strdup(answer) : NULL;
|
||||
char *saved_answer = (answer != NULL) ? copy_of(answer) : NULL;
|
||||
/* The current answer when the user invokes help at the prompt. */
|
||||
unsigned stash[sizeof(flags) / sizeof(flags[0])];
|
||||
/* A storage place for the current flag settings. */
|
||||
filestruct *line;
|
||||
linestruct *line;
|
||||
int length;
|
||||
FILE *fp;
|
||||
|
||||
blank_statusbar();
|
||||
|
||||
/* Get a temporary file for the help text. If it fails, give up. */
|
||||
tempfilename = safe_tempfile(&fp);
|
||||
if (tempfilename == NULL) {
|
||||
statusline(ALERT, _("Error writing temp file: %s"), strerror(errno));
|
||||
free(saved_answer);
|
||||
return;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
/* Save the settings of all flags. */
|
||||
memcpy(stash, flags, sizeof(flags));
|
||||
|
||||
@@ -164,8 +150,7 @@ void do_help(void)
|
||||
|
||||
/* Extract the title from the head of the help text. */
|
||||
length = break_line(help_text, MAX_BUF_SIZE, TRUE);
|
||||
title = charalloc(length * sizeof(char) + 1);
|
||||
strncpy(title, help_text, length);
|
||||
title = measured_copy(help_text, length + 1);
|
||||
title[length] = '\0';
|
||||
|
||||
titlebar(title);
|
||||
@@ -175,7 +160,7 @@ void do_help(void)
|
||||
while (*start_of_body == '\n')
|
||||
start_of_body++;
|
||||
|
||||
wrap_the_help_text(FALSE);
|
||||
wrap_help_text_into_buffer();
|
||||
edit_refresh();
|
||||
|
||||
while (TRUE) {
|
||||
@@ -193,9 +178,9 @@ void do_help(void)
|
||||
} else if (ISSET(SHOW_CURSOR) && (func == do_left || func == do_right ||
|
||||
func == do_up || func == do_down)) {
|
||||
func();
|
||||
} else if (func == do_up) {
|
||||
} else if (func == do_up || func == do_scroll_up) {
|
||||
do_scroll_up();
|
||||
} else if (func == do_down) {
|
||||
} else if (func == do_down || func == do_scroll_down) {
|
||||
if (openfile->edittop->lineno + editwinrows - 1 <
|
||||
openfile->filebot->lineno)
|
||||
do_scroll_down();
|
||||
@@ -210,19 +195,16 @@ void do_help(void)
|
||||
} else if (func == (functionptrtype)implant) {
|
||||
implant(first_sc_for(MHELP, func)->expansion);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
} else if (kbinput == KEY_WINCH) {
|
||||
; /* Nothing to do. */
|
||||
#endif
|
||||
#ifdef ENABLE_MOUSE
|
||||
} else if (kbinput == KEY_MOUSE) {
|
||||
int dummy_row, dummy_col;
|
||||
get_mouseinput(&dummy_row, &dummy_col, TRUE);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
} else if (kbinput == KEY_WINCH) {
|
||||
; /* Nothing to do. */
|
||||
#endif
|
||||
} else if (func == do_exit) {
|
||||
/* Exit from the help viewer. */
|
||||
close_buffer();
|
||||
curs_set(0);
|
||||
break;
|
||||
} else
|
||||
unbound_key(kbinput);
|
||||
@@ -231,7 +213,7 @@ void do_help(void)
|
||||
edit_refresh();
|
||||
|
||||
location = 0;
|
||||
line = openfile->fileage;
|
||||
line = openfile->filetop;
|
||||
|
||||
/* Count how far (in bytes) edittop is into the file. */
|
||||
while (line != openfile->edittop) {
|
||||
@@ -240,6 +222,9 @@ void do_help(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Discard the help-text buffer. */
|
||||
close_buffer();
|
||||
|
||||
/* Restore the settings of all flags. */
|
||||
memcpy(flags, stash, sizeof(flags));
|
||||
|
||||
@@ -250,35 +235,35 @@ void do_help(void)
|
||||
tabsize = was_tabsize;
|
||||
#ifdef ENABLE_COLOR
|
||||
syntaxstr = was_syntax;
|
||||
have_palette = FALSE;
|
||||
#endif
|
||||
|
||||
/* Switch back to the buffer we were invoked from. */
|
||||
switch_to_prev_buffer();
|
||||
free(title);
|
||||
title = NULL;
|
||||
free(answer);
|
||||
answer = saved_answer;
|
||||
free(help_text);
|
||||
inhelp = FALSE;
|
||||
|
||||
curs_set(0);
|
||||
|
||||
if (ISSET(NO_HELP)) {
|
||||
currmenu = oldmenu;
|
||||
window_init();
|
||||
} else
|
||||
} else {
|
||||
wipe_statusbar();
|
||||
bottombars(oldmenu);
|
||||
|
||||
free(title);
|
||||
title = NULL;
|
||||
inhelp = FALSE;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
|
||||
browser_refresh();
|
||||
else
|
||||
#endif
|
||||
total_refresh();
|
||||
|
||||
free(answer);
|
||||
answer = saved_answer;
|
||||
|
||||
remove(tempfilename);
|
||||
free(tempfilename);
|
||||
|
||||
free(help_text);
|
||||
{
|
||||
titlebar(NULL);
|
||||
edit_refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate space for the help text for the current menu, and concatenate
|
||||
@@ -291,8 +276,8 @@ void help_init(void)
|
||||
/* Untranslated help introduction. We break it up into three chunks
|
||||
* in case the full string is too long for the compiler to handle. */
|
||||
char *ptr;
|
||||
const subnfunc *f;
|
||||
const sc *s;
|
||||
const funcstruct *f;
|
||||
const keystruct *s;
|
||||
|
||||
/* First, set up the initial help text for the current function. */
|
||||
if (currmenu == MWHEREIS || currmenu == MREPLACE || currmenu == MREPLACEWITH) {
|
||||
@@ -464,22 +449,22 @@ void help_init(void)
|
||||
allocsize += strlen(htx[2]);
|
||||
|
||||
/* Calculate the length of the shortcut help text. Each entry has
|
||||
* one or two keys, which fill 16 columns, plus translated text,
|
||||
* one or two keys, which fill 17 cells, plus translated text,
|
||||
* plus one or two \n's. */
|
||||
for (f = allfuncs; f != NULL; f = f->next)
|
||||
if (f->menus & currmenu)
|
||||
allocsize += (16 * MAXCHARLEN) + strlen(_(f->help)) + 2;
|
||||
allocsize += strlen(_(f->help)) + 21;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we're on the main list, we also count the toggle help text.
|
||||
* Each entry has "M-%c\t\t", five chars which fill 16 columns,
|
||||
* plus a space, plus translated text, plus one or two '\n's. */
|
||||
* Each entry has "M-%c\t\t ", six chars which fill 17 cells, plus
|
||||
* two translated texts, plus a space, plus one or two '\n's. */
|
||||
if (currmenu == MMAIN) {
|
||||
size_t endis_len = strlen(_("enable/disable"));
|
||||
size_t onoff_len = strlen(_("enable/disable"));
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->func == do_toggle_void)
|
||||
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 8;
|
||||
allocsize += strlen(_(flagtostr(s->toggle))) + onoff_len + 9;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -493,40 +478,39 @@ void help_init(void)
|
||||
if (htx[2] != NULL)
|
||||
strcat(help_text, htx[2]);
|
||||
|
||||
ptr = help_text + strlen(help_text);
|
||||
|
||||
/* Remember this end-of-introduction, start-of-shortcuts. */
|
||||
end_of_intro = ptr;
|
||||
end_of_intro = help_text + strlen(help_text);
|
||||
ptr = end_of_intro;
|
||||
|
||||
/* Now add our shortcut info. */
|
||||
/* Now add the shortcuts and their descriptions. */
|
||||
for (f = allfuncs; f != NULL; f = f->next) {
|
||||
int tally = 0;
|
||||
|
||||
if ((f->menus & currmenu) == 0)
|
||||
continue;
|
||||
|
||||
/* Let's simply show the first two shortcuts from the list. */
|
||||
/* Show the first two shortcuts (if any) for each function. */
|
||||
for (s = sclist; s != NULL; s = s->next) {
|
||||
if ((s->menus & currmenu) && s->func == f->func) {
|
||||
/* Make the first column narrower (6) than the second (10),
|
||||
* but allow it to spill into the second, for "M-Space". */
|
||||
/* Make the first column 7 cells wide and the second 10. */
|
||||
if (++tally == 1) {
|
||||
sprintf(ptr, "%s ", s->keystr);
|
||||
sprintf(ptr, "%s ", s->keystr);
|
||||
/* Unicode arrows take three bytes instead of one. */
|
||||
ptr += (strstr(s->keystr, "\xE2") != NULL ? 8 : 6);
|
||||
ptr += (strstr(s->keystr, "\xE2") != NULL ? 9 : 7);
|
||||
} else {
|
||||
ptr += sprintf(ptr, "(%s)\t", s->keystr);
|
||||
sprintf(ptr, "(%s) ", s->keystr);
|
||||
ptr += (strstr(s->keystr, "\xE2") != NULL ? 12 : 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tally == 0)
|
||||
ptr += sprintf(ptr, "\t\t");
|
||||
ptr += sprintf(ptr, "\t\t ");
|
||||
else if (tally == 1)
|
||||
ptr += 10;
|
||||
|
||||
/* The shortcut's help text. */
|
||||
/* The shortcut's description. */
|
||||
ptr += sprintf(ptr, "%s\n", _(f->help));
|
||||
|
||||
if (f->blank_after)
|
||||
@@ -547,7 +531,7 @@ void help_init(void)
|
||||
counter++;
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
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"));
|
||||
if (s->toggle == NO_COLOR_SYNTAX || s->toggle == TABS_TO_SPACES)
|
||||
ptr += sprintf(ptr, "\n");
|
||||
@@ -556,9 +540,6 @@ void help_init(void)
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
if (strlen(help_text) > allocsize)
|
||||
statusline(ALERT, "Help text spilled over -- please report a bug");
|
||||
}
|
||||
|
||||
/* Return the function that is bound to the given key, accepting certain
|
||||
@@ -567,7 +548,6 @@ functionptrtype parse_help_input(int *kbinput)
|
||||
{
|
||||
if (!meta_key) {
|
||||
switch (*kbinput) {
|
||||
case DEL_CODE:
|
||||
case '-':
|
||||
return do_page_up;
|
||||
case ' ':
|
||||
@@ -610,10 +590,10 @@ size_t help_line_len(const char *ptr)
|
||||
|
||||
/* Get the length of the entire line up to a null or a newline. */
|
||||
while (*(ptr + length) != '\0' && *(ptr + length) != '\n')
|
||||
length = move_mbright(ptr, length);
|
||||
length = step_right(ptr, length);
|
||||
|
||||
/* If the entire line will just fit the screen, don't wrap it. */
|
||||
if (strnlenpt(ptr, length) <= wrapping_point + 1)
|
||||
if (wideness(ptr, length) <= wrapping_point + 1)
|
||||
return length;
|
||||
else if (wrap_location > 0)
|
||||
return wrap_location;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* history.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2003-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2003-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -21,11 +21,11 @@
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
|
||||
#ifndef SEARCH_HISTORY
|
||||
#define SEARCH_HISTORY "search_history"
|
||||
#endif
|
||||
@@ -40,29 +40,31 @@ static struct stat stat_of_positions_file;
|
||||
/* The last-obtained stat information of the positions file. */
|
||||
static char *poshistname = NULL;
|
||||
/* The name of the positions-history file. */
|
||||
static poshiststruct *position_history = NULL;
|
||||
/* The list of filenames with their last cursor positions. */
|
||||
|
||||
/* Initialize the lists of historical search and replace strings
|
||||
* and the list of historical executed commands. */
|
||||
void history_init(void)
|
||||
{
|
||||
search_history = make_new_node(NULL);
|
||||
search_history->data = mallocstrcpy(NULL, "");
|
||||
search_history->data = copy_of("");
|
||||
searchtop = search_history;
|
||||
searchbot = search_history;
|
||||
|
||||
replace_history = make_new_node(NULL);
|
||||
replace_history->data = mallocstrcpy(NULL, "");
|
||||
replace_history->data = copy_of("");
|
||||
replacetop = replace_history;
|
||||
replacebot = replace_history;
|
||||
|
||||
execute_history = make_new_node(NULL);
|
||||
execute_history->data = mallocstrcpy(NULL, "");
|
||||
execute_history->data = copy_of("");
|
||||
executetop = execute_history;
|
||||
executebot = execute_history;
|
||||
}
|
||||
|
||||
/* Set the current position in the given history list to the bottom. */
|
||||
void history_reset(const filestruct *list)
|
||||
void history_reset(const linestruct *list)
|
||||
{
|
||||
if (list == search_history)
|
||||
search_history = searchbot;
|
||||
@@ -75,14 +77,14 @@ void history_reset(const filestruct *list)
|
||||
/* 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
|
||||
* text, or NULL if there is no such node. */
|
||||
filestruct *find_history(const filestruct *start, const filestruct *end,
|
||||
linestruct *find_history(const linestruct *start, const linestruct *end,
|
||||
const char *text, size_t len)
|
||||
{
|
||||
const filestruct *item;
|
||||
const linestruct *item;
|
||||
|
||||
for (item = start; item != end->prev && item != NULL; item = item->prev) {
|
||||
if (strncmp(item->data, text, len) == 0)
|
||||
return (filestruct *)item;
|
||||
return (linestruct *)item;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -90,9 +92,9 @@ filestruct *find_history(const filestruct *start, const filestruct *end,
|
||||
|
||||
/* 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. */
|
||||
void update_history(filestruct **item, const char *text)
|
||||
void update_history(linestruct **item, const char *text)
|
||||
{
|
||||
filestruct **htop = NULL, **hbot = NULL, *thesame;
|
||||
linestruct **htop = NULL, **hbot = NULL, *thesame;
|
||||
|
||||
if (*item == search_history) {
|
||||
htop = &searchtop;
|
||||
@@ -110,31 +112,31 @@ void update_history(filestruct **item, const char *text)
|
||||
|
||||
/* If an identical string was found, delete that item. */
|
||||
if (thesame != NULL) {
|
||||
filestruct *after = thesame->next;
|
||||
linestruct *after = thesame->next;
|
||||
|
||||
/* If the string is at the head of the list, move the head. */
|
||||
if (thesame == *htop)
|
||||
*htop = after;
|
||||
|
||||
unlink_node(thesame);
|
||||
renumber(after);
|
||||
renumber_from(after);
|
||||
}
|
||||
|
||||
/* If the history is full, delete the oldest item (the one at the
|
||||
* head of the list), to make room for a new item at the end. */
|
||||
if ((*hbot)->lineno == MAX_SEARCH_HISTORY + 1) {
|
||||
filestruct *oldest = *htop;
|
||||
linestruct *oldest = *htop;
|
||||
|
||||
*htop = (*htop)->next;
|
||||
unlink_node(oldest);
|
||||
renumber(*htop);
|
||||
renumber_from(*htop);
|
||||
}
|
||||
|
||||
/* Store the fresh string in the last item, then create a new item. */
|
||||
(*hbot)->data = mallocstrcpy((*hbot)->data, text);
|
||||
splice_node(*hbot, make_new_node(*hbot));
|
||||
*hbot = (*hbot)->next;
|
||||
(*hbot)->data = mallocstrcpy(NULL, "");
|
||||
(*hbot)->data = copy_of("");
|
||||
|
||||
/* Indicate that the history needs to be saved on exit. */
|
||||
history_changed = TRUE;
|
||||
@@ -145,7 +147,7 @@ void update_history(filestruct **item, const char *text)
|
||||
|
||||
/* Move h to the string in the history list just before it, and return
|
||||
* that string. If there isn't one, don't move h and return NULL. */
|
||||
char *get_history_older(filestruct **h)
|
||||
char *get_history_older(linestruct **h)
|
||||
{
|
||||
if ((*h)->prev == NULL)
|
||||
return NULL;
|
||||
@@ -157,7 +159,7 @@ char *get_history_older(filestruct **h)
|
||||
|
||||
/* Move h to the string in the history list just after it, and return
|
||||
* that string. If there isn't one, don't move h and return NULL. */
|
||||
char *get_history_newer(filestruct **h)
|
||||
char *get_history_newer(linestruct **h)
|
||||
{
|
||||
if ((*h)->next == NULL)
|
||||
return NULL;
|
||||
@@ -167,14 +169,12 @@ char *get_history_newer(filestruct **h)
|
||||
return (*h)->data;
|
||||
}
|
||||
|
||||
/* More placeholders. */
|
||||
void get_history_newer_void(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
/* Two empty placeholder functions. */
|
||||
void get_history_older_void(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
void get_history_newer_void(void)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TABCOMP
|
||||
@@ -182,10 +182,10 @@ void get_history_older_void(void)
|
||||
* looking at only the first len characters of s, and return that
|
||||
* string. If there isn't one, or if len is 0, don't move h and return
|
||||
* s. */
|
||||
char *get_history_completion(filestruct **h, char *s, size_t len)
|
||||
char *get_history_completion(linestruct **h, char *s, size_t len)
|
||||
{
|
||||
if (len > 0) {
|
||||
filestruct *htop = NULL, *hbot = NULL, *p;
|
||||
linestruct *htop = NULL, *hbot = NULL, *p;
|
||||
|
||||
if (*h == search_history) {
|
||||
htop = searchtop;
|
||||
@@ -229,19 +229,6 @@ char *get_history_completion(filestruct **h, char *s, size_t len)
|
||||
}
|
||||
#endif /* ENABLE_TABCOMP */
|
||||
|
||||
void history_error(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, msg);
|
||||
vfprintf(stderr, _(msg), ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, _("\nPress Enter to continue\n"));
|
||||
while (getchar() != '\n')
|
||||
;
|
||||
}
|
||||
|
||||
/* Check whether we have or could make a directory for history files. */
|
||||
bool have_statedir(void)
|
||||
{
|
||||
@@ -280,14 +267,14 @@ bool have_statedir(void)
|
||||
free(statepath);
|
||||
}
|
||||
if (mkdir(statedir, S_IRWXU) == -1) {
|
||||
history_error(N_("Unable to create directory %s: %s\n"
|
||||
jot_error(N_("Unable to create directory %s: %s\n"
|
||||
"It is required for saving/loading "
|
||||
"search history or cursor positions.\n"),
|
||||
statedir, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
} else if (!S_ISDIR(dirstat.st_mode)) {
|
||||
history_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 "
|
||||
"search history or cursor positions.\n"),
|
||||
statedir);
|
||||
@@ -308,14 +295,14 @@ void load_history(void)
|
||||
if (errno != ENOENT) {
|
||||
/* When reading failed, don't save history when we quit. */
|
||||
UNSET(HISTORYLOG);
|
||||
history_error(N_("Error reading %s: %s"), histname,
|
||||
jot_error(N_("Error reading %s: %s"), histname,
|
||||
strerror(errno));
|
||||
}
|
||||
} else {
|
||||
/* Load the three history lists -- first search, then replace,
|
||||
* then execute -- from oldest entry to newest. Between two
|
||||
* lists there is an empty line. */
|
||||
filestruct **history = &search_history;
|
||||
linestruct **history = &search_history;
|
||||
char *line = NULL;
|
||||
size_t buf_len = 0;
|
||||
ssize_t read;
|
||||
@@ -344,9 +331,9 @@ void load_history(void)
|
||||
|
||||
/* Write the lines of a history list, starting at head, from oldest to newest,
|
||||
* to the given file. Return TRUE if writing succeeded, and FALSE otherwise. */
|
||||
bool write_list(const filestruct *head, FILE *hisfile)
|
||||
bool write_list(const linestruct *head, FILE *hisfile)
|
||||
{
|
||||
const filestruct *item;
|
||||
const linestruct *item;
|
||||
|
||||
for (item = head; item != NULL; item = item->next) {
|
||||
size_t length = strlen(item->data);
|
||||
@@ -404,7 +391,7 @@ void load_poshistory(void)
|
||||
if (errno != ENOENT) {
|
||||
/* When reading failed, don't save history when we quit. */
|
||||
UNSET(POSITIONLOG);
|
||||
history_error(N_("Error reading %s: %s"), poshistname, strerror(errno));
|
||||
jot_error(N_("Error reading %s: %s"), poshistname, strerror(errno));
|
||||
}
|
||||
} else {
|
||||
char *line = NULL, *lineptr, *xptr;
|
||||
@@ -414,7 +401,7 @@ void load_poshistory(void)
|
||||
|
||||
/* Read and parse each line, and store the extracted data. */
|
||||
while ((read = getline(&line, &buf_len, hisfile)) > 5) {
|
||||
/* Decode nulls as embedded newlines. */
|
||||
/* Decode NULs as embedded newlines. */
|
||||
unsunder(line, read);
|
||||
|
||||
/* Find where the x index and line number are in the line. */
|
||||
@@ -431,7 +418,7 @@ void load_poshistory(void)
|
||||
|
||||
/* Create a new position record. */
|
||||
newrecord = (poshiststruct *)nmalloc(sizeof(poshiststruct));
|
||||
newrecord->filename = mallocstrcpy(NULL, line);
|
||||
newrecord->filename = copy_of(line);
|
||||
newrecord->lineno = atoi(lineptr);
|
||||
newrecord->xno = atoi(xptr);
|
||||
newrecord->next = NULL;
|
||||
@@ -484,7 +471,7 @@ void save_poshistory(void)
|
||||
posptr->filename, posptr->lineno, posptr->xno);
|
||||
length = strlen(path_and_place);
|
||||
|
||||
/* Encode newlines in filenames as nulls. */
|
||||
/* Encode newlines in filenames as NULs. */
|
||||
sunder(path_and_place);
|
||||
/* Restore the terminating newline. */
|
||||
path_and_place[length - 1] = '\n';
|
||||
@@ -528,7 +515,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
|
||||
poshiststruct *posptr, *theone, *posprev = NULL;
|
||||
char *fullpath = get_full_path(filename);
|
||||
|
||||
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/' || inhelp) {
|
||||
if (fullpath == NULL || *filename == '\0') {
|
||||
free(fullpath);
|
||||
return;
|
||||
}
|
||||
@@ -563,7 +550,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
|
||||
* not at the end, move the matching one to the end. */
|
||||
if (theone == NULL) {
|
||||
theone = (poshiststruct *)nmalloc(sizeof(poshiststruct));
|
||||
theone->filename = mallocstrcpy(NULL, fullpath);
|
||||
theone->filename = copy_of(fullpath);
|
||||
if (position_history == NULL)
|
||||
position_history = theone;
|
||||
else
|
||||
@@ -593,7 +580,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
|
||||
* set line and column to the retrieved values. */
|
||||
bool has_old_position(const char *file, ssize_t *line, ssize_t *column)
|
||||
{
|
||||
poshiststruct *posptr = position_history;
|
||||
poshiststruct *posptr;
|
||||
char *fullpath = get_full_path(file);
|
||||
|
||||
if (fullpath == NULL)
|
||||
@@ -601,6 +588,7 @@ bool has_old_position(const char *file, ssize_t *line, ssize_t *column)
|
||||
|
||||
reload_positions_if_needed();
|
||||
|
||||
posptr = position_history;
|
||||
while (posptr != NULL && strcmp(posptr->filename, fullpath) != 0)
|
||||
posptr = posptr->next;
|
||||
|
||||
|
||||
123
src/move.c
123
src/move.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* move.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2018 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -26,7 +26,7 @@
|
||||
/* Move to the first line of the file. */
|
||||
void to_first_line(void)
|
||||
{
|
||||
openfile->current = openfile->fileage;
|
||||
openfile->current = openfile->filetop;
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
|
||||
@@ -68,14 +68,14 @@ void get_edge_and_target(size_t *leftedge, size_t *target_column)
|
||||
* chunk that starts at the given leftedge. If the target column has landed
|
||||
* on a tab, prevent the cursor from falling back a row when moving forward,
|
||||
* or from skipping a row when moving backward, by incrementing the index. */
|
||||
size_t proper_x(filestruct *line, size_t *leftedge, bool forward,
|
||||
size_t proper_x(linestruct *line, size_t *leftedge, bool forward,
|
||||
size_t column, bool *shifted)
|
||||
{
|
||||
size_t index = actual_x(line->data, column);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP) && line->data[index] == '\t' &&
|
||||
((forward && strnlenpt(line->data, index) < *leftedge) ||
|
||||
((forward && wideness(line->data, index) < *leftedge) ||
|
||||
(!forward && column / tabsize == (*leftedge - 1) / tabsize &&
|
||||
column / tabsize < (*leftedge + editwincols - 1) / tabsize))) {
|
||||
index++;
|
||||
@@ -85,7 +85,7 @@ size_t proper_x(filestruct *line, size_t *leftedge, bool forward,
|
||||
}
|
||||
|
||||
if (ISSET(SOFTWRAP))
|
||||
*leftedge = leftedge_for(strnlenpt(line->data, index), line);
|
||||
*leftedge = leftedge_for(wideness(line->data, index), line);
|
||||
#endif
|
||||
|
||||
return index;
|
||||
@@ -109,7 +109,7 @@ void set_proper_index_and_pww(size_t *leftedge, size_t target, bool forward)
|
||||
openfile->placewewant = *leftedge + target;
|
||||
}
|
||||
|
||||
/* Move up nearly one screenful. */
|
||||
/* Move up almost one screenful. */
|
||||
void do_page_up(void)
|
||||
{
|
||||
int mustmove = (editwinrows < 3) ? 1 : editwinrows - 2;
|
||||
@@ -117,7 +117,7 @@ void do_page_up(void)
|
||||
|
||||
/* 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. */
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
if (ISSET(JUMPY_SCROLLING)) {
|
||||
openfile->current = openfile->edittop;
|
||||
leftedge = openfile->firstcolumn;
|
||||
openfile->current_y = 0;
|
||||
@@ -139,7 +139,7 @@ void do_page_up(void)
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
/* Move down nearly one screenful. */
|
||||
/* Move down almost one screenful. */
|
||||
void do_page_down(void)
|
||||
{
|
||||
int mustmove = (editwinrows < 3) ? 1 : editwinrows - 2;
|
||||
@@ -147,7 +147,7 @@ void do_page_down(void)
|
||||
|
||||
/* 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. */
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
if (ISSET(JUMPY_SCROLLING)) {
|
||||
openfile->current = openfile->edittop;
|
||||
leftedge = openfile->firstcolumn;
|
||||
openfile->current_y = 0;
|
||||
@@ -170,59 +170,52 @@ void do_page_down(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
/* Move to the beginning of the first-found beginning-of-paragraph line
|
||||
* before the current line. */
|
||||
void do_para_begin(void)
|
||||
/* Move to the first beginning of a paragraph before the current line. */
|
||||
void do_para_begin(linestruct **line)
|
||||
{
|
||||
if (openfile->current != openfile->fileage)
|
||||
openfile->current = openfile->current->prev;
|
||||
if ((*line)->prev != NULL)
|
||||
*line = (*line)->prev;
|
||||
|
||||
while (!begpar(openfile->current, 0))
|
||||
openfile->current = openfile->current->prev;
|
||||
|
||||
openfile->current_x = 0;
|
||||
while (!begpar(*line, 0))
|
||||
*line = (*line)->prev;
|
||||
}
|
||||
|
||||
/* Move down to the beginning of the last line of the current paragraph.
|
||||
* Then move down one line farther if there is such a line, or to the
|
||||
* end of the current line if not. A line is the last line of a paragraph
|
||||
* if it is in a paragraph, and the next line either is the beginning line
|
||||
* of a paragraph or isn't in a paragraph. */
|
||||
void do_para_end(void)
|
||||
/* Move down to the last line of the first found paragraph. */
|
||||
void do_para_end(linestruct **line)
|
||||
{
|
||||
while (openfile->current != openfile->filebot &&
|
||||
!inpar(openfile->current))
|
||||
openfile->current = openfile->current->next;
|
||||
while ((*line)->next != NULL && !inpar(*line))
|
||||
*line = (*line)->next;
|
||||
|
||||
while (openfile->current != openfile->filebot &&
|
||||
inpar(openfile->current->next) &&
|
||||
!begpar(openfile->current->next, 0)) {
|
||||
openfile->current = openfile->current->next;
|
||||
}
|
||||
|
||||
if (openfile->current != openfile->filebot) {
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_x = 0;
|
||||
} else
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
while ((*line)->next != NULL && inpar((*line)->next) &&
|
||||
!begpar((*line)->next, 0))
|
||||
*line = (*line)->next;
|
||||
}
|
||||
|
||||
/* Move up to first start of a paragraph before the current line. */
|
||||
void do_para_begin_void(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
do_para_begin();
|
||||
do_para_begin(&openfile->current);
|
||||
openfile->current_x = 0;
|
||||
|
||||
edit_redraw(was_current, CENTERING);
|
||||
}
|
||||
|
||||
/* Move down to just after the first end of a paragraph. */
|
||||
/* Move down to just after the first found end of a paragraph. */
|
||||
void do_para_end_void(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
do_para_end();
|
||||
do_para_end(&openfile->current);
|
||||
|
||||
/* Step beyond the last line of the paragraph, if possible;
|
||||
* otherwise, move to the end of the line. */
|
||||
if (openfile->current->next != NULL) {
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_x = 0;
|
||||
} else
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
|
||||
edit_redraw(was_current, CENTERING);
|
||||
}
|
||||
@@ -231,7 +224,7 @@ void do_para_end_void(void)
|
||||
/* Move to the preceding block of text. */
|
||||
void do_prev_block(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
bool is_text = FALSE, seen_text = FALSE;
|
||||
|
||||
/* Skip backward until first blank line after some nonblank line(s). */
|
||||
@@ -253,7 +246,7 @@ void do_prev_block(void)
|
||||
/* Move to the next block of text. */
|
||||
void do_next_block(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
bool is_white = white_string(openfile->current->data);
|
||||
bool seen_white = is_white;
|
||||
|
||||
@@ -285,7 +278,7 @@ void do_prev_word(bool allow_punct)
|
||||
}
|
||||
|
||||
/* Step back one character. */
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x = step_left(openfile->current->data,
|
||||
openfile->current_x);
|
||||
|
||||
if (is_word_mbchar(openfile->current->data + openfile->current_x,
|
||||
@@ -303,7 +296,7 @@ void do_prev_word(bool allow_punct)
|
||||
|
||||
if (step_forward)
|
||||
/* Move one character forward again to sit on the start of the word. */
|
||||
openfile->current_x = move_mbright(openfile->current->data,
|
||||
openfile->current_x = step_right(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
@@ -331,7 +324,7 @@ bool do_next_word(bool after_ends, bool allow_punct)
|
||||
seen_space = TRUE;
|
||||
} else {
|
||||
/* Step forward one character. */
|
||||
openfile->current_x = move_mbright(openfile->current->data,
|
||||
openfile->current_x = step_right(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
@@ -364,7 +357,7 @@ bool do_next_word(bool after_ends, bool allow_punct)
|
||||
* word if the WORD_BOUNDS flag is set, and update the screen afterwards. */
|
||||
void do_prev_word_void(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
do_prev_word(ISSET(WORD_BOUNDS));
|
||||
|
||||
@@ -376,7 +369,7 @@ void do_prev_word_void(void)
|
||||
* punctuation as part of a word. Update the screen afterwards. */
|
||||
void do_next_word_void(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
do_next_word(ISSET(AFTER_ENDS), ISSET(WORD_BOUNDS));
|
||||
|
||||
@@ -388,7 +381,7 @@ void do_next_word_void(void)
|
||||
* of the full line when already at the start of a chunk. */
|
||||
void do_home(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
size_t was_column = xplustabs();
|
||||
bool moved_off_chunk = TRUE;
|
||||
#ifndef NANO_TINY
|
||||
@@ -448,7 +441,7 @@ void do_home(void)
|
||||
* end of the full line. */
|
||||
void do_end(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
size_t was_column = xplustabs();
|
||||
size_t line_len = strlen(openfile->current->data);
|
||||
bool moved_off_chunk = TRUE;
|
||||
@@ -497,7 +490,7 @@ void do_end(void)
|
||||
/* Move the cursor to the preceding line or chunk. */
|
||||
void do_up(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
size_t leftedge, target_column;
|
||||
|
||||
get_edge_and_target(&leftedge, &target_column);
|
||||
@@ -508,7 +501,7 @@ void do_up(void)
|
||||
|
||||
set_proper_index_and_pww(&leftedge, target_column, FALSE);
|
||||
|
||||
if (openfile->current_y == 0 && ISSET(SMOOTH_SCROLL))
|
||||
if (openfile->current_y == 0 && !ISSET(JUMPY_SCROLLING))
|
||||
edit_scroll(BACKWARD);
|
||||
else
|
||||
edit_redraw(was_current, FLOWING);
|
||||
@@ -520,7 +513,7 @@ void do_up(void)
|
||||
/* Move the cursor to next line or chunk. */
|
||||
void do_down(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
size_t leftedge, target_column;
|
||||
|
||||
get_edge_and_target(&leftedge, &target_column);
|
||||
@@ -531,7 +524,7 @@ void do_down(void)
|
||||
|
||||
set_proper_index_and_pww(&leftedge, target_column, TRUE);
|
||||
|
||||
if (openfile->current_y == editwinrows - 1 && ISSET(SMOOTH_SCROLL))
|
||||
if (openfile->current_y == editwinrows - 1 && !ISSET(JUMPY_SCROLLING))
|
||||
edit_scroll(FORWARD);
|
||||
else
|
||||
edit_redraw(was_current, FLOWING);
|
||||
@@ -541,7 +534,7 @@ void do_down(void)
|
||||
}
|
||||
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
/* Scroll up one line or chunk without scrolling the cursor. */
|
||||
/* Scroll up one line or chunk without moving the cursor textwise. */
|
||||
void do_scroll_up(void)
|
||||
{
|
||||
/* When the top of the file is onscreen, we can't scroll. */
|
||||
@@ -555,18 +548,18 @@ void do_scroll_up(void)
|
||||
edit_scroll(BACKWARD);
|
||||
}
|
||||
|
||||
/* Scroll down one line or chunk without scrolling the cursor. */
|
||||
/* Scroll down one line or chunk without moving the cursor textwise. */
|
||||
void do_scroll_down(void)
|
||||
{
|
||||
if (openfile->current_y == 0)
|
||||
do_down();
|
||||
|
||||
if (openfile->edittop->next != NULL
|
||||
if (editwinrows > 1 && (openfile->edittop->next != NULL
|
||||
#ifndef NANO_TINY
|
||||
|| chunk_for(openfile->firstcolumn, openfile->edittop) <
|
||||
number_of_chunks_in(openfile->edittop)
|
||||
#endif
|
||||
)
|
||||
))
|
||||
edit_scroll(FORWARD);
|
||||
}
|
||||
#endif
|
||||
@@ -574,12 +567,12 @@ void do_scroll_down(void)
|
||||
/* Move left one character. */
|
||||
void do_left(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
if (openfile->current_x > 0)
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x = step_left(openfile->current->data,
|
||||
openfile->current_x);
|
||||
else if (openfile->current != openfile->fileage) {
|
||||
else if (openfile->current != openfile->filetop) {
|
||||
openfile->current = openfile->current->prev;
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
}
|
||||
@@ -590,10 +583,10 @@ void do_left(void)
|
||||
/* Move right one character. */
|
||||
void do_right(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
if (openfile->current->data[openfile->current_x] != '\0')
|
||||
openfile->current_x = move_mbright(openfile->current->data,
|
||||
openfile->current_x = step_right(openfile->current->data,
|
||||
openfile->current_x);
|
||||
else if (openfile->current != openfile->filebot) {
|
||||
openfile->current = openfile->current->next;
|
||||
|
||||
1300
src/nano.c
1300
src/nano.c
File diff suppressed because it is too large
Load Diff
191
src/nano.h
191
src/nano.h
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* nano.h -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -19,9 +19,6 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef NANO_H
|
||||
#define NANO_H 1
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@@ -59,11 +56,9 @@
|
||||
#define ISSET(flag) ((FLAGS(flag) & FLAGMASK(flag)) != 0)
|
||||
#define TOGGLE(flag) FLAGS(flag) ^= FLAGMASK(flag)
|
||||
|
||||
/* Macros for character allocation and more. */
|
||||
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
|
||||
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
|
||||
/* 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
|
||||
@@ -113,14 +108,11 @@
|
||||
#define N_(string) gettext_noop(string)
|
||||
/* Mark a string that will be sent to gettext() later. */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <regex.h>
|
||||
#include <signal.h>
|
||||
#include <assert.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. */
|
||||
@@ -147,10 +139,12 @@
|
||||
#define BAD_COLOR -2
|
||||
#endif
|
||||
|
||||
#define STANDARD_INPUT 0
|
||||
|
||||
/* Enumeration types. */
|
||||
typedef enum {
|
||||
NIX_FILE, DOS_FILE, MAC_FILE
|
||||
} file_format;
|
||||
} format_type;
|
||||
|
||||
typedef enum {
|
||||
HUSH, NOTICE, MILD, ALERT
|
||||
@@ -188,21 +182,14 @@ typedef struct colortype {
|
||||
/* This syntax's foreground color. */
|
||||
short bg;
|
||||
/* This syntax's background color. */
|
||||
int pairnum;
|
||||
/* The color pair number used for this foreground color and
|
||||
* background color. */
|
||||
short pairnum;
|
||||
/* The pair number for this foreground/background color combination. */
|
||||
int attributes;
|
||||
/* Pair number and brightness composed into ready-to-use attributes. */
|
||||
int rex_flags;
|
||||
/* The regex compilation flags (with or without REG_ICASE). */
|
||||
char *start_regex;
|
||||
/* The start (or all) of the regex string. */
|
||||
regex_t *start;
|
||||
/* The compiled start (or all) of the regex string. */
|
||||
char *end_regex;
|
||||
/* The end (if any) of the regex string. */
|
||||
/* The compiled regular expression for 'start=', or the only one. */
|
||||
regex_t *end;
|
||||
/* The compiled end (if any) of the regex string. */
|
||||
/* The compiled regular expression for 'end=', if any. */
|
||||
struct colortype *next;
|
||||
/* Next set of colors. */
|
||||
int id;
|
||||
@@ -216,9 +203,26 @@ typedef struct regexlisttype {
|
||||
/* The next regex. */
|
||||
} regexlisttype;
|
||||
|
||||
typedef struct augmentstruct {
|
||||
char *filename;
|
||||
/* The file where the syntax is extended. */
|
||||
ssize_t lineno;
|
||||
/* The number of the line of the extendsyntax command. */
|
||||
char *data;
|
||||
/* The text of the line. */
|
||||
struct augmentstruct *next;
|
||||
/* Next node. */
|
||||
} augmentstruct;
|
||||
|
||||
typedef struct syntaxtype {
|
||||
char *name;
|
||||
/* The name of this syntax. */
|
||||
char *filename;
|
||||
/* File where the syntax is defined, or NULL if not an included file. */
|
||||
size_t lineno;
|
||||
/* The line number where the 'syntax' command was found. */
|
||||
struct augmentstruct *augmentations;
|
||||
/* List of extendsyntax commands to apply when loaded. */
|
||||
regexlisttype *extensions;
|
||||
/* The list of extensions that this syntax applies to. */
|
||||
regexlisttype *headers;
|
||||
@@ -227,6 +231,10 @@ typedef struct syntaxtype {
|
||||
/* The list of libmagic results that this syntax applies to. */
|
||||
char *linter;
|
||||
/* The command with which to lint this type of file. */
|
||||
char *formatter;
|
||||
/* The command with which to format/modify/arrange this type of file. */
|
||||
char *tab;
|
||||
/* What the Tab key should produce; NULL for default behavior. */
|
||||
#ifdef ENABLE_COMMENT
|
||||
char *comment;
|
||||
/* The line comment prefix (and postfix) for this type of file. */
|
||||
@@ -270,79 +278,59 @@ typedef struct lintstruct {
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
/* More structure types. */
|
||||
typedef struct filestruct {
|
||||
typedef struct linestruct {
|
||||
char *data;
|
||||
/* The text of this line. */
|
||||
ssize_t lineno;
|
||||
/* The number of this line. */
|
||||
struct filestruct *next;
|
||||
struct linestruct *next;
|
||||
/* Next node. */
|
||||
struct filestruct *prev;
|
||||
struct linestruct *prev;
|
||||
/* Previous node. */
|
||||
#ifdef ENABLE_COLOR
|
||||
short *multidata;
|
||||
/* Array of which multi-line regexes apply to this line. */
|
||||
#endif
|
||||
} filestruct;
|
||||
|
||||
typedef struct partition {
|
||||
filestruct *fileage;
|
||||
/* The top line of this portion of the file. */
|
||||
filestruct *top_prev;
|
||||
/* The line before the top line of this portion of the file. */
|
||||
char *top_data;
|
||||
/* The text before the beginning of the top line of this portion
|
||||
* of the file. */
|
||||
filestruct *filebot;
|
||||
/* The bottom line of this portion of the file. */
|
||||
filestruct *bot_next;
|
||||
/* The line after the bottom line of this portion of the
|
||||
* file. */
|
||||
char *bot_data;
|
||||
/* The text after the end of the bottom line of this portion of
|
||||
* the file. */
|
||||
} partition;
|
||||
} linestruct;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
typedef struct undo_group {
|
||||
typedef struct groupstruct {
|
||||
ssize_t top_line;
|
||||
/* First line of group. */
|
||||
ssize_t bottom_line;
|
||||
/* Last line of group. */
|
||||
char **indentations;
|
||||
/* String data used to restore the affected lines; one per line. */
|
||||
struct undo_group *next;
|
||||
} undo_group;
|
||||
struct groupstruct *next;
|
||||
/* The next group, if any. */
|
||||
} groupstruct;
|
||||
|
||||
typedef struct undo {
|
||||
ssize_t lineno;
|
||||
typedef struct undostruct {
|
||||
undo_type type;
|
||||
/* What type of undo this was. */
|
||||
/* The operation type that this undo item is for. */
|
||||
int xflags;
|
||||
/* Some flag data to mark certain corner cases. */
|
||||
ssize_t lineno;
|
||||
/* The line number where the operation began or ended. */
|
||||
size_t begin;
|
||||
/* Where did this action begin or end. */
|
||||
/* The x position where the operation began or ended. */
|
||||
char *strdata;
|
||||
/* String type data we will use for copying the affected line back. */
|
||||
/* String data to help restore the affected line. */
|
||||
size_t wassize;
|
||||
/* The file size before the action. */
|
||||
size_t newsize;
|
||||
/* The file size after the action. */
|
||||
int xflags;
|
||||
/* Some flag data we need. */
|
||||
undo_group *grouping;
|
||||
groupstruct *grouping;
|
||||
/* Undo info specific to groups of lines. */
|
||||
|
||||
/* Cut-specific stuff we need. */
|
||||
filestruct *cutbuffer;
|
||||
/* Copy of the cutbuffer. */
|
||||
filestruct *cutbottom;
|
||||
/* Copy of cutbottom. */
|
||||
linestruct *cutbuffer;
|
||||
/* A copy of the cutbuffer. */
|
||||
ssize_t mark_begin_lineno;
|
||||
/* Mostly the line number of the current line; sometimes something else. */
|
||||
size_t mark_begin_x;
|
||||
/* The x position corresponding to the above line number. */
|
||||
struct undo *next;
|
||||
struct undostruct *next;
|
||||
/* A pointer to the undo item of the preceding action. */
|
||||
} undo;
|
||||
} undostruct;
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
@@ -352,21 +340,22 @@ typedef struct poshiststruct {
|
||||
ssize_t lineno;
|
||||
/* Line number we left off on. */
|
||||
ssize_t xno;
|
||||
/* x position in the file we left off on. */
|
||||
/* The x position in the file we left off on. */
|
||||
struct poshiststruct *next;
|
||||
/* The next item of position history. */
|
||||
} poshiststruct;
|
||||
#endif
|
||||
|
||||
typedef struct openfilestruct {
|
||||
char *filename;
|
||||
/* The file's name. */
|
||||
filestruct *fileage;
|
||||
linestruct *filetop;
|
||||
/* The file's first line. */
|
||||
filestruct *filebot;
|
||||
linestruct *filebot;
|
||||
/* The file's last line. */
|
||||
filestruct *edittop;
|
||||
linestruct *edittop;
|
||||
/* The current top of the edit window for this file. */
|
||||
filestruct *current;
|
||||
linestruct *current;
|
||||
/* The current line for this file. */
|
||||
size_t totsize;
|
||||
/* The file's total number of characters. */
|
||||
@@ -379,30 +368,34 @@ typedef struct openfilestruct {
|
||||
/* The file's x position we would like. */
|
||||
ssize_t current_y;
|
||||
/* The file's y-coordinate position. */
|
||||
bool modified;
|
||||
/* Whether the file has been modified. */
|
||||
struct stat *current_stat;
|
||||
/* The file's current stat information. */
|
||||
#ifdef ENABLE_WRAPPING
|
||||
linestruct *spillage_line;
|
||||
/* The line for prepending stuff to during automatic hard-wrapping. */
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
filestruct *mark;
|
||||
linestruct *mark;
|
||||
/* The line in the file where the mark is set; NULL if not set. */
|
||||
size_t mark_x;
|
||||
/* The mark's x position in the above line. */
|
||||
mark_type kind_of_mark;
|
||||
/* Whether it is a soft (with Shift) or a hard mark. */
|
||||
file_format fmt;
|
||||
format_type fmt;
|
||||
/* The file's format -- Unix or DOS or Mac or mixed. */
|
||||
undo *undotop;
|
||||
char *lock_filename;
|
||||
/* The path of the lockfile, if we created one. */
|
||||
undostruct *undotop;
|
||||
/* The top of the undo list. */
|
||||
undo *current_undo;
|
||||
undostruct *current_undo;
|
||||
/* The current (i.e. next) level of undo. */
|
||||
undo *last_saved;
|
||||
undostruct *last_saved;
|
||||
/* The undo item at which the file was last saved. */
|
||||
undo_type last_action;
|
||||
/* The type of the last action the user performed. */
|
||||
char *lock_filename;
|
||||
/* The path of the lockfile, if we created one. */
|
||||
#endif
|
||||
bool modified;
|
||||
/* Whether the file has been modified. */
|
||||
#ifdef ENABLE_COLOR
|
||||
syntaxtype *syntax;
|
||||
/* The syntax struct for this file, if any. */
|
||||
@@ -426,17 +419,17 @@ typedef struct rcoption {
|
||||
} rcoption;
|
||||
#endif
|
||||
|
||||
typedef struct sc {
|
||||
typedef struct keystruct {
|
||||
const char *keystr;
|
||||
/* The string that describes a keystroke, like "^C" or "M-R". */
|
||||
/* The string that describes the keystroke, like "^C" or "M-R". */
|
||||
bool meta;
|
||||
/* Whether this is a Meta keystroke. */
|
||||
int keycode;
|
||||
/* The integer that, together with meta, identifies the keystroke. */
|
||||
int menus;
|
||||
/* Which menus this applies to. */
|
||||
/* The menus in which this keystroke is bound. */
|
||||
void (*func)(void);
|
||||
/* The function we're going to run. */
|
||||
/* The function to which this keystroke is bound. */
|
||||
#ifndef NANO_TINY
|
||||
int toggle;
|
||||
/* If a toggle, what we're toggling. */
|
||||
@@ -448,11 +441,11 @@ typedef struct sc {
|
||||
char *expansion;
|
||||
/* The string of keycodes to which this shortcut is expanded. */
|
||||
#endif
|
||||
struct sc *next;
|
||||
struct keystruct *next;
|
||||
/* Next in the list. */
|
||||
} sc;
|
||||
} keystruct;
|
||||
|
||||
typedef struct subnfunc {
|
||||
typedef struct funcstruct {
|
||||
void (*func)(void);
|
||||
/* The actual function to call. */
|
||||
int menus;
|
||||
@@ -470,9 +463,9 @@ typedef struct subnfunc {
|
||||
/* Is this function allowed when in view mode? */
|
||||
long toggle;
|
||||
/* If this is a toggle, which toggle to affect. */
|
||||
struct subnfunc *next;
|
||||
struct funcstruct *next;
|
||||
/* Next item in the list. */
|
||||
} subnfunc;
|
||||
} funcstruct;
|
||||
|
||||
#ifdef ENABLE_WORDCOMPLETION
|
||||
typedef struct completion_word {
|
||||
@@ -486,6 +479,7 @@ enum
|
||||
{
|
||||
TITLE_BAR = 0,
|
||||
LINE_NUMBER,
|
||||
GUIDE_STRIPE,
|
||||
SELECTED_TEXT,
|
||||
STATUS_BAR,
|
||||
ERROR_MESSAGE,
|
||||
@@ -513,7 +507,7 @@ enum
|
||||
MULTIBUFFER,
|
||||
SMOOTH_SCROLL,
|
||||
REBIND_DELETE,
|
||||
REBIND_KEYPAD,
|
||||
RAW_SEQUENCES,
|
||||
NO_CONVERT,
|
||||
BACKUP_FILE,
|
||||
INSECURE_BACKUP,
|
||||
@@ -529,7 +523,6 @@ enum
|
||||
WORD_BOUNDS,
|
||||
NO_NEWLINES,
|
||||
BOLD_TEXT,
|
||||
QUIET,
|
||||
SOFTWRAP,
|
||||
POSITIONLOG,
|
||||
LOCKING,
|
||||
@@ -541,7 +534,10 @@ enum
|
||||
NO_PAUSES,
|
||||
AT_BLANKS,
|
||||
AFTER_ENDS,
|
||||
LET_THEM_ZAP
|
||||
LET_THEM_ZAP,
|
||||
BREAK_LONG_LINES,
|
||||
JUMPY_SCROLLING,
|
||||
EMPTY_LINE
|
||||
};
|
||||
|
||||
/* Flags for the menus in which a given function should be present. */
|
||||
@@ -571,6 +567,7 @@ enum
|
||||
#endif
|
||||
|
||||
/* Basic control codes. */
|
||||
#define BS_CODE 0x08
|
||||
#define TAB_CODE 0x09
|
||||
#define ESC_CODE 0x1B
|
||||
#define DEL_CODE 0x7F
|
||||
@@ -610,6 +607,9 @@ enum
|
||||
#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
|
||||
|
||||
#ifdef USE_SLANG
|
||||
#ifdef ENABLE_UTF8
|
||||
#define KEY_BAD 0xFF /* Clipped error code. */
|
||||
@@ -631,9 +631,6 @@ enum
|
||||
#define WAS_MARKED_FORWARD (1<<5)
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* The maximum number of entries displayed in the main shortcut list. */
|
||||
#define MAIN_VISIBLE (((COLS + 40) / 20) * 2)
|
||||
|
||||
/* The default number of columns from end of line where wrapping occurs. */
|
||||
#define COLUMNS_FROM_EOL 8
|
||||
|
||||
@@ -652,5 +649,3 @@ enum
|
||||
|
||||
/* The largest size_t number that doesn't have the high bit set. */
|
||||
#define HIGHEST_POSITIVE ((~(size_t)0) >> 1)
|
||||
|
||||
#endif /* !NANO_H */
|
||||
|
||||
149
src/prompt.c
149
src/prompt.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* prompt.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016, 2018 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -37,13 +37,13 @@ int do_statusbar_mouse(void)
|
||||
|
||||
/* We can click on the statusbar window text to move the cursor. */
|
||||
if (retval == 0 && wmouse_trafo(bottomwin, &click_row, &click_col, FALSE)) {
|
||||
size_t start_col = strlenpt(prompt) + 2;
|
||||
size_t start_col = breadth(prompt) + 2;
|
||||
|
||||
/* Move to where the click occurred. */
|
||||
if (click_row == 0 && click_col >= start_col)
|
||||
typing_x = actual_x(answer,
|
||||
get_statusbar_page_start(start_col, start_col +
|
||||
strnlenpt(answer, typing_x)) + click_col - start_col);
|
||||
wideness(answer, typing_x)) + click_col - start_col);
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -61,7 +61,7 @@ int do_statusbar_input(bool *finished)
|
||||
/* The input buffer. */
|
||||
static size_t kbinput_len = 0;
|
||||
/* The length of the input buffer. */
|
||||
const sc *shortcut;
|
||||
const keystruct *shortcut;
|
||||
|
||||
*finished = FALSE;
|
||||
|
||||
@@ -126,6 +126,11 @@ int do_statusbar_input(bool *finished)
|
||||
if (shortcut) {
|
||||
if (shortcut->func == do_tab || shortcut->func == do_enter)
|
||||
;
|
||||
#ifdef ENABLE_HISTORIES
|
||||
else if (shortcut->func == get_history_older_void ||
|
||||
shortcut->func == get_history_newer_void)
|
||||
;
|
||||
#endif
|
||||
else if (shortcut->func == do_left)
|
||||
do_statusbar_left();
|
||||
else if (shortcut->func == do_right)
|
||||
@@ -145,8 +150,8 @@ int do_statusbar_input(bool *finished)
|
||||
else if (ISSET(RESTRICTED) && currmenu == MWRITEFILE &&
|
||||
openfile->filename[0] != '\0' &&
|
||||
(shortcut->func == do_verbatim_input ||
|
||||
shortcut->func == do_cut_text_void ||
|
||||
shortcut->func == do_uncut_text ||
|
||||
shortcut->func == cut_text ||
|
||||
shortcut->func == paste_text ||
|
||||
shortcut->func == do_delete ||
|
||||
shortcut->func == do_backspace))
|
||||
;
|
||||
@@ -156,13 +161,13 @@ int do_statusbar_input(bool *finished)
|
||||
#endif
|
||||
else if (shortcut->func == do_verbatim_input)
|
||||
do_statusbar_verbatim_input();
|
||||
else if (shortcut->func == do_cut_text_void)
|
||||
else if (shortcut->func == cut_text)
|
||||
do_statusbar_cut_text();
|
||||
else if (shortcut->func == do_delete)
|
||||
do_statusbar_delete();
|
||||
else if (shortcut->func == do_backspace)
|
||||
do_statusbar_backspace();
|
||||
else if (shortcut->func == do_uncut_text) {
|
||||
else if (shortcut->func == paste_text) {
|
||||
if (cutbuffer != NULL)
|
||||
do_statusbar_uncut_text();
|
||||
} else {
|
||||
@@ -185,7 +190,7 @@ void do_statusbar_output(int *the_input, size_t input_len,
|
||||
{
|
||||
char *output = charalloc(input_len + 1);
|
||||
char onechar[MAXCHARLEN];
|
||||
size_t char_len, i, j = 0;
|
||||
size_t charlen, i, j = 0;
|
||||
|
||||
/* Copy the typed stuff so it can be treated. */
|
||||
for (i = 0; i < input_len; i++)
|
||||
@@ -198,21 +203,21 @@ void do_statusbar_output(int *the_input, size_t input_len,
|
||||
output[j] = '\n';
|
||||
|
||||
/* Interpret the next multibyte character. */
|
||||
char_len = parse_mbchar(output + j, onechar, NULL);
|
||||
charlen = collect_char(output + j, onechar);
|
||||
|
||||
j += char_len;
|
||||
j += charlen;
|
||||
|
||||
/* When filtering, skip any ASCII control character. */
|
||||
if (filtering && is_ascii_cntrl_char(*(output + j - char_len)))
|
||||
if (filtering && is_ascii_cntrl_char(*(output + j - charlen)))
|
||||
continue;
|
||||
|
||||
/* Insert the typed character into the existing answer string. */
|
||||
answer = charealloc(answer, strlen(answer) + char_len + 1);
|
||||
charmove(answer + typing_x + char_len, answer + typing_x,
|
||||
answer = charealloc(answer, strlen(answer) + charlen + 1);
|
||||
memmove(answer + typing_x + charlen, answer + typing_x,
|
||||
strlen(answer) - typing_x + 1);
|
||||
strncpy(answer + typing_x, onechar, char_len);
|
||||
strncpy(answer + typing_x, onechar, charlen);
|
||||
|
||||
typing_x += char_len;
|
||||
typing_x += charlen;
|
||||
}
|
||||
|
||||
free(output);
|
||||
@@ -234,24 +239,24 @@ void do_statusbar_end(void)
|
||||
void do_statusbar_left(void)
|
||||
{
|
||||
if (typing_x > 0)
|
||||
typing_x = move_mbleft(answer, typing_x);
|
||||
typing_x = step_left(answer, typing_x);
|
||||
}
|
||||
|
||||
/* Move right one character. */
|
||||
void do_statusbar_right(void)
|
||||
{
|
||||
if (answer[typing_x] != '\0')
|
||||
typing_x = move_mbright(answer, typing_x);
|
||||
typing_x = step_right(answer, typing_x);
|
||||
}
|
||||
|
||||
/* Delete one character. */
|
||||
void do_statusbar_delete(void)
|
||||
{
|
||||
if (answer[typing_x] != '\0') {
|
||||
int char_len = parse_mbchar(answer + typing_x, NULL, NULL);
|
||||
int charlen = char_length(answer + typing_x);
|
||||
|
||||
charmove(answer + typing_x, answer + typing_x + char_len,
|
||||
strlen(answer) - typing_x - char_len + 1);
|
||||
memmove(answer + typing_x, answer + typing_x + charlen,
|
||||
strlen(answer) - typing_x - charlen + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +264,7 @@ void do_statusbar_delete(void)
|
||||
void do_statusbar_backspace(void)
|
||||
{
|
||||
if (typing_x > 0) {
|
||||
typing_x = move_mbleft(answer, typing_x);
|
||||
typing_x = step_left(answer, typing_x);
|
||||
do_statusbar_delete();
|
||||
}
|
||||
}
|
||||
@@ -283,7 +288,7 @@ void do_statusbar_next_word(void)
|
||||
/* Move forward until we reach either the end or the start of a word,
|
||||
* depending on whether the AFTER_ENDS flag is set or not. */
|
||||
while (answer[typing_x] != '\0') {
|
||||
typing_x = move_mbright(answer, typing_x);
|
||||
typing_x = step_right(answer, typing_x);
|
||||
|
||||
if (ISSET(AFTER_ENDS)) {
|
||||
/* If this is a word character, continue; else it's a separator,
|
||||
@@ -310,7 +315,7 @@ void do_statusbar_prev_word(void)
|
||||
|
||||
/* Move backward until we pass over the start of a word. */
|
||||
while (typing_x != 0) {
|
||||
typing_x = move_mbleft(answer, typing_x);
|
||||
typing_x = step_left(answer, typing_x);
|
||||
|
||||
if (is_word_mbchar(answer + typing_x, FALSE))
|
||||
seen_a_word = TRUE;
|
||||
@@ -323,7 +328,7 @@ void do_statusbar_prev_word(void)
|
||||
|
||||
if (step_forward)
|
||||
/* Move one character forward again to sit on the start of the word. */
|
||||
typing_x = move_mbright(answer, typing_x);
|
||||
typing_x = step_right(answer, typing_x);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -380,26 +385,27 @@ void put_cursor_at_end_of_answer(void)
|
||||
/* Redraw the promptbar and place the cursor at the right spot. */
|
||||
void draw_the_promptbar(void)
|
||||
{
|
||||
size_t base = strlenpt(prompt) + 2;
|
||||
size_t base = breadth(prompt) + 2;
|
||||
size_t the_page, end_page, column;
|
||||
char *expanded;
|
||||
|
||||
the_page = get_statusbar_page_start(base, base + strnlenpt(answer, typing_x));
|
||||
end_page = get_statusbar_page_start(base, base + strlenpt(answer) - 1);
|
||||
the_page = get_statusbar_page_start(base, base + wideness(answer, typing_x));
|
||||
end_page = get_statusbar_page_start(base, base + breadth(answer) - 1);
|
||||
|
||||
/* Color the promptbar over its full width. */
|
||||
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
blank_statusbar();
|
||||
mvwprintw(bottomwin, 0, 0, "%*s", COLS, " ");
|
||||
|
||||
mvwaddstr(bottomwin, 0, 0, prompt);
|
||||
waddch(bottomwin, ':');
|
||||
waddch(bottomwin, (the_page == 0) ? ' ' : '<');
|
||||
|
||||
expanded = display_string(answer, the_page, COLS - base - 1, FALSE);
|
||||
expanded = display_string(answer, the_page, COLS - base, FALSE, TRUE);
|
||||
waddstr(bottomwin, expanded);
|
||||
free(expanded);
|
||||
|
||||
waddch(bottomwin, (the_page >= end_page) ? ' ' : '>');
|
||||
if (base + breadth(answer) != COLS && the_page < end_page)
|
||||
mvwaddch(bottomwin, 0, COLS - 1, '>');
|
||||
|
||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
|
||||
@@ -408,7 +414,7 @@ void draw_the_promptbar(void)
|
||||
wrefresh(bottomwin);
|
||||
|
||||
/* Place the cursor at the right spot. */
|
||||
column = base + strnlenpt(answer, typing_x);
|
||||
column = base + wideness(answer, typing_x);
|
||||
wmove(bottomwin, 0, column - get_statusbar_page_start(base, column));
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
@@ -418,12 +424,12 @@ void draw_the_promptbar(void)
|
||||
void add_or_remove_pipe_symbol_from_answer(void)
|
||||
{
|
||||
if (answer[0] == '|') {
|
||||
charmove(answer, answer + 1, strlen(answer) + 1);
|
||||
memmove(answer, answer + 1, strlen(answer) + 1);
|
||||
if (typing_x > 0)
|
||||
typing_x--;
|
||||
} else {
|
||||
answer = charealloc(answer, strlen(answer) + 2);
|
||||
charmove(answer + 1, answer, strlen(answer) + 1);
|
||||
memmove(answer + 1, answer, strlen(answer) + 1);
|
||||
answer[0] = '|';
|
||||
typing_x++;
|
||||
}
|
||||
@@ -432,7 +438,7 @@ void add_or_remove_pipe_symbol_from_answer(void)
|
||||
|
||||
/* Get a string of input at the statusbar prompt. */
|
||||
functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
bool allow_files, bool *listed, filestruct **history_list,
|
||||
bool allow_files, bool *listed, linestruct **history_list,
|
||||
void (*refresh_func)(void))
|
||||
{
|
||||
int kbinput = ERR;
|
||||
@@ -517,12 +523,6 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
answer = mallocstrcpy(answer, history);
|
||||
typing_x = strlen(answer);
|
||||
}
|
||||
|
||||
/* This key has a shortcut-list entry when it's used to
|
||||
* move to an older search, which means that finished has
|
||||
* been set to TRUE. Set it back to FALSE here, so that
|
||||
* we aren't kicked out of the statusbar prompt. */
|
||||
finished = FALSE;
|
||||
}
|
||||
} else if (func == get_history_newer_void) {
|
||||
if (history_list != NULL) {
|
||||
@@ -540,12 +540,6 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
answer = mallocstrcpy(answer, magichistory);
|
||||
typing_x = strlen(answer);
|
||||
}
|
||||
|
||||
/* This key has a shortcut-list entry when it's used to
|
||||
* move to a newer search, which means that finished has
|
||||
* been set to TRUE. Set it back to FALSE here, so that
|
||||
* we aren't kicked out of the statusbar prompt. */
|
||||
finished = FALSE;
|
||||
}
|
||||
} else
|
||||
#endif /* ENABLE_HISTORIES */
|
||||
@@ -581,19 +575,16 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
return func;
|
||||
}
|
||||
|
||||
/* Ask a question on the statusbar. The prompt will be stored in the
|
||||
* static prompt, which should be NULL initially, and the answer will be
|
||||
* stored in the answer global. Returns -1 on aborted enter, -2 on a
|
||||
* blank string, and 0 otherwise, the valid shortcut key caught.
|
||||
* curranswer is any editable text that we want to put up by default,
|
||||
* and refresh_func is the function we want to call to refresh the edit
|
||||
* window.
|
||||
/* Ask a question on the statusbar. Return 0 when text was entered,
|
||||
* -1 for a cancelled entry, -2 for a blank string, and the relevant
|
||||
* keycode when a valid shortcut key was pressed.
|
||||
*
|
||||
* The allow_tabs parameter indicates whether we should allow tabs to be
|
||||
* interpreted. The allow_files parameter indicates whether we should
|
||||
* allow all files (as opposed to just directories) to be tab completed. */
|
||||
* The allow_tabs parameter indicates whether tab completion is allowed,
|
||||
* and allow_files indicates whether all files (and not just directories)
|
||||
* can be tab completed. The 'provided' parameter is the default answer
|
||||
* for when simply Enter is typed. */
|
||||
int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int menu, const char *curranswer, filestruct **history_list,
|
||||
int menu, const char *provided, linestruct **history_list,
|
||||
void (*refresh_func)(void), const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -606,8 +597,8 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
|
||||
bottombars(menu);
|
||||
|
||||
if (answer != curranswer || answer == NULL)
|
||||
answer = mallocstrcpy(answer, curranswer);
|
||||
if (answer != provided)
|
||||
answer = mallocstrcpy(answer, provided);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
redo_theprompt:
|
||||
@@ -658,7 +649,7 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
* TRUE when passed in), and -1 for Cancel. */
|
||||
int do_yesno_prompt(bool all, const char *msg)
|
||||
{
|
||||
int response = -2, width = 16;
|
||||
int choice = -2, width = 16;
|
||||
/* TRANSLATORS: For the next three strings, specify the starting letters
|
||||
* 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. */
|
||||
@@ -666,7 +657,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
const char *nostr = _("Nn");
|
||||
const char *allstr = _("Aa");
|
||||
|
||||
while (response == -2) {
|
||||
while (choice == -2) {
|
||||
#ifdef ENABLE_NLS
|
||||
char letter[MAXCHARLEN + 1];
|
||||
int index = 0;
|
||||
@@ -676,7 +667,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
if (!ISSET(NO_HELP)) {
|
||||
char shortstr[MAXCHARLEN + 2];
|
||||
/* Temporary string for (translated) " Y", " N" and " A". */
|
||||
const sc *cancelshortcut = first_sc_for(MYESNO, do_cancel);
|
||||
const keystruct *cancelshortcut = first_sc_for(MYESNO, do_cancel);
|
||||
/* The keystroke that is bound to the Cancel function. */
|
||||
|
||||
if (COLS < 32)
|
||||
@@ -704,9 +695,9 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
post_one_key(cancelshortcut->keystr, _("Cancel"), width);
|
||||
}
|
||||
|
||||
/* Color the statusbar over its full width and display the question. */
|
||||
/* Color the promptbar over its full width and display the question. */
|
||||
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
blank_statusbar();
|
||||
mvwprintw(bottomwin, 0, 0, "%*s", COLS, " ");
|
||||
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
wnoutrefresh(bottomwin);
|
||||
@@ -732,21 +723,27 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
|
||||
/* See if the typed letter is in the Yes, No, or All strings. */
|
||||
if (strstr(yesstr, letter) != NULL)
|
||||
response = 1;
|
||||
choice = 1;
|
||||
else if (strstr(nostr, letter) != NULL)
|
||||
response = 0;
|
||||
choice = 0;
|
||||
else if (all && strstr(allstr, letter) != NULL)
|
||||
response = 2;
|
||||
choice = 2;
|
||||
else
|
||||
#endif /* ENABLE_NLS */
|
||||
if (strchr("Yy", kbinput) != NULL)
|
||||
response = 1;
|
||||
choice = 1;
|
||||
else if (strchr("Nn", kbinput) != NULL)
|
||||
response = 0;
|
||||
choice = 0;
|
||||
else if (all && strchr("Aa", kbinput) != NULL)
|
||||
response = 2;
|
||||
choice = 2;
|
||||
else if (func_from_key(&kbinput) == do_cancel)
|
||||
response = -1;
|
||||
choice = -1;
|
||||
/* Interpret ^N and ^Q as "No", to allow exiting in anger. */
|
||||
else if (kbinput == '\x0E' || kbinput == '\x11')
|
||||
choice = 0;
|
||||
/* And interpret ^Y as "Yes". */
|
||||
else if (kbinput == '\x19')
|
||||
choice = 1;
|
||||
#ifdef ENABLE_MOUSE
|
||||
else if (kbinput == KEY_MOUSE) {
|
||||
int mouse_x, mouse_y;
|
||||
@@ -758,14 +755,14 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
int y = mouse_y - 1;
|
||||
|
||||
/* x == 0 means Yes or No, y == 0 means Yes or All. */
|
||||
response = -2 * x * y + x - y + 1;
|
||||
choice = -2 * x * y + x - y + 1;
|
||||
|
||||
if (response == 2 && !all)
|
||||
response = -2;
|
||||
if (choice == 2 && !all)
|
||||
choice = -2;
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_MOUSE */
|
||||
}
|
||||
|
||||
return response;
|
||||
return choice;
|
||||
}
|
||||
|
||||
278
src/proto.h
278
src/proto.h
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* proto.h -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -18,9 +18,6 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef PROTO_H
|
||||
#define PROTO_H 1
|
||||
|
||||
#include "nano.h"
|
||||
|
||||
/* All external variables. See global.c for their descriptions. */
|
||||
@@ -29,9 +26,7 @@
|
||||
extern volatile sig_atomic_t the_window_resized;
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
extern bool on_a_vt;
|
||||
#endif
|
||||
|
||||
extern bool meta_key;
|
||||
extern bool shift_held;
|
||||
@@ -40,11 +35,15 @@ extern bool focusing;
|
||||
|
||||
extern bool as_an_at;
|
||||
|
||||
extern bool control_C_was_pressed;
|
||||
|
||||
extern bool suppress_cursorpos;
|
||||
|
||||
extern bool started_curses;
|
||||
|
||||
extern message_type lastmessage;
|
||||
|
||||
extern filestruct *pletion_line;
|
||||
extern linestruct *pletion_line;
|
||||
|
||||
extern bool inhelp;
|
||||
extern char *title;
|
||||
@@ -53,6 +52,8 @@ extern bool more_than_one;
|
||||
|
||||
extern bool also_the_last;
|
||||
|
||||
extern bool is_shorter;
|
||||
|
||||
extern int didfind;
|
||||
|
||||
extern int controlleft, controlright;
|
||||
@@ -73,7 +74,8 @@ extern int shiftaltup, shiftaltdown;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
extern ssize_t wrap_at, fill;
|
||||
extern ssize_t fill;
|
||||
extern size_t wrap_at;
|
||||
#endif
|
||||
|
||||
extern char *last_search;
|
||||
@@ -88,30 +90,32 @@ extern WINDOW *bottomwin;
|
||||
extern int editwinrows;
|
||||
extern int editwincols;
|
||||
extern int margin;
|
||||
#ifndef NANO_TINY
|
||||
extern ssize_t stripe_column;
|
||||
#endif
|
||||
|
||||
extern linestruct *cutbuffer;
|
||||
extern linestruct *cutbottom;
|
||||
extern bool keep_cutbuffer;
|
||||
|
||||
extern filestruct *cutbuffer;
|
||||
extern filestruct *cutbottom;
|
||||
extern partition *filepart;
|
||||
extern openfilestruct *openfile;
|
||||
extern openfilestruct *firstfile;
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
extern openfilestruct *startfile;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
extern char *matchbrackets;
|
||||
extern char *whitespace;
|
||||
extern int whitespace_len[2];
|
||||
extern int whitelen[2];
|
||||
#endif
|
||||
|
||||
extern const char *exit_tag;
|
||||
extern const char *close_tag;
|
||||
extern const char *uncut_tag;
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
extern const char *unjust_tag;
|
||||
extern char *punct;
|
||||
extern char *brackets;
|
||||
extern char *quotestr;
|
||||
extern regex_t quotereg;
|
||||
extern int quoterc;
|
||||
extern char *quoteerr;
|
||||
#endif
|
||||
|
||||
extern char *word_chars;
|
||||
@@ -142,22 +146,20 @@ extern bool have_palette;
|
||||
extern bool refresh_needed;
|
||||
|
||||
extern int currmenu;
|
||||
extern sc *sclist;
|
||||
extern subnfunc *allfuncs;
|
||||
extern subnfunc *exitfunc;
|
||||
extern subnfunc *uncutfunc;
|
||||
extern keystruct *sclist;
|
||||
extern funcstruct *allfuncs;
|
||||
extern funcstruct *exitfunc;
|
||||
|
||||
extern filestruct *search_history;
|
||||
extern filestruct *replace_history;
|
||||
extern filestruct *execute_history;
|
||||
extern linestruct *search_history;
|
||||
extern linestruct *replace_history;
|
||||
extern linestruct *execute_history;
|
||||
#ifdef ENABLE_HISTORIES
|
||||
extern filestruct *searchtop;
|
||||
extern filestruct *searchbot;
|
||||
extern filestruct *replacetop;
|
||||
extern filestruct *replacebot;
|
||||
extern filestruct *executetop;
|
||||
extern filestruct *executebot;
|
||||
extern poshiststruct *position_history;
|
||||
extern linestruct *searchtop;
|
||||
extern linestruct *searchbot;
|
||||
extern linestruct *replacetop;
|
||||
extern linestruct *replacebot;
|
||||
extern linestruct *executetop;
|
||||
extern linestruct *executebot;
|
||||
#endif
|
||||
|
||||
extern regex_t search_regexp;
|
||||
@@ -171,8 +173,8 @@ extern int interface_color_pair[NUMBER_OF_ELEMENTS];
|
||||
|
||||
extern char *homedir;
|
||||
extern char *statedir;
|
||||
#ifdef ENABLE_NANORC
|
||||
extern char *rcfile_with_errors;
|
||||
#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
|
||||
extern char *startup_problem;
|
||||
#endif
|
||||
|
||||
extern bool spotlighted;
|
||||
@@ -208,18 +210,21 @@ bool is_ascii_cntrl_char(int c);
|
||||
bool is_cntrl_mbchar(const char *c);
|
||||
bool is_word_mbchar(const char *c, bool allow_punct);
|
||||
char control_mbrep(const char *c, bool isdata);
|
||||
int length_of_char(const char *c, int *width);
|
||||
#ifdef ENABLE_UTF8
|
||||
int mbwidth(const char *c);
|
||||
#endif
|
||||
char *make_mbchar(long chr, int *chr_mb_len);
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col);
|
||||
size_t move_mbleft(const char *buf, size_t pos);
|
||||
size_t move_mbright(const char *buf, size_t pos);
|
||||
int char_length(const char *pointer);
|
||||
size_t mbstrlen(const char *s);
|
||||
int collect_char(const char *buf, char *chr);
|
||||
int advance_over(const char *string, size_t *column);
|
||||
size_t step_left(const char *buf, size_t pos);
|
||||
size_t step_right(const char *buf, size_t pos);
|
||||
int mbstrcasecmp(const char *s1, const char *s2);
|
||||
int mbstrncasecmp(const char *s1, const char *s2, size_t n);
|
||||
char *mbstrcasestr(const char *haystack, const char *needle);
|
||||
char *revstrstr(const char *haystack, const char *needle, const char *index);
|
||||
char *mbrevstrcasestr(const char *haystack, const char *needle, const char *index);
|
||||
size_t mbstrlen(const char *s);
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
|
||||
char *mbstrchr(const char *s, const char *c);
|
||||
#endif
|
||||
@@ -229,8 +234,9 @@ char *revstrpbrk(const char *head, const char *accept, const char *index);
|
||||
char *mbrevstrpbrk(const char *head, const char *accept, const char *index);
|
||||
#endif
|
||||
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || defined(ENABLE_JUSTIFY))
|
||||
bool has_blank_mbchars(const char *s);
|
||||
bool has_blank_char(const char *s);
|
||||
#endif
|
||||
bool white_string(const char *s);
|
||||
#ifdef ENABLE_UTF8
|
||||
bool is_valid_unicode(wchar_t wc);
|
||||
#endif
|
||||
@@ -240,44 +246,46 @@ bool is_valid_unicode(wchar_t wc);
|
||||
void set_colorpairs(void);
|
||||
void color_init(void);
|
||||
void color_update(void);
|
||||
void check_the_multis(filestruct *line);
|
||||
void alloc_multidata_if_needed(filestruct *fileptr);
|
||||
void set_up_multicache(linestruct *line);
|
||||
void check_the_multis(linestruct *line);
|
||||
void precalc_multicolorinfo(void);
|
||||
#endif
|
||||
|
||||
/* Most functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
void do_delete(void);
|
||||
void do_backspace(void);
|
||||
#ifndef NANO_TINY
|
||||
void chop_previous_word(void);
|
||||
void chop_next_word(void);
|
||||
void cut_marked(bool *right_side_up);
|
||||
#endif
|
||||
void do_cut_text(bool copy_text, bool marked, bool cut_till_eof, bool append);
|
||||
void do_cut_text_void(void);
|
||||
void do_snip(bool copying, bool marked, bool until_eof, bool append);
|
||||
bool is_cuttable(bool test_cliff);
|
||||
void cut_text(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_copy_text(void);
|
||||
void do_cut_till_eof(void);
|
||||
void copy_text(void);
|
||||
void cut_till_eof(void);
|
||||
void zap_text(void);
|
||||
#endif
|
||||
void do_uncut_text(void);
|
||||
void paste_text(void);
|
||||
|
||||
/* Most functions in files.c. */
|
||||
void initialize_buffer_text(void);
|
||||
void make_new_buffer(void);
|
||||
void set_modified(void);
|
||||
bool open_buffer(const char *filename, bool new_buffer);
|
||||
#ifdef ENABLE_SPELLER
|
||||
void replace_buffer(const char *filename);
|
||||
#ifndef NANO_TINY
|
||||
void replace_marked_buffer(const char *filename);
|
||||
#endif
|
||||
bool replace_buffer(const char *filename, undo_type action, bool marked,
|
||||
const char *operation);
|
||||
#endif
|
||||
void prepare_for_display(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void mention_name_and_linecount(void);
|
||||
void switch_to_prev_buffer(void);
|
||||
void switch_to_next_buffer(void);
|
||||
bool close_buffer(void);
|
||||
void close_buffer(void);
|
||||
#endif
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable);
|
||||
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
void do_insertfile_void(void);
|
||||
char *get_full_path(const char *origpath);
|
||||
@@ -311,25 +319,24 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
#endif
|
||||
|
||||
/* Some functions in global.c. */
|
||||
size_t length_of_list(int menu);
|
||||
const sc *first_sc_for(int menu, void (*func)(void));
|
||||
const keystruct *first_sc_for(int menu, void (*func)(void));
|
||||
int the_code_for(void (*func)(void), int defaultval);
|
||||
size_t shown_entries_for(int menu);
|
||||
const keystruct *get_shortcut(int *kbinput);
|
||||
functionptrtype func_from_key(int *kbinput);
|
||||
int keycode_from_string(const char *keystring);
|
||||
void assign_keyinfo(sc *s, const char *keystring, const int keycode);
|
||||
void print_sclist(void);
|
||||
void assign_keyinfo(keystruct *s, const char *keystring, const int keycode);
|
||||
void shortcut_init(void);
|
||||
const subnfunc *sctofunc(const sc *s);
|
||||
const char *flagtostr(int flag);
|
||||
#ifdef ENABLE_NANORC
|
||||
sc *strtosc(const char *input);
|
||||
keystruct *strtosc(const char *input);
|
||||
int name_to_menu(const char *name);
|
||||
char *menu_to_name(int menu);
|
||||
#endif
|
||||
|
||||
/* All functions in help.c. */
|
||||
#ifdef ENABLE_HELP
|
||||
void wrap_the_help_text(bool redisplaying);
|
||||
void wrap_help_text_into_buffer(void);
|
||||
void do_help(void);
|
||||
void help_init(void);
|
||||
functionptrtype parse_help_input(int *kbinput);
|
||||
@@ -340,14 +347,14 @@ void do_help_void(void);
|
||||
/* Most functions in history.c. */
|
||||
#ifdef ENABLE_HISTORIES
|
||||
void history_init(void);
|
||||
void history_reset(const filestruct *h);
|
||||
void update_history(filestruct **h, const char *s);
|
||||
char *get_history_older(filestruct **h);
|
||||
char *get_history_newer(filestruct **h);
|
||||
void history_reset(const linestruct *h);
|
||||
void update_history(linestruct **h, const char *s);
|
||||
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
|
||||
char *get_history_completion(filestruct **h, char *s, size_t len);
|
||||
char *get_history_completion(linestruct **h, char *s, size_t len);
|
||||
#endif
|
||||
bool have_statedir(void);
|
||||
void load_history(void);
|
||||
@@ -363,8 +370,8 @@ void to_last_line(void);
|
||||
void do_page_up(void);
|
||||
void do_page_down(void);
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
void do_para_begin(void);
|
||||
void do_para_end(void);
|
||||
void do_para_begin(linestruct **line);
|
||||
void do_para_end(linestruct **line);
|
||||
void do_para_begin_void(void);
|
||||
void do_para_end_void(void);
|
||||
#endif
|
||||
@@ -386,26 +393,21 @@ void do_left(void);
|
||||
void do_right(void);
|
||||
|
||||
/* Most functions in nano.c. */
|
||||
filestruct *make_new_node(filestruct *prevnode);
|
||||
void splice_node(filestruct *afterthis, filestruct *newnode);
|
||||
void unlink_node(filestruct *fileptr);
|
||||
void delete_node(filestruct *fileptr);
|
||||
filestruct *copy_filestruct(const filestruct *src);
|
||||
void free_filestruct(filestruct *src);
|
||||
void renumber(filestruct *line);
|
||||
partition *partition_filestruct(filestruct *top, size_t top_x,
|
||||
filestruct *bot, size_t bot_x);
|
||||
void unpartition_filestruct(partition **p);
|
||||
void extract_buffer(filestruct **file_top, filestruct **file_bot,
|
||||
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
|
||||
void ingraft_buffer(filestruct *somebuffer);
|
||||
void copy_from_buffer(filestruct *somebuffer);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void unlink_opennode(openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
#endif
|
||||
linestruct *make_new_node(linestruct *prevnode);
|
||||
void splice_node(linestruct *afterthis, linestruct *newnode);
|
||||
void unlink_node(linestruct *fileptr);
|
||||
void delete_node(linestruct *fileptr);
|
||||
linestruct *copy_buffer(const linestruct *src);
|
||||
void free_lines(linestruct *src);
|
||||
void renumber_from(linestruct *line);
|
||||
void partition_buffer(linestruct *top, size_t top_x,
|
||||
linestruct *bot, size_t bot_x);
|
||||
void unpartition_buffer(void);
|
||||
void extract(linestruct *top, size_t top_x, linestruct *bot, size_t bot_x);
|
||||
void ingraft_buffer(linestruct *somebuffer);
|
||||
void copy_from_buffer(linestruct *somebuffer);
|
||||
void print_view_warning(void);
|
||||
void show_restricted_warning(void);
|
||||
bool in_restricted_mode(void);
|
||||
#ifndef ENABLE_HELP
|
||||
void say_there_is_no_help(void);
|
||||
#endif
|
||||
@@ -415,18 +417,25 @@ void emergency_save(const char *die_filename, struct stat *die_stat);
|
||||
void window_init(void);
|
||||
void do_exit(void);
|
||||
void close_and_go(void);
|
||||
void install_handler_for_Ctrl_C(void);
|
||||
void restore_handler_for_Ctrl_C(void);
|
||||
void reconnect_and_store_state(void);
|
||||
RETSIGTYPE handle_hupterm(int signal);
|
||||
#ifndef DEBUG
|
||||
RETSIGTYPE handle_crash(int signal);
|
||||
#endif
|
||||
RETSIGTYPE do_suspend(int signal);
|
||||
RETSIGTYPE do_continue(int signal);
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER)
|
||||
void block_sigwinch(bool blockit);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
RETSIGTYPE handle_sigwinch(int signal);
|
||||
void regenerate_screen(void);
|
||||
void do_toggle(int flag);
|
||||
void enable_signals(void);
|
||||
#endif
|
||||
void disable_kb_interrupt(void);
|
||||
void enable_kb_interrupt(void);
|
||||
void disable_flow_control(void);
|
||||
void enable_flow_control(void);
|
||||
void terminal_init(void);
|
||||
@@ -434,8 +443,7 @@ void terminal_init(void);
|
||||
void confirm_margin(void);
|
||||
#endif
|
||||
void unbound_key(int code);
|
||||
bool okay_for_view(const sc *shortcut);
|
||||
int do_input(bool allow_funcs);
|
||||
bool okay_for_view(const keystruct *shortcut);
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls);
|
||||
|
||||
/* Most functions in prompt.c. */
|
||||
@@ -457,23 +465,30 @@ size_t get_statusbar_page_start(size_t start_col, size_t column);
|
||||
void put_cursor_at_end_of_answer(void);
|
||||
void add_or_remove_pipe_symbol_from_answer(void);
|
||||
int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int menu, const char *curranswer, filestruct **history_list,
|
||||
int menu, const char *curranswer, linestruct **history_list,
|
||||
void (*refresh_func)(void), const char *msg, ...);
|
||||
int do_yesno_prompt(bool all, const char *msg);
|
||||
|
||||
/* Most functions in rcfile.c. */
|
||||
#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
|
||||
void display_rcfile_errors(void);
|
||||
void jot_error(const char *msg, ...);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifdef ENABLE_COLOR
|
||||
void parse_one_include(char *file, syntaxtype *syntax);
|
||||
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
|
||||
bool parse_syntax_commands(char *keyword, char *ptr);
|
||||
#endif
|
||||
void parse_rcfile(FILE *rcstream, bool syntax_only);
|
||||
void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only);
|
||||
void do_rcfiles(void);
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* Most functions in search.c. */
|
||||
bool regexp_init(const char *regexp);
|
||||
void tidy_up_after_search(void);
|
||||
int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x);
|
||||
size_t *match_len, bool skipone, const linestruct *begin, size_t begin_x);
|
||||
void do_search(void);
|
||||
void do_search_forward(void);
|
||||
void do_search_backward(void);
|
||||
@@ -482,7 +497,7 @@ void do_findnext(void);
|
||||
void not_found_msg(const char *str);
|
||||
void go_looking(void);
|
||||
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
const filestruct *real_current, size_t *real_current_x);
|
||||
const linestruct *real_current, size_t *real_current_x);
|
||||
void do_replace(void);
|
||||
void ask_for_replacement(void);
|
||||
void goto_line_posx(ssize_t line, size_t pos_x);
|
||||
@@ -497,18 +512,11 @@ void do_find_bracket(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_mark(void);
|
||||
#endif
|
||||
void do_delete(void);
|
||||
void do_backspace(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_cut_prev_word(void);
|
||||
void do_cut_next_word(void);
|
||||
#endif
|
||||
void do_tab(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_indent(void);
|
||||
void do_unindent(void);
|
||||
#endif
|
||||
bool white_string(const char *s);
|
||||
#ifdef ENABLE_COMMENT
|
||||
void do_comment(void);
|
||||
#endif
|
||||
@@ -518,14 +526,13 @@ void do_enter(void);
|
||||
#ifndef NANO_TINY
|
||||
RETSIGTYPE cancel_command(int signal);
|
||||
bool execute_command(const char *command);
|
||||
void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep);
|
||||
void add_undo(undo_type action);
|
||||
void discard_until(const undostruct *thisitem, openfilestruct *thefile, bool keep);
|
||||
void add_undo(undo_type action, const char *message);
|
||||
void update_multiline_undo(ssize_t lineno, char *indentation);
|
||||
void update_undo(undo_type action);
|
||||
#endif /* !NANO_TINY */
|
||||
#ifdef ENABLE_WRAPPING
|
||||
void wrap_reset(void);
|
||||
bool do_wrap(filestruct *line);
|
||||
bool do_wrap(void);
|
||||
#endif
|
||||
#if defined(ENABLE_HELP) || defined(ENABLED_WRAPORJUSTIFY)
|
||||
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
|
||||
@@ -534,9 +541,9 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
|
||||
size_t indent_length(const char *line);
|
||||
#endif
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
void justify_format(filestruct *paragraph, size_t skip);
|
||||
bool begpar(const filestruct *const foo, int depth);
|
||||
bool inpar(const filestruct *const foo);
|
||||
size_t quote_length(const char *line);
|
||||
bool begpar(const linestruct *const foo, int depth);
|
||||
bool inpar(const linestruct *const foo);
|
||||
void do_justify(bool full_justify);
|
||||
void do_justify_void(void);
|
||||
void do_full_justify(void);
|
||||
@@ -546,6 +553,7 @@ void do_spell(void);
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
void do_linter(void);
|
||||
void do_formatter(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void do_wordlinechar_count(void);
|
||||
@@ -562,42 +570,39 @@ int digits(ssize_t n);
|
||||
#endif
|
||||
bool parse_num(const char *str, ssize_t *val);
|
||||
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
|
||||
void snuggly_fit(char **str);
|
||||
void null_at(char **data, size_t index);
|
||||
void unsunder(char *str, size_t true_len);
|
||||
void sunder(char *str);
|
||||
void unsunder(char *string, size_t length);
|
||||
void sunder(char *string);
|
||||
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||
void free_chararray(char **array, size_t len);
|
||||
#endif
|
||||
const char *fixbounds(const char *r);
|
||||
#ifdef ENABLE_SPELLER
|
||||
bool is_separate_word(size_t position, size_t length, const char *buf);
|
||||
#endif
|
||||
const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *start);
|
||||
void nperror(const char *s);
|
||||
void *nmalloc(size_t howmuch);
|
||||
void *nrealloc(void *ptr, size_t howmuch);
|
||||
char *mallocstrncpy(char *dest, const char *src, size_t n);
|
||||
char *measured_copy(const char *src, size_t n);
|
||||
char *mallocstrcpy(char *dest, const char *src);
|
||||
char *copy_of(const char *string);
|
||||
char *free_and_assign(char *dest, char *src);
|
||||
size_t get_page_start(size_t column);
|
||||
size_t xplustabs(void);
|
||||
size_t actual_x(const char *text, size_t column);
|
||||
size_t strnlenpt(const char *text, size_t maxlen);
|
||||
size_t strlenpt(const char *text);
|
||||
size_t wideness(const char *text, size_t maxlen);
|
||||
size_t breadth(const char *text);
|
||||
void new_magicline(void);
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
void remove_magicline(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void mark_order(const filestruct **top, size_t *top_x,
|
||||
const filestruct **bot, size_t *bot_x, bool *right_side_up);
|
||||
void get_range(const filestruct **top, const filestruct **bot);
|
||||
void get_region(const linestruct **top, size_t *top_x,
|
||||
const linestruct **bot, size_t *bot_x, bool *right_side_up);
|
||||
void get_range(const linestruct **top, const linestruct **bot);
|
||||
#endif
|
||||
size_t get_totsize(const filestruct *begin, const filestruct *end);
|
||||
size_t get_totsize(const linestruct *begin, const linestruct *end);
|
||||
#ifndef NANO_TINY
|
||||
filestruct *fsfromline(ssize_t lineno);
|
||||
linestruct *line_from_number(ssize_t lineno);
|
||||
#endif
|
||||
|
||||
/* Most functions in winio.c. */
|
||||
@@ -620,43 +625,40 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
|
||||
#ifdef ENABLE_MOUSE
|
||||
int get_mouseinput(int *mouse_row, int *mouse_col, bool allow_shortcuts);
|
||||
#endif
|
||||
const sc *get_shortcut(int *kbinput);
|
||||
void blank_row(WINDOW *win, int y, int x, int n);
|
||||
void blank_edit(void);
|
||||
void blank_statusbar(void);
|
||||
void wipe_statusbar(void);
|
||||
void blank_bottombars(void);
|
||||
void check_statusblank(void);
|
||||
char *display_string(const char *buf, size_t column, size_t span, bool isdata);
|
||||
char *display_string(const char *buf, size_t column, size_t span,
|
||||
bool isdata, bool isprompt);
|
||||
void titlebar(const char *path);
|
||||
void statusline(message_type importance, const char *msg, ...);
|
||||
void statusbar(const char *msg);
|
||||
void warn_and_shortly_pause(const char *msg);
|
||||
void statusline(message_type importance, const char *msg, ...);
|
||||
void bottombars(int menu);
|
||||
void post_one_key(const char *keystroke, const char *tag, int width);
|
||||
void place_the_cursor(void);
|
||||
void edit_draw(filestruct *fileptr, const char *converted,
|
||||
int line, size_t from_col);
|
||||
int update_line(filestruct *fileptr, size_t index);
|
||||
int update_line(linestruct *fileptr, size_t index);
|
||||
#ifndef NANO_TINY
|
||||
int update_softwrapped_line(filestruct *fileptr);
|
||||
int update_softwrapped_line(linestruct *fileptr);
|
||||
#endif
|
||||
bool line_needs_update(const size_t old_column, const size_t new_column);
|
||||
int go_back_chunks(int nrows, filestruct **line, size_t *leftedge);
|
||||
int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge);
|
||||
int go_back_chunks(int nrows, linestruct **line, size_t *leftedge);
|
||||
int go_forward_chunks(int nrows, linestruct **line, size_t *leftedge);
|
||||
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
|
||||
void edit_scroll(bool direction);
|
||||
#ifndef NANO_TINY
|
||||
size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
|
||||
bool *end_of_line);
|
||||
size_t get_chunk_and_edge(size_t column, filestruct *line, size_t *leftedge);
|
||||
size_t chunk_for(size_t column, filestruct *line);
|
||||
size_t leftedge_for(size_t column, filestruct *line);
|
||||
size_t number_of_chunks_in(filestruct *line);
|
||||
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 leftedge_for(size_t column, linestruct *line);
|
||||
size_t number_of_chunks_in(linestruct *line);
|
||||
void ensure_firstcolumn_is_aligned(void);
|
||||
#endif
|
||||
size_t actual_last_column(size_t leftedge, size_t column);
|
||||
void edit_redraw(filestruct *old_current, update_type manner);
|
||||
void edit_redraw(linestruct *old_current, update_type manner);
|
||||
void edit_refresh(void);
|
||||
void adjust_viewport(update_type location);
|
||||
void total_redraw(void);
|
||||
@@ -700,5 +702,3 @@ void flip_newbuffer(void);
|
||||
#endif
|
||||
void discard_buffer(void);
|
||||
void do_cancel(void);
|
||||
|
||||
#endif /* !PROTO_H */
|
||||
|
||||
886
src/rcfile.c
886
src/rcfile.c
File diff suppressed because it is too large
Load Diff
366
src/search.c
366
src/search.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* search.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015-2018 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -22,9 +22,6 @@
|
||||
#include "proto.h"
|
||||
|
||||
#include <string.h>
|
||||
#ifdef DEBUG
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
static bool came_full_circle = FALSE;
|
||||
/* Have we reached the starting line again while searching? */
|
||||
@@ -35,7 +32,7 @@ static bool have_compiled_regexp = FALSE;
|
||||
* Return TRUE if the expression is valid, and FALSE otherwise. */
|
||||
bool regexp_init(const char *regexp)
|
||||
{
|
||||
int value = regcomp(&search_regexp, fixbounds(regexp),
|
||||
int value = regcomp(&search_regexp, regexp,
|
||||
NANO_REG_EXTENDED | (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE));
|
||||
|
||||
/* If regex compilation failed, show the error message. */
|
||||
@@ -79,32 +76,33 @@ void search_init(bool replacing, bool keep_the_answer)
|
||||
|
||||
/* When starting a new search, clear the current answer. */
|
||||
if (!keep_the_answer)
|
||||
answer = mallocstrcpy(answer, NULL);
|
||||
answer = mallocstrcpy(answer, "");
|
||||
|
||||
/* If something was searched for earlier, include it in the prompt. */
|
||||
if (*last_search != '\0') {
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE, FALSE);
|
||||
|
||||
thedefault = charalloc(strlen(disp) + 7);
|
||||
/* We use (COLS / 3) here because we need to see more on the line. */
|
||||
sprintf(thedefault, " [%s%s]", disp,
|
||||
(strlenpt(last_search) > COLS / 3) ? "..." : "");
|
||||
(breadth(last_search) > COLS / 3) ? "..." : "");
|
||||
free(disp);
|
||||
} else
|
||||
thedefault = mallocstrcpy(NULL, "");
|
||||
thedefault = copy_of("");
|
||||
|
||||
while (TRUE) {
|
||||
functionptrtype func;
|
||||
/* Ask the user what to search for (or replace). */
|
||||
int i = do_prompt(FALSE, FALSE,
|
||||
int response = do_prompt(FALSE, FALSE,
|
||||
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
|
||||
answer, &search_history,
|
||||
answer, &search_history, edit_refresh,
|
||||
/* TRANSLATORS: This is the main search prompt. */
|
||||
edit_refresh, "%s%s%s%s%s%s", _("Search"),
|
||||
"%s%s%s%s%s%s", _("Search"),
|
||||
/* TRANSLATORS: The next four modify the search prompt. */
|
||||
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") : "",
|
||||
ISSET(USE_REGEXP) ? _(" [Regexp]") : "",
|
||||
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") : "", replacing ?
|
||||
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") : "",
|
||||
replacing ?
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark ? _(" (to replace) in selection") :
|
||||
#endif
|
||||
@@ -112,15 +110,13 @@ void search_init(bool replacing, bool keep_the_answer)
|
||||
|
||||
/* If the search was cancelled, or we have a blank answer and
|
||||
* nothing was searched for yet during this session, get out. */
|
||||
if (i == -1 || (i == -2 && *last_search == '\0')) {
|
||||
if (response == -1 || (response == -2 && *last_search == '\0')) {
|
||||
statusbar(_("Cancelled"));
|
||||
tidy_up_after_search();
|
||||
free(thedefault);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If Enter was pressed, prepare to do a replace or a search. */
|
||||
if (i == 0 || i == -2) {
|
||||
if (response == 0 || response == -2) {
|
||||
/* If an actual answer was typed, remember it. */
|
||||
if (*answer != '\0') {
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
@@ -139,38 +135,35 @@ void search_init(bool replacing, bool keep_the_answer)
|
||||
go_looking();
|
||||
}
|
||||
|
||||
tidy_up_after_search();
|
||||
free(thedefault);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
func = func_from_key(&i);
|
||||
func = func_from_key(&response);
|
||||
|
||||
/* If we're here, one of the five toggles was pressed, or
|
||||
* a shortcut was executed. */
|
||||
if (func == case_sens_void) {
|
||||
if (func == case_sens_void)
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
} else if (func == backwards_void) {
|
||||
else if (func == backwards_void)
|
||||
TOGGLE(BACKWARDS_SEARCH);
|
||||
} else if (func == regexp_void) {
|
||||
else if (func == regexp_void)
|
||||
TOGGLE(USE_REGEXP);
|
||||
} else if (func == flip_replace) {
|
||||
else if (func == flip_replace) {
|
||||
if (ISSET(VIEW_MODE)) {
|
||||
print_view_warning();
|
||||
tidy_up_after_search();
|
||||
free(thedefault);
|
||||
return;
|
||||
}
|
||||
replacing = !replacing;
|
||||
} else {
|
||||
if (func == flip_goto)
|
||||
do_gotolinecolumn(openfile->current->lineno,
|
||||
openfile->placewewant + 1, TRUE, TRUE);
|
||||
tidy_up_after_search();
|
||||
free(thedefault);
|
||||
return;
|
||||
}
|
||||
napms(600);
|
||||
} else
|
||||
replacing = !replacing;
|
||||
} else if (func == flip_goto) {
|
||||
do_gotolinecolumn(openfile->current->lineno,
|
||||
openfile->placewewant + 1, TRUE, TRUE);
|
||||
break;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
tidy_up_after_search();
|
||||
free(thedefault);
|
||||
}
|
||||
|
||||
/* Look for needle, starting at (current, current_x). begin is the line
|
||||
@@ -178,13 +171,13 @@ void search_init(bool replacing, bool keep_the_answer)
|
||||
* found something, 0 when nothing, and -2 on cancel. When match_len is
|
||||
* not NULL, set it to the length of the found string, if any. */
|
||||
int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x)
|
||||
size_t *match_len, bool skipone, const linestruct *begin, size_t begin_x)
|
||||
{
|
||||
size_t found_len = strlen(needle);
|
||||
/* The length of a match -- will be recomputed for a regex. */
|
||||
int feedback = 0;
|
||||
/* When bigger than zero, show and wipe the "Searching..." message. */
|
||||
filestruct *line = openfile->current;
|
||||
linestruct *line = openfile->current;
|
||||
/* The line that we will search through now. */
|
||||
const char *from = line->data + openfile->current_x;
|
||||
/* The point in the line from where we start searching. */
|
||||
@@ -230,10 +223,10 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
if (skipone) {
|
||||
skipone = FALSE;
|
||||
if (ISSET(BACKWARDS_SEARCH) && from != line->data) {
|
||||
from = line->data + move_mbleft(line->data, from - line->data);
|
||||
from = line->data + step_left(line->data, from - line->data);
|
||||
found = strstrwrapper(line->data, needle, from);
|
||||
} else if (!ISSET(BACKWARDS_SEARCH) && *from != '\0') {
|
||||
from += move_mbright(from, 0);
|
||||
from += char_length(from);
|
||||
found = strstrwrapper(line->data, needle, from);
|
||||
}
|
||||
} else
|
||||
@@ -248,7 +241,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
* if it's not, continue looking in the rest of the line. */
|
||||
if (whole_word_only && !is_separate_word(found - line->data,
|
||||
found_len, line->data)) {
|
||||
from = found + move_mbright(found, 0);
|
||||
from = found + char_length(found);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@@ -279,7 +272,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
line = openfile->filebot;
|
||||
else
|
||||
line = openfile->fileage;
|
||||
line = openfile->filetop;
|
||||
|
||||
if (modus == JUSTFIND) {
|
||||
statusbar(_("Search Wrapped"));
|
||||
@@ -366,6 +359,8 @@ void do_research(void)
|
||||
/* Use the search-menu key bindings, to allow cancelling. */
|
||||
currmenu = MWHEREIS;
|
||||
|
||||
wipe_statusbar();
|
||||
|
||||
go_looking();
|
||||
|
||||
tidy_up_after_search();
|
||||
@@ -388,8 +383,8 @@ void do_findnext(void)
|
||||
/* Report on the status bar that the given string was not found. */
|
||||
void not_found_msg(const char *str)
|
||||
{
|
||||
char *disp = display_string(str, 0, (COLS / 2) + 1, FALSE);
|
||||
size_t numchars = actual_x(disp, strnlenpt(disp, COLS / 2));
|
||||
char *disp = display_string(str, 0, (COLS / 2) + 1, FALSE, FALSE);
|
||||
size_t numchars = actual_x(disp, wideness(disp, COLS / 2));
|
||||
|
||||
statusline(HUSH, _("\"%.*s%s\" not found"), numchars, disp,
|
||||
(disp[numchars] == '\0') ? "" : "...");
|
||||
@@ -400,9 +395,12 @@ void not_found_msg(const char *str)
|
||||
* the string occurs only once. */
|
||||
void go_looking(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
linestruct *was_current = openfile->current;
|
||||
size_t was_current_x = openfile->current_x;
|
||||
#ifdef DEBUG
|
||||
|
||||
//#define TIMEIT 12
|
||||
#ifdef TIMEIT
|
||||
#include <time.h>
|
||||
clock_t start = clock();
|
||||
#endif
|
||||
|
||||
@@ -419,7 +417,7 @@ void go_looking(void)
|
||||
else if (didfind == 0)
|
||||
not_found_msg(last_search);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef TIMEIT
|
||||
statusline(HUSH, "Took: %.2f", (double)(clock() - start) / CLOCKS_PER_SEC);
|
||||
#endif
|
||||
|
||||
@@ -472,21 +470,20 @@ int replace_regexp(char *string, bool create)
|
||||
/* Return a copy of the current line with one needle replaced. */
|
||||
char *replace_line(const char *needle)
|
||||
{
|
||||
char *copy;
|
||||
size_t new_size = strlen(openfile->current->data) + 1;
|
||||
size_t match_len;
|
||||
size_t new_line_size = strlen(openfile->current->data) + 1;
|
||||
char *copy;
|
||||
|
||||
/* First adjust the size of the new line for the change. */
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
match_len = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
new_line_size += replace_regexp(NULL, FALSE) - match_len;
|
||||
new_size += replace_regexp(NULL, FALSE) - match_len;
|
||||
} else {
|
||||
match_len = strlen(needle);
|
||||
new_line_size += strlen(answer) - match_len;
|
||||
new_size += strlen(answer) - match_len;
|
||||
}
|
||||
|
||||
/* Create the buffer. */
|
||||
copy = charalloc(new_line_size);
|
||||
copy = charalloc(new_size);
|
||||
|
||||
/* Copy the head of the original line. */
|
||||
strncpy(copy, openfile->current->data, openfile->current_x);
|
||||
@@ -497,8 +494,6 @@ char *replace_line(const char *needle)
|
||||
else
|
||||
strcpy(copy + openfile->current_x, answer);
|
||||
|
||||
assert(openfile->current_x + match_len <= strlen(openfile->current->data));
|
||||
|
||||
/* Copy the tail of the original line. */
|
||||
strcat(copy, openfile->current->data + openfile->current_x + match_len);
|
||||
|
||||
@@ -512,7 +507,7 @@ char *replace_line(const char *needle)
|
||||
* is replaced by a shorter word. Return -1 if needle isn't found, -2 if
|
||||
* the seeking is aborted, else the number of replacements performed. */
|
||||
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
const filestruct *real_current, size_t *real_current_x)
|
||||
const linestruct *real_current, size_t *real_current_x)
|
||||
{
|
||||
ssize_t numreplaced = -1;
|
||||
size_t match_len;
|
||||
@@ -520,8 +515,8 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
bool skipone = ISSET(BACKWARDS_SEARCH);
|
||||
int modus = REPLACING;
|
||||
#ifndef NANO_TINY
|
||||
filestruct *was_mark = openfile->mark;
|
||||
filestruct *top, *bot;
|
||||
linestruct *was_mark = openfile->mark;
|
||||
linestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
bool right_side_up = FALSE;
|
||||
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
|
||||
@@ -529,8 +524,8 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
|
||||
/* If the mark is on, frame the region, and turn the mark off. */
|
||||
if (openfile->mark) {
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, &right_side_up);
|
||||
get_region((const linestruct **)&top, &top_x,
|
||||
(const linestruct **)&bot, &bot_x, &right_side_up);
|
||||
openfile->mark = NULL;
|
||||
modus = INREGION;
|
||||
|
||||
@@ -548,7 +543,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
came_full_circle = FALSE;
|
||||
|
||||
while (TRUE) {
|
||||
int i = 0;
|
||||
int choice = 0;
|
||||
int result = findnextstr(needle, whole_word_only, modus,
|
||||
&match_len, skipone, real_current, *real_current_x);
|
||||
|
||||
@@ -577,33 +572,33 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
if (!replaceall) {
|
||||
spotlighted = TRUE;
|
||||
light_from_col = xplustabs();
|
||||
light_to_col = strnlenpt(openfile->current->data,
|
||||
light_to_col = wideness(openfile->current->data,
|
||||
openfile->current_x + match_len);
|
||||
|
||||
/* Refresh the edit window, scrolling it if necessary. */
|
||||
edit_refresh();
|
||||
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
i = do_yesno_prompt(TRUE, _("Replace this instance?"));
|
||||
choice = do_yesno_prompt(TRUE, _("Replace this instance?"));
|
||||
|
||||
spotlighted = FALSE;
|
||||
|
||||
if (i == -1) /* The replacing was cancelled. */
|
||||
if (choice == -1) /* The replacing was cancelled. */
|
||||
break;
|
||||
else if (i == 2)
|
||||
else if (choice == 2)
|
||||
replaceall = TRUE;
|
||||
|
||||
/* When "No" or moving backwards, the search routine should
|
||||
* first move one character further before continuing. */
|
||||
skipone = (i == 0 || ISSET(BACKWARDS_SEARCH));
|
||||
skipone = (choice == 0 || ISSET(BACKWARDS_SEARCH));
|
||||
}
|
||||
|
||||
if (i == 1 || replaceall) { /* Yes, replace it. */
|
||||
if (choice == 1 || replaceall) { /* Yes, replace it. */
|
||||
char *copy;
|
||||
size_t length_change;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(REPLACE);
|
||||
add_undo(REPLACE, NULL);
|
||||
#endif
|
||||
copy = replace_line(needle);
|
||||
|
||||
@@ -680,7 +675,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
#endif
|
||||
|
||||
/* If "automatic newline" is enabled, and text has been added to the
|
||||
* magicline, make a new magicline. */
|
||||
* magic line, make a new magic line. */
|
||||
if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0')
|
||||
new_magicline();
|
||||
|
||||
@@ -701,25 +696,25 @@ void do_replace(void)
|
||||
/* Ask the user what the already given search string should be replaced with. */
|
||||
void ask_for_replacement(void)
|
||||
{
|
||||
filestruct *edittop_save, *begin;
|
||||
linestruct *edittop_save, *begin;
|
||||
size_t firstcolumn_save, begin_x;
|
||||
ssize_t numreplaced;
|
||||
int i = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL, &replace_history,
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
edit_refresh, _("Replace with"));
|
||||
int response = do_prompt(FALSE, FALSE, MREPLACEWITH, "",
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
&replace_history, edit_refresh, _("Replace with"));
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
/* If the replace string is not "", add it to the replace history list. */
|
||||
if (i == 0)
|
||||
if (response == 0)
|
||||
update_history(&replace_history, answer);
|
||||
#endif
|
||||
|
||||
/* When cancelled, or when a function was run, get out. */
|
||||
if (i == -1 || i > 0) {
|
||||
if (i == -1)
|
||||
statusbar(_("Cancelled"));
|
||||
if (response == -1) {
|
||||
statusbar(_("Cancelled"));
|
||||
return;
|
||||
} else if (response > 0)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Save where we are. */
|
||||
edittop_save = openfile->edittop;
|
||||
@@ -744,7 +739,7 @@ void ask_for_replacement(void)
|
||||
/* Go to the specified line and x position. */
|
||||
void goto_line_posx(ssize_t line, size_t pos_x)
|
||||
{
|
||||
for (openfile->current = openfile->fileage; line > 1 &&
|
||||
for (openfile->current = openfile->filetop; line > 1 &&
|
||||
openfile->current != openfile->filebot; line--)
|
||||
openfile->current = openfile->current->next;
|
||||
|
||||
@@ -762,18 +757,18 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
{
|
||||
if (interactive) {
|
||||
/* Ask for the line and column. */
|
||||
int i = do_prompt(FALSE, FALSE, MGOTOLINE,
|
||||
use_answer ? answer : NULL, NULL,
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
edit_refresh, _("Enter line number, column number"));
|
||||
int response = do_prompt(FALSE, FALSE, MGOTOLINE,
|
||||
use_answer ? answer : "", NULL, edit_refresh,
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
_("Enter line number, column number"));
|
||||
|
||||
/* If the user cancelled or gave a blank answer, get out. */
|
||||
if (i < 0) {
|
||||
if (response < 0) {
|
||||
statusbar(_("Cancelled"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (func_from_key(&i) == flip_goto) {
|
||||
if (func_from_key(&response) == flip_goto) {
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
/* Retain what the user typed so far and switch to searching. */
|
||||
search_init(FALSE, TRUE);
|
||||
@@ -781,7 +776,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
}
|
||||
|
||||
/* If a function was executed, we're done here. */
|
||||
if (i > 0)
|
||||
if (response > 0)
|
||||
return;
|
||||
|
||||
/* Try to extract one or two numbers from the user's response. */
|
||||
@@ -804,13 +799,13 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
line = 1;
|
||||
|
||||
/* Iterate to the requested line. */
|
||||
for (openfile->current = openfile->fileage; line > 1 &&
|
||||
for (openfile->current = openfile->filetop; line > 1 &&
|
||||
openfile->current != openfile->filebot; line--)
|
||||
openfile->current = openfile->current->next;
|
||||
|
||||
/* Take a negative column number to mean: from the end of the line. */
|
||||
if (column < 0)
|
||||
column = strlenpt(openfile->current->data) + column + 2;
|
||||
column = breadth(openfile->current->data) + column + 2;
|
||||
if (column < 1)
|
||||
column = 1;
|
||||
|
||||
@@ -820,8 +815,8 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP) && openfile->placewewant / editwincols >
|
||||
strlenpt(openfile->current->data) / editwincols)
|
||||
openfile->placewewant = strlenpt(openfile->current->data);
|
||||
breadth(openfile->current->data) / editwincols)
|
||||
openfile->placewewant = breadth(openfile->current->data);
|
||||
#endif
|
||||
|
||||
/* When the position was manually given, center the target line. */
|
||||
@@ -833,7 +828,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
filestruct *currentline = openfile->current;
|
||||
linestruct *currentline = openfile->current;
|
||||
size_t leftedge = leftedge_for(xplustabs(), openfile->current);
|
||||
|
||||
rows_from_tail = (editwinrows / 2) - go_forward_chunks(
|
||||
@@ -846,7 +841,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
/* If the target line is close to the tail of the file, put the last
|
||||
* line or chunk on the bottom line of the screen; otherwise, just
|
||||
* center the target line. */
|
||||
if (rows_from_tail < editwinrows / 2 && ISSET(SMOOTH_SCROLL)) {
|
||||
if (rows_from_tail < editwinrows / 2 && !ISSET(JUMPY_SCROLLING)) {
|
||||
openfile->current_y = editwinrows - 1 - rows_from_tail;
|
||||
adjust_viewport(STATIONARY);
|
||||
} else
|
||||
@@ -858,62 +853,57 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
void do_gotolinecolumn_void(void)
|
||||
{
|
||||
do_gotolinecolumn(openfile->current->lineno,
|
||||
openfile->placewewant + 1, FALSE, TRUE);
|
||||
openfile->placewewant + 1, FALSE, TRUE);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Search for a match to one of the two characters in bracket_set. If
|
||||
* reverse is TRUE, search backwards for the leftmost bracket.
|
||||
* Otherwise, search forwards for the rightmost bracket. Return TRUE if
|
||||
* we found a match, and FALSE otherwise. */
|
||||
bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
/* Search, starting from the current position, for any of the two characters
|
||||
* in bracket_pair. If reverse is TRUE, search backwards, otherwise forwards.
|
||||
* Return TRUE when one of the brackets was found, and FALSE otherwise. */
|
||||
bool find_a_bracket(bool reverse, const char *bracket_pair)
|
||||
{
|
||||
filestruct *fileptr = openfile->current;
|
||||
const char *rev_start = NULL, *found = NULL;
|
||||
linestruct *line = openfile->current;
|
||||
const char *pointer, *found;
|
||||
|
||||
assert(mbstrlen(bracket_set) == 2);
|
||||
/* Step away from the current bracket, either backwards or forwards. */
|
||||
if (reverse) {
|
||||
if (openfile->current_x == 0) {
|
||||
line = line->prev;
|
||||
if (line == NULL)
|
||||
return FALSE;
|
||||
pointer = line->data + strlen(line->data);
|
||||
} else
|
||||
pointer = line->data + step_left(line->data, openfile->current_x);
|
||||
} else
|
||||
pointer = line->data + step_right(line->data, openfile->current_x);
|
||||
|
||||
/* rev_start might end up 1 character before the start or after the
|
||||
* end of the line. This won't be a problem because we'll skip over
|
||||
* it below in that case, and rev_start will be properly set when
|
||||
* the search continues on the previous or next line. */
|
||||
if (reverse)
|
||||
rev_start = fileptr->data + (openfile->current_x - 1);
|
||||
else
|
||||
rev_start = fileptr->data + (openfile->current_x + 1);
|
||||
|
||||
/* Look for either of the two characters in bracket_set. rev_start
|
||||
* can be 1 character before the start or after the end of the line.
|
||||
* In either case, just act as though no match is found. */
|
||||
/* Now seek for any of the two brackets, either backwards or forwards. */
|
||||
while (TRUE) {
|
||||
if ((rev_start > fileptr->data && *(rev_start - 1) == '\0') ||
|
||||
rev_start < fileptr->data)
|
||||
found = NULL;
|
||||
else if (reverse)
|
||||
found = mbrevstrpbrk(fileptr->data, bracket_set, rev_start);
|
||||
if (reverse)
|
||||
found = mbrevstrpbrk(line->data, bracket_pair, pointer);
|
||||
else
|
||||
found = mbstrpbrk(rev_start, bracket_set);
|
||||
found = mbstrpbrk(pointer, bracket_pair);
|
||||
|
||||
if (found)
|
||||
break;
|
||||
|
||||
if (reverse)
|
||||
fileptr = fileptr->prev;
|
||||
line = line->prev;
|
||||
else
|
||||
fileptr = fileptr->next;
|
||||
line = line->next;
|
||||
|
||||
/* If we've reached the start or end of the buffer, get out. */
|
||||
if (fileptr == NULL)
|
||||
if (line == NULL)
|
||||
return FALSE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
pointer = line->data;
|
||||
if (reverse)
|
||||
rev_start += strlen(fileptr->data);
|
||||
pointer += strlen(line->data);
|
||||
}
|
||||
|
||||
/* Set the current position to the found matching bracket. */
|
||||
openfile->current = fileptr;
|
||||
openfile->current_x = found - fileptr->data;
|
||||
/* Set the current position to the found bracket. */
|
||||
openfile->current = line;
|
||||
openfile->current_x = found - line->data;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -922,104 +912,78 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
* there is one. */
|
||||
void do_find_bracket(void)
|
||||
{
|
||||
filestruct *current_save;
|
||||
size_t current_x_save;
|
||||
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 at the current
|
||||
* cursor position. */
|
||||
/* 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 bracket complementing
|
||||
* the bracket at the current cursor position. */
|
||||
/* The location in matchbrackets of the complementing bracket. */
|
||||
int wanted_ch_len;
|
||||
/* The length of wanted_ch in bytes. */
|
||||
char bracket_set[MAXCHARLEN * 2 + 1];
|
||||
char bracket_pair[MAXCHARLEN * 2 + 1];
|
||||
/* The pair of characters in ch and wanted_ch. */
|
||||
size_t i;
|
||||
/* Generic loop variable. */
|
||||
size_t matchhalf;
|
||||
/* The number of single-byte characters in one half of
|
||||
* matchbrackets. */
|
||||
size_t mbmatchhalf;
|
||||
/* The number of multibyte characters in one half of
|
||||
* matchbrackets. */
|
||||
size_t count = 1;
|
||||
size_t halfway = 0;
|
||||
/* The index in matchbrackets where the closing brackets start. */
|
||||
size_t charcount = mbstrlen(matchbrackets) / 2;
|
||||
/* Half the number of characters in matchbrackets. */
|
||||
size_t balance = 1;
|
||||
/* The initial bracket count. */
|
||||
bool reverse;
|
||||
/* The direction we search. */
|
||||
|
||||
assert(mbstrlen(matchbrackets) % 2 == 0);
|
||||
ch = mbstrchr(matchbrackets, openfile->current->data + openfile->current_x);
|
||||
|
||||
ch = openfile->current->data + openfile->current_x;
|
||||
|
||||
if ((ch = mbstrchr(matchbrackets, ch)) == NULL) {
|
||||
if (ch == NULL) {
|
||||
statusbar(_("Not a bracket"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Save where we are. */
|
||||
current_save = openfile->current;
|
||||
current_x_save = openfile->current_x;
|
||||
/* Find the halfway point in matchbrackets, where the closing ones start. */
|
||||
for (size_t i = 0; i < charcount; i++)
|
||||
halfway += char_length(matchbrackets + halfway);
|
||||
|
||||
/* If we're on an opening bracket, which must be in the first half
|
||||
* of matchbrackets, we want to search forwards for a closing
|
||||
* bracket. If we're on a closing bracket, which must be in the
|
||||
* second half of matchbrackets, we want to search backwards for an
|
||||
* opening bracket. */
|
||||
matchhalf = 0;
|
||||
mbmatchhalf = mbstrlen(matchbrackets) / 2;
|
||||
/* When on a closing bracket, we have to search backwards for a matching
|
||||
* opening bracket; otherwise, forward for a matching closing bracket. */
|
||||
reverse = (ch >= (matchbrackets + halfway));
|
||||
|
||||
for (i = 0; i < mbmatchhalf; i++)
|
||||
matchhalf += parse_mbchar(matchbrackets + matchhalf, NULL, NULL);
|
||||
|
||||
reverse = ((ch - matchbrackets) >= matchhalf);
|
||||
|
||||
/* If we're on an opening bracket, set wanted_ch to the character
|
||||
* that's matchhalf characters after ch. If we're on a closing
|
||||
* bracket, set wanted_ch to the character that's matchhalf
|
||||
* characters before ch. */
|
||||
/* Step half the number of total characters either backwards or forwards
|
||||
* through matchbrackets to find the wanted complementary bracket. */
|
||||
wanted_ch = ch;
|
||||
|
||||
while (mbmatchhalf > 0) {
|
||||
while (charcount-- > 0) {
|
||||
if (reverse)
|
||||
wanted_ch = matchbrackets + move_mbleft(matchbrackets,
|
||||
wanted_ch - matchbrackets);
|
||||
wanted_ch = matchbrackets + step_left(matchbrackets,
|
||||
wanted_ch - matchbrackets);
|
||||
else
|
||||
wanted_ch += move_mbright(wanted_ch, 0);
|
||||
|
||||
mbmatchhalf--;
|
||||
wanted_ch += char_length(wanted_ch);
|
||||
}
|
||||
|
||||
ch_len = parse_mbchar(ch, NULL, NULL);
|
||||
wanted_ch_len = parse_mbchar(wanted_ch, NULL, NULL);
|
||||
ch_len = char_length(ch);
|
||||
wanted_ch_len = char_length(wanted_ch);
|
||||
|
||||
/* Fill bracket_set in with the values of ch and wanted_ch. */
|
||||
strncpy(bracket_set, ch, ch_len);
|
||||
strncpy(bracket_set + ch_len, wanted_ch, wanted_ch_len);
|
||||
bracket_set[ch_len + wanted_ch_len] = '\0';
|
||||
/* Copy the two complementary brackets into a single string. */
|
||||
strncpy(bracket_pair, ch, ch_len);
|
||||
strncpy(bracket_pair + ch_len, wanted_ch, wanted_ch_len);
|
||||
bracket_pair[ch_len + wanted_ch_len] = '\0';
|
||||
|
||||
while (TRUE) {
|
||||
if (find_bracket_match(reverse, bracket_set)) {
|
||||
/* If we found an identical bracket, increment count. If we
|
||||
* found a complementary bracket, decrement it. */
|
||||
count += (strncmp(openfile->current->data + openfile->current_x,
|
||||
ch, ch_len) == 0) ? 1 : -1;
|
||||
while (find_a_bracket(reverse, bracket_pair)) {
|
||||
/* Increment/decrement balance for an identical/other bracket. */
|
||||
balance += (strncmp(openfile->current->data + openfile->current_x,
|
||||
ch, ch_len) == 0) ? 1 : -1;
|
||||
|
||||
/* If count is zero, we've found a matching bracket. Update
|
||||
* the screen and get out. */
|
||||
if (count == 0) {
|
||||
edit_redraw(current_save, FLOWING);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* We didn't find either an opening or closing bracket.
|
||||
* Indicate this, restore where we were, and get out. */
|
||||
statusbar(_("No matching bracket"));
|
||||
openfile->current = current_save;
|
||||
openfile->current_x = current_x_save;
|
||||
break;
|
||||
/* When balance reached zero, we've found the complementary bracket. */
|
||||
if (balance == 0) {
|
||||
edit_redraw(was_current, FLOWING);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
statusbar(_("No matching bracket"));
|
||||
|
||||
/* Restore the cursor position. */
|
||||
openfile->current = was_current;
|
||||
openfile->current_x = was_current_x;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
2495
src/text.c
2495
src/text.c
File diff suppressed because it is too large
Load Diff
200
src/utils.c
200
src/utils.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* utils.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -49,7 +49,7 @@ void get_homedir(void)
|
||||
/* Only set homedir if some home directory could be determined,
|
||||
* otherwise keep homedir NULL. */
|
||||
if (homenv != NULL && *homenv != '\0')
|
||||
homedir = mallocstrcpy(NULL, homenv);
|
||||
homedir = copy_of(homenv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||
if (comma == str)
|
||||
return retval;
|
||||
|
||||
firstpart = mallocstrcpy(NULL, str);
|
||||
firstpart = copy_of(str);
|
||||
firstpart[comma - str] = '\0';
|
||||
|
||||
retval = parse_num(firstpart, line) && retval;
|
||||
@@ -159,36 +159,24 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Reduce the memory allocation of a string to what is needed. */
|
||||
void snuggly_fit(char **string)
|
||||
/* In the given string, recode each embedded NUL as a newline. */
|
||||
void unsunder(char *string, size_t length)
|
||||
{
|
||||
*string = charealloc(*string, strlen(*string) + 1);
|
||||
}
|
||||
|
||||
/* Null a string at a certain index and align it. */
|
||||
void null_at(char **data, size_t index)
|
||||
{
|
||||
*data = charealloc(*data, index + 1);
|
||||
(*data)[index] = '\0';
|
||||
}
|
||||
|
||||
/* For non-null-terminated lines. A line, by definition, shouldn't
|
||||
* normally have newlines in it, so encode its nulls as newlines. */
|
||||
void unsunder(char *str, size_t true_len)
|
||||
{
|
||||
for (; true_len > 0; true_len--, str++) {
|
||||
if (*str == '\0')
|
||||
*str = '\n';
|
||||
while (length > 0) {
|
||||
if (*string == '\0')
|
||||
*string = '\n';
|
||||
length--;
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
||||
/* For non-null-terminated lines. A line, by definition, shouldn't
|
||||
* normally have newlines in it, so decode its newlines as nulls. */
|
||||
void sunder(char *str)
|
||||
/* In the given string, recode each embedded newline as a NUL. */
|
||||
void sunder(char *string)
|
||||
{
|
||||
for (; *str != '\0'; str++) {
|
||||
if (*str == '\n')
|
||||
*str = '\0';
|
||||
while (*string != '\0') {
|
||||
if (*string == '\n')
|
||||
*string = '\0';
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,37 +194,6 @@ void free_chararray(char **array, size_t len)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Fix the regex if we're on platforms which require an adjustment
|
||||
* from GNU-style to BSD-style word boundaries. */
|
||||
const char *fixbounds(const char *r)
|
||||
{
|
||||
#ifndef GNU_WORDBOUNDS
|
||||
int i, j = 0;
|
||||
char *r2 = charalloc(strlen(r) * 5);
|
||||
char *r3;
|
||||
|
||||
for (i = 0; i < strlen(r); i++) {
|
||||
if (r[i] != '\0' && r[i] == '\\' && (r[i + 1] == '>' || r[i + 1] == '<')) {
|
||||
strcpy(&r2[j], "[[:");
|
||||
r2[j + 3] = r[i + 1];
|
||||
strcpy(&r2[j + 4], ":]]");
|
||||
i++;
|
||||
j += 6;
|
||||
} else
|
||||
r2[j] = r[i];
|
||||
j++;
|
||||
}
|
||||
|
||||
r2[j] = '\0';
|
||||
r3 = mallocstrcpy(NULL, r2);
|
||||
free(r2);
|
||||
|
||||
return (const char *) r3;
|
||||
#endif /* !GNU_WORDBOUNDS */
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SPELLER
|
||||
/* Is the word starting at the given position in buf and of the given length
|
||||
* a separate word? That is: is it not part of a longer word?*/
|
||||
@@ -246,8 +203,8 @@ bool is_separate_word(size_t position, size_t length, const char *buf)
|
||||
size_t word_end = position + length;
|
||||
|
||||
/* Get the characters before and after the word, if any. */
|
||||
parse_mbchar(buf + move_mbleft(buf, position), before, NULL);
|
||||
parse_mbchar(buf + word_end, after, NULL);
|
||||
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
|
||||
* the word isn't a letter, and if the word ends at the end of the line OR
|
||||
@@ -290,7 +247,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
/* If this is the last possible match, don't try to advance. */
|
||||
if (last_find == ceiling)
|
||||
break;
|
||||
next_rung = move_mbright(haystack, last_find);
|
||||
next_rung = step_right(haystack, last_find);
|
||||
regmatches[0].rm_so = next_rung;
|
||||
regmatches[0].rm_eo = far_end;
|
||||
if (regexec(&search_regexp, haystack, 1, regmatches,
|
||||
@@ -331,17 +288,6 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
return mbstrcasestr(start, needle);
|
||||
}
|
||||
|
||||
/* This is a wrapper for the perror() function. The wrapper temporarily
|
||||
* leaves curses mode, calls perror() (which writes to stderr), and then
|
||||
* reenters curses mode, updating the screen in the process. Note that
|
||||
* nperror() causes the window to flicker once. */
|
||||
void nperror(const char *s)
|
||||
{
|
||||
endwin();
|
||||
perror(s);
|
||||
doupdate();
|
||||
}
|
||||
|
||||
/* This is a wrapper for the malloc() function that properly handles
|
||||
* things when we run out of memory. */
|
||||
void *nmalloc(size_t howmuch)
|
||||
@@ -366,28 +312,32 @@ void *nrealloc(void *ptr, size_t howmuch)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Allocate and copy the first n characters of the given src string, after
|
||||
* freeing the destination. Usage: "dest = mallocstrncpy(dest, src, n);". */
|
||||
char *mallocstrncpy(char *dest, const char *src, size_t n)
|
||||
/* Return an appropriately reallocated dest string holding a copy of src.
|
||||
* Usage: "dest = mallocstrcpy(dest, src);". */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
{
|
||||
if (src == NULL)
|
||||
src = "";
|
||||
size_t count = strlen(src) + 1;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (src == dest)
|
||||
fprintf(stderr, "\r*** Copying a string to itself -- please report a bug ***");
|
||||
#endif
|
||||
dest = charealloc(dest, n);
|
||||
strncpy(dest, src, n);
|
||||
dest = charealloc(dest, count);
|
||||
strncpy(dest, src, count);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Free the dest string and return a malloc'ed copy of src. Should be used as:
|
||||
* "dest = mallocstrcpy(dest, src);". */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
/* Return an allocated copy of the first count characters of the given string. */
|
||||
char *measured_copy(const char *string, size_t count)
|
||||
{
|
||||
return mallocstrncpy(dest, src, (src == NULL) ? 1 : strlen(src) + 1);
|
||||
char *thecopy = charalloc(count);
|
||||
|
||||
strncpy(thecopy, string, count);
|
||||
|
||||
return thecopy;
|
||||
}
|
||||
|
||||
/* Return an allocated copy of the given string. */
|
||||
char *copy_of(const char *string)
|
||||
{
|
||||
return measured_copy(string, strlen(string) + 1);
|
||||
}
|
||||
|
||||
/* Free the string at dest and return the string at src. */
|
||||
@@ -404,10 +354,10 @@ char *free_and_assign(char *dest, char *src)
|
||||
* get_page_start(column) < COLS). */
|
||||
size_t get_page_start(size_t column)
|
||||
{
|
||||
if (column < editwincols - 1 || ISSET(SOFTWRAP) || column == 0)
|
||||
if (column + 2 < editwincols || ISSET(SOFTWRAP) || column == 0)
|
||||
return 0;
|
||||
else if (editwincols > 8)
|
||||
return column - 7 - (column - 7) % (editwincols - 8);
|
||||
return column - 6 - (column - 6) % (editwincols - 8);
|
||||
else
|
||||
return column - (editwincols - 2);
|
||||
}
|
||||
@@ -416,7 +366,7 @@ size_t get_page_start(size_t column)
|
||||
* column position of the cursor. */
|
||||
size_t xplustabs(void)
|
||||
{
|
||||
return strnlenpt(openfile->current->data, openfile->current_x);
|
||||
return wideness(openfile->current->data, openfile->current_x);
|
||||
}
|
||||
|
||||
/* Return the index in text of the character that (when displayed) will
|
||||
@@ -429,7 +379,7 @@ size_t actual_x(const char *text, size_t column)
|
||||
/* The current accumulated span, in columns. */
|
||||
|
||||
while (*text != '\0') {
|
||||
int charlen = parse_mbchar(text, NULL, &width);
|
||||
int charlen = advance_over(text, &width);
|
||||
|
||||
if (width > column)
|
||||
break;
|
||||
@@ -442,16 +392,15 @@ size_t actual_x(const char *text, size_t column)
|
||||
|
||||
/* A strnlen() with tabs and multicolumn characters factored in:
|
||||
* how many columns wide are the first maxlen bytes of text? */
|
||||
size_t strnlenpt(const char *text, size_t maxlen)
|
||||
size_t wideness(const char *text, size_t maxlen)
|
||||
{
|
||||
size_t width = 0;
|
||||
/* The screen display width to text[maxlen]. */
|
||||
|
||||
if (maxlen == 0)
|
||||
return 0;
|
||||
|
||||
while (*text != '\0') {
|
||||
size_t charlen = parse_mbchar(text, NULL, &width);
|
||||
size_t charlen = advance_over(text, &width);
|
||||
|
||||
if (maxlen <= charlen)
|
||||
break;
|
||||
@@ -464,34 +413,34 @@ size_t strnlenpt(const char *text, size_t maxlen)
|
||||
}
|
||||
|
||||
/* Return the number of columns that the given text occupies. */
|
||||
size_t strlenpt(const char *text)
|
||||
size_t breadth(const char *text)
|
||||
{
|
||||
size_t span = 0;
|
||||
|
||||
while (*text != '\0')
|
||||
text += parse_mbchar(text, NULL, &span);
|
||||
text += advance_over(text, &span);
|
||||
|
||||
return span;
|
||||
}
|
||||
|
||||
/* Append a new magicline to the end of the buffer. */
|
||||
/* Append a new magic line to the end of the buffer. */
|
||||
void new_magicline(void)
|
||||
{
|
||||
openfile->filebot->next = make_new_node(openfile->filebot);
|
||||
openfile->filebot->next->data = mallocstrcpy(NULL, "");
|
||||
openfile->filebot->next->data = copy_of("");
|
||||
openfile->filebot = openfile->filebot->next;
|
||||
openfile->totsize++;
|
||||
}
|
||||
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
/* Remove the magicline from the end of the buffer, if there is one and
|
||||
/* Remove the magic line from the end of the buffer, if there is one and
|
||||
* it isn't the only line in the file. */
|
||||
void remove_magicline(void)
|
||||
{
|
||||
if (openfile->filebot->data[0] == '\0' &&
|
||||
openfile->filebot != openfile->fileage) {
|
||||
openfile->filebot != openfile->filetop) {
|
||||
openfile->filebot = openfile->filebot->prev;
|
||||
free_filestruct(openfile->filebot->next);
|
||||
delete_node(openfile->filebot->next);
|
||||
openfile->filebot->next = NULL;
|
||||
openfile->totsize--;
|
||||
}
|
||||
@@ -499,15 +448,15 @@ void remove_magicline(void)
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Set (top, top_x) and (bot, bot_x) to the start and end "coordinates" of
|
||||
* the marked region. If right_side_up isn't NULL, set it to TRUE when the
|
||||
* mark is at the top of the marked region, and to FALSE otherwise. */
|
||||
void mark_order(const filestruct **top, size_t *top_x,
|
||||
const filestruct **bot, size_t *bot_x, bool *right_side_up)
|
||||
/* Return in (top, top_x) and (bot, bot_x) the start and end "coordinates"
|
||||
* of the marked region. If right_side_up isn't NULL, set it to TRUE when
|
||||
* the mark is at the top of the marked region, and to FALSE otherwise. */
|
||||
void get_region(const linestruct **top, size_t *top_x,
|
||||
const linestruct **bot, size_t *bot_x, bool *right_side_up)
|
||||
{
|
||||
if ((openfile->current->lineno == openfile->mark->lineno &&
|
||||
openfile->current_x > openfile->mark_x) ||
|
||||
openfile->current->lineno > openfile->mark->lineno) {
|
||||
if (openfile->mark->lineno < openfile->current->lineno ||
|
||||
(openfile->mark == openfile->current &&
|
||||
openfile->mark_x < openfile->current_x)) {
|
||||
*top = openfile->mark;
|
||||
*top_x = openfile->mark_x;
|
||||
*bot = openfile->current;
|
||||
@@ -527,7 +476,7 @@ void mark_order(const filestruct **top, size_t *top_x,
|
||||
/* Get the set of lines to work on -- either just the current line, or the
|
||||
* first to last lines of the marked region. When the cursor (or mark) is
|
||||
* at the start of the last line of the region, exclude that line. */
|
||||
void get_range(const filestruct **top, const filestruct **bot)
|
||||
void get_range(const linestruct **top, const linestruct **bot)
|
||||
{
|
||||
if (!openfile->mark) {
|
||||
*top = openfile->current;
|
||||
@@ -535,7 +484,7 @@ void get_range(const filestruct **top, const filestruct **bot)
|
||||
} else {
|
||||
size_t top_x, bot_x;
|
||||
|
||||
mark_order(top, &top_x, bot, &bot_x, NULL);
|
||||
get_region(top, &top_x, bot, &bot_x, NULL);
|
||||
|
||||
if (bot_x == 0 && *bot != *top && !also_the_last)
|
||||
*bot = (*bot)->prev;
|
||||
@@ -544,31 +493,26 @@ void get_range(const filestruct **top, const filestruct **bot)
|
||||
}
|
||||
}
|
||||
|
||||
/* Given a line number, return a pointer to the corresponding struct. */
|
||||
filestruct *fsfromline(ssize_t lineno)
|
||||
/* Return a pointer to the line that has the given line number. */
|
||||
linestruct *line_from_number(ssize_t number)
|
||||
{
|
||||
filestruct *f = openfile->current;
|
||||
linestruct *line = openfile->current;
|
||||
|
||||
if (lineno <= openfile->current->lineno)
|
||||
while (f->lineno != lineno && f->prev != NULL)
|
||||
f = f->prev;
|
||||
if (line->lineno > number)
|
||||
while (line->lineno != number)
|
||||
line = line->prev;
|
||||
else
|
||||
while (f->lineno != lineno && f->next != NULL)
|
||||
f = f->next;
|
||||
while (line->lineno != number)
|
||||
line = line->next;
|
||||
|
||||
if (f->lineno != lineno) {
|
||||
statusline(ALERT, "Gone undo line -- please report a bug");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return f;
|
||||
return line;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Count the number of characters from begin to end, and return it. */
|
||||
size_t get_totsize(const filestruct *begin, const filestruct *end)
|
||||
size_t get_totsize(const linestruct *begin, const linestruct *end)
|
||||
{
|
||||
const filestruct *line;
|
||||
const linestruct *line;
|
||||
size_t totsize = 0;
|
||||
|
||||
/* Sum the number of characters (plus a newline) in each line. */
|
||||
|
||||
845
src/winio.c
845
src/winio.c
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ color red "\<[A-Z_]{2,}\>"
|
||||
color brightgreen "\.(data|subsection|text)"
|
||||
color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
|
||||
color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
|
||||
icolor brightred "^[[:space:]]*[.0-9A-Z_]*:"
|
||||
color brightred "^[[:space:]]*[.0-9A-Za-z_]*:"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
|
||||
# Strings.
|
||||
|
||||
@@ -20,7 +20,7 @@ color red "\"[^"]*\"" "\'[^']*\'"
|
||||
color green "`[^`]*`"
|
||||
|
||||
# Error lines:
|
||||
color brightred "^\*\*\*.*"
|
||||
color brightred "^[[:space:]]*\*\*\*.*"
|
||||
|
||||
# Brackets:
|
||||
color magenta "\[|\]|\(|\)"
|
||||
|
||||
@@ -6,7 +6,7 @@ magic "awk script"
|
||||
comment "#"
|
||||
|
||||
# Records.
|
||||
icolor brightred "\$[0-9A-Z_!@#$*?-]+"
|
||||
color brightred "\$[0-9A-Za-z_!@#$*?-]+"
|
||||
# Awk-set variables.
|
||||
color red "\<(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\>"
|
||||
color red "\<(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\>"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for C/C++.
|
||||
|
||||
syntax c "\.([ch](pp|xx)?|C|cc|c\+\+|H|hh|ii?)$"
|
||||
syntax c "\.([ch](pp|xx)?|C|cc|c\+\+|cu|H|hh|ii?)$"
|
||||
header "-\*-.*\<C(\+\+)?((;|\s).*)?-\*-"
|
||||
magic "^(C|C\+\+) (source|program)"
|
||||
comment "//"
|
||||
|
||||
@@ -10,12 +11,11 @@ color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
||||
color brightmagenta "^[[:space:]]*[A-Z_a-z]+:[[:space:]]*$"
|
||||
|
||||
color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|auto|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
|
||||
color green "\<((s?size)|((u_?)?int(8|16|32|64|ptr)))_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 brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
|
||||
color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||
color magenta "\<(goto|continue|break|return)\>"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
|
||||
color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
|
||||
|
||||
# GCC builtins.
|
||||
@@ -23,11 +23,15 @@ color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidd
|
||||
|
||||
# Strings. In general you will want your strings and comments to come last,
|
||||
# because highlighting rules are applied in the order they are read in.
|
||||
color brightyellow ""([^"]|\\")*"" "<[^[:blank:]=]*>"
|
||||
color brightyellow ""([^"]|\\")*"" "#[[:space:]]*include[[:space:]]+<[^[:blank:]=]*>"
|
||||
# Multiline strings. This regex is VERY resource intensive,
|
||||
# and sometimes colours things that shouldn't be coloured.
|
||||
###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
|
||||
|
||||
# Preprocessor directives.
|
||||
color brightcyan start="^[[:space:]]*#[[:space:]]*(if(n?def)?|elif|warning|error|pragma)\>" end="(\`|[^\\])$"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|else|endif|include(_next)?|undef)\>"
|
||||
|
||||
# Comments.
|
||||
color brightblue "//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
syntax cmake "(CMakeLists\.txt|\.cmake)$"
|
||||
comment "#"
|
||||
|
||||
icolor green "^[[:space:]]*[A-Z0-9_]+"
|
||||
color green "^[[:space:]]*[0-9A-Za-z_]+"
|
||||
icolor brightyellow "^[[:space:]]*(include|include_directories|include_external_msproject)\>"
|
||||
|
||||
icolor brightgreen "^[[:space:]]*((else|end)?if|else|(end)?while|(end)?foreach|break)\>"
|
||||
@@ -12,7 +12,7 @@ color brightgreen "[[:space:]](OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS
|
||||
|
||||
icolor brightred "^[[:space:]]*((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 brightblue "(^|[[:space:]])#.*"
|
||||
|
||||
@@ -11,7 +11,10 @@ color cyan "^[[:space:]]*#.*"
|
||||
color ,red " + +"
|
||||
|
||||
# Nano's name, including version.
|
||||
color brightred "(GNU )?[Nn]ano [1-3]\.[0-9][-.[:alnum:]]*\>"
|
||||
color brightred "(GNU )?[Nn]ano [1-4]\.[0-9][-.[:alnum:]]*\>"
|
||||
|
||||
# Email addresses.
|
||||
color magenta "<[[:alnum:].%_+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,}>"
|
||||
|
||||
# Bracketed captions in certain config files.
|
||||
color brightgreen "^\[[^][]+\]$"
|
||||
|
||||
@@ -34,7 +34,7 @@ icolor yellow "\<(.or.|repeat|select case|then|where|while)\>"
|
||||
icolor magenta "\<(continue|cycle|exit|go?to|result|return)\>"
|
||||
|
||||
# Strings.
|
||||
icolor yellow "<[^= ]*>" ""(\\.|[^"])*""
|
||||
color yellow "<[^= ]*>" ""(\\.|[^"])*""
|
||||
|
||||
# Comments.
|
||||
icolor blue "!.*"
|
||||
color blue "!.*"
|
||||
|
||||
@@ -17,7 +17,7 @@ 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|[HPR]?DEPEND|PROVIDE|PROPERTIES|REQUIRED_USE|RESTRICT|USERLAND)\>"
|
||||
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)?\>"
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
syntax go "\.go$"
|
||||
comment "//"
|
||||
|
||||
formatter gofmt -w
|
||||
|
||||
# Types.
|
||||
color green "\<(bool|u?int(8|16|32|64)?|float(32|64)|complex(64|128)|byte|rune|uintptr|string|error)\>"
|
||||
color green "\<((<-[[:space:]]*)chan|chan[[:space:]]*<-|const|func|interface|map|struct|type|var)\>"
|
||||
|
||||
@@ -4,6 +4,8 @@ syntax html "\.html?$"
|
||||
magic "HTML document"
|
||||
comment "<!--|-->"
|
||||
|
||||
formatter tidy -m -q
|
||||
|
||||
# Tags:
|
||||
color cyan "<[[:alpha:]/!?][^>]*>"
|
||||
# Bold, italic, and underlined:
|
||||
@@ -11,18 +13,19 @@ color brightmagenta "</?[biu]>"
|
||||
|
||||
# Named character references:
|
||||
color red "&[^;[:space:]]*;"
|
||||
|
||||
# Attributes:
|
||||
color red "\<(abbr|accept(-charset)?|accesskey|action|alink|align|alt|archive|axis|background|bgcolor|border)="
|
||||
color red "\<(cell(padding|spacing)|char(off|set)?|checked|cite|class(id)?|compact|code(base|tag)?|cols(pan)?)="
|
||||
color red "\<(content(editable)?|contextmenu|coords|data|datetime|declare|defer|dir|disabled|enctype)="
|
||||
color red "\<(for|frame(border)?|headers|height|hidden|href(lang)?|hspace|http-equiv|id|ismap)="
|
||||
color red "\<(label|lang|link|longdesc|margin(height|width)|maxlength|media|method|multiple)="
|
||||
color red "\<(name|nohref|noresize|noshade|object|onclick|onfocus|onload|onmouseover|profile|readonly|rel|rev)="
|
||||
color red "\<(rows(pan)?|rules|scheme|scope|scrolling|selected|shape|size|span|src|standby|start|style|summary)="
|
||||
color red "\<(tabindex|target|text|title|type|usemap|valign|value(type)?|vlink|vspace|width|xmlns|xml:space)="
|
||||
|
||||
# Strings:
|
||||
color green ""(\\.|[^"])*""
|
||||
|
||||
# Attributes:
|
||||
color red "(abbr|accept(-charset)?|accesskey|action|alink|align|alt|archive|axis|background|bgcolor|border)="
|
||||
color red "(cell(padding|spacing)|char(off|set)?|checked|cite|class(id)?|compact|code(base|tag)?|cols(pan)?)="
|
||||
color red "(content(editable)?|contextmenu|coords|data|datetime|declare|defer|dir|disabled|enctype)="
|
||||
color red "(for|frame(border)?|headers|height|hidden|href(lang)?|hspace|http-equiv|id|ismap)="
|
||||
color red "(label|lang|link|longdesc|margin(height|width)|maxlength|media|method|multiple)="
|
||||
color red "(name|nohref|noresize|noshade|object|onclick|onfocus|onload|onmouseover|profile|readonly|rel|rev)="
|
||||
color red "(rows(pan)?|rules|scheme|scope|scrolling|selected|shape|size|span|src|standby|start|style|summary)="
|
||||
color red "(tabindex|target|text|title|type|usemap|valign|value(type)?|vlink|vspace|width|xmlns|xml:space)="
|
||||
|
||||
# Comments:
|
||||
color yellow start="<!--" end="-->"
|
||||
|
||||
@@ -12,7 +12,9 @@ color brightyellow "\<(await|export|import|throw|try|catch|finally|new|delete)\>
|
||||
color magenta "\<(break|continue|return|yield)\>"
|
||||
|
||||
# Octal/decimal and hexadecimal numbers.
|
||||
color cyan "\<[0-9]+\>" "\<0x[0-9A-Fa-f]+\>"
|
||||
color cyan "\<([0-9]+|0x[0-9A-Fa-f]+)\>"
|
||||
# Special values.
|
||||
color cyan "\<(true|false|null|undefined)\>"
|
||||
|
||||
# Strings.
|
||||
color brightmagenta ""(\\.|[^"])*"" "'(\\.|[^'])*'" "`(\\.|[^`])*`"
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
|
||||
syntax lua "\.lua$"
|
||||
magic "Lua script"
|
||||
linter "luacheck --no-color"
|
||||
comment "--"
|
||||
|
||||
linter luacheck --no-color
|
||||
|
||||
color brightwhite "\[\[.*\]\]"
|
||||
|
||||
# Operators
|
||||
@@ -44,7 +45,7 @@ color brightmagenta "\<(false|nil|true)\>"
|
||||
|
||||
# Decimal and hexadecimal numbers
|
||||
color red "\<[0-9]+(\.[0-9]*)?([Ee][+-]?[0-9]+)?\>"
|
||||
icolor red "\<0x[0-9a-f]+(\.[0-9a-f]*)?(p[+-]?[0-9]+)?\>"
|
||||
color red "\<0x[0-9A-Fa-f]+(\.[0-9A-Fa-f]*)?([Pp][+-]?[0-9]+)?\>"
|
||||
|
||||
# Brackets
|
||||
color brightmagenta "\(|\)|\[|\]|\{|\}"
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
## Here is an example for manpages.
|
||||
## Syntax highlighting for man pages.
|
||||
|
||||
syntax man "\.[1-9]x?$"
|
||||
magic "troff or preprocessor input"
|
||||
comment ".\""
|
||||
|
||||
color green "\.(SH|SS|TH) .*"
|
||||
color brightgreen "\.(SH|SS|TH) " "\.([HIT]P)"
|
||||
color brightred "\.(B[IR]?|I[BR]?|R[BI]|S[BM]) .*"
|
||||
color brightblue "\.(B[IR]?|I[BR]?|R[BI]|S[BM]) " "\.([LP]?P)$"
|
||||
# Section headers, title line, and indented paragraphs.
|
||||
color green "^\.(SH|SS|TH) .*"
|
||||
color brightgreen "^\.(SH|SS|TH) " "^\.([HIT]P)"
|
||||
# Type faces, and normal paragraphs.
|
||||
color brightred "^\.(B[IR]?|I[BR]?|R[BI]|S[BM]) .*"
|
||||
color brightblue "^\.(B[IR]?|I[BR]?|R[BI]|S[BM]) " "^\.([LP]?P)$"
|
||||
# Inline type faces.
|
||||
color magenta "\\f[BIPR]"
|
||||
color yellow "\.(br|DT|RS|RE|PD)"
|
||||
# Relative margins, hyperlinks, and various other stuff.
|
||||
color yellow "^\.(RS|RE|UR|UE|PD|DT)"
|
||||
color yellow "^\.(ad|bp|br|ce|de|ds|el|ie|if|fi|ft|hy|ig|in|na|ne|nf|nh|ps|so|sp|ti|tr)"
|
||||
|
||||
# Comments.
|
||||
color cyan "\.?\\\".*"
|
||||
color cyan "(^\.)?\\\".*"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -4,6 +4,6 @@ syntax mgp "\.mgp$"
|
||||
header "^%include.*"
|
||||
comment "#"
|
||||
|
||||
icolor green "^%[a-z].*"
|
||||
color green "^%[A-Za-z].*"
|
||||
color cyan "(^|[[:space:]])(#|%%).*"
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -3,25 +3,26 @@
|
||||
syntax nanorc "\.?nanorc$"
|
||||
comment "#"
|
||||
|
||||
# Possible errors and parameters
|
||||
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|i?color|extendsyntax).*"
|
||||
# Everything that does not get recolored is invalid
|
||||
color brightred ".*"
|
||||
|
||||
# Keywords
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|trimblanks|unix|view|wordbounds|zap)\>"
|
||||
icolor yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
|
||||
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+"
|
||||
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter)[[:space:]]+.*"
|
||||
icolor brightgreen "^[[:space:]]*(syntax|linter)[[:space:]]+[^[:blank:]]+"
|
||||
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|extendsyntax)\>"
|
||||
color brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|finalnewline|historylog|jumpyscrolling|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabstospaces|tempfile|trimblanks|unix|view|wordbounds|zap)\>"
|
||||
color yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|stripe|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
|
||||
color brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|stripecolor|titlecolor|whitespace|wordchars)[[:space:]]+"
|
||||
color brightgreen "^[[:space:]]*set[[:space:]]+(fill[[:space:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:space:]]+[1-9][0-9]*)\>"
|
||||
color brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]/@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]/@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|formatter|linter|tabgives)[[:space:]]+.*"
|
||||
color brightgreen "^[[:space:]]*(syntax[[:space:]]+[^[:blank:]]+|(formatter|linter)[[:space:]]+.+)"
|
||||
color green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|formatter|linter|tabgives|extendsyntax)\>"
|
||||
|
||||
# Strings
|
||||
color brightmagenta "".+"([[:space:]]|$)"
|
||||
color brightmagenta "([[:space:]]|(start|end)=)".+"([[:space:]]|$)"
|
||||
|
||||
# Colors
|
||||
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
|
||||
icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
|
||||
color yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
|
||||
color magenta "^[[:space:]]*i?color\>" "\<(start|end)="
|
||||
|
||||
# Comments
|
||||
color brightblue "(^|[[:space:]]+)#.*"
|
||||
|
||||
@@ -7,9 +7,18 @@ comment "#"
|
||||
|
||||
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
|
||||
icolor cyan start="[$@%]" end="( |[^0-9A-Z_]|-)"
|
||||
|
||||
# Variable names.
|
||||
color cyan "[$%&@]([A-Za-z_][0-9A-Za-z_]*|\^[][A-Z?\^_]|[0-9]+)\>"
|
||||
color cyan "[$%&@]\{(\^?[A-Za-z_][0-9A-Za-z_]*|\^[][?\^][0-9]+)\}"
|
||||
color cyan "[$%&@]([][!"#'()*+,.:;<=>?`|~-]|\{[][!-/:-@\`|~]\})|\$[$%&@]"
|
||||
color cyan "(^|[[:space:]])[$%@][/\]"
|
||||
|
||||
color yellow "".*"|qq\|.*\|"
|
||||
color white "[sm]/.*/"
|
||||
color white start="(^use| = new)" end=";"
|
||||
color green "#.*"
|
||||
|
||||
# Comments.
|
||||
color green "(^|[[:space:]])#.*"
|
||||
|
||||
color yellow start="<< 'STOP'" end="STOP"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for PHP.
|
||||
|
||||
syntax php "\.ph(p[23457s~]?|tml)$"
|
||||
syntax php "\.(php[23457s~]?|phtml|ctp)$"
|
||||
magic "PHP script"
|
||||
comment "//"
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ color brightmagenta "\<(Project\-Id\-Version|Report\-Msgid\-Bugs\-To|Last\-Trans
|
||||
color cyan "\<(POT\-Creation\-Date|PO\-Revision\-Date|MIME\-Version|Content\-Type|Content\-Transfer\-Encoding)\>"
|
||||
# Encodings and numbers.
|
||||
color yellow "\<(UTF|ISO|Windows|Mac|IBM)-[0-9]+"
|
||||
color yellow "[0-9]|pre[0-9]|[0-9]bit"
|
||||
color yellow "\<((pre|rc)?[0-9]+|[0-9]bit)\>"
|
||||
# Msgids.
|
||||
color brightblue "^(msgid|msgid_plural|msgstr)\>"
|
||||
# Tags.
|
||||
@@ -22,7 +22,7 @@ color yellow " (no-)?[-[:alpha:]]+-format(,|$)"
|
||||
color brightmagenta "%([1-9]\$)?[a-z]*"
|
||||
# Quotes and escaped characters.
|
||||
color yellow "\""
|
||||
color cyan "\\[abcefnrtv"\]"
|
||||
color cyan "\\([abcefnrtv"\]|x[0-9abcdefABCDEF]{2}|[0-7]{3})"
|
||||
# Reminders.
|
||||
color brightwhite,yellow "(FIXME|TODO|XXX)"
|
||||
# Obsolete strings.
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
syntax python "\.py$"
|
||||
header "^#!.*python"
|
||||
magic "Python script"
|
||||
linter pyflakes
|
||||
comment "#"
|
||||
|
||||
linter pyflakes
|
||||
|
||||
# Function definitions.
|
||||
icolor brightblue "def [0-9A-Z_]+"
|
||||
color brightblue "def [0-9A-Za-z_]+"
|
||||
# Keywords.
|
||||
color brightcyan "\<(and|as|assert|async|await|break|class|continue)\>"
|
||||
color brightcyan "\<(def|del|elif|else|except|finally|for|from)\>"
|
||||
@@ -22,14 +23,15 @@ color brightcyan "\<(exec|print)([[:blank:]]|$)"
|
||||
# Special values.
|
||||
color brightmagenta "\<(False|None|True)\>"
|
||||
|
||||
# Single-quoted strings.
|
||||
color brightgreen "'([^'\]|\\.)+'"
|
||||
color brightgreen ""([^"\]|\\.)+""
|
||||
# Mono-quoted strings.
|
||||
color brightgreen "'([^'\]|\\.)*'|'''"
|
||||
color brightgreen ""([^"\]|\\.)*"|""""
|
||||
color normal "'''|""""
|
||||
# Comments.
|
||||
color brightred "(^|[[:blank:]])#.*"
|
||||
# Triple-quoted strings.
|
||||
color brightgreen start="'''([^'),]|$)" end="(^|[^(\])'''"
|
||||
color brightgreen start="\"\"\"([^"),]|$)" end="(^|[^(\])\"\"\""
|
||||
color brightgreen start=""""([^"),]|$)" end="(^|[^(\])""""
|
||||
|
||||
# Reminders.
|
||||
color brightwhite,yellow "(FIXME|TODO|XXX)"
|
||||
|
||||
@@ -6,13 +6,13 @@ magic "Ruby script"
|
||||
linter ruby -w -c
|
||||
comment "#"
|
||||
|
||||
# Constants.
|
||||
color brightblue "\<[A-Z]+[0-9A-Z_a-z]*|(\$|@|@@)[0-9A-Z_a-z]+"
|
||||
# Reserved words.
|
||||
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module)\>"
|
||||
color yellow "\<(next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
|
||||
# Constants.
|
||||
color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
|
||||
# Ruby "symbols".
|
||||
icolor magenta "([ ]|^):[0-9A-Z_]+\>"
|
||||
color magenta "([ ]|^):[0-9A-Za-z_]+\>"
|
||||
# Some unique things we want to stand out.
|
||||
color brightyellow "\<(__FILE__|__LINE__)\>"
|
||||
# Regular expressions.
|
||||
|
||||
@@ -11,7 +11,7 @@ comment "//"
|
||||
color magenta "fn [a-z_0-9]+"
|
||||
|
||||
# Reserved words
|
||||
color yellow "\<(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\>"
|
||||
color yellow "\<(abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|true|try|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\>"
|
||||
|
||||
# Macros
|
||||
color red "[a-z_]+!"
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
syntax sh "(\.sh|\.(a|ba|c|da|k|mk|pdk|tc|z)(sh|shrc|sh_profile)|/(etc/|\.)profile)$"
|
||||
header "^#!.*/(((a|ba|c|da|k|mk|pdk|tc|z)?sh)|(busybox|env) +sh|openrc-run|runscript)"
|
||||
magic "(POSIX|Bourne-Again) shell script.*text"
|
||||
linter dash -n
|
||||
comment "#"
|
||||
|
||||
linter dash -n
|
||||
|
||||
# Function declarations.
|
||||
color brightgreen "^[A-Za-z0-9_-]+\(\)"
|
||||
|
||||
|
||||
@@ -7,14 +7,16 @@ comment "#"
|
||||
# Standard Tcl [info commands]:
|
||||
color green "\<(after|append|array|auto_execok|auto_import|auto_load|auto_load_index|auto_qualify|binary|break|case|catch|cd|clock|close|concat|continue|encoding|eof|error|eval|exec|exit|expr|fblocked|fconfigure|fcopy|file|fileevent|flush|for|foreach|format|gets|glob|global|history|if|incr|info|interp|join|lappend|lindex|linsert|list|llength|load|lrange|lreplace|lsearch|lset|lsort|namespace|open|package|pid|puts|pwd|read|regexp|regsub|rename|return|scan|seek|set|socket|source|split|string|subst|switch|tclLog|tell|time|trace|unknown|unset|update|uplevel|upvar|variable|vwait|while)\>"
|
||||
# Basic Tcl subcommands:
|
||||
color green "\<(array anymore|array donesearch|array exists|array get|array names|array nextelement|array set|array size|array startsearch|array statistics|array unset)\>"
|
||||
color green "\<(string bytelength|string compare|string equal|string first|string index|string is|string last|string length|string map|string match|string range|string repeat|string replace|string to|string tolower|string totitle|string toupper|string trim|string trimleft|string trimright|string will|string wordend|string wordstart)\>"
|
||||
color green "\<array (anymore|donesearch|exists|get|names|nextelement|set|size|startsearch|statistics|unset)\>"
|
||||
color green "\<string (bytelength|compare|equal|first|index|is|last|length|map|match|range|repeat|replace|to|tolower|totitle|toupper|trim|trimleft|trimright|will|wordend|wordstart)\>"
|
||||
# Extended TclX [info commands]:
|
||||
color green "\<(alarm|auto_load_pkg|bsearch|catclose|catgets|catopen|ccollate|cconcat|cequal|chgrp|chmod|chown|chroot|cindex|clength|cmdtrace|commandloop|crange|csubstr|ctoken|ctype|dup|echo|execl|fcntl|flock|fork|fstat|ftruncate|funlock|host_info|id|infox|keyldel|keylget|keylkeys|keylset|kill|lassign|lcontain|lempty|lgets|link|lmatch|loadlibindex|loop|lvarcat|lvarpop|lvarpush|max|min|nice|pipe|profile|random|readdir|replicate|scancontext|scanfile|scanmatch|select|server_accept|server_create|signal|sleep|sync|system|tclx_findinit|tclx_fork|tclx_load_tndxs|tclx_sleep|tclx_system|tclx_wait|times|translit|try_eval|umask|wait)\>"
|
||||
# Syntax:
|
||||
color brightblue "proc[[:space:]]" "(\{|\})"
|
||||
color green "(\(|\)|\;|`|\\|\$|<|>|!|=|&|\|)"
|
||||
color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
|
||||
icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?"
|
||||
color brightred "\$\{?[0-9A-Za-z_!@#$*?-]+\}?"
|
||||
# Trailing whitespace:
|
||||
color ,green "[[:space:]]+$"
|
||||
color ,magenta "^[[:space:]]*#.*"
|
||||
# Comments:
|
||||
color cyan "^[[:space:]]*#.*"
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
syntax tex "\.tex$"
|
||||
magic "(La)?TeX document"
|
||||
linter chktex -v0 -q -I
|
||||
comment "%"
|
||||
|
||||
icolor green "\\.|\\[A-Z]*"
|
||||
linter chktex -v0 -q -I
|
||||
|
||||
color green "\\.|\\[A-Za-z]*"
|
||||
color magenta "[{}]"
|
||||
color blue "(^|[^\])%.*"
|
||||
|
||||
Reference in New Issue
Block a user