Compare commits
461 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8d2f552bd | ||
|
|
f2ae08ab19 | ||
|
|
325d774393 | ||
|
|
0856f53703 | ||
|
|
7f0bfdfeb2 | ||
|
|
51371e0ca5 | ||
|
|
3bd66b78c1 | ||
|
|
5ea6054a75 | ||
|
|
04738996fc | ||
|
|
07a9477213 | ||
|
|
a5b48f9a0d | ||
|
|
d141e849a3 | ||
|
|
da68ee19e7 | ||
|
|
8b2f7bd5a2 | ||
|
|
6119756347 | ||
|
|
06c80b6ccd | ||
|
|
7ce1f6d86d | ||
|
|
88087f2b2f | ||
|
|
16c4f5bbd0 | ||
|
|
e877c2406e | ||
|
|
b6a1583e8e | ||
|
|
48df800db3 | ||
|
|
ee05daab92 | ||
|
|
74f4c37d5f | ||
|
|
3f5ba950d6 | ||
|
|
0a52e92d4c | ||
|
|
7c57806c6f | ||
|
|
a2f8703df5 | ||
|
|
073251fdb1 | ||
|
|
5a0ee3c2f9 | ||
|
|
6bd5dce954 | ||
|
|
f25059c244 | ||
|
|
856f2c433e | ||
|
|
38c5a4465b | ||
|
|
f494bfcbb9 | ||
|
|
b856fc4664 | ||
|
|
faa96ead44 | ||
|
|
26444bf8df | ||
|
|
4eaade2938 | ||
|
|
662e8b2d20 | ||
|
|
4502295a34 | ||
|
|
25b0bf0ae8 | ||
|
|
f6b6bc47d6 | ||
|
|
a692b01c04 | ||
|
|
a197ccf12d | ||
|
|
67e5913edf | ||
|
|
e864107046 | ||
|
|
7984ea4eb6 | ||
|
|
f38bd5030d | ||
|
|
a2fea9928d | ||
|
|
c64f506933 | ||
|
|
445cd2a6c5 | ||
|
|
fb073ec88d | ||
|
|
c09e96f294 | ||
|
|
0b54785fe5 | ||
|
|
8835c0d486 | ||
|
|
0442eef95b | ||
|
|
6ae11071b3 | ||
|
|
3c177c1bb9 | ||
|
|
e0213b1a41 | ||
|
|
e70ff87c86 | ||
|
|
db10a421dc | ||
|
|
5725336149 | ||
|
|
b8ba27bbc0 | ||
|
|
e3f6638a76 | ||
|
|
f8553f6d3a | ||
|
|
a78da18aa4 | ||
|
|
d764d7094f | ||
|
|
2651554721 | ||
|
|
fa686457c2 | ||
|
|
a65f0ec80c | ||
|
|
e01e1d8ab5 | ||
|
|
58597b6d9b | ||
|
|
196e913681 | ||
|
|
620553b795 | ||
|
|
6df50790cd | ||
|
|
6cd98e32f7 | ||
|
|
f9baa4de71 | ||
|
|
1cd5005d06 | ||
|
|
f7a3b996fa | ||
|
|
ea874112d8 | ||
|
|
25d397e7b3 | ||
|
|
5111b20bf5 | ||
|
|
f571d6ba36 | ||
|
|
0e21baf611 | ||
|
|
1e78881a70 | ||
|
|
077d307b30 | ||
|
|
998992ddcb | ||
|
|
0ff9499583 | ||
|
|
eb1668ce81 | ||
|
|
54b97a6f03 | ||
|
|
5e48c36877 | ||
|
|
9e3fca4021 | ||
|
|
5130c35b85 | ||
|
|
e01651cde1 | ||
|
|
12cf1c9980 | ||
|
|
092711e412 | ||
|
|
0e6d693dc8 | ||
|
|
aac3126183 | ||
|
|
63cddceeaa | ||
|
|
486d4956ff | ||
|
|
7567a67cdd | ||
|
|
c4939c76a5 | ||
|
|
04e557fdaf | ||
|
|
7dcc8f1d7a | ||
|
|
343f97b3ac | ||
|
|
706f3e93f4 | ||
|
|
f47ef539db | ||
|
|
2148e857e5 | ||
|
|
afa4c6b9fc | ||
|
|
27127853db | ||
|
|
a81ba0215a | ||
|
|
3e0bd533db | ||
|
|
e8d20a8e4b | ||
|
|
6896d8df47 | ||
|
|
8455251c35 | ||
|
|
5cf351913e | ||
|
|
416386edcd | ||
|
|
497f126bb2 | ||
|
|
4687322398 | ||
|
|
99f0265d34 | ||
|
|
7b0b9a12ea | ||
|
|
7d483987ce | ||
|
|
f705a9674b | ||
|
|
3233e9cfe0 | ||
|
|
5a98a51173 | ||
|
|
2eaba21a4c | ||
|
|
9a227de3e7 | ||
|
|
3f57200e10 | ||
|
|
1486f32d42 | ||
|
|
e3edce4e7b | ||
|
|
0e559c5bbc | ||
|
|
edfbfbfd0a | ||
|
|
a4eae770ce | ||
|
|
72e5c15110 | ||
|
|
97c8140cea | ||
|
|
c5b03ca4ae | ||
|
|
c2f2c659d9 | ||
|
|
9364bd6c81 | ||
|
|
baa2be3217 | ||
|
|
12742586e5 | ||
|
|
194620c5f0 | ||
|
|
67d37adf98 | ||
|
|
3f0d2fd5ca | ||
|
|
5b07e5fd1f | ||
|
|
3cae32390d | ||
|
|
1be0285832 | ||
|
|
2867f1bbde | ||
|
|
c4d2bf59fb | ||
|
|
5527883c43 | ||
|
|
ade93ccf25 | ||
|
|
84b305f3f0 | ||
|
|
67b89459d5 | ||
|
|
6d916c6c4a | ||
|
|
87542eeaf1 | ||
|
|
29f2e3181a | ||
|
|
8255696b45 | ||
|
|
fc00e89499 | ||
|
|
55946c15e7 | ||
|
|
2e539e2c97 | ||
|
|
38c286c019 | ||
|
|
56d842258c | ||
|
|
8ed8ab69d5 | ||
|
|
4dcbd40c49 | ||
|
|
72645b160d | ||
|
|
dda1b167c9 | ||
|
|
074cf40409 | ||
|
|
6c09504040 | ||
|
|
4991b3bb1a | ||
|
|
075b7e75bc | ||
|
|
c00431134f | ||
|
|
51065ff24b | ||
|
|
4314feae11 | ||
|
|
410280b089 | ||
|
|
178dd9181f | ||
|
|
d30ca576b7 | ||
|
|
ed520c89bc | ||
|
|
cb44a2bd2c | ||
|
|
a0055f3640 | ||
|
|
b00c1d6110 | ||
|
|
594ef2225f | ||
|
|
9631e858f2 | ||
|
|
26d88ccbb1 | ||
|
|
413b9cb774 | ||
|
|
d3a8d81afb | ||
|
|
e16026eacd | ||
|
|
90f18af8bd | ||
|
|
011e8de480 | ||
|
|
4e8afb2877 | ||
|
|
c7ad5c8d86 | ||
|
|
0b1a766964 | ||
|
|
a7e11495bd | ||
|
|
b56db25a35 | ||
|
|
e3957ee5ee | ||
|
|
2a73b4a050 | ||
|
|
ef7c78910c | ||
|
|
772f1029e5 | ||
|
|
3251a216cd | ||
|
|
00b0316ab8 | ||
|
|
76d90617cc | ||
|
|
f516cddce7 | ||
|
|
60b826e5ee | ||
|
|
fc0fcdea10 | ||
|
|
1dd7b216a0 | ||
|
|
87bf46ffb6 | ||
|
|
a921bdadbf | ||
|
|
0271e4a187 | ||
|
|
076eb6f6af | ||
|
|
e484918ef2 | ||
|
|
fdf095c32f | ||
|
|
81402101d9 | ||
|
|
154742c5e3 | ||
|
|
ec569b4bd0 | ||
|
|
38743b0016 | ||
|
|
68c3aaf2df | ||
|
|
2a97cb9f41 | ||
|
|
af8ffa8c94 | ||
|
|
3ffefbfddc | ||
|
|
8637acb106 | ||
|
|
51a3f78d69 | ||
|
|
4d77e0adbb | ||
|
|
2b8a73348c | ||
|
|
576502a5c5 | ||
|
|
ec9a11c761 | ||
|
|
1c63bf0e38 | ||
|
|
4aa1678f3b | ||
|
|
c60d3bbb97 | ||
|
|
90d4b51837 | ||
|
|
302ea79d1c | ||
|
|
ebeed9c013 | ||
|
|
75dd9bee38 | ||
|
|
9151abcd45 | ||
|
|
3258bb0ff4 | ||
|
|
3f3698640b | ||
|
|
432388b23e | ||
|
|
bad618e537 | ||
|
|
7ae305fdc0 | ||
|
|
7d4f279c04 | ||
|
|
f230c46e5e | ||
|
|
bc5a225678 | ||
|
|
493b334ebb | ||
|
|
7d54207627 | ||
|
|
458933f09e | ||
|
|
2b49a19793 | ||
|
|
fc716156a4 | ||
|
|
2b9f06194f | ||
|
|
631defb8b2 | ||
|
|
a6dae403e6 | ||
|
|
b4dbbe3799 | ||
|
|
4281b6becb | ||
|
|
34b1824822 | ||
|
|
b025f67805 | ||
|
|
40f8ca0d07 | ||
|
|
aae752912e | ||
|
|
3c695664ec | ||
|
|
8a7634f070 | ||
|
|
fa88fcc8f2 | ||
|
|
c2d8641f01 | ||
|
|
3d5e51bcd0 | ||
|
|
95ae124891 | ||
|
|
1a8646393a | ||
|
|
054559dc93 | ||
|
|
fdeab9b4c9 | ||
|
|
f26c121ca9 | ||
|
|
17c16a4bf5 | ||
|
|
46566572d6 | ||
|
|
b4a5fac744 | ||
|
|
f816da413a | ||
|
|
3a0ac428ba | ||
|
|
97ab28a164 | ||
|
|
ccb739dd7d | ||
|
|
1082f2adec | ||
|
|
042b8394a0 | ||
|
|
f2d6e6fa5e | ||
|
|
5390f96900 | ||
|
|
50ed18be17 | ||
|
|
a6365707c0 | ||
|
|
6fad6a17da | ||
|
|
eb757e7c5b | ||
|
|
b554606047 | ||
|
|
e915fb1650 | ||
|
|
4e40ec057e | ||
|
|
bd0026be86 | ||
|
|
a1bef0e953 | ||
|
|
f5693d4151 | ||
|
|
e3807f00a2 | ||
|
|
022cc084a7 | ||
|
|
0f98466e2f | ||
|
|
40c067133a | ||
|
|
36270748dc | ||
|
|
1894c81412 | ||
|
|
e917ef0105 | ||
|
|
3347682fd0 | ||
|
|
7c5b104859 | ||
|
|
3b9a24a7ca | ||
|
|
7d3290fb91 | ||
|
|
df0ae2ace5 | ||
|
|
bc91af2e3c | ||
|
|
48b94d71c7 | ||
|
|
f14be47878 | ||
|
|
c51f5f4bff | ||
|
|
7f8851caa8 | ||
|
|
bfdc31fbb4 | ||
|
|
69d2045c9f | ||
|
|
c63f4c1f58 | ||
|
|
b8dc8d4a37 | ||
|
|
8749ccb469 | ||
|
|
b5c5cde0d4 | ||
|
|
d8c03cd4cd | ||
|
|
1536a76ced | ||
|
|
d2fb371fe2 | ||
|
|
34170611d3 | ||
|
|
23c36ba667 | ||
|
|
31d5cb1118 | ||
|
|
f551c07e7a | ||
|
|
2656f543f4 | ||
|
|
ba79602281 | ||
|
|
094758be15 | ||
|
|
06bbc70d4a | ||
|
|
d256d0cbc0 | ||
|
|
ab6635c3a6 | ||
|
|
416ad4c5fd | ||
|
|
0374708597 | ||
|
|
101987f5c6 | ||
|
|
ad451933c6 | ||
|
|
222e67300e | ||
|
|
d12191db5a | ||
|
|
785efc2087 | ||
|
|
557ad827f9 | ||
|
|
600f81cf98 | ||
|
|
56d98052d1 | ||
|
|
265d3245af | ||
|
|
53d4224be9 | ||
|
|
f813fd0f4d | ||
|
|
e90b40e651 | ||
|
|
07c1e72216 | ||
|
|
7338b45d36 | ||
|
|
c95e5362e6 | ||
|
|
2698a2ba68 | ||
|
|
ff0e01a69e | ||
|
|
72b13adeff | ||
|
|
481178428b | ||
|
|
9a2ef3a542 | ||
|
|
b480e7fc9c | ||
|
|
3e33d1eba6 | ||
|
|
cdb9b04980 | ||
|
|
31ff7ead73 | ||
|
|
5398d986ef | ||
|
|
b02dccc51f | ||
|
|
3158133edd | ||
|
|
acf50ae26d | ||
|
|
01b840890d | ||
|
|
9bd60e7d5d | ||
|
|
c5e46101b1 | ||
|
|
53b77cb4c6 | ||
|
|
cc4ce8d83b | ||
|
|
23c8ef70aa | ||
|
|
2a4d338d97 | ||
|
|
9c202198a3 | ||
|
|
c8dc67717b | ||
|
|
4df2f81295 | ||
|
|
78def852d1 | ||
|
|
a4933873c9 | ||
|
|
1861052234 | ||
|
|
2307b31887 | ||
|
|
108a3b0b41 | ||
|
|
e0d9b7a8af | ||
|
|
b3ace4d8f6 | ||
|
|
e9d6ceab0b | ||
|
|
5103bfe6b8 | ||
|
|
cfd17f5722 | ||
|
|
43235c2f16 | ||
|
|
b14ad451a9 | ||
|
|
cd00d0975e | ||
|
|
40f6dbc34e | ||
|
|
a9fb56a8c9 | ||
|
|
07c0d29276 | ||
|
|
310c971d50 | ||
|
|
3644d51b97 | ||
|
|
591d3170aa | ||
|
|
752dde1130 | ||
|
|
b5eda7f812 | ||
|
|
4d44b03fc8 | ||
|
|
2d16c27820 | ||
|
|
ad65b79ac7 | ||
|
|
fe5bd8cdef | ||
|
|
c848ec3d53 | ||
|
|
ab6390cad0 | ||
|
|
48124fdba4 | ||
|
|
ebd9eb346d | ||
|
|
413116e1b5 | ||
|
|
69a3d39bc4 | ||
|
|
f081fa3047 | ||
|
|
4383b01b9b | ||
|
|
b901a20a06 | ||
|
|
d6e05d8376 | ||
|
|
21e307e820 | ||
|
|
dbcf4f0cbe | ||
|
|
7b88557ef5 | ||
|
|
75a6abe6d2 | ||
|
|
ba5b85baf0 | ||
|
|
9f95fa9ce5 | ||
|
|
8853bc448d | ||
|
|
15148a5e6d | ||
|
|
7d9ad31cd9 | ||
|
|
aecbc6faa9 | ||
|
|
a06b921f12 | ||
|
|
bdf1a9d4e7 | ||
|
|
5c399dfc6e | ||
|
|
ed4b6486a1 | ||
|
|
2326bf695e | ||
|
|
a9dd73fb16 | ||
|
|
073bd3ad6e | ||
|
|
4bcc224560 | ||
|
|
f2f367ba9c | ||
|
|
48bff32ee3 | ||
|
|
304f07258b | ||
|
|
e1c2573c7a | ||
|
|
07ec7de8eb | ||
|
|
82f5fed45a | ||
|
|
a2f7e31ba2 | ||
|
|
55983ee9d1 | ||
|
|
cd274a7830 | ||
|
|
f773fa3968 | ||
|
|
288355686b | ||
|
|
f7d5a82a5d | ||
|
|
63e04ac31e | ||
|
|
0c63b50fdc | ||
|
|
94c9defde1 | ||
|
|
ee91c51e09 | ||
|
|
1e3f3a7511 | ||
|
|
8fce33afe0 | ||
|
|
4314b8ded3 | ||
|
|
52e39ae5f7 | ||
|
|
5e7ba03ad1 | ||
|
|
97fec5603f | ||
|
|
3b8847f319 | ||
|
|
a578d2706c | ||
|
|
44d38815cc | ||
|
|
b23a5d5b29 | ||
|
|
b96cc8c212 | ||
|
|
09ad0eb5f7 | ||
|
|
62ca113ed3 | ||
|
|
5cfb74650d | ||
|
|
8cd6aa0a32 | ||
|
|
fcbe41942f | ||
|
|
39e5b52734 | ||
|
|
70b347183b | ||
|
|
699cacf7a4 | ||
|
|
23cb26c58f | ||
|
|
3422ec3419 | ||
|
|
5f1d9af375 | ||
|
|
f3a441043d | ||
|
|
e6c629951f | ||
|
|
c06d5452f5 | ||
|
|
1fcb9b99cf | ||
|
|
d8c840692e | ||
|
|
8c7b6bd21a | ||
|
|
21d0755de5 | ||
|
|
bbab9e2e62 | ||
|
|
9ea1cd947c |
494
ChangeLog
494
ChangeLog
@@ -1,3 +1,497 @@
|
||||
Changes between v4.7 and v4.8:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (166):
|
||||
bindings: allow to bind shifted Meta+letter combinations with Sh-M-X
|
||||
bindings: allow to rebind also ^`, although it is synonymous with ^Space
|
||||
bindings: do not show the Full-Justify keystroke when in View mode
|
||||
bindings: force the first letter in a key name to uppercase
|
||||
build: exclude bracketed pasting from the tiny version
|
||||
build: exclude option '-g' when configured without browser and help
|
||||
build: exclude the escape sequences for F13...F16 from the tiny version
|
||||
build: fix compilation for --enable-{tiny,help,multibuffer}
|
||||
build: restrict the use of --with-slang to together with --enable-tiny
|
||||
bump version numbers and add a news item for the 4.8 release
|
||||
copyright: update the years for significantly changed files
|
||||
copyright: update the years for the FSF
|
||||
display: adjust line and column count upon a resize also when using Slang
|
||||
display: clear the help lines before a briefly shown warning
|
||||
display: don't let a message write over the second help line
|
||||
display: ensure the guiding stripe can be shown when not softwrapping
|
||||
display: exclude a bit of feedback from the tiny version
|
||||
display: show the cursor during suspension also when built with Slang
|
||||
display: skip zero-width characters on a Linux console, to avoid a mess
|
||||
docs: add a FAQ item about a self-compiled nano not reading /etc/nanorc
|
||||
docs: document the new -f/--rcfile option
|
||||
docs: document the new Sh-M-X format for binding <Shift+Meta+letter>
|
||||
docs: for the alternative bindings, rebind ^C only in the main menu
|
||||
docs: improve the description of which rc-files are read during startup
|
||||
docs: mention in the FAQ that auto-indentation is suppressed when pasting
|
||||
docs: mention that -D/--boldtext gets overridden by some nanorc options
|
||||
docs: put the three new behaviors in a bulletted list, to catch the eye
|
||||
docs: stop saying that 'set fill' enables hard-wrapping -- it does not
|
||||
docs: use more generally available arrows in the cheatsheet
|
||||
feedback: ask a clearer question when a valid lock file is encountered
|
||||
feedback: report Ctrl+Alt keystrokes as unbindable
|
||||
feedback: restore a message that can occur in help viewer or file browser
|
||||
files: alert the user afterward when an overwritten file is being edited
|
||||
files: revert the previous commit, as the extra warning is annoying
|
||||
files: warn doubly when the user is about to overwrite an existing file
|
||||
files: write a lock file also for a new file and when the name changed
|
||||
gnulib: update to its current upstream state
|
||||
help: don't waste the last column in the help viewer on narrow terminals
|
||||
help: increase the minimum help-text width from 24 to 32 columns
|
||||
help: prevent double spaces from protruding across the right edge
|
||||
help: when a key description wraps, indent its wrapped part
|
||||
input: consume and ignore the raw escape sequences for F17 to F24
|
||||
input: correct the escape sequence for PageUp/PageDown on Eterm/Urxvt
|
||||
input: Ctrl+arrow is "Esc O x" on Eterm, as on rxvt -- not "Esc o x"
|
||||
input: discard partial sequences that Slang produces for F17 to F24
|
||||
input: do not auto-indent when something is pasted into nano from outside
|
||||
input: don't discard the first keystroke after a resize when using Slang
|
||||
input: filter out Ctrl+Meta keystrokes, as they can never be shortcuts
|
||||
input: ignore bracketed pastes in help viewer and file browser
|
||||
input: ignore modifiers on a VT while executing a macro or a string bind
|
||||
input: prevent unintentional marking of text for shifted Meta keystrokes
|
||||
input: read in an external paste in one go, to allow undoing with one M-U
|
||||
input: recognize the raw escape sequences for F13 to F16 on xterm too
|
||||
locking: accept a minimal amount of data, enough for PID plus username
|
||||
locking: avoid crashing when there is a problem writing the lock file
|
||||
locking: check two magic bytes, to verify that it is a lock file
|
||||
locking: do not write a lock file when in view mode
|
||||
locking: when a lock file is unreadable, open the file itself anyway
|
||||
locking: when finding a lock file at startup, quit when user cancels
|
||||
new feature: allow specifying a custom nanorc file on the command line
|
||||
pasting: retain the mark's position when it was set at the cursor
|
||||
prompt: for a Yes-No-All, accept the first character of an external paste
|
||||
rcfile: do set the meta flag for plain <Meta+ASCII> combinations
|
||||
rcfile: require "bright", "start=", and "end=" to be in lowercase too
|
||||
rcfile: unbind keys by their key code instead of by their key string
|
||||
softwrap: suppress the guiding stripe on unaffected chunks
|
||||
speller: avoid messing up the screen when an unknown locale is used
|
||||
suspension: put in an extra terminal-initialization call for Slang
|
||||
syntax: nanohelp, nanorc: colorize the Sh-M-X format as a valid key name
|
||||
syntax: nanorc: colorize all-lowercase Meta key binds as valid too
|
||||
tweaks: add a little change that was overlooked in the previous commit
|
||||
tweaks: add an error message for something that should never occur
|
||||
tweaks: adjust or reword a few items in the FAQ
|
||||
tweaks: adjust the indentation after the previous change
|
||||
tweaks: allocate the lock data only when ready to write them
|
||||
tweaks: avoid analyzing the key string when the target key code is known
|
||||
tweaks: avoid determining the key code from the key string twice
|
||||
tweaks: avoid fiddling with the keybuffer when it's not needed
|
||||
tweaks: comment fully, so that all handled escape sequences are findable
|
||||
tweaks: condense a fragment of code
|
||||
tweaks: condense five more fragments of repetitious code
|
||||
tweaks: condense three comments to one, and do the masking more directly
|
||||
tweaks: condense three fragments of repetitious code
|
||||
tweaks: condense two comments, and reshuffle an #endif
|
||||
tweaks: correct a comment
|
||||
tweaks: correct a couple of comments about escape sequences
|
||||
tweaks: correct the description of what nano writes into the lock file
|
||||
tweaks: delete some fragments of code that have become irrelevant
|
||||
tweaks: do not leak a file descriptor when fdopen() fails
|
||||
tweaks: don't bother including Haiku escape sequences in the tiny version
|
||||
tweaks: don't enable bracketed pasting when not handling such pastes
|
||||
tweaks: drop a message that will never be seen
|
||||
tweaks: drop an unneeded call of keypad() -- we never read from topwin
|
||||
tweaks: drop a pointless suffix from two function names
|
||||
tweaks: elide a function that has become too small for its two calls
|
||||
tweaks: elide a helper function, in preparation for an improvement
|
||||
tweaks: elide an 'if', by moving the relevant code to a better place
|
||||
tweaks: elide a small function, as it's in fact needed just once
|
||||
tweaks: elide a somewhat costly call by remembering some state
|
||||
tweaks: elide a variable, and rename its sister
|
||||
tweaks: elide three checks of a shortcut's meta flag
|
||||
tweaks: ensure that editor name and user name are NUL terminated
|
||||
tweaks: exclude an unneeded fragment of code from the tiny version
|
||||
tweaks: exclude two unneeded fragments of code from the tiny version
|
||||
tweaks: free two strings as soon as they are no longer needed
|
||||
tweaks: frob a couple of indentations and white lines
|
||||
tweaks: fuse two nearly identical functions into a single one
|
||||
tweaks: gather four calls that are always done together into a function
|
||||
tweaks: harmonize the amount of lock data that we read and write
|
||||
tweaks: improve a comment by indirectly referring to the ncurses docs
|
||||
tweaks: in comments, reword "titlebar" and "statusbar" to two words each
|
||||
tweaks: initialize three booleans straightaway, when they are declared
|
||||
tweaks: initialize three more booleans straightaway, at declaration
|
||||
tweaks: judge from the key code itself whether it is a Meta keystroke
|
||||
tweaks: make a couple of comments more precise
|
||||
tweaks: move a function to after the one that it calls
|
||||
tweaks: move a function to be before the ones that call it
|
||||
tweaks: move a function to before the one that calls it
|
||||
tweaks: move a function to related ones, and after one that it calls
|
||||
tweaks: move a function to right before the one that calls it
|
||||
tweaks: move another function to after the one that it calls
|
||||
tweaks: move another function to before the one that calls it
|
||||
tweaks: move another function, to group the deleting ones together
|
||||
tweaks: move three functions to the file where they are mainly used
|
||||
tweaks: rearrange a few global variables, to group things better
|
||||
tweaks: recompute the wrapping point just once
|
||||
tweaks: reduce the scope of a variable, and reshuffle a declaration
|
||||
tweaks: reduce the scope of two constants and of four variables
|
||||
tweaks: reformat a comment, and resuffle a line to match byte order
|
||||
tweaks: remove a feedback message that is never shown
|
||||
tweaks: remove a redundant call, as there is nothing to free there
|
||||
tweaks: remove a superfluous check
|
||||
tweaks: remove some superfluous conditions for rewriting a lock file
|
||||
tweaks: remove the now-unneeded code related to bracketed pasting
|
||||
tweaks: remove the now-unused meta flag from 'keystruct'
|
||||
tweaks: remove two superfluous assignments, and rename a variable
|
||||
tweaks: rename a function and its parameter, to be more fitting
|
||||
tweaks: rename a function, to be a bit more expressive
|
||||
tweaks: rename a function, to make it not contain the name of another
|
||||
tweaks: rename a parameter and invert its logic, and correct a comment
|
||||
tweaks: rename five variables, away from a single letter
|
||||
tweaks: rename two functions, to make more sense
|
||||
tweaks: rename two parameters, to be more general and to sound shorter
|
||||
tweaks: rename two variables, to make more sense
|
||||
tweaks: renumber some FAQ items in preparation for adding another
|
||||
tweaks: reorder two symbols
|
||||
tweaks: reshuffle some assignments for a return value
|
||||
tweaks: reshuffle some declarations
|
||||
tweaks: reshuffle some declarations, and expand a few variable names
|
||||
tweaks: reshuffle some lines, to avoid tallying the menus when not needed
|
||||
tweaks: reshuffle some lines, to group all ignored keystrokes together
|
||||
tweaks: reshuffle three lines, to make the grouping tighther
|
||||
tweaks: reshuffle two lines, to do the linking first, then the content
|
||||
tweaks: reword two comments, and rewrap another
|
||||
tweaks: rewrap a comment and a line, and reshuffle a fragment of code
|
||||
tweaks: rewrap two lines, for consistency with similar lines
|
||||
tweaks: rewrite the same file name into the lock file as the first time
|
||||
tweaks: slightly condense a function by conflating case
|
||||
tweaks: stop recognizing escape sequences for a key without meaning
|
||||
tweaks: suggest a few more alternative key bindings and unbindings
|
||||
tweaks: take just one shot at reading the lock file, and correct a type
|
||||
tweaks: trim some excessive error checking and key-name frobbing
|
||||
tweaks: tumble three conditions, for consistency in comparisons
|
||||
tweaks: unabbreviate "argument" in the documentation
|
||||
tweaks: use a simple subtraction instead of a function call
|
||||
usage: improve the description of --restricted and --quickblank
|
||||
|
||||
Brand Huntsman (2):
|
||||
input: beep when invalid key is pressed at yesno prompt or in linter menu
|
||||
input: recognize the start and stop sequences of a bracketed paste
|
||||
|
||||
|
||||
Changes between v4.6 and v4.7:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (39):
|
||||
build: add the uploading of PDF and cheatsheet to the release script
|
||||
build: avoid three compiler warnings when using gcc-9.2 or newer
|
||||
build: fix compilation for --enable-tiny --enable-wrapping
|
||||
build: fix compilation on macOS, where 'st_mtim' is unknown
|
||||
build: fix compilation when configured with --disable-justify
|
||||
bump version numbers and add a news item for the 4.7 release
|
||||
display: don't color the space that separates line numbers from text
|
||||
docs: add or improve the 'description' meta tag in the two HTML pages
|
||||
docs: add the 'lang' attribute in the right place to the two HTML pages
|
||||
docs: mention that all keywords in a nanorc file should be in lowercase
|
||||
docs: mention that a negative number after "+" counts from the end
|
||||
gnulib: update to its current upstream state
|
||||
input: make <Tab> indent only when mark and cursor are on different lines
|
||||
justify: distinguish between tabs and spaces when comparing indentation
|
||||
justify: treat consecutive indentations that look the same as the same
|
||||
linter: beep when trying to go beyond first or last message
|
||||
rcfile: accept also function names and menu names only in lowercase
|
||||
rcfile: accept only keywords in all lowercase, for speed of comparison
|
||||
rcfile: demand that function 'exit' is bound in the file browser
|
||||
syntax: nanohelp: colorize also ^/ as a possible keystroke
|
||||
syntax: sh: recognize shell rc files also in dedicated directories
|
||||
tweaks: avoid using strlen() where it is not needed
|
||||
tweaks: drop M-Space and ^Space from the browser's key list
|
||||
tweaks: improve two comments and the ordering of some operands
|
||||
tweaks: move three functions to the file where they are used
|
||||
tweaks: optimize the trimming of trailing whitespace
|
||||
tweaks: remove a stray space
|
||||
tweaks: rename a function, to get out of the way for another rename
|
||||
tweaks: rename a function, to get rid of a useless suffix
|
||||
tweaks: reshuffle a few lines, for brevity or speed or consistency
|
||||
tweaks: reshuffle a few lines, for symmetry with the preceding function
|
||||
tweaks: reshuffle a fragment of code, for efficiency
|
||||
tweaks: reshuffle and rename a few things, to elide duplication
|
||||
tweaks: reshuffle an item, to avoid a lone 'else'
|
||||
tweaks: reshuffle two declarations, for compactness
|
||||
tweaks: slightly streamline the search for a possible wrapping point
|
||||
tweaks: trim or adjust some whitespace in HTML, and add two keywords
|
||||
tweaks: unwrap a few lines, and move some strings to among their peers
|
||||
wrapping: never break in the quoting part nor in the indentation part
|
||||
|
||||
|
||||
Changes between v4.5 and v4.6:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (128):
|
||||
bindings: allow to rebind ^/, even though it is synonymous with ^_
|
||||
bindings: don't hard-bind ^H in the help viewer or the file browser
|
||||
bindings: the 'all' keyword should encompass the browser menu too
|
||||
bindings: the 'all' keyword should include the browser menu always
|
||||
build: fix compilation for --enable-tiny --enable-histories
|
||||
build: fix compilation when configured with --disable-color
|
||||
build: slightly speed up the compilation of the tiny version
|
||||
bump version numbers and add a news item for the 4.6 release
|
||||
chars: add a faster version of the character-parsing function
|
||||
commands: rename 'fixer' to 'formatter', to be less misleading
|
||||
cutting: do nothing when trying to chop a word leftward at start of file
|
||||
display: do refresh the edit window when exiting from the help viewer
|
||||
docs: add a note saying that rebinding ^M or ^I is not advisable
|
||||
docs: add the M-F and M-N keystrokes to the cheatsheet
|
||||
docs: adjust the compilation instructions to two-digit version numbers
|
||||
docs: correct the description of the 'spell' menu
|
||||
docs: document the 'fixer' command, a per-syntax content arranger
|
||||
docs: mention that color rules are applied in the order they are listed
|
||||
docs: mention that 'hunspell' is now the first default spelling program
|
||||
docs: mention that the 'nopauses' option is obsolete
|
||||
docs: remove some excessive detail from the sample nanorc file
|
||||
docs: remove the note about the formatter having been removed
|
||||
feedback: say it when spell check or manipulation did not change anything
|
||||
files: distinguish between read error and write error when prepending
|
||||
files: don't mention the name of the temp file when reading goes wrong
|
||||
files: when opening a file for copying, it should NOT be created
|
||||
formatter: accept the formatted result also upon a nonzero exit status
|
||||
formatter: don't let output from the program pollute the screen
|
||||
gnulib: update to its current upstream state
|
||||
history: don't wait when there is something wrong with the history files
|
||||
linter: report it as an error when running the linting program fails
|
||||
rcfile: allow binding also F17...F24
|
||||
rcfile: process extensions to file-matching commands straightaway
|
||||
restored feature: a per-syntax 'fixer' command that processes the buffer
|
||||
softwrap: when switching to another buffer, re-align the starting column
|
||||
speller: prefer 'hunspell' over 'spell', because it can handle UTF-8
|
||||
speller: when 'spell' is not found, try running 'hunspell -l' instead
|
||||
statusbar: show only the first error message, with dots to indicate more
|
||||
syntax: c: recognize some C++ header files by their Emacs modeline
|
||||
syntax: default: don't colorize stuff between two pairs of brackets
|
||||
syntax: html: add a formatter command, making use of 'tidy'
|
||||
syntax: html: colorize only full attributes, and colorize strings later
|
||||
syntax: javascript: colorize also special values 'null' and 'undefined'
|
||||
syntax: javascript: colorize the boolean values 'true' and 'false' too
|
||||
syntax: nanorc: colorize all arguments of 'fixer' and 'linter' as valid
|
||||
syntax: nanorc: colorize in bright red everything that is invalid
|
||||
syntax: nanorc: colorize only lowercase keywords as valid
|
||||
syntax: nanorc: colorize the 'fixer' command as valid
|
||||
syntax: ruby: colorize also lowercase global/instance variables
|
||||
syntaxes: put the 'linter' and 'formatter' commands on a separate line
|
||||
tweaks: add a helper function without the ubiquitous NULL argument
|
||||
tweaks: add a local variable, for clarity, to not preuse another one
|
||||
tweaks: add some "fall-through" comments, and reshuffle some breaks
|
||||
tweaks: add two translator hints
|
||||
tweaks: adjust the indentation after the previous change
|
||||
tweaks: adjust the indentation after the previous change
|
||||
tweaks: adjust the indentation after the previous change, and another
|
||||
tweaks: adjust two comments, to better fit the actual functions
|
||||
tweaks: avoid setting and resetting a variable when there is no need
|
||||
tweaks: avoid three unneeded calls of umask() in the normal case
|
||||
tweaks: be explicit about which program complained
|
||||
tweaks: check the return value of copy_file() also after its other uses
|
||||
tweaks: close the unused reading ends of two more output pipes
|
||||
tweaks: condense a fragment of code by making use of a helper function
|
||||
tweaks: condense or improve some comments
|
||||
tweaks: condense two comments, and rename two parameters
|
||||
tweaks: condense two comments, and rewrap a line
|
||||
tweaks: correct a comment, and retype a variable
|
||||
tweaks: die on an impossible condition -- to be removed later
|
||||
tweaks: don't do in the parent something that only the child needs
|
||||
tweaks: don't wrap calls of statusline() that slightly overshoot 80 cols
|
||||
tweaks: drop the unneeded closing of descriptors when exiting anyway
|
||||
tweaks: elide a duplicate opening of the existing file when prepending
|
||||
tweaks: elide a function call for the plain ASCII case
|
||||
tweaks: elide another two calls of umask(), and rename two variables
|
||||
tweaks: elide an unneeded and leaky function
|
||||
tweaks: elide an unneeded check when making a backup
|
||||
tweaks: elide a variable, and add a condition to elide an assignment
|
||||
tweaks: elide a variable that is the same as another
|
||||
tweaks: exclude two fragments of code from the tiny version
|
||||
tweaks: fuse two regexes into one
|
||||
tweaks: group the closing of descriptors together, for compactness
|
||||
tweaks: group the closing of two descriptors, and reword two comments
|
||||
tweaks: harmonize a message with another
|
||||
tweaks: improve some comments, and trim some repetitive ones
|
||||
tweaks: make a function do a check so its calls don't need to
|
||||
tweaks: mark two strings for translation
|
||||
tweaks: move a call of umask() closer to where it is relevant
|
||||
tweaks: move two functions to after the one that they make use of
|
||||
tweaks: normalize the indentation after the previous change
|
||||
tweaks: order two functions more sensibly
|
||||
tweaks: pass an empty string as an answer instead of a NULL pointer
|
||||
tweaks: pass an empty string for copying instead of a non-existent one
|
||||
tweaks: pass any special undo/redo messages to the add_undo() function
|
||||
tweaks: remove a pointless updating of the title bar
|
||||
tweaks: remove a redundant check for an existing emergency file
|
||||
tweaks: remove the superfluous closing of a file descriptor
|
||||
tweaks: remove two pointless re-inclusion guards
|
||||
tweaks: remove two superfluous conditions when prepending
|
||||
tweaks: rename a function and add a parameter, so it becomes more general
|
||||
tweaks: rename a function, and elide a parameter that is always NULL
|
||||
tweaks: rename a function and elide its first parameter
|
||||
tweaks: rename a local variable, to not shadow another
|
||||
tweaks: rename a variable, to be a bit more fitting
|
||||
tweaks: rename a variable, to be distinct and visible
|
||||
tweaks: rename three variables, and reshuffle some lines
|
||||
tweaks: rename three variables, to be consistent with other linestructs
|
||||
tweaks: rename three variables, to be more descriptive
|
||||
tweaks: rename three variables, to match others elsewhere
|
||||
tweaks: rename two parameters, for contrast and to match others
|
||||
tweaks: rename two parameters plus a variable, to match others
|
||||
tweaks: rename two variables, and add a third, for more contrast
|
||||
tweaks: reshuffle a few declarations, and reduce the scope of one
|
||||
tweaks: reshuffle a fragment of code into two alternatives
|
||||
tweaks: reshuffle an 'if' to avoid a negation, and improve a comment
|
||||
tweaks: reshuffle some declarations, and rename a variable
|
||||
tweaks: reword an undo/redo string that was overlooked during the rename
|
||||
tweaks: silence a warning when configured with --enable-tiny
|
||||
tweaks: simplify the opening of files when prepending
|
||||
tweaks: slightly reword some fragments in the manual's rebinding section
|
||||
tweaks: use a better variable name for the argument of an option
|
||||
tweaks: use a literal NULL instead of a variable that is NULL
|
||||
tweaks: use a simpler positive/negative check for after copy_file()
|
||||
tweaks: use a string-copy function that checks for out-of-memory
|
||||
tweaks: use the given string instead of the found match, for clarity
|
||||
undo: don't try to copy a string that doesn't exist
|
||||
undo: put the cursor back on the original row for a full-buffer operation
|
||||
utils: don't accept NULL for the string to be copied
|
||||
|
||||
Jeroen Roovers (1):
|
||||
syntax: gentoo: highlight the BDEPEND variable as well
|
||||
|
||||
|
||||
Changes between v4.4 and v4.5:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (60):
|
||||
bindings: add a dedicated keycode for <Tab> for when a region is marked
|
||||
bump version numbers and add a news item for the 4.5 release
|
||||
color: don't concatenate an absolute path with the working directory
|
||||
docs: add two examples of the 'tabgives' command to the sample nanorc
|
||||
docs: describe the new syntax-specific 'tabgives' command
|
||||
docs: mark the undoing of justifications as done in the TODO list
|
||||
docs: mention that gcc must be at least version 5.0
|
||||
gnulib: update to its current upstream state
|
||||
mouse: make the clickable width of menu items more consistent
|
||||
new feature: a 'tabgives' command to define what the Tab key produces
|
||||
search: after search-at-startup, store the column (for vertical movement)
|
||||
tweaks: add a translator hint, and correct two others
|
||||
tweaks: add some translator hints, be more precise on permissible length
|
||||
tweaks: add two hints for translators, to try and help avoid mistakes
|
||||
tweaks: adjust indentation after previous change, reshuffle declarations
|
||||
tweaks: avoid a comparison between signed and unsigned [coverity]
|
||||
tweaks: avoid leaking memory when finding an invalid string [coverity]
|
||||
tweaks: avoid recomputing a maximum value every time round the loop
|
||||
tweaks: don't burden all menus with something meant for the WriteOut menu
|
||||
tweaks: elide a function from a non-UTF8 build
|
||||
tweaks: elide two multiplications with something that is always 1
|
||||
tweaks: frob a few comments
|
||||
tweaks: improve a bunch of comments, and reshuffle some declarations
|
||||
tweaks: improve a handful of comments, and reduce the needed padding
|
||||
tweaks: mark as 'const' a parameter that takes fixed strings [coverity]
|
||||
tweaks: meld two calls of free() into a single one, to elide an 'else'
|
||||
tweaks: move a fragment of common code into the appropriate function
|
||||
tweaks: move a function to a better file, to be amongst its kind
|
||||
tweaks: move a function to before its callers and next to its kind
|
||||
tweaks: move two functions to after the ones that they call
|
||||
tweaks: remove some timing code that has served its purpose
|
||||
tweaks: remove two superfluous macros, as sizeof(char) is always 1
|
||||
tweaks: rename a function, to be a bit more fitting
|
||||
tweaks: rename another type, again to better fit the general pattern
|
||||
tweaks: rename another type, to also better fit the general pattern
|
||||
tweaks: rename another variable, for a better fit
|
||||
tweaks: rename a type, to better fit the general pattern
|
||||
tweaks: rename a variable, normalize a comment, and reshuffle a free()
|
||||
tweaks: rename a variable, to be more compact
|
||||
tweaks: rename three variables, for contrast and more sense
|
||||
tweaks: rename three variables, for more contrast
|
||||
tweaks: rename three variables, to better indicate what they hold
|
||||
tweaks: rename two variables, away from single letters
|
||||
tweaks: rename two variables, to better describe what they contain
|
||||
tweaks: reshuffle a fragment, to group some toggles together
|
||||
tweaks: reshuffle a line, to group things better
|
||||
tweaks: reshuffle some lines, to elide an unneeded assignment
|
||||
tweaks: reshuffle some lines, to have the same order as elsewhere
|
||||
tweaks: reshuffle two fragments, to group things better
|
||||
tweaks: rewrap a line, reshuffle a declaration, and improve some comments
|
||||
tweaks: simplify a calculation, as done elsewhere
|
||||
tweaks: simplify the determination of a canonical path
|
||||
tweaks: sort two keywords strictly alphabetically
|
||||
tweaks: speed up determining the width of plain ASCII characters
|
||||
tweaks: speed up the counting of the menu entries to be shown
|
||||
tweaks: use a more effecient way to skip storing an empty file name
|
||||
tweaks: use an early return when there is no tilde
|
||||
tweaks: use 'void' in prototypes of parameterless functions [coverity]
|
||||
usage: mark the -J/--guidestripe option plus argument as translatable
|
||||
usage: properly align --help output also when it has accented characters
|
||||
|
||||
Brand Huntsman (1):
|
||||
search: accept a match at start of file when searching from command line
|
||||
|
||||
Dirkjan Ochtman (1):
|
||||
syntax: rust: add the words reserved in 2018, and remove unreserved ones
|
||||
|
||||
|
||||
Changes between v4.3 and v4.4:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (53):
|
||||
browser: draw a bar of spaces only where needed -- for the selected item
|
||||
build: exclude the search-at-startup feature from the tiny version
|
||||
bump version numbers and add a news item for the 4.4 release
|
||||
copying: do not prevent M-6 from copying emptiness into the cutbuffer
|
||||
display: blank the status bar on a successful cut or paste
|
||||
display: clear the remainder of a row only when there actually is some
|
||||
display: don't clear a row beforehand -- just clear the remainder
|
||||
display: use a somewhat faster method to clear a row
|
||||
display: when linenumbering, correctly spotlight text that spans two rows
|
||||
display: where needed, use slow blanking, but elsewhere do it much faster
|
||||
docs: change a few URLs over to https, and rewrap a couple of NEWS items
|
||||
docs: document the search-at-startup feature (+/string or +?string)
|
||||
docs: make the synopsis of --speller and 'set speller' more accurate
|
||||
docs: mention the M-N toggle instead of the obsolete M-# one
|
||||
docs: slightly reword some of the descriptions around syntax highlighting
|
||||
docs: slightly reword the descriptions of most configure options
|
||||
docs: stop mentioning the 'unjustify' function, as it no longer exists
|
||||
gnulib: update to its current upstream state
|
||||
new document: a condensed overview of nano's shortcut keystrokes
|
||||
new feature: allow specifying a search string to "jump to" at startup
|
||||
rcfile: properly handle an empty syntax before an 'include' statement
|
||||
scrolling: don't overscroll when the edit window has just one row
|
||||
search: don't wipe the status bar at startup when there was an error
|
||||
search: wipe the status bar before searching again (M-W / M-Q)
|
||||
syntax: c: allow an underscore in lowercase type names
|
||||
syntax: default: colorize bracketed section headers in some config files
|
||||
syntaxes: change some unneeded 'icolor' commands to 'color' commands
|
||||
syntaxes: recognize .ctp extension as a PHP file, and .cu as a C/C++ file
|
||||
syntax: perl: avoid recognizing embedded hash signs as a comment starter
|
||||
syntax: perl: avoid upsetting older glibcs with crafty range expression
|
||||
syntax: perl: don't color the character after a variable name
|
||||
syntax: po: colorize numbers only when they form a self-contained word
|
||||
text: copy leading quote characters when automatic hard-wrapping occurs
|
||||
tweaks: add a translator hint, to clarify four short words
|
||||
tweaks: call the correct lighting function directly when softwrapping
|
||||
tweaks: condense some comments, and drop two unneeded initializations
|
||||
tweaks: drop two parameters that are no longer needed
|
||||
tweaks: improve a comment, and drop a superfluous one
|
||||
tweaks: improve a handful of comments
|
||||
tweaks: make a function name unique, to not overlap with others
|
||||
tweaks: move a call from two different places to a single place
|
||||
tweaks: move a function to before the first one that calls it
|
||||
tweaks: move a general function to a better place
|
||||
tweaks: remove a saving and restoring that has become superfluous
|
||||
tweaks: rename a function, to suit better, and reshuffle its parameters
|
||||
tweaks: rename a parameter in three functions, to say what it points to
|
||||
tweaks: reshuffle an assignment, and trim some excessive blank lines
|
||||
tweaks: reshuffle an 'if' out of a function, and rename the function
|
||||
tweaks: reword and condense two comments, and correct another
|
||||
tweaks: rewrap two lines, and reshuffle some logic to make more sense
|
||||
tweaks: shorten two messages that translators tend to make too long
|
||||
tweaks: try the allocation of a multidata cache just once per line
|
||||
tweaks: when precalculating, allocate all the cache space upfront
|
||||
|
||||
Brand Huntsman (3):
|
||||
rcfile: for an empty syntax, show the line number of the 'syntax' command
|
||||
rcfile: report the correct command location for an invalid 'include'
|
||||
search: accept toggles for case and regex when searching at startup
|
||||
|
||||
|
||||
Changes between v4.2 and v4.3:
|
||||
------------------------------
|
||||
|
||||
|
||||
@@ -2,6 +2,13 @@ Improvements in GNU nano
|
||||
========================
|
||||
|
||||
Since 4.0:
|
||||
- Pasting from outside into nano suppresses auto-indentation.
|
||||
- Such an external paste can be undone with a single M-U.
|
||||
- Shift+Meta+letter key combos can be bound with 'bind Sh-M-letter ...'.
|
||||
- A custom nanorc file may be specified with -f / --rcfile.
|
||||
- What the <Tab> key produces can be specified per syntax with 'tabgives'.
|
||||
- The ability to perform a search at startup with +/string or +?string.
|
||||
- Comment characters are copied when automatic hard-wrapping occurs.
|
||||
- The ability to both read from and write to a FIFO.
|
||||
- Automatic hard-wrapping is no longer the default.
|
||||
- Addition of --guidestripe to draw a helpful vertical bar.
|
||||
|
||||
124
NEWS
124
NEWS
@@ -1,3 +1,47 @@
|
||||
2020.02.07 - GNU nano 4.8 "Jaška"
|
||||
• When something is pasted into nano, auto-indentation is suppressed,
|
||||
and the paste can be undone as a whole with a single M-U.
|
||||
• When a lock file is encountered during startup, pressing ^C/Cancel
|
||||
quits nano. (Pressing 'No' just skips the file and continues.)
|
||||
• Shift+Meta+letter key combos can be bound with 'bind Sh-M-letter'.
|
||||
Making any such binding dismisses the default behavior of ignoring
|
||||
Shift for all Meta+letter keystrokes.
|
||||
• The configuration option --with-slang (to be avoided when possible)
|
||||
can now be used only together with --enable-tiny.
|
||||
• A custom nanorc file can be specified on the command line, with
|
||||
-f filename or --rcfile=filename.
|
||||
|
||||
2019.12.23 - GNU nano 4.7 "Havikskruid"
|
||||
• A <Tab> will indent a marked region only when mark and cursor are
|
||||
on different lines.
|
||||
• Two indentations (any mix of tabs and spaces) are considered the
|
||||
same when they look the same (that is: indent to the same level).
|
||||
• When using --breaklonglines or ^J, a line will never be broken in
|
||||
its leading whitespace or quoting.
|
||||
• The keywords in nanorc files must be in lowercase.
|
||||
|
||||
2019.11.29 - GNU nano 4.6 "And don't you eat that yellow snow"
|
||||
• The 'formatter' command has returned, bound by default to M-F.
|
||||
It allows running a syntax-specific command on the contents of
|
||||
the buffer.
|
||||
• ^T will try to run 'hunspell' before 'spell', because it checks
|
||||
spellling for the locale's language and understands UTF-8.
|
||||
• Multiple errors or warnings on startup will no longer slow nano
|
||||
down but will be indicated on the status bar with trailing dots.
|
||||
|
||||
2019.10.04 - GNU nano 4.5 "Košice"
|
||||
• The new 'tabgives' command allows you to specify per syntax what
|
||||
the <Tab> key should produce: some spaces, a hard TAB, ...
|
||||
• The output of --help is properly aligned again for all languages.
|
||||
• <Tab> will indent a marked region also when M-} has been rebound.
|
||||
|
||||
2019.08.25 - GNU nano 4.4 "Hagelslag"
|
||||
• At startup, the cursor can be put on the first or last occurrence
|
||||
of a string by preceding the filename with +/string or +?string.
|
||||
• When automatic hard-wrapping occurs (--breaklonglines), any leading
|
||||
quoting characters will be automatically copied to the new line.
|
||||
• M-6 works again also when the cursor is at end of buffer.
|
||||
|
||||
2019.06.18 - GNU nano 4.3 "Musa Kart"
|
||||
• The ability to read from and write to a FIFO has been regained.
|
||||
• Startup time is reduced by fully parsing a syntax only when needed.
|
||||
@@ -615,7 +659,7 @@
|
||||
like this what could POSSIBLY go WRONG? Hahaha.
|
||||
Enjoy and if you find new bugs, as always please
|
||||
use Savannah's bug tracker.
|
||||
http://savannah.gnu.org/bugs/?func=additem&group=nano
|
||||
https://savannah.gnu.org/bugs/?func=additem&group=nano
|
||||
|
||||
2010.01.17 - GNU nano 2.2.2 is released for you, you, you. This
|
||||
release includes fixes for: crashes when writing
|
||||
@@ -700,7 +744,7 @@
|
||||
editor, via the -$ or --softwrap command-line flags,
|
||||
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)
|
||||
(https://savannah.gnu.org/bugs/?func=additem&group=nano)
|
||||
Remember: data loss happens, back up your files.
|
||||
|
||||
2009.07.28 - GNU nano 2.1.10 "Ellie" is released. This version includes
|
||||
@@ -728,45 +772,41 @@
|
||||
birthday lenny!
|
||||
|
||||
2009.02.07 - GNU nano 2.1.8 "unsafe at any speed" is released. This
|
||||
release include some long overdue performance
|
||||
improvements in syntax color highlighting, the ability
|
||||
to abort running searches (useful mainly when
|
||||
editing very large files) and the ability to use nano
|
||||
like a pager for viewing standard input (i.e. "nano -").
|
||||
Additionally, there are gentoo syntax highlighting
|
||||
updates and fixes for issues with reading files
|
||||
in a directory with strange parent directory permissions.
|
||||
The key bindings code was also substantially changed
|
||||
in order to be more ISO-C compatible. Be sure to use
|
||||
the Savannah page not only for bug reports but for any
|
||||
release includes some long overdue performance improvements
|
||||
in syntax color highlighting, the ability to abort running
|
||||
searches (useful mainly when editing very large files) and
|
||||
the ability to use nano like a pager for viewing standard
|
||||
input (i.e. "nano -"). Additionally, there are gentoo
|
||||
syntax highlighting updates and fixes for issues with
|
||||
reading files in a directory with strange parent directory
|
||||
permissions. The key-bindings code was also substantially
|
||||
changed in order to be more ISO-C compatible. Be sure to
|
||||
use the Savannah page not only for bug reports but for any
|
||||
features you would like to see before the next stable
|
||||
series is released. Have fun with it!
|
||||
|
||||
2008.11.10 - GNU nano 2.1.7 "Effingham" is ready to make good on those
|
||||
campaign promises of lower bug rates and 50% more pie.
|
||||
This release includes a new check for external
|
||||
modifications when saving a file, some code and
|
||||
documentation cleanups, and more bug fixes for
|
||||
the new undo code (but we continue to welcome
|
||||
your bug reports via the Savannah bug page at
|
||||
http://savannah.gnu.org/bugs/?func=additem&group=nano).
|
||||
This release includes a new check for external modifications
|
||||
when saving a file, some code and documentation cleanups,
|
||||
and more bug fixes for the new undo code (but we continue
|
||||
to welcome your bug reports via the Savannah bug page at
|
||||
https://savannah.gnu.org/bugs/?func=additem&group=nano).
|
||||
Come get some.
|
||||
|
||||
2008.10.03 - GNU nano 2.1.6 was for new features before it was against
|
||||
them. This release includes more undo capability,
|
||||
several new syntax highlighting configurations including
|
||||
Objective C, OCaml, and Fortran, and a new capability
|
||||
to activate highlighting based on the 1st line of the
|
||||
file being edited. Also, the new default configure
|
||||
options now include color syntax highlighting, .nanorc
|
||||
support, multibuffer and extras. These items can still
|
||||
be disabled and are not enabled with --enable-tiny. Bug
|
||||
fixes include better signal handling under Cygwin, and
|
||||
that's about it. Again please remember to
|
||||
submit bug reports via Savannah at
|
||||
http://savannah.gnu.org/bugs/?func=additem&group=nano
|
||||
as undo functions certainly need more testing.
|
||||
Bon appetit.
|
||||
them. This release includes more undo capability, several
|
||||
new syntax highlighting configurations including Objective
|
||||
C, OCaml, and Fortran, and a new capability to activate
|
||||
highlighting based on the 1st line of the file being
|
||||
edited. Also, the new default configure options now
|
||||
include color syntax highlighting, .nanorc support,
|
||||
multibuffer and extras. These items can still be disabled
|
||||
and are not enabled with --enable-tiny. Bug fixes include
|
||||
better signal handling under Cygwin, and that's about it.
|
||||
Again please remember to submit bug reports via Savannah at
|
||||
https://savannah.gnu.org/bugs/?func=additem&group=nano as
|
||||
undo functions certainly need more testing. Bon appetit.
|
||||
|
||||
2008.08.30 - GNU nano 2.1.5 is ready to lead on day one. This release
|
||||
contains a better fix for incorrectly reported successful
|
||||
@@ -789,15 +829,15 @@
|
||||
are likely to run out of space; see Savannah bug #24000.
|
||||
Have fun with it!
|
||||
|
||||
2008.08.04 - GNU nano 2.1.3 "least stable version ever" is released. This
|
||||
release includes new (and experimental) undo and redo
|
||||
functionality for most text operations. The default
|
||||
key bindings are Meta-U for undo and Meta-E for redo, but
|
||||
these can be remapped using the new 2.1 keybinding code.
|
||||
Also included are some fixes for configuring using wide
|
||||
curses, crashing when invoking the help menu with
|
||||
certain locales, and not saving the search history when
|
||||
compiled with configure options.
|
||||
2008.08.04 - GNU nano 2.1.3 "least stable version ever" is released.
|
||||
This release includes new (and experimental) undo and redo
|
||||
functionality for most text operations. The default key
|
||||
bindings are Meta-U for undo and Meta-E for redo, but these
|
||||
can be remapped using the new 2.1 keybinding code. Also
|
||||
included are some fixes for configuring using wide curses,
|
||||
crashing when invoking the help menu with certain locales,
|
||||
and not saving the search history when compiled with
|
||||
configure options.
|
||||
|
||||
2008.04.24 - GNU nano 2.1.2 "New York City" is released. This release
|
||||
contains fixes for binding bad keys, some
|
||||
|
||||
6
README
6
README
@@ -25,10 +25,10 @@ Overview
|
||||
|
||||
How to compile and install nano
|
||||
|
||||
Download the nano source code, then:
|
||||
Download the latest nano source tarball, then:
|
||||
|
||||
tar xvzf nano-x.y.z.tar.gz
|
||||
cd nano-x.y.z
|
||||
tar -xvf nano-x.y.tar.gz
|
||||
cd nano-x.y
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
@@ -14,13 +14,13 @@ packages:
|
||||
- autoconf (version >= 2.69)
|
||||
- automake (version >= 1.14)
|
||||
- autopoint (version >= 0.18.3)
|
||||
- gcc (version >= 5.0)
|
||||
- gettext (version >= 0.18.3)
|
||||
- git (version >= 2.7.4)
|
||||
- groff (version >= 1.12)
|
||||
- make (any version)
|
||||
- pkg-config (version >= 0.22)
|
||||
- texinfo (version >= 4.0)
|
||||
- gcc (any version)
|
||||
- make (any version)
|
||||
|
||||
If you want UTF-8 support, you will also need libncursesw5-dev installed
|
||||
(version >= 5.7), or libslang2-dev (version >= 2.0) if you use --with-slang.
|
||||
|
||||
4
TODO
4
TODO
@@ -2,7 +2,6 @@ A list of desired features
|
||||
--------------------------
|
||||
|
||||
Somewhat urgent:
|
||||
- Make undo/redo work also for justifying.
|
||||
- Detect when text is being pasted, so that we can handle it faster.
|
||||
See https://savannah.gnu.org/bugs/?40060.
|
||||
- Allow color syntaxes to apply to more than just color, so that we can
|
||||
@@ -17,6 +16,9 @@ Vague musings:
|
||||
- Make matching bracket searches sophisticated enough to skip over
|
||||
brackets inside comments?
|
||||
|
||||
For version 4.0:
|
||||
- Make undo/redo work also for justifying. [DONE]
|
||||
|
||||
For version 2.9:
|
||||
- Allow piping (marked) text to an external command and replacing it with
|
||||
the command's output. That is: implement filtering. [DONE]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Generate configure & friends for GIT users.
|
||||
|
||||
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
||||
gnulib_hash="a1beabcb14cde661c36f7a3c7c17b5871704003e"
|
||||
gnulib_hash="e313a5367b1e4edfa19ab5f0d001d0b060a77066"
|
||||
|
||||
modules="
|
||||
futimens
|
||||
|
||||
11
configure.ac
11
configure.ac
@@ -1,6 +1,6 @@
|
||||
# Configuration for GNU nano - a small and user-friendly text editor
|
||||
#
|
||||
# Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2014, 2017 Mike Frysinger
|
||||
#
|
||||
# GNU nano is free software: you can redistribute it and/or modify
|
||||
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
AC_INIT([GNU nano], [4.3], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [4.8], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE([1.14])
|
||||
@@ -89,6 +89,12 @@ AC_CHECK_HEADERS(libintl.h limits.h pwd.h termios.h sys/param.h)
|
||||
|
||||
dnl Checks for options.
|
||||
|
||||
if test "x$with_slang" = xyes; then
|
||||
if test "x$enable_tiny" != xyes; then
|
||||
AC_MSG_ERROR([--with-slang is supported only together with --enable-tiny])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(browser,
|
||||
AS_HELP_STRING([--disable-browser], [Disable the built-in file browser]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
@@ -516,7 +522,6 @@ int main(void)
|
||||
;;
|
||||
esac], [AC_MSG_RESULT(no)])
|
||||
|
||||
|
||||
dnl Checks for functions.
|
||||
|
||||
if test "x$enable_utf8" != xno; then
|
||||
|
||||
134
doc/cheatsheet.html
Normal file
134
doc/cheatsheet.html
Normal file
@@ -0,0 +1,134 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Cheatsheet for nano</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="description" content="A concise overview of the command shortcuts of the GNU nano editor, grouped by category.">
|
||||
<meta name="keywords" content="cheatsheet, nano, editor, shortcuts, keystrokes, functions, operations, commands">
|
||||
<meta name="author" content="Benno Schulenberg">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<br>
|
||||
<h1 align="center">Overview of nano's shortcuts </h1>
|
||||
<h3 align="center">The editor's keystrokes and their functions </h3>
|
||||
<br>
|
||||
|
||||
<table align="center"><tbody>
|
||||
<tr><td>
|
||||
|
||||
<b>File handling</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+S </td><td>Save current file</td></tr>
|
||||
<tr><td>Ctrl+O</td><td>Offer to write file ("Save as")</td></tr>
|
||||
<tr><td>Ctrl+R</td><td>Insert a file into current one</td></tr>
|
||||
<tr><td>Ctrl+X</td><td>Close buffer, exit from nano</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Editing</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+K </td><td>Cut current line into cutbuffer</td></tr>
|
||||
<tr><td>Alt+6</td><td>Copy current line into cutbuffer</td></tr>
|
||||
<tr><td>Ctrl+U</td><td>Paste contents of cutbuffer</td></tr>
|
||||
<tr><td>Alt+T</td><td>Cut until end of buffer</td></tr>
|
||||
<tr><td>Ctrl+]</td><td>Complete current word</td></tr>
|
||||
<tr><td>Alt+3</td><td>Comment/uncomment line/region</td></tr>
|
||||
<tr><td>Alt+U</td><td>Undo last action</td></tr>
|
||||
<tr><td>Alt+E</td><td>Redo last undone action</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Search and replace</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+Q </td><td>Start backward search</td></tr>
|
||||
<tr><td>Ctrl+W</td><td>Start forward search</td></tr>
|
||||
<tr><td>Alt+Q</td><td>Find next occurrence backward</td></tr>
|
||||
<tr><td>Alt+W</td><td>Find next occurrence forward</td></tr>
|
||||
<tr><td>Alt+R</td><td>Start a replacing session</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Deletion</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+H</td><td>Delete character before cursor </td></tr>
|
||||
<tr><td>Ctrl+D</td><td>Delete character under cursor</td></tr>
|
||||
<tr><td>Ctrl+Shift+Del </td><td>Delete word to the left</td></tr>
|
||||
<tr><td>Ctrl+Del</td><td>Delete word to the right</td></tr>
|
||||
<tr><td>Alt+Del</td><td>Delete current line</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Operations</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+T </td><td>Run a spell check</td></tr>
|
||||
<tr><td>Ctrl+J</td><td>Justify paragraph or region</td></tr>
|
||||
<tr><td>Alt+J</td><td>Justify entire buffer</td></tr>
|
||||
<tr><td>Alt+B</td><td>Run a syntax check</td></tr>
|
||||
<tr><td>Alt+F</td><td>Run a formatter/fixer/arranger</td></tr>
|
||||
<tr><td>Alt+:</td><td>Start/stop recording of macro</td></tr>
|
||||
<tr><td>Alt+;</td><td>Replay macro</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
</td><td>
|
||||
|
||||
<b>Moving around</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+B </td><td>One character backward</td></tr>
|
||||
<tr><td>Ctrl+F</td><td>One character forward</td></tr>
|
||||
<tr><td>Ctrl+<b>←</b></td><td>One word backward</td></tr>
|
||||
<tr><td>Ctrl+<b>→</b></td><td>One word forward</td></tr>
|
||||
<tr><td>Ctrl+A</td><td>To start of line</td></tr>
|
||||
<tr><td>Ctrl+E</td><td>To end of line</td></tr>
|
||||
<tr><td>Ctrl+P</td><td>One line up</td></tr>
|
||||
<tr><td>Ctrl+N</td><td>One line down</td></tr>
|
||||
<tr><td>Ctrl+<b>↑</b></td><td>To previous block</td></tr>
|
||||
<tr><td>Ctrl+<b>↓</b></td><td>To next block</td></tr>
|
||||
<tr><td>Ctrl+Y</td><td>One page up</td></tr>
|
||||
<tr><td>Ctrl+V</td><td>One page down</td></tr>
|
||||
<tr><td>Alt+\</td><td>To top of buffer</td></tr>
|
||||
<tr><td>Alt+/</td><td>To end of buffer</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Special movement</b>
|
||||
<table><tbody>
|
||||
<tr><td>Alt+G </td><td>Go to specified line</td></tr>
|
||||
<tr><td>Alt+]</td><td>Go to complementary bracket</td></tr>
|
||||
<tr><td>Alt+<b>↑</b></td><td>Scroll viewport up</td></tr>
|
||||
<tr><td>Alt+<b>↓</b></td><td>Scroll viewport down</td></tr>
|
||||
<tr><td>Alt+<</td><td>Switch to preceding buffer</td></tr>
|
||||
<tr><td>Alt+></td><td>Switch to succeeding buffer</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Information</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+C </td><td>Report cursor position</td></tr>
|
||||
<tr><td>Alt+D</td><td>Report word/line/char count</td></tr>
|
||||
<tr><td>Ctrl+G</td><td>Display help text</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Various</b>
|
||||
<table><tbody>
|
||||
<tr><td>Alt+A</td><td>Turn the mark on/off</td></tr>
|
||||
<tr><td>Tab</td><td>Indent marked region</td></tr>
|
||||
<tr><td>Shift+Tab </td><td>Unindent marked region</td></tr>
|
||||
<tr><td>Alt+N</td><td>Turn line numbers on/off</td></tr>
|
||||
<tr><td>Alt+P</td><td>Turn visible whitespace on/off</td></tr>
|
||||
<tr><td>Alt+V</td><td>Enter next keystroke verbatim</td></tr>
|
||||
<tr><td>Ctrl+L</td><td>Refresh the screen</td></tr>
|
||||
<tr><td>Ctrl+Z</td><td>Suspend nano</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
</td></tr>
|
||||
</tbody></table>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
70
doc/faq.html
70
doc/faq.html
@@ -1,9 +1,12 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>The GNU nano editor FAQ</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="description" content="The genesis story of the nano editor, plus the solution to some common problems.">
|
||||
</head>
|
||||
|
||||
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
|
||||
|
||||
<h1>The GNU nano editor FAQ</h1>
|
||||
@@ -28,11 +31,12 @@
|
||||
<a href="#3.1">3.1. How do I install the RPM or DEB package?</a><br>
|
||||
<a href="#3.2">3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</a><br>
|
||||
<a href="#3.3">3.3. Why does everything go into /usr/local?</a><br>
|
||||
<a href="#3.5">3.5. nano should automatically run strip on the binary when installing it!</a><br>
|
||||
<a href="#3.6">3.6. How can I make the executable smaller? This is too bloated!</a><br>
|
||||
<a href="#3.7">3.7. Tell me more about this multibuffer stuff!</a><br>
|
||||
<a href="#3.8">3.8. Tell me more about this verbatim input stuff!</a><br>
|
||||
<a href="#3.9">3.9. How do I make a .nanorc file that nano will read when I start it?</a><br>
|
||||
<a href="#3.4">3.4. nano should automatically run strip on the binary when installing it!</a><br>
|
||||
<a href="#3.5">3.5. How can I make the executable smaller? This is too bloated!</a><br>
|
||||
<a href="#3.6">3.6. Tell me more about this multibuffer stuff!</a><br>
|
||||
<a href="#3.7">3.7. Tell me more about this verbatim input stuff!</a><br>
|
||||
<a href="#3.8">3.8. How do I make a .nanorc file that nano will read when I start it?</a><br>
|
||||
<a href="#3.9">3.9. Why does my self-compiled nano not read /etc/nanorc?</a><br>
|
||||
</p></blockquote>
|
||||
<h3><a href="#4">4. Running</a></h3>
|
||||
<blockquote><p>
|
||||
@@ -85,7 +89,7 @@
|
||||
<h3><a name="1.3"></a>1.3. Why the name change from TIP?</h3>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h3><a name="1.4"></a>1.4. What is the current version of nano?</h3>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>4.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>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>4.8</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%">
|
||||
@@ -94,8 +98,8 @@
|
||||
<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>
|
||||
<li><a href="https://nano-editor.org/dist/latest/">https://nano-editor.org/dist/latest/</a></li>
|
||||
<li><a href="https://ftpmirror.gnu.org/gnu/nano/">https://ftpmirror.gnu.org/gnu/nano/</a></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<h3><a name="2.2"></a>2.2. RPM packages (RedHat, OpenSuse, and derivatives).</h3>
|
||||
@@ -112,7 +116,7 @@
|
||||
<li><a href="https://packages.debian.org/testing/editors/nano">testing</a></li>
|
||||
<li><a href="https://packages.debian.org/unstable/editors/nano">unstable</a></li>
|
||||
</ul>
|
||||
<p>You can also have a look at the <a href="ftp://ftp.debian.org/debian/pool/main/n/nano/">Package Pool</a> to see all the available binary and source packages.</p>
|
||||
<p>You can also have a look at the <a href="http://ftp.debian.org/debian/pool/main/n/nano/">Package Pool</a> to see all the available binary and source packages.</p>
|
||||
</blockquote>
|
||||
<h3><a name="2.4"></a>2.4. By GIT (for the brave).</h3>
|
||||
<blockquote><p>For the 'bleeding edge' current version of nano, you can use GIT to download the current source code. <b>Note:</b> believe it or not, by downloading code that has not yet stabilized into an official release, there could quite possibly be bugs, in fact the code may not even compile! Anyway, see <a href="http://git.savannah.gnu.org/cgit/nano.git/tree/README.GIT">the nano GIT document</a> for info on anonymous GIT access to the nano source.</p></blockquote>
|
||||
@@ -120,23 +124,23 @@
|
||||
|
||||
<h1><a name="3"></a>3. Installation and Configuration</h1>
|
||||
<h3><a name="3.1"></a>3.1. How do I install the RPM or DEB package?</h3>
|
||||
<blockquote><p>It's simple really! As root, type <b>rpm -Uvh nano-x.y.z-1.i386.rpm</b> if you have a RedHat-ish system or <b>dpkg -i nano_x.y.z-1.deb</b> if you have a Debian-ish system, where <b>x.y.z</b> is the release of nano. There are other programs to install packages, and if you wish to use those, knock yourself out.</p></blockquote>
|
||||
<blockquote><p>It's simple really! As root, type <b>rpm -Uvh nano-x.y-1*.rpm</b> if you have a RedHat-ish system or <b>dpkg -i nano_x.y-1*.deb</b> if you have a Debian-ish system, where <b>x.y</b> is the version number of nano. There are other programs to install packages, and if you wish to use those, knock yourself out.</p></blockquote>
|
||||
<h3><a name="3.2"></a>3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</h3>
|
||||
<blockquote><p>Okay, take a deep breath, this really isn't hard. Unpack the nano source with a command like:</p>
|
||||
<p><b>tar -xvf nano-x.y.z.tar.gz</b></p>
|
||||
<p><b>tar -xvf nano-x.y.tar.gz</b></p>
|
||||
<p>Then you need to run <b>configure</b> with any options you might want (if any).</p>
|
||||
<p>The average case is this:</p>
|
||||
<p><b>cd nano-x.y.z/</b><br>
|
||||
<p><b>cd nano-x.y/</b><br>
|
||||
<b>./configure</b><br>
|
||||
<b>make</b><br>
|
||||
<b>make install</b> (as root, of course)</p></blockquote>
|
||||
<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>
|
||||
<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>
|
||||
<h3><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h3>
|
||||
<p>This will put nano into /usr/bin when you run <b>make install</b>.</p></blockquote>
|
||||
<h3><a name="3.4"></a>3.4. nano should automatically run strip on the binary when installing it!</h3>
|
||||
<blockquote><p>It does when you use <b>make install-strip</b>. The default <b>make install</b> does not, and will not, run strip automatically.</p></blockquote>
|
||||
<h3><a name="3.5"></a>3.5. How can I make the executable smaller? This is too bloated!</h3>
|
||||
<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
|
||||
@@ -156,26 +160,28 @@
|
||||
<b>--disable-tabcomp</b> Disable the tab-completion functions
|
||||
<b>--disable-wordcomp</b> Disable the word-completion function
|
||||
<b>--disable-wrapping</b> Disable all hard-wrapping of text</pre>
|
||||
<p>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the 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>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the undo/redo code and the code for selecting text). Also, if you know you don't need other languages, you can use <b>--disable-nls</b> to disable internationalization and save a few kilobytes. And finally, there's always good old <b>strip</b> to remove all unneeded symbols.</p>
|
||||
</blockquote>
|
||||
<h3><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h3>
|
||||
<h3><a name="3.6"></a>3.6. 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>
|
||||
<h3><a name="3.7"></a>3.7. Tell me more about this verbatim input stuff!</h3>
|
||||
<blockquote><p>When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message "Verbatim Input" on the status bar), then press the key(s) that generate the character you want.</p>
|
||||
<p>Alternatively, if Unicode support is enabled (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code (from 000000 to 10FFFF, case-insensitive), and the character with the corresponding value will be inserted. The status bar will change to "Unicode Input: ......" when you do this.</p></blockquote>
|
||||
<h3><a name="3.9"></a>3.9. How do I make a .nanorc file that will be read when I start nano?</h3>
|
||||
<blockquote><p>It's not hard at all! But, your nano must <b>not</b> have been compiled with <b>--disable-nanorc</b>. Then simply copy the <b>sample.nanorc</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax of the file is simple. Flags are turned on and off by using the words <b>set</b> and <b>unset</b> plus the long option name for the feature. For example, "set nowrap" or "set smarthome".</p></blockquote>
|
||||
<h3><a name="3.8"></a>3.8. How do I make a .nanorc file that will be read when I start nano?</h3>
|
||||
<blockquote><p>It's not hard at all! Simply copy the <b>sample.nanorc</b> from the doc/ directory in the nano source package (or from /usr/doc/nano on your system) to <b>.nanorc</b> in your home directory, and then edit it. If you didn't get a sample nanorc, the syntax of the file is simple: features are turned on and off by using the words <b>set</b> and <b>unset</b> followed by the long option name of the feature (see <b>man nanorc</b> for the full list of options). For example, "set quickblank" or "set smarthome". Of course, for this to work, your nano must <b>not</b> have been compiled with <b>--disable-nanorc</b>.</p></blockquote>
|
||||
<h3><a name="3.9"></a>3.9. Why does my self-compiled nano not read /etc/nanorc?</h3>
|
||||
<blockquote><p>By default (see <a href="#3.3">3.3</a>), nano gets installed into /usr/local. This also means that, at startup, nano will read <b>/usr/local/etc/nanorc</b> instead of <b>/etc/nanorc</b>. You can make a symlink from the former to the latter if you want your self-compiled nano to read the same nanorc as the system-installed nano. Or you can configure your nano to overwrite the system nano (again, see <a href="#3.3">3.3</a>).</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="4"></a>4. Running</h1>
|
||||
<h3><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h3>
|
||||
<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>
|
||||
<blockquote><p>If a command-line argument that begins with '+' is followed by another argument, the former is always treated as a starting line (plus column number), and the latter always as a filename. If a command-line argument that begins with '+' isn't followed by another argument, it's treated as a filename. Examples:</p>
|
||||
<p>To open '+filename.txt': <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>
|
||||
To open '+filename.txt' starting on line 1 and 'filename.txt' starting on line 40: <b>nano +1 +filename.txt +40 filename.txt</b></p></blockquote>
|
||||
<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>
|
||||
@@ -187,9 +193,11 @@
|
||||
<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>
|
||||
<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>
|
||||
<p><i>Update:</i> Since version 4.8, nano will suppress auto-indentation during a paste, so you no longer need to toggle it off and on manually.</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>
|
||||
<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>
|
||||
<p><i>Update:</i> Since version 4.8, nano will ignore linefeed characters in a paste, so you no longer need the above workaround.</p></blockquote>
|
||||
<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>
|
||||
@@ -203,8 +211,8 @@
|
||||
<b>[ ] enable-alternate-editor-implicitly</b></p>
|
||||
<p>Then exit (<b>E</b>) and select Yes (<b>Y</b>).</p>
|
||||
<p>If you're a mutt user, you should see an effect immediately the next time you log in. No further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
|
||||
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
|
||||
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
|
||||
<p><b>my_hdr X-Composer: nano-x.y</b></p>
|
||||
<p>Again, replace x.y with the version of nano you use.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
|
||||
55
doc/nano.1
55
doc/nano.1
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc.
|
||||
.\" Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -16,33 +16,54 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 4.3" "June 2019"
|
||||
.TH NANO 1 "version 4.8" "February 2020"
|
||||
|
||||
.SH NAME
|
||||
nano \- Nano's ANOther editor, inspired by Pico
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.RI [ options "] [[+" line [, column "]]\ " file "]..."
|
||||
.RI [ options "] [[\fB+" line [\fB, column "]] " file ]...
|
||||
.sp
|
||||
.BR nano " [" \fIoptions "] [[" + [ crCR ]( / | ? ) \fIstring "] " \fIfile ]...
|
||||
|
||||
.SH NOTICE
|
||||
Starting with version 4.0, \fBnano\fR no longer hard-wraps an overlong
|
||||
line by default. It further uses smooth scrolling by default, and by
|
||||
default includes the line below the title bar into the editing area.
|
||||
Since version 4.0, \fBnano\fR by default:
|
||||
.sp
|
||||
.RS 4
|
||||
\(bu does not automatically hard-wrap lines that become overlong,
|
||||
.br
|
||||
\(bu includes the line below the title bar in the editing area,
|
||||
.br
|
||||
\(bu does linewise (smooth) scrolling.
|
||||
.RE
|
||||
.sp
|
||||
If you want the old, Pico behavior back, you can use \fB\-\-breaklonglines\fR,
|
||||
\fB\-\-jumpyscrolling\fR, and \fB\-\-emptyline\fR (or \fB\-bje\fR for short).
|
||||
\fB\-\-emptyline\fR, and \fB\-\-jumpyscrolling\fR (or \fB\-bej\fR for short).
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBnano\fP is a small and friendly editor. It copies the look and feel
|
||||
of Pico, but is free software, and implements several features that Pico
|
||||
lacks, such as: opening multiple files, scrolling per line, undo/redo,
|
||||
syntax coloring, line numbering, and soft-wrapping overlong lines.
|
||||
|
||||
.sp
|
||||
When giving a filename on the command line, the cursor can be put on a
|
||||
specific line by adding the line number with a plus sign (\fB+\fR) before
|
||||
the filename, and even in a specific column by adding it with a comma.
|
||||
|
||||
(Negative numbers count from the end of the file or line.)
|
||||
The cursor can be put on the first or last occurrence of a specific string
|
||||
by specifying that string after \fB+/\fR or \fB+?\fR before the filename.
|
||||
The string can be made case sensitive and/or caused to be interpreted as a
|
||||
regular expression by inserting \fBc\fR and/or \fBr\fR after the \fB+\fR sign.
|
||||
These search modes can be explicitly disabled by using the uppercase variant
|
||||
of those letters: \fBC\fR and/or \fBR\fR. When the string contains spaces,
|
||||
it needs to be enclosed in quotes. To give an example: to open a file at
|
||||
the first occurrence of the word "Foo", one would do:
|
||||
.sp
|
||||
.RS 4
|
||||
.BI "nano +c/Foo " file
|
||||
.RE
|
||||
.sp
|
||||
As a special case: if instead of a filename a dash (\fB\-\fR) is given,
|
||||
\fBnano\fR will read data from standard input.
|
||||
|
||||
@@ -91,7 +112,10 @@ numbered one every time a file is saved -- when backups are enabled (\fB\-B\fR).
|
||||
The uniquely numbered files are stored in the specified \fIdirectory\fR.
|
||||
.TP
|
||||
.BR \-D ", " \-\-boldtext
|
||||
Use bold text instead of reverse video text.
|
||||
For the interface, use bold instead of reverse video. This will be overridden
|
||||
by setting the options \fBtitlecolor\fP, \fBstatuscolor\fP, \fBkeycolor\fP,
|
||||
\fBfunctioncolor\fP, \fBnumbercolor\fP, and/or \fBselectedcolor\fP in your
|
||||
nanorc file. See \fBnanorc\fR(5).
|
||||
.TP
|
||||
.BR \-E ", " \-\-tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
@@ -211,6 +235,10 @@ system either Backspace acts like Delete or Delete acts like Backspace.
|
||||
.BR \-e ", " \-\-emptyline
|
||||
Do not use the line below the title bar, leaving it entirely blank.
|
||||
.TP
|
||||
.BR \-f\ \fIfile ", " \-\-rcfile= \fIfile
|
||||
Read only this \fIfile\fR for setting nano's options, instead of reading
|
||||
both the system-wide and the user's nanorc files.
|
||||
.TP
|
||||
.BR \-g ", " \-\-showcursor
|
||||
Make the cursor visible in the file browser (putting it on the
|
||||
highlighted item) and in the help viewer. Useful for braille users
|
||||
@@ -263,8 +291,9 @@ at the width of the screen minus \fInumber\fR columns, allowing the wrap
|
||||
point to vary along with the width of the screen if the screen is resized.
|
||||
The default value is \-8.
|
||||
.TP
|
||||
.BR \-s\ \fIprogram ", " \-\-speller= \fIprogram
|
||||
Use this alternative spell checker command.
|
||||
.B "\-s ""\fIprogram\fR [\fIargument \fR...]\fB""\fR, \fB\-\-speller=""\fIprogram\fR [\fIargument \fR...]\fB"""
|
||||
Use this command to perform spell checking and correcting, instead of
|
||||
using the built-in corrector that calls \fBhunspell\fR or GNU \fBspell\fR.
|
||||
.TP
|
||||
.BR \-t ", " \-\-tempfile
|
||||
Save a changed buffer without prompting (when exiting with \fB^X\fR).
|
||||
@@ -311,6 +340,8 @@ hard-wrapping of long lines, \fBM\-S\fR toggles soft-wrapping,
|
||||
See at the end of the \fB^G\fR help text for a complete list.
|
||||
|
||||
.SH FILES
|
||||
When \fB\-\-rcfile\fR is given, \fBnano\fR will read just the specified file
|
||||
for setting its options and syntaxes and key bindings. Without that option,
|
||||
\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 \fI~/.nanorc\fR or \fI$XDG_CONFIG_HOME/nano/nanorc\fR
|
||||
|
||||
221
doc/nano.texi
221
doc/nano.texi
@@ -8,8 +8,8 @@
|
||||
|
||||
@smallbook
|
||||
@set EDITION 0.5
|
||||
@set VERSION 4.3
|
||||
@set UPDATED June 2019
|
||||
@set VERSION 4.8
|
||||
@set UPDATED February 2020
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @command{nano}
|
||||
@subtitle a small and friendly text editor
|
||||
@subtitle version 4.3
|
||||
@subtitle version 4.8
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -33,7 +33,7 @@ This manual documents the GNU @command{nano} editor.
|
||||
This manual is part of the GNU @command{nano} distribution.@*
|
||||
|
||||
@sp 4
|
||||
Copyright @copyright{} 1999-2009, 2014-2019 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1999-2009, 2014-2020 Free Software Foundation, Inc.
|
||||
|
||||
@sp 1
|
||||
This document is dual-licensed. You may distribute and/or modify it
|
||||
@@ -57,13 +57,13 @@ You may contact the author by
|
||||
e-mail: @email{chrisa@@asty.org}@*
|
||||
@end titlepage
|
||||
|
||||
|
||||
@ifnottex
|
||||
|
||||
|
||||
@node Top
|
||||
@top
|
||||
|
||||
This manual documents the GNU @command{nano} editor, version 4.3.
|
||||
This manual documents the GNU @command{nano} editor, version 4.8.
|
||||
|
||||
@menu
|
||||
* Introduction::
|
||||
@@ -127,13 +127,22 @@ But it is also possible to specify one or more options (see the next
|
||||
section), and to edit several files in a row. Additionally, the cursor
|
||||
can be put on a specific line of a file by adding the line number
|
||||
with a plus sign before the filename, and even in a specific column by
|
||||
adding it with a comma. So a more complete command synopsis is:
|
||||
adding it with a comma.
|
||||
(Negative numbers count from the end of the file or line.)
|
||||
The cursor can also be put on the first or last occurrence of a specific string
|
||||
by specifying that string after @code{+/} or @code{+?} before the filename.
|
||||
The string can be made case sensitive and/or caused to be interpreted as a
|
||||
regular expression by inserting a @code{c} and/or @code{r} after the plus sign.
|
||||
These search modes can be explicitly disabled by using the uppercase variant
|
||||
of those letters: @code{C} and/or @code{R}. When the string contains spaces,
|
||||
it needs to be enclosed in quotes.
|
||||
A more complete command synopsis thus is:
|
||||
|
||||
@iftex
|
||||
@sp 1
|
||||
@end iftex
|
||||
@example
|
||||
@code{nano [OPTION]@dots{} [[+LINE[,COLUMN]|+,COLUMN] FILE]@dots{}}
|
||||
@code{nano [OPTION]@dots{} [[+LINE[,COLUMN]|+[crCR](/|?)STRING] FILE]@dots{}}
|
||||
@end example
|
||||
@iftex
|
||||
@sp 1
|
||||
@@ -148,6 +157,7 @@ As a special case: when instead of a filename a dash is given, @command{nano}
|
||||
will read data from standard input. This means you can pipe the output of
|
||||
a command straight into a buffer, and then edit it.
|
||||
|
||||
|
||||
@node Command-line Options
|
||||
@chapter Command-line Options
|
||||
|
||||
@@ -176,7 +186,10 @@ The uniquely numbered files are stored in the specified directory.
|
||||
|
||||
@item -D
|
||||
@itemx --boldtext
|
||||
Use bold text instead of reverse video text.
|
||||
For the interface, use bold instead of reverse video. This will be overridden
|
||||
by setting the options @code{titlecolor}, @code{statuscolor}, @code{keycolor},
|
||||
@code{functioncolor}, @code{numbercolor}, and/or @code{selectedcolor} in your
|
||||
nanorc file. @xref{@code{set functioncolor}} for details.
|
||||
|
||||
@item -E
|
||||
@itemx --tabstospaces
|
||||
@@ -324,6 +337,11 @@ system either Backspace acts like Delete or Delete acts like Backspace.
|
||||
@itemx --emptyline
|
||||
Do not use the line below the title bar, leaving it entirely blank.
|
||||
|
||||
@item -f @var{file}
|
||||
@itemx --rcfile=@var{file}
|
||||
Read only this @var{file} for setting nano's options, instead of reading
|
||||
both the system-wide and the user's nanorc files.
|
||||
|
||||
@item -g
|
||||
@itemx --showcursor
|
||||
Make the cursor visible in the file browser (putting it on the
|
||||
@@ -388,13 +406,14 @@ point to vary along with the width of the screen if the screen is resized.
|
||||
The default value is @t{-8}.
|
||||
|
||||
@anchor{@option{--speller}}
|
||||
@item -s @var{program}
|
||||
@itemx --speller=@var{program}
|
||||
@item -s "@var{program} [@var{argument} @dots{}]"
|
||||
@itemx --speller="@var{program} [@var{argument} @dots{}]"
|
||||
Use the given program to do spell checking and correcting. By default,
|
||||
@command{nano} uses the command specified in the @env{SPELL} environment
|
||||
variable. If @env{SPELL} is not set, and @option{--speller} is
|
||||
not specified either, then @command{nano} uses its own interactive spell
|
||||
corrector, which requires the GNU @command{spell} program to be installed.
|
||||
corrector, which requires either @command{hunspell} or GNU @command{spell}
|
||||
to be installed.
|
||||
|
||||
@item -t
|
||||
@itemx --tempfile
|
||||
@@ -423,7 +442,6 @@ This is the default. (This option is the opposite of @option{-b}
|
||||
(@option{--breaklonglines}) --- the last one given takes effect.)
|
||||
|
||||
|
||||
@anchor{Expert Mode}
|
||||
@item -x
|
||||
@itemx --nohelp
|
||||
Expert Mode: don't show the Shortcut List at the bottom of the screen.
|
||||
@@ -606,6 +624,7 @@ The recording and playback of keyboard macros works correctly only on a
|
||||
terminal emulator, not on a Linux console (VT), because the latter does
|
||||
not by default distinguish modified from unmodified arrow keys.
|
||||
|
||||
|
||||
@node Built-in Help
|
||||
@chapter Built-in Help
|
||||
|
||||
@@ -673,16 +692,20 @@ The following global toggles are available:
|
||||
|
||||
The nanorc files contain the default settings for @command{nano}. They
|
||||
should be in Unix format, not in DOS or Mac format. During startup,
|
||||
@command{nano} will first read the system-wide settings, from /etc/nanorc
|
||||
(the exact path might be different), and then the user-specific settings,
|
||||
if @option{--rcfile} is not given, @command{nano} will read two files:
|
||||
first the system-wide settings, from @file{/etc/nanorc} (the exact path
|
||||
might be different on your system), and then the user-specific settings,
|
||||
either from @file{~/.nanorc} or from @file{$XDG_CONFIG_HOME/nano/nanorc}
|
||||
or from @file{.config/nano/nanorc}, whichever exists first.
|
||||
If @option{--rcfile} is given, @command{nano} will read just the
|
||||
specified settings file.
|
||||
|
||||
A nanorc file accepts a series of "set" and "unset" commands, which can
|
||||
be used to configure @command{nano} on startup without using command-line
|
||||
options. Additionally, there are some commands to define syntax highlighting
|
||||
and to rebind keys --- @pxref{Syntax Highlighting} and @ref{Rebinding Keys}.
|
||||
@command{nano} will read one command per line.
|
||||
All commands and keywords should be written in lowercase.
|
||||
|
||||
Options in nanorc files take precedence over @command{nano}'s defaults, and
|
||||
command-line options override nanorc settings. Also, options that do not
|
||||
@@ -735,9 +758,9 @@ The uniquely numbered files are stored in the specified directory.
|
||||
|
||||
@item 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
|
||||
function tags, line numbers, and selected text. This is overridden by
|
||||
setting the options @code{titlecolor}, @code{statuscolor}, @code{keycolor},
|
||||
@code{functioncolor}, @code{numbercolor}, and @code{selectedcolor}.
|
||||
@code{functioncolor}, @code{numbercolor}, and/or @code{selectedcolor}.
|
||||
|
||||
@item set brackets "@var{characters}"
|
||||
Set the characters treated as closing brackets when justifying
|
||||
@@ -835,8 +858,7 @@ Don't automatically add a newline when a text does not end with one.
|
||||
(This can cause you to save non-POSIX text files.)
|
||||
|
||||
@item set nopauses
|
||||
Don't pause between warnings at startup. This means that only
|
||||
the last one will be visible (when there are multiple ones).
|
||||
Obsolete option. Ignored.
|
||||
|
||||
@item set nowrap
|
||||
Deprecated option since it has become the default setting.
|
||||
@@ -915,7 +937,7 @@ When needed, use @code{unset jumpyscrolling} instead.
|
||||
@item set softwrap
|
||||
Enable soft line wrapping for easier viewing of very long lines.
|
||||
|
||||
@item set speller "@var{program}"
|
||||
@item set speller "@var{program} [@var{argument} @dots{}]"
|
||||
Use the given program to do spell checking and correcting.
|
||||
@xref{@option{--speller}} for details.
|
||||
|
||||
@@ -989,7 +1011,7 @@ powerful enough to fully parse a file. Nevertheless, regular
|
||||
expressions can do a lot and are easy to make, so they are a
|
||||
good fit for a small editor like @command{nano}.
|
||||
|
||||
All regular expressions in @command{nano} are extended regular expressions
|
||||
All regular expressions in @command{nano} are POSIX extended regular expressions
|
||||
(ERE). This means that @code{.}, @code{?}, @code{*}, @code{+}, @code{^},
|
||||
@code{$}, and several other characters are special.
|
||||
The period @code{.} matches any single character,
|
||||
@@ -1021,7 +1043,7 @@ activated by using the @option{-Y} or @option{--syntax}
|
||||
command-line option followed by the @var{name}.
|
||||
|
||||
The @code{default} syntax is special: it takes no @var{fileregex},
|
||||
and applies to files that don't match any syntax's @var{fileregex}.
|
||||
and applies to files that don't match any syntax's regexes.
|
||||
The @code{none} syntax is reserved; specifying it on the
|
||||
command line is the same as not having a syntax at all.
|
||||
|
||||
@@ -1038,7 +1060,13 @@ file, to determine whether this syntax should be used for it.
|
||||
(This functionality only works when @code{libmagic} is installed
|
||||
on the system and will be silently ignored otherwise.)
|
||||
|
||||
@item linter @var{program} [@var{arg} @dots{}]
|
||||
@item formatter @var{program} [@var{argument} @dots{}]
|
||||
Run the given @var{program} on the full contents of the current buffer.
|
||||
(The current buffer is written out to a temporary file, the program is
|
||||
run on it, and then the temporary file is read back in, replacing the
|
||||
contents of the buffer.)
|
||||
|
||||
@item linter @var{program} [@var{argument} @dots{}]
|
||||
Use the given @var{program} to do a syntax check on the current buffer.
|
||||
|
||||
@item comment "@var{string}"
|
||||
@@ -1052,26 +1080,33 @@ Python files. If empty double quotes are specified, the comment/uncomment
|
||||
functions are disabled; for example, @t{""} for JSON.
|
||||
The default value is @t{"#"}.
|
||||
|
||||
@item tabgives "@var{string}"
|
||||
Make the <Tab> key produce the given @var{string}. Useful for languages like
|
||||
Python that want to see only spaces for indentation.
|
||||
This overrides the setting of the @code{tabstospaces} option.
|
||||
|
||||
@item color @var{fgcolor},@var{bgcolor} "@var{regex}" @dots{}
|
||||
Display all pieces of text that match the
|
||||
extended regular expression "regex" with foreground color "fgcolor" and
|
||||
background color "bgcolor", at least one of which must be specified.
|
||||
Valid names for foreground and background color are:
|
||||
Paint all pieces of text that match the extended regular expression "regex"
|
||||
with the given foreground and background colors, at least one of which must
|
||||
be specified. Valid color names are:
|
||||
@code{white}, @code{black}, @code{blue}, @code{green},
|
||||
@code{red}, @code{cyan}, @code{yellow}, @code{magenta}, and @code{normal}
|
||||
--- where @code{normal} means the default foreground or background color.
|
||||
You may use the prefix @code{bright}
|
||||
to get a stronger color highlight for the foreground. If your
|
||||
terminal supports transparency, not specifying a "bgcolor" tells @command{nano}
|
||||
to attempt to use a transparent background.
|
||||
You may use the prefix @code{bright} for the foreground color to get a
|
||||
stronger highlight.
|
||||
If your terminal supports transparency, not specifying a "bgcolor"
|
||||
tells @command{nano} to attempt to use a transparent background.
|
||||
|
||||
All coloring commands are applied in the order in which they are specified,
|
||||
which means that later commands can recolor stuff that was colored earlier.
|
||||
|
||||
@item icolor @var{fgcolor},@var{bgcolor} "@var{regex}" @dots{}
|
||||
Same as above, except that the matching is case insensitive.
|
||||
|
||||
@item color @var{fgcolor},@var{bgcolor} start="@var{fromrx}" end="@var{torx}"
|
||||
Display all pieces of text whose start matches extended regular expression
|
||||
Paint all pieces of text whose start matches extended regular expression
|
||||
"fromrx" and whose end matches extended regular expression "torx" with
|
||||
foreground color "fgcolor" and background color "bgcolor", at least one of
|
||||
the given foreground and background colors, at least one of
|
||||
which must be specified. This means that, after an initial instance of
|
||||
"fromrx", all text until the first instance of "torx" will be colored.
|
||||
This allows syntax highlighting to span multiple lines.
|
||||
@@ -1084,31 +1119,16 @@ Read in self-contained color syntaxes from "syntaxfile". Note that
|
||||
"syntaxfile" may contain only the above commands, from @code{syntax}
|
||||
to @code{icolor}.
|
||||
|
||||
@item extendsyntax @var{name} @var{command} [@var{arg} @dots{}]
|
||||
@item extendsyntax @var{name} @var{command} @var{argument} @dots{}
|
||||
Extend the syntax previously defined as "@var{name}" with another @var{command}.
|
||||
This allows you to add a new @code{color}, @code{icolor}, @code{header},
|
||||
@code{magic}, @code{comment}, or @code{linter} command to an already
|
||||
@code{magic}, @code{formatter}, @code{linter}, @code{comment},
|
||||
or @code{tabgives} command to an already
|
||||
defined syntax --- useful when you want to slightly improve a syntax defined
|
||||
in one of the system-installed files (which normally are not writable).
|
||||
|
||||
@end table
|
||||
|
||||
Note: the @code{formatter} command has been removed. It was superseded by
|
||||
a more general mechanism: the filtering of buffer or marked text through
|
||||
an external command. Such filtering is done by typing @code{^R^X} and then
|
||||
preceding your formatter command with the pipe symbol (@code{|}). It has
|
||||
the added advantage that the operation can be undone.
|
||||
|
||||
If you use such a formatting command regularly, you could assign the relevant
|
||||
series of keystrokes to a single key in your nanorc:
|
||||
|
||||
@example
|
||||
bind M-F "^R^X|yourformatcommand^M" main
|
||||
@end example
|
||||
|
||||
(Note that the @key{^R}, @key{^X}, and @key{^M} are each a single, literal
|
||||
control character. You can enter them by preceding each with @key{M-V}.)
|
||||
|
||||
@node Rebinding Keys
|
||||
@section Rebinding Keys
|
||||
|
||||
@@ -1119,7 +1139,7 @@ nanorc file:
|
||||
|
||||
@item bind key function menu
|
||||
Rebinds @code{key} to @code{function} in the context of @code{menu}
|
||||
(or in all menus where the function exists by using @code{all}).
|
||||
(or in all menus where the function exists when @code{all} is used).
|
||||
|
||||
@item bind key "string" menu
|
||||
Makes @code{key} produce @code{string} in the context of @code{menu}
|
||||
@@ -1130,7 +1150,7 @@ with @kbd{M-V}.)
|
||||
|
||||
@item unbind key menu
|
||||
Unbinds @code{key} from @code{menu}
|
||||
(or from all menus where it exists by using @code{all}).
|
||||
(or from all menus where the key exists when @code{all} is used).
|
||||
|
||||
@end table
|
||||
|
||||
@@ -1139,22 +1159,36 @@ The format of @code{key} should be one of:
|
||||
|
||||
@itemize @w{}
|
||||
@item
|
||||
@code{^}@ followed by a Latin letter, by one of several ASCII characters
|
||||
(@@, ], \, ^, or _), or by the word "Space".
|
||||
@code{^@var{X}} ------ where @var{X} is a Latin letter, or one of several
|
||||
ASCII characters (@@, ], \, ^, _), or the word "Space".
|
||||
Example: @code{^C}.
|
||||
|
||||
@item
|
||||
@code{M-}@ followed by any ASCII character except [, or by the word "Space".
|
||||
Example: @code{M-C}.
|
||||
@code{M-@var{X}} ------ where @var{X} is any ASCII character except [,
|
||||
or the word "Space".
|
||||
Example: @code{M-8}.
|
||||
|
||||
@item
|
||||
@code{F}@ followed by a numeric value from 1 to 16.
|
||||
@code{Sh-M-@var{X}} ------ where @var{X} is a Latin letter.
|
||||
Example: @code{Sh-M-U}.
|
||||
By default, each Meta+letter keystroke does the same as the corresponding
|
||||
Shift+Meta+letter. But when any Shift+Meta bind is made, that will
|
||||
no longer be the case, for all letters.
|
||||
|
||||
@item
|
||||
@code{F@var{n}} ------ where @var{n} is a numeric value from 1 to 24.
|
||||
Example: @code{F10}.
|
||||
(Often, @code{F13} to @code{F24} can be typed as @code{F1} to @code{F12}
|
||||
with Shift.)
|
||||
|
||||
@item
|
||||
the word "Ins" or the word "Del".
|
||||
@code{Ins} or @code{Del}.
|
||||
@end itemize
|
||||
|
||||
Rebinding @code{^M} (Enter) or @code{^I} (Tab) is probably not a good idea.
|
||||
On some terminals it's not possible to rebind @code{^H} (unless @code{--raw}
|
||||
is used) because its keycode is identical to that of the Backspace key.
|
||||
|
||||
@sp 1
|
||||
Valid names for the @code{function} to be bound are:
|
||||
|
||||
@@ -1234,8 +1268,12 @@ Shows the current cursor position: the line, column, and character positions.
|
||||
Counts the number of words, lines and characters in the current buffer.
|
||||
|
||||
@item speller
|
||||
Invokes a spell-checking program, either the default one, or the one
|
||||
defined by @option{--speller} or @code{set speller}.
|
||||
Invokes a spell-checking program, either the default @command{hunspell}
|
||||
or GNU @command{spell}, or the one defined by @option{--speller} or
|
||||
@code{set speller}.
|
||||
|
||||
@item formatter
|
||||
Invokes a full-buffer-processing program (if the active syntax defines one).
|
||||
|
||||
@item linter
|
||||
Invokes a syntax-checking program (if the active syntax defines one).
|
||||
@@ -1519,7 +1557,7 @@ The menu for inserting output from an external command, reached from the insert
|
||||
The help-viewer menu.
|
||||
|
||||
@item spell
|
||||
The interactive spell checker Yes/no menu.
|
||||
The menu of the integrated spell checker where the user can edit a misspelled word.
|
||||
|
||||
@item linter
|
||||
The linter menu.
|
||||
@@ -1580,7 +1618,7 @@ whereas Pico does it at screen width minus six columns. You can make
|
||||
By default, @command{nano} will scroll just one line (instead of half
|
||||
a screen) when the cursor is moved to a line that is just out of view.
|
||||
And when paging up or down, @command{nano} keeps the cursor in the same
|
||||
screen position as much as possible, instead always placing it on the
|
||||
screen position as much as possible, instead of always placing it on the
|
||||
first line of the viewport. The Pico-like behavior can be obtained
|
||||
with the @option{--jumpyscrolling} option.
|
||||
|
||||
@@ -1677,54 +1715,54 @@ The possible options to @code{./configure} are:
|
||||
@table @code
|
||||
|
||||
@item --disable-browser
|
||||
Disable the mini file browser that can be called with @kbd{^T} when reading
|
||||
or writing files.
|
||||
Exclude the mini file browser that can be called with @kbd{^T} when
|
||||
wanting to read or write a file.
|
||||
|
||||
@item --disable-color
|
||||
Disable support for the syntax coloring of files. This also eliminates
|
||||
the @option{-Y} command-line option, which chooses a specific syntax.
|
||||
Exclude support for syntax coloring. This also eliminates the @option{-Y}
|
||||
command-line option, which allows choosing a specific syntax.
|
||||
|
||||
@item --disable-comment
|
||||
Disable the single-keystroke comment/uncomment function (@kbd{M-3}).
|
||||
Exclude the single-keystroke comment/uncomment function (@kbd{M-3}).
|
||||
|
||||
@item --disable-extra
|
||||
Disable the Easter egg: a crawl of major contributors.
|
||||
Exclude the Easter egg: a crawl of major contributors.
|
||||
|
||||
@item --disable-help
|
||||
Disable the help function. Doing this makes the binary much smaller,
|
||||
but makes it difficult for new users to learn more than very basic
|
||||
Exclude the help texts (@kbd{^G}). This makes the binary much smaller,
|
||||
but also makes it difficult for new users to learn more than very basic
|
||||
things about using the editor.
|
||||
|
||||
@item --disable-histories
|
||||
Disable the code for the handling of the history files: the search and
|
||||
Exclude the code for handling the history files: the search and
|
||||
replace strings that were used, and the cursor position at which each
|
||||
file was closed. This also eliminates the @option{-H} and @option{-P}
|
||||
command-line options, which switch on the logging of search/replace
|
||||
strings and cursor positions.
|
||||
|
||||
@item --disable-justify
|
||||
Disable the justify and unjustify functions.
|
||||
Exclude the justify functions (@kbd{^J} and @kbd{M-J}).
|
||||
|
||||
@item --disable-libmagic
|
||||
Disable the use of the library of magic-number tests (for determining
|
||||
the file type and thus which syntax to use for colouring --- often the
|
||||
tests on filename extension and header line will be enough).
|
||||
Exclude the code for using the library of magic-number tests (for determining
|
||||
the file type and thus which syntax to use for coloring --- often the regexes
|
||||
for filename and header line will be enough).
|
||||
|
||||
@item --disable-linenumbers
|
||||
Disable the line-numbering function (@kbd{M-#}). This also eliminates the
|
||||
Exclude the line-numbering function (@kbd{M-N}). This also eliminates the
|
||||
@option{-l} command-line option, which turns line numbering on.
|
||||
|
||||
@item --disable-mouse
|
||||
Disable all mouse functionality. This also eliminates the @option{-m}
|
||||
Exclude all mouse functionality. This also eliminates the @option{-m}
|
||||
command-line option, which enables the mouse functionality.
|
||||
|
||||
@item --disable-multibuffer
|
||||
Disable support for opening multiple files at a time and switching
|
||||
Exclude support for opening multiple files at a time and switching
|
||||
between them on the fly. This also eliminates the @option{-F} command-line
|
||||
option, which causes a file to be read into a separate buffer by default.
|
||||
|
||||
@item --disable-nanorc
|
||||
Disable support for reading the nanorc files at startup. With such
|
||||
Exclude support for reading the nanorc files at startup. With such
|
||||
support, you can store custom settings in a system-wide and a per-user
|
||||
nanorc file rather than having to pass command-line options to get
|
||||
the desired behavior. @xref{Nanorc Files} for more info.
|
||||
@@ -1732,22 +1770,23 @@ Disabling this also eliminates the @option{-I} command-line option,
|
||||
which inhibits the reading of nanorc files.
|
||||
|
||||
@item --disable-operatingdir
|
||||
Disable setting the operating directory. This also eliminates the @option{-o}
|
||||
command-line option, which sets the operating directory.
|
||||
Exclude the code for setting the operating directory. This also eliminates
|
||||
the @option{-o} command-line option, which sets the operating directory.
|
||||
|
||||
@item --disable-speller
|
||||
Disable use of the spell checker. This also eliminates the @option{-s}
|
||||
Exclude the code for spell checking. This also eliminates the @option{-s}
|
||||
command-line option, which allows specifying an alternate spell checker.
|
||||
|
||||
@item --disable-tabcomp
|
||||
Disable tab completion (when nano asks for a filename or a search string).
|
||||
Exclude tab completion (when nano asks for a filename or a search string).
|
||||
|
||||
@item --disable-wordcomp
|
||||
Disable word completion (@kbd{^]}).
|
||||
Exclude word completion (@kbd{^]}).
|
||||
|
||||
@item --disable-wrapping
|
||||
Disable all hard-wrapping of overlong lines. This also eliminates the
|
||||
@option{-w} command-line option, which switches long-line wrapping off.
|
||||
Exclude all hard-wrapping of overlong lines. This also eliminates the
|
||||
@option{-b} and @option{-w} command-line options, which switch automatic
|
||||
long-line wrapping on and off, respectively.
|
||||
|
||||
@item --enable-tiny
|
||||
This option implies all of the above. It also disables some other
|
||||
@@ -1757,19 +1796,19 @@ counterpart of the above options together with @option{--enable-tiny},
|
||||
specific features can be switched back on --- but a few cannot.
|
||||
|
||||
@item --enable-debug
|
||||
Enable support for runtime debug output. This can get pretty messy, so
|
||||
Include some code for runtime debugging output. This can get pretty messy, so
|
||||
chances are you only want this feature when you're working on the nano source.
|
||||
|
||||
@item --disable-nls
|
||||
Disables Native Language support. This will disable the use of any
|
||||
Exclude Native Language support. This will disable the use of any
|
||||
available GNU @command{nano} translations.
|
||||
|
||||
@item --enable-utf8
|
||||
Enable support for reading and writing Unicode files. This will require
|
||||
Include support for reading and writing Unicode files. This will require
|
||||
either a wide version of curses, or a UTF-8-enabled version of Slang.
|
||||
|
||||
@item --disable-utf8
|
||||
Disable support for reading and writing Unicode files. Normally the
|
||||
Exclude support for reading and writing Unicode files. Normally the
|
||||
configure script auto-detects whether to enable UTF-8 support or not.
|
||||
You can use this or the previous option to override that detection.
|
||||
|
||||
|
||||
157
doc/nanorc.5
157
doc/nanorc.5
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2003-2011, 2013-2019 Free Software Foundation, Inc.
|
||||
.\" Copyright (C) 2003-2011, 2013-2020 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -16,27 +16,36 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 4.3" "June 2019"
|
||||
.TH NANORC 5 "version 4.8" "February 2020"
|
||||
|
||||
.SH NAME
|
||||
nanorc \- GNU nano's configuration file
|
||||
|
||||
.SH NOTICE
|
||||
Starting with version 4.0, \fBnano\fR no longer hard-wraps an overlong
|
||||
line by default. It further uses smooth scrolling by default, and by
|
||||
default includes the line below the title bar into the editing area.
|
||||
.sp
|
||||
If you want the old, Pico behavior back, you can use \fBset breaklonglines\fR,
|
||||
\fBset jumpyscrolling\fR, and \fBset emptyline\fR.
|
||||
|
||||
.SH DESCRIPTION
|
||||
The \fInanorc\fP file contains the default settings for \fBnano\fP, a
|
||||
small and friendly editor. The file should be in Unix format, not in
|
||||
DOS or Mac format. During startup, \fBnano\fP will first read the
|
||||
The \fInanorc\fP files contain the default settings for \fBnano\fP, a
|
||||
small and friendly editor. They should be in Unix format, not in
|
||||
DOS or Mac format. During startup, if \fB\-\-rcfile\fR is not given,
|
||||
\fBnano\fR will read two files: first the
|
||||
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 \fI~/.nanorc\fR or from \fI$XDG_CONFIG_HOME/nano/nanorc\fR
|
||||
or from \fI~/.config/nano/nanorc\fR, whichever is encountered first.
|
||||
If \fB\-\-rcfile\fR is given, \fBnano\fR will read just the specified
|
||||
settings file.
|
||||
|
||||
.SH NOTICE
|
||||
Since version 4.0, \fBnano\fR by default:
|
||||
.sp
|
||||
.RS 4
|
||||
\(bu does not automatically hard-wrap lines that become overlong,
|
||||
.br
|
||||
\(bu includes the line below the title bar in the editing area,
|
||||
.br
|
||||
\(bu does linewise (smooth) scrolling.
|
||||
.RE
|
||||
.sp
|
||||
To get the old, Pico behavior back, you can use \fBset breaklonglines\fR,
|
||||
\fBset emptyline\fR, and \fBset jumpyscrolling\fR.
|
||||
|
||||
.SH OPTIONS
|
||||
The configuration file accepts a series of \fBset\fP and \fBunset\fP
|
||||
@@ -44,6 +53,7 @@ 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.
|
||||
All commands and keywords should be written in lowercase.
|
||||
.sp
|
||||
Options in \fInanorc\fP files take precedence over nano's defaults, and
|
||||
command-line options override \fInanorc\fP settings. Also, options that
|
||||
@@ -183,8 +193,7 @@ Don't automatically add a newline when a text does not end with one.
|
||||
(This can cause you to save non-POSIX text files.)
|
||||
.TP
|
||||
.B set nopauses
|
||||
Don't pause between warnings at startup. This means that only
|
||||
the last one will be visible (when there are multiple ones).
|
||||
Obsolete option. Ignored.
|
||||
.TP
|
||||
.B set nowrap
|
||||
Deprecated option since it has become the default setting.
|
||||
@@ -261,9 +270,9 @@ When needed, use \fBunset jumpyscrolling\fR instead.
|
||||
.B set softwrap
|
||||
Enable soft line wrapping for easier viewing of very long lines.
|
||||
.TP
|
||||
.B set speller "\fIprogram\fP"
|
||||
Use the given \fIprogram\fR to do spell checking and correcting,
|
||||
instead of the built-in corrector that calls \fBspell\fR.
|
||||
.B set speller """\fIprogram\fR [\fIargument \fR...]\fB"""
|
||||
Use the given \fIprogram\fR to do spell checking and correcting, instead of
|
||||
using the built-in corrector that calls \fBhunspell\fR or GNU \fBspell\fR.
|
||||
.TP
|
||||
.B set statuscolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the status bar.
|
||||
@@ -335,7 +344,7 @@ powerful enough to fully parse a file. Nevertheless, regular
|
||||
expressions can do a lot and are easy to make, so they are a
|
||||
good fit for a small editor like \fBnano\fR.
|
||||
.sp
|
||||
All regular expressions in \fBnano\fR are extended regular expressions (ERE).
|
||||
All regular expressions in \fBnano\fR are POSIX extended regular expressions.
|
||||
This means that \fB.\fR, \fB?\fR, \fB*\fR, \fB+\fR, \fB^\fR, \fB$\fR, and
|
||||
several other characters are special.
|
||||
The period \fB.\fR matches any single character,
|
||||
@@ -382,7 +391,13 @@ file, to determine whether this syntax should be used for it.
|
||||
(This functionality only works when \fBlibmagic\fP is installed on the
|
||||
system and will be silently ignored otherwise.)
|
||||
.TP
|
||||
.BI linter " program " \fR[ "arg " \fR...]
|
||||
.BI formatter " program " \fR[ "argument " \fR...]
|
||||
Run the given \fIprogram\fR on the full contents of the current buffer.
|
||||
(The current buffer is written out to a temporary file, the program is
|
||||
run on it, and then the temporary file is read back in, replacing the
|
||||
contents of the buffer.)
|
||||
.TP
|
||||
.BI linter " program " \fR[ "argument " \fR...]
|
||||
Use the given \fIprogram\fR to run a syntax check on the current buffer.
|
||||
.TP
|
||||
.BI "comment """ string """
|
||||
@@ -396,26 +411,32 @@ for Python files. If empty double quotes are specified, the comment/uncomment
|
||||
function is disabled; for example, "" for JSON.
|
||||
The default value is "\fB#\fP".
|
||||
.TP
|
||||
.BI "tabgives """ string """
|
||||
Make the <Tab> key produce the given \fIstring\fR. Useful for languages like
|
||||
Python that want to see only spaces for indentation.
|
||||
This overrides the setting of the \fBtabstospaces\fR option.
|
||||
.TP
|
||||
.BI "color " fgcolor , bgcolor " """ regex """ " \fR...
|
||||
Display all pieces of text that match
|
||||
the extended regular expression \fIregex\fP with foreground color
|
||||
\fIfgcolor\fP and background color \fIbgcolor\fP, at least one of which
|
||||
must be specified. Valid names for foreground and background colors are:
|
||||
Paint all pieces of text that match the extended regular expression
|
||||
\fIregex\fP with the given foreground and background colors, at least
|
||||
one of which must be specified. Valid color names are:
|
||||
.BR white ", " black ", " blue ", " green ", " red ", "
|
||||
.BR cyan ", " yellow ", " magenta ", and " normal
|
||||
-- where \fBnormal\fR means the default foreground or background color.
|
||||
You may use the prefix \fBbright\fR to get a stronger color highlight for the
|
||||
foreground. If your terminal supports transparency, not specifying a
|
||||
\fIbgcolor\fP tells \fBnano\fP to attempt to use a transparent
|
||||
background.
|
||||
You may use the prefix \fBbright\fR for the foreground color to get a
|
||||
stronger highlight. If your terminal supports transparency, not specifying
|
||||
a \fIbgcolor\fP tells \fBnano\fP to attempt to use a transparent background.
|
||||
.sp
|
||||
All coloring commands are applied in the order in which they are specified,
|
||||
which means that later commands can recolor stuff that was colored earlier.
|
||||
.TP
|
||||
.BI "icolor " fgcolor , bgcolor " """ regex """ " \fR...
|
||||
Same as above, except that the matching is case insensitive.
|
||||
.TP
|
||||
.BI "color " fgcolor , bgcolor " start=""" fromrx """ end=""" torx """
|
||||
Display all pieces of text whose start matches extended regular expression
|
||||
\fIfromrx\fP and whose end matches extended regular expression \fItorx\fP with
|
||||
foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
|
||||
Paint all pieces of text whose start matches extended regular expression
|
||||
\fIfromrx\fP and whose end matches extended regular expression \fItorx\fP
|
||||
with the given foreground and background colors,
|
||||
at least one of which must be specified. This means that, after an
|
||||
initial instance of \fIfromrx\fP, all text until the first instance of
|
||||
\fItorx\fP will be colored. This allows syntax highlighting to span
|
||||
@@ -429,39 +450,22 @@ 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.
|
||||
.TP
|
||||
.BI extendsyntax " name command " \fR[ "arg " \fR...]
|
||||
.BI extendsyntax " name command argument " \fR...
|
||||
Extend the syntax previously defined as \fIname\fR with another
|
||||
\fIcommand\fR. This allows adding a new \fBcolor\fP, \fBicolor\fP,
|
||||
\fBheader\fP, \fBmagic\fP, \fBcomment\fP, or \fBlinter\fP
|
||||
\fBheader\fR, \fBmagic\fR, \fBformatter\fR, \fBlinter\fR, \fBcomment\fR,
|
||||
or \fBtabgives\fR
|
||||
command to an already defined syntax -- useful when you want to
|
||||
slightly improve a syntax defined in one of the system-installed
|
||||
files (which normally are not writable).
|
||||
|
||||
.P
|
||||
Note: the \fBformatter\fR command has been removed. It was superseded by
|
||||
a more general mechanism: the filtering of buffer or marked text through
|
||||
an external command. Such filtering is done by typing \fB^R^X\fR and then
|
||||
preceding your formatter command with the pipe symbol (\fB|\fR). It has
|
||||
the added advantage that the operation can be undone.
|
||||
.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 three commands:
|
||||
.RS 3
|
||||
.TP
|
||||
.BI bind " key function menu"
|
||||
Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the
|
||||
context of menu \fImenu\fP (or in all menus where the function exists
|
||||
by using \fBall\fP).
|
||||
Rebinds the given \fIkey\fP to the given \fIfunction\fP in the given \fImenu\fP
|
||||
(or in all menus where the function exists when \fBall\fP is used).
|
||||
.TP
|
||||
.BI bind " key " """" string """" " menu"
|
||||
Makes the given \fIkey\fR produce the given \fIstring\fR in the given
|
||||
@@ -469,33 +473,45 @@ Makes the given \fIkey\fR produce the given \fIstring\fR in the given
|
||||
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).
|
||||
Unbinds the given \fIkey\fP from the given \fImenu\fP (or from all
|
||||
menus where the key exists when \fBall\fP is used).
|
||||
.RE
|
||||
|
||||
.TP
|
||||
The format of \fIkey\fP should be one of:
|
||||
.RS 3
|
||||
.TP 3
|
||||
.B ^
|
||||
followed by a Latin letter, by one of several ASCII characters
|
||||
(@, ], \\, ^, or _), or by the word "Space".
|
||||
.TP 7
|
||||
.BI ^ X
|
||||
where \fIX\fR is a Latin letter, or one of several ASCII characters
|
||||
(@, ], \\, ^, _), or the word "Space".
|
||||
Example: ^C.
|
||||
.TP
|
||||
.B M\-
|
||||
followed by any ASCII character except [, or by the word "Space".
|
||||
Example: M\-C.
|
||||
.BI M\- X
|
||||
where \fIX\fR is any ASCII character except [, or the word "Space".
|
||||
Example: M\-8.
|
||||
.TP
|
||||
.B F
|
||||
followed by a numeric value from 1 to 16.
|
||||
.BI Sh\-M\- X
|
||||
where \fIX\fR is a Latin letter.
|
||||
Example: Sh\-M\-U.
|
||||
By default, each Meta+letter keystroke does the same as the corresponding
|
||||
Shift+Meta+letter. But when any Shift+Meta bind is made, that will
|
||||
no longer be the case, for all letters.
|
||||
.TP
|
||||
.BI F N
|
||||
where \fIN\fR is a numeric value from 1 to 24.
|
||||
Example: F10.
|
||||
(Often, \fBF13\fR to \fBF24\fR can be typed as \fBF1\fR to \fBF12\fR with Shift.)
|
||||
|
||||
.TP
|
||||
the word "Ins" or the word "Del".
|
||||
.BR Ins " or " Del .
|
||||
.RE
|
||||
|
||||
Rebinding \fB^M\fR (Enter) or \fB^I\fR (Tab) is probably not a good idea.
|
||||
On some terminals it's not possible to rebind \fB^H\fR (unless \fB\-\-raw\fR
|
||||
is used) because its keycode is identical to that of the Backspace key.
|
||||
|
||||
.TP
|
||||
Valid \fIfunction\fP names to be bound are:
|
||||
.RS 3
|
||||
@@ -574,8 +590,11 @@ Shows the current cursor position: the line, column, and character positions.
|
||||
Counts the number of words, lines and characters in the current buffer.
|
||||
.TP
|
||||
.B speller
|
||||
Invokes a spell-checking program, either the default one, or the one
|
||||
defined by \fB\-\-speller\fR or \fBset speller\fR.
|
||||
Invokes a spell-checking program, either the default \fBhunspell\fR or GNU
|
||||
\fBspell\fR, or the one defined by \fB\-\-speller\fR or \fBset speller\fR.
|
||||
.TP
|
||||
.B formatter
|
||||
Invokes a full-buffer-processing program (if the active syntax defines one).
|
||||
.TP
|
||||
.B linter
|
||||
Invokes a syntax-checking program (if the active syntax defines one).
|
||||
@@ -857,7 +876,7 @@ The menu for inserting output from an external command, reached from the insert
|
||||
The help-viewer menu.
|
||||
.TP
|
||||
.B spell
|
||||
The interactive spell checker Yes/no menu.
|
||||
The menu of the integrated spell checker where the user can edit a misspelled word.
|
||||
.TP
|
||||
.B linter
|
||||
The linter menu.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2002-2007, 2014-2019 Free Software Foundation, Inc.
|
||||
.\" Copyright (C) 2002-2007, 2014-2020 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 4.3" "June 2019"
|
||||
.TH RNANO 1 "version 4.8" "February 2020"
|
||||
|
||||
.SH NAME
|
||||
rnano \- a restricted nano
|
||||
|
||||
@@ -54,9 +54,9 @@
|
||||
## 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 the target width for automatic hard-wrapping and for justifying
|
||||
## paragraphs. If the specified value is 0 or less, the wrapping point
|
||||
## will be the terminal's width minus this number.
|
||||
# set fill -8
|
||||
|
||||
## Remember the used search/replace strings for the next session.
|
||||
@@ -97,10 +97,6 @@
|
||||
## Don't automatically add a newline when a file does not end with one.
|
||||
# set nonewlines
|
||||
|
||||
## Don't pause between warnings at startup. Which means that only the
|
||||
## last one will be readable (when there are multiple ones).
|
||||
# set nopauses
|
||||
|
||||
## 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
|
||||
@@ -218,49 +214,44 @@
|
||||
|
||||
## Setup of syntax coloring.
|
||||
##
|
||||
## Format:
|
||||
## syntax "name" ["filename regex" ...]
|
||||
##
|
||||
## syntax "short description" ["filename regex" ...]
|
||||
## color|icolor foreground,background "regex" ["regex"...]
|
||||
## [...]
|
||||
##
|
||||
## The "none" syntax is reserved; specifying it on the command line is
|
||||
## the same as not having a syntax at all. The "default" syntax is
|
||||
## special: it takes no filename regexes, and applies to files that
|
||||
## don't match any other syntax's filename regexes.
|
||||
##
|
||||
## color foreground,background "regex" ["regex"...]
|
||||
## or
|
||||
## icolor foreground,background "regex" ["regex"...]
|
||||
##
|
||||
## "color" will do case-sensitive matches, while "icolor" will do
|
||||
## 'color' will do case-sensitive matches, while 'icolor' will do
|
||||
## case-insensitive matches.
|
||||
##
|
||||
## Valid color names ares: white, black, normal, red, blue, green,
|
||||
## yellow, magenta, cyan. For foreground colors, you may use the
|
||||
## prefix "bright" to get a stronger highlight.
|
||||
## All color commands are applied in the order in which they are specified,
|
||||
## meaning that later commands can recolor stuff that was colored earlier.
|
||||
##
|
||||
## Valid color names for foreground and background are: white, black, normal,
|
||||
## red, blue, green, yellow, magenta, cyan. For foreground colors, you may
|
||||
## use the prefix "bright" to get a stronger highlight.
|
||||
##
|
||||
## All regexes (regular expressions) are of the extended type (ERE).
|
||||
##
|
||||
## To use multi-line regexes, use the start="regex" end="regex"
|
||||
## [start="regex" end="regex"...] format.
|
||||
## If the coloring rule should span multiple lines, use the following format:
|
||||
##
|
||||
## If your system supports transparency, not specifying a background
|
||||
## color will use a transparent color. If you don't want this, be sure
|
||||
## to set the background color to black or white.
|
||||
## color fg,bg start="regex" end="regex"
|
||||
##
|
||||
## If you wish, you may put your syntax definitions in separate files.
|
||||
## You can make use of such files as follows:
|
||||
##
|
||||
## include "/path/to/syntax_file.nanorc"
|
||||
##
|
||||
## Unless otherwise noted, the name of the syntax file (without the
|
||||
## ".nanorc" extension) should be the same as the "short description"
|
||||
## name inside that file. These names are kept fairly short to make
|
||||
## them easier to remember and faster to type using nano's -Y option.
|
||||
## include "/path/to/syntax_file.nanorc"
|
||||
|
||||
## To include all existing syntax definitions, you can do:
|
||||
# include "@PKGDATADIR@/*.nanorc"
|
||||
|
||||
|
||||
## If <Tab> should always produce four spaces when editing a Python file,
|
||||
## independent of the settings of 'tabsize' and 'tabstospaces':
|
||||
# extendsyntax python tabgives " "
|
||||
|
||||
## If <Tab> should always produce an actual TAB when editing a Makefile:
|
||||
# extendsyntax makefile tabgives " "
|
||||
|
||||
|
||||
## Key bindings.
|
||||
## See nanorc(5) (section REBINDING KEYS) for more details on this.
|
||||
|
||||
@@ -277,6 +268,9 @@
|
||||
## such as ^O for Open, ^F for Find, ^H for Help, and ^Q for Quit,
|
||||
## then uncomment these:
|
||||
#bind ^Q exit all
|
||||
#bind ^S savefile main
|
||||
#bind ^W writeout main
|
||||
#bind ^O insert main
|
||||
#bind ^H help all
|
||||
#bind ^H exit help
|
||||
#bind ^F whereis all
|
||||
@@ -284,23 +278,23 @@
|
||||
#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 ^C copy main
|
||||
#bind ^V paste all
|
||||
#bind ^P curpos main
|
||||
#bind ^A mark main
|
||||
#unbind ^K main
|
||||
#unbind ^U all
|
||||
#unbind ^N main
|
||||
#unbind ^Y all
|
||||
#unbind M-J main
|
||||
#unbind M-T main
|
||||
#bind ^T gotoline main
|
||||
#bind ^T gotodir browser
|
||||
#bind ^Y speller main
|
||||
#unbind ^K all
|
||||
#unbind ^U all
|
||||
#bind M-U undo main
|
||||
#bind M-R redo main
|
||||
#bind ^U undo main
|
||||
#bind ^E redo main
|
||||
#unbind M-J main
|
||||
#unbind M-T main
|
||||
#set multibuffer
|
||||
|
||||
1642
po/nano.pot
1642
po/nano.pot
File diff suppressed because it is too large
Load Diff
1448
po/pt_BR.po
1448
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1380
po/zh_CN.po
1380
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
1378
po/zh_TW.po
1378
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION="4.3"
|
||||
VERSION="4.8"
|
||||
|
||||
./configure -C --enable-tiny && make && ./configure -C &&
|
||||
|
||||
@@ -22,6 +22,10 @@ gpg --verify nano-$VERSION.tar.xz.asc &&
|
||||
|
||||
git tag -u A0ACE884 -a v$VERSION -m "the nano $VERSION release" &&
|
||||
|
||||
make pdf && rm -rf doc/nano.t2p &&
|
||||
scp doc/nano.pdf bens@wh0rd.org:nano.pdf &&
|
||||
scp doc/cheatsheet.html bens@wh0rd.org:cheatsheet.html &&
|
||||
|
||||
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 &&
|
||||
|
||||
107
src/browser.c
107
src/browser.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* browser.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2020 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015-2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -21,13 +21,13 @@
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef ENABLE_BROWSER
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef ENABLE_BROWSER
|
||||
|
||||
static char **filelist = NULL;
|
||||
/* The list of files to display in the file browser. */
|
||||
static size_t filelist_len = 0;
|
||||
@@ -138,14 +138,20 @@ char *do_browser(char *path)
|
||||
/* If we selected the same filename as last time, fake a
|
||||
* press of the Enter key so that the file is read in. */
|
||||
if (old_selected == selected)
|
||||
unget_kbinput(KEY_ENTER, FALSE);
|
||||
kbinput = KEY_ENTER;
|
||||
}
|
||||
|
||||
continue;
|
||||
if (kbinput == KEY_MOUSE)
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLE_MOUSE */
|
||||
|
||||
func = parse_browser_input(&kbinput);
|
||||
#ifndef NANO_TINY
|
||||
if (bracketed_paste || kbinput == BRACKETED_PASTE_MARKER) {
|
||||
beep();
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
func = interpret(&kbinput);
|
||||
|
||||
if (func == total_refresh) {
|
||||
total_redraw();
|
||||
@@ -153,9 +159,9 @@ char *do_browser(char *path)
|
||||
/* Simulate a window resize to force a directory reread. */
|
||||
kbinput = KEY_WINCH;
|
||||
#endif
|
||||
} else if (func == do_help_void) {
|
||||
} else if (func == do_help) {
|
||||
#ifdef ENABLE_HELP
|
||||
do_help_void();
|
||||
do_help();
|
||||
#ifndef NANO_TINY
|
||||
/* The window dimensions might have changed, so act as if. */
|
||||
kbinput = KEY_WINCH;
|
||||
@@ -219,9 +225,9 @@ char *do_browser(char *path)
|
||||
selected = 0;
|
||||
} else if (func == to_last_file) {
|
||||
selected = filelist_len - 1;
|
||||
} else if (func == goto_dir_void) {
|
||||
} else if (func == goto_dir) {
|
||||
/* Ask for the directory to go to. */
|
||||
if (do_prompt(TRUE, FALSE, MGOTODIR, NULL, NULL,
|
||||
if (do_prompt(TRUE, FALSE, MGOTODIR, "", NULL,
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
browser_refresh, _("Go To Directory")) < 0) {
|
||||
statusbar(_("Cancelled"));
|
||||
@@ -285,7 +291,7 @@ char *do_browser(char *path)
|
||||
|
||||
/* If it isn't a directory, a file was selected -- we're done. */
|
||||
if (!S_ISDIR(st.st_mode)) {
|
||||
retval = mallocstrcpy(NULL, filelist[selected]);
|
||||
retval = copy_of(filelist[selected]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -314,7 +320,7 @@ char *do_browser(char *path)
|
||||
/* If the window resized, refresh the file list. */
|
||||
if (kbinput == KEY_WINCH) {
|
||||
/* Remember the selected file, to be able to reselect it. */
|
||||
present_name = mallocstrcpy(NULL, filelist[selected]);
|
||||
present_name = copy_of(filelist[selected]);
|
||||
/* Reread the contents of the current directory. */
|
||||
goto read_directory_contents;
|
||||
}
|
||||
@@ -447,50 +453,10 @@ void read_the_list(const char *path, DIR *dir)
|
||||
width = (COLS + 2) / (longest + 2);
|
||||
}
|
||||
|
||||
/* Return the function that is bound to the given key, accepting certain
|
||||
* plain characters too, for compatibility with Pico. */
|
||||
functionptrtype parse_browser_input(int *kbinput)
|
||||
{
|
||||
if (!meta_key) {
|
||||
switch (*kbinput) {
|
||||
case BS_CODE:
|
||||
case '-':
|
||||
return do_page_up;
|
||||
case ' ':
|
||||
return do_page_down;
|
||||
case '?':
|
||||
return do_help_void;
|
||||
case 'E':
|
||||
case 'e':
|
||||
case 'Q':
|
||||
case 'q':
|
||||
case 'X':
|
||||
case 'x':
|
||||
return do_exit;
|
||||
case 'G':
|
||||
case 'g':
|
||||
return goto_dir_void;
|
||||
case 'S':
|
||||
case 's':
|
||||
return do_enter;
|
||||
case 'W':
|
||||
case 'w':
|
||||
case '/':
|
||||
return do_search_forward;
|
||||
case 'N':
|
||||
return do_findprevious;
|
||||
case 'n':
|
||||
return do_findnext;
|
||||
}
|
||||
}
|
||||
return func_from_key(kbinput);
|
||||
}
|
||||
|
||||
/* Set width to the number of files that we can display per screen row,
|
||||
* if necessary, and display the list of files. */
|
||||
void browser_refresh(void)
|
||||
{
|
||||
size_t i;
|
||||
int row = 0, col = 0;
|
||||
/* The current row and column while the list is getting displayed. */
|
||||
int the_row = 0, the_column = 0;
|
||||
@@ -503,11 +469,10 @@ void browser_refresh(void)
|
||||
|
||||
wmove(edit, 0, 0);
|
||||
|
||||
i = selected - selected % (editwinrows * width);
|
||||
|
||||
for (; i < filelist_len && row < editwinrows; i++) {
|
||||
for (size_t index = selected - selected % (editwinrows * width);
|
||||
index < filelist_len && row < editwinrows; index++) {
|
||||
struct stat st;
|
||||
const char *thename = tail(filelist[i]);
|
||||
const char *thename = tail(filelist[index]);
|
||||
/* The filename we display, minus the path. */
|
||||
size_t namelen = breadth(thename);
|
||||
/* The length of the filename in columns. */
|
||||
@@ -524,16 +489,15 @@ void browser_refresh(void)
|
||||
/* The filename (or a fragment of it) in displayable format.
|
||||
* When a fragment, account for dots plus one space padding. */
|
||||
|
||||
/* If this is the selected item, start its highlighting, and
|
||||
/* If this is the selected item, draw its highlighted bar upfront, and
|
||||
* remember its location to be able to place the cursor on it. */
|
||||
if (i == selected) {
|
||||
if (index == selected) {
|
||||
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||
mvwprintw(edit, row, col, "%*s", longest, " ");
|
||||
the_row = row;
|
||||
the_column = col;
|
||||
}
|
||||
|
||||
blank_row(edit, row, col, longest);
|
||||
|
||||
/* If the name is too long, we display something like "...ename". */
|
||||
if (dots)
|
||||
mvwaddstr(edit, row, col, "...");
|
||||
@@ -546,19 +510,19 @@ void browser_refresh(void)
|
||||
/* Show information about the file: "--" for symlinks (except when
|
||||
* they point to a directory) and for files that have disappeared,
|
||||
* "(dir)" for directories, and the file size for normal files. */
|
||||
if (lstat(filelist[i], &st) == -1 || S_ISLNK(st.st_mode)) {
|
||||
if (stat(filelist[i], &st) == -1 || !S_ISDIR(st.st_mode))
|
||||
info = mallocstrcpy(NULL, "--");
|
||||
if (lstat(filelist[index], &st) == -1 || S_ISLNK(st.st_mode)) {
|
||||
if (stat(filelist[index], &st) == -1 || !S_ISDIR(st.st_mode))
|
||||
info = copy_of("--");
|
||||
else
|
||||
/* TRANSLATORS: Try to keep this at most 7 characters. */
|
||||
info = mallocstrcpy(NULL, _("(dir)"));
|
||||
info = copy_of(_("(dir)"));
|
||||
} else if (S_ISDIR(st.st_mode)) {
|
||||
if (strcmp(thename, "..") == 0) {
|
||||
/* TRANSLATORS: Try to keep this at most 12 characters. */
|
||||
info = mallocstrcpy(NULL, _("(parent dir)"));
|
||||
info = copy_of(_("(parent dir)"));
|
||||
infomaxlen = 12;
|
||||
} else
|
||||
info = mallocstrcpy(NULL, _("(dir)"));
|
||||
info = copy_of(_("(dir)"));
|
||||
} else {
|
||||
off_t result = st.st_size;
|
||||
char modifier;
|
||||
@@ -598,7 +562,7 @@ void browser_refresh(void)
|
||||
mvwaddstr(edit, row, col - infolen, info);
|
||||
|
||||
/* If this is the selected item, finish its highlighting. */
|
||||
if (i == selected)
|
||||
if (index == selected)
|
||||
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
||||
|
||||
free(info);
|
||||
@@ -666,11 +630,12 @@ int filesearch_init(bool forwards)
|
||||
(breadth(last_search) > COLS / 3) ? "..." : "");
|
||||
free(disp);
|
||||
} else
|
||||
thedefault = mallocstrcpy(NULL, "");
|
||||
thedefault = copy_of("");
|
||||
|
||||
/* Now ask what to search for. */
|
||||
response = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL, &search_history,
|
||||
response = do_prompt(FALSE, FALSE, MWHEREISFILE, "", &search_history,
|
||||
browser_refresh, "%s%s%s", _("Search"),
|
||||
/* TRANSLATORS: A modifier of the Search prompt. */
|
||||
!forwards ? _(" [Backwards]") : "", thedefault);
|
||||
free(thedefault);
|
||||
|
||||
@@ -793,7 +758,7 @@ void to_last_file(void)
|
||||
* The returned string is dynamically allocated, and should be freed. */
|
||||
char *strip_last_component(const char *path)
|
||||
{
|
||||
char *copy = mallocstrcpy(NULL, path);
|
||||
char *copy = copy_of(path);
|
||||
char *last_slash = strrchr(copy, '/');
|
||||
|
||||
if (last_slash != NULL)
|
||||
|
||||
173
src/chars.c
173
src/chars.c
@@ -1,8 +1,8 @@
|
||||
/**************************************************************************
|
||||
* chars.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016-2018 Benno Schulenberg *
|
||||
* Copyright (C) 2001-2011, 2013-2020 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016-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 *
|
||||
@@ -160,7 +160,7 @@ bool is_word_mbchar(const char *c, bool allow_punct)
|
||||
|
||||
if (word_chars != NULL && *word_chars != '\0') {
|
||||
char symbol[MAXCHARLEN + 1];
|
||||
int symlen = parse_mbchar(c, symbol, NULL);
|
||||
int symlen = collect_char(c, symbol);
|
||||
|
||||
symbol[symlen] = '\0';
|
||||
return (strstr(word_chars, symbol) != NULL);
|
||||
@@ -200,11 +200,12 @@ char control_mbrep(const char *c, bool isdata)
|
||||
return control_rep(*c);
|
||||
}
|
||||
|
||||
/* This function is equivalent to wcwidth() for multibyte characters. */
|
||||
#ifdef ENABLE_UTF8
|
||||
/* Return the width in columns of the given (multibyte) character. */
|
||||
int mbwidth(const char *c)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
/* Ask for the width only when the character isn't plain ASCII. */
|
||||
if ((signed char)*c <= 0) {
|
||||
wchar_t wc;
|
||||
int width;
|
||||
|
||||
@@ -213,41 +214,41 @@ int mbwidth(const char *c)
|
||||
|
||||
width = wcwidth(wc);
|
||||
|
||||
if (width == -1)
|
||||
if (width < 0)
|
||||
return 1;
|
||||
|
||||
return width;
|
||||
} else
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Convert the Unicode value in chr to a multibyte character, if possible.
|
||||
/* Convert the Unicode value in code to a multibyte character, if possible.
|
||||
* If the conversion succeeds, return the (dynamically allocated) multibyte
|
||||
* character and its length. Otherwise, return an undefined (dynamically
|
||||
* allocated) multibyte character and a length of zero. */
|
||||
char *make_mbchar(long chr, int *chr_mb_len)
|
||||
char *make_mbchar(long code, int *length)
|
||||
{
|
||||
char *chr_mb;
|
||||
char *mb_char;
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
chr_mb = charalloc(MAXCHARLEN);
|
||||
*chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
|
||||
mb_char = charalloc(MAXCHARLEN);
|
||||
*length = wctomb(mb_char, (wchar_t)code);
|
||||
|
||||
/* Reject invalid Unicode characters. */
|
||||
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
|
||||
if (*length < 0 || !is_valid_unicode((wchar_t)code)) {
|
||||
IGNORE_CALL_RESULT(wctomb(NULL, 0));
|
||||
*chr_mb_len = 0;
|
||||
*length = 0;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
*chr_mb_len = 1;
|
||||
chr_mb = mallocstrncpy(NULL, (char *)&chr, 1);
|
||||
mb_char = measured_copy((char *)&code, 1);
|
||||
*length = 1;
|
||||
}
|
||||
|
||||
return chr_mb;
|
||||
return mb_char;
|
||||
}
|
||||
|
||||
/* Return the length (in bytes) of the character located at *pointer. */
|
||||
@@ -264,50 +265,88 @@ int char_length(const char *pointer)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Parse a multibyte character from buf. Return the number of bytes
|
||||
* used. If chr isn't NULL, store the multibyte character in it. If
|
||||
* col isn't NULL, add the character's width (in columns) to it. */
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
/* Return the number of (multibyte) characters in the given string. */
|
||||
size_t mbstrlen(const char *pointer)
|
||||
{
|
||||
int length;
|
||||
size_t count = 0;
|
||||
|
||||
while (*pointer != '\0') {
|
||||
#ifdef ENABLE_UTF8
|
||||
if ((signed char)*pointer < 0) {
|
||||
int length = mblen(pointer, MAXCHARLEN);
|
||||
|
||||
pointer += (length < 0 ? 1 : length);
|
||||
} else
|
||||
#endif
|
||||
pointer++;
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/* Return the length (in bytes) of the character at the start of the
|
||||
* given string, and return a copy of this character in *thechar. */
|
||||
int collect_char(const char *string, char *thechar)
|
||||
{
|
||||
int charlen;
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* If this is a UTF-8 starter byte, get the number of bytes of the character. */
|
||||
if ((signed char)*buf < 0) {
|
||||
length = mblen(buf, MAXCHARLEN);
|
||||
if ((signed char)*string < 0) {
|
||||
charlen = mblen(string, MAXCHARLEN);
|
||||
|
||||
/* When the multibyte sequence is invalid, only take the first byte. */
|
||||
if (length <= 0)
|
||||
length = 1;
|
||||
if (charlen <= 0)
|
||||
charlen = 1;
|
||||
} else
|
||||
#endif
|
||||
length = 1;
|
||||
charlen = 1;
|
||||
|
||||
/* When requested, store the multibyte character in chr. */
|
||||
if (chr != NULL)
|
||||
for (int i = 0; i < length; i++)
|
||||
chr[i] = buf[i];
|
||||
for (int i = 0; i < charlen; i++)
|
||||
thechar[i] = string[i];
|
||||
|
||||
/* When requested, add the width of the character to col. */
|
||||
if (col != NULL) {
|
||||
/* If we have a tab, compute its width in columns based on the
|
||||
* current value of col. */
|
||||
if (*buf == '\t')
|
||||
*col += tabsize - *col % tabsize;
|
||||
/* If we have a control character, it's two columns wide: one
|
||||
* column for the "^", and one for the visible character. */
|
||||
else if (is_cntrl_mbchar(buf))
|
||||
*col += 2;
|
||||
/* If we have a normal character, get its width normally. */
|
||||
else if (length == 1)
|
||||
*col += 1;
|
||||
return charlen;
|
||||
}
|
||||
|
||||
/* Return the length (in bytes) of the character at the start of
|
||||
* the given string, and add this character's width to *column. */
|
||||
int advance_over(const char *string, size_t *column)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
else
|
||||
*col += mbwidth(buf);
|
||||
#endif
|
||||
}
|
||||
if ((signed char)*string < 0) {
|
||||
int charlen = mblen(string, MAXCHARLEN);
|
||||
|
||||
return length;
|
||||
if (charlen > 0) {
|
||||
if (is_cntrl_mbchar(string))
|
||||
*column += 2;
|
||||
else
|
||||
*column += mbwidth(string);
|
||||
} else {
|
||||
charlen = 1;
|
||||
*column += 1;
|
||||
}
|
||||
|
||||
return charlen;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((unsigned char)*string < 0x20) {
|
||||
if (*string == '\t')
|
||||
*column += tabsize - *column % tabsize;
|
||||
else
|
||||
*column += 2;
|
||||
} else if (*string == 0x7F)
|
||||
*column += 2;
|
||||
#ifndef ENABLE_UTF8
|
||||
else if (0x7F < (unsigned char)*string && (unsigned char)*string < 0xA0)
|
||||
*column += 2;
|
||||
#endif
|
||||
else
|
||||
*column += 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return the index in buf of the beginning of the multibyte character
|
||||
@@ -346,7 +385,7 @@ size_t step_left(const char *buf, size_t pos)
|
||||
return before - charlen;
|
||||
} else
|
||||
#endif
|
||||
return (pos == 0 ? 0 : pos - 1);
|
||||
return (pos == 0 ? 0 : pos - 1);
|
||||
}
|
||||
|
||||
/* Return the index in buf of the beginning of the multibyte character
|
||||
@@ -487,27 +526,6 @@ char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
return revstrcasestr(haystack, needle, pointer);
|
||||
}
|
||||
|
||||
/* Count the number of (multibyte) characters in the given string. */
|
||||
size_t mbstrlen(const char *pointer)
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
while (*pointer != '\0') {
|
||||
#ifdef ENABLE_UTF8
|
||||
if ((signed char)*pointer < 0) {
|
||||
int length = mblen(pointer, MAXCHARLEN);
|
||||
|
||||
pointer += (length < 0 ? 1 : length);
|
||||
} else
|
||||
#endif
|
||||
pointer++;
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
|
||||
/* This function is equivalent to strchr() for multibyte strings. */
|
||||
char *mbstrchr(const char *string, const char *chr)
|
||||
@@ -592,7 +610,7 @@ bool has_blank_char(const char *string)
|
||||
char symbol[MAXCHARLEN];
|
||||
|
||||
while (*string != '\0') {
|
||||
string += parse_mbchar(string, symbol, NULL);
|
||||
string += collect_char(string, symbol);
|
||||
|
||||
if (is_blank_mbchar(symbol))
|
||||
return TRUE;
|
||||
@@ -602,6 +620,15 @@ bool has_blank_char(const char *string)
|
||||
}
|
||||
#endif /* ENABLE_NANORC && (!NANO_TINY || ENABLE_JUSTIFY) */
|
||||
|
||||
/* Return TRUE when the given string is empty or consists of only blanks. */
|
||||
bool white_string(const char *string)
|
||||
{
|
||||
while (*string != '\0' && (is_blank_mbchar(string) || *string == '\r'))
|
||||
string += char_length(string);
|
||||
|
||||
return !*string;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
|
||||
bool is_valid_unicode(wchar_t wc)
|
||||
|
||||
88
src/color.c
88
src/color.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* color.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2020 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -21,14 +21,13 @@
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_MAGIC_H
|
||||
#include <magic.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
/* For early versions of ncurses-6.0, use an additional A_PROTECT attribute
|
||||
* for all colors, in order to work around an ncurses miscoloring bug. */
|
||||
@@ -68,7 +67,6 @@ void set_colorpairs(void)
|
||||
{
|
||||
syntaxtype *sint;
|
||||
bool using_defaults = FALSE;
|
||||
size_t i;
|
||||
|
||||
/* Tell ncurses to enable colors. */
|
||||
start_color();
|
||||
@@ -79,30 +77,31 @@ void set_colorpairs(void)
|
||||
#endif
|
||||
|
||||
/* Initialize the color pairs for nano's interface elements. */
|
||||
for (i = 0; i < NUMBER_OF_ELEMENTS; i++) {
|
||||
colortype *combo = color_combo[i];
|
||||
for (size_t index = 0; index < NUMBER_OF_ELEMENTS; index++) {
|
||||
colortype *combo = color_combo[index];
|
||||
|
||||
if (combo != NULL) {
|
||||
if (combo->fg == USE_THE_DEFAULT && !using_defaults)
|
||||
combo->fg = COLOR_WHITE;
|
||||
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->attributes;
|
||||
init_pair(index + 1, combo->fg, combo->bg);
|
||||
interface_color_pair[index] = COLOR_PAIR(index + 1) | A_BANDAID |
|
||||
combo->attributes;
|
||||
} 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;
|
||||
if (index == FUNCTION_TAG)
|
||||
interface_color_pair[index] = A_NORMAL;
|
||||
else if (index == GUIDE_STRIPE)
|
||||
interface_color_pair[index] = A_REVERSE;
|
||||
else if (index == ERROR_MESSAGE) {
|
||||
init_pair(index + 1, COLOR_WHITE, COLOR_RED);
|
||||
interface_color_pair[index] = COLOR_PAIR(index + 1) |
|
||||
A_BOLD | A_BANDAID;
|
||||
} else
|
||||
interface_color_pair[i] = hilite_attribute;
|
||||
interface_color_pair[index] = hilite_attribute;
|
||||
}
|
||||
|
||||
free(color_combo[i]);
|
||||
free(color_combo[index]);
|
||||
}
|
||||
|
||||
/* For each loaded syntax, assign pair numbers to color combinations. */
|
||||
@@ -192,20 +191,7 @@ void color_update(void)
|
||||
/* If no syntax-override string was specified, or it didn't match,
|
||||
* try finding a syntax based on the filename (extension). */
|
||||
if (sint == NULL && !inhelp) {
|
||||
char *reserved = charalloc(PATH_MAX + 1);
|
||||
char *currentdir = getcwd(reserved, PATH_MAX + 1);
|
||||
char *joinednames = charalloc(PATH_MAX + 1);
|
||||
char *fullname = NULL;
|
||||
|
||||
if (currentdir == NULL)
|
||||
free(reserved);
|
||||
else {
|
||||
/* Concatenate the current working directory with the
|
||||
* specified filename, and canonicalize the result. */
|
||||
sprintf(joinednames, "%s/%s", currentdir, openfile->filename);
|
||||
fullname = get_full_path(joinednames);
|
||||
free(currentdir);
|
||||
}
|
||||
char *fullname = get_full_path(openfile->filename);
|
||||
|
||||
if (fullname == NULL)
|
||||
fullname = mallocstrcpy(fullname, openfile->filename);
|
||||
@@ -215,7 +201,6 @@ void color_update(void)
|
||||
break;
|
||||
}
|
||||
|
||||
free(joinednames);
|
||||
free(fullname);
|
||||
}
|
||||
|
||||
@@ -282,6 +267,15 @@ void color_update(void)
|
||||
openfile->colorstrings = (sint == NULL ? NULL : sint->color);
|
||||
}
|
||||
|
||||
/* Allocate and initialize (for the given line) the cache for multiline info. */
|
||||
void set_up_multicache(linestruct *line)
|
||||
{
|
||||
line->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
|
||||
|
||||
for (int index = 0; index < openfile->syntax->nmultis; index++)
|
||||
line->multidata[index] = -1;
|
||||
}
|
||||
|
||||
/* Determine whether the matches of multiline regexes are still the same,
|
||||
* and if not, schedule a screen refresh, so things will be repainted. */
|
||||
void check_the_multis(linestruct *line)
|
||||
@@ -295,13 +289,14 @@ void check_the_multis(linestruct *line)
|
||||
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0)
|
||||
return;
|
||||
|
||||
if (line->multidata == NULL)
|
||||
set_up_multicache(line);
|
||||
|
||||
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
|
||||
/* If it's not a multiline regex, skip. */
|
||||
if (ink->end == NULL)
|
||||
continue;
|
||||
|
||||
alloc_multidata_if_needed(line);
|
||||
|
||||
astart = (regexec(ink->start, line->data, 1, &startmatch, 0) == 0);
|
||||
afterstart = line->data + (astart ? startmatch.rm_eo : 0);
|
||||
anend = (regexec(ink->end, afterstart, 1, &endmatch, 0) == 0);
|
||||
@@ -328,17 +323,6 @@ void check_the_multis(linestruct *line)
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate (for one line) the cache space for multiline color regexes. */
|
||||
void alloc_multidata_if_needed(linestruct *fileptr)
|
||||
{
|
||||
if (fileptr->multidata == NULL) {
|
||||
fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
|
||||
|
||||
for (int i = 0; i < openfile->syntax->nmultis; i++)
|
||||
fileptr->multidata[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Precalculate the multi-line start and end regex info so we can
|
||||
* speed up rendering (with any hope at all...). */
|
||||
void precalc_multicolorinfo(void)
|
||||
@@ -350,6 +334,10 @@ void precalc_multicolorinfo(void)
|
||||
if (openfile->colorstrings == NULL || ISSET(NO_COLOR_SYNTAX))
|
||||
return;
|
||||
|
||||
/* For each line, allocate cache space for the multiline-regex info. */
|
||||
for (line = openfile->filetop; line != NULL; line = line->next)
|
||||
set_up_multicache(line);
|
||||
|
||||
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
|
||||
/* If this is not a multi-line regex, skip it. */
|
||||
if (ink->end == NULL)
|
||||
@@ -358,7 +346,6 @@ void precalc_multicolorinfo(void)
|
||||
for (line = openfile->filetop; line != NULL; line = line->next) {
|
||||
int index = 0;
|
||||
|
||||
alloc_multidata_if_needed(line);
|
||||
/* Assume nothing applies until proven otherwise below. */
|
||||
line->multidata[ink->id] = CNONE;
|
||||
|
||||
@@ -410,12 +397,9 @@ void precalc_multicolorinfo(void)
|
||||
* the lines in between and the end properly. */
|
||||
line->multidata[ink->id] = CENDAFTER;
|
||||
|
||||
for (line = line->next; line != tailline; line = line->next) {
|
||||
alloc_multidata_if_needed(line);
|
||||
for (line = line->next; line != tailline; line = line->next)
|
||||
line->multidata[ink->id] = CWHOLELINE;
|
||||
}
|
||||
|
||||
alloc_multidata_if_needed(tailline);
|
||||
tailline->multidata[ink->id] = CBEGINBEFORE;
|
||||
|
||||
/* Begin looking for a new start after the end match. */
|
||||
|
||||
219
src/cut.c
219
src/cut.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* cut.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014 Mark Majeres *
|
||||
* Copyright (C) 2016, 2018, 2019 Benno Schulenberg *
|
||||
* *
|
||||
@@ -42,7 +42,7 @@ void do_deletion(undo_type action)
|
||||
* 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);
|
||||
add_undo(action, NULL);
|
||||
else
|
||||
update_undo(action);
|
||||
|
||||
@@ -50,7 +50,7 @@ void do_deletion(undo_type action)
|
||||
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],
|
||||
memmove(&openfile->current->data[openfile->current_x],
|
||||
&openfile->current->data[openfile->current_x + charlen],
|
||||
line_len - charlen + 1);
|
||||
#ifndef NANO_TINY
|
||||
@@ -68,13 +68,13 @@ void do_deletion(undo_type action)
|
||||
!ISSET(NO_NEWLINES)) {
|
||||
#ifndef NANO_TINY
|
||||
if (action == BACK)
|
||||
add_undo(BACK);
|
||||
add_undo(BACK, NULL);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(action);
|
||||
add_undo(action, NULL);
|
||||
#endif
|
||||
/* Add the contents of the next line to those of the current one. */
|
||||
openfile->current->data = charealloc(openfile->current->data,
|
||||
@@ -182,7 +182,9 @@ void chop_word(bool forward)
|
||||
openfile->current_x = is_current_x;
|
||||
|
||||
/* Now kill the marked region and a word is gone. */
|
||||
cut_text();
|
||||
add_undo(CUT, NULL);
|
||||
do_snip(FALSE, TRUE, FALSE, FALSE);
|
||||
update_undo(CUT);
|
||||
|
||||
/* Discard the cut word and restore the cutbuffer. */
|
||||
free_lines(cutbuffer);
|
||||
@@ -192,7 +194,10 @@ void chop_word(bool forward)
|
||||
/* Delete a word leftward. */
|
||||
void chop_previous_word(void)
|
||||
{
|
||||
chop_word(BACKWARD);
|
||||
if (openfile->current->prev == NULL && openfile->current_x == 0)
|
||||
statusbar(_("Nothing was cut"));
|
||||
else
|
||||
chop_word(BACKWARD);
|
||||
}
|
||||
|
||||
/* Delete a word rightward. */
|
||||
@@ -205,6 +210,164 @@ void chop_next_word(void)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Move all text between (top, top_x) and (bot, bot_x) from the current buffer
|
||||
* into the cutbuffer. */
|
||||
void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_x)
|
||||
{
|
||||
bool edittop_inside = (openfile->edittop->lineno >= top->lineno &&
|
||||
openfile->edittop->lineno <= bot->lineno);
|
||||
#ifndef NANO_TINY
|
||||
bool mark_inside = (openfile->mark &&
|
||||
openfile->mark->lineno >= top->lineno &&
|
||||
openfile->mark->lineno <= bot->lineno &&
|
||||
(openfile->mark != top || openfile->mark_x >= top_x) &&
|
||||
(openfile->mark != bot || openfile->mark_x <= bot_x));
|
||||
bool same_line = (openfile->mark == top);
|
||||
|
||||
if (top == bot && top_x == bot_x)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* Reduce the buffer to cover just the text that needs to be extracted. */
|
||||
partition_buffer(top, top_x, bot, bot_x);
|
||||
|
||||
/* Subtract the number of characters in that text from the file size. */
|
||||
openfile->totsize -= get_totsize(top, bot);
|
||||
|
||||
/* If the cutbuffer is currently empty, just move all the text directly
|
||||
* into it; otherwise, append the text to what is already there. */
|
||||
if (cutbuffer == NULL) {
|
||||
cutbuffer = openfile->filetop;
|
||||
cutbottom = openfile->filebot;
|
||||
} else {
|
||||
/* Tack the data of the first line of the text onto the data of
|
||||
* the last line in the given buffer. */
|
||||
cutbottom->data = charealloc(cutbottom->data,
|
||||
strlen(cutbottom->data) +
|
||||
strlen(openfile->filetop->data) + 1);
|
||||
strcat(cutbottom->data, openfile->filetop->data);
|
||||
|
||||
/* Attach the second line of the text (if any) to the last line
|
||||
* of the buffer, then remove the now superfluous first line. */
|
||||
cutbottom->next = openfile->filetop->next;
|
||||
delete_node(openfile->filetop);
|
||||
|
||||
/* If there is a second line, make the reverse attachment too and
|
||||
* update the buffer pointer to point at the end of the text. */
|
||||
if (cutbottom->next != NULL) {
|
||||
cutbottom->next->prev = cutbottom;
|
||||
cutbottom = openfile->filebot;
|
||||
}
|
||||
}
|
||||
|
||||
/* Since the text has now been saved, remove it from the file buffer. */
|
||||
openfile->filetop = make_new_node(NULL);
|
||||
openfile->filetop->data = copy_of("");
|
||||
openfile->filebot = openfile->filetop;
|
||||
|
||||
/* Set the cursor at the point where the text was removed. */
|
||||
openfile->current = openfile->filetop;
|
||||
openfile->current_x = top_x;
|
||||
#ifndef NANO_TINY
|
||||
/* If the mark was inside the partition, put it where the cursor now is. */
|
||||
if (mark_inside) {
|
||||
openfile->mark = openfile->current;
|
||||
openfile->mark_x = openfile->current_x;
|
||||
} else if (same_line)
|
||||
/* Update the pointer to this partially cut line. */
|
||||
openfile->mark = openfile->current;
|
||||
#endif
|
||||
|
||||
/* Glue the texts before and after the extraction together. */
|
||||
unpartition_buffer();
|
||||
|
||||
renumber_from(openfile->current);
|
||||
|
||||
/* If the top of the edit window was inside the old partition, put
|
||||
* it in range of current. */
|
||||
if (edittop_inside) {
|
||||
adjust_viewport(STATIONARY);
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
/* If the text doesn't end with a newline, and it should, add one. */
|
||||
if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0')
|
||||
new_magicline();
|
||||
}
|
||||
|
||||
/* Meld the buffer that starts at topline into the current file buffer
|
||||
* at the current cursor position. */
|
||||
void ingraft_buffer(linestruct *topline)
|
||||
{
|
||||
size_t current_x_save = openfile->current_x;
|
||||
/* Remember whether the current line is at the top of the edit window. */
|
||||
bool edittop_inside = (openfile->edittop == openfile->current);
|
||||
#ifndef NANO_TINY
|
||||
/* Remember whether mark and cursor are on the same line, and their order. */
|
||||
bool same_line = (openfile->mark == openfile->current);
|
||||
bool right_side_up = (openfile->mark &&
|
||||
(openfile->mark->lineno < openfile->current->lineno ||
|
||||
(same_line && openfile->mark_x <= openfile->current_x)));
|
||||
#endif
|
||||
|
||||
/* Partition the buffer so that it contains no text, then delete it.*/
|
||||
partition_buffer(openfile->current, openfile->current_x,
|
||||
openfile->current, openfile->current_x);
|
||||
delete_node(openfile->filetop);
|
||||
|
||||
/* Replace the current buffer with the passed buffer. */
|
||||
openfile->filetop = topline;
|
||||
openfile->filebot = topline;
|
||||
while (openfile->filebot->next != NULL)
|
||||
openfile->filebot = openfile->filebot->next;
|
||||
|
||||
/* Put the cursor at the end of the pasted text. */
|
||||
openfile->current = openfile->filebot;
|
||||
openfile->current_x = strlen(openfile->filebot->data);
|
||||
|
||||
/* When the pasted stuff contains no newline, adjust the cursor's
|
||||
* x coordinate for the text that is before the pasted stuff. */
|
||||
if (openfile->filetop == openfile->filebot)
|
||||
openfile->current_x += current_x_save;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* When needed, refresh the mark's pointer and compensate the mark's
|
||||
* x coordinate for the change in the current line. */
|
||||
if (same_line) {
|
||||
if (!right_side_up) {
|
||||
openfile->mark = openfile->filebot;
|
||||
openfile->mark_x += openfile->current_x - current_x_save;
|
||||
} else
|
||||
openfile->mark = openfile->filetop;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Add the number of characters in the copied text to the file size. */
|
||||
openfile->totsize += get_totsize(openfile->filetop, openfile->filebot);
|
||||
|
||||
/* If we pasted onto the first line of the edit window, the corresponding
|
||||
* record has been freed, so... point at the start of the copied text. */
|
||||
if (edittop_inside)
|
||||
openfile->edittop = openfile->filetop;
|
||||
|
||||
/* Weld the pasted text into the surrounding content of the buffer. */
|
||||
unpartition_buffer();
|
||||
|
||||
renumber_from(topline);
|
||||
|
||||
/* If the text doesn't end with a newline, and it should, add one. */
|
||||
if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0')
|
||||
new_magicline();
|
||||
}
|
||||
|
||||
/* Meld a copy of the given buffer into the current file buffer. */
|
||||
void copy_from_buffer(linestruct *somebuffer)
|
||||
{
|
||||
linestruct *the_copy = copy_buffer(somebuffer);
|
||||
|
||||
ingraft_buffer(the_copy);
|
||||
}
|
||||
|
||||
/* Move the whole current line from the current buffer to the cutbuffer. */
|
||||
void cut_line(void)
|
||||
{
|
||||
@@ -212,9 +375,9 @@ void cut_line(void)
|
||||
* 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(openfile->current, 0, openfile->current->next, 0);
|
||||
extract_segment(openfile->current, 0, openfile->current->next, 0);
|
||||
else
|
||||
extract(openfile->current, 0,
|
||||
extract_segment(openfile->current, 0,
|
||||
openfile->current, strlen(openfile->current->data));
|
||||
|
||||
openfile->placewewant = 0;
|
||||
@@ -232,10 +395,10 @@ void cut_to_eol(void)
|
||||
* the cutbuffer. Otherwise, when not at the end of the buffer,
|
||||
* move the line separation into the cutbuffer. */
|
||||
if (openfile->current_x < data_len)
|
||||
extract(openfile->current, openfile->current_x,
|
||||
extract_segment(openfile->current, openfile->current_x,
|
||||
openfile->current, data_len);
|
||||
else if (openfile->current != openfile->filebot) {
|
||||
extract(openfile->current, openfile->current_x,
|
||||
extract_segment(openfile->current, openfile->current_x,
|
||||
openfile->current->next, 0);
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
@@ -250,7 +413,7 @@ void cut_marked(bool *right_side_up)
|
||||
get_region((const linestruct **)&top, &top_x,
|
||||
(const linestruct **)&bot, &bot_x, right_side_up);
|
||||
|
||||
extract(top, top_x, bot, bot_x);
|
||||
extract_segment(top, top_x, bot, bot_x);
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
@@ -258,7 +421,7 @@ void cut_marked(bool *right_side_up)
|
||||
/* Move all text from the cursor position to end-of-file into the cutbuffer. */
|
||||
void cut_to_eof(void)
|
||||
{
|
||||
extract(openfile->current, openfile->current_x,
|
||||
extract_segment(openfile->current, openfile->current_x,
|
||||
openfile->filebot, strlen(openfile->filebot->data));
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
@@ -268,7 +431,7 @@ void cut_to_eof(void)
|
||||
* If until_eof is TRUE, move all text from the current cursor
|
||||
* position to the end of the file into the cutbuffer. If append
|
||||
* is TRUE (when zapping), always append the cut to the cutbuffer. */
|
||||
void do_cut_text(bool copying, bool marked, bool until_eof, bool append)
|
||||
void do_snip(bool copying, bool marked, bool until_eof, bool append)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
linestruct *was_bottom = NULL;
|
||||
@@ -361,9 +524,9 @@ bool is_cuttable(bool test_cliff)
|
||||
#endif
|
||||
)) {
|
||||
#ifndef NANO_TINY
|
||||
statusbar(_("Nothing was cut"));
|
||||
openfile->mark = NULL;
|
||||
#endif
|
||||
statusbar(_("Nothing was cut"));
|
||||
return FALSE;
|
||||
} else
|
||||
return TRUE;
|
||||
@@ -380,16 +543,17 @@ void cut_text(void)
|
||||
* the current cut is not contiguous with the previous cutting. */
|
||||
if (openfile->last_action != CUT || !keep_cutbuffer) {
|
||||
keep_cutbuffer = FALSE;
|
||||
add_undo(CUT);
|
||||
add_undo(CUT, NULL);
|
||||
}
|
||||
|
||||
do_cut_text(FALSE, openfile->mark != NULL, FALSE, FALSE);
|
||||
do_snip(FALSE, openfile->mark != NULL, FALSE, FALSE);
|
||||
|
||||
update_undo(CUT);
|
||||
#else
|
||||
if (is_cuttable(FALSE))
|
||||
do_cut_text(FALSE, FALSE, FALSE, FALSE);
|
||||
do_snip(FALSE, FALSE, FALSE, FALSE);
|
||||
#endif
|
||||
wipe_statusbar();
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -406,11 +570,7 @@ void copy_text(void)
|
||||
ssize_t is_current_lineno = openfile->current->lineno;
|
||||
size_t is_current_x = openfile->current_x;
|
||||
|
||||
/* If there is nothing to copy, don't even try. */
|
||||
if (openfile->current->next == NULL && openfile->current->data[0] == '\0')
|
||||
return;
|
||||
|
||||
do_cut_text(TRUE, mark_is_set, FALSE, FALSE);
|
||||
do_snip(TRUE, mark_is_set, FALSE, FALSE);
|
||||
|
||||
/* If the mark was set, restore the viewport and cursor position. */
|
||||
if (mark_is_set) {
|
||||
@@ -434,9 +594,10 @@ void cut_till_eof(void)
|
||||
return;
|
||||
}
|
||||
|
||||
add_undo(CUT_TO_EOF);
|
||||
do_cut_text(FALSE, FALSE, TRUE, FALSE);
|
||||
add_undo(CUT_TO_EOF, NULL);
|
||||
do_snip(FALSE, FALSE, TRUE, FALSE);
|
||||
update_undo(CUT_TO_EOF);
|
||||
wipe_statusbar();
|
||||
}
|
||||
|
||||
/* Erase text (current line or marked region), sending it into oblivion. */
|
||||
@@ -451,14 +612,15 @@ void zap_text(void)
|
||||
/* 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 || !keep_cutbuffer)
|
||||
add_undo(ZAP);
|
||||
add_undo(ZAP, NULL);
|
||||
|
||||
/* Use the cutbuffer from the ZAP undo item, so the cut can be undone. */
|
||||
cutbuffer = openfile->current_undo->cutbuffer;
|
||||
|
||||
do_cut_text(FALSE, openfile->mark != NULL, FALSE, TRUE);
|
||||
do_snip(FALSE, openfile->mark != NULL, FALSE, TRUE);
|
||||
|
||||
update_undo(ZAP);
|
||||
wipe_statusbar();
|
||||
|
||||
cutbuffer = was_cutbuffer;
|
||||
}
|
||||
@@ -478,7 +640,7 @@ void paste_text(void)
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(PASTE);
|
||||
add_undo(PASTE, NULL);
|
||||
|
||||
if (ISSET(SOFTWRAP))
|
||||
was_leftedge = leftedge_for(xplustabs(), openfile->current);
|
||||
@@ -500,5 +662,6 @@ void paste_text(void)
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
set_modified();
|
||||
wipe_statusbar();
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
909
src/files.c
909
src/files.c
File diff suppressed because it is too large
Load Diff
772
src/global.c
772
src/global.c
File diff suppressed because it is too large
Load Diff
124
src/help.c
124
src/help.c
@@ -1,9 +1,9 @@
|
||||
/**************************************************************************
|
||||
* help.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2000-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2000-2011, 2013-2020 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2017 Rishabh Dave *
|
||||
* Copyright (C) 2014-2018 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 *
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef ENABLE_HELP
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef ENABLE_HELP
|
||||
|
||||
static char *help_text = NULL;
|
||||
/* The text displayed in the help window. */
|
||||
|
||||
@@ -40,19 +40,34 @@ static size_t location;
|
||||
/* The offset (in bytes) of the topleft of the shown help text. */
|
||||
|
||||
/* Hard-wrap the concatenated help text, and write it into a new buffer. */
|
||||
void wrap_help_text_into_buffer()
|
||||
void wrap_help_text_into_buffer(void)
|
||||
{
|
||||
size_t sum = 0;
|
||||
/* Avoid overtight and overwide paragraphs in the introductory text. */
|
||||
size_t wrapping_point = (COLS < 32) ? 32 : (COLS > 74) ? 74 : COLS;
|
||||
const char *ptr = start_of_body;
|
||||
|
||||
make_new_buffer();
|
||||
|
||||
/* Copy the help text into the just-created new buffer. */
|
||||
while (*ptr != '\0') {
|
||||
int length = help_line_len(ptr);
|
||||
char *oneline = nmalloc(length + 1);
|
||||
int length, shim;
|
||||
char *oneline;
|
||||
|
||||
if (ptr == end_of_intro)
|
||||
wrapping_point = (COLS < 32) ? 32 : COLS;
|
||||
|
||||
if (ptr > end_of_intro && *(ptr - 1) != '\n') {
|
||||
length = break_line(ptr, (COLS < 32) ? 14 : COLS - 18, TRUE);
|
||||
oneline = nmalloc(length + 5);
|
||||
snprintf(oneline, length + 5, "\t\t %s", ptr);
|
||||
} else {
|
||||
length = break_line(ptr, wrapping_point, TRUE);
|
||||
oneline = nmalloc(length + 1);
|
||||
shim = (*(ptr + length - 1) == ' ') ? 0 : 1;
|
||||
snprintf(oneline, length + shim, "%s", ptr);
|
||||
}
|
||||
|
||||
snprintf(oneline, length + 1, "%s", ptr);
|
||||
free(openfile->current->data);
|
||||
openfile->current->data = oneline;
|
||||
|
||||
@@ -64,7 +79,7 @@ void wrap_help_text_into_buffer()
|
||||
do {
|
||||
openfile->current->next = make_new_node(openfile->current);
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current->data = mallocstrcpy(NULL, "");
|
||||
openfile->current->data = copy_of("");
|
||||
} while (*(++ptr) == '\n');
|
||||
}
|
||||
|
||||
@@ -88,8 +103,8 @@ void wrap_help_text_into_buffer()
|
||||
openfile->edittop = openfile->current;
|
||||
}
|
||||
|
||||
/* Our main help-viewer function. */
|
||||
void do_help(void)
|
||||
/* Assemble a help text, display it, and allow scrolling through it. */
|
||||
void show_help(void)
|
||||
{
|
||||
int kbinput = ERR;
|
||||
functionptrtype func;
|
||||
@@ -103,7 +118,7 @@ void do_help(void)
|
||||
#ifdef ENABLE_COLOR
|
||||
char *was_syntax = syntaxstr;
|
||||
#endif
|
||||
char *saved_answer = (answer != NULL) ? strdup(answer) : NULL;
|
||||
char *saved_answer = (answer != NULL) ? copy_of(answer) : NULL;
|
||||
/* The current answer when the user invokes help at the prompt. */
|
||||
unsigned stash[sizeof(flags) / sizeof(flags[0])];
|
||||
/* A storage place for the current flag settings. */
|
||||
@@ -140,8 +155,9 @@ void do_help(void)
|
||||
#endif
|
||||
curs_set(0);
|
||||
|
||||
/* Compose the help text from all the pieces. */
|
||||
/* Compose the help text from all the relevant pieces. */
|
||||
help_init();
|
||||
|
||||
inhelp = TRUE;
|
||||
location = 0;
|
||||
didfind = 0;
|
||||
@@ -150,8 +166,7 @@ void do_help(void)
|
||||
|
||||
/* Extract the title from the head of the help text. */
|
||||
length = break_line(help_text, MAX_BUF_SIZE, TRUE);
|
||||
title = charalloc(length * sizeof(char) + 1);
|
||||
strncpy(title, help_text, length);
|
||||
title = measured_copy(help_text, length + 1);
|
||||
title[length] = '\0';
|
||||
|
||||
titlebar(title);
|
||||
@@ -172,7 +187,13 @@ void do_help(void)
|
||||
kbinput = get_kbinput(edit, didfind == 1 || ISSET(SHOW_CURSOR));
|
||||
didfind = 0;
|
||||
|
||||
func = parse_help_input(&kbinput);
|
||||
#ifndef NANO_TINY
|
||||
if (bracketed_paste || kbinput == BRACKETED_PASTE_MARKER) {
|
||||
beep();
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
func = interpret(&kbinput);
|
||||
|
||||
if (func == total_refresh) {
|
||||
total_redraw();
|
||||
@@ -247,7 +268,6 @@ void do_help(void)
|
||||
inhelp = FALSE;
|
||||
|
||||
curs_set(0);
|
||||
refresh_needed = TRUE;
|
||||
|
||||
if (ISSET(NO_HELP)) {
|
||||
currmenu = oldmenu;
|
||||
@@ -262,7 +282,10 @@ void do_help(void)
|
||||
browser_refresh();
|
||||
else
|
||||
#endif
|
||||
{
|
||||
titlebar(NULL);
|
||||
edit_refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate space for the help text for the current menu, and concatenate
|
||||
@@ -540,74 +563,13 @@ void help_init(void)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
}
|
||||
|
||||
/* Return the function that is bound to the given key, accepting certain
|
||||
* plain characters too, for consistency with the file browser. */
|
||||
functionptrtype parse_help_input(int *kbinput)
|
||||
{
|
||||
if (!meta_key) {
|
||||
switch (*kbinput) {
|
||||
case BS_CODE:
|
||||
case '-':
|
||||
return do_page_up;
|
||||
case ' ':
|
||||
return do_page_down;
|
||||
case 'W':
|
||||
case 'w':
|
||||
case '/':
|
||||
return do_search_forward;
|
||||
case 'N':
|
||||
return do_findprevious;
|
||||
case 'n':
|
||||
return do_findnext;
|
||||
case 'E':
|
||||
case 'e':
|
||||
case 'Q':
|
||||
case 'q':
|
||||
case 'X':
|
||||
case 'x':
|
||||
return do_exit;
|
||||
}
|
||||
}
|
||||
return func_from_key(kbinput);
|
||||
}
|
||||
|
||||
/* Calculate the displayable length of the help-text line starting at ptr. */
|
||||
size_t help_line_len(const char *ptr)
|
||||
{
|
||||
size_t wrapping_point = (COLS > 24) ? COLS - 1 : 24;
|
||||
/* The target width for wrapping long lines. */
|
||||
ssize_t wrap_location;
|
||||
/* Actual position where the line can be wrapped. */
|
||||
size_t length = 0;
|
||||
/* Full length of the line, until the first newline. */
|
||||
|
||||
/* Avoid overwide paragraphs in the introductory text. */
|
||||
if (ptr < end_of_intro && COLS > 74)
|
||||
wrapping_point = 74;
|
||||
|
||||
wrap_location = break_line(ptr, wrapping_point, TRUE);
|
||||
|
||||
/* Get the length of the entire line up to a null or a newline. */
|
||||
while (*(ptr + length) != '\0' && *(ptr + length) != '\n')
|
||||
length = step_right(ptr, length);
|
||||
|
||||
/* If the entire line will just fit the screen, don't wrap it. */
|
||||
if (wideness(ptr, length) <= wrapping_point + 1)
|
||||
return length;
|
||||
else if (wrap_location > 0)
|
||||
return wrap_location;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ENABLE_HELP */
|
||||
|
||||
/* Start the help viewer. */
|
||||
void do_help_void(void)
|
||||
/* Start the help viewer, or indicate that there is no help. */
|
||||
void do_help(void)
|
||||
{
|
||||
#ifdef ENABLE_HELP
|
||||
do_help();
|
||||
show_help();
|
||||
#else
|
||||
if (currmenu == MMAIN)
|
||||
say_there_is_no_help();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**************************************************************************
|
||||
* history.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2003-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016-2017 Benno Schulenberg *
|
||||
* Copyright (C) 2003-2011, 2013-2020 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016, 2017, 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 *
|
||||
@@ -21,11 +21,11 @@
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
|
||||
#ifndef SEARCH_HISTORY
|
||||
#define SEARCH_HISTORY "search_history"
|
||||
#endif
|
||||
@@ -48,17 +48,17 @@ static poshiststruct *position_history = NULL;
|
||||
void history_init(void)
|
||||
{
|
||||
search_history = make_new_node(NULL);
|
||||
search_history->data = mallocstrcpy(NULL, "");
|
||||
search_history->data = copy_of("");
|
||||
searchtop = search_history;
|
||||
searchbot = search_history;
|
||||
|
||||
replace_history = make_new_node(NULL);
|
||||
replace_history->data = mallocstrcpy(NULL, "");
|
||||
replace_history->data = copy_of("");
|
||||
replacetop = replace_history;
|
||||
replacebot = replace_history;
|
||||
|
||||
execute_history = make_new_node(NULL);
|
||||
execute_history->data = mallocstrcpy(NULL, "");
|
||||
execute_history->data = copy_of("");
|
||||
executetop = execute_history;
|
||||
executebot = execute_history;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ void update_history(linestruct **item, const char *text)
|
||||
(*hbot)->data = mallocstrcpy((*hbot)->data, text);
|
||||
splice_node(*hbot, make_new_node(*hbot));
|
||||
*hbot = (*hbot)->next;
|
||||
(*hbot)->data = mallocstrcpy(NULL, "");
|
||||
(*hbot)->data = copy_of("");
|
||||
|
||||
/* Indicate that the history needs to be saved on exit. */
|
||||
history_changed = TRUE;
|
||||
@@ -229,19 +229,6 @@ char *get_history_completion(linestruct **h, char *s, size_t len)
|
||||
}
|
||||
#endif /* ENABLE_TABCOMP */
|
||||
|
||||
void history_error(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, msg);
|
||||
vfprintf(stderr, _(msg), ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, _("\nPress Enter to continue\n"));
|
||||
while (getchar() != '\n')
|
||||
;
|
||||
}
|
||||
|
||||
/* Check whether we have or could make a directory for history files. */
|
||||
bool have_statedir(void)
|
||||
{
|
||||
@@ -280,14 +267,14 @@ bool have_statedir(void)
|
||||
free(statepath);
|
||||
}
|
||||
if (mkdir(statedir, S_IRWXU) == -1) {
|
||||
history_error(N_("Unable to create directory %s: %s\n"
|
||||
jot_error(N_("Unable to create directory %s: %s\n"
|
||||
"It is required for saving/loading "
|
||||
"search history or cursor positions.\n"),
|
||||
statedir, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
} else if (!S_ISDIR(dirstat.st_mode)) {
|
||||
history_error(N_("Path %s is not a directory and needs to be.\n"
|
||||
jot_error(N_("Path %s is not a directory and needs to be.\n"
|
||||
"Nano will be unable to load or save "
|
||||
"search history or cursor positions.\n"),
|
||||
statedir);
|
||||
@@ -308,7 +295,7 @@ void load_history(void)
|
||||
if (errno != ENOENT) {
|
||||
/* When reading failed, don't save history when we quit. */
|
||||
UNSET(HISTORYLOG);
|
||||
history_error(N_("Error reading %s: %s"), histname,
|
||||
jot_error(N_("Error reading %s: %s"), histname,
|
||||
strerror(errno));
|
||||
}
|
||||
} else {
|
||||
@@ -404,7 +391,7 @@ void load_poshistory(void)
|
||||
if (errno != ENOENT) {
|
||||
/* When reading failed, don't save history when we quit. */
|
||||
UNSET(POSITIONLOG);
|
||||
history_error(N_("Error reading %s: %s"), poshistname, strerror(errno));
|
||||
jot_error(N_("Error reading %s: %s"), poshistname, strerror(errno));
|
||||
}
|
||||
} else {
|
||||
char *line = NULL, *lineptr, *xptr;
|
||||
@@ -414,7 +401,7 @@ void load_poshistory(void)
|
||||
|
||||
/* Read and parse each line, and store the extracted data. */
|
||||
while ((read = getline(&line, &buf_len, hisfile)) > 5) {
|
||||
/* Decode nulls as embedded newlines. */
|
||||
/* Decode NULs as embedded newlines. */
|
||||
unsunder(line, read);
|
||||
|
||||
/* Find where the x index and line number are in the line. */
|
||||
@@ -431,7 +418,7 @@ void load_poshistory(void)
|
||||
|
||||
/* Create a new position record. */
|
||||
newrecord = (poshiststruct *)nmalloc(sizeof(poshiststruct));
|
||||
newrecord->filename = mallocstrcpy(NULL, line);
|
||||
newrecord->filename = copy_of(line);
|
||||
newrecord->lineno = atoi(lineptr);
|
||||
newrecord->xno = atoi(xptr);
|
||||
newrecord->next = NULL;
|
||||
@@ -484,7 +471,7 @@ void save_poshistory(void)
|
||||
posptr->filename, posptr->lineno, posptr->xno);
|
||||
length = strlen(path_and_place);
|
||||
|
||||
/* Encode newlines in filenames as nulls. */
|
||||
/* Encode newlines in filenames as NULs. */
|
||||
sunder(path_and_place);
|
||||
/* Restore the terminating newline. */
|
||||
path_and_place[length - 1] = '\n';
|
||||
@@ -528,7 +515,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
|
||||
poshiststruct *posptr, *theone, *posprev = NULL;
|
||||
char *fullpath = get_full_path(filename);
|
||||
|
||||
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/') {
|
||||
if (fullpath == NULL || *filename == '\0') {
|
||||
free(fullpath);
|
||||
return;
|
||||
}
|
||||
@@ -563,7 +550,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
|
||||
* not at the end, move the matching one to the end. */
|
||||
if (theone == NULL) {
|
||||
theone = (poshiststruct *)nmalloc(sizeof(poshiststruct));
|
||||
theone->filename = mallocstrcpy(NULL, fullpath);
|
||||
theone->filename = copy_of(fullpath);
|
||||
if (position_history == NULL)
|
||||
position_history = theone;
|
||||
else
|
||||
|
||||
14
src/move.c
14
src/move.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* move.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2018 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -109,7 +109,7 @@ void set_proper_index_and_pww(size_t *leftedge, size_t target, bool forward)
|
||||
openfile->placewewant = *leftedge + target;
|
||||
}
|
||||
|
||||
/* Move up nearly one screenful. */
|
||||
/* Move up almost one screenful. */
|
||||
void do_page_up(void)
|
||||
{
|
||||
int mustmove = (editwinrows < 3) ? 1 : editwinrows - 2;
|
||||
@@ -139,7 +139,7 @@ void do_page_up(void)
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
/* Move down nearly one screenful. */
|
||||
/* Move down almost one screenful. */
|
||||
void do_page_down(void)
|
||||
{
|
||||
int mustmove = (editwinrows < 3) ? 1 : editwinrows - 2;
|
||||
@@ -534,7 +534,7 @@ void do_down(void)
|
||||
}
|
||||
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
/* Scroll up one line or chunk without scrolling the cursor. */
|
||||
/* Scroll up one line or chunk without moving the cursor textwise. */
|
||||
void do_scroll_up(void)
|
||||
{
|
||||
/* When the top of the file is onscreen, we can't scroll. */
|
||||
@@ -548,18 +548,18 @@ void do_scroll_up(void)
|
||||
edit_scroll(BACKWARD);
|
||||
}
|
||||
|
||||
/* Scroll down one line or chunk without scrolling the cursor. */
|
||||
/* Scroll down one line or chunk without moving the cursor textwise. */
|
||||
void do_scroll_down(void)
|
||||
{
|
||||
if (openfile->current_y == 0)
|
||||
do_down();
|
||||
|
||||
if (openfile->edittop->next != NULL
|
||||
if (editwinrows > 1 && (openfile->edittop->next != NULL
|
||||
#ifndef NANO_TINY
|
||||
|| chunk_for(openfile->firstcolumn, openfile->edittop) <
|
||||
number_of_chunks_in(openfile->edittop)
|
||||
#endif
|
||||
)
|
||||
))
|
||||
edit_scroll(FORWARD);
|
||||
}
|
||||
#endif
|
||||
|
||||
684
src/nano.c
684
src/nano.c
File diff suppressed because it is too large
Load Diff
82
src/nano.h
82
src/nano.h
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* nano.h -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -19,9 +19,6 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef NANO_H
|
||||
#define NANO_H 1
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@@ -59,11 +56,9 @@
|
||||
#define ISSET(flag) ((FLAGS(flag) & FLAGMASK(flag)) != 0)
|
||||
#define TOGGLE(flag) FLAGS(flag) ^= FLAGMASK(flag)
|
||||
|
||||
/* Macros for character allocation and more. */
|
||||
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
|
||||
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
|
||||
/* Macros for allocation of character strings. */
|
||||
#define charalloc(howmuch) (char *)nmalloc(howmuch)
|
||||
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, howmuch)
|
||||
|
||||
/* In UTF-8 a character is at most six bytes long. */
|
||||
#ifdef ENABLE_UTF8
|
||||
@@ -149,7 +144,7 @@
|
||||
/* Enumeration types. */
|
||||
typedef enum {
|
||||
NIX_FILE, DOS_FILE, MAC_FILE
|
||||
} file_format;
|
||||
} format_type;
|
||||
|
||||
typedef enum {
|
||||
HUSH, NOTICE, MILD, ALERT
|
||||
@@ -236,6 +231,10 @@ typedef struct syntaxtype {
|
||||
/* The list of libmagic results that this syntax applies to. */
|
||||
char *linter;
|
||||
/* The command with which to lint this type of file. */
|
||||
char *formatter;
|
||||
/* The command with which to format/modify/arrange this type of file. */
|
||||
char *tab;
|
||||
/* What the Tab key should produce; NULL for default behavior. */
|
||||
#ifdef ENABLE_COMMENT
|
||||
char *comment;
|
||||
/* The line comment prefix (and postfix) for this type of file. */
|
||||
@@ -295,41 +294,43 @@ typedef struct linestruct {
|
||||
} linestruct;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
typedef struct undo_group {
|
||||
typedef struct groupstruct {
|
||||
ssize_t top_line;
|
||||
/* First line of group. */
|
||||
ssize_t bottom_line;
|
||||
/* Last line of group. */
|
||||
char **indentations;
|
||||
/* String data used to restore the affected lines; one per line. */
|
||||
struct undo_group *next;
|
||||
} undo_group;
|
||||
struct groupstruct *next;
|
||||
/* The next group, if any. */
|
||||
} groupstruct;
|
||||
|
||||
typedef struct undo {
|
||||
ssize_t lineno;
|
||||
typedef struct undostruct {
|
||||
undo_type type;
|
||||
/* What type of undo this was. */
|
||||
/* The operation type that this undo item is for. */
|
||||
int xflags;
|
||||
/* Some flag data to mark certain corner cases. */
|
||||
ssize_t lineno;
|
||||
/* The line number where the operation began or ended. */
|
||||
size_t begin;
|
||||
/* Where did this action begin or end. */
|
||||
/* The x position where the operation began or ended. */
|
||||
char *strdata;
|
||||
/* String type data we will use for copying the affected line back. */
|
||||
/* String data to help restore the affected line. */
|
||||
size_t wassize;
|
||||
/* The file size before the action. */
|
||||
size_t newsize;
|
||||
/* The file size after the action. */
|
||||
int xflags;
|
||||
/* Some flag data we need. */
|
||||
undo_group *grouping;
|
||||
groupstruct *grouping;
|
||||
/* Undo info specific to groups of lines. */
|
||||
linestruct *cutbuffer;
|
||||
/* Copy of the cutbuffer. */
|
||||
/* A copy of the cutbuffer. */
|
||||
ssize_t mark_begin_lineno;
|
||||
/* Mostly the line number of the current line; sometimes something else. */
|
||||
size_t mark_begin_x;
|
||||
/* The x position corresponding to the above line number. */
|
||||
struct undo *next;
|
||||
struct undostruct *next;
|
||||
/* A pointer to the undo item of the preceding action. */
|
||||
} undo;
|
||||
} undostruct;
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
@@ -339,8 +340,9 @@ typedef struct poshiststruct {
|
||||
ssize_t lineno;
|
||||
/* Line number we left off on. */
|
||||
ssize_t xno;
|
||||
/* x position in the file we left off on. */
|
||||
/* The x position in the file we left off on. */
|
||||
struct poshiststruct *next;
|
||||
/* The next item of position history. */
|
||||
} poshiststruct;
|
||||
#endif
|
||||
|
||||
@@ -366,8 +368,6 @@ typedef struct openfilestruct {
|
||||
/* The file's x position we would like. */
|
||||
ssize_t current_y;
|
||||
/* The file's y-coordinate position. */
|
||||
bool modified;
|
||||
/* Whether the file has been modified. */
|
||||
struct stat *current_stat;
|
||||
/* The file's current stat information. */
|
||||
#ifdef ENABLE_WRAPPING
|
||||
@@ -381,19 +381,21 @@ typedef struct openfilestruct {
|
||||
/* The mark's x position in the above line. */
|
||||
mark_type kind_of_mark;
|
||||
/* Whether it is a soft (with Shift) or a hard mark. */
|
||||
file_format fmt;
|
||||
format_type fmt;
|
||||
/* The file's format -- Unix or DOS or Mac or mixed. */
|
||||
undo *undotop;
|
||||
char *lock_filename;
|
||||
/* The path of the lockfile, if we created one. */
|
||||
undostruct *undotop;
|
||||
/* The top of the undo list. */
|
||||
undo *current_undo;
|
||||
undostruct *current_undo;
|
||||
/* The current (i.e. next) level of undo. */
|
||||
undo *last_saved;
|
||||
undostruct *last_saved;
|
||||
/* The undo item at which the file was last saved. */
|
||||
undo_type last_action;
|
||||
/* The type of the last action the user performed. */
|
||||
char *lock_filename;
|
||||
/* The path of the lockfile, if we created one. */
|
||||
#endif
|
||||
bool modified;
|
||||
/* Whether the file has been modified. */
|
||||
#ifdef ENABLE_COLOR
|
||||
syntaxtype *syntax;
|
||||
/* The syntax struct for this file, if any. */
|
||||
@@ -420,8 +422,6 @@ typedef struct rcoption {
|
||||
typedef struct keystruct {
|
||||
const char *keystr;
|
||||
/* 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;
|
||||
@@ -567,6 +567,7 @@ enum
|
||||
/* Basic control codes. */
|
||||
#define BS_CODE 0x08
|
||||
#define TAB_CODE 0x09
|
||||
#define CR_CODE 0x0D
|
||||
#define ESC_CODE 0x1B
|
||||
#define DEL_CODE 0x7F
|
||||
|
||||
@@ -605,6 +606,12 @@ enum
|
||||
#define SHIFT_DELETE 0x45D
|
||||
#define SHIFT_TAB 0x45F
|
||||
|
||||
/* A special keycode for when <Tab> is pressed while the mark is on. */
|
||||
#define INDENT_KEY 0x4F1
|
||||
|
||||
/* A special keycode to signal the beginning and end of a bracketed paste. */
|
||||
#define BRACKETED_PASTE_MARKER 0x4FB
|
||||
|
||||
#ifdef USE_SLANG
|
||||
#ifdef ENABLE_UTF8
|
||||
#define KEY_BAD 0xFF /* Clipped error code. */
|
||||
@@ -626,9 +633,6 @@ enum
|
||||
#define WAS_MARKED_FORWARD (1<<5)
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* The maximum number of entries displayed in the main shortcut list. */
|
||||
#define MAIN_VISIBLE (((COLS + 40) / 20) * 2)
|
||||
|
||||
/* The default number of columns from end of line where wrapping occurs. */
|
||||
#define COLUMNS_FROM_EOL 8
|
||||
|
||||
@@ -647,5 +651,3 @@ enum
|
||||
|
||||
/* The largest size_t number that doesn't have the high bit set. */
|
||||
#define HIGHEST_POSITIVE ((~(size_t)0) >> 1)
|
||||
|
||||
#endif /* !NANO_H */
|
||||
|
||||
73
src/prompt.c
73
src/prompt.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* prompt.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016, 2018 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -24,18 +24,18 @@
|
||||
#include <string.h>
|
||||
|
||||
static char *prompt = NULL;
|
||||
/* The prompt string used for statusbar questions. */
|
||||
/* The prompt string used for status-bar questions. */
|
||||
static size_t typing_x = HIGHEST_POSITIVE;
|
||||
/* The cursor position in answer. */
|
||||
|
||||
#ifdef ENABLE_MOUSE
|
||||
/* Handle a mouse click on the statusbar prompt or the shortcut list. */
|
||||
/* Handle a mouse click on the status-bar prompt or the shortcut list. */
|
||||
int do_statusbar_mouse(void)
|
||||
{
|
||||
int click_row, click_col;
|
||||
int retval = get_mouseinput(&click_row, &click_col, TRUE);
|
||||
|
||||
/* We can click on the statusbar window text to move the cursor. */
|
||||
/* We can click on the status-bar window text to move the cursor. */
|
||||
if (retval == 0 && wmouse_trafo(bottomwin, &click_row, &click_col, FALSE)) {
|
||||
size_t start_col = breadth(prompt) + 2;
|
||||
|
||||
@@ -115,7 +115,7 @@ int do_statusbar_input(bool *finished)
|
||||
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);
|
||||
inject_into_answer(kbinput, kbinput_len, TRUE);
|
||||
|
||||
/* Empty the input buffer. */
|
||||
kbinput_len = 0;
|
||||
@@ -185,8 +185,7 @@ int do_statusbar_input(bool *finished)
|
||||
|
||||
/* The user typed input_len multibyte characters. Add them to the answer,
|
||||
* filtering out ASCII control characters if filtering is TRUE. */
|
||||
void do_statusbar_output(int *the_input, size_t input_len,
|
||||
bool filtering)
|
||||
void inject_into_answer(int *the_input, size_t input_len, bool filtering)
|
||||
{
|
||||
char *output = charalloc(input_len + 1);
|
||||
char onechar[MAXCHARLEN];
|
||||
@@ -203,7 +202,7 @@ void do_statusbar_output(int *the_input, size_t input_len,
|
||||
output[j] = '\n';
|
||||
|
||||
/* Interpret the next multibyte character. */
|
||||
charlen = parse_mbchar(output + j, onechar, NULL);
|
||||
charlen = collect_char(output + j, onechar);
|
||||
|
||||
j += charlen;
|
||||
|
||||
@@ -213,7 +212,7 @@ void do_statusbar_output(int *the_input, size_t input_len,
|
||||
|
||||
/* Insert the typed character into the existing answer string. */
|
||||
answer = charealloc(answer, strlen(answer) + charlen + 1);
|
||||
charmove(answer + typing_x + charlen, answer + typing_x,
|
||||
memmove(answer + typing_x + charlen, answer + typing_x,
|
||||
strlen(answer) - typing_x + 1);
|
||||
strncpy(answer + typing_x, onechar, charlen);
|
||||
|
||||
@@ -255,7 +254,7 @@ void do_statusbar_delete(void)
|
||||
if (answer[typing_x] != '\0') {
|
||||
int charlen = char_length(answer + typing_x);
|
||||
|
||||
charmove(answer + typing_x, answer + typing_x + charlen,
|
||||
memmove(answer + typing_x, answer + typing_x + charlen,
|
||||
strlen(answer) - typing_x - charlen + 1);
|
||||
}
|
||||
}
|
||||
@@ -340,7 +339,7 @@ void do_statusbar_verbatim_input(void)
|
||||
|
||||
kbinput = get_verbatim_kbinput(bottomwin, &kbinput_len);
|
||||
|
||||
do_statusbar_output(kbinput, kbinput_len, FALSE);
|
||||
inject_into_answer(kbinput, kbinput_len, FALSE);
|
||||
|
||||
free(kbinput);
|
||||
}
|
||||
@@ -363,7 +362,7 @@ void do_statusbar_uncut_text(void)
|
||||
}
|
||||
|
||||
/* Return the column number of the first character of the answer that is
|
||||
* displayed in the statusbar when the cursor is at the given column,
|
||||
* displayed in the status bar when the cursor is at the given column,
|
||||
* with the available room for the answer starting at base. Note that
|
||||
* (0 <= column - get_statusbar_page_start(column) < COLS). */
|
||||
size_t get_statusbar_page_start(size_t base, size_t column)
|
||||
@@ -394,7 +393,7 @@ void draw_the_promptbar(void)
|
||||
|
||||
/* Color the promptbar over its full width. */
|
||||
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
blank_statusbar();
|
||||
mvwprintw(bottomwin, 0, 0, "%*s", COLS, " ");
|
||||
|
||||
mvwaddstr(bottomwin, 0, 0, prompt);
|
||||
waddch(bottomwin, ':');
|
||||
@@ -424,19 +423,19 @@ void draw_the_promptbar(void)
|
||||
void add_or_remove_pipe_symbol_from_answer(void)
|
||||
{
|
||||
if (answer[0] == '|') {
|
||||
charmove(answer, answer + 1, strlen(answer) + 1);
|
||||
memmove(answer, answer + 1, strlen(answer) + 1);
|
||||
if (typing_x > 0)
|
||||
typing_x--;
|
||||
} else {
|
||||
answer = charealloc(answer, strlen(answer) + 2);
|
||||
charmove(answer + 1, answer, strlen(answer) + 1);
|
||||
memmove(answer + 1, answer, strlen(answer) + 1);
|
||||
answer[0] = '|';
|
||||
typing_x++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Get a string of input at the statusbar prompt. */
|
||||
/* Get a string of input at the status-bar prompt. */
|
||||
functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
bool allow_files, bool *listed, linestruct **history_list,
|
||||
void (*refresh_func)(void))
|
||||
@@ -543,14 +542,18 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
}
|
||||
} else
|
||||
#endif /* ENABLE_HISTORIES */
|
||||
if (func == do_help_void) {
|
||||
if (func == do_help) {
|
||||
/* This key has a shortcut-list entry when it's used to go to
|
||||
* the help browser or display a message indicating that help
|
||||
* the help viewer or display a message indicating that help
|
||||
* is disabled, 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. */
|
||||
* the status-bar prompt. */
|
||||
finished = FALSE;
|
||||
}
|
||||
#ifndef NANO_TINY
|
||||
else if (func == do_nothing)
|
||||
finished = FALSE;
|
||||
#endif
|
||||
|
||||
/* If we have a shortcut with an associated function, break out if
|
||||
* we're finished after running or trying to run the function. */
|
||||
@@ -575,30 +578,30 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
return func;
|
||||
}
|
||||
|
||||
/* Ask a question on the statusbar. Return 0 when text was entered,
|
||||
/* Ask a question on the status bar. 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 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
|
||||
* can be tab completed. The 'provided' parameter is the default answer
|
||||
* for when simply Enter is typed. */
|
||||
int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int menu, const char *curranswer, linestruct **history_list,
|
||||
int menu, const char *provided, linestruct **history_list,
|
||||
void (*refresh_func)(void), const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int retval;
|
||||
functionptrtype func = NULL;
|
||||
bool listed = FALSE;
|
||||
/* Save a possible current statusbar x position and prompt. */
|
||||
/* Save a possible current status-bar x position and prompt. */
|
||||
size_t was_typing_x = typing_x;
|
||||
char *saved_prompt = prompt;
|
||||
|
||||
bottombars(menu);
|
||||
|
||||
if (answer != curranswer || answer == NULL)
|
||||
answer = mallocstrcpy(answer, curranswer);
|
||||
if (answer != provided)
|
||||
answer = mallocstrcpy(answer, provided);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
redo_theprompt:
|
||||
@@ -645,7 +648,7 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
}
|
||||
|
||||
/* Ask a simple Yes/No (and optionally All) question, specified in msg,
|
||||
* on the statusbar. Return 1 for Yes, 0 for No, 2 for All (if all is
|
||||
* on the status bar. Return 1 for Yes, 0 for No, 2 for All (if all is
|
||||
* TRUE when passed in), and -1 for Cancel. */
|
||||
int do_yesno_prompt(bool all, const char *msg)
|
||||
{
|
||||
@@ -695,9 +698,9 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
post_one_key(cancelshortcut->keystr, _("Cancel"), width);
|
||||
}
|
||||
|
||||
/* Color the statusbar over its full width and display the question. */
|
||||
/* Color the promptbar over its full width and display the question. */
|
||||
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
blank_statusbar();
|
||||
mvwprintw(bottomwin, 0, 0, "%*s", COLS, " ");
|
||||
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
wnoutrefresh(bottomwin);
|
||||
@@ -707,6 +710,12 @@ 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);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Accept the first character of an external paste. */
|
||||
if (bracketed_paste && kbinput == BRACKETED_PASTE_MARKER)
|
||||
kbinput = get_kbinput(bottomwin, BLIND);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
letter[index++] = (unsigned char)kbinput;
|
||||
#ifdef ENABLE_UTF8
|
||||
@@ -762,6 +771,14 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_MOUSE */
|
||||
else
|
||||
beep();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Ignore the rest of an external paste. */
|
||||
while (bracketed_paste)
|
||||
kbinput = get_kbinput(bottomwin, BLIND);
|
||||
#endif
|
||||
}
|
||||
|
||||
return choice;
|
||||
|
||||
148
src/proto.h
148
src/proto.h
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* proto.h -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -18,9 +18,6 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef PROTO_H
|
||||
#define PROTO_H 1
|
||||
|
||||
#include "nano.h"
|
||||
|
||||
/* All external variables. See global.c for their descriptions. */
|
||||
@@ -30,9 +27,19 @@ extern volatile sig_atomic_t the_window_resized;
|
||||
#endif
|
||||
|
||||
extern bool on_a_vt;
|
||||
extern bool shifted_metas;
|
||||
|
||||
extern bool meta_key;
|
||||
extern bool shift_held;
|
||||
extern bool mute_modifiers;
|
||||
extern bool bracketed_paste;
|
||||
|
||||
extern bool started_curses;
|
||||
extern bool we_are_running;
|
||||
extern bool more_than_one;
|
||||
|
||||
extern bool inhelp;
|
||||
extern char *title;
|
||||
|
||||
extern bool focusing;
|
||||
|
||||
@@ -42,21 +49,21 @@ extern bool control_C_was_pressed;
|
||||
|
||||
extern bool suppress_cursorpos;
|
||||
|
||||
extern bool started_curses;
|
||||
|
||||
extern message_type lastmessage;
|
||||
|
||||
extern linestruct *pletion_line;
|
||||
|
||||
extern bool inhelp;
|
||||
extern char *title;
|
||||
|
||||
extern bool more_than_one;
|
||||
|
||||
extern bool also_the_last;
|
||||
|
||||
extern char *answer;
|
||||
|
||||
extern char *last_search;
|
||||
extern int didfind;
|
||||
|
||||
extern char *present_path;
|
||||
|
||||
extern unsigned flags[4];
|
||||
|
||||
extern int controlleft, controlright;
|
||||
extern int controlup, controldown;
|
||||
extern int controlhome, controlend;
|
||||
@@ -75,15 +82,10 @@ extern int shiftaltup, shiftaltdown;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
extern ssize_t fill, wrap_at;
|
||||
extern ssize_t fill;
|
||||
extern size_t wrap_at;
|
||||
#endif
|
||||
|
||||
extern char *last_search;
|
||||
|
||||
extern char *present_path;
|
||||
|
||||
extern unsigned flags[4];
|
||||
|
||||
extern WINDOW *topwin;
|
||||
extern WINDOW *edit;
|
||||
extern WINDOW *bottomwin;
|
||||
@@ -120,14 +122,10 @@ extern regex_t quotereg;
|
||||
|
||||
extern char *word_chars;
|
||||
|
||||
extern char *answer;
|
||||
|
||||
extern ssize_t tabsize;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
extern char *backup_dir;
|
||||
extern const char *locking_prefix;
|
||||
extern const char *locking_suffix;
|
||||
#endif
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
extern char *operating_dir;
|
||||
@@ -173,8 +171,11 @@ extern int interface_color_pair[NUMBER_OF_ELEMENTS];
|
||||
|
||||
extern char *homedir;
|
||||
extern char *statedir;
|
||||
#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
|
||||
extern char *startup_problem;
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
extern char *rcfile_with_errors;
|
||||
extern char *custom_nanorc;
|
||||
#endif
|
||||
|
||||
extern bool spotlighted;
|
||||
@@ -210,10 +211,14 @@ bool is_ascii_cntrl_char(int c);
|
||||
bool is_cntrl_mbchar(const char *c);
|
||||
bool is_word_mbchar(const char *c, bool allow_punct);
|
||||
char control_mbrep(const char *c, bool isdata);
|
||||
#ifdef ENABLE_UTF8
|
||||
int mbwidth(const char *c);
|
||||
#endif
|
||||
char *make_mbchar(long chr, int *chr_mb_len);
|
||||
int char_length(const char *pointer);
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col);
|
||||
size_t mbstrlen(const char *s);
|
||||
int collect_char(const char *buf, char *chr);
|
||||
int advance_over(const char *string, size_t *column);
|
||||
size_t step_left(const char *buf, size_t pos);
|
||||
size_t step_right(const char *buf, size_t pos);
|
||||
int mbstrcasecmp(const char *s1, const char *s2);
|
||||
@@ -221,7 +226,6 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n);
|
||||
char *mbstrcasestr(const char *haystack, const char *needle);
|
||||
char *revstrstr(const char *haystack, const char *needle, const char *index);
|
||||
char *mbrevstrcasestr(const char *haystack, const char *needle, const char *index);
|
||||
size_t mbstrlen(const char *s);
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
|
||||
char *mbstrchr(const char *s, const char *c);
|
||||
#endif
|
||||
@@ -233,6 +237,7 @@ char *mbrevstrpbrk(const char *head, const char *accept, const char *index);
|
||||
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || defined(ENABLE_JUSTIFY))
|
||||
bool has_blank_char(const char *s);
|
||||
#endif
|
||||
bool white_string(const char *s);
|
||||
#ifdef ENABLE_UTF8
|
||||
bool is_valid_unicode(wchar_t wc);
|
||||
#endif
|
||||
@@ -242,8 +247,8 @@ bool is_valid_unicode(wchar_t wc);
|
||||
void set_colorpairs(void);
|
||||
void color_init(void);
|
||||
void color_update(void);
|
||||
void set_up_multicache(linestruct *line);
|
||||
void check_the_multis(linestruct *line);
|
||||
void alloc_multidata_if_needed(linestruct *fileptr);
|
||||
void precalc_multicolorinfo(void);
|
||||
#endif
|
||||
|
||||
@@ -253,9 +258,15 @@ void do_backspace(void);
|
||||
#ifndef NANO_TINY
|
||||
void chop_previous_word(void);
|
||||
void chop_next_word(void);
|
||||
#endif
|
||||
void extract_segment(linestruct *top, size_t top_x,
|
||||
linestruct *bot, size_t bot_x);
|
||||
void ingraft_buffer(linestruct *somebuffer);
|
||||
void copy_from_buffer(linestruct *somebuffer);
|
||||
#ifndef NANO_TINY
|
||||
void cut_marked(bool *right_side_up);
|
||||
#endif
|
||||
void do_cut_text(bool copying, bool marked, bool until_eof, bool append);
|
||||
void do_snip(bool copying, bool marked, bool until_eof, bool append);
|
||||
bool is_cuttable(bool test_cliff);
|
||||
void cut_text(void);
|
||||
#ifndef NANO_TINY
|
||||
@@ -267,11 +278,15 @@ void paste_text(void);
|
||||
|
||||
/* Most functions in files.c. */
|
||||
void make_new_buffer(void);
|
||||
void set_modified(void);
|
||||
#ifndef NANO_TINY
|
||||
int delete_lockfile(const char *lockfilename);
|
||||
#endif
|
||||
bool open_buffer(const char *filename, bool new_buffer);
|
||||
#ifdef ENABLE_SPELLER
|
||||
bool replace_buffer(const char *filename, undo_type action, bool marked);
|
||||
bool replace_buffer(const char *filename, undo_type action, bool marked,
|
||||
const char *operation);
|
||||
#endif
|
||||
void set_modified(void);
|
||||
void prepare_for_display(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void mention_name_and_linecount(void);
|
||||
@@ -291,8 +306,6 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void init_backup_dir(void);
|
||||
int delete_lockfile(const char *lockfilename);
|
||||
int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out, bool close_out);
|
||||
bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
@@ -314,29 +327,25 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
#endif
|
||||
|
||||
/* Some functions in global.c. */
|
||||
size_t length_of_list(int menu);
|
||||
const keystruct *first_sc_for(int menu, void (*func)(void));
|
||||
int the_code_for(void (*func)(void), int defaultval);
|
||||
size_t shown_entries_for(int menu);
|
||||
const keystruct *get_shortcut(int *kbinput);
|
||||
functionptrtype func_from_key(int *kbinput);
|
||||
#if defined(ENABLE_BROWSER) || defined(ENABLE_HELP)
|
||||
functionptrtype interpret(int *keycode);
|
||||
#endif
|
||||
int keycode_from_string(const char *keystring);
|
||||
void assign_keyinfo(keystruct *s, const char *keystring, const int keycode);
|
||||
void shortcut_init(void);
|
||||
const char *flagtostr(int flag);
|
||||
#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. */
|
||||
#ifdef ENABLE_HELP
|
||||
void wrap_help_text_into_buffer();
|
||||
void do_help(void);
|
||||
void wrap_help_text_into_buffer(void);
|
||||
void help_init(void);
|
||||
functionptrtype parse_help_input(int *kbinput);
|
||||
size_t help_line_len(const char *ptr);
|
||||
#endif
|
||||
void do_help_void(void);
|
||||
void do_help(void);
|
||||
|
||||
/* Most functions in history.c. */
|
||||
#ifdef ENABLE_HISTORIES
|
||||
@@ -395,13 +404,10 @@ linestruct *copy_buffer(const linestruct *src);
|
||||
void free_lines(linestruct *src);
|
||||
void renumber_from(linestruct *line);
|
||||
void partition_buffer(linestruct *top, size_t top_x,
|
||||
linestruct *bot, size_t bot_x);
|
||||
void unpartition_buffer();
|
||||
void extract(linestruct *top, size_t top_x, linestruct *bot, size_t bot_x);
|
||||
void ingraft_buffer(linestruct *somebuffer);
|
||||
void copy_from_buffer(linestruct *somebuffer);
|
||||
linestruct *bot, size_t bot_x);
|
||||
void unpartition_buffer(void);
|
||||
void print_view_warning(void);
|
||||
void show_restricted_warning(void);
|
||||
bool in_restricted_mode(void);
|
||||
#ifndef ENABLE_HELP
|
||||
void say_there_is_no_help(void);
|
||||
#endif
|
||||
@@ -438,10 +444,10 @@ void confirm_margin(void);
|
||||
#endif
|
||||
void unbound_key(int code);
|
||||
bool okay_for_view(const keystruct *shortcut);
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls);
|
||||
void inject(char *output, size_t output_len, bool filtering);
|
||||
|
||||
/* Most functions in prompt.c. */
|
||||
void do_statusbar_output(int *the_input, size_t input_len, bool filtering);
|
||||
void inject_into_answer(int *the_input, size_t input_len, bool filtering);
|
||||
void do_statusbar_home(void);
|
||||
void do_statusbar_end(void);
|
||||
void do_statusbar_left(void);
|
||||
@@ -464,8 +470,11 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int do_yesno_prompt(bool all, const char *msg);
|
||||
|
||||
/* Most functions in rcfile.c. */
|
||||
#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
|
||||
void display_rcfile_errors(void);
|
||||
void jot_error(const char *msg, ...);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
void display_rcfile_errors();
|
||||
#ifdef ENABLE_COLOR
|
||||
void parse_one_include(char *file, syntaxtype *syntax);
|
||||
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
|
||||
@@ -476,6 +485,8 @@ void do_rcfiles(void);
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* Most functions in search.c. */
|
||||
bool regexp_init(const char *regexp);
|
||||
void tidy_up_after_search(void);
|
||||
int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
size_t *match_len, bool skipone, const linestruct *begin, size_t begin_x);
|
||||
void do_search(void);
|
||||
@@ -506,7 +517,6 @@ void do_tab(void);
|
||||
void do_indent(void);
|
||||
void do_unindent(void);
|
||||
#endif
|
||||
bool white_string(const char *s);
|
||||
#ifdef ENABLE_COMMENT
|
||||
void do_comment(void);
|
||||
#endif
|
||||
@@ -516,8 +526,8 @@ void do_enter(void);
|
||||
#ifndef NANO_TINY
|
||||
RETSIGTYPE cancel_command(int signal);
|
||||
bool execute_command(const char *command);
|
||||
void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep);
|
||||
void add_undo(undo_type action);
|
||||
void discard_until(const undostruct *thisitem, openfilestruct *thefile, bool keep);
|
||||
void add_undo(undo_type action, const char *message);
|
||||
void update_multiline_undo(ssize_t lineno, char *indentation);
|
||||
void update_undo(undo_type action);
|
||||
#endif /* !NANO_TINY */
|
||||
@@ -527,10 +537,11 @@ bool do_wrap(void);
|
||||
#if defined(ENABLE_HELP) || defined(ENABLED_WRAPORJUSTIFY)
|
||||
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
|
||||
#endif
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
|
||||
#if !defined(NANO_TINY) || defined(ENABLED_WRAPORJUSTIFY)
|
||||
size_t indent_length(const char *line);
|
||||
#endif
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
size_t quote_length(const char *line);
|
||||
bool begpar(const linestruct *const foo, int depth);
|
||||
bool inpar(const linestruct *const foo);
|
||||
void do_justify(bool full_justify);
|
||||
@@ -542,6 +553,7 @@ void do_spell(void);
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
void do_linter(void);
|
||||
void do_formatter(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void do_wordlinechar_count(void);
|
||||
@@ -558,8 +570,8 @@ 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 unsunder(char *str, size_t true_len);
|
||||
void sunder(char *str);
|
||||
void unsunder(char *string, size_t length);
|
||||
void sunder(char *string);
|
||||
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||
void free_chararray(char **array, size_t len);
|
||||
#endif
|
||||
@@ -570,8 +582,9 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *start);
|
||||
void *nmalloc(size_t howmuch);
|
||||
void *nrealloc(void *ptr, size_t howmuch);
|
||||
char *mallocstrncpy(char *dest, const char *src, size_t n);
|
||||
char *measured_copy(const char *src, size_t n);
|
||||
char *mallocstrcpy(char *dest, const char *src);
|
||||
char *copy_of(const char *string);
|
||||
char *free_and_assign(char *dest, char *src);
|
||||
size_t get_page_start(size_t column);
|
||||
size_t xplustabs(void);
|
||||
@@ -596,15 +609,11 @@ linestruct *line_from_number(ssize_t lineno);
|
||||
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);
|
||||
int parse_escape_sequence(WINDOW *win, int kbinput);
|
||||
int get_kbinput(WINDOW *win, bool showcursor);
|
||||
int get_byte_kbinput(int kbinput);
|
||||
int get_control_kbinput(int kbinput);
|
||||
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
|
||||
@@ -612,8 +621,6 @@ 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 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);
|
||||
@@ -622,14 +629,12 @@ void check_statusblank(void);
|
||||
char *display_string(const char *buf, size_t column, size_t span,
|
||||
bool isdata, bool isprompt);
|
||||
void titlebar(const char *path);
|
||||
void statusline(message_type importance, const char *msg, ...);
|
||||
void statusbar(const char *msg);
|
||||
void warn_and_shortly_pause(const char *msg);
|
||||
void statusline(message_type importance, const char *msg, ...);
|
||||
void bottombars(int menu);
|
||||
void post_one_key(const char *keystroke, const char *tag, int width);
|
||||
void place_the_cursor(void);
|
||||
void edit_draw(linestruct *fileptr, const char *converted,
|
||||
int line, size_t from_col);
|
||||
int update_line(linestruct *fileptr, size_t index);
|
||||
#ifndef NANO_TINY
|
||||
int update_softwrapped_line(linestruct *fileptr);
|
||||
@@ -674,10 +679,11 @@ void backwards_void(void);
|
||||
void flip_replace(void);
|
||||
void flip_goto(void);
|
||||
#ifdef ENABLE_BROWSER
|
||||
void to_files_void(void);
|
||||
void goto_dir_void(void);
|
||||
void to_files(void);
|
||||
void goto_dir(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void do_nothing(void);
|
||||
void do_toggle_void(void);
|
||||
void dos_format_void(void);
|
||||
void mac_format_void(void);
|
||||
@@ -693,5 +699,3 @@ void flip_newbuffer(void);
|
||||
#endif
|
||||
void discard_buffer(void);
|
||||
void do_cancel(void);
|
||||
|
||||
#endif /* !PROTO_H */
|
||||
|
||||
758
src/rcfile.c
758
src/rcfile.c
File diff suppressed because it is too large
Load Diff
18
src/search.c
18
src/search.c
@@ -1,8 +1,8 @@
|
||||
/**************************************************************************
|
||||
* search.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015-2018 Benno Schulenberg *
|
||||
* Copyright (C) 1999-2011, 2013-2020 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 *
|
||||
@@ -76,7 +76,7 @@ void search_init(bool replacing, bool keep_the_answer)
|
||||
|
||||
/* When starting a new search, clear the current answer. */
|
||||
if (!keep_the_answer)
|
||||
answer = mallocstrcpy(answer, NULL);
|
||||
answer = mallocstrcpy(answer, "");
|
||||
|
||||
/* If something was searched for earlier, include it in the prompt. */
|
||||
if (*last_search != '\0') {
|
||||
@@ -88,7 +88,7 @@ void search_init(bool replacing, bool keep_the_answer)
|
||||
(breadth(last_search) > COLS / 3) ? "..." : "");
|
||||
free(disp);
|
||||
} else
|
||||
thedefault = mallocstrcpy(NULL, "");
|
||||
thedefault = copy_of("");
|
||||
|
||||
while (TRUE) {
|
||||
functionptrtype func;
|
||||
@@ -98,7 +98,7 @@ void search_init(bool replacing, bool keep_the_answer)
|
||||
answer, &search_history, edit_refresh,
|
||||
/* TRANSLATORS: This is the main search prompt. */
|
||||
"%s%s%s%s%s%s", _("Search"),
|
||||
/* TRANSLATORS: The next five modify the search prompt. */
|
||||
/* TRANSLATORS: The next four modify the search prompt. */
|
||||
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") : "",
|
||||
ISSET(USE_REGEXP) ? _(" [Regexp]") : "",
|
||||
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") : "",
|
||||
@@ -359,6 +359,8 @@ void do_research(void)
|
||||
/* Use the search-menu key bindings, to allow cancelling. */
|
||||
currmenu = MWHEREIS;
|
||||
|
||||
wipe_statusbar();
|
||||
|
||||
go_looking();
|
||||
|
||||
tidy_up_after_search();
|
||||
@@ -596,7 +598,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
size_t length_change;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(REPLACE);
|
||||
add_undo(REPLACE, NULL);
|
||||
#endif
|
||||
copy = replace_line(needle);
|
||||
|
||||
@@ -697,7 +699,7 @@ void ask_for_replacement(void)
|
||||
linestruct *edittop_save, *begin;
|
||||
size_t firstcolumn_save, begin_x;
|
||||
ssize_t numreplaced;
|
||||
int response = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL,
|
||||
int response = do_prompt(FALSE, FALSE, MREPLACEWITH, "",
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
&replace_history, edit_refresh, _("Replace with"));
|
||||
|
||||
@@ -756,7 +758,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
if (interactive) {
|
||||
/* Ask for the line and column. */
|
||||
int response = do_prompt(FALSE, FALSE, MGOTOLINE,
|
||||
use_answer ? answer : NULL, NULL, edit_refresh,
|
||||
use_answer ? answer : "", NULL, edit_refresh,
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
_("Enter line number, column number"));
|
||||
|
||||
|
||||
753
src/text.c
753
src/text.c
File diff suppressed because it is too large
Load Diff
75
src/utils.c
75
src/utils.c
@@ -1,8 +1,8 @@
|
||||
/**************************************************************************
|
||||
* utils.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016-2017 Benno Schulenberg *
|
||||
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016, 2017, 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 *
|
||||
@@ -49,7 +49,7 @@ void get_homedir(void)
|
||||
/* Only set homedir if some home directory could be determined,
|
||||
* otherwise keep homedir NULL. */
|
||||
if (homenv != NULL && *homenv != '\0')
|
||||
homedir = mallocstrcpy(NULL, homenv);
|
||||
homedir = copy_of(homenv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||
if (comma == str)
|
||||
return retval;
|
||||
|
||||
firstpart = mallocstrcpy(NULL, str);
|
||||
firstpart = copy_of(str);
|
||||
firstpart[comma - str] = '\0';
|
||||
|
||||
retval = parse_num(firstpart, line) && retval;
|
||||
@@ -159,23 +159,24 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* 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)
|
||||
/* In the given string, recode each embedded NUL as a newline. */
|
||||
void unsunder(char *string, size_t length)
|
||||
{
|
||||
for (; true_len > 0; true_len--, str++) {
|
||||
if (*str == '\0')
|
||||
*str = '\n';
|
||||
while (length > 0) {
|
||||
if (*string == '\0')
|
||||
*string = '\n';
|
||||
length--;
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
||||
/* For non-null-terminated lines. A line, by definition, shouldn't
|
||||
* normally have newlines in it, so decode its newlines as nulls. */
|
||||
void sunder(char *str)
|
||||
/* In the given string, recode each embedded newline as a NUL. */
|
||||
void sunder(char *string)
|
||||
{
|
||||
for (; *str != '\0'; str++) {
|
||||
if (*str == '\n')
|
||||
*str = '\0';
|
||||
while (*string != '\0') {
|
||||
if (*string == '\n')
|
||||
*string = '\0';
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,8 +203,8 @@ bool is_separate_word(size_t position, size_t length, const char *buf)
|
||||
size_t word_end = position + length;
|
||||
|
||||
/* Get the characters before and after the word, if any. */
|
||||
parse_mbchar(buf + step_left(buf, position), before, NULL);
|
||||
parse_mbchar(buf + word_end, after, NULL);
|
||||
collect_char(buf + step_left(buf, position), before);
|
||||
collect_char(buf + word_end, after);
|
||||
|
||||
/* If the word starts at the beginning of the line OR the character before
|
||||
* the word isn't a letter, and if the word ends at the end of the line OR
|
||||
@@ -311,24 +312,32 @@ void *nrealloc(void *ptr, size_t howmuch)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Allocate and copy the first n characters of the given src string, after
|
||||
* freeing the destination. Usage: "dest = mallocstrncpy(dest, src, n);". */
|
||||
char *mallocstrncpy(char *dest, const char *src, size_t n)
|
||||
/* Return an appropriately reallocated dest string holding a copy of src.
|
||||
* Usage: "dest = mallocstrcpy(dest, src);". */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
{
|
||||
if (src == NULL)
|
||||
src = "";
|
||||
size_t count = strlen(src) + 1;
|
||||
|
||||
dest = charealloc(dest, n);
|
||||
strncpy(dest, src, n);
|
||||
dest = charealloc(dest, count);
|
||||
strncpy(dest, src, count);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Free the dest string and return a malloc'ed copy of src. Should be used as:
|
||||
* "dest = mallocstrcpy(dest, src);". */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
/* Return an allocated copy of the first count characters of the given string. */
|
||||
char *measured_copy(const char *string, size_t count)
|
||||
{
|
||||
return mallocstrncpy(dest, src, (src == NULL) ? 1 : strlen(src) + 1);
|
||||
char *thecopy = charalloc(count);
|
||||
|
||||
strncpy(thecopy, string, count);
|
||||
|
||||
return thecopy;
|
||||
}
|
||||
|
||||
/* Return an allocated copy of the given string. */
|
||||
char *copy_of(const char *string)
|
||||
{
|
||||
return measured_copy(string, strlen(string) + 1);
|
||||
}
|
||||
|
||||
/* Free the string at dest and return the string at src. */
|
||||
@@ -370,7 +379,7 @@ size_t actual_x(const char *text, size_t column)
|
||||
/* The current accumulated span, in columns. */
|
||||
|
||||
while (*text != '\0') {
|
||||
int charlen = parse_mbchar(text, NULL, &width);
|
||||
int charlen = advance_over(text, &width);
|
||||
|
||||
if (width > column)
|
||||
break;
|
||||
@@ -391,7 +400,7 @@ size_t wideness(const char *text, size_t maxlen)
|
||||
return 0;
|
||||
|
||||
while (*text != '\0') {
|
||||
size_t charlen = parse_mbchar(text, NULL, &width);
|
||||
size_t charlen = advance_over(text, &width);
|
||||
|
||||
if (maxlen <= charlen)
|
||||
break;
|
||||
@@ -409,7 +418,7 @@ size_t breadth(const char *text)
|
||||
size_t span = 0;
|
||||
|
||||
while (*text != '\0')
|
||||
text += parse_mbchar(text, NULL, &span);
|
||||
text += advance_over(text, &span);
|
||||
|
||||
return span;
|
||||
}
|
||||
@@ -418,7 +427,7 @@ size_t breadth(const char *text)
|
||||
void new_magicline(void)
|
||||
{
|
||||
openfile->filebot->next = make_new_node(openfile->filebot);
|
||||
openfile->filebot->next->data = mallocstrcpy(NULL, "");
|
||||
openfile->filebot->next->data = copy_of("");
|
||||
openfile->filebot = openfile->filebot->next;
|
||||
openfile->totsize++;
|
||||
}
|
||||
|
||||
1711
src/winio.c
1711
src/winio.c
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ color red "\<[A-Z_]{2,}\>"
|
||||
color brightgreen "\.(data|subsection|text)"
|
||||
color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
|
||||
color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
|
||||
icolor brightred "^[[:space:]]*[.0-9A-Z_]*:"
|
||||
color brightred "^[[:space:]]*[.0-9A-Za-z_]*:"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
|
||||
# Strings.
|
||||
|
||||
@@ -6,7 +6,7 @@ magic "awk script"
|
||||
comment "#"
|
||||
|
||||
# Records.
|
||||
icolor brightred "\$[0-9A-Z_!@#$*?-]+"
|
||||
color brightred "\$[0-9A-Za-z_!@#$*?-]+"
|
||||
# Awk-set variables.
|
||||
color red "\<(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\>"
|
||||
color red "\<(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\>"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for C/C++.
|
||||
|
||||
syntax c "\.([ch](pp|xx)?|C|cc|c\+\+|H|hh|ii?)$"
|
||||
syntax c "\.([ch](pp|xx)?|C|cc|c\+\+|cu|H|hh|ii?)$"
|
||||
header "-\*-.*\<C(\+\+)?((;|\s).*)?-\*-"
|
||||
magic "^(C|C\+\+) (source|program)"
|
||||
comment "//"
|
||||
|
||||
@@ -10,7 +11,7 @@ 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 "\<([[:lower:]]+|(u_?)?int(8|16|32|64|ptr))_t\>"
|
||||
color green "\<([[:lower:]][[:lower:]_]*|(u_?)?int(8|16|32|64))_t\>"
|
||||
color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|override|using|mutable|volatile|register|explicit)\>"
|
||||
color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
|
||||
color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
syntax cmake "(CMakeLists\.txt|\.cmake)$"
|
||||
comment "#"
|
||||
|
||||
icolor green "^[[:space:]]*[A-Z0-9_]+"
|
||||
color green "^[[:space:]]*[0-9A-Za-z_]+"
|
||||
icolor brightyellow "^[[:space:]]*(include|include_directories|include_external_msproject)\>"
|
||||
|
||||
icolor brightgreen "^[[:space:]]*((else|end)?if|else|(end)?while|(end)?foreach|break)\>"
|
||||
@@ -12,7 +12,7 @@ color brightgreen "[[:space:]](OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS
|
||||
|
||||
icolor brightred "^[[:space:]]*((end)?(function|macro)|return)"
|
||||
|
||||
icolor cyan start="\$(\{|ENV\{)" end="\}"
|
||||
icolor cyan start="\$(ENV)?\{" end="\}"
|
||||
color magenta "\<(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\>"
|
||||
|
||||
color brightblue "(^|[[:space:]])#.*"
|
||||
|
||||
@@ -15,3 +15,6 @@ color brightred "(GNU )?[Nn]ano [1-4]\.[0-9][-.[:alnum:]]*\>"
|
||||
|
||||
# Email addresses.
|
||||
color magenta "<[[:alnum:].%_+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,}>"
|
||||
|
||||
# Bracketed captions in certain config files.
|
||||
color brightgreen "^\[[^][]+\]$"
|
||||
|
||||
@@ -34,7 +34,7 @@ icolor yellow "\<(.or.|repeat|select case|then|where|while)\>"
|
||||
icolor magenta "\<(continue|cycle|exit|go?to|result|return)\>"
|
||||
|
||||
# Strings.
|
||||
icolor yellow "<[^= ]*>" ""(\\.|[^"])*""
|
||||
color yellow "<[^= ]*>" ""(\\.|[^"])*""
|
||||
|
||||
# Comments.
|
||||
icolor blue "!.*"
|
||||
color blue "!.*"
|
||||
|
||||
@@ -17,7 +17,7 @@ color green "-(eq|ne|gt|lt|ge|le)\>"
|
||||
## Variables... official portage ones in red, all others in bright red:
|
||||
color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*"
|
||||
color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:digit:]]|@)+\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
|
||||
color red "\<(EAPI|ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|[HPR]?DEPEND|PROVIDE|PROPERTIES|REQUIRED_USE|RESTRICT|USERLAND)\>"
|
||||
color red "\<(EAPI|ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|[BHPR]?DEPEND|PROVIDE|PROPERTIES|REQUIRED_USE|RESTRICT|USERLAND)\>"
|
||||
color red "\<(S|E?D|T|PV|PF|P|PN|PR|PVR|A|CATEGORY|DISTDIR|FILESDIR|EPREFIX|E?ROOT|WORKDIR)\>"
|
||||
color red "\<(AS|C(PP|XX)?|LD)FLAGS\>" "\<C(HOST|TARGET|BUILD)\>" "\<(MERGE_TYPE|REPLACING_VERSIONS|REPLACED_BY_VERSION)\>"
|
||||
color red "\<EBUILD_PHASE(_FUNC)?\>"
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
syntax go "\.go$"
|
||||
comment "//"
|
||||
|
||||
formatter gofmt -w
|
||||
|
||||
# Types.
|
||||
color green "\<(bool|u?int(8|16|32|64)?|float(32|64)|complex(64|128)|byte|rune|uintptr|string|error)\>"
|
||||
color green "\<((<-[[:space:]]*)chan|chan[[:space:]]*<-|const|func|interface|map|struct|type|var)\>"
|
||||
|
||||
@@ -4,6 +4,8 @@ syntax html "\.html?$"
|
||||
magic "HTML document"
|
||||
comment "<!--|-->"
|
||||
|
||||
formatter tidy -m -q
|
||||
|
||||
# Tags:
|
||||
color cyan "<[[:alpha:]/!?][^>]*>"
|
||||
# Bold, italic, and underlined:
|
||||
@@ -11,18 +13,19 @@ color brightmagenta "</?[biu]>"
|
||||
|
||||
# Named character references:
|
||||
color red "&[^;[:space:]]*;"
|
||||
|
||||
# Attributes:
|
||||
color red "\<(abbr|accept(-charset)?|accesskey|action|alink|align|alt|archive|axis|background|bgcolor|border)="
|
||||
color red "\<(cell(padding|spacing)|char(off|set)?|checked|cite|class(id)?|compact|code(base|tag)?|cols(pan)?)="
|
||||
color red "\<(content(editable)?|contextmenu|coords|data|datetime|declare|defer|dir|disabled|enctype)="
|
||||
color red "\<(for|frame(border)?|headers|height|hidden|href(lang)?|hspace|http-equiv|id|ismap)="
|
||||
color red "\<(label|lang|link|longdesc|margin(height|width)|maxlength|media|method|multiple)="
|
||||
color red "\<(name|nohref|noresize|noshade|object|onclick|onfocus|onload|onmouseover|profile|readonly|rel|rev)="
|
||||
color red "\<(rows(pan)?|rules|scheme|scope|scrolling|selected|shape|size|span|src|standby|start|style|summary)="
|
||||
color red "\<(tabindex|target|text|title|type|usemap|valign|value(type)?|vlink|vspace|width|xmlns|xml:space)="
|
||||
|
||||
# Strings:
|
||||
color green ""(\\.|[^"])*""
|
||||
|
||||
# Attributes:
|
||||
color red "(abbr|accept(-charset)?|accesskey|action|alink|align|alt|archive|axis|background|bgcolor|border)="
|
||||
color red "(cell(padding|spacing)|char(off|set)?|checked|cite|class(id)?|compact|code(base|tag)?|cols(pan)?)="
|
||||
color red "(content(editable)?|contextmenu|coords|data|datetime|declare|defer|dir|disabled|enctype)="
|
||||
color red "(for|frame(border)?|headers|height|hidden|href(lang)?|hspace|http-equiv|id|ismap)="
|
||||
color red "(label|lang|link|longdesc|margin(height|width)|maxlength|media|method|multiple)="
|
||||
color red "(name|nohref|noresize|noshade|object|onclick|onfocus|onload|onmouseover|profile|readonly|rel|rev)="
|
||||
color red "(rows(pan)?|rules|scheme|scope|scrolling|selected|shape|size|span|src|standby|start|style|summary)="
|
||||
color red "(tabindex|target|text|title|type|usemap|valign|value(type)?|vlink|vspace|width|xmlns|xml:space)="
|
||||
|
||||
# Comments:
|
||||
color yellow start="<!--" end="-->"
|
||||
|
||||
@@ -12,7 +12,9 @@ color brightyellow "\<(await|export|import|throw|try|catch|finally|new|delete)\>
|
||||
color magenta "\<(break|continue|return|yield)\>"
|
||||
|
||||
# Octal/decimal and hexadecimal numbers.
|
||||
color cyan "\<[0-9]+\>" "\<0x[0-9A-Fa-f]+\>"
|
||||
color cyan "\<([0-9]+|0x[0-9A-Fa-f]+)\>"
|
||||
# Special values.
|
||||
color cyan "\<(true|false|null|undefined)\>"
|
||||
|
||||
# Strings.
|
||||
color brightmagenta ""(\\.|[^"])*"" "'(\\.|[^'])*'" "`(\\.|[^`])*`"
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
|
||||
syntax lua "\.lua$"
|
||||
magic "Lua script"
|
||||
linter "luacheck --no-color"
|
||||
comment "--"
|
||||
|
||||
linter luacheck --no-color
|
||||
|
||||
color brightwhite "\[\[.*\]\]"
|
||||
|
||||
# Operators
|
||||
@@ -44,7 +45,7 @@ color brightmagenta "\<(false|nil|true)\>"
|
||||
|
||||
# Decimal and hexadecimal numbers
|
||||
color red "\<[0-9]+(\.[0-9]*)?([Ee][+-]?[0-9]+)?\>"
|
||||
icolor red "\<0x[0-9a-f]+(\.[0-9a-f]*)?(p[+-]?[0-9]+)?\>"
|
||||
color red "\<0x[0-9A-Fa-f]+(\.[0-9A-Fa-f]*)?([Pp][+-]?[0-9]+)?\>"
|
||||
|
||||
# Brackets
|
||||
color brightmagenta "\(|\)|\[|\]|\{|\}"
|
||||
|
||||
@@ -4,6 +4,6 @@ syntax mgp "\.mgp$"
|
||||
header "^%include.*"
|
||||
comment "#"
|
||||
|
||||
icolor green "^%[a-z].*"
|
||||
color green "^%[A-Za-z].*"
|
||||
color cyan "(^|[[:space:]])(#|%%).*"
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
syntax nanohelp
|
||||
|
||||
# Key combos:
|
||||
color cyan "\^[]4-8A-Z^\_◀▶▲▼]" "[◀▶▲▼]" "\<M-." "\<F1?[0-9]"
|
||||
color cyan "\^[]/4-8@A-Z\^_`◀▶▲▼]" "[◀▶▲▼]" "\<(M|S[Hh]-[Mm])-." "\<F([1-9]|1[0-9]|2[0-4])"
|
||||
color cyan "\<((Sh-)?Tab|Enter|Ins|(Sh-\^?)?Del|Space|Bsp|Up|Down|Left|Right|Home|End|PgUp|PgDn)\>"
|
||||
|
||||
# Quoted indicators:
|
||||
|
||||
@@ -3,26 +3,26 @@
|
||||
syntax nanorc "\.?nanorc$"
|
||||
comment "#"
|
||||
|
||||
# Possible errors and parameters
|
||||
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|i?color|extendsyntax).*"
|
||||
# Everything that does not get recolored is invalid
|
||||
color brightred ".*"
|
||||
|
||||
# Keywords
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|finalnewline|historylog|jumpyscrolling|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabstospaces|tempfile|trimblanks|unix|view|wordbounds|zap)\>"
|
||||
icolor yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|stripe|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
|
||||
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|stripecolor|titlecolor|whitespace|wordchars)[[:space:]]+"
|
||||
icolor brightgreen "^[[:space:]]*set[[:space:]]+(fill[[:space:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:space:]]+[1-9][0-9]*)\>"
|
||||
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter)[[:space:]]+.*"
|
||||
icolor brightgreen "^[[:space:]]*(syntax|linter)[[:space:]]+[^[:blank:]]+"
|
||||
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|extendsyntax)\>"
|
||||
color brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|finalnewline|historylog|jumpyscrolling|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabstospaces|tempfile|trimblanks|unix|view|wordbounds|zap)\>"
|
||||
color yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|stripe|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
|
||||
color brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|stripecolor|titlecolor|whitespace|wordchars)[[:space:]]+"
|
||||
color brightgreen "^[[:space:]]*set[[:space:]]+(fill[[:space:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:space:]]+[1-9][0-9]*)\>"
|
||||
color brightgreen "^[[:space:]]*bind[[:space:]]+((\^([A-Za-z]|[]/@\^_`]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+([a-z]+|".*")[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([A-Za-z]|[]/@\^_`]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|formatter|linter|tabgives)[[:space:]]+.*"
|
||||
color brightgreen "^[[:space:]]*(syntax[[:space:]]+[^[:blank:]]+|(formatter|linter)[[:space:]]+.+)"
|
||||
color green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|formatter|linter|tabgives|extendsyntax)\>"
|
||||
|
||||
# Strings
|
||||
color brightmagenta "([[:space:]]|(start|end)=)".+"([[:space:]]|$)"
|
||||
|
||||
# Colors
|
||||
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
|
||||
icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
|
||||
color yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
|
||||
color magenta "^[[:space:]]*i?color\>" "\<(start|end)="
|
||||
|
||||
# Comments
|
||||
color brightblue "(^|[[:space:]]+)#.*"
|
||||
|
||||
@@ -7,9 +7,18 @@ comment "#"
|
||||
|
||||
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
|
||||
icolor cyan start="[$@%]" end="( |[^0-9A-Z_]|-)"
|
||||
|
||||
# Variable names.
|
||||
color cyan "[$%&@]([A-Za-z_][0-9A-Za-z_]*|\^[][A-Z?\^_]|[0-9]+)\>"
|
||||
color cyan "[$%&@]\{(\^?[A-Za-z_][0-9A-Za-z_]*|\^[][?\^][0-9]+)\}"
|
||||
color cyan "[$%&@]([][!"#'()*+,.:;<=>?`|~-]|\{[][!-/:-@\`|~]\})|\$[$%&@]"
|
||||
color cyan "(^|[[:space:]])[$%@][/\]"
|
||||
|
||||
color yellow "".*"|qq\|.*\|"
|
||||
color white "[sm]/.*/"
|
||||
color white start="(^use| = new)" end=";"
|
||||
color green "#.*"
|
||||
|
||||
# Comments.
|
||||
color green "(^|[[:space:]])#.*"
|
||||
|
||||
color yellow start="<< 'STOP'" end="STOP"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for PHP.
|
||||
|
||||
syntax php "\.ph(p[23457s~]?|tml)$"
|
||||
syntax php "\.(php[23457s~]?|phtml|ctp)$"
|
||||
magic "PHP script"
|
||||
comment "//"
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ color brightmagenta "\<(Project\-Id\-Version|Report\-Msgid\-Bugs\-To|Last\-Trans
|
||||
color cyan "\<(POT\-Creation\-Date|PO\-Revision\-Date|MIME\-Version|Content\-Type|Content\-Transfer\-Encoding)\>"
|
||||
# Encodings and numbers.
|
||||
color yellow "\<(UTF|ISO|Windows|Mac|IBM)-[0-9]+"
|
||||
color yellow "[0-9]|pre[0-9]|[0-9]bit"
|
||||
color yellow "\<((pre|rc)?[0-9]+|[0-9]bit)\>"
|
||||
# Msgids.
|
||||
color brightblue "^(msgid|msgid_plural|msgstr)\>"
|
||||
# Tags.
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
syntax python "\.py$"
|
||||
header "^#!.*python"
|
||||
magic "Python script"
|
||||
linter pyflakes
|
||||
comment "#"
|
||||
|
||||
linter pyflakes
|
||||
|
||||
# Function definitions.
|
||||
icolor brightblue "def [0-9A-Z_]+"
|
||||
color brightblue "def [0-9A-Za-z_]+"
|
||||
# Keywords.
|
||||
color brightcyan "\<(and|as|assert|async|await|break|class|continue)\>"
|
||||
color brightcyan "\<(def|del|elif|else|except|finally|for|from)\>"
|
||||
|
||||
@@ -6,13 +6,13 @@ magic "Ruby script"
|
||||
linter ruby -w -c
|
||||
comment "#"
|
||||
|
||||
# Constants.
|
||||
color brightblue "\<[A-Z]+[0-9A-Z_a-z]*|(\$|@|@@)[0-9A-Z_a-z]+"
|
||||
# Reserved words.
|
||||
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module)\>"
|
||||
color yellow "\<(next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
|
||||
# Constants.
|
||||
color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
|
||||
# Ruby "symbols".
|
||||
icolor magenta "([ ]|^):[0-9A-Z_]+\>"
|
||||
color magenta "([ ]|^):[0-9A-Za-z_]+\>"
|
||||
# Some unique things we want to stand out.
|
||||
color brightyellow "\<(__FILE__|__LINE__)\>"
|
||||
# Regular expressions.
|
||||
|
||||
@@ -11,7 +11,7 @@ comment "//"
|
||||
color magenta "fn [a-z_0-9]+"
|
||||
|
||||
# Reserved words
|
||||
color yellow "\<(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\>"
|
||||
color yellow "\<(abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|true|try|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\>"
|
||||
|
||||
# Macros
|
||||
color red "[a-z_]+!"
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
## Here is an example for Bourne shell scripts.
|
||||
|
||||
syntax sh "(\.sh|\.(a|ba|c|da|k|mk|pdk|tc|z)(sh|shrc|sh_profile)|/(etc/|\.)profile)$"
|
||||
syntax sh "(\.sh|(\.|/)(a|ba|c|da|k|mk|pdk|tc|z)sh(rc|_profile)?|/(etc/|\.)profile)$"
|
||||
header "^#!.*/(((a|ba|c|da|k|mk|pdk|tc|z)?sh)|(busybox|env) +sh|openrc-run|runscript)"
|
||||
magic "(POSIX|Bourne-Again) shell script.*text"
|
||||
linter dash -n
|
||||
comment "#"
|
||||
|
||||
linter dash -n
|
||||
|
||||
# Function declarations.
|
||||
color brightgreen "^[A-Za-z0-9_-]+\(\)"
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
syntax tex "\.tex$"
|
||||
magic "(La)?TeX document"
|
||||
linter chktex -v0 -q -I
|
||||
comment "%"
|
||||
|
||||
icolor green "\\.|\\[A-Z]*"
|
||||
linter chktex -v0 -q -I
|
||||
|
||||
color green "\\.|\\[A-Za-z]*"
|
||||
color magenta "[{}]"
|
||||
color blue "(^|[^\])%.*"
|
||||
|
||||
Reference in New Issue
Block a user