Compare commits
835 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
8a049e3233 | ||
|
|
31fdd2908b | ||
|
|
2404474dce | ||
|
|
5474a9f34b | ||
|
|
4bd423fc92 | ||
|
|
03d10941cc | ||
|
|
cc01bc3edb | ||
|
|
5f6f8a8083 | ||
|
|
e938c24d04 | ||
|
|
f55a3fabef | ||
|
|
7ee07af081 | ||
|
|
15ec0eb3ee | ||
|
|
7dad21f4f4 | ||
|
|
362965b9a3 | ||
|
|
eaa0f1a122 | ||
|
|
9923b073af | ||
|
|
9d9ae8dc76 | ||
|
|
ca6281e821 | ||
|
|
77826c2b06 | ||
|
|
89760cd6ec | ||
|
|
f02e2d3b6e | ||
|
|
252f14796e | ||
|
|
ae3ec1784d | ||
|
|
5662a38802 | ||
|
|
02eaa4ce6d | ||
|
|
636e9ac3e8 | ||
|
|
af71d44e4e | ||
|
|
e9ba058f3d | ||
|
|
9e2a12b62a | ||
|
|
5be94a3bbe | ||
|
|
518a2b4c45 | ||
|
|
e0d9fee5d6 | ||
|
|
065672bf12 | ||
|
|
477f63d8b5 | ||
|
|
95dd873205 | ||
|
|
e901387b72 | ||
|
|
280ac81b31 | ||
|
|
b7f53096fb | ||
|
|
f7f7767e7d | ||
|
|
91155486c7 | ||
|
|
63f2be7a2f | ||
|
|
71de0b9e2f | ||
|
|
b8c51329f6 | ||
|
|
bab5eeb808 | ||
|
|
d342cbbff8 | ||
|
|
5c5806bbe7 | ||
|
|
16a3dc90c7 | ||
|
|
769a0e661f | ||
|
|
6ed0a12d80 | ||
|
|
dda9d4e357 | ||
|
|
c43177487a | ||
|
|
f442f91187 | ||
|
|
33d67d5cee | ||
|
|
a4e7d6b80b | ||
|
|
06416e3d5c | ||
|
|
e1c8dd0091 | ||
|
|
b167444ee8 | ||
|
|
6b08648377 | ||
|
|
8c456423e9 | ||
|
|
53865ced9d | ||
|
|
c2e4f77594 | ||
|
|
7ea6d6bbda | ||
|
|
e4f5848425 | ||
|
|
ddd033adaf | ||
|
|
233a0807ec | ||
|
|
f9134af504 | ||
|
|
10d9742c11 | ||
|
|
2a894213e0 | ||
|
|
826be439db | ||
|
|
8bffc8ea53 | ||
|
|
fb8d981bfa | ||
|
|
915064870f | ||
|
|
401c49e611 | ||
|
|
eb9111a575 | ||
|
|
9c2b67231e | ||
|
|
b81995af8a | ||
|
|
339e0c131a | ||
|
|
2ee2407e63 | ||
|
|
5ca444e5df | ||
|
|
d245b07c25 | ||
|
|
d66a68166d | ||
|
|
13a4f3130d | ||
|
|
b32deee382 | ||
|
|
076bc31ce5 | ||
|
|
22c8ef6c39 | ||
|
|
c8852aa5e2 | ||
|
|
5f1b618a5a | ||
|
|
52ba76b2a2 | ||
|
|
5bb2b5c08a | ||
|
|
062b6691bb | ||
|
|
f4c958e810 | ||
|
|
4b32c62674 | ||
|
|
b4b9e9b012 | ||
|
|
0b63de335e | ||
|
|
628eef28b3 | ||
|
|
600295a3af | ||
|
|
bed997171c | ||
|
|
8d0b7a490d | ||
|
|
efa323ec88 | ||
|
|
4c6ec6377f | ||
|
|
c545438a5f | ||
|
|
e998814bbc | ||
|
|
fe6cb6e516 | ||
|
|
be69a7c299 | ||
|
|
33b576c289 | ||
|
|
1f39f60b2f | ||
|
|
818ee3e68c | ||
|
|
790f98560b | ||
|
|
d718ed4fc3 | ||
|
|
368ec04870 | ||
|
|
ce94cb1dc6 | ||
|
|
031f255ffd | ||
|
|
e8a5665d2c | ||
|
|
65e4784eec | ||
|
|
e2051a61e0 | ||
|
|
a8fa0a82c4 | ||
|
|
d19169c263 | ||
|
|
4e7b92ed4c | ||
|
|
eaeafe29ca | ||
|
|
fe3a72ce3e | ||
|
|
6cd53e7f44 | ||
|
|
b84d7bf7a5 | ||
|
|
6840205e84 | ||
|
|
3c5e5d4b6f | ||
|
|
09ab2e3d0e | ||
|
|
5b1229599e | ||
|
|
8efdd08a86 | ||
|
|
27d2db2d1f | ||
|
|
571676eb85 | ||
|
|
9e71de12cd | ||
|
|
c7affe17c0 | ||
|
|
e21ce0db1f | ||
|
|
e6429e782a | ||
|
|
3270aac7db | ||
|
|
13615d0953 | ||
|
|
921f8ae4c9 | ||
|
|
24487d48ff | ||
|
|
388cd0b514 | ||
|
|
33c4bb22d5 | ||
|
|
6e80772311 | ||
|
|
5f00b02f7c | ||
|
|
c6bdc46bb0 | ||
|
|
bf5949395d | ||
|
|
a18b48f0f7 | ||
|
|
25e9877607 | ||
|
|
c524fbe6d0 | ||
|
|
93c8e316a8 | ||
|
|
80bea3eb9b | ||
|
|
b5ede4ff65 | ||
|
|
63b15275bd | ||
|
|
772c324f25 | ||
|
|
f1e5872e6a | ||
|
|
bc42ae42a9 | ||
|
|
6d62682ddb | ||
|
|
8d6b205e4c | ||
|
|
03f9761c35 | ||
|
|
ec339d3b08 | ||
|
|
3218d8358a | ||
|
|
a3a10dfafe | ||
|
|
850e538ff7 | ||
|
|
18419b5e3f | ||
|
|
07447f3278 | ||
|
|
fd65f74428 | ||
|
|
e40e6bbf10 | ||
|
|
2147e161bf | ||
|
|
dc079bdf31 | ||
|
|
8560a0a225 | ||
|
|
52d851a1aa | ||
|
|
2d434f63e2 | ||
|
|
5c179aae7d | ||
|
|
975b491235 | ||
|
|
94b4f07281 | ||
|
|
61b4eeda66 | ||
|
|
667fcea65e | ||
|
|
c39c9c241b | ||
|
|
115f089d5f | ||
|
|
7f6460b804 | ||
|
|
bc6787826a | ||
|
|
b5f15cb574 | ||
|
|
4c66a6259c | ||
|
|
db1893ef2d | ||
|
|
ad79a4fcfb | ||
|
|
418bd3be34 | ||
|
|
4170454837 | ||
|
|
e90b7cf4aa | ||
|
|
bb90de0eb4 | ||
|
|
157c7b1bc4 | ||
|
|
ac102a7516 | ||
|
|
d249233ea7 | ||
|
|
33fb54c75f | ||
|
|
c231b774d7 | ||
|
|
0c263bda7d | ||
|
|
60ee4408be | ||
|
|
72a590d60a | ||
|
|
9a47a9c4c0 | ||
|
|
9c8e40b442 | ||
|
|
54a4123d4c | ||
|
|
7a31507167 | ||
|
|
7f2031006a | ||
|
|
7e18b91ead | ||
|
|
f82eefa303 | ||
|
|
8e1ce7034d | ||
|
|
c4d09cc24b | ||
|
|
d04c8f88f1 | ||
|
|
a67f6c6031 | ||
|
|
8d8f5788ce | ||
|
|
4a268678a5 | ||
|
|
7c9a4793dd | ||
|
|
05592a84ec | ||
|
|
c46696d40c | ||
|
|
bfe65af6f3 | ||
|
|
46f5d51fb5 | ||
|
|
b99ec28a60 | ||
|
|
b2acffe5be | ||
|
|
2fef7f647d | ||
|
|
6d3b16b761 | ||
|
|
89c0e7493f | ||
|
|
14b9a42f5b | ||
|
|
3227ba46d9 | ||
|
|
d994af0334 | ||
|
|
75c7c35cfd | ||
|
|
eb84205426 | ||
|
|
c2593c1c5a | ||
|
|
d92142c66a | ||
|
|
f598a4f12d | ||
|
|
063a8b0870 | ||
|
|
ecc9211afc | ||
|
|
ab0897072a | ||
|
|
b2ff574678 | ||
|
|
3bac3c4c78 | ||
|
|
acadf71b13 | ||
|
|
4c02329205 | ||
|
|
a31896011a | ||
|
|
769504c495 | ||
|
|
18f13c3a75 | ||
|
|
aea54276b6 | ||
|
|
0c455155ad | ||
|
|
e6c6a72ee8 | ||
|
|
4a853cf451 | ||
|
|
078265456c | ||
|
|
3ac821ee0c | ||
|
|
ce0ecf67a6 | ||
|
|
b6f7ff5c6f | ||
|
|
035b91cb15 | ||
|
|
f456794045 | ||
|
|
20971e8392 | ||
|
|
fa454abb1c | ||
|
|
f2adefb158 | ||
|
|
7ae8f3bca4 | ||
|
|
9a7ba5db79 | ||
|
|
cc2b19c8fd | ||
|
|
430d3bad7a | ||
|
|
4e667bd048 | ||
|
|
ba2e6f43c2 | ||
|
|
6c555828c9 | ||
|
|
0ff068380c | ||
|
|
fb372ed0a8 | ||
|
|
ed433f6af0 | ||
|
|
44814055b5 | ||
|
|
71f859377d | ||
|
|
33d81fa1e6 | ||
|
|
78dc7b8f0a | ||
|
|
1057ca7a16 | ||
|
|
5550d15418 | ||
|
|
54cab02030 | ||
|
|
2633114b8e | ||
|
|
2e1e157967 | ||
|
|
6df30a634e | ||
|
|
856322b01e | ||
|
|
ad5d0f7530 | ||
|
|
0f2b0ffbd3 | ||
|
|
f2f901c895 | ||
|
|
a4e353799b | ||
|
|
64f28515fd | ||
|
|
b84dea9898 | ||
|
|
8492de53f7 | ||
|
|
a1dc1376be | ||
|
|
6fe132194c | ||
|
|
0ea434b006 | ||
|
|
d430934f09 | ||
|
|
dc3261b685 | ||
|
|
dc4146f077 | ||
|
|
59eb01b403 | ||
|
|
738487f13d | ||
|
|
c8a9a96578 | ||
|
|
cd8e932c65 | ||
|
|
fce54a724d | ||
|
|
4ae1b99c92 | ||
|
|
ebdb647450 | ||
|
|
0c2aac5ff8 | ||
|
|
7952d68830 | ||
|
|
5cb4485fa5 | ||
|
|
d7c1ab8e80 | ||
|
|
1881db099d | ||
|
|
36c83d92dd | ||
|
|
9021725d53 | ||
|
|
d00ab406bc | ||
|
|
d63d79b067 | ||
|
|
446c7d5fff | ||
|
|
52efac535b | ||
|
|
45c36f93e5 | ||
|
|
432a7d7729 | ||
|
|
d7fe5a7db3 | ||
|
|
a6c0212158 | ||
|
|
a832f33291 | ||
|
|
b9f533a69e | ||
|
|
ac31669ec3 | ||
|
|
86c08560ad | ||
|
|
119a6f0de3 | ||
|
|
3757683e3f | ||
|
|
c07586d9f3 | ||
|
|
3e9ef3032f | ||
|
|
6fb1509817 | ||
|
|
07ddf25cc0 | ||
|
|
73d397c64b | ||
|
|
e0c7ff2a7e | ||
|
|
84f8df2df8 | ||
|
|
408d9b8708 | ||
|
|
b5427ebb98 | ||
|
|
22663f8a2e | ||
|
|
5d02ee64b6 | ||
|
|
5ffd8d96ae | ||
|
|
f304b9aee1 | ||
|
|
299e710845 | ||
|
|
d9ba6c10d2 | ||
|
|
03c184d7f2 | ||
|
|
4ec19847a3 | ||
|
|
3628863f90 | ||
|
|
9d6621afd0 | ||
|
|
cdd637d69f | ||
|
|
4d232a4aef | ||
|
|
455899fe27 | ||
|
|
6aef1fa905 | ||
|
|
06c3e1acde | ||
|
|
09d8ee82b7 | ||
|
|
dac3b25d16 | ||
|
|
ca538e6f08 | ||
|
|
4b26308b6a | ||
|
|
f5eeb92f40 | ||
|
|
ae1ba5e259 | ||
|
|
cecf453b14 | ||
|
|
c3a02f8094 | ||
|
|
87283711ee | ||
|
|
123f77ff1a | ||
|
|
10c49edd3b | ||
|
|
2d5c917b1a | ||
|
|
95002da66c | ||
|
|
858663444e | ||
|
|
4046dfca63 | ||
|
|
c0b15c2982 | ||
|
|
e889c28a95 | ||
|
|
0da554e6d7 | ||
|
|
f1530c7ba0 | ||
|
|
0e46c0f4a5 | ||
|
|
6a064503e5 | ||
|
|
4d92dffb3a | ||
|
|
4c1c425bbb | ||
|
|
21a54a3cf6 | ||
|
|
a0147c5a72 | ||
|
|
553940760e | ||
|
|
faa0eb991e | ||
|
|
f54cd02652 | ||
|
|
6dd308d0fb | ||
|
|
4872f42cd2 | ||
|
|
62007c84c6 | ||
|
|
d0f37205af | ||
|
|
f05874ea23 | ||
|
|
0d9080a22c | ||
|
|
1ae90e205a | ||
|
|
d53086d38d | ||
|
|
0b6bb37c56 | ||
|
|
c43a6fdcc1 | ||
|
|
0c613cb1ac | ||
|
|
1e5064ef84 | ||
|
|
5b40bad629 | ||
|
|
45f8fc77e0 | ||
|
|
94347f0811 | ||
|
|
1a4a3de68b | ||
|
|
bf8bd02558 | ||
|
|
544d426d86 | ||
|
|
30a984661b | ||
|
|
7ab8a4d835 | ||
|
|
0353a24400 | ||
|
|
d4304ca88c | ||
|
|
02d8da3bdd | ||
|
|
7a09b655c1 | ||
|
|
c8b26baee8 | ||
|
|
bb394990cd | ||
|
|
7c5d099c6f | ||
|
|
152cc24d1f | ||
|
|
8965103a4d | ||
|
|
d0d293b8af | ||
|
|
839743fd24 | ||
|
|
0b30835dd0 | ||
|
|
a865c25eea | ||
|
|
cf1129a8b4 | ||
|
|
0cd833e64b | ||
|
|
cbf226476d | ||
|
|
9fcfee18e8 | ||
|
|
27eccbec23 | ||
|
|
0bce5ba4d9 | ||
|
|
f9415e347a | ||
|
|
f3c4dadcf6 | ||
|
|
20d1823d90 | ||
|
|
e01bcddf16 | ||
|
|
570fb6c606 | ||
|
|
1de3667555 | ||
|
|
5726514869 | ||
|
|
88234c90bc | ||
|
|
02719ec4bf | ||
|
|
415bf82690 | ||
|
|
9bce8bfeb3 | ||
|
|
2c024a74a9 | ||
|
|
ab8698df47 | ||
|
|
206d89b739 | ||
|
|
eff2e0e291 | ||
|
|
c5e20164c3 | ||
|
|
0f1f53a441 | ||
|
|
bf1a080923 | ||
|
|
b7f8d4819b | ||
|
|
30fc197b66 | ||
|
|
c88a2fd9ca | ||
|
|
b9de5525c4 | ||
|
|
f4d1ef1c4e | ||
|
|
dd157f1494 | ||
|
|
624918800b | ||
|
|
8b8c6bb818 | ||
|
|
b830a7dd38 | ||
|
|
3e5b0ea5fd | ||
|
|
a1132c81a1 | ||
|
|
0496aed4ab | ||
|
|
373e3b880f | ||
|
|
7b1f3f4fe7 | ||
|
|
9517972b58 | ||
|
|
95989e7dfe | ||
|
|
dcda98fb73 | ||
|
|
336fa40055 | ||
|
|
93318b972d | ||
|
|
8656f160d7 | ||
|
|
0e30177db7 | ||
|
|
3089a98169 | ||
|
|
1b704e7c8c | ||
|
|
efb9192ee5 | ||
|
|
f0734dae3e | ||
|
|
e8505b2d3e | ||
|
|
1ebb1da382 | ||
|
|
1fb3218a14 | ||
|
|
a7b1f0f03f | ||
|
|
c782b4cb72 | ||
|
|
5234475781 | ||
|
|
80605c3918 | ||
|
|
d3012be095 | ||
|
|
03bc19fd0c | ||
|
|
e4cef3086b | ||
|
|
9936a6357a | ||
|
|
899bf0ae3a | ||
|
|
1f7384ebd2 | ||
|
|
95fffa99aa | ||
|
|
22f7861694 | ||
|
|
ba96d507dd | ||
|
|
9bf57e5ca0 | ||
|
|
f9103a5cb5 | ||
|
|
e9eabdcdcb | ||
|
|
a1be8b6a19 | ||
|
|
de4fbadf20 | ||
|
|
bdd8920081 | ||
|
|
ae9ec6d4ad | ||
|
|
8f1a657a37 | ||
|
|
7f88eff96f | ||
|
|
3b8c898880 | ||
|
|
6f4f1878fc | ||
|
|
082e5db4b7 | ||
|
|
5eccaa7633 | ||
|
|
d9ac785a07 | ||
|
|
01457ae3d3 | ||
|
|
c757aee235 | ||
|
|
48749a9500 | ||
|
|
4cd3987791 | ||
|
|
aa41eb69c0 | ||
|
|
54103d8ed1 | ||
|
|
53a10ddcaf | ||
|
|
65bf04060b | ||
|
|
a95fb64dd6 | ||
|
|
b235404ade | ||
|
|
ffebd31cbb | ||
|
|
e55227f65f | ||
|
|
b77b54bf73 | ||
|
|
2428620b16 | ||
|
|
cb0289f0dc | ||
|
|
b027263a37 | ||
|
|
1a926d79c5 | ||
|
|
c79fe1a160 | ||
|
|
fef195bce9 | ||
|
|
dd9766c2e0 | ||
|
|
5b870a7632 | ||
|
|
0cf455bc48 | ||
|
|
3e1fc6385b | ||
|
|
544cda6a62 | ||
|
|
28933cf572 | ||
|
|
1635060ba6 | ||
|
|
7a038adfd4 | ||
|
|
f1b5be4bbf | ||
|
|
9ceeabda38 | ||
|
|
204e1b8353 | ||
|
|
d865d7ac8f | ||
|
|
16d237ba1b | ||
|
|
c3031b9b8f | ||
|
|
d289510724 | ||
|
|
60f1090da0 | ||
|
|
8f6ee22b41 | ||
|
|
a083d7f1e1 | ||
|
|
919df09ffa | ||
|
|
ddbff6dcb2 | ||
|
|
4295baa5fe | ||
|
|
467cc8edf3 | ||
|
|
6d111c9343 | ||
|
|
bb667beb5a | ||
|
|
eed765f4f7 |
11
AUTHORS
11
AUTHORS
@@ -5,6 +5,11 @@ nano editor. Please see the ChangeLog for specific changes by author.
|
||||
Chris Allegretta <chrisa@asty.org>
|
||||
* Original program author and long-time maintainer.
|
||||
|
||||
Benno Schulenberg <bensberg@telfort.nl>
|
||||
* An array of small bug fixes, the cut-word and block-jump
|
||||
routines, text selection by holding Shift, macro recording
|
||||
and replay, plus some key bindings. Current maintainer.
|
||||
|
||||
David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* Former stable series maintainer. Multiple buffer support,
|
||||
operating dir (-o) option, bug fixes for display routines,
|
||||
@@ -60,7 +65,5 @@ Sumedh Pendurkar <sumedh.pendurkar@gmail.com>
|
||||
Rishabh Dave <rishabhddave@gmail.com>
|
||||
* Searchable help.
|
||||
|
||||
Benno Schulenberg <bensberg@justemail.net>
|
||||
* An array of small bug fixes, the cut-word and block-jump
|
||||
routines, text selection by holding Shift, and some extra
|
||||
key bindings. Current maintainer.
|
||||
Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
|
||||
* Filtering text through an external command.
|
||||
|
||||
937
ChangeLog
937
ChangeLog
@@ -1,3 +1,940 @@
|
||||
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:
|
||||
------------------------------
|
||||
|
||||
Benjamin Mintz (1):
|
||||
syntax: python: do not highlight 'print' and 'exec' in Python 3
|
||||
|
||||
Benno Schulenberg (87):
|
||||
bindings: allow using <Enter> to exit from the linter
|
||||
bindings: allow using ^X to exit from the linter
|
||||
bindings: drop M-| as a keystroke for 'cutwordleft' -- set it free again
|
||||
bindings: in tiny version with help, don't show unfunctional M-◀ and M-▶
|
||||
bindings: make <Alt+Up> and <Alt+Down> work also on a Linux console
|
||||
bindings: make the linter separately accessible, through M-B by default
|
||||
bindings: make the Shift+arrow keys work by default on more terminals
|
||||
bindings: no longer bind F13 and F14 and F15
|
||||
bindings: recognize ASCII DEL as backspace also in viewer and browser
|
||||
bindings: recognize <Ctrl+Shift+Delete> also on a Linux console
|
||||
bindings: rename 'prevhistory' to 'older' and 'nexthistory' to 'newer'
|
||||
bindings: stop binding <Bsp> to do_backspace() in the browser menu
|
||||
bindings: when implanting a string, make sure to use positive values
|
||||
build: exclude scrolling functions only from tiny version without help
|
||||
build: fix compilation again when configured with --enable-tiny
|
||||
build: fix compilation when configured with --disable-multibuffer
|
||||
build: verify that --enable-tiny compiles before allowing a release
|
||||
bump version numbers and add a news item for the 3.1 release
|
||||
debug: report for which modified editing keys ncurses has no keycode
|
||||
display: correct a mistaken label in the help lines of the browser
|
||||
display: ensure that the help lines are shown when in linting mode
|
||||
display: let the title bar show when nano is in linting mode
|
||||
display: show the cursor also in a help text (when --showcursor is used)
|
||||
display: use a different color when showing a linting message
|
||||
docs: document the slightly changed workings of the --view option
|
||||
docs: give suggestions for alternative key bindings in the sample nanorc
|
||||
docs: remove a no-longer-needed suggestion from the sample nanorc
|
||||
docs: update the description of -R/--restricted, as it now reads nanorc
|
||||
docs, usage: mention that --showcursor now covers help texts too
|
||||
feedback: give proper message for ^R when combining --view & --restricted
|
||||
gnulib: update to its current upstream state
|
||||
help: add a relevant explanatory text for the linter
|
||||
help: move the linter to the end, to restore pairing in the help lines
|
||||
help: pull "Older" and "Newer" into view on an 80-column terminal
|
||||
help: restore the blank line between manipulation and position stuff
|
||||
help: show <PgUp> and <PgDn> instead of F7 and F8 for pagewise scrolling
|
||||
help: show the keystroke <Ctrl+Shift+Delete> as "Sh-^Del"
|
||||
linter: allow using <Ctrl+Up> and <Ctrl+Down> to jump to other message
|
||||
linter: do not pause when there are no messages for unopened files
|
||||
linter: for "first"/"last", reshow actual message after a short pause
|
||||
options: --ignorercfiles is now available in restricted mode
|
||||
options: let view mode activate "multibuffer" to allow viewing more files
|
||||
speller: remove a pointless message -- it is never seen
|
||||
startup: allow reading nanorc in restricted mode, to permit customization
|
||||
syntaxes: remove several redundant end-of-line anchors from regexes
|
||||
tweaks: add a comment, and correct an indentation
|
||||
tweaks: add two more translator hints
|
||||
tweaks: capitalize the word "nano" when at the start of a sentence
|
||||
tweaks: change a bunch of URLs to use 'https' instead of 'http'
|
||||
tweaks: condense a handful of comments, and drop an assert
|
||||
tweaks: condense another bit of code
|
||||
tweaks: define a symbol to make the code itself a little simpler
|
||||
tweaks: don't bother asking ncurses for keycodes for shifted Left/Right
|
||||
tweaks: drop a check for the needle (the search string) being empty
|
||||
tweaks: drop the checking of two flags that can no longer be toggled
|
||||
tweaks: elide a function that is used just once and is a oneliner
|
||||
tweaks: elide a wrapper function that is no longer useful
|
||||
tweaks: exclude word-deletion keystrokes from the tiny version
|
||||
tweaks: fold a few pairs of regexes into each other
|
||||
tweaks: group a series of related variables together
|
||||
tweaks: improve two comments, and reshuffle a line for consistency
|
||||
tweaks: include an extra function call only where it is needed
|
||||
tweaks: move all the function keys to the end of the shortcuts list
|
||||
tweaks: move some calls of edit_redraw() to where they are needed
|
||||
tweaks: redefine MMOST to exclude MBROWSER, to simplify the bindings
|
||||
tweaks: reduce some repetitious and superfluous comments to just one
|
||||
tweaks: remove a check that was made redundant by the previous commit
|
||||
tweaks: remove a now-unused parameter from four functions
|
||||
tweaks: remove an unneeded check for NULL, and rename a parameter
|
||||
tweaks: remove a stray file that was accidentally comitted
|
||||
tweaks: remove some old debugging code
|
||||
tweaks: rename a bunch of variables, to make it clearer what they contain
|
||||
tweaks: rename a flag, to match the name of the option
|
||||
tweaks: rename a variable, to be a bit more fitting
|
||||
tweaks: renumber a couple of symbols, and reshuffle a bit of code
|
||||
tweaks: reorder some code to put backward motion before the forward one
|
||||
tweaks: reshuffle a couple of conditions, to group things better
|
||||
tweaks: reshuffle some conditions, putting the least likely one first
|
||||
tweaks: reshuffle some lines to get standard order (first up, then down)
|
||||
tweaks: reshuffle some lines, to put things in order of option name
|
||||
tweaks: snip trailing whitespace that ended with a non-breaking space
|
||||
tweaks: stop setting and requiring the Meta flag for special keycodes
|
||||
tweaks: swap and reword two bullet points in the rnano manpage
|
||||
tweaks: there is no reason to block SIGWINCHes while waiting for speller
|
||||
undo: move another piece of checking to the two places that need it
|
||||
undo: move some special checking code to the one place that needs it
|
||||
wrapping: make the --fill option override 'set fill' again
|
||||
|
||||
Brand Huntsman (5):
|
||||
bindings: hard-bind the zap function to M-Del (Alt+Delete)
|
||||
display: make all dying messages end in a newline
|
||||
linter: throttle "first"/"last" message on repeated key presses
|
||||
new feature: a bindable 'zap', to erase text without changing cutbuffer
|
||||
options: add --zap, that makes <Bsp> and <Del> erase a marked region
|
||||
|
||||
David Lawrence Ramsey (16):
|
||||
display: do spotlighting as part of drawing the screen
|
||||
docs: update rnano manpage, as -R/--restricted now reads nanorc
|
||||
input: don't detect <Ctrl+Shift+Delete> on Linux console in tiny version
|
||||
input: properly consume a modified Delete key also in the tiny version
|
||||
input: properly recognize Alt+Delete when using -K/--rebindkeypad
|
||||
input: recognize some escape sequences for <Shift+Delete>
|
||||
speller: restore the mark coordinates slightly later
|
||||
syntax: nanohelp: properly color the keystroke "Sh-^Del"
|
||||
tweaks: don't define controldelete or controlshiftdelete in tiny version
|
||||
tweaks: join two lines, and add a clarifying comment
|
||||
tweaks: move the justifying of a single paragraph into its own function
|
||||
tweaks: normalize the indentation of the shuffled code
|
||||
tweaks: reshuffle some code to avoid several checks for having justified
|
||||
tweaks: simplify by using a 'do/while' loop instead of 'while (TRUE)'
|
||||
weeding: remove the 'active' parameter from spotlight()
|
||||
wrapping: make relative fill values work again also for screen resizes
|
||||
|
||||
|
||||
Changes between v3.0 and v3.1:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (13):
|
||||
bindings: bind ASCII DEL during startup instead of repeatedly at runtime
|
||||
bindings: make ^H rebindable also on NetBSD, FreeBSD and macOS
|
||||
bindings: when Ctrl+Shift+Delete has no keycode, don't use KEY_BSP
|
||||
bump version numbers and add a news item for the 3.1 release
|
||||
input: keep the cursor in edit window after message, also on NetBSD
|
||||
input: recognize the sequences for Ctrl+Shift+Delete on xterm and urxvt
|
||||
main: allow toggling all editor features when in view mode
|
||||
suspension: don't try to show the cursor position when going to sleep
|
||||
syntax: sh: let the header regex match also busybox shell scripts
|
||||
tweaks: condense a bit of code
|
||||
tweaks: remove a superfluous comment and a redundant assignment
|
||||
tweaks: rename a variable to be special and distinct
|
||||
tweaks: sharpen an optimization, to allow DEL to be a shortcut
|
||||
|
||||
Liu Hao (1):
|
||||
search: disallow switching to the Replace prompt when in view mode
|
||||
|
||||
|
||||
Changes between v2.9.8 and v3.0:
|
||||
--------------------------------
|
||||
|
||||
Benno Schulenberg (113):
|
||||
bindings: bind M-Q to 'findprevious' by default, and M-W to 'findnext'
|
||||
bindings: hard-bind <Ctrl+Shift+Delete> to 'cutwordleft'
|
||||
bindings: make ^Q and M-Q available also in the help viewer
|
||||
bindings: move the noconvert toggle from the main to the insert menu
|
||||
bindings: reassign the M-| keystroke to 'cutwordleft' by default
|
||||
bindings: remove backup and new-buffer toggles (M-B, M-F) from main menu
|
||||
bindings: remove the More-Space toggle entirely
|
||||
bindings: remove the 'searchagain' function entirely
|
||||
bindings: rename two bindable functions: copytext to copy, uncut to paste
|
||||
bindings: unassign the M-? keystroke, to free it up for future use
|
||||
build: add the release script to the repository
|
||||
build: fix compilation again when configured with --enable-tiny
|
||||
build: fix compilation when configured with --enable-tiny
|
||||
build: verify that 'msgfmt' is available when building from git
|
||||
bump version numbers and add a news item for the 3.0 release
|
||||
chars: make the UTF-8 case ever so slightly faster by eliding an 'if'
|
||||
chars: speed up the counting of string length for the plain ASCII case
|
||||
chars: speed up the parsing of a character for the plain ASCII case
|
||||
completion: when the cursor is not after a word fragment, say so
|
||||
cut: concentrate the logic for clearing the cutbuffer mostly in one place
|
||||
cutting: when deleting whole words, don't join lines unexpectedly
|
||||
debug: add some code to time the performance of get_totsize()
|
||||
docs: improve a comment about rebinding <Backspace>
|
||||
docs: mention that also Ctrl increases the stride when selecting text
|
||||
docs: mention that "normal" can be used to give things the default color
|
||||
docs: mention that the 'formatter' command has been superseded
|
||||
docs: reshuffle a bindable function to a slightly better position
|
||||
docs: say that 'cutwordright' is now bound to <Ctrl+Delete> by default
|
||||
docs: slightly reword the description of four bindable functions
|
||||
docs: the 'noconvert' bindable function was renamed to 'flipconvert'
|
||||
dropping a feature: remove the ability to use the 'formatter' command
|
||||
easter: show the crawl only when there is room enough for the lines
|
||||
files: add the file format on the status bar when switching buffers
|
||||
filtering: wait for the data-sending process to terminate too
|
||||
gnulib: update to its current upstream state
|
||||
help: for ^R^X, mention that the buffer can be piped to the command
|
||||
help: move "Search Again" away from "Find Next" and "Find Previous"
|
||||
input: consume the whole escape sequence for modified PgUp and PgDn keys
|
||||
input: fully consume modified PgUp and PgDn keys also in the tiny version
|
||||
input: ignore any <Escape>s before a valid command keystroke
|
||||
input: stop <Alt+Insert> from entering "3~" into the buffer
|
||||
input: stop a modified Delete key from entering stuff into the buffer
|
||||
mouse: put the row/column arguments in the proper order [coverity scan]
|
||||
prompt: concentrate manipulations of 'statusbar_x' into a single file
|
||||
prompt: remove redundant redrawings of the prompt bar
|
||||
rcfile: allow to rebind the Cancel function in the yesno menu
|
||||
rcfile, docs: no longer recognize nor mention 'set backwards'
|
||||
rcfile: do not accept rebinding F0 nor function keys above F16
|
||||
rcfile: ensure that in the yesno menu Cancel is bound to some keystroke
|
||||
rcfile: explicitly check for disallowed keywords in included files
|
||||
rcfile: reject things like "M-Del" and "^{" as invalid key names
|
||||
rcfile: when a vital function is not mapped, mention in which menu
|
||||
search: include 'findprevious' and 'findnext' in the tiny version
|
||||
signals: don't call a print routine in a signal handler
|
||||
speller: do not replace the text when the temporary file did not change
|
||||
startup: don't overwrite rcfile error messages on a Linux console
|
||||
startup: show the correct number of lines when opening multiple files
|
||||
syntax: awk: recognize any {g,m,n,}awk script also by its shebang line
|
||||
syntax: default: colorize also two-digit and capitalized nano versions
|
||||
syntaxes: remove all traces of the 'formatter' command
|
||||
syntax: nanorc: recognize 'yesno' as a valid menu to bind/unbind keys in
|
||||
syntax: nanorc: show ^@ as validly rebindable, but not any ^digit
|
||||
syntax: python: avoid coloring the three special values inside strings
|
||||
text: add auto-whitespace to the file size after creating the undo item
|
||||
tweaks: adjust indentation after the previous change
|
||||
tweaks: adjust one more translator hint, for removed toggles
|
||||
tweaks: adjust some translator hints for past changes, and add two more
|
||||
tweaks: adjust two comments, to be more accurate and general
|
||||
tweaks: avoid dereferencing a pointer when it is NULL [coverity scan]
|
||||
tweaks: close a temp file only when descriptor is valid [coverity scan]
|
||||
tweaks: correct a comment, rewrap a line, and drop some debugging stuff
|
||||
tweaks: delete some old debugging code that no longer seems useful
|
||||
tweaks: don't bother having debug code that deallocates all memory
|
||||
tweaks: don't call va_start() without calling va_end() [coverity scan]
|
||||
tweaks: drop a condition that has been made redundant two commits ago
|
||||
tweaks: drop some old debugging code
|
||||
tweaks: elide a bunch of unneeded constant strings
|
||||
tweaks: elide a function that is used just once
|
||||
tweaks: elide another function that is used just once
|
||||
tweaks: elide an unneeded/duplicate variable
|
||||
tweaks: elide a one-line function -- no, a half-line function
|
||||
tweaks: elide a subfunction that is used just once
|
||||
tweaks: exclude a global flagging variable when it is not needed
|
||||
tweaks: exclude the file-prepending code from the tiny version
|
||||
tweaks: fix a pasting error from a month ago
|
||||
tweaks: implement the name-to-menu function in another manner
|
||||
tweaks: improve a couple of comments in the sample nanorc
|
||||
tweaks: improve a translator hint and some other comments
|
||||
tweaks: move a call to where it will be executed [coverity scan]
|
||||
tweaks: normalize the indentation after the previous change
|
||||
tweaks: properly escape "\" in a man page and "@" in a texi document
|
||||
tweaks: recognize escape sequences of modified Ins/Del more precisely
|
||||
tweaks: reduce the counting of characters to just the needed function
|
||||
tweaks: remove a redundant "struct" word, and replace it in comments
|
||||
tweaks: remove a superfluous condition and a redundant refresh
|
||||
tweaks: remove redundant braces and conditions after the previous change
|
||||
tweaks: remove some braces that are now superfluous
|
||||
tweaks: remove some ineffectual parts from header-line regexes
|
||||
tweaks: remove the superfluous calls that reset the mbtowc() state
|
||||
tweaks: remove two needless words, and split up a changed text further
|
||||
tweaks: remove two superfluous assignments
|
||||
tweaks: rename a constant, to match what it actually means
|
||||
tweaks: rename a function and place its call better
|
||||
tweaks: rename a function to better match its counterpart
|
||||
tweaks: rename a function, to better state what it does
|
||||
tweaks: rename a variable and a function, for more clarity
|
||||
tweaks: rename a variable, to better match its task
|
||||
tweaks: reshuffle some lines, in order to elide one
|
||||
tweaks: reshuffle the order of the bindings, for help-line esthetics
|
||||
tweaks: show "Space" and "Bsp" in the help text of the browser
|
||||
tweaks: slightly improve error message when vital function is unmapped
|
||||
tweaks: use a shorter message, because when the screen is small...
|
||||
undo: differentiate between general filtering and spell checking
|
||||
|
||||
Brand Huntsman (4):
|
||||
input: give feedback for all unbound keys also in the help viewer
|
||||
statusbar: elevate three messages to an ALERT, to make them more visible
|
||||
tweaks: correct four spaces of indentation to a tab, in two places
|
||||
tweaks: remove the 'bright' field from the colortype struct
|
||||
|
||||
David Lawrence Ramsey (13):
|
||||
bindings: make "n" work again in file browser and help viewer
|
||||
bindings: make ^Q start a backward search also in the file browser
|
||||
docs: mention that "Ins" and "Del" are valid rebindable keys
|
||||
justify: verify being in a paragraph before trying to find its beginning
|
||||
speller: hook up a full alternative spellcheck to the undo system
|
||||
speller: hook up a marked-text alternative spellcheck to the undo system
|
||||
speller: make replace_buffer() use the cutting functions directly
|
||||
speller: make replace_marked_buffer() use the cutting functions directly
|
||||
undo: actually enable undoing/redoing an alternative spellcheck
|
||||
undo: always initialize the 'newsize' element in the undo struct
|
||||
undo: position the cursor properly when undoing/redoing magicline cuts
|
||||
undo: restore the cursor position when a cut and paste are paired
|
||||
undo: store the correct cursor position after a paired cut+insert
|
||||
|
||||
Devin Hussey (2):
|
||||
files: speed up reading by using getc_unlocked() instead of getc()
|
||||
syntax: sh: recognize more file extensions and header lines
|
||||
|
||||
Marco Diego Aurélio Mesquita (1):
|
||||
input: erase the next word when Ctrl is held while pressing Delete
|
||||
|
||||
Mark-Weston (2):
|
||||
build: fix compilation when CC=tcc
|
||||
syntax: lua: do not color strings inside comments, and add a linter
|
||||
|
||||
|
||||
Changes between v2.9.7 and v2.9.8:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (64):
|
||||
build: fix compilation failure when configured with --enable-tiny
|
||||
build: fix compilation when configured with --disable-justify
|
||||
build: fix compilation when configured with --disable-multibuffer
|
||||
build: fix compilation with --enable-{tiny,help,multibuffer}
|
||||
bump version numbers and add a news item for the 2.9.8 release
|
||||
copyright: update the years for significantly changed files
|
||||
credits: sort the names roughly according to amount of influence
|
||||
docs: add a missing double quote in the default brackets string
|
||||
docs: describe what constitutes a paragraph
|
||||
docs: improve description of 'speller' and related bindable functions
|
||||
docs: improve the description of --nonewlines, and properly sort it
|
||||
docs: improve the description of the --autoindent option
|
||||
docs: make quotes around regexes bold, as they are part of the command
|
||||
docs: mark the filtering of text through an external command as done
|
||||
docs: register Marco as the author of the filtering feature
|
||||
docs: remove mention of the quotestr for when regex support is lacking
|
||||
docs: remove quotes around the name of a syntax -- they are not needed
|
||||
docs: thank Kamil for his bug fixes, and update an email address
|
||||
docs, usage: make it clear that the argument of --quotestr is a regex
|
||||
files: give feedback during writeout also when prepending or appending
|
||||
filtering: pair the cut and the insert, so they can be undone together
|
||||
gnulib: update to its current upstream state
|
||||
justification: find the beginning of a paragraph in a better way
|
||||
justification: limit the amount of recursion to prevent a stack overflow
|
||||
justification: recognize indented paragraphs also without --autoindent
|
||||
justification: when leading whitespace exceeds fill width, wrap anyway
|
||||
linter: don't try to access absent stat info, as that gives a crash
|
||||
linter: make sure that the margin is updated before displaying a buffer
|
||||
linter: make sure the shortcuts bar will redrawn when exiting early
|
||||
main: add "/" to the quoting regex, to allow justifying //-comments
|
||||
main: interpret only a double slash (//) as quoting, not a single one
|
||||
rcfile: don't crash when a bind to a string lacks the closing quote
|
||||
startup: provide a hint for people unfamiliar with the ^char convention
|
||||
syntaxes: condense and/or correct some extension regexes
|
||||
syntax: makefile: color all keywords that GNU make recognizes
|
||||
tweaks: adjust a translator hint
|
||||
tweaks: avoid an unused-variable warning with --enable-tiny
|
||||
tweaks: avoid a warning with --enable-{tiny,help,multibuffer}
|
||||
tweaks: condense a comment, and elide an unneeded 'if'
|
||||
tweaks: condense some repetitious comments, and check before assigning
|
||||
tweaks: condense two statements into one, and elide a 'break'
|
||||
tweaks: elide a function that is called just once
|
||||
tweaks: elide another function that is called just once
|
||||
tweaks: exclude an unneeded 'if' from the single-buffer version
|
||||
tweaks: frob a couple of comments
|
||||
tweaks: frob some comments, and rename two parameters to make sense
|
||||
tweaks: give some continuation lines a more obvious indentation
|
||||
tweaks: improve a couple of comments, and reshuffle a group of lines
|
||||
tweaks: make better use of an existing variable
|
||||
tweaks: make better use of an intermediate variable
|
||||
tweaks: reduce the abundance of the word 'toggle' in the Info manual
|
||||
tweaks: remove a superfluous assignment -- the lead length never changes
|
||||
tweaks: remove two superfluous checks, after making one of them so
|
||||
tweaks: rename a function, for more aptness and extra contrast
|
||||
tweaks: rename a variable, for contrast, and improve two comments
|
||||
tweaks: rename a variable, to give it some meaning
|
||||
tweaks: rename two variables, to better fit their tasks
|
||||
tweaks: reshuffle a condition, and adjust a comment and some indentation
|
||||
tweaks: reshuffle a couple of assignments
|
||||
tweaks: simplify the determining of the prefix for justified lines
|
||||
tweaks: stop decreasing both the iterator and the limit of a loop
|
||||
tweaks: use a more meaningful variable name, and avoid a distant 'else'
|
||||
wrapping: use "smart" autoindenting only when hard-wrapping is enabled
|
||||
wrapping: when autoindenting, use indentation of next line as example
|
||||
|
||||
Brand Huntsman (1):
|
||||
tweaks: avoid two unused variable warnings when NLS is disabled
|
||||
|
||||
Cristian Caloghera (1):
|
||||
syntax: makefile: recognize also an all-lowercase makefile name
|
||||
|
||||
David Lawrence Ramsey (3):
|
||||
bindings: add the "flippipe" bindable function
|
||||
tweaks: avoid an unused variable warning with --enable-tiny
|
||||
tweaks: fix some grammar plus a typo in the comments
|
||||
|
||||
Marco Diego Aurélio Mesquita (2):
|
||||
linter: check all open buffers, instead of just the next one
|
||||
new feature: allow piping (selected) text to an external command
|
||||
|
||||
|
||||
Changes between v2.9.6 and v2.9.7:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (21):
|
||||
bindings: add the 'linenumbers' bindable function
|
||||
bindings: rename constupdate to constantshow, cuttoend to cutfromcursor
|
||||
bump version numbers and add a news item for the 2.9.7 release
|
||||
docs: add notes about deprecated options and function names
|
||||
docs: break down some old improvements further per version
|
||||
docs: note a small difference with Pico in the default hard-wrapping
|
||||
docs: say thanks to three recent translators, and re-sort two others
|
||||
docs: slightly improve the description of the file browser in the manual
|
||||
main: clear a spurious error number, to avoid irrelevant messages later
|
||||
prompt: when asking for Yes/No/All, recognize also UTF-8 letters
|
||||
scrolling: only do a scroll when the edit window has more than one row
|
||||
signals: don't trap segfault/abort when envvar NANO_NOCATCH is defined
|
||||
signals: exclude the crash handler from the tiny version
|
||||
startup: suggest using ^D to finish reading from standard input
|
||||
tweaks: improve a couple of comments
|
||||
tweaks: normalize indentation and whitespace after previous changes
|
||||
tweaks: put check for -h and -l options in their alphabetical positions
|
||||
tweaks: put Yes/No/All in a consistent order (for the translators)
|
||||
tweaks: rename two variables, to be more descriptive
|
||||
tweaks: sort an option better, and reschedule a removal
|
||||
tweaks: use symbolic names instead of puzzling TRUE and FALSE
|
||||
|
||||
Devin Hussey (1):
|
||||
signals: upon a crash, save changed buffers and reset terminal state
|
||||
|
||||
Mark-Weston (1):
|
||||
new feature: an option to make the 'nextword' function stop at word ends
|
||||
|
||||
|
||||
Changes between v2.9.5 and v2.9.6:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (39):
|
||||
build: do not prefix an alternative rcfilename with a dot
|
||||
build: fix compilation when configured with --disable-help
|
||||
bump version numbers and add a news item for the 2.9.6 release
|
||||
command-execution: do not crash when opening the pipe would fail
|
||||
completion: correctly do a signed comparison, to avoid a segfault
|
||||
files: prevent a hang when a call to sigaction() would fail
|
||||
formatting, linting: redetermine the argument list for every run
|
||||
gnulib: update to its current upstream state
|
||||
memory: use a reallocation to reduce the amount of leakage
|
||||
prompt: recognize Yes/No/All in English when the locale gives no match
|
||||
rcfile: skip color commands where some color name is invalid
|
||||
scrolling: don't redraw entire edit window when cursor goes offscreen
|
||||
search: always go forward by default, also when coming from Goto-Line
|
||||
search: use a better value to mean "nothing was typed"
|
||||
speller: don't add an extra newline when saving the text to a tempfile
|
||||
syntax: po: highlight also other escaped characters, not just \n
|
||||
syntax: sh: colorize options only when they are preceded by whitespace
|
||||
tweaks: adjust the translator hint about Yes/No/All
|
||||
tweaks: correct or improve a couple of comments
|
||||
tweaks: elide a function that is called just once
|
||||
tweaks: fix a typo, remove a blank line, and improve some comments
|
||||
tweaks: frob a couple of comments
|
||||
tweaks: group some more of the empty functions together
|
||||
tweaks: improve some comments, and exit with nonzero status upon error
|
||||
tweaks: improve the ordering of a couple of functions
|
||||
tweaks: invert two conditions and reshuffle, to reduce duplication
|
||||
tweaks: move a function to its proper location
|
||||
tweaks: move a function to its proper location
|
||||
tweaks: rearrange a few if statements more symmetrically
|
||||
tweaks: remove the group handling for undoing/redoing (un)indents
|
||||
tweaks: rename a function, to be more distinct from its caller
|
||||
tweaks: rename a function, to be more fitting and descriptive
|
||||
tweaks: rename a variable, for clarity
|
||||
tweaks: rename a variable, to be a bit more fitting
|
||||
tweaks: rename a variable, to be more clear and to match another
|
||||
tweaks: rename a variable, to match another and to be more visible
|
||||
tweaks: reshuffle two declarations
|
||||
tweaks: set the correct flags just once for each spell-fixing session
|
||||
tweaks: use meaningful names instead of puzzling values
|
||||
|
||||
Liu Hao (1):
|
||||
replacing: always clear the backwards flag for ^\, just like for ^W
|
||||
|
||||
|
||||
Changes between v2.9.4 and v2.9.5:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (45):
|
||||
build: exclude more things when configured with --disable-multibuffer
|
||||
build: fix compilation again when configured with --enable-tiny
|
||||
build: fix compilation when configured with --disable-multibuffer
|
||||
build: fix compilation with --enable-{tiny,help,multibuffer}
|
||||
bump version numbers and add a news item for the 2.9.5 release
|
||||
cut: avoid calling renumber() on what might be NULL
|
||||
docs: clarify how the Linux console is deficient: in the arrow keys
|
||||
docs: clarify what the scrollup and scrolldown bindable functions do
|
||||
docs: document the newly added color name "normal"
|
||||
docs: mention in the FAQ that <Shift+Insert> pastes from the clipboard
|
||||
files: prevent an infinite loop when reading from standard input fails
|
||||
files: prevent the undo of reading a file into a new buffer
|
||||
help: describe the Scroll-Up and Scroll-Down commands more precisely
|
||||
help: do not reserve space for line numbers, as they are absent
|
||||
linting: drop messages for other files when configured for one buffer
|
||||
memory: plug a leak, by actually freeing a discarded undo struct
|
||||
scrolling: first move the cursor before pushing current chunk offscreen
|
||||
scrolling: let Scroll-Up/Down keep the cursor in the same text position
|
||||
selecting: don't cancel a softmark when just scrolling the screen
|
||||
small addition: understand color name "normal" to mean the default color
|
||||
syntax: sh: color also the 'cut', 'head', 'tail', and 'sort' commands
|
||||
syntax: sh: color options distinctively, and color also long options
|
||||
syntax: sh: uncolor "tar" when it's part of a filename
|
||||
tweaks: adjust a couple of types, to reduce the number of warnings
|
||||
tweaks: adjust or correct some comments, and rename a function
|
||||
tweaks: adjust the indentation after the previous changes
|
||||
tweaks: bundle some settings for a new buffer
|
||||
tweaks: change a parameter of open_buffer() and invert its logic
|
||||
tweaks: condense some code, to remove a bit of duplication
|
||||
tweaks: drop a handful of unhelpful asserts
|
||||
tweaks: elide an unneeded and shadowing variable
|
||||
tweaks: elide a parameter, as it's always the inverse of another
|
||||
tweaks: elide a parameter that is always 1
|
||||
tweaks: elide two parameters and thus a pair of wrapper functions
|
||||
tweaks: factor out the check for 'viewok' into its own function
|
||||
tweaks: fix a typo and adjust some wording and formatting in the FAQ
|
||||
tweaks: frob some comments plus miscellaneous other stuff
|
||||
tweaks: fuse two ifs into one
|
||||
tweaks: move an 'if' and then remove an unneeded label
|
||||
tweaks: reduce the font size of the questions in the FAQ
|
||||
tweaks: remove an inconsistent space from two pointer declarations
|
||||
tweaks: remove unneeded settings and unsettings of MULTIBUFFER
|
||||
tweaks: reshuffle some movement code, to reduce the number of conditions
|
||||
tweaks: revert commit c88a2fd9 -- the extra variable is needed
|
||||
tweaks: rewrap and amend some lines in the NEWS file
|
||||
|
||||
David Lawrence Ramsey (1):
|
||||
tweaks: correct several parameter types
|
||||
|
||||
Kamil Dudka (1):
|
||||
input: do not crash if sctofunc() returns NULL
|
||||
|
||||
Liu Hao (1):
|
||||
build: fix compilation error when configured with --disable-justify
|
||||
|
||||
|
||||
Changes between v2.9.3 and v2.9.4:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (65):
|
||||
bindings: make a key defined as string work also in browser and viewer
|
||||
bindings: rename the bindable function 'gototext' to 'flipgoto'
|
||||
bindings: revert the ^/ changes, as ^/ is not always Go-To-Line
|
||||
bindings: show ^/ instead of ^_ for Go-To-Line
|
||||
build: fix compilation when configured with --enable-tiny
|
||||
bump version numbers and add a news item for the 2.9.4 release
|
||||
docs: mention that a key can be bound to a string
|
||||
docs: note also in the Info manual that text can be selected with Shift
|
||||
editing: when --smooth is used, make <Enter>-at-bottom scroll one row
|
||||
general: detect in a better way whether we're running on a Linux console
|
||||
gnulib: update to its current upstream state
|
||||
goto: avoid a segfault, by initializing 'answer' when it is NULL
|
||||
help: mention that some keys work on a region when the mark is on
|
||||
help: tweak the descriptions of ^X and ^R
|
||||
input: handle the implant() function separately also for the prompt
|
||||
input: handle the implant() function separately, as it is special
|
||||
memory: avoid a leak when toggling from Search to Goto
|
||||
memory: squeal when there is something wrong, instead of stumbling on
|
||||
new feature: allow binding a key to a string (in a nanorc file)
|
||||
prompt: disallow pasting when in restricted mode
|
||||
rcfile: allow a syntax name to be unquoted
|
||||
search: clear the existing answer when starting a new search
|
||||
search: get rid of some unneeded recursion when just toggling things
|
||||
selecting: cancel the softmark upon any attempt to move the cursor
|
||||
small addition: allow customizing the color of an error message
|
||||
syntax: color also ^/ in nano's help texts and in nanorc files
|
||||
syntaxes: remove quotes from each syntax name, and color it differently
|
||||
syntax: nanorc: color also bindings to a string as valid
|
||||
tweaks: adjust comments and indentation after the previous change
|
||||
tweaks: adjust two comments, move two declarations, rewrap three lines
|
||||
tweaks: appease valgrind concerning syscalls with uninitialized values
|
||||
tweaks: condense a comment and elide an 'if'
|
||||
tweaks: correct a typo in NEWS
|
||||
tweaks: correct a typo that broke binding a key to a string
|
||||
tweaks: do not needlessly renumber the lines in the buffer
|
||||
tweaks: don't call strcmp() to determine whether a string is empty
|
||||
tweaks: drop an assert, add a warning, and change a 'for' to a 'while'
|
||||
tweaks: drop some debugging stuff, and adjust what remains of it
|
||||
tweaks: elide another variable, to call a function less often
|
||||
tweaks: elide an unneeded variable
|
||||
tweaks: elide an unneeded variable
|
||||
tweaks: elide an unneeded variable
|
||||
tweaks: elide an unused variable and parameter
|
||||
tweaks: elide two unneeded booleans
|
||||
tweaks: exclude an unlikely error message from the tiny version
|
||||
tweaks: exclude an unlikely warning from the tiny version
|
||||
tweaks: fix a copy-and-paste error
|
||||
tweaks: make the fsfromline() call only for the undo types that need it
|
||||
tweaks: plug a memory leak when using Verbatim Input at a prompt
|
||||
tweaks: refactor the implanting of a key expansion
|
||||
tweaks: remove another superfluous check
|
||||
tweaks: remove a superfluous check
|
||||
tweaks: remove two deprecated options and six rebindable function names
|
||||
tweaks: remove two superfluous checks, and restrict two others
|
||||
tweaks: rename a parameter and a variable, to be more fitting
|
||||
tweaks: rename a variable to be more distinct and greppable
|
||||
tweaks: rename two variables, to be more meaningful
|
||||
tweaks: reshuffle some code, to be slightly less ugly
|
||||
tweaks: reshuffle some of the search-and-replace cleanup calls
|
||||
tweaks: reshuffle the undo types into mostly the same order everywhere
|
||||
tweaks: shorten the name of two record elements
|
||||
tweaks: slightly rewrap the FAQ's table of contents
|
||||
tweaks: transform a 'do' to a 'while', and reshuffle a comment
|
||||
tweaks: unabbreviate two variable names
|
||||
undo: when redoing, don't try to find a line number that might not exist
|
||||
|
||||
Brand Huntsman (1):
|
||||
color: remove unneeded bright comparision to prevent duplicate pairs
|
||||
|
||||
David Lawrence Ramsey (3):
|
||||
docs: mention that errorcolor does have default colors
|
||||
input: don't stop prepending when the user adds text via a shortcut
|
||||
tweaks: fix typo in rebindable function name
|
||||
|
||||
Tom Levy (1):
|
||||
syntax: go: highlight also floats with leading zeroes as valid
|
||||
|
||||
|
||||
Changes between v2.9.2 and v2.9.3:
|
||||
----------------------------------
|
||||
|
||||
|
||||
@@ -8278,7 +8278,7 @@ nano 0.7.6 - 2000.01.15
|
||||
having a newline at the end doesn't get read, bugfix in do_replace
|
||||
with replace all, more/better comments. (Robert Siemborski)
|
||||
0.7.2 Our first patch accepted into the source! configure fixes
|
||||
and optimizations (Erik Anderson). Added missing stdarg.h to winio.c.
|
||||
and optimizations (Erik Andersen). Added missing stdarg.h to winio.c.
|
||||
Bug fix in update_line for editing long lines. Fixed arguments
|
||||
being put into the filename when none is specified. Preliminary
|
||||
+line command argument function.
|
||||
|
||||
@@ -3555,10 +3555,10 @@ GNU nano 2.1.4 - 2008.08.09
|
||||
* text.c (add_undo): Fix check for multi-line cut check skips adding other new legit events.
|
||||
|
||||
2008-07-23 Chris Allegretta <chrisa@asty.org>
|
||||
* text.c: Reset openfile-> to OTHER after an undo or redo so we don't
|
||||
mistakenly think this is an update when it's really an add. Also
|
||||
fix an extra ; after an if statement which makes nano try to free
|
||||
a struct which may be NULL.
|
||||
* text.c: Reset openfile->last_action to OTHER after an undo or redo
|
||||
so we don't mistakenly think this is an update when it's really an
|
||||
add. Also fix a mistaken ; after an if statement which made nano
|
||||
try to free a struct which might be NULL.
|
||||
|
||||
GNU nano 2.1.3 - 2008.08.04
|
||||
|
||||
|
||||
44
IMPROVEMENTS
44
IMPROVEMENTS
@@ -1,7 +1,27 @@
|
||||
Improvements in GNU nano
|
||||
========================
|
||||
|
||||
Since 4.0:
|
||||
- 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.
|
||||
- An external spell check can be undone.
|
||||
|
||||
Since 2.9.0:
|
||||
- The ability to filter text through an external command.
|
||||
- Better detection of paragraphs, allowing a less indented beginning.
|
||||
- Option 'set afterends' for making Ctrl+Right stop at word ends.
|
||||
- A crash handler that saves changed buffers in case of a crash.
|
||||
- Addition of the color name "normal", meaning the default color.
|
||||
- A key can be bound to a string -- any mix of text and commands.
|
||||
- Error messages are shown by default in bright white on red.
|
||||
- <Tab> and <Shift+Tab> can be used to indent/unindent a marked region.
|
||||
- Can snip trailing whitespace while typing, with 'set trimblanks'.
|
||||
- The ability to record and replay a series of keystrokes (a macro).
|
||||
@@ -11,7 +31,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).
|
||||
@@ -31,28 +50,29 @@ Since 2.6.0:
|
||||
- The option 'wordchars' for specifying extra word characters.
|
||||
- Hi-bit control characters are shown in a more readable manner.
|
||||
- The ability to use negative numbers at the Go To Line prompt.
|
||||
|
||||
Noteworthy changes since 2.2
|
||||
----------------------------
|
||||
- The ability to comment/uncomment lines with a single keystroke (M-3).
|
||||
- The ability to refresh the file list in the browser (^L).
|
||||
- The ability to abort re-searches (^C after an M-W).
|
||||
- Better feedback at startup when opening large or multiple files.
|
||||
|
||||
Since 2.5.0:
|
||||
- The option 'justifytrim' for snipping whitespace from justified lines.
|
||||
- The ability to discard a buffer (^O ^Q) when --tempfile is used.
|
||||
- Replacing things in a marked region now takes place in situ, in context,
|
||||
instead of changing the view to only the marked text.
|
||||
- On some terminals Ctrl+Left / Ctrl+Right now work for PrevWord/NextWord.
|
||||
- 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.
|
||||
- Invalid byte sequences are properly displayed and not mistakenly found.
|
||||
- Resizing the window does not exit from help viewer nor file browser.
|
||||
- Improved arrangement of the shortcuts in the two help lines.
|
||||
- Several small bug fixes in the syntax highlighting.
|
||||
- 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.
|
||||
|
||||
Since 2.4.0:
|
||||
- Replacing things in a marked region now takes place in situ, in context,
|
||||
instead of changing the view to only the marked text.
|
||||
- Invalid byte sequences are properly displayed and not mistakenly found.
|
||||
- Resizing the window does not exit from help viewer nor file browser.
|
||||
|
||||
Since 2.3.0:
|
||||
- System syntaxes can be improved upon with the 'extendsyntax' command.
|
||||
- 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.
|
||||
|
||||
221
NEWS
221
NEWS
@@ -1,3 +1,148 @@
|
||||
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 halfs 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
|
||||
title bar and the color of the status bar to make linting
|
||||
mode more obvious. It also adds a bindable 'zap' function
|
||||
for deleting a line or marked region without changing the
|
||||
cutbuffer, adds --zap to bind the <Del> and <Backspace>
|
||||
keys to the zap function when something is marked, and
|
||||
hard-binds <Alt+Del> to 'zap'. Furthermore, it shows the
|
||||
cursor also in the help viewer (when --showcursor is used),
|
||||
renames the bindable functions 'prevhistory' to 'older' and
|
||||
'nexthistory' to 'newer' (update your nanorcs when needed),
|
||||
reads the nanorc files also in restricted mode to allow
|
||||
customization by the user (if this should not be allowed,
|
||||
use --ignorercfiles in addition to --restricted), allows
|
||||
in view mode to open also other files (if this should not
|
||||
be allowed, use --restricted in addition to --view), makes
|
||||
resizes respect a relative --fill again, no longer binds
|
||||
F13...F15 by default, properly re-highlights a misspelled
|
||||
word after invoking help in the internal spell checker,
|
||||
and does not skip Unicode characters in string binds.
|
||||
|
||||
2018.09.18 - GNU nano 3.1 "Je faisais des bonds comme ça!" fixes a
|
||||
misbinding of ^H on some terminals and some systems,
|
||||
does not leave stray stuff after the prompt upon exit
|
||||
when having suspended nano while using --constantshow,
|
||||
and does not allow to toggle to Replace in view mode.
|
||||
|
||||
2018.09.09 - GNU nano 3.0 "Water Flowing Underground" speeds up the
|
||||
reading of a file by seventy percent, roughly doubles the
|
||||
speed of handling ASCII text, changes the way words at line
|
||||
boundaries are deleted, makes <Ctrl+Delete> wipe the next
|
||||
word and <Ctrl+Shift+Delete> the preceding word, binds M-Q
|
||||
to 'findprevious' by default (the Tabs-to-Spaces toggle is
|
||||
placed on M-O, and the More-Space toggle is fully removed),
|
||||
makes an external spell check undoable, shows the correct
|
||||
number of lines on the status bar when opening multiple
|
||||
files, removes the 'formatter' command, removes the
|
||||
'searchagain' bindable function (M-W is now bound to
|
||||
'findnext' by default), moves the No-Convert toggle to the
|
||||
Insert menu, removes the Backup and New-Buffer toggles from
|
||||
the main menu (they remain in the Write-Out and Insert
|
||||
menus, respectively), is more precise in what it accepts as
|
||||
a rebindable key name, ignores any presses of <Esc> before
|
||||
a valid command keystroke, recognizes some more escape
|
||||
sequences for modified editing-pad keys, does not hide
|
||||
rcfile error messages on a Linux console, renames the
|
||||
bindable functions 'copytext' to 'copy' and 'uncut' to
|
||||
'paste', and avoids a possible hang during a Full-Justify.
|
||||
|
||||
|
||||
2018.06.02 - GNU nano 2.9.8 "Espresso" brings the ability to filter the
|
||||
buffer (or the marked region) through an external command
|
||||
(^R^X and prefix the command with the pipe symbol, "|"), is
|
||||
better at detecting and maintaining paragraphs, is able to
|
||||
justify //-style comments, fixes a crash when the binding
|
||||
of a key to a string lacks a closing quote, gives feedback
|
||||
about the number of lines written also when prepending or
|
||||
appending, and fixes a couple of bugs with the linter.
|
||||
|
||||
2018.05.15 - GNU nano 2.9.7 "Hvide Sande" adds the option '--afterends'
|
||||
for making Ctrl+Right (the nextword function) stop at word
|
||||
ends instead of beginnings, accepts multibyte letters for
|
||||
the Yes/No/All answers, does emergency saves of changed
|
||||
buffers in the unlikely event that nano crashes, adds the
|
||||
until-now missing bindable function 'linenumbers', and
|
||||
renames the toggles 'constupdate' to 'constantshow' and
|
||||
'cuttoend' to 'cutfromcursor', for consistency with the
|
||||
corresponding options -- adjust your nanorc files soon.
|
||||
|
||||
2018.04.27 - GNU nano 2.9.6 "Gomance" fixes a crash in word completion,
|
||||
makes --enable-altrcname work again, improves the fluidity
|
||||
of scrolling when using the touchpad, tweaks the syntaxes
|
||||
for shell scripts and PO files, makes a replacing session
|
||||
go always forward by default, no longer inserts a newline
|
||||
after an external spell check of a selected region, always
|
||||
accepts the English Y and N (and A) at a yes-no prompt in
|
||||
any locale, and solves a few hypothetical bugs.
|
||||
|
||||
2018.03.29 - GNU nano 2.9.5 "Kiša pada" changes the way the Scroll-Up
|
||||
and Scroll-Down commands work (M-- and M-+): instead of
|
||||
keeping the cursor in the same screen position they now
|
||||
keep the cursor in the same text position (if possible).
|
||||
This version further adds a new color name, "normal",
|
||||
which gives the default foreground or background color,
|
||||
which is useful when you want to undo some overzealous
|
||||
painting by earlier syntax regexes. Bug fixes include:
|
||||
a segfault when trying to insert a file in restricted
|
||||
mode, the reading in of a new file being "undoable", a
|
||||
slight miswrapping of help texts when --linenumbers was
|
||||
used, and the shell syntax coloring the word "tar" in
|
||||
file names.
|
||||
|
||||
2018.03.08 - GNU nano 2.9.4 "Isabel" allows binding a key to a string
|
||||
(any piece of text and/or commands), permits customizing
|
||||
the color of error messages with 'set errorcolor', colors
|
||||
those error messages by default in bright white on red,
|
||||
makes <Enter> at the bottom of the screen scroll just one
|
||||
row when --smooth is used, does not fail when redoing a
|
||||
file insertion, and cancels a Shift-selection when any
|
||||
cursor key is pressed without Shift even when the cursor
|
||||
cannot move. Further, it treats tabs fully the same as
|
||||
spaces when doing automatic hard-wrapping, allows syntax
|
||||
names to be unquoted, and removes two deprecated options
|
||||
and six deprecated bindable function names.
|
||||
|
||||
2018.01.29 - GNU nano 2.9.3 "Córdoba" fixes a segfault with trimblanks
|
||||
that could occur when a typed space caused the word after
|
||||
it to be pushed to the next line. It further makes macros
|
||||
@@ -5,7 +150,7 @@
|
||||
adds the options -M and --trimblanks for the command line,
|
||||
recognizes key combos with Shift on a few more terminals,
|
||||
no longer shows dots in certain prompt texts when visible
|
||||
witespace is turned on, fixes two corner cases when doing
|
||||
whitespace is turned on, fixes two corner cases when doing
|
||||
replacements in a marked region, allows to open a named
|
||||
pipe again when using --noread, and accurately detects
|
||||
a needed color change when a line contains a start match
|
||||
@@ -179,7 +324,7 @@
|
||||
option 'set numbercolor'. This release furthermore fixes
|
||||
some bugs with scrolling in softwrap mode, is more strict
|
||||
in the parsing of key rebindings, and marks a new buffer
|
||||
as modified when the output of a command (^R ^X) has been
|
||||
as modified when the output of a command (^R^X) has been
|
||||
read into it. Come and check it out!
|
||||
|
||||
2016.09.01 - GNU nano 2.7.0 "Suni" adds a new feature: allowing text to
|
||||
@@ -513,7 +658,7 @@
|
||||
history. On the features front, nano will now attempt to
|
||||
retain the proper ownership and permissions when trying
|
||||
to create a .save file due to receiving a signal. Nano
|
||||
can also now unbind keys from one or more menus via the
|
||||
can now also unbind keys from one or more menus via the
|
||||
'unbind' keyword. Finally, passing --fill or --nowrap on
|
||||
the command line will now override any related .nanorc
|
||||
entries. Speak now or forever hold your bugs!
|
||||
@@ -539,8 +684,8 @@
|
||||
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
|
||||
or via "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)
|
||||
Remember: data loss happens, back up your files.
|
||||
|
||||
@@ -588,9 +733,9 @@
|
||||
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.
|
||||
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).
|
||||
Come get some.
|
||||
|
||||
2008.10.03 - GNU nano 2.1.6 was for new features before it was against
|
||||
@@ -1215,18 +1360,18 @@
|
||||
with it.
|
||||
|
||||
2002.01.05 - GNU nano 1.1.5 is out. The main new feature in this
|
||||
release is the changed behavior of the keypad. Nano now
|
||||
does the Right Thing and used keypad() by default. If
|
||||
you wish to use the keypad arrow keys in certain
|
||||
terminals, you may use the -K or --keypad flag to use
|
||||
release is the changed behavior of the keypad. Nano
|
||||
now does the Right Thing and uses keypad() by default.
|
||||
If you wish to use the keypad arrow keys in certain
|
||||
terminals, you may use the -K or --keypad flag to get
|
||||
the old behavior. Users of other OSes should see better
|
||||
handling of their non-keypad keys in this release.
|
||||
Other changes include more Hurd fixes, fixes parsing
|
||||
the .nanorc, display fixes for the color syntax
|
||||
highlighting, gettext stabilization and many translation
|
||||
updates. This is almost like a stable release, much
|
||||
like in the 0.9.x series when every other release was
|
||||
the most stable one :) Have fun!
|
||||
Other changes include more Hurd fixes, fixes parsing the
|
||||
.nanorc, display fixes for the color syntax highlighting,
|
||||
gettext stabilization and many translation updates.
|
||||
This is almost like a stable release, much like in the
|
||||
0.9.x series when every other release was the most stable
|
||||
one :) Have fun!
|
||||
|
||||
2001.12.11 - GNU nano 1.1.4 is released. This release contains
|
||||
rudimentary color syntax support (but it's still
|
||||
@@ -1239,7 +1384,7 @@
|
||||
|
||||
2001.10.26 - GNU nano 1.1.3 is released. As far as new features go,
|
||||
the help system is now available for all functions in
|
||||
the editor. Also, nano will also now print a message on
|
||||
the editor. Also, nano will now also print a message on
|
||||
the status bar when it automatically converts a file
|
||||
from Mac or DOS format, and trying to load a file that
|
||||
has already been loaded in multibuffer mode will now
|
||||
@@ -1369,11 +1514,10 @@
|
||||
code freeze for nano 1.0. Don't expect (or request) any
|
||||
new features between now and nano 1.0, only bugfixes,
|
||||
optimizations and doc/translation updates. For fixes, a
|
||||
nasty segfault when trying to insert one's home
|
||||
directory (~), some checks for the NumLock key making
|
||||
the keypad go awry, window size sanity checks, many
|
||||
autoconf fixes, and support for the KDE Konsole keypad
|
||||
layout. Have fun.
|
||||
nasty segfault when trying to insert one's home directory
|
||||
(~), some checks for the NumLock key making the keypad go
|
||||
awry, window size sanity checks, many autoconf fixes, and
|
||||
support for the KDE Konsole keypad layout. Have fun.
|
||||
|
||||
2001.01.07 - Nano 0.9.25 is the "Just one more feature I swear!"
|
||||
release. It includes one new feature that Pico has had
|
||||
@@ -1384,13 +1528,13 @@
|
||||
for crashes when tab completion in certain instances.
|
||||
Have fun and Happy New Year!
|
||||
|
||||
2000.12.18 - Nano 0.9.24 is released. This version contains the last of
|
||||
the security fixes for writing files, as well as for a
|
||||
nasty segfault when nano is unable to open a file for
|
||||
reading, among other fixes. Nano also now cowardly
|
||||
2000.12.18 - Nano 0.9.24 is released. This version contains the last
|
||||
of the security fixes for writing files, as well as for
|
||||
a nasty segfault when nano is unable to open a file for
|
||||
reading, among other fixes. Nano now also cowardly
|
||||
refuses to open device files, to stop silly things like
|
||||
trying to open /dev/zero. New features include being
|
||||
Able to use Meta-Meta-<key> as Control-<key>, better
|
||||
able to use Meta-Meta-<key> as Control-<key>, better
|
||||
HURD support, and some new flags have been added for
|
||||
Pico compatibility. Upgrading to this version is highly
|
||||
recommended.
|
||||
@@ -1482,15 +1626,14 @@
|
||||
of the curses library used. Yay.
|
||||
|
||||
2000.07.27 - Nano 0.9.14 is officially the "13 is so unlucky it should
|
||||
be skipped as a version number" release. One typo
|
||||
caused unending problems (calling nano with either -t or
|
||||
-k caused both flags to be used). The -k code is also
|
||||
now closer in functionality to Pico's -k mode; please
|
||||
note that this code is not finished yet. Working on
|
||||
this code has made me realize that there is not enough
|
||||
abstraction in the code, and I will be working on that
|
||||
for the next release. Until then, have fun with this
|
||||
version.
|
||||
be skipped as a version number" release. One typo caused
|
||||
unending problems (calling nano with either -t or -k
|
||||
caused both flags to be used). The -k code is now also
|
||||
closer in functionality to Pico's -k mode; please note
|
||||
that this code is not finished yet. Working on this code
|
||||
has made me realize that there is not enough abstraction
|
||||
in the code, and I will be working on that for the next
|
||||
release. Until then, have fun with this version.
|
||||
|
||||
2000.07.23 - Nano 0.9.13 has a few new bits and bobs, most notably the
|
||||
-k option from Pico (cut to end of line). The majority
|
||||
@@ -1571,7 +1714,7 @@
|
||||
concerned with being on the bleeding edge.
|
||||
|
||||
2000.04.25 - Nano 0.9.4 fixes some problems in 0.9.3 with the last
|
||||
line code and related segfaults. It also now has much
|
||||
line code and related segfaults. It now also has much
|
||||
better handling for 8-bit characters. The --enable-tiny
|
||||
code also produces a smaller executable.
|
||||
|
||||
|
||||
23
README
23
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,18 +7,21 @@ 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) include extra functionality by default.
|
||||
|
||||
Nowadays, nano wants to be a generally useful editor, with default
|
||||
settings that do not change the file contents automatically.
|
||||
|
||||
The nano editor is an official GNU package. For more information on
|
||||
GNU and the Free Software Foundation, please see http://www.gnu.org/.
|
||||
GNU and the Free Software Foundation, please see https://www.gnu.org/.
|
||||
|
||||
How to compile and install nano
|
||||
|
||||
|
||||
8
THANKS
8
THANKS
@@ -4,7 +4,7 @@ If we missed you here, let us know!
|
||||
|
||||
Translations:
|
||||
============
|
||||
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com> Malay
|
||||
Pedro Albuquerque <palbuquerque73@gmail.com> Portuguese
|
||||
Josef Andersson <josef.andersson@fripost.org> Swedish
|
||||
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian
|
||||
Mario Blättermann <mario.blaettermann@gmail.com> German
|
||||
@@ -44,16 +44,18 @@ João Victor Duarte Martins <jvdm@sdf.lonestar.org> Brazilian Portuguese
|
||||
Pavel Maryanov <acid@jack.kiev.ua> Russian
|
||||
Daniele Medri <madrid@linux.it> Italian
|
||||
Gergely Nagy <algernon@debian.org> Hungarian
|
||||
Claudio Neves <cneves@nextis.com> Brazilian Portuguese
|
||||
Kalle Olavi Niemitalo <kon@iki.fi> Finnish
|
||||
Мирослав Николић <miroslavnikolic@rocketmail.com> Serbian
|
||||
Claudio Neves <cneves@nextis.com> Brazilian Portuguese
|
||||
Lauri Nurmi <lanurmi@iki.fi> Finnish
|
||||
Daniel Nylander <po@danielnylander.se> Swedish
|
||||
Mikel Olasagasti <hey_neken@mundurat.net> Basque
|
||||
Yi-Jyun Pan <pan93412@gmail.com> Chinese (traditional)
|
||||
Michael Piefel <piefel@informatik.hu-berlin.de> German
|
||||
Sergey Poznyakoff <gray@gnu.org> Polish
|
||||
Božidar Putanec <bozidarp@yahoo.com> Croatian
|
||||
Trần Ngọc Quân <vnwildman@gmail.com> Vietnamese
|
||||
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com> Malay
|
||||
Sergey A. Ribalchenko <fisher@obu.ck.ua> Ukrainian and Russian
|
||||
Michel Robitaille <robitail@IRO.UMontreal.CA> French
|
||||
Christian Rose <menthos@menthos.com> Swedish
|
||||
@@ -76,6 +78,7 @@ Miquel Vidal <miquel@sindominio.net> Catalan
|
||||
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese
|
||||
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish
|
||||
Aron Xu <happyaron.xu@gmail.com> Chinese (simplified)
|
||||
Boyuan Yang <073plan@gmail.com> Chinese (simplified)
|
||||
Peio Ziarsolo <peio@sindominio.net> Basque
|
||||
Anton Zinoviev <zinoviev@debian.org> Bulgarian
|
||||
|
||||
@@ -84,6 +87,7 @@ Other stuff:
|
||||
===========
|
||||
Ben Armstrong <synrg@sanctuary.nslug.ns.ca> Negative -r value idea, code
|
||||
Thomas Dickey <dickey@herndon4.his.com> Curses help and advice
|
||||
Kamil Dudka <kdudka@redhat.com> Several small bug fixes
|
||||
Sven Guckes <guckes@math.fu-berlin.de> Advice and advocacy
|
||||
Thijs Kinkhorst <thijs@kinkhorst.com> rnano.1 manpage
|
||||
Jim Knoble <jmknoble@pobox.com> Pico compat for browser
|
||||
|
||||
7
TODO
7
TODO
@@ -8,9 +8,6 @@ Somewhat urgent:
|
||||
- Allow color syntaxes to apply to more than just color, so that we can
|
||||
e.g. specify a different alternate spell checker depending on which
|
||||
file type we have open.
|
||||
- Allow piping marked text to an external command and replacing it with
|
||||
the command's output -- that is: generalize the spell-check flow.
|
||||
See also https://savannah.gnu.org/bugs/?28993.
|
||||
|
||||
Vague musings:
|
||||
- Add support for right-to-left text (RTL), through FriBidi?
|
||||
@@ -21,8 +18,10 @@ Vague musings:
|
||||
brackets inside comments?
|
||||
|
||||
For version 2.9:
|
||||
- Make undo/redo work also for indenting. [DONE]
|
||||
- Allow piping (marked) text to an external command and replacing it with
|
||||
the command's output. That is: implement filtering. [DONE]
|
||||
- Allow to record and replay a macro: a stored series of keystrokes. [DONE]
|
||||
- Make undo/redo work also for indenting. [DONE]
|
||||
|
||||
For version 2.8:
|
||||
- Allow text searches in the help viewer. [DONE]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Generate configure & friends for GIT users.
|
||||
|
||||
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
||||
gnulib_hash="4a236f16ce0ef97094ff2f6538d4dba90e72a523"
|
||||
gnulib_hash="91584ed612fa26a505c8fc4c7f6fb19f7413795d"
|
||||
|
||||
modules="
|
||||
futimens
|
||||
|
||||
146
configure.ac
146
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
|
||||
@@ -14,9 +14,9 @@
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
# along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
AC_INIT([GNU nano], [2.9.3], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [4.1], [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,17 +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)
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
doc/Makefile
|
||||
|
||||
192
doc/faq.html
192
doc/faq.html
@@ -7,21 +7,23 @@
|
||||
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
|
||||
|
||||
<h1>The GNU nano editor FAQ</h1>
|
||||
<h2>Table of Contents</h2>
|
||||
<h2><a href="#1">1. General</a></h2>
|
||||
<h3>Table of Contents</h3>
|
||||
<h3><a href="#1">1. General</a></h3>
|
||||
<blockquote><p>
|
||||
<a href="#1.1">1.1. What is GNU nano?</a><br>
|
||||
<a href="#1.2">1.2. What is the history behind nano?</a><br>
|
||||
<a href="#1.3">1.3. Why the name change from TIP?</a><br>
|
||||
<a href="#1.4">1.4. What is the current version of nano?</a><br>
|
||||
<a href="#1.5">1.5. I want to read the manpage without having to download the program!</a></p></blockquote>
|
||||
<h2><a href="#2">2. Where to get GNU nano.</a></h2>
|
||||
<a href="#1.5">1.5. I want to read the manpage without having to download the program!</a>
|
||||
</p></blockquote>
|
||||
<h3><a href="#2">2. Where to get GNU nano.</a></h3>
|
||||
<blockquote><p>
|
||||
<a href="#2.1">2.1. FTP and WWW sites that carry nano.</a><br>
|
||||
<a href="#2.2">2.2. RedHat and derivatives (.rpm) packages.</a><br>
|
||||
<a href="#2.3">2.3. Debian (.deb) packages.</a><br>
|
||||
<a href="#2.4">2.4. By GIT (for the brave).</a></p></blockquote>
|
||||
<h2><a href="#3">3. Installation and Configuration</a></h2>
|
||||
<a href="#2.4">2.4. By GIT (for the brave).</a>
|
||||
</p></blockquote>
|
||||
<h3><a href="#3">3. Installation and Configuration</a></h3>
|
||||
<blockquote><p>
|
||||
<a href="#3.1">3.1. How do I install the RPM or DEB package?</a><br>
|
||||
<a href="#3.2">3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</a><br>
|
||||
@@ -30,96 +32,96 @@
|
||||
<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></p></blockquote>
|
||||
<h2><a href="#4">4. Running</a></h2>
|
||||
<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 keystroke 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. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</a><br>
|
||||
<a href="#4.8b">4.8b. 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></p></blockquote>
|
||||
<h2><a href="#5">5. Internationalization</a></h2>
|
||||
<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>
|
||||
<a href="#5.1">5.1. There's no translation for my language!</a><br>
|
||||
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a><br>
|
||||
<a href="#5.3">5.3. What is the status of Unicode support?</a></p></blockquote>
|
||||
<h2><a href="#6">6. Advocacy and Licensing</a></h2>
|
||||
<a href="#5.3">5.3. What is the status of Unicode support?</a>
|
||||
</p></blockquote>
|
||||
<h3><a href="#6">6. Advocacy and Licensing</a></h3>
|
||||
<blockquote><p>
|
||||
<a href="#6.1">6.1. Why should I use nano instead of Pico?</a><br>
|
||||
<a href="#6.2">6.2. Why should I use Pico instead of nano?</a><br>
|
||||
<a href="#6.3">6.3. What is so bad about the older Pine license?</a><br>
|
||||
<a href="#6.4">6.4. Okay, well, what mail program should I use then?</a></p></blockquote>
|
||||
<h2><a href="#7">7. Miscellaneous</a></h2>
|
||||
<a href="#6.4">6.4. Okay, well, what mail program should I use then?</a>
|
||||
</p></blockquote>
|
||||
<h3><a href="#7">7. Miscellaneous</a></h3>
|
||||
<blockquote><p>
|
||||
<a href="#7.1">7.1. Where can I ask questions or send suggestions?</a><br>
|
||||
<a href="#7.2">7.2. How do I submit a bug report or patch?</a><br>
|
||||
<a href="#7.3">7.3. I want to send the development team a big load of cash (or just a thank you).</a><br>
|
||||
<a href="#7.4">7.4. How do I join the development team?</a><br>
|
||||
<a href="#7.5">7.5. Can I have write access to the GIT tree?</a></p></blockquote>
|
||||
<a href="#7.5">7.5. Can I have write access to the GIT tree?</a>
|
||||
</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="1"></a>1. General</h1>
|
||||
<h2><a name="1.1"></a>1.1. What is GNU nano?</h2>
|
||||
<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>
|
||||
<h2><a name="1.2"></a>1.2. What is the history behind nano?</h2>
|
||||
<h3><a name="1.1"></a>1.1. What is GNU nano?</h3>
|
||||
<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>
|
||||
<p>For years Pine was THE program used to read email on a Unix system. The Pico text editor is the portion of the program one would use to compose his or her mail messages. Many beginners to Unix flocked to Pico and Pine because of their well organized, easy to use interfaces. With the proliferation of GNU/Linux in the mid to late 90's, many University students became intimately familiar with the strengths (and weaknesses) of Pine and Pico.</p>
|
||||
<p><b>Then came Debian...</b></p>
|
||||
<p>The <a href="http://www.debian.org/">Debian GNU/Linux</a> distribution, known for its strict standards in distributing truly "free" software (i.e. software with no restrictions on redistribution), would not include a binary package for Pine or Pico. Many people had a serious dilemma: they loved these programs, but the versions available at the time were not truly free software in the <a href="http://www.gnu.org/philosophy/free-sw.html">GNU</a> sense of the word.</p>
|
||||
<p>The <a href="https://www.debian.org/">Debian GNU/Linux</a> distribution, known for its strict standards in distributing truly "free" software (i.e. software with no restrictions on redistribution), would not include a binary package for Pine or Pico. Many people had a serious dilemma: they loved these programs, but the versions available at the time were not truly free software in the <a href="https://www.gnu.org/philosophy/free-sw.html">GNU</a> sense of the word.</p>
|
||||
<p><b>The event...</b></p>
|
||||
<p>It was in late 1999 when Chris Allegretta (our hero) was yet again complaining to himself about the less-than-perfect license Pico was distributed under, the 1000 makefiles that came with it and how just a few small improvements could make it the Best Editor in the World (TM). Having been a convert from Slackware to Debian, he missed having a simple binary package that included Pine and Pico, and had grown tired of downloading them himself.</p>
|
||||
<p>Finally something snapped inside and Chris coded and hacked like a madman for many hours straight one weekend to make a (barely usable) Pico clone, at the time called TIP (Tip Isn't Pico). The program could not be invoked without a filename, could not save files, had no help text display, spell checker, and so forth. But over time it improved, and with the help of a few great coders it matured to the (hopefully) stable state it is in today.</p>
|
||||
<p>In February 2001, nano was declared an official GNU program by Richard Stallman. nano also reached its first production release on March 22, 2001.</p></blockquote>
|
||||
<h2><a name="1.3"></a>1.3. Why the name change from TIP?</h2>
|
||||
<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>
|
||||
<h2><a name="1.4"></a>1.4. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>2.9.3</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>
|
||||
<h2><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h2>
|
||||
<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>4.1</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<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%">
|
||||
|
||||
<h1><a name="2"></a>2. Where to get GNU nano.</h1>
|
||||
<h2><a name="2.1"></a>2.1. Web sites that carry nano.</h2>
|
||||
<h3><a name="2.1"></a>2.1. Web sites that carry nano.</h3>
|
||||
<blockquote><p>The nano source tarballs can be downloaded from the following web sites:</p>
|
||||
<ul>
|
||||
<li><a href="https://nano-editor.org/dist/">https://nano-editor.org/dist/</a></li>
|
||||
<li><a href="https://ftp.gnu.org/gnu/nano/">https://ftp.gnu.org/gnu/nano/</a></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<h2><a name="2.2"></a>2.2. RPM packages (RedHat, OpenSuse, and derivatives).</h2>
|
||||
<h3><a name="2.2"></a>2.2. RPM packages (RedHat, OpenSuse, and derivatives).</h3>
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li><a href="https://kojipkgs.fedoraproject.org//packages/nano/">https://kojipkgs.fedoraproject.org//packages/nano/</a></li>
|
||||
<li><a href="https://software.opensuse.org/package/nano">https://software.opensuse.org/package/nano</a></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<h2><a name="2.3"></a>2.3. Deb packages (Debian and derivatives):</h2>
|
||||
<h3><a name="2.3"></a>2.3. Deb packages (Debian and derivatives):</h3>
|
||||
<blockquote><p>Debian users can check out the current nano packages for:</p>
|
||||
<ul>
|
||||
<li><a href="http://packages.debian.org/stable/editors/nano">stable</a></li>
|
||||
<li><a href="http://packages.debian.org/testing/editors/nano">testing</a></li>
|
||||
<li><a href="http://packages.debian.org/unstable/editors/nano">unstable</a></li>
|
||||
<li><a href="https://packages.debian.org/stable/editors/nano">stable</a></li>
|
||||
<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>
|
||||
</blockquote>
|
||||
<h2><a name="2.4"></a>2.4. By GIT (for the brave).</h2>
|
||||
<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>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="3"></a>3. Installation and Configuration</h1>
|
||||
<h2><a name="3.1"></a>3.1. How do I install the RPM or DEB package?</h2>
|
||||
<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>
|
||||
<h2><a name="3.2"></a>3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</h2>
|
||||
<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>Then you need to run <b>configure</b> with any options you might want (if any).</p>
|
||||
@@ -128,13 +130,13 @@
|
||||
<b>./configure</b><br>
|
||||
<b>make</b><br>
|
||||
<b>make install</b> (as root, of course)</p></blockquote>
|
||||
<h2><a name="3.3"></a>3.3. Why does everything go into /usr/local?</h2>
|
||||
<h3><a name="3.3"></a>3.3. Why does everything go into /usr/local?</h3>
|
||||
<blockquote><p>Well, that's what the <b>configure</b> script defaults to. If you wish to change this, simply do this:</p>
|
||||
<p><b>./configure --prefix=/usr</b></p>
|
||||
<p>to put nano into /usr/bin when you run <b>make install</b>.</p></blockquote>
|
||||
<h2><a name="3.5"></a>3.5. nano should automatically run strip on the binary when installing it!</h2>
|
||||
<h3><a name="3.5"></a>3.5. nano should automatically run strip on the binary when installing it!</h3>
|
||||
<blockquote><p>Actually, it does, but you have to use <b>make install-strip</b>. The default make install does not, and will not, run strip automatically.</p></blockquote>
|
||||
<h2><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h2>
|
||||
<h3><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h3>
|
||||
<blockquote><p>Actually, there are several parts of the editor that can be disabled. You can pass arguments to the <b>configure</b> script that disable certain features. Here's a brief list:</p>
|
||||
<pre>
|
||||
<b>--disable-browser</b> Disable the built-in file browser
|
||||
@@ -155,51 +157,42 @@
|
||||
<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>
|
||||
<h2><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h2>
|
||||
<blockquote><p>To use multiple file buffers, you must 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>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<p>You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b> keys, or more easily without holding Shift: <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the normal "Exit" when only one buffer is open.</p></blockquote>
|
||||
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
|
||||
<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>
|
||||
<p>You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b> keys, or more easily without holding Shift: <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one buffer open, the ^X shortcut will say "Close", instead of "Exit".</p></blockquote>
|
||||
<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 you've enabled Unicode support (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 statubar will change to "Unicode Input: ......" when you do this.</p></blockquote>
|
||||
<h2><a name="3.9a"></a>3.9a. How do I make a .nanorc file that will be read when I start nano?</h2>
|
||||
<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.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>
|
||||
<h2><a name="3.9b"></a>3.9b. How about in Win32?</h2>
|
||||
<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>
|
||||
<h2><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h2>
|
||||
<h3><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h3>
|
||||
<blockquote><p>If a command-line option that begins with '+' is followed by another option, the former is always treated as a starting line and column number, and the latter is always treated as a filename. If a command-line option that begins with '+' isn't followed by another option, it's always treated as a filename. Examples:</p>
|
||||
<p>To open '+filename.txt' starting on line 1: <b>nano +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 10: <b>nano +10 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 1, column 20: <b>nano +,20 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 10, column 20: <b>nano +10,20 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 1 and 'filename.txt' starting on line 40 (if nano has been compiled with multibuffer support): <b>nano +1 +filename.txt +40 filename.txt</b></p></blockquote>
|
||||
<h2><a name="4.2"></a>4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</h2>
|
||||
<h3><a name="4.2"></a>4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</h3>
|
||||
<blockquote><p>Try setting your $TERM variable to 'vt100'. nano doesn't yet support every term entry under the sun.</p>
|
||||
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
|
||||
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
|
||||
<h2><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h2>
|
||||
<blockquote><p>You can use the <b>-K</b> or <b>--rebindkeypad</b> 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>
|
||||
<h2><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?</h2>
|
||||
<blockquote><p>This was a bug in how nano handled consecutive escape sequences. It should be fixed since version 2.6.0.</p></blockquote>
|
||||
<h2><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!</h2>
|
||||
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, and Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
|
||||
<h2><a name="4.6"></a>4.6. nano crashes when I type <insert keystroke here>!</h2>
|
||||
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or in the <a href="https://savannah.gnu.org/bugs/?group=nano">bug tracker</a> on Savannah.</p></blockquote>
|
||||
<h2><a name="4.7"></a>4.7. nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<blockquote><p>Older versions of nano had this problem. Please upgrade to version 2.7.0 or newer.</p></blockquote>
|
||||
<h2><a name="4.8a"></a>4.8a. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</h2>
|
||||
<blockquote><p>You have the autoindent feature turned on. Hit Meta-I to turn it off, paste your text, and then hit Meta-I again to turn it back on.</p></blockquote>
|
||||
<h2><a name="4.8b"></a>4.8b. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?</h2>
|
||||
<h3><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h3>
|
||||
<blockquote><p>You can use the <b>-K</b> or <b>--rawsequences</b> option on the command line, or add the line <b>set rawsequences</b> to your .nanorc. However, nano's mouse support will be disabled if you do any of these things.</p></blockquote>
|
||||
<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.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.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>
|
||||
<h2><a name="4.9"></a>4.9. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. 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>
|
||||
<h2><a name="4.10"></a>4.10. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<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>
|
||||
@@ -212,53 +205,46 @@
|
||||
<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>
|
||||
<h2><a name="4.11"></a>4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
|
||||
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
|
||||
<h2><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!</h2>
|
||||
<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>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
<h2><a name="5.1"></a>5.1. There's no translation for my language!</h2>
|
||||
<blockquote><p>In June 2001, GNU nano entered the <a href="http://translationproject.org/html/welcome.html">Translation Project</a> and since then, translations should be managed from there.</p>
|
||||
<p>If there isn't a translation for your language, you could ask <a href="http://translationproject.org/team/">your language team</a> to translate nano, or better still, join that team and do it yourself. Joining a team is easy. You just need to ask the team leader to add you, and then send a <a href="http://translationproject.org/disclaim.txt">translation disclaimer to the FSF</a> (this is necessary as nano is an official GNU package, but it does <b>not</b> mean that you transfer the rights of your work to the FSF, it's just so the FSF can legally manage them).</p>
|
||||
<p>In any case, translating nano is easy. Just grab the latest <b>nano.pot</b> file listed on <a href="http://translationproject.org/domain/nano.html">nano's page</a> at the TP, and translate each <b>msgid</b> line into your native language on the <b>msgstr</b> line. When you're done, you should send it to the TP's central PO-file repository.</p></blockquote>
|
||||
<h2><a name="5.2"></a>5.2. I don't like the translation for <x> in my language. How can I fix it?</h2>
|
||||
<h3><a name="5.1"></a>5.1. There's no translation for my language!</h3>
|
||||
<blockquote><p>In June 2001, GNU nano entered the <a href="https://translationproject.org/html/welcome.html">Translation Project</a> and since then, translations should be managed from there.</p>
|
||||
<p>If there isn't a translation for your language, you could ask <a href="https://translationproject.org/team/">your language team</a> to translate nano, or better still, join that team and do it yourself. Joining a team is easy. You just need to ask the team leader to add you, and then send a <a href="https://translationproject.org/disclaim.txt">translation disclaimer to the FSF</a> (this is necessary as nano is an official GNU package, but it does <b>not</b> mean that you transfer the rights of your work to the FSF, it's just so the FSF can legally manage them).</p>
|
||||
<p>In any case, translating nano is easy. Just grab the latest <b>nano.pot</b> file listed on <a href="https://translationproject.org/domain/nano.html">nano's page</a> at the TP, and translate each <b>msgid</b> line into your native language on the <b>msgstr</b> line. When you're done, you should send it to the TP's central PO-file repository.</p></blockquote>
|
||||
<h3><a name="5.2"></a>5.2. I don't like the translation for <x> in my language. How can I fix it?</h3>
|
||||
<blockquote><p>The best way is to send an e-mail with your suggested corrections to the team's mailing list. The address is mentioned in the <code>Language-Team:</code> field in the relevant PO file. The team leader or the assigned translator can then make the changes reach the nano-devel list.</p></blockquote>
|
||||
<h2><a name="5.3"></a>5.3. What is the status of Unicode support?</h2>
|
||||
<h3><a name="5.3"></a>5.3. What is the status of Unicode support?</h3>
|
||||
<blockquote><p>Unicode should be fully usable nowadays. When the encoding of your terminal is set to UTF-8, and your locale (mainly the LANG environment variable) is UTF-8 too, then you should be able to read, enter and save Unicode text.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="6"></a>6. Advocacy and Licensing</h1>
|
||||
<h2><a name="6.1"></a>6.1. Why should I use nano instead of Pico?</h2>
|
||||
<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>
|
||||
<h2><a name="6.2"></a>6.2. Why should I use Pico instead of nano?</h2>
|
||||
<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>
|
||||
<h2><a name="6.3"></a>6.3. What is so bad about the older Pine license?</h2>
|
||||
<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="http://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>
|
||||
<h2><a name="6.4"></a>6.4. Okay, well, what mail program should I use then?</h2>
|
||||
<h3><a name="6.1"></a>6.1. Why should I use nano instead of Pico?</h3>
|
||||
<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>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>
|
||||
<blockquote><p>If you are looking to use a Free Software program similar to Pine, and Emacs is not your thing, you should definitely take a look at <a href="http://www.mutt.org/">mutt</a>. It is a full-screen, console based mail program that actually has a lot more flexibility than Pine, but has a keymap included in the distribution that allows you to use the same keystrokes as Pine would to send and receive mail. It's also under the GNU General Public License, version 2.0.</p>
|
||||
<p>Of course, due to the license change you can now use the <a href="http://www.washington.edu/alpine/">Alpine distribution</a> of PINE as it is now considered Free Software, but you would be sacrificing many of nano's features to do so.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="7"></a>7. Miscellaneous</h1>
|
||||
<h2><a name="7.1"></a>7.1. Where can I ask questions or send suggestions?</h2>
|
||||
<blockquote><p>There are three mailing lists for nano hosted at <a href="http://savannah.gnu.org/">Savannah</a>: info-nano, help-nano and nano-devel. info-nano is a very low traffic list where new versions of nano are announced (surprise!). help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
|
||||
<p>info-nano - <a href="http://mail.gnu.org/mailman/listinfo/info-nano/">http://mail.gnu.org/mailman/listinfo/info-nano/</a><br>
|
||||
help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
|
||||
nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
|
||||
<h2><a name="7.2"></a>7.3. How do I submit a bug report or patch?</h2>
|
||||
<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://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.
|
||||
<p>You can submit patches for nano via <a href="https://savannah.gnu.org/patch/?group=nano">Savannah's patch manager</a>.</p></blockquote>
|
||||
<h2><a name="7.3"></a>7.3. I want to send the development team a big load of cash (or just a thank you).</h2>
|
||||
<h3><a name="7.3"></a>7.3. I want to send the development team a big load of cash (or just a thank you).</h3>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="https://savannah.gnu.org/bugs/?group=nano">bug</a> in the program or implement a <a href="https://nano-editor.org/dist/latest/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<h2><a name="7.4"></a>7.4. How do I join the development team?</h2>
|
||||
<h3><a name="7.4"></a>7.4. How do I join the development team?</h3>
|
||||
<blockquote><p>The easiest way is to consistently send in good patches that add some needed functionality, fix a bug or two, and/or make the program more optimized/efficient. Then ask nicely and you will probably be added to the Savannah development list and be given write access after a while. There is a lot of responsibility that goes along with being a team member, so don't think it's just something to add to your resume.</p></blockquote>
|
||||
<h2><a name="7.5"></a>7.5. Can I have write access to the git tree?</h2>
|
||||
<h3><a name="7.5"></a>7.5. Can I have write access to the git tree?</h3>
|
||||
<blockquote><p>Re-read section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
|
||||
169
doc/nano.1
169
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:
|
||||
@@ -7,24 +7,32 @@
|
||||
.\" Foundation, version 3 or (at your option) any later version. You
|
||||
.\" should have received a copy of the GNU General Public License
|
||||
.\" along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * The GNU Free Documentation License, as published by the Free
|
||||
.\" Software Foundation, version 1.2 or (at your option) any later
|
||||
.\" version, with no Invariant Sections, no Front-Cover Texts, and no
|
||||
.\" Back-Cover Texts. You should have received a copy of the GNU Free
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.9.3" "January 2018"
|
||||
.TH NANO 1 "version 4.1" "April 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 "]..."
|
||||
|
||||
.SH NOTICE
|
||||
Starting with version 4.0, \fBnano\fR no longer hard-wraps an overlong
|
||||
line by default, uses smooth scrolling by default, and by default makes
|
||||
use of the line below the title bar.
|
||||
.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
|
||||
@@ -47,17 +55,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
|
||||
Since nano-2.7.0, text can also be selected by holding Shift and moving the
|
||||
cursor with the arrow keys. Holding down the Alt key too will increase the
|
||||
stride.
|
||||
.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.
|
||||
.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
|
||||
@@ -100,13 +109,19 @@ 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 add newlines to the ends of files.
|
||||
Don't automatically add a newline when a file does not end with one.
|
||||
.TP
|
||||
.BR \-M ", " \-\-trimblanks
|
||||
Snip trailing whitespace from the wrapped line when automatic
|
||||
@@ -116,31 +131,34 @@ 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,
|
||||
and place it at that position again upon reopening such a file.
|
||||
(The old form of this option, \fB\-\-poslog\fR, is deprecated.)
|
||||
.TP
|
||||
.BR "\-Q ""\fIcharacters\fB""" ", " "\-\-quotestr=""" \fIcharacters """
|
||||
Set the quoting string for justifying. The default is
|
||||
\fB"^([\ \\t]*[#:>\\|}])+"\fP if extended regular expression support is
|
||||
available, or \fB">\ "\fP otherwise. Note that \fB\\t\fP stands for a
|
||||
Tab.
|
||||
.BR "\-Q ""\fIregex\fB""" ", " "\-\-quotestr=""" \fIregex """
|
||||
Set the regular expression for matching the quoting part of a line.
|
||||
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
|
||||
command line; don't read any \fInanorc\fP files nor history files;
|
||||
don't allow suspending nor spell checking;
|
||||
command line. This means: don't read or write history files;
|
||||
don't allow suspending; don't allow spell checking;
|
||||
don't allow a file to be appended to, prepended to, or saved under a
|
||||
different name if it already has one; and don't use backup files.
|
||||
This restricted mode is also accessible by invoking \fBnano\fP
|
||||
different name if it already has one; and don't make backup files.
|
||||
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
|
||||
@@ -167,29 +185,46 @@ should be considered as part of a word. This overrides option
|
||||
Specify the name of the syntax highlighting to use from among the ones
|
||||
defined in the \fInanorc\fP files.
|
||||
.TP
|
||||
.BR \-Z ", " \-\-zap
|
||||
Let an unmodified Backspace or Delete erase the marked region
|
||||
(instead of a single character, and without affecting the cutbuffer).
|
||||
.TP
|
||||
.BR \-a ", " \-\-atblanks
|
||||
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
|
||||
highlighted item. Useful for braille users.
|
||||
Make the cursor visible in the file browser (putting it on the
|
||||
highlighted item) and in the help viewer. Useful for braille users
|
||||
and people with poor vision.
|
||||
.TP
|
||||
.BR \-h ", " \-\-help
|
||||
Show a summary of the available command-line options and exit.
|
||||
.TP
|
||||
.BR \-i ", " \-\-autoindent
|
||||
Indent new lines to the previous line's indentation. Useful when
|
||||
editing source code.
|
||||
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
|
||||
@@ -220,15 +255,12 @@ 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.
|
||||
@@ -243,14 +275,21 @@ default behavior of saving a file in the format that it had.
|
||||
.TP
|
||||
.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.
|
||||
.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.
|
||||
.TP
|
||||
.BR \-y ", " \-\-afterends
|
||||
Make Ctrl+Right stop at word ends instead of beginnings.
|
||||
.TP
|
||||
.BR \-z ", " \-\-suspend
|
||||
Enable the suspend ability.
|
||||
.TP
|
||||
@@ -261,23 +300,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.
|
||||
|
||||
@@ -297,29 +333,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 is a
|
||||
deficient terminal.
|
||||
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).
|
||||
|
||||
552
doc/nano.texi
552
doc/nano.texi
File diff suppressed because it is too large
Load Diff
349
doc/nanorc.5
349
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:
|
||||
@@ -7,28 +7,36 @@
|
||||
.\" Foundation, version 3 or (at your option) any later version. You
|
||||
.\" should have received a copy of the GNU General Public License
|
||||
.\" along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * The GNU Free Documentation License, as published by the Free
|
||||
.\" Software Foundation, version 1.2 or (at your option) any later
|
||||
.\" version, with no Invariant Sections, no Front-Cover Texts, and no
|
||||
.\" Back-Cover Texts. You should have received a copy of the GNU Free
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.9.3" "January 2018"
|
||||
.TH NANORC 5 "version 4.1" "April 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, uses smooth scrolling by default, and by default makes
|
||||
use of the line below the title bar.
|
||||
.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,23 +44,26 @@ 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
|
||||
.sp
|
||||
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
|
||||
The supported commands and arguments are:
|
||||
|
||||
.TP 3
|
||||
.B set afterends
|
||||
Make Ctrl+Right stop at word ends instead of beginnings.
|
||||
.TP
|
||||
.B set allow_insecure_backup
|
||||
When backing up files, allow the backup to succeed even if its permissions
|
||||
can't be (re)set due to special OS considerations. You should
|
||||
@@ -63,7 +74,9 @@ When soft line wrapping is enabled, make it wrap lines at blank characters
|
||||
(tabs and spaces) instead of always at the edge of the screen.
|
||||
.TP
|
||||
.B set autoindent
|
||||
Use auto-indentation.
|
||||
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
|
||||
.B set backup
|
||||
When saving a file, create a backup file by adding a tilde (\fB~\fP) to
|
||||
@@ -75,10 +88,6 @@ numbered one every time a file is saved -- when backups are enabled
|
||||
with \fBset backup\fR or \fB\-\-backup\fR or \fB\-B\fR.
|
||||
The uniquely numbered files are stored in the specified \fIdirectory\fR.
|
||||
.TP
|
||||
.B set backwards
|
||||
Obsolete option. Recognized but ignored. \fB^Q\fR is available to
|
||||
start a backward search.
|
||||
.TP
|
||||
.B set boldtext
|
||||
Use bold instead of reverse video for the title bar, status bar, key combos,
|
||||
function tags, line numbers, and selected text. This can be overridden by
|
||||
@@ -88,26 +97,35 @@ setting the options \fBtitlecolor\fP, \fBstatuscolor\fP, \fBkeycolor\fP,
|
||||
.B set brackets "\fIstring\fP"
|
||||
Set the characters treated as closing brackets when justifying
|
||||
paragraphs. This may not include blank characters. Only closing
|
||||
punctuation (see \fBpunct\fP), optionally followed by the specified
|
||||
punctuation (see \fBset punct\fP), optionally followed by the specified
|
||||
closing brackets, can end sentences. The default value is "\fB"')>]}\fP".
|
||||
.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
|
||||
.B set constantshow
|
||||
Constantly display the cursor position in the status bar.
|
||||
(The old form of this option, '\fBset const\fR', is deprecated.)
|
||||
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.
|
||||
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 \-8.
|
||||
.TP
|
||||
.B set functioncolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the function descriptions
|
||||
@@ -118,6 +136,9 @@ See \fBset titlecolor\fR for more details.
|
||||
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.
|
||||
@@ -129,6 +150,10 @@ 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 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 matchbrackets "\fIstring\fP"
|
||||
Set the opening and closing brackets that can be found by bracket
|
||||
searches. This may not include blank characters. The opening set must
|
||||
@@ -136,7 +161,8 @@ 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
|
||||
@@ -155,15 +181,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
|
||||
Don't automatically add a newline to the ends of files.
|
||||
Don't automatically add a newline when a file does not end with one.
|
||||
.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).
|
||||
.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.
|
||||
@@ -178,7 +204,6 @@ directory feature is turned off.
|
||||
.B set positionlog
|
||||
Save the cursor position of files between editing sessions.
|
||||
The cursor position is remembered for the 200 most-recently edited files.
|
||||
(The old form of this option, '\fBset poslog\fR', is deprecated.)
|
||||
.TP
|
||||
.B set preserve
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
@@ -193,26 +218,23 @@ 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.
|
||||
.B set quotestr "\fIregex\fP"
|
||||
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 "\fIstring\fP"
|
||||
The email-quote string, used to justify email-quoted paragraphs. This
|
||||
is an extended regular expression if your system supports them,
|
||||
otherwise a literal string. The default value is
|
||||
"\fB^([\ \\t]*[#:>\\|}])+\fP" if you have extended regular expression
|
||||
support, and "\fB>\ \fP" otherwise. Note that '\\t' stands for a literal
|
||||
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.
|
||||
@@ -233,19 +255,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 "\fIspellprog\fP"
|
||||
Use spelling checker \fIspellprog\fP instead of the built-in one, which
|
||||
calls \fIspell\fP.
|
||||
.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.
|
||||
.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
|
||||
@@ -262,7 +289,9 @@ Save automatically on exit, don't prompt.
|
||||
.B set titlecolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the title bar.
|
||||
Valid names for the foreground and background colors are:
|
||||
.BR white ", " black ", " blue ", " green ", " red ", " cyan ", " yellow ", and " magenta .
|
||||
.BR white ", " black ", " blue ", " green ", " red ", "
|
||||
.BR cyan ", " yellow ", " magenta ", and " normal
|
||||
-- where \fBnormal\fR means the default foreground or background color.
|
||||
The name of the foreground color may be prefixed with \fBbright\fR.
|
||||
And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
|
||||
.TP
|
||||
@@ -276,7 +305,9 @@ default behavior of saving a file in the format that it had.
|
||||
(This option has no effect when you also use \fBset noconvert\fR.)
|
||||
.TP
|
||||
.B set view
|
||||
Disallow file modification.
|
||||
Disallow file modification: read-only mode.
|
||||
This mode allows the user to open also other files for viewing,
|
||||
unless \fB\-\-restricted\fR is given on the command line.
|
||||
.TP
|
||||
.B set whitespace "\fIstring\fP"
|
||||
Set the two characters used to indicate the presence of tabs and
|
||||
@@ -291,6 +322,10 @@ characters as parts of words.
|
||||
Specify which other characters (besides the normal alphanumeric ones)
|
||||
should be considered as parts of words. This overrides the option
|
||||
\fBwordbounds\fR.
|
||||
.TP
|
||||
.B set zap
|
||||
Let an unmodified Backspace or Delete erase the marked region
|
||||
(instead of a single character, and without affecting the cutbuffer).
|
||||
|
||||
.SH SYNTAX HIGHLIGHTING
|
||||
Coloring the different syntactic elements of a file
|
||||
@@ -303,7 +338,7 @@ good fit for a small editor like \fBnano\fR.
|
||||
For each kind of file a separate syntax can be defined
|
||||
via the following commands:
|
||||
.TP
|
||||
.BR syntax " ""\fIname\fR"" [""\fIfileregex\fR"" ...]"
|
||||
.BI syntax " name \fR[" """" fileregex """ " \fR...]
|
||||
Start the definition of a syntax with this \fIname\fR.
|
||||
All subsequent \fBcolor\fR and other such commands
|
||||
will be added to this syntax, until a new \fBsyntax\fR
|
||||
@@ -312,20 +347,20 @@ 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,
|
||||
The syntax \fBdefault\fP is special: it takes no \fIfileregex\fR,
|
||||
and applies to files that don't match any syntax's regexes.
|
||||
The syntax "\fBnone\fP" is reserved; specifying it on the command line
|
||||
The syntax \fBnone\fP is reserved; specifying it on the command line
|
||||
is the same as not having a syntax at all.
|
||||
.TP
|
||||
.BR header " ""\fIregex\fR"" " ...
|
||||
.BI "header """ regex """ \fR...
|
||||
If from all defined syntaxes no \fIfileregex\fR matched, then compare
|
||||
this \fIregex\fR (or regexes) against the first line of the current file,
|
||||
to determine whether this syntax should be used for it.
|
||||
.TP
|
||||
.BR magic " ""\fIregex\fR"" " ...
|
||||
.BI "magic """ regex """ \fR...
|
||||
If no \fIfileregex\fR matched and no \fBheader\fR regex matched
|
||||
either, then compare this \fIregex\fR (or regexes) against the
|
||||
result of querying the \fBmagic\fP database about the current
|
||||
@@ -334,16 +369,10 @@ file, to determine whether this syntax should be used for it.
|
||||
system and will be silently ignored otherwise.)
|
||||
.TP
|
||||
.BI linter " program " \fR[ "arg " \fR...]
|
||||
Use the given \fIprogram\fR to run a syntax check on the current file.
|
||||
(This overrides the speller function.)
|
||||
Use the given \fIprogram\fR to run a syntax check on the current buffer.
|
||||
.TP
|
||||
.BI formatter " program " \fR[ "arg " \fR...]
|
||||
Use the given \fIprogram\fR to automatically reformat text --
|
||||
useful in a programming language like Go.
|
||||
(This overrides the speller and linter functions.)
|
||||
.TP
|
||||
.BR comment " ""\fIstring\fR"""
|
||||
Use the given string for commenting and uncommenting lines.
|
||||
.BI "comment """ string """
|
||||
Use the given \fIstring\fR for commenting and uncommenting lines.
|
||||
If the string contains a vertical bar or pipe character (\fB|\fR),
|
||||
this designates bracket-style comments; for example, "\fB/*|*/\fR" for
|
||||
CSS files. The characters before the pipe are prepended to the line and the
|
||||
@@ -353,21 +382,23 @@ 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
|
||||
.B color \fIfgcolor\fR,\fIbgcolor\fR """\fIregex\fR""" ...
|
||||
.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 colors for foreground and background
|
||||
are: white, black, red, blue, green, yellow, magenta, and cyan. You may
|
||||
use the prefix "bright" to get a stronger color highlight for the
|
||||
must be specified. Valid names for foreground and background colors 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.
|
||||
.TP
|
||||
.B icolor \fIfgcolor\fR,\fIbgcolor\fR """\fIregex\fR""" ...
|
||||
.BI "icolor " fgcolor , bgcolor " """ regex """ " \fR...
|
||||
Same as above, except that the matching is case insensitive.
|
||||
.TP
|
||||
.BR color " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIfromrx\fR"" " end= """\fItorx\fR""
|
||||
.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,
|
||||
@@ -376,10 +407,10 @@ initial instance of \fIfromrx\fP, all text until the first instance of
|
||||
\fItorx\fP will be colored. This allows syntax highlighting to span
|
||||
multiple lines.
|
||||
.TP
|
||||
.BR icolor " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIfromrx\fR"" " end= """\fItorx\fR""
|
||||
.BI "icolor " fgcolor , bgcolor " start=""" fromrx """ end=""" torx """
|
||||
Same as above, except that the matching is case insensitive.
|
||||
.TP
|
||||
.BR include " ""\fIsyntaxfile\fR"""
|
||||
.BI "include """ syntaxfile """
|
||||
Read in self-contained color syntaxes from \fIsyntaxfile\fP. Note that
|
||||
\fIsyntaxfile\fP may contain only the above commands, from \fBsyntax\fP
|
||||
to \fBicolor\fP.
|
||||
@@ -387,38 +418,68 @@ 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, \fBlinter\fP, or \fBformatter\fP
|
||||
\fBheader\fP, \fBmagic\fP, \fBcomment\fP, or \fBlinter\fP
|
||||
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.
|
||||
.sp
|
||||
If you use such a formatting command regularly, you could assign the relevant
|
||||
series of keystrokes to a single key in your nanorc:
|
||||
.sp
|
||||
.RS
|
||||
.B "bind M\-F \(dq^R^X|yourformatcommand^M\(dq main"
|
||||
.RE
|
||||
.sp
|
||||
(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 two commands:
|
||||
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).
|
||||
.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.)
|
||||
|
||||
.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).
|
||||
.RE
|
||||
|
||||
.TP
|
||||
The format of \fIkey\fP should be one of:
|
||||
.RS 3
|
||||
.TP 3
|
||||
.B ^
|
||||
followed by an alpha character or the word "Space".
|
||||
Example: ^C
|
||||
followed by a Latin letter, by one of several ASCII characters
|
||||
(@, ], \\, ^, or _), or by the word "Space".
|
||||
Example: ^C.
|
||||
.TP
|
||||
.B M-
|
||||
followed by a printable character or the word "Space".
|
||||
Example: M-C
|
||||
.B M\-
|
||||
followed by any ASCII character except [, or by the word "Space".
|
||||
Example: M\-C.
|
||||
.TP
|
||||
.B F
|
||||
followed by a numeric value from 1 to 16.
|
||||
Example: F10
|
||||
Example: F10.
|
||||
.TP
|
||||
the word "Ins" or the word "Del".
|
||||
.RE
|
||||
|
||||
.TP
|
||||
@@ -449,17 +510,14 @@ Starts a forward search for text in the current buffer -- or for filenames
|
||||
matching a string in the current list in the file browser.
|
||||
.TP
|
||||
.B wherewas
|
||||
Starts a backward search for text in the current buffer.
|
||||
.TP
|
||||
.B searchagain
|
||||
Repeats the last search command without prompting.
|
||||
(The form 'research' is deprecated.)
|
||||
Starts a backward search for text in the current buffer -- or for filenames
|
||||
matching a string in the current list in the file browser.
|
||||
.TP
|
||||
.B findprevious
|
||||
As \fBsearchagain\fR, but always in the backward direction.
|
||||
Searches the next occurrence in the backward direction.
|
||||
.TP
|
||||
.B findnext
|
||||
As \fBsearchagain\fR, but always in the forward direction.
|
||||
Searches the next occurrence in the forward direction.
|
||||
.TP
|
||||
.B replace
|
||||
Interactively replaces text within the current buffer.
|
||||
@@ -467,41 +525,52 @@ Interactively replaces text within the current buffer.
|
||||
.B cut
|
||||
Cuts and stores the current line (or the marked region).
|
||||
.TP
|
||||
.B copytext
|
||||
.B copy
|
||||
Copies the current line (or the marked region) without deleting it.
|
||||
.TP
|
||||
.B uncut
|
||||
Copies the currently stored text into the current buffer at the
|
||||
.B paste
|
||||
Pastes the currently stored text into the current buffer at the
|
||||
current cursor position.
|
||||
.TP
|
||||
.B mark
|
||||
Sets the mark at the current position, to start selecting text.
|
||||
.B zap
|
||||
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.
|
||||
.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
|
||||
Cuts all text from the cursor position till the end of the buffer.
|
||||
.TP
|
||||
.B mark
|
||||
Sets the mark at the current position, to start selecting text.
|
||||
Or, when it is set, unsets the mark.
|
||||
.TP
|
||||
.B curpos
|
||||
Shows the current cursor position: the line, column, and character positions.
|
||||
(The form 'cursorpos' is deprecated.)
|
||||
.TP
|
||||
.B wordcount
|
||||
Counts the number of words, lines and characters in the current buffer.
|
||||
.TP
|
||||
.B speller
|
||||
Invokes a spell-checking program (or a linting program, if the current
|
||||
syntax highlighting defines one).
|
||||
Invokes a spell-checking program, either the default one, or the one
|
||||
defined by \fB\-\-speller\fR or \fBset speller\fR.
|
||||
.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.
|
||||
Justifies the current paragraph. A paragraph is a group of contiguous lines
|
||||
that, apart from possibly the first line, all have the same indentation. The
|
||||
beginning of a paragraph is detected by either this lone line with a differing
|
||||
indentation or by a preceding blank line.
|
||||
.TP
|
||||
.B fulljustify
|
||||
Justifies the entire current buffer.
|
||||
@@ -533,10 +602,12 @@ Goes one line up (in the editor or browser).
|
||||
Goes one line down (in the editor or browser).
|
||||
.TP
|
||||
.B scrollup
|
||||
Scrolls up one line of text from the current position.
|
||||
Scrolls the viewport up one row (meaning that the text slides down)
|
||||
while keeping the cursor in the same text position, if possible.
|
||||
.TP
|
||||
.B scrolldown
|
||||
Scrolls down one line of text from the current position.
|
||||
Scrolls the viewport down one row (meaning that the text slides up)
|
||||
while keeping the cursor in the same text position, if possible.
|
||||
.TP
|
||||
.B prevword
|
||||
Moves the cursor to the beginning of the previous word.
|
||||
@@ -579,9 +650,6 @@ Goes to the last line of the file.
|
||||
Goes to a specific line (and column if specified). Negative numbers count
|
||||
from the end of the file (and end of the line).
|
||||
.TP
|
||||
.B gototext
|
||||
Switches from targeting a line number to searching for text.
|
||||
.TP
|
||||
.B findbracket
|
||||
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
|
||||
(pairs) with the one under the cursor.
|
||||
@@ -628,32 +696,41 @@ Suspends the editor (if the suspending function is enabled, see the
|
||||
"suspendenable" entry below).
|
||||
.TP
|
||||
.B casesens
|
||||
Toggles case sensitivity in searching (search/replace menus only).
|
||||
Toggles whether searching/replacing ignores or respects the case of
|
||||
the given characters.
|
||||
.TP
|
||||
.B regexp
|
||||
Toggles whether searching/replacing is based on literal strings or regular expressions.
|
||||
(The form 'regex' is deprecated.)
|
||||
Toggles whether searching/replacing uses literal strings or regular expressions.
|
||||
.TP
|
||||
.B backwards
|
||||
Toggles whether searching/replacing goes forward or backward.
|
||||
.TP
|
||||
.B prevhistory
|
||||
Shows the previous history entry in the prompt menus (e.g. search).
|
||||
.B older
|
||||
Retrieves the previous (earlier) entry at a prompt.
|
||||
.TP
|
||||
.B nexthistory
|
||||
Shows the next history entry in the prompt menus (e.g. search).
|
||||
.B newer
|
||||
Retrieves the next (later) entry at a prompt.
|
||||
.TP
|
||||
.B flipreplace
|
||||
Toggles between searching for something and replacing something.
|
||||
(The form 'dontreplace' is deprecated.)
|
||||
.TP
|
||||
.B flipgoto
|
||||
Toggles between searching for text and targeting a line number.
|
||||
.TP
|
||||
.B flipexecute
|
||||
Toggles between inserting a file and executing a command.
|
||||
.TP
|
||||
.B flippipe
|
||||
When executing a command, toggles whether the current buffer (or marked
|
||||
region) is piped to the command.
|
||||
.TP
|
||||
.B flipnewbuffer
|
||||
Toggles between inserting into the current buffer and into a new
|
||||
empty buffer.
|
||||
(The form 'newbuffer' is deprecated.)
|
||||
.TP
|
||||
.B flipconvert
|
||||
When reading in a file, toggles between converting and not converting
|
||||
it from DOS/Mac format. Converting is the default.
|
||||
.TP
|
||||
.B dosformat
|
||||
When writing a file, switches to writing a DOS format (CR/LF).
|
||||
@@ -691,18 +768,15 @@ Goes to the last file when using the file browser (reading or writing files).
|
||||
.B nohelp
|
||||
Toggles the presence of the two-line list of key bindings at the bottom of the screen.
|
||||
.TP
|
||||
.B constupdate
|
||||
.B constantshow
|
||||
Toggles the constant display of the current line, column, and character positions.
|
||||
.TP
|
||||
.B morespace
|
||||
Toggles the presence of the blank line that 'separates' the title bar from the file text.
|
||||
.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.
|
||||
.TP
|
||||
.B linenumbers
|
||||
Toggles the display of line numbers in front of the text.
|
||||
.TP
|
||||
.B whitespacedisplay
|
||||
Toggles the showing of whitespace.
|
||||
.TP
|
||||
@@ -713,9 +787,11 @@ Toggles syntax highlighting.
|
||||
Toggles the smartness of the Home key.
|
||||
.TP
|
||||
.B autoindent
|
||||
Toggles whether new lines will contain the same amount of whitespace as the preceding line.
|
||||
Toggles whether a newly created line will contain the same amount of leading
|
||||
whitespace as the preceding line -- or as the next line if the preceding line
|
||||
is the beginning of a paragraph.
|
||||
.TP
|
||||
.B cuttoend
|
||||
.B cutfromcursor
|
||||
Toggles whether cutting text will cut the whole line or just from the current cursor
|
||||
position to the end of the line.
|
||||
.TP
|
||||
@@ -725,19 +801,9 @@ Toggles whether long lines will be hard-wrapped to the next line.
|
||||
.B tabstospaces
|
||||
Toggles whether typed tabs will be converted to spaces.
|
||||
.TP
|
||||
.B backupfile
|
||||
Toggles whether a backup will be made of the file being edited.
|
||||
.TP
|
||||
.B multibuffer
|
||||
Toggles whether a file is inserted into the current buffer
|
||||
or read into a new buffer.
|
||||
.TP
|
||||
.B mouse
|
||||
Toggles mouse support.
|
||||
.TP
|
||||
.B noconvert
|
||||
Toggles automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.B suspendenable
|
||||
Toggles whether the suspend sequence (normally ^Z) will suspend the editor window.
|
||||
.RE
|
||||
@@ -757,7 +823,9 @@ The 'search to replace' menu.
|
||||
.TP
|
||||
.B replacewith
|
||||
The 'replace with' menu, which comes up after 'search to replace'.
|
||||
(The form 'replace2' is deprecated.)
|
||||
.TP
|
||||
.B yesno
|
||||
The 'yesno' menu, where the Yes/No/All/Cancel question is asked.
|
||||
.TP
|
||||
.B gotoline
|
||||
The 'goto line (and column)' menu.
|
||||
@@ -797,16 +865,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).
|
||||
|
||||
32
doc/rnano.1
32
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:
|
||||
@@ -7,16 +7,16 @@
|
||||
.\" Foundation, version 3 or (at your option) any later version. You
|
||||
.\" should have received a copy of the GNU General Public License
|
||||
.\" along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * The GNU Free Documentation License, as published by the Free
|
||||
.\" Software Foundation, version 1.2 or (at your option) any later
|
||||
.\" version, with no Invariant Sections, no Front-Cover Texts, and no
|
||||
.\" Back-Cover Texts. You should have received a copy of the GNU Free
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 2.9.3" "January 2018"
|
||||
.TH RNANO 1 "version 4.1" "April 2019"
|
||||
|
||||
.SH NAME
|
||||
rnano \- a restricted nano
|
||||
@@ -29,16 +29,14 @@ 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 read any nanorc files;
|
||||
.IP \[bu]
|
||||
not allow suspending;
|
||||
.IP \[bu]
|
||||
not read nor write any file not specified on the command line;
|
||||
not allow saving the current buffer under a different name;
|
||||
.IP \[bu]
|
||||
not allow saving a file under a different name;
|
||||
not allow inserting another file or opening a new buffer;
|
||||
.IP \[bu]
|
||||
not allow appending or prepending to any file;
|
||||
.IP \[bu]
|
||||
@@ -47,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).
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
## Sample initialization file for GNU nano.
|
||||
##
|
||||
## Please note that you must have configured nano with --enable-nanorc
|
||||
## for this file to be read! Also note that this file should not be in
|
||||
## DOS or Mac format, and that characters specially interpreted by the
|
||||
## shell should not be escaped here.
|
||||
## This file should not be in DOS or Mac format, and characters
|
||||
## specially interpreted by the shell should not be escaped here.
|
||||
##
|
||||
## To make sure an option is disabled, use "unset <option>".
|
||||
##
|
||||
@@ -15,11 +13,17 @@
|
||||
## its end. For example, for the "brackets" option, ""')>]}" will match
|
||||
## ", ', ), >, ], and }.
|
||||
|
||||
## Make the 'nextword' function (Ctrl+Right) stop at word ends
|
||||
## instead of at beginnings.
|
||||
# set afterends
|
||||
|
||||
## When soft line wrapping is enabled, make it wrap lines at blanks
|
||||
## (tabs and spaces) instead of always at the edge of the screen.
|
||||
# set atblanks
|
||||
|
||||
## Use auto-indentation.
|
||||
## Automatically indent a newly created line to the same number of
|
||||
## tabs and/or spaces as the preceding line -- or as the next line
|
||||
## if the preceding line is the beginning of a paragraph.
|
||||
# set autoindent
|
||||
|
||||
## Back up files to the current filename plus a tilde.
|
||||
@@ -31,32 +35,38 @@
|
||||
## Use bold text instead of reverse video text.
|
||||
# set boldtext
|
||||
|
||||
## The characters treated as closing brackets when justifying
|
||||
## paragraphs. They cannot contain blank characters. Only closing
|
||||
## punctuation, optionally followed by closing brackets, can end
|
||||
## sentences.
|
||||
## The characters treated as closing brackets when justifying paragraphs.
|
||||
## This may not include any blank characters. Only closing punctuation,
|
||||
## 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
|
||||
|
||||
## Constantly display the cursor position in the status bar. Note that
|
||||
## this overrides "quickblank".
|
||||
# set constantshow
|
||||
## (The old form, 'const', is deprecated.)
|
||||
|
||||
## Use cut-from-cursor-to-end-of-line by default.
|
||||
# set cutfromcursor
|
||||
## (The old form, 'cut', is deprecated.)
|
||||
|
||||
## Set the line length for wrapping text and justifying paragraphs.
|
||||
## If the value is 0 or less, the wrapping point will be the screen
|
||||
## width less this number.
|
||||
## 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
|
||||
## less, the wrapping point will be the screen width minus this number.
|
||||
# set fill -8
|
||||
|
||||
## 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
|
||||
|
||||
@@ -70,9 +80,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
|
||||
@@ -89,16 +96,13 @@
|
||||
## Don't display the helpful shortcut lists at the bottom of the screen.
|
||||
# set nohelp
|
||||
|
||||
## 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
|
||||
|
||||
## Don't add newlines to the ends of files.
|
||||
# set nonewlines
|
||||
|
||||
## Don't wrap text at all.
|
||||
# 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
|
||||
@@ -107,7 +111,6 @@
|
||||
|
||||
## Remember the cursor position in each file for the next editing session.
|
||||
# set positionlog
|
||||
## (The old form, 'poslog', is deprecated.)
|
||||
|
||||
## Preserve the XON and XOFF keys (^Q and ^S).
|
||||
# set preserve
|
||||
@@ -122,25 +125,22 @@
|
||||
## 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 if your system supports them,
|
||||
## otherwise a literal string.
|
||||
## If you have extended regular expression support, the default is:
|
||||
# set quotestr "^([ ]*[#:>\|}])+"
|
||||
## Otherwise:
|
||||
# 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.
|
||||
# set regexp
|
||||
|
||||
## Put the cursor on the highlighted item in the file browser;
|
||||
## useful for people who use a braille display.
|
||||
## Put the cursor on the highlighted item in the file browser, and show
|
||||
## the cursor in the help viewer; useful for people who use a braille
|
||||
## display and people with poor vision.
|
||||
# set showcursor
|
||||
|
||||
## Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
@@ -150,9 +150,6 @@
|
||||
## beginning of the line.
|
||||
# set smarthome
|
||||
|
||||
## Use smooth scrolling as the default.
|
||||
# set smooth
|
||||
|
||||
## Enable soft line wrapping (AKA full-line display).
|
||||
# set softwrap
|
||||
|
||||
@@ -195,19 +192,26 @@
|
||||
## set, it overrides option 'set wordbounds'.
|
||||
# set wordchars "<_>."
|
||||
|
||||
## Let an unmodified Backspace or Delete erase the marked region (instead
|
||||
## of a single character, and without affecting the cutbuffer).
|
||||
# set zap
|
||||
|
||||
## Paint the interface elements of nano.
|
||||
## These are examples; by default there are no colors.
|
||||
## Paint the interface elements of nano. These are examples;
|
||||
## by default there are no colors, except for errorcolor.
|
||||
# set titlecolor brightwhite,blue
|
||||
# set statuscolor brightwhite,green
|
||||
# set errorcolor brightwhite,red
|
||||
# set selectedcolor brightwhite,magenta
|
||||
# set stripecolor ,yellow
|
||||
# set numbercolor cyan
|
||||
# set keycolor cyan
|
||||
# set functioncolor green
|
||||
## In root's .nanorc you might want to use:
|
||||
# set titlecolor brightwhite,red
|
||||
# set statuscolor brightwhite,red
|
||||
# set titlecolor brightwhite,magenta
|
||||
# set statuscolor brightwhite,magenta
|
||||
# set errorcolor brightwhite,red
|
||||
# set selectedcolor brightwhite,cyan
|
||||
# set stripecolor ,yellow
|
||||
# set numbercolor magenta
|
||||
# set keycolor brightmagenta
|
||||
# set functioncolor magenta
|
||||
@@ -231,9 +235,9 @@
|
||||
## "color" will do case-sensitive matches, while "icolor" will do
|
||||
## case-insensitive matches.
|
||||
##
|
||||
## Valid colors: white, black, red, blue, green, yellow, magenta, cyan.
|
||||
## For foreground colors, you may use the prefix "bright" to get a
|
||||
## stronger highlight.
|
||||
## 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.
|
||||
##
|
||||
## To use multi-line regexes, use the start="regex" end="regex"
|
||||
## [start="regex" end="regex"...] format.
|
||||
@@ -253,18 +257,51 @@
|
||||
## ".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.
|
||||
##
|
||||
|
||||
## To include all existing syntax definitions, you can do:
|
||||
# include "@PKGDATADIR@/*.nanorc"
|
||||
|
||||
|
||||
## Key bindings.
|
||||
## See nanorc(5) (section REBINDING KEYS) for more details on this.
|
||||
##
|
||||
## The following two functions are not bound to any key by default.
|
||||
## You may wish to choose other keys than the ones suggested here.
|
||||
# bind M-B cutwordleft main
|
||||
# bind M-N cutwordright main
|
||||
|
||||
## Set this if your Backspace key sends Del most of the time.
|
||||
# bind Del backspace all
|
||||
## The <Ctrl+Delete> keystroke deletes the word to the right of the cursor.
|
||||
## On some terminals the <Ctrl+Backspace> keystroke produces ^H, which is
|
||||
## the ASCII character for backspace, so it is bound by default to the
|
||||
## backspace function. The <Backspace> key itself produces a different
|
||||
## 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 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,
|
||||
## then uncomment these:
|
||||
#bind ^Q exit all
|
||||
#bind ^H help all
|
||||
#bind ^H exit help
|
||||
#bind ^F whereis all
|
||||
#bind ^G findnext all
|
||||
#bind ^B wherewas all
|
||||
#bind ^D findprevious all
|
||||
#bind ^R replace main
|
||||
#bind ^W writeout main
|
||||
#bind ^O insert main
|
||||
#unbind ^V all
|
||||
#unbind ^Y all
|
||||
#bind M-X flipnewbuffer all
|
||||
#bind ^X cut all
|
||||
#bind ^C copy all
|
||||
#bind ^V paste all
|
||||
#bind ^P curpos main
|
||||
#bind ^T gotoline main
|
||||
#bind ^T gotodir browser
|
||||
#bind ^Y speller main
|
||||
#unbind ^K all
|
||||
#unbind ^U all
|
||||
#bind M-R redo main
|
||||
#bind ^U undo main
|
||||
#bind ^E redo main
|
||||
#unbind M-J main
|
||||
#unbind M-T main
|
||||
#set multibuffer
|
||||
|
||||
@@ -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
|
||||
|
||||
2008
po/nano.pot
2008
po/nano.pot
File diff suppressed because it is too large
Load Diff
2177
po/pt_BR.po
2177
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 || \
|
||||
|
||||
2552
po/zh_CN.po
2552
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
3108
po/zh_TW.po
3108
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
29
roll-a-release.sh
Executable file
29
roll-a-release.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION="4.1"
|
||||
|
||||
./configure -C --enable-tiny && make && ./configure -C &&
|
||||
|
||||
echo "Running autogen..." && ./autogen.sh &&
|
||||
rm -v -f m4/*.m4~ *.asc *.sig *.gz *.xz &&
|
||||
|
||||
echo "Rebuilding..." && make &&
|
||||
po/update_linguas.sh &&
|
||||
|
||||
make distcheck && make dist-xz &&
|
||||
|
||||
git add po/*.po &&
|
||||
git commit -a -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 &&
|
||||
gpg --verify nano-$VERSION.tar.gz.asc &&
|
||||
gpg --verify nano-$VERSION.tar.xz.asc &&
|
||||
|
||||
git tag -u A0ACE884 -a v$VERSION -m "the nano $VERSION release" &&
|
||||
|
||||
for file in nano-$VERSION.tar.*z*; do scp $file bens@wh0rd.org:$file; done &&
|
||||
|
||||
gnupload --to ftp.gnu.org:nano nano-$VERSION.tar.*z &&
|
||||
|
||||
echo "Tarballs have been rolled and uploaded."
|
||||
@@ -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 *
|
||||
@@ -32,9 +32,9 @@ static char **filelist = NULL;
|
||||
/* The list of files to display in the file browser. */
|
||||
static size_t filelist_len = 0;
|
||||
/* The number of files in the list. */
|
||||
static int width = 0;
|
||||
static size_t width = 0;
|
||||
/* The number of files that we can display per screen row. */
|
||||
static int longest = 0;
|
||||
static size_t longest = 0;
|
||||
/* The number of columns in the longest filename in the list. */
|
||||
static size_t selected = 0;
|
||||
/* The currently selected filename in the list; zero-based. */
|
||||
@@ -166,15 +166,13 @@ char *do_browser(char *path)
|
||||
say_there_is_no_help();
|
||||
#endif
|
||||
} else if (func == do_search_forward) {
|
||||
do_filesearch();
|
||||
} else if (func == do_research) {
|
||||
do_fileresearch(TRUE);
|
||||
#ifndef NANO_TINY
|
||||
do_filesearch(FORWARD);
|
||||
} else if (func == do_search_backward) {
|
||||
do_filesearch(BACKWARD);
|
||||
} else if (func == do_findprevious) {
|
||||
do_fileresearch(FALSE);
|
||||
do_fileresearch(BACKWARD);
|
||||
} else if (func == do_findnext) {
|
||||
do_fileresearch(TRUE);
|
||||
#endif
|
||||
do_fileresearch(FORWARD);
|
||||
} else if (func == do_left) {
|
||||
if (selected > 0)
|
||||
selected--;
|
||||
@@ -187,10 +185,10 @@ char *do_browser(char *path)
|
||||
selected += width - 1 - (selected % width);
|
||||
if (selected >= filelist_len)
|
||||
selected = filelist_len - 1;
|
||||
} else if (func == do_up_void) {
|
||||
} else if (func == do_up) {
|
||||
if (selected >= width)
|
||||
selected -= width;
|
||||
} else if (func == do_down_void) {
|
||||
} else if (func == do_down) {
|
||||
if (selected + width <= filelist_len - 1)
|
||||
selected += width;
|
||||
} else if (func == do_prev_block) {
|
||||
@@ -258,9 +256,9 @@ char *do_browser(char *path)
|
||||
|
||||
/* In case the specified directory cannot be entered, select it
|
||||
* (if it is in the current list) so it will be highlighted. */
|
||||
for (i = 0; i < filelist_len; i++)
|
||||
if (strcmp(filelist[i], path) == 0)
|
||||
selected = i;
|
||||
for (size_t j = 0; j < filelist_len; j++)
|
||||
if (strcmp(filelist[j], path) == 0)
|
||||
selected = j;
|
||||
|
||||
/* Try opening and reading the specified directory. */
|
||||
goto read_directory_contents;
|
||||
@@ -303,6 +301,10 @@ char *do_browser(char *path)
|
||||
/* Try opening and reading the selected directory. */
|
||||
path = mallocstrcpy(path, filelist[selected]);
|
||||
goto read_directory_contents;
|
||||
#ifdef ENABLE_NANORC
|
||||
} else if (func == (functionptrtype)implant) {
|
||||
implant(first_sc_for(MBROWSER, func)->expansion);
|
||||
#endif
|
||||
} else if (func == do_exit) {
|
||||
/* Exit from the file browser. */
|
||||
break;
|
||||
@@ -357,7 +359,7 @@ char *do_browse_from(const char *inpath)
|
||||
path = free_and_assign(path, strip_last_component(path));
|
||||
|
||||
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
||||
char * currentdir = charalloc(PATH_MAX + 1);
|
||||
char *currentdir = charalloc(PATH_MAX + 1);
|
||||
|
||||
free(path);
|
||||
path = getcwd(currentdir, PATH_MAX + 1);
|
||||
@@ -460,10 +462,11 @@ functionptrtype parse_browser_input(int *kbinput)
|
||||
{
|
||||
if (!meta_key) {
|
||||
switch (*kbinput) {
|
||||
case ' ':
|
||||
return do_page_down;
|
||||
case BS_CODE:
|
||||
case '-':
|
||||
return do_page_up;
|
||||
case ' ':
|
||||
return do_page_down;
|
||||
case '?':
|
||||
return do_help_void;
|
||||
case 'E':
|
||||
@@ -484,11 +487,9 @@ functionptrtype parse_browser_input(int *kbinput)
|
||||
case '/':
|
||||
return do_search_forward;
|
||||
case 'N':
|
||||
#ifndef NANO_TINY
|
||||
return do_findprevious;
|
||||
#endif
|
||||
case 'n':
|
||||
return do_research;
|
||||
return do_findnext;
|
||||
}
|
||||
}
|
||||
return func_from_key(kbinput);
|
||||
@@ -521,14 +522,14 @@ void browser_refresh(void)
|
||||
/* The length of the filename in columns. */
|
||||
size_t infolen;
|
||||
/* The length of the file information in columns. */
|
||||
int infomaxlen = 7;
|
||||
size_t infomaxlen = 7;
|
||||
/* The maximum length of the file information in columns:
|
||||
* normally seven, but will be twelve for "(parent dir)". */
|
||||
bool dots = (COLS >= 15 && namelen >= longest - infomaxlen);
|
||||
/* 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. */
|
||||
|
||||
@@ -655,42 +656,42 @@ void browser_select_dirname(const char *needle)
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up the system variables for a filename search. Return -1 or -2 if
|
||||
* the search should be canceled (due to Cancel or a blank search string),
|
||||
* return 0 when we have a string, and return a positive value when some
|
||||
* function was run. */
|
||||
int filesearch_init(void)
|
||||
/* Prepare the prompt and ask the user what to search for. If forwards is
|
||||
* TRUE, search forward in the list; otherwise, search backward. Return -2
|
||||
* for a blank answer, -1 for Cancel, 0 when we have a string, and a
|
||||
* positive value when some function was run. */
|
||||
int filesearch_init(bool forwards)
|
||||
{
|
||||
int input;
|
||||
char *buf;
|
||||
char *thedefault;
|
||||
int response;
|
||||
|
||||
/* 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);
|
||||
|
||||
buf = charalloc(strlen(disp) + 7);
|
||||
thedefault = charalloc(strlen(disp) + 7);
|
||||
/* We use (COLS / 3) here because we need to see more on the line. */
|
||||
sprintf(buf, " [%s%s]", disp,
|
||||
sprintf(thedefault, " [%s%s]", disp,
|
||||
(strlenpt(last_search) > COLS / 3) ? "..." : "");
|
||||
free(disp);
|
||||
} else
|
||||
buf = mallocstrcpy(NULL, "");
|
||||
thedefault = mallocstrcpy(NULL, "");
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
input = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL, &search_history,
|
||||
browser_refresh, "%s%s", _("Search"), buf);
|
||||
|
||||
/* Release buf now that we don't need it anymore. */
|
||||
free(buf);
|
||||
/* Now ask what to search for. */
|
||||
response = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL, &search_history,
|
||||
browser_refresh, "%s%s%s", _("Search"),
|
||||
!forwards ? _(" [Backwards]") : "", thedefault);
|
||||
free(thedefault);
|
||||
|
||||
/* If only Enter was pressed but we have a previous string, it's okay. */
|
||||
if (input == -2 && *last_search != '\0')
|
||||
if (response == -2 && *last_search != '\0')
|
||||
return 0;
|
||||
|
||||
/* Otherwise negative inputs are a bailout. */
|
||||
if (input < 0)
|
||||
/* Otherwise negative responses are a bailout. */
|
||||
if (response < 0)
|
||||
statusbar(_("Cancelled"));
|
||||
|
||||
return input;
|
||||
return response;
|
||||
}
|
||||
|
||||
/* Look for the given needle in the list of files. If forwards is TRUE,
|
||||
@@ -752,11 +753,12 @@ void findfile(const char *needle, bool forwards)
|
||||
selected = looking_at;
|
||||
}
|
||||
|
||||
/* Search for a filename. */
|
||||
void do_filesearch(void)
|
||||
/* Search for a filename. If forwards is TRUE, search forward in the list;
|
||||
* otherwise, search backward.*/
|
||||
void do_filesearch(bool forwards)
|
||||
{
|
||||
/* If the user cancelled or jumped to first or last file, don't search. */
|
||||
if (filesearch_init() != 0)
|
||||
if (filesearch_init(forwards) != 0)
|
||||
return;
|
||||
|
||||
/* If answer is now "", copy last_search into answer. */
|
||||
@@ -771,7 +773,7 @@ void do_filesearch(void)
|
||||
update_history(&search_history, answer);
|
||||
#endif
|
||||
|
||||
findfile(answer, TRUE);
|
||||
findfile(answer, forwards);
|
||||
}
|
||||
|
||||
/* Search again without prompting for the last given search string,
|
||||
|
||||
276
src/chars.c
276
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 *
|
||||
@@ -62,11 +62,6 @@ bool is_byte(int c)
|
||||
return ((unsigned int)c == (unsigned char)c);
|
||||
}
|
||||
|
||||
void mbtowc_reset(void)
|
||||
{
|
||||
IGNORE_CALL_RESULT(mbtowc(NULL, NULL, 0));
|
||||
}
|
||||
|
||||
/* This function is equivalent to isalpha() for multibyte characters. */
|
||||
bool is_alpha_mbchar(const char *c)
|
||||
{
|
||||
@@ -74,10 +69,8 @@ bool is_alpha_mbchar(const char *c)
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return iswalpha(wc);
|
||||
} else
|
||||
@@ -92,10 +85,8 @@ bool is_alnum_mbchar(const char *c)
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return iswalnum(wc);
|
||||
} else
|
||||
@@ -110,10 +101,8 @@ bool is_blank_mbchar(const char *c)
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return iswblank(wc);
|
||||
} else
|
||||
@@ -128,13 +117,6 @@ bool is_ascii_cntrl_char(int c)
|
||||
return (0 <= c && c < 32);
|
||||
}
|
||||
|
||||
/* This function is equivalent to iscntrl(), except in that it also
|
||||
* handles high-bit control characters. */
|
||||
bool is_cntrl_char(int c)
|
||||
{
|
||||
return ((c & 0x60) == 0 || c == 127);
|
||||
}
|
||||
|
||||
/* This function is equivalent to iscntrl() for multibyte characters,
|
||||
* except in that it also handles multibyte control characters with
|
||||
* their high bits set. */
|
||||
@@ -146,7 +128,7 @@ bool is_cntrl_mbchar(const char *c)
|
||||
((signed char)c[0] == -62 && (signed char)c[1] < -96));
|
||||
} else
|
||||
#endif
|
||||
return is_cntrl_char((unsigned char)*c);
|
||||
return (((unsigned char)*c & 0x60) == 0 || (unsigned char)*c == 127);
|
||||
}
|
||||
|
||||
/* This function is equivalent to ispunct() for multibyte characters. */
|
||||
@@ -156,10 +138,8 @@ bool is_punct_mbchar(const char *c)
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return iswpunct(wc);
|
||||
} else
|
||||
@@ -232,10 +212,8 @@ int length_of_char(const char *c, int *width)
|
||||
int charlen = mbtowc(&wc, c, MAXCHARLEN);
|
||||
|
||||
/* If the sequence is invalid... */
|
||||
if (charlen < 0) {
|
||||
mbtowc_reset();
|
||||
if (charlen < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If the codepoint is invalid... */
|
||||
if (!is_valid_unicode(wc))
|
||||
@@ -260,10 +238,8 @@ int mbwidth(const char *c)
|
||||
wchar_t wc;
|
||||
int width;
|
||||
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
width = wcwidth(wc);
|
||||
|
||||
@@ -309,65 +285,45 @@ char *make_mbchar(long chr, int *chr_mb_len)
|
||||
* col isn't NULL, add the character's width (in columns) to it. */
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
{
|
||||
int length;
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
/* Get the number of bytes in the multibyte character. */
|
||||
int length = mblen(buf, MAXCHARLEN);
|
||||
/* 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);
|
||||
|
||||
/* When the multibyte sequence is invalid, only take the first byte. */
|
||||
if (length <= 0) {
|
||||
IGNORE_CALL_RESULT(mblen(NULL, 0));
|
||||
if (length <= 0)
|
||||
length = 1;
|
||||
}
|
||||
|
||||
/* When requested, store the multibyte character in chr. */
|
||||
if (chr != NULL) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
chr[i] = buf[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
|
||||
*col += mbwidth(buf);
|
||||
}
|
||||
|
||||
return length;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* When requested, store the byte character in chr. */
|
||||
if (chr != NULL)
|
||||
*chr = *buf;
|
||||
length = 1;
|
||||
|
||||
/* When requested, add the width of the character to col. */
|
||||
if (col != NULL) {
|
||||
/* If we have a tab, compute its width in columns using the
|
||||
* current value of col. */
|
||||
if (*buf == '\t')
|
||||
*col += tabsize - *col % tabsize;
|
||||
/* If we have a control character, it's two columns wide: one
|
||||
* column for the "^", and one for the visible character. */
|
||||
else if (is_cntrl_char((unsigned char)*buf))
|
||||
*col += 2;
|
||||
/* If we have a normal character, it's one column wide. */
|
||||
else
|
||||
(*col)++;
|
||||
}
|
||||
/* When requested, store the multibyte character in chr. */
|
||||
if (chr != NULL)
|
||||
for (int i = 0; i < length; i++)
|
||||
chr[i] = buf[i];
|
||||
|
||||
return 1;
|
||||
/* 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;
|
||||
#ifdef ENABLE_UTF8
|
||||
else
|
||||
*col += mbwidth(buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/* Return the index in buf of the beginning of the multibyte character
|
||||
@@ -430,17 +386,8 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
wchar_t wc1, wc2;
|
||||
|
||||
while (*s1 != '\0' && *s2 != '\0' && n > 0) {
|
||||
bool bad1 = FALSE, bad2 = FALSE;
|
||||
|
||||
if (mbtowc(&wc1, s1, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
bad1 = TRUE;
|
||||
}
|
||||
|
||||
if (mbtowc(&wc2, s2, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
bad2 = TRUE;
|
||||
}
|
||||
bool bad1 = (mbtowc(&wc1, s1, MAXCHARLEN) < 0);
|
||||
bool bad2 = (mbtowc(&wc2, s2, MAXCHARLEN) < 0);
|
||||
|
||||
if (bad1 || bad2) {
|
||||
if (*s1 != *s2)
|
||||
@@ -556,22 +503,26 @@ char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
return revstrcasestr(haystack, needle, pointer);
|
||||
}
|
||||
|
||||
/* This function is equivalent to strlen() for multibyte strings. */
|
||||
/* Count the number of (multibyte) characters in the given string. */
|
||||
size_t mbstrlen(const char *s)
|
||||
{
|
||||
return mbstrnlen(s, (size_t)-1);
|
||||
}
|
||||
size_t maxlen = (size_t)-1;
|
||||
|
||||
/* This function is equivalent to strnlen() for multibyte strings. */
|
||||
size_t mbstrnlen(const char *s, size_t maxlen)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
size_t n = 0;
|
||||
|
||||
for (; *s != '\0' && maxlen > 0; s += move_mbright(s, 0),
|
||||
maxlen--, n++)
|
||||
;
|
||||
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
|
||||
@@ -591,7 +542,6 @@ char *mbstrchr(const char *s, const char *c)
|
||||
wchar_t ws, wc;
|
||||
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
wc = (unsigned char)*c;
|
||||
bad_c_mb = TRUE;
|
||||
}
|
||||
@@ -600,7 +550,6 @@ char *mbstrchr(const char *s, const char *c)
|
||||
int sym_len = parse_mbchar(s, symbol, NULL);
|
||||
|
||||
if (mbtowc(&ws, symbol, sym_len) < 0) {
|
||||
mbtowc_reset();
|
||||
ws = (unsigned char)*s;
|
||||
bad_s_mb = TRUE;
|
||||
}
|
||||
@@ -623,102 +572,59 @@ char *mbstrchr(const char *s, const char *c)
|
||||
#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 += move_mbright(string, 0);
|
||||
}
|
||||
|
||||
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 + move_mbleft(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 + move_mbleft(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 += parse_mbchar(string, symbol, NULL);
|
||||
|
||||
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) */
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
@@ -731,17 +637,3 @@ bool is_valid_unicode(wchar_t wc)
|
||||
(0xFFFF < wc && wc <= 0x10FFFF && (wc & 0xFFFF) <= 0xFFFD));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Check if the string s is a valid multibyte string. Return TRUE if it
|
||||
* is, and FALSE otherwise. */
|
||||
bool is_valid_mbstring(const char *s)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8)
|
||||
return (mbstowcs(NULL, s, 0) != (size_t)-1);
|
||||
else
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
45
src/color.c
45
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 *
|
||||
@@ -60,18 +60,23 @@ void set_colorpairs(void)
|
||||
colortype *combo = color_combo[i];
|
||||
|
||||
if (combo != NULL) {
|
||||
if (combo->fg == -1 && !using_defaults)
|
||||
if (combo->fg == USE_THE_DEFAULT && !using_defaults)
|
||||
combo->fg = COLOR_WHITE;
|
||||
if (combo->bg == -1 && !using_defaults)
|
||||
if (combo->bg == USE_THE_DEFAULT && !using_defaults)
|
||||
combo->bg = COLOR_BLACK;
|
||||
init_pair(i + 1, combo->fg, combo->bg);
|
||||
interface_color_pair[i] = COLOR_PAIR(i + 1) | A_BANDAID |
|
||||
(combo->bright ? A_BOLD : A_NORMAL);
|
||||
combo->attributes;
|
||||
} else {
|
||||
if (i != FUNCTION_TAG)
|
||||
interface_color_pair[i] = hilite_attribute;
|
||||
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;
|
||||
} else
|
||||
interface_color_pair[i] = hilite_attribute;
|
||||
}
|
||||
|
||||
free(color_combo[i]);
|
||||
@@ -87,8 +92,7 @@ void set_colorpairs(void)
|
||||
const colortype *beforenow = sint->color;
|
||||
|
||||
while (beforenow != ink && (beforenow->fg != ink->fg ||
|
||||
beforenow->bg != ink->bg ||
|
||||
beforenow->bright != ink->bright))
|
||||
beforenow->bg != ink->bg))
|
||||
beforenow = beforenow->next;
|
||||
|
||||
if (beforenow != ink)
|
||||
@@ -96,8 +100,7 @@ void set_colorpairs(void)
|
||||
else
|
||||
ink->pairnum = new_number++;
|
||||
|
||||
ink->attributes = COLOR_PAIR(ink->pairnum) | A_BANDAID |
|
||||
(ink->bright ? A_BOLD : A_NORMAL);
|
||||
ink->attributes |= COLOR_PAIR(ink->pairnum) | A_BANDAID;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,10 +126,10 @@ void color_init(void)
|
||||
foreground = ink->fg;
|
||||
background = ink->bg;
|
||||
|
||||
if (foreground == -1 && !using_defaults)
|
||||
if (foreground == USE_THE_DEFAULT && !using_defaults)
|
||||
foreground = COLOR_WHITE;
|
||||
|
||||
if (background == -1 && !using_defaults)
|
||||
if (background == USE_THE_DEFAULT && !using_defaults)
|
||||
background = COLOR_BLACK;
|
||||
|
||||
init_pair(ink->pairnum, foreground, background);
|
||||
@@ -143,7 +146,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);
|
||||
@@ -214,7 +217,7 @@ void color_update(void)
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
@@ -272,19 +275,19 @@ void color_update(void)
|
||||
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);
|
||||
regcomp(ink->start, ink->start_regex, ink->rex_flags);
|
||||
}
|
||||
|
||||
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);
|
||||
regcomp(ink->end, ink->end_regex, ink->rex_flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
@@ -329,7 +332,7 @@ void check_the_multis(filestruct *line)
|
||||
}
|
||||
|
||||
/* Allocate (for one line) the cache space for multiline color regexes. */
|
||||
void alloc_multidata_if_needed(filestruct *fileptr)
|
||||
void alloc_multidata_if_needed(linestruct *fileptr)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -347,7 +350,7 @@ 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;
|
||||
@@ -361,7 +364,7 @@ void precalc_multicolorinfo(void)
|
||||
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);
|
||||
|
||||
358
src/cut.c
358
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,28 +24,196 @@
|
||||
|
||||
#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 char_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, NULL, NULL);
|
||||
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);
|
||||
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. */
|
||||
charmove(&openfile->current->data[openfile->current_x],
|
||||
&openfile->current->data[openfile->current_x + char_len],
|
||||
line_len - char_len + 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 -= char_len;
|
||||
#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);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(action);
|
||||
#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(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();
|
||||
}
|
||||
|
||||
/* Return the status of cutbuffer preservation. */
|
||||
inline bool keeping_cutbuffer(void)
|
||||
/* Delete the character under the cursor. */
|
||||
void do_delete(void)
|
||||
{
|
||||
return keep_cutbuffer;
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark && ISSET(LET_THEM_ZAP))
|
||||
zap_text();
|
||||
else
|
||||
#endif
|
||||
do_deletion(DEL);
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
/* 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 and then make it seem blank. */
|
||||
linestruct *is_cutbuffer = cutbuffer;
|
||||
linestruct *is_cutbottom = cutbottom;
|
||||
cutbuffer = NULL;
|
||||
cutbottom = 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. */
|
||||
do_cut_text_void();
|
||||
|
||||
/* Discard the cut word and restore the cutbuffer. */
|
||||
free_lines(cutbuffer);
|
||||
cutbuffer = is_cutbuffer;
|
||||
cutbottom = is_cutbottom;
|
||||
}
|
||||
|
||||
/* Delete a word leftward. */
|
||||
void chop_previous_word(void)
|
||||
{
|
||||
chop_word(BACKWARD);
|
||||
}
|
||||
|
||||
/* Delete a word rightward. */
|
||||
void chop_next_word(void)
|
||||
{
|
||||
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);
|
||||
@@ -56,49 +224,40 @@ void cut_line(void)
|
||||
}
|
||||
|
||||
#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. */
|
||||
/* Move all marked text from the current buffer into the cutbuffer. */
|
||||
void cut_marked(bool *right_side_up)
|
||||
{
|
||||
filestruct *top, *bot;
|
||||
linestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, right_side_up);
|
||||
mark_order((const linestruct **)&top, &top_x,
|
||||
(const linestruct **)&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);
|
||||
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);
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
|
||||
/* Move all the text from the current cursor position to the end of the
|
||||
* file into the cutbuffer. */
|
||||
/* Move all text from the cursor position to end-of-file into the cutbuffer. */
|
||||
void cut_to_eof(void)
|
||||
{
|
||||
extract_buffer(&cutbuffer, &cutbottom,
|
||||
@@ -110,27 +269,28 @@ void cut_to_eof(void)
|
||||
/* 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
|
||||
* position to the end of the file into the cutbuffer. */
|
||||
void do_cut_text(bool copy_text, bool cut_till_eof)
|
||||
* 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)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
filestruct *cb_save = NULL;
|
||||
linestruct *cb_save = NULL;
|
||||
/* The current end of the cutbuffer, before we add text to it. */
|
||||
size_t cb_save_len = 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;
|
||||
|
||||
/* If a chain of cuts was broken, empty the cutbuffer. */
|
||||
if (!keep_cutbuffer) {
|
||||
free_filestruct(cutbuffer);
|
||||
/* If cuts were not continuous, or when cutting a region, clear the slate. */
|
||||
if (!append && (!keep_cutbuffer || marked || cut_till_eof)) {
|
||||
free_lines(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
/* Indicate that future cuts should add to the cutbuffer. */
|
||||
keep_cutbuffer = TRUE;
|
||||
/* After a line cut, future line cuts should add to the cutbuffer. */
|
||||
keep_cutbuffer = !marked && !cut_till_eof;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -140,7 +300,7 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
|
||||
cb_save = cutbottom;
|
||||
cb_save_len = 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);
|
||||
}
|
||||
|
||||
@@ -177,35 +337,58 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
|
||||
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)
|
||||
set_modified();
|
||||
|
||||
set_modified();
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
check_the_multis(openfile->current);
|
||||
/* 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
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_filestruct(cutbuffer);
|
||||
)) {
|
||||
#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)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
add_undo(CUT);
|
||||
#endif
|
||||
do_cut_text(FALSE, FALSE);
|
||||
#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 != NULL, FALSE, FALSE);
|
||||
update_undo(CUT);
|
||||
#else
|
||||
if (is_cuttable(FALSE))
|
||||
do_cut_text(FALSE, FALSE, FALSE, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -215,7 +398,7 @@ void do_cut_text_void(void)
|
||||
* was moved, blow away previous contents of the cutbuffer. */
|
||||
void do_copy_text(void)
|
||||
{
|
||||
static struct filestruct *next_contiguous_line = NULL;
|
||||
static linestruct *next_contiguous_line = NULL;
|
||||
bool mark_is_set = (openfile->mark != NULL);
|
||||
|
||||
/* Remember the current viewport and cursor position. */
|
||||
@@ -225,9 +408,9 @@ void do_copy_text(void)
|
||||
size_t is_current_x = openfile->current_x;
|
||||
|
||||
if (mark_is_set || openfile->current != next_contiguous_line)
|
||||
cutbuffer_reset();
|
||||
keep_cutbuffer = FALSE;
|
||||
|
||||
do_cut_text(TRUE, FALSE);
|
||||
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);
|
||||
@@ -244,10 +427,46 @@ void do_copy_text(void)
|
||||
/* Cut from the current cursor position to the end of the file. */
|
||||
void do_cut_till_eof(void)
|
||||
{
|
||||
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);
|
||||
do_cut_text(FALSE, TRUE);
|
||||
do_cut_text(FALSE, FALSE, TRUE, FALSE);
|
||||
update_undo(CUT_TO_EOF);
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
linestruct *was_cutbuffer = cutbuffer;
|
||||
linestruct *was_cutbottom = cutbottom;
|
||||
|
||||
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);
|
||||
|
||||
/* 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 != NULL, FALSE, TRUE);
|
||||
|
||||
update_undo(ZAP);
|
||||
|
||||
cutbuffer = was_cutbuffer;
|
||||
cutbottom = was_cutbottom;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Copy text from the cutbuffer into the current buffer. */
|
||||
@@ -258,9 +477,10 @@ void do_uncut_text(void)
|
||||
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);
|
||||
@@ -286,8 +506,4 @@ void do_uncut_text(void)
|
||||
|
||||
set_modified();
|
||||
refresh_needed = TRUE;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
check_the_multis(openfile->current);
|
||||
#endif
|
||||
}
|
||||
|
||||
417
src/files.c
417
src/files.c
@@ -1,8 +1,8 @@
|
||||
/**************************************************************************
|
||||
* files.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015-2017 Benno Schulenberg *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015-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 *
|
||||
@@ -62,20 +62,23 @@ bool has_valid_path(const char *filename)
|
||||
/* Add an item to the circular list of openfile structs. */
|
||||
void make_new_buffer(void)
|
||||
{
|
||||
openfilestruct *newnode = make_new_opennode();
|
||||
openfilestruct *newnode = nmalloc(sizeof(openfilestruct));
|
||||
|
||||
if (openfile == NULL) {
|
||||
/* Make the first open file the only element in the list. */
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
newnode->prev = newnode;
|
||||
newnode->next = newnode;
|
||||
#endif
|
||||
firstfile = newnode;
|
||||
} else {
|
||||
/* Add the new open file after the current one in the list. */
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
newnode->prev = openfile;
|
||||
newnode->next = openfile->next;
|
||||
openfile->next->prev = newnode;
|
||||
openfile->next = newnode;
|
||||
|
||||
#endif
|
||||
/* There is more than one file open: show "Close" in help lines. */
|
||||
exitfunc->desc = close_tag;
|
||||
more_than_one = !inhelp || more_than_one;
|
||||
@@ -114,12 +117,12 @@ void make_new_buffer(void)
|
||||
/* Initialize the text and pointers of the current openfile struct. */
|
||||
void initialize_buffer_text(void)
|
||||
{
|
||||
openfile->fileage = make_new_node(NULL);
|
||||
openfile->fileage->data = mallocstrcpy(NULL, "");
|
||||
openfile->filetop = make_new_node(NULL);
|
||||
openfile->filetop->data = mallocstrcpy(NULL, "");
|
||||
|
||||
openfile->filebot = openfile->fileage;
|
||||
openfile->edittop = openfile->fileage;
|
||||
openfile->current = openfile->fileage;
|
||||
openfile->filebot = openfile->filetop;
|
||||
openfile->edittop = openfile->filetop;
|
||||
openfile->current = openfile->filetop;
|
||||
|
||||
openfile->firstcolumn = 0;
|
||||
openfile->current_x = 0;
|
||||
@@ -313,7 +316,7 @@ int do_lockfile(const char *filename)
|
||||
size_t readtot = 0;
|
||||
size_t readamt = 0;
|
||||
char *lockbuf, *question, *pidstring, *postedname, *promptstr;
|
||||
int room, response;
|
||||
int room, choice;
|
||||
|
||||
if ((lockfd = open(lockfilename, O_RDONLY)) < 0) {
|
||||
statusline(MILD, _("Error opening lock file %s: %s"),
|
||||
@@ -356,13 +359,13 @@ int do_lockfile(const char *filename)
|
||||
postedname = mallocstrcpy(NULL, "_");
|
||||
else if (room < strlenpt(filename)) {
|
||||
char *fragment = display_string(filename,
|
||||
strlenpt(filename) - room + 3, room, FALSE);
|
||||
strlenpt(filename) - room + 3, room, FALSE, FALSE);
|
||||
postedname = charalloc(strlen(fragment) + 4);
|
||||
strcpy(postedname, "...");
|
||||
strcat(postedname, fragment);
|
||||
free(fragment);
|
||||
} else
|
||||
postedname = display_string(filename, 0, room, FALSE);
|
||||
postedname = display_string(filename, 0, room, FALSE, FALSE);
|
||||
|
||||
/* Allow extra space for username (14), program name (8), PID (8),
|
||||
* and terminating \0 (1), minus the %s (2) for the file name. */
|
||||
@@ -371,10 +374,10 @@ int do_lockfile(const char *filename)
|
||||
free(postedname);
|
||||
free(pidstring);
|
||||
|
||||
response = do_yesno_prompt(FALSE, promptstr);
|
||||
choice = do_yesno_prompt(FALSE, promptstr);
|
||||
free(promptstr);
|
||||
|
||||
if (response < 1) {
|
||||
if (choice < 1) {
|
||||
wipe_statusbar();
|
||||
goto free_the_name;
|
||||
}
|
||||
@@ -406,13 +409,11 @@ void stat_with_alloc(const char *filename, struct stat **pstat)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* This does one of three things. If the filename is "", just create a new
|
||||
* empty buffer. Otherwise, read the given file into the existing buffer,
|
||||
* or into a new buffer when MULTIBUFFER is set or there is no buffer yet. */
|
||||
bool open_buffer(const char *filename, bool undoable)
|
||||
/* This does one of three things. If the filename is "", it just creates
|
||||
* a new empty buffer. When the filename is not empty, it reads that file
|
||||
* into a new buffer when requested, otherwise into the existing buffer. */
|
||||
bool open_buffer(const char *filename, bool new_buffer)
|
||||
{
|
||||
bool new_buffer = (openfile == NULL || ISSET(MULTIBUFFER));
|
||||
/* Whether we load into the current buffer or a new one. */
|
||||
char *realname;
|
||||
/* The filename after tilde expansion. */
|
||||
FILE *f;
|
||||
@@ -435,7 +436,7 @@ bool open_buffer(const char *filename, bool undoable)
|
||||
|
||||
/* When the specified filename is not empty, and the corresponding
|
||||
* file exists, verify that it is a normal file. */
|
||||
if (strcmp(filename, "") != 0) {
|
||||
if (*filename != '\0') {
|
||||
struct stat fileinfo;
|
||||
|
||||
if (stat(realname, &fileinfo) == 0 && !(S_ISREG(fileinfo.st_mode) ||
|
||||
@@ -475,25 +476,21 @@ bool open_buffer(const char *filename, bool undoable)
|
||||
rc = (filename[0] != '\0' && !ISSET(NOREAD_MODE)) ?
|
||||
open_file(realname, new_buffer, inhelp, &f) : -2;
|
||||
|
||||
/* If we have a file, and we're loading into a new buffer, update
|
||||
* the filename. */
|
||||
if (rc != -1 && new_buffer)
|
||||
openfile->filename = mallocstrcpy(openfile->filename, realname);
|
||||
|
||||
/* If we have a non-new file, read it in. Then, if the buffer has
|
||||
* no stat, update the stat, if applicable. */
|
||||
if (rc > 0) {
|
||||
read_file(f, rc, realname, undoable, new_buffer);
|
||||
read_file(f, rc, realname, !new_buffer);
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->current_stat == NULL)
|
||||
stat_with_alloc(realname, &openfile->current_stat);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If we have a file, and we're loading into a new buffer, move back
|
||||
* to the beginning of the first line of the buffer. */
|
||||
/* If we have a file, and we've loaded it into a new buffer, set
|
||||
* the filename and put the cursor at the start of the buffer. */
|
||||
if (rc != -1 && new_buffer) {
|
||||
openfile->current = openfile->fileage;
|
||||
openfile->filename = mallocstrcpy(openfile->filename, realname);
|
||||
openfile->current = openfile->filetop;
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
}
|
||||
@@ -515,6 +512,7 @@ void replace_buffer(const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
int descriptor;
|
||||
linestruct *was_cutbuffer = cutbuffer;
|
||||
|
||||
/* Open the file quietly. */
|
||||
descriptor = open_file(filename, FALSE, TRUE, &f);
|
||||
@@ -523,47 +521,73 @@ void replace_buffer(const char *filename)
|
||||
if (descriptor < 0)
|
||||
return;
|
||||
|
||||
/* Reinitialize the text of the current buffer. */
|
||||
free_filestruct(openfile->fileage);
|
||||
initialize_buffer_text();
|
||||
#ifndef NANO_TINY
|
||||
add_undo(COUPLE_BEGIN);
|
||||
openfile->undotop->strdata = mallocstrcpy(NULL, _("spelling correction"));
|
||||
#endif
|
||||
|
||||
/* Throw away the text of the file. */
|
||||
cutbuffer = NULL;
|
||||
openfile->current = openfile->filetop;
|
||||
openfile->current_x = 0;
|
||||
#ifndef NANO_TINY
|
||||
add_undo(CUT_TO_EOF);
|
||||
#endif
|
||||
do_cut_text(FALSE, FALSE, TRUE, FALSE);
|
||||
#ifndef NANO_TINY
|
||||
update_undo(CUT_TO_EOF);
|
||||
#endif
|
||||
free_lines(cutbuffer);
|
||||
cutbuffer = was_cutbuffer;
|
||||
|
||||
/* Insert the processed file into its place. */
|
||||
read_file(f, descriptor, filename, FALSE, TRUE);
|
||||
read_file(f, descriptor, filename, TRUE);
|
||||
|
||||
/* Put current at a place that is certain to exist. */
|
||||
openfile->current = openfile->fileage;
|
||||
#ifndef NANO_TINY
|
||||
add_undo(COUPLE_END);
|
||||
openfile->undotop->strdata = mallocstrcpy(NULL, _("spelling correction"));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Open the specified file, and if that succeeds, blow away the text of
|
||||
* the current buffer at the given coordinates and read the file
|
||||
* the current buffer covered by the mark and read the file
|
||||
* contents into its place. */
|
||||
void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x,
|
||||
filestruct *bot, size_t bot_x)
|
||||
void replace_marked_buffer(const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
int descriptor;
|
||||
bool old_no_newlines = ISSET(NO_NEWLINES);
|
||||
filestruct *trash_top = NULL;
|
||||
filestruct *trash_bot = NULL;
|
||||
bool using_magicline = !ISSET(NO_NEWLINES);
|
||||
linestruct *was_cutbuffer = cutbuffer;
|
||||
|
||||
descriptor = open_file(filename, FALSE, TRUE, &f);
|
||||
|
||||
if (descriptor < 0)
|
||||
return;
|
||||
|
||||
/* Don't add a magicline when replacing text in the buffer. */
|
||||
/* Don't add a magic line when replacing text in the buffer. */
|
||||
SET(NO_NEWLINES);
|
||||
|
||||
/* Throw away the text under the mark, and insert the processed file
|
||||
* where the marked text was. */
|
||||
extract_buffer(&trash_top, &trash_bot, top, top_x, bot, bot_x);
|
||||
free_filestruct(trash_top);
|
||||
read_file(f, descriptor, filename, FALSE, TRUE);
|
||||
add_undo(COUPLE_BEGIN);
|
||||
openfile->undotop->strdata = mallocstrcpy(NULL, _("spelling correction"));
|
||||
|
||||
/* Restore the magicline behavior now that we're done fiddling. */
|
||||
if (!old_no_newlines)
|
||||
/* Throw away the text under the mark. */
|
||||
cutbuffer = NULL;
|
||||
add_undo(CUT);
|
||||
do_cut_text(FALSE, TRUE, FALSE, FALSE);
|
||||
update_undo(CUT);
|
||||
free_lines(cutbuffer);
|
||||
cutbuffer = was_cutbuffer;
|
||||
|
||||
/* Insert the processed file where the marked text was. */
|
||||
read_file(f, descriptor, filename, TRUE);
|
||||
|
||||
/* Restore the magic-line behavior now that we're done fiddling. */
|
||||
if (using_magicline)
|
||||
UNSET(NO_NEWLINES);
|
||||
|
||||
add_undo(COUPLE_END);
|
||||
openfile->undotop->strdata = mallocstrcpy(NULL, _("spelling correction"));
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
#endif /* ENABLE_SPELLER */
|
||||
@@ -579,7 +603,7 @@ void prepare_for_display(void)
|
||||
/* If there are multiline coloring regexes, and there is no
|
||||
* multiline cache data yet, precalculate it now. */
|
||||
if (openfile->syntax && openfile->syntax->nmultis > 0 &&
|
||||
openfile->fileage->multidata == NULL)
|
||||
openfile->filetop->multidata == NULL)
|
||||
precalc_multicolorinfo();
|
||||
|
||||
have_palette = FALSE;
|
||||
@@ -588,12 +612,31 @@ void prepare_for_display(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Show name of current buffer and its number of lines on the status bar. */
|
||||
void mention_name_and_linecount(void)
|
||||
{
|
||||
size_t count = openfile->filebot->lineno -
|
||||
(openfile->filebot->data[0] == '\0' ? 1 : 0);
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->fmt != NIX_FILE)
|
||||
/* TRANSLATORS: first %s is file name, second %s is file format. */
|
||||
statusline(HUSH, P_("%s -- %zu line (%s)", "%s -- %zu lines (%s)", count),
|
||||
openfile->filename[0] == '\0' ?
|
||||
_("New Buffer") : tail(openfile->filename), count,
|
||||
openfile->fmt == DOS_FILE ? _("DOS") : _("Mac"));
|
||||
else
|
||||
#endif
|
||||
statusline(HUSH, P_("%s -- %zu line", "%s -- %zu lines", count),
|
||||
openfile->filename[0] == '\0' ?
|
||||
_("New Buffer") : tail(openfile->filename), count);
|
||||
}
|
||||
|
||||
/* Switch to a neighbouring file buffer; to the next if to_next is TRUE;
|
||||
* otherwise, to the previous one. */
|
||||
void switch_to_adjacent_buffer(bool to_next)
|
||||
{
|
||||
/* If only one file buffer is open, say so and get out. */
|
||||
if (openfile == openfile->next && !inhelp) {
|
||||
if (openfile == openfile->next) {
|
||||
statusbar(_("No more open file buffers"));
|
||||
return;
|
||||
}
|
||||
@@ -618,14 +661,11 @@ void switch_to_adjacent_buffer(bool to_next)
|
||||
/* Ensure that the main loop will redraw the help lines. */
|
||||
currmenu = MMOST;
|
||||
|
||||
/* Indicate the switch on the statusbar. */
|
||||
statusline(HUSH, _("Switched to %s"),
|
||||
((openfile->filename[0] == '\0') ?
|
||||
_("New Buffer") : openfile->filename));
|
||||
/* Prevent a possible Shift selection from getting cancelled. */
|
||||
shift_held = TRUE;
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_filestruct(openfile->current);
|
||||
#endif
|
||||
/* Indicate on the status bar where we switched to. */
|
||||
mention_name_and_linecount();
|
||||
}
|
||||
|
||||
/* Switch to the previous entry in the list of open files. */
|
||||
@@ -641,22 +681,19 @@ void switch_to_next_buffer(void)
|
||||
}
|
||||
|
||||
/* Delete an entry from the circular list of open files, and switch to the
|
||||
* one after it. Return TRUE on success, and FALSE if there are no other
|
||||
* open buffers. */
|
||||
* one after it. Return FALSE if just one buffer is open, otherwise TRUE. */
|
||||
bool close_buffer(void)
|
||||
{
|
||||
/* If only one file buffer is open, get out. */
|
||||
if (openfile == openfile->next)
|
||||
return FALSE;
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
if (ISSET(POS_HISTORY))
|
||||
if (ISSET(POSITIONLOG))
|
||||
update_poshistory(openfile->filename,
|
||||
openfile->current->lineno, xplustabs() + 1);
|
||||
#endif
|
||||
|
||||
/* Switch to the next file buffer. */
|
||||
switch_to_adjacent_buffer(TRUE);
|
||||
switch_to_next_buffer();
|
||||
|
||||
/* Delete the old file buffer, and adjust the count in the top bar. */
|
||||
unlink_opennode(openfile->prev);
|
||||
@@ -716,13 +753,10 @@ char *encode_data(char *buf, size_t buf_len)
|
||||
return mallocstrcpy(NULL, buf);
|
||||
}
|
||||
|
||||
/* Read an open file into the current buffer. f should be set to the
|
||||
* open file, and filename should be set to the name of the file.
|
||||
* undoable means do we want to create undo records to try and undo
|
||||
* this. Will also attempt to check file writability if fd > 0 and
|
||||
* checkwritable == TRUE. */
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable,
|
||||
bool checkwritable)
|
||||
/* Read the given open file f into the current buffer. filename should be
|
||||
* set to the name of the file. undoable means that undo records should be
|
||||
* created and that the file does not need to be checked for writability. */
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable)
|
||||
{
|
||||
ssize_t was_lineno = openfile->current->lineno;
|
||||
/* The line number where we start the insertion. */
|
||||
@@ -738,9 +772,9 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable,
|
||||
/* The buffer in which we assemble each line of the file. */
|
||||
size_t bufx = MAX_BUF_SIZE;
|
||||
/* The allocated size of the line buffer; increased as needed. */
|
||||
filestruct *topline;
|
||||
linestruct *topline;
|
||||
/* The top of the new buffer where we store the read file. */
|
||||
filestruct *bottomline;
|
||||
linestruct *bottomline;
|
||||
/* The bottom of the new buffer. */
|
||||
int input_int;
|
||||
/* The current value we read from the file, whether an input
|
||||
@@ -766,8 +800,16 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable,
|
||||
topline = make_new_node(NULL);
|
||||
bottomline = topline;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
block_sigwinch(TRUE);
|
||||
#endif
|
||||
|
||||
/* Lock the file before starting to read it, to avoid the overhead
|
||||
* of locking it for each single byte that we read from it. */
|
||||
flockfile(f);
|
||||
|
||||
/* Read the entire file into the new buffer. */
|
||||
while ((input_int = getc(f)) != EOF) {
|
||||
while ((input_int = getc_unlocked(f)) != EOF) {
|
||||
input = (char)input_int;
|
||||
|
||||
/* If it's a *nix file ("\n") or a DOS file ("\r\n"), and file
|
||||
@@ -834,11 +876,18 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable,
|
||||
#endif
|
||||
}
|
||||
|
||||
/* We are done with the file, unlock it. */
|
||||
funlockfile(f);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
block_sigwinch(FALSE);
|
||||
#endif
|
||||
|
||||
/* Perhaps this could use some better handling. */
|
||||
if (ferror(f))
|
||||
nperror(filename);
|
||||
fclose(f);
|
||||
if (fd > 0 && checkwritable) {
|
||||
if (fd > 0 && !undoable) {
|
||||
close(fd);
|
||||
writable = is_file_writable(filename);
|
||||
}
|
||||
@@ -1042,7 +1091,7 @@ void do_insertfile(void)
|
||||
if (execute) {
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER))
|
||||
/* TRANSLATORS: The next four messages are prompts. */
|
||||
/* TRANSLATORS: The next six messages are prompts. */
|
||||
msg = _("Command to execute in new buffer");
|
||||
else
|
||||
#endif
|
||||
@@ -1052,10 +1101,20 @@ void do_insertfile(void)
|
||||
{
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER))
|
||||
msg = _("File to insert into new buffer [from %s]");
|
||||
#ifndef NANO_TINY
|
||||
if ISSET(NO_CONVERT)
|
||||
msg = _("File to read unconverted into new buffer [from %s]");
|
||||
else
|
||||
#endif
|
||||
msg = _("File to read into new buffer [from %s]");
|
||||
else
|
||||
#endif
|
||||
msg = _("File to insert [from %s]");
|
||||
#ifndef NANO_TINY
|
||||
if ISSET(NO_CONVERT)
|
||||
msg = _("File to insert unconverted [from %s]");
|
||||
else
|
||||
#endif
|
||||
msg = _("File to insert [from %s]");
|
||||
}
|
||||
|
||||
present_path = mallocstrcpy(present_path, "./");
|
||||
@@ -1098,6 +1157,10 @@ void do_insertfile(void)
|
||||
}
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
if (func == flip_convert) {
|
||||
TOGGLE(NO_CONVERT);
|
||||
continue;
|
||||
}
|
||||
if (func == flip_execute) {
|
||||
execute = !execute;
|
||||
continue;
|
||||
@@ -1115,6 +1178,13 @@ void do_insertfile(void)
|
||||
answer = chosen;
|
||||
i = 0;
|
||||
}
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
if (func == flip_pipe) {
|
||||
add_or_remove_pipe_symbol_from_answer();
|
||||
given = mallocstrcpy(given, answer);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
/* If we don't have a file yet, go back to the prompt. */
|
||||
if (i != 0 && (!ISSET(MULTIBUFFER) || i != -2))
|
||||
@@ -1125,7 +1195,7 @@ void do_insertfile(void)
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* When in multibuffer mode, first open a blank buffer. */
|
||||
if (ISSET(MULTIBUFFER))
|
||||
open_buffer("", FALSE);
|
||||
open_buffer("", TRUE);
|
||||
#endif
|
||||
/* If the command is not empty, execute it and read its output
|
||||
* into the buffer, and add the command to the history list. */
|
||||
@@ -1139,7 +1209,7 @@ void do_insertfile(void)
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* If this is a new buffer, put the cursor at the top. */
|
||||
if (ISSET(MULTIBUFFER)) {
|
||||
openfile->current = openfile->fileage;
|
||||
openfile->current = openfile->filetop;
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
|
||||
@@ -1152,14 +1222,14 @@ void do_insertfile(void)
|
||||
/* Make sure the specified path is tilde-expanded. */
|
||||
answer = free_and_assign(answer, real_dir_from_tilde(answer));
|
||||
|
||||
/* Read the specified file into the current buffer. */
|
||||
open_buffer(answer, TRUE);
|
||||
/* Read the file into a new buffer or into current buffer. */
|
||||
open_buffer(answer, ISSET(MULTIBUFFER));
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER)) {
|
||||
#ifdef ENABLE_HISTORIES
|
||||
if (ISSET(POS_HISTORY)) {
|
||||
if (ISSET(POSITIONLOG)) {
|
||||
ssize_t priorline, priorcol;
|
||||
#ifndef NANO_TINY
|
||||
if (!execute)
|
||||
@@ -1196,10 +1266,6 @@ void do_insertfile_void(void)
|
||||
{
|
||||
if (ISSET(RESTRICTED))
|
||||
show_restricted_warning();
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
else if (ISSET(VIEW_MODE) && !ISSET(MULTIBUFFER))
|
||||
statusbar(_("Key invalid in non-multibuffer mode"));
|
||||
#endif
|
||||
else
|
||||
do_insertfile();
|
||||
}
|
||||
@@ -1357,63 +1423,59 @@ char *check_writable_directory(const char *path)
|
||||
}
|
||||
|
||||
/* This function calls mkstemp(($TMPDIR|P_tmpdir|/tmp/)"nano.XXXXXX").
|
||||
* On success, it returns the malloc()ed filename and corresponding FILE
|
||||
* stream, opened in "r+b" mode. On error, it returns NULL for the
|
||||
* filename and leaves the FILE stream unchanged. */
|
||||
* On success, it returns the malloc()ed filename and corresponding
|
||||
* FILE stream, opened in "r+b" mode. On error, it returns NULL for
|
||||
* the filename and leaves the FILE stream unchanged. */
|
||||
char *safe_tempfile(FILE **f)
|
||||
{
|
||||
char *full_tempdir = NULL;
|
||||
const char *tmpdir_env;
|
||||
int fd;
|
||||
const char *tmpdir_env = getenv("TMPDIR");
|
||||
char *full_tempdir = NULL, *tempfile_name = NULL;
|
||||
mode_t original_umask = 0;
|
||||
int fd;
|
||||
|
||||
/* If $TMPDIR is set, set tempdir to it, run it through
|
||||
* get_full_path(), and save the result in full_tempdir. Otherwise,
|
||||
* leave full_tempdir set to NULL. */
|
||||
tmpdir_env = getenv("TMPDIR");
|
||||
/* Get the absolute path for the first directory among $TMPDIR
|
||||
* and P_tmpdir that is writable, otherwise use /tmp/. */
|
||||
if (tmpdir_env != NULL)
|
||||
full_tempdir = check_writable_directory(tmpdir_env);
|
||||
|
||||
/* If $TMPDIR is unset, empty, or not a writable directory, and
|
||||
* full_tempdir is NULL, try P_tmpdir instead. */
|
||||
if (full_tempdir == NULL)
|
||||
full_tempdir = check_writable_directory(P_tmpdir);
|
||||
|
||||
/* if P_tmpdir is NULL, use /tmp. */
|
||||
if (full_tempdir == NULL)
|
||||
full_tempdir = mallocstrcpy(NULL, "/tmp/");
|
||||
|
||||
full_tempdir = charealloc(full_tempdir, strlen(full_tempdir) + 12);
|
||||
strcat(full_tempdir, "nano.XXXXXX");
|
||||
tempfile_name = charealloc(full_tempdir, strlen(full_tempdir) + 12);
|
||||
strcat(tempfile_name, "nano.XXXXXX");
|
||||
|
||||
original_umask = umask(0);
|
||||
umask(S_IRWXG | S_IRWXO);
|
||||
|
||||
fd = mkstemp(full_tempdir);
|
||||
fd = mkstemp(tempfile_name);
|
||||
|
||||
if (fd != -1)
|
||||
*f = fdopen(fd, "r+b");
|
||||
else {
|
||||
free(full_tempdir);
|
||||
full_tempdir = NULL;
|
||||
free(tempfile_name);
|
||||
tempfile_name = NULL;
|
||||
}
|
||||
|
||||
umask(original_umask);
|
||||
|
||||
return full_tempdir;
|
||||
return tempfile_name;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
/* Change to the specified operating directory, when it's valid. */
|
||||
void init_operating_dir(void)
|
||||
{
|
||||
operating_dir = free_and_assign(operating_dir, get_full_path(operating_dir));
|
||||
char *target = get_full_path(operating_dir);
|
||||
|
||||
/* If the operating directory is inaccessible, fail. */
|
||||
if (operating_dir == NULL || chdir(operating_dir) == -1)
|
||||
die(_("Invalid operating directory\n"));
|
||||
if (target == NULL || chdir(target) == -1)
|
||||
die(_("Invalid operating directory: %s\n"), operating_dir);
|
||||
|
||||
snuggly_fit(&operating_dir);
|
||||
free(operating_dir);
|
||||
operating_dir = charealloc(target, strlen(target) + 1);
|
||||
}
|
||||
|
||||
/* Check whether the given path is outside of the operating directory.
|
||||
@@ -1455,31 +1517,32 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp)
|
||||
* messed up and I'm blanket allowing insecure file writing operations'. */
|
||||
int prompt_failed_backupwrite(const char *filename)
|
||||
{
|
||||
static int response;
|
||||
static int choice;
|
||||
static char *prevfile = NULL;
|
||||
/* The last file we were passed, so we don't keep asking this.
|
||||
* Though maybe we should? */
|
||||
/* The last filename we were passed, so we don't keep asking this. */
|
||||
|
||||
if (prevfile == NULL || strcmp(filename, prevfile)) {
|
||||
response = do_yesno_prompt(FALSE, _("Failed to write backup file; "
|
||||
choice = do_yesno_prompt(FALSE, _("Failed to write backup file; "
|
||||
"continue saving? (Say N if unsure.) "));
|
||||
prevfile = mallocstrcpy(prevfile, filename);
|
||||
}
|
||||
|
||||
return response;
|
||||
return choice;
|
||||
}
|
||||
|
||||
/* Transform the specified backup directory to an absolute path,
|
||||
* and verify that it is usable. */
|
||||
void init_backup_dir(void)
|
||||
{
|
||||
backup_dir = free_and_assign(backup_dir, get_full_path(backup_dir));
|
||||
char *target = get_full_path(backup_dir);
|
||||
|
||||
/* If we can't get an absolute path (which means it doesn't exist or
|
||||
* isn't accessible), or it's not a directory, fail. */
|
||||
if (backup_dir == NULL || backup_dir[strlen(backup_dir) - 1] != '/')
|
||||
die(_("Invalid backup directory\n"));
|
||||
if (target == NULL || target[strlen(target) - 1] != '/')
|
||||
die(_("Invalid backup directory: %s\n"), backup_dir);
|
||||
|
||||
snuggly_fit(&backup_dir);
|
||||
free(backup_dir);
|
||||
backup_dir = charealloc(target, strlen(target) + 1);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -1538,7 +1601,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
/* Instead of returning in this function, you should always
|
||||
* set retval and then goto cleanup_and_exit. */
|
||||
size_t lineswritten = 0;
|
||||
const filestruct *fileptr = openfile->fileage;
|
||||
const linestruct *fileptr = openfile->filetop;
|
||||
int fd;
|
||||
/* The file descriptor we use. */
|
||||
mode_t original_umask = 0;
|
||||
@@ -1761,6 +1824,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
umask(original_umask);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we're prepending, copy the file to a temp file. */
|
||||
if (method == PREPEND) {
|
||||
int fd_source;
|
||||
@@ -1807,6 +1871,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
if (f_open == NULL) {
|
||||
/* Now open the file in place. Use O_EXCL if tmp is TRUE. This
|
||||
@@ -1840,13 +1905,12 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
while (fileptr != NULL) {
|
||||
size_t data_len = strlen(fileptr->data), size;
|
||||
|
||||
/* Convert newlines to nulls, just before we write to disk. */
|
||||
/* Decode LFs as the NULs that they are, before writing to disk. */
|
||||
sunder(fileptr->data);
|
||||
|
||||
size = fwrite(fileptr->data, sizeof(char), data_len, f);
|
||||
|
||||
/* Convert nulls to newlines. data_len is the string's real
|
||||
* length. */
|
||||
/* Re-encode any embedded NULs as LFs. */
|
||||
unsunder(fileptr->data, data_len);
|
||||
|
||||
if (size < data_len) {
|
||||
@@ -1888,6 +1952,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
lineswritten++;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we're prepending, open the temp file, and append it to f. */
|
||||
if (method == PREPEND) {
|
||||
int fd_source;
|
||||
@@ -1915,22 +1980,24 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
}
|
||||
|
||||
unlink(tempname);
|
||||
} else if (fclose(f) != 0) {
|
||||
} else
|
||||
#endif
|
||||
if (fclose(f) != 0) {
|
||||
statusline(ALERT, _("Error writing %s: %s"), realname,
|
||||
strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
if (method == OVERWRITE && !tmp) {
|
||||
/* If we must set the filename, and it changed, adjust things. */
|
||||
if (fullbuffer && strcmp(openfile->filename, realname) != 0) {
|
||||
/* When having written an entire buffer, update some administrivia. */
|
||||
if (fullbuffer && method == OVERWRITE && !tmp) {
|
||||
/* If the filename was changed, check if this means a new syntax. */
|
||||
if (strcmp(openfile->filename, realname) != 0) {
|
||||
#ifdef ENABLE_COLOR
|
||||
const char *oldname, *newname;
|
||||
|
||||
oldname = openfile->syntax ? openfile->syntax->name : "";
|
||||
#endif
|
||||
openfile->filename = mallocstrcpy(openfile->filename, realname);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
/* See if the applicable syntax has changed. */
|
||||
color_update();
|
||||
@@ -1940,36 +2007,34 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
|
||||
/* If the syntax changed, discard and recompute the multidata. */
|
||||
if (strcmp(oldname, newname) != 0) {
|
||||
filestruct *line = openfile->fileage;
|
||||
linestruct *line = openfile->filetop;
|
||||
|
||||
while (line != NULL) {
|
||||
free(line->multidata);
|
||||
line->multidata = NULL;
|
||||
line = line->next;
|
||||
}
|
||||
|
||||
precalc_multicolorinfo();
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (fullbuffer) {
|
||||
#ifndef NANO_TINY
|
||||
/* Get or update the stat info to reflect the current state. */
|
||||
stat_with_alloc(realname, &openfile->current_stat);
|
||||
/* Get or update the stat info to reflect the current state. */
|
||||
stat_with_alloc(realname, &openfile->current_stat);
|
||||
|
||||
/* Record at which point in the undo stack the file was saved. */
|
||||
openfile->last_saved = openfile->current_undo;
|
||||
openfile->last_action = OTHER;
|
||||
/* Record at which point in the undo stack the file was saved. */
|
||||
openfile->last_saved = openfile->current_undo;
|
||||
openfile->last_action = OTHER;
|
||||
#endif
|
||||
openfile->modified = FALSE;
|
||||
titlebar(NULL);
|
||||
}
|
||||
|
||||
statusline(HUSH, P_("Wrote %zu line", "Wrote %zu lines",
|
||||
lineswritten), lineswritten);
|
||||
openfile->modified = FALSE;
|
||||
titlebar(NULL);
|
||||
}
|
||||
|
||||
if (!tmp)
|
||||
statusline(HUSH, P_("Wrote %zu line", "Wrote %zu lines",
|
||||
lineswritten), lineswritten);
|
||||
retval = TRUE;
|
||||
|
||||
cleanup_and_exit:
|
||||
@@ -1987,16 +2052,15 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
{
|
||||
bool retval;
|
||||
bool added_magicline = FALSE;
|
||||
/* Whether we added a magicline after filebot. */
|
||||
filestruct *top, *bot;
|
||||
linestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
/* Partition the buffer so that it contains only the marked text. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
filepart = partition_filestruct(top, top_x, bot, bot_x);
|
||||
mark_order((const linestruct **)&top, &top_x,
|
||||
(const linestruct **)&bot, &bot_x, NULL);
|
||||
filepart = partition_buffer(top, top_x, bot, bot_x);
|
||||
|
||||
/* If we are doing magicline, and the last line of the partition
|
||||
/* If we are using a magic line, and the last line of the partition
|
||||
* isn't blank, then add a newline at the end of the buffer. */
|
||||
if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0') {
|
||||
new_magicline();
|
||||
@@ -2005,12 +2069,11 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
|
||||
retval = write_file(name, f_open, tmp, method, FALSE);
|
||||
|
||||
/* If we added a magicline, remove it now. */
|
||||
if (added_magicline)
|
||||
remove_magicline();
|
||||
|
||||
/* Unpartition the buffer so that it contains all the text again. */
|
||||
unpartition_filestruct(&filepart);
|
||||
unpartition_buffer(&filepart);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -2046,7 +2109,7 @@ int do_writeout(bool exiting, bool withprompt)
|
||||
|
||||
while (TRUE) {
|
||||
const char *msg;
|
||||
int i = 0;
|
||||
int response = 0, choice = 0;
|
||||
functionptrtype func;
|
||||
#ifndef NANO_TINY
|
||||
const char *formatstr, *backupstr;
|
||||
@@ -2079,7 +2142,7 @@ int do_writeout(bool exiting, bool withprompt)
|
||||
else {
|
||||
/* Ask for (confirmation of) the filename. Disable tab completion
|
||||
* when using restricted mode and the filename isn't blank. */
|
||||
i = do_prompt(!ISSET(RESTRICTED) || openfile->filename[0] == '\0',
|
||||
response = do_prompt(!ISSET(RESTRICTED) || openfile->filename[0] == '\0',
|
||||
TRUE, MWRITEFILE, given, NULL,
|
||||
edit_refresh, "%s%s%s", msg,
|
||||
#ifndef NANO_TINY
|
||||
@@ -2090,12 +2153,12 @@ int do_writeout(bool exiting, bool withprompt)
|
||||
);
|
||||
}
|
||||
|
||||
if (i < 0) {
|
||||
if (response < 0) {
|
||||
statusbar(_("Cancelled"));
|
||||
break;
|
||||
}
|
||||
|
||||
func = func_from_key(&i);
|
||||
func = func_from_key(&response);
|
||||
|
||||
/* Upon request, abandon the buffer. */
|
||||
if (func == discard_buffer) {
|
||||
@@ -2146,8 +2209,12 @@ int do_writeout(bool exiting, bool withprompt)
|
||||
* egg. Display the credits. */
|
||||
if (!did_credits && exiting && !ISSET(TEMP_FILE) &&
|
||||
strcasecmp(answer, "zzy") == 0) {
|
||||
do_credits();
|
||||
did_credits = TRUE;
|
||||
if (LINES > 5 && COLS > 31) {
|
||||
do_credits();
|
||||
did_credits = TRUE;
|
||||
} else
|
||||
/* TRANSLATORS: Concisely say the screen is too small. */
|
||||
statusbar(_("Too tiny"));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -2197,18 +2264,18 @@ int do_writeout(bool exiting, bool withprompt)
|
||||
if (name_exists) {
|
||||
char *question = _("File \"%s\" exists; OVERWRITE? ");
|
||||
char *name = display_string(answer, 0,
|
||||
COLS - strlenpt(question) + 1, FALSE);
|
||||
COLS - strlenpt(question) + 1, FALSE, FALSE);
|
||||
char *message = charalloc(strlen(question) +
|
||||
strlen(name) + 1);
|
||||
|
||||
sprintf(message, question, name);
|
||||
|
||||
i = do_yesno_prompt(FALSE, message);
|
||||
choice = do_yesno_prompt(FALSE, message);
|
||||
|
||||
free(message);
|
||||
free(name);
|
||||
|
||||
if (i < 1)
|
||||
if (choice < 1)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2220,11 +2287,10 @@ int do_writeout(bool exiting, bool withprompt)
|
||||
(openfile->current_stat->st_mtime < st.st_mtime ||
|
||||
openfile->current_stat->st_dev != st.st_dev ||
|
||||
openfile->current_stat->st_ino != st.st_ino)) {
|
||||
int response;
|
||||
|
||||
warn_and_shortly_pause(_("File on disk has changed"));
|
||||
|
||||
response = do_yesno_prompt(FALSE, _("File was modified "
|
||||
choice = do_yesno_prompt(FALSE, _("File was modified "
|
||||
"since you opened it; continue saving? "));
|
||||
wipe_statusbar();
|
||||
|
||||
@@ -2232,14 +2298,14 @@ int do_writeout(bool exiting, bool withprompt)
|
||||
* overwrite the file right here when requested. */
|
||||
if (ISSET(TEMP_FILE) && withprompt) {
|
||||
free(given);
|
||||
if (response == 1)
|
||||
if (choice == 1)
|
||||
return write_file(openfile->filename, NULL,
|
||||
FALSE, OVERWRITE, TRUE);
|
||||
else if (response == 0)
|
||||
else if (choice == 0)
|
||||
return 2;
|
||||
else
|
||||
return 0;
|
||||
} else if (response != 1) {
|
||||
} else if (choice != 1) {
|
||||
free(given);
|
||||
return 1;
|
||||
}
|
||||
@@ -2353,18 +2419,16 @@ int diralphasort(const void *va, const void *vb)
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_TABCOMP
|
||||
/* Is the given path a directory? */
|
||||
bool is_dir(const char *buf)
|
||||
/* Return TRUE when the given path is a directory. */
|
||||
bool is_dir(const char *path)
|
||||
{
|
||||
char *dirptr;
|
||||
char *realpath = real_dir_from_tilde(path);
|
||||
struct stat fileinfo;
|
||||
bool retval;
|
||||
|
||||
dirptr = real_dir_from_tilde(buf);
|
||||
retval = (stat(realpath, &fileinfo) != -1 && S_ISDIR(fileinfo.st_mode));
|
||||
|
||||
retval = (stat(dirptr, &fileinfo) != -1 && S_ISDIR(fileinfo.st_mode));
|
||||
|
||||
free(dirptr);
|
||||
free(realpath);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -2429,8 +2493,8 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||
|
||||
/* We consider the first buf_len characters of buf for filename tab
|
||||
* completion. */
|
||||
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||
*num_matches, size_t buf_len)
|
||||
char **cwd_tab_completion(const char *buf, bool allow_files,
|
||||
size_t *num_matches, size_t buf_len)
|
||||
{
|
||||
char *dirname = mallocstrcpy(NULL, buf);
|
||||
char *slash, *filename;
|
||||
@@ -2609,7 +2673,8 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
if (!*lastwastab)
|
||||
*lastwastab = TRUE;
|
||||
else if (num_matches > 1) {
|
||||
int longest_name = 0, ncols, editline = 0;
|
||||
size_t longest_name = 0, ncols;
|
||||
int editline = 0;
|
||||
|
||||
/* Sort the list of available choices. */
|
||||
qsort(matches, num_matches, sizeof(char *), diralphasort);
|
||||
@@ -2647,7 +2712,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
break;
|
||||
}
|
||||
|
||||
disp = display_string(matches[match], 0, longest_name, FALSE);
|
||||
disp = display_string(matches[match], 0, longest_name, FALSE, FALSE);
|
||||
waddstr(edit, disp);
|
||||
free(disp);
|
||||
|
||||
|
||||
1150
src/global.c
1150
src/global.c
File diff suppressed because it is too large
Load Diff
111
src/help.c
111
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 *
|
||||
@@ -46,7 +46,7 @@ char *tempfilename = NULL;
|
||||
* read that file into a new buffer. */
|
||||
void wrap_the_help_text(bool redisplaying)
|
||||
{
|
||||
int sum = 0;
|
||||
size_t sum = 0;
|
||||
const char *ptr = start_of_body;
|
||||
FILE *tempfile = fopen(tempfilename, "w+b");
|
||||
|
||||
@@ -75,7 +75,7 @@ void wrap_the_help_text(bool redisplaying)
|
||||
if (redisplaying)
|
||||
close_buffer();
|
||||
|
||||
open_buffer(tempfilename, FALSE);
|
||||
open_buffer(tempfilename, TRUE);
|
||||
remove_magicline();
|
||||
|
||||
prepare_for_display();
|
||||
@@ -110,7 +110,7 @@ void do_help(void)
|
||||
/* 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;
|
||||
|
||||
@@ -142,10 +142,10 @@ void do_help(void)
|
||||
|
||||
UNSET(WHITESPACE_DISPLAY);
|
||||
UNSET(NOREAD_MODE);
|
||||
SET(MULTIBUFFER);
|
||||
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
UNSET(LINE_NUMBERS);
|
||||
editwincols = COLS;
|
||||
margin = 0;
|
||||
#endif
|
||||
tabsize = 8;
|
||||
@@ -161,7 +161,6 @@ void do_help(void)
|
||||
didfind = 0;
|
||||
|
||||
bottombars(MHELP);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
/* Extract the title from the head of the help text. */
|
||||
length = break_line(help_text, MAX_BUF_SIZE, TRUE);
|
||||
@@ -184,37 +183,34 @@ void do_help(void)
|
||||
focusing = TRUE;
|
||||
|
||||
/* Show the cursor when we searched and found something. */
|
||||
kbinput = get_kbinput(edit, didfind == 1);
|
||||
kbinput = get_kbinput(edit, didfind == 1 || ISSET(SHOW_CURSOR));
|
||||
didfind = 0;
|
||||
|
||||
func = parse_help_input(&kbinput);
|
||||
|
||||
if (func == total_refresh) {
|
||||
total_redraw();
|
||||
} else if (func == do_up_void) {
|
||||
do_up(TRUE);
|
||||
} else if (func == do_down_void) {
|
||||
} else if (ISSET(SHOW_CURSOR) && (func == do_left || func == do_right ||
|
||||
func == do_up || func == do_down)) {
|
||||
func();
|
||||
} else if (func == do_up || func == do_scroll_up) {
|
||||
do_scroll_up();
|
||||
} else if (func == do_down || func == do_scroll_down) {
|
||||
if (openfile->edittop->lineno + editwinrows - 1 <
|
||||
openfile->filebot->lineno)
|
||||
do_down(TRUE);
|
||||
} else if (func == do_page_up) {
|
||||
do_page_up();
|
||||
} else if (func == do_page_down) {
|
||||
do_page_down();
|
||||
} else if (func == to_first_line) {
|
||||
to_first_line();
|
||||
} else if (func == to_last_line) {
|
||||
to_last_line();
|
||||
} else if (func == do_search_forward) {
|
||||
do_search();
|
||||
do_scroll_down();
|
||||
} else if (func == do_page_up || func == do_page_down ||
|
||||
func == to_first_line || func == to_last_line ||
|
||||
func == do_findprevious || func == do_findnext) {
|
||||
func();
|
||||
} else if (func == do_search_forward || func == do_search_backward) {
|
||||
func();
|
||||
bottombars(MHELP);
|
||||
} else if (func == do_research) {
|
||||
do_research();
|
||||
#ifdef ENABLE_NANORC
|
||||
} else if (func == (functionptrtype)implant) {
|
||||
implant(first_sc_for(MHELP, func)->expansion);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
} else if (func == do_findprevious) {
|
||||
do_findprevious();
|
||||
} else if (func == do_findnext) {
|
||||
do_findnext();
|
||||
} else if (kbinput == KEY_WINCH) {
|
||||
; /* Nothing to do. */
|
||||
#endif
|
||||
@@ -235,7 +231,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) {
|
||||
@@ -249,6 +245,7 @@ void do_help(void)
|
||||
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
margin = was_margin;
|
||||
editwincols = COLS - margin;
|
||||
#endif
|
||||
tabsize = was_tabsize;
|
||||
#ifdef ENABLE_COLOR
|
||||
@@ -294,8 +291,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) {
|
||||
@@ -409,11 +406,21 @@ void help_init(void)
|
||||
htx[0] = N_("Execute Command Help Text\n\n "
|
||||
"This mode allows you to insert the output of a "
|
||||
"command run by the shell into the current buffer (or "
|
||||
"a new buffer in multiple file buffer mode). If you "
|
||||
"need another blank buffer, do not enter any "
|
||||
"command.\n\n The following function keys are "
|
||||
"into a new buffer). If the command is preceded by '|' "
|
||||
"(the pipe symbol), the current contents of the buffer "
|
||||
"(or marked region) will be piped to the command. ");
|
||||
htx[1] = N_("If you just need another blank buffer, do not enter any "
|
||||
"command.\n\n");
|
||||
htx[2] = N_(" The following function keys are "
|
||||
"available in Execute Command mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
} else if (currmenu == MLINTER) {
|
||||
htx[0] = N_("=== Linter ===\n\n "
|
||||
"In this mode, the status bar shows an error message or "
|
||||
"warning, and the cursor is put at the corresponding "
|
||||
"position in the file. With PageUp and PageDown you "
|
||||
"can switch to earlier and later messages.\n\n");
|
||||
htx[1] = N_(" The following function keys are "
|
||||
"available in Linter mode:\n\n");
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
@@ -471,7 +478,7 @@ void help_init(void)
|
||||
size_t endis_len = strlen(_("enable/disable"));
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->scfunc == do_toggle_void)
|
||||
if (s->func == do_toggle_void)
|
||||
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 8;
|
||||
}
|
||||
#endif
|
||||
@@ -493,28 +500,20 @@ void help_init(void)
|
||||
|
||||
/* Now add our shortcut info. */
|
||||
for (f = allfuncs; f != NULL; f = f->next) {
|
||||
int scsfound = 0;
|
||||
int tally = 0;
|
||||
|
||||
if ((f->menus & currmenu) == 0)
|
||||
continue;
|
||||
|
||||
/* Let's simply show the first two shortcuts from the list. */
|
||||
for (s = sclist; s != NULL; s = s->next) {
|
||||
|
||||
if ((s->menus & currmenu) == 0)
|
||||
continue;
|
||||
|
||||
if (s->scfunc == f->scfunc) {
|
||||
scsfound++;
|
||||
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". */
|
||||
if (scsfound == 1) {
|
||||
if (++tally == 1) {
|
||||
sprintf(ptr, "%s ", s->keystr);
|
||||
/* Unicode arrows take three bytes instead of one. */
|
||||
if (strstr(s->keystr, "\xE2") != NULL)
|
||||
ptr += 8;
|
||||
else
|
||||
ptr += 6;
|
||||
ptr += (strstr(s->keystr, "\xE2") != NULL ? 8 : 6);
|
||||
} else {
|
||||
ptr += sprintf(ptr, "(%s)\t", s->keystr);
|
||||
break;
|
||||
@@ -522,9 +521,9 @@ void help_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (scsfound == 0)
|
||||
if (tally == 0)
|
||||
ptr += sprintf(ptr, "\t\t");
|
||||
else if (scsfound == 1)
|
||||
else if (tally == 1)
|
||||
ptr += 10;
|
||||
|
||||
/* The shortcut's help text. */
|
||||
@@ -557,9 +556,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
|
||||
@@ -568,20 +564,19 @@ functionptrtype parse_help_input(int *kbinput)
|
||||
{
|
||||
if (!meta_key) {
|
||||
switch (*kbinput) {
|
||||
case ' ':
|
||||
return do_page_down;
|
||||
case BS_CODE:
|
||||
case '-':
|
||||
return do_page_up;
|
||||
case ' ':
|
||||
return do_page_down;
|
||||
case 'W':
|
||||
case 'w':
|
||||
case '/':
|
||||
return do_search_forward;
|
||||
case 'N':
|
||||
#ifndef NANO_TINY
|
||||
return do_findprevious;
|
||||
#endif
|
||||
case 'n':
|
||||
return do_research;
|
||||
return do_findnext;
|
||||
case 'E':
|
||||
case 'e':
|
||||
case 'Q':
|
||||
|
||||
@@ -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 *
|
||||
@@ -40,6 +40,8 @@ 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. */
|
||||
@@ -62,7 +64,7 @@ void history_init(void)
|
||||
}
|
||||
|
||||
/* 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,7 +112,7 @@ 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)
|
||||
@@ -123,7 +125,7 @@ void update_history(filestruct **item, const char *text)
|
||||
/* 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);
|
||||
@@ -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;
|
||||
@@ -227,7 +227,7 @@ char *get_history_completion(filestruct **h, char *s, size_t len)
|
||||
* match, or len is 0. Return s. */
|
||||
return (char *)s;
|
||||
}
|
||||
#endif /* ENSABLE_TABCOMP */
|
||||
#endif /* ENABLE_TABCOMP */
|
||||
|
||||
void history_error(const char *msg, ...)
|
||||
{
|
||||
@@ -315,7 +315,7 @@ void load_history(void)
|
||||
/* 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 +344,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);
|
||||
@@ -403,7 +403,7 @@ void load_poshistory(void)
|
||||
if (hisfile == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
/* When reading failed, don't save history when we quit. */
|
||||
UNSET(POS_HISTORY);
|
||||
UNSET(POSITIONLOG);
|
||||
history_error(N_("Error reading %s: %s"), poshistname, strerror(errno));
|
||||
}
|
||||
} else {
|
||||
@@ -593,7 +593,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 +601,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;
|
||||
|
||||
|
||||
238
src/move.c
238
src/move.c
@@ -1,8 +1,8 @@
|
||||
/**************************************************************************
|
||||
* move.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* 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 *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -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,7 +68,7 @@ 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);
|
||||
@@ -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;
|
||||
@@ -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,71 +170,61 @@ void do_page_down(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
/* Move to the beginning of the last beginning-of-paragraph line before the
|
||||
* current line. If update_screen is TRUE, update the screen afterwards. */
|
||||
void do_para_begin(bool update_screen)
|
||||
/* Move to the first beginning of a paragraph before the current line. */
|
||||
void do_para_begin(linestruct **line)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
if ((*line)->prev != NULL)
|
||||
*line = (*line)->prev;
|
||||
|
||||
if (openfile->current != openfile->fileage)
|
||||
openfile->current = openfile->current->prev;
|
||||
|
||||
while (!begpar(openfile->current))
|
||||
openfile->current = openfile->current->prev;
|
||||
|
||||
openfile->current_x = 0;
|
||||
|
||||
if (update_screen)
|
||||
edit_redraw(was_current, CENTERING);
|
||||
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. If update_screen is TRUE, update the
|
||||
* screen afterwards. 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(bool update_screen)
|
||||
/* Move down to the last line of the first found paragraph. */
|
||||
void do_para_end(linestruct **line)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
while ((*line)->next != NULL && !inpar(*line))
|
||||
*line = (*line)->next;
|
||||
|
||||
while (openfile->current != openfile->filebot &&
|
||||
!inpar(openfile->current))
|
||||
openfile->current = openfile->current->next;
|
||||
|
||||
while (openfile->current != openfile->filebot &&
|
||||
inpar(openfile->current->next) &&
|
||||
!begpar(openfile->current->next)) {
|
||||
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);
|
||||
|
||||
if (update_screen)
|
||||
edit_redraw(was_current, CENTERING);
|
||||
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)
|
||||
{
|
||||
do_para_begin(TRUE);
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
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)
|
||||
{
|
||||
do_para_end(TRUE);
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
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);
|
||||
}
|
||||
#endif /* ENABLE_JUSTIFY */
|
||||
|
||||
/* 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). */
|
||||
@@ -256,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;
|
||||
|
||||
@@ -272,10 +262,9 @@ void do_next_block(void)
|
||||
}
|
||||
|
||||
/* Move to the previous word. If allow_punct is TRUE, treat punctuation
|
||||
* as part of a word. When requested, update the screen afterwards. */
|
||||
void do_prev_word(bool allow_punct, bool update_screen)
|
||||
* as part of a word. */
|
||||
void do_prev_word(bool allow_punct)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
bool seen_a_word = FALSE, step_forward = FALSE;
|
||||
|
||||
/* Move backward until we pass over the start of a word. */
|
||||
@@ -309,20 +298,19 @@ void do_prev_word(bool allow_punct, bool update_screen)
|
||||
/* Move one character forward again to sit on the start of the word. */
|
||||
openfile->current_x = move_mbright(openfile->current->data,
|
||||
openfile->current_x);
|
||||
|
||||
if (update_screen)
|
||||
edit_redraw(was_current, FLOWING);
|
||||
}
|
||||
|
||||
/* Move to the next word. If allow_punct is TRUE, treat punctuation
|
||||
* as part of a word. When requested, update the screen afterwards.
|
||||
* Return TRUE if we started on a word, and FALSE otherwise. */
|
||||
bool do_next_word(bool allow_punct, bool update_screen)
|
||||
/* Move to the next word. If after_ends is TRUE, stop at the ends of words
|
||||
* instead of their beginnings. If allow_punct is TRUE, treat punctuation as
|
||||
* part of a word. Return TRUE if we started on a word, and FALSE otherwise. */
|
||||
bool do_next_word(bool after_ends, bool allow_punct)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
bool started_on_word = is_word_mbchar(openfile->current->data +
|
||||
openfile->current_x, allow_punct);
|
||||
bool seen_space = !started_on_word;
|
||||
#ifndef NANO_TINY
|
||||
bool seen_word = started_on_word;
|
||||
#endif
|
||||
|
||||
/* Move forward until we reach the start of a word. */
|
||||
while (TRUE) {
|
||||
@@ -340,19 +328,28 @@ bool do_next_word(bool allow_punct, bool update_screen)
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
/* If this is not a word character, then it's a separator; else
|
||||
* if we've already seen a separator, then it's a word start. */
|
||||
if (!is_word_mbchar(openfile->current->data + openfile->current_x,
|
||||
#ifndef NANO_TINY
|
||||
if (after_ends) {
|
||||
/* If this is a word character, continue; else it's a separator,
|
||||
* and if we've already seen a word, then it's a word end. */
|
||||
if (is_word_mbchar(openfile->current->data + openfile->current_x,
|
||||
allow_punct))
|
||||
seen_space = TRUE;
|
||||
else if (seen_space)
|
||||
break;
|
||||
seen_word = TRUE;
|
||||
else if (seen_word)
|
||||
break;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* If this is not a word character, then it's a separator; else
|
||||
* if we've already seen a separator, then it's a word start. */
|
||||
if (!is_word_mbchar(openfile->current->data + openfile->current_x,
|
||||
allow_punct))
|
||||
seen_space = TRUE;
|
||||
else if (seen_space)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (update_screen)
|
||||
edit_redraw(was_current, FLOWING);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
return started_on_word;
|
||||
}
|
||||
|
||||
@@ -360,14 +357,23 @@ bool do_next_word(bool allow_punct, bool update_screen)
|
||||
* word if the WORD_BOUNDS flag is set, and update the screen afterwards. */
|
||||
void do_prev_word_void(void)
|
||||
{
|
||||
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
do_prev_word(ISSET(WORD_BOUNDS));
|
||||
|
||||
edit_redraw(was_current, FLOWING);
|
||||
}
|
||||
|
||||
/* Move to the next word in the file, treating punctuation as part of a word
|
||||
* if the WORD_BOUNDS flag is set, and update the screen afterwards. */
|
||||
/* Move to the next word in the file. If the AFTER_ENDS flag is set, stop
|
||||
* at word ends instead of beginnings. If the WORD_BOUNDS flag is set, treat
|
||||
* punctuation as part of a word. Update the screen afterwards. */
|
||||
void do_next_word_void(void)
|
||||
{
|
||||
do_next_word(ISSET(WORD_BOUNDS), TRUE);
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
do_next_word(ISSET(AFTER_ENDS), ISSET(WORD_BOUNDS));
|
||||
|
||||
edit_redraw(was_current, FLOWING);
|
||||
}
|
||||
|
||||
/* Move to the beginning of the current line (or softwrapped chunk).
|
||||
@@ -375,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
|
||||
@@ -435,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;
|
||||
@@ -481,18 +487,12 @@ void do_end(void)
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
/* Move the cursor to the preceding line or chunk. If scroll_only is TRUE,
|
||||
* also scroll the screen one row, so the cursor stays in the same spot. */
|
||||
void do_up(bool scroll_only)
|
||||
/* 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;
|
||||
|
||||
/* When just scrolling and the top of the file is onscreen, get out. */
|
||||
if (scroll_only && openfile->edittop == openfile->fileage &&
|
||||
openfile->firstcolumn == 0)
|
||||
return;
|
||||
|
||||
get_edge_and_target(&leftedge, &target_column);
|
||||
|
||||
/* If we can't move up one line or chunk, we're at top of file. */
|
||||
@@ -501,20 +501,19 @@ void do_up(bool scroll_only)
|
||||
|
||||
set_proper_index_and_pww(&leftedge, target_column, FALSE);
|
||||
|
||||
if (scroll_only)
|
||||
edit_scroll(BACKWARD, 1);
|
||||
|
||||
edit_redraw(was_current, FLOWING);
|
||||
if (openfile->current_y == 0 && !ISSET(JUMPY_SCROLLING))
|
||||
edit_scroll(BACKWARD);
|
||||
else
|
||||
edit_redraw(was_current, FLOWING);
|
||||
|
||||
/* <Up> should not change placewewant, so restore it. */
|
||||
openfile->placewewant = leftedge + target_column;
|
||||
}
|
||||
|
||||
/* Move the cursor to next line or chunk. If scroll_only is TRUE, also
|
||||
* scroll the screen one row, so the cursor stays in the same spot. */
|
||||
void do_down(bool scroll_only)
|
||||
/* 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);
|
||||
@@ -525,50 +524,55 @@ void do_down(bool scroll_only)
|
||||
|
||||
set_proper_index_and_pww(&leftedge, target_column, TRUE);
|
||||
|
||||
if (scroll_only)
|
||||
edit_scroll(FORWARD, 1);
|
||||
|
||||
edit_redraw(was_current, FLOWING);
|
||||
if (openfile->current_y == editwinrows - 1 && !ISSET(JUMPY_SCROLLING))
|
||||
edit_scroll(FORWARD);
|
||||
else
|
||||
edit_redraw(was_current, FLOWING);
|
||||
|
||||
/* <Down> should not change placewewant, so restore it. */
|
||||
openfile->placewewant = leftedge + target_column;
|
||||
}
|
||||
|
||||
/* Move up one line or chunk. */
|
||||
void do_up_void(void)
|
||||
{
|
||||
do_up(FALSE);
|
||||
}
|
||||
|
||||
/* Move down one line or chunk. */
|
||||
void do_down_void(void)
|
||||
{
|
||||
do_down(FALSE);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
/* Scroll up one line or chunk without scrolling the cursor. */
|
||||
void do_scroll_up(void)
|
||||
{
|
||||
do_up(TRUE);
|
||||
/* When the top of the file is onscreen, we can't scroll. */
|
||||
if (openfile->edittop->prev == NULL && openfile->firstcolumn == 0)
|
||||
return;
|
||||
|
||||
if (openfile->current_y == editwinrows - 1)
|
||||
do_up();
|
||||
|
||||
if (editwinrows > 1)
|
||||
edit_scroll(BACKWARD);
|
||||
}
|
||||
|
||||
/* Scroll down one line or chunk without scrolling the cursor. */
|
||||
void do_scroll_down(void)
|
||||
{
|
||||
do_down(TRUE);
|
||||
if (openfile->current_y == 0)
|
||||
do_down();
|
||||
|
||||
if (openfile->edittop->next != NULL
|
||||
#ifndef NANO_TINY
|
||||
|| chunk_for(openfile->firstcolumn, openfile->edittop) <
|
||||
number_of_chunks_in(openfile->edittop)
|
||||
#endif
|
||||
)
|
||||
edit_scroll(FORWARD);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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);
|
||||
else if (openfile->current != openfile->fileage) {
|
||||
else if (openfile->current != openfile->filetop) {
|
||||
openfile->current = openfile->current->prev;
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
}
|
||||
@@ -579,7 +583,7 @@ 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,
|
||||
|
||||
1086
src/nano.c
1086
src/nano.c
File diff suppressed because it is too large
Load Diff
111
src/nano.h
111
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 *
|
||||
@@ -142,13 +142,18 @@
|
||||
#define REPLACING 1
|
||||
#define INREGION 2
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
#define USE_THE_DEFAULT -1
|
||||
#define BAD_COLOR -2
|
||||
#endif
|
||||
|
||||
/* Enumeration types. */
|
||||
typedef enum {
|
||||
NIX_FILE, DOS_FILE, MAC_FILE
|
||||
} file_format;
|
||||
|
||||
typedef enum {
|
||||
HUSH, MILD, ALERT
|
||||
HUSH, NOTICE, MILD, ALERT
|
||||
} message_type;
|
||||
|
||||
typedef enum {
|
||||
@@ -163,8 +168,9 @@ typedef enum {
|
||||
CENTERING, FLOWING, STATIONARY
|
||||
} update_type;
|
||||
|
||||
/* The kinds of undo actions. ADD...REPLACE must come first. */
|
||||
typedef enum {
|
||||
ADD, DEL, BACK, CUT, CUT_TO_EOF, REPLACE,
|
||||
ADD, ENTER, BACK, DEL, JOIN, REPLACE,
|
||||
#ifdef ENABLE_WRAPPING
|
||||
SPLIT_BEGIN, SPLIT_END,
|
||||
#endif
|
||||
@@ -172,7 +178,7 @@ typedef enum {
|
||||
#ifdef ENABLE_COMMENT
|
||||
COMMENT, UNCOMMENT, PREFLIGHT,
|
||||
#endif
|
||||
JOIN, PASTE, INSERT, ENTER, OTHER
|
||||
ZAP, CUT, CUT_TO_EOF, PASTE, INSERT, COUPLE_BEGIN, COUPLE_END, OTHER
|
||||
} undo_type;
|
||||
|
||||
/* Structure types. */
|
||||
@@ -182,8 +188,6 @@ typedef struct colortype {
|
||||
/* This syntax's foreground color. */
|
||||
short bg;
|
||||
/* This syntax's background color. */
|
||||
bool bright;
|
||||
/* Is this color A_BOLD? */
|
||||
int pairnum;
|
||||
/* The color pair number used for this foreground color and
|
||||
* background color. */
|
||||
@@ -223,8 +227,6 @@ 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 formatting command (for programming languages mainly). */
|
||||
#ifdef ENABLE_COMMENT
|
||||
char *comment;
|
||||
/* The line comment prefix (and postfix) for this type of file. */
|
||||
@@ -268,32 +270,32 @@ 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;
|
||||
} linestruct;
|
||||
|
||||
typedef struct partition {
|
||||
filestruct *fileage;
|
||||
linestruct *filetop;
|
||||
/* The top line of this portion of the file. */
|
||||
filestruct *top_prev;
|
||||
linestruct *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;
|
||||
linestruct *filebot;
|
||||
/* The bottom line of this portion of the file. */
|
||||
filestruct *bot_next;
|
||||
linestruct *bot_next;
|
||||
/* The line after the bottom line of this portion of the
|
||||
* file. */
|
||||
char *bot_data;
|
||||
@@ -330,9 +332,9 @@ typedef struct undo {
|
||||
/* Undo info specific to groups of lines. */
|
||||
|
||||
/* Cut-specific stuff we need. */
|
||||
filestruct *cutbuffer;
|
||||
linestruct *cutbuffer;
|
||||
/* Copy of the cutbuffer. */
|
||||
filestruct *cutbottom;
|
||||
linestruct *cutbottom;
|
||||
/* Copy of cutbottom. */
|
||||
ssize_t mark_begin_lineno;
|
||||
/* Mostly the line number of the current line; sometimes something else. */
|
||||
@@ -358,13 +360,13 @@ typedef struct poshiststruct {
|
||||
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. */
|
||||
@@ -382,7 +384,7 @@ typedef struct openfilestruct {
|
||||
struct stat *current_stat;
|
||||
/* The file's current stat information. */
|
||||
#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. */
|
||||
@@ -407,10 +409,12 @@ typedef struct openfilestruct {
|
||||
colortype *colorstrings;
|
||||
/* The file's associated colors. */
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
struct openfilestruct *next;
|
||||
/* The next open file, if any. */
|
||||
struct openfilestruct *prev;
|
||||
/* The preceding open file, if any. */
|
||||
#endif
|
||||
} openfilestruct;
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
@@ -422,17 +426,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. */
|
||||
void (*scfunc)(void);
|
||||
/* The function we're going to run. */
|
||||
/* The menus in which this keystroke is bound. */
|
||||
void (*func)(void);
|
||||
/* The function to which this keystroke is bound. */
|
||||
#ifndef NANO_TINY
|
||||
int toggle;
|
||||
/* If a toggle, what we're toggling. */
|
||||
@@ -440,12 +444,16 @@ typedef struct sc {
|
||||
/* The how-manieth toggle this is, in order to be able to
|
||||
* keep them in sequence. */
|
||||
#endif
|
||||
struct sc *next;
|
||||
#ifdef ENABLE_NANORC
|
||||
char *expansion;
|
||||
/* The string of keycodes to which this shortcut is expanded. */
|
||||
#endif
|
||||
struct keystruct *next;
|
||||
/* Next in the list. */
|
||||
} sc;
|
||||
} keystruct;
|
||||
|
||||
typedef struct subnfunc {
|
||||
void (*scfunc)(void);
|
||||
typedef struct funcstruct {
|
||||
void (*func)(void);
|
||||
/* The actual function to call. */
|
||||
int menus;
|
||||
/* In what menus this function applies. */
|
||||
@@ -462,9 +470,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 {
|
||||
@@ -478,8 +486,10 @@ enum
|
||||
{
|
||||
TITLE_BAR = 0,
|
||||
LINE_NUMBER,
|
||||
GUIDE_STRIPE,
|
||||
SELECTED_TEXT,
|
||||
STATUS_BAR,
|
||||
ERROR_MESSAGE,
|
||||
KEY_COMBO,
|
||||
FUNCTION_TAG,
|
||||
NUMBER_OF_ELEMENTS
|
||||
@@ -504,7 +514,7 @@ enum
|
||||
MULTIBUFFER,
|
||||
SMOOTH_SCROLL,
|
||||
REBIND_DELETE,
|
||||
REBIND_KEYPAD,
|
||||
RAW_SEQUENCES,
|
||||
NO_CONVERT,
|
||||
BACKUP_FILE,
|
||||
INSECURE_BACKUP,
|
||||
@@ -520,9 +530,8 @@ enum
|
||||
WORD_BOUNDS,
|
||||
NO_NEWLINES,
|
||||
BOLD_TEXT,
|
||||
QUIET,
|
||||
SOFTWRAP,
|
||||
POS_HISTORY,
|
||||
POSITIONLOG,
|
||||
LOCKING,
|
||||
NOREAD_MODE,
|
||||
MAKE_IT_UNIX,
|
||||
@@ -530,7 +539,12 @@ enum
|
||||
SHOW_CURSOR,
|
||||
LINE_NUMBERS,
|
||||
NO_PAUSES,
|
||||
AT_BLANKS
|
||||
AT_BLANKS,
|
||||
AFTER_ENDS,
|
||||
LET_THEM_ZAP,
|
||||
BREAK_LONG_LINES,
|
||||
JUMPY_SCROLLING,
|
||||
EMPTY_LINE
|
||||
};
|
||||
|
||||
/* Flags for the menus in which a given function should be present. */
|
||||
@@ -550,16 +564,17 @@ enum
|
||||
#define MYESNO (1<<13)
|
||||
#define MLINTER (1<<14)
|
||||
#define MFINDINHELP (1<<15)
|
||||
/* This is an abbreviation for all menus except Help and YesNo. */
|
||||
/* This is an abbreviation for all menus except Help and Browser and YesNo. */
|
||||
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
|
||||
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
|
||||
MEXTCMD|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
|
||||
#ifndef NANO_TINY
|
||||
#define MSOME MMOST
|
||||
#define MSOME MMOST|MBROWSER
|
||||
#else
|
||||
#define MSOME MMAIN|MBROWSER
|
||||
#endif
|
||||
|
||||
/* Basic control codes. */
|
||||
#define BS_CODE 0x08
|
||||
#define TAB_CODE 0x09
|
||||
#define ESC_CODE 0x1B
|
||||
#define DEL_CODE 0x7F
|
||||
@@ -571,24 +586,32 @@ enum
|
||||
#define CONTROL_DOWN 0x404
|
||||
#define CONTROL_HOME 0x405
|
||||
#define CONTROL_END 0x406
|
||||
#define CONTROL_DELETE 0x40D
|
||||
#define SHIFT_CONTROL_LEFT 0x411
|
||||
#define SHIFT_CONTROL_RIGHT 0x412
|
||||
#define SHIFT_CONTROL_UP 0x413
|
||||
#define SHIFT_CONTROL_DOWN 0x414
|
||||
#define SHIFT_CONTROL_HOME 0x415
|
||||
#define SHIFT_CONTROL_END 0x416
|
||||
#define CONTROL_SHIFT_DELETE 0x41D
|
||||
#define ALT_LEFT 0x421
|
||||
#define ALT_RIGHT 0x422
|
||||
#define ALT_UP 0x423
|
||||
#define ALT_DOWN 0x424
|
||||
#define ALT_DELETE 0x42D
|
||||
#define SHIFT_ALT_LEFT 0x431
|
||||
#define SHIFT_ALT_RIGHT 0x432
|
||||
#define SHIFT_ALT_UP 0x433
|
||||
#define SHIFT_ALT_DOWN 0x434
|
||||
//#define SHIFT_LEFT 0x451
|
||||
//#define SHIFT_RIGHT 0x452
|
||||
#define SHIFT_UP 0x453
|
||||
#define SHIFT_DOWN 0x454
|
||||
#define SHIFT_HOME 0x455
|
||||
#define SHIFT_END 0x456
|
||||
#define SHIFT_PAGEUP 0x457
|
||||
#define SHIFT_PAGEDOWN 0x458
|
||||
#define SHIFT_DELETE 0x45D
|
||||
#define SHIFT_TAB 0x45F
|
||||
|
||||
#ifdef USE_SLANG
|
||||
@@ -608,7 +631,6 @@ enum
|
||||
#define WAS_FINAL_BACKSPACE (1<<1)
|
||||
#define WAS_WHOLE_LINE (1<<2)
|
||||
#define WAS_FINAL_LINE (1<<3)
|
||||
/* The flags for the mark need to be the highest. */
|
||||
#define MARK_WAS_SET (1<<4)
|
||||
#define WAS_MARKED_FORWARD (1<<5)
|
||||
#endif /* !NANO_TINY */
|
||||
@@ -616,9 +638,8 @@ enum
|
||||
/* The maximum number of entries displayed in the main shortcut list. */
|
||||
#define MAIN_VISIBLE (((COLS + 40) / 20) * 2)
|
||||
|
||||
/* The default number of characters from the end of the line where
|
||||
* wrapping occurs. */
|
||||
#define CHARS_FROM_EOL 8
|
||||
/* The default number of columns from end of line where wrapping occurs. */
|
||||
#define COLUMNS_FROM_EOL 8
|
||||
|
||||
/* The default width of a tab in spaces. */
|
||||
#define WIDTH_OF_TAB 8
|
||||
|
||||
414
src/prompt.c
414
src/prompt.c
@@ -1,8 +1,8 @@
|
||||
/**************************************************************************
|
||||
* prompt.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* 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 *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
static char *prompt = NULL;
|
||||
/* The prompt string used for statusbar questions. */
|
||||
static size_t statusbar_x = HIGHEST_POSITIVE;
|
||||
static size_t typing_x = HIGHEST_POSITIVE;
|
||||
/* The cursor position in answer. */
|
||||
|
||||
#ifdef ENABLE_MOUSE
|
||||
@@ -40,12 +40,10 @@ int do_statusbar_mouse(void)
|
||||
size_t start_col = strlenpt(prompt) + 2;
|
||||
|
||||
/* Move to where the click occurred. */
|
||||
if (click_row == 0 && click_col >= start_col) {
|
||||
statusbar_x = actual_x(answer,
|
||||
if (click_row == 0 && click_col >= start_col)
|
||||
typing_x = actual_x(answer,
|
||||
get_statusbar_page_start(start_col, start_col +
|
||||
statusbar_xplustabs()) + click_col - start_col);
|
||||
update_the_statusbar();
|
||||
}
|
||||
strnlenpt(answer, typing_x)) + click_col - start_col);
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -53,10 +51,9 @@ int do_statusbar_mouse(void)
|
||||
#endif
|
||||
|
||||
/* Read in a keystroke, interpret it if it is a shortcut or toggle, and
|
||||
* return it. Set ran_func to TRUE if we ran a function associated with
|
||||
* a shortcut key, and set finished to TRUE if we're done after running
|
||||
* return it. Set finished to TRUE if we're done after running
|
||||
* or trying to run a function associated with a shortcut key. */
|
||||
int do_statusbar_input(bool *ran_func, bool *finished)
|
||||
int do_statusbar_input(bool *finished)
|
||||
{
|
||||
int input;
|
||||
/* The character we read in. */
|
||||
@@ -64,11 +61,8 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
||||
/* The input buffer. */
|
||||
static size_t kbinput_len = 0;
|
||||
/* The length of the input buffer. */
|
||||
const sc *s;
|
||||
bool have_shortcut = FALSE;
|
||||
const subnfunc *f;
|
||||
const keystruct *shortcut;
|
||||
|
||||
*ran_func = FALSE;
|
||||
*finished = FALSE;
|
||||
|
||||
/* Read in a character. */
|
||||
@@ -91,15 +85,11 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
||||
#endif
|
||||
|
||||
/* Check for a shortcut in the current list. */
|
||||
s = get_shortcut(&input);
|
||||
|
||||
/* If we got a shortcut from the current list, or a "universal"
|
||||
* statusbar prompt shortcut, set have_shortcut to TRUE. */
|
||||
have_shortcut = (s != NULL);
|
||||
shortcut = get_shortcut(&input);
|
||||
|
||||
/* If we got a non-high-bit control key, a meta key sequence, or a
|
||||
* function key, and it's not a shortcut or toggle, throw it out. */
|
||||
if (!have_shortcut) {
|
||||
if (shortcut == NULL) {
|
||||
if (is_ascii_cntrl_char(input) || meta_key || !is_byte(input)) {
|
||||
beep();
|
||||
input = ERR;
|
||||
@@ -108,7 +98,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
||||
|
||||
/* If the keystroke isn't a shortcut nor a toggle, it's a normal text
|
||||
* character: add the it to the input buffer, when allowed. */
|
||||
if (input != ERR && !have_shortcut) {
|
||||
if (input != ERR && shortcut == NULL) {
|
||||
/* Only accept input when not in restricted mode, or when not at
|
||||
* the "Write File" prompt, or when there is no filename yet. */
|
||||
if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
|
||||
@@ -122,7 +112,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
||||
/* If we got a shortcut, or if there aren't any other keystrokes waiting
|
||||
* after the one we read in, we need to insert all the characters in the
|
||||
* input buffer (if not empty) into the answer. */
|
||||
if ((have_shortcut || get_key_buffer_len() == 0) && kbinput != NULL) {
|
||||
if ((shortcut || get_key_buffer_len() == 0) && kbinput != NULL) {
|
||||
/* Inject all characters in the input buffer at once, filtering out
|
||||
* control characters. */
|
||||
do_statusbar_output(kbinput, kbinput_len, TRUE);
|
||||
@@ -133,55 +123,59 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
||||
kbinput = NULL;
|
||||
}
|
||||
|
||||
if (have_shortcut) {
|
||||
if (s->scfunc == do_tab || s->scfunc == do_enter)
|
||||
if (shortcut) {
|
||||
if (shortcut->func == do_tab || shortcut->func == do_enter)
|
||||
;
|
||||
else if (s->scfunc == do_left)
|
||||
#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 (s->scfunc == do_right)
|
||||
else if (shortcut->func == do_right)
|
||||
do_statusbar_right();
|
||||
#ifndef NANO_TINY
|
||||
else if (s->scfunc == do_prev_word_void)
|
||||
else if (shortcut->func == do_prev_word_void)
|
||||
do_statusbar_prev_word();
|
||||
else if (s->scfunc == do_next_word_void)
|
||||
else if (shortcut->func == do_next_word_void)
|
||||
do_statusbar_next_word();
|
||||
#endif
|
||||
else if (s->scfunc == do_home)
|
||||
else if (shortcut->func == do_home)
|
||||
do_statusbar_home();
|
||||
else if (s->scfunc == do_end)
|
||||
else if (shortcut->func == do_end)
|
||||
do_statusbar_end();
|
||||
/* When in restricted mode at the "Write File" prompt and the
|
||||
* filename isn't blank, disallow any input and deletion. */
|
||||
else if (ISSET(RESTRICTED) && currmenu == MWRITEFILE &&
|
||||
openfile->filename[0] != '\0' &&
|
||||
(s->scfunc == do_verbatim_input ||
|
||||
s->scfunc == do_cut_text_void ||
|
||||
s->scfunc == do_delete ||
|
||||
s->scfunc == do_backspace))
|
||||
(shortcut->func == do_verbatim_input ||
|
||||
shortcut->func == do_cut_text_void ||
|
||||
shortcut->func == do_uncut_text ||
|
||||
shortcut->func == do_delete ||
|
||||
shortcut->func == do_backspace))
|
||||
;
|
||||
else if (s->scfunc == do_verbatim_input)
|
||||
#ifdef ENABLE_NANORC
|
||||
else if (shortcut->func == (functionptrtype)implant)
|
||||
implant(shortcut->expansion);
|
||||
#endif
|
||||
else if (shortcut->func == do_verbatim_input)
|
||||
do_statusbar_verbatim_input();
|
||||
else if (s->scfunc == do_cut_text_void)
|
||||
else if (shortcut->func == do_cut_text_void)
|
||||
do_statusbar_cut_text();
|
||||
else if (s->scfunc == do_delete)
|
||||
else if (shortcut->func == do_delete)
|
||||
do_statusbar_delete();
|
||||
else if (s->scfunc == do_backspace)
|
||||
else if (shortcut->func == do_backspace)
|
||||
do_statusbar_backspace();
|
||||
else if (s->scfunc == do_uncut_text) {
|
||||
else if (shortcut->func == do_uncut_text) {
|
||||
if (cutbuffer != NULL)
|
||||
do_statusbar_uncut_text();
|
||||
} else {
|
||||
/* Handle any other shortcut in the current menu, setting
|
||||
* ran_func to TRUE if we try to run their associated functions,
|
||||
* and setting finished to TRUE to indicatethat we're done after
|
||||
* running or trying to run their associated functions. */
|
||||
f = sctofunc(s);
|
||||
if (s->scfunc != NULL) {
|
||||
*ran_func = TRUE;
|
||||
if (f && (!ISSET(VIEW_MODE) || f->viewok) &&
|
||||
f->scfunc != do_gotolinecolumn_void)
|
||||
f->scfunc();
|
||||
}
|
||||
/* Handle any other shortcut in the current menu, setting finished
|
||||
* to TRUE to indicate that we're done after running or trying to
|
||||
* run its associated function. */
|
||||
if (!ISSET(VIEW_MODE) || okay_for_view(shortcut))
|
||||
shortcut->func();
|
||||
*finished = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -196,127 +190,122 @@ void do_statusbar_output(int *the_input, size_t input_len,
|
||||
{
|
||||
char *output = charalloc(input_len + 1);
|
||||
char onechar[MAXCHARLEN];
|
||||
int i, char_len;
|
||||
size_t char_len, i, j = 0;
|
||||
|
||||
/* Copy the typed stuff so it can be treated. */
|
||||
for (i = 0; i < input_len; i++)
|
||||
output[i] = (char)the_input[i];
|
||||
output[i] = '\0';
|
||||
|
||||
i = 0;
|
||||
|
||||
while (i < input_len) {
|
||||
while (j < input_len) {
|
||||
/* Encode any NUL byte as 0x0A. */
|
||||
if (output[i] == '\0')
|
||||
output[i] = '\n';
|
||||
if (output[j] == '\0')
|
||||
output[j] = '\n';
|
||||
|
||||
/* Interpret the next multibyte character. */
|
||||
char_len = parse_mbchar(output + i, onechar, NULL);
|
||||
char_len = parse_mbchar(output + j, onechar, NULL);
|
||||
|
||||
i += char_len;
|
||||
j += char_len;
|
||||
|
||||
/* When filtering, skip any ASCII control character. */
|
||||
if (filtering && is_ascii_cntrl_char(*(output + i - char_len)))
|
||||
if (filtering && is_ascii_cntrl_char(*(output + j - char_len)))
|
||||
continue;
|
||||
|
||||
/* Insert the typed character into the existing answer string. */
|
||||
answer = charealloc(answer, strlen(answer) + char_len + 1);
|
||||
charmove(answer + statusbar_x + char_len, answer + statusbar_x,
|
||||
strlen(answer) - statusbar_x + 1);
|
||||
strncpy(answer + statusbar_x, onechar, char_len);
|
||||
charmove(answer + typing_x + char_len, answer + typing_x,
|
||||
strlen(answer) - typing_x + 1);
|
||||
strncpy(answer + typing_x, onechar, char_len);
|
||||
|
||||
statusbar_x += char_len;
|
||||
typing_x += char_len;
|
||||
}
|
||||
|
||||
free(output);
|
||||
|
||||
update_the_statusbar();
|
||||
}
|
||||
|
||||
/* Move to the beginning of the answer. */
|
||||
void do_statusbar_home(void)
|
||||
{
|
||||
statusbar_x = 0;
|
||||
update_the_statusbar();
|
||||
typing_x = 0;
|
||||
}
|
||||
|
||||
/* Move to the end of the answer. */
|
||||
void do_statusbar_end(void)
|
||||
{
|
||||
statusbar_x = strlen(answer);
|
||||
update_the_statusbar();
|
||||
typing_x = strlen(answer);
|
||||
}
|
||||
|
||||
/* Move left one character. */
|
||||
void do_statusbar_left(void)
|
||||
{
|
||||
if (statusbar_x > 0) {
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
update_the_statusbar();
|
||||
}
|
||||
if (typing_x > 0)
|
||||
typing_x = move_mbleft(answer, typing_x);
|
||||
}
|
||||
|
||||
/* Move right one character. */
|
||||
void do_statusbar_right(void)
|
||||
{
|
||||
if (answer[statusbar_x] != '\0') {
|
||||
statusbar_x = move_mbright(answer, statusbar_x);
|
||||
update_the_statusbar();
|
||||
if (answer[typing_x] != '\0')
|
||||
typing_x = move_mbright(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);
|
||||
|
||||
charmove(answer + typing_x, answer + typing_x + char_len,
|
||||
strlen(answer) - typing_x - char_len + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Backspace over one character. */
|
||||
void do_statusbar_backspace(void)
|
||||
{
|
||||
if (statusbar_x > 0) {
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
if (typing_x > 0) {
|
||||
typing_x = move_mbleft(answer, typing_x);
|
||||
do_statusbar_delete();
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete one character. */
|
||||
void do_statusbar_delete(void)
|
||||
{
|
||||
if (answer[statusbar_x] != '\0') {
|
||||
int char_len = parse_mbchar(answer + statusbar_x, NULL, NULL);
|
||||
|
||||
charmove(answer + statusbar_x, answer + statusbar_x + char_len,
|
||||
strlen(answer) - statusbar_x - char_len + 1);
|
||||
|
||||
update_the_statusbar();
|
||||
}
|
||||
}
|
||||
|
||||
/* Zap some or all text from the answer. */
|
||||
void do_statusbar_cut_text(void)
|
||||
{
|
||||
if (!ISSET(CUT_FROM_CURSOR))
|
||||
statusbar_x = 0;
|
||||
typing_x = 0;
|
||||
|
||||
answer[statusbar_x] = '\0';
|
||||
|
||||
update_the_statusbar();
|
||||
answer[typing_x] = '\0';
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Move to the next word in the answer. */
|
||||
void do_statusbar_next_word(void)
|
||||
{
|
||||
bool seen_space = !is_word_mbchar(answer + statusbar_x, FALSE);
|
||||
bool seen_space = !is_word_mbchar(answer + typing_x, FALSE);
|
||||
bool seen_word = !seen_space;
|
||||
|
||||
/* Move forward until we reach the start of a word. */
|
||||
while (answer[statusbar_x] != '\0') {
|
||||
statusbar_x = move_mbright(answer, statusbar_x);
|
||||
/* 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);
|
||||
|
||||
/* If this is not a word character, then it's a separator; else
|
||||
* if we've already seen a separator, then it's a word start. */
|
||||
if (!is_word_mbchar(answer + statusbar_x, FALSE))
|
||||
seen_space = TRUE;
|
||||
else if (seen_space)
|
||||
break;
|
||||
if (ISSET(AFTER_ENDS)) {
|
||||
/* If this is a word character, continue; else it's a separator,
|
||||
* and if we've already seen a word, then it's a word end. */
|
||||
if (is_word_mbchar(answer + typing_x, FALSE))
|
||||
seen_word = TRUE;
|
||||
else if (seen_word)
|
||||
break;
|
||||
} else {
|
||||
/* If this is not a word character, then it's a separator; else
|
||||
* if we've already seen a separator, then it's a word start. */
|
||||
if (!is_word_mbchar(answer + typing_x, FALSE))
|
||||
seen_space = TRUE;
|
||||
else if (seen_space)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
update_the_statusbar();
|
||||
}
|
||||
|
||||
/* Move to the previous word in the answer. */
|
||||
@@ -325,10 +314,10 @@ void do_statusbar_prev_word(void)
|
||||
bool seen_a_word = FALSE, step_forward = FALSE;
|
||||
|
||||
/* Move backward until we pass over the start of a word. */
|
||||
while (statusbar_x != 0) {
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
while (typing_x != 0) {
|
||||
typing_x = move_mbleft(answer, typing_x);
|
||||
|
||||
if (is_word_mbchar(answer + statusbar_x, FALSE))
|
||||
if (is_word_mbchar(answer + typing_x, FALSE))
|
||||
seen_a_word = TRUE;
|
||||
else if (seen_a_word) {
|
||||
/* This is space now: we've overshot the start of the word. */
|
||||
@@ -339,9 +328,7 @@ void do_statusbar_prev_word(void)
|
||||
|
||||
if (step_forward)
|
||||
/* Move one character forward again to sit on the start of the word. */
|
||||
statusbar_x = move_mbright(answer, statusbar_x);
|
||||
|
||||
update_the_statusbar();
|
||||
typing_x = move_mbright(answer, typing_x);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -354,12 +341,8 @@ void do_statusbar_verbatim_input(void)
|
||||
kbinput = get_verbatim_kbinput(bottomwin, &kbinput_len);
|
||||
|
||||
do_statusbar_output(kbinput, kbinput_len, FALSE);
|
||||
}
|
||||
|
||||
/* Return the zero-based column position of the cursor in the answer. */
|
||||
size_t statusbar_xplustabs(void)
|
||||
{
|
||||
return strnlenpt(answer, statusbar_x);
|
||||
free(kbinput);
|
||||
}
|
||||
|
||||
/* Paste the first line of the cutbuffer into the current answer. */
|
||||
@@ -370,13 +353,13 @@ void do_statusbar_uncut_text(void)
|
||||
|
||||
/* Concatenate: the current answer before the cursor, the first line
|
||||
* of the cutbuffer, plus the rest of the current answer. */
|
||||
strncpy(fusion, answer, statusbar_x);
|
||||
strncpy(fusion + statusbar_x, cutbuffer->data, pastelen);
|
||||
strcpy(fusion + statusbar_x + pastelen, answer + statusbar_x);
|
||||
strncpy(fusion, answer, typing_x);
|
||||
strncpy(fusion + typing_x, cutbuffer->data, pastelen);
|
||||
strcpy(fusion + typing_x + pastelen, answer + typing_x);
|
||||
|
||||
free(answer);
|
||||
answer = fusion;
|
||||
statusbar_x += pastelen;
|
||||
typing_x += pastelen;
|
||||
}
|
||||
|
||||
/* Return the column number of the first character of the answer that is
|
||||
@@ -394,19 +377,19 @@ size_t get_statusbar_page_start(size_t base, size_t column)
|
||||
}
|
||||
|
||||
/* Reinitialize the cursor position in the answer. */
|
||||
void reinit_statusbar_x(void)
|
||||
void put_cursor_at_end_of_answer(void)
|
||||
{
|
||||
statusbar_x = HIGHEST_POSITIVE;
|
||||
typing_x = HIGHEST_POSITIVE;
|
||||
}
|
||||
|
||||
/* Redraw the promptbar and place the cursor at the right spot. */
|
||||
void update_the_statusbar(void)
|
||||
void draw_the_promptbar(void)
|
||||
{
|
||||
size_t base = strlenpt(prompt) + 2;
|
||||
size_t the_page, end_page, column;
|
||||
char *expanded;
|
||||
|
||||
the_page = get_statusbar_page_start(base, base + strnlenpt(answer, statusbar_x));
|
||||
the_page = get_statusbar_page_start(base, base + strnlenpt(answer, typing_x));
|
||||
end_page = get_statusbar_page_start(base, base + strlenpt(answer) - 1);
|
||||
|
||||
/* Color the promptbar over its full width. */
|
||||
@@ -417,11 +400,12 @@ void update_the_statusbar(void)
|
||||
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 + strlenpt(answer) != COLS && the_page < end_page)
|
||||
mvwaddch(bottomwin, 0, COLS - 1, '>');
|
||||
|
||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
|
||||
@@ -429,19 +413,36 @@ void update_the_statusbar(void)
|
||||
wmove(bottomwin, 0, 0);
|
||||
wrefresh(bottomwin);
|
||||
|
||||
/* Place the cursor at statusbar_x in the answer. */
|
||||
column = base + statusbar_xplustabs();
|
||||
/* Place the cursor at the right spot. */
|
||||
column = base + strnlenpt(answer, typing_x);
|
||||
wmove(bottomwin, 0, column - get_statusbar_page_start(base, column));
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Remove or add the pipe character at the answer's head. */
|
||||
void add_or_remove_pipe_symbol_from_answer(void)
|
||||
{
|
||||
if (answer[0] == '|') {
|
||||
charmove(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);
|
||||
answer[0] = '|';
|
||||
typing_x++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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;
|
||||
bool ran_func, finished;
|
||||
bool finished;
|
||||
functionptrtype func;
|
||||
#ifdef ENABLE_TABCOMP
|
||||
bool tabbed = FALSE;
|
||||
@@ -451,8 +452,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
char *history = NULL;
|
||||
/* The current history string. */
|
||||
char *magichistory = NULL;
|
||||
/* The temporary string typed at the bottom of the history, if
|
||||
* any. */
|
||||
/* The (partial) answer that was typed at the prompt, if any. */
|
||||
#ifdef ENABLE_TABCOMP
|
||||
int last_kbinput = ERR;
|
||||
/* The key we pressed before the current key. */
|
||||
@@ -462,13 +462,13 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
#endif
|
||||
#endif /* ENABLE_HISTORIES */
|
||||
|
||||
if (statusbar_x > strlen(answer))
|
||||
statusbar_x = strlen(answer);
|
||||
|
||||
update_the_statusbar();
|
||||
if (typing_x > strlen(answer))
|
||||
typing_x = strlen(answer);
|
||||
|
||||
while (TRUE) {
|
||||
kbinput = do_statusbar_input(&ran_func, &finished);
|
||||
draw_the_promptbar();
|
||||
|
||||
kbinput = do_statusbar_input(&finished);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If the window size changed, go reformat the prompt string. */
|
||||
@@ -500,12 +500,12 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
if (complete_len > 0) {
|
||||
answer = get_history_completion(history_list,
|
||||
answer, complete_len);
|
||||
statusbar_x = strlen(answer);
|
||||
typing_x = strlen(answer);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
if (allow_tabs)
|
||||
answer = input_tab(answer, allow_files, &statusbar_x,
|
||||
answer = input_tab(answer, allow_files, &typing_x,
|
||||
&tabbed, refresh_func, listed);
|
||||
} else
|
||||
#endif /* ENABLE_TABCOMP */
|
||||
@@ -521,14 +521,8 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
* answer. If there is no older search, don't do anything. */
|
||||
if ((history = get_history_older(history_list)) != NULL) {
|
||||
answer = mallocstrcpy(answer, history);
|
||||
statusbar_x = strlen(answer);
|
||||
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) {
|
||||
@@ -536,23 +530,16 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
* answer. If there is no newer search, don't do anything. */
|
||||
if ((history = get_history_newer(history_list)) != NULL) {
|
||||
answer = mallocstrcpy(answer, history);
|
||||
statusbar_x = strlen(answer);
|
||||
typing_x = strlen(answer);
|
||||
}
|
||||
|
||||
/* If, after scrolling down, we're at the bottom of the
|
||||
* history list, answer is blank, and magichistory is set,
|
||||
* save magichistory in answer. */
|
||||
/* If we've reached the bottom of the history list, and answer
|
||||
* is blank, and magichistory is set, restore the old answer. */
|
||||
if ((*history_list)->next == NULL &&
|
||||
*answer == '\0' && magichistory != NULL) {
|
||||
answer = mallocstrcpy(answer, magichistory);
|
||||
statusbar_x = strlen(answer);
|
||||
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 */
|
||||
@@ -570,8 +557,6 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
if (finished)
|
||||
break;
|
||||
|
||||
update_the_statusbar();
|
||||
|
||||
#if defined(ENABLE_HISTORIES) && defined(ENABLE_TABCOMP)
|
||||
last_kbinput = kbinput;
|
||||
#endif
|
||||
@@ -590,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 curranswer 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 *curranswer, linestruct **history_list,
|
||||
void (*refresh_func)(void), const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -610,12 +592,13 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
functionptrtype func = NULL;
|
||||
bool listed = FALSE;
|
||||
/* Save a possible current statusbar x position and prompt. */
|
||||
size_t was_statusbar_x = statusbar_x;
|
||||
size_t was_typing_x = typing_x;
|
||||
char *saved_prompt = prompt;
|
||||
|
||||
bottombars(menu);
|
||||
|
||||
answer = mallocstrcpy(answer, curranswer);
|
||||
if (answer != curranswer || answer == NULL)
|
||||
answer = mallocstrcpy(answer, curranswer);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
redo_theprompt:
|
||||
@@ -640,7 +623,7 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
/* If we're done with this prompt, restore the x position to what
|
||||
* it was at a possible previous prompt. */
|
||||
if (func == do_cancel || func == do_enter)
|
||||
statusbar_x = was_statusbar_x;
|
||||
typing_x = was_typing_x;
|
||||
|
||||
/* If we left the prompt via Cancel or Enter, set the return value
|
||||
* properly. */
|
||||
@@ -666,25 +649,26 @@ 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;
|
||||
|
||||
/* TRANSLATORS: For the next three strings, if possible, specify
|
||||
* the single-byte letters for both your language and English.
|
||||
* For example, in French: "OoYy", for both "Oui" and "Yes". */
|
||||
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. */
|
||||
const char *yesstr = _("Yy");
|
||||
const char *nostr = _("Nn");
|
||||
const char *allstr = _("Aa");
|
||||
|
||||
/* The above three variables consist of all the single-byte characters
|
||||
* that are accepted for the corresponding answer. Of each variable,
|
||||
* the first character is displayed in the help lines. */
|
||||
|
||||
while (response == -2) {
|
||||
while (choice == -2) {
|
||||
#ifdef ENABLE_NLS
|
||||
char letter[MAXCHARLEN + 1];
|
||||
int index = 0;
|
||||
#endif
|
||||
int kbinput;
|
||||
|
||||
if (!ISSET(NO_HELP)) {
|
||||
char shortstr[MAXCHARLEN + 2];
|
||||
/* Temporary string for (translated) " Y", " N" and " A". */
|
||||
const keystruct *cancelshortcut = first_sc_for(MYESNO, do_cancel);
|
||||
/* The keystroke that is bound to the Cancel function. */
|
||||
|
||||
if (COLS < 32)
|
||||
width = COLS / 2;
|
||||
@@ -697,18 +681,18 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
wmove(bottomwin, 1, 0);
|
||||
post_one_key(shortstr, _("Yes"), width);
|
||||
|
||||
shortstr[1] = nostr[0];
|
||||
wmove(bottomwin, 2, 0);
|
||||
post_one_key(shortstr, _("No"), width);
|
||||
|
||||
if (all) {
|
||||
shortstr[1] = allstr[0];
|
||||
wmove(bottomwin, 1, width);
|
||||
post_one_key(shortstr, _("All"), width);
|
||||
}
|
||||
|
||||
shortstr[1] = nostr[0];
|
||||
wmove(bottomwin, 2, 0);
|
||||
post_one_key(shortstr, _("No"), width);
|
||||
|
||||
wmove(bottomwin, 2, width);
|
||||
post_one_key("^C", _("Cancel"), width);
|
||||
post_one_key(cancelshortcut->keystr, _("Cancel"), width);
|
||||
}
|
||||
|
||||
/* Color the statusbar over its full width and display the question. */
|
||||
@@ -723,34 +707,56 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
/* When not replacing, show the cursor while waiting for a key. */
|
||||
kbinput = get_kbinput(bottomwin, !all);
|
||||
|
||||
/* See if the pressed key is in the Yes, No, or All strings. */
|
||||
if (strchr(yesstr, kbinput) != NULL)
|
||||
response = 1;
|
||||
else if (strchr(nostr, kbinput) != NULL)
|
||||
response = 0;
|
||||
else if (all && strchr(allstr, kbinput) != NULL)
|
||||
response = 2;
|
||||
#ifdef ENABLE_NLS
|
||||
letter[index++] = (unsigned char)kbinput;
|
||||
#ifdef ENABLE_UTF8
|
||||
/* If the received code is a UTF-8 starter byte, get also the
|
||||
* continuation bytes and assemble them into one letter. */
|
||||
if (using_utf8() && 0xC0 <= kbinput && kbinput <= 0xF7) {
|
||||
int extras = (kbinput / 16) % 4 + (kbinput <= 0xCF ? 1 : 0);
|
||||
|
||||
while (extras <= get_key_buffer_len() && extras-- > 0)
|
||||
letter[index++] = (unsigned char)get_kbinput(bottomwin, !all);
|
||||
}
|
||||
#endif
|
||||
letter[index] = '\0';
|
||||
|
||||
/* See if the typed letter is in the Yes, No, or All strings. */
|
||||
if (strstr(yesstr, letter) != NULL)
|
||||
choice = 1;
|
||||
else if (strstr(nostr, letter) != NULL)
|
||||
choice = 0;
|
||||
else if (all && strstr(allstr, letter) != NULL)
|
||||
choice = 2;
|
||||
else
|
||||
#endif /* ENABLE_NLS */
|
||||
if (strchr("Yy", kbinput) != NULL)
|
||||
choice = 1;
|
||||
else if (strchr("Nn", kbinput) != NULL)
|
||||
choice = 0;
|
||||
else if (all && strchr("Aa", kbinput) != NULL)
|
||||
choice = 2;
|
||||
else if (func_from_key(&kbinput) == do_cancel)
|
||||
response = -1;
|
||||
choice = -1;
|
||||
#ifdef ENABLE_MOUSE
|
||||
else if (kbinput == KEY_MOUSE) {
|
||||
int mouse_x, mouse_y;
|
||||
/* We can click on the Yes/No/All shortcuts to select an answer. */
|
||||
if (get_mouseinput(&mouse_x, &mouse_y, FALSE) == 0 &&
|
||||
if (get_mouseinput(&mouse_y, &mouse_x, FALSE) == 0 &&
|
||||
wmouse_trafo(bottomwin, &mouse_y, &mouse_x, FALSE) &&
|
||||
mouse_x < (width * 2) && mouse_y > 0) {
|
||||
int x = mouse_x / width;
|
||||
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;
|
||||
}
|
||||
|
||||
311
src/proto.h
311
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 *
|
||||
@@ -30,7 +30,7 @@ extern volatile sig_atomic_t the_window_resized;
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
extern bool console;
|
||||
extern bool on_a_vt;
|
||||
#endif
|
||||
|
||||
extern bool meta_key;
|
||||
@@ -40,14 +40,11 @@ extern bool focusing;
|
||||
|
||||
extern bool as_an_at;
|
||||
|
||||
extern int margin;
|
||||
extern int editwincols;
|
||||
|
||||
extern bool suppress_cursorpos;
|
||||
|
||||
extern message_type lastmessage;
|
||||
|
||||
extern filestruct *pletion_line;
|
||||
extern linestruct *pletion_line;
|
||||
|
||||
extern bool inhelp;
|
||||
extern char *title;
|
||||
@@ -58,32 +55,25 @@ extern bool also_the_last;
|
||||
|
||||
extern int didfind;
|
||||
|
||||
extern int controlleft;
|
||||
extern int controlright;
|
||||
extern int controlup;
|
||||
extern int controldown;
|
||||
extern int controlhome;
|
||||
extern int controlend;
|
||||
extern int controlleft, controlright;
|
||||
extern int controlup, controldown;
|
||||
extern int controlhome, controlend;
|
||||
#ifndef NANO_TINY
|
||||
extern int shiftcontrolleft;
|
||||
extern int shiftcontrolright;
|
||||
extern int shiftcontrolup;
|
||||
extern int shiftcontroldown;
|
||||
extern int shiftcontrolhome;
|
||||
extern int shiftcontrolend;
|
||||
extern int altleft;
|
||||
extern int altright;
|
||||
extern int altup;
|
||||
extern int altdown;
|
||||
extern int shiftaltleft;
|
||||
extern int shiftaltright;
|
||||
extern int shiftaltup;
|
||||
extern int shiftaltdown;
|
||||
extern int controldelete, controlshiftdelete;
|
||||
extern int shiftleft, shiftright;
|
||||
extern int shiftup, shiftdown;
|
||||
extern int shiftcontrolleft, shiftcontrolright;
|
||||
extern int shiftcontrolup, shiftcontroldown;
|
||||
extern int shiftcontrolhome, shiftcontrolend;
|
||||
extern int altleft, altright;
|
||||
extern int altup, altdown;
|
||||
extern int altdelete;
|
||||
extern int shiftaltleft, shiftaltright;
|
||||
extern int shiftaltup, shiftaltdown;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
extern ssize_t fill;
|
||||
extern ssize_t wrap_at;
|
||||
extern ssize_t fill, wrap_at;
|
||||
#endif
|
||||
|
||||
extern char *last_search;
|
||||
@@ -91,13 +81,21 @@ extern char *last_search;
|
||||
extern char *present_path;
|
||||
|
||||
extern unsigned flags[4];
|
||||
|
||||
extern WINDOW *topwin;
|
||||
extern WINDOW *edit;
|
||||
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;
|
||||
@@ -105,20 +103,16 @@ extern openfilestruct *firstfile;
|
||||
#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;
|
||||
@@ -149,22 +143,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;
|
||||
@@ -178,7 +170,13 @@ extern int interface_color_pair[NUMBER_OF_ELEMENTS];
|
||||
|
||||
extern char *homedir;
|
||||
extern char *statedir;
|
||||
#ifdef ENABLE_NANORC
|
||||
extern char *rcfile_with_errors;
|
||||
#endif
|
||||
|
||||
extern bool spotlighted;
|
||||
extern size_t light_from_col;
|
||||
extern size_t light_to_col;
|
||||
|
||||
typedef void (*functionptrtype)(void);
|
||||
|
||||
@@ -189,7 +187,7 @@ void read_the_list(const char *path, DIR *dir);
|
||||
functionptrtype parse_browser_input(int *kbinput);
|
||||
void browser_refresh(void);
|
||||
void browser_select_dirname(const char *needle);
|
||||
void do_filesearch(void);
|
||||
void do_filesearch(bool forwards);
|
||||
void do_fileresearch(bool forwards);
|
||||
void to_first_file(void);
|
||||
void to_last_file(void);
|
||||
@@ -221,7 +219,6 @@ 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);
|
||||
size_t mbstrnlen(const char *s, size_t maxlen);
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
|
||||
char *mbstrchr(const char *s, const char *c);
|
||||
#endif
|
||||
@@ -231,58 +228,58 @@ 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
|
||||
#ifdef ENABLE_UTF8
|
||||
bool is_valid_unicode(wchar_t wc);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
bool is_valid_mbstring(const char *s);
|
||||
#endif
|
||||
|
||||
/* Most functions in color.c. */
|
||||
#ifdef ENABLE_COLOR
|
||||
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 check_the_multis(linestruct *line);
|
||||
void alloc_multidata_if_needed(linestruct *fileptr);
|
||||
void precalc_multicolorinfo(void);
|
||||
#endif
|
||||
|
||||
/* Most functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
bool keeping_cutbuffer(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 cut_till_eof);
|
||||
void do_cut_text(bool copy_text, bool marked, bool cut_till_eof, bool append);
|
||||
bool is_cuttable(bool test_cliff);
|
||||
void do_cut_text_void(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_copy_text(void);
|
||||
void do_cut_till_eof(void);
|
||||
void zap_text(void);
|
||||
#endif
|
||||
void do_uncut_text(void);
|
||||
|
||||
/* Most functions in files.c. */
|
||||
void initialize_buffer_text(void);
|
||||
void set_modified(void);
|
||||
bool open_buffer(const char *filename, bool undoable);
|
||||
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, filestruct *top, size_t top_x,
|
||||
filestruct *bot, size_t bot_x);
|
||||
void replace_marked_buffer(const char *filename);
|
||||
#endif
|
||||
#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);
|
||||
#endif
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable,
|
||||
bool checkwritable);
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable);
|
||||
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
void do_insertfile_void(void);
|
||||
@@ -318,23 +315,19 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
|
||||
/* 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);
|
||||
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 assign_keyinfo(keystruct *s, const char *keystring, const int keycode);
|
||||
void print_sclist(void);
|
||||
void shortcut_init(void);
|
||||
#ifdef ENABLE_COLOR
|
||||
void set_lint_or_format_shortcuts(void);
|
||||
void set_spell_shortcuts(void);
|
||||
#endif
|
||||
const subnfunc *sctofunc(const sc *s);
|
||||
const funcstruct *sctofunc(const keystruct *s);
|
||||
const char *flagtostr(int flag);
|
||||
sc *strtosc(const char *input);
|
||||
int strtomenu(const char *input);
|
||||
#ifdef DEBUG
|
||||
void thanks_for_all_the_fish(void);
|
||||
#ifdef ENABLE_NANORC
|
||||
keystruct *strtosc(const char *input);
|
||||
int name_to_menu(const char *name);
|
||||
char *menu_to_name(int menu);
|
||||
#endif
|
||||
|
||||
/* All functions in help.c. */
|
||||
@@ -350,14 +343,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);
|
||||
@@ -373,24 +366,22 @@ void to_last_line(void);
|
||||
void do_page_up(void);
|
||||
void do_page_down(void);
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
void do_para_begin(bool update_screen);
|
||||
void do_para_end(bool update_screen);
|
||||
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
|
||||
void do_prev_block(void);
|
||||
void do_next_block(void);
|
||||
void do_prev_word(bool allow_punct, bool update_screen);
|
||||
bool do_next_word(bool allow_punct, bool update_screen);
|
||||
void do_prev_word(bool allow_punct);
|
||||
bool do_next_word(bool after_ends, bool allow_punct);
|
||||
void do_prev_word_void(void);
|
||||
void do_next_word_void(void);
|
||||
void do_home(void);
|
||||
void do_end(void);
|
||||
void do_up(bool scroll_only);
|
||||
void do_down(bool scroll_only);
|
||||
void do_up_void(void);
|
||||
void do_down_void(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_up(void);
|
||||
void do_down(void);
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
void do_scroll_up(void);
|
||||
void do_scroll_down(void);
|
||||
#endif
|
||||
@@ -398,23 +389,24 @@ 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 *fileptr);
|
||||
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);
|
||||
openfilestruct *make_new_opennode(void);
|
||||
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(linestruct *line);
|
||||
partition *partition_buffer(linestruct *top, size_t top_x,
|
||||
linestruct *bot, size_t bot_x);
|
||||
void unpartition_buffer(partition **p);
|
||||
void extract_buffer(linestruct **file_top, linestruct **file_bot,
|
||||
linestruct *top, size_t top_x, linestruct *bot, size_t bot_x);
|
||||
void ingraft_buffer(linestruct *somebuffer);
|
||||
void copy_from_buffer(linestruct *somebuffer);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void unlink_opennode(openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
#endif
|
||||
void print_view_warning(void);
|
||||
void show_restricted_warning(void);
|
||||
#ifndef ENABLE_HELP
|
||||
@@ -422,26 +414,33 @@ void say_there_is_no_help(void);
|
||||
#endif
|
||||
void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename, struct stat *die_stat);
|
||||
void emergency_save(const char *die_filename, struct stat *die_stat);
|
||||
void window_init(void);
|
||||
void do_exit(void);
|
||||
void close_and_go(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 allow_sigwinch(bool allow);
|
||||
void do_toggle(int flag);
|
||||
void do_toggle_void(void);
|
||||
void enable_signals(void);
|
||||
#endif
|
||||
void disable_flow_control(void);
|
||||
void enable_flow_control(void);
|
||||
void terminal_init(void);
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
void confirm_margin(void);
|
||||
#endif
|
||||
void unbound_key(int code);
|
||||
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. */
|
||||
@@ -459,19 +458,17 @@ void do_statusbar_prev_word(void);
|
||||
void do_statusbar_next_word(void);
|
||||
#endif
|
||||
void do_statusbar_verbatim_input(void);
|
||||
size_t statusbar_xplustabs(void);
|
||||
size_t get_statusbar_page_start(size_t start_col, size_t column);
|
||||
void reinit_statusbar_x(void);
|
||||
void update_the_statusbar(void);
|
||||
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. */
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifdef ENABLE_COLOR
|
||||
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
|
||||
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
|
||||
#endif
|
||||
void parse_rcfile(FILE *rcstream, bool syntax_only);
|
||||
@@ -479,22 +476,20 @@ void do_rcfiles(void);
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* Most functions in search.c. */
|
||||
void not_found_msg(const char *str);
|
||||
void search_replace_abort(void);
|
||||
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);
|
||||
#ifndef NANO_TINY
|
||||
void do_findprevious(void);
|
||||
void do_findnext(void);
|
||||
#endif
|
||||
void do_research(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);
|
||||
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
bool interactive);
|
||||
@@ -507,12 +502,6 @@ 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);
|
||||
@@ -521,7 +510,6 @@ void do_unindent(void);
|
||||
bool white_string(const char *s);
|
||||
#ifdef ENABLE_COMMENT
|
||||
void do_comment(void);
|
||||
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
|
||||
#endif
|
||||
void do_undo(void);
|
||||
void do_redo(void);
|
||||
@@ -536,7 +524,7 @@ void update_undo(undo_type action);
|
||||
#endif /* !NANO_TINY */
|
||||
#ifdef ENABLE_WRAPPING
|
||||
void wrap_reset(void);
|
||||
bool do_wrap(filestruct *line);
|
||||
bool do_wrap(linestruct *line);
|
||||
#endif
|
||||
#if defined(ENABLE_HELP) || defined(ENABLED_WRAPORJUSTIFY)
|
||||
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
|
||||
@@ -545,9 +533,8 @@ 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);
|
||||
bool inpar(const filestruct *const foo);
|
||||
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);
|
||||
@@ -557,7 +544,6 @@ 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);
|
||||
@@ -574,14 +560,11 @@ 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);
|
||||
#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
|
||||
@@ -603,23 +586,24 @@ void new_magicline(void);
|
||||
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 mark_order(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);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void dump_filestruct(const filestruct *inptr);
|
||||
linestruct *fsfromline(ssize_t lineno);
|
||||
#endif
|
||||
|
||||
/* Most functions in winio.c. */
|
||||
void record_macro(void);
|
||||
void run_macro(void);
|
||||
size_t get_key_buffer_len(void);
|
||||
void put_back(int keycode);
|
||||
void unget_kbinput(int kbinput, bool metakey);
|
||||
#ifdef ENABLE_NANORC
|
||||
void implant(const char *string);
|
||||
#endif
|
||||
int get_kbinput(WINDOW *win, bool showcursor);
|
||||
int parse_kbinput(WINDOW *win);
|
||||
int arrow_from_abcd(int kbinput);
|
||||
@@ -631,14 +615,15 @@ 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);
|
||||
const keystruct *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 statusbar(const char *msg);
|
||||
void warn_and_shortly_pause(const char *msg);
|
||||
@@ -646,38 +631,37 @@ 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,
|
||||
void edit_draw(linestruct *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, int nrows);
|
||||
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);
|
||||
void total_refresh(void);
|
||||
void display_main_list(void);
|
||||
void do_cursorpos(bool force);
|
||||
void do_cursorpos_void(void);
|
||||
void spotlight(bool active, size_t from_col, size_t to_col);
|
||||
void spotlight(size_t from_col, size_t to_col);
|
||||
#ifndef NANO_TINY
|
||||
void spotlight_softwrapped(bool active, size_t from_col, size_t to_col);
|
||||
void spotlight_softwrapped(size_t from_col, size_t to_col);
|
||||
#endif
|
||||
void do_suspend_void(void);
|
||||
void disable_waiting(void);
|
||||
@@ -687,27 +671,30 @@ void do_credits(void);
|
||||
#endif
|
||||
|
||||
/* These are just name definitions. */
|
||||
void do_cancel(void);
|
||||
void case_sens_void(void);
|
||||
void regexp_void(void);
|
||||
void backwards_void(void);
|
||||
void flip_replace(void);
|
||||
void gototext_void(void);
|
||||
void flip_goto(void);
|
||||
#ifdef ENABLE_BROWSER
|
||||
void to_files_void(void);
|
||||
void goto_dir_void(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void do_toggle_void(void);
|
||||
void dos_format_void(void);
|
||||
void mac_format_void(void);
|
||||
void append_void(void);
|
||||
void prepend_void(void);
|
||||
void backup_file_void(void);
|
||||
void flip_execute(void);
|
||||
void flip_pipe(void);
|
||||
void flip_convert(void);
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void flip_newbuffer(void);
|
||||
#endif
|
||||
void discard_buffer(void);
|
||||
void do_cancel(void);
|
||||
|
||||
#endif /* !PROTO_H */
|
||||
|
||||
466
src/rcfile.c
466
src/rcfile.c
@@ -1,9 +1,9 @@
|
||||
/**************************************************************************
|
||||
* rcfile.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 Mike Frysinger *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* Copyright (C) 2014-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 *
|
||||
@@ -31,26 +31,33 @@
|
||||
#ifdef ENABLE_NANORC
|
||||
|
||||
#ifndef RCFILE_NAME
|
||||
#define HOME_RC_NAME ".nanorc"
|
||||
#define RCFILE_NAME "nanorc"
|
||||
#else
|
||||
#define HOME_RC_NAME RCFILE_NAME
|
||||
#endif
|
||||
|
||||
static const rcoption rcopts[] = {
|
||||
{"boldtext", BOLD_TEXT},
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
{"linenumbers", LINE_NUMBERS},
|
||||
#endif
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
{"brackets", 0},
|
||||
#endif
|
||||
{"const", CONSTANT_SHOW}, /* deprecated form, remove in 2018 */
|
||||
#ifdef ENABLE_WRAPPING
|
||||
{"breaklonglines", BREAK_LONG_LINES},
|
||||
#endif
|
||||
{"constantshow", CONSTANT_SHOW},
|
||||
{"emptyline", EMPTY_LINE},
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
{"fill", 0},
|
||||
#endif
|
||||
#ifdef ENABLE_HISTORIES
|
||||
{"historylog", HISTORYLOG},
|
||||
#endif
|
||||
{"morespace", MORE_SPACE},
|
||||
{"jumpyscrolling", JUMPY_SCROLLING},
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
{"linenumbers", LINE_NUMBERS},
|
||||
#endif
|
||||
{"morespace", MORE_SPACE}, /* Deprecated; remove in 2021. */
|
||||
#ifdef ENABLE_MOUSE
|
||||
{"mouse", USE_MOUSE},
|
||||
#endif
|
||||
@@ -61,14 +68,13 @@ static const rcoption rcopts[] = {
|
||||
{"nonewlines", NO_NEWLINES},
|
||||
{"nopauses", NO_PAUSES},
|
||||
#ifdef ENABLE_WRAPPING
|
||||
{"nowrap", NO_WRAP},
|
||||
{"nowrap", NO_WRAP}, /* Deprecated; remove in 2021. */
|
||||
#endif
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
{"operatingdir", 0},
|
||||
#endif
|
||||
#ifdef ENABLE_HISTORIES
|
||||
{"poslog", POS_HISTORY}, /* deprecated form, remove in 2018 */
|
||||
{"positionlog", POS_HISTORY},
|
||||
{"positionlog", POSITIONLOG},
|
||||
#endif
|
||||
{"preserve", PRESERVE},
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
@@ -76,8 +82,8 @@ static const rcoption rcopts[] = {
|
||||
{"quotestr", 0},
|
||||
#endif
|
||||
{"quickblank", QUICK_BLANK},
|
||||
{"rawsequences", RAW_SEQUENCES},
|
||||
{"rebinddelete", REBIND_DELETE},
|
||||
{"rebindkeypad", REBIND_KEYPAD},
|
||||
{"regexp", USE_REGEXP},
|
||||
#ifdef ENABLE_SPELLER
|
||||
{"speller", 0},
|
||||
@@ -87,23 +93,21 @@ static const rcoption rcopts[] = {
|
||||
{"tempfile", TEMP_FILE},
|
||||
{"view", VIEW_MODE},
|
||||
#ifndef NANO_TINY
|
||||
{"afterends", AFTER_ENDS},
|
||||
{"allow_insecure_backup", INSECURE_BACKUP},
|
||||
{"atblanks", AT_BLANKS},
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"backup", BACKUP_FILE},
|
||||
{"backupdir", 0},
|
||||
{"backwards", BACKWARDS_SEARCH},
|
||||
{"casesensitive", CASE_SENSITIVE},
|
||||
{"cut", CUT_FROM_CURSOR}, /* deprecated form, remove in 2020 */
|
||||
{"cutfromcursor", CUT_FROM_CURSOR},
|
||||
{"justifytrim", TRIM_BLANKS}, /* deprecated form, remove in 2020 */
|
||||
{"guidestripe", 0},
|
||||
{"locking", LOCKING},
|
||||
{"matchbrackets", 0},
|
||||
{"noconvert", NO_CONVERT},
|
||||
{"quiet", QUIET},
|
||||
{"showcursor", SHOW_CURSOR},
|
||||
{"smarthome", SMART_HOME},
|
||||
{"smooth", SMOOTH_SCROLL},
|
||||
{"smooth", SMOOTH_SCROLL}, /* Deprecated; remove in 2021. */
|
||||
{"softwrap", SOFTWRAP},
|
||||
{"tabstospaces", TABS_TO_SPACES},
|
||||
{"trimblanks", TRIM_BLANKS},
|
||||
@@ -111,12 +115,15 @@ static const rcoption rcopts[] = {
|
||||
{"whitespace", 0},
|
||||
{"wordbounds", WORD_BOUNDS},
|
||||
{"wordchars", 0},
|
||||
{"zap", LET_THEM_ZAP},
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
{"titlecolor", 0},
|
||||
{"numbercolor", 0},
|
||||
{"stripecolor", 0},
|
||||
{"selectedcolor", 0},
|
||||
{"statuscolor", 0},
|
||||
{"errorcolor", 0},
|
||||
{"keycolor", 0},
|
||||
{"functioncolor", 0},
|
||||
#endif
|
||||
@@ -240,15 +247,14 @@ char *parse_next_regex(char *ptr)
|
||||
bool nregcomp(const char *regex, int compile_flags)
|
||||
{
|
||||
regex_t preg;
|
||||
const char *r = fixbounds(regex);
|
||||
int rc = regcomp(&preg, r, compile_flags);
|
||||
int rc = regcomp(&preg, regex, compile_flags);
|
||||
|
||||
if (rc != 0) {
|
||||
size_t len = regerror(rc, &preg, NULL, 0);
|
||||
char *str = charalloc(len);
|
||||
|
||||
regerror(rc, &preg, str, len);
|
||||
rcfile_error(N_("Bad regex \"%s\": %s"), r, str);
|
||||
rcfile_error(N_("Bad regex \"%s\": %s"), regex, str);
|
||||
free(str);
|
||||
}
|
||||
|
||||
@@ -260,8 +266,7 @@ bool nregcomp(const char *regex, int compile_flags)
|
||||
* line at ptr, and add it to the global linked list of color syntaxes. */
|
||||
void parse_syntax(char *ptr)
|
||||
{
|
||||
char *nameptr;
|
||||
/* A pointer to what should be the name of the syntax. */
|
||||
char *nameptr = ptr;
|
||||
|
||||
opensyntax = FALSE;
|
||||
|
||||
@@ -272,17 +277,19 @@ void parse_syntax(char *ptr)
|
||||
return;
|
||||
}
|
||||
|
||||
nameptr = ++ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
|
||||
/* Check that the name starts and ends with a double quote. */
|
||||
if (*(nameptr - 1) != '\x22' || nameptr[strlen(nameptr) - 1] != '\x22') {
|
||||
rcfile_error(N_("A syntax name must be quoted"));
|
||||
/* Check that quotes around the name are either paired or absent. */
|
||||
if ((*nameptr == '\x22') ^ (nameptr[strlen(nameptr) - 1] == '\x22')) {
|
||||
rcfile_error(N_("Unpaired quote in syntax name"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Strip the end quote. */
|
||||
nameptr[strlen(nameptr) - 1] = '\0';
|
||||
/* If the name is quoted, strip the quotes. */
|
||||
if (*nameptr == '\x22') {
|
||||
nameptr++;
|
||||
nameptr[strlen(nameptr) - 1] = '\0';
|
||||
}
|
||||
|
||||
/* Redefining the "none" syntax is not allowed. */
|
||||
if (strcmp(nameptr, "none") == 0) {
|
||||
@@ -297,7 +304,6 @@ void parse_syntax(char *ptr)
|
||||
live_syntax->headers = NULL;
|
||||
live_syntax->magics = NULL;
|
||||
live_syntax->linter = NULL;
|
||||
live_syntax->formatter = NULL;
|
||||
#ifdef ENABLE_COMMENT
|
||||
live_syntax->comment = mallocstrcpy(NULL, GENERAL_COMMENT_CHARACTER);
|
||||
#endif
|
||||
@@ -311,10 +317,6 @@ void parse_syntax(char *ptr)
|
||||
|
||||
opensyntax = TRUE;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
|
||||
#endif
|
||||
|
||||
/* The default syntax should have no associated extensions. */
|
||||
if (strcmp(live_syntax->name, "default") == 0 && *ptr != '\0') {
|
||||
rcfile_error(N_("The \"default\" syntax does not accept extensions"));
|
||||
@@ -327,34 +329,26 @@ void parse_syntax(char *ptr)
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
/* Check whether the given executable function is "universal" (meaning
|
||||
* any horizontal movement or deletion) and thus is present in almost
|
||||
* all menus. */
|
||||
/* Return TRUE when the given function is present in almost all menus. */
|
||||
bool is_universal(void (*func)(void))
|
||||
{
|
||||
if (func == do_left || func == do_right ||
|
||||
return (func == do_left || func == do_right ||
|
||||
func == do_home || func == do_end ||
|
||||
#ifndef NANO_TINY
|
||||
func == do_prev_word_void || func == do_next_word_void ||
|
||||
#endif
|
||||
func == do_delete || func == do_backspace ||
|
||||
func == do_cut_text_void || func == do_uncut_text ||
|
||||
func == do_tab || func == do_enter || func == do_verbatim_input)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
func == do_tab || func == do_enter || func == do_verbatim_input);
|
||||
}
|
||||
|
||||
/* Bind or unbind a key combo, to or from a function. */
|
||||
void parse_binding(char *ptr, bool dobind)
|
||||
{
|
||||
char *keyptr = NULL, *keycopy = NULL, *funcptr = NULL, *menuptr = NULL;
|
||||
sc *s, *newsc = NULL;
|
||||
int menu;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting the rebinding code...\n");
|
||||
#endif
|
||||
keystruct *s, *newsc = NULL;
|
||||
int menu, mask = 0;
|
||||
funcstruct *f;
|
||||
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing key name"));
|
||||
@@ -396,12 +390,13 @@ void parse_binding(char *ptr, bool dobind)
|
||||
|
||||
if (dobind) {
|
||||
funcptr = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
ptr = parse_argument(ptr);
|
||||
|
||||
if (funcptr[0] == '\0') {
|
||||
rcfile_error(N_("Must specify a function to bind the key to"));
|
||||
goto free_things;
|
||||
}
|
||||
} else if (ptr == NULL)
|
||||
goto free_things;
|
||||
}
|
||||
|
||||
menuptr = ptr;
|
||||
@@ -414,80 +409,89 @@ void parse_binding(char *ptr, bool dobind)
|
||||
}
|
||||
|
||||
if (dobind) {
|
||||
newsc = strtosc(funcptr);
|
||||
/* If the thing to bind starts with a double quote, it is a string,
|
||||
* otherwise it is the name of a function. */
|
||||
if (*funcptr == '"') {
|
||||
newsc = nmalloc(sizeof(keystruct));
|
||||
newsc->func = (functionptrtype)implant;
|
||||
newsc->expansion = mallocstrcpy(NULL, funcptr + 1);
|
||||
#ifndef NANO_TINY
|
||||
newsc->toggle = 0;
|
||||
#endif
|
||||
} else
|
||||
newsc = strtosc(funcptr);
|
||||
|
||||
if (newsc == NULL) {
|
||||
rcfile_error(N_("Cannot map name \"%s\" to a function"), funcptr);
|
||||
goto free_things;
|
||||
}
|
||||
}
|
||||
|
||||
menu = strtomenu(menuptr);
|
||||
menu = name_to_menu(menuptr);
|
||||
if (menu < 1) {
|
||||
rcfile_error(N_("Cannot map name \"%s\" to a menu"), menuptr);
|
||||
goto free_things;
|
||||
}
|
||||
|
||||
if (dobind) {
|
||||
subnfunc *f;
|
||||
int mask = 0;
|
||||
|
||||
/* Tally up the menus where the function exists. */
|
||||
for (f = allfuncs; f != NULL; f = f->next)
|
||||
if (f->scfunc == newsc->scfunc)
|
||||
mask = mask | f->menus;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Handle the special case of the toggles. */
|
||||
if (newsc->scfunc == do_toggle_void)
|
||||
mask = MMAIN;
|
||||
#endif
|
||||
|
||||
/* Now limit the given menu to those where the function exists. */
|
||||
if (is_universal(newsc->scfunc))
|
||||
menu = menu & MMOST;
|
||||
else
|
||||
menu = menu & mask;
|
||||
|
||||
if (!menu) {
|
||||
rcfile_error(N_("Function '%s' does not exist in menu '%s'"), funcptr, menuptr);
|
||||
goto free_things;
|
||||
}
|
||||
|
||||
newsc->menus = menu;
|
||||
assign_keyinfo(newsc, keycopy, 0);
|
||||
|
||||
/* Do not allow rebinding a frequent escape-sequence starter: Esc [. */
|
||||
if (newsc->meta && newsc->keycode == 91) {
|
||||
rcfile_error(N_("Sorry, keystroke \"%s\" may not be rebound"), newsc->keystr);
|
||||
goto free_things;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now find and delete any existing same shortcut in the menu(s). */
|
||||
for (s = sclist; s != NULL; s = s->next) {
|
||||
if ((s->menus & menu) && !strcmp(s->keystr, keycopy))
|
||||
/* Wipe the given shortcut from the given menu. */
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if ((s->menus & menu) && strcmp(s->keystr, keycopy) == 0)
|
||||
s->menus &= ~menu;
|
||||
|
||||
/* When unbinding, we are done now. */
|
||||
if (!dobind)
|
||||
goto free_things;
|
||||
|
||||
/* Tally up the menus where the function exists. */
|
||||
for (f = allfuncs; f != NULL; f = f->next)
|
||||
if (f->func == newsc->func)
|
||||
mask = mask | f->menus;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Handle the special case of the toggles. */
|
||||
if (newsc->func == do_toggle_void)
|
||||
mask = MMAIN;
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Handle the special case of a key defined as a string. */
|
||||
if (newsc->func == (functionptrtype)implant)
|
||||
mask = MMOST | MHELP;
|
||||
#endif
|
||||
/* Now limit the given menu to those where the function exists. */
|
||||
menu = menu & (is_universal(newsc->func) ? MMOST : mask);
|
||||
|
||||
if (!menu) {
|
||||
if (!ISSET(RESTRICTED) && !ISSET(VIEW_MODE))
|
||||
rcfile_error(N_("Function '%s' does not exist in menu '%s'"),
|
||||
funcptr, menuptr);
|
||||
goto free_things;
|
||||
}
|
||||
|
||||
if (dobind) {
|
||||
#ifndef NANO_TINY
|
||||
/* If this is a toggle, copy its sequence number. */
|
||||
if (newsc->scfunc == do_toggle_void) {
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->scfunc == do_toggle_void && s->toggle == newsc->toggle)
|
||||
newsc->ordinal = s->ordinal;
|
||||
} else
|
||||
newsc->ordinal = 0;
|
||||
#endif
|
||||
/* Add the new shortcut at the start of the list. */
|
||||
newsc->next = sclist;
|
||||
sclist = newsc;
|
||||
newsc->menus = menu;
|
||||
assign_keyinfo(newsc, keycopy, 0);
|
||||
|
||||
/* Disallow rebinding ^[ and frequent escape-sequence starter "Esc [". */
|
||||
if ((!newsc->meta && newsc->keycode == ESC_CODE) ||
|
||||
(newsc->meta && newsc->keycode == '[')) {
|
||||
rcfile_error(N_("Keystroke %s may not be rebound"), keycopy);
|
||||
free_things:
|
||||
free(keycopy);
|
||||
free(newsc);
|
||||
return;
|
||||
}
|
||||
|
||||
free_things:
|
||||
free(newsc);
|
||||
free(keycopy);
|
||||
#ifndef NANO_TINY
|
||||
/* If this is a toggle, find and copy its sequence number. */
|
||||
if (newsc->func == do_toggle_void) {
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->func == do_toggle_void && s->toggle == newsc->toggle)
|
||||
newsc->ordinal = s->ordinal;
|
||||
} else
|
||||
newsc->ordinal = 0;
|
||||
#endif
|
||||
/* Add the new shortcut at the start of the list. */
|
||||
newsc->next = sclist;
|
||||
sclist = newsc;
|
||||
}
|
||||
|
||||
/* Verify that the given file exists, is not a folder nor a device. */
|
||||
@@ -499,7 +503,7 @@ bool is_good_file(char *file)
|
||||
if (access(file, R_OK) != 0)
|
||||
return FALSE;
|
||||
|
||||
/* If the thing exists, it may not be a directory nor a device. */
|
||||
/* If the thing exists, it may be neither a directory nor a device. */
|
||||
if (stat(file, &rcinfo) != -1 && (S_ISDIR(rcinfo.st_mode) ||
|
||||
S_ISCHR(rcinfo.st_mode) || S_ISBLK(rcinfo.st_mode))) {
|
||||
rcfile_error(S_ISDIR(rcinfo.st_mode) ? _("\"%s\" is a directory") :
|
||||
@@ -532,41 +536,42 @@ static void parse_one_include(char *file)
|
||||
nanorc = file;
|
||||
lineno = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Parsing file \"%s\"\n", file);
|
||||
#endif
|
||||
|
||||
parse_rcfile(rcstream, TRUE);
|
||||
}
|
||||
|
||||
/* Expand globs in the passed name, and parse the resultant files. */
|
||||
void parse_includes(char *ptr)
|
||||
{
|
||||
char *option, *nanorc_save = nanorc, *expanded;
|
||||
size_t lineno_save = lineno, i;
|
||||
char *pattern, *expanded;
|
||||
char *was_nanorc = nanorc;
|
||||
size_t was_lineno = lineno;
|
||||
glob_t files;
|
||||
int result;
|
||||
|
||||
option = ptr;
|
||||
if (*option == '"')
|
||||
option++;
|
||||
pattern = ptr;
|
||||
if (*pattern == '"')
|
||||
pattern++;
|
||||
ptr = parse_argument(ptr);
|
||||
|
||||
/* Expand tildes first, then the globs. */
|
||||
expanded = real_dir_from_tilde(option);
|
||||
/* Expand a tilde first, then try to match the globbing pattern. */
|
||||
expanded = real_dir_from_tilde(pattern);
|
||||
result = glob(expanded, GLOB_ERR, NULL, &files);
|
||||
|
||||
if (glob(expanded, GLOB_ERR|GLOB_NOSORT, NULL, &files) == 0) {
|
||||
for (i = 0; i < files.gl_pathc; ++i)
|
||||
/* If there are matches, process each of them. Otherwise, only
|
||||
* report an error if it's something other than zero matches. */
|
||||
if (result == 0) {
|
||||
for (size_t i = 0; i < files.gl_pathc; ++i)
|
||||
parse_one_include(files.gl_pathv[i]);
|
||||
} else
|
||||
rcfile_error(_("Error expanding %s: %s"), option, strerror(errno));
|
||||
} else if (result != GLOB_NOMATCH)
|
||||
rcfile_error(_("Error expanding %s: %s"), pattern, strerror(errno));
|
||||
|
||||
globfree(&files);
|
||||
free(expanded);
|
||||
|
||||
/* We're done with the included file(s). Restore the original
|
||||
* filename and line number position. */
|
||||
nanorc = nanorc_save;
|
||||
lineno = lineno_save;
|
||||
nanorc = was_nanorc;
|
||||
lineno = was_lineno;
|
||||
}
|
||||
|
||||
/* Return the short value corresponding to the color named in colorname,
|
||||
@@ -595,9 +600,45 @@ short color_to_short(const char *colorname, bool *bright)
|
||||
return COLOR_MAGENTA;
|
||||
else if (strcasecmp(colorname, "black") == 0)
|
||||
return COLOR_BLACK;
|
||||
else if (strcasecmp(colorname, "normal") == 0)
|
||||
return USE_THE_DEFAULT;
|
||||
|
||||
rcfile_error(N_("Color \"%s\" not understood"), colorname);
|
||||
return -1;
|
||||
return BAD_COLOR;
|
||||
}
|
||||
|
||||
/* Parse the color name (or pair of color names) in the given string.
|
||||
* Return FALSE when any color name is invalid; otherwise return TRUE. */
|
||||
bool parse_color_names(char *combostr, short *fg, short *bg, int *attributes)
|
||||
{
|
||||
char *comma = strchr(combostr, ',');
|
||||
bool bright;
|
||||
|
||||
*attributes = A_NORMAL;
|
||||
|
||||
if (comma != NULL) {
|
||||
*bg = color_to_short(comma + 1, &bright);
|
||||
if (bright) {
|
||||
rcfile_error(N_("A background color cannot be bright"));
|
||||
return FALSE;
|
||||
}
|
||||
if (*bg == BAD_COLOR)
|
||||
return FALSE;
|
||||
*comma = '\0';
|
||||
} else
|
||||
*bg = USE_THE_DEFAULT;
|
||||
|
||||
if (comma != combostr) {
|
||||
*fg = color_to_short(combostr, &bright);
|
||||
if (*fg == BAD_COLOR)
|
||||
return FALSE;
|
||||
|
||||
if (bright)
|
||||
*attributes = A_BOLD;
|
||||
} else
|
||||
*fg = USE_THE_DEFAULT;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Parse the color string in the line at ptr, and add it to the current
|
||||
@@ -606,7 +647,7 @@ short color_to_short(const char *colorname, bool *bright)
|
||||
void parse_colors(char *ptr, int rex_flags)
|
||||
{
|
||||
short fg, bg;
|
||||
bool bright;
|
||||
int attributes;
|
||||
char *item;
|
||||
|
||||
if (!opensyntax) {
|
||||
@@ -622,7 +663,7 @@ void parse_colors(char *ptr, int rex_flags)
|
||||
|
||||
item = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
if (!parse_color_names(item, &fg, &bg, &bright))
|
||||
if (!parse_color_names(item, &fg, &bg, &attributes))
|
||||
return;
|
||||
|
||||
if (*ptr == '\0') {
|
||||
@@ -669,7 +710,7 @@ void parse_colors(char *ptr, int rex_flags)
|
||||
|
||||
newcolor->fg = fg;
|
||||
newcolor->bg = bg;
|
||||
newcolor->bright = bright;
|
||||
newcolor->attributes = attributes;
|
||||
newcolor->rex_flags = rex_flags;
|
||||
|
||||
newcolor->start_regex = mallocstrcpy(NULL, item);
|
||||
@@ -727,39 +768,12 @@ void parse_colors(char *ptr, int rex_flags)
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the color name, or pair of color names, in combostr. */
|
||||
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
|
||||
{
|
||||
char *comma = strchr(combostr, ',');
|
||||
|
||||
if (comma != NULL) {
|
||||
*bg = color_to_short(comma + 1, bright);
|
||||
if (*bright) {
|
||||
rcfile_error(N_("A background color cannot be bright"));
|
||||
return FALSE;
|
||||
}
|
||||
*comma = '\0';
|
||||
} else
|
||||
*bg = -1;
|
||||
|
||||
if (comma != combostr) {
|
||||
*fg = color_to_short(combostr, bright);
|
||||
|
||||
/* If the specified foreground color is bad, ignore the regexes. */
|
||||
if (*fg == -1)
|
||||
return FALSE;
|
||||
} else
|
||||
*fg = -1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Parse the argument of an interface color option. */
|
||||
colortype *parse_interface_color(char *combostr)
|
||||
{
|
||||
colortype *trio = nmalloc(sizeof(colortype));
|
||||
|
||||
if (parse_color_names(combostr, &trio->fg, &trio->bg, &trio->bright)) {
|
||||
if (parse_color_names(combostr, &trio->fg, &trio->bg, &trio->attributes)) {
|
||||
free(combostr);
|
||||
return trio;
|
||||
} else {
|
||||
@@ -832,7 +846,7 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
|
||||
}
|
||||
}
|
||||
|
||||
/* Gather and store the string after a comment/linter/formatter command. */
|
||||
/* Gather and store the string after a comment/linter command. */
|
||||
void pick_up_name(const char *kind, char *ptr, char **storage)
|
||||
{
|
||||
if (!opensyntax) {
|
||||
@@ -869,19 +883,20 @@ void pick_up_name(const char *kind, char *ptr, char **storage)
|
||||
* function that we consider 'vital' (such as "Exit"). */
|
||||
static void check_vitals_mapped(void)
|
||||
{
|
||||
subnfunc *f;
|
||||
funcstruct *f;
|
||||
int v;
|
||||
#define VITALS 5
|
||||
void (*vitals[VITALS])(void) = { do_exit, do_exit, do_cancel, do_cancel, do_cancel };
|
||||
int inmenus[VITALS] = { MMAIN, MHELP, MWHEREIS, MREPLACE, MGOTOLINE };
|
||||
#define VITALS 3
|
||||
void (*vitals[VITALS])(void) = { do_exit, do_exit, do_cancel };
|
||||
int inmenus[VITALS] = { MMAIN, MHELP, MYESNO };
|
||||
|
||||
for (v = 0; v < VITALS; v++) {
|
||||
for (f = allfuncs; f != NULL; f = f->next) {
|
||||
if (f->scfunc == vitals[v] && f->menus & inmenus[v]) {
|
||||
const sc *s = first_sc_for(inmenus[v], f->scfunc);
|
||||
if (f->func == vitals[v] && f->menus & inmenus[v]) {
|
||||
const keystruct *s = first_sc_for(inmenus[v], f->func);
|
||||
if (!s) {
|
||||
fprintf(stderr, _("Fatal error: no keys mapped for function "
|
||||
"\"%s\". Exiting.\n"), f->desc);
|
||||
fprintf(stderr, _("No key is bound to function '%s' in "
|
||||
"menu '%s'. Exiting.\n"), f->desc,
|
||||
menu_to_name(inmenus[v]));
|
||||
fprintf(stderr, _("If needed, use nano with the -I option "
|
||||
"to adjust your nanorc settings.\n"));
|
||||
exit(1);
|
||||
@@ -915,8 +930,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
||||
while (isblank((unsigned char)*ptr))
|
||||
ptr++;
|
||||
|
||||
/* If we have a blank line or a comment, skip to the next
|
||||
* line. */
|
||||
/* If the line is empty or a comment, skip to next line. */
|
||||
if (*ptr == '\0' || *ptr == '#')
|
||||
continue;
|
||||
|
||||
@@ -926,7 +940,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
/* Handle extending first... */
|
||||
if (strcasecmp(keyword, "extendsyntax") == 0) {
|
||||
if (strcasecmp(keyword, "extendsyntax") == 0 && !syntax_only) {
|
||||
syntaxtype *sint;
|
||||
char *syntaxname = ptr;
|
||||
|
||||
@@ -983,13 +997,12 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
||||
parse_colors(ptr, NANO_REG_EXTENDED | REG_ICASE);
|
||||
else if (strcasecmp(keyword, "linter") == 0)
|
||||
pick_up_name("linter", ptr, &live_syntax->linter);
|
||||
else if (strcasecmp(keyword, "formatter") == 0)
|
||||
#ifdef ENABLE_SPELLER
|
||||
pick_up_name("formatter", ptr, &live_syntax->formatter);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
else if (syntax_only)
|
||||
else if (syntax_only && (strcasecmp(keyword, "set") == 0 ||
|
||||
strcasecmp(keyword, "unset") == 0 ||
|
||||
strcasecmp(keyword, "bind") == 0 ||
|
||||
strcasecmp(keyword, "unbind") == 0 ||
|
||||
strcasecmp(keyword, "include") == 0 ||
|
||||
strcasecmp(keyword, "extendsyntax") == 0))
|
||||
rcfile_error(N_("Command \"%s\" not allowed in included file"),
|
||||
keyword);
|
||||
else if (strcasecmp(keyword, "include") == 0)
|
||||
@@ -1035,10 +1048,6 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " Option name = \"%s\"\n", rcopts[i].name);
|
||||
fprintf(stderr, " Flag = %ld\n", rcopts[i].flag);
|
||||
#endif
|
||||
/* First handle unsetting. */
|
||||
if (set == -1) {
|
||||
if (rcopts[i].flag != 0)
|
||||
@@ -1067,24 +1076,27 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
||||
ptr = parse_argument(ptr);
|
||||
|
||||
option = mallocstrcpy(NULL, option);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " Option argument = \"%s\"\n", option);
|
||||
#endif
|
||||
/* Make sure the option argument is a valid multibyte string. */
|
||||
if (!is_valid_mbstring(option)) {
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* When in a UTF-8 locale, ignore arguments with invalid sequences. */
|
||||
if (using_utf8() && mbstowcs(NULL, option, 0) == (size_t)-1) {
|
||||
rcfile_error(N_("Argument is not a valid multibyte string"));
|
||||
continue;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
if (strcasecmp(rcopts[i].name, "titlecolor") == 0)
|
||||
color_combo[TITLE_BAR] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "numbercolor") == 0)
|
||||
color_combo[LINE_NUMBER] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "stripecolor") == 0)
|
||||
color_combo[GUIDE_STRIPE] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "selectedcolor") == 0)
|
||||
color_combo[SELECTED_TEXT] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "statuscolor") == 0)
|
||||
color_combo[STATUS_BAR] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "errorcolor") == 0)
|
||||
color_combo[ERROR_MESSAGE] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "keycolor") == 0)
|
||||
color_combo[KEY_COMBO] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "functioncolor") == 0)
|
||||
@@ -1098,51 +1110,54 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
||||
#endif
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
if (strcasecmp(rcopts[i].name, "fill") == 0) {
|
||||
if (!parse_num(option, &wrap_at)) {
|
||||
if (!parse_num(option, &fill)) {
|
||||
rcfile_error(N_("Requested fill size \"%s\" is invalid"),
|
||||
option);
|
||||
wrap_at = -CHARS_FROM_EOL;
|
||||
} else
|
||||
UNSET(NO_WRAP);
|
||||
fill = -COLUMNS_FROM_EOL;
|
||||
}
|
||||
free(option);
|
||||
} else
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
if (strcasecmp(rcopts[i].name, "matchbrackets") == 0) {
|
||||
matchbrackets = option;
|
||||
if (has_blank_mbchars(matchbrackets)) {
|
||||
rcfile_error(N_("Non-blank characters required"));
|
||||
free(matchbrackets);
|
||||
matchbrackets = NULL;
|
||||
if (strcasecmp(rcopts[i].name, "guidestripe") == 0) {
|
||||
if (!parse_num(option, &stripe_column) || stripe_column <= 0) {
|
||||
rcfile_error(N_("Guide column \"%s\" is invalid"), option);
|
||||
stripe_column = 0;
|
||||
}
|
||||
free(option);
|
||||
} else if (strcasecmp(rcopts[i].name, "matchbrackets") == 0) {
|
||||
if (has_blank_char(option)) {
|
||||
rcfile_error(N_("Non-blank characters required"));
|
||||
free(option);
|
||||
} else if (mbstrlen(option) % 2 != 0) {
|
||||
rcfile_error(N_("Even number of characters required"));
|
||||
free(option);
|
||||
} else
|
||||
matchbrackets = option;
|
||||
} else if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
||||
whitespace = option;
|
||||
if (mbstrlen(whitespace) != 2 || strlenpt(whitespace) != 2) {
|
||||
if (mbstrlen(option) != 2 || strlenpt(option) != 2) {
|
||||
rcfile_error(N_("Two single-column characters required"));
|
||||
free(whitespace);
|
||||
whitespace = NULL;
|
||||
free(option);
|
||||
} else {
|
||||
whitespace_len[0] = parse_mbchar(whitespace, NULL, NULL);
|
||||
whitespace_len[1] = parse_mbchar(whitespace +
|
||||
whitespace_len[0], NULL, NULL);
|
||||
whitespace = option;
|
||||
whitelen[0] = parse_mbchar(whitespace, NULL, NULL);
|
||||
whitelen[1] = parse_mbchar(whitespace + whitelen[0], NULL, NULL);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
if (strcasecmp(rcopts[i].name, "punct") == 0) {
|
||||
punct = option;
|
||||
if (has_blank_mbchars(punct)) {
|
||||
if (has_blank_char(option)) {
|
||||
rcfile_error(N_("Non-blank characters required"));
|
||||
free(punct);
|
||||
punct = NULL;
|
||||
}
|
||||
free(option);
|
||||
} else
|
||||
punct = option;
|
||||
} else if (strcasecmp(rcopts[i].name, "brackets") == 0) {
|
||||
brackets = option;
|
||||
if (has_blank_mbchars(brackets)) {
|
||||
if (has_blank_char(option)) {
|
||||
rcfile_error(N_("Non-blank characters required"));
|
||||
free(brackets);
|
||||
brackets = NULL;
|
||||
}
|
||||
free(option);
|
||||
} else
|
||||
brackets = option;
|
||||
} else if (strcasecmp(rcopts[i].name, "quotestr") == 0)
|
||||
quotestr = option;
|
||||
else
|
||||
@@ -1194,9 +1209,6 @@ void parse_one_nanorc(void)
|
||||
if (!is_good_file(nanorc))
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Going to parse file \"%s\"\n", nanorc);
|
||||
#endif
|
||||
rcstream = fopen(nanorc, "rb");
|
||||
|
||||
/* If opening the file succeeded, parse it. Otherwise, only
|
||||
@@ -1223,24 +1235,16 @@ void do_rcfiles(void)
|
||||
{
|
||||
const char *xdgconfdir;
|
||||
|
||||
/* First process the system-wide nanorc, if there is one. */
|
||||
nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");
|
||||
|
||||
/* Process the system-wide nanorc. */
|
||||
parse_one_nanorc();
|
||||
|
||||
/* When configured with --disable-wrapping-as-root, turn wrapping off
|
||||
* for root, so that only root's .nanorc or --fill can turn it on. */
|
||||
#ifdef DISABLE_ROOTWRAPPING
|
||||
if (geteuid() == NANO_ROOT_UID)
|
||||
SET(NO_WRAP);
|
||||
#endif
|
||||
|
||||
get_homedir();
|
||||
xdgconfdir = getenv("XDG_CONFIG_HOME");
|
||||
|
||||
/* Now try the to find a nanorc file in the user's home directory
|
||||
* or in the XDG configuration directories. */
|
||||
if (have_nanorc(homedir, "/." RCFILE_NAME))
|
||||
/* Now try the to find a nanorc file in the user's home directory or in
|
||||
* the XDG configuration directories, and process the first one found. */
|
||||
if (have_nanorc(homedir, "/" HOME_RC_NAME))
|
||||
parse_one_nanorc();
|
||||
else if (have_nanorc(xdgconfdir, "/nano/" RCFILE_NAME))
|
||||
parse_one_nanorc();
|
||||
@@ -1251,6 +1255,16 @@ void do_rcfiles(void)
|
||||
|
||||
check_vitals_mapped();
|
||||
|
||||
#ifdef __linux__
|
||||
/* On a Linux console, don't start nano when there are rcfile errors,
|
||||
* because otherwise these error messages get wiped. */
|
||||
if (on_a_vt && rcfile_with_errors) {
|
||||
fprintf(stderr, _("If needed, use nano with the -I option "
|
||||
"to adjust your nanorc settings.\n"));
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
free(nanorc);
|
||||
}
|
||||
|
||||
|
||||
518
src/search.c
518
src/search.c
@@ -1,8 +1,8 @@
|
||||
/**************************************************************************
|
||||
* search.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015-2017 Benno Schulenberg *
|
||||
* 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 *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -28,14 +28,14 @@
|
||||
|
||||
static bool came_full_circle = FALSE;
|
||||
/* Have we reached the starting line again while searching? */
|
||||
static bool regexp_compiled = FALSE;
|
||||
/* Have we compiled any regular expressions? */
|
||||
static bool have_compiled_regexp = FALSE;
|
||||
/* Whether we have compiled a regular expression for the search. */
|
||||
|
||||
/* Compile the given regular expression and store it in search_regexp.
|
||||
* 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. */
|
||||
@@ -50,152 +50,127 @@ bool regexp_init(const char *regexp)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
regexp_compiled = TRUE;
|
||||
have_compiled_regexp = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Decompile the compiled regular expression we used in the last
|
||||
* search, if any. */
|
||||
void regexp_cleanup(void)
|
||||
/* Free a compiled regular expression, if one was compiled; and schedule a
|
||||
* full screen refresh when the mark is on, in case the cursor has moved. */
|
||||
void tidy_up_after_search(void)
|
||||
{
|
||||
if (regexp_compiled) {
|
||||
regexp_compiled = FALSE;
|
||||
if (have_compiled_regexp) {
|
||||
regfree(&search_regexp);
|
||||
have_compiled_regexp = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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));
|
||||
|
||||
statusline(HUSH, _("\"%.*s%s\" not found"), numchars, disp,
|
||||
(disp[numchars] == '\0') ? "" : "...");
|
||||
free(disp);
|
||||
}
|
||||
|
||||
/* Abort the current search or replace. Clean up by displaying the main
|
||||
* shortcut list, updating the screen if the mark was on before, and
|
||||
* decompiling the compiled regular expression we used in the last
|
||||
* search, if any. */
|
||||
void search_replace_abort(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark)
|
||||
refresh_needed = TRUE;
|
||||
#endif
|
||||
regexp_cleanup();
|
||||
}
|
||||
|
||||
/* Set up the system variables for a search or replace. If use_answer
|
||||
* is TRUE, only set backupstring to answer. Return -2 to run the
|
||||
* opposite program (search -> replace, replace -> search), return -1 if
|
||||
* the search should be canceled (due to Cancel, a blank search string,
|
||||
* Go to Line, or a failed regcomp()), return 0 on success, and return 1
|
||||
* on rerun calling program.
|
||||
*
|
||||
* replacing is TRUE if we call from do_replace(), and FALSE if called
|
||||
* from do_search(). */
|
||||
int search_init(bool replacing, bool use_answer)
|
||||
/* Prepare the prompt and ask the user what to search for. Keep looping
|
||||
* as long as the user presses a toggle, and only take action and exit
|
||||
* when <Enter> is pressed or a non-toggle shortcut was executed. */
|
||||
void search_init(bool replacing, bool keep_the_answer)
|
||||
{
|
||||
int i = 0;
|
||||
char *buf;
|
||||
static char *backupstring = NULL;
|
||||
/* The search string we'll be using. */
|
||||
functionptrtype func;
|
||||
char *thedefault;
|
||||
/* What will be searched for when the user typed nothing. */
|
||||
|
||||
/* If use_answer is TRUE, set backupstring to answer and get out. */
|
||||
if (use_answer) {
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* We display the search prompt below. If the user types a partial
|
||||
* search string and then Replace or a toggle, we will return to
|
||||
* do_search() or do_replace() and be called again. In that case,
|
||||
* we should put the same search string back up. */
|
||||
/* When starting a new search, clear the current answer. */
|
||||
if (!keep_the_answer)
|
||||
answer = mallocstrcpy(answer, NULL);
|
||||
|
||||
/* 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);
|
||||
|
||||
buf = charalloc(strlen(disp) + 7);
|
||||
thedefault = charalloc(strlen(disp) + 7);
|
||||
/* We use (COLS / 3) here because we need to see more on the line. */
|
||||
sprintf(buf, " [%s%s]", disp,
|
||||
sprintf(thedefault, " [%s%s]", disp,
|
||||
(strlenpt(last_search) > COLS / 3) ? "..." : "");
|
||||
free(disp);
|
||||
} else
|
||||
buf = mallocstrcpy(NULL, "");
|
||||
thedefault = mallocstrcpy(NULL, "");
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
i = do_prompt(FALSE, FALSE,
|
||||
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
|
||||
backupstring, &search_history,
|
||||
/* TRANSLATORS: This is the main search prompt. */
|
||||
edit_refresh, "%s%s%s%s%s%s", _("Search"),
|
||||
/* TRANSLATORS: The next three modify the search prompt. */
|
||||
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") : "",
|
||||
ISSET(USE_REGEXP) ? _(" [Regexp]") : "",
|
||||
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") : "", replacing ?
|
||||
while (TRUE) {
|
||||
functionptrtype func;
|
||||
/* Ask the user what to search for (or replace). */
|
||||
int i = do_prompt(FALSE, FALSE,
|
||||
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
|
||||
answer, &search_history,
|
||||
/* TRANSLATORS: This is the main search prompt. */
|
||||
edit_refresh, "%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 ?
|
||||
#ifndef NANO_TINY
|
||||
/* TRANSLATORS: The next two modify the search prompt. */
|
||||
openfile->mark ? _(" (to replace) in selection") :
|
||||
openfile->mark ? _(" (to replace) in selection") :
|
||||
#endif
|
||||
_(" (to replace)") : "", buf);
|
||||
_(" (to replace)") : "", thedefault);
|
||||
|
||||
/* Release buf now that we don't need it anymore. */
|
||||
free(buf);
|
||||
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
|
||||
/* 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')) {
|
||||
statusbar(_("Cancelled"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If Enter was pressed, see what we got. */
|
||||
if (i == 0 || i == -2) {
|
||||
/* If an answer was given, remember it. */
|
||||
if (*answer != '\0') {
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
#ifdef ENABLE_HISTORIES
|
||||
update_history(&search_history, answer);
|
||||
#endif
|
||||
/* 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')) {
|
||||
statusbar(_("Cancelled"));
|
||||
tidy_up_after_search();
|
||||
free(thedefault);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If Enter was pressed, prepare to do a replace or a search. */
|
||||
if (i == 0 || i == -2) {
|
||||
/* If an actual answer was typed, remember it. */
|
||||
if (*answer != '\0') {
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
#ifdef ENABLE_HISTORIES
|
||||
update_history(&search_history, answer);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* When not doing a regular-expression search, just search;
|
||||
* otherwise compile the search string, and only search when
|
||||
* the expression is valid. */
|
||||
if (!ISSET(USE_REGEXP) || regexp_init(last_search)) {
|
||||
if (replacing)
|
||||
ask_for_replacement();
|
||||
else
|
||||
go_looking();
|
||||
}
|
||||
|
||||
tidy_up_after_search();
|
||||
free(thedefault);
|
||||
return;
|
||||
}
|
||||
|
||||
func = func_from_key(&i);
|
||||
|
||||
/* If we're here, one of the five toggles was pressed, or
|
||||
* a shortcut was executed. */
|
||||
if (func == case_sens_void) {
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
} else if (func == backwards_void) {
|
||||
TOGGLE(BACKWARDS_SEARCH);
|
||||
} else if (func == regexp_void) {
|
||||
TOGGLE(USE_REGEXP);
|
||||
} 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;
|
||||
}
|
||||
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
|
||||
return -1;
|
||||
else
|
||||
return 0; /* We have a valid string or regex. */
|
||||
}
|
||||
|
||||
func = func_from_key(&i);
|
||||
|
||||
if (func == case_sens_void) {
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
} else if (func == backwards_void) {
|
||||
TOGGLE(BACKWARDS_SEARCH);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
} else if (func == regexp_void) {
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
} else if (func == flip_replace) {
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
} else if (func == do_gotolinecolumn_void) {
|
||||
do_gotolinecolumn(openfile->current->lineno,
|
||||
openfile->placewewant + 1, TRUE, TRUE);
|
||||
return 3;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Look for needle, starting at (current, current_x). begin is the line
|
||||
@@ -203,13 +178,13 @@ int search_init(bool replacing, bool use_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. */
|
||||
@@ -235,7 +210,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
lastkbcheck = time(NULL);
|
||||
|
||||
/* Consume all waiting keystrokes until a Cancel. */
|
||||
while (input) {
|
||||
while (input != ERR) {
|
||||
if (func_from_key(&input) == do_cancel) {
|
||||
statusbar(_("Cancelled"));
|
||||
enable_waiting();
|
||||
@@ -304,7 +279,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"));
|
||||
@@ -353,17 +328,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
/* Ask what to search for and then go looking for it. */
|
||||
void do_search(void)
|
||||
{
|
||||
int i = search_init(FALSE, FALSE);
|
||||
|
||||
if (i == -1) /* Cancelled, or some other exit reason. */
|
||||
search_replace_abort();
|
||||
else if (i == -2) /* Do a replace instead. */
|
||||
do_replace();
|
||||
else if (i == 1) /* Toggled something. */
|
||||
do_search();
|
||||
|
||||
if (i == 0)
|
||||
go_looking();
|
||||
search_init(FALSE, FALSE);
|
||||
}
|
||||
|
||||
/* Search forward for a string. */
|
||||
@@ -380,22 +345,6 @@ void do_search_backward(void)
|
||||
do_search();
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Search in the backward direction for the next occurrence. */
|
||||
void do_findprevious(void)
|
||||
{
|
||||
SET(BACKWARDS_SEARCH);
|
||||
do_research();
|
||||
}
|
||||
|
||||
/* Search in the forward direction for the next occurrence. */
|
||||
void do_findnext(void)
|
||||
{
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
do_research();
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Search for the last string without prompting. */
|
||||
void do_research(void)
|
||||
{
|
||||
@@ -418,13 +367,40 @@ void do_research(void)
|
||||
currmenu = MWHEREIS;
|
||||
|
||||
go_looking();
|
||||
|
||||
tidy_up_after_search();
|
||||
}
|
||||
|
||||
/* Search in the backward direction for the next occurrence. */
|
||||
void do_findprevious(void)
|
||||
{
|
||||
SET(BACKWARDS_SEARCH);
|
||||
do_research();
|
||||
}
|
||||
|
||||
/* Search in the forward direction for the next occurrence. */
|
||||
void do_findnext(void)
|
||||
{
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
do_research();
|
||||
}
|
||||
|
||||
/* 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, FALSE);
|
||||
size_t numchars = actual_x(disp, strnlenpt(disp, COLS / 2));
|
||||
|
||||
statusline(HUSH, _("\"%.*s%s\" not found"), numchars, disp,
|
||||
(disp[numchars] == '\0') ? "" : "...");
|
||||
free(disp);
|
||||
}
|
||||
|
||||
/* Search for the global string 'last_search'. Inform the user when
|
||||
* 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
|
||||
clock_t start = clock();
|
||||
@@ -448,7 +424,6 @@ void go_looking(void)
|
||||
#endif
|
||||
|
||||
edit_redraw(was_current, CENTERING);
|
||||
search_replace_abort();
|
||||
}
|
||||
|
||||
/* Calculate the size of the replacement text, taking possible
|
||||
@@ -537,7 +512,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;
|
||||
@@ -545,8 +520,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,
|
||||
@@ -554,8 +529,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);
|
||||
mark_order((const linestruct **)&top, &top_x,
|
||||
(const linestruct **)&bot, &bot_x, &right_side_up);
|
||||
openfile->mark = NULL;
|
||||
modus = INREGION;
|
||||
|
||||
@@ -573,7 +548,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);
|
||||
|
||||
@@ -600,31 +575,30 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
numreplaced = 0;
|
||||
|
||||
if (!replaceall) {
|
||||
size_t from_col = xplustabs();
|
||||
size_t to_col = strnlenpt(openfile->current->data,
|
||||
spotlighted = TRUE;
|
||||
light_from_col = xplustabs();
|
||||
light_to_col = strnlenpt(openfile->current->data,
|
||||
openfile->current_x + match_len);
|
||||
|
||||
/* Refresh the edit window, scrolling it if necessary. */
|
||||
edit_refresh();
|
||||
|
||||
spotlight(TRUE, from_col, to_col);
|
||||
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
i = do_yesno_prompt(TRUE, _("Replace this instance?"));
|
||||
choice = do_yesno_prompt(TRUE, _("Replace this instance?"));
|
||||
|
||||
spotlight(FALSE, from_col, to_col);
|
||||
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;
|
||||
|
||||
@@ -706,7 +680,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();
|
||||
|
||||
@@ -716,29 +690,21 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
/* Replace a string. */
|
||||
void do_replace(void)
|
||||
{
|
||||
filestruct *edittop_save, *begin;
|
||||
if (ISSET(VIEW_MODE))
|
||||
print_view_warning();
|
||||
else {
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
search_init(TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ask the user what the already given search string should be replaced with. */
|
||||
void ask_for_replacement(void)
|
||||
{
|
||||
linestruct *edittop_save, *begin;
|
||||
size_t firstcolumn_save, begin_x;
|
||||
ssize_t numreplaced;
|
||||
int i;
|
||||
|
||||
if (ISSET(VIEW_MODE)) {
|
||||
print_view_warning();
|
||||
return;
|
||||
}
|
||||
|
||||
i = search_init(TRUE, FALSE);
|
||||
|
||||
if (i == -1) /* Cancelled, or some other exit reason. */
|
||||
search_replace_abort();
|
||||
else if (i == -2) /* Do a search instead. */
|
||||
do_search();
|
||||
else if (i == 1) /* Toggled something. */
|
||||
do_replace();
|
||||
|
||||
if (i != 0)
|
||||
return;
|
||||
|
||||
i = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL, &replace_history,
|
||||
int i = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL, &replace_history,
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
edit_refresh, _("Replace with"));
|
||||
|
||||
@@ -752,7 +718,6 @@ void do_replace(void)
|
||||
if (i == -1 || i > 0) {
|
||||
if (i == -1)
|
||||
statusbar(_("Cancelled"));
|
||||
search_replace_abort();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -774,14 +739,12 @@ void do_replace(void)
|
||||
if (numreplaced >= 0)
|
||||
statusline(HUSH, P_("Replaced %zd occurrence",
|
||||
"Replaced %zd occurrences", numreplaced), numreplaced);
|
||||
|
||||
search_replace_abort();
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
@@ -798,8 +761,6 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
bool interactive)
|
||||
{
|
||||
if (interactive) {
|
||||
functionptrtype func;
|
||||
|
||||
/* Ask for the line and column. */
|
||||
int i = do_prompt(FALSE, FALSE, MGOTOLINE,
|
||||
use_answer ? answer : NULL, NULL,
|
||||
@@ -812,12 +773,11 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
return;
|
||||
}
|
||||
|
||||
func = func_from_key(&i);
|
||||
|
||||
if (func == gototext_void) {
|
||||
if (func_from_key(&i) == flip_goto) {
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
/* Retain what the user typed so far and switch to searching. */
|
||||
search_init(TRUE, TRUE);
|
||||
do_search();
|
||||
search_init(FALSE, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If a function was executed, we're done here. */
|
||||
@@ -844,7 +804,7 @@ 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;
|
||||
|
||||
@@ -873,11 +833,11 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
filestruct *line = openfile->current;
|
||||
linestruct *currentline = openfile->current;
|
||||
size_t leftedge = leftedge_for(xplustabs(), openfile->current);
|
||||
|
||||
rows_from_tail = (editwinrows / 2) -
|
||||
go_forward_chunks(editwinrows / 2, &line, &leftedge);
|
||||
rows_from_tail = (editwinrows / 2) - go_forward_chunks(
|
||||
editwinrows / 2, ¤tline, &leftedge);
|
||||
} else
|
||||
#endif
|
||||
rows_from_tail = openfile->filebot->lineno -
|
||||
@@ -886,7 +846,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
|
||||
@@ -902,58 +862,53 @@ void do_gotolinecolumn_void(void)
|
||||
}
|
||||
|
||||
#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. */
|
||||
/* Search, starting from the current position, for any of the two characters
|
||||
* in bracket_set. If reverse is TRUE, search backwards, otherwise forwards.
|
||||
* Return TRUE when one of the brackets was found, and FALSE otherwise. */
|
||||
bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
{
|
||||
filestruct *fileptr = openfile->current;
|
||||
const char *rev_start = NULL, *found = NULL;
|
||||
linestruct *line = openfile->current;
|
||||
const char *pointer = line->data + openfile->current_x;
|
||||
const char *found = NULL;
|
||||
|
||||
assert(mbstrlen(bracket_set) == 2);
|
||||
/* Step away from the current bracket, either backwards or forwards. */
|
||||
if (reverse) {
|
||||
if (--pointer < line->data) {
|
||||
line = line->prev;
|
||||
if (line == NULL)
|
||||
return FALSE;
|
||||
pointer = line->data + strlen(line->data);
|
||||
}
|
||||
} else
|
||||
++pointer;
|
||||
|
||||
/* 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_set, pointer);
|
||||
else
|
||||
found = mbstrpbrk(rev_start, bracket_set);
|
||||
found = mbstrpbrk(pointer, bracket_set);
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -962,73 +917,52 @@ 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];
|
||||
/* 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 += parse_mbchar(matchbrackets + halfway, NULL, NULL);
|
||||
|
||||
/* 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);
|
||||
else
|
||||
wanted_ch += move_mbright(wanted_ch, 0);
|
||||
|
||||
mbmatchhalf--;
|
||||
}
|
||||
|
||||
ch_len = parse_mbchar(ch, NULL, NULL);
|
||||
@@ -1041,23 +975,23 @@ void do_find_bracket(void)
|
||||
|
||||
while (TRUE) {
|
||||
if (find_bracket_match(reverse, bracket_set)) {
|
||||
/* If we found an identical bracket, increment count. If we
|
||||
/* If we found an identical bracket, increment balance. If we
|
||||
* found a complementary bracket, decrement it. */
|
||||
count += (strncmp(openfile->current->data + openfile->current_x,
|
||||
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
|
||||
/* If balance is zero, we've found a matching bracket. Update
|
||||
* the screen and get out. */
|
||||
if (count == 0) {
|
||||
edit_redraw(current_save, FLOWING);
|
||||
if (balance == 0) {
|
||||
edit_redraw(was_current, 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;
|
||||
openfile->current = was_current;
|
||||
openfile->current_x = was_current_x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
2983
src/text.c
2983
src/text.c
File diff suppressed because it is too large
Load Diff
128
src/utils.c
128
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 *
|
||||
@@ -48,7 +48,7 @@ void get_homedir(void)
|
||||
|
||||
/* Only set homedir if some home directory could be determined,
|
||||
* otherwise keep homedir NULL. */
|
||||
if (homenv != NULL && strcmp(homenv, "") != 0)
|
||||
if (homenv != NULL && *homenv != '\0')
|
||||
homedir = mallocstrcpy(NULL, homenv);
|
||||
}
|
||||
}
|
||||
@@ -159,20 +159,6 @@ 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 **str)
|
||||
{
|
||||
if (*str != NULL)
|
||||
*str = charealloc(*str, strlen(*str) + 1);
|
||||
}
|
||||
|
||||
/* Null a string at a certain index and align it. */
|
||||
void null_at(char **data, size_t index)
|
||||
{
|
||||
*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)
|
||||
@@ -207,37 +193,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?*/
|
||||
@@ -266,13 +221,6 @@ bool is_separate_word(size_t position, size_t length, const char *buf)
|
||||
const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *start)
|
||||
{
|
||||
if (*needle == '\0') {
|
||||
#ifndef NANO_TINY
|
||||
statusline(ALERT, "Searching for nothing -- please report a bug");
|
||||
#endif
|
||||
return (char *)start;
|
||||
}
|
||||
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
size_t last_find, ceiling, far_end;
|
||||
@@ -325,15 +273,18 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
else
|
||||
return haystack + regmatches[0].rm_so;
|
||||
}
|
||||
|
||||
if (ISSET(CASE_SENSITIVE)) {
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
return revstrstr(haystack, needle, start);
|
||||
else
|
||||
return strstr(start, needle);
|
||||
} else if (ISSET(BACKWARDS_SEARCH))
|
||||
return mbrevstrcasestr(haystack, needle, start);
|
||||
}
|
||||
|
||||
return mbstrcasestr(start, needle);
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
return mbrevstrcasestr(haystack, needle, start);
|
||||
else
|
||||
return mbstrcasestr(start, needle);
|
||||
}
|
||||
|
||||
/* This is a wrapper for the perror() function. The wrapper temporarily
|
||||
@@ -354,7 +305,7 @@ void *nmalloc(size_t howmuch)
|
||||
void *r = malloc(howmuch);
|
||||
|
||||
if (r == NULL && howmuch != 0)
|
||||
die(_("nano is out of memory!"));
|
||||
die(_("Nano is out of memory!\n"));
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -366,7 +317,7 @@ void *nrealloc(void *ptr, size_t howmuch)
|
||||
void *r = realloc(ptr, howmuch);
|
||||
|
||||
if (r == NULL && howmuch != 0)
|
||||
die(_("nano is out of memory!"));
|
||||
die(_("Nano is out of memory!\n"));
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -378,10 +329,7 @@ char *mallocstrncpy(char *dest, const char *src, size_t n)
|
||||
if (src == NULL)
|
||||
src = "";
|
||||
|
||||
if (src != dest)
|
||||
free(dest);
|
||||
|
||||
dest = charalloc(n);
|
||||
dest = charealloc(dest, n);
|
||||
strncpy(dest, src, n);
|
||||
|
||||
return dest;
|
||||
@@ -408,10 +356,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);
|
||||
}
|
||||
@@ -455,7 +403,7 @@ size_t strnlenpt(const char *text, size_t maxlen)
|
||||
return 0;
|
||||
|
||||
while (*text != '\0') {
|
||||
int charlen = parse_mbchar(text, NULL, &width);
|
||||
size_t charlen = parse_mbchar(text, NULL, &width);
|
||||
|
||||
if (maxlen <= charlen)
|
||||
break;
|
||||
@@ -478,7 +426,7 @@ size_t strlenpt(const char *text)
|
||||
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);
|
||||
@@ -488,14 +436,14 @@ void new_magicline(void)
|
||||
}
|
||||
|
||||
#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);
|
||||
free_lines(openfile->filebot->next);
|
||||
openfile->filebot->next = NULL;
|
||||
openfile->totsize--;
|
||||
}
|
||||
@@ -506,8 +454,8 @@ void remove_magicline(void)
|
||||
/* 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)
|
||||
void mark_order(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) ||
|
||||
@@ -531,7 +479,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;
|
||||
@@ -549,9 +497,9 @@ 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)
|
||||
linestruct *fsfromline(ssize_t lineno)
|
||||
{
|
||||
filestruct *f = openfile->current;
|
||||
linestruct *f = openfile->current;
|
||||
|
||||
if (lineno <= openfile->current->lineno)
|
||||
while (f->lineno != lineno && f->prev != NULL)
|
||||
@@ -560,19 +508,17 @@ filestruct *fsfromline(ssize_t lineno)
|
||||
while (f->lineno != lineno && f->next != NULL)
|
||||
f = f->next;
|
||||
|
||||
if (f->lineno != lineno) {
|
||||
statusline(ALERT, "Gone undo line -- please report a bug");
|
||||
if (f->lineno == lineno)
|
||||
return f;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
#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. */
|
||||
@@ -586,21 +532,3 @@ size_t get_totsize(const filestruct *begin, const filestruct *end)
|
||||
|
||||
return totsize;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Dump the given buffer to stderr. */
|
||||
void dump_filestruct(const filestruct *inptr)
|
||||
{
|
||||
if (inptr == openfile->fileage)
|
||||
fprintf(stderr, "Dumping file buffer to stderr...\n");
|
||||
else if (inptr == cutbuffer)
|
||||
fprintf(stderr, "Dumping cutbuffer to stderr...\n");
|
||||
else
|
||||
fprintf(stderr, "Dumping a buffer to stderr...\n");
|
||||
|
||||
while (inptr != NULL) {
|
||||
fprintf(stderr, "(%zd) %s\n", inptr->lineno, inptr->data);
|
||||
inptr = inptr->next;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
665
src/winio.c
665
src/winio.c
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
## Here is an example for assembler.
|
||||
|
||||
syntax "asm" "\.(S|s|asm)$"
|
||||
syntax asm "\.(S|s|asm)$"
|
||||
magic "assembler source"
|
||||
comment "//"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for Autoconf.
|
||||
|
||||
syntax "autoconf" "\.(ac|m4)$"
|
||||
syntax autoconf "\.(ac|m4)$"
|
||||
comment "#"
|
||||
|
||||
# Keywords:
|
||||
@@ -20,7 +20,7 @@ color red "\"[^"]*\"" "\'[^']*\'"
|
||||
color green "`[^`]*`"
|
||||
|
||||
# Error lines:
|
||||
color brightred "^\*\*\*.*"
|
||||
color brightred "^[[:space:]]*\*\*\*.*"
|
||||
|
||||
# Brackets:
|
||||
color magenta "\[|\]|\(|\)"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for awk.
|
||||
|
||||
syntax "awk" "\.awk$"
|
||||
syntax awk "\.awk$"
|
||||
header "^#!.*awk"
|
||||
magic "awk script"
|
||||
comment "#"
|
||||
|
||||
@@ -18,8 +19,7 @@ color green "(\{|\}|\(|\)|\;|\]|\[|\\|<|>|!|=|&|\+|-|\*|%|/|\?:|\^|\|)"
|
||||
color brightyellow "\<(for|if|while|do|else|in|delete|exit)\>"
|
||||
color brightyellow "\<(break|continue|return)\>"
|
||||
# I/O statements.
|
||||
color brightgreen "\<(close|getline|next|nextfile|print|printf)\>"
|
||||
color brightgreen "\<(system|fflush)\>"
|
||||
color brightgreen "\<(close|fflush|getline|next|nextfile|print|printf|system)\>"
|
||||
# Standard functions.
|
||||
color magenta "\<(atan2|cos|exp|int|log|rand|sin|sqrt|srand)\>"
|
||||
color magenta "\<(asort|asorti|gensub|gsub|index|length|match)\>"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for C/C++.
|
||||
|
||||
syntax "c" "\.(c(c|pp|xx|\+\+)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$"
|
||||
syntax c "\.([ch](pp|xx)?|C|cc|c\+\+|H|hh|ii?)$"
|
||||
magic "^(C|C\+\+) (source|program)"
|
||||
comment "//"
|
||||
|
||||
@@ -10,12 +10,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:]]+|(u_?)?int(8|16|32|64|ptr))_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 +22,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="\*/"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
## Colouring for Changelogs.
|
||||
|
||||
syntax "changelog" "Change[Ll]og.*"
|
||||
syntax changelog "Change[Ll]og[^/]*$"
|
||||
|
||||
# Author lines.
|
||||
color green "^(19|20).*$"
|
||||
color green "^(19|20).*"
|
||||
# Dates.
|
||||
color red "^(19|20)[0-9-]{8}"
|
||||
# Email addresses.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Syntax highlighting for CMake files.
|
||||
|
||||
syntax "cmake" "(CMakeLists\.txt|\.cmake)$"
|
||||
syntax cmake "(CMakeLists\.txt|\.cmake)$"
|
||||
comment "#"
|
||||
|
||||
icolor green "^[[:space:]]*[A-Z0-9_]+"
|
||||
@@ -15,6 +15,5 @@ icolor brightred "^[[:space:]]*((end)?(function|macro)|return)"
|
||||
icolor cyan start="\$(\{|ENV\{)" end="\}"
|
||||
color magenta "\<(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\>"
|
||||
|
||||
icolor brightblue "^([[:space:]]*)?#.*"
|
||||
icolor brightblue "[[:space:]]#.*"
|
||||
color brightblue "(^|[[:space:]])#.*"
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for CSS files.
|
||||
|
||||
syntax "css" "\.css$"
|
||||
syntax css "\.css$"
|
||||
comment "/*|*/"
|
||||
|
||||
color brightred "."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for apt's sources.list.
|
||||
|
||||
syntax "sources.list" "sources\.list(~|\.old|\.save)?$" "sources\.list\.d/.*\.list(~|\.old|\.save)?$"
|
||||
syntax sources.list "sources\.list(\.d/.*\.list)?(~|\.old|\.save)?$"
|
||||
comment "#"
|
||||
|
||||
# Coloring the deb lines, working from tail to head. First the
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## An example of a default syntax. The default syntax is used for
|
||||
## files that do not match any other syntax.
|
||||
|
||||
syntax "default"
|
||||
syntax default
|
||||
comment "#"
|
||||
|
||||
# Comments.
|
||||
@@ -11,7 +11,7 @@ color cyan "^[[:space:]]*#.*"
|
||||
color ,red " + +"
|
||||
|
||||
# Nano's name, including version.
|
||||
color brightred "(GNU )?nano [1-9]\.[0-9]\.[^[:space:][:punct:]]+"
|
||||
color brightred "(GNU )?[Nn]ano [1-4]\.[0-9][-.[:alnum:]]*\>"
|
||||
|
||||
# Email addresses.
|
||||
color magenta "<[[:alnum:].%_+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,}>"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for Emacs Lisp.
|
||||
|
||||
syntax "elisp" "\.el$"
|
||||
syntax elisp "\.el$"
|
||||
magic "Lisp/Scheme program"
|
||||
comment ";"
|
||||
|
||||
@@ -30,4 +30,4 @@ color blue ":(\w|[?-])+"
|
||||
color yellow start="^[[:blank:]]+\"" end="[^\]\""
|
||||
color yellow ""(\\.|[^"])*""
|
||||
# Comments
|
||||
color cyan "(^|[[:space:]]);.*$"
|
||||
color cyan "(^|[[:space:]]);.*"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for Fortran 90/95.
|
||||
|
||||
syntax "fortran" "\.(f|f90|f95)$"
|
||||
syntax fortran "\.(f|f90|f95)$"
|
||||
comment "!"
|
||||
|
||||
color red "\<[0-9]+\>"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## Here is an example for Gentoo ebuilds/eclasses,
|
||||
## and (further down) one for Portage control files.
|
||||
|
||||
syntax "ebuild" "\.e(build|class|blit)$"
|
||||
syntax ebuild "\.e(build|class|blit)$"
|
||||
comment "#"
|
||||
|
||||
## All the standard portage functions:
|
||||
@@ -39,7 +39,7 @@ color brightblue "\<tc-(arch(-kernel)?|export|has-(tls|openmp))\>"
|
||||
## Common commands used in ebuilds:
|
||||
color blue "\<(awk|cat|cd|chmod|chown|cp|echo|env|find|e?grep|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|tar|touch|unset|xargs)\>"
|
||||
## Comments (doesn't work that well):
|
||||
color yellow "(^|[[:space:]])#.*$"
|
||||
color yellow "(^|[[:space:]])#.*"
|
||||
## Strings (doesn't work that well):
|
||||
color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
|
||||
## Trailing space is bad!
|
||||
@@ -48,11 +48,11 @@ color ,green "[[:space:]]+$"
|
||||
color ,green " "
|
||||
|
||||
|
||||
syntax "/etc/portage" "\.(accept_keywords|env|keywords|mask|unmask|use)(/.+)?$"
|
||||
syntax /etc/portage "\.(accept_keywords|env|keywords|mask|unmask|use)(/.+)?$"
|
||||
comment "#"
|
||||
|
||||
## Base text:
|
||||
color green "^.+$"
|
||||
color green ".+"
|
||||
## Likely version and slot numbers:
|
||||
color magenta "-[[:digit:].]+(_(alpha|beta|pre|rc|p)[[:digit:]]*)*(-r[[:digit:]]+)?([:[:space:]]|$)"
|
||||
color magenta ":[^[:space:]]+([[:space:]]|$)"
|
||||
@@ -67,7 +67,7 @@ color cyan "^[[:space:]]*[^/]*/"
|
||||
## Masking regulators:
|
||||
color brightmagenta "^[[:space:]]*(=|~|<|<=|>|>=)"
|
||||
## Comments:
|
||||
color yellow "#.*$"
|
||||
color yellow "#.*"
|
||||
## Trailing space is bad!
|
||||
color ,green "[[:space:]]+$"
|
||||
## Mixed whitespace is also bad.
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
## Here is an example for Go.
|
||||
|
||||
syntax "go" "\.go$"
|
||||
syntax go "\.go$"
|
||||
comment "//"
|
||||
|
||||
# Set up a formatter since spelling is probably useless...
|
||||
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)\>"
|
||||
@@ -24,9 +21,11 @@ color brightcyan "\<(package|import)\>"
|
||||
color brightcyan "//[[:space:]]*\+build[[:space:]]+(([a-zA-Z_0-9]+[[:space:]]*)+,[[:space:]]*)*[a-zA-Z_0-9]+"
|
||||
|
||||
# Literals.
|
||||
color red "\<0([0-7]*|[xX][0-9a-fA-F]+)\>"
|
||||
color red "(\<0+|\B)\.[0-9]+([Ee][+-]?[0-9]+)?i?\>"
|
||||
color red "\<[1-9][0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?i?\>"
|
||||
color red "\<([1-9][0-9]*|0[0-7]*|0[xX][0-9A-Fa-f]+)\>"
|
||||
color red "\<[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?i?\>"
|
||||
color red "\<[0-9]+[eE][+-]?[0-9]+i?\>"
|
||||
color red "\B\.[0-9]+([eE][+-]?[0-9]+)?i?\>"
|
||||
color red "\<[0-9]+i\>"
|
||||
|
||||
# Strings and characters; slightly fuzzy.
|
||||
color red "\<(true|false|nil|iota|_)\>"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for groff.
|
||||
|
||||
syntax "groff" "\.m[ems]$" "\.rof" "\.tmac$" "^tmac."
|
||||
syntax groff "(/tmac\.[^/]+$|\.(m[ems]|rof|tmac)$)"
|
||||
comment ".\""
|
||||
|
||||
# The argument of .ds or .nr
|
||||
@@ -15,7 +15,7 @@ color cyan start="(\\|\\\\)n\[" end="]"
|
||||
# Requests
|
||||
color brightgreen "^\.[[:space:]]*[^[:space:]]*"
|
||||
# Comments
|
||||
color yellow "^\.\\".*$"
|
||||
color yellow "^\.\\".*"
|
||||
# Strings
|
||||
color green "(\\|\\\\)\*(.|\(..)"
|
||||
color green start="(\\|\\\\)\*\[" end="]"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for Guile Scheme.
|
||||
|
||||
syntax "guile" "\.scm$"
|
||||
syntax guile "\.scm$"
|
||||
header "^#!.*guile"
|
||||
comment ";"
|
||||
|
||||
@@ -21,4 +21,4 @@ color blue "#?:(\w|[?-])+"
|
||||
color yellow start="^[[:blank:]]+\"" end="[^\]\""
|
||||
color yellow ""(\\.|[^"])*""
|
||||
# Comments
|
||||
color cyan "(^|[[:space:]]);.*$"
|
||||
color cyan "(^|[[:space:]]);.*"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for HTML.
|
||||
|
||||
syntax "html" "\.html?$"
|
||||
syntax html "\.html?$"
|
||||
magic "HTML document"
|
||||
comment "<!--|-->"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for Java.
|
||||
|
||||
syntax "java" "\.java$"
|
||||
syntax java "\.java$"
|
||||
magic "Java "
|
||||
comment "//"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Syntax highlighting for Javascript.
|
||||
|
||||
syntax "javascript" "\.js$"
|
||||
syntax javascript "\.js$"
|
||||
comment "//"
|
||||
|
||||
# Declarational stuff.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Original author: Aapo Rantalainen
|
||||
# License: GPLv3 or newer
|
||||
|
||||
syntax "json" "\.json$"
|
||||
syntax json "\.json$"
|
||||
# No comments are permitted in JSON.
|
||||
comment ""
|
||||
|
||||
@@ -28,7 +28,7 @@ color brightred "\{" "\}"
|
||||
color brightred "," ":"
|
||||
|
||||
# Comments.
|
||||
color cyan "(^|[[:space:]]+)(//|#).*$"
|
||||
color cyan "(^|[[:space:]]+)(//|#).*"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -3,14 +3,17 @@
|
||||
## Original author: Matthew Wild <mwild1 (at) gmail.com>
|
||||
## License: GPL 3 or later
|
||||
|
||||
syntax "lua" "\.lua$"
|
||||
syntax lua "\.lua$"
|
||||
magic "Lua script"
|
||||
linter "luacheck --no-color"
|
||||
comment "--"
|
||||
|
||||
color brightwhite "\[\[.*\]\]"
|
||||
|
||||
# Operators
|
||||
color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
|
||||
color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|#|\<(not|and|or)\>"
|
||||
# Don't partially color ... as an operator
|
||||
color normal "\.\.\."
|
||||
|
||||
# Statements
|
||||
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|break)\>"
|
||||
@@ -49,9 +52,9 @@ color brightmagenta "\(|\)|\[|\]|\{|\}"
|
||||
# Shebang
|
||||
color brightcyan "^#!.*"
|
||||
|
||||
# Strings
|
||||
color red ""(\\.|[^"\])*"|'(\\.|[^'\])*'"
|
||||
|
||||
# Simple comments and multiline comments
|
||||
color green "--.*"
|
||||
color green start="--\[\[" end="\]\]"
|
||||
|
||||
# Strings
|
||||
color red ""(\\.|[^"\])*"|'(\\.|[^'\])*'"
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
## Here is an example for Makefiles.
|
||||
|
||||
syntax "makefile" "Makefile[^/]*$" "\.(make|mk)$"
|
||||
syntax makefile "(/((GNU)?m|M)akefile[^/]*$|\.(make|mk)$)"
|
||||
magic "makefile script"
|
||||
comment "#"
|
||||
|
||||
color red "[:=]"
|
||||
color magenta "\<(if|ifeq|else|endif)\>"
|
||||
# Assignments.
|
||||
color red " (:?:|\+|\?)?= "
|
||||
|
||||
# Keywords.
|
||||
color magenta "^(if|ifn?def|ifn?eq|else|endif|(-|s)?include)\>"
|
||||
color magenta "^((override +)?(un)?define|endef|(un)?export|private|vpath)\>"
|
||||
|
||||
# Variable expansions.
|
||||
color blue "\$+[{(][a-zA-Z0-9_-]+[})]"
|
||||
|
||||
# Targets.
|
||||
color brightblue "^[^ ]+:"
|
||||
|
||||
# Comments.
|
||||
color green "(^|[[:space:]]+)#.*"
|
||||
|
||||
## Trailing whitespace.
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
## Here is an example for manpages.
|
||||
## Syntax highlighting for man pages.
|
||||
|
||||
syntax "man" "\.[1-9]x?$"
|
||||
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:]]+$"
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
## Here is an example for Magicpoint presentations.
|
||||
|
||||
syntax "mgp" "\.mgp$"
|
||||
syntax mgp "\.mgp$"
|
||||
header "^%include.*"
|
||||
comment "#"
|
||||
|
||||
icolor green "^%[a-z].*$"
|
||||
color cyan "(^|[[:space:]])#.*$"
|
||||
color cyan "(^|[[:space:]])%%.*$"
|
||||
icolor green "^%[a-z].*"
|
||||
color cyan "(^|[[:space:]])(#|%%).*"
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for quoted emails (under e.g. mutt).
|
||||
|
||||
syntax "mutt"
|
||||
syntax mutt
|
||||
|
||||
# Quoted lines.
|
||||
color green "^>.*"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user