Compare commits
393 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa695744fd | ||
|
|
c4a6725ad6 | ||
|
|
bb31118fcb | ||
|
|
26151189ba | ||
|
|
40e1fd37d7 | ||
|
|
f2da466388 | ||
|
|
ba8f806705 | ||
|
|
c12d1b87d4 | ||
|
|
ccc9b24f16 | ||
|
|
4bc8ff1e6d | ||
|
|
8651fefc68 | ||
|
|
ee5cdcbce5 | ||
|
|
a41968eeef | ||
|
|
e76bbc8832 | ||
|
|
6fa1e98c8d | ||
|
|
1fbcf0b23d | ||
|
|
1ea76eb51b | ||
|
|
5634d7d717 | ||
|
|
ad1f1bce7f | ||
|
|
c9e91df4e4 | ||
|
|
07e806e7f2 | ||
|
|
eee07d5755 | ||
|
|
3d6378b153 | ||
|
|
ae22fe03eb | ||
|
|
4ea55c3bf7 | ||
|
|
6a88d8a737 | ||
|
|
42ac5368e1 | ||
|
|
66e21416af | ||
|
|
6b1566023a | ||
|
|
0129299dc9 | ||
|
|
98f2f852dd | ||
|
|
ee33503402 | ||
|
|
e19a16f0e6 | ||
|
|
9e22e8b1b5 | ||
|
|
6135e28878 | ||
|
|
f9a6eb8bec | ||
|
|
b1d6d7f95c | ||
|
|
be01647a18 | ||
|
|
4a59b12ed4 | ||
|
|
793d8490de | ||
|
|
cf0c9403e1 | ||
|
|
530c7862c9 | ||
|
|
b255b01b50 | ||
|
|
1b69dd629a | ||
|
|
438cb110ff | ||
|
|
e0d0ca4b97 | ||
|
|
fbe4376822 | ||
|
|
9c821dfe2e | ||
|
|
9dc47fdfe5 | ||
|
|
f08d79d204 | ||
|
|
72caa54020 | ||
|
|
81f3177a33 | ||
|
|
6007d6227b | ||
|
|
d6bd276c8c | ||
|
|
c706b79b63 | ||
|
|
1f027a838e | ||
|
|
c9e8370cec | ||
|
|
f9274a5a29 | ||
|
|
ec26fd5e7c | ||
|
|
bde996db67 | ||
|
|
7be493047c | ||
|
|
54c2f6b5ae | ||
|
|
f1d9fcc77b | ||
|
|
619f28077c | ||
|
|
02a3a25aa0 | ||
|
|
c43c048783 | ||
|
|
4a23a171b8 | ||
|
|
a1c03ed5c1 | ||
|
|
b66e4bfa5b | ||
|
|
a3c9dfa391 | ||
|
|
53fbcf77f2 | ||
|
|
4ede3b494f | ||
|
|
452066bc88 | ||
|
|
d0e8887e3b | ||
|
|
bf84e5972d | ||
|
|
5cbb5115c6 | ||
|
|
2418b9486b | ||
|
|
df80bfd2fc | ||
|
|
4a1835fd93 | ||
|
|
c67ab656dc | ||
|
|
3c40b35055 | ||
|
|
499c2af385 | ||
|
|
bf64514283 | ||
|
|
b0a2f9853b | ||
|
|
0d9397e5b0 | ||
|
|
d0b72552bf | ||
|
|
26eed9d406 | ||
|
|
3059e16c25 | ||
|
|
08e5eea5b6 | ||
|
|
17b46f04da | ||
|
|
b4103321e6 | ||
|
|
6620de0091 | ||
|
|
954d04bc59 | ||
|
|
9205c28865 | ||
|
|
459d9f8ba8 | ||
|
|
213294e69c | ||
|
|
86bbe50a3b | ||
|
|
8925eabd5e | ||
|
|
149b1fe439 | ||
|
|
a5b29539b1 | ||
|
|
9e438cdce1 | ||
|
|
7a1959fb11 | ||
|
|
427eff6780 | ||
|
|
5440796f31 | ||
|
|
a9aa0ef997 | ||
|
|
f811846dc5 | ||
|
|
8a058d1f9a | ||
|
|
677e9474f7 | ||
|
|
58a0ddebac | ||
|
|
07fdf46154 | ||
|
|
c9337dd4ed | ||
|
|
f5234e583f | ||
|
|
ea2b51a41d | ||
|
|
eac0446c86 | ||
|
|
90798fbfba | ||
|
|
2a5bd555e7 | ||
|
|
7e1bc82d98 | ||
|
|
30daf4d43f | ||
|
|
24d6b7fcf7 | ||
|
|
052ad10d11 | ||
|
|
70cbbda87c | ||
|
|
95e1f55574 | ||
|
|
455fb4f063 | ||
|
|
3d2784e113 | ||
|
|
8a06dfa4d7 | ||
|
|
ace151778b | ||
|
|
45f873a6a7 | ||
|
|
e919c22793 | ||
|
|
b3e4051ded | ||
|
|
20ba559b9f | ||
|
|
b7f7df93df | ||
|
|
6847616aee | ||
|
|
104ea6b0c3 | ||
|
|
2ee18d635f | ||
|
|
efbf7b6ef3 | ||
|
|
5885e34b23 | ||
|
|
e4294a211e | ||
|
|
0b15c42a5c | ||
|
|
bff6a905af | ||
|
|
c7f5691637 | ||
|
|
17ab9a2dba | ||
|
|
f7e8861770 | ||
|
|
4990f74f83 | ||
|
|
8ffc33cd89 | ||
|
|
ee7b095678 | ||
|
|
25c775af21 | ||
|
|
b967368d41 | ||
|
|
f47813eefa | ||
|
|
474b390816 | ||
|
|
b58676f3c9 | ||
|
|
d52f108526 | ||
|
|
9dc544acbd | ||
|
|
59fdd4db7a | ||
|
|
f1bd958851 | ||
|
|
74e7521478 | ||
|
|
3f1878d9a9 | ||
|
|
6039cd7f6e | ||
|
|
1dc298d28b | ||
|
|
98ffb642f3 | ||
|
|
8cde95e170 | ||
|
|
aa0fd889af | ||
|
|
1f866c29db | ||
|
|
cadb4f3689 | ||
|
|
79526151d5 | ||
|
|
5e53c6ee9e | ||
|
|
42f307ef75 | ||
|
|
674ab835e8 | ||
|
|
badbc676fb | ||
|
|
aee86996de | ||
|
|
3d01486409 | ||
|
|
5bb096d32f | ||
|
|
aff252aed6 | ||
|
|
08d9f572a4 | ||
|
|
ea4b775a3e | ||
|
|
93e391eba3 | ||
|
|
9fcde23009 | ||
|
|
6095ff3d39 | ||
|
|
fc7825d00d | ||
|
|
8f5fa24e51 | ||
|
|
619666460e | ||
|
|
5ac6a87522 | ||
|
|
05fb283034 | ||
|
|
6edb7a43f2 | ||
|
|
5190ab9c9b | ||
|
|
b60f555843 | ||
|
|
953ccc990f | ||
|
|
296ff1ed2a | ||
|
|
6062a040e1 | ||
|
|
954f98c448 | ||
|
|
076fcbf631 | ||
|
|
38e8ed14ca | ||
|
|
ecffb85656 | ||
|
|
f0bb50306c | ||
|
|
412b9fc0a2 | ||
|
|
75ac24b25e | ||
|
|
4499520c03 | ||
|
|
7f0003a54b | ||
|
|
57f52a8a20 | ||
|
|
e219bb9dba | ||
|
|
4310139117 | ||
|
|
11fa458677 | ||
|
|
e06472a249 | ||
|
|
a267699440 | ||
|
|
025553769e | ||
|
|
7c2f53b2a9 | ||
|
|
3021a04c1c | ||
|
|
86cbd959f6 | ||
|
|
ef2593695d | ||
|
|
6404101407 | ||
|
|
67667af233 | ||
|
|
82373d85f9 | ||
|
|
c32a58a826 | ||
|
|
26ae9dbd12 | ||
|
|
d49c267f91 | ||
|
|
2e121fa08c | ||
|
|
e00b3e8587 | ||
|
|
87e963a2c7 | ||
|
|
74ac8ce407 | ||
|
|
f87de12b96 | ||
|
|
1a3fa549a9 | ||
|
|
0424243e3c | ||
|
|
a1c4da8b04 | ||
|
|
7b2ea40575 | ||
|
|
1f3148db4b | ||
|
|
24f39d3ad1 | ||
|
|
40bfc729ca | ||
|
|
01e39f4ff9 | ||
|
|
d297784b87 | ||
|
|
72b437bbd2 | ||
|
|
3e8dadfb1b | ||
|
|
2661d6d397 | ||
|
|
59187b8051 | ||
|
|
75d64e677e | ||
|
|
c5710d0ef8 | ||
|
|
de6da120a0 | ||
|
|
f111c0d6ab | ||
|
|
55d1e1a9b8 | ||
|
|
2da9cbf1a1 | ||
|
|
a338798559 | ||
|
|
46464105f2 | ||
|
|
7f3bd26593 | ||
|
|
9233c98a7e | ||
|
|
ec8d51bee3 | ||
|
|
3739016e45 | ||
|
|
df7524d7e8 | ||
|
|
b454d9c89b | ||
|
|
af708843f6 | ||
|
|
ca1983adb4 | ||
|
|
1cf22d4d4f | ||
|
|
583a30e971 | ||
|
|
6bdcc8faa9 | ||
|
|
e68759bf12 | ||
|
|
ec0e0235fa | ||
|
|
7edd350593 | ||
|
|
455a918071 | ||
|
|
296152ec67 | ||
|
|
6ff772b8d9 | ||
|
|
3de2c704ef | ||
|
|
cc65a42035 | ||
|
|
5b83d7df51 | ||
|
|
45772652ff | ||
|
|
f225991b05 | ||
|
|
4d2b198403 | ||
|
|
5ea46cacb6 | ||
|
|
fd759d5ca3 | ||
|
|
f34c8fdc6b | ||
|
|
1cf9deb603 | ||
|
|
4e5ea18394 | ||
|
|
4e9b3687ba | ||
|
|
99d2358510 | ||
|
|
08a52c1dab | ||
|
|
ce48ca2223 | ||
|
|
2dc9cbefd3 | ||
|
|
0f7b99b433 | ||
|
|
057348e1da | ||
|
|
ab21161a69 | ||
|
|
d8b6dbfffe | ||
|
|
d5177059e8 | ||
|
|
a9647b0508 | ||
|
|
37fd348a1d | ||
|
|
2aac470cb9 | ||
|
|
25ce5f6759 | ||
|
|
5d0b267aaa | ||
|
|
c2ed8277c2 | ||
|
|
d7ade1f346 | ||
|
|
de53c53c6e | ||
|
|
5ac108188d | ||
|
|
e683e32c74 | ||
|
|
7fe830fd20 | ||
|
|
07e199ff0e | ||
|
|
6f2da6b9b2 | ||
|
|
14a9c8aa0b | ||
|
|
52d7d5f55a | ||
|
|
0b6d6f45d2 | ||
|
|
0a79c78e05 | ||
|
|
ad827a6aef | ||
|
|
41580848e3 | ||
|
|
b455fa3a16 | ||
|
|
ff4a457d82 | ||
|
|
eae9f282de | ||
|
|
e39cf37026 | ||
|
|
6440aa9e47 | ||
|
|
745fab8293 | ||
|
|
a37ebcf2f8 | ||
|
|
92142bed34 | ||
|
|
83ec9e7d50 | ||
|
|
a0a0556993 | ||
|
|
33ac317132 | ||
|
|
9007c58bdd | ||
|
|
2456dd2a85 | ||
|
|
a44cf41d37 | ||
|
|
76e7aaf514 | ||
|
|
cb776fad88 | ||
|
|
a4f28694c8 | ||
|
|
82d737ee6d | ||
|
|
138add24c8 | ||
|
|
532d55c8bd | ||
|
|
3345e3407d | ||
|
|
52d1c20973 | ||
|
|
6898c60ba6 | ||
|
|
69d26c35fb | ||
|
|
4d9b5e92b3 | ||
|
|
18a2edfb84 | ||
|
|
4e95ee9f6e | ||
|
|
79ff393dc2 | ||
|
|
03bcaf6067 | ||
|
|
5891c4a542 | ||
|
|
3131d0c48a | ||
|
|
336b0ecbca | ||
|
|
32e76c4386 | ||
|
|
7d77521794 | ||
|
|
7f61fa1b55 | ||
|
|
98485c96d8 | ||
|
|
184cf609c0 | ||
|
|
e73e02fe10 | ||
|
|
ed2f0b349f | ||
|
|
d4e1d31ea4 | ||
|
|
bb4edd0136 | ||
|
|
c9b3a71d02 | ||
|
|
1b65b19abd | ||
|
|
35cd49ec50 | ||
|
|
6c7764862b | ||
|
|
9c88cab78c | ||
|
|
651bb5009f | ||
|
|
86c6cd1725 | ||
|
|
bd98ff02f6 | ||
|
|
057ef182cd | ||
|
|
67cdd5ee1e | ||
|
|
92896a708d | ||
|
|
57fa775f25 | ||
|
|
8d53aa3ad2 | ||
|
|
5b1fb56a8f | ||
|
|
6948d2e779 | ||
|
|
69429ce274 | ||
|
|
170679294b | ||
|
|
4b3f2771b5 | ||
|
|
a44def03a0 | ||
|
|
9f1b1e2b14 | ||
|
|
e99f0b609b | ||
|
|
5bb10d25ef | ||
|
|
edabd27cd8 | ||
|
|
97a5d1270a | ||
|
|
f729c6dae5 | ||
|
|
a3cc4e6ecd | ||
|
|
2a9536c4e8 | ||
|
|
1f960f7e34 | ||
|
|
3f4389b968 | ||
|
|
700c43bd42 | ||
|
|
2ec70b6466 | ||
|
|
cf9f32b009 | ||
|
|
fcd4468f90 | ||
|
|
7239fda971 | ||
|
|
47dffa483f | ||
|
|
266e0496ab | ||
|
|
dbb5e7cd8e | ||
|
|
80750632d0 | ||
|
|
d23283e249 | ||
|
|
7ffc7b0438 | ||
|
|
1a8c90eec7 | ||
|
|
ea40ebb648 | ||
|
|
1c8cdfd174 | ||
|
|
0dfd5f7f67 | ||
|
|
35cb2c8659 | ||
|
|
3d5de0df51 | ||
|
|
a3710f695f | ||
|
|
18be89773c | ||
|
|
a9fdfd0799 | ||
|
|
2394e52ebc | ||
|
|
ee7bbf4650 | ||
|
|
8914bd5b1a | ||
|
|
5dde918e24 | ||
|
|
300e27745b | ||
|
|
cfc396c32e |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -14,6 +14,7 @@ core
|
||||
/INSTALL
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
/compile
|
||||
/config.cache
|
||||
/config.guess
|
||||
/config.h
|
||||
|
||||
15
AUTHORS
15
AUTHORS
@@ -9,8 +9,8 @@ Chris Allegretta <chrisa@asty.org>
|
||||
David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* Former stable series maintainer. Multiple buffer support,
|
||||
operating dir (-o) option, bug fixes for display routines,
|
||||
wrapping code, spelling fixes, const mode, parts of the UTF-8
|
||||
support, and various other fixes.
|
||||
wrapping code, spelling fixes, const mode, parts of the
|
||||
UTF-8 support, and various other fixes.
|
||||
|
||||
Jordi Mallach <jordi@gnu.org>
|
||||
* Debian package maintainer, fellow bug squasher.
|
||||
@@ -23,8 +23,8 @@ Adam Rogoyski <rogoyski@cs.utexas.edu>
|
||||
|
||||
Robert Siemborski <rjs3@andrew.cmu.edu>
|
||||
* Miscellaneous cut, display, replace, and other bug fixes,
|
||||
original and new "magic line" code, read_line() function, new
|
||||
edit display routines.
|
||||
original and new "magic line" code, read_line() function,
|
||||
new edit display routines.
|
||||
|
||||
Rocco Corsi <rocco.corsi@sympatico.ca>
|
||||
* Internal spelling code, many optimizations and bug fixes for
|
||||
@@ -41,3 +41,10 @@ Mike Frysinger <vapier@gentoo.org>
|
||||
--enable-utf8/--disable-utf8 configure options for ncurses,
|
||||
many new color regexes and improvements to existing color
|
||||
regexes for nanorc.sample, and miscellaneous bug fixes.
|
||||
|
||||
Mark Majeres <mark@engine12.com>
|
||||
* A functional undo/redo system, and coloring nano's interface.
|
||||
|
||||
Benno Schulenberg <bensberg@justemail.net>
|
||||
* A bunch of small bug fixes, the cutword routines, some extra
|
||||
key bindings. Current maintainer.
|
||||
|
||||
104
NEWS
104
NEWS
@@ -1,3 +1,89 @@
|
||||
2015.12.05 - GNU nano 2.5.0 "Karma", the the first release of the 2.5
|
||||
series, is now available. Please note that as of this release,
|
||||
there will no longer be separate stable and unstable
|
||||
branches. The development team will prioritize bug fixes as
|
||||
needed, and make new releases in proportion to the
|
||||
severity of the bugs which are fixed.
|
||||
This release includes many of the fixes now in
|
||||
2.4.3, as well as color synax highlighting improvements,
|
||||
undo fixes, and many more improvements! Thank you for
|
||||
using nano!
|
||||
|
||||
2015.11.18 - GNU nano 2.4.3 "Apocalypse" is now available for your
|
||||
downloading pleasure. This release includes a myriad
|
||||
of fixes including several memory leaks, issues with
|
||||
color syntax highlighting, search/replace, file
|
||||
insertion and help menu bugs. Many thanks to
|
||||
Benno Schulenberg for tireless efforts on the vast
|
||||
majority of fixes for some time now. As always please
|
||||
report bugs via the Savannah page, and remember to
|
||||
Share and Enjoy.
|
||||
|
||||
2015.07.05 - GNU nano 2.4.2 "Portorož" is released. This release
|
||||
includes several fixes, including the ability to resize
|
||||
when in modes other than the main editing window,
|
||||
proper displaying of invalid UTF-8 bytes, new syntax
|
||||
definitions for Elisp, Guile, and PostgreSQL, and
|
||||
better display of shortcuts in the help menu and file
|
||||
browser. Thanks for your patience and using nano!
|
||||
|
||||
2015.04.14 - GNU nano 2.4.1 "Glitch Gremlin" is released. This release
|
||||
includes several fixes for issues with the file browser
|
||||
menu, linter and formatter functions, spell checker,
|
||||
undo/redo with some specific marked-cutting situations,
|
||||
and some small improvements to the color syntax
|
||||
highlighting definitions. There are also various
|
||||
documentation and code comment updates included, and
|
||||
finally, fixes for compilation on non-GNU/Linux systems
|
||||
and certain configure combinations. Toasters!
|
||||
|
||||
2015.03.22 - GNU nano 2.4.0 "lizf" is released. This is the first
|
||||
stable release in many years, and brings together many
|
||||
new features from the 2.3 series, including:
|
||||
a fully functional undo system (now enabled by default),
|
||||
vim-compatible file locking, linter support, formatter
|
||||
support, syntax highlighting flexibility, and many fixes
|
||||
for issues reported since 2.2. Many sincere thanks
|
||||
to all of the bug reports, patches, well wishes and
|
||||
contributions from everyone who has continued to
|
||||
support us. Thank you for using nano!
|
||||
|
||||
|
||||
2015.02.27 - GNU nano 2.3.99pre3 "Ashley" is released. This is likely
|
||||
to be the last release before the next major (2.4.0)
|
||||
release. Please test it out and send us any feedback
|
||||
via the Savannah bug page for nano
|
||||
(https://savannah.gnu.org/bugs/?group=nano). This
|
||||
release includes fixes for rebinding toggles via
|
||||
nanorc, several memory alignment fixes, and documentation
|
||||
and build updates. As always thank you for using
|
||||
nano - Share and Enjoy!
|
||||
|
||||
2015.02.06 - GNU nano 2.3.99pre2 "Snowblind" is released. This release
|
||||
contains only fixes, including: a long-standing problem
|
||||
with cutting in nano-tiny, several memory alignment
|
||||
improvements, and issues with leftover file locks. Please
|
||||
keep reporting bugs so we can get a happy and healthy
|
||||
2.4.0 soon. Thanks for using nano!
|
||||
|
||||
2015.01.06 - GNU nano 2.3.99pre1 "Junior" is released. As the first
|
||||
2.4 release candidate there will be fewer new features
|
||||
but many bugfixes going forward. This release contains
|
||||
new support for language reformatters like Go's gofmt
|
||||
command which takes the place of the spelling checker.
|
||||
Fixes in this release include many syntax highlighting
|
||||
fixes and improvements, and documentation formatting updates.
|
||||
As always please report bugs via the Savannah bug page for
|
||||
nano (https://savannah.gnu.org/bugs/?group=nano), so we can
|
||||
release a super awesome and bug-free 2.4.0 soon!
|
||||
|
||||
2014.07.17 - GNU nano 2.3.6 "Columbo" is released. This release
|
||||
contains a fix for installing internationalization
|
||||
files. Also included are scattered documentation
|
||||
(in particular man page) fixes, and a few touch ups
|
||||
to syntax highlighting definitions. Oh, just one
|
||||
more thing, thanks for using nano!
|
||||
|
||||
2014.07.11 - GNU nano 2.3.5 "lucky day" is released. This release
|
||||
contains many visible and under-the-hood fixes for
|
||||
components such as file locking, more fixes to the
|
||||
@@ -11,23 +97,23 @@
|
||||
https://savannah.gnu.org/bugs/index.php?42639 and
|
||||
thanks for using nano.
|
||||
|
||||
2014.06.02 - GNU nano 2.3.4 won't leave you high, won't leave you dry. This
|
||||
2014.06.02 - GNU nano 2.3.4 won't leave you high, won't leave you dry. This
|
||||
release contains only a small number of fixes, but in
|
||||
particular allows nano to compile on non-UTF8 curses
|
||||
implementations (i.e. libncursesw). Other small fixes to
|
||||
the undo implementation and the default syntax config are
|
||||
also included. As always, Share and Enjoy!
|
||||
also included. As always, Share and Enjoy!
|
||||
|
||||
2014.05.28 - GNU nano 2.3.3 is in its right place. This release contains
|
||||
many many improvements to the core system, including
|
||||
substantial improvements to the undo/redo code, UTF-8
|
||||
handling, the configure script, and display of shortcuts
|
||||
on very wide terminals, New features include the
|
||||
ability to read named pipes (--noread), as well as
|
||||
ability to write to named pipes (--noread), as well as
|
||||
linter support (see the nanorc man page for details). Also
|
||||
included are much improved syntax highlighting code, and
|
||||
configurations for JSON, texinfo, Go, and a default syntax
|
||||
for catch all highlighting. Finally, nano now has the
|
||||
for catch all highlighting. Finally, nano now has the
|
||||
ability to set the color of the title bar, status bar, and
|
||||
shortcut keys (e.g. "^X") and their descriptions. Again
|
||||
see the nanorc page for details. There's much more, too
|
||||
@@ -62,7 +148,7 @@
|
||||
in your .nanorc. Also included are some fixes for
|
||||
compilation with g++, and better handling of issues
|
||||
writing the backup file, which should reduce the need
|
||||
for the 'set allow_insecure_backup" nanorc option.
|
||||
for the "set allow_insecure_backup" nanorc option.
|
||||
Don't stop, get it get it, don't stop, get it get it.
|
||||
|
||||
2010.11.22 - GNU nano 2.2.6 "Pimp my BBS" wants you to go to
|
||||
@@ -108,7 +194,7 @@
|
||||
This release contains a fix for only one bug, but a
|
||||
rather irritating one: when paging up/down with smooth
|
||||
scrolling, the cursor position was not being preserved
|
||||
due to a bug in 2.2.2. With such a targeted fix
|
||||
due to a bug in 2.2.2. With such a targeted fix
|
||||
like this what could POSSIBLY go WRONG? Hahaha.
|
||||
Enjoy and if you find new bugs, as always please
|
||||
use Savannah's bug tracker.
|
||||
@@ -149,7 +235,7 @@
|
||||
the help keys and replace menu text), more 'final'
|
||||
fixes for soft wrapping, and several typo and documentation
|
||||
updates including nanorc tweaks and a new syntax
|
||||
highlighting file for makefiles. Also included is a long
|
||||
highlighting file for makefiles. Also included is a long
|
||||
standing fix for random crashing when using nanorc on
|
||||
FreeBSD, and nano will no longer clear the screen on
|
||||
suspend to maintain compatibility with other *nix editors.
|
||||
@@ -188,7 +274,7 @@
|
||||
2009.09.14 - GNU nano 2.1.11 is on very thin ice, very thin ice, very thin
|
||||
ice. This release includes two new features: first, nano
|
||||
will check whether the current file is writable when it
|
||||
is opened, and warn if it is not on the status bar. Secondly,
|
||||
is opened, and warn if it is not on the status bar. Secondly,
|
||||
a new soft-wrapping (AKA full line display) option is
|
||||
available, which will attempt to fully display the contents
|
||||
of lines longer than the width of the screen without the
|
||||
@@ -319,7 +405,7 @@
|
||||
2008.03.18 - GNU nano 2.1.0 "under old mismanagement" is released.
|
||||
This first release in the 2.1 development series
|
||||
introduces rebinadble keys for most actions inside
|
||||
the editor. Please see the nanorc(5) page for
|
||||
the editor. Please see the nanorc(5) page for
|
||||
more information on configuring key bindings. Please
|
||||
also report all keybinding bugs (crashes, missing
|
||||
menu functions) using the Savannah bug tracker URL,
|
||||
|
||||
63
README
63
README
@@ -6,24 +6,24 @@ Overview
|
||||
The nano project was started because of a few "problems" with the
|
||||
wonderfully easy-to-use and friendly Pico text editor.
|
||||
|
||||
First and foremost is its license: the Pine suite does not use the
|
||||
GPL or a GPL-friendly license, and has unclear restrictions on
|
||||
First and foremost was its license: the Pine suite does not use
|
||||
the GPL or a GPL-friendly license, and has unclear restrictions on
|
||||
redistribution. Because of this, Pine and Pico are not included
|
||||
with many GNU/Linux distributions. Also, other features (like go
|
||||
to line number or search and replace) were unavailable until
|
||||
recently or require a command line flag. Yuck.
|
||||
with many GNU/Linux distributions. Also, other features (like
|
||||
go-to-line-number or search-and-replace) were unavailable until
|
||||
recently or require a command-line flag. Yuck.
|
||||
|
||||
nano aims to solve these problems by emulating the functionality of
|
||||
Pico as closely as possible while addressing the problems above and
|
||||
perhaps providing other extra functionality.
|
||||
providing other extra functionality.
|
||||
|
||||
The nano editor is now an official GNU package. For more
|
||||
information on GNU and the Free Software Foundation, please see
|
||||
http://www.gnu.org/.
|
||||
The nano editor is an official GNU package. For more information on
|
||||
GNU and the Free Software Foundation, please see http://www.gnu.org/.
|
||||
|
||||
How to compile and install nano
|
||||
|
||||
Download the nano source code, then:
|
||||
|
||||
tar zxvf nano-x.y.z.tar.gz
|
||||
cd nano-x.y.z
|
||||
./configure
|
||||
@@ -32,41 +32,42 @@ How to compile and install nano
|
||||
|
||||
It's that simple. Use --prefix with configure to override the
|
||||
default installation directory of /usr/local.
|
||||
|
||||
If you configured with the "--enable-nanorc" option, after
|
||||
installation you might copy the doc/nanorc.sample to your home
|
||||
directory, rename it to ".nanorc", and then edit it according to
|
||||
your taste.
|
||||
|
||||
If you haven't configured with the "--disable-nanorc" option, after
|
||||
installation you may want to copy the doc/nanorc.sample to your
|
||||
home directory, rename it to ".nanorc", and then edit it according
|
||||
to your taste.
|
||||
|
||||
Web Page
|
||||
|
||||
http://www.nano-editor.org/
|
||||
|
||||
Mailing List and Bug Reports
|
||||
Mailing Lists and Bug Reports
|
||||
|
||||
Savannah hosts all the nano-related mailing-lists.
|
||||
|
||||
+ info-nano@gnu.org is a very low traffic list
|
||||
used to announce new nano versions or other important
|
||||
information about the project.
|
||||
+ info-nano@gnu.org is a very low traffic list used to announce
|
||||
new nano versions or other important information about the
|
||||
project.
|
||||
+ help-nano@gnu.org is for those seeking to get help without
|
||||
wanting to hear about the technical details of its
|
||||
development.
|
||||
+ nano-devel@gnu.org is the list used by the people
|
||||
that make nano and a general development discussion list, with
|
||||
moderate traffic.
|
||||
wanting to hear about the technical details of its development.
|
||||
+ nano-devel@gnu.org is the list used by the people that make
|
||||
nano and a general development discussion list, with moderate
|
||||
traffic.
|
||||
|
||||
To subscribe, send email to nano-<name>-request@gnu.org with a
|
||||
To subscribe, send email to <name>-request@gnu.org with a
|
||||
subject of "subscribe", where <name> is the list you want to
|
||||
subscribe to.
|
||||
|
||||
For general bug reports, send a description of the problem to
|
||||
nano@nano-editor.org or directly to the development list.
|
||||
For general bug reports, please file a description of the problem
|
||||
on the Savannah bug tracker page for nano
|
||||
(https://savannah.gnu.org/bugs/?group=nano). The issue may have
|
||||
already been reported, and we are better able to track the state
|
||||
of the issue and whom to notify when fixed, the more the bug
|
||||
tracker is used.
|
||||
|
||||
Current Status
|
||||
|
||||
GNU nano has reached its fourth stable milestone, 2.2.x.
|
||||
Development of new features continues in the 2.3.x branch, while
|
||||
2.2.x versions are dedicated to bug-fixing and polishing.
|
||||
|
||||
$Id$
|
||||
GNU nano has reached its fifth stable milestone, 2.4.x.
|
||||
Development of new features will continue in the 2.5.x branch,
|
||||
while 2.4.x versions are dedicated to bug-fixing and polishing.
|
||||
|
||||
141
THANKS
141
THANKS
@@ -2,81 +2,87 @@ The following people have helped GNU nano in some way or another.
|
||||
If we missed you here, let us know!
|
||||
|
||||
|
||||
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com>
|
||||
Malay translator
|
||||
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian translator
|
||||
CHAO Wei-Lun <chaoweilun@pcmail.com.tw> Chinese (traditional) translator
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish translator
|
||||
Marco Colombo <magicdice@inwind.it> Italian translator
|
||||
Yavor Doganov <yavor@doganov.org> Bulgarian translator
|
||||
Karl Eichwalder <keichwa@gmx.net> German translator
|
||||
Doruk Fisek <dfisek@fisek.com.tr> Turkish translator
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net>
|
||||
French translator
|
||||
Geir Helland <pjallabais@users.sourceforge.net> Norwegian Bokmål translator
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Indonesian translator
|
||||
Václav Haisman <V.Haisman@sh.cvut.cz> Czech translator
|
||||
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu>
|
||||
Hungarian translator
|
||||
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish translator
|
||||
Eivind Kjørstad <ekj@vestdata.no> Norwegian Nynorsk translator
|
||||
Florian König <floki@bigfoot.com> German translator
|
||||
Wojciech Kotwica <wkotwica@post.pl> Polish translator
|
||||
Clement Laforet <clem_laf@wanadoo.fr> French translator
|
||||
Gergely Nagy <algernon@debian.org> Hungarian translator
|
||||
Kalle Olavi Niemitalo <kon@iki.fi> Finnish translator
|
||||
A. Murat EREN <meren@comu.edu.tr> Turkish translator
|
||||
Claudio Neves <cneves@nextis.com> Brazilian Portuguese translator
|
||||
Daniel Nylander <po@danielnylander.se> Swedish translator
|
||||
Michael Piefel <piefel@informatik.hu-berlin.de> German translator
|
||||
Sergey A. Ribalchenko <fisher@obu.ck.ua> Ukrainian and Russian translator
|
||||
Michel Robitaille <robitail@IRO.UMontreal.CA> French translator
|
||||
Christian Rose <menthos@menthos.com> Swedish translator
|
||||
Stig E Sandø <stig@ii.uib.no> Norwegian Bokmål translator
|
||||
Benno Schulenberg <benno@vertaalt.nl> Dutch and Esperanto translator
|
||||
Danilo Segan <dsegan@gmx.net> Serbian translator
|
||||
Keld Simonsen <keld@dkuug.dk> Danish translator
|
||||
Guus Sliepen <guus@nl.linux.org> Dutch translator
|
||||
Cezary Sliwa <sliwa@cft.edu.pl> Polish translator
|
||||
Pierre Tane <tanep@bigfoot.com> French translator
|
||||
Jacobo Tarrío <jtarrio@trasno.net> Galician translator
|
||||
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian Nynorsk translator
|
||||
Miquel Vidal <miquel@sindominio.net> Catalan translator
|
||||
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese translator
|
||||
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish translator
|
||||
Peio Ziarsolo <peio@sindominio.net> Basque translator
|
||||
Anton Zinoviev <zinoviev@debian.org> Bulgarian translator
|
||||
João Victor Duarte Martins <jvdm@sdf.lonestar.org>
|
||||
Brazilian Portuguese translator
|
||||
Kevin Patrick Scannell <kscanne@gmail.com> Irish translator
|
||||
Gabor Kelemen <kelemeng@gnome.hu> Hungarian translator
|
||||
Francisco Javier Tsao Santín <tsao@members.fsf.org>
|
||||
Galician translator
|
||||
Dimitriy Ryazantcev <DJm00n@mail.ru> Russian translator
|
||||
Clytie Siddall <clytie@riverland.net.au> Vietnamese translator
|
||||
LI Daobing <lidaobing@gmail.com> Chinese (simplified) translator
|
||||
Jorma Karvonen <karvonen.jorma@gmail.com> Finnish translator
|
||||
Aron Xu <happyaron.xu@gmail.com> Chinese (simplified) translator
|
||||
Pavel Fric <pavelfric@seznam.cz> Czech translator
|
||||
Pavel Maryanov <acid@jack.kiev.ua> Russian translator
|
||||
Sergey Poznyakoff <gray@gnu.org> Polish translator
|
||||
Ask Hjorth Larsen <asklarsen@gmail.com> Danish translator
|
||||
Trần Ngọc Quân <vnwildman@gmail.com> Vietnamese translator
|
||||
Klemen Košir <klemen913@gmail.com> Slovenian translator
|
||||
Yasuaki Taniguchi <yasuakit@gmail.com> Japanese translator
|
||||
Jorge González <aloriel@gmail.com> Spanish translator
|
||||
Johnny A. Solbu <johnny@solbu.net> Norwegian Bokmål translator
|
||||
Мирослав Николић <miroslavnikolic@rocketmail.com>
|
||||
Serbian translator
|
||||
Translations:
|
||||
============
|
||||
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com> Malay
|
||||
Josef Andersson <josef.andersson@fripost.org> Swedish
|
||||
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian
|
||||
Mario Blättermann <mario.blaettermann@gmail.com> German
|
||||
Wei-Lun CHAO <chaoweilun@pcmail.com.tw> Chinese (traditional)
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish
|
||||
Yuri Chornoivan <yurchor@ukr.net> Ukrainian
|
||||
Mihai Cristescu <mihai.cristescu@archlinux.info> Romanian
|
||||
Marco Colombo <magicdice@inwind.it> Italian
|
||||
Yavor Doganov <yavor@doganov.org> Bulgarian
|
||||
Karl Eichwalder <keichwa@gmx.net> German
|
||||
A. Murat EREN <meren@comu.edu.tr> Turkish
|
||||
Rafael Ferreira <rafael.f.f1@gmail.com> Brazilian Portuguese
|
||||
Doruk Fisek <dfisek@fisek.com.tr> Turkish
|
||||
Pavel Fric <pavelfric@seznam.cz> Czech
|
||||
Jorge González <aloriel@gmail.com> Spanish
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net> French
|
||||
Geir Helland <pjallabais@users.sourceforge.net> Norwegian Bokmål
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Indonesian
|
||||
Václav Haisman <V.Haisman@sh.cvut.cz> Czech
|
||||
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian Nynorsk
|
||||
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu> Hungarian
|
||||
Jorma Karvonen <karvonen.jorma@gmail.com> Finnish
|
||||
Gabor Kelemen <kelemeng@gnome.hu> Hungarian
|
||||
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish
|
||||
Eivind Kjørstad <ekj@vestdata.no> Norwegian Nynorsk
|
||||
Florian König <floki@bigfoot.com> German
|
||||
Klemen Košir <klemen913@gmail.com> Slovenian
|
||||
Wojciech Kotwica <wkotwica@post.pl> Polish
|
||||
Ask Hjorth Larsen <asklarsen@gmail.com> Danish
|
||||
Clement Laforet <clem_laf@wanadoo.fr> French
|
||||
LI Daobing <lidaobing@gmail.com> Chinese (simplified)
|
||||
João Victor Duarte Martins <jvdm@sdf.lonestar.org> Brazilian Portuguese
|
||||
Pavel Maryanov <acid@jack.kiev.ua> Russian
|
||||
Daniele Medri <madrid@linux.it> Italian
|
||||
Gergely Nagy <algernon@debian.org> Hungarian
|
||||
Kalle Olavi Niemitalo <kon@iki.fi> Finnish
|
||||
Мирослав Николић <miroslavnikolic@rocketmail.com> Serbian
|
||||
Claudio Neves <cneves@nextis.com> Brazilian Portuguese
|
||||
Daniel Nylander <po@danielnylander.se> Swedish
|
||||
Mikel Olasagasti <hey_neken@mundurat.net> Basque
|
||||
Michael Piefel <piefel@informatik.hu-berlin.de> German
|
||||
Sergey Poznyakoff <gray@gnu.org> Polish
|
||||
Trần Ngọc Quân <vnwildman@gmail.com> Vietnamese
|
||||
Sergey A. Ribalchenko <fisher@obu.ck.ua> Ukrainian and Russian
|
||||
Michel Robitaille <robitail@IRO.UMontreal.CA> French
|
||||
Christian Rose <menthos@menthos.com> Swedish
|
||||
Dimitriy Ryazantcev <DJm00n@mail.ru> Russian
|
||||
Stig E Sandø <stig@ii.uib.no> Norwegian Bokmål
|
||||
Kevin Patrick Scannell <kscanne@gmail.com> Irish
|
||||
Benno Schulenberg <benno@vertaalt.nl> Dutch and Esperanto
|
||||
Danilo Segan <dsegan@gmx.net> Serbian
|
||||
Clytie Siddall <clytie@riverland.net.au> Vietnamese
|
||||
Keld Simonsen <keld@dkuug.dk> Danish
|
||||
Guus Sliepen <guus@nl.linux.org> Dutch
|
||||
Cezary Sliwa <sliwa@cft.edu.pl> Polish
|
||||
Johnny A. Solbu <johnny@solbu.net> Norwegian Bokmål
|
||||
Pierre Tane <tanep@bigfoot.com> French
|
||||
Yasuaki Taniguchi <yasuakit@gmail.com> Japanese
|
||||
Jacobo Tarrío <jtarrio@trasno.net> Galician
|
||||
Francisco Javier Tsao Santín <tsao@members.fsf.org> Galician
|
||||
Miquel Vidal <miquel@sindominio.net> Catalan
|
||||
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese
|
||||
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish
|
||||
Aron Xu <happyaron.xu@gmail.com> Chinese (simplified)
|
||||
Peio Ziarsolo <peio@sindominio.net> Basque
|
||||
Anton Zinoviev <zinoviev@debian.org> Bulgarian
|
||||
|
||||
|
||||
Other stuff:
|
||||
===========
|
||||
Ben Armstrong <synrg@sanctuary.nslug.ns.ca> Negative -r value idea, code
|
||||
Thomas Dickey <dickey@herndon4.his.com> Curses help and advice
|
||||
Sven Guckes <guckes@math.fu-berlin.de> Advice and Advocacy
|
||||
Sven Guckes <guckes@math.fu-berlin.de> Advice and advocacy
|
||||
Thijs Kinkhorst <thijs@kinkhorst.com> rnano.1 manpage
|
||||
Jim Knoble <jmknoble@pobox.com> Pico compat for browser
|
||||
Ryan Krebs <fluffy@highwire.stanford.edu> Many bug fixes and testing
|
||||
Roy Lanek <lanek@ranahminang.net> Advice and advocacy
|
||||
Mark Majeres <mark@engine12.com> Working undo/redo code
|
||||
Chuck Mead <csm@MoonGroup.com> Feedback and RPM stuff
|
||||
Mike Melanson <melanson@pcisys.net> Bugs
|
||||
Neil Parks <nparks@acsmail.com> Bug reports and fixes
|
||||
@@ -84,4 +90,5 @@ Jeremy Robichaud <robicj@yahoo.com> Beta tester
|
||||
Bill Soudan <wes0472@rit.edu> Regex code, etc
|
||||
Ken Tyler <kent@werple.net.au> Search fixes and more
|
||||
|
||||
|
||||
$Id$
|
||||
|
||||
20
TODO
20
TODO
@@ -17,30 +17,32 @@ For the future (no targeted version, catch-all)
|
||||
- Allow color syntaxes to apply to more than just color, so that we can
|
||||
e.g. specify a different alternate spell checker depending on which
|
||||
file type we have open.
|
||||
- Allow even better file type detection than we have currently, e.g.
|
||||
through libmagic?
|
||||
- Allow setting marks (saved positions, not to be confused with the mark
|
||||
set via Ctrl-^) at various lines and/or columns in the buffer, and
|
||||
allow movement between them with a single keystroke? (we're running
|
||||
out of keystrokes)
|
||||
allow movement between them with a single keystroke? (We're running
|
||||
out of keystrokes, though.)
|
||||
- Allow searching for and replacing newlines.
|
||||
- Fix handling of bad/incomplete UTF-8 sequences to display one Unicode
|
||||
FFFD (Replacement Character) per sequence instead of one per byte.
|
||||
|
||||
For version 2.4:
|
||||
For version 2.6:
|
||||
- New regression framework built on expect.
|
||||
- Allow text searches in the help browser.
|
||||
- Handle window resizes better. After we resize, we should stay
|
||||
wherever we were before we resized, as Pico does.
|
||||
- Allow text searches in the help viewer.
|
||||
- Add the ability to move to different lines of the screen with a single
|
||||
keystroke, e.g. M-` (M-~) to go to the top line, M-& (M-7) to go to
|
||||
the center line, and M-' (M-") to go to the last line.
|
||||
- Detect when we're pasting text, so that we can handle it differently
|
||||
(i.e. faster than currently with screen redraws)
|
||||
(i.e. faster than currently with screen redraws).
|
||||
- Allow piping marked text to an external command and replacing it with
|
||||
the command's output (as the internal spell checker already does with
|
||||
the "spell" command)?
|
||||
|
||||
For version 2.4:
|
||||
- Handle window resizes better. After we've resized, we should stay
|
||||
wherever we were before we resized, as Pico does. [DONE]
|
||||
- Allow even better file-type detection than we have currently, e.g.
|
||||
through libmagic. [DONE]
|
||||
|
||||
For version 2.2:
|
||||
- Rebindable keys? [DONE]
|
||||
- Undo/Redo keys (M-U and M-E)? [DONE]
|
||||
|
||||
@@ -20,16 +20,12 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.3.5], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.5.0], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
dnl Silence a pointless warning from the gettext Makefile.
|
||||
|
||||
AC_DEFUN([AC_DATAROOTDIR_CHECKED])
|
||||
|
||||
dnl Make sure the ONCE macros are available.
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
@@ -531,6 +527,7 @@ else
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors() command.]))
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], key_defined, AC_DEFINE(HAVE_KEY_DEFINED, 1, [Define this if your curses library has the key_defined() command.]))
|
||||
|
||||
dnl Parse any configure options.
|
||||
|
||||
|
||||
46
doc/faq.html
46
doc/faq.html
@@ -28,8 +28,8 @@
|
||||
<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.9.1">3.9.1. How about in Win32?</a></p></blockquote>
|
||||
<a href="#3.9a">3.9a. How do I make a .nanorc file that nano will read when I start it?</a><br>
|
||||
<a href="#3.9b">3.9b. How about in Win32?</a></p></blockquote>
|
||||
<h2><a href="#4">4. Running</a></h2>
|
||||
<blockquote><p><a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
|
||||
<a href="#4.2">4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</a><br>
|
||||
@@ -84,9 +84,9 @@
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current stable version of nano *should* be 2.2.6. Of course, you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current stable version of nano *should* be 2.4.2. Of course, you should always check the <a href="http://www.nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v2.2/nano.1.html">here</a>.</p></blockquote>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v2.4/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="2"></a>2. Where to get GNU nano.</h1>
|
||||
<h2><a name="2.1"></a>2.1. FTP and WWW sites that carry nano.</h2>
|
||||
@@ -135,18 +135,20 @@
|
||||
<h2><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h2>
|
||||
<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 built-in file browser
|
||||
<b>--disable-browser</b> Disable the built-in file browser
|
||||
<b>--disable-color</b> Disable color and syntax highlighting
|
||||
<b>--disable-extra</b> Disable extra features, currently only an easter egg
|
||||
<b>--disable-extra</b> Disable extra features (currently only an easter egg)
|
||||
<b>--disable-help</b> Disable help functions
|
||||
<b>--disable-histories</b> Disable the saving of search strings and cursor positions
|
||||
<b>--disable-justify</b> Disable justify/unjustify functions
|
||||
<b>--disable-mouse</b> Disable mouse support (and -m flag)
|
||||
<b>--disable-libmagic</b> Disable the use of libmagic for determining a file's syntax
|
||||
<b>--disable-mouse</b> Disable mouse support
|
||||
<b>--disable-multibuffer</b> Disable having multiple file buffers open
|
||||
<b>--disable-nanorc</b> Disable the use of .nanorc files
|
||||
<b>--disable-operatingdir</b> Disable setting of operating directory
|
||||
<b>--disable-operatingdir</b> Disable the setting of an operating directory
|
||||
<b>--disable-speller</b> Disable spell checker functions
|
||||
<b>--disable-tabcomp</b> Disable tab completion functions
|
||||
<b>--disable-wrapping</b> Disable all wrapping of text (and -w flag)</pre>
|
||||
<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 if you have locale support on your system. And finally there's always good old <b>strip</b> to strip all debugging code and code that exists in libraries on your system.</p>
|
||||
<p>With <b>--disable-wrapping-as-root</b> you can disable any hard-wrapping by default when the user is root, useful to prevent accidentally changing long lines in system configuration files.</p>
|
||||
</blockquote>
|
||||
@@ -156,12 +158,12 @@
|
||||
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
|
||||
<blockquote><p>To use verbatim input, you must be using nano 1.3.1 or newer. When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message "Verbatim Input"), then press the key(s) that generate the character you want.</p>
|
||||
<p>Alternatively, if you've enabled Unicode support (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code (from 000000 to 10FFFF, case-insensitive), and the character with the corresponding value will be inserted instead. The prompt will change to "Unicode Input" when you do this.</p></blockquote>
|
||||
<h2><a name="3.9"></a>3.9. How do I make a .nanorc file that nano will read when I start it?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your version of nano must not have been compiled with <b>--disable-nanorc</b>, and must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the word <b>set</b> and the getopt_long flag for the feature, for example "set nowrap" or "set suspend".</p></blockquote>
|
||||
<h2><a name="3.9.1"></a>3.9. How about in Win32?</h2>
|
||||
<blockquote><p>If you're using the official nano .zip file and have extracted all the files, you should take the file nano.rc and place it somewhere on your Win32 system (for example if you have write permission to do so, at the top of C:\). Then you must create an Environment variable called HOME which points to the directory where you put nano.rc. In Windows XP, you can get to Environment variables by right-clicking "My Computer" either on the desktop or in the Start Menu, and selecting Properties. This should bring up the System Properties panel. Then click the Advanced Tab, and there should be a button called Environment Variables. Click that to bring up the Environment Variables section. Now, under User Variables you should be able to click the New button, and make a new Variables Name called HOME, with the Variable Value of whatever path you copied nano.rc into (just the directory name; don't add nano.rc onto the end).</p>
|
||||
<p>We're still working on documentation for enabling synax highlighting on Win32; please bear with us.</p>
|
||||
<p>Note that the nano.rc file must remain Unix-formated in order for nano to understand it. In other words, you should probably use only nano to edit its config file. Other programs like Wordpad and Notepad will convert the file to DOS format when saving, and the latter does not even properly read Unix-formatted files to begin with.</p></blockquote>
|
||||
<h2><a name="3.9a"></a>3.9a. How do I make a .nanorc file that nano will read when I start it?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your version of nano must <b>not</b> have been compiled with <b>--disable-nanorc</b>, and must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the words <b>set</b> and <b>unset</b> plus the long option name for the feature. For example, "set nowrap" or "set smarthome".</p></blockquote>
|
||||
<h2><a name="3.9b"></a>3.9b. How about in Win32?</h2>
|
||||
<blockquote><p>If you're using the official nano .zip file and have extracted all the files, you should take the file nano.rc and place it somewhere on your Win32 system (for example, if you have write permission to do so, at the top of C:\). Then you must create an Environment variable called HOME which points to the directory where you put nano.rc. In Windows XP, you can get to Environment variables by right-clicking "My Computer" either on the desktop or in the Start Menu, and selecting Properties. This should bring up the System Properties panel. Then click the Advanced Tab, and there should be a button called Environment Variables. Click that to bring up the Environment Variables section. Now, under User Variables you should be able to click the New button, and make a new Variables Name called HOME, with the Variable Value of whatever path you copied nano.rc into (just the directory name; don't add nano.rc onto the end).</p>
|
||||
<p>We're still working on documentation for enabling syntax highlighting on Win32; please bear with us.</p>
|
||||
<p>Note that the nano.rc file must remain Unix-formatted in order for nano to understand it. In other words, you should probably use only nano to edit its config file. Other programs like Wordpad and Notepad will convert the file to DOS format when saving, and the latter does not even properly read Unix-formatted files to begin with.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="4"></a>4. Running</h1>
|
||||
<h2><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h2>
|
||||
@@ -182,9 +184,9 @@
|
||||
<h2><a name="4.5"></a>4.5. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
|
||||
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, and Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
|
||||
<h2><a name="4.6"></a>4.6. nano crashes when I type <insert keystroke here>!</h2>
|
||||
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or in the <a href="https://savannah.gnu.org/bugs/?group=nano">bug database</a> on Savannah.</p></blockquote>
|
||||
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or in the <a href="https://savannah.gnu.org/bugs/?group=nano">bug tracker</a> on Savannah.</p></blockquote>
|
||||
<h2><a name="4.7"></a>4.7. nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9, but 2.2.6 is recommended).</p></blockquote>
|
||||
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9, but 2.4.2 is recommended).</p></blockquote>
|
||||
<h2><a name="4.8"></a>4.8. [version 1.3.12 and later] I'm using glibc 2.2.3, and nano crashes when I use color support or do regular expression searches. How can I fix that?</h2>
|
||||
<blockquote><p>It's a bug in glibc 2.2.3. You should upgrade to at least glibc 2.2.4.</p></blockquote>
|
||||
<h2><a name="4.9"></a>4.9. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
|
||||
@@ -207,15 +209,15 @@
|
||||
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
|
||||
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
|
||||
<h2><a name="4.12"></a>4.12. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Several example configurations are in the <b>doc/syntax</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9">3.9</a>.</p></blockquote>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Several example configurations are in the <b>doc/syntax</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9a">3.9a</a>.</p></blockquote>
|
||||
<h2><a name="4.13"></a>4.13. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
|
||||
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
|
||||
<h2><a name="4.14"></a>4.14. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</h2>
|
||||
<blockquote><p>You have the autoindent feature turned on. Hit Meta-I to turn it off, paste your text, and then hit Meta-I again to turn it back on.</p></blockquote>
|
||||
<h2><a name="4.15"></a>4.15. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</h2>
|
||||
<blockquote><p>In nano 2.3.0, cursor-position history was introduced, and both history files now reside under a .nano directory in your home. nano was trying to move this file into the new location so it could continue to use it. This means that if you try and use an earlier version of nano, it will be unable to see your current search history. To fix this, run the following commands:<br>
|
||||
mv ~/.nano/search_history ~/.nano_history<br>
|
||||
ln -sf ~/.nano_history ~/.nano/search_history<br>
|
||||
<p><b>mv ~/.nano/search_history ~/.nano_history</b><br>
|
||||
<b>ln -sf ~/.nano_history ~/.nano/search_history</b></p>
|
||||
</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
@@ -256,7 +258,9 @@ Of course, due to the license change you can now use the <A HREF="http://www.was
|
||||
<h2><a name="7.5"></a>7.5. Can I have write access to the subversion tree?</h2>
|
||||
<blockquote><p>Re-read Section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote><p>2014/04/24 - A bunch of small fixes and updates. (Benno)<br>
|
||||
<blockquote><p>
|
||||
2015/07/18 - More small fixes and updates. (Benno)<br>
|
||||
2014/04/24 - A bunch of small fixes and updates. (Benno)<br>
|
||||
2009/11/30 - Update various bits for nano 2.2.x. (DLR)<br>
|
||||
2009/11/18 - Typo fix. (j.mader@gmail.com)<br>
|
||||
2008/03/16 - Update docs to refer to subversion instead of CVS, add more words about Alpine, and refer to Savannah for bugs and patches. (chrisa)<br>
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
.\" Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" Le travail d'adaptation française de cette page de manuel a été
|
||||
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
|
||||
.\" Le travail d'adaptation française de cette page de manuel a été
|
||||
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
|
||||
.\" Ce travail d'adaptation est dans le domaine public. Attention, la
|
||||
.\" page traduite reste soumise au droit d'auteur de ses auteurs
|
||||
.\" originaux.
|
||||
.\"
|
||||
.\" The French translation of this document is a public domain work of
|
||||
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
|
||||
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
|
||||
.\" 2005, 2006 and 2007. The translated man page in itself is still
|
||||
.\" subject to the copyright of its original authors.
|
||||
.\"
|
||||
@@ -29,20 +29,20 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" Ce document est publié sous une double licence. Vous pouvez
|
||||
.\" Ce document est publié sous une double licence. Vous pouvez
|
||||
.\" le distribuer et le modifier selon les termes de l'une des deux
|
||||
.\" licences ci-dessous :
|
||||
.\" licences ci-dessous :
|
||||
.\"
|
||||
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
|
||||
.\" votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation. Vous devriez avoir reçu une copie de la
|
||||
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
|
||||
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
|
||||
.\" votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation. Vous devriez avoir reçu une copie de la
|
||||
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
|
||||
.\" le cas, consultez <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2 ou,
|
||||
.\" à votre choix, supérieure, telle que publiée par la Free
|
||||
.\" à votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation, sans section invariante, ni texte de
|
||||
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
|
||||
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
|
||||
.\" une copie de la Licence de documentation libre GNU avec ce
|
||||
.\" programme. Si ce n'est pas le cas, consultez
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
@@ -50,71 +50,71 @@
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 2.0.0" "29\ novembre\ 2007"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\"
|
||||
|
||||
.SH NOM
|
||||
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
|
||||
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [OPTIONS]\ [[\+LIGNE,COLONNE]\ FICHIER]...
|
||||
.I [OPTIONS]\ [[+LIGNE,COLONNE]\ FICHIER]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement la commande \fBnano\fR.
|
||||
Cette page de manuel décrit brièvement la commande \fBnano\fR.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" respectively.
|
||||
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à remplacer
|
||||
Pico, l'éditeur par défaut du logiciel non libre Pine. \fBnano\fR ne se
|
||||
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à remplacer
|
||||
Pico, l'éditeur par défaut du logiciel non libre Pine. \fBnano\fR ne se
|
||||
contentant pas de copier l'interface et l'ergonomie de Pico, il offre
|
||||
également certaines fonctions manquantes (ou désactivées par défaut)
|
||||
dans Pico. Ces fonctionnalités sont, par exemple, les fonctions de
|
||||
recherche et de remplacement, et la possibilité de sauter directement à
|
||||
une ligne et à une colonne précise.
|
||||
également certaines fonctions manquantes (ou désactivées par défaut)
|
||||
dans Pico. Ces fonctionnalités sont, par exemple, les fonctions de
|
||||
recherche et de remplacement, et la possibilité de sauter directement à
|
||||
une ligne et à une colonne précise.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILIGNE\fP,\fICOLONNE\fP
|
||||
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
|
||||
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
|
||||
lieu de démarrer à la colonne\ 1, ligne\ 1.
|
||||
.B +\fILIGNE\fP,\fICOLONNE\fP
|
||||
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
|
||||
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
|
||||
lieu de démarrer à la colonne\ 1, ligne\ 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Identique à \fB-h (\-\-help)\fP.
|
||||
Identique à \fB\-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque l'on
|
||||
appuie sur cette touche à n'importe quel endroit excepté au tout début
|
||||
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
|
||||
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
|
||||
arrière). Si le curseur est déjà là, il se placera au vrai début de la
|
||||
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque l'on
|
||||
appuie sur cette touche à n'importe quel endroit excepté au tout début
|
||||
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
|
||||
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
|
||||
arrière). Si le curseur est déjà là, il se placera au vrai début de la
|
||||
ligne.
|
||||
.TP
|
||||
.B \-B (\-\-backup)
|
||||
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
|
||||
version précédente, en ajoutant un tilde (~) au nom du fichier.
|
||||
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
|
||||
version précédente, en ajoutant un tilde (~) au nom du fichier.
|
||||
.TP
|
||||
.B \-D (\-\-boldtext)
|
||||
Utilise des caractères gras à la place de la vidéo inverse.
|
||||
Utilise des caractères gras à la place de la vidéo inverse.
|
||||
.TP
|
||||
.B \-C \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
|
||||
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
|
||||
de sécurité uniques si celles-ci sont activées.
|
||||
.B \-C \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
|
||||
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
|
||||
de sécurité uniques si celles-ci sont activées.
|
||||
.TP
|
||||
.B \-E (\-\-tabstospaces)
|
||||
Convertit les tabulations clavier en espaces.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
Active le mode multi-espace, autorisant l'édition simultanée de
|
||||
Active le mode multi-espace, autorisant l'édition simultanée de
|
||||
plusieurs fichiers, si ce mode est disponible.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
|
||||
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
|
||||
remplacement dans le fichier \fI~/.nano_history\fR afin de permettre leur
|
||||
réutilisation. Ceci n'est possible que si \fBnano\fR est configuré pour
|
||||
réutilisation. Ceci n'est possible que si \fBnano\fR est configuré pour
|
||||
utiliser les fichiers nanorc.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
@@ -122,63 +122,63 @@ Ne pas utiliser pas les fichiers \fISYSCONFDIR/nanorc\fR et
|
||||
\fI~/.nanorc\fR (si \fBnano\fR est capable de les utiliser).
|
||||
.TP
|
||||
.B \-K (\-\-rebindkeypad)
|
||||
Interprète les touches du pavé numérique afin qu'elles fonctionnent
|
||||
Interprète les touches du pavé numérique afin qu'elles fonctionnent
|
||||
toutes correctement. Vous ne devriez utiliser cette option que si ce
|
||||
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
|
||||
correctement lorsque cette option sera activée.
|
||||
correctement lorsque cette option sera activée.
|
||||
.TP
|
||||
.B \-L (\-\-nonewlines)
|
||||
Ne pas ajouter de passage à la ligne à la fin des fichiers.
|
||||
Ne pas ajouter de passage à la ligne à la fin des fichiers.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
Désactive la conversion automatique des fichiers depuis les formats Mac et
|
||||
Désactive la conversion automatique des fichiers depuis les formats Mac et
|
||||
DOS.
|
||||
.TP
|
||||
.B \-O (\-\-morespace)
|
||||
Utiliser la ligne blanche située sous la ligne de titre comme
|
||||
espace supplémentaire d'édition.
|
||||
Utiliser la ligne blanche située sous la ligne de titre comme
|
||||
espace supplémentaire d'édition.
|
||||
.TP
|
||||
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
|
||||
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
|
||||
pour réaliser une justification correcte des citations. Si nano est
|
||||
capable d'utiliser des expressions rationnelles, le préfixe par défaut
|
||||
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
|
||||
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
|
||||
pour réaliser une justification correcte des citations. Si nano est
|
||||
capable d'utiliser des expressions rationnelles, le préfixe par défaut
|
||||
sera "\fI^([\ \\t]*[#:>\\|}])+\fP", sinon, ce sera "\fI>\ \fP". Dans
|
||||
l'expression rationnelle précédente, «\ \fI\\t\fP\ » représente une
|
||||
l'expression rationnelle précédente, «\ \fI\\t\fP\ » représente une
|
||||
tabulation.
|
||||
.TP
|
||||
.B \-R (\-\-restricted)
|
||||
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
|
||||
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
|
||||
sur la ligne de commande, pas de lecture des fichiers nanorc,
|
||||
interdiction de suspendre, interdiction d'ajouter au début, à la fin,
|
||||
de sauvegarder un fichier ayant déjà un nom sous un nom différent,
|
||||
d'utiliser une copie de sécurité ou le correcteur orthographique. Cette
|
||||
option peut aussi être activée en appelant \fBnano\fP sous un nom
|
||||
commençant par «\ r\ » (par exemple «\ rnano\ »).
|
||||
interdiction de suspendre, interdiction d'ajouter au début, à la fin,
|
||||
de sauvegarder un fichier ayant déjà un nom sous un nom différent,
|
||||
d'utiliser une copie de sécurité ou le correcteur orthographique. Cette
|
||||
option peut aussi être activée en appelant \fBnano\fP sous un nom
|
||||
commençant par «\ r\ » (par exemple «\ rnano\ »).
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
|
||||
de défiler morceau-par-morceau.
|
||||
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
|
||||
de défiler morceau-par-morceau.
|
||||
.TP
|
||||
.B \-T \fInombre\fP (\-\-tabsize=\fInombre\fP)
|
||||
Définit la taille (largeur) des tabulations en nombre de colonnes. Le
|
||||
nombre indiqué doit être strictement supérieur à 0. La valeur par défaut
|
||||
Définit la taille (largeur) des tabulations en nombre de colonnes. Le
|
||||
nombre indiqué doit être strictement supérieur à 0. La valeur par défaut
|
||||
est de 8.
|
||||
.TP
|
||||
.B \-U (\-\-quickblank)
|
||||
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
|
||||
d'état disparaîtront après une frappe clavier au lieu de 25. Notez que
|
||||
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
|
||||
d'état disparaîtront après une frappe clavier au lieu de 25. Notez que
|
||||
l'option \fB-c\fP prend le pas sur cette option.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Affiche la version, puis s'arrête.
|
||||
Affiche la version, puis s'arrête.
|
||||
.TP
|
||||
.B \-W (\-\-wordbounds)
|
||||
Détection plus précise des limites de mots, obtenue en considérant les
|
||||
caractères de ponctuation comme faisant partie des mots.
|
||||
Détection plus précise des limites de mots, obtenue en considérant les
|
||||
caractères de ponctuation comme faisant partie des mots.
|
||||
.TP
|
||||
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
|
||||
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
|
||||
Indique quel mode de colorisation syntaxique adopter, parmi les modes
|
||||
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
|
||||
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
|
||||
disponible.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
@@ -186,111 +186,111 @@ Affiche en permanence la position du curseur. Notez que cette option
|
||||
prend le pas sur l'option \fB-U\fP.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous ne devriez avoir besoin de cette option que si, sur votre système,
|
||||
la touche «\ Effacement arrière\ » produit l'effet de la touche
|
||||
«\ Supprimer\ ».
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous ne devriez avoir besoin de cette option que si, sur votre système,
|
||||
la touche «\ Effacement arrière\ » produit l'effet de la touche
|
||||
«\ Supprimer\ ».
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Affiche un résumé des options de lancement de nano, puis s'arrête.
|
||||
Affiche un résumé des options de lancement de nano, puis s'arrête.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
Indentation automatique. Commence chaque nouvelle ligne au même niveau que
|
||||
la ligne précédente. Utile pour l'édition de code source.
|
||||
Indentation automatique. Commence chaque nouvelle ligne au même niveau que
|
||||
la ligne précédente. Utile pour l'édition de code source.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
Coupe le texte du curseur à la fin de la ligne, au lieu de couper la
|
||||
ligne entière.
|
||||
Coupe le texte du curseur à la fin de la ligne, au lieu de couper la
|
||||
ligne entière.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
Si le fichier édité est un lien symbolique, au lieu de le suivre,
|
||||
remplace le lien par le nouveau fichier. Sans doute utile pour éditer
|
||||
Si le fichier édité est un lien symbolique, au lieu de le suivre,
|
||||
remplace le lien par le nouveau fichier. Sans doute utile pour éditer
|
||||
les fichiers de \fI/tmp\fR, non\ ?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Active l'utilisation de la souris, si elle est disponible pour votre
|
||||
système. Lorsque celle-ci est activée, il est possible d'utiliser la
|
||||
système. Lorsque celle-ci est activée, il est possible d'utiliser la
|
||||
souris pour positionner le curseur, pour marquer le texte (avec un
|
||||
double-clic) et pour lancer les fonctions correspondant aux raccourcis.
|
||||
Il est possible d'utiliser la souris sous X\ Window ou en mode console
|
||||
avec gpm.
|
||||
.TP
|
||||
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
|
||||
Définit le répertoire de travail. Demande à \fBnano\fP de mettre en place
|
||||
quelque chose de similaire à un environnement d'exécution restreint
|
||||
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
|
||||
Définit le répertoire de travail. Demande à \fBnano\fP de mettre en place
|
||||
quelque chose de similaire à un environnement d'exécution restreint
|
||||
(\fIchroot\fR).
|
||||
.TP
|
||||
.B \-p (\-\-preserve)
|
||||
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient reçues
|
||||
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient reçues
|
||||
par le terminal.
|
||||
.TP
|
||||
.B \-r \fIcolonne\fP (\-\-fill=\fIcolonne\fP)
|
||||
Passe automatiquement à la ligne une fois arrivé à la colonne
|
||||
\fIcolonne\fR. Si la valeur indiquée est de 0 ou moins, le point de
|
||||
passage à la ligne aura lieu à la taille de l'écran moins \fIcolonne\fR.
|
||||
Cela permet de faire varier le point de passage à la ligne lorsque l'on
|
||||
change la taille de l'écran. La valeur par défaut est de \-8.
|
||||
Passe automatiquement à la ligne une fois arrivé à la colonne
|
||||
\fIcolonne\fR. Si la valeur indiquée est de 0 ou moins, le point de
|
||||
passage à la ligne aura lieu à la taille de l'écran moins \fIcolonne\fR.
|
||||
Cela permet de faire varier le point de passage à la ligne lorsque l'on
|
||||
change la taille de l'écran. La valeur par défaut est de \-8.
|
||||
.TP
|
||||
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
|
||||
Choix d'un correcteur orthographique de remplacement.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
|
||||
demande de confirmation. Identique à l'option \fB-t\fP de Pico.
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
|
||||
demande de confirmation. Identique à l'option \fB-t\fP de Pico.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
Mode visualisation (lecture seule).
|
||||
.TP
|
||||
.B \-w (\-\-nowrap)
|
||||
Désactive le passage automatique à la ligne.
|
||||
Désactive le passage automatique à la ligne.
|
||||
.TP
|
||||
.B \-x (\-\-nohelp)
|
||||
Désactive la barre d'aide affichée en bas de l'écran.
|
||||
Désactive la barre d'aide affichée en bas de l'écran.
|
||||
.TP
|
||||
.B \-z (\-\-suspend)
|
||||
Autorise à suspendre l'éditeur.
|
||||
Autorise à suspendre l'éditeur.
|
||||
.TP
|
||||
.B \-a, \-b, \-e, \-f, \-g, \-j
|
||||
Ignoré, pour être compatible avec Pico.
|
||||
Ignoré, pour être compatible avec Pico.
|
||||
|
||||
.SH "FICHIERS D'INITIALISATION"
|
||||
\fBnano\fR lit les fichiers d'initialisation dans l'ordre suivant\ :
|
||||
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de
|
||||
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de
|
||||
manuel de \fBnanorc(5)\fR et au fichier d'exemple \fInanorc.sample\fR,
|
||||
qui devraient tous les deux être livrés avec \fBnano\fR.
|
||||
qui devraient tous les deux être livrés avec \fBnano\fR.
|
||||
|
||||
.SH NOTES
|
||||
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
|
||||
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
|
||||
ligne de commande ou dans l'un des fichiers nanorc, \fBnano\fR prendra
|
||||
la commande indiquée par la variable d'environnement \fBSPELL\fR si
|
||||
elle est définie.
|
||||
la commande indiquée par la variable d'environnement \fBSPELL\fR si
|
||||
elle est définie.
|
||||
|
||||
Dans certains cas, \fBnano\fR essaiera de sauvegarder le fichier en cours
|
||||
d'édition dans un fichier de secours. Cela arrivera principalement si
|
||||
\fBnano\fR reçoit un signal SIGHUP ou SIGTERM, ou bien se trouve à court de
|
||||
mémoire. Le nom de ce fichier de secours sera \fInano.save\fR si le fichier en
|
||||
cours n'avait pas encore de nom, ou sera composé du nom du fichier en cours
|
||||
suivi du suffixe «\ .save\ ». Si un fichier de ce nom existe déjà dans
|
||||
le répertoire, un «\ .save\ » et un nombre seront ajoutés à la fin du
|
||||
d'édition dans un fichier de secours. Cela arrivera principalement si
|
||||
\fBnano\fR reçoit un signal SIGHUP ou SIGTERM, ou bien se trouve à court de
|
||||
mémoire. Le nom de ce fichier de secours sera \fInano.save\fR si le fichier en
|
||||
cours n'avait pas encore de nom, ou sera composé du nom du fichier en cours
|
||||
suivi du suffixe «\ .save\ ». Si un fichier de ce nom existe déjà dans
|
||||
le répertoire, un «\ .save\ » et un nombre seront ajoutés à la fin du
|
||||
nom du fichier en cours afin de le rendre unique (par exemple,
|
||||
«\ .save.1\ »). En mode multi-espace, \fBnano\fR réalisera une
|
||||
«\ .save.1\ »). En mode multi-espace, \fBnano\fR réalisera une
|
||||
sauvegarde de tous les fichiers en cours dans leurs fichiers de secours
|
||||
respectifs.
|
||||
|
||||
.SH BOGUES
|
||||
Merci de nous faire parvenir vos commentaires et de nous signaler les
|
||||
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
|
||||
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
|
||||
|
||||
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
|
||||
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
|
||||
\fBnano-devel@gnu.org\fR.
|
||||
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
|
||||
|
||||
N'hésitez pas également à envoyez vos commentaires, suggestions et
|
||||
corrections relatives à l'adaptation française de cette page de manuel
|
||||
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
|
||||
N'hésitez pas également à envoyez vos commentaires, suggestions et
|
||||
corrections relatives à l'adaptation française de cette page de manuel
|
||||
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
|
||||
|
||||
.SH "SITE INTERNET"
|
||||
http://www.nano-editor.org/
|
||||
@@ -300,27 +300,27 @@ http://www.nano-editor.org/
|
||||
.TP
|
||||
\fBnanorc\fR(5)
|
||||
.PP
|
||||
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
|
||||
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fR et \fITHANKS\fR pour plus d'information). Cette page de
|
||||
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
|
||||
le système Debian (mais elle peut être utilisée par d'autres).
|
||||
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
|
||||
le système Debian (mais elle peut être utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
|
||||
de la version 1.54 du 11\ octobre\ 2007 de la page de manuel de nano
|
||||
2.0.0. Cette page a été relue par Gérard Delafond.
|
||||
2.0.0. Cette page a été relue par Gérard Delafond.
|
||||
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
traducteur.
|
||||
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
consultable via la commande\ :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007
|
||||
.\" Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" Le travail d'adaptation française de cette page de manuel a été
|
||||
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
|
||||
.\" Le travail d'adaptation française de cette page de manuel a été
|
||||
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
|
||||
.\" Ce travail d'adaptation est dans le domaine public. Attention, la
|
||||
.\" page traduite reste soumise au droit d'auteur de ses auteurs
|
||||
.\" originaux.
|
||||
.\"
|
||||
.\" The French translation of this document is a public domain work of
|
||||
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
|
||||
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
|
||||
.\" 2005, 2006 and 2007. The translated man page in itself is still
|
||||
.\" subject to the copyright of its original authors.
|
||||
.\"
|
||||
@@ -29,20 +29,20 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" Ce document est publié sous une double licence. Vous pouvez
|
||||
.\" Ce document est publié sous une double licence. Vous pouvez
|
||||
.\" le distribuer et le modifier selon les termes de l'une des deux
|
||||
.\" licences ci-dessous :
|
||||
.\" licences ci-dessous :
|
||||
.\"
|
||||
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
|
||||
.\" votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation. Vous devriez avoir reçu une copie de la
|
||||
.\" Licence publique générale GNU avec ce programme. Si ce n'est
|
||||
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
|
||||
.\" votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation. Vous devriez avoir reçu une copie de la
|
||||
.\" Licence publique générale GNU avec ce programme. Si ce n'est
|
||||
.\" pas le cas, consultez <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2
|
||||
.\" ou, à votre choix, supérieure, telle que publiée par la Free
|
||||
.\" ou, à votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation, sans section invariante, ni texte de
|
||||
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
|
||||
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
|
||||
.\" une copie de la Licence de documentation libre GNU avec ce
|
||||
.\" programme. Si ce n'est pas le cas, consultez
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
@@ -50,50 +50,50 @@
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 2.0.0" "29\ novembre\ 2007"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
|
||||
.SH NOM
|
||||
nanorc \- fichier de configuration de l'éditeur nano du projet GNU
|
||||
nanorc \- fichier de configuration de l'éditeur nano du projet GNU
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement le fichier de configuration de
|
||||
l'éditeur \fBnano\fP GNU.
|
||||
Cette page de manuel décrit brièvement le fichier de configuration de
|
||||
l'éditeur \fBnano\fP GNU.
|
||||
.PP
|
||||
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à
|
||||
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
|
||||
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à
|
||||
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
|
||||
\fBnano\fP ne se contentant pas de copier l'interface et l'ergonomie de
|
||||
Pico, il offre également certaines fonctionnalités manquantes (ou
|
||||
désactivées par défaut) de Pico. Ces fonctionnalités sont, par exemple,
|
||||
les fonctions de recherche et de remplacement et la possibilité de
|
||||
sauter directement à une ligne et à une colonne précise.
|
||||
Pico, il offre également certaines fonctionnalités manquantes (ou
|
||||
désactivées par défaut) de Pico. Ces fonctionnalités sont, par exemple,
|
||||
les fonctions de recherche et de remplacement et la possibilité de
|
||||
sauter directement à une ligne et à une colonne précise.
|
||||
.PP
|
||||
Le fichier \fInanorc\fP contient les paramètres par défaut de
|
||||
\fBnano\fP. Il ne doit pas être au format DOS ou Mac. Lors de son
|
||||
démarrage, nano commencera par lire le fichier de configuration général
|
||||
Le fichier \fInanorc\fP contient les paramètres par défaut de
|
||||
\fBnano\fP. Il ne doit pas être au format DOS ou Mac. Lors de son
|
||||
démarrage, nano commencera par lire le fichier de configuration général
|
||||
\fISYSCONFDIR/nanorc\fP, puis lira le fichier de configuration personnel
|
||||
de l'utilisateur \fI~/.nanorc\fP.
|
||||
|
||||
.SH OPTIONS
|
||||
Le fichier de configuration accepte une série de commandes \fBset\fP
|
||||
(activer) et \fBunset\fP (désactiver), qui permettent de définir le
|
||||
paramétrage de nano au démarrage sans avoir à utiliser d'options de
|
||||
Le fichier de configuration accepte une série de commandes \fBset\fP
|
||||
(activer) et \fBunset\fP (désactiver), qui permettent de définir le
|
||||
paramétrage de nano au démarrage sans avoir à utiliser d'options de
|
||||
ligne de commande. De plus, les mots clefs \fBsyntax\fP (syntaxe),
|
||||
\fBcolor\fP (couleur) et \fBicolor\fP (couleur insensible à la casse)
|
||||
sont utilisés pour définir les règles de colorisation pour différents
|
||||
\fBcolor\fP (couleur) et \fBicolor\fP (couleur insensible à la casse)
|
||||
sont utilisés pour définir les règles de colorisation pour différents
|
||||
motifs de texte. \fBnano\fP lit une commande par ligne.
|
||||
|
||||
Les options du fichier de configuration ont priorité sur les valeurs par
|
||||
défaut utilisées par nano. Les options de la ligne de commande sont
|
||||
Les options du fichier de configuration ont priorité sur les valeurs par
|
||||
défaut utilisées par nano. Les options de la ligne de commande sont
|
||||
prioritaires par rapport aux options du fichier de configuration. Les
|
||||
options sont désactivées (unset) par défaut, sauf les options prenant un
|
||||
options sont désactivées (unset) par défaut, sauf les options prenant un
|
||||
argument.
|
||||
|
||||
Les apostrophes («\ \fI'\fP\ ») et les guillemets droits («\ \fI"\fP\ »)
|
||||
présents dans des chaînes de caractères utilisées comme paramètres n'ont
|
||||
pas besoin d'être précédées d'une barre oblique inversée
|
||||
(«\ \fI\\\fP\ »). La chaîne sera terminée par le dernier guillemet
|
||||
Les apostrophes («\ \fI'\fP\ ») et les guillemets droits («\ \fI"\fP\ »)
|
||||
présents dans des chaînes de caractères utilisées comme paramètres n'ont
|
||||
pas besoin d'être précédées d'une barre oblique inversée
|
||||
(«\ \fI\\\fP\ »). La chaîne sera terminée par le dernier guillemet
|
||||
droit. Par exemple, pour l'option \fBbrackets\fP, "\fI"')>]}\fP"
|
||||
correspondra à \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP et \fI}\fP.
|
||||
correspondra à \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP et \fI}\fP.
|
||||
|
||||
Les commandes et arguments reconnus sont\ :
|
||||
|
||||
@@ -102,69 +102,69 @@ Les commandes et arguments reconnus sont\ :
|
||||
Active l'indentation automatique.
|
||||
.TP
|
||||
.B set/unset backup
|
||||
Crée des copies de sécurité nommées
|
||||
Crée des copies de sécurité nommées
|
||||
.IR nom_du_fichier~ .
|
||||
.TP
|
||||
.B set backupdir "\fIrépertoire\fP"
|
||||
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
|
||||
de sécurité uniques, si l'enregistrement de copies de sécurité est
|
||||
activé.
|
||||
.B set backupdir "\fIrépertoire\fP"
|
||||
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
|
||||
de sécurité uniques, si l'enregistrement de copies de sécurité est
|
||||
activé.
|
||||
.TP
|
||||
.B set/unset backwards
|
||||
Par défaut, les recherches se font vers l'arrière.
|
||||
Par défaut, les recherches se font vers l'arrière.
|
||||
.TP
|
||||
.B set/unset boldtext
|
||||
Utilise des caractères gras à la place de la vidéo inverse.
|
||||
Utilise des caractères gras à la place de la vidéo inverse.
|
||||
.TP
|
||||
.B set brackets "\fIchaîne\fP"
|
||||
Définit les caractères considérés comme des crochets fermants lors de la
|
||||
justification des paragraphes. Ces caractères ne doivent pas contenir
|
||||
d'espaces. Seules les ponctuations terminales, éventuellement suivies
|
||||
.B set brackets "\fIchaîne\fP"
|
||||
Définit les caractères considérés comme des crochets fermants lors de la
|
||||
justification des paragraphes. Ces caractères ne doivent pas contenir
|
||||
d'espaces. Seules les ponctuations terminales, éventuellement suivies
|
||||
de crochets fermants, peuvent terminer une phrase.
|
||||
|
||||
La valeur par défaut de cette option est\ : "\fI"')>]}\fP".
|
||||
La valeur par défaut de cette option est\ : "\fI"')>]}\fP".
|
||||
|
||||
N.D.T.\ : reportez-vous au paragraphe sur l'option \fBpunct\fR pour
|
||||
plus d'informations.
|
||||
|
||||
.TP
|
||||
.B set/unset casesensitive
|
||||
Par défaut, les recherches ne tiennent pas compte de la casse.
|
||||
Par défaut, les recherches ne tiennent pas compte de la casse.
|
||||
.TP
|
||||
.B set/unset const
|
||||
Affiche en permanence la position du curseur dans la ligne d'état.
|
||||
Affiche en permanence la position du curseur dans la ligne d'état.
|
||||
.TP
|
||||
.B set/unset cut
|
||||
Par défaut, coupe le texte du curseur à la fin de la ligne, au lieu de
|
||||
couper la ligne entière.
|
||||
Par défaut, coupe le texte du curseur à la fin de la ligne, au lieu de
|
||||
couper la ligne entière.
|
||||
.TP
|
||||
.B set fill \fIn\fP
|
||||
Passe automatiquement à la ligne une fois arrivé à la colonne
|
||||
\fIn\fR. Si la valeur indiquée est de 0 ou moins, le point de passage à
|
||||
la ligne aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de
|
||||
faire varier le point de passage à la ligne lorsque l'on change la
|
||||
taille de l'écran. La valeur par défaut est de \-8.
|
||||
Passe automatiquement à la ligne une fois arrivé à la colonne
|
||||
\fIn\fR. Si la valeur indiquée est de 0 ou moins, le point de passage à
|
||||
la ligne aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de
|
||||
faire varier le point de passage à la ligne lorsque l'on change la
|
||||
taille de l'écran. La valeur par défaut est de \-8.
|
||||
.TP
|
||||
.B set/unset historylog
|
||||
Active l'utilisation de
|
||||
.I ~/.nano_history
|
||||
pour enregistrer et relire les chaînes ayant fait l'objet d'une
|
||||
pour enregistrer et relire les chaînes ayant fait l'objet d'une
|
||||
recherche ou d'un remplacement.
|
||||
.TP
|
||||
.B set matchbrackets "\fIchaîne\fP"
|
||||
Définit les crochets ouvrants et fermant pour la recherche de crochets
|
||||
.B set matchbrackets "\fIchaîne\fP"
|
||||
Définit les crochets ouvrants et fermant pour la recherche de crochets
|
||||
correspondants. Cette liste ne doit pas contenir de blancs. L'ensemble
|
||||
des crochets ouvrants doit être indiqué en premier, suivi de l'ensemble
|
||||
des crochets fermant, qui doit être dans le même ordre. La valeur par
|
||||
défaut de cette option est "\fI(<[{)>]}\fP".
|
||||
des crochets ouvrants doit être indiqué en premier, suivi de l'ensemble
|
||||
des crochets fermant, qui doit être dans le même ordre. La valeur par
|
||||
défaut de cette option est "\fI(<[{)>]}\fP".
|
||||
.TP
|
||||
.B set/unset morespace
|
||||
Utiliser la ligne blanche située sous la ligne de titre comme espace
|
||||
supplémentaire d'édition.
|
||||
Utiliser la ligne blanche située sous la ligne de titre comme espace
|
||||
supplémentaire d'édition.
|
||||
.TP
|
||||
.B set/unset mouse
|
||||
Active l'utilisation de la souris, si elle est disponible pour votre
|
||||
système. Lorsque celle-ci est activée, il est possible d'utiliser la
|
||||
système. Lorsque celle-ci est activée, il est possible d'utiliser la
|
||||
souris pour positionner le curseur, pour marquer le texte (avec un
|
||||
double-clic) et pour lancer les fonctions correspondant aux raccourcis.
|
||||
Il est possible d'utiliser la souris sous X\ Window ou en mode console
|
||||
@@ -178,167 +178,167 @@ espace.
|
||||
Pas de conversion depuis les formats DOS et Mac.
|
||||
.TP
|
||||
.B set/unset nofollow
|
||||
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
|
||||
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
|
||||
.TP
|
||||
.B set/unset nohelp
|
||||
Désactive les lignes d'aide affichée en bas de l'écran.
|
||||
Désactive les lignes d'aide affichée en bas de l'écran.
|
||||
.TP
|
||||
.B set/unset nonewlines
|
||||
Ne pas ajouter de passage à la ligne à la fin des fichiers.
|
||||
Ne pas ajouter de passage à la ligne à la fin des fichiers.
|
||||
.TP
|
||||
.B set/unset nowrap
|
||||
Désactive le passage automatique à la ligne.
|
||||
Désactive le passage automatique à la ligne.
|
||||
.TP
|
||||
.B set operatingdir "\fIrépertoire\fP"
|
||||
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
|
||||
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
|
||||
le répertoire courant, afin que les fichiers soient lus depuis ce
|
||||
répertoire. Par défaut, cette fonction est désactivée.
|
||||
.B set operatingdir "\fIrépertoire\fP"
|
||||
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
|
||||
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
|
||||
le répertoire courant, afin que les fichiers soient lus depuis ce
|
||||
répertoire. Par défaut, cette fonction est désactivée.
|
||||
.TP
|
||||
.B set/unset preserve
|
||||
Préserve les séquences XON et XOFF (^Q et ^S).
|
||||
Préserve les séquences XON et XOFF (^Q et ^S).
|
||||
.TP
|
||||
.B set punct "\fIchaîne\fP"
|
||||
Définit les caractères interprétés comme des ponctuations terminales
|
||||
lors de la justification des paragraphes. Ces caractères ne peuvent
|
||||
inclure de blancs. Seules les ponctuations terminales, éventuellement
|
||||
.B set punct "\fIchaîne\fP"
|
||||
Définit les caractères interprétés comme des ponctuations terminales
|
||||
lors de la justification des paragraphes. Ces caractères ne peuvent
|
||||
inclure de blancs. Seules les ponctuations terminales, éventuellement
|
||||
suivies de crochets fermants, peuvent terminer une phrase. La valeur par
|
||||
défaut de cette option est "\fI!.?\fP".
|
||||
défaut de cette option est "\fI!.?\fP".
|
||||
|
||||
N.D.T.\ : ce réglage permet, lors de la justification, de conserver
|
||||
2\ espaces au lieu d'une derrière les ponctuations terminales, ce qui
|
||||
N.D.T.\ : ce réglage permet, lors de la justification, de conserver
|
||||
2\ espaces au lieu d'une derrière les ponctuations terminales, ce qui
|
||||
correspond aux normes typographiques anglo-saxonnes, mais n'a pas lieu
|
||||
d'être en français. Pour le français, le plus simple est d'indiquer,
|
||||
dans le fichier nanorc, une chaîne vide pour ce paramètre.
|
||||
d'être en français. Pour le français, le plus simple est d'indiquer,
|
||||
dans le fichier nanorc, une chaîne vide pour ce paramètre.
|
||||
.TP
|
||||
.B set/unset quickblank
|
||||
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
|
||||
d'état disparaîtront après une frappe clavier au lieu de 25.
|
||||
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
|
||||
d'état disparaîtront après une frappe clavier au lieu de 25.
|
||||
.TP
|
||||
.B set quotestr "\fIchaîne\fP"
|
||||
Définit le préfixe par défaut utilisé pour les citations dans les
|
||||
courriers électroniques. Ce préfixe est utilisé pour réaliser une
|
||||
justification correcte de ces citations. Il s'agira, si votre système le
|
||||
permet, d'une expression rationnelle étendue. Dans le cas
|
||||
contraire, il s'agira d'une chaîne de texte brut. Si vous disposez des
|
||||
expressions rationnelles, la valeur par défaut de cette option sera
|
||||
.B set quotestr "\fIchaîne\fP"
|
||||
Définit le préfixe par défaut utilisé pour les citations dans les
|
||||
courriers électroniques. Ce préfixe est utilisé pour réaliser une
|
||||
justification correcte de ces citations. Il s'agira, si votre système le
|
||||
permet, d'une expression rationnelle étendue. Dans le cas
|
||||
contraire, il s'agira d'une chaîne de texte brut. Si vous disposez des
|
||||
expressions rationnelles, la valeur par défaut de cette option sera
|
||||
"\fI^([\ \\t]*[#:>\\|}])+\fP", sinon, ce sera ">\ ". Notez que le
|
||||
«\ \\t\ » ci-dessus correspond à un caractère de tabulation.
|
||||
«\ \\t\ » ci-dessus correspond à un caractère de tabulation.
|
||||
.TP
|
||||
.B set/unset rebinddelete
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous ne devriez avoir besoin de cette option que si, sur votre système,
|
||||
la touche «\ Effacement arrière\ » produit l'effet de la touche «\
|
||||
Supprimer\ ».
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous ne devriez avoir besoin de cette option que si, sur votre système,
|
||||
la touche «\ Effacement arrière\ » produit l'effet de la touche «\
|
||||
Supprimer\ ».
|
||||
.TP
|
||||
.B set/unset rebindkeypad
|
||||
Interprète les touches du pavé numérique afin qu'elles fonctionnent
|
||||
Interprète les touches du pavé numérique afin qu'elles fonctionnent
|
||||
toutes correctement. Vous ne devriez utiliser cette option que si ce
|
||||
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
|
||||
correctement lorsque cette option sera activée.
|
||||
correctement lorsque cette option sera activée.
|
||||
.TP
|
||||
.B set/unset regexp
|
||||
Utilise par défaut des expressions rationnelles étendues pour les
|
||||
Utilise par défaut des expressions rationnelles étendues pour les
|
||||
recherches.
|
||||
.TP
|
||||
.B set/unset smarthome
|
||||
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque
|
||||
cette touche est pressée à n'importe quel endroit excepté au tout début
|
||||
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
|
||||
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
|
||||
arrière). Si le curseur est déjà là, il se placera au vrai début de la
|
||||
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque
|
||||
cette touche est pressée à n'importe quel endroit excepté au tout début
|
||||
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
|
||||
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
|
||||
arrière). Si le curseur est déjà là, il se placera au vrai début de la
|
||||
ligne.
|
||||
.TP
|
||||
.B set/unset smooth
|
||||
Active le défilement ligne-par-ligne du texte.
|
||||
Active le défilement ligne-par-ligne du texte.
|
||||
.TP
|
||||
.B set speller "\fIprogramme\fP"
|
||||
Utilise le correcteur orthographique \fIprogramme\fP au lieu du
|
||||
correcteur intégré, qui s'appuie sur \fIspell\fP.
|
||||
correcteur intégré, qui s'appuie sur \fIspell\fP.
|
||||
.TP
|
||||
.B set/unset suspend
|
||||
Autorise à suspendre \fBnano\fP.
|
||||
Autorise à suspendre \fBnano\fP.
|
||||
.TP
|
||||
.B set tabsize \fIn\fP
|
||||
Utilise une taille de tabulation de \fIn\fP colonnes. Cette valeur doit
|
||||
être strictement supérieure à 0. La valeur par défaut est de\ 8.
|
||||
être strictement supérieure à 0. La valeur par défaut est de\ 8.
|
||||
.TP
|
||||
.B set/unset tabstospaces
|
||||
Convertit les tabulations clavier en espaces.
|
||||
.TP
|
||||
.B set/unset tempfile
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement en
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement en
|
||||
quittant, sans demande de confirmation.
|
||||
.TP
|
||||
.B set/unset view
|
||||
Interdit de modifier les fichiers.
|
||||
.TP
|
||||
.B set whitespace "\fIchaîne\fP"
|
||||
Définit les deux caractères utilisés pour afficher les premiers
|
||||
caractères des tabulations et des espaces. Ces deux caractères doivent
|
||||
être mono-colonne.
|
||||
.B set whitespace "\fIchaîne\fP"
|
||||
Définit les deux caractères utilisés pour afficher les premiers
|
||||
caractères des tabulations et des espaces. Ces deux caractères doivent
|
||||
être mono-colonne.
|
||||
.TP
|
||||
.B set/unset wordbounds
|
||||
Détection plus précise des limites de mots, obtenue en considérant les
|
||||
caractères de ponctuation comme faisant partie des mots.
|
||||
Détection plus précise des limites de mots, obtenue en considérant les
|
||||
caractères de ponctuation comme faisant partie des mots.
|
||||
.TP
|
||||
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
|
||||
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
|
||||
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
|
||||
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
|
||||
l'option \fB-Y\fP (ou \fB--syntax\fP) ou qui sera automatiquement
|
||||
activée si le nom du fichier en cours correspond à l'expression
|
||||
rationnelle étendue \fImotif_de_fichier\fP. Toutes les instructions
|
||||
suivantes de colorisation \fBcolor\fP ou \fBicolor\fP s'appliqueront à
|
||||
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
|
||||
activée si le nom du fichier en cours correspond à l'expression
|
||||
rationnelle étendue \fImotif_de_fichier\fP. Toutes les instructions
|
||||
suivantes de colorisation \fBcolor\fP ou \fBicolor\fP s'appliqueront à
|
||||
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
|
||||
|
||||
La syntaxe nommée \fInone\fP (aucune) est réservée\ ; si elle est
|
||||
indiquée dans la ligne de commande, cela revient à ne définir aucune
|
||||
syntaxe. La syntaxe nommée \fIdefault\fP (par défaut) est spéciale, elle
|
||||
ne nécessite aucun motif de \fImotif_de_fichier\fP, et s'applique aux
|
||||
fichiers ne correspondant à aucun des \fImotif_de_fichier\fP des autres
|
||||
La syntaxe nommée \fInone\fP (aucune) est réservée\ ; si elle est
|
||||
indiquée dans la ligne de commande, cela revient à ne définir aucune
|
||||
syntaxe. La syntaxe nommée \fIdefault\fP (par défaut) est spéciale, elle
|
||||
ne nécessite aucun motif de \fImotif_de_fichier\fP, et s'applique aux
|
||||
fichiers ne correspondant à aucun des \fImotif_de_fichier\fP des autres
|
||||
syntaxes.
|
||||
.TP
|
||||
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
|
||||
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
|
||||
l'expression rationnelle étendue \fImotif\fP en utilisant la couleur de
|
||||
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
|
||||
l'expression rationnelle étendue \fImotif\fP en utilisant la couleur de
|
||||
texte \fIcouleur_texte\fP et la couleur de fond \fIcouleur_fond\fP,
|
||||
l'une de ces deux couleurs au moins devant être définie. Les couleurs
|
||||
acceptées par \fBnano\fP pour le texte et le fond sont\ : \fIwhite\fP
|
||||
l'une de ces deux couleurs au moins devant être définie. Les couleurs
|
||||
acceptées par \fBnano\fP pour le texte et le fond sont\ : \fIwhite\fP
|
||||
(blanc), \fIblack\fP (noir), \fIred\fP (rouge), \fIblue\fP (bleu),
|
||||
\fIgreen\fP (vert), \fIyellow\fP (jaune), \fImagenta\fP, et \fIcyan\fP.
|
||||
Pour la couleur du texte, vous pouvez ajouter à ces couleurs le préfixe
|
||||
Pour la couleur du texte, vous pouvez ajouter à ces couleurs le préfixe
|
||||
\fIbright\fP (lumineux) pour obtenir une couleur plus lumineuse. Si
|
||||
votre terminal est capable de gérer la transparence, ne pas spécifier de
|
||||
\fIcouleur_fond\fP indique à \fBnano\fP d'essayer d'utiliser un fond
|
||||
votre terminal est capable de gérer la transparence, ne pas spécifier de
|
||||
\fIcouleur_fond\fP indique à \fBnano\fP d'essayer d'utiliser un fond
|
||||
transparent.
|
||||
.TP
|
||||
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
|
||||
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
|
||||
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
|
||||
compte de la casse.
|
||||
.TP
|
||||
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
|
||||
Affiche les expressions commençant par l'expression rationnelle étendue
|
||||
\fImotif_début\fP et se terminant par l'expression rationnelle étendue
|
||||
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
|
||||
Affiche les expressions commençant par l'expression rationnelle étendue
|
||||
\fImotif_début\fP et se terminant par l'expression rationnelle étendue
|
||||
\fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
|
||||
et la couleur de fond \fIcouleur_fond\fP, l'une de ces deux couleurs au
|
||||
moins devant être définie. Cela permet à la colorisation syntaxique de
|
||||
s'étendre sur plusieurs lignes. Notez que toutes les occurrences
|
||||
successives de \fImotif_début\fP après le \fImotif_début\fP initial
|
||||
seront surlignées jusqu'à la prochaine instance de \fImotif_fin\fP.
|
||||
moins devant être définie. Cela permet à la colorisation syntaxique de
|
||||
s'étendre sur plusieurs lignes. Notez que toutes les occurrences
|
||||
successives de \fImotif_début\fP après le \fImotif_début\fP initial
|
||||
seront surlignées jusqu'à la prochaine instance de \fImotif_fin\fP.
|
||||
.TP
|
||||
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
|
||||
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
|
||||
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
|
||||
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
|
||||
compte de la casse.
|
||||
.TP
|
||||
.B include "\fIfichier_de_syntaxes\fP"
|
||||
Lit le fichier \fIfichier_de_syntaxes\fP contenant une liste
|
||||
autosuffisante de définitions de syntaxes. Ce fichier ne doit contenir
|
||||
autosuffisante de définitions de syntaxes. Ce fichier ne doit contenir
|
||||
que des commandes \fBsyntax\fP, \fBcolor\fP et \fBicolor\fP.
|
||||
|
||||
.SH FICHIERS
|
||||
.TP
|
||||
.I $SYSCONFDIR/nanorc
|
||||
Fichier de configuration général
|
||||
Fichier de configuration général
|
||||
.TP
|
||||
.I ~/.nanorc
|
||||
Fichier de configuration personnel
|
||||
@@ -348,29 +348,29 @@ Fichier de configuration personnel
|
||||
.TP
|
||||
\fBnano\fP(1)
|
||||
.PP
|
||||
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (ou son équivalent sur
|
||||
votre système)
|
||||
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (ou son équivalent sur
|
||||
votre système)
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fP et \fITHANKS\fP pour plus d'information). Cette page de
|
||||
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
|
||||
le système Debian (mais elle peut être utilisée par d'autres).
|
||||
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
|
||||
le système Debian (mais elle peut être utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir de
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir de
|
||||
la version 1.56 du 11\ octobre\ 2007 de la page de manuel de nanorc
|
||||
(pour la version 2.0.0 de nano). Cette page a été relue par Gérard
|
||||
(pour la version 2.0.0 de nano). Cette page a été relue par Gérard
|
||||
Delafond.
|
||||
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
traducteur.
|
||||
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
consultable via la commande\ :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
.\" Skeleton based on nano-tiny.1:
|
||||
.\" Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" Le travail d'adaptation française de cette page de manuel a été
|
||||
.\" réalisé par Jean-Philippe Guérard, en 2006 et 2007. Ce travail
|
||||
.\" Le travail d'adaptation française de cette page de manuel a été
|
||||
.\" réalisé par Jean-Philippe Guérard, en 2006 et 2007. Ce travail
|
||||
.\" d'adaptation est dans le domaine public. Attention, la page traduite
|
||||
.\" reste soumise au droit d'auteur de ses auteurs originaux.
|
||||
.\"
|
||||
.\" The French translation of this document is a public domain work of
|
||||
.\" Jean-Philippe Guérard. This translation work was made in 2006 and
|
||||
.\" Jean-Philippe Guérard. This translation work was made in 2006 and
|
||||
.\" 2007. The translated man page in itself is still subject to the
|
||||
.\" copyright of its original authors.
|
||||
.\"
|
||||
@@ -29,20 +29,20 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" Ce document est publié sous une double licence. Vous pouvez
|
||||
.\" Ce document est publié sous une double licence. Vous pouvez
|
||||
.\" le distribuer et le modifier selon les termes de l'une des deux
|
||||
.\" licences ci-dessous :
|
||||
.\" licences ci-dessous :
|
||||
.\"
|
||||
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
|
||||
.\" votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation. Vous devriez avoir reçu une copie de la
|
||||
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
|
||||
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
|
||||
.\" votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation. Vous devriez avoir reçu une copie de la
|
||||
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
|
||||
.\" le cas, consultez <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2 ou,
|
||||
.\" à votre choix, supérieure, telle que publiée par la Free
|
||||
.\" à votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation, sans section invariante, ni texte de
|
||||
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
|
||||
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
|
||||
.\" une copie de la Licence de documentation libre GNU avec ce
|
||||
.\" programme. Si ce n'est pas le cas, consultez
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
@@ -50,105 +50,105 @@
|
||||
.\" $Id$
|
||||
.TH RNANO 1 "version 2.0.0" "29\ novembre\ 20O7"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\"
|
||||
.SH NOM
|
||||
rnano \- Le mode restreint de NAno un NOuvel éditeur, un clone libre et
|
||||
amélioré de Pico
|
||||
rnano \- Le mode restreint de NAno un NOuvel éditeur, un clone libre et
|
||||
amélioré de Pico
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B rnano
|
||||
.I [OPTIONS]\ [[\+LIGNE,COLONNE]\ FICHIER]...
|
||||
.I [OPTIONS]\ [[+LIGNE,COLONNE]\ FICHIER]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement la commande \fBrnano\fR.
|
||||
Cette page de manuel décrit brièvement la commande \fBrnano\fR.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" respectively.
|
||||
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à
|
||||
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
|
||||
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à
|
||||
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
|
||||
\fBnano\fR ne se contentant pas de copier l'interface et l'ergonomie de
|
||||
Pico, il offre également certaines fonctions manquantes (ou désactivées
|
||||
par défaut) dans Pico. Ces fonctionnalités sont, par exemple, les
|
||||
fonctions de recherche et de remplacement, et la possibilité de sauter
|
||||
directement à une ligne et à une colonne précise..
|
||||
Pico, il offre également certaines fonctions manquantes (ou désactivées
|
||||
par défaut) dans Pico. Ces fonctionnalités sont, par exemple, les
|
||||
fonctions de recherche et de remplacement, et la possibilité de sauter
|
||||
directement à une ligne et à une colonne précise..
|
||||
.PP
|
||||
\fBrnano\fP est une version de \fBnano\fP fonctionnant en mode
|
||||
restreint, qui ne permet d'éditer que les fichiers indiqués et qui
|
||||
n'autorise pas l'utilisateur à accéder au système de fichier ou à un
|
||||
interpréteur de commandes.
|
||||
restreint, qui ne permet d'éditer que les fichiers indiqués et qui
|
||||
n'autorise pas l'utilisateur à accéder au système de fichier ou à un
|
||||
interpréteur de commandes.
|
||||
.PP
|
||||
En mode restreint, \fBnano\fP refusera\ :
|
||||
.IP \[bu] 2
|
||||
de lire ou d'écrire dans un fichier n'ayant pas été indiqué dans la
|
||||
de lire ou d'écrire dans un fichier n'ayant pas été indiqué dans la
|
||||
ligne de commande\ ;
|
||||
.IP \[bu]
|
||||
de lire un fichier nanorc\ ;
|
||||
.IP \[bu]
|
||||
de permettre de suspendre l'édition\ ;
|
||||
de permettre de suspendre l'édition\ ;
|
||||
.IP \[bu]
|
||||
de permettre d'ajouter en début ou en fin d'un fichier, ou de
|
||||
l'enregistrer sous un nom différent\ ;
|
||||
de permettre d'ajouter en début ou en fin d'un fichier, ou de
|
||||
l'enregistrer sous un nom différent\ ;
|
||||
.IP \[bu]
|
||||
l'utilisation de copies de sécurité ou de la correction orthographique.
|
||||
l'utilisation de copies de sécurité ou de la correction orthographique.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILIGNE\fP,\fICOLONNE\fP
|
||||
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
|
||||
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
|
||||
lieu de démarrer à la colonne\ 1, ligne\ 1.
|
||||
.B +\fILIGNE\fP,\fICOLONNE\fP
|
||||
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
|
||||
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
|
||||
lieu de démarrer à la colonne\ 1, ligne\ 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Identique à \fB-h (\-\-help)\fP.
|
||||
Identique à \fB\-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Affiche un résumé des options de lancement de nano, puis s'arrête.
|
||||
Affiche un résumé des options de lancement de nano, puis s'arrête.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Affiche la version, puis s'arrête.
|
||||
Affiche la version, puis s'arrête.
|
||||
.PP
|
||||
Reportez-vous à la page de manuel \fBnano\fP(1) si vous souhaitez
|
||||
consulter la documentation complète de \fBnano\fP.
|
||||
Reportez-vous à la page de manuel \fBnano\fP(1) si vous souhaitez
|
||||
consulter la documentation complète de \fBnano\fP.
|
||||
|
||||
.SH BOGUES
|
||||
Merci de nous faire parvenir vos commentaires et de nous signaler les
|
||||
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
|
||||
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
|
||||
|
||||
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
|
||||
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
|
||||
\fBnano-devel@gnu.org\fR.
|
||||
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
|
||||
|
||||
N'hésitez pas également à envoyez vos commentaires, suggestions et
|
||||
corrections relatives à l'adaptation française de cette page de manuel
|
||||
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
|
||||
N'hésitez pas également à envoyez vos commentaires, suggestions et
|
||||
corrections relatives à l'adaptation française de cette page de manuel
|
||||
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
|
||||
|
||||
.SH "SITE INTERNET"
|
||||
http://www.nano-editor.org/
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir le fichier
|
||||
\fIAUTHORS\fR). Cette page de manuel a été initialement rédigée par
|
||||
Thijs Kinkhorst <thijs@kinkhorst.com>, pour le système GNU Debian (mais
|
||||
elle peut être utilisée par d'autres).
|
||||
\fIAUTHORS\fR). Cette page de manuel a été initialement rédigée par
|
||||
Thijs Kinkhorst <thijs@kinkhorst.com>, pour le système GNU Debian (mais
|
||||
elle peut être utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
|
||||
de la version 1.19 du 6\ novembre\ 2007 de la page de manuel de rnano
|
||||
(pour la version 2.0.0 de nano).
|
||||
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
traducteur.
|
||||
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
consultable via la commande\ :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
|
||||
156
doc/man/nano.1
156
doc/man/nano.1
@@ -20,7 +20,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.3.5" "June 2014"
|
||||
.TH NANO 1 "version 2.5.0" "December 2015"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -29,8 +29,7 @@ nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.RI [ options "] [[\+" line , column "]\ " file "]..."
|
||||
.br
|
||||
.RI [ options "] [[+" line , column "]\ " file "]..."
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBnano\fP is a small, free and friendly editor which aims to replace
|
||||
@@ -39,72 +38,94 @@ top of copying Pico's look and feel, \fBnano\fP also implements some
|
||||
missing (or disabled by default) features in Pico, such as "search and
|
||||
replace" and "go to line and column number".
|
||||
|
||||
.SH EDITING
|
||||
Entering text and moving around in a file is straightforward: typing the
|
||||
letters and using the normal cursor movement keys. Commands are entered
|
||||
by using the Control (^) and the Alt or Meta (M-) keys.
|
||||
Typing \fB^K\fR deletes the current line and puts it in the cutbuffer.
|
||||
Consecutive \fB^K\fRs will put all deleted lines together in the cutbuffer.
|
||||
Any cursor movement or executing any other command will cause the next
|
||||
\fB^K\fR to overwrite the cutbuffer. A \fB^U\fR will paste the current
|
||||
contents of the cutbuffer at the current cursor position.
|
||||
.PP
|
||||
When a more precise piece of text needs to be cut or copied, one can mark
|
||||
its start with \fB^6\fR, move the cursor to its end (the marked text will be
|
||||
highlighted), and then use \fB^K\fR to cut it, or \fBM-6\fR to copy it to the
|
||||
cutbuffer. One can also save the marked text to a file with \fB^O\fR, or
|
||||
spell check it with \fB^T\fR.
|
||||
.PP
|
||||
The two lines at the bottom of the screen show the most important commands;
|
||||
the built-in help (\fB^G\fR) lists all the available ones.
|
||||
The default key bindings can be changed via the .nanorc file -- see
|
||||
.BR nanorc (5).
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fIline\fP,\fIcolumn\fP
|
||||
.B +\fIline\fP,\fIcolumn\fP
|
||||
Places the cursor on line number \fIline\fP and at column number \fIcolumn\fP
|
||||
(at least one of which must be specified) on startup, instead of the
|
||||
default line 1, column 1.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
.BR \-A ", " \-\-smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
.TP
|
||||
.B \-B (\-\-backup)
|
||||
When saving a file, back up the previous version of it to the current
|
||||
.BR \-B ", " \-\-backup
|
||||
When saving a file, back up the previous version of it, using the current
|
||||
filename suffixed with a tilde (\fB~\fP).
|
||||
.TP
|
||||
.B \-C \fIdir\fP (\-\-backupdir=\fIdir\fP)
|
||||
Set the directory where \fBnano\fP puts unique backup files, if file
|
||||
backups are enabled.
|
||||
.BR \-C\ \fIdirectory\fR ", " \-\-backupdir= \fIdirectory
|
||||
Make and keep not just one backup file, but make and keep a uniquely
|
||||
numbered one every time a file is saved -- when backups are enabled.
|
||||
The uniquely numbered files are stored in the specified \fIdirectory\fR.
|
||||
.TP
|
||||
.B \-D (\-\-boldtext)
|
||||
.BR \-D ", " \-\-boldtext
|
||||
Use bold text instead of reverse video text.
|
||||
.TP
|
||||
.B \-E (\-\-tabstospaces)
|
||||
.BR \-E ", " \-\-tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
.BR \-F ", " \-\-multibuffer
|
||||
Enable multiple file buffers (if support for them has been compiled in).
|
||||
.TP
|
||||
.B \-G (\-\-locking)
|
||||
.BR \-G ", " \-\-locking
|
||||
Enable vim-style file locking when editing files.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
.BR \-H ", " \-\-historylog
|
||||
Log search and replace strings to \fI~/.nano/search_history\fP, so they can be
|
||||
retrieved in later sessions.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
.BR \-I ", " \-\-ignorercfiles
|
||||
Don't look at the system's \fBnanorc\fP nor at \fB~/.nanorc\fP.
|
||||
.TP
|
||||
.B \-K (\-\-rebindkeypad)
|
||||
.BR \-K ", " \-\-rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
.TP
|
||||
.B \-L (\-\-nonewlines)
|
||||
.BR \-L ", " \-\-nonewlines
|
||||
Don't add newlines to the ends of files.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
.BR \-N ", " \-\-noconvert
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.B \-O (\-\-morespace)
|
||||
.BR \-O ", " \-\-morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
.B \-P (\-\-poslog)
|
||||
.BR \-P ", " \-\-positionlog
|
||||
Log and later read back the location of the cursor and place it there
|
||||
again.
|
||||
again. (The old form of this option, \fB\-\-poslog\fR, is deprecated.)
|
||||
.TP
|
||||
.B \-Q \fIstr\fP (\-\-quotestr=\fIstr\fP)
|
||||
.BR "\-Q ""\fIcharacters\fB""" ", " "\-\-quotestr=""" \fIcharacters\fR """
|
||||
Set the quoting string for justifying. The default is
|
||||
"\fI^([\ \\t]*[#:>\\|}])+\fP" if extended regular expression support is
|
||||
available, or "\fI>\ \fP" otherwise. Note that \fI\\t\fP stands for a
|
||||
\fB"^([\ \\t]*[#:>\\|}])+"\fP if extended regular expression support is
|
||||
available, or \fB">\ "\fP otherwise. Note that \fB\\t\fP stands for a
|
||||
Tab.
|
||||
.TP
|
||||
.B \-R (\-\-restricted)
|
||||
.BR \-R ", " \-\-restricted
|
||||
Restricted mode: don't read or write to any file not specified on the
|
||||
command line; don't read any \fInanorc\fP files nor history files;
|
||||
don't allow suspending nor spell checking;
|
||||
@@ -113,80 +134,80 @@ different name if it already has one; and don't use backup files.
|
||||
This restricted mode is also accessible by invoking \fBnano\fP
|
||||
with any name beginning with 'r' (e.g. "rnano").
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
.BR \-S ", " \-\-smooth
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
.TP
|
||||
.B \-T \fInumber\fP (\-\-tabsize=\fInumber\fP)
|
||||
.BR \-T\ \fInumber\fR ", " \-\-tabsize= \fInumber
|
||||
Set the size (width) of a tab to \fInumber\fP columns. The value of
|
||||
\fInumber\fP must be greater than 0. The default value is 8.
|
||||
.TP
|
||||
.B \-U (\-\-quickblank)
|
||||
.BR \-U ", " \-\-quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25. Note that \fB\-c\fP overrides this.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
.BR \-V ", " \-\-version
|
||||
Show the current version number and exit.
|
||||
.TP
|
||||
.B \-W (\-\-wordbounds)
|
||||
.BR \-W ", " \-\-wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
.TP
|
||||
.B \-Y \fIname\fP (\-\-syntax=\fIname\fP)
|
||||
.BR \-Y\ \fIname\fR ", " \-\-syntax= \fIname
|
||||
Specify the name of the syntax highlighting to use from among the ones
|
||||
defined in the \fInanorc\fP files.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
.BR \-c ", " \-\-constantshow
|
||||
Constantly show the cursor position. Note that this overrides \fB\-U\fP.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
.BR \-d ", " \-\-rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
.BR \-h ", " \-\-help
|
||||
Show a summary of the available command-line options and exit.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
.BR \-i ", " \-\-autoindent
|
||||
Indent new lines to the previous line's indentation. Useful when
|
||||
editing source code.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
.BR \-k ", " \-\-cut
|
||||
Make the 'Cut Text' command (normally ^K) cut from the current cursor
|
||||
position to the end of the line, instead of cutting the entire line.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
.BR \-l ", " \-\-nofollow
|
||||
If the file being edited is a symbolic link, replace the link with
|
||||
a new file instead of following it. Good for editing files in
|
||||
\fI/tmp\fP, perhaps?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
.BR \-m ", " \-\-mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
clicks can be used to place the cursor, set the mark (with a double
|
||||
click), and execute shortcuts. The mouse will work in the X Window
|
||||
System, and on the console when gpm is running. Text can still be
|
||||
selected through dragging by holding down the Shift key.
|
||||
.TP
|
||||
.B \-n (\-\-noread)
|
||||
.BR \-n ", " \-\-noread
|
||||
Treat any name given on the command line as a new file. This allows
|
||||
\fBnano\fR to write to named pipes: it will start with a blank buffer,
|
||||
and will write to the pipe when the user saves the "file". This way
|
||||
\fBnano\fR can be used as an editor in combination with for instance
|
||||
\fBgpg\fR without having to write sensitive data to disk first.
|
||||
.TP
|
||||
.B \-o \fIdir\fP (\-\-operatingdir=\fIdir\fP)
|
||||
.BR \-o\ \fIdirectory\fR ", " \-\-operatingdir= \fIdirectory
|
||||
Set the operating directory. This makes \fBnano\fP set up something
|
||||
similar to a chroot.
|
||||
.TP
|
||||
.B \-p (\-\-preserve)
|
||||
.BR \-p ", " \-\-preserve
|
||||
Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
|
||||
by the terminal.
|
||||
.TP
|
||||
.B \-q (\-\-quiet)
|
||||
.BR \-q ", " \-\-quiet
|
||||
Do not report errors in the \fInanorc\fP files nor ask them to be
|
||||
acknowledged by pressing Enter at startup.
|
||||
.TP
|
||||
.B \-r \fInumber\fP (\-\-fill=\fInumber\fP)
|
||||
.BR \-r\ \fInumber\fR ", " \-\-fill= \fInumber
|
||||
Hard-wrap lines at column \fInumber\fP. If this value is 0 or less, wrapping
|
||||
will occur at the width of the screen less \fInumber\fP columns, allowing
|
||||
the wrap point to vary along with the width of the screen if the screen
|
||||
@@ -194,36 +215,41 @@ is resized. The default value is \-8. This option conflicts with
|
||||
.B \-w
|
||||
-- the last one given takes effect.
|
||||
.TP
|
||||
.B \-s \fIprogram\fP (\-\-speller=\fIprogram\fP)
|
||||
Enable alternative spell checker command.
|
||||
.BR \-s\ \fIprogram\fR ", " \-\-speller= \fIprogram
|
||||
Use this alternative spell checker command.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
Always save changed buffer without prompting. Same as Pico's \fB\-t\fP
|
||||
.BR \-t ", " \-\-tempfile
|
||||
Always save a changed buffer without prompting. Same as Pico's \fB\-t\fP
|
||||
option.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
.BR \-u ", " \-\-unix
|
||||
Save a file by default in Unix format. This overrides nano's
|
||||
default behavior of saving a file in the format that it had.
|
||||
(This option has no effect when you also use \fB\-\-noconvert\fR.)
|
||||
.TP
|
||||
.BR \-v ", " \-\-view
|
||||
View-file (read-only) mode.
|
||||
.TP
|
||||
.B \-w (\-\-nowrap)
|
||||
.BR \-w ", " \-\-nowrap
|
||||
Disable the hard-wrapping of long lines. This option conflicts with
|
||||
.B \-r
|
||||
-- the last one given takes effect.
|
||||
.TP
|
||||
.B \-x (\-\-nohelp)
|
||||
.BR \-x ", " \-\-nohelp
|
||||
Don't show the two help lines at the bottom of the screen.
|
||||
.TP
|
||||
.B \-z (\-\-suspend)
|
||||
.BR \-z ", " \-\-suspend
|
||||
Enable the suspend ability.
|
||||
.TP
|
||||
.B \-$ (\-\-softwrap)
|
||||
.BR \-$ ", " \-\-softwrap
|
||||
Enable 'soft wrapping'. This will make \fBnano\fP attempt to display the
|
||||
entire contents of any line, even if it is longer than the screen width, by
|
||||
continuing it over multiple screen lines. Since
|
||||
\&'$' normally refers to a variable in the Unix shell, you should specify
|
||||
this option last when using other options (e.g. 'nano \-wS$') or pass it
|
||||
separately (e.g. 'nano \-wS \-$').
|
||||
this option last when using other options (e.g.\& 'nano \-wS$') or pass it
|
||||
separately (e.g.\& 'nano \-wS \-$').
|
||||
.TP
|
||||
.B \-a, \-b, \-e, \-f, \-g, \-j
|
||||
.BR \-a ", " \-b ", " \-e ", " \-f ", " \-g ", " \-j
|
||||
Ignored, for compatibility with Pico.
|
||||
|
||||
.SH INITIALIZATION FILE
|
||||
@@ -244,17 +270,19 @@ SIGTERM or runs out of memory. It will write the buffer into a file
|
||||
named \fInano.save\fP if the buffer didn't have a name already, or will
|
||||
add a ".save" suffix to the current filename. If an emergency file with
|
||||
that name already exists in the current directory, it will add ".save"
|
||||
plus a number (e.g. ".save.1") to the current filename in order to make
|
||||
plus a number (e.g.\& ".save.1") to the current filename in order to make
|
||||
it unique. In multibuffer mode, \fBnano\fP will write all the open
|
||||
buffers to their respective emergency files.
|
||||
|
||||
.SH BUGS
|
||||
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
|
||||
|
||||
The \fBnano\fP mailing list is available from \fBnano-devel@gnu.org\fP.
|
||||
|
||||
To subscribe, email to \fBnano-devel-request@gnu.org\fP with a subject
|
||||
of "subscribe".
|
||||
Justifications (\fB^J\fR) and reindentations (\fBM-{\fR and \fBM-}\fR)
|
||||
are not yet covered by the general undo system. So after a justification
|
||||
that is not immediately undone, or after any reindentation, earlier edits
|
||||
cannot be undone any more. The workaround is, of course, to exit without
|
||||
saving.
|
||||
.sp
|
||||
Please report any other bugs that you encounter via
|
||||
https://savannah.gnu.org/bugs/?group=nano.
|
||||
|
||||
.SH HOMEPAGE
|
||||
http://www.nano-editor.org/
|
||||
@@ -267,7 +295,7 @@ http://www.nano-editor.org/
|
||||
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see \fIAUTHORS\fP and
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see the files \fIAUTHORS\fP and
|
||||
\fITHANKS\fP for details). This manual page was originally written by
|
||||
Jordi Mallach <jordi@gnu.org>, for the Debian system (but may be used by
|
||||
others).
|
||||
|
||||
242
doc/man/nanorc.5
242
doc/man/nanorc.5
@@ -2,7 +2,7 @@
|
||||
.\" $Id$
|
||||
.\"
|
||||
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
|
||||
.\" 2013, 2014 Free Software Foundation, Inc.
|
||||
.\" 2013, 2014, 2015 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:
|
||||
@@ -20,7 +20,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.3.5" "June 2014"
|
||||
.TH NANORC 5 "version 2.5.0" "December 2015"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -38,38 +38,45 @@ commands, which can be used to configure nano on startup without using
|
||||
command-line options. Additionally, there are some commands to define
|
||||
syntax highlighting and to rebind keys -- see the two separate sections
|
||||
on those. \fBnano\fP reads one command per line.
|
||||
|
||||
.PP
|
||||
Options in \fInanorc\fP files take precedence over nano's defaults, and
|
||||
command-line options override \fInanorc\fP settings. Also, options are
|
||||
unset by default, except for those that take arguments.
|
||||
|
||||
Quotes inside string parameters don't have to be escaped with
|
||||
command-line options override \fInanorc\fP settings. Also, options that
|
||||
do not take an argument are unset by default. So using the \fBunset\fR
|
||||
command is only needed when wanting to override a setting of the system's
|
||||
\fInanorc\fR file in your own \fB~/.nanorc\fR. Options that take an
|
||||
argument cannot be unset.
|
||||
.PP
|
||||
Below, the \fIstring\fR parameters need to be enclosed in double quotes.
|
||||
Quotes inside these string parameters don't have to be escaped with
|
||||
backslashes. The last double quote in the string will be treated as its
|
||||
end. For example, for the \fBbrackets\fP option, "\fB"')>]}\fP" will
|
||||
match \fB"\fP, \fB'\fP, \fB)\fP, \fB>\fP, \fB]\fP, and \fB}\fP.
|
||||
|
||||
.PP
|
||||
The supported commands and arguments are:
|
||||
|
||||
.TP 3
|
||||
.B set/unset allow_insecure_backup
|
||||
.B set allow_insecure_backup
|
||||
When backing up files, allow the backup to succeed even if its permissions
|
||||
can't be (re)set due to special OS considerations. You should
|
||||
NOT enable this option unless you are sure you need it.
|
||||
.TP
|
||||
.B set/unset autoindent
|
||||
.B set autoindent
|
||||
Use auto-indentation.
|
||||
.TP
|
||||
.B set/unset backup
|
||||
Create backup files by adding a tilde (\fB~\fP) to each file's name.
|
||||
.B set backup
|
||||
When saving a file, create a backup file by adding a tilde (\fB~\fP) to
|
||||
the file's name.
|
||||
.TP
|
||||
.B set backupdir "\fIdirectory\fP"
|
||||
Set the directory where \fBnano\fP puts unique backup files, if file
|
||||
backups are enabled.
|
||||
Make and keep not just one backup file, but make and keep a uniquely
|
||||
numbered one every time a file is saved --- when backups are enabled
|
||||
with \fBset backup\fR or \fB\-\-backup\fR or \fB\-B\fR.
|
||||
The uniquely numbered files are stored in the specified \fIdirectory\fR.
|
||||
.TP
|
||||
.B set/unset backwards
|
||||
.B set backwards
|
||||
Do backwards searches by default.
|
||||
.TP
|
||||
.B set/unset boldtext
|
||||
.B set boldtext
|
||||
Use bold instead of reverse video for the titlebar, statusbar, key combos,
|
||||
and selected text. This can be overridden for the first three by setting
|
||||
the options \fBtitlecolor\fP, \fBstatuscolor\fP, and \fBkeycolor\fP.
|
||||
@@ -80,26 +87,27 @@ paragraphs. This may not include blank characters. Only closing
|
||||
punctuation (see \fBpunct\fP), optionally followed by the specified
|
||||
closing brackets, can end sentences. The default value is "\fB"')>]}\fP".
|
||||
.TP
|
||||
.B set/unset casesensitive
|
||||
.B set casesensitive
|
||||
Do case-sensitive searches by default.
|
||||
.TP
|
||||
.B set/unset const
|
||||
.B set constantshow
|
||||
Constantly display the cursor position in the status bar.
|
||||
(The old form of this option, '\fBset const\fR', is deprecated.)
|
||||
.TP
|
||||
.B set/unset cut
|
||||
.B set cut
|
||||
Use cut-to-end-of-line by default, instead of cutting the whole line.
|
||||
.TP
|
||||
.B set fill \fIn\fP
|
||||
Hard-wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the
|
||||
maximum line length will be the screen width less \fIn\fP columns. The
|
||||
default value is \-8.
|
||||
.B set fill \fInumber\fR
|
||||
Hard-wrap lines at column number \fInumber\fR. If \fInumber\fR is 0 or less,
|
||||
the maximum line length will be the screen width less \fInumber\fP columns.
|
||||
The default value is \fB\-8\fR.
|
||||
.TP
|
||||
.B set functioncolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the function descriptions
|
||||
in the two help lines at the bottom of the screen.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set/unset historylog
|
||||
.B set historylog
|
||||
Enable the use of \fB~/.nano/search_history\fP for saving and reading
|
||||
search/replace strings.
|
||||
.TP
|
||||
@@ -108,7 +116,7 @@ Specify the color combination to use for the shortcut key combos
|
||||
in the two help lines at the bottom of the screen.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set/unset locking
|
||||
.B set locking
|
||||
Enable vim-style lock-files for when editing files.
|
||||
.TP
|
||||
.B set matchbrackets "\fIstring\fP"
|
||||
@@ -117,32 +125,32 @@ searches. This may not include blank characters. The opening set must
|
||||
come before the closing set, and the two sets must be in the same order.
|
||||
The default value is "\fB(<[{)>]}\fP".
|
||||
.TP
|
||||
.B set/unset morespace
|
||||
.B set morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
.B set/unset mouse
|
||||
.B set mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
clicks can be used to place the cursor, set the mark (with a double
|
||||
click), and execute shortcuts. The mouse will work in the X Window
|
||||
System, and on the console when gpm is running. Text can still be
|
||||
selected through dragging by holding down the Shift key.
|
||||
.TP
|
||||
.B set/unset multibuffer
|
||||
Allow inserting files into their own buffers.
|
||||
.B set multibuffer
|
||||
When reading in a file with ^R, insert it into a new buffer by default.
|
||||
.TP
|
||||
.B set/unset noconvert
|
||||
.B set noconvert
|
||||
Don't convert files from DOS/Mac format.
|
||||
.TP
|
||||
.B set/unset nofollow
|
||||
.B set nofollow
|
||||
Don't follow symlinks when writing files.
|
||||
.TP
|
||||
.B set/unset nohelp
|
||||
.B set nohelp
|
||||
Don't display the two help lines at the bottom of the screen.
|
||||
.TP
|
||||
.B set/unset nonewlines
|
||||
.B set nonewlines
|
||||
Don't automatically add a newline to the ends of files.
|
||||
.TP
|
||||
.B set/unset nowrap
|
||||
.B set nowrap
|
||||
Don't hard-wrap text at all.
|
||||
.TP
|
||||
.B set operatingdir "\fIdirectory\fP"
|
||||
@@ -151,10 +159,11 @@ subdirectories. Also, the current directory is changed to here, so
|
||||
files are inserted from this directory. By default, the operating
|
||||
directory feature is turned off.
|
||||
.TP
|
||||
.B set/unset poslog
|
||||
.B set positionlog
|
||||
Save the cursor position of files between editing sessions.
|
||||
(The old form of this option, '\fBset poslog\fR', is deprecated.)
|
||||
.TP
|
||||
.B set/unset preserve
|
||||
.B set preserve
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
.TP
|
||||
.B set punct "\fIstring\fP"
|
||||
@@ -163,11 +172,11 @@ paragraphs. This may not include blank characters. Only the
|
||||
specfified closing punctuation, optionally followed by closing brackets
|
||||
(see \fBbrackets\fP), can end sentences. The default value is "\fB!.?\fP".
|
||||
.TP
|
||||
.B set/unset quickblank
|
||||
.B set quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
.TP
|
||||
.B set/unset quiet
|
||||
.B set quiet
|
||||
\fBnano\fP will not report errors in the \fInanorc\fP file nor ask them
|
||||
to be acknowledged by pressing Enter at startup. If this is used, it
|
||||
should be placed at the top of the file to be fully effective.
|
||||
@@ -180,30 +189,30 @@ otherwise a literal string. The default value is
|
||||
support, and "\fB>\ \fP" otherwise. Note that '\\t' stands for a literal
|
||||
Tab character.
|
||||
.TP
|
||||
.B set/unset rebinddelete
|
||||
.B set rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
.TP
|
||||
.B set/unset rebindkeypad
|
||||
.B set rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
.TP
|
||||
.B set/unset regexp
|
||||
.B set regexp
|
||||
Do extended regular expression searches by default.
|
||||
.TP
|
||||
.B set/unset smarthome
|
||||
.B set smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
.TP
|
||||
.B set/unset smooth
|
||||
.B set smooth
|
||||
Use smooth scrolling by default.
|
||||
.TP
|
||||
.B set/unset softwrap
|
||||
.B set softwrap
|
||||
Enable soft line wrapping for easier viewing of very long lines.
|
||||
.TP
|
||||
.B set speller "\fIspellprog\fP"
|
||||
@@ -214,17 +223,17 @@ calls \fIspell\fP.
|
||||
Specify the color combination to use for the statusbar.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set/unset suspend
|
||||
.B set suspend
|
||||
Allow \fBnano\fP to be suspended.
|
||||
.TP
|
||||
.B set tabsize \fIn\fP
|
||||
Use a tab size of \fIn\fP columns. The value of \fIn\fP must be greater
|
||||
than 0. The default value is 8.
|
||||
.B set tabsize \fInumber\fR
|
||||
Use a tab size of \fInumber\fR columns. The value of \fInumber\fP must be
|
||||
greater than 0. The default value is \fB8\fR.
|
||||
.TP
|
||||
.B set/unset tabstospaces
|
||||
.B set tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
.TP
|
||||
.B set/unset tempfile
|
||||
.B set tempfile
|
||||
Save automatically on exit, don't prompt.
|
||||
.TP
|
||||
.B set titlecolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
@@ -233,46 +242,62 @@ Valid color names for foreground and background are:
|
||||
.BR white , \ black , \ red , \ blue , \ green , \ yellow , \ magenta ", and " cyan .
|
||||
And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
|
||||
.TP
|
||||
.B set/unset view
|
||||
.B set unix
|
||||
Save a file by default in Unix format. This overrides nano's
|
||||
default behavior of saving a file in the format that it had.
|
||||
(This option has no effect when you also use \fBset noconvert\fR.)
|
||||
.TP
|
||||
.B set view
|
||||
Disallow file modification.
|
||||
.TP
|
||||
.B set whitespace "\fIstring\fP"
|
||||
Set the two characters used to indicate the presence of tabs and
|
||||
spaces. They must be single-column characters.
|
||||
.TP
|
||||
.B set/unset wordbounds
|
||||
.B set wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as parts of words.
|
||||
|
||||
.SH SYNTAX HIGHLIGHTING
|
||||
Coloring the different syntactic elements of a file
|
||||
can be defined via the following commands:
|
||||
is done via regular expressions (see the \fBcolor\fR command below).
|
||||
This is inherently imperfect, because regular expressions are not
|
||||
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
|
||||
A separate syntax can be defined for each kind of file
|
||||
via the following commands:
|
||||
.TP
|
||||
.BR syntax " ""\fIstr\fR"" [""\fIfileregex\fR"" ...]"
|
||||
Defines a syntax named \fIstr\fP which can be activated via the
|
||||
.BR \-Y / \-\-syntax
|
||||
command-line option, or will be automatically activated if
|
||||
the current filename matches the extended regular expression
|
||||
\fIfileregex\fP. All following \fBcolor\fP and \fBicolor\fP statements
|
||||
will apply to this \fIstr\fP syntax until a new syntax is defined.
|
||||
\fIfileregex\fP. All subsequent \fBcolor\fR, \fBicolor\fR,
|
||||
\fBheader\fR and other such statements will apply to this
|
||||
\fIstr\fP syntax until a new \fBsyntax\fR command is encountered.
|
||||
|
||||
The \fBnone\fP syntax is reserved; specifying it on the command line is
|
||||
the same as not having a syntax at all. The \fBdefault\fP syntax is
|
||||
special: it takes no \fIfileregex\fP, and applies to files that don't
|
||||
match any other syntax's \fIfileregex\fP.
|
||||
match any syntax's \fIfileregex\fP.
|
||||
.TP
|
||||
.BI linter " program " \fR[ "arg " \fR...]
|
||||
For the currently defined syntax, use the given \fIprogram\fR
|
||||
to invoke the linter (this overrides the speller function when
|
||||
defined).
|
||||
Use the given \fIprogram\fR to run a syntax check on the current file
|
||||
(this overrides the speller function when defined).
|
||||
.TP
|
||||
.BR header " [""\fIregex\fR"" ...]
|
||||
For the currently defined syntax, add one or more regexes which will
|
||||
.BI formatter " program " \fR[ "arg " \fR...]
|
||||
Use the given \fIprogram\fR to automatically reformat text.
|
||||
Useful in certain programming languages (e.g. Go).
|
||||
.TP
|
||||
.BR header " \fIregex\fR " ...
|
||||
Add one or more regexes which will
|
||||
be compared against the very first line of the file to be edited,
|
||||
to determine whether this syntax should be used for that file.
|
||||
.TP
|
||||
.BR magic " [""\fIregex\fR"" ...]
|
||||
For the currently defined syntax, add one or more regexes which
|
||||
.BR magic " \fIregex\fR " ...
|
||||
Add one or more regexes which
|
||||
will be compared against the result of querying the \fBmagic\fP
|
||||
database about the file to be edited, to determine whether this
|
||||
syntax should be used for that file. This
|
||||
@@ -280,7 +305,7 @@ functionality only works when \fBlibmagic\fP is installed on the
|
||||
system and will be silently ignored otherwise.
|
||||
.TP
|
||||
.B color \fIfgcolor\fR,\fIbgcolor\fR """\fIregex\fR""" ...
|
||||
For the currently defined syntax, display all expressions matching
|
||||
Display all pieces of text that match
|
||||
the extended regular expression \fIregex\fP with foreground color
|
||||
\fIfgcolor\fP and background color \fIbgcolor\fP, at least one of which
|
||||
must be specified. Valid colors for foreground and background
|
||||
@@ -291,34 +316,34 @@ foreground. If your terminal supports transparency, not specifying a
|
||||
background.
|
||||
.TP
|
||||
.B icolor \fIfgcolor\fR,\fIbgcolor\fR """\fIregex\fR""" ...
|
||||
Same as above, except that the expression matching is case insensitive.
|
||||
Same as above, except that the text matching is case insensitive.
|
||||
.TP
|
||||
.BR color " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIsr\fR"" " end= """\fIer\fR""
|
||||
Display expressions which start with the extended regular expression
|
||||
\fIsr\fP and end with the extended regular expression \fIer\fP with
|
||||
Display all pieces of text whose start matches extended regular expression
|
||||
\fIsr\fP and whose end matches extended regular expression \fIer\fP with
|
||||
foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
|
||||
at least one of which must be specified. This allows syntax
|
||||
highlighting to span multiple lines. Note that all subsequent instances
|
||||
of \fIsr\fP after an initial \fIsr\fP is found will be highlighted until
|
||||
the first instance of \fIer\fP.
|
||||
at least one of which must be specified. This means that, after an
|
||||
initial instance of \fIsr\fP, all text will be highlighted until the
|
||||
first instance of \fIer\fP. This allows syntax highlighting to span
|
||||
multiple lines.
|
||||
.TP
|
||||
.BR icolor " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIsr\fR"" " end= """\fIer\fR""
|
||||
Same as above, except that the expression matching is case insensitive.
|
||||
Same as above, except that the text matching is case insensitive.
|
||||
.TP
|
||||
.BR include " ""\fIsyntaxfile\fR"""
|
||||
Read in self-contained color syntaxes from \fIsyntaxfile\fP. Note that
|
||||
\fIsyntaxfile\fP can only contain the above commands, from \fBsyntax\fP
|
||||
\fIsyntaxfile\fP may contain only the above commands, from \fBsyntax\fP
|
||||
to \fBicolor\fP.
|
||||
.TP
|
||||
.BI extendsyntax " str directive " \fR[ "arg " \fR...]
|
||||
Extend the syntax previously defined as \fIstr\fP to include
|
||||
new information. This allows you to add a new \fIcolor\fP, \fIicolor\fP,
|
||||
\fImagic\fP, \fIheader\fP, or \fIlinter\fP directive to an already
|
||||
defined syntax -- useful when you want to add to definitions from the
|
||||
system-installed syntax definitions (which are normally not writable).
|
||||
|
||||
new information. This allows you to add a new \fBcolor\fP, \fBicolor\fP,
|
||||
\fBheader\fP, \fBmagic\fP, \fBlinter\fP, or \fBformatter\fP directive
|
||||
to an already defined syntax -- useful when you want to
|
||||
slightly improve a syntax defined in one of the system-installed
|
||||
files (which are normally not writable)
|
||||
.SH REBINDING KEYS
|
||||
Key bindings may be reassigned via the following commands:
|
||||
Key bindings can be changed via the following two commands:
|
||||
.TP
|
||||
.BI bind " key function menu"
|
||||
Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the
|
||||
@@ -331,7 +356,8 @@ menus where it exists by using \fBall\fP).
|
||||
|
||||
.TP
|
||||
The format of \fIkey\fP should be one of:
|
||||
.TP
|
||||
.RS 3
|
||||
.TP 3
|
||||
.B ^
|
||||
followed by an alpha character or the word "Space".
|
||||
Example: ^C
|
||||
@@ -343,10 +369,11 @@ Example: M-C
|
||||
.B F
|
||||
followed by a numeric value from 1 to 16.
|
||||
Example: F10
|
||||
.RE
|
||||
|
||||
.TP
|
||||
|
||||
Valid \fIfunction\fP names to be bound include:
|
||||
|
||||
Valid \fIfunction\fP names to be bound are:
|
||||
.RS 3
|
||||
.TP 2
|
||||
.B help
|
||||
Invokes the help viewer.
|
||||
@@ -358,18 +385,27 @@ Cancels the current command.
|
||||
Exits from the program (or from the help viewer or the file browser).
|
||||
.TP
|
||||
.B writeout
|
||||
Writes the current buffer to disk.
|
||||
Writes the current buffer to disk, asking for a name.
|
||||
.TP
|
||||
.B savefile
|
||||
Writes the current file to disk without prompting or warning.
|
||||
.TP
|
||||
.B insert
|
||||
Inserts a file into the current buffer (or into a new buffer when multibuffer
|
||||
is enabled).
|
||||
Inserts a file into the current buffer (at the current cursor position),
|
||||
or into a new buffer when option \fBmultibuffer\fR is set.
|
||||
.TP
|
||||
.B whereis
|
||||
Searches for text in the current buffer -- or for filenames matching
|
||||
a string in the current list in the file browser.
|
||||
.TP
|
||||
.B searchagain
|
||||
Repeats the last search command.
|
||||
Repeats the last search command without prompting.
|
||||
.TP
|
||||
.B findprevious
|
||||
As \fBsearchagain\fR, but always in the backward direction.
|
||||
.TP
|
||||
.B findnext
|
||||
As \fBsearchagain\fR, but always in the forward direction.
|
||||
.TP
|
||||
.B replace
|
||||
Interactively replaces text within the current buffer.
|
||||
@@ -387,6 +423,12 @@ current cursor position.
|
||||
.B mark
|
||||
Sets the mark at the current position, to start selecting text.
|
||||
.TP
|
||||
.B cutwordleft
|
||||
Cuts from the cursor position to the beginning of the preceding word.
|
||||
.TP
|
||||
.B cutwordright
|
||||
Cuts from the cursor position to the beginning of the next word.
|
||||
.TP
|
||||
.B cutrestoffile
|
||||
Cuts all text from the cursor position till the end of the buffer.
|
||||
.TP
|
||||
@@ -400,6 +442,9 @@ Counts the number of words, lines and characters in the current buffer.
|
||||
Invokes a spell-checking program (or a linting program, if the current
|
||||
syntax highlighting defines one).
|
||||
.TP
|
||||
.B linter
|
||||
A synonym of \fBspeller\fR (for when the speller has not been configured).
|
||||
.TP
|
||||
.B justify
|
||||
Justifies the current paragraph.
|
||||
.TP
|
||||
@@ -430,12 +475,12 @@ Scrolls up one line of text from the current position.
|
||||
.B scrolldown
|
||||
Scrolls down one line of text from the current position.
|
||||
.TP
|
||||
.B nextword
|
||||
Moves the cursor to the beginning of the next word.
|
||||
.TP
|
||||
.B prevword
|
||||
Moves the cursor to the beginning of the previous word.
|
||||
.TP
|
||||
.B nextword
|
||||
Moves the cursor to the beginning of the next word.
|
||||
.TP
|
||||
.B home
|
||||
Moves the cursor to the beginning of the current line.
|
||||
.TP
|
||||
@@ -464,17 +509,17 @@ Goes to the last line of the file.
|
||||
Goes to a specific line (and column if specified).
|
||||
.TP
|
||||
.B gototext
|
||||
Switches from targetting a line number to searching for text.
|
||||
Switches from targeting a line number to searching for text.
|
||||
.TP
|
||||
.B findbracket
|
||||
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
|
||||
(pairs) with the one under the cursor.
|
||||
.TP
|
||||
.B prevbuf
|
||||
Switches to editing/viewing the previous buffer when using multibuffer mode.
|
||||
Switches to editing/viewing the previous buffer when multiple buffers are open.
|
||||
.TP
|
||||
.B nextbuf
|
||||
Switches to editing/viewing the next buffer when using multibuffer mode.
|
||||
Switches to editing/viewing the next buffer when multiple buffers are open.
|
||||
.TP
|
||||
.B verbatim
|
||||
Inserts the next character verbatim into the file.
|
||||
@@ -595,10 +640,11 @@ Toggles whether long lines will be hard-wrapped to the next line.
|
||||
Toggles whether typed tabs will be converted to spaces.
|
||||
.TP
|
||||
.B backupfile
|
||||
Toggles whether a backup will be made of the file to be edited.
|
||||
Toggles whether a backup will be made of the file being edited.
|
||||
.TP
|
||||
.B multibuffer
|
||||
Toggles the use of multiple file buffers (if support for them has been compiled in).
|
||||
Toggles whether a file is inserted into the current buffer
|
||||
or read into a new buffer.
|
||||
.TP
|
||||
.B mouse
|
||||
Toggles mouse support.
|
||||
@@ -608,10 +654,11 @@ Toggles automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.B suspendenable
|
||||
Toggles whether the suspend sequence (normally ^Z) will suspend the editor window.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
|
||||
Valid \fImenu\fP sections are:
|
||||
|
||||
.RS 3
|
||||
.TP 2
|
||||
.B main
|
||||
The main editor window where text is entered and edited.
|
||||
@@ -659,6 +706,7 @@ The 'go to directory' menu in the file browser.
|
||||
A special name that encompasses all menus.
|
||||
For \fBbind\fR it means all menus where the specified \fIfunction\fR exists;
|
||||
for \fBunbind\fR it means all menus where the specified \fIkey\fR exists.
|
||||
.RE
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
.\" Skeleton based on nano-tiny.1:
|
||||
.\" Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
.\" $Id$
|
||||
.\"
|
||||
.\" Copyright (C) 2002, 2005, 2006, 2007, 2014 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:
|
||||
@@ -19,8 +19,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH RNANO 1 "version 2.3.3" "April 2014"
|
||||
.TH RNANO 1 "version 2.5.0" "December 2015"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -29,8 +28,7 @@ Pico clone
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B rnano
|
||||
.RI [ options "] [[\+" line , column "]\ " file "]..."
|
||||
.br
|
||||
.RI [ options "] [[+" line , column "]\ " file "]..."
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBnano\fP is a small, free and friendly editor which aims to replace
|
||||
@@ -43,7 +41,7 @@ replace" and "go to line and column number".
|
||||
specific files and doesn't allow the user access to the filesystem or a
|
||||
command shell.
|
||||
.PP
|
||||
In restricted mode, \fBnano\fP will \fInot\fP:
|
||||
In restricted mode, \fBnano\fP will \fInot\/\fP:
|
||||
.IP \[bu] 2
|
||||
read or write to any file not specified on the command line;
|
||||
.IP \[bu]
|
||||
@@ -58,14 +56,13 @@ use backup files or spell checking.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Show a summary of command line options and exit.
|
||||
.BR \-h ", " \-\-help
|
||||
Show a summary of command-line options and exit.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
.BR \-V ", " \-\-version
|
||||
Show the current version number and exit.
|
||||
.PP
|
||||
See the \fBnano\fP(1) manpage for the complete documentation of
|
||||
\fBnano\fP.
|
||||
See the \fBnano\fP(1) manpage for all of the possible options.
|
||||
|
||||
.SH BUGS
|
||||
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
|
||||
@@ -79,7 +76,7 @@ of "subscribe".
|
||||
http://www.nano-editor.org/
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS for details).
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see the file AUTHORS for details).
|
||||
This manual page was originally written by Thijs Kinkhorst
|
||||
<thijs@kinkhorst.com>, for the Debian system (but may be used by
|
||||
others).
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
|
||||
## Constantly display the cursor position in the statusbar. Note that
|
||||
## this overrides "quickblank".
|
||||
# set const
|
||||
# set constantshow
|
||||
## (The old form, 'const', is deprecated.)
|
||||
|
||||
## Use cut-to-end-of-line by default.
|
||||
# set cut
|
||||
@@ -104,7 +105,8 @@
|
||||
# set operatingdir ""
|
||||
|
||||
## Remember the cursor position in each file for the next editing session.
|
||||
# set poslog
|
||||
# set positionlog
|
||||
## (The old form, 'poslog', is deprecated.)
|
||||
|
||||
## Preserve the XON and XOFF keys (^Q and ^S).
|
||||
# set preserve
|
||||
@@ -165,10 +167,6 @@
|
||||
## Save automatically on exit; don't prompt.
|
||||
# set tempfile
|
||||
|
||||
## Enable the new (EXPERIMENTAL) generic undo code, not just for line
|
||||
## cuts.
|
||||
# set undo
|
||||
|
||||
## Disallow file modification. Why would you want this in an rcfile? ;)
|
||||
# set view
|
||||
|
||||
@@ -239,13 +237,15 @@
|
||||
|
||||
|
||||
## Key bindings.
|
||||
## See nanorc(5) for more details on this.
|
||||
## See nanorc(5) (section REBINDING KEYS) for more details on this.
|
||||
##
|
||||
## Here are a few samples to get you going.
|
||||
##
|
||||
# bind M-W nowrap main
|
||||
# bind M-A casesens search
|
||||
# bind ^S research main
|
||||
## The following five functions are not bound to any key by default.
|
||||
## You may wish to choose different keys than the ones suggested here.
|
||||
# bind ^S savefile main
|
||||
# bind M-Q findprevious main
|
||||
# bind M-W findnext main
|
||||
# bind M-B cutwordleft main
|
||||
# bind M-N cutwordright main
|
||||
|
||||
## Set this if your backspace key sends Del most of the time.
|
||||
## Set this if your Backspace key sends Del most of the time.
|
||||
# bind Del backspace all
|
||||
|
||||
@@ -6,10 +6,12 @@ pkgdata_DATA = asm.nanorc \
|
||||
css.nanorc \
|
||||
debian.nanorc \
|
||||
default.nanorc \
|
||||
elisp.nanorc \
|
||||
fortran.nanorc \
|
||||
gentoo.nanorc \
|
||||
go.nanorc \
|
||||
groff.nanorc \
|
||||
guile.nanorc \
|
||||
html.nanorc \
|
||||
java.nanorc \
|
||||
javascript.nanorc \
|
||||
@@ -26,6 +28,7 @@ pkgdata_DATA = asm.nanorc \
|
||||
perl.nanorc \
|
||||
php.nanorc \
|
||||
po.nanorc \
|
||||
postgresql.nanorc \
|
||||
pov.nanorc \
|
||||
python.nanorc \
|
||||
ruby.nanorc \
|
||||
|
||||
28
doc/syntax/autoconf.nanorc
Normal file
28
doc/syntax/autoconf.nanorc
Normal file
@@ -0,0 +1,28 @@
|
||||
## Here is an example for Autoconf.
|
||||
|
||||
syntax "autoconf" "\.ac$"
|
||||
|
||||
# Keywords:
|
||||
color yellow "\<(if|test|then|else|fi|for|in|do|done)\>"
|
||||
color yellow "(=|!=|&&|\|\|)"
|
||||
|
||||
# Macros:
|
||||
color cyan "\<[[:upper:]_[:digit:]]+\>"
|
||||
|
||||
# Version numbers:
|
||||
color red "\<[-_.0-9]+\>"
|
||||
|
||||
# Strings:
|
||||
color red "\"[^"]*\"" "\'[^']*\'"
|
||||
|
||||
# Backticks:
|
||||
color green "`[^`]*`"
|
||||
|
||||
# Error lines:
|
||||
color black "^\*\*\*.*"
|
||||
|
||||
# Brackets:
|
||||
color magenta "\[|\]|\(|\)"
|
||||
|
||||
# Comments:
|
||||
color blue "^[[:blank:]]*#.*" "^dnl.*"
|
||||
@@ -9,17 +9,20 @@ color red "^(19|20)[0-9-]{8}"
|
||||
# Email addresses.
|
||||
color yellow "<[^>]*@[^>]*>"
|
||||
|
||||
# Changed files.
|
||||
color magenta "[[:space:]]\*[[:space:]].*:"
|
||||
|
||||
# Command-line options.
|
||||
color cyan "[[:space:]]-[a-zA-Z\$]" "--[8a-z-]+"
|
||||
# Bug numbers.
|
||||
color cyan "bug #[0-9]{5}"
|
||||
# Probable variables, for variety.
|
||||
# Bug and patch numbers.
|
||||
color cyan "bug #[0-9]{5,9}" "patch #[0-9]{4,9}"
|
||||
# Probable constants, for variety.
|
||||
color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
||||
# Key sequences.
|
||||
color brightblue "\^[A-Z]" "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
|
||||
|
||||
# Changed files.
|
||||
color magenta start="^( | {8})\* " end="(:( |$)|^$)"
|
||||
|
||||
# Release markers.
|
||||
color brightblue "^(GNU )?nano[- ][0-9]\.[0-9]\.[^ ]+"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
## Here is an example for apt's sources.list.
|
||||
|
||||
syntax "apt/sources.list" "sources\.list(\.old|~)?$"
|
||||
syntax "sources.list" "sources\.list(~|\.old|\.save)?$" "sources\.list\.d/.*\.list(~|\.old|\.save)?$"
|
||||
|
||||
# Coloring the deb lines, working from tail to head. First the
|
||||
# components -- well, everything, and thus also the components.
|
||||
color brightmagenta "^deb.*"
|
||||
# Distribution -- well, everything, except the components.
|
||||
color brightred "^deb(-src)? ((http|ftp|rsh|ssh|file|copy):/[^ ]+|cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/) [^ ]+"
|
||||
color brightred "^deb(-src)?\s+.*((ftp|https?|rsh|ssh|copy|file|spacewalk|tor):/\S+|cdrom:\[.+\]/)\s+\S+"
|
||||
# URIs.
|
||||
color brightgreen "(http|ftp|rsh|ssh|file|copy):/[^ ]+"
|
||||
color brightgreen "^deb(-src)?\s+.*(ftp|https?|rsh|ssh|copy|file|spacewalk|tor):/\S+"
|
||||
# CDroms.
|
||||
color brightgreen "cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/"
|
||||
color brightgreen "^deb(-src)?\s+.*cdrom:\[.+\]/"
|
||||
# Options.
|
||||
color brightcyan "^deb(-src)?\s+\[.+\]\s+"
|
||||
# And finally the initial deb tag.
|
||||
color yellow "^deb(-src)?"
|
||||
|
||||
# Comments.
|
||||
color brightblue "#.*"
|
||||
|
||||
|
||||
31
doc/syntax/elisp.nanorc
Normal file
31
doc/syntax/elisp.nanorc
Normal file
@@ -0,0 +1,31 @@
|
||||
## Here is an example for Emacs Lisp.
|
||||
|
||||
syntax "elisp" "\.el$"
|
||||
|
||||
# Basic functions/macros
|
||||
color brightcyan "\<(if|when|unless|cond|and|or|lambda|let|progn|while|dolist|dotimes)\>"
|
||||
color brightcyan "\<save-((window-)?excursion|restriction)\>"
|
||||
color brightcyan "\<eval-(and|when)-compile\>"
|
||||
# Defining functions
|
||||
color brightcyan "\<def(un|macro|subst|generic|alias)\>"
|
||||
color brightcyan "\<cl-def(un|macro|subst|generic|struct|type)\>"
|
||||
color brightcyan "\<define-(derived|minor|generic)-mode\>"
|
||||
# Defining variables
|
||||
color brightcyan "\<def(class|const|var(-local|alias)?)\>"
|
||||
# Customization functions
|
||||
color brightcyan "\<def(custom|face|group|theme)\>"
|
||||
# Setting values
|
||||
color brightcyan "\<(setq(-default|-local)?|setf|push|pop|declare(-function)?)\>"
|
||||
# Feature functions
|
||||
color brightcyan "\<(require|provide)\>"
|
||||
# Quoted symbols
|
||||
color brightyellow "#?'\<(\w|-)+\>"
|
||||
# Booleans
|
||||
color brightred "\<(t|nil)\>"
|
||||
# Keywords
|
||||
color blue ":(\w|[?-])+"
|
||||
# Strings
|
||||
color yellow start="^[[:blank:]]+\"" end="[^\]\""
|
||||
color yellow ""(\\.|[^"])*""
|
||||
# Comments
|
||||
color cyan "(^|[[:space:]]);.*$"
|
||||
@@ -40,3 +40,6 @@ color brightblue start="/\*" end="\*/"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
# Set up the formatter since spelling is probably useless...
|
||||
formatter gofmt -w
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
syntax "groff" "\.m[ems]$" "\.rof" "\.tmac$" "^tmac."
|
||||
|
||||
# The argument of .ds or .nr
|
||||
color cyan "^\.(ds|nr) [^[[:space:]]]*"
|
||||
color cyan "^\.(ds|nr) [^[:space:]]*"
|
||||
# Single-character escapes
|
||||
color brightmagenta "\\."
|
||||
# The argument of \f or \s in the same color
|
||||
@@ -12,7 +12,7 @@ color brightmagenta "\\f." "\\f\(.." "\\s(\+|\-)?[0-9]"
|
||||
color cyan "(\\|\\\\)n(.|\(..)"
|
||||
color cyan start="(\\|\\\\)n\[" end="]"
|
||||
# Requests
|
||||
color brightgreen "^\.[[:space:]]*[^[[:space:]]]*"
|
||||
color brightgreen "^\.[[:space:]]*[^[:space:]]*"
|
||||
# Comments
|
||||
color yellow "^\.\\".*$"
|
||||
# Strings
|
||||
|
||||
24
doc/syntax/guile.nanorc
Normal file
24
doc/syntax/guile.nanorc
Normal file
@@ -0,0 +1,24 @@
|
||||
## Here is an example for Guile Scheme.
|
||||
|
||||
syntax "guile" "\.scm$"
|
||||
header "^#!.*guile"
|
||||
magic "guile"
|
||||
|
||||
# Basic scheme functions
|
||||
color green "\<(do|if|lambda|let(rec)?|map|unless|when)\>"
|
||||
# Defining things
|
||||
color brightcyan "\<define(-macro|-module|-public|-syntax)?\>"
|
||||
# Quoted symbols
|
||||
color brightyellow "'\<(\w|-)+\>"
|
||||
# Chars
|
||||
color brightmagenta "#\\."
|
||||
color brightmagenta "#\\\w+\>"
|
||||
# Booleans
|
||||
color brightred "(#t|#f)\>"
|
||||
# Keywords
|
||||
color blue "#?:(\w|[?-])+"
|
||||
# Strings
|
||||
color yellow start="^[[:blank:]]+\"" end="[^\]\""
|
||||
color yellow ""(\\.|[^"])*""
|
||||
# Comments
|
||||
color cyan "(^|[[:space:]]);.*$"
|
||||
@@ -5,7 +5,8 @@ magic "Java "
|
||||
|
||||
color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
|
||||
color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
|
||||
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
|
||||
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native)\>"
|
||||
color cyan "\<(package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
|
||||
color red ""[^"]*""
|
||||
color yellow "\<(true|false|null)\>"
|
||||
color blue "//.*"
|
||||
|
||||
@@ -15,18 +15,20 @@ color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
|
||||
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|break)\>"
|
||||
|
||||
# Keywords
|
||||
color brightyellow "\<(debug|string|math|table|io|coroutine|os)\>\."
|
||||
color brightyellow "\<(io|math|os|string|table|coroutine|debug)\>\."
|
||||
color brightyellow "\<(_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\("
|
||||
|
||||
# Standard library
|
||||
color brightyellow "io\.\<(close|flush|input|lines|open|output|popen|read|tmpfile|type|write|stdin|stdout|stderr)\>"
|
||||
color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
|
||||
color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log)\>"
|
||||
color brightyellow "math\.\<(max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
|
||||
color brightyellow "os\.\<(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>"
|
||||
color brightyellow "package\.\<(cpath|loaded|loadlib|path|preload|seeall)\>"
|
||||
color brightyellow "string\.\<(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)\>"
|
||||
color brightyellow "table\.\<(concat|insert|maxn|remove|sort)\>"
|
||||
color brightyellow "coroutine\.\<(create|resume|running|status|wrap|yield)\>"
|
||||
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
|
||||
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue)\>"
|
||||
color brightyellow "debug\.\<(setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
|
||||
|
||||
# File handle methods
|
||||
color brightyellow "\:\<(close|flush|lines|read|seek|setvbuf|write)\>"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for Makefiles.
|
||||
|
||||
syntax "makefile" "Makefile[^/]*$"
|
||||
syntax "makefile" "Makefile[^/]*$" "\.(make|mk)$"
|
||||
|
||||
color red "[:=]"
|
||||
color magenta "\<(if|ifeq|else|endif)\>"
|
||||
|
||||
@@ -6,13 +6,13 @@ syntax "nanorc" "\.?nanorc$"
|
||||
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|i?color|extendsyntax).*$"
|
||||
|
||||
# Keywords
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|poslog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|undo|view|wordbounds)\>"
|
||||
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor||statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const(antshow)?|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|pos(ition)?log|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|unix|view|wordbounds)\>"
|
||||
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor|statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace)[[:space:]]+"
|
||||
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+[[:alpha:]]+[[:space:]]*$"
|
||||
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]*$"
|
||||
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|linter)[[:space:]]+.*$"
|
||||
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|extendsyntax)\>"
|
||||
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)+[[:space:]]*$"
|
||||
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)+[[:space:]]*$"
|
||||
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|linter|formatter)[[:space:]]+.*$"
|
||||
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|formatter|extendsyntax)\>"
|
||||
|
||||
# Colors
|
||||
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
|
||||
29
doc/syntax/nftables.nanorc
Normal file
29
doc/syntax/nftables.nanorc
Normal file
@@ -0,0 +1,29 @@
|
||||
## Here is an example for nftables.
|
||||
|
||||
syntax "nftables" "\.(nft|nftables)$"
|
||||
header "^#!.*(nft|nftables)"
|
||||
|
||||
# Objects and operations
|
||||
color green "\<(chain|hook|policy|priority|ruleset|set|table|type|v?map)\>"
|
||||
color green "\<(define|include)\>"
|
||||
color red "\<(add|delete|flush|insert|remove|replace)\>"
|
||||
|
||||
# Families
|
||||
color yellow "\<(arp|bridge|inet|ip6?)\>"
|
||||
|
||||
# Terminal statements
|
||||
color red "\<(drop|reject)\>"
|
||||
color brightblue "\<(accept|continue|(d|s)nat|goto|jump|masquerade|return)\>"
|
||||
|
||||
# Comments
|
||||
color cyan "(^|[[:space:]])#.*$"
|
||||
|
||||
# Trailing whitespace
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
# Strings and others
|
||||
color yellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
|
||||
color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
|
||||
|
||||
# Basic variable names
|
||||
color brightred "\$[[:alpha:]_][[:alnum:]_.]*"
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for patch files.
|
||||
|
||||
syntax "patch" "\.(patch|diff)$"
|
||||
syntax "patch" "\.(patch|diff|debdiff)$"
|
||||
magic "diff output text"
|
||||
|
||||
# Added lines.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## Here is an example for Perl.
|
||||
|
||||
syntax "perl" "\.p[lm]$"
|
||||
header "^#!.*/perl[-0-9._]*"
|
||||
header "^#!.*perl[-0-9._]*"
|
||||
magic "Perl script text"
|
||||
|
||||
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)\>"
|
||||
|
||||
@@ -25,7 +25,7 @@ color brightyellow "<[^= ]*>" ""(\.|[^"])*""
|
||||
color brightblue "//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
##color blue start="<" end=">"
|
||||
##color red "&[^;[[:space:]]]*;"
|
||||
##color red "&[^;[:space:]]*;"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -6,16 +6,16 @@ syntax "po" "\.pot?$"
|
||||
color green "^#.*$"
|
||||
color yellow "Copyright|\(C\)"
|
||||
# Header fields.
|
||||
color brightmagenta "\<(Project\-Id\-Version|Report\-Msgid\-Bugs\-To|Last\-Translator|Language\-Team|Language|X\-Generator|Plural\-Forms)\>"
|
||||
color brightmagenta "\<(Project\-Id\-Version|Report\-Msgid\-Bugs\-To|Last\-Translator|Language(\-Team)?|X\-Generator|Plural\-Forms)\>"
|
||||
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"
|
||||
# Msgids.
|
||||
color brightblue "\<(msgid|msgid_plural|msgstr)\>"
|
||||
color brightblue "^(msgid|msgid_plural|msgstr)\>"
|
||||
# Tags.
|
||||
color red "\<fuzzy\>"
|
||||
color yellow "\<c-format\>"
|
||||
color red " fuzzy(,|$)"
|
||||
color yellow " (no-)?[-[:alpha:]]+-format(,|$)"
|
||||
# Format specifiers.
|
||||
color brightmagenta "%([1-9]\$)?[a-z]*"
|
||||
# Quotes and newlines.
|
||||
|
||||
75
doc/syntax/postgresql.nanorc
Normal file
75
doc/syntax/postgresql.nanorc
Normal file
@@ -0,0 +1,75 @@
|
||||
## Here is an example for PostgreSQL.
|
||||
|
||||
syntax "sql" "\.sql[2345s~]?$"
|
||||
magic "PostgreSQL script text"
|
||||
|
||||
# Functions.
|
||||
color white "\<[a-z_]*\("
|
||||
|
||||
# Types.
|
||||
color green "\<(int2|smallint|int4|int|integer|int8|bigint|decimal|numeric|real|double precision|(small|big)?serial)\>"
|
||||
color green "\<(bit( varying)?|boolean|bytea|enum|money|tsvector|uuid)\>"
|
||||
color green "\<(char|varchar|character( varying)?|text)\>"
|
||||
color green "\<(date|interval|time(stamp)?( with time zone| without time zone)?)\>"
|
||||
color green "\<(point|line|lseg|path|box|polygon|circle)\>"
|
||||
color green "\<(cidr|inet|macaddr)\>"
|
||||
color green "\<(daterange|int4range|int8range|numrange|tsrange|tstzrange)\>"
|
||||
|
||||
# Structure.
|
||||
color brightyellow "\<(CASE|CLASS|DEFAULT|DO|ELSE|ELSEIF|FOR|FOREACH|FUNCTION|IF|IS NULL)\>"
|
||||
color brightyellow "\<(NEW|PRIVATE|PUBLIC|RETURN|RETURNS|SETOF|SWITCH|THEN|WHEN|WHILE)>"
|
||||
|
||||
# Control flow.
|
||||
color magenta "\<(EXCEPTION|NOTICE|RAISE|RETURN)\>"
|
||||
|
||||
# SQL keywords.
|
||||
color blue "\<(ABORT|AGGREGATE|ALTER|ANALYZE|AND|AS|AUTHORIZATION|BEGIN|CAST|CHECKPOINT|CLASS|CLOSE)\>"
|
||||
color blue "\<(CLUSTER|COLLATION|COMMENT|COMMIT|CONFIGURATION|CONSTRAINTS|CONVERSION|COPY|CREATE)\>"
|
||||
color blue "\<(DATA|DATABASE|DEALLOCATE|DECLARE|DEFAULT|DELETE|DICTIONARY|DISCARD|DO|DOMAIN|DROP)\>"
|
||||
color blue "\<(END|EVENT|EXECUTE|EXPLAIN|EXTENSION|FAMILY|FETCH|FOREIGN|FROM|FUNCTION)\>"
|
||||
color blue "\<(GRANT|GROUP|IF NOT EXISTS|IMMUTABLE|INDEX|INSERT|INTO|LABEL|LANGUAGE|LARGE|LOAD|LOCK)\>"
|
||||
color blue "\<(MAPPING FOR|MATERIALIZED|MOVE|NOTIFY|OBJECT|OPERATOR|OPTIONS|OWNED|OWNER)\>"
|
||||
color blue "\<(PARSER|PREPARED?|PRIVILEGES|REASSIGN|REFRESH|RELEASE|RESET|REVOKE|ROLE|ROLLBACK|RULE)\>"
|
||||
color blue "\<(SAVEPOINT|SCHEMA|SEARCH|SECURITY|SELECT|SEQUENCE|SERVER|SESSION|SET|SHOW|SPACE|START|SYSTEM)\>"
|
||||
color blue "\<(TABLE|TEXT|TO|TRANSACTION|TYPE|UPDATE|USER|VACUUM|VALUES|VIEW|WHERE|WITH|WRAPPER)\>"
|
||||
|
||||
# Strings.
|
||||
color brightyellow "<[^= ]*>" ""(\.|[^"])*""
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
# Regular expressions.
|
||||
color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
|
||||
|
||||
# Shell command expansion is in `backticks` or like %x{this}. These are
|
||||
# "double-quotish" (to use a perlism).
|
||||
color brightblue "`[^`]*`" "%x\{[^}]*\}"
|
||||
|
||||
# Strings, double-quoted.
|
||||
color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>"
|
||||
color green "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
|
||||
|
||||
# Expression substitution. These go inside double-quoted strings,
|
||||
# "like #{this}".
|
||||
color brightgreen "#\{[^}]*\}"
|
||||
|
||||
# Strings, single-quoted.
|
||||
color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>"
|
||||
color green "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
|
||||
|
||||
# Comments.
|
||||
color red "#[^{].*$" "#$"
|
||||
color red "--[^{].*$" "#$"
|
||||
color red "##[^{].*$" "##$"
|
||||
color brightblue "//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
|
||||
# PostgreSQL markings.
|
||||
color red "(--)"
|
||||
|
||||
# PostgreSQL default schemas.
|
||||
color brightred "(pg_catalog|public)"
|
||||
|
||||
# PostgreSQL PLs.
|
||||
color brightblue "(pljava|plperlu?|plpgsql|plpy|plpythonu?|plr|plruby|plsh|pltcl|plscheme)"
|
||||
@@ -1,22 +1,24 @@
|
||||
## Here is an example for Python.
|
||||
|
||||
syntax "python" "\.py$"
|
||||
header "^#!.*/python[-0-9._]*"
|
||||
header "^#!.*python[-0-9._]*"
|
||||
linter pyflakes
|
||||
|
||||
# Function definitions.
|
||||
icolor brightblue "def [0-9A-Z_]+"
|
||||
# Keywords.
|
||||
color brightcyan "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
|
||||
|
||||
# Strings.
|
||||
color brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
|
||||
color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
|
||||
# Multiline strings.
|
||||
color brightgreen start="\"\"\"([^"),]|$)" end="(^|[^(])\"\"\""
|
||||
color brightgreen start="'''([^'),]|$)" end="(^|[^(])'''"
|
||||
color brightcyan "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from)\>"
|
||||
color brightcyan "\<(global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
|
||||
|
||||
# Single-quoted strings.
|
||||
color brightgreen "'([^'\]|\\.)+'"
|
||||
color brightgreen ""([^"\]|\\.)+""
|
||||
# Comments.
|
||||
color brightred "(^|[[:blank:]])#.*$"
|
||||
# Triple-quoted strings.
|
||||
color brightgreen start="'''[^'),]" end="(^|[^(\])'''"
|
||||
color brightgreen start="\"\"\"[^"),]" end="(^|[^(\])\"\"\""
|
||||
|
||||
# Reminders.
|
||||
color ,yellow "(FIXME|TODO|XXX)"
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
## Here is an example for Ruby.
|
||||
|
||||
syntax "ruby" "\.rb$"
|
||||
header "^#!.*/ruby[-0-9._]*"
|
||||
header "^#!.*ruby[-0-9._]*"
|
||||
linter ruby -w -c
|
||||
|
||||
# Asciibetical list of reserved words.
|
||||
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
|
||||
# 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".
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
## Here is an example for Bourne shell scripts.
|
||||
|
||||
syntax "sh" "\.sh$"
|
||||
header "^#!.*/(ba|k|pdk)?sh[-0-9_]*"
|
||||
header "^#!.*((ba|da|k|pdk)?sh[-0-9_]*|openrc-run|runscript)"
|
||||
magic "(POSIX|Bourne.*) shell script text"
|
||||
linter dash -n
|
||||
|
||||
icolor brightgreen "^[0-9A-Z_]+\(\)"
|
||||
color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"
|
||||
|
||||
@@ -24,8 +24,8 @@ color yellow start="%__" end="\ "
|
||||
color magenta start="%\{" end="\}"
|
||||
color yellow start="%\{__" end="\}"
|
||||
# Sections.
|
||||
color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|preun|post|postun)"
|
||||
color red "^%(trigger|triggerin|triggerpostun|triggerun|verifyscript)"
|
||||
color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|pretrans|preun)"
|
||||
color red "^%(post|posttrans|postun|trigger|triggerin|triggerpostun|triggerun|verifyscript)"
|
||||
# Conditionals and defines.
|
||||
color brightred "%(if|else|endif|define|global|undefine)"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is a short example for TeX files.
|
||||
|
||||
syntax "tex" "\.tex$"
|
||||
linter chktex -v0 -q -I
|
||||
|
||||
icolor green "\\.|\\[A-Z]*"
|
||||
color magenta "[{}]"
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
## Here is an example for XML files.
|
||||
|
||||
syntax "xml" "\.([jrs]html?|sgml?|xml|xslt?)$"
|
||||
syntax "xml" "\.([jrsx]html?|jnlp|mml|pom|rng|sgml?|svg|w[as]dl|wsdd|xjb|xml|xs(d|lt?)|xul)$"
|
||||
magic "(XML|SGML) (sub)?document text"
|
||||
|
||||
# The entire content of the tag:
|
||||
color green start="<" end=">"
|
||||
color cyan "<[^> ]+"
|
||||
color cyan ">"
|
||||
|
||||
# The start and the end of the tag:
|
||||
color cyan "<[^> ]+" ">"
|
||||
|
||||
# The strings inside the tag:
|
||||
color magenta "\"[^"]*\""
|
||||
|
||||
# Comments:
|
||||
color yellow start="<!DOCTYPE" end="[/]?>"
|
||||
color yellow start="<!--" end="-->"
|
||||
|
||||
# Escapes:
|
||||
color red "&[^;]*;"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
25
nano.spec.in
25
nano.spec.in
@@ -2,20 +2,24 @@
|
||||
%define version @VERSION@
|
||||
%define release 1
|
||||
|
||||
Summary : Pico editor clone with enhancements
|
||||
Name : %{name}
|
||||
Version : %{version}
|
||||
Release : %{release}
|
||||
Summary : a user-friendly editor, a Pico clone with enhancements
|
||||
|
||||
License : GPLv3+
|
||||
Group : Applications/Editors
|
||||
URL : http://www.nano-editor.org/
|
||||
Source : http://www.nano-editor.org/dist/v2.3/%{name}-%{version}.tar.gz
|
||||
Source : http://www.nano-editor.org/dist/v2.4/%{name}-%{version}.tar.gz
|
||||
|
||||
BuildRoot : %{_tmppath}/%{name}-%{version}-root
|
||||
BuildRequires : autoconf, automake, gettext-devel, ncurses-devel
|
||||
BuildRequires : autoconf, automake, gettext-devel, ncurses-devel, texinfo
|
||||
Requires(post) : info
|
||||
Requires(preun) : info
|
||||
|
||||
%description
|
||||
GNU nano is a small and friendly text editor. It aims to emulate the
|
||||
Pico text editor while also offering a few enhancements.
|
||||
Pico text editor while also offering several enhancements.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
@@ -26,13 +30,22 @@ make
|
||||
|
||||
%install
|
||||
make DESTDIR="%{buildroot}" install
|
||||
#ln -s nano %{buildroot}%{_bindir}/pico
|
||||
rm -f %{buildroot}%{_infodir}/dir
|
||||
#ln -s nano %{buildroot}/%{_bindir}/pico
|
||||
rm -f %{buildroot}/%{_infodir}/dir
|
||||
|
||||
%post
|
||||
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
|
||||
|
||||
%preun
|
||||
if [ $1 = 0 ] ; then
|
||||
/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO doc/faq.html doc/nanorc.sample
|
||||
%{_bindir}/*
|
||||
%{_docdir}/nano/*
|
||||
%{_mandir}/man*/*
|
||||
%{_mandir}/fr/man*/*
|
||||
%{_infodir}/nano.info*
|
||||
|
||||
1307
po/nano.pot
1307
po/nano.pot
File diff suppressed because it is too large
Load Diff
2321
po/pt_BR.po
2321
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1335
po/zh_CN.po
1335
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
1322
po/zh_TW.po
1322
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
365
src/browser.c
365
src/browser.c
@@ -3,7 +3,8 @@
|
||||
* browser.c *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
|
||||
* 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* 2010, 2011, 2013, 2014, 2015 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -23,6 +24,7 @@
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@@ -39,10 +41,9 @@ static int width = 0;
|
||||
static int longest = 0;
|
||||
/* The number of columns in the longest filename in the list. */
|
||||
static size_t selected = 0;
|
||||
/* The currently selected filename in the list. This variable
|
||||
* is zero-based. */
|
||||
static bool search_last_file = FALSE;
|
||||
/* Have we gone past the last file while searching? */
|
||||
/* The currently selected filename in the list; zero-based. */
|
||||
static char *path_save = NULL;
|
||||
/* A copy of the current path. */
|
||||
|
||||
/* Our main file browser function. path is the tilde-expanded path we
|
||||
* start browsing from. */
|
||||
@@ -52,8 +53,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
int kbinput;
|
||||
bool old_const_update = ISSET(CONST_UPDATE);
|
||||
char *prev_dir = NULL;
|
||||
/* The directory we were in, if any, before backing up via
|
||||
* browsing to "..". */
|
||||
/* The directory we were in before backing up to "..". */
|
||||
char *ans = NULL;
|
||||
/* The last answer the user typed at the statusbar prompt. */
|
||||
size_t old_selected;
|
||||
@@ -63,7 +63,6 @@ char *do_browser(char *path, DIR *dir)
|
||||
|
||||
curs_set(0);
|
||||
blank_statusbar();
|
||||
currmenu = MBROWSER;
|
||||
bottombars(MBROWSER);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
@@ -79,6 +78,9 @@ char *do_browser(char *path, DIR *dir)
|
||||
|
||||
path = mallocstrassn(path, get_full_path(path));
|
||||
|
||||
/* Save the current path in order to be used later. */
|
||||
path_save = path;
|
||||
|
||||
assert(path != NULL && path[strlen(path) - 1] == '/');
|
||||
|
||||
/* Get the file list, and set longest and width in the process. */
|
||||
@@ -92,7 +94,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
/* If prev_dir isn't NULL, select the directory saved in it, and
|
||||
* then blow it away. */
|
||||
if (prev_dir != NULL) {
|
||||
browser_select_filename(prev_dir);
|
||||
browser_select_dirname(prev_dir);
|
||||
|
||||
free(prev_dir);
|
||||
prev_dir = NULL;
|
||||
@@ -122,6 +124,14 @@ char *do_browser(char *path, DIR *dir)
|
||||
|
||||
kbinput = get_kbinput(edit);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (kbinput == KEY_WINCH) {
|
||||
kbinput = ERR;
|
||||
curs_set(0);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
if (kbinput == KEY_MOUSE) {
|
||||
int mouse_x, mouse_y;
|
||||
@@ -137,21 +147,18 @@ char *do_browser(char *path, DIR *dir)
|
||||
width) + (mouse_x / (longest + 2));
|
||||
|
||||
/* If they clicked beyond the end of a row,
|
||||
* select the filename at the end of that
|
||||
* row. */
|
||||
* select the last filename in that row. */
|
||||
if (mouse_x > width * (longest + 2))
|
||||
selected--;
|
||||
|
||||
/* If we're off the screen, select the last
|
||||
* filename. */
|
||||
/* If we're off the screen, select the last filename. */
|
||||
if (selected > filelist_len - 1)
|
||||
selected = filelist_len - 1;
|
||||
|
||||
/* If we selected the same filename as last
|
||||
* time, put back the Enter key so that it's
|
||||
* read in. */
|
||||
/* If we selected the same filename as last time,
|
||||
* put back the Enter key so that it's read in. */
|
||||
if (old_selected == selected)
|
||||
unget_kbinput(sc_seq_or(do_enter_void, 0), FALSE, FALSE);
|
||||
unget_kbinput(sc_seq_or(do_enter, 0), FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
@@ -163,9 +170,11 @@ char *do_browser(char *path, DIR *dir)
|
||||
} else if (func == do_help_void) {
|
||||
#ifndef DISABLE_HELP
|
||||
do_help_void();
|
||||
/* Perhaps the window dimensions have changed. */
|
||||
browser_refresh();
|
||||
curs_set(0);
|
||||
#else
|
||||
nano_disabled_msg();
|
||||
say_there_is_no_help();
|
||||
#endif
|
||||
} else if (func == do_search) {
|
||||
/* Search for a filename. */
|
||||
@@ -203,7 +212,6 @@ char *do_browser(char *path, DIR *dir)
|
||||
browser_refresh, _("Go To Directory"));
|
||||
|
||||
curs_set(0);
|
||||
currmenu = MBROWSER;
|
||||
bottombars(MBROWSER);
|
||||
|
||||
/* If the directory begins with a newline (i.e. an
|
||||
@@ -268,16 +276,16 @@ char *do_browser(char *path, DIR *dir)
|
||||
} else if (func == do_up_void) {
|
||||
if (selected >= width)
|
||||
selected -= width;
|
||||
} else if (func == do_left) {
|
||||
if (selected > 0)
|
||||
selected--;
|
||||
} else if (func == do_down_void) {
|
||||
if (selected + width <= filelist_len - 1)
|
||||
selected += width;
|
||||
} else if (func == do_left) {
|
||||
if (selected > 0)
|
||||
selected--;
|
||||
} else if (func == do_right) {
|
||||
if (selected < filelist_len - 1)
|
||||
selected++;
|
||||
} else if (func == do_enter_void) {
|
||||
} else if (func == do_enter) {
|
||||
/* We can't move up from "/". */
|
||||
if (strcmp(filelist[selected], "/..") == 0) {
|
||||
statusbar(_("Can't move up a directory"));
|
||||
@@ -398,8 +406,7 @@ char *do_browse_from(const char *inpath)
|
||||
|
||||
/* If we can't open the path, get out. */
|
||||
if (dir == NULL) {
|
||||
if (path != NULL)
|
||||
free(path);
|
||||
free(path);
|
||||
beep();
|
||||
return NULL;
|
||||
}
|
||||
@@ -429,31 +436,31 @@ void browser_init(const char *path, DIR *dir)
|
||||
|
||||
assert(path != NULL && path[strlen(path) - 1] == '/' && dir != NULL);
|
||||
|
||||
/* Set longest to zero, just before we initialize it. */
|
||||
longest = 0;
|
||||
|
||||
/* Find the length of the longest filename in the current folder. */
|
||||
while ((nextdir = readdir(dir)) != NULL) {
|
||||
size_t d_len;
|
||||
size_t name_len = strlenpt(nextdir->d_name);
|
||||
|
||||
/* Don't show the "." entry. */
|
||||
if (strcmp(nextdir->d_name, ".") == 0)
|
||||
continue;
|
||||
|
||||
d_len = strlenpt(nextdir->d_name);
|
||||
if (d_len > longest)
|
||||
longest = (d_len > COLS) ? COLS : d_len;
|
||||
if (name_len > longest)
|
||||
longest = name_len;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
rewinddir(dir);
|
||||
|
||||
/* Put 10 columns' worth of blank space between columns of filenames
|
||||
/* Put 10 characters' worth of blank space between columns of filenames
|
||||
* in the list whenever possible, as Pico does. */
|
||||
longest += 10;
|
||||
|
||||
if (filelist != NULL)
|
||||
free_chararray(filelist, filelist_len);
|
||||
/* Make sure longest is between 15 and COLS. */
|
||||
if (longest < 15)
|
||||
longest = 15;
|
||||
if (longest > COLS)
|
||||
longest = COLS;
|
||||
|
||||
rewinddir(dir);
|
||||
|
||||
free_chararray(filelist, filelist_len);
|
||||
|
||||
filelist_len = i;
|
||||
|
||||
@@ -479,12 +486,6 @@ void browser_init(const char *path, DIR *dir)
|
||||
|
||||
closedir(dir);
|
||||
|
||||
/* Make sure longest is between 15 and COLS. */
|
||||
if (longest < 15)
|
||||
longest = 15;
|
||||
if (longest > COLS)
|
||||
longest = COLS;
|
||||
|
||||
/* Set width to zero, just before we initialize it. */
|
||||
width = 0;
|
||||
|
||||
@@ -536,7 +537,7 @@ functionptrtype parse_browser_input(int *kbinput)
|
||||
return goto_dir_void;
|
||||
case 'S':
|
||||
case 's':
|
||||
return do_enter_void;
|
||||
return do_enter;
|
||||
case 'W':
|
||||
case 'w':
|
||||
return do_search;
|
||||
@@ -549,20 +550,21 @@ functionptrtype parse_browser_input(int *kbinput)
|
||||
* necessary, and display the list of files. */
|
||||
void browser_refresh(void)
|
||||
{
|
||||
static int uimax_digits = -1;
|
||||
size_t i;
|
||||
int col = 0;
|
||||
/* The maximum number of columns that the filenames will take
|
||||
* up. */
|
||||
int line = 0;
|
||||
/* The maximum number of lines that the filenames will take
|
||||
* up. */
|
||||
int line = 0, col = 0;
|
||||
/* The current line and column while the list is getting displayed. */
|
||||
char *foo;
|
||||
/* The file information that we'll display. */
|
||||
/* The additional information that we'll display about a file. */
|
||||
|
||||
if (uimax_digits == -1)
|
||||
uimax_digits = digits(UINT_MAX);
|
||||
/* Perhaps window dimensions have changed; reinitialize the browser. */
|
||||
browser_init(path_save, opendir(path_save));
|
||||
qsort(filelist, filelist_len, sizeof(char *), diralphasort);
|
||||
|
||||
/* Make sure the selected file is within range. */
|
||||
if (selected >= filelist_len)
|
||||
selected = filelist_len - 1;
|
||||
|
||||
titlebar(path_save);
|
||||
blank_edit();
|
||||
|
||||
wmove(edit, 0, 0);
|
||||
@@ -581,8 +583,7 @@ void browser_refresh(void)
|
||||
/* The maximum length of the file information in
|
||||
* columns: seven for "--", "(dir)", or the file size,
|
||||
* and 12 for "(parent dir)". */
|
||||
bool dots = (COLS >= 15 && filetaillen >= longest -
|
||||
foomaxlen - 1);
|
||||
bool dots = (COLS >= 15 && filetaillen >= longest - foomaxlen);
|
||||
/* Do we put an ellipsis before the filename? Don't set
|
||||
* this to TRUE if we have fewer than 15 columns (i.e.
|
||||
* one column for padding, plus seven columns for a
|
||||
@@ -594,15 +595,13 @@ void browser_refresh(void)
|
||||
* "(dir)", or the file size, plus three columns for the
|
||||
* ellipsis. */
|
||||
|
||||
/* Start highlighting the currently selected file or
|
||||
* directory. */
|
||||
/* Start highlighting the currently selected file or directory. */
|
||||
if (i == selected)
|
||||
wattron(edit, hilite_attribute);
|
||||
|
||||
blank_line(edit, line, col, longest);
|
||||
|
||||
/* If dots is TRUE, we will display something like
|
||||
* "...ename". */
|
||||
/* If dots is TRUE, we will display something like "...ename". */
|
||||
if (dots)
|
||||
mvwaddstr(edit, line, col, "...");
|
||||
mvwaddstr(edit, line, dots ? col + 3 : col, disp);
|
||||
@@ -622,42 +621,43 @@ void browser_refresh(void)
|
||||
/* If the file is a symlink that points to a directory,
|
||||
* display it as a directory. */
|
||||
else
|
||||
/* TRANSLATORS: Try to keep this at most 7
|
||||
* characters. */
|
||||
/* TRANSLATORS: Try to keep this at most 7 characters. */
|
||||
foo = mallocstrcpy(NULL, _("(dir)"));
|
||||
} else if (S_ISDIR(st.st_mode)) {
|
||||
/* If the file is a directory, display it as such. */
|
||||
if (strcmp(filetail, "..") == 0) {
|
||||
/* TRANSLATORS: Try to keep this at most 12
|
||||
* characters. */
|
||||
/* TRANSLATORS: Try to keep this at most 12 characters. */
|
||||
foo = mallocstrcpy(NULL, _("(parent dir)"));
|
||||
foomaxlen = 12;
|
||||
} else
|
||||
foo = mallocstrcpy(NULL, _("(dir)"));
|
||||
} else {
|
||||
unsigned long result = st.st_size;
|
||||
off_t result = st.st_size;
|
||||
char modifier;
|
||||
|
||||
foo = charalloc(uimax_digits + 4);
|
||||
foo = charalloc(foomaxlen + 1);
|
||||
|
||||
/* Bytes. */
|
||||
if (st.st_size < (1 << 10))
|
||||
modifier = ' ';
|
||||
/* Kilobytes. */
|
||||
modifier = ' '; /* bytes */
|
||||
else if (st.st_size < (1 << 20)) {
|
||||
result >>= 10;
|
||||
modifier = 'K';
|
||||
/* Megabytes. */
|
||||
modifier = 'K'; /* kilobytes */
|
||||
} else if (st.st_size < (1 << 30)) {
|
||||
result >>= 20;
|
||||
modifier = 'M';
|
||||
/* Gigabytes. */
|
||||
modifier = 'M'; /* megabytes */
|
||||
} else {
|
||||
result >>= 30;
|
||||
modifier = 'G';
|
||||
modifier = 'G'; /* gigabytes */
|
||||
}
|
||||
|
||||
sprintf(foo, "%4lu %cB", result, modifier);
|
||||
/* Show the size if less than a terabyte,
|
||||
* otherwise show "(huge)". */
|
||||
if (result < (1 << 10))
|
||||
sprintf(foo, "%4ju %cB", (intmax_t)result, modifier);
|
||||
else
|
||||
/* TRANSLATORS: Try to keep this at most 7 characters.
|
||||
* If necessary, you can leave out the parentheses. */
|
||||
foo = mallocstrcpy(foo, _("(huge)"));
|
||||
}
|
||||
|
||||
/* Make sure foo takes up no more than foomaxlen columns. */
|
||||
@@ -669,8 +669,7 @@ void browser_refresh(void)
|
||||
|
||||
mvwaddstr(edit, line, col - foolen, foo);
|
||||
|
||||
/* Finish highlighting the currently selected file or
|
||||
* directory. */
|
||||
/* Finish highlighting the currently selected file or directory. */
|
||||
if (i == selected)
|
||||
wattroff(edit, hilite_attribute);
|
||||
|
||||
@@ -692,56 +691,34 @@ void browser_refresh(void)
|
||||
wnoutrefresh(edit);
|
||||
}
|
||||
|
||||
/* Look for needle. If we find it, set selected to its location. Note
|
||||
* that needle must be an exact match for a file in the list. The
|
||||
* return value specifies whether we found anything. */
|
||||
bool browser_select_filename(const char *needle)
|
||||
/* Look for needle. If we find it, set selected to its location.
|
||||
* Note that needle must be an exact match for a file in the list. */
|
||||
void browser_select_dirname(const char *needle)
|
||||
{
|
||||
size_t currselected;
|
||||
bool found = FALSE;
|
||||
size_t looking_at = 0;
|
||||
|
||||
for (currselected = 0; currselected < filelist_len;
|
||||
currselected++) {
|
||||
if (strcmp(filelist[currselected], needle) == 0) {
|
||||
found = TRUE;
|
||||
for (; looking_at < filelist_len; looking_at++) {
|
||||
if (strcmp(filelist[looking_at], needle) == 0) {
|
||||
selected = looking_at;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
selected = currselected;
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/* Set up the system variables for a filename search. Return -1 if the
|
||||
* search should be canceled (due to Cancel, a blank search string, or a
|
||||
* failed regcomp()), return 0 on success, and return 1 on rerun calling
|
||||
* program. */
|
||||
/* Set up the system variables for a filename search. Return -1 or -2 if
|
||||
* the search should be canceled (due to Cancel or a blank search string),
|
||||
* return 0 when we have a string, and return a positive value when some
|
||||
* function was run. */
|
||||
int filesearch_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
int input;
|
||||
char *buf;
|
||||
static char *backupstring = NULL;
|
||||
/* The search string we'll be using. */
|
||||
|
||||
/* If backupstring doesn't exist, initialize it to "". */
|
||||
if (backupstring == NULL)
|
||||
backupstring = mallocstrcpy(NULL, "");
|
||||
|
||||
/* We display the search prompt below. If the user types a partial
|
||||
* search string and then Replace or a toggle, we will return to
|
||||
* do_search() or do_replace() and be called again. In that case,
|
||||
* we should put the same search string back up. */
|
||||
|
||||
search_init_globals();
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||
|
||||
buf = charalloc(strlen(disp) + 7);
|
||||
/* We use (COLS / 3) here because we need to see more on the
|
||||
* line. */
|
||||
/* We use (COLS / 3) here because we need to see more on the line. */
|
||||
sprintf(buf, " [%s%s]", disp,
|
||||
(strlenpt(last_search) > COLS / 3) ? "..." : "");
|
||||
free(disp);
|
||||
@@ -749,11 +726,11 @@ int filesearch_init(void)
|
||||
buf = mallocstrcpy(NULL, "");
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
i = do_prompt(FALSE,
|
||||
input = do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
MWHEREISFILE, backupstring,
|
||||
MWHEREISFILE, NULL,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
&search_history,
|
||||
#endif
|
||||
@@ -762,100 +739,92 @@ int filesearch_init(void)
|
||||
/* Release buf now that we don't need it anymore. */
|
||||
free(buf);
|
||||
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
/* If only Enter was pressed but we have a previous string, it's okay. */
|
||||
if (input == -2 && *last_search != '\0')
|
||||
return 0;
|
||||
|
||||
/* Cancel any search, or just return with no previous search. */
|
||||
if (i == -1 || (i < 0 && *last_search == '\0') || (i == 0 &&
|
||||
*answer == '\0')) {
|
||||
/* Otherwise negative inputs are a bailout. */
|
||||
if (input < 0)
|
||||
statusbar(_("Cancelled"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return input;
|
||||
}
|
||||
|
||||
/* Look for needle. If no_sameline is TRUE, skip over selected when
|
||||
* looking for needle. begin is the location of the filename where we
|
||||
* first started searching. The return value specifies whether we found
|
||||
* anything. */
|
||||
bool findnextfile(bool no_sameline, size_t begin, const char *needle)
|
||||
/* Look for the given needle in the list of files. */
|
||||
void findnextfile(const char *needle)
|
||||
{
|
||||
size_t currselected = selected;
|
||||
/* The location in the current file list of the match we
|
||||
* find. */
|
||||
const char *filetail = tail(filelist[currselected]);
|
||||
size_t looking_at = selected;
|
||||
/* The location in the file list of the filename we're looking at. */
|
||||
bool came_full_circle = FALSE;
|
||||
/* Have we reached the starting file again? */
|
||||
const char *filetail = tail(filelist[looking_at]);
|
||||
/* The filename we display, minus the path. */
|
||||
const char *rev_start = filetail, *found = NULL;
|
||||
unsigned stash[sizeof(flags) / sizeof(flags[0])];
|
||||
/* A storage place for the current flag settings. */
|
||||
|
||||
/* Look for needle in the current filename we're searching. */
|
||||
/* Save the settings of all flags. */
|
||||
memcpy(stash, flags, sizeof(flags));
|
||||
|
||||
/* Search forward, case insensitive and without regexes. */
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
UNSET(CASE_SENSITIVE);
|
||||
UNSET(USE_REGEXP);
|
||||
|
||||
/* Step through each filename in the list until a match is found or
|
||||
* we've come back to the point where we started. */
|
||||
while (TRUE) {
|
||||
found = strstrwrapper(filetail, needle, rev_start);
|
||||
|
||||
/* We've found a potential match. If we're not allowed to find
|
||||
* a match on the same filename we started on and this potential
|
||||
* match is on that line, continue searching. */
|
||||
if (found != NULL && (!no_sameline || currselected != begin))
|
||||
/* If we've found a match and it's not the same filename where
|
||||
* we started, then we're done. */
|
||||
if (found != NULL && looking_at != selected)
|
||||
break;
|
||||
|
||||
/* We've finished processing the filenames, so get out. */
|
||||
if (search_last_file) {
|
||||
/* If we've found a match and we're back at the beginning, then
|
||||
* it's the only occurrence. */
|
||||
if (found != NULL && came_full_circle) {
|
||||
statusbar(_("This is the only occurrence"));
|
||||
break;
|
||||
}
|
||||
|
||||
if (came_full_circle) {
|
||||
/* We're back at the beginning and didn't find anything. */
|
||||
not_found_msg(needle);
|
||||
return FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Move to the next filename in the list. If we've reached the
|
||||
* end of the list, wrap around. */
|
||||
if (currselected < filelist_len - 1)
|
||||
currselected++;
|
||||
if (looking_at < filelist_len - 1)
|
||||
looking_at++;
|
||||
else {
|
||||
currselected = 0;
|
||||
looking_at = 0;
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
|
||||
/* We've reached the original starting file. */
|
||||
if (currselected == begin)
|
||||
search_last_file = TRUE;
|
||||
if (looking_at == selected)
|
||||
/* We've reached the original starting file. */
|
||||
came_full_circle = TRUE;
|
||||
|
||||
filetail = tail(filelist[currselected]);
|
||||
filetail = tail(filelist[looking_at]);
|
||||
|
||||
rev_start = filetail;
|
||||
}
|
||||
|
||||
/* We've definitely found something. */
|
||||
selected = currselected;
|
||||
/* Restore the settings of all flags. */
|
||||
memcpy(flags, stash, sizeof(flags));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Clear the flag indicating that a search reached the last file in the
|
||||
* list. We need to do this just before a new search. */
|
||||
void findnextfile_wrap_reset(void)
|
||||
{
|
||||
search_last_file = FALSE;
|
||||
}
|
||||
|
||||
/* Abort the current filename search. Clean up by setting the current
|
||||
* shortcut list to the browser shortcut list, and displaying it. */
|
||||
void filesearch_abort(void)
|
||||
{
|
||||
currmenu = MBROWSER;
|
||||
bottombars(MBROWSER);
|
||||
/* Select the one we've found. */
|
||||
selected = looking_at;
|
||||
}
|
||||
|
||||
/* Search for a filename. */
|
||||
void do_filesearch(void)
|
||||
{
|
||||
size_t begin = selected;
|
||||
bool didfind;
|
||||
|
||||
UNSET(CASE_SENSITIVE);
|
||||
UNSET(USE_REGEXP);
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
|
||||
if (filesearch_init() != 0) {
|
||||
/* Cancelled or a blank search string. */
|
||||
filesearch_abort();
|
||||
/* Cancelled, or a blank search string, or done something. */
|
||||
bottombars(MBROWSER);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -872,50 +841,18 @@ void do_filesearch(void)
|
||||
update_history(&search_history, answer);
|
||||
#endif
|
||||
|
||||
findnextfile_wrap_reset();
|
||||
didfind = findnextfile(FALSE, begin, answer);
|
||||
findnextfile(answer);
|
||||
|
||||
/* Check to see if there's only one occurrence of the string and
|
||||
* we're on it now. */
|
||||
if (selected == begin && didfind) {
|
||||
/* Do the search again, skipping over the current line. We
|
||||
* should only end up back at the same position if the string
|
||||
* isn't found again, in which case it's the only occurrence. */
|
||||
didfind = findnextfile(TRUE, begin, answer);
|
||||
if (selected == begin && !didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
}
|
||||
|
||||
filesearch_abort();
|
||||
bottombars(MBROWSER);
|
||||
}
|
||||
|
||||
/* Search for the last filename without prompting. */
|
||||
/* Search for the last given filename again without prompting. */
|
||||
void do_fileresearch(void)
|
||||
{
|
||||
size_t begin = selected;
|
||||
bool didfind;
|
||||
|
||||
search_init_globals();
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
findnextfile_wrap_reset();
|
||||
didfind = findnextfile(FALSE, begin, answer);
|
||||
|
||||
/* Check to see if there's only one occurrence of the string and
|
||||
* we're on it now. */
|
||||
if (selected == begin && didfind) {
|
||||
/* Do the search again, skipping over the current line. We
|
||||
* should only end up back at the same position if the
|
||||
* string isn't found again, in which case it's the only
|
||||
* occurrence. */
|
||||
didfind = findnextfile(TRUE, begin, answer);
|
||||
if (selected == begin && !didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
}
|
||||
} else
|
||||
statusbar(_("No current search pattern"));
|
||||
|
||||
filesearch_abort();
|
||||
if (last_search[0] == '\0')
|
||||
statusbar(_("No current search pattern"));
|
||||
else
|
||||
findnextfile(last_search);
|
||||
}
|
||||
|
||||
/* Select the first file in the list. */
|
||||
|
||||
18
src/chars.c
18
src/chars.c
@@ -484,12 +484,18 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
* before the one at pos. */
|
||||
size_t move_mbleft(const char *buf, size_t pos)
|
||||
{
|
||||
size_t before = 0, char_len = 0;
|
||||
size_t before, char_len = 0;
|
||||
|
||||
assert(buf != NULL && pos <= strlen(buf));
|
||||
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. Here is the naive, O(pos) way to do it. */
|
||||
* character. So we just start groping for one at the farthest
|
||||
* possible point. */
|
||||
if (mb_cur_max() > pos)
|
||||
before = 0;
|
||||
else
|
||||
before = pos - mb_cur_max();
|
||||
|
||||
while (before < pos) {
|
||||
char_len = parse_mbchar(buf + before, NULL, NULL);
|
||||
before += char_len;
|
||||
@@ -630,7 +636,8 @@ char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
|
||||
for (; *haystack != '\0' && haystack_len >= needle_len;
|
||||
haystack += move_mbright(haystack, 0), haystack_len--) {
|
||||
if (mbstrncasecmp(haystack, needle, needle_len) == 0)
|
||||
if (mbstrncasecmp(haystack, needle, needle_len) == 0 &&
|
||||
mblen(haystack, MB_CUR_MAX) > 0)
|
||||
return (char *)haystack;
|
||||
}
|
||||
|
||||
@@ -723,8 +730,9 @@ char *mbrevstrcasestr(const char *haystack, const char *needle, const
|
||||
rev_start_len = mbstrlen(rev_start);
|
||||
|
||||
while (!begin_line) {
|
||||
if (rev_start_len >= needle_len && mbstrncasecmp(rev_start,
|
||||
needle, needle_len) == 0)
|
||||
if (rev_start_len >= needle_len &&
|
||||
mbstrncasecmp(rev_start, needle, needle_len) == 0 &&
|
||||
mblen(rev_start, MB_CUR_MAX) > 0)
|
||||
return (char *)rev_start;
|
||||
|
||||
if (rev_start == haystack)
|
||||
|
||||
164
src/color.c
164
src/color.c
@@ -3,7 +3,7 @@
|
||||
* color.c *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
|
||||
* 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* 2010, 2011, 2013, 2014, 2015 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_MAGIC_H
|
||||
#include <magic.h>
|
||||
@@ -69,10 +70,8 @@ void set_colorpairs(void)
|
||||
interface_color_pair[i].pairnum = A_NORMAL;
|
||||
}
|
||||
|
||||
if (specified_color_combo[i] != NULL) {
|
||||
free(specified_color_combo[i]);
|
||||
specified_color_combo[i] = NULL;
|
||||
}
|
||||
free(specified_color_combo[i]);
|
||||
specified_color_combo[i] = NULL;
|
||||
}
|
||||
|
||||
for (; this_syntax != NULL; this_syntax = this_syntax->next) {
|
||||
@@ -181,12 +180,30 @@ void color_update(void)
|
||||
if (openfile->colorstrings != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
if (openfile->colorstrings == NULL)
|
||||
statusbar(_("Unknown syntax name: %s"), syntaxstr);
|
||||
}
|
||||
|
||||
/* If we didn't specify a syntax override string, or if we did and
|
||||
* there was no syntax by that name, get the syntax based on the
|
||||
* file extension, then try the headerline, and then try magic. */
|
||||
if (openfile->colorstrings == NULL) {
|
||||
char *currentdir = getcwd(NULL, PATH_MAX + 1);
|
||||
char *joinednames = charalloc(PATH_MAX + 1);
|
||||
char *fullname = NULL;
|
||||
|
||||
if (currentdir != NULL) {
|
||||
/* Concatenate the current working directory with the
|
||||
* specified filename, and canonicalize the result. */
|
||||
sprintf(joinednames, "%s/%s", currentdir, openfile->filename);
|
||||
fullname = realpath(joinednames, NULL);
|
||||
free(currentdir);
|
||||
}
|
||||
|
||||
if (fullname == NULL)
|
||||
fullname = mallocstrcpy(fullname, openfile->filename);
|
||||
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
|
||||
@@ -211,7 +228,7 @@ void color_update(void)
|
||||
}
|
||||
|
||||
/* Set colorstrings if we match the extension regex. */
|
||||
if (regexec(e->ext, openfile->filename, 0, NULL, 0) == 0) {
|
||||
if (regexec(e->ext, fullname, 0, NULL, 0) == 0) {
|
||||
openfile->syntax = tmpsyntax;
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
break;
|
||||
@@ -224,6 +241,9 @@ void color_update(void)
|
||||
}
|
||||
}
|
||||
|
||||
free(joinednames);
|
||||
free(fullname);
|
||||
|
||||
/* Check the headerline if the extension didn't match anything. */
|
||||
if (openfile->colorstrings == NULL) {
|
||||
#ifdef DEBUG
|
||||
@@ -269,9 +289,9 @@ void color_update(void)
|
||||
/* Open the magic database and get a diagnosis of the file. */
|
||||
cookie = magic_open(MAGIC_SYMLINK |
|
||||
#ifdef DEBUG
|
||||
MAGIC_DEBUG | MAGIC_CHECK |
|
||||
MAGIC_DEBUG | MAGIC_CHECK |
|
||||
#endif
|
||||
MAGIC_ERROR);
|
||||
MAGIC_ERROR);
|
||||
if (cookie == NULL || magic_load(cookie, NULL) < 0)
|
||||
statusbar(_("magic_load() failed: %s"), strerror(errno));
|
||||
else {
|
||||
@@ -345,67 +365,49 @@ void color_update(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset the multicolor info cache for records for any lines which need
|
||||
* to be recalculated. */
|
||||
void reset_multis_after(filestruct *fileptr, int mindex)
|
||||
/* Reset the multiline coloring cache for one specific regex (given by
|
||||
* index) for lines that need reevaluation. */
|
||||
void reset_multis_for_id(filestruct *fileptr, int index)
|
||||
{
|
||||
filestruct *oof;
|
||||
for (oof = fileptr->next; oof != NULL; oof = oof->next) {
|
||||
alloc_multidata_if_needed(oof);
|
||||
if (oof->multidata == NULL)
|
||||
continue;
|
||||
if (oof->multidata[mindex] != CNONE)
|
||||
oof->multidata[mindex] = -1;
|
||||
else
|
||||
filestruct *row;
|
||||
|
||||
/* Reset the cache of earlier lines, as far back as needed. */
|
||||
for (row = fileptr->prev; row != NULL; row = row->prev) {
|
||||
alloc_multidata_if_needed(row);
|
||||
if (row->multidata[index] == CNONE)
|
||||
break;
|
||||
row->multidata[index] = -1;
|
||||
}
|
||||
for (; oof != NULL; oof = oof->next) {
|
||||
alloc_multidata_if_needed(oof);
|
||||
if (oof->multidata == NULL)
|
||||
continue;
|
||||
if (oof->multidata[mindex] == CNONE)
|
||||
oof->multidata[mindex] = -1;
|
||||
else
|
||||
for (; row != NULL; row = row->prev) {
|
||||
alloc_multidata_if_needed(row);
|
||||
if (row->multidata[index] != CNONE)
|
||||
break;
|
||||
row->multidata[index] = -1;
|
||||
}
|
||||
|
||||
/* Reset the cache of the current line. */
|
||||
fileptr->multidata[index] = -1;
|
||||
|
||||
/* Reset the cache of later lines, as far ahead as needed. */
|
||||
for (row = fileptr->next; row != NULL; row = row->next) {
|
||||
alloc_multidata_if_needed(row);
|
||||
if (row->multidata[index] == CNONE)
|
||||
break;
|
||||
row->multidata[index] = -1;
|
||||
}
|
||||
for (; row != NULL; row = row->next) {
|
||||
alloc_multidata_if_needed(row);
|
||||
if (row->multidata[index] != CNONE)
|
||||
break;
|
||||
row->multidata[index] = -1;
|
||||
}
|
||||
|
||||
edit_refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
void reset_multis_before(filestruct *fileptr, int mindex)
|
||||
{
|
||||
filestruct *oof;
|
||||
for (oof = fileptr->prev; oof != NULL; oof = oof->prev) {
|
||||
alloc_multidata_if_needed(oof);
|
||||
if (oof->multidata == NULL)
|
||||
continue;
|
||||
if (oof->multidata[mindex] != CNONE)
|
||||
oof->multidata[mindex] = -1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
for (; oof != NULL; oof = oof->prev) {
|
||||
alloc_multidata_if_needed(oof);
|
||||
if (oof->multidata == NULL)
|
||||
continue;
|
||||
if (oof->multidata[mindex] == CNONE)
|
||||
oof->multidata[mindex] = -1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
edit_refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
/* Reset one multiline regex info. */
|
||||
void reset_multis_for_id(filestruct *fileptr, int num)
|
||||
{
|
||||
reset_multis_before(fileptr, num);
|
||||
reset_multis_after(fileptr, num);
|
||||
fileptr->multidata[num] = -1;
|
||||
}
|
||||
|
||||
/* Reset multi-line strings around a filestruct ptr, trying to be smart
|
||||
* about stopping. Bool force means: reset everything regardless, useful
|
||||
* when we don't know how much screen state has changed. */
|
||||
/* Reset multi-line strings around the filestruct fileptr, trying to be
|
||||
* smart about stopping. Bool force means: reset everything regardless,
|
||||
* useful when we don't know how much screen state has changed. */
|
||||
void reset_multis(filestruct *fileptr, bool force)
|
||||
{
|
||||
int nobegin, noend;
|
||||
@@ -416,34 +418,32 @@ void reset_multis(filestruct *fileptr, bool force)
|
||||
return;
|
||||
|
||||
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
|
||||
|
||||
/* If it's not a multi-line regex, amscray. */
|
||||
if (tmpcolor->end == NULL)
|
||||
continue;
|
||||
|
||||
alloc_multidata_if_needed(fileptr);
|
||||
if (force == TRUE) {
|
||||
reset_multis_for_id(fileptr, tmpcolor->id);
|
||||
continue;
|
||||
|
||||
if (force == FALSE) {
|
||||
/* Check whether the multidata still matches the current situation. */
|
||||
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
|
||||
noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
|
||||
if ((fileptr->multidata[tmpcolor->id] == CWHOLELINE ||
|
||||
fileptr->multidata[tmpcolor->id] == CNONE) &&
|
||||
nobegin && noend)
|
||||
continue;
|
||||
else if (fileptr->multidata[tmpcolor->id] == CSTARTENDHERE &&
|
||||
!nobegin && !noend && startmatch.rm_so < endmatch.rm_so)
|
||||
continue;
|
||||
else if (fileptr->multidata[tmpcolor->id] == CBEGINBEFORE &&
|
||||
nobegin && !noend)
|
||||
continue;
|
||||
else if (fileptr->multidata[tmpcolor->id] == CENDAFTER &&
|
||||
!nobegin && noend)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Figure out where the first begin and end are to determine if
|
||||
* things changed drastically for the precalculated multi values. */
|
||||
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
|
||||
noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
|
||||
if (fileptr->multidata[tmpcolor->id] == CWHOLELINE) {
|
||||
if (nobegin && noend)
|
||||
continue;
|
||||
} else if (fileptr->multidata[tmpcolor->id] == CNONE) {
|
||||
if (nobegin && noend)
|
||||
continue;
|
||||
} else if (fileptr->multidata[tmpcolor->id] & CBEGINBEFORE && !noend
|
||||
&& (nobegin || endmatch.rm_eo > startmatch.rm_eo)) {
|
||||
reset_multis_after(fileptr, tmpcolor->id);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If we got here, assume the worst. */
|
||||
/* If we got here, things have changed. */
|
||||
reset_multis_for_id(fileptr, tmpcolor->id);
|
||||
}
|
||||
}
|
||||
|
||||
29
src/cut.c
29
src/cut.c
@@ -50,11 +50,6 @@ inline bool keeping_cutbuffer(void)
|
||||
* current line. */
|
||||
void cut_line(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
if (!openfile->mark_begin)
|
||||
openfile->mark_begin = openfile->current;
|
||||
#endif
|
||||
|
||||
if (openfile->current != openfile->filebot)
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current, 0,
|
||||
openfile->current->next, 0);
|
||||
@@ -124,7 +119,7 @@ void cut_to_eof(void)
|
||||
* position to the end of the file into the cutbuffer. */
|
||||
void do_cut_text(
|
||||
#ifndef NANO_TINY
|
||||
bool copy_text, bool cut_till_eof, bool undoing
|
||||
bool copy_text, bool cut_till_eof
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
@@ -214,15 +209,13 @@ void do_cut_text(
|
||||
* disturbing the text. */
|
||||
if (!old_no_newlines)
|
||||
UNSET(NO_NEWLINES);
|
||||
} else if (!undoing)
|
||||
update_undo(cut_till_eof ? CUT_EOF : CUT);
|
||||
}
|
||||
|
||||
/* Leave the text in the cutbuffer, and mark the file as
|
||||
* modified. */
|
||||
if (!copy_text) {
|
||||
set_modified();
|
||||
}
|
||||
if (!copy_text)
|
||||
#endif /* !NANO_TINY */
|
||||
set_modified();
|
||||
|
||||
/* Update the screen. */
|
||||
edit_refresh_needed = TRUE;
|
||||
@@ -241,12 +234,11 @@ void do_cut_text_void(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
add_undo(CUT);
|
||||
do_cut_text(FALSE, FALSE);
|
||||
update_undo(CUT);
|
||||
#else
|
||||
do_cut_text();
|
||||
#endif
|
||||
do_cut_text(
|
||||
#ifndef NANO_TINY
|
||||
FALSE, FALSE, FALSE
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -261,7 +253,7 @@ void do_copy_text(void)
|
||||
if (mark_set || openfile->current != next_contiguous_line)
|
||||
cutbuffer_reset();
|
||||
|
||||
do_cut_text(TRUE, FALSE, FALSE);
|
||||
do_cut_text(TRUE, FALSE);
|
||||
|
||||
/* If the mark was set, blow away the cutbuffer on the next copy. */
|
||||
next_contiguous_line = (mark_set ? NULL : openfile->current);
|
||||
@@ -271,7 +263,8 @@ void do_copy_text(void)
|
||||
void do_cut_till_eof(void)
|
||||
{
|
||||
add_undo(CUT_EOF);
|
||||
do_cut_text(FALSE, TRUE, FALSE);
|
||||
do_cut_text(FALSE, TRUE);
|
||||
update_undo(CUT_EOF);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
|
||||
640
src/files.c
640
src/files.c
File diff suppressed because it is too large
Load Diff
525
src/global.c
525
src/global.c
@@ -30,18 +30,21 @@
|
||||
|
||||
/* Global variables. */
|
||||
#ifndef NANO_TINY
|
||||
sigjmp_buf jump_buf;
|
||||
/* Used to return to either main() or the unjustify routine in
|
||||
* do_justify() after a SIGWINCH. */
|
||||
bool jump_buf_main = FALSE;
|
||||
/* Have we set jump_buf so that we return to main() after a
|
||||
* SIGWINCH? */
|
||||
volatile sig_atomic_t sigwinch_counter = 0;
|
||||
/* Is incremented by the handler whenever a SIGWINCH occurs. */
|
||||
#endif
|
||||
|
||||
bool meta_key;
|
||||
/* Whether the current keystroke is a Meta key. */
|
||||
bool func_key;
|
||||
/* Whether the current keystroke is an extended keypad value. */
|
||||
bool focusing = FALSE;
|
||||
/* Whether an update of the edit window should center the cursor. */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
int controlleft = CONTROL_LEFT;
|
||||
int controlright = CONTROL_RIGHT;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
ssize_t fill = 0;
|
||||
@@ -91,14 +94,10 @@ openfilestruct *openfile = NULL;
|
||||
char *matchbrackets = NULL;
|
||||
/* The opening and closing brackets that can be found by bracket
|
||||
* searches. */
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
|
||||
char *whitespace = NULL;
|
||||
/* The characters used when displaying the first characters of
|
||||
* tabs and spaces. */
|
||||
/* The characters used when visibly showing tabs and spaces. */
|
||||
int whitespace_len[2];
|
||||
/* The length of these characters. */
|
||||
/* The length in bytes of these characters. */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -137,9 +136,9 @@ char *backup_dir = NULL;
|
||||
/* The directory where we store backup files. */
|
||||
|
||||
const char *locking_prefix = ".";
|
||||
/* Prefix of how to store the vim-style lock file. */
|
||||
/* Prefix of how to store the vim-style lock file. */
|
||||
const char *locking_suffix = ".swp";
|
||||
/* Suffix of the vim-style lock file. */
|
||||
/* Suffix of the vim-style lock file. */
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
char *operating_dir = NULL;
|
||||
@@ -223,11 +222,7 @@ size_t length_of_list(int menu)
|
||||
size_t i = 0;
|
||||
|
||||
for (f = allfuncs; f != NULL; f = f->next)
|
||||
if ((f->menus & menu) != 0
|
||||
#ifndef DISABLE_HELP
|
||||
&& strlen(f->help) > 0
|
||||
#endif
|
||||
) {
|
||||
if ((f->menus & menu) != 0) {
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
@@ -285,21 +280,7 @@ void flip_execute_void(void)
|
||||
{
|
||||
}
|
||||
|
||||
/* Set the type of command key based on the string. */
|
||||
key_type strtokeytype(const char *str)
|
||||
{
|
||||
if (str[0] == '^')
|
||||
return CONTROL;
|
||||
else if (str[0] == 'M')
|
||||
return META;
|
||||
else if (str[0] == 'F')
|
||||
return FKEY;
|
||||
else
|
||||
return RAWINPUT;
|
||||
}
|
||||
|
||||
/* Add a string to the function list struct.
|
||||
* Does not allow updates, not yet anyway. */
|
||||
/* Add a function to the function list. */
|
||||
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
|
||||
bool blank_after, bool viewok)
|
||||
{
|
||||
@@ -326,58 +307,33 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Return the first shortcut in the list of shortcuts that
|
||||
* matches the given func in the given menu. */
|
||||
const sc *first_sc_for(int menu, void (*func)(void))
|
||||
/* Add a key combo to the shortcut list. */
|
||||
void add_to_sclist(int menus, const char *scstring, void (*func)(void), int toggle)
|
||||
{
|
||||
const sc *s;
|
||||
static sc *tailsc;
|
||||
static int counter = 0;
|
||||
sc *s = (sc *)nmalloc(sizeof(sc));
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if ((s->menu & menu) && s->scfunc == func)
|
||||
return s;
|
||||
/* Start the list, or tack on the next item. */
|
||||
if (sclist == NULL)
|
||||
sclist = s;
|
||||
else
|
||||
tailsc->next = s;
|
||||
tailsc = s;
|
||||
s->next = NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
|
||||
#endif
|
||||
/* Otherwise... */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Add a string to the shortcut list.
|
||||
* Allows updates to existing entries in the list. */
|
||||
void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggle)
|
||||
{
|
||||
sc *s;
|
||||
|
||||
if (sclist == NULL) {
|
||||
sclist = (sc *)nmalloc(sizeof(sc));
|
||||
s = sclist;
|
||||
s->next = NULL;
|
||||
} else {
|
||||
for (s = sclist; s->next != NULL; s = s->next)
|
||||
if (s->menu == menu && s->keystr == scstring)
|
||||
break;
|
||||
|
||||
if (s->menu != menu || s->keystr != scstring) { /* i.e. this is not a replace... */
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "No match found...\n");
|
||||
#endif
|
||||
s->next = (sc *)nmalloc(sizeof(sc));
|
||||
s = s->next;
|
||||
s->next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
s->type = strtokeytype(scstring);
|
||||
s->menu = menu;
|
||||
s->toggle = toggle;
|
||||
s->keystr = (char *) scstring;
|
||||
/* Fill in the data. */
|
||||
s->menus = menus;
|
||||
s->scfunc = func;
|
||||
s->toggle = toggle;
|
||||
if (toggle)
|
||||
s->ordinal = ++counter;
|
||||
s->keystr = (char *) scstring;
|
||||
s->type = strtokeytype(scstring);
|
||||
assign_keyinfo(s);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menu %x\n", s->seq, scstring, (int)s->menu);
|
||||
fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menus %x\n", s->seq, scstring, s->menus);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -391,6 +347,23 @@ void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
|
||||
s->scfunc = newfunc;
|
||||
}
|
||||
|
||||
/* Return the first shortcut in the list of shortcuts that
|
||||
* matches the given func in the given menu. */
|
||||
const sc *first_sc_for(int menu, void (*func)(void))
|
||||
{
|
||||
const sc *s;
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if ((s->menus & menu) && s->scfunc == func)
|
||||
return s;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
|
||||
#endif
|
||||
/* Otherwise... */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return the given menu's first shortcut sequence, or the default value
|
||||
* (2nd arg). Assumes currmenu for the menu to check. */
|
||||
int sc_seq_or(void (*func)(void), int defaultval)
|
||||
@@ -399,7 +372,7 @@ int sc_seq_or(void (*func)(void), int defaultval)
|
||||
|
||||
if (s) {
|
||||
meta_key = (s->type == META);
|
||||
return s->seq;
|
||||
return s->seq;
|
||||
}
|
||||
/* else */
|
||||
return defaultval;
|
||||
@@ -416,21 +389,34 @@ functionptrtype func_from_key(int *kbinput)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return the type of command key based on the given string. */
|
||||
key_type strtokeytype(const char *str)
|
||||
{
|
||||
if (str[0] == '^')
|
||||
return CONTROL;
|
||||
else if (str[0] == 'M')
|
||||
return META;
|
||||
else if (str[0] == 'F')
|
||||
return FKEY;
|
||||
else
|
||||
return RAWINPUT;
|
||||
}
|
||||
|
||||
/* Assign the info to the shortcut struct.
|
||||
* Assumes keystr is already assigned, naturally. */
|
||||
void assign_keyinfo(sc *s)
|
||||
{
|
||||
if (s->type == CONTROL) {
|
||||
assert(strlen(s->keystr) > 1);
|
||||
s->seq = s->keystr[1] - 64;
|
||||
assert(strlen(s->keystr) > 1);
|
||||
s->seq = s->keystr[1] - 64;
|
||||
} else if (s->type == META) {
|
||||
assert(strlen(s->keystr) > 2);
|
||||
s->seq = tolower((int) s->keystr[2]);
|
||||
assert(strlen(s->keystr) > 2);
|
||||
s->seq = tolower((int) s->keystr[2]);
|
||||
} else if (s->type == FKEY) {
|
||||
assert(strlen(s->keystr) > 1);
|
||||
s->seq = KEY_F0 + atoi(&s->keystr[1]);
|
||||
assert(strlen(s->keystr) > 1);
|
||||
s->seq = KEY_F0 + atoi(&s->keystr[1]);
|
||||
} else /* RAWINPUT */
|
||||
s->seq = (int) s->keystr[0];
|
||||
s->seq = (int) s->keystr[0];
|
||||
|
||||
/* Override some keys which don't bind as easily as we'd like. */
|
||||
if (s->type == CONTROL && (!strcasecmp(&s->keystr[1], "space")))
|
||||
@@ -485,32 +471,35 @@ void print_sclist(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* TRANSLATORS: Try to keep the next four strings at most 10 characters. */
|
||||
/* These four tags are used elsewhere too, so they are global. */
|
||||
/* TRANSLATORS: Try to keep the next fifteen strings at most 10 characters. */
|
||||
const char *exit_tag = N_("Exit");
|
||||
const char *close_tag = N_("Close");
|
||||
const char *uncut_tag = N_("Uncut Text");
|
||||
#ifndef DISABLE_JUSITIFY
|
||||
const char *unjust_tag = N_("Unjustify");
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
/* TRANSLATORS: Try to keep this at most 12 characters. */
|
||||
const char *whereis_next_tag = N_("WhereIs Next");
|
||||
#endif
|
||||
|
||||
/* Initialize the list of functions and the list of shortcuts. */
|
||||
void shortcut_init(void)
|
||||
{
|
||||
/* TRANSLATORS: Try to keep the next eight strings at most 10 characters. */
|
||||
const char *read_file_tag = N_("Read File");
|
||||
const char *whereis_tag = N_("Where Is");
|
||||
const char *replace_tag = N_("Replace");
|
||||
const char *gotoline_tag = N_("Go To Line");
|
||||
const char *prev_line_tag = N_("Prev Line");
|
||||
const char *next_line_tag = N_("Next Line");
|
||||
const char *read_file_tag = N_("Read File");
|
||||
const char *prev_page_tag = N_("Prev Page");
|
||||
const char *next_page_tag = N_("Next Page");
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *justify_tag = N_("Justify");
|
||||
const char *fulljustify_tag = N_("FullJstify");
|
||||
#endif
|
||||
const char *refresh_tag = N_("Refresh");
|
||||
#ifndef NANO_TINY
|
||||
/* TRANSLATORS: Try to keep this string at most 12 characters. */
|
||||
const char *whereis_next_tag = N_("WhereIs Next");
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -595,6 +584,10 @@ void shortcut_init(void)
|
||||
const char *nano_backspace_msg =
|
||||
N_("Delete the character to the left of the cursor");
|
||||
#ifndef NANO_TINY
|
||||
const char *nano_cut_word_left_msg =
|
||||
N_("Cut backward from cursor to word start");
|
||||
const char *nano_cut_word_right_msg =
|
||||
N_("Cut forward from cursor to next word start");
|
||||
const char *nano_cut_till_eof_msg =
|
||||
N_("Cut from the cursor position to the end of the file");
|
||||
#endif
|
||||
@@ -608,8 +601,11 @@ void shortcut_init(void)
|
||||
const char *nano_refresh_msg =
|
||||
N_("Refresh (redraw) the current screen");
|
||||
const char *nano_suspend_msg =
|
||||
N_("Suspend the editor (if suspend is enabled)");
|
||||
N_("Suspend the editor (if suspension is enabled)");
|
||||
#ifndef NANO_TINY
|
||||
const char *nano_savefile_msg = N_("Save file without prompting");
|
||||
const char *nano_findprev_msg = N_("Search next occurrence backward");
|
||||
const char *nano_findnext_msg = N_("Search next occurrence forward");
|
||||
const char *nano_case_msg =
|
||||
N_("Toggle the case sensitivity of the search");
|
||||
const char *nano_reverse_msg =
|
||||
@@ -651,6 +647,9 @@ void shortcut_init(void)
|
||||
const char *nano_lint_msg = N_("Invoke the linter, if available");
|
||||
const char *nano_prevlint_msg = N_("Go to previous linter msg");
|
||||
const char *nano_nextlint_msg = N_("Go to next linter msg");
|
||||
#ifndef DISABLE_SPELLER
|
||||
const char *nano_formatter_msg = N_("Invoke formatter, if available");
|
||||
#endif
|
||||
#endif
|
||||
#endif /* !DISABLE_HELP */
|
||||
|
||||
@@ -661,9 +660,9 @@ void shortcut_init(void)
|
||||
#endif
|
||||
|
||||
while (allfuncs != NULL) {
|
||||
subnfunc *f = allfuncs;
|
||||
allfuncs = allfuncs->next;
|
||||
free(f);
|
||||
subnfunc *f = allfuncs;
|
||||
allfuncs = allfuncs->next;
|
||||
free(f);
|
||||
}
|
||||
|
||||
/* Start populating the different menus with functions. */
|
||||
@@ -688,18 +687,28 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_writeout_void, MMAIN,
|
||||
N_("Write Out"), IFSCHELP(nano_writeout_msg), TOGETHER, NOVIEW);
|
||||
|
||||
/* We allow inserting files in view mode if multibuffers are
|
||||
* available, so that we can view multiple files. If we're using
|
||||
* restricted mode, inserting files is disabled, since it allows
|
||||
* reading from or writing to files not specified on the command
|
||||
* line. */
|
||||
add_to_funcs(do_insertfile_void, MMAIN,
|
||||
read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER,
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
VIEW);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
#else
|
||||
NOVIEW);
|
||||
/* If we can't replace Insert with Justify, show Insert anyway, to
|
||||
* keep the help items nicely paired also in restricted mode. */
|
||||
if (TRUE) {
|
||||
#endif
|
||||
add_to_funcs(do_insertfile_void, MMAIN,
|
||||
read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER,
|
||||
/* We allow inserting files in view mode if multibuffer mode
|
||||
* is switched on, so that we can view multiple files. */
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
VIEW);
|
||||
#else
|
||||
NOVIEW);
|
||||
#endif
|
||||
} else {
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
add_to_funcs(do_justify_void, MMAIN,
|
||||
justify_tag, IFSCHELP(nano_justify_msg), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
}
|
||||
|
||||
add_to_funcs(do_search, MMAIN,
|
||||
whereis_tag, IFSCHELP(nano_whereis_msg), TOGETHER, VIEW);
|
||||
@@ -734,20 +743,25 @@ void shortcut_init(void)
|
||||
/* Remember the entry for Uncut, to be able to replace it with Unjustify. */
|
||||
uncutfunc = tailfunc;
|
||||
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
add_to_funcs(do_justify_void, MMAIN,
|
||||
N_("Justify"), IFSCHELP(nano_justify_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_justify_void, MMAIN,
|
||||
justify_tag, IFSCHELP(nano_justify_msg), TOGETHER, NOVIEW);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
add_to_funcs(do_spell, MMAIN,
|
||||
N_("To Spell"), IFSCHELP(nano_spell_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_spell, MMAIN,
|
||||
N_("To Spell"), IFSCHELP(nano_spell_msg), TOGETHER, NOVIEW);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
add_to_funcs(do_linter, MMAIN,
|
||||
N_("To Linter"), IFSCHELP(nano_lint_msg), BLANKAFTER, NOVIEW);
|
||||
add_to_funcs(do_linter, MMAIN,
|
||||
N_("To Linter"), IFSCHELP(nano_lint_msg), TOGETHER, NOVIEW);
|
||||
#ifndef DISABLE_SPELLER
|
||||
add_to_funcs(do_formatter, MMAIN,
|
||||
N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_to_funcs(case_sens_void, MWHEREIS|MREPLACE,
|
||||
@@ -785,10 +799,10 @@ void shortcut_init(void)
|
||||
gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, VIEW);
|
||||
#endif
|
||||
|
||||
add_to_funcs(do_page_up, MMAIN|MHELP|MBROWSER,
|
||||
N_("Prev Page"), IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_page_down, MMAIN|MHELP|MBROWSER,
|
||||
N_("Next Page"), IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_page_up, MMAIN|MHELP,
|
||||
prev_page_tag, IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_page_down, MMAIN|MHELP,
|
||||
next_page_tag, IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
|
||||
|
||||
add_to_funcs(do_first_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
|
||||
N_("First Line"), IFSCHELP(nano_firstline_msg), TOGETHER, VIEW);
|
||||
@@ -879,8 +893,9 @@ void shortcut_init(void)
|
||||
|
||||
add_to_funcs(do_tab, MMAIN,
|
||||
N_("Tab"), IFSCHELP(nano_tab_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_enter_void, MMAIN,
|
||||
N_("Enter"), IFSCHELP(nano_enter_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_enter, MMAIN,
|
||||
N_("Enter"), IFSCHELP(nano_enter_msg), BLANKAFTER, NOVIEW);
|
||||
|
||||
add_to_funcs(do_delete, MMAIN,
|
||||
N_("Delete"), IFSCHELP(nano_delete_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_backspace, MMAIN,
|
||||
@@ -893,6 +908,10 @@ void shortcut_init(void)
|
||||
NOVIEW);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_to_funcs(do_cut_prev_word, MMAIN,
|
||||
N_("Cut Left"), IFSCHELP(nano_cut_word_left_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_cut_next_word, MMAIN,
|
||||
N_("Cut Right"), IFSCHELP(nano_cut_word_right_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_cut_till_eof, MMAIN,
|
||||
N_("CutTillEnd"), IFSCHELP(nano_cut_till_eof_msg), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
@@ -913,6 +932,16 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_suspend_void, MMAIN,
|
||||
N_("Suspend"), IFSCHELP(nano_suspend_msg), BLANKAFTER, VIEW);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_to_funcs(do_savefile, MMAIN,
|
||||
N_("Save"), IFSCHELP(nano_savefile_msg), BLANKAFTER, NOVIEW);
|
||||
|
||||
add_to_funcs(do_findprevious, MMAIN,
|
||||
N_("Previous"), IFSCHELP(nano_findprev_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_findnext, MMAIN,
|
||||
N_("Next"), IFSCHELP(nano_findnext_msg), BLANKAFTER, VIEW);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
add_to_funcs(get_history_older_void,
|
||||
(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE),
|
||||
@@ -926,35 +955,32 @@ void shortcut_init(void)
|
||||
N_("Go To Text"), IFSCHELP(nano_whereis_msg), BLANKAFTER, VIEW);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we're using restricted mode, the DOS format, Mac format,
|
||||
* append, prepend, and backup toggles are disabled. The first and
|
||||
* second are useless since inserting files is disabled, the third
|
||||
* and fourth are disabled because they allow writing to files not
|
||||
* specified on the command line, and the fifth is useless since
|
||||
* backups are disabled. */
|
||||
add_to_funcs(dos_format_void, MWRITEFILE,
|
||||
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(mac_format_void, MWRITEFILE,
|
||||
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
|
||||
|
||||
/* If we're using restricted mode, the Append, Prepend, and Backup toggles
|
||||
* are disabled. The first and second are not useful as they only allow
|
||||
* reduplicating the current file, and the third is not allowed as it
|
||||
* would write to a file not specified on the command line. */
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
add_to_funcs(dos_format_void, MWRITEFILE,
|
||||
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(append_void, MWRITEFILE,
|
||||
N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(prepend_void, MWRITEFILE,
|
||||
N_("Prepend"), IFSCHELP(nano_prepend_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(mac_format_void, MWRITEFILE,
|
||||
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(append_void, MWRITEFILE,
|
||||
N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(prepend_void, MWRITEFILE,
|
||||
N_("Prepend"), IFSCHELP(nano_prepend_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(backup_file_void, MWRITEFILE,
|
||||
N_("Backup File"), IFSCHELP(nano_backup_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(backup_file_void, MWRITEFILE,
|
||||
N_("Backup File"), IFSCHELP(nano_backup_msg), TOGETHER, NOVIEW);
|
||||
}
|
||||
|
||||
/* If we're using restricted mode, file insertion is disabled, and
|
||||
* thus command execution and the multibuffer toggle have no place. */
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
add_to_funcs(flip_execute_void, MINSERTFILE,
|
||||
add_to_funcs(flip_execute_void, MINSERTFILE,
|
||||
N_("Execute Command"), IFSCHELP(nano_execute_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(flip_execute_void, MEXTCMD,
|
||||
add_to_funcs(flip_execute_void, MEXTCMD,
|
||||
read_file_tag, IFSCHELP(nano_insert_msg), TOGETHER, NOVIEW);
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
@@ -969,10 +995,15 @@ void shortcut_init(void)
|
||||
add_to_funcs(to_files_void, MWRITEFILE|MINSERTFILE,
|
||||
N_("To Files"), IFSCHELP(nano_tofiles_msg), TOGETHER, VIEW);
|
||||
|
||||
add_to_funcs(do_page_up, MBROWSER,
|
||||
prev_page_tag, IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_page_down, MBROWSER,
|
||||
next_page_tag, IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
|
||||
|
||||
add_to_funcs(do_first_file, (MBROWSER|MWHEREISFILE),
|
||||
N_("First File"), IFSCHELP(nano_firstfile_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_last_file, (MBROWSER|MWHEREISFILE),
|
||||
N_("Last File"), IFSCHELP(nano_lastfile_msg), TOGETHER, VIEW);
|
||||
N_("Last File"), IFSCHELP(nano_lastfile_msg), BLANKAFTER, VIEW);
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_TINY) && !defined(DISABLE_BROWSER)
|
||||
@@ -1026,12 +1057,12 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "^_", do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MMAIN, "M-G", do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MMAIN, "F13", do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "^Y", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "F7", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "PgUp", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "^V", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "F8", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "PgDn", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^Y", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F7", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgUp", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-\\", do_first_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-|", do_first_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-/", do_last_line, 0);
|
||||
@@ -1058,10 +1089,10 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMOST, "M-Space", do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^Space", do_next_word_void, 0);
|
||||
#endif
|
||||
add_to_sclist(MMOST, "^A", do_home, 0);
|
||||
add_to_sclist(MMOST, "Home", do_home, 0);
|
||||
add_to_sclist(MMOST, "^E", do_end, 0);
|
||||
add_to_sclist(MMOST, "End", do_end, 0);
|
||||
add_to_sclist((MMOST & ~MBROWSER), "^A", do_home, 0);
|
||||
add_to_sclist((MMOST & ~MBROWSER), "Home", do_home, 0);
|
||||
add_to_sclist((MMOST & ~MBROWSER), "^E", do_end, 0);
|
||||
add_to_sclist((MMOST & ~MBROWSER), "End", do_end, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", do_up_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", do_up_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", do_down_void, 0);
|
||||
@@ -1154,31 +1185,45 @@ void shortcut_init(void)
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Down", get_history_newer_void, 0);
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
add_to_sclist(MWHEREISFILE, "^Y", do_first_file, 0);
|
||||
add_to_sclist(MWHEREISFILE, "^V", do_last_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", do_first_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", do_first_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", do_last_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", do_last_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "^_", goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-G", goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "F13", goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER, "Home", do_first_file, 0);
|
||||
add_to_sclist(MBROWSER, "End", do_last_file, 0);
|
||||
add_to_sclist(MBROWSER, "^_", goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER, "M-G", goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER, "F13", goto_dir_void, 0);
|
||||
#endif
|
||||
add_to_sclist(MWRITEFILE, "M-D", dos_format_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-M", mac_format_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-A", append_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-P", prepend_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-B", backup_file_void, 0);
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
/* Don't allow Appending, Prepending, nor Backups in restricted mode. */
|
||||
add_to_sclist(MWRITEFILE, "M-A", append_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-P", prepend_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-B", backup_file_void, 0);
|
||||
#ifndef DISABLE_BROWSER
|
||||
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", to_files_void, 0);
|
||||
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", to_files_void, 0);
|
||||
#endif
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", flip_execute_void, 0);
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", new_buffer_void, 0);
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", flip_execute_void, 0);
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", new_buffer_void, 0);
|
||||
}
|
||||
add_to_sclist(MHELP|MBROWSER, "^C", do_exit, 0);
|
||||
/* Allow exiting from the file browser and the help viewer with
|
||||
* the same key as they were entered. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
add_to_sclist(MBROWSER, "^T", do_exit, 0);
|
||||
#endif
|
||||
#ifndef DISABLE_HELP
|
||||
add_to_sclist(MHELP, "^G", do_exit, 0);
|
||||
add_to_sclist(MHELP, "Home", do_first_line, 0);
|
||||
add_to_sclist(MHELP, "End", do_last_line, 0);
|
||||
#endif
|
||||
add_to_sclist(MMOST, "^I", do_tab, 0);
|
||||
add_to_sclist(MMOST, "^M", do_enter_void, 0);
|
||||
add_to_sclist(MMOST, "Enter", do_enter_void, 0);
|
||||
add_to_sclist(MMOST, "^M", do_enter, 0);
|
||||
add_to_sclist(MMOST, "Enter", do_enter, 0);
|
||||
add_to_sclist(MMOST, "^D", do_delete, 0);
|
||||
add_to_sclist(MMOST, "Del", do_delete, 0);
|
||||
add_to_sclist(MMOST, "^H", do_backspace, 0);
|
||||
@@ -1190,17 +1235,24 @@ void shortcut_init(void)
|
||||
}
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
void set_lint_shortcuts(void)
|
||||
void set_lint_or_format_shortcuts(void)
|
||||
{
|
||||
#ifndef DISABLE_SPELLER
|
||||
replace_scs_for(do_spell, do_linter);
|
||||
if (openfile->syntax->formatter) {
|
||||
replace_scs_for(do_spell, do_formatter);
|
||||
replace_scs_for(do_linter, do_formatter);
|
||||
} else {
|
||||
replace_scs_for(do_spell, do_linter);
|
||||
replace_scs_for(do_formatter, do_linter);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_spell_shortcuts(void)
|
||||
{
|
||||
#ifndef DISABLE_SPELLER
|
||||
replace_scs_for(do_linter, do_spell);
|
||||
replace_scs_for(do_formatter, do_spell);
|
||||
replace_scs_for(do_linter, do_spell);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -1221,44 +1273,44 @@ const subnfunc *sctofunc(sc *s)
|
||||
const char *flagtostr(int flag)
|
||||
{
|
||||
switch (flag) {
|
||||
case NO_HELP:
|
||||
/* TRANSLATORS: The next seventeen strings are toggle descriptions;
|
||||
* they are best kept shorter than 40 characters, but may be longer. */
|
||||
return N_("Help mode");
|
||||
case CONST_UPDATE:
|
||||
return N_("Constant cursor position display");
|
||||
case MORE_SPACE:
|
||||
return N_("Use of one more line for editing");
|
||||
case SMOOTH_SCROLL:
|
||||
return N_("Smooth scrolling");
|
||||
case SOFTWRAP:
|
||||
return N_("Soft wrapping of overlong lines");
|
||||
case WHITESPACE_DISPLAY:
|
||||
return N_("Whitespace display");
|
||||
case NO_COLOR_SYNTAX:
|
||||
return N_("Color syntax highlighting");
|
||||
case SMART_HOME:
|
||||
return N_("Smart home key");
|
||||
case AUTOINDENT:
|
||||
return N_("Auto indent");
|
||||
case CUT_TO_END:
|
||||
return N_("Cut to end");
|
||||
case NO_WRAP:
|
||||
return N_("Hard wrapping of overlong lines");
|
||||
case TABS_TO_SPACES:
|
||||
return N_("Conversion of typed tabs to spaces");
|
||||
case BACKUP_FILE:
|
||||
return N_("Backup files");
|
||||
case MULTIBUFFER:
|
||||
return N_("Multiple file buffers");
|
||||
case USE_MOUSE:
|
||||
return N_("Mouse support");
|
||||
case NO_CONVERT:
|
||||
return N_("No conversion from DOS/Mac format");
|
||||
case SUSPEND:
|
||||
return N_("Suspension");
|
||||
default:
|
||||
return "?????";
|
||||
case NO_HELP:
|
||||
/* TRANSLATORS: The next seventeen strings are toggle descriptions;
|
||||
* they are best kept shorter than 40 characters, but may be longer. */
|
||||
return N_("Help mode");
|
||||
case CONST_UPDATE:
|
||||
return N_("Constant cursor position display");
|
||||
case MORE_SPACE:
|
||||
return N_("Use of one more line for editing");
|
||||
case SMOOTH_SCROLL:
|
||||
return N_("Smooth scrolling");
|
||||
case SOFTWRAP:
|
||||
return N_("Soft wrapping of overlong lines");
|
||||
case WHITESPACE_DISPLAY:
|
||||
return N_("Whitespace display");
|
||||
case NO_COLOR_SYNTAX:
|
||||
return N_("Color syntax highlighting");
|
||||
case SMART_HOME:
|
||||
return N_("Smart home key");
|
||||
case AUTOINDENT:
|
||||
return N_("Auto indent");
|
||||
case CUT_TO_END:
|
||||
return N_("Cut to end");
|
||||
case NO_WRAP:
|
||||
return N_("Hard wrapping of overlong lines");
|
||||
case TABS_TO_SPACES:
|
||||
return N_("Conversion of typed tabs to spaces");
|
||||
case BACKUP_FILE:
|
||||
return N_("Backup files");
|
||||
case MULTIBUFFER:
|
||||
return N_("Reading file into separate buffer");
|
||||
case USE_MOUSE:
|
||||
return N_("Mouse support");
|
||||
case NO_CONVERT:
|
||||
return N_("No conversion from DOS/Mac format");
|
||||
case SUSPEND:
|
||||
return N_("Suspension");
|
||||
default:
|
||||
return "?????";
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
@@ -1283,6 +1335,10 @@ sc *strtosc(char *input)
|
||||
s->scfunc = do_exit;
|
||||
else if (!strcasecmp(input, "writeout"))
|
||||
s->scfunc = do_writeout_void;
|
||||
#ifndef NANO_TINY
|
||||
else if (!strcasecmp(input, "savefile"))
|
||||
s->scfunc = do_savefile;
|
||||
#endif
|
||||
else if (!strcasecmp(input, "insert"))
|
||||
s->scfunc = do_insertfile_void;
|
||||
else if (!strcasecmp(input, "whereis"))
|
||||
@@ -1291,6 +1347,10 @@ sc *strtosc(char *input)
|
||||
else if (!strcasecmp(input, "searchagain") ||
|
||||
!strcasecmp(input, "research"))
|
||||
s->scfunc = do_research;
|
||||
else if (!strcasecmp(input, "findprevious"))
|
||||
s->scfunc = do_findprevious;
|
||||
else if (!strcasecmp(input, "findnext"))
|
||||
s->scfunc = do_findnext;
|
||||
#endif
|
||||
else if (!strcasecmp(input, "replace"))
|
||||
s->scfunc = do_replace;
|
||||
@@ -1310,6 +1370,10 @@ sc *strtosc(char *input)
|
||||
else if (!strcasecmp(input, "tospell") ||
|
||||
!strcasecmp(input, "speller"))
|
||||
s->scfunc = do_spell;
|
||||
#endif
|
||||
#ifndef DISABLE_COLOR
|
||||
else if (!strcasecmp(input, "linter"))
|
||||
s->scfunc = do_linter;
|
||||
#endif
|
||||
else if (!strcasecmp(input, "curpos") ||
|
||||
!strcasecmp(input, "cursorpos"))
|
||||
@@ -1339,6 +1403,10 @@ sc *strtosc(char *input)
|
||||
s->scfunc = do_prev_word_void;
|
||||
else if (!strcasecmp(input, "nextword"))
|
||||
s->scfunc = do_next_word_void;
|
||||
else if (!strcasecmp(input, "cutwordleft"))
|
||||
s->scfunc = do_cut_prev_word;
|
||||
else if (!strcasecmp(input, "cutwordright"))
|
||||
s->scfunc = do_cut_next_word;
|
||||
else if (!strcasecmp(input, "findbracket"))
|
||||
s->scfunc = do_find_bracket;
|
||||
else if (!strcasecmp(input, "wordcount"))
|
||||
@@ -1385,7 +1453,7 @@ sc *strtosc(char *input)
|
||||
else if (!strcasecmp(input, "tab"))
|
||||
s->scfunc = do_tab;
|
||||
else if (!strcasecmp(input, "enter"))
|
||||
s->scfunc = do_enter_void;
|
||||
s->scfunc = do_enter;
|
||||
else if (!strcasecmp(input, "delete"))
|
||||
s->scfunc = do_delete;
|
||||
else if (!strcasecmp(input, "backspace"))
|
||||
@@ -1559,34 +1627,25 @@ void thanks_for_all_the_fish(void)
|
||||
delwin(bottomwin);
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
if (quotestr != NULL)
|
||||
free(quotestr);
|
||||
free(quotestr);
|
||||
#ifdef HAVE_REGEX_H
|
||||
regfree("ereg);
|
||||
if (quoteerr != NULL)
|
||||
free(quoteerr);
|
||||
free(quoteerr);
|
||||
#endif
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
if (backup_dir != NULL)
|
||||
free(backup_dir);
|
||||
free(backup_dir);
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (operating_dir != NULL)
|
||||
free(operating_dir);
|
||||
if (full_operating_dir != NULL)
|
||||
free(full_operating_dir);
|
||||
free(operating_dir);
|
||||
free(full_operating_dir);
|
||||
#endif
|
||||
if (last_search != NULL)
|
||||
free(last_search);
|
||||
if (last_replace != NULL)
|
||||
free(last_replace);
|
||||
free(answer);
|
||||
free(last_search);
|
||||
free(last_replace);
|
||||
#ifndef DISABLE_SPELLER
|
||||
if (alt_speller != NULL)
|
||||
free(alt_speller);
|
||||
free(alt_speller);
|
||||
#endif
|
||||
if (answer != NULL)
|
||||
free(answer);
|
||||
if (cutbuffer != NULL)
|
||||
free_filestruct(cutbuffer);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -1597,12 +1656,13 @@ void thanks_for_all_the_fish(void)
|
||||
if (openfile != NULL)
|
||||
free_openfilestruct(openfile);
|
||||
#ifndef DISABLE_COLOR
|
||||
if (syntaxstr != NULL)
|
||||
free(syntaxstr);
|
||||
free(syntaxstr);
|
||||
while (syntaxes != NULL) {
|
||||
syntaxtype *bill = syntaxes;
|
||||
|
||||
free(syntaxes->desc);
|
||||
free(syntaxes->linter);
|
||||
free(syntaxes->formatter);
|
||||
while (syntaxes->extensions != NULL) {
|
||||
regexlisttype *bob = syntaxes->extensions;
|
||||
syntaxes->extensions = bob->next;
|
||||
@@ -1663,18 +1723,17 @@ void thanks_for_all_the_fish(void)
|
||||
#endif
|
||||
/* Free the functions and shortcuts lists. */
|
||||
while (allfuncs != NULL) {
|
||||
subnfunc *f = allfuncs;
|
||||
allfuncs = allfuncs->next;
|
||||
free(f);
|
||||
subnfunc *f = allfuncs;
|
||||
allfuncs = allfuncs->next;
|
||||
free(f);
|
||||
}
|
||||
while (sclist != NULL) {
|
||||
sc *s = sclist;
|
||||
sclist = sclist->next;
|
||||
free(s);
|
||||
sc *s = sclist;
|
||||
sclist = sclist->next;
|
||||
free(s);
|
||||
}
|
||||
#ifndef DISABLE_NANORC
|
||||
if (homedir != NULL)
|
||||
free(homedir);
|
||||
free(homedir);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
194
src/help.c
194
src/help.c
@@ -32,9 +32,12 @@
|
||||
static char *help_text = NULL;
|
||||
/* The text displayed in the help window. */
|
||||
|
||||
/* Our main help browser function. refresh_func is the function we will
|
||||
* call to refresh the edit window. */
|
||||
void do_help(void (*refresh_func)(void))
|
||||
static char *end_of_intro = NULL;
|
||||
/* The point in the help text where the introductory paragraphs end
|
||||
* and the shortcut descriptions begin. */
|
||||
|
||||
/* Our main help-viewer function. */
|
||||
void do_help(void)
|
||||
{
|
||||
int kbinput = ERR;
|
||||
bool old_no_help = ISSET(NO_HELP);
|
||||
@@ -62,10 +65,6 @@ void do_help(void (*refresh_func)(void))
|
||||
|
||||
assert(help_text != NULL);
|
||||
|
||||
/* Set currmenu to allow clicking on the help screen's shortcut
|
||||
* list, after help_init() is called. */
|
||||
currmenu = MHELP;
|
||||
|
||||
if (ISSET(NO_HELP)) {
|
||||
/* Make sure that the help screen's shortcut list will actually
|
||||
* be displayed. */
|
||||
@@ -76,35 +75,35 @@ void do_help(void (*refresh_func)(void))
|
||||
bottombars(MHELP);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
/* Get the last line of the help text. */
|
||||
ptr = help_text;
|
||||
|
||||
for (; *ptr != '\0'; last_line++) {
|
||||
ptr += help_line_len(ptr);
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
if (last_line > 0)
|
||||
last_line--;
|
||||
|
||||
while (TRUE) {
|
||||
size_t i;
|
||||
|
||||
/* Display the help text if we don't have a key, or if the help
|
||||
* text has moved. */
|
||||
if (kbinput == ERR || line != old_line) {
|
||||
ptr = help_text;
|
||||
|
||||
/* Find the line number of the last line of the help text. */
|
||||
for (last_line = 0; *ptr != '\0'; last_line++) {
|
||||
ptr += help_line_len(ptr);
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (last_line > 0)
|
||||
last_line--;
|
||||
|
||||
/* Redisplay if the text was scrolled or an invalid key was pressed. */
|
||||
if (line != old_line || kbinput == ERR) {
|
||||
blank_edit();
|
||||
|
||||
ptr = help_text;
|
||||
|
||||
/* Calculate where in the text we should be, based on the
|
||||
* page. */
|
||||
/* Advance in the text to the first line to be displayed. */
|
||||
for (i = 0; i < line; i++) {
|
||||
ptr += help_line_len(ptr);
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
|
||||
/* Now display as many lines as the window will hold. */
|
||||
for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
|
||||
size_t j = help_line_len(ptr);
|
||||
|
||||
@@ -121,6 +120,14 @@ void do_help(void (*refresh_func)(void))
|
||||
|
||||
kbinput = get_kbinput(edit);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (kbinput == KEY_WINCH) {
|
||||
kbinput = ERR;
|
||||
curs_set(0);
|
||||
continue; /* Redraw the screen. */
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
if (kbinput == KEY_MOUSE) {
|
||||
int mouse_x, mouse_y;
|
||||
@@ -153,51 +160,50 @@ void do_help(void (*refresh_func)(void))
|
||||
if (line + (editwinrows - 1) < last_line)
|
||||
line = last_line - (editwinrows - 1);
|
||||
} else if (func == do_exit) {
|
||||
/* Exit from the help browser. */
|
||||
/* Exit from the help viewer. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
currmenu = oldmenu;
|
||||
|
||||
if (old_no_help) {
|
||||
blank_bottombars();
|
||||
wnoutrefresh(bottomwin);
|
||||
currmenu = oldmenu;
|
||||
SET(NO_HELP);
|
||||
window_init();
|
||||
} else
|
||||
bottombars(currmenu);
|
||||
bottombars(oldmenu);
|
||||
|
||||
curs_set(1);
|
||||
refresh_func();
|
||||
|
||||
/* The help_init() at the beginning allocated help_text. Since
|
||||
* help_text has now been written to the screen, we don't need it
|
||||
* anymore. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
|
||||
browser_refresh();
|
||||
else
|
||||
#endif
|
||||
edit_refresh();
|
||||
|
||||
/* We're exiting from the help screen. */
|
||||
free(help_text);
|
||||
help_text = NULL;
|
||||
}
|
||||
|
||||
/* This function allocates help_text, and stores the help string in it.
|
||||
* help_text should be NULL initially. */
|
||||
/* Allocate space for the help text for the current menu, and concatenate
|
||||
* the different pieces of text into it. */
|
||||
void help_init(void)
|
||||
{
|
||||
size_t allocsize = 0; /* Space needed for help_text. */
|
||||
const char *htx[3]; /* Untranslated help message. We break
|
||||
* it up into three chunks in case the
|
||||
* full string is too long for the
|
||||
* compiler to handle. */
|
||||
size_t allocsize = 0;
|
||||
/* Space needed for help_text. */
|
||||
const char *htx[3];
|
||||
/* Untranslated help introduction. We break it up into three chunks
|
||||
* in case the full string is too long for the compiler to handle. */
|
||||
char *ptr;
|
||||
const subnfunc *f;
|
||||
const sc *s;
|
||||
int scsfound = 0;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
#ifndef DISABLE_NANORC
|
||||
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
|
||||
|
||||
UNSET(WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* First, set up the initial help text for the current function. */
|
||||
@@ -364,9 +370,9 @@ void help_init(void)
|
||||
/* Calculate the length of the shortcut help text. Each entry has
|
||||
* one or two keys, which fill 16 columns, plus translated text,
|
||||
* plus one or two \n's. */
|
||||
for (f = allfuncs; f != NULL; f = f->next)
|
||||
if (f->menus & currmenu)
|
||||
allocsize += (16 * mb_cur_max()) + strlen(f->help) + 2;
|
||||
for (f = allfuncs; f != NULL; f = f->next)
|
||||
if (f->menus & currmenu)
|
||||
allocsize += (16 * mb_cur_max()) + strlen(f->help) + 2;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we're on the main list, we also count the toggle help text.
|
||||
@@ -381,11 +387,6 @@ void help_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* help_text has been freed and set to NULL unless the user resized
|
||||
* while in the help screen. */
|
||||
if (help_text != NULL)
|
||||
free(help_text);
|
||||
|
||||
/* Allocate space for the help text. */
|
||||
help_text = charalloc(allocsize + 1);
|
||||
|
||||
@@ -398,19 +399,20 @@ void help_init(void)
|
||||
|
||||
ptr = help_text + strlen(help_text);
|
||||
|
||||
/* Remember this end-of-introduction, start-of-shortcuts. */
|
||||
end_of_intro = ptr;
|
||||
|
||||
/* Now add our shortcut info. */
|
||||
for (f = allfuncs; f != NULL; f = f->next) {
|
||||
int scsfound = 0;
|
||||
|
||||
if ((f->menus & currmenu) == 0)
|
||||
continue;
|
||||
|
||||
/* Let's simply show the first two shortcuts from the list. */
|
||||
for (s = sclist, scsfound = 0; s != NULL; s = s->next) {
|
||||
for (s = sclist; s != NULL; s = s->next) {
|
||||
|
||||
if (s->type == RAWINPUT)
|
||||
continue;
|
||||
|
||||
if ((s->menu & currmenu) == 0)
|
||||
if ((s->menus & currmenu) == 0)
|
||||
continue;
|
||||
|
||||
if (s->scfunc == f->scfunc) {
|
||||
@@ -441,23 +443,32 @@ void help_init(void)
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* And the toggles... */
|
||||
if (currmenu == MMAIN)
|
||||
for (s = sclist; s != NULL; s = s->next) {
|
||||
if (s->scfunc == do_toggle_void)
|
||||
ptr += sprintf(ptr, "%s\t\t%s %s\n", (s->menu == MMAIN ? s->keystr : ""),
|
||||
_(flagtostr(s->toggle)), _("enable/disable"));
|
||||
if (s->toggle == NO_COLOR_SYNTAX || s->toggle == TABS_TO_SPACES)
|
||||
ptr += sprintf(ptr, "\n");
|
||||
}
|
||||
if (currmenu == MMAIN) {
|
||||
int maximum = 0, counter = 0;
|
||||
|
||||
/* First see how many toggles there are. */
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
maximum = (s->toggle && s->ordinal > maximum) ? s->ordinal : maximum;
|
||||
|
||||
/* Now show them in the original order. */
|
||||
while (counter < maximum) {
|
||||
counter++;
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->toggle && s->ordinal == counter) {
|
||||
ptr += sprintf(ptr, "%s\t\t%s %s\n", (s->menus == MMAIN ? s->keystr : ""),
|
||||
_(flagtostr(s->toggle)), _("enable/disable"));
|
||||
if (s->toggle == NO_COLOR_SYNTAX || s->toggle == TABS_TO_SPACES)
|
||||
ptr += sprintf(ptr, "\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
if (old_whitespace)
|
||||
SET(WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* If all went well, we didn't overwrite the allocated space for
|
||||
* help_text. */
|
||||
/* If all went well, we didn't overwrite the allocated space. */
|
||||
assert(strlen(help_text) <= allocsize + 1);
|
||||
}
|
||||
|
||||
@@ -479,46 +490,45 @@ functionptrtype parse_help_input(int *kbinput)
|
||||
return func_from_key(kbinput);
|
||||
}
|
||||
|
||||
/* Calculate the next line of help_text, starting at ptr. */
|
||||
/* Calculate the displayable length of the help-text line starting at ptr. */
|
||||
size_t help_line_len(const char *ptr)
|
||||
{
|
||||
int help_cols = (COLS > 24) ? COLS - 1 : 24;
|
||||
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. */
|
||||
|
||||
/* Try to break the line at (COLS - 1) columns if we have more than
|
||||
* 24 columns, and at 24 columns otherwise. */
|
||||
ssize_t wrap_loc = break_line(ptr, help_cols, TRUE);
|
||||
size_t retval = (wrap_loc < 0) ? 0 : wrap_loc;
|
||||
size_t retval_save = retval;
|
||||
/* 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 + retval) != '\0' && *(ptr + retval) != '\n')
|
||||
retval += move_mbright(ptr + retval, 0);
|
||||
while (*(ptr + length) != '\0' && *(ptr + length) != '\n')
|
||||
length = move_mbright(ptr, length);
|
||||
|
||||
/* If the entire line doesn't go more than one column beyond where
|
||||
* we tried to break it, we should display it as-is. Otherwise, we
|
||||
* should display it only up to the break. */
|
||||
if (strnlenpt(ptr, retval) > help_cols + 1)
|
||||
retval = retval_save;
|
||||
|
||||
return retval;
|
||||
/* If the entire line will just fit the screen, don't wrap it. */
|
||||
if (strnlenpt(ptr, length) <= wrapping_point + 1)
|
||||
return length;
|
||||
else if (wrap_location > 0)
|
||||
return wrap_location;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* !DISABLE_HELP */
|
||||
|
||||
/* Start the help browser. */
|
||||
/* Start the help viewer. */
|
||||
void do_help_void(void)
|
||||
{
|
||||
#ifndef DISABLE_HELP
|
||||
/* Start the help browser, with the correct refresher for afterwards. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
if (currmenu == MBROWSER || currmenu == MWHEREISFILE || currmenu == MGOTODIR)
|
||||
do_help(&browser_refresh);
|
||||
else
|
||||
#endif
|
||||
do_help(&edit_refresh);
|
||||
do_help();
|
||||
#else
|
||||
if (currmenu == MMAIN)
|
||||
nano_disabled_msg();
|
||||
say_there_is_no_help();
|
||||
else
|
||||
beep();
|
||||
#endif /* !DISABLE_HELP */
|
||||
|
||||
236
src/move.c
236
src/move.c
@@ -52,9 +52,8 @@ void do_page_up(void)
|
||||
{
|
||||
int i, skipped = 0;
|
||||
|
||||
/* If there's less than a page of text left on the screen, put the
|
||||
* cursor at the beginning of the first line of the file, and then
|
||||
* update the edit window. */
|
||||
/* If the cursor is less than a page away from the top of the file,
|
||||
* put it at the beginning of the first line. */
|
||||
if (openfile->current->lineno == 1 || (
|
||||
#ifndef NANO_TINY
|
||||
!ISSET(SOFTWRAP) &&
|
||||
@@ -106,9 +105,8 @@ void do_page_down(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* If there's less than a page of text left on the screen, put the
|
||||
* cursor at the beginning of the last line of the file, and then
|
||||
* update the edit window. */
|
||||
/* If the cursor is less than a page away from the bottom of the file,
|
||||
* put it at the end of the last line. */
|
||||
if (openfile->current->lineno + maxrows - 2 >=
|
||||
openfile->filebot->lineno) {
|
||||
do_last_line();
|
||||
@@ -225,75 +223,37 @@ bool do_next_word(bool allow_punct, bool allow_update)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
filestruct *current_save = openfile->current;
|
||||
char *char_mb;
|
||||
int char_mb_len;
|
||||
bool end_line = FALSE, started_on_word = FALSE;
|
||||
bool started_on_word = is_word_mbchar(openfile->current->data +
|
||||
openfile->current_x, allow_punct);
|
||||
bool seen_space = !started_on_word;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
char_mb = charalloc(mb_cur_max());
|
||||
|
||||
/* Move forward until we find the character after the last letter of
|
||||
* the current word. */
|
||||
while (!end_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving forward through the current
|
||||
* line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
/* If we haven't found it, then we've started on a word, so set
|
||||
* started_on_word to TRUE. */
|
||||
started_on_word = TRUE;
|
||||
|
||||
if (openfile->current->data[openfile->current_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
openfile->current_x += char_mb_len;
|
||||
}
|
||||
|
||||
/* Move forward until we find the first letter of the next word. */
|
||||
if (openfile->current->data[openfile->current_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
openfile->current_x += char_mb_len;
|
||||
|
||||
for (; openfile->current != NULL;
|
||||
openfile->current = openfile->current->next) {
|
||||
while (!end_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving forward through the
|
||||
* current line. */
|
||||
if (is_word_mbchar(char_mb, allow_punct))
|
||||
/* Move forward until we reach the start of a word. */
|
||||
while (TRUE) {
|
||||
/* If at the end of a line, move to the beginning of the next one. */
|
||||
if (openfile->current->data[openfile->current_x] == '\0') {
|
||||
/* If at the end of the file, stop. */
|
||||
if (openfile->current->next == NULL)
|
||||
break;
|
||||
|
||||
if (openfile->current->data[openfile->current_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
openfile->current_x += char_mb_len;
|
||||
}
|
||||
|
||||
/* If we've found it, stop moving forward to the beginnings of
|
||||
* subsequent lines. */
|
||||
if (!end_line)
|
||||
break;
|
||||
|
||||
if (openfile->current != openfile->filebot) {
|
||||
end_line = FALSE;
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_x = 0;
|
||||
seen_space = TRUE;
|
||||
} else {
|
||||
/* Step forward one character. */
|
||||
openfile->current_x = move_mbright(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
/* If this is not a word character, then it's a separator; else
|
||||
* if we've already seen a separator, then it's a word start. */
|
||||
if (!is_word_mbchar(openfile->current->data + openfile->current_x,
|
||||
allow_punct))
|
||||
seen_space = TRUE;
|
||||
else if (seen_space)
|
||||
break;
|
||||
}
|
||||
|
||||
free(char_mb);
|
||||
|
||||
/* If we haven't found it, move to the end of the file. */
|
||||
if (openfile->current == NULL)
|
||||
openfile->current = openfile->filebot;
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
@@ -314,125 +274,51 @@ void do_next_word_void(void)
|
||||
|
||||
/* Move to the previous word in the file. If allow_punct is TRUE, treat
|
||||
* punctuation as part of a word. If allow_update is TRUE, update the
|
||||
* screen afterwards. Return TRUE if we started on a word, and FALSE
|
||||
* otherwise. */
|
||||
bool do_prev_word(bool allow_punct, bool allow_update)
|
||||
* screen afterwards. */
|
||||
void do_prev_word(bool allow_punct, bool allow_update)
|
||||
{
|
||||
size_t pww_save = openfile->placewewant;
|
||||
filestruct *current_save = openfile->current;
|
||||
char *char_mb;
|
||||
int char_mb_len;
|
||||
bool begin_line = FALSE, started_on_word = FALSE;
|
||||
bool seen_a_word = FALSE, step_forward = FALSE;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
char_mb = charalloc(mb_cur_max());
|
||||
/* Move backward until we pass over the start of a word. */
|
||||
while (TRUE) {
|
||||
/* If at the head of a line, move to the end of the preceding one. */
|
||||
if (openfile->current_x == 0) {
|
||||
if (openfile->current->prev == NULL)
|
||||
break;
|
||||
openfile->current = openfile->current->prev;
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
}
|
||||
|
||||
/* Move backward until we find the character before the first letter
|
||||
* of the current word. */
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the current
|
||||
* line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
/* If we haven't found it, then we've started on a word, so set
|
||||
* started_on_word to TRUE. */
|
||||
started_on_word = TRUE;
|
||||
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
/* Move backward until we find the last letter of the previous
|
||||
* word. */
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
/* Step back one character. */
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
|
||||
for (; openfile->current != NULL;
|
||||
openfile->current = openfile->current->prev) {
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the
|
||||
* current line. */
|
||||
if (is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
openfile->current_x);
|
||||
|
||||
if (is_word_mbchar(openfile->current->data + openfile->current_x,
|
||||
allow_punct)) {
|
||||
seen_a_word = TRUE;
|
||||
/* If at the head of a line now, this surely is a word start. */
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x =
|
||||
move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
/* If we've found it, stop moving backward to the ends of
|
||||
* previous lines. */
|
||||
if (!begin_line)
|
||||
break;
|
||||
} else if (seen_a_word) {
|
||||
/* This is space now: we've overshot the start of the word. */
|
||||
step_forward = TRUE;
|
||||
break;
|
||||
|
||||
if (openfile->current != openfile->fileage) {
|
||||
begin_line = FALSE;
|
||||
openfile->current_x = strlen(openfile->current->prev->data);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we haven't found it, move to the beginning of the file. */
|
||||
if (openfile->current == NULL)
|
||||
openfile->current = openfile->fileage;
|
||||
/* If we've found it, move backward until we find the character
|
||||
* before the first letter of the previous word. */
|
||||
else if (!begin_line) {
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(openfile->current->data +
|
||||
openfile->current_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the
|
||||
* current line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
if (openfile->current_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
openfile->current_x =
|
||||
move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
}
|
||||
|
||||
/* If we've found it, move forward to the first letter of the
|
||||
* previous word. */
|
||||
if (!begin_line)
|
||||
openfile->current_x += char_mb_len;
|
||||
}
|
||||
|
||||
free(char_mb);
|
||||
|
||||
if (step_forward)
|
||||
/* Move one character forward again to sit on the start of the word. */
|
||||
openfile->current_x = move_mbright(openfile->current->data,
|
||||
openfile->current_x);
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update)
|
||||
edit_redraw(current_save, pww_save);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
return started_on_word;
|
||||
}
|
||||
|
||||
/* Move to the previous word in the file, treating punctuation as part
|
||||
@@ -471,7 +357,7 @@ void do_home(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
if (need_screen_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
@@ -483,7 +369,7 @@ void do_end(void)
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
if (need_screen_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
@@ -534,7 +420,7 @@ void do_up(
|
||||
* needs to be redrawn if we're not on the first page, and the
|
||||
* latter needs to be drawn unconditionally. */
|
||||
if (openfile->current_y > 0) {
|
||||
if (need_vertical_update(0))
|
||||
if (need_screen_update(0))
|
||||
update_line(openfile->current->next, 0);
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
@@ -592,11 +478,11 @@ void do_down(
|
||||
topline = openfile->edittop;
|
||||
/* Reduce the amount when there are overlong lines at the top. */
|
||||
for (enough = 1; enough < amount; enough++) {
|
||||
if (amount <= strlenpt(topline->data) / COLS) {
|
||||
amount -= strlenpt(topline->data) / COLS;
|
||||
if (amount <= 0) {
|
||||
amount = enough;
|
||||
break;
|
||||
}
|
||||
amount -= strlenpt(topline->data) / COLS;
|
||||
topline = topline->next;
|
||||
}
|
||||
}
|
||||
@@ -632,7 +518,7 @@ void do_down(
|
||||
|| ISSET(SOFTWRAP)
|
||||
#endif
|
||||
) {
|
||||
if (need_vertical_update(0))
|
||||
if (need_screen_update(0))
|
||||
update_line(openfile->current->prev, 0);
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
@@ -671,7 +557,7 @@ void do_left(void)
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
if (need_screen_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
@@ -692,6 +578,6 @@ void do_right(void)
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
if (need_screen_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
496
src/nano.c
496
src/nano.c
File diff suppressed because it is too large
Load Diff
128
src/nano.h
128
src/nano.h
@@ -116,9 +116,7 @@
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* If no vsnprintf(), use the version from glib 2.x. */
|
||||
@@ -194,6 +192,7 @@ typedef enum {
|
||||
JOIN, PASTE, INSERT, ENTER, OTHER
|
||||
} undo_type;
|
||||
|
||||
/* Structure types. */
|
||||
typedef struct color_pair {
|
||||
int pairnum;
|
||||
/* The color pair number used for this foreground color and
|
||||
@@ -251,6 +250,8 @@ typedef struct syntaxtype {
|
||||
/* The colors used in this syntax. */
|
||||
char *linter;
|
||||
/* The command to lint this type of file. */
|
||||
char *formatter;
|
||||
/* Use this formatter command (for programming lang mainly) */
|
||||
int nmultis;
|
||||
/* How many multi-line strings this syntax has. */
|
||||
struct syntaxtype *next;
|
||||
@@ -272,7 +273,7 @@ typedef struct lintstruct {
|
||||
/* Previous error. */
|
||||
} lintstruct;
|
||||
|
||||
|
||||
/* Flags that indicate how a multiline regex applies to a line. */
|
||||
#define CNONE (1<<1)
|
||||
/* Yay, regex doesn't apply to this line at all! */
|
||||
#define CBEGINBEFORE (1<<2)
|
||||
@@ -283,13 +284,9 @@ typedef struct lintstruct {
|
||||
/* Whole line engulfed by the regex, start < me, end > me. */
|
||||
#define CSTARTENDHERE (1<<5)
|
||||
/* Regex starts and ends within this line. */
|
||||
#define CWTF (1<<6)
|
||||
/* Something else. */
|
||||
|
||||
#endif /* !DISABLE_COLOR */
|
||||
|
||||
|
||||
/* Structure types. */
|
||||
/* More structure types. */
|
||||
typedef struct filestruct {
|
||||
char *data;
|
||||
/* The text of this line. */
|
||||
@@ -332,6 +329,10 @@ typedef struct undo {
|
||||
/* Where did this action begin or end. */
|
||||
char *strdata;
|
||||
/* String type data we will use for copying the affected line back. */
|
||||
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. */
|
||||
|
||||
@@ -364,75 +365,57 @@ typedef struct poshiststruct {
|
||||
|
||||
typedef struct openfilestruct {
|
||||
char *filename;
|
||||
/* The current file's name. */
|
||||
/* The file's name. */
|
||||
filestruct *fileage;
|
||||
/* The current file's first line. */
|
||||
/* The file's first line. */
|
||||
filestruct *filebot;
|
||||
/* The current file's last line. */
|
||||
/* The file's last line. */
|
||||
filestruct *edittop;
|
||||
/* The current top of the edit window. */
|
||||
/* The current top of the edit window for this file. */
|
||||
filestruct *current;
|
||||
/* The current file's current line. */
|
||||
/* The current line for this file. */
|
||||
size_t totsize;
|
||||
/* The current file's total number of characters. */
|
||||
/* The file's total number of characters. */
|
||||
size_t current_x;
|
||||
/* The current file's x-coordinate position. */
|
||||
/* The file's x-coordinate position. */
|
||||
size_t placewewant;
|
||||
/* The current file's x position we would like. */
|
||||
/* The file's x position we would like. */
|
||||
ssize_t current_y;
|
||||
/* The current file's y-coordinate position. */
|
||||
/* The file's y-coordinate position. */
|
||||
bool modified;
|
||||
/* Whether the current file has been modified. */
|
||||
/* Whether the file has been modified. */
|
||||
#ifndef NANO_TINY
|
||||
bool mark_set;
|
||||
/* Whether the mark is on in the current file. */
|
||||
/* Whether the mark is on in this file. */
|
||||
filestruct *mark_begin;
|
||||
/* The current file's beginning marked line, if any. */
|
||||
/* The file's line where the mark is, if any. */
|
||||
size_t mark_begin_x;
|
||||
/* The current file's beginning marked line's x-coordinate
|
||||
* position, if any. */
|
||||
/* The file's mark's x-coordinate position, if any. */
|
||||
file_format fmt;
|
||||
/* The current file's format. */
|
||||
/* The file's format. */
|
||||
struct stat *current_stat;
|
||||
/* The current file's stat. */
|
||||
/* The file's current stat information. */
|
||||
undo *undotop;
|
||||
/* Top of the undo list. */
|
||||
/* The top of the undo list. */
|
||||
undo *current_undo;
|
||||
/* The current (i.e. next) level of undo. */
|
||||
undo_type last_action;
|
||||
const char *lock_filename;
|
||||
/* The type of the last action the user performed. */
|
||||
char *lock_filename;
|
||||
/* The path of the lockfile, if we created one. */
|
||||
#endif
|
||||
#ifndef DISABLE_COLOR
|
||||
syntaxtype *syntax;
|
||||
/* The syntax struct for this file, if any. */
|
||||
colortype *colorstrings;
|
||||
/* The current file's associated colors. */
|
||||
/* The file's associated colors. */
|
||||
#endif
|
||||
struct openfilestruct *next;
|
||||
/* Next node. */
|
||||
/* The next open file, if any. */
|
||||
struct openfilestruct *prev;
|
||||
/* Previous node. */
|
||||
/* The preceding open file, if any. */
|
||||
} openfilestruct;
|
||||
|
||||
typedef struct shortcut {
|
||||
const char *desc;
|
||||
/* The function's description, e.g. "Page Up". */
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help;
|
||||
/* The help file entry text for this function. */
|
||||
bool blank_after;
|
||||
/* Whether there should be a blank line after the help entry
|
||||
* text for this function. */
|
||||
#endif
|
||||
bool viewok;
|
||||
/* Is this function allowed when in view mode? */
|
||||
void (*func)(void);
|
||||
/* The function to call when we get this key. */
|
||||
struct shortcut *next;
|
||||
/* Next shortcut. */
|
||||
} shortcut;
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
typedef struct rcoption {
|
||||
const char *name;
|
||||
@@ -448,38 +431,38 @@ typedef struct sc {
|
||||
key_type type;
|
||||
/* What kind of command key it is, for convenience later. */
|
||||
int seq;
|
||||
/* The actual sequence to check on the type is determined. */
|
||||
int menu;
|
||||
/* What list this applies to. */
|
||||
/* The actual sequence to check once the type is determined. */
|
||||
int menus;
|
||||
/* Which menus this applies to. */
|
||||
void (*scfunc)(void);
|
||||
/* The function we're going to run. */
|
||||
int toggle;
|
||||
/* If a toggle, what we're toggling. */
|
||||
bool execute;
|
||||
/* Whether to execute the function in question or just return
|
||||
* so the sequence can be caught by the calling code. */
|
||||
int ordinal;
|
||||
/* The how-manieth toggle this is, in order to be able to
|
||||
* keep them in sequence. */
|
||||
struct sc *next;
|
||||
/* Next in the list. */
|
||||
} sc;
|
||||
|
||||
typedef struct subnfunc {
|
||||
void (*scfunc)(void);
|
||||
/* What function this is. */
|
||||
/* The actual function to call. */
|
||||
int menus;
|
||||
/* In what menus this function applies. */
|
||||
const char *desc;
|
||||
/* The function's description, e.g. "Page Up". */
|
||||
/* The function's short description, for example "Where Is". */
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help;
|
||||
/* The help file entry text for this function. */
|
||||
/* The help-screen text for this function. */
|
||||
bool blank_after;
|
||||
/* Whether there should be a blank line after the help entry
|
||||
* text for this function. */
|
||||
/* Whether there should be a blank line after the help text
|
||||
* for this function. */
|
||||
#endif
|
||||
bool viewok;
|
||||
/* Is this function allowed when in view mode? */
|
||||
long toggle;
|
||||
/* If this is a toggle, if nonzero what toggle to set. */
|
||||
/* If this is a toggle, which toggle to affect. */
|
||||
struct subnfunc *next;
|
||||
/* Next item in the list. */
|
||||
} subnfunc;
|
||||
@@ -534,7 +517,8 @@ enum
|
||||
SOFTWRAP,
|
||||
POS_HISTORY,
|
||||
LOCKING,
|
||||
NOREAD_MODE
|
||||
NOREAD_MODE,
|
||||
MAKE_IT_UNIX
|
||||
};
|
||||
|
||||
/* Flags for the menus in which a given function should be present. */
|
||||
@@ -554,7 +538,8 @@ enum
|
||||
#define MYESNO (1<<13)
|
||||
#define MLINTER (1<<14)
|
||||
/* This is an abbreviation for all menus except Help and YesNo. */
|
||||
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MSPELL|MLINTER)
|
||||
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
|
||||
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MSPELL|MLINTER)
|
||||
|
||||
/* Control key sequences. Changing these would be very, very bad. */
|
||||
#define NANO_CONTROL_SPACE 0
|
||||
@@ -563,17 +548,18 @@ enum
|
||||
#define NANO_CONTROL_7 31
|
||||
#define NANO_CONTROL_8 127
|
||||
|
||||
/* Codes for "modified" Arrow keys. Chosen like this because some
|
||||
* terminals produce them, and they are beyond KEY_MAX of ncurses. */
|
||||
#define CONTROL_LEFT 539
|
||||
#define CONTROL_RIGHT 554
|
||||
/* Codes for "modified" Arrow keys, beyond KEY_MAX of ncurses. */
|
||||
#define CONTROL_LEFT 0x401
|
||||
#define CONTROL_RIGHT 0x402
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Extra bits for the undo function. */
|
||||
#define UNdel_del (1<<0)
|
||||
#define UNdel_backspace (1<<1)
|
||||
#define UNcut_marked_forward (1<<2)
|
||||
#define UNcut_cutline (1<<3)
|
||||
/* An imaginary key for when we get a SIGWINCH (window resize). */
|
||||
#define KEY_WINCH -2
|
||||
|
||||
/* Some extra flags for the undo function. */
|
||||
#define WAS_FINAL_BACKSPACE (1<<1)
|
||||
#define WAS_MARKED_FORWARD (1<<2)
|
||||
#define WAS_WHOLE_LINE (1<<3)
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* The maximum number of entries displayed in the main shortcut list. */
|
||||
|
||||
176
src/prompt.c
176
src/prompt.c
@@ -66,6 +66,11 @@ int do_statusbar_input(bool *ran_func, bool *finished,
|
||||
/* Read in a character. */
|
||||
input = get_kbinput(bottomwin);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (input == KEY_WINCH)
|
||||
return KEY_WINCH;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
/* If we got a mouse click and it was on a shortcut, read in the
|
||||
* shortcut character. */
|
||||
@@ -140,7 +145,7 @@ int do_statusbar_input(bool *ran_func, bool *finished,
|
||||
}
|
||||
|
||||
if (have_shortcut) {
|
||||
if (s->scfunc == do_tab || s->scfunc == do_enter_void)
|
||||
if (s->scfunc == do_tab || s->scfunc == do_enter)
|
||||
;
|
||||
else if (s->scfunc == total_refresh)
|
||||
total_statusbar_refresh(refresh_func);
|
||||
@@ -151,15 +156,15 @@ int do_statusbar_input(bool *ran_func, bool *finished,
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||
'\0' || currmenu != MWRITEFILE)
|
||||
do_statusbar_cut_text();
|
||||
} else if (s->scfunc == do_right)
|
||||
do_statusbar_right();
|
||||
else if (s->scfunc == do_left)
|
||||
} else if (s->scfunc == do_left)
|
||||
do_statusbar_left();
|
||||
else if (s->scfunc == do_right)
|
||||
do_statusbar_right();
|
||||
#ifndef NANO_TINY
|
||||
else if (s->scfunc == do_next_word_void)
|
||||
do_statusbar_next_word(FALSE);
|
||||
else if (s->scfunc == do_prev_word_void)
|
||||
do_statusbar_prev_word(FALSE);
|
||||
else if (s->scfunc == do_next_word_void)
|
||||
do_statusbar_next_word(FALSE);
|
||||
#endif
|
||||
else if (s->scfunc == do_home)
|
||||
do_statusbar_home();
|
||||
@@ -181,7 +186,7 @@ int do_statusbar_input(bool *ran_func, bool *finished,
|
||||
* set finished to TRUE to indicate that we're done. */
|
||||
if (got_enter) {
|
||||
get_input(NULL, 1);
|
||||
input = sc_seq_or(do_enter_void, 0);
|
||||
input = sc_seq_or(do_enter, 0);
|
||||
*finished = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -245,7 +250,7 @@ int do_statusbar_mouse(void)
|
||||
statusbar_xplustabs()) + mouse_x - start_col);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
}
|
||||
@@ -340,15 +345,14 @@ void do_statusbar_home(void)
|
||||
statusbar_x = 0;
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
statusbar_x = 0;
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
|
||||
@@ -360,7 +364,7 @@ void do_statusbar_end(void)
|
||||
statusbar_x = strlen(answer);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
|
||||
@@ -373,7 +377,7 @@ void do_statusbar_left(void)
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
}
|
||||
@@ -387,7 +391,7 @@ void do_statusbar_right(void)
|
||||
statusbar_x = move_mbright(answer, statusbar_x);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
}
|
||||
@@ -431,14 +435,13 @@ void do_statusbar_cut_text(void)
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(CUT_TO_END))
|
||||
null_at(&answer, statusbar_x);
|
||||
else {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
null_at(&answer, 0);
|
||||
statusbar_x = 0;
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
@@ -502,7 +505,7 @@ bool do_statusbar_next_word(bool allow_punct)
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
@@ -597,7 +600,7 @@ bool do_statusbar_prev_word(bool allow_punct)
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
@@ -647,7 +650,7 @@ size_t statusbar_xplustabs(void)
|
||||
* get_statusbar_page_start(column) < COLS). */
|
||||
size_t get_statusbar_page_start(size_t start_col, size_t column)
|
||||
{
|
||||
if (column == start_col || column < COLS - 1)
|
||||
if (column == start_col || column < COLS - 1 || COLS == start_col + 1)
|
||||
return 0;
|
||||
else
|
||||
return column - start_col - (column - start_col) % (COLS -
|
||||
@@ -700,10 +703,10 @@ void update_statusbar_line(const char *curranswer, size_t index)
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
|
||||
/* Return TRUE if we need an update after moving horizontally, and FALSE
|
||||
* otherwise. We need one if pww_save and statusbar_pww are on
|
||||
/* Return TRUE if we need an update after moving the cursor, and FALSE
|
||||
* otherwise. We need an update if pww_save and statusbar_pww are on
|
||||
* different pages. */
|
||||
bool need_statusbar_horizontal_update(size_t pww_save)
|
||||
bool need_statusbar_update(size_t pww_save)
|
||||
{
|
||||
size_t start_col = strlenpt(prompt) + 2;
|
||||
|
||||
@@ -777,7 +780,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
|
||||
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
|
||||
#endif
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
@@ -796,9 +799,17 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
|
||||
kbinput = do_statusbar_input(&ran_func, &finished, refresh_func);
|
||||
assert(statusbar_x <= strlen(answer));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (kbinput == KEY_WINCH) {
|
||||
refresh_func();
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
func = func_from_key(&kbinput);
|
||||
|
||||
if (func == do_cancel || func == do_enter_void)
|
||||
if (func == do_cancel || func == do_enter)
|
||||
break;
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
@@ -901,25 +912,22 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
/* Set the current position in the history list to the bottom,
|
||||
* and free magichistory if we need to. */
|
||||
if (history_list != NULL) {
|
||||
history_reset(*history_list);
|
||||
|
||||
if (magichistory != NULL)
|
||||
free(magichistory);
|
||||
free(magichistory);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* We've finished putting in an answer or run a normal shortcut's
|
||||
* associated function, so reset statusbar_x and statusbar_pww. If
|
||||
* we've finished putting in an answer, reset the statusbar cursor
|
||||
* position too. */
|
||||
if (func) {
|
||||
if (func == do_cancel || func == do_enter_void || ran_func) {
|
||||
if (func == do_cancel || func == do_enter || ran_func) {
|
||||
statusbar_x = old_statusbar_x;
|
||||
statusbar_pww = old_pww;
|
||||
|
||||
@@ -968,12 +976,10 @@ int do_prompt(bool allow_tabs,
|
||||
|
||||
/* prompt has been freed and set to NULL unless the user resized
|
||||
* while at the statusbar prompt. */
|
||||
if (prompt != NULL)
|
||||
free(prompt);
|
||||
free(prompt);
|
||||
|
||||
prompt = charalloc(((COLS - 4) * mb_cur_max()) + 1);
|
||||
|
||||
currmenu = menu;
|
||||
bottombars(menu);
|
||||
|
||||
va_start(ap, msg);
|
||||
@@ -1004,7 +1010,7 @@ int do_prompt(bool allow_tabs,
|
||||
* properly. */
|
||||
if (func == do_cancel)
|
||||
retval = -1;
|
||||
else if (func == do_enter_void)
|
||||
else if (func == do_enter)
|
||||
retval = (*answer == '\0') ? -2 : 0;
|
||||
|
||||
blank_statusbar();
|
||||
@@ -1045,7 +1051,6 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
const char *yesstr; /* String of Yes characters accepted. */
|
||||
const char *nostr; /* Same for No. */
|
||||
const char *allstr; /* And All, surprise! */
|
||||
const sc *s;
|
||||
int oldmenu = currmenu;
|
||||
|
||||
assert(msg != NULL);
|
||||
@@ -1061,60 +1066,67 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
nostr = _("Nn");
|
||||
allstr = _("Aa");
|
||||
|
||||
if (!ISSET(NO_HELP)) {
|
||||
char shortstr[3];
|
||||
/* Temp string for Yes, No, All. */
|
||||
|
||||
if (COLS < 32)
|
||||
width = COLS / 2;
|
||||
|
||||
/* Clear the shortcut list from the bottom of the screen. */
|
||||
blank_bottombars();
|
||||
|
||||
sprintf(shortstr, " %c", yesstr[0]);
|
||||
wmove(bottomwin, 1, 0);
|
||||
onekey(shortstr, _("Yes"), width);
|
||||
|
||||
if (all) {
|
||||
wmove(bottomwin, 1, width);
|
||||
shortstr[1] = allstr[0];
|
||||
onekey(shortstr, _("All"), width);
|
||||
}
|
||||
|
||||
wmove(bottomwin, 2, 0);
|
||||
shortstr[1] = nostr[0];
|
||||
onekey(shortstr, _("No"), width);
|
||||
|
||||
wmove(bottomwin, 2, 16);
|
||||
onekey("^C", _("Cancel"), width);
|
||||
}
|
||||
|
||||
if (interface_color_pair[TITLE_BAR].bright)
|
||||
wattron(bottomwin, A_BOLD);
|
||||
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
||||
|
||||
blank_statusbar();
|
||||
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
||||
|
||||
wattroff(bottomwin, A_BOLD);
|
||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
||||
|
||||
/* Refresh the edit window and the statusbar before getting
|
||||
* input. */
|
||||
wnoutrefresh(edit);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
do {
|
||||
int kbinput;
|
||||
functionptrtype func;
|
||||
#ifndef DISABLE_MOUSE
|
||||
int mouse_x, mouse_y;
|
||||
#endif
|
||||
|
||||
if (!ISSET(NO_HELP)) {
|
||||
char shortstr[3];
|
||||
/* Temporary string for (translated) " Y", " N" and " A". */
|
||||
|
||||
if (COLS < 32)
|
||||
width = COLS / 2;
|
||||
|
||||
/* Clear the shortcut list from the bottom of the screen. */
|
||||
blank_bottombars();
|
||||
|
||||
/* Now show the ones for "Yes", "No", "Cancel" and maybe "All". */
|
||||
sprintf(shortstr, " %c", yesstr[0]);
|
||||
wmove(bottomwin, 1, 0);
|
||||
onekey(shortstr, _("Yes"), width);
|
||||
|
||||
if (all) {
|
||||
shortstr[1] = allstr[0];
|
||||
wmove(bottomwin, 1, width);
|
||||
onekey(shortstr, _("All"), width);
|
||||
}
|
||||
|
||||
shortstr[1] = nostr[0];
|
||||
wmove(bottomwin, 2, 0);
|
||||
onekey(shortstr, _("No"), width);
|
||||
|
||||
wmove(bottomwin, 2, width);
|
||||
onekey("^C", _("Cancel"), width);
|
||||
}
|
||||
|
||||
if (interface_color_pair[TITLE_BAR].bright)
|
||||
wattron(bottomwin, A_BOLD);
|
||||
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
||||
|
||||
blank_statusbar();
|
||||
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
||||
|
||||
wattroff(bottomwin, A_BOLD);
|
||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
||||
|
||||
/* Refresh edit window and statusbar before getting input. */
|
||||
wnoutrefresh(edit);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
currmenu = MYESNO;
|
||||
kbinput = get_kbinput(bottomwin);
|
||||
s = get_shortcut(&kbinput);
|
||||
|
||||
if (s && s->scfunc == do_cancel)
|
||||
#ifndef NANO_TINY
|
||||
if (kbinput == KEY_WINCH)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
func = func_from_key(&kbinput);
|
||||
|
||||
if (func == do_cancel)
|
||||
ok = -1;
|
||||
#ifndef DISABLE_MOUSE
|
||||
else if (kbinput == KEY_MOUSE) {
|
||||
@@ -1146,7 +1158,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
}
|
||||
}
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
else if (s && s->scfunc == total_refresh) {
|
||||
else if (func == total_refresh) {
|
||||
total_redraw();
|
||||
continue;
|
||||
} else {
|
||||
|
||||
81
src/proto.h
81
src/proto.h
@@ -28,12 +28,17 @@
|
||||
|
||||
/* All external variables. See global.c for their descriptions. */
|
||||
#ifndef NANO_TINY
|
||||
extern sigjmp_buf jump_buf;
|
||||
extern bool jump_buf_main;
|
||||
extern volatile sig_atomic_t sigwinch_counter;
|
||||
#endif
|
||||
|
||||
extern bool meta_key;
|
||||
extern bool func_key;
|
||||
extern bool focusing;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
extern int controlleft;
|
||||
extern int controlright;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
extern ssize_t fill;
|
||||
@@ -62,7 +67,7 @@ extern openfilestruct *openfile;
|
||||
extern char *matchbrackets;
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
|
||||
#ifndef NANO_TINY
|
||||
extern char *whitespace;
|
||||
extern int whitespace_len[2];
|
||||
#endif
|
||||
@@ -148,10 +153,9 @@ char *do_browse_from(const char *inpath);
|
||||
void browser_init(const char *path, DIR *dir);
|
||||
functionptrtype parse_browser_input(int *kbinput);
|
||||
void browser_refresh(void);
|
||||
bool browser_select_filename(const char *needle);
|
||||
void browser_select_dirname(const char *needle);
|
||||
int filesearch_init(void);
|
||||
bool findnextfile(bool no_sameline, size_t begin, const char *needle);
|
||||
void findnextfile_wrap_reset(void);
|
||||
void findnextfile(const char *needle);
|
||||
void filesearch_abort(void);
|
||||
void do_filesearch(void);
|
||||
void do_fileresearch(void);
|
||||
@@ -261,7 +265,7 @@ void cut_to_eof(void);
|
||||
#endif
|
||||
void do_cut_text(
|
||||
#ifndef NANO_TINY
|
||||
bool copy_text, bool cut_till_eof, bool undoing
|
||||
bool copy_text, bool cut_till_eof
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
@@ -275,7 +279,6 @@ void do_uncut_text(void);
|
||||
|
||||
/* All functions in files.c. */
|
||||
void make_new_buffer(void);
|
||||
void initialize_buffer(void);
|
||||
void initialize_buffer_text(void);
|
||||
void open_buffer(const char *filename, bool undoable);
|
||||
#ifndef DISABLE_SPELLER
|
||||
@@ -283,15 +286,15 @@ void replace_buffer(const char *filename);
|
||||
#endif
|
||||
void display_buffer(void);
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
void switch_to_prevnext_buffer(bool next);
|
||||
void switch_to_prevnext_buffer(bool next, bool quiet);
|
||||
void switch_to_prev_buffer_void(void);
|
||||
void switch_to_next_buffer_void(void);
|
||||
bool close_buffer(void);
|
||||
bool close_buffer(bool quiet);
|
||||
#endif
|
||||
filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
*first_line_ins, size_t buf_len);
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
void do_insertfile(
|
||||
#ifndef NANO_TINY
|
||||
@@ -322,6 +325,9 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
#endif
|
||||
bool do_writeout(bool exiting);
|
||||
void do_writeout_void(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_savefile(void);
|
||||
#endif
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
|
||||
int diralphasort(const void *va, const void *vb);
|
||||
@@ -359,7 +365,7 @@ void assign_keyinfo(sc *s);
|
||||
void print_sclist(void);
|
||||
void shortcut_init(void);
|
||||
#ifndef DISABLE_COLOR
|
||||
void set_lint_shortcuts(void);
|
||||
void set_lint_or_format_shortcuts(void);
|
||||
void set_spell_shortcuts(void);
|
||||
#endif
|
||||
const subnfunc *sctofunc(sc *s);
|
||||
@@ -372,7 +378,7 @@ void thanks_for_all_the_fish(void);
|
||||
|
||||
/* All functions in help.c. */
|
||||
#ifndef DISABLE_HELP
|
||||
void do_help(void (*refresh_func)(void));
|
||||
void do_help(void);
|
||||
void help_init(void);
|
||||
functionptrtype parse_help_input(int *kbinput);
|
||||
size_t help_line_len(const char *ptr);
|
||||
@@ -393,7 +399,7 @@ void do_para_end_void(void);
|
||||
#ifndef NANO_TINY
|
||||
bool do_next_word(bool allow_punct, bool allow_update);
|
||||
void do_next_word_void(void);
|
||||
bool do_prev_word(bool allow_punct, bool allow_update);
|
||||
void do_prev_word(bool allow_punct, bool allow_update);
|
||||
void do_prev_word_void(void);
|
||||
#endif
|
||||
void do_home(void);
|
||||
@@ -426,9 +432,8 @@ void do_right(void);
|
||||
/* All functions in nano.c. */
|
||||
filestruct *make_new_node(filestruct *prevnode);
|
||||
filestruct *copy_node(const filestruct *src);
|
||||
void splice_node(filestruct *begin, filestruct *newnode, filestruct
|
||||
*end);
|
||||
void unlink_node(const filestruct *fileptr);
|
||||
void splice_node(filestruct *afterthis, filestruct *newnode);
|
||||
void unlink_node(filestruct *fileptr);
|
||||
void delete_node(filestruct *fileptr);
|
||||
filestruct *copy_filestruct(const filestruct *src);
|
||||
void free_filestruct(filestruct *src);
|
||||
@@ -448,6 +453,10 @@ void delete_opennode(openfilestruct *fileptr);
|
||||
void free_openfilestruct(openfilestruct *src);
|
||||
#endif
|
||||
void print_view_warning(void);
|
||||
void show_restricted_warning(void);
|
||||
#ifdef DISABLE_HELP
|
||||
void say_there_is_no_help(void);
|
||||
#endif
|
||||
void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename
|
||||
@@ -470,7 +479,7 @@ void usage(void);
|
||||
void version(void);
|
||||
int more_space(void);
|
||||
int no_help(void);
|
||||
void nano_disabled_msg(void);
|
||||
void no_current_file_name_warning(void);
|
||||
void do_exit(void);
|
||||
void signal_init(void);
|
||||
RETSIGTYPE handle_hupterm(int signal);
|
||||
@@ -478,10 +487,11 @@ RETSIGTYPE do_suspend(int signal);
|
||||
RETSIGTYPE do_continue(int signal);
|
||||
#ifndef NANO_TINY
|
||||
RETSIGTYPE handle_sigwinch(int signal);
|
||||
void regenerate_screen(void);
|
||||
void allow_pending_sigwinch(bool allow);
|
||||
void do_toggle(int flag);
|
||||
void do_toggle_void(void);
|
||||
#endif
|
||||
void do_toggle_void(void);
|
||||
void disable_extended_io(void);
|
||||
#ifdef USE_SLANG
|
||||
void disable_signals(void);
|
||||
@@ -522,7 +532,7 @@ size_t statusbar_xplustabs(void);
|
||||
size_t get_statusbar_page_start(size_t start_col, size_t column);
|
||||
void reset_statusbar_cursor(void);
|
||||
void update_statusbar_line(const char *curranswer, size_t index);
|
||||
bool need_statusbar_horizontal_update(size_t pww_save);
|
||||
bool need_statusbar_update(size_t pww_save);
|
||||
void total_statusbar_refresh(void (*refresh_func)(void));
|
||||
functionptrtype get_prompt_string(int *value, bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
@@ -579,16 +589,19 @@ void regexp_cleanup(void);
|
||||
#endif
|
||||
void not_found_msg(const char *str);
|
||||
void search_replace_abort(void);
|
||||
void search_init_globals(void);
|
||||
int search_init(bool replacing, bool use_answer);
|
||||
bool findnextstr(
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool whole_word,
|
||||
bool whole_word_only,
|
||||
#endif
|
||||
bool no_sameline, const filestruct *begin, size_t begin_x, const
|
||||
char *needle, size_t *needle_len);
|
||||
const filestruct *begin, size_t begin_x,
|
||||
const char *needle, size_t *needle_len);
|
||||
void findnextstr_wrap_reset(void);
|
||||
void do_search(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_findprevious(void);
|
||||
void do_findnext(void);
|
||||
#endif
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
|
||||
void do_research(void);
|
||||
#endif
|
||||
@@ -598,7 +611,7 @@ int replace_regexp(char *string, bool create);
|
||||
char *replace_line(const char *needle);
|
||||
ssize_t do_replace_loop(
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool whole_word,
|
||||
bool whole_word_only,
|
||||
#endif
|
||||
bool *canceled, const filestruct *real_current, size_t
|
||||
*real_current_x, const char *needle);
|
||||
@@ -637,6 +650,10 @@ void do_mark(void);
|
||||
#endif
|
||||
void do_delete(void);
|
||||
void do_backspace(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_cut_prev_word(void);
|
||||
void do_cut_next_word(void);
|
||||
#endif
|
||||
void do_tab(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_indent(ssize_t cols);
|
||||
@@ -645,8 +662,7 @@ void do_unindent(void);
|
||||
void do_undo(void);
|
||||
void do_redo(void);
|
||||
#endif
|
||||
void do_enter(bool undoing);
|
||||
void do_enter_void(void);
|
||||
void do_enter(void);
|
||||
#ifndef NANO_TINY
|
||||
RETSIGTYPE cancel_command(int signal);
|
||||
bool execute_command(const char *command);
|
||||
@@ -688,6 +704,7 @@ void do_spell(void);
|
||||
#endif
|
||||
#ifndef DISABLE_COLOR
|
||||
void do_linter(void);
|
||||
void do_formatter(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void do_wordlinechar_count(void);
|
||||
@@ -695,7 +712,6 @@ void do_wordlinechar_count(void);
|
||||
void do_verbatim_input(void);
|
||||
|
||||
/* All functions in utils.c. */
|
||||
int digits(size_t n);
|
||||
void get_homedir(void);
|
||||
bool parse_num(const char *str, ssize_t *val);
|
||||
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
|
||||
@@ -712,7 +728,6 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
bool regexp_bol_or_eol(const regex_t *preg, const char *string);
|
||||
const char *fixbounds(const char *r);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
@@ -736,7 +751,8 @@ void new_magicline(void);
|
||||
void remove_magicline(void);
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
void add_undo(undo_type current_action);
|
||||
void discard_until(undo *thisone);
|
||||
void add_undo(undo_type action);
|
||||
void update_undo(undo_type action);
|
||||
#endif
|
||||
size_t get_totsize(const filestruct *begin, const filestruct *end);
|
||||
@@ -780,7 +796,7 @@ void check_statusblank(void);
|
||||
char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||
dollars);
|
||||
void titlebar(const char *path);
|
||||
void set_modified(void);
|
||||
extern void set_modified(void);
|
||||
void statusbar(const char *msg, ...);
|
||||
void bottombars(int menu);
|
||||
void onekey(const char *keystroke, const char *desc, size_t len);
|
||||
@@ -788,8 +804,7 @@ void reset_cursor(void);
|
||||
void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
line, size_t start);
|
||||
int update_line(filestruct *fileptr, size_t index);
|
||||
bool need_horizontal_update(size_t pww_save);
|
||||
bool need_vertical_update(size_t pww_save);
|
||||
bool need_screen_update(size_t pww_save);
|
||||
void edit_scroll(scroll_dir direction, ssize_t nlines);
|
||||
void edit_redraw(filestruct *old_current, size_t pww_save);
|
||||
void edit_refresh(void);
|
||||
|
||||
121
src/rcfile.c
121
src/rcfile.c
@@ -38,20 +38,21 @@ static const rcoption rcopts[] = {
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
{"brackets", 0},
|
||||
#endif
|
||||
{"const", CONST_UPDATE},
|
||||
{"const", CONST_UPDATE}, /* deprecated form, remove in 2018 */
|
||||
{"constantshow", CONST_UPDATE},
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
{"fill", 0},
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
{"locking", LOCKING},
|
||||
#ifndef DISABLE_HISTORIES
|
||||
{"historylog", HISTORYLOG},
|
||||
#endif
|
||||
{"morespace", MORE_SPACE},
|
||||
#ifndef DISABLE_MOUSE
|
||||
{"mouse", USE_MOUSE},
|
||||
#endif
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
{"multibuffer", MULTIBUFFER},
|
||||
#endif
|
||||
{"morespace", MORE_SPACE},
|
||||
{"nofollow", NOFOLLOW_SYMLINKS},
|
||||
{"nohelp", NO_HELP},
|
||||
{"nonewlines", NO_NEWLINES},
|
||||
@@ -60,6 +61,10 @@ static const rcoption rcopts[] = {
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
{"operatingdir", 0},
|
||||
#endif
|
||||
#ifndef DISABLE_HISTORIES
|
||||
{"poslog", POS_HISTORY}, /* deprecated form, remove in 2018 */
|
||||
{"positionlog", POS_HISTORY},
|
||||
#endif
|
||||
{"preserve", PRESERVE},
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -79,25 +84,25 @@ static const rcoption rcopts[] = {
|
||||
{"tempfile", TEMP_FILE},
|
||||
{"view", VIEW_MODE},
|
||||
#ifndef NANO_TINY
|
||||
{"allow_insecure_backup", INSECURE_BACKUP},
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"backup", BACKUP_FILE},
|
||||
{"allow_insecure_backup", INSECURE_BACKUP},
|
||||
{"backupdir", 0},
|
||||
{"backwards", BACKWARDS_SEARCH},
|
||||
{"casesensitive", CASE_SENSITIVE},
|
||||
{"cut", CUT_TO_END},
|
||||
{"historylog", HISTORYLOG},
|
||||
{"locking", LOCKING},
|
||||
{"matchbrackets", 0},
|
||||
{"noconvert", NO_CONVERT},
|
||||
{"poslog", POS_HISTORY},
|
||||
{"quiet", QUIET},
|
||||
{"quickblank", QUICK_BLANK},
|
||||
{"quiet", QUIET},
|
||||
{"smarthome", SMART_HOME},
|
||||
{"smooth", SMOOTH_SCROLL},
|
||||
{"softwrap", SOFTWRAP},
|
||||
{"tabstospaces", TABS_TO_SPACES},
|
||||
{"unix", MAKE_IT_UNIX},
|
||||
{"whitespace", 0},
|
||||
{"wordbounds", WORD_BOUNDS},
|
||||
{"softwrap", SOFTWRAP},
|
||||
#endif
|
||||
#ifndef DISABLE_COLOR
|
||||
{"titlecolor", 0},
|
||||
@@ -328,6 +333,7 @@ void parse_syntax(char *ptr)
|
||||
endsyntax->next = NULL;
|
||||
endsyntax->nmultis = 0;
|
||||
endsyntax->linter = NULL;
|
||||
endsyntax->formatter = NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
|
||||
@@ -439,7 +445,7 @@ void parse_binding(char *ptr, bool dobind)
|
||||
|
||||
if (strlen(keycopy) < 2) {
|
||||
rcfile_error(N_("Key name is too short"));
|
||||
return;
|
||||
goto free_copy;
|
||||
}
|
||||
|
||||
/* Uppercase only the first two or three characters of the key name. */
|
||||
@@ -450,7 +456,7 @@ void parse_binding(char *ptr, bool dobind)
|
||||
keycopy[2] = toupper(keycopy[2]);
|
||||
else {
|
||||
rcfile_error(N_("Key name is too short"));
|
||||
return;
|
||||
goto free_copy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +466,7 @@ void parse_binding(char *ptr, bool dobind)
|
||||
keycopy[1] = tolower(keycopy[1]);
|
||||
else if (keycopy[0] != '^' && keycopy[0] != 'M' && keycopy[0] != 'F') {
|
||||
rcfile_error(N_("Key name must begin with \"^\", \"M\", or \"F\""));
|
||||
return;
|
||||
goto free_copy;
|
||||
}
|
||||
|
||||
if (dobind) {
|
||||
@@ -469,7 +475,7 @@ void parse_binding(char *ptr, bool dobind)
|
||||
|
||||
if (funcptr[0] == '\0') {
|
||||
rcfile_error(N_("Must specify a function to bind the key to"));
|
||||
return;
|
||||
goto free_copy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,21 +485,21 @@ void parse_binding(char *ptr, bool dobind)
|
||||
if (menuptr[0] == '\0') {
|
||||
/* TRANSLATORS: Do not translate the word "all". */
|
||||
rcfile_error(N_("Must specify a menu (or \"all\") in which to bind/unbind the key"));
|
||||
return;
|
||||
goto free_copy;
|
||||
}
|
||||
|
||||
if (dobind) {
|
||||
newsc = strtosc(funcptr);
|
||||
if (newsc == NULL) {
|
||||
rcfile_error(N_("Cannot map name \"%s\" to a function"), funcptr);
|
||||
return;
|
||||
goto free_copy;
|
||||
}
|
||||
}
|
||||
|
||||
menu = strtomenu(menuptr);
|
||||
if (menu < 1) {
|
||||
rcfile_error(N_("Cannot map name \"%s\" to a menu"), menuptr);
|
||||
return;
|
||||
goto free_copy;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -513,6 +519,10 @@ void parse_binding(char *ptr, bool dobind)
|
||||
if (f->scfunc == newsc->scfunc)
|
||||
mask = mask | f->menus;
|
||||
|
||||
/* Handle the special case of the toggles. */
|
||||
if (newsc->scfunc == do_toggle_void)
|
||||
mask = MMAIN;
|
||||
|
||||
/* Now limit the given menu to those where the function exists. */
|
||||
if (is_universal(newsc->scfunc))
|
||||
menu = menu & MMOST;
|
||||
@@ -522,11 +532,11 @@ void parse_binding(char *ptr, bool dobind)
|
||||
if (!menu) {
|
||||
rcfile_error(N_("Function '%s' does not exist in menu '%s'"), funcptr, menuptr);
|
||||
free(newsc);
|
||||
return;
|
||||
goto free_copy;
|
||||
}
|
||||
|
||||
newsc->keystr = keycopy;
|
||||
newsc->menu = menu;
|
||||
newsc->menus = menu;
|
||||
newsc->type = strtokeytype(newsc->keystr);
|
||||
assign_keyinfo(newsc);
|
||||
#ifdef DEBUG
|
||||
@@ -537,25 +547,36 @@ void parse_binding(char *ptr, bool dobind)
|
||||
if (check_bad_binding(newsc)) {
|
||||
rcfile_error(N_("Sorry, keystroke \"%s\" may not be rebound"), newsc->keystr);
|
||||
free(newsc);
|
||||
return;
|
||||
goto free_copy;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now find and delete any existing same shortcut in the menu(s). */
|
||||
for (s = sclist; s != NULL; s = s->next) {
|
||||
if (((s->menu & menu)) && !strcmp(s->keystr, keycopy)) {
|
||||
if ((s->menus & menu) && !strcmp(s->keystr, keycopy)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "deleting entry from menu %x\n", s->menu);
|
||||
fprintf(stderr, "deleting entry from among menus %x\n", s->menus);
|
||||
#endif
|
||||
s->menu &= ~menu;
|
||||
s->menus &= ~menu;
|
||||
}
|
||||
}
|
||||
|
||||
if (dobind) {
|
||||
/* If this is a toggle, copy its sequence number. */
|
||||
if (newsc->scfunc == do_toggle_void) {
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->scfunc == do_toggle_void && s->toggle == newsc->toggle)
|
||||
newsc->ordinal = s->ordinal;
|
||||
} else
|
||||
newsc->ordinal = 0;
|
||||
/* Add the new shortcut at the start of the list. */
|
||||
newsc->next = sclist;
|
||||
sclist = newsc;
|
||||
return;
|
||||
}
|
||||
|
||||
free_copy:
|
||||
free(keycopy);
|
||||
}
|
||||
|
||||
|
||||
@@ -596,11 +617,7 @@ static void _parse_include(char *file)
|
||||
fprintf(stderr, "Parsing file \"%s\"\n", file);
|
||||
#endif
|
||||
|
||||
parse_rcfile(rcstream
|
||||
#ifndef DISABLE_COLOR
|
||||
, TRUE
|
||||
#endif
|
||||
);
|
||||
parse_rcfile(rcstream, TRUE);
|
||||
}
|
||||
|
||||
void parse_include(char *ptr)
|
||||
@@ -902,11 +919,10 @@ void parse_header_exp(char *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
/* Parse the magic regexes that may influence the choice of syntax. */
|
||||
void parse_magic_exp(char *ptr)
|
||||
{
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
regexlisttype *endmagic = NULL;
|
||||
|
||||
assert(ptr != NULL);
|
||||
@@ -966,11 +982,10 @@ void parse_magic_exp(char *ptr)
|
||||
} else
|
||||
free(newmagic);
|
||||
}
|
||||
#endif /* HAVE_LIBMAGIC */
|
||||
}
|
||||
#endif /* !DISABLE_COLOR */
|
||||
#endif /* HAVE_LIBMAGIC */
|
||||
|
||||
/* Parse the linter requested for this syntax. Simple? */
|
||||
/* Parse the linter requested for this syntax. */
|
||||
void parse_linter(char *ptr)
|
||||
{
|
||||
assert(ptr != NULL);
|
||||
@@ -986,15 +1001,41 @@ void parse_linter(char *ptr)
|
||||
return;
|
||||
}
|
||||
|
||||
if (endsyntax->linter != NULL)
|
||||
free(endsyntax->linter);
|
||||
free(endsyntax->linter);
|
||||
|
||||
/* Let them unset the linter by using "". */
|
||||
if (!strcmp(ptr, "\"\""))
|
||||
endsyntax->linter = NULL;
|
||||
else
|
||||
endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr);
|
||||
endsyntax->linter = mallocstrcpy(NULL, ptr);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
/* Parse the formatter requested for this syntax. */
|
||||
void parse_formatter(char *ptr)
|
||||
{
|
||||
assert(ptr != NULL);
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
rcfile_error(
|
||||
N_("Cannot add formatter without a syntax command"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing formatter command"));
|
||||
return;
|
||||
}
|
||||
|
||||
free(endsyntax->formatter);
|
||||
|
||||
/* Let them unset the formatter by using "". */
|
||||
if (!strcmp(ptr, "\"\""))
|
||||
endsyntax->formatter = NULL;
|
||||
else
|
||||
endsyntax->formatter = mallocstrcpy(NULL, ptr);
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER */
|
||||
#endif /* !DISABLE_COLOR */
|
||||
|
||||
/* Check whether the user has unmapped every shortcut for a
|
||||
@@ -1121,7 +1162,11 @@ void parse_rcfile(FILE *rcstream
|
||||
parse_syntax(ptr);
|
||||
}
|
||||
else if (strcasecmp(keyword, "magic") == 0)
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
parse_magic_exp(ptr);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
else if (strcasecmp(keyword, "header") == 0)
|
||||
parse_header_exp(ptr);
|
||||
else if (strcasecmp(keyword, "color") == 0)
|
||||
@@ -1130,6 +1175,12 @@ void parse_rcfile(FILE *rcstream
|
||||
parse_colors(ptr, TRUE);
|
||||
else if (strcasecmp(keyword, "linter") == 0)
|
||||
parse_linter(ptr);
|
||||
else if (strcasecmp(keyword, "formatter") == 0)
|
||||
#ifndef DISABLE_SPELLER
|
||||
parse_formatter(ptr);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
#endif /* !DISABLE_COLOR */
|
||||
else if (strcasecmp(keyword, "bind") == 0)
|
||||
parse_binding(ptr, TRUE);
|
||||
|
||||
342
src/search.c
342
src/search.c
@@ -106,6 +106,7 @@ void not_found_msg(const char *str)
|
||||
void search_replace_abort(void)
|
||||
{
|
||||
display_main_list();
|
||||
focusing = FALSE;
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set)
|
||||
edit_refresh();
|
||||
@@ -115,15 +116,6 @@ void search_replace_abort(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Initialize the global search and replace strings. */
|
||||
void search_init_globals(void)
|
||||
{
|
||||
if (last_search == NULL)
|
||||
last_search = mallocstrcpy(NULL, "");
|
||||
if (last_replace == NULL)
|
||||
last_replace = mallocstrcpy(NULL, "");
|
||||
}
|
||||
|
||||
/* Set up the system variables for a search or replace. If use_answer
|
||||
* is TRUE, only set backupstring to answer. Return -2 to run the
|
||||
* opposite program (search -> replace, replace -> search), return -1 if
|
||||
@@ -155,14 +147,13 @@ int search_init(bool replacing, bool use_answer)
|
||||
* do_search() or do_replace() and be called again. In that case,
|
||||
* we should put the same search string back up. */
|
||||
|
||||
search_init_globals();
|
||||
focusing = TRUE;
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||
|
||||
buf = charalloc(strlen(disp) + 7);
|
||||
/* We use (COLS / 3) here because we need to see more on the
|
||||
* line. */
|
||||
/* We use (COLS / 3) here because we need to see more on the line. */
|
||||
sprintf(buf, " [%s%s]", disp,
|
||||
(strlenpt(last_search) > COLS / 3) ? "..." : "");
|
||||
free(disp);
|
||||
@@ -258,17 +249,16 @@ int search_init(bool replacing, bool use_answer)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Look for needle, starting at (current, current_x). If no_sameline is
|
||||
* TRUE, skip over begin when looking for needle. begin is the line
|
||||
/* Look for needle, starting at (current, current_x). begin is the line
|
||||
* where we first started searching, at column begin_x. The return
|
||||
* value specifies whether we found anything. If we did, set needle_len
|
||||
* to the length of the string we found if it isn't NULL. */
|
||||
bool findnextstr(
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool whole_word,
|
||||
bool whole_word_only,
|
||||
#endif
|
||||
bool no_sameline, const filestruct *begin, size_t begin_x, const
|
||||
char *needle, size_t *needle_len)
|
||||
const filestruct *begin, size_t begin_x,
|
||||
const char *needle, size_t *needle_len)
|
||||
{
|
||||
size_t found_len;
|
||||
/* The length of the match we find. */
|
||||
@@ -287,9 +277,9 @@ bool findnextstr(
|
||||
rev_start +=
|
||||
#ifndef NANO_TINY
|
||||
ISSET(BACKWARDS_SEARCH) ?
|
||||
openfile->current_x - 1 :
|
||||
((openfile->current_x == 0) ? -1 : move_mbleft(fileptr->data, openfile->current_x)) :
|
||||
#endif
|
||||
openfile->current_x + 1;
|
||||
move_mbright(fileptr->data, openfile->current_x);
|
||||
|
||||
/* Look for needle in the current line we're searching. */
|
||||
enable_nodelay();
|
||||
@@ -325,7 +315,7 @@ bool findnextstr(
|
||||
#ifndef DISABLE_SPELLER
|
||||
/* If we're searching for whole words, see if this potential
|
||||
* match is a whole word. */
|
||||
if (whole_word) {
|
||||
if (whole_word_only) {
|
||||
char *word = mallocstrncpy(NULL, found, found_len + 1);
|
||||
word[found_len] = '\0';
|
||||
|
||||
@@ -333,22 +323,16 @@ bool findnextstr(
|
||||
fileptr->data, word);
|
||||
free(word);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If we're searching for whole words and this potential
|
||||
* match isn't a whole word, or if we're not allowed to find
|
||||
* a match on the same line we started on and this potential
|
||||
* match is on that line, continue searching. */
|
||||
if (
|
||||
#ifndef DISABLE_SPELLER
|
||||
(!whole_word || found_whole) &&
|
||||
* match isn't a whole word, continue searching. */
|
||||
if (!whole_word_only || found_whole)
|
||||
#endif
|
||||
(!no_sameline || fileptr != openfile->current))
|
||||
break;
|
||||
}
|
||||
|
||||
/* We've finished processing the file, so get out. */
|
||||
if (search_last_line) {
|
||||
/* We've finished processing the file, so get out. */
|
||||
not_found_msg(needle);
|
||||
disable_nodelay();
|
||||
return FALSE;
|
||||
@@ -367,9 +351,8 @@ bool findnextstr(
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We've reached the start or end of the buffer, so wrap
|
||||
* around. */
|
||||
if (fileptr == NULL) {
|
||||
/* We've reached the start or end of the buffer, so wrap around. */
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
fileptr = openfile->filebot;
|
||||
@@ -384,8 +367,8 @@ bool findnextstr(
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
|
||||
/* We've reached the original starting line. */
|
||||
if (fileptr == begin)
|
||||
/* We've reached the original starting line. */
|
||||
search_last_line = TRUE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
@@ -445,8 +428,7 @@ void do_search(void)
|
||||
i = search_init(FALSE, FALSE);
|
||||
|
||||
if (i == -1)
|
||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
||||
* failed. */
|
||||
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
|
||||
search_replace_abort();
|
||||
else if (i == -2)
|
||||
/* Replace. */
|
||||
@@ -478,35 +460,13 @@ void do_search(void)
|
||||
#ifndef DISABLE_SPELLER
|
||||
FALSE,
|
||||
#endif
|
||||
FALSE, openfile->current, openfile->current_x, answer, NULL);
|
||||
openfile->current, openfile->current_x, answer, NULL);
|
||||
|
||||
/* Check to see if there's only one occurrence of the string and
|
||||
* we're on it now. */
|
||||
/* If we found something, and we're back at the exact same spot where
|
||||
* we started searching, then this is the only occurrence. */
|
||||
if (fileptr == openfile->current && fileptr_x ==
|
||||
openfile->current_x && didfind) {
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Do the search again, skipping over the current line, if we're
|
||||
* doing a bol and/or eol regex search ("^", "$", or "^$"), so
|
||||
* that we find one only once per line. We should only end up
|
||||
* back at the same position if the string isn't found again, in
|
||||
* which case it's the only occurrence. */
|
||||
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
|
||||
last_search)) {
|
||||
didfind = findnextstr(
|
||||
#ifndef DISABLE_SPELLER
|
||||
FALSE,
|
||||
#endif
|
||||
TRUE, openfile->current,
|
||||
openfile->current_x, answer, NULL);
|
||||
if (fileptr == openfile->current && fileptr_x ==
|
||||
openfile->current_x && !didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
} else {
|
||||
#endif
|
||||
statusbar(_("This is the only occurrence"));
|
||||
#ifdef HAVE_REGEX_H
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
@@ -514,6 +474,31 @@ void do_search(void)
|
||||
search_replace_abort();
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Search in the backward direction for the next occurrence. */
|
||||
void do_findprevious(void)
|
||||
{
|
||||
if ISSET(BACKWARDS_SEARCH)
|
||||
do_research();
|
||||
else {
|
||||
SET(BACKWARDS_SEARCH);
|
||||
do_research();
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
}
|
||||
}
|
||||
|
||||
/* Search in the forward direction for the next occurrence. */
|
||||
void do_findnext(void)
|
||||
{
|
||||
if ISSET(BACKWARDS_SEARCH) {
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
do_research();
|
||||
SET(BACKWARDS_SEARCH);
|
||||
} else
|
||||
do_research();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
|
||||
/* Search for the last string without prompting. */
|
||||
void do_research(void)
|
||||
@@ -523,7 +508,14 @@ void do_research(void)
|
||||
size_t pww_save = openfile->placewewant;
|
||||
bool didfind;
|
||||
|
||||
search_init_globals();
|
||||
focusing = TRUE;
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
/* If nothing was searched for yet during this run of nano, but
|
||||
* there is a search history, take the most recent item. */
|
||||
if (last_search[0] == '\0' && searchbot->prev != NULL)
|
||||
last_search = mallocstrcpy(last_search, searchbot->prev->data);
|
||||
#endif
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
#ifdef HAVE_REGEX_H
|
||||
@@ -537,36 +529,13 @@ void do_research(void)
|
||||
#ifndef DISABLE_SPELLER
|
||||
FALSE,
|
||||
#endif
|
||||
FALSE, openfile->current, openfile->current_x,
|
||||
last_search, NULL);
|
||||
openfile->current, openfile->current_x, last_search, NULL);
|
||||
|
||||
/* Check to see if there's only one occurrence of the string and
|
||||
* we're on it now. */
|
||||
/* If we found something, and we're back at the exact same spot
|
||||
* where we started searching, then this is the only occurrence. */
|
||||
if (fileptr == openfile->current && fileptr_x ==
|
||||
openfile->current_x && didfind) {
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Do the search again, skipping over the current line, if
|
||||
* we're doing a bol and/or eol regex search ("^", "$", or
|
||||
* "^$"), so that we find one only once per line. We should
|
||||
* only end up back at the same position if the string isn't
|
||||
* found again, in which case it's the only occurrence. */
|
||||
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
|
||||
last_search)) {
|
||||
didfind = findnextstr(
|
||||
#ifndef DISABLE_SPELLER
|
||||
FALSE,
|
||||
#endif
|
||||
TRUE, openfile->current, openfile->current_x,
|
||||
answer, NULL);
|
||||
if (fileptr == openfile->current && fileptr_x ==
|
||||
openfile->current_x && !didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
} else {
|
||||
#endif /* HAVE_REGEX_H */
|
||||
statusbar(_("This is the only occurrence"));
|
||||
#ifdef HAVE_REGEX_H
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else
|
||||
statusbar(_("No current search pattern"));
|
||||
@@ -578,17 +547,13 @@ void do_research(void)
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Calculate the size of the replacement text, taking possible
|
||||
* subexpressions \1 to \9 into account. Return the replacement
|
||||
* text in the passed string only when create is TRUE. */
|
||||
int replace_regexp(char *string, bool create)
|
||||
{
|
||||
/* We have a split personality here. If create is FALSE, just
|
||||
* calculate the size of the replacement line (necessary because of
|
||||
* subexpressions \1 to \9 in the replaced text). */
|
||||
|
||||
const char *c = last_replace;
|
||||
size_t search_match_count = regmatches[0].rm_eo -
|
||||
regmatches[0].rm_so;
|
||||
size_t new_line_size = strlen(openfile->current->data) + 1 -
|
||||
search_match_count;
|
||||
size_t replacement_size = 0;
|
||||
|
||||
/* Iterate through the replacement text to handle subexpression
|
||||
* replacement using \1, \2, \3, etc. */
|
||||
@@ -600,7 +565,7 @@ int replace_regexp(char *string, bool create)
|
||||
if (create)
|
||||
*string++ = *c;
|
||||
c++;
|
||||
new_line_size++;
|
||||
replacement_size++;
|
||||
} else {
|
||||
size_t i = regmatches[num].rm_eo - regmatches[num].rm_so;
|
||||
|
||||
@@ -608,7 +573,7 @@ int replace_regexp(char *string, bool create)
|
||||
c += 2;
|
||||
|
||||
/* But add the length of the subexpression to new_size. */
|
||||
new_line_size += i;
|
||||
replacement_size += i;
|
||||
|
||||
/* And if create is TRUE, append the result of the
|
||||
* subexpression match to the new line. */
|
||||
@@ -623,25 +588,26 @@ int replace_regexp(char *string, bool create)
|
||||
if (create)
|
||||
*string = '\0';
|
||||
|
||||
return new_line_size;
|
||||
return replacement_size;
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
/* Return a copy of the current line with one needle replaced. */
|
||||
char *replace_line(const char *needle)
|
||||
{
|
||||
char *copy;
|
||||
size_t new_line_size, search_match_count;
|
||||
size_t match_len;
|
||||
size_t new_line_size = strlen(openfile->current->data) + 1;
|
||||
|
||||
/* Calculate the size of the new line. */
|
||||
/* First adjust the size of the new line for the change. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
new_line_size = replace_regexp(NULL, FALSE);
|
||||
match_len = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
new_line_size += replace_regexp(NULL, FALSE) - match_len;
|
||||
} else {
|
||||
#endif
|
||||
search_match_count = strlen(needle);
|
||||
new_line_size = strlen(openfile->current->data) -
|
||||
search_match_count + strlen(answer) + 1;
|
||||
match_len = strlen(needle);
|
||||
new_line_size += strlen(answer) - match_len;
|
||||
#ifdef HAVE_REGEX_H
|
||||
}
|
||||
#endif
|
||||
@@ -649,10 +615,10 @@ char *replace_line(const char *needle)
|
||||
/* Create the buffer. */
|
||||
copy = charalloc(new_line_size);
|
||||
|
||||
/* The head of the original line. */
|
||||
/* Copy the head of the original line. */
|
||||
strncpy(copy, openfile->current->data, openfile->current_x);
|
||||
|
||||
/* The replacement text. */
|
||||
/* Add the replacement text. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP))
|
||||
replace_regexp(copy + openfile->current_x, TRUE);
|
||||
@@ -660,11 +626,10 @@ char *replace_line(const char *needle)
|
||||
#endif
|
||||
strcpy(copy + openfile->current_x, answer);
|
||||
|
||||
/* The tail of the original line. */
|
||||
assert(openfile->current_x + search_match_count <= strlen(openfile->current->data));
|
||||
assert(openfile->current_x + match_len <= strlen(openfile->current->data));
|
||||
|
||||
strcat(copy, openfile->current->data + openfile->current_x +
|
||||
search_match_count);
|
||||
/* Copy the tail of the original line. */
|
||||
strcat(copy, openfile->current->data + openfile->current_x + match_len);
|
||||
|
||||
return copy;
|
||||
}
|
||||
@@ -679,7 +644,7 @@ char *replace_line(const char *needle)
|
||||
* canceled isn't NULL, set it to TRUE if we canceled. */
|
||||
ssize_t do_replace_loop(
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool whole_word,
|
||||
bool whole_word_only,
|
||||
#endif
|
||||
bool *canceled, const filestruct *real_current, size_t
|
||||
*real_current_x, const char *needle)
|
||||
@@ -687,31 +652,28 @@ ssize_t do_replace_loop(
|
||||
ssize_t numreplaced = -1;
|
||||
size_t match_len;
|
||||
bool replaceall = FALSE;
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* The starting-line match and bol/eol regex flags. */
|
||||
bool begin_line = FALSE, bol_or_eol = FALSE;
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
bool old_mark_set = openfile->mark_set;
|
||||
filestruct *edittop_save = openfile->edittop, *top, *bot;
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
bool right_side_up = FALSE;
|
||||
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
|
||||
* FALSE if (current, current_x) is. */
|
||||
|
||||
if (old_mark_set) {
|
||||
/* If the mark is on, partition the filestruct so that it
|
||||
* contains only the marked text, set edittop to the top of the
|
||||
* partition, turn the mark off, and refresh the screen. */
|
||||
/* If the mark is on, frame the region, and turn the mark off. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, &right_side_up);
|
||||
filepart = partition_filestruct(top, top_x, bot, bot_x);
|
||||
openfile->edittop = openfile->fileage;
|
||||
openfile->mark_set = FALSE;
|
||||
#ifndef DISABLE_COLOR
|
||||
reset_multis(openfile->current, TRUE);
|
||||
#endif
|
||||
edit_refresh();
|
||||
|
||||
/* Start either at the top or the bottom of the marked region. */
|
||||
if (!ISSET(BACKWARDS_SEARCH)) {
|
||||
openfile->current = top;
|
||||
openfile->current_x = (top_x == 0 ? 0 : top_x - 1);
|
||||
} else {
|
||||
openfile->current = bot;
|
||||
openfile->current_x = bot_x;
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -721,41 +683,23 @@ ssize_t do_replace_loop(
|
||||
findnextstr_wrap_reset();
|
||||
while (findnextstr(
|
||||
#ifndef DISABLE_SPELLER
|
||||
whole_word,
|
||||
whole_word_only,
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* We should find a bol and/or eol regex only once per line. If
|
||||
* the bol_or_eol flag is set, it means that the last search
|
||||
* found one on the beginning line, so we should skip over the
|
||||
* beginning line when doing this search. */
|
||||
bol_or_eol
|
||||
#else
|
||||
FALSE
|
||||
#endif
|
||||
, real_current, *real_current_x, needle, &match_len)) {
|
||||
real_current, *real_current_x, needle, &match_len)) {
|
||||
int i = 0;
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* If the bol_or_eol flag is set, we've found a match on the
|
||||
* beginning line already, and we're still on the beginning line
|
||||
* after the search, it means that we've wrapped around, so
|
||||
* we're done. */
|
||||
if (bol_or_eol && begin_line && openfile->current ==
|
||||
real_current)
|
||||
break;
|
||||
/* Otherwise, set the begin_line flag if we've found a match on
|
||||
* the beginning line, reset the bol_or_eol flag, and
|
||||
* continue. */
|
||||
else {
|
||||
if (openfile->current == real_current)
|
||||
begin_line = TRUE;
|
||||
bol_or_eol = FALSE;
|
||||
#ifndef NANO_TINY
|
||||
if (old_mark_set) {
|
||||
/* When we've found an occurrence outside of the marked region,
|
||||
* stop the fanfare. */
|
||||
if (openfile->current->lineno > bot->lineno ||
|
||||
openfile->current->lineno < top->lineno ||
|
||||
(openfile->current == bot && openfile->current_x > bot_x) ||
|
||||
(openfile->current == top && openfile->current_x < top_x))
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!replaceall)
|
||||
edit_refresh();
|
||||
|
||||
/* Indicate that we found the search string. */
|
||||
if (numreplaced == -1)
|
||||
numreplaced = 0;
|
||||
@@ -766,6 +710,8 @@ ssize_t do_replace_loop(
|
||||
xpt, strnlenpt(openfile->current->data,
|
||||
openfile->current_x + match_len) - xpt, FALSE);
|
||||
|
||||
edit_refresh();
|
||||
|
||||
curs_set(0);
|
||||
|
||||
do_replace_highlight(TRUE, exp_word);
|
||||
@@ -786,59 +732,53 @@ ssize_t do_replace_loop(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Set the bol_or_eol flag if we're doing a bol and/or eol regex
|
||||
* replace ("^", "$", or "^$"). */
|
||||
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
|
||||
needle))
|
||||
bol_or_eol = TRUE;
|
||||
#endif
|
||||
|
||||
if (i > 0 || replaceall) { /* Yes, replace it!!!! */
|
||||
char *copy;
|
||||
size_t length_change;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
update_undo(REPLACE);
|
||||
add_undo(REPLACE);
|
||||
#endif
|
||||
if (i == 2)
|
||||
replaceall = TRUE;
|
||||
|
||||
copy = replace_line(needle);
|
||||
|
||||
length_change = strlen(copy) -
|
||||
strlen(openfile->current->data);
|
||||
length_change = strlen(copy) - strlen(openfile->current->data);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If the mark was on and (mark_begin, mark_begin_x) was the
|
||||
* top of it, don't change mark_begin_x. */
|
||||
if (!old_mark_set || !right_side_up) {
|
||||
/* Keep mark_begin_x in sync with the text changes. */
|
||||
/* If the mark was on and it was located after the cursor,
|
||||
* then adjust its x position for any text length changes. */
|
||||
if (old_mark_set && !right_side_up) {
|
||||
if (openfile->current == openfile->mark_begin &&
|
||||
openfile->mark_begin_x > openfile->current_x) {
|
||||
if (openfile->mark_begin_x < openfile->current_x +
|
||||
match_len)
|
||||
if (openfile->mark_begin_x < openfile->current_x + match_len)
|
||||
openfile->mark_begin_x = openfile->current_x;
|
||||
else
|
||||
openfile->mark_begin_x += length_change;
|
||||
bot_x = openfile->mark_begin_x;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the mark was on and (current, current_x) was the top
|
||||
* of it, don't change real_current_x. */
|
||||
/* If the mark was not on or it was before the cursor, then
|
||||
* adjust the cursor's x position for any text length changes. */
|
||||
if (!old_mark_set || right_side_up) {
|
||||
#endif
|
||||
/* Keep real_current_x in sync with the text changes. */
|
||||
if (openfile->current == real_current &&
|
||||
openfile->current_x <= *real_current_x) {
|
||||
if (*real_current_x <
|
||||
openfile->current_x + match_len)
|
||||
*real_current_x = openfile->current_x +
|
||||
match_len;
|
||||
if (*real_current_x < openfile->current_x + match_len)
|
||||
*real_current_x = openfile->current_x + match_len;
|
||||
*real_current_x += length_change;
|
||||
}
|
||||
#ifndef NANO_TINY
|
||||
bot_x = *real_current_x;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Don't find the same zero-length match again. */
|
||||
if (match_len == 0)
|
||||
match_len++;
|
||||
#endif
|
||||
|
||||
/* Set the cursor at the last character of the replacement
|
||||
@@ -850,16 +790,18 @@ ssize_t do_replace_loop(
|
||||
#endif
|
||||
openfile->current_x += match_len + length_change - 1;
|
||||
|
||||
/* Cleanup. */
|
||||
openfile->totsize += mbstrlen(copy) -
|
||||
mbstrlen(openfile->current->data);
|
||||
/* Update the file size, and put the changed line into place. */
|
||||
openfile->totsize += mbstrlen(copy) - mbstrlen(openfile->current->data);
|
||||
free(openfile->current->data);
|
||||
openfile->current->data = copy;
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
reset_multis(openfile->current, TRUE);
|
||||
/* Reset the precalculated multiline-regex hints only when
|
||||
* the first replacement has been made. */
|
||||
if (numreplaced == 0)
|
||||
reset_multis(openfile->current, TRUE);
|
||||
#endif
|
||||
edit_refresh();
|
||||
|
||||
if (!replaceall) {
|
||||
#ifndef DISABLE_COLOR
|
||||
/* If color syntaxes are available and turned on, we
|
||||
@@ -877,16 +819,12 @@ ssize_t do_replace_loop(
|
||||
}
|
||||
}
|
||||
|
||||
if (numreplaced == -1)
|
||||
not_found_msg(needle);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (old_mark_set) {
|
||||
/* If the mark was on, unpartition the filestruct so that it
|
||||
* contains all the text again, set edittop back to what it was
|
||||
* before, turn the mark back on, and refresh the screen. */
|
||||
unpartition_filestruct(&filepart);
|
||||
openfile->edittop = edittop_save;
|
||||
if (old_mark_set)
|
||||
openfile->mark_set = TRUE;
|
||||
edit_refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the NO_NEWLINES flag isn't set, and text has been added to the
|
||||
@@ -913,8 +851,7 @@ void do_replace(void)
|
||||
|
||||
i = search_init(TRUE, FALSE);
|
||||
if (i == -1) {
|
||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
||||
* failed. */
|
||||
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
|
||||
search_replace_abort();
|
||||
return;
|
||||
} else if (i == -2) {
|
||||
@@ -951,8 +888,7 @@ void do_replace(void)
|
||||
edit_refresh, _("Replace with"));
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
/* Add this replace string to the replace history list. i == 0
|
||||
* means that the string is not "". */
|
||||
/* If the replace string is not "", add it to the replace history list. */
|
||||
if (i == 0)
|
||||
update_history(&replace_history, answer);
|
||||
#endif
|
||||
@@ -1085,7 +1021,6 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update) {
|
||||
edit_refresh();
|
||||
|
||||
display_main_list();
|
||||
}
|
||||
}
|
||||
@@ -1144,8 +1079,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
mbrevstrpbrk(fileptr->data, bracket_set, rev_start) :
|
||||
mbstrpbrk(rev_start, bracket_set));
|
||||
|
||||
/* We've found a potential match. */
|
||||
if (found != NULL)
|
||||
/* We've found a potential match. */
|
||||
break;
|
||||
|
||||
if (reverse) {
|
||||
@@ -1156,8 +1091,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
current_y_find++;
|
||||
}
|
||||
|
||||
/* We've reached the start or end of the buffer, so get out. */
|
||||
if (fileptr == NULL)
|
||||
/* We've reached the start or end of the buffer, so get out. */
|
||||
return FALSE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
@@ -1211,7 +1146,7 @@ void do_find_bracket(void)
|
||||
|
||||
ch = openfile->current->data + openfile->current_x;
|
||||
|
||||
if (ch == '\0' || (ch = mbstrchr(matchbrackets, ch)) == NULL) {
|
||||
if ((ch = mbstrchr(matchbrackets, ch)) == NULL) {
|
||||
statusbar(_("Not a bracket"));
|
||||
return;
|
||||
}
|
||||
@@ -1372,9 +1307,7 @@ void update_history(filestruct **h, const char *s)
|
||||
foo = p;
|
||||
bar = p->next;
|
||||
unlink_node(foo);
|
||||
delete_node(foo);
|
||||
if (bar != NULL)
|
||||
renumber(bar);
|
||||
renumber(bar);
|
||||
}
|
||||
|
||||
/* If the history is full, delete the beginning entry to make room
|
||||
@@ -1385,13 +1318,12 @@ void update_history(filestruct **h, const char *s)
|
||||
|
||||
*hage = (*hage)->next;
|
||||
unlink_node(foo);
|
||||
delete_node(foo);
|
||||
renumber(*hage);
|
||||
}
|
||||
|
||||
/* Add the new entry to the end. */
|
||||
(*hbot)->data = mallocstrcpy((*hbot)->data, s);
|
||||
splice_node(*hbot, make_new_node(*hbot), (*hbot)->next);
|
||||
splice_node(*hbot, make_new_node(*hbot));
|
||||
*hbot = (*hbot)->next;
|
||||
(*hbot)->data = mallocstrcpy(NULL, "");
|
||||
|
||||
|
||||
1015
src/text.c
1015
src/text.c
File diff suppressed because it is too large
Load Diff
43
src/utils.c
43
src/utils.c
@@ -30,21 +30,6 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* Return the number of decimal digits in n. */
|
||||
int digits(size_t n)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (n == 0)
|
||||
i = 1;
|
||||
else {
|
||||
for (i = 0; n != 0; n /= 10, i++)
|
||||
;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Return the user's home directory. We use $HOME, and if that fails,
|
||||
* we fall back on the home directory of the effective user ID. */
|
||||
void get_homedir(void)
|
||||
@@ -58,7 +43,11 @@ void get_homedir(void)
|
||||
if (userage != NULL)
|
||||
homenv = userage->pw_dir;
|
||||
}
|
||||
homedir = mallocstrcpy(NULL, homenv);
|
||||
|
||||
/* Only set homedir if some home directory could be determined,
|
||||
* otherwise keep homedir NULL. */
|
||||
if (homenv != NULL && strcmp(homenv, "") != 0)
|
||||
homedir = mallocstrcpy(NULL, homenv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,15 +239,6 @@ ssize_t ngetline(char **lineptr, size_t *n, FILE *stream)
|
||||
#endif /* !DISABLE_NANORC */
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Do the compiled regex in preg and the regex in string match the
|
||||
* beginning or end of a line? */
|
||||
bool regexp_bol_or_eol(const regex_t *preg, const char *string)
|
||||
{
|
||||
return (regexec(preg, string, 0, NULL, 0) == 0 &&
|
||||
regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
|
||||
REG_NOMATCH);
|
||||
}
|
||||
|
||||
/* Fix the regex if we're on platforms which require an adjustment
|
||||
* from GNU-style to BSD-style word boundaries. */
|
||||
const char *fixbounds(const char *r)
|
||||
@@ -290,12 +270,11 @@ const char *fixbounds(const char *r)
|
||||
fprintf(stderr, "fixbounds(): Ending string = \"%s\"\n", r3);
|
||||
#endif
|
||||
return (const char *) r3;
|
||||
#endif
|
||||
#endif /* !GNU_WORDBOUNDS */
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
/* Is the word starting at position pos in buf a whole word? */
|
||||
@@ -425,8 +404,7 @@ void *nrealloc(void *ptr, size_t howmuch)
|
||||
}
|
||||
|
||||
/* Copy the first n characters of one malloc()ed string to another
|
||||
* pointer. Should be used as: "dest = mallocstrncpy(dest, src,
|
||||
* n);". */
|
||||
* pointer. Should be used as: "dest = mallocstrncpy(dest, src, n);". */
|
||||
char *mallocstrncpy(char *dest, const char *src, size_t n)
|
||||
{
|
||||
if (src == NULL)
|
||||
@@ -445,8 +423,7 @@ char *mallocstrncpy(char *dest, const char *src, size_t n)
|
||||
* "dest = mallocstrcpy(dest, src);". */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
{
|
||||
return mallocstrncpy(dest, src, (src == NULL) ? 1 :
|
||||
strlen(src) + 1);
|
||||
return mallocstrncpy(dest, src, (src == NULL) ? 1 : strlen(src) + 1);
|
||||
}
|
||||
|
||||
/* Free the malloc()ed string at dest and return the malloc()ed string
|
||||
@@ -643,7 +620,7 @@ filestruct *fsfromline(ssize_t lineno)
|
||||
for (; f->lineno != lineno && f != openfile->fileage; f = f->prev)
|
||||
;
|
||||
else
|
||||
for (; f->lineno != lineno && f->next != NULL; f = f->next)
|
||||
for (; f->lineno != lineno && f->next != NULL; f = f->next)
|
||||
;
|
||||
|
||||
if (f->lineno != lineno)
|
||||
|
||||
665
src/winio.c
665
src/winio.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user