Compare commits
366 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a890962f8 | ||
|
|
50ee461ff5 | ||
|
|
15c9b9a3a2 | ||
|
|
f8770d632e | ||
|
|
2ceb858030 | ||
|
|
35bd350c03 | ||
|
|
b995263309 | ||
|
|
b1eb0ee20b | ||
|
|
86058fa97f | ||
|
|
ec71964386 | ||
|
|
a4ede3c21e | ||
|
|
99c61e207f | ||
|
|
2aa69bcf27 | ||
|
|
3c019ef217 | ||
|
|
870dc48ef0 | ||
|
|
6dfd398531 | ||
|
|
a9003419e1 | ||
|
|
33b0c6874a | ||
|
|
0e1df431a8 | ||
|
|
d8d19ba324 | ||
|
|
5314b8dd8a | ||
|
|
cc91cf41a0 | ||
|
|
e44cd2dfba | ||
|
|
9e7b2d572c | ||
|
|
30ca7d5219 | ||
|
|
6e1cd2d2f3 | ||
|
|
4154d08362 | ||
|
|
8310cd3de6 | ||
|
|
f38b27e0a1 | ||
|
|
9eaa50d69c | ||
|
|
61848f172a | ||
|
|
0ec34ac28a | ||
|
|
cb04b56c92 | ||
|
|
5d7a1017ef | ||
|
|
9009890726 | ||
|
|
4554520805 | ||
|
|
70afb990b3 | ||
|
|
b5ba9df80f | ||
|
|
904a510ee1 | ||
|
|
c4592f3a55 | ||
|
|
44e671f2de | ||
|
|
ce270393be | ||
|
|
6335fb54d5 | ||
|
|
4b1c73ee17 | ||
|
|
bd34da7d1d | ||
|
|
0c7e6d7aed | ||
|
|
fc77fde448 | ||
|
|
e9252c55e2 | ||
|
|
518b7fac9d | ||
|
|
0c426782c4 | ||
|
|
2aca11e800 | ||
|
|
4078d60d69 | ||
|
|
46104dcc8e | ||
|
|
26b3ead8d2 | ||
|
|
ad64cd97b8 | ||
|
|
8060d66158 | ||
|
|
4c19415ecf | ||
|
|
b513778b56 | ||
|
|
6642e88561 | ||
|
|
f85a1eb48a | ||
|
|
5ab28f2716 | ||
|
|
f1982f01d1 | ||
|
|
e3e3128629 | ||
|
|
4b6a00cb72 | ||
|
|
4ef023478c | ||
|
|
cfeebc6055 | ||
|
|
bd5398050a | ||
|
|
ad36bdc773 | ||
|
|
916c7c26bf | ||
|
|
b6fb6884ca | ||
|
|
3d267dc323 | ||
|
|
9a2d0aff00 | ||
|
|
f7eef5d04c | ||
|
|
9d4b8fb434 | ||
|
|
8ad3b78626 | ||
|
|
6ad82142c0 | ||
|
|
0e48bc18be | ||
|
|
4fd1ca07a7 | ||
|
|
8db126b09d | ||
|
|
d97649859d | ||
|
|
81371020bb | ||
|
|
013613ec40 | ||
|
|
50d78a6f9a | ||
|
|
b6c4dbffdb | ||
|
|
8125e08bfa | ||
|
|
90c5a908ee | ||
|
|
cfc9fd2780 | ||
|
|
173bd2f003 | ||
|
|
d21eea02ac | ||
|
|
1c9dd109bf | ||
|
|
5a8182e7df | ||
|
|
292f7ef414 | ||
|
|
b7f6bf794d | ||
|
|
79f946b682 | ||
|
|
3a2dc3e0a7 | ||
|
|
6b8b3ec105 | ||
|
|
16fd49b854 | ||
|
|
f3af804378 | ||
|
|
21b946e45d | ||
|
|
8269ae3cea | ||
|
|
606d5a1e22 | ||
|
|
458e850b83 | ||
|
|
cb801d63a3 | ||
|
|
6c6d2bc4db | ||
|
|
84d22e3f53 | ||
|
|
89eb5a96fb | ||
|
|
d23dcc5a25 | ||
|
|
6f751500cc | ||
|
|
a93023f14b | ||
|
|
b31b128a78 | ||
|
|
b24cb0cd19 | ||
|
|
2bf7e975eb | ||
|
|
ba48aa9743 | ||
|
|
6c3a399817 | ||
|
|
137694d15b | ||
|
|
8965af5874 | ||
|
|
4967eb8fc0 | ||
|
|
366c509304 | ||
|
|
f8df4a0fcb | ||
|
|
f0c6e78a6e | ||
|
|
e88bc62258 | ||
|
|
ca74e42a84 | ||
|
|
6b9e7cf5be | ||
|
|
1bb4db6409 | ||
|
|
e693023de8 | ||
|
|
e54f1c4eaa | ||
|
|
08cf2528e1 | ||
|
|
40dcea0e2e | ||
|
|
cb6ad31a8e | ||
|
|
057f239b43 | ||
|
|
890eab8270 | ||
|
|
32612ddcde | ||
|
|
3660bc6a46 | ||
|
|
cca9bdd177 | ||
|
|
9f0fccd713 | ||
|
|
65ab1c87b7 | ||
|
|
0c0cafbc19 | ||
|
|
76520a8ec4 | ||
|
|
1295699d03 | ||
|
|
ee8edfc64c | ||
|
|
273b9e8d5b | ||
|
|
85f9f0f941 | ||
|
|
385e772e54 | ||
|
|
ab8c7162d3 | ||
|
|
152f57bf9c | ||
|
|
8ee8915c49 | ||
|
|
a447a2d810 | ||
|
|
22066a2cad | ||
|
|
c603fefbf6 | ||
|
|
b5652a4d56 | ||
|
|
98bca94758 | ||
|
|
8c9256a731 | ||
|
|
89ae4a343c | ||
|
|
61525a1e29 | ||
|
|
97e0d665de | ||
|
|
e4769dfeab | ||
|
|
ee35aa3b01 | ||
|
|
23b9907048 | ||
|
|
85307fe28e | ||
|
|
1755e28ad9 | ||
|
|
6db9ebbe04 | ||
|
|
77369f425b | ||
|
|
52804ab8e8 | ||
|
|
6e379c254e | ||
|
|
2953f783e3 | ||
|
|
48f67a5c4c | ||
|
|
d09eb8374a | ||
|
|
b9f007430b | ||
|
|
0061bf5b71 | ||
|
|
4ab14c6ad0 | ||
|
|
768a75ff5f | ||
|
|
012425c401 | ||
|
|
f5a720dfda | ||
|
|
b7a5be6739 | ||
|
|
ce1c9ac363 | ||
|
|
1b36fc16f5 | ||
|
|
7f0cfd5304 | ||
|
|
b011e440b4 | ||
|
|
464c8a808c | ||
|
|
d2b1f52d17 | ||
|
|
7d15d1d8d8 | ||
|
|
a1b6997066 | ||
|
|
9054e3a2ae | ||
|
|
1b3e4e117a | ||
|
|
3879528945 | ||
|
|
185dc6acd0 | ||
|
|
890ea443d7 | ||
|
|
495fe91e97 | ||
|
|
4d5cd6be1e | ||
|
|
89ca96bd88 | ||
|
|
8fd5193b74 | ||
|
|
1512503b2b | ||
|
|
d6972ae74f | ||
|
|
5187b504d4 | ||
|
|
fa38795ef5 | ||
|
|
e1e2cb7064 | ||
|
|
17408b52e5 | ||
|
|
e5e6d9b696 | ||
|
|
98332d40dc | ||
|
|
62591da0fe | ||
|
|
fa67260c53 | ||
|
|
56ec5925f3 | ||
|
|
f7b8783eaa | ||
|
|
6835102ce5 | ||
|
|
0bbd290168 | ||
|
|
5c55e85410 | ||
|
|
5a22dbb159 | ||
|
|
73e337594e | ||
|
|
dbc415fc47 | ||
|
|
f351176756 | ||
|
|
69583ad664 | ||
|
|
30d7f33954 | ||
|
|
6da4e56f1e | ||
|
|
c6bef76a6c | ||
|
|
2ea7fb0154 | ||
|
|
cbab273a08 | ||
|
|
28a6802307 | ||
|
|
2578025e7f | ||
|
|
5b17ef85e7 | ||
|
|
3714e07d7b | ||
|
|
7b0531aa0b | ||
|
|
e517613c01 | ||
|
|
57703086e2 | ||
|
|
550ca10378 | ||
|
|
f9f8cc36e4 | ||
|
|
ad344e9d1d | ||
|
|
6827146dd2 | ||
|
|
b159f941e8 | ||
|
|
c7c49c48da | ||
|
|
4ce755072c | ||
|
|
2f702285eb | ||
|
|
592ccf9a5e | ||
|
|
bd28ee472b | ||
|
|
1b4ae6997e | ||
|
|
722b728a1c | ||
|
|
97cd67c3d4 | ||
|
|
f28ff9dece | ||
|
|
ec177be416 | ||
|
|
1dc7c1225a | ||
|
|
8a72370040 | ||
|
|
5370b0cd19 | ||
|
|
19f3bd6546 | ||
|
|
a44ca78a50 | ||
|
|
006fc2338c | ||
|
|
118cb37e63 | ||
|
|
d3887dc695 | ||
|
|
c81aa0641c | ||
|
|
f8758833cd | ||
|
|
4ac129c4bf | ||
|
|
e53e12559f | ||
|
|
23994bd8a0 | ||
|
|
6e308c0442 | ||
|
|
7c06be5ff7 | ||
|
|
3bb45ae00b | ||
|
|
6ff22e7020 | ||
|
|
0a4b737b73 | ||
|
|
32a3ce4cd2 | ||
|
|
935594b14a | ||
|
|
a5ad825f30 | ||
|
|
f968a18a3f | ||
|
|
eec40df2a1 | ||
|
|
c346701d09 | ||
|
|
9a145d906f | ||
|
|
49172cad95 | ||
|
|
0d8feb9a85 | ||
|
|
1e1117775f | ||
|
|
84b9f4bd17 | ||
|
|
82697f2fcd | ||
|
|
1a473483b1 | ||
|
|
c6c98f7c7a | ||
|
|
b8592ce2bb | ||
|
|
b08c9f004c | ||
|
|
87b37bde9b | ||
|
|
35c9fa6da3 | ||
|
|
083cc12861 | ||
|
|
4ea2eac360 | ||
|
|
e328169b6d | ||
|
|
4e68588596 | ||
|
|
7f3fdb4790 | ||
|
|
d59c42363b | ||
|
|
c284e1ddb8 | ||
|
|
664e0da48e | ||
|
|
a5322ee5ad | ||
|
|
c2e585ef6c | ||
|
|
2c36e2eb00 | ||
|
|
bf104950fd | ||
|
|
ec15fdb30b | ||
|
|
b006367878 | ||
|
|
99a06d344f | ||
|
|
aee00d4d14 | ||
|
|
7f80174373 | ||
|
|
a89e39a35e | ||
|
|
afeed5f640 | ||
|
|
aa4eb40e71 | ||
|
|
19cb1e6de6 | ||
|
|
85e35e67a2 | ||
|
|
51b7b0e7d8 | ||
|
|
0cae087784 | ||
|
|
567d471681 | ||
|
|
f1a8e7221d | ||
|
|
ca53a6e35a | ||
|
|
a7bdd2e9c6 | ||
|
|
4953e49d92 | ||
|
|
051e953f17 | ||
|
|
bc7dc36c7d | ||
|
|
60d22f012a | ||
|
|
2f7c1a0613 | ||
|
|
b520d509cc | ||
|
|
c0ba4bf3e0 | ||
|
|
f8d085d2ed | ||
|
|
3528a034f2 | ||
|
|
49c85d076c | ||
|
|
015c434be1 | ||
|
|
afa1542b76 | ||
|
|
9f2e3f7654 | ||
|
|
458d004efe | ||
|
|
139dc4a844 | ||
|
|
a0283b7710 | ||
|
|
345a5b84bf | ||
|
|
d44f322f6d | ||
|
|
ed467e50ff | ||
|
|
7d6dd41a4a | ||
|
|
a43827d1cb | ||
|
|
224b6d5b77 | ||
|
|
5ee89c6898 | ||
|
|
6fa1144d1a | ||
|
|
96514a242f | ||
|
|
6b90657d94 | ||
|
|
85ffaeeefc | ||
|
|
fef3c8679d | ||
|
|
c021925abb | ||
|
|
46c29c4351 | ||
|
|
17e12691b0 | ||
|
|
3d7c2bd2d6 | ||
|
|
21cdee5517 | ||
|
|
0457eb97af | ||
|
|
a43b10854f | ||
|
|
a662c5579a | ||
|
|
990a695f54 | ||
|
|
6f499096ad | ||
|
|
296ee153b0 | ||
|
|
8f975a11f0 | ||
|
|
2458b295d9 | ||
|
|
a4e92c8ad6 | ||
|
|
fef232a672 | ||
|
|
8cd0d2c751 | ||
|
|
0fd5d60477 | ||
|
|
780f1d3f78 | ||
|
|
6cefb9f21a | ||
|
|
d04037760d | ||
|
|
ef45a2528c | ||
|
|
727c244ab6 | ||
|
|
68e2c375e7 | ||
|
|
99c87ccb0c | ||
|
|
4e71ab6891 | ||
|
|
b0c1bc28f8 | ||
|
|
0e92adf153 | ||
|
|
3b722460b8 | ||
|
|
865ad94100 | ||
|
|
6c8f92c092 | ||
|
|
2f94f42730 | ||
|
|
98e4d4f3b1 | ||
|
|
f23cc46655 | ||
|
|
decae6c25e | ||
|
|
74d8ebc041 | ||
|
|
899d0360ec |
6
AUTHORS
6
AUTHORS
@@ -4,15 +4,15 @@ nano editor. Please see the ChangeLog for specific changes by author.
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Chris Allegretta <chrisa@asty.org>
|
||||
* Original program author, stable series maintainer.
|
||||
* Original program author, former stable series maintainer.
|
||||
|
||||
David Lawrence Ramsey <pooka109@cox.net>
|
||||
* Development series maintainer. Multiple buffer support,
|
||||
* Current 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.
|
||||
|
||||
Jordi Mallach <jordi@sindominio.net>
|
||||
Jordi Mallach <jordi@gnu.org>
|
||||
* Debian package maintainer, fellow bug squasher.
|
||||
* Internationalization support head, ca.po maintainer.
|
||||
|
||||
|
||||
122
BUGS
122
BUGS
@@ -8,18 +8,18 @@
|
||||
certain col values. (9) [FIXED]
|
||||
- edit_refresh() and update_line() do not handle selecting text when the
|
||||
cursor is beyond COLS (10) [FIXED]
|
||||
- no way to do a replace with the empty string (11) [FIXED, yay!]
|
||||
- No way to do a replace with the empty string (11) [FIXED, yay!]
|
||||
- Spelling support is not elegant like Pico's integration of the 'spell'
|
||||
program. Nano only uses ispell (for now) (12) [FIXED]
|
||||
program. nano only uses ispell (for now) (12) [FIXED]
|
||||
- Moving to the end of a line when close to a multiple of COLS and at
|
||||
least COLS * 2 does not make the screen jump early like it would for
|
||||
if we were around COLS (bugs in edit_refresh, update_line) (13)
|
||||
[FIXED, mostly]
|
||||
- When at the very bottom of the edit window, do_wrap goes berserk and
|
||||
- When at the very bottom of the edit window, do_wrap() goes berserk and
|
||||
puts the cursor somewhere bad; subsequent keystrokes crash the program
|
||||
(14) [FIXED, mostly]
|
||||
- Doing a replacement of a substring of the replace string (e.g. replacing
|
||||
"ed" with "fred" causes an infinite loop). (15) [FIXED]
|
||||
- Doing a replacement of a substring of the replace string (e.g.
|
||||
replacing "ed" with "fred" causes an infinite loop). (15) [FIXED]
|
||||
- Cutting a file with marked text and both marker ends on the same line
|
||||
causes a random segfault (16) [FIXED]
|
||||
- Cutting more than one line resets the KEEP_CUTBUFFER flag in 0.9.3.
|
||||
@@ -27,25 +27,28 @@
|
||||
- The wrapping code does not work right for lines like the following:
|
||||
* *
|
||||
Error is in do_wrap, must be rewritten. (18) [FIXED]
|
||||
- Nano fails to follow symlinks, even though -l isn't being used (20).
|
||||
- nano fails to follow symlinks, even though -l isn't being used (20).
|
||||
[Bug in global flag init, FIXED]
|
||||
- When using --help or --version, the SIGINT character gets lost. (21) [FIXED]
|
||||
- When using --help or --version, the SIGINT character gets lost. (21)
|
||||
[FIXED]
|
||||
- edit_refresh() and update_line() (and related functions) have
|
||||
trouble when a tab is the character that is the boundary at COLS (23)
|
||||
[FIXED]
|
||||
- There is an off-by-one error in keeping track of totsize. It is caused
|
||||
by the fact that we count the newline at the end when we read in a file
|
||||
but we do not, in fact, display this newline. This should go away
|
||||
implicitly when the "Magic Line" returns, but it is noted here for
|
||||
documentation's sake. (24) [FIXED]
|
||||
- There is an off-by-one error in keeping track of totsize. It is
|
||||
caused by the fact that we count the newline at the end when we read
|
||||
in a file but we do not, in fact, display this newline. This should
|
||||
go away implicitly when the "Magic Line" returns, but it is noted here
|
||||
for documentation's sake. (24) [FIXED]
|
||||
- In replace with completely adjacent strings, every other search string
|
||||
will be missed (try replace ':' in a string like ':::::::::') (28) [FIXED]
|
||||
- If nano opens a read-only file with the --tempfile option, and a change
|
||||
is made to the buffer, and a write is attempted, nano will not give you
|
||||
a dialog about not being able to write the file, and it will not let the
|
||||
user exit (29, discovered by Joshua Jensen) [FIXED]
|
||||
will be missed (try replace ':' in a string like ':::::::::') (28)
|
||||
[FIXED]
|
||||
- If nano opens a read-only file with the --tempfile option, and a
|
||||
change is made to the buffer, and a write is attempted, nano will not
|
||||
give you a dialog about not being able to write the file, and it will
|
||||
not let the user exit (29, discovered by Joshua Jensen) [FIXED]
|
||||
- Using nano -k, marked text is not cut properly. (31) [FIXED]
|
||||
- Invoking -t or -k has the effect of invoking both options. (32) [FIXED]
|
||||
- Invoking -t or -k has the effect of invoking both options. (32)
|
||||
[FIXED]
|
||||
- totsize becomes incorrect after word-wrapping (25) [FIXED]
|
||||
- Wrapping a line with autoindent mode sometimes causes a segfault (19)
|
||||
[FIXED]
|
||||
@@ -55,51 +58,52 @@
|
||||
[FIXED]
|
||||
- In replace, there is no way to accept the default replace string. (27)
|
||||
[FIXED]
|
||||
- Using nano -t, user can not exit until a filename is given via ^O. (30)
|
||||
[FIXED]
|
||||
- Using nano -t, user can not exit until a filename is given via ^O.
|
||||
(30) [FIXED]
|
||||
- totsize problems still abound in do_justify (33) [FIXED]
|
||||
- Using -k, cut text is not pasted properly. (34) [FIXED].
|
||||
- Using -k, pasted text is not updated properly if it goes beyond editbot. (35)
|
||||
[FIXED]
|
||||
- Using -k, pasted text is not updated properly if it goes beyond
|
||||
editbot. (35) [FIXED]
|
||||
- Doing a cut with -k can screw up the filestruct; fault is in cutting
|
||||
code. (36) [FIXED]
|
||||
code. (36) [FIXED]
|
||||
- Hitting enter on the magic line makes new lines, but they are not
|
||||
written out to disk when saved..... (37). [FIXED]
|
||||
- Page up and page down do not work the same way as in Pico (# of lines). (38)
|
||||
[FIXED]
|
||||
- Page up and page down do not work the same way as in Pico (# of
|
||||
lines). (38) [FIXED]
|
||||
- When doing a search and the marker is set, the screen does not always
|
||||
properly update the inverted text (39). [FIXED]
|
||||
- Searches for a string that only exists on one line multiple times will
|
||||
fail after finding the last occurrence (discovered by Ken Tyler) (40).
|
||||
[FIXED]
|
||||
- Alt-Z is currently broken to toggle suspend. I guess I still don't know
|
||||
signals very well =-) (41) [FIXED].
|
||||
- Unable to cut the entire file using the marker (discovered by Ken Tyler)
|
||||
(42). [FIXED]
|
||||
- The keypad does not work when nano runs in the Gnome terminal (43). [FIXED]
|
||||
- When reading in a file, if the file is a directory, the contents of the
|
||||
file being edited are blown away (discovered by Chris Pimlot) (44). [FIXED]
|
||||
- in certain terms, nano will leave a "ghost" of screen upon exit
|
||||
when called from inside mutt (among other settings) (45). [FIXED]
|
||||
- Meta-Z is currently broken to toggle suspend. I guess I still don't
|
||||
know signals very well =-) (41) [FIXED].
|
||||
- Unable to cut the entire file using the marker (discovered by Ken
|
||||
Tyler) (42). [FIXED]
|
||||
- The keypad does not work when nano runs in the Gnome terminal (43).
|
||||
[FIXED]
|
||||
- When reading in a file, if the file is a directory, the contents of
|
||||
the file being edited are blown away (discovered by Chris Pimlot)
|
||||
(44). [FIXED]
|
||||
- In certain terms, nano will leave a "ghost" of screen upon exit when
|
||||
called from inside mutt (among other settings) (45). [FIXED]
|
||||
- In replace, hitting the Goto line shortcut key does nothing after a
|
||||
search string is entered (discovered by Rocco Corsi) (46) [FIXED].
|
||||
- When typing in a string in search or replace and hitting CASE_SENSITIVE
|
||||
or the other search string, the current string edit is blown away in
|
||||
favor of the last stored search (47) [FIXED]
|
||||
- When typing in a string in search or replace and hitting
|
||||
CASE_SENSITIVE or the other search string, the current string edit is
|
||||
blown away in favor of the last stored search (47) [FIXED]
|
||||
- If nano fails to open a file when it starts up, doing almost anything
|
||||
causes a segfault (discovered by Ben Roberts) (48). [FIXED]
|
||||
- In certain terminals, nano would not work properly with keypad().
|
||||
Turned out to be the silly timeout(0) call, which is completely
|
||||
unneeded, anyway. (49) [FIXED]
|
||||
- With less than a page of text, doing a page down will move the
|
||||
current line to the top of the screen, which it shouldn't do. (50)
|
||||
[FIXED]
|
||||
- with PDCURSES, running meta-X turns off the keypad. (51) [FIXED]
|
||||
unneeded, anyway. (49) [FIXED]
|
||||
- With less than a page of text, doing a page down will move the current
|
||||
line to the top of the screen, which it shouldn't do. (50) [FIXED]
|
||||
- With PDCurses, running Meta-X turns off the keypad. (51) [FIXED]
|
||||
- Resizing the window completely screws up the display if in any other
|
||||
mode than normal editing (help screen, search and replace, file
|
||||
browser..) (52) [FIXED]
|
||||
- Alt speller argument (-s, --speller) does not take a string argument of
|
||||
more than one word. (53) [FIXED].
|
||||
browser...) (52) [FIXED]
|
||||
- Alt speller argument (-s, --speller) does not take a string argument
|
||||
of more than one word. (53) [FIXED].
|
||||
- Cut to end cutting (-k) causes segfaults (try cutting "- Backup making
|
||||
(filename~)?" line in TODO file) (discovered by
|
||||
higuita@cadernoverde.com) (54) [FIXED].
|
||||
@@ -109,29 +113,29 @@
|
||||
the first fail if no string is entered (56) [FIXED].
|
||||
- Page down on a file of editwinrows fails (again). Reported by Ryan
|
||||
Krebs (57) [FIXED].
|
||||
- File browser aborts on Solaris in qsort() call. (Reported by
|
||||
Matthias Andree) (58) [FIXED].
|
||||
- Can modify the current file in view mode with ^W^R (discovered by Rocco
|
||||
Corsi) (58) [FIXED].
|
||||
- When page up is used after two page down's, the screen doesn't update
|
||||
- File browser aborts on Solaris in qsort() call. (Reported by Matthias
|
||||
Andree) (58) [FIXED].
|
||||
- Can modify the current file in view mode with ^W^R (discovered by
|
||||
Rocco Corsi) (58) [FIXED].
|
||||
- When page up is used after two page downs, the screen doesn't update
|
||||
properly (discovered by David Lawrence Ramsey) (59) [FIXED].
|
||||
- On BSD systems, marked cutting sna paste often screws up the
|
||||
last line in the cutbuffer (discovered by Barry Pederson) (60) [FIXED]
|
||||
- On BSD systems, marked cutting and paste often screws up the last line
|
||||
in the cutbuffer (discovered by Barry Pederson) (60) [FIXED]
|
||||
- Blank lines are not kept when cutting with -k (discovered by Rocco)
|
||||
(61) [FIXED].
|
||||
- Nano will not suspend properly inside of mutt (62) [FIXED].
|
||||
- nano will not suspend properly inside of mutt (62) [FIXED].
|
||||
- When switching from Pico mode to normal mode, the previous search is
|
||||
not displayed until cancelling the search (63) [FIXED].
|
||||
- If you change search options but don't change the search string in
|
||||
normal mode, hitting enter causes the search/replace to abort (64)
|
||||
normal mode, hitting Enter causes the search/replace to abort (64)
|
||||
(Jordi Mallach) [FIXED].
|
||||
- Cutting one line of text causes the screen to recenter the line
|
||||
(reported and fixed by David Lawrence Ramsey) (65) [FIXED].
|
||||
- When cutting marked text including the bottom of the file, a new
|
||||
"magic line" is not created" (reported by David Lawrence
|
||||
Ramsey, fixed by David Lawrence Ramsey & Chris) (66) [FIXED].
|
||||
- ^C does not work after a suspend in tcsh (discovered by
|
||||
Trevor Cordes) (68) [FIXED].
|
||||
- When cutting marked text including the bottom of the file, a new
|
||||
"magic line" is not created" (reported by David Lawrence Ramsey, fixed
|
||||
by David Lawrence Ramsey & Chris) (66) [FIXED].
|
||||
- ^C does not work after a suspend in tcsh (discovered by Trevor Cordes)
|
||||
(68) [FIXED].
|
||||
- Home and End control keys (^A, ^E) do not always work in filename
|
||||
prompt (bug found by Ian Turner) (69) [1.0 series only] [FIXED].
|
||||
- Trying to insert a file of 0 bytes will hang nano (70) [FIXED].
|
||||
|
||||
@@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = gnu no-dependencies
|
||||
SUBDIRS = doc m4 po src
|
||||
|
||||
EXTRA_DIST = ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS \
|
||||
README THANKS TODO UPGRADE config.rpath install-sh \
|
||||
missing mkinstalldirs nano.spec
|
||||
README README.CVS THANKS TODO UPGRADE config.rpath \
|
||||
install-sh missing mkinstalldirs nano.spec
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
108
NEWS
108
NEWS
@@ -1,3 +1,76 @@
|
||||
2007.01.29 - GNU nano 2.0.3 flows toward its ending. This release
|
||||
contains several minor optimizations to make the
|
||||
executable a little smaller under some circumstances,
|
||||
some translation updates, improvements to the color
|
||||
syntax for Python, and still more minor documentation
|
||||
updates. Have fun.
|
||||
|
||||
2006.12.20 - GNU nano 2.0.2 forges ahead. This release fixes a segfault
|
||||
when trying to save in a nonexistent directory; fixes
|
||||
handling of strings containing nulls at the "Write File",
|
||||
"Insert File", "Execute Command", and "Go to Directory"
|
||||
prompts; fixes several minor memory leaks; fixes two
|
||||
more potential compilation warnings; adds a few
|
||||
translation updates; and adds a few more minor
|
||||
documentation updates. Enjoy.
|
||||
|
||||
2006.11.20 - GNU nano 2.0.1 emerges from its cocoon. This release
|
||||
contains several bugfixes: saving one file over another
|
||||
will now always warn about overwriting it, overwriting
|
||||
a file is no longer possible when saving a new file in
|
||||
restricted mode, and zero-length Unicode characters are
|
||||
now highlighted properly when nano is built without
|
||||
regular expression support. It also adds several minor
|
||||
documentation updates. Have fun with it.
|
||||
|
||||
2006.11.06 - GNU nano 2.0.0 does its little dance. This release adds
|
||||
documentation updates and a few cosmetic tweaks.
|
||||
For those who haven't been following nano 1.3
|
||||
development, there are a ton of new features, including
|
||||
support for UTF-8, moving to a specified line and column
|
||||
instead of just a line, improved color syntax
|
||||
highlighting, inserting previously untypeable characters
|
||||
using "Verbatim Input" mode, and copying text into the
|
||||
cutbuffer without cutting it. There are also fixes for
|
||||
some long-standing bugs, such as the "NumLock glitch"
|
||||
from nano 1.2.x, and the inability to unjustify text
|
||||
after resizing. Finally, there are also a ton of
|
||||
translation updates and new translations, as well as new
|
||||
color syntaxes. See the UPGRADE file for more
|
||||
information, and enjoy the new stable release.
|
||||
|
||||
2006.10.25 - GNU nano 1.9.99pre3 learns to appreciate life. This
|
||||
release fixes a bug where the screen sometimes wouldn't
|
||||
be updated properly after copying text into the
|
||||
cutbuffer, fixes a potential warning while compiling,
|
||||
and fixes a few other minor inconsistencies. Have fun.
|
||||
|
||||
2006.10.02 - GNU nano 1.9.99pre2 crosses the threshold. This release
|
||||
fixes a few more bugs: cursor positioning after leaving
|
||||
the statusbar prompt has been fixed, and verbatim input
|
||||
at the statusbar prompt now properly handles newlines.
|
||||
Enjoy.
|
||||
|
||||
2006.08.29 - GNU nano 1.9.99pre1 passes through the flames. This
|
||||
release fixes various bugs in the last version: the
|
||||
mouse support properly ignores everything except clicks
|
||||
of the left mouse button; the statusbar is now blanked
|
||||
properly when it should be; indenting and unindenting
|
||||
operate on the current line when the mark is off; nano
|
||||
should build on Tru64, NetBSD, and other systems that
|
||||
use termcap instead of terminfo in their curses
|
||||
libraries; the built-in file browser now properly
|
||||
navigates file lists that take up only one row; the
|
||||
cursor position is now completely restored after
|
||||
inserting a file into the current buffer, and after
|
||||
inserting the output of a command into a new buffer; the
|
||||
^X shortcut at the search prompt has been removed, as
|
||||
official Pico doesn't include it and it's too easily
|
||||
confused with Exit; the screen is updated properly after
|
||||
scrolling a line without moving the cursor; the keyboard
|
||||
input routines behave more consistently; and so on.
|
||||
Have fun with it.
|
||||
|
||||
2006.06.26 - GNU nano 1.3.12 escapes the darkness. This release
|
||||
contains the last new features that nano will have
|
||||
before 2.0: copying text into the cutbuffer without
|
||||
@@ -154,8 +227,8 @@
|
||||
and replacing all text in a file now properly updates
|
||||
the screen in all cases. New features include sample
|
||||
regexes for patch files, improvements to the sample
|
||||
regexes for C files, and support for strings
|
||||
greater than 1023 characters and/or containing nulls in
|
||||
regexes for C files, and support for strings greater
|
||||
than 1023 characters and/or containing nulls in
|
||||
.nano_history. Additionally, the full justify keystroke
|
||||
has been changed to match current Pico, and whitespace
|
||||
display mode is now turned off by default. Enjoy.
|
||||
@@ -229,7 +302,7 @@
|
||||
broken regex detection, search history recall, and
|
||||
keypad handling with -K. Debugging strings are no
|
||||
longer translated and comments denote where translations
|
||||
should be as short as possible (i.e, the statusbar).
|
||||
should be as short as possible (i.e. the statusbar).
|
||||
There are new examples for syntax highlighting, and
|
||||
documentation updates and fixes. The 1.3.0 CVS tree
|
||||
will be opening soon for all your nano desires, so stay
|
||||
@@ -362,7 +435,7 @@
|
||||
mode (^O,M-P), a new "syntax" command in the .nanorc to
|
||||
allow multiple syntax highlighting types, and a new -Y,
|
||||
--syntax flag to set a specific one if there's no
|
||||
filename regex to match it against (i.e, w/mutt). The
|
||||
filename regex to match it against (i.e. w/mutt). The
|
||||
^space and M-space keys will now show up in the help
|
||||
menu, which itself has been tweaked a bit, and many more
|
||||
configure options should now cooperate (like the odd
|
||||
@@ -502,6 +575,27 @@
|
||||
introduce lots of bugs ;-) Have fun with it, but be
|
||||
careful, unstable means unstable.
|
||||
|
||||
07/01/2001 - GNU nano 1.0.3 is the "mutt" release. This release
|
||||
features oodles of bug fixes with cutting text,
|
||||
especially with the -k (cut to end) option. There is
|
||||
also a new suspend handler which should make nano play
|
||||
better with mutt (the code for which came from mutt
|
||||
itself; many many thanks to Jordi Mallach and Tom Lear
|
||||
for working late into the night fixing this). Nano now
|
||||
also features mutt's case insensitive string compare
|
||||
function for more speed and less memory usage. Two new
|
||||
translations are included, Ukrainian and Russian.
|
||||
|
||||
05/12/2001 - GNU nano 1.0.2 is the "just the bugfixes ma'am" release.
|
||||
The most noticeable fixes are for display errors using
|
||||
page up/down with the marker code, and view mode (-v)
|
||||
not stopping the replace function. Other fixes include
|
||||
being able to use the arrow keys while holding down the
|
||||
ctrl key in certain TERMs, and there are many
|
||||
documentation updates and spelling tweaks. We also have
|
||||
a new Galician translation (provided by Jacobo Tarrío).
|
||||
Have fun with it!
|
||||
|
||||
04/06/2001 - GNU nano 1.0.1 is out there. The only new feature is a
|
||||
configure option for those who want to disable all word
|
||||
wrapping from nano, --disable-wrapping. Bug fixes this
|
||||
@@ -542,7 +636,7 @@
|
||||
resizing the editor in any mode other than normal edit
|
||||
mode. Other fixes include some more tab completion
|
||||
segfaults, and an silly segfault that occurred when
|
||||
successfully writing a file on the 2nd try (i.e, after
|
||||
successfully writing a file on the 2nd try (i.e. after
|
||||
an initial write error). Slowly but surely, on toward
|
||||
1.0 we travel.
|
||||
|
||||
@@ -730,7 +824,7 @@
|
||||
|
||||
05/14/2000 - Nano 0.9.7 (the Mother's Day release) continues in the long
|
||||
line of display fixes, and also fixes the broken symlink
|
||||
behavior (i.e, symlinks weren't being followed by
|
||||
behavior (i.e. symlinks weren't being followed by
|
||||
default). Hopefully all major bugs can be worked out
|
||||
soon and we can have a 1.0 release before the end of the
|
||||
year, but who knows.
|
||||
@@ -783,7 +877,7 @@
|
||||
04/14/2000 - 0.9.1 has some more Pico compatibility built-in. The
|
||||
option to switch to/from Search and Search/Replace (^T)
|
||||
is now available, and nano now displays the more
|
||||
Pico-like shortcut list when invoked as 'pico' (i.e, if
|
||||
Pico-like shortcut list when invoked as 'pico' (i.e. if
|
||||
'pico' is a symlink to nano). There is an important
|
||||
change to the handling of symbolic links as well. Now,
|
||||
nano does the "correct" thing and automatically writes
|
||||
|
||||
8
README
8
README
@@ -19,7 +19,7 @@ Overview
|
||||
|
||||
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.
|
||||
http://www.gnu.org/.
|
||||
|
||||
How to compile and install nano
|
||||
|
||||
@@ -65,10 +65,6 @@ Mailing List and Bug Reports
|
||||
|
||||
Current Status
|
||||
|
||||
GNU nano has reached its second stable milestone, 1.2.x.
|
||||
Development of new features continues in the 1.3.x branch, while
|
||||
1.2.x versions are dedicated to bug-fixing and polishing.
|
||||
|
||||
Chris Allegretta (chrisa@asty.org)
|
||||
GNU nano has reached its third stable milestone, 2.0.x.
|
||||
|
||||
$Id$
|
||||
|
||||
@@ -42,11 +42,7 @@ If you're using a C shell (e.g. tcsh or csh), do
|
||||
After that's set up, cd to your src directory and use the following
|
||||
command to download the CVS tree:
|
||||
|
||||
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout nano
|
||||
|
||||
If you want to download the stable CVS branch, add "-r nano_1_2_branch":
|
||||
|
||||
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout -r nano_1_2_branch nano
|
||||
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout -r nano_2_0_branch nano
|
||||
|
||||
|
||||
Generate the configure script
|
||||
@@ -80,7 +76,7 @@ Then, once it's done compiling, run
|
||||
|
||||
$ make install
|
||||
|
||||
which should copy various files (i.e, the nano executable, the info and
|
||||
which should copy various files (i.e. the nano executable, the info and
|
||||
man pages, and syntax highlighting pattern files) to their appropriate
|
||||
directories.
|
||||
|
||||
|
||||
20
TODO
20
TODO
@@ -2,21 +2,25 @@ TODO file (? means the feature may be implemented, but not definitely)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
For the next version:
|
||||
- Undo/Redo keys?
|
||||
- Undo/Redo keys (M-U and M-E)?
|
||||
- Rebindable keys?
|
||||
- FriBidi support?
|
||||
- Port to DJGPP?
|
||||
- Make matching bracket searches sophisticated enough to skip over
|
||||
brackets inside comments?
|
||||
- Allow indentation of marked text by spaces as well as tabs?
|
||||
- Allow indentation to add just enough columns to reach the nearest
|
||||
multiple of tabsize, rather than always adding tabsize columns?
|
||||
- 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)?
|
||||
- Rewrite the nano FAQ in SGML.
|
||||
- Allow conversion between different character sets. Maybe use glib's
|
||||
iconv() if the system's iconv() is inadequate, since we already use
|
||||
glib's vsnprintf() if the system lacks vsnprintf()?
|
||||
- Properly preserve the cursor position when going from the "Read File"
|
||||
or "Save File As" prompt to the file browser to the "Go To Directory"
|
||||
prompt, and then canceling back to the "Read File" or "Save File As"
|
||||
prompt.
|
||||
- Handle window resizes better. After we resize, we should stay
|
||||
wherever we were before we resized, as Pico does.
|
||||
- Fix problems with color syntaxes' highlighting lines too aggressively.
|
||||
- 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.
|
||||
@@ -27,8 +31,10 @@ For the next version:
|
||||
set via Ctrl-^) at various lines and/or columns in the buffer, and
|
||||
allow movement between them with a single keystroke.
|
||||
- Add the ability to move to different lines of the screen with a single
|
||||
keystroke, e.g. M-` to go to the top line, M-& to go to the center
|
||||
line, and M-' to go to the last line.
|
||||
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.
|
||||
- Allow searching for and replacing newlines.
|
||||
- Allow soft wrapping as well as hard wrapping?
|
||||
|
||||
Old requests:
|
||||
|
||||
|
||||
4
UPGRADE
4
UPGRADE
@@ -6,7 +6,7 @@ Visible changes since 1.2
|
||||
* Editor Features
|
||||
- Support for UTF-8.
|
||||
- Moving to a specified line and column of a file, instead of just a
|
||||
line (+LINE[,COLUMN]).
|
||||
line (+LINE,COLUMN).
|
||||
- Smart home key (-A).
|
||||
- Creation of unique backup files in a specified directory (-C <dir>).
|
||||
- Insertion of spaces instead of a tab when Tab is pressed (-E).
|
||||
@@ -28,7 +28,7 @@ Visible changes since 1.2
|
||||
- Meta-W now repeats the last search. Wrapping is now toggled via
|
||||
Meta-L.
|
||||
- Replacing and spell checking only selected text.
|
||||
- Indenting all marked lines with one keystroke.
|
||||
- Indenting lines with one keystroke.
|
||||
- Copying text into the cutbuffer without cutting it.
|
||||
- Scrolling the text up and down single lines without moving the
|
||||
cursor.
|
||||
|
||||
100
configure.ac
100
configure.ac
@@ -19,7 +19,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [1.3.12], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.0.3], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
@@ -39,7 +39,7 @@ dnl Internationalization macros.
|
||||
|
||||
AM_GNU_GETTEXT_VERSION(0.11.5)
|
||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
||||
AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
|
||||
AM_CONDITIONAL(USE_NLS, test x$USE_NLS = xyes)
|
||||
|
||||
dnl Data location.
|
||||
|
||||
@@ -56,18 +56,17 @@ dnl Checks for options.
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Enable debugging (disabled by default)],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
|
||||
debug_support=yes
|
||||
AC_DEFINE(DEBUG, 1, [Define this to enable debug messages and assert warnings.]) debug_support=yes
|
||||
fi])
|
||||
|
||||
if test x$debug_support != xyes; then
|
||||
AC_DEFINE(NDEBUG, 1, [Shut up the assert warnings :-)])
|
||||
AC_DEFINE(NDEBUG, 1, [Shut up assert warnings :-)])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(extra,
|
||||
[ --enable-extra Enable extra features, currently only easter eggs],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
|
||||
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable extra stuff.]) extra_support=yes
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(tiny,
|
||||
@@ -76,42 +75,42 @@ AC_ARG_ENABLE(tiny,
|
||||
AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable any and all text wrapping.])
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion functions for files and search strings.])
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(browser,
|
||||
[ --disable-browser Disable mini file browser],
|
||||
[ --disable-browser Disable built-in file browser],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(help,
|
||||
[ --disable-help Disable help function],
|
||||
[ --disable-help Disable help functions],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(justify,
|
||||
[ --disable-justify Disable justify/unjustify function],
|
||||
[ --disable-justify Disable justify/unjustify functions],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(mouse,
|
||||
[ --disable-mouse Disable mouse support (and -m flag)],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(operatingdir,
|
||||
[ --disable-operatingdir Disable setting of operating directory (chroot of sorts)],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(speller,
|
||||
@@ -121,28 +120,36 @@ AC_ARG_ENABLE(speller,
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(tabcomp,
|
||||
[ --disable-tabcomp Disable tab completion code for a smaller binary],
|
||||
[ --disable-tabcomp Disable tab completion functions],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion functions for files and search strings.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(wrapping,
|
||||
[ --disable-wrapping Disable all wrapping of text (and -w flag)],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable any and all text wrapping.])
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(wrapping-as-root,
|
||||
[ --disable-wrapping-as-root Disable wrapping of text as root by default],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_ROOTWRAP, 1, [Define this to disable wrapping as root by default.])
|
||||
AC_DEFINE(DISABLE_ROOTWRAPPING, 1, [Define this to disable text wrapping as root by default.])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(color,
|
||||
[ --enable-color Enable color and syntax highlighting],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
|
||||
if test x$ac_cv_header_regex_h = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** The header file regex.h was not found. If you wish to use color
|
||||
*** support this header file is required. Please either install C
|
||||
*** libraries that include the regex.h file or do not call the configure
|
||||
*** script with --enable-color.])
|
||||
fi
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(multibuffer,
|
||||
@@ -152,18 +159,18 @@ AC_ARG_ENABLE(multibuffer,
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(nanorc,
|
||||
[ --enable-nanorc Enable use of .nanorc file],
|
||||
[ --enable-nanorc Enable use of .nanorc files],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(all,
|
||||
[ --enable-all Enable ALL extra nano functionality (kitchen sink option)],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
|
||||
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
|
||||
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable extra stuff.]) extra_support=yes
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING([whether to enable UTF-8 support])
|
||||
@@ -203,12 +210,11 @@ AC_ARG_WITH(slang,
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLutf8_enable(TRUE);
|
||||
SLutf8_enable(1);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
@@ -230,12 +236,11 @@ int main(void)
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLutf8_enable(TRUE);
|
||||
SLutf8_enable(1);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
@@ -252,12 +257,11 @@ int main(void)
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLutf8_enable(TRUE);
|
||||
SLutf8_enable(1);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
@@ -270,11 +274,10 @@ int main(void)
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** install a version of slang that includes the slcurses.h file or
|
||||
*** do not call the configure script with --with-slang
|
||||
]))
|
||||
*** do not call the configure script with --with-slang.]))
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
@@ -295,8 +298,7 @@ int main(void)
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
else
|
||||
@@ -321,8 +323,7 @@ int main(void)
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
else
|
||||
@@ -342,8 +343,7 @@ int main(void)
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
else
|
||||
@@ -355,11 +355,10 @@ int main(void)
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** install a version of slang that includes the slcurses.h file or
|
||||
*** do not call the configure script with --with-slang
|
||||
]))
|
||||
*** do not call the configure script with --with-slang.]))
|
||||
fi
|
||||
|
||||
if test "${_libs+set}" = "set"; then
|
||||
@@ -372,7 +371,8 @@ int main(void)
|
||||
;;
|
||||
esac], [AC_MSG_RESULT(no)])
|
||||
|
||||
AM_CONDITIONAL(USE_COLOR, test "x$color_support" = "xyes")
|
||||
AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
|
||||
AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes)
|
||||
|
||||
dnl Checks for functions.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
SUBDIRS = man texinfo
|
||||
|
||||
if USE_COLOR
|
||||
SUBDIRS += syntax
|
||||
SUBDIRS = man syntax texinfo
|
||||
else
|
||||
SUBDIRS = man texinfo
|
||||
endif
|
||||
|
||||
EXTRA_DIST = faq.html nanorc.sample
|
||||
EXTRA_DIST = faq.html
|
||||
|
||||
71
doc/faq.html
71
doc/faq.html
@@ -25,7 +25,7 @@
|
||||
<a href="#3.2">3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</a><br>
|
||||
<a href="#3.3">3.3. Why does everything go into /usr/local?</a><br>
|
||||
<a href="#3.4">3.4. I get errors about 'bindtextdomain','gettext', and/or 'gettextdomain'. What can I do about it?</a><br>
|
||||
<a href="#3.5">3.5. Nano should automatically run strip on the binary when installing it!</a><br>
|
||||
<a href="#3.5">3.5. nano should automatically run strip on the binary when installing it!</a><br>
|
||||
<a href="#3.6">3.6. How can I make the executable smaller? This is too bloated!</a><br>
|
||||
<a href="#3.7">3.7. Tell me more about this multibuffer stuff!</a><br>
|
||||
<a href="#3.8">3.8. Tell me more about this verbatim input stuff!</a><br>
|
||||
@@ -36,15 +36,15 @@
|
||||
<a href="#4.3">4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</a><br>
|
||||
<a href="#4.4">4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</a><br>
|
||||
<a href="#4.5">4.5. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.6">4.6. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.7">4.7. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.6">4.6. nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.7">4.7. nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.8">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?</a><br>
|
||||
<a href="#4.9">4.9. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.10a">4.10a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
|
||||
<a href="#4.10b">4.10b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.11">4.11. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.12">4.12. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.13">4.13. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a></p></blockquote>
|
||||
<a href="#4.13">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?</a></p></blockquote>
|
||||
<h2><a href="#5">5. Internationalization</a></h2>
|
||||
<blockquote><p><a href="#5.1">5.1. There's no translation for my language!</a><br>
|
||||
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a><br>
|
||||
@@ -57,7 +57,7 @@
|
||||
<a href="#6.5">6.5. Why doesn't UW simply change their license?</a><br>
|
||||
<a href="#6.6">6.6. What if tomorrow UW changes the license to be truly Free Software?</a></p></blockquote>
|
||||
<h2><a href="#7">7. Miscellaneous</a></h2>
|
||||
<blockquote><p><a href="#7.1">7.1. Nano-related mailing lists.</a><br>
|
||||
<blockquote><p><a href="#7.1">7.1. nano-related mailing lists.</a><br>
|
||||
<a href="#7.2">7.2. I want to send the development team a big load of cash (or just a thank you).</a><br>
|
||||
<a href="#7.3">7.3. How do I submit a patch?</a><br>
|
||||
<a href="#7.4">7.4. How do I join the development team?</a><br>
|
||||
@@ -80,13 +80,13 @@
|
||||
<p><b>The event...</b></p>
|
||||
<p>It was in late 1999 when Chris Allegretta (our hero) was yet again complaining to himself about the less-than-perfect license Pico was distributed under, the 1000 makefiles that came with it and how just a few small improvements could make it the Best Editor in the World (TM). Having been a convert from Slackware to Debian, he missed having a simple binary package that included Pine and Pico, and had grown tired of downloading them himself.</p>
|
||||
<p>Finally something snapped inside and Chris coded and hacked like a madman for many hours straight one weekend to make a (barely usable) Pico clone, at the time called TIP (Tip Isn't Pico). The program could not be invoked without a filename, could not save files, had no help text display, spell checker, and so forth. But over time it improved, and with the help of a few great coders it matured to the (hopefully) stable state it is today.</p>
|
||||
<p>In February 2001, nano was declared an official GNU program by Richard Stallman. Nano also reached its first production release on March 22, 2001.</p></blockquote>
|
||||
<p>In February 2001, nano was declared an official GNU program by Richard Stallman. nano also reached its first production release on March 22, 2001.</p></blockquote>
|
||||
<h2><a name="1.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 version of nano *should* be 1.3.12. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano *should* be 2.0.3. Of course, you should always check the nano homepage 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/v1.3/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.0/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>
|
||||
@@ -136,17 +136,16 @@
|
||||
<p>to put nano into /usr/bin when you run <b>make install</b>.</p></blockquote>
|
||||
<h2><a name="3.4"></a>3.4. I get errors about 'bindtextdomain', 'gettext', and/or 'gettextdomain'. What can I do about it?</h2>
|
||||
<blockquote><p>Try doing a <b>./configure --with-included-gettext</b> and see if that solves your problem. You may need to do a <b>make clean; make</b> to get it to work fully.</p></blockquote>
|
||||
<h2><a name="3.5"></a>3.5. Nano should automatically run strip on the binary when installing it!</h2>
|
||||
<h2><a name="3.5"></a>3.5. nano should automatically run strip on the binary when installing it!</h2>
|
||||
<blockquote><p>Actually, it does, but you have to use <b>make install-strip</b>. The default make install does not, and will not, run strip automatically.</p></blockquote>
|
||||
<h2><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h2>
|
||||
<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-tabcomp</b> Disable tab completion code for a smaller
|
||||
binary
|
||||
<b>--disable-justify</b> Disable justify/unjustify function
|
||||
<b>--disable-speller</b> Disable spell checker function
|
||||
<b>--disable-help</b> Disable help function
|
||||
<b>--disable-browser</b> Disable mini file browser
|
||||
<b>--disable-tabcomp</b> Disable tab completion functions
|
||||
<b>--disable-justify</b> Disable justify/unjustify functions
|
||||
<b>--disable-speller</b> Disable spell checker functions
|
||||
<b>--disable-help</b> Disable help functions
|
||||
<b>--disable-browser</b> Disable built-in file browser
|
||||
<b>--disable-wrapping</b> Disable all wrapping of text (and -w flag)
|
||||
<b>--disable-mouse</b> Disable mouse support (and -m flag)
|
||||
<b>--disable-operatingdir</b> Disable setting of operating directory</pre>
|
||||
@@ -154,15 +153,15 @@
|
||||
<p>If, on the other hand, you can't live without bells and whistles, you could try:</p>
|
||||
<pre>
|
||||
<b>--enable-extra</b> Enable extra features, currently only easter eggs
|
||||
<b>--enable-nanorc</b> Enable use of .nanorc file
|
||||
<b>--enable-nanorc</b> Enable use of .nanorc files
|
||||
<b>--enable-color</b> Enable color and syntax highlighting
|
||||
<b>--enable-multibuffer</b> Enable having multiple file buffers open
|
||||
<b>--enable-all</b> Enable all of the above features
|
||||
<b>--disable-wrapping-as-root</b>
|
||||
Turn off wrapping of text by default when the
|
||||
user is root</pre></blockquote>
|
||||
Disable text wrapping by default when the user is
|
||||
root</pre></blockquote>
|
||||
<h2><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h2>
|
||||
<blockquote><p>To use multiple file buffers, you must be using nano 1.1.0 or newer, and you must have configured nano with <b>--enable-multibuffer</b> (use nano -V to check). Then when you want to enable inserting a file into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<blockquote><p>To use multiple file buffers, you must be using nano 1.1.0 or newer, and you must have configured nano with <b>--enable-multibuffer</b> (use nano -V to check). Then when you want to enable inserting a file into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<p>You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b> keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the normal "Exit" when only one buffer is open.</p></blockquote>
|
||||
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
|
||||
<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>
|
||||
@@ -172,23 +171,25 @@
|
||||
<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>
|
||||
<blockquote><p>If a command line option that begins with '+' is followed by another option, the former is always treated as a starting line number and the latter is always treated as a filename. If a command line option that begins with '+' isn't followed by another option, it's always treated as a filename. Examples:</p>
|
||||
<blockquote><p>If a command line option that begins with '+' is followed by another option, the former is always treated as a starting line and column number and the latter is always treated as a filename. If a command line option that begins with '+' isn't followed by another option, it's always treated as a filename. Examples:</p>
|
||||
<p>To open '+filename.txt' starting on line 1: <b>nano +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 10: <b>nano +10 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 1, column 20: <b>nano +,20 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 10, column 20: <b>nano +10,20 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 1 and 'filename.txt' starting on line 10 (if nano has been compiled with multibuffer support): <b>nano +1 +filename.txt +20 filename.txt</b></p></blockquote>
|
||||
<h2><a name="4.2"></a>4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</h2>
|
||||
<blockquote><p>Try setting your $TERM variable to 'vt100'. Nano doesn't yet support every term entry under the sun.</p>
|
||||
<blockquote><p>Try setting your $TERM variable to 'vt100'. nano doesn't yet support every term entry under the sun.</p>
|
||||
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
|
||||
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
|
||||
<h2><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h2>
|
||||
<blockquote><p>You can use the <b>-K</b> or <b>--rebindkeypad</b> options on the command line, or add the line <b>set rebindkeypad</b> to your .nanorc. However, nano's mouse support won't work properly if you do any of these things.</p></blockquote>
|
||||
<blockquote><p>You can use the <b>-K</b> or <b>--rebindkeypad</b> options on the command line, or add the line <b>set rebindkeypad</b> to your .nanorc. However, nano's mouse support won't work properly if you do any of these things.</p></blockquote>
|
||||
<h2><a name="4.4"></a>4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</h2>
|
||||
<blockquote><p>This is a bug in the terminal, not in nano. When a key is repeating faster than nano can process it, the keyboard buffer becomes full and starts dropping incoming keystrokes. Unfortunately, it doesn't just drop whole keystrokes; it can also drop parts of multibyte key combinations, resulting in nano's receiving a wrong key.</p></blockquote>
|
||||
<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>
|
||||
<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 to <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</p></blockquote>
|
||||
<h2><a name="4.7"></a>4.7. Nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<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 would be great, 0.9.12 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>
|
||||
@@ -197,7 +198,7 @@
|
||||
<h2><a name="4.10a"></a>4.10a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
|
||||
<blockquote><p>In nano version 0.9.20, the default is to have a completely consistent user interface across all user input functions. This means that regardless of whether you're being asked for a filename to insert or write, or a string to search for, the previous value is already inserted before the cursor. If you prefer the old behavior, use the Pico emulation mode (-p or --pico) or just hit Meta-P while in nano (see the ^G help text for more details).</p></blockquote>
|
||||
<h2><a name="4.10b"></a>4.10b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<blockquote><p>It was decided that consistency was nice, but people are used to Pico's inconsistent behavior. Also, in version 1.1.99pre1, search and replace history was introduced. If you wish to edit your previous search/replace entry (or any previous entry), you can do so by hitting the up arrow to cycle through your history. This method allows the best of both worlds: You don't need to erase the previous string if you want to enter a new one, but you can with one keystroke recall previous entries for editing. Therefore there is now no "Pico mode", nano is and has always been a Pico <b>clone</b>, and clones by default should be compatible.</p></blockquote>
|
||||
<blockquote><p>It was decided that consistency was nice, but people are used to Pico's inconsistent behavior. Also, in version 1.1.99pre1, search and replace history was introduced. If you wish to edit your previous search/replace entry (or any previous entry), you can do so by hitting the up arrow to cycle through your history. This method allows the best of both worlds: You don't need to erase the previous string if you want to enter a new one, but you can with one keystroke recall previous entries for editing. Therefore there is now no "Pico mode", nano is and has always been a Pico <b>clone</b>, and clones by default should be compatible.</p></blockquote>
|
||||
<h2><a name="4.11"></a>4.11. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
|
||||
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
|
||||
@@ -224,7 +225,7 @@
|
||||
<h2><a name="5.2"></a>5.2. I don't like the translation for <x> in my language. How can I fix it?</h2>
|
||||
<blockquote><p>The best way would probably be to e-mail the person listed in the <code>Last-Translator:</code> field in the <b><your_language>.po</b> file with your suggested corrections and they can make the changes reach the nano-devel list.</p></blockquote>
|
||||
<h2><a name="5.3"></a>5.3. What is the status of Unicode support?</h2>
|
||||
<blockquote><p>With the latest development version (1.3.12+), Unicode should be usable. With your terminal, locale (LC_ALL and similar environment variables), and encoding configured to properly support UTF-8, you should be able to enter and save Unicode text.</p></blockquote>
|
||||
<blockquote><p>In version 1.3.12 or later, Unicode should be usable. With your terminal, locale (LC_ALL and similar environment variables), and encoding configured to properly support UTF-8, you should be able to enter and save Unicode text.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="6"></a>6. Advocacy and Licensing</h1>
|
||||
<h2><a name="6.1"></a>6.1. Why should I use nano instead of Pico?</h2>
|
||||
@@ -238,16 +239,16 @@
|
||||
<h2><a name="6.5"></a>6.5. Why doesn't UW simply change their license?</h2>
|
||||
<blockquote><p>You're really not asking the right person here. I (Chris) waited a long time to see if UW would change their license because of the amount of high quality software being released and developed under the GPL without being taken advantage of by malicious corporate entities or other baddies, but no such luck so far.</p></blockquote>
|
||||
<h2><a name="6.6"></a>6.6. What if tomorrow UW changes the license to be truly Free Software?</h2>
|
||||
<blockquote><p>Honestly nothing would make me happier than to see that happen. Nano would continue to be developed independently until such time as Pico had all the features nano did or the projects merged. That just does not seem very likely given that there has been no sign of any changes in the past few years in a positive direction.</p></blockquote>
|
||||
<blockquote><p>Honestly nothing would make me happier than to see that happen. nano would continue to be developed independently until such time as Pico had all the features nano did or the projects merged. That just does not seem very likely given that there has been no sign of any changes in the past few years in a positive direction.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="7"></a>7. Miscellaneous</h1>
|
||||
<h2><a name="7.1"></a>7.1. Nano-related mailing lists.</h2>
|
||||
<blockquote><p>There are three mailing lists for nano hosted at <a href="http://savannah.gnu.org/">Savannah</a>, info-nano, help-nano and nano-devel. Info-nano is a very low traffic list where new versions of nano are announced (surprise!) Help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. Nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
|
||||
<h2><a name="7.1"></a>7.1. nano-related mailing lists.</h2>
|
||||
<blockquote><p>There are three mailing lists for nano hosted at <a href="http://savannah.gnu.org/">Savannah</a>, info-nano, help-nano and nano-devel. info-nano is a very low traffic list where new versions of nano are announced (surprise!). help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
|
||||
<p>info-nano - <a href="http://mail.gnu.org/mailman/listinfo/info-nano/">http://mail.gnu.org/mailman/listinfo/info-nano/</a><br>
|
||||
help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
|
||||
nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
|
||||
<h2><a name="7.2"></a>7.2. I want to send the development team a big load of cash (or just a thank you).</h2>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v1.3/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v1.3/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v2.0/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v2.0/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<h2><a name="7.3"></a>7.3. How do I submit a patch?</h2>
|
||||
<blockquote><p>See Section <a href="#7.2">7.2</a>.</p></blockquote>
|
||||
<h2><a name="7.4"></a>7.4. How do I join the development team?</h2>
|
||||
@@ -255,8 +256,12 @@
|
||||
<h2><a name="7.5"></a>7.5. Can I have CVS write access?</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>2006/06/12 - Update section 5.3, due to the display fix for two-column Unicode characters. (DLR)<br>
|
||||
<blockquote><p>2007/01/01 - Update section 4.1 to describe how to open files with names beginning with '+' at specified columns as well as lines. (DLR)<br>
|
||||
2006/11/25 - Add miscellaneous wording and capitalization fixes. (DLR)<br>
|
||||
2006/10/28 - Update various links for the 2.0 branch of nano. (DLR)<br>
|
||||
2006/10/06 - Update the question in section 4.13 to match the version of it in the answer section. (DLR)<br>
|
||||
2006/07/25 - Update section 5.3 again to not state "the latest development version" before 1.3.12, as it's no longer accurate. Also add some minor spacing fixes. (DLR)<br>
|
||||
2006/06/12 - Update section 5.3, due to the display fix for two-column Unicode characters. (DLR)<br>
|
||||
2006/06/05 - Add a new section 4.8, and move all section 4 entries after it down one number, to explain how to deal with glibc 2.2.3's crashes involving extended regular expressions. (DLR)<br>
|
||||
2006/06/04 - Add minor punctuation, wording, and typo fixes. (DLR)<br>
|
||||
2006/05/27 - Update section 3.8 to mention the new "Unicode Input" prompt, and how Unicode input only works when Unicode support is enabled. (DLR)<br>
|
||||
@@ -280,7 +285,7 @@
|
||||
2004/11/05 - Fixed inaccuracy: Pico compatibility mode was made the default in nano 1.1.99pre1, not 1.2.2. Also added question about how to type F13-F16 on terminals lacking keys past F12 (suggested by Chris), question about how to select text for the clipboard in X terminals with nano's mouse support turned on (answer found by Joseph Birthisel), and misc. fixes and link updates. (DLR)<br>
|
||||
2004/04/07 - Removed NumLock glitch question, as it's no longer needed. (DLR)<br>
|
||||
2004/01/30 - Fixed inaccuracy: multibuffer mode was first in nano 1.1.0, not 1.1.12. (DLR)<br>
|
||||
2003/12/31 - Added question about the new verbatim input function, and a few minor fixes. Removed reference to "set pico" (DLR).<br>
|
||||
2003/12/31 - Added question about the new verbatim input function, and a few minor fixes. Removed reference to "set pico" (DLR).<br>
|
||||
2003/07/02 - Added question about nano's not showing color when it's compiled with color support (DLR; suggested by Jordi).<br>
|
||||
2003/02/23 - Updated RPM links for nano 1.2.x (DLR).<br>
|
||||
2003/01/16 - Split section 4.5 into 4.5a and 4.5b for search string behavior. Added --enable-all docs.<br>
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
SUBDIRS =
|
||||
|
||||
if USE_NLS
|
||||
SUBDIRS += fr
|
||||
SUBDIRS = fr
|
||||
else
|
||||
SUBDIRS =
|
||||
endif
|
||||
|
||||
if USE_NANORC
|
||||
man_MANS = nano.1 nanorc.5 rnano.1
|
||||
|
||||
BUILT_SOURCES = nano.1.html nanorc.5.html rnano.1.html
|
||||
else
|
||||
man_MANS = nano.1 rnano.1
|
||||
BUILT_SOURCES = nano.1.html rnano.1.html
|
||||
endif
|
||||
|
||||
nano_man_mans = nano.1 nanorc.5 rnano.1
|
||||
nano_built_sources = nano.1.html nanorc.5.html rnano.1.html
|
||||
|
||||
nano.1.html: nano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
nanorc.5.html: nanorc.5
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
rnano.1.html: rnano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(BUILT_SOURCES)
|
||||
EXTRA_DIST = $(nano_man_mans) $(nano_built_sources)
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
man_MANS = nano.1 nanorc.5 rnano.1
|
||||
|
||||
mandir = @mandir@/fr
|
||||
|
||||
if USE_NANORC
|
||||
man_MANS = nano.1 nanorc.5 rnano.1
|
||||
BUILT_SOURCES = nano.1.html nanorc.5.html rnano.1.html
|
||||
else
|
||||
man_MANS = nano.1 rnano.1
|
||||
BUILT_SOURCES = nano.1.html rnano.1.html
|
||||
endif
|
||||
|
||||
nano_man_mans = nano.1 nanorc.5 rnano.1
|
||||
nano_built_sources = nano.1.html nanorc.5.html rnano.1.html
|
||||
|
||||
nano.1.html: nano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
nanorc.5.html: nanorc.5
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
rnano.1.html: rnano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(BUILT_SOURCES)
|
||||
EXTRA_DIST = $(nano_man_mans) $(nano_built_sources)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
.\" 2006 by Chris Allegretta <chrisa@asty.org>
|
||||
.\"
|
||||
.\" Adaptation française (c) 2003-2006 par
|
||||
.\" Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>.
|
||||
.\" Jean-Philippe Guérard <jean-philippe.guerard@tigreraye.org>.
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU
|
||||
.\" General Public License for copying conditions. There is NO
|
||||
@@ -15,7 +15,7 @@
|
||||
.\" AUCUNE garantie.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.12" "17\ juin\ 2006"
|
||||
.TH NANO 1 "version 2.0.0" "28\ octobre\ 2006"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\"
|
||||
@@ -25,7 +25,7 @@ nano \- NAno un NOuvel
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [OPTIONS]\ [[\+LIGNE[,COLONNE]]\ FICHIER]...
|
||||
.I [OPTIONS]\ [[\+LIGNE,COLONNE]\ FICHIER]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -39,14 +39,15 @@ Pico, l'
|
||||
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 à un
|
||||
numéro de ligne.
|
||||
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]
|
||||
.B \+\fILIGNE\fP,\fICOLONNE\fP
|
||||
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
|
||||
la ligne \fILIGNE\fR au lieu de démarrer à la colonne\ 1, ligne\ 1.
|
||||
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.
|
||||
@@ -256,7 +257,7 @@ Pour vous abonner, envoyez un courrier
|
||||
|
||||
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@corbeaunoir.org\fR.
|
||||
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
|
||||
|
||||
.SH "SITE INTERNET"
|
||||
http://www.nano-editor.org/
|
||||
@@ -271,15 +272,14 @@ http://www.nano-editor.org/
|
||||
.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@sindominio.net> pour le système GNU 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é par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@corbeaunoir.org> le 17\ juin\ 2006 à partir
|
||||
de la version du 8\ juin\ 2006 de la page de manuel de nano 1.3.12.
|
||||
Cette page a été relue par Gérard Delafond.
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 28\ octobre\ 2006 à partir
|
||||
de la version du 28\ octobre\ 2006 de la page de manuel de nano
|
||||
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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.\" nanorc.5 is Copyright (C) 2003, 2004, 2005, 2006 by the Free
|
||||
.\" Software Foundation, Inc.
|
||||
.\"
|
||||
.\" (c) 2003-2006 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" (c) 2003-2006 Jean-Philippe Guérard <jean-philippe.guerard@tigreraye.org>
|
||||
.\" pour l'adaptation française.
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU
|
||||
@@ -15,7 +15,7 @@
|
||||
.\" AUCUNE garantie.
|
||||
.\"
|
||||
\" $Id$
|
||||
.TH NANORC 5 "version 1.3.12" "17\ juin\ 2006"
|
||||
.TH NANORC 5 "version 2.0.0" "28\ octobre\ 2006"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
|
||||
@@ -32,7 +32,7 @@ remplacer Pico, l'
|
||||
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 à un numéro de ligne.
|
||||
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
|
||||
@@ -321,13 +321,14 @@ votre syst
|
||||
.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é rédigée par Jordi Mallach <jordi@gnu.org>.
|
||||
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é par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@corbeaunoir.org> le 17\ juin\ 2006 à partir de
|
||||
la version du 24\ mai\ 2006 de la page de manuel de nanorc (pour la
|
||||
version 1.3.12 de nano). Cette page a été relue par Gérard
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 28\ octobre\ 2006 à partir de
|
||||
la version du 28\ octobre\ 2006 de la page de manuel de nanorc (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
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" rnano.1 is Copyright 2005, 2006 by Thijs Kinkhorst
|
||||
.\" rnano.1 is Copyright (C) 2005, 2006 by Thijs Kinkhorst
|
||||
.\" <thijs@kinkhorst.com>; skeleton based on nano-tiny.1 by Jordi
|
||||
.\" Mallach <jordi@debian.org>.
|
||||
.\" Mallach <jordi@gnu.org>.
|
||||
.\"
|
||||
.\" Adaptation française (c) 2006 par
|
||||
.\" Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>.
|
||||
.\" Jean-Philippe Guérard <jean-philippe.guerard@tigreraye.org>.
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU
|
||||
.\" General Public License for copying conditions. There is NO
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" AUCUNE garantie.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH RNANO 1 "version 1.3.12" "17\ juin\ 20O6"
|
||||
.TH RNANO 1 "version 2.0.0" "28\ octobre\ 20O6"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\"
|
||||
@@ -26,7 +26,7 @@ am
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B rnano
|
||||
.I [OPTIONS]\ [[\+LIGNE[,COLONNE]]\ FICHIER]...
|
||||
.I [OPTIONS]\ [[\+LIGNE,COLONNE]\ FICHIER]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -41,7 +41,7 @@ remplacer Pico, l'
|
||||
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 à un numéro de ligne.
|
||||
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
|
||||
@@ -64,9 +64,10 @@ l'utilisation de copies de s
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILIGNE\fP[,\fICOLONNE\fP]
|
||||
.B \+\fILIGNE\fP,\fICOLONNE\fP
|
||||
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
|
||||
la ligne \fILIGNE\fR au lieu de démarrer à la colonne\ 1, ligne\ 1.
|
||||
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.
|
||||
@@ -92,7 +93,7 @@ Pour vous abonner, envoyez un courrier
|
||||
|
||||
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@corbeaunoir.org\fR.
|
||||
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
|
||||
|
||||
.SH "SITE INTERNET"
|
||||
http://www.nano-editor.org/
|
||||
@@ -104,10 +105,10 @@ Thijs Kinkhorst <thijs@kinkhorst.com>, pour le syst
|
||||
elle peut être utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Cette adaptation française a été réalisé par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@corbeaunoir.org> le 17\ juin\ 2006 à partir
|
||||
de la version du 1er\ mai\ 2006 de la page de manuel de rnano
|
||||
(pour la version 1.3.12 de nano).
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 28\ octobre\ 2006 à partir
|
||||
de la version du 28\ octobre\ 2006 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
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
.\" warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.12" "June 7, 2006"
|
||||
.TH NANO 1 "version 2.0.0" "October 28, 2006"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -16,7 +16,7 @@ nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [OPTIONS]\ [[\+LINE[,COLUMN]]\ FILE]...
|
||||
.I [OPTIONS]\ [[\+LINE,COLUMN]\ FILE]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -29,13 +29,14 @@ This manual page briefly documents the \fBnano\fP command.
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just 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 number".
|
||||
replace" and "go to line and column number".
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILINE\fP[,\fICOLUMN\fP]
|
||||
.B \+\fILINE\fP,\fICOLUMN\fP
|
||||
Places cursor at line number \fILINE\fP and column number \fICOLUMN\fP
|
||||
on startup, instead of the default of line 1, column 1.
|
||||
(at least one of which must be specified) on startup, instead of the
|
||||
default of line 1, column 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Same as \fB-h (\-\-help)\fP.
|
||||
@@ -229,5 +230,5 @@ http://www.nano-editor.org/
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see \fIAUTHORS\fP and
|
||||
\fITHANKS\fP for details). This manual page was originally written by
|
||||
Jordi Mallach <jordi@sindominio.net>, for the Debian GNU system (but may
|
||||
be used by others).
|
||||
Jordi Mallach <jordi@gnu.org>, for the Debian system (but may be used by
|
||||
others).
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
.\" warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 1.3.12" "May 24, 2006"
|
||||
.TH NANORC 5 "version 2.0.0" "October 28, 2006"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -19,7 +19,7 @@ This manual page briefly documents GNU \fBnano\fP's rcfile.
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just 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 number".
|
||||
replace" and "go to line and column number".
|
||||
.PP
|
||||
The \fInanorc\fP file contains the default settings for \fBnano\fP. It
|
||||
should not be in DOS or Mac format. During startup, \fBnano\fP will
|
||||
@@ -92,7 +92,7 @@ come before the latter set, and both must be in the same order. The
|
||||
default value is "\fI(<[{)>]}\fP".
|
||||
.TP
|
||||
.B set/unset morespace
|
||||
Allow use of the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
.B set/unset mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
@@ -194,7 +194,7 @@ spaces. They must be single-column characters.
|
||||
.TP
|
||||
.B set/unset wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
characters as parts of words.
|
||||
.TP
|
||||
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
|
||||
Defines a syntax named \fIstr\fP which can be activated via the
|
||||
@@ -254,5 +254,6 @@ Per-user configuration file
|
||||
system)
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see \fIAUTHORS\fP and
|
||||
\fITHANKS\fP for details). This manual page was written by Jordi
|
||||
Mallach <jordi@gnu.org>.
|
||||
\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).
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" rnano.1 is Copyright 2005, 2006 by Thijs Kinkhorst
|
||||
.\" rnano.1 is Copyright (C) 2005, 2006 by Thijs Kinkhorst
|
||||
.\" <thijs@kinkhorst.com>; skeleton based on nano-tiny.1 by Jordi
|
||||
.\" Mallach <jordi@debian.org>.
|
||||
.\" Mallach <jordi@gnu.org>.
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU
|
||||
.\" General Public License for copying conditions. There is NO
|
||||
.\" warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH RNANO 1 "version 1.3.12" "May 1, 2006"
|
||||
.TH RNANO 1 "version 2.0.0" "October 28, 2006"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -17,7 +17,7 @@ Pico clone
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B rnano
|
||||
.I [OPTIONS]\ [[\+LINE[,COLUMN]]\ FILE]...
|
||||
.I [OPTIONS]\ [[\+LINE,COLUMN]\ FILE]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -30,7 +30,7 @@ This manual page briefly documents the \fBrnano\fP command.
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just 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 number".
|
||||
replace" and "go to line and column number".
|
||||
.PP
|
||||
\fBrnano\fP is a restricted version of \fBnano\fP, which only edits
|
||||
specific files and doesn't allow the user access to the filesystem or a
|
||||
@@ -51,9 +51,10 @@ use backup files or spell checking.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILINE\fP[,\fICOLUMN\fP]
|
||||
.B \+\fILINE\fP,\fICOLUMN\fP
|
||||
Places cursor at line number \fILINE\fP and column number \fICOLUMN\fP
|
||||
on startup, instead of the default of line 1, column 1.
|
||||
(at least one of which must be specified) on startup, instead of the
|
||||
default of line 1, column 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Same as \fB-h (\-\-help)\fP.
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
## Save automatically on exit, don't prompt.
|
||||
# set tempfile
|
||||
|
||||
## Disallow file modification; why would you want this in an rcfile? ;)
|
||||
## Disallow file modification. Why would you want this in an rcfile? ;)
|
||||
# set view
|
||||
|
||||
## The two single-column characters used to display the first characters
|
||||
@@ -167,7 +167,7 @@
|
||||
# set whitespace " "
|
||||
|
||||
## Detect word boundaries more accurately by treating punctuation
|
||||
## characters as part of a word.
|
||||
## characters as parts of words.
|
||||
# set wordbounds
|
||||
|
||||
|
||||
@@ -255,3 +255,6 @@
|
||||
|
||||
## Bourne shell scripts
|
||||
# include "@PKGDATADIR@/sh.nanorc"
|
||||
|
||||
## POV-Ray
|
||||
# include "@PKGDATADIR@/pov.nanorc"
|
||||
|
||||
@@ -8,6 +8,7 @@ pkgdata_DATA = asm.nanorc \
|
||||
nanorc.nanorc \
|
||||
patch.nanorc \
|
||||
perl.nanorc \
|
||||
pov.nanorc \
|
||||
python.nanorc \
|
||||
ruby.nanorc \
|
||||
sh.nanorc \
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
## Here is an example for C/C++.
|
||||
##
|
||||
syntax "c" "\.(c|C|cc|cpp|cxx|h|H|hh|hpp|hxx)$"
|
||||
syntax "c" "\.(c(c|pp|xx)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$"
|
||||
color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
||||
color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
|
||||
color green "\<(u_?)?int(8|16|32|64|ptr)_t\>"
|
||||
color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
|
||||
color green "\<((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\>"
|
||||
color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
|
||||
color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
|
||||
color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||
color magenta "\<(goto|continue|break|return)\>"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||
color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
|
||||
##
|
||||
## GCC builtins
|
||||
|
||||
15
doc/syntax/pov.nanorc
Normal file
15
doc/syntax/pov.nanorc
Normal file
@@ -0,0 +1,15 @@
|
||||
## Here is an example for POV-Ray.
|
||||
##
|
||||
syntax "pov" "\.(pov|POV|povray|POVRAY)$"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(declare)"
|
||||
color brightyellow "\<(sphere|cylinder|translate|matrix|rotate|scale)\>"
|
||||
color brightyellow "\<(orthographic|location|up|right|direction|clipped_by)\>"
|
||||
color brightyellow "\<(fog_type|fog_offset|fog_alt|rgb|distance|transform)\>"
|
||||
color brightred "^\<(texture)\>"
|
||||
color brightred "\<(light_source|background)\>"
|
||||
color brightred "\<(fog|object|camera)\>"
|
||||
color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
|
||||
color brightmagenta "\<(union|group|subgroup)\>"
|
||||
## Comment highlighting
|
||||
color brightblue "//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
@@ -3,6 +3,7 @@
|
||||
syntax "python" "\.py$"
|
||||
icolor brightblue "def [0-9A-Z_]+"
|
||||
color brightcyan "\<(and|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|while)\>"
|
||||
color brightgreen "["'].*[^\\]["']" "["']{3}.*[^\\]["']{3}"
|
||||
color brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
|
||||
color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
|
||||
color brightgreen start=""""[^"]" end=""""" start="'''[^']" end="'''"
|
||||
color brightred "#.*$"
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
## Here is an example for Ruby.
|
||||
##
|
||||
syntax "ruby" "\.rb$"
|
||||
## 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)\>"
|
||||
## Constants
|
||||
color brightblue "(\$|@|@@)?[A-Z]+[0-9A-Z_a-z]*"
|
||||
color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
|
||||
## Ruby "symbols"
|
||||
icolor magenta "([ ]|^):[0-9A-Z_]+\>"
|
||||
## Some unique things we want to stand out
|
||||
|
||||
@@ -5,6 +5,6 @@ MAKEINFO = makeinfo --no-split
|
||||
BUILT_SOURCES = nano.html
|
||||
|
||||
nano.html: nano.texi
|
||||
cat $< | makeinfo --no-split --html > $@
|
||||
makeinfo --no-split --html < $< > $@
|
||||
|
||||
EXTRA_DIST = $(info_TEXINFOS) $(BUILT_SOURCES)
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
@c Run 'makeinfo' rather than 'texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.3.12
|
||||
@set UPDATED 20 Jun 2006
|
||||
@set VERSION 2.0.0
|
||||
@set UPDATED 27 Oct 2006
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.3.12
|
||||
@subtitle version 2.0.0
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -34,7 +34,7 @@ editor.
|
||||
This manual is part of the GNU @code{nano} distribution.@*
|
||||
@sp4
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by Chris
|
||||
Allegretta.
|
||||
Allegretta
|
||||
|
||||
This is free documentation, see the latest version of the GNU General
|
||||
Public License for copying conditions. There is NO warranty.
|
||||
@@ -64,8 +64,9 @@ editor.
|
||||
|
||||
GNU @code{nano} is a small and friendly text editor. Besides basic text
|
||||
editing, @code{nano} offers many extra features like an interactive
|
||||
search and replace, go to line number, auto-indentation, feature
|
||||
toggles, internationalization support, and filename tab completion.
|
||||
search and replace, go to line and column number, auto-indentation,
|
||||
feature toggles, internationalization support, and filename tab
|
||||
completion.
|
||||
|
||||
@menu
|
||||
* Overview::
|
||||
@@ -94,6 +95,8 @@ adding it with a comma. So the complete synopsis is:
|
||||
@quotation
|
||||
@code{nano [OPTION]@dots{} [[+LINE] FILE]@dots{}}
|
||||
|
||||
@code{nano [OPTION]@dots{} [[+,COLUMN] FILE]@dots{}}
|
||||
|
||||
@code{nano [OPTION]@dots{} [[+LINE,COLUMN] FILE]@dots{}}
|
||||
@end quotation
|
||||
|
||||
@@ -105,9 +108,9 @@ Email bug reports to @email{nano@@nano-editor.org}.
|
||||
@code{nano} takes the following options from the command line:
|
||||
|
||||
@table @code
|
||||
@item +LINE[,COLUMN]
|
||||
Start at line number LINE and column number COLUMN instead of the
|
||||
default of line 1, column 1.
|
||||
@item +LINE,COLUMN
|
||||
Start at line number LINE and column number COLUMN (at least one of
|
||||
which must be specified) instead of the default of line 1, column 1.
|
||||
|
||||
@item -?
|
||||
Same as @code{-h, --help}.
|
||||
@@ -155,6 +158,9 @@ Don't add newlines to the ends of files.
|
||||
@item -N, --noconvert
|
||||
Don't convert files from DOS/Mac format.
|
||||
|
||||
@item -O, --morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
|
||||
@item -Q <str>, --quotestr=<str>
|
||||
Set the quoting string for justifying. The default value is
|
||||
|
||||
@@ -189,7 +195,7 @@ Show the current version number and exit.
|
||||
|
||||
@item -W, --wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
characters as parts of words.
|
||||
|
||||
@item -Y <str>, --syntax=<str>
|
||||
Specify a specific syntax highlighting from the nanorc to use, if
|
||||
@@ -520,7 +526,7 @@ default value is
|
||||
@end quotation
|
||||
|
||||
@item set/unset morespace
|
||||
Allow use of the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
|
||||
@item set/unset mouse
|
||||
Enable mouse support, so that mouse clicks can be used to place the
|
||||
@@ -726,7 +732,7 @@ position of the cursor.
|
||||
|
||||
@item Interactive Replace and Spell Checker
|
||||
It is worth noting that @code{nano}'s replace function is interactive,
|
||||
i.e, it does not stop after one search string is found and automatically
|
||||
i.e. it does not stop after one search string is found and automatically
|
||||
replace it. The @code{nano} implementation will pause at each search
|
||||
string found and query whether to replace this instance or not. The
|
||||
internal spell checker operates similarly. Note that there is no way to
|
||||
@@ -787,8 +793,8 @@ line option, which enables long line wrapping.
|
||||
|
||||
@item --enable-tiny
|
||||
This option disables all the above. It also disables some of the larger
|
||||
internals of the editor, like the marking code and the cut to line code.
|
||||
It also disables the function toggles.
|
||||
internals of the editor, like the marking code and the cut to end of
|
||||
line code. It also disables the function toggles.
|
||||
|
||||
@item --enable-debug
|
||||
Enable support for runtime debug output. This can get pretty messy, so
|
||||
|
||||
@@ -13,9 +13,9 @@ dnl
|
||||
dnl @category Misc
|
||||
dnl @author Stepan Kasal <kasal@ucw.cz>
|
||||
dnl @author Andreas Schwab <schwab@suse.de>
|
||||
dnl @author Guido Draheim <guidod@gmx.de>
|
||||
dnl @author Guido U. Draheim <guidod@gmx.de>
|
||||
dnl @author Alexandre Oliva
|
||||
dnl @version 2005-07-29
|
||||
dnl @version 2006-10-13
|
||||
dnl @license AllPermissive
|
||||
|
||||
AC_DEFUN([AC_DEFINE_DIR], [
|
||||
|
||||
@@ -19,6 +19,9 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run
|
||||
gmodule)
|
||||
pkg_config_args="$pkg_config_args gmodule-2.0"
|
||||
;;
|
||||
gmodule-no-export)
|
||||
pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
|
||||
;;
|
||||
gobject)
|
||||
pkg_config_args="$pkg_config_args gobject-2.0"
|
||||
;;
|
||||
|
||||
40
nano.spec.in
40
nano.spec.in
@@ -1,45 +1,39 @@
|
||||
%define name @PACKAGE@
|
||||
%define ver @VERSION@
|
||||
%define rel 1
|
||||
%define version @VERSION@
|
||||
%define release 1
|
||||
|
||||
Summary : Pico editor clone with enhancements
|
||||
Name : %{name}
|
||||
Version : %{ver}
|
||||
Release : %{rel}
|
||||
Copyright : GPL
|
||||
Group : Console/Editors
|
||||
Version : %{version}
|
||||
Release : %{release}
|
||||
License : GPL
|
||||
Group : Applications/Editors
|
||||
URL : http://www.nano-editor.org/
|
||||
Source : http://www.nano-editor.org/dist/v1.3/%{name}-%{ver}.tar.gz
|
||||
BuildRoot : /var/tmp/%{name}-buildroot
|
||||
Requires : ncurses
|
||||
Source : http://www.nano-editor.org/dist/v2.0/%{name}-%{version}.tar.gz
|
||||
BuildRoot : %{_tmppath}/%{name}-%{version}-root
|
||||
BuildRequires : autoconf, automake, gettext-devel, ncurses-devel
|
||||
|
||||
%description
|
||||
GNU nano is a small and friendly text editor. It aims to emulate the Pico
|
||||
text editor while also offering a few enhancements.
|
||||
GNU nano is a small and friendly text editor. It aims to emulate the
|
||||
Pico text editor while also offering a few enhancements.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%configure --enable-all
|
||||
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf "$RPM_BUILD_ROOT"
|
||||
make DESTDIR="$RPM_BUILD_ROOT" install
|
||||
rm -rf %{buildroot}
|
||||
make DESTDIR="%{buildroot}" install
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README THANKS TODO doc/faq.html doc/nanorc.sample
|
||||
%{_bindir}/*
|
||||
%{_mandir}/*/*
|
||||
%{_mandir}/man*/*
|
||||
%{_mandir}/fr/man*/*
|
||||
%{_infodir}/nano.info*
|
||||
%{_datadir}/locale/*/LC_MESSAGES/nano.mo
|
||||
%{_datadir}/nano/*
|
||||
%{_infodir}/nano.info*
|
||||
|
||||
%changelog
|
||||
* Sat Mar 30 2002 Chris Allegretta <chrisa@asty.org>
|
||||
- Accepted into main distribution
|
||||
- Added Packager and URL tage from original spec file.
|
||||
* Tue Mar 06 2002 Brett Pemberton <generica@email.com>
|
||||
- Initial spec-file
|
||||
|
||||
129
po/ChangeLog
129
po/ChangeLog
@@ -1,3 +1,120 @@
|
||||
2007-01-29 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* ru.po: Updated Russian translation by Dimitriy Ryazantcev.
|
||||
* ru.po: Fix incorrect "Project-Id-Version" entry and misplaced
|
||||
space.
|
||||
|
||||
2007-01-13 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* es.po: Fix misplaced space.
|
||||
* eu.po: Fix typos and misplaced space.
|
||||
* fr.po: Fix misplaced space.
|
||||
* gl.po: Fix typos and misplaced space.
|
||||
* nb.po: Fix typos and more misplaced space.
|
||||
|
||||
2007-01-06 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* nb.po: Fix misplaced space.
|
||||
|
||||
2006-12-06 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* hu.po: Removed unneeded duplicate plural forms again.
|
||||
* ms.po: Fix incorrect "Project-Id-Version" entry.
|
||||
|
||||
2006-12-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* hu.po: Updated Hungarian translation by Gabor Kelemen.
|
||||
* ms.po: Updated Malay translation by
|
||||
Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2006-11-20 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* tr.po: Removed unneeded blank plural forms, as gettext 0.15
|
||||
generates errors upon encountering them.
|
||||
|
||||
2006-10-25 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* nb.po: Updated Norwegian bokmål translation by
|
||||
Geir Helland.
|
||||
|
||||
2006-10-16 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* gl.po: Updated Galician translation by
|
||||
Francisco Javier Tsao Santín.
|
||||
|
||||
2006-10-16 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* eu.po: Updated Basque translation by Mikel Olasagasti.
|
||||
|
||||
2006-10-10 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* gl.po: Updated Galician translation by
|
||||
Francisco Javier Tsao Santín.
|
||||
|
||||
2006-10-02 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* pt_BR.po: Refetch the current nano 1.9.99pre0 pt_BR file from
|
||||
the TP, as the latest file offered is apparently for 1.3.11pre1.
|
||||
|
||||
2006-10-02 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* pt_BR.po: Restore previous version of pt_BR, as it was for
|
||||
nano 1.9.99pre0, and the current version is for 1.3.11pre1.
|
||||
|
||||
2006-09-27 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* pt_BR.po: Updated Brazilian Portuguese translation by
|
||||
Joao Victor Duarte Martins.
|
||||
|
||||
2006-09-10 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* hu.po: Removed unneeded duplicate plural forms again.
|
||||
|
||||
2006-09-10 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* hu.po: Updated Hungarian translation by Gabor Kelemen.
|
||||
|
||||
2006-09-02 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* pt_BR.po: Updated Brazilian Portuguese translation by
|
||||
Joao Victor Duarte Martins.
|
||||
|
||||
2006-09-01 Benno Schulenberg <bensberg@justemail.net>
|
||||
|
||||
* ChangeLog: Fix incorrect years in two entries.
|
||||
|
||||
2006-08-31 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* bg.po: Fix misplaced space.
|
||||
|
||||
2006-08-31 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* de.po: Updated German translation by Michael Piefel.
|
||||
* es.po: Updated Spanish translation by
|
||||
Ricardo Javier Cardenes Medina.
|
||||
|
||||
2006-08-28 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
|
||||
2006-08-25 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* bg.po: Updated Bulgarian translation by Anton Zinoviev.
|
||||
* ca.po: Updated Catalan translation.
|
||||
* ga.po: Updated Irish translation by Kevin Patrick Scannell.
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* nl.po: Updated Dutch translation by Benno Schulenberg.
|
||||
* sv.po: Updated Swedish translation by Daniel Nylander.
|
||||
|
||||
2006-08-15 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* hu.po: Removed unneeded duplicate plural forms, as gettext
|
||||
0.15 generates errors upon encountering them.
|
||||
* id.po: Removed unneeded duplicate plural forms, as gettext
|
||||
0.15 generates errors upon encountering them.
|
||||
|
||||
2006-06-20 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
@@ -7,9 +124,9 @@
|
||||
|
||||
2006-06-20 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* fr.po: Fixed incorrect "Project-Id-Version" entry.
|
||||
* hu.po: Fixed incorrect "Project-Id-Version" entry.
|
||||
* it.po: Fixed incorrect "Project-Id-Version" entry.
|
||||
* fr.po: Fix incorrect "Project-Id-Version" entry.
|
||||
* hu.po: Fix incorrect "Project-Id-Version" entry.
|
||||
* it.po: Fix incorrect "Project-Id-Version" entry.
|
||||
|
||||
2006-06-19 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
@@ -83,7 +200,7 @@
|
||||
|
||||
* POTFILES.in: Add help.c.
|
||||
|
||||
2006-10-23 Jordi Mallach <jordi@gnu.org>
|
||||
2005-10-23 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* eu.po: Updated Basque translation by Mikel Olasagasti.
|
||||
@@ -94,7 +211,7 @@
|
||||
* zh_TW: Updated Traditional Chinese translation by
|
||||
Wei-Lun Chao.
|
||||
|
||||
2006-08-22 Jordi Mallach <jordi@gnu.org>
|
||||
2005-08-22 Jordi Mallach <jordi@gnu.org>
|
||||
* bg.po: New Bulgarian translation by
|
||||
Yavor Doganov <yavor@doganov.org>.
|
||||
|
||||
@@ -153,7 +270,7 @@
|
||||
|
||||
2005-04-22 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Norwegian bokmål translation by
|
||||
* nb.po: Updated Norwegian bokmål translation by
|
||||
Geir Helland.
|
||||
|
||||
2005-04-20 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
2409
po/pt_BR.po
2409
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1943
po/zh_TW.po
1943
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
514
src/browser.c
514
src/browser.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* browser.c *
|
||||
* *
|
||||
* Copyright (C) 2001-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -31,11 +31,11 @@
|
||||
#ifndef DISABLE_BROWSER
|
||||
|
||||
static char **filelist = NULL;
|
||||
/* The list of files to display in the browser. */
|
||||
/* The list of files to display in the file browser. */
|
||||
static size_t filelist_len = 0;
|
||||
/* The number of files in the list. */
|
||||
static int width = 0;
|
||||
/* The number of columns to display the list in. */
|
||||
/* The number of files that we can display per line. */
|
||||
static int longest = 0;
|
||||
/* The number of columns in the longest filename in the list. */
|
||||
static size_t selected = 0;
|
||||
@@ -44,16 +44,22 @@ static size_t selected = 0;
|
||||
static bool search_last_file = FALSE;
|
||||
/* Have we gone past the last file while searching? */
|
||||
|
||||
/* Our browser function. path is the tilde-expanded path to start
|
||||
* browsing from. */
|
||||
/* Our main file browser function. path is the tilde-expanded path we
|
||||
* start browsing from. */
|
||||
char *do_browser(char *path, DIR *dir)
|
||||
{
|
||||
int kbinput;
|
||||
bool meta_key, func_key;
|
||||
bool old_const_update = ISSET(CONST_UPDATE);
|
||||
char *ans = mallocstrcpy(NULL, "");
|
||||
/* The last answer the user typed on the statusbar. */
|
||||
char *retval = NULL;
|
||||
int kbinput;
|
||||
bool meta_key, func_key, old_const_update = ISSET(CONST_UPDATE);
|
||||
bool abort = FALSE;
|
||||
/* Whether we should abort the file browser. */
|
||||
char *prev_dir = NULL;
|
||||
/* The directory we were in, if any, before backing up via
|
||||
* browsing to "..". */
|
||||
char *ans = NULL;
|
||||
/* The last answer the user typed at the statusbar prompt. */
|
||||
size_t old_selected;
|
||||
/* The selected file we had before the current selected file. */
|
||||
|
||||
curs_set(0);
|
||||
blank_statusbar();
|
||||
@@ -65,86 +71,99 @@ char *do_browser(char *path, DIR *dir)
|
||||
|
||||
UNSET(CONST_UPDATE);
|
||||
|
||||
change_browser_directory:
|
||||
/* We go here after the user selects a new directory. */
|
||||
ans = mallocstrcpy(NULL, "");
|
||||
|
||||
change_browser_directory:
|
||||
/* We go here after we select a new directory. */
|
||||
|
||||
/* Start with no key pressed. */
|
||||
kbinput = ERR;
|
||||
meta_key = FALSE;
|
||||
func_key = FALSE;
|
||||
width = 0;
|
||||
selected = 0;
|
||||
|
||||
path = mallocstrassn(path, get_full_path(path));
|
||||
|
||||
/* Assume that path exists and ends with a slash. */
|
||||
assert(path != NULL && path[strlen(path) - 1] == '/');
|
||||
|
||||
/* Get the list of files. */
|
||||
/* Get the file list, and set longest and width in the process. */
|
||||
browser_init(path, dir);
|
||||
|
||||
assert(filelist != NULL);
|
||||
|
||||
/* Sort the list. */
|
||||
/* Sort the file list. */
|
||||
qsort(filelist, filelist_len, sizeof(char *), diralphasort);
|
||||
|
||||
/* 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);
|
||||
|
||||
free(prev_dir);
|
||||
prev_dir = NULL;
|
||||
/* Otherwise, select the first file or directory in the list. */
|
||||
} else
|
||||
selected = 0;
|
||||
|
||||
old_selected = (size_t)-1;
|
||||
|
||||
titlebar(path);
|
||||
|
||||
do {
|
||||
bool abort = FALSE;
|
||||
while (!abort) {
|
||||
struct stat st;
|
||||
int i;
|
||||
size_t fileline;
|
||||
size_t fileline = selected / width;
|
||||
/* The line number the selected file is on. */
|
||||
char *new_path;
|
||||
/* Used by the "Go To Directory" prompt. */
|
||||
#ifndef DISABLE_MOUSE
|
||||
MEVENT mevent;
|
||||
#endif
|
||||
/* The path we switch to at the "Go to Directory"
|
||||
* prompt. */
|
||||
|
||||
/* Compute the line number we're on now, so that we don't divide
|
||||
* by zero. */
|
||||
fileline = selected;
|
||||
if (width != 0)
|
||||
fileline /= width;
|
||||
/* Display the file list if we don't have a key, or if the
|
||||
* selected file has changed, and set width in the process. */
|
||||
if (kbinput == ERR || old_selected != selected)
|
||||
browser_refresh();
|
||||
|
||||
old_selected = selected;
|
||||
|
||||
kbinput = get_kbinput(edit, &meta_key, &func_key);
|
||||
parse_browser_input(&kbinput, &meta_key, &func_key);
|
||||
|
||||
switch (kbinput) {
|
||||
#ifndef DISABLE_MOUSE
|
||||
case KEY_MOUSE:
|
||||
if (getmouse(&mevent) == ERR)
|
||||
break;
|
||||
|
||||
/* If we clicked in the edit window, we probably clicked
|
||||
* on a file. */
|
||||
if (wenclose(edit, mevent.y, mevent.x)) {
|
||||
size_t old_selected = selected;
|
||||
|
||||
/* Subtract out the size of topwin. */
|
||||
mevent.y -= 2 - no_more_space();
|
||||
|
||||
/* longest is the width of each column. There are
|
||||
* two spaces between each column. */
|
||||
selected = (fileline / editwinrows) * (editwinrows *
|
||||
width) + (mevent.y * width) + (mevent.x /
|
||||
(longest + 2));
|
||||
|
||||
/* If they clicked beyond the end of a row, select
|
||||
* the end of that row. */
|
||||
if (mevent.x > width * (longest + 2))
|
||||
selected--;
|
||||
|
||||
/* If we're off the screen, reset to the last item.
|
||||
* If we clicked the same place as last time, select
|
||||
* this name! */
|
||||
if (selected > filelist_len - 1)
|
||||
selected = filelist_len - 1;
|
||||
else if (old_selected == selected)
|
||||
/* Put back the "Select" key, so that the file
|
||||
* is selected. */
|
||||
unget_kbinput(NANO_ENTER_KEY, FALSE, FALSE);
|
||||
} else {
|
||||
/* We must have clicked a shortcut. Put back the
|
||||
* equivalent shortcut key. */
|
||||
{
|
||||
int mouse_x, mouse_y;
|
||||
get_mouseinput(&mouse_x, &mouse_y, TRUE);
|
||||
|
||||
if (!get_mouseinput(&mouse_x, &mouse_y, TRUE)) {
|
||||
/* We can click in the edit window to select a
|
||||
* filename. */
|
||||
if (wenclose(edit, mouse_y, mouse_x)) {
|
||||
/* Subtract out the size of topwin. */
|
||||
mouse_y -= 2 - no_more_space();
|
||||
|
||||
/* longest is the width of each column.
|
||||
* There are two spaces between each
|
||||
* column. */
|
||||
selected = (fileline / editwinrows) *
|
||||
(editwinrows * width) + (mouse_y *
|
||||
width) + (mouse_x / (longest + 2));
|
||||
|
||||
/* If they clicked beyond the end of a row,
|
||||
* select the filename at the end of that
|
||||
* row. */
|
||||
if (mouse_x > width * (longest + 2))
|
||||
selected--;
|
||||
|
||||
/* 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 (old_selected == selected)
|
||||
unget_kbinput(NANO_ENTER_KEY, FALSE,
|
||||
FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
@@ -181,14 +200,14 @@ char *do_browser(char *path, DIR *dir)
|
||||
case NANO_NEXTPAGE_KEY:
|
||||
selected += (editwinrows - fileline % editwinrows) *
|
||||
width;
|
||||
if (selected >= filelist_len)
|
||||
if (selected > filelist_len - 1)
|
||||
selected = filelist_len - 1;
|
||||
break;
|
||||
case NANO_FIRSTFILE_ALTKEY:
|
||||
case NANO_FIRSTFILE_METAKEY:
|
||||
if (meta_key)
|
||||
selected = 0;
|
||||
break;
|
||||
case NANO_LASTFILE_ALTKEY:
|
||||
case NANO_LASTFILE_METAKEY:
|
||||
if (meta_key)
|
||||
selected = filelist_len - 1;
|
||||
break;
|
||||
@@ -212,7 +231,9 @@ char *do_browser(char *path, DIR *dir)
|
||||
#endif
|
||||
bottombars(browser_list);
|
||||
|
||||
if (i < 0) {
|
||||
/* If the directory begins with a newline (i.e. an
|
||||
* encoded null), treat it as though it's blank. */
|
||||
if (i < 0 || answer[0] == '\n') {
|
||||
/* We canceled. Indicate that on the statusbar, and
|
||||
* blank out ans, since we're done with it. */
|
||||
statusbar(_("Cancelled"));
|
||||
@@ -232,6 +253,11 @@ char *do_browser(char *path, DIR *dir)
|
||||
* with it. */
|
||||
ans = mallocstrcpy(ans, "");
|
||||
|
||||
/* Convert newlines to nulls, just before we go to the
|
||||
* directory. */
|
||||
sunder(answer);
|
||||
align(&answer);
|
||||
|
||||
new_path = real_dir_from_tilde(answer);
|
||||
|
||||
if (new_path[0] != '/') {
|
||||
@@ -252,7 +278,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
|
||||
dir = opendir(new_path);
|
||||
if (dir == NULL) {
|
||||
/* We can't open this dir for some reason.
|
||||
/* We can't open this directory for some reason.
|
||||
* Complain. */
|
||||
statusbar(_("Error reading %s: %s"), answer,
|
||||
strerror(errno));
|
||||
@@ -264,7 +290,6 @@ char *do_browser(char *path, DIR *dir)
|
||||
/* Start over again with the new path value. */
|
||||
free(path);
|
||||
path = new_path;
|
||||
free_chararray(filelist, filelist_len);
|
||||
goto change_browser_directory;
|
||||
case NANO_PREVLINE_KEY:
|
||||
if (selected >= width)
|
||||
@@ -283,7 +308,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
selected++;
|
||||
break;
|
||||
case NANO_ENTER_KEY:
|
||||
/* You can't move up from "/". */
|
||||
/* We can't move up from "/". */
|
||||
if (strcmp(filelist[selected], "/..") == 0) {
|
||||
statusbar(_("Can't move up a directory"));
|
||||
beep();
|
||||
@@ -291,7 +316,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
}
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
/* Note: the selected file can be outside the operating
|
||||
/* Note: The selected file can be outside the operating
|
||||
* directory if it's ".." or if it's a symlink to a
|
||||
* directory outside the operating directory. */
|
||||
if (check_operating_dir(filelist[selected], FALSE)) {
|
||||
@@ -312,11 +337,18 @@ char *do_browser(char *path, DIR *dir)
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we've successfully opened a file, we're done, so
|
||||
* get out. */
|
||||
if (!S_ISDIR(st.st_mode)) {
|
||||
retval = mallocstrcpy(retval, filelist[selected]);
|
||||
retval = mallocstrcpy(NULL, filelist[selected]);
|
||||
abort = TRUE;
|
||||
break;
|
||||
}
|
||||
/* If we've successfully opened a directory, and it's
|
||||
* "..", save the current directory in prev_dir, so that
|
||||
* we can select it later. */
|
||||
} else if (strcmp(tail(filelist[selected]), "..") == 0)
|
||||
prev_dir = mallocstrcpy(NULL,
|
||||
striponedir(filelist[selected]));
|
||||
|
||||
dir = opendir(filelist[selected]);
|
||||
if (dir == NULL) {
|
||||
@@ -331,34 +363,26 @@ char *do_browser(char *path, DIR *dir)
|
||||
path = mallocstrcpy(path, filelist[selected]);
|
||||
|
||||
/* Start over again with the new path value. */
|
||||
free_chararray(filelist, filelist_len);
|
||||
goto change_browser_directory;
|
||||
/* Abort the browser. */
|
||||
/* Abort the file browser. */
|
||||
case NANO_EXIT_KEY:
|
||||
abort = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (abort)
|
||||
break;
|
||||
|
||||
browser_refresh();
|
||||
|
||||
kbinput = get_kbinput(edit, &meta_key, &func_key);
|
||||
parse_browser_input(&kbinput, &meta_key, &func_key);
|
||||
} while (kbinput != NANO_EXIT_KEY);
|
||||
|
||||
blank_edit();
|
||||
titlebar(NULL);
|
||||
edit_refresh();
|
||||
curs_set(1);
|
||||
if (old_const_update)
|
||||
SET(CONST_UPDATE);
|
||||
|
||||
/* Clean up. */
|
||||
free(path);
|
||||
free(ans);
|
||||
|
||||
free_chararray(filelist, filelist_len);
|
||||
filelist = NULL;
|
||||
filelist_len = 0;
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -384,7 +408,8 @@ char *do_browse_from(const char *inpath)
|
||||
* at all. If so, we'll just pass the current directory to
|
||||
* do_browser(). */
|
||||
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
||||
striponedir(path);
|
||||
path = mallocstrassn(path, striponedir(path));
|
||||
|
||||
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
||||
free(path);
|
||||
|
||||
@@ -399,19 +424,18 @@ char *do_browse_from(const char *inpath)
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
/* If the resulting path isn't in the operating directory, use
|
||||
* the operating directory instead. */
|
||||
if (check_operating_dir(path, FALSE)) {
|
||||
if (path != NULL)
|
||||
free(path);
|
||||
path = mallocstrcpy(NULL, operating_dir);
|
||||
}
|
||||
if (check_operating_dir(path, FALSE))
|
||||
path = mallocstrcpy(path, operating_dir);
|
||||
#endif
|
||||
|
||||
if (path != NULL)
|
||||
dir = opendir(path);
|
||||
|
||||
/* If we can't open the path, get out. */
|
||||
if (dir == NULL) {
|
||||
if (path != NULL)
|
||||
free(path);
|
||||
beep();
|
||||
free(path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -419,16 +443,28 @@ char *do_browse_from(const char *inpath)
|
||||
}
|
||||
|
||||
/* Set filelist to the list of files contained in the directory path,
|
||||
* set filelist_len to the number of files in that list, and set longest
|
||||
* to the width in columns of the longest filename in that list, up to
|
||||
* COLS - 1 (but at least 7). Assume path exists and is a directory. */
|
||||
* set filelist_len to the number of files in that list, set longest to
|
||||
* the width in columns of the longest filename in that list (between 15
|
||||
* and COLS), and set width to the number of files that we can display
|
||||
* per line. longest needs to be at least 15 columns in order to
|
||||
* display ".. (parent dir)", as Pico does. Assume path exists and is a
|
||||
* directory. */
|
||||
void browser_init(const char *path, DIR *dir)
|
||||
{
|
||||
const struct dirent *nextdir;
|
||||
size_t i = 0, path_len;
|
||||
size_t i = 0, path_len = strlen(path);
|
||||
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 filesperline = 0;
|
||||
/* The number of files that we can display per line. */
|
||||
|
||||
assert(dir != NULL);
|
||||
assert(path != NULL && path[strlen(path) - 1] == '/' && dir != NULL);
|
||||
|
||||
/* Set longest to zero, just before we initialize it. */
|
||||
longest = 0;
|
||||
|
||||
while ((nextdir = readdir(dir)) != NULL) {
|
||||
@@ -437,20 +473,26 @@ void browser_init(const char *path, DIR *dir)
|
||||
/* Don't show the "." entry. */
|
||||
if (strcmp(nextdir->d_name, ".") == 0)
|
||||
continue;
|
||||
i++;
|
||||
|
||||
d_len = strlenpt(nextdir->d_name);
|
||||
if (d_len > longest)
|
||||
longest = (d_len > COLS - 1) ? COLS - 1 : d_len;
|
||||
longest = (d_len > COLS) ? COLS : d_len;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
filelist_len = i;
|
||||
rewinddir(dir);
|
||||
|
||||
/* Put 10 columns' worth of blank space between columns of filenames
|
||||
* in the list whenever possible, as Pico does. */
|
||||
longest += 10;
|
||||
|
||||
filelist = (char **)nmalloc(filelist_len * sizeof(char *));
|
||||
if (filelist != NULL)
|
||||
free_chararray(filelist, filelist_len);
|
||||
|
||||
path_len = strlen(path);
|
||||
filelist_len = i;
|
||||
|
||||
filelist = (char **)nmalloc(filelist_len * sizeof(char *));
|
||||
|
||||
i = 0;
|
||||
|
||||
@@ -461,6 +503,7 @@ void browser_init(const char *path, DIR *dir)
|
||||
|
||||
filelist[i] = charalloc(path_len + strlen(nextdir->d_name) + 1);
|
||||
sprintf(filelist[i], "%s%s", path, nextdir->d_name);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -468,12 +511,44 @@ void browser_init(const char *path, DIR *dir)
|
||||
* first time we scanned and the second. i is the actual length of
|
||||
* filelist, so record it. */
|
||||
filelist_len = i;
|
||||
|
||||
closedir(dir);
|
||||
|
||||
if (longest > COLS - 1)
|
||||
longest = COLS - 1;
|
||||
if (longest < 7)
|
||||
longest = 7;
|
||||
/* 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;
|
||||
|
||||
for (i = 0; i < filelist_len && line < editwinrows; i++) {
|
||||
/* Calculate the number of columns one filename will take up. */
|
||||
col += longest;
|
||||
filesperline++;
|
||||
|
||||
/* Add some space between the columns. */
|
||||
col += 2;
|
||||
|
||||
/* If the next entry isn't going to fit on the current line,
|
||||
* move to the next line. */
|
||||
if (col > COLS - longest) {
|
||||
line++;
|
||||
col = 0;
|
||||
|
||||
/* If width isn't initialized yet, and we've taken up more
|
||||
* than one line, it means that width is equal to
|
||||
* filesperline. */
|
||||
if (width == 0)
|
||||
width = filesperline;
|
||||
}
|
||||
}
|
||||
|
||||
/* If width isn't initialized yet, and we've taken up only one line,
|
||||
* it means that width is equal to (COLS % longest). */
|
||||
if (width == 0)
|
||||
width = COLS % longest;
|
||||
}
|
||||
|
||||
/* Determine the shortcut key corresponding to the values of kbinput
|
||||
@@ -486,7 +561,7 @@ void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||
get_shortcut(browser_list, kbinput, meta_key, func_key);
|
||||
|
||||
/* Pico compatibility. */
|
||||
if (*meta_key == FALSE) {
|
||||
if (!*meta_key) {
|
||||
switch (*kbinput) {
|
||||
case ' ':
|
||||
*kbinput = NANO_NEXTPAGE_KEY;
|
||||
@@ -519,69 +594,137 @@ void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||
}
|
||||
}
|
||||
|
||||
/* Calculate the number of columns needed to display the list of files
|
||||
* in the array filelist, if necessary, and then display the list of
|
||||
* files. */
|
||||
/* Set width to the number of files that we can display per line, if
|
||||
* necessary, and display the list of files. */
|
||||
void browser_refresh(void)
|
||||
{
|
||||
struct stat st;
|
||||
size_t i = 0;
|
||||
int col = 0, line = 0, filecols = 0;
|
||||
size_t foo_len = mb_cur_max() * 7;
|
||||
char *foo = charalloc(foo_len + 1);
|
||||
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. */
|
||||
char *foo;
|
||||
/* The file information that we'll display. */
|
||||
|
||||
if (width != 0)
|
||||
i = width * editwinrows * ((selected / width) / editwinrows);
|
||||
if (uimax_digits == -1)
|
||||
uimax_digits = digits(UINT_MAX);
|
||||
|
||||
blank_edit();
|
||||
|
||||
wmove(edit, 0, 0);
|
||||
|
||||
for (; i < filelist_len && line <= editwinrows - 1; i++) {
|
||||
char *disp = display_string(tail(filelist[i]), 0, longest,
|
||||
FALSE);
|
||||
i = width * editwinrows * ((selected / width) / editwinrows);
|
||||
|
||||
/* Highlight the currently selected file or directory. */
|
||||
for (; i < filelist_len && line < editwinrows; i++) {
|
||||
struct stat st;
|
||||
const char *filetail = tail(filelist[i]);
|
||||
/* The filename we display, minus the path. */
|
||||
size_t filetaillen = strlenpt(filetail);
|
||||
/* The length of the filename in columns. */
|
||||
size_t foolen;
|
||||
/* The length of the file information in columns. */
|
||||
int foomaxlen = 7;
|
||||
/* 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);
|
||||
/* 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
|
||||
* filename other than ".."). */
|
||||
char *disp = display_string(filetail, dots ? filetaillen -
|
||||
longest + foomaxlen + 4 : 0, longest, FALSE);
|
||||
/* If we put an ellipsis before the filename, reserve
|
||||
* one column for padding, plus seven columns for "--",
|
||||
* "(dir)", or the file size, plus three columns for the
|
||||
* ellipsis. */
|
||||
|
||||
/* Start highlighting the currently selected file or
|
||||
* directory. */
|
||||
if (i == selected)
|
||||
wattron(edit, reverse_attr);
|
||||
|
||||
blank_line(edit, line, col, longest);
|
||||
mvwaddstr(edit, line, col, disp);
|
||||
|
||||
/* If dots is TRUE, we will display something like
|
||||
* "...ename". */
|
||||
if (dots)
|
||||
mvwaddstr(edit, line, col, "...");
|
||||
mvwaddstr(edit, line, dots ? col + 3 : col, disp);
|
||||
|
||||
free(disp);
|
||||
|
||||
col += longest;
|
||||
filecols++;
|
||||
|
||||
/* Show file info also. We don't want to report file sizes for
|
||||
* links, so we use lstat(). Also, stat() and lstat() return an
|
||||
* error if, for example, the file is deleted while the file
|
||||
* browser is open. In that case, we report "--" as the file
|
||||
* info. */
|
||||
/* Show information about the file. We don't want to report
|
||||
* file sizes for links, so we use lstat(). */
|
||||
if (lstat(filelist[i], &st) == -1 || S_ISLNK(st.st_mode)) {
|
||||
/* Aha! It's a symlink! Now, is it a dir? If so, mark it
|
||||
* as such. */
|
||||
if (stat(filelist[i], &st) == 0 && S_ISDIR(st.st_mode)) {
|
||||
strncpy(foo, _("(dir)"), foo_len);
|
||||
foo[foo_len] = '\0';
|
||||
} else
|
||||
strcpy(foo, "--");
|
||||
/* If the file doesn't exist (i.e. it's been deleted while
|
||||
* the file browser is open), or it's a symlink that doesn't
|
||||
* point to a directory, display "--". */
|
||||
if (stat(filelist[i], &st) == -1 || !S_ISDIR(st.st_mode))
|
||||
foo = mallocstrcpy(NULL, "--");
|
||||
/* 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. */
|
||||
foo = mallocstrcpy(NULL, _("(dir)"));
|
||||
} else if (S_ISDIR(st.st_mode)) {
|
||||
strncpy(foo, _("(dir)"), foo_len);
|
||||
foo[foo_len] = '\0';
|
||||
} else if (st.st_size < (1 << 10)) /* less than 1 k. */
|
||||
sprintf(foo, "%4u B", (unsigned int)st.st_size);
|
||||
else if (st.st_size < (1 << 20)) /* less than 1 meg. */
|
||||
sprintf(foo, "%4u KB", (unsigned int)(st.st_size >> 10));
|
||||
else if (st.st_size < (1 << 30)) /* less than 1 gig. */
|
||||
sprintf(foo, "%4u MB", (unsigned int)(st.st_size >> 20));
|
||||
else
|
||||
sprintf(foo, "%4u GB", (unsigned int)(st.st_size >> 30));
|
||||
/* If the file is a directory, display it as such. */
|
||||
if (strcmp(filetail, "..") == 0) {
|
||||
/* 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;
|
||||
char modifier;
|
||||
|
||||
mvwaddnstr(edit, line, col - strlen(foo), foo, foo_len);
|
||||
foo = charalloc(uimax_digits + 4);
|
||||
|
||||
/* Bytes. */
|
||||
if (st.st_size < (1 << 10))
|
||||
modifier = ' ';
|
||||
/* Kilobytes. */
|
||||
else if (st.st_size < (1 << 20)) {
|
||||
result >>= 10;
|
||||
modifier = 'K';
|
||||
/* Megabytes. */
|
||||
} else if (st.st_size < (1 << 30)) {
|
||||
result >>= 20;
|
||||
modifier = 'M';
|
||||
/* Gigabytes. */
|
||||
} else {
|
||||
result >>= 30;
|
||||
modifier = 'G';
|
||||
}
|
||||
|
||||
sprintf(foo, "%4lu %cB", result, modifier);
|
||||
}
|
||||
|
||||
/* Make sure foo takes up no more than foomaxlen columns. */
|
||||
foolen = strlenpt(foo);
|
||||
if (foolen > foomaxlen) {
|
||||
null_at(&foo, actual_x(foo, foomaxlen));
|
||||
foolen = foomaxlen;
|
||||
}
|
||||
|
||||
mvwaddstr(edit, line, col - foolen, foo);
|
||||
|
||||
/* Finish highlighting the currently selected file or
|
||||
* directory. */
|
||||
if (i == selected)
|
||||
wattroff(edit, reverse_attr);
|
||||
|
||||
free(foo);
|
||||
|
||||
/* Add some space between the columns. */
|
||||
col += 2;
|
||||
|
||||
@@ -590,21 +733,36 @@ void browser_refresh(void)
|
||||
if (col > COLS - longest) {
|
||||
line++;
|
||||
col = 0;
|
||||
|
||||
/* Set the number of columns to display the list in, if
|
||||
* necessary, so that we don't divide by zero. */
|
||||
if (width == 0)
|
||||
width = filecols;
|
||||
}
|
||||
|
||||
wmove(edit, line, col);
|
||||
}
|
||||
|
||||
free(foo);
|
||||
|
||||
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)
|
||||
{
|
||||
size_t currselected;
|
||||
bool found = FALSE;
|
||||
|
||||
for (currselected = 0; currselected < filelist_len;
|
||||
currselected++) {
|
||||
if (strcmp(filelist[currselected], needle) == 0) {
|
||||
found = TRUE;
|
||||
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
|
||||
@@ -686,9 +844,8 @@ int filesearch_init(void)
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Use last_search if answer is an empty string, or
|
||||
* answer if it isn't. */
|
||||
if (ISSET(USE_REGEXP) &&
|
||||
regexp_init((i == -2) ? last_search :
|
||||
answer) == 0)
|
||||
if (ISSET(USE_REGEXP) && !regexp_init((i == -2) ?
|
||||
last_search : answer))
|
||||
return -1;
|
||||
#endif
|
||||
break;
|
||||
@@ -725,17 +882,18 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle)
|
||||
size_t currselected = selected;
|
||||
/* The location in the current file list of the match we
|
||||
* find. */
|
||||
const char *rev_start = tail(filelist[currselected]), *found = NULL;
|
||||
const char *filetail = tail(filelist[currselected]);
|
||||
/* The filename we display, minus the path. */
|
||||
const char *rev_start = filetail, *found = NULL;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
rev_start += strlen(tail(filelist[currselected]));
|
||||
rev_start += strlen(rev_start);
|
||||
#endif
|
||||
|
||||
/* Look for needle in the current filename we're searching. */
|
||||
while (TRUE) {
|
||||
found = strstrwrapper(tail(filelist[currselected]), needle,
|
||||
rev_start);
|
||||
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
|
||||
@@ -775,10 +933,12 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle)
|
||||
if (currselected == begin)
|
||||
search_last_file = TRUE;
|
||||
|
||||
rev_start = tail(filelist[currselected]);
|
||||
filetail = tail(filelist[currselected]);
|
||||
|
||||
rev_start = filetail;
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
rev_start += strlen(tail(filelist[currselected]));
|
||||
rev_start += strlen(rev_start);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -869,7 +1029,7 @@ void do_fileresearch(void)
|
||||
if (last_search[0] != '\0') {
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Since answer is "", use last_search! */
|
||||
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
|
||||
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -893,27 +1053,35 @@ void do_fileresearch(void)
|
||||
filesearch_abort();
|
||||
}
|
||||
|
||||
/* Select the first file in the list. */
|
||||
void do_first_file(void)
|
||||
{
|
||||
selected = 0;
|
||||
}
|
||||
|
||||
/* Select the last file in the list. */
|
||||
void do_last_file(void)
|
||||
{
|
||||
selected = filelist_len - 1;
|
||||
}
|
||||
|
||||
/* Strip one directory from the end of path. */
|
||||
void striponedir(char *path)
|
||||
/* Strip one directory from the end of path, and return the stripped
|
||||
* path. The returned string is dynamically allocated, and should be
|
||||
* freed. */
|
||||
char *striponedir(const char *path)
|
||||
{
|
||||
char *tmp;
|
||||
char *retval, *tmp;
|
||||
|
||||
assert(path != NULL);
|
||||
|
||||
tmp = strrchr(path, '/');
|
||||
retval = mallocstrcpy(NULL, path);
|
||||
|
||||
tmp = strrchr(retval, '/');
|
||||
|
||||
if (tmp != NULL)
|
||||
*tmp = '\0';
|
||||
null_at(&retval, tmp - retval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
|
||||
42
src/chars.c
42
src/chars.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* chars.c *
|
||||
* *
|
||||
* Copyright (C) 2001-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -38,10 +38,9 @@ static bool use_utf8 = FALSE;
|
||||
/* Whether we've enabled UTF-8 support. */
|
||||
static const wchar_t bad_wchar = 0xFFFD;
|
||||
/* If we get an invalid multibyte sequence, we treat it as
|
||||
* Unicode FFFD (Replacement Character), unless we're
|
||||
* determining if it's a control character or searching for a
|
||||
* match to it. */
|
||||
static const char *bad_mbchar = "\xEF\xBF\xBD";
|
||||
* Unicode FFFD (Replacement Character), unless we're searching
|
||||
* for a match to it. */
|
||||
static const char *const bad_mbchar = "\xEF\xBF\xBD";
|
||||
static const int bad_mbchar_len = 3;
|
||||
|
||||
/* Enable UTF-8 support. */
|
||||
@@ -514,10 +513,7 @@ int nstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
break;
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
return tolower(*s1) - tolower(*s2);
|
||||
else
|
||||
return 0;
|
||||
return (n > 0) ? tolower(*s1) - tolower(*s2) : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -527,12 +523,14 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
char *s1_mb = charalloc(MB_CUR_MAX);
|
||||
char *s2_mb = charalloc(MB_CUR_MAX);
|
||||
char *s1_mb, *s2_mb;
|
||||
wchar_t ws1, ws2;
|
||||
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
|
||||
s1_mb = charalloc(MB_CUR_MAX);
|
||||
s2_mb = charalloc(MB_CUR_MAX);
|
||||
|
||||
while (n > 0 && *s1 != '\0' && *s2 != '\0') {
|
||||
bool bad_s1_mb = FALSE, bad_s2_mb = FALSE;
|
||||
int s1_mb_len, s2_mb_len;
|
||||
@@ -576,8 +574,9 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
* from mutt 1.2.4i (lib.c). Here is the notice from that file, with
|
||||
* the Free Software Foundation's address updated:
|
||||
*
|
||||
* Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
|
||||
* Copyright (C) 1999-2000 Thomas Roessler <roessler@guug.de>
|
||||
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael R. Elkins
|
||||
* <me@cs.hmc.edu>
|
||||
* Copyright (C) 1999, 2000 Thomas Roessler <roessler@guug.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU General Public
|
||||
@@ -620,13 +619,15 @@ const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
char *r_mb, *q_mb;
|
||||
wchar_t wr, wq;
|
||||
bool found_needle = FALSE;
|
||||
|
||||
assert(haystack != NULL && needle != NULL);
|
||||
|
||||
r_mb = charalloc(MB_CUR_MAX);
|
||||
q_mb = charalloc(MB_CUR_MAX);
|
||||
|
||||
while (*haystack != '\0') {
|
||||
const char *r = haystack, *q = needle;
|
||||
int r_mb_len, q_mb_len;
|
||||
@@ -726,13 +727,15 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
char *r_mb, *q_mb;
|
||||
wchar_t wr, wq;
|
||||
bool begin_line = FALSE, found_needle = FALSE;
|
||||
|
||||
assert(haystack != NULL && needle != NULL && rev_start != NULL);
|
||||
|
||||
r_mb = charalloc(MB_CUR_MAX);
|
||||
q_mb = charalloc(MB_CUR_MAX);
|
||||
|
||||
while (!begin_line) {
|
||||
const char *r = rev_start, *q = needle;
|
||||
int r_mb_len, q_mb_len;
|
||||
@@ -1020,8 +1023,7 @@ bool is_valid_mbstring(const char *s)
|
||||
|
||||
return
|
||||
#ifdef ENABLE_UTF8
|
||||
use_utf8 ?
|
||||
(mbstowcs(NULL, s, 0) != (size_t)-1) :
|
||||
use_utf8 ? (mbstowcs(NULL, s, 0) != (size_t)-1) :
|
||||
#endif
|
||||
TRUE;
|
||||
}
|
||||
|
||||
11
src/color.c
11
src/color.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* color.c *
|
||||
* *
|
||||
* Copyright (C) 2001-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -29,7 +29,7 @@
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
/* For each syntax list entry, go through the list of colors and assign
|
||||
* color pairs. */
|
||||
* the color pairs. */
|
||||
void set_colorpairs(void)
|
||||
{
|
||||
const syntaxtype *this_syntax = syntaxes;
|
||||
@@ -138,9 +138,8 @@ void color_update(void)
|
||||
exttype *e;
|
||||
|
||||
/* If this is the default syntax, it has no associated
|
||||
* extensions. (We've checked for this and for duplicate
|
||||
* syntax names elsewhere.) Skip over it here, but keep
|
||||
* track of its color regexes. */
|
||||
* extensions, which we've checked for elsewhere. Skip over
|
||||
* it here, but keep track of its color regexes. */
|
||||
if (strcmp(tmpsyntax->desc, "default") == 0) {
|
||||
defcolor = tmpsyntax->color;
|
||||
continue;
|
||||
|
||||
18
src/cut.c
18
src/cut.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* cut.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -90,7 +90,7 @@ void cut_to_eol(void)
|
||||
else if (openfile->current != openfile->filebot) {
|
||||
/* If we're at the end of the line, and it isn't the last line
|
||||
* of the file, move all the text from the current position up
|
||||
* to the beginning of the next line, i.e, the newline at the
|
||||
* to the beginning of the next line, i.e. the newline at the
|
||||
* end, into the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->current->next, 0);
|
||||
@@ -146,7 +146,7 @@ void do_cut_text(
|
||||
if (copy_text) {
|
||||
if (cutbuffer != NULL) {
|
||||
/* If the cutbuffer isn't empty, save where it currently
|
||||
* ends. This is where the new text will be added. */
|
||||
* ends. This is where we'll add the new text. */
|
||||
cb_save = cutbottom;
|
||||
cb_save_len = strlen(cutbottom->data);
|
||||
}
|
||||
@@ -173,12 +173,12 @@ void do_cut_text(
|
||||
cut_marked();
|
||||
openfile->mark_set = FALSE;
|
||||
} else if (ISSET(CUT_TO_END))
|
||||
/* Otherwise, if the CUT_TO_END flag is set, move all text up to
|
||||
* the end of the line into the cutbuffer. */
|
||||
/* If the CUT_TO_END flag is set, move all text up to the end of
|
||||
* the line into the cutbuffer. */
|
||||
cut_to_eol();
|
||||
else
|
||||
#endif
|
||||
/* Otherwise, move the entire line into the cutbuffer. */
|
||||
/* Move the entire line into the cutbuffer. */
|
||||
cut_line();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -194,6 +194,10 @@ void do_cut_text(
|
||||
cb_save->data -= cb_save_len;
|
||||
} else
|
||||
copy_from_filestruct(cutbuffer, cutbottom);
|
||||
|
||||
/* Set the current place we want to where the text from the
|
||||
* cutbuffer ends. */
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
|
||||
/* Set NO_NEWLINES back to what it was before, since we're done
|
||||
|
||||
475
src/files.c
475
src/files.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* files.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -132,8 +132,8 @@ void open_buffer(const char *filename)
|
||||
if (new_buffer)
|
||||
make_new_buffer();
|
||||
|
||||
/* If we have a file and we're loading into a new buffer, update the
|
||||
* filename. */
|
||||
/* If we have a file, and we're loading into a new buffer, update
|
||||
* the filename. */
|
||||
if (rc != -1 && new_buffer)
|
||||
openfile->filename = mallocstrcpy(openfile->filename, filename);
|
||||
|
||||
@@ -150,7 +150,7 @@ void open_buffer(const char *filename)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If we have a file and we're loading into a new buffer, move back
|
||||
/* If we have a file, and we're loading into a new buffer, move back
|
||||
* to the beginning of the first line of the buffer. */
|
||||
if (rc != -1 && new_buffer) {
|
||||
openfile->current = openfile->fileage;
|
||||
@@ -294,8 +294,8 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
{
|
||||
filestruct *fileptr = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
|
||||
/* Convert nulls to newlines. buf_len is the string's real length
|
||||
* here. */
|
||||
/* Convert nulls to newlines. buf_len is the string's real
|
||||
* length. */
|
||||
unsunder(buf, buf_len);
|
||||
|
||||
assert(openfile->fileage != NULL && strlen(buf) == buf_len);
|
||||
@@ -309,13 +309,13 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
fileptr->data[buf_len - 1] = '\0';
|
||||
#endif
|
||||
|
||||
if (*first_line_ins == TRUE) {
|
||||
if (*first_line_ins) {
|
||||
/* Special case: We're inserting with the cursor on the first
|
||||
* line. */
|
||||
fileptr->prev = NULL;
|
||||
fileptr->next = openfile->fileage;
|
||||
fileptr->lineno = 1;
|
||||
if (*first_line_ins == TRUE) {
|
||||
if (*first_line_ins) {
|
||||
*first_line_ins = FALSE;
|
||||
/* If we're inserting into the first line of the file, then
|
||||
* we want to make sure that our edit buffer stays on the
|
||||
@@ -540,7 +540,7 @@ void read_file(FILE *f, const char *filename)
|
||||
openfile->filebot);
|
||||
|
||||
/* If the NO_NEWLINES flag isn't set, and text has been added to
|
||||
* the magicline (i.e, a file that doesn't end in a newline has been
|
||||
* the magicline (i.e. a file that doesn't end in a newline has been
|
||||
* inserted at the end of the current buffer), add a new magicline,
|
||||
* and move the current line down to it. */
|
||||
if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0') {
|
||||
@@ -579,13 +579,13 @@ void read_file(FILE *f, const char *filename)
|
||||
* "New File" if the file is missing. Otherwise, say "[filename] not
|
||||
* found".
|
||||
*
|
||||
* Return -2 if we say "New File". Otherwise, -1 if the file isn't
|
||||
* opened, 0 otherwise. The file might still have an error while
|
||||
* reading with a 0 return value. *f is set to the opened file. */
|
||||
* Return -2 if we say "New File", -1 if the file isn't opened, and 0
|
||||
* otherwise. The file might still have an error while reading with a 0
|
||||
* return value. *f is set to the opened file. */
|
||||
int open_file(const char *filename, bool newfie, FILE **f)
|
||||
{
|
||||
int fd;
|
||||
struct stat fileinfo;
|
||||
int fd;
|
||||
|
||||
assert(filename != NULL && f != NULL);
|
||||
|
||||
@@ -681,8 +681,9 @@ void do_insertfile(
|
||||
int i;
|
||||
const char *msg;
|
||||
char *ans = mallocstrcpy(NULL, "");
|
||||
/* The last answer the user typed on the statusbar. */
|
||||
/* The last answer the user typed at the statusbar prompt. */
|
||||
filestruct *edittop_save = openfile->edittop;
|
||||
size_t current_x_save = openfile->current_x;
|
||||
ssize_t current_y_save = openfile->current_y;
|
||||
bool at_edittop = FALSE;
|
||||
/* Whether we're at the top of the edit window. */
|
||||
@@ -727,8 +728,10 @@ void do_insertfile(
|
||||
"./");
|
||||
|
||||
/* If we're in multibuffer mode and the filename or command is
|
||||
* blank, open a new buffer instead of canceling. */
|
||||
if (i == -1 || (i == -2
|
||||
* blank, open a new buffer instead of canceling. If the
|
||||
* filename or command begins with a newline (i.e. an encoded
|
||||
* null), treat it as though it's blank. */
|
||||
if (i == -1 || ((i == -2 || answer[0] == '\n')
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
&& !ISSET(MULTIBUFFER)
|
||||
#endif
|
||||
@@ -765,13 +768,11 @@ void do_insertfile(
|
||||
if (tmp == NULL)
|
||||
continue;
|
||||
|
||||
/* We have a file now. Indicate this. */
|
||||
free(answer);
|
||||
answer = tmp;
|
||||
|
||||
/* We have a file now. Indicate this and get out of the
|
||||
* statusbar prompt cleanly. */
|
||||
i = 0;
|
||||
do_prompt_abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -801,6 +802,11 @@ void do_insertfile(
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Convert newlines to nulls, just before we insert the file
|
||||
* or execute the command. */
|
||||
sunder(answer);
|
||||
align(&answer);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (execute) {
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
@@ -811,8 +817,18 @@ void do_insertfile(
|
||||
|
||||
/* Save the command's output in the current buffer. */
|
||||
execute_command(answer);
|
||||
} else {
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER)) {
|
||||
/* Move back to the beginning of the first line of
|
||||
* the buffer. */
|
||||
openfile->current = openfile->fileage;
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
#endif /* !NANO_TINY */
|
||||
/* Make sure the path to the file specified in answer is
|
||||
* tilde-expanded. */
|
||||
answer = mallocstrassn(answer,
|
||||
@@ -835,20 +851,26 @@ void do_insertfile(
|
||||
{
|
||||
filestruct *top_save = openfile->fileage;
|
||||
|
||||
/* If we didn't insert into a new buffer, and we were at
|
||||
* the top of the edit window before, set the saved
|
||||
* value of edittop to the new top of the edit window,
|
||||
* and update the current y-coordinate to account for
|
||||
* the number of lines inserted. */
|
||||
/* If we were at the top of the edit window before, set
|
||||
* the saved value of edittop to the new top of the edit
|
||||
* window. */
|
||||
if (at_edittop)
|
||||
edittop_save = openfile->fileage;
|
||||
|
||||
/* Update the current x-coordinate to account for the
|
||||
* number of characters inserted on the current line. */
|
||||
openfile->current_x = strlen(openfile->filebot->data);
|
||||
if (openfile->fileage == openfile->filebot)
|
||||
openfile->current_x += current_x_save;
|
||||
|
||||
/* Update the current y-coordinate to account for the
|
||||
* number of lines inserted. */
|
||||
openfile->current_y += current_y_save;
|
||||
|
||||
/* If we didn't insert into a new buffer, unpartition
|
||||
* the filestruct so that it contains all the text
|
||||
* again. Note that we've replaced the non-text
|
||||
* originally in the partition with the text in the
|
||||
* inserted file/executed command output. */
|
||||
/* Unpartition the filestruct so that it contains all
|
||||
* the text again. Note that we've replaced the
|
||||
* non-text originally in the partition with the text in
|
||||
* the inserted file/executed command output. */
|
||||
unpartition_filestruct(&filepart);
|
||||
|
||||
/* Renumber starting with the beginning line of the old
|
||||
@@ -882,7 +904,7 @@ void do_insertfile_void(void)
|
||||
{
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(VIEW_MODE) && !ISSET(MULTIBUFFER))
|
||||
statusbar(_("Key illegal in non-multibuffer mode"));
|
||||
statusbar(_("Key invalid in non-multibuffer mode"));
|
||||
else
|
||||
#endif
|
||||
do_insertfile(
|
||||
@@ -902,21 +924,29 @@ void do_insertfile_void(void)
|
||||
* able to go there. */
|
||||
char *get_full_path(const char *origpath)
|
||||
{
|
||||
char *d_here, *d_there = NULL;
|
||||
struct stat fileinfo;
|
||||
char *d_here, *d_there, *d_there_file = NULL;
|
||||
const char *last_slash;
|
||||
bool path_only;
|
||||
|
||||
if (origpath == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Get the current directory. */
|
||||
/* Get the current directory. If it doesn't exist, back up and try
|
||||
* again until we get a directory that does, and use that as the
|
||||
* current directory. */
|
||||
d_here = charalloc(PATH_MAX + 1);
|
||||
d_here = getcwd(d_here, PATH_MAX + 1);
|
||||
|
||||
if (d_here != NULL) {
|
||||
const char *last_slash;
|
||||
char *d_there_file = NULL;
|
||||
bool path_only;
|
||||
struct stat fileinfo;
|
||||
while (d_here == NULL) {
|
||||
if (chdir("..") == -1)
|
||||
break;
|
||||
|
||||
d_here = getcwd(d_here, PATH_MAX + 1);
|
||||
}
|
||||
|
||||
/* If we succeeded, canonicalize it in d_here. */
|
||||
if (d_here != NULL) {
|
||||
align(&d_here);
|
||||
|
||||
/* If the current directory isn't "/", tack a slash onto the end
|
||||
@@ -925,99 +955,99 @@ char *get_full_path(const char *origpath)
|
||||
d_here = charealloc(d_here, strlen(d_here) + 2);
|
||||
strcat(d_here, "/");
|
||||
}
|
||||
/* Otherwise, set d_here to "". */
|
||||
} else
|
||||
d_here = mallocstrcpy(NULL, "");
|
||||
|
||||
d_there = real_dir_from_tilde(origpath);
|
||||
d_there = real_dir_from_tilde(origpath);
|
||||
|
||||
assert(d_there != NULL);
|
||||
/* If stat()ing d_there fails, assume that d_there refers to a new
|
||||
* file that hasn't been saved to disk yet. Set path_only to TRUE
|
||||
* if d_there refers to a directory, and FALSE otherwise. */
|
||||
path_only = (stat(d_there, &fileinfo) != -1 &&
|
||||
S_ISDIR(fileinfo.st_mode));
|
||||
|
||||
/* Stat d_there. If stat() fails, assume that d_there refers to
|
||||
* a new file that hasn't been saved to disk yet. Set path_only
|
||||
* to TRUE if d_there refers to a directory, and FALSE if
|
||||
* d_there refers to a file. */
|
||||
path_only = !stat(d_there, &fileinfo) &&
|
||||
S_ISDIR(fileinfo.st_mode);
|
||||
/* If path_only is TRUE, make sure d_there ends in a slash. */
|
||||
if (path_only) {
|
||||
size_t d_there_len = strlen(d_there);
|
||||
|
||||
/* If path_only is TRUE, make sure d_there ends in a slash. */
|
||||
if (path_only) {
|
||||
size_t d_there_len = strlen(d_there);
|
||||
|
||||
if (d_there[d_there_len - 1] != '/') {
|
||||
d_there = charealloc(d_there, d_there_len + 2);
|
||||
strcat(d_there, "/");
|
||||
}
|
||||
if (d_there[d_there_len - 1] != '/') {
|
||||
d_there = charealloc(d_there, d_there_len + 2);
|
||||
strcat(d_there, "/");
|
||||
}
|
||||
}
|
||||
|
||||
/* Search for the last slash in d_there. */
|
||||
last_slash = strrchr(d_there, '/');
|
||||
/* Search for the last slash in d_there. */
|
||||
last_slash = strrchr(d_there, '/');
|
||||
|
||||
/* If we didn't find one, then make sure the answer is in the
|
||||
* format "d_here/d_there". */
|
||||
if (last_slash == NULL) {
|
||||
assert(!path_only);
|
||||
/* If we didn't find one, then make sure the answer is in the format
|
||||
* "d_here/d_there". */
|
||||
if (last_slash == NULL) {
|
||||
assert(!path_only);
|
||||
|
||||
d_there_file = d_there;
|
||||
d_there = d_here;
|
||||
d_there_file = d_there;
|
||||
d_there = d_here;
|
||||
} else {
|
||||
/* If path_only is FALSE, then save the filename portion of the
|
||||
* answer (everything after the last slash) in d_there_file. */
|
||||
if (!path_only)
|
||||
d_there_file = mallocstrcpy(NULL, last_slash + 1);
|
||||
|
||||
/* Remove the filename portion of the answer from d_there. */
|
||||
null_at(&d_there, last_slash - d_there + 1);
|
||||
|
||||
/* Go to the path specified in d_there. */
|
||||
if (chdir(d_there) == -1) {
|
||||
free(d_there);
|
||||
d_there = NULL;
|
||||
} else {
|
||||
/* If path_only is FALSE, then save the filename portion of
|
||||
* the answer, everything after the last slash, in
|
||||
* d_there_file. */
|
||||
if (!path_only)
|
||||
d_there_file = mallocstrcpy(NULL, last_slash + 1);
|
||||
free(d_there);
|
||||
|
||||
/* And remove the filename portion of the answer from
|
||||
* d_there. */
|
||||
null_at(&d_there, last_slash - d_there + 1);
|
||||
/* Get the full path. */
|
||||
d_there = charalloc(PATH_MAX + 1);
|
||||
d_there = getcwd(d_there, PATH_MAX + 1);
|
||||
|
||||
/* Go to the path specified in d_there. */
|
||||
if (chdir(d_there) == -1) {
|
||||
free(d_there);
|
||||
d_there = NULL;
|
||||
} else {
|
||||
/* Get the full path and save it in d_there. */
|
||||
free(d_there);
|
||||
/* If we succeeded, canonicalize it in d_there. */
|
||||
if (d_there != NULL) {
|
||||
align(&d_there);
|
||||
|
||||
d_there = charalloc(PATH_MAX + 1);
|
||||
d_there = getcwd(d_there, PATH_MAX + 1);
|
||||
/* If the current directory isn't "/", tack a slash onto
|
||||
* the end of it. */
|
||||
if (strcmp(d_there, "/") != 0) {
|
||||
d_there = charealloc(d_there, strlen(d_there) + 2);
|
||||
strcat(d_there, "/");
|
||||
}
|
||||
} else
|
||||
/* Otherwise, set path_only to TRUE, so that we clean up
|
||||
* correctly, free all allocated memory, and return
|
||||
* NULL. */
|
||||
path_only = TRUE;
|
||||
|
||||
if (d_there != NULL) {
|
||||
align(&d_there);
|
||||
|
||||
if (strcmp(d_there, "/") != 0) {
|
||||
/* Make sure d_there ends in a slash. */
|
||||
d_there = charealloc(d_there,
|
||||
strlen(d_there) + 2);
|
||||
strcat(d_there, "/");
|
||||
}
|
||||
} else
|
||||
/* If we couldn't get the full path, set path_only
|
||||
* to TRUE so that we clean up correctly, free all
|
||||
* allocated memory, and return NULL. */
|
||||
path_only = TRUE;
|
||||
|
||||
/* Finally, go back to the path specified in d_here,
|
||||
* where we were before. */
|
||||
chdir(d_here);
|
||||
}
|
||||
/* Finally, go back to the path specified in d_here,
|
||||
* where we were before. We don't check for a chdir()
|
||||
* error, since we can do nothing if we get one. */
|
||||
chdir(d_here);
|
||||
|
||||
/* Free d_here, since we're done using it. */
|
||||
free(d_here);
|
||||
}
|
||||
|
||||
/* At this point, if path_only is FALSE and d_there exists,
|
||||
* d_there contains the path portion of the answer and
|
||||
* d_there_file contains the filename portion of the answer. If
|
||||
* this is the case, tack d_there_file onto the end of
|
||||
* d_there, so that d_there contains the complete answer. */
|
||||
if (!path_only && d_there != NULL) {
|
||||
d_there = charealloc(d_there, strlen(d_there) +
|
||||
strlen(d_there_file) + 1);
|
||||
strcat(d_there, d_there_file);
|
||||
}
|
||||
|
||||
/* Free d_there_file, since we're done using it. */
|
||||
free(d_there_file);
|
||||
}
|
||||
|
||||
/* At this point, if path_only is FALSE and d_there isn't NULL,
|
||||
* d_there contains the path portion of the answer and d_there_file
|
||||
* contains the filename portion of the answer. If this is the
|
||||
* case, tack the latter onto the end of the former. d_there will
|
||||
* then contain the complete answer. */
|
||||
if (!path_only && d_there != NULL) {
|
||||
d_there = charealloc(d_there, strlen(d_there) +
|
||||
strlen(d_there_file) + 1);
|
||||
strcat(d_there, d_there_file);
|
||||
}
|
||||
|
||||
/* Free d_there_file, since we're done using it. */
|
||||
if (d_there_file != NULL)
|
||||
free(d_there_file);
|
||||
|
||||
return d_there;
|
||||
}
|
||||
|
||||
@@ -1120,10 +1150,10 @@ void init_operating_dir(void)
|
||||
* so that tab completion will work. */
|
||||
bool check_operating_dir(const char *currpath, bool allow_tabcomp)
|
||||
{
|
||||
/* The char *full_operating_dir is global for mem cleanup. It
|
||||
* should have already been initialized by init_operating_dir().
|
||||
* Also, a relative operating directory path will only be handled
|
||||
* properly if this is done. */
|
||||
/* full_operating_dir is global for memory cleanup. It should have
|
||||
* already been initialized by init_operating_dir(). Also, a
|
||||
* relative operating directory path will only be handled properly
|
||||
* if this is done. */
|
||||
|
||||
char *fullpath;
|
||||
bool retval = FALSE;
|
||||
@@ -1137,9 +1167,9 @@ bool check_operating_dir(const char *currpath, bool allow_tabcomp)
|
||||
|
||||
fullpath = get_full_path(currpath);
|
||||
|
||||
/* fullpath == NULL means some directory in the path doesn't exist
|
||||
* or is unreadable. If allow_tabcomp is FALSE, then currpath is
|
||||
* what the user typed somewhere. We don't want to report a
|
||||
/* If fullpath is NULL, it means some directory in the path doesn't
|
||||
* exist or is unreadable. If allow_tabcomp is FALSE, then currpath
|
||||
* is what the user typed somewhere. We don't want to report a
|
||||
* non-existent directory as being outside the operating directory,
|
||||
* so we return FALSE. If allow_tabcomp is TRUE, then currpath
|
||||
* exists, but is not executable. So we say it isn't in the
|
||||
@@ -1220,28 +1250,27 @@ int copy_file(FILE *inn, FILE *out)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Write a file out. If f_open isn't NULL, we assume that it is a
|
||||
* stream associated with the file, and we don't try to open it
|
||||
/* Write a file out to disk. If f_open isn't NULL, we assume that it is
|
||||
* a stream associated with the file, and we don't try to open it
|
||||
* ourselves. If tmp is TRUE, we set the umask to disallow anyone else
|
||||
* from accessing the file, we don't set the filename to its name, and
|
||||
* we don't print out how many lines we wrote on the statusbar.
|
||||
*
|
||||
* tmp means we are writing a temporary file in a secure fashion. We
|
||||
* use it when spell checking or dumping the file on an error.
|
||||
* use it when spell checking or dumping the file on an error. If
|
||||
* append is APPEND, it means we are appending instead of overwriting.
|
||||
* If append is PREPEND, it means we are prepending instead of
|
||||
* overwriting. If nonamechange is TRUE, we don't change the current
|
||||
* filename. nonamechange is ignored if tmp is FALSE, we're appending,
|
||||
* or we're prepending.
|
||||
*
|
||||
* append == APPEND means we are appending instead of overwriting.
|
||||
* append == PREPEND means we are prepending instead of overwriting.
|
||||
*
|
||||
* nonamechange means don't change the current filename. It is ignored
|
||||
* if tmp is FALSE or if we're appending/prepending.
|
||||
*
|
||||
* Return 0 on success or -1 on error. */
|
||||
int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
* Return TRUE on success or FALSE on error. */
|
||||
bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
append, bool nonamechange)
|
||||
{
|
||||
int retval = -1;
|
||||
bool retval = FALSE;
|
||||
/* Instead of returning in this function, you should always
|
||||
* merely set retval and then goto cleanup_and_exit. */
|
||||
* set retval and then goto cleanup_and_exit. */
|
||||
size_t lineswritten = 0;
|
||||
const filestruct *fileptr = openfile->fileage;
|
||||
int fd;
|
||||
@@ -1541,12 +1570,13 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
while (fileptr != NULL) {
|
||||
size_t data_len = strlen(fileptr->data), size;
|
||||
|
||||
/* Newlines to nulls, just before we write to disk. */
|
||||
/* Convert newlines to nulls, just before we write to disk. */
|
||||
sunder(fileptr->data);
|
||||
|
||||
size = fwrite(fileptr->data, sizeof(char), data_len, f);
|
||||
|
||||
/* Nulls to newlines; data_len is the string's real length. */
|
||||
/* Convert nulls to newlines. data_len is the string's real
|
||||
* length. */
|
||||
unsunder(fileptr->data, data_len);
|
||||
|
||||
if (size < data_len) {
|
||||
@@ -1655,21 +1685,23 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
titlebar(NULL);
|
||||
}
|
||||
|
||||
retval = 0;
|
||||
retval = TRUE;
|
||||
|
||||
cleanup_and_exit:
|
||||
free(realname);
|
||||
free(tempname);
|
||||
if (tempname != NULL)
|
||||
free(tempname);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Write a marked selection from a file out. */
|
||||
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
/* Write a marked selection from a file out to disk. Return TRUE on
|
||||
* success or FALSE on error. */
|
||||
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
append_type append)
|
||||
{
|
||||
int retval = -1;
|
||||
bool retval;
|
||||
bool old_modified = openfile->modified;
|
||||
/* write_file() unsets the modified flag. */
|
||||
bool added_magicline = FALSE;
|
||||
@@ -1714,16 +1746,17 @@ int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
/* Write the current file to disk. If the mark is on, write the current
|
||||
* marked selection to disk. If exiting is TRUE, write the file to disk
|
||||
* regardless of whether the mark is on, and without prompting if the
|
||||
* TEMP_FILE flag is set. */
|
||||
int do_writeout(bool exiting)
|
||||
* TEMP_FILE flag is set. Return TRUE on success or FALSE on error. */
|
||||
bool do_writeout(bool exiting)
|
||||
{
|
||||
int i, retval = 0;
|
||||
int i;
|
||||
append_type append = OVERWRITE;
|
||||
char *ans;
|
||||
/* The last answer the user typed on the statusbar. */
|
||||
/* The last answer the user typed at the statusbar prompt. */
|
||||
#ifdef NANO_EXTRA
|
||||
static bool did_credits = FALSE;
|
||||
#endif
|
||||
bool retval = FALSE;
|
||||
|
||||
currshortcut = writefile_list;
|
||||
|
||||
@@ -1732,13 +1765,13 @@ int do_writeout(bool exiting)
|
||||
FALSE);
|
||||
|
||||
/* Write succeeded. */
|
||||
if (retval == 0)
|
||||
if (retval)
|
||||
return retval;
|
||||
}
|
||||
|
||||
ans = mallocstrcpy(NULL,
|
||||
#ifndef NANO_TINY
|
||||
(openfile->mark_set && !exiting) ? "" :
|
||||
(!exiting && openfile->mark_set) ? "" :
|
||||
#endif
|
||||
openfile->filename);
|
||||
|
||||
@@ -1753,7 +1786,7 @@ int do_writeout(bool exiting)
|
||||
|
||||
backupstr = ISSET(BACKUP_FILE) ? _(" [Backup]") : "";
|
||||
|
||||
if (openfile->mark_set && !exiting)
|
||||
if (!exiting && openfile->mark_set)
|
||||
msg = (append == PREPEND) ?
|
||||
_("Prepend Selection to File") : (append == APPEND) ?
|
||||
_("Append Selection to File") :
|
||||
@@ -1784,9 +1817,11 @@ int do_writeout(bool exiting)
|
||||
#endif
|
||||
);
|
||||
|
||||
if (i < 0) {
|
||||
/* If the filename or command begins with a newline (i.e. an
|
||||
* encoded null), treat it as though it's blank. */
|
||||
if (i < 0 || answer[0] == '\n') {
|
||||
statusbar(_("Cancelled"));
|
||||
retval = -1;
|
||||
retval = FALSE;
|
||||
break;
|
||||
} else {
|
||||
ans = mallocstrcpy(ans, answer);
|
||||
@@ -1798,12 +1833,9 @@ int do_writeout(bool exiting)
|
||||
if (tmp == NULL)
|
||||
continue;
|
||||
|
||||
/* We have a file now. Indicate this. */
|
||||
free(answer);
|
||||
answer = tmp;
|
||||
|
||||
/* We have a file now. Get out of the statusbar prompt
|
||||
* cleanly. */
|
||||
do_prompt_abort();
|
||||
} else
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#ifndef NANO_TINY
|
||||
@@ -1843,47 +1875,82 @@ int do_writeout(bool exiting)
|
||||
strcasecmp(answer, "zzy") == 0) {
|
||||
do_credits();
|
||||
did_credits = TRUE;
|
||||
retval = -1;
|
||||
retval = FALSE;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if (append == OVERWRITE && strcmp(answer,
|
||||
openfile->filename) != 0) {
|
||||
|
||||
if (append == OVERWRITE) {
|
||||
size_t answer_len = strlen(answer);
|
||||
bool name_exists, different_name;
|
||||
char *full_answer, *full_filename;
|
||||
struct stat st;
|
||||
|
||||
if (!stat(answer, &st)) {
|
||||
i = do_yesno_prompt(FALSE,
|
||||
_("File exists, OVERWRITE ? "));
|
||||
if (i == 0 || i == -1)
|
||||
continue;
|
||||
/* If we're using restricted mode, we aren't allowed to
|
||||
* change the name of a file once it has one, because
|
||||
* that would allow reading from or writing to files not
|
||||
* specified on the command line. In this case, don't
|
||||
* bother showing the "Different Name" prompt. */
|
||||
} else if (!ISSET(RESTRICTED) &&
|
||||
/* Convert newlines to nulls, just before we get the
|
||||
* full path. */
|
||||
sunder(answer);
|
||||
|
||||
name_exists = (stat(answer, &st) != -1);
|
||||
full_answer = get_full_path(answer);
|
||||
full_filename = get_full_path(openfile->filename);
|
||||
different_name = (strcmp((full_answer == NULL) ?
|
||||
answer : full_answer, (full_filename == NULL) ?
|
||||
openfile->filename : full_filename) != 0);
|
||||
|
||||
/* Convert nulls to newlines. answer_len is the
|
||||
* string's real length. */
|
||||
unsunder(answer, answer_len);
|
||||
|
||||
if (full_filename != NULL)
|
||||
free(full_filename);
|
||||
if (full_answer != NULL)
|
||||
free(full_answer);
|
||||
|
||||
if (different_name) {
|
||||
if (name_exists) {
|
||||
/* If we're using restricted mode, we aren't
|
||||
* allowed to save a new file under the name of
|
||||
* an existing file. */
|
||||
if (ISSET(RESTRICTED))
|
||||
continue;
|
||||
|
||||
i = do_yesno_prompt(FALSE,
|
||||
_("File exists, OVERWRITE ? "));
|
||||
if (i == 0 || i == -1)
|
||||
continue;
|
||||
/* If we're using restricted mode, we aren't allowed
|
||||
* to change the name of a file once it has one,
|
||||
* because that would allow reading from or writing
|
||||
* to files not specified on the command line. */
|
||||
} else if (!ISSET(RESTRICTED) &&
|
||||
openfile->filename[0] != '\0'
|
||||
#ifndef NANO_TINY
|
||||
&& (exiting || !openfile->mark_set)
|
||||
#endif
|
||||
) {
|
||||
i = do_yesno_prompt(FALSE,
|
||||
_("Save file under DIFFERENT NAME ? "));
|
||||
if (i == 0 || i == -1)
|
||||
continue;
|
||||
i = do_yesno_prompt(FALSE,
|
||||
_("Save file under DIFFERENT NAME ? "));
|
||||
if (i == 0 || i == -1)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Convert newlines to nulls, just before we save the
|
||||
* file. */
|
||||
sunder(answer);
|
||||
align(&answer);
|
||||
|
||||
/* Here's where we allow the selected text to be written to
|
||||
* a separate file. If we're using restricted mode, this is
|
||||
* disabled since it allows reading from or writing to files
|
||||
* not specified on the command line. */
|
||||
if (!ISSET(RESTRICTED) && !exiting && openfile->mark_set)
|
||||
retval = write_marked_file(answer, NULL, FALSE, append);
|
||||
else
|
||||
#endif /* !NANO_TINY */
|
||||
retval = write_file(answer, NULL, FALSE, append, FALSE);
|
||||
* disabled, since it allows reading from or writing to
|
||||
* files not specified on the command line. */
|
||||
retval =
|
||||
#ifndef NANO_TINY
|
||||
(!ISSET(RESTRICTED) && !exiting && openfile->mark_set) ?
|
||||
write_marked_file(answer, NULL, FALSE, append) :
|
||||
#endif
|
||||
write_file(answer, NULL, FALSE, append, FALSE);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1983,15 +2050,19 @@ void free_chararray(char **array, size_t len)
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
/* Is the given file a directory? */
|
||||
int is_dir(const char *buf)
|
||||
/* Is the given path a directory? */
|
||||
bool is_dir(const char *buf)
|
||||
{
|
||||
char *dirptr = real_dir_from_tilde(buf);
|
||||
char *dirptr;
|
||||
struct stat fileinfo;
|
||||
int retval = (stat(dirptr, &fileinfo) != -1 &&
|
||||
S_ISDIR(fileinfo.st_mode));
|
||||
bool retval;
|
||||
|
||||
assert(buf != NULL && dirptr != buf);
|
||||
assert(buf != NULL);
|
||||
|
||||
dirptr = real_dir_from_tilde(buf);
|
||||
|
||||
retval = (stat(dirptr, &fileinfo) != -1 &&
|
||||
S_ISDIR(fileinfo.st_mode));
|
||||
|
||||
free(dirptr);
|
||||
|
||||
@@ -2217,22 +2288,22 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
free(match2_mb);
|
||||
|
||||
mzero = charalloc(lastslash_len + common_len + 1);
|
||||
sprintf(mzero, "%.*s%.*s", lastslash_len, buf, common_len,
|
||||
matches[0]);
|
||||
|
||||
strncpy(mzero, buf, lastslash_len);
|
||||
strncpy(mzero + lastslash_len, matches[0], common_len);
|
||||
|
||||
common_len += lastslash_len;
|
||||
mzero[common_len] = '\0';
|
||||
|
||||
assert(common_len >= *place);
|
||||
|
||||
if (num_matches == 1 && is_dir(mzero)) {
|
||||
mzero[common_len] = '/';
|
||||
common_len++;
|
||||
mzero[common_len++] = '/';
|
||||
|
||||
assert(common_len > *place);
|
||||
}
|
||||
|
||||
if (num_matches > 1 && (common_len != *place ||
|
||||
*lastwastab == FALSE))
|
||||
if (num_matches > 1 && (common_len != *place || !*lastwastab))
|
||||
beep();
|
||||
|
||||
/* If there is more of a match to display on the statusbar, show
|
||||
@@ -2248,7 +2319,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
*place + 1);
|
||||
strncpy(buf, mzero, common_len);
|
||||
*place = common_len;
|
||||
} else if (*lastwastab == FALSE || num_matches < 2)
|
||||
} else if (!*lastwastab || num_matches < 2)
|
||||
*lastwastab = TRUE;
|
||||
else {
|
||||
int longest_name = 0, columns, editline = 0;
|
||||
@@ -2273,7 +2344,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
|
||||
assert(longest_name <= COLS - 1);
|
||||
|
||||
/* Each column will be (longest_name + 2) columns wide, i.e,
|
||||
/* Each column will be (longest_name + 2) columns wide, i.e.
|
||||
* two spaces between columns, except that there will be
|
||||
* only one space after the last column. */
|
||||
columns = (COLS + 1) / (longest_name + 2);
|
||||
@@ -2319,7 +2390,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
|
||||
/* Only refresh the edit window if we don't have a list of filename
|
||||
* matches on it. */
|
||||
if (*list == FALSE)
|
||||
if (!*list)
|
||||
refresh_func();
|
||||
|
||||
/* Enable el cursor. */
|
||||
@@ -2344,8 +2415,9 @@ const char *tail(const char *foo)
|
||||
}
|
||||
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
/* Return $HOME/.nano_history, or NULL if we can't find the homedir.
|
||||
* The string is dynamically allocated, and should be freed. */
|
||||
/* Return $HOME/.nano_history, or NULL if we can't find the home
|
||||
* directory. The string is dynamically allocated, and should be
|
||||
* freed. */
|
||||
char *histfilename(void)
|
||||
{
|
||||
char *nanohist = NULL;
|
||||
@@ -2357,6 +2429,7 @@ char *histfilename(void)
|
||||
strcpy(nanohist, homedir);
|
||||
strcpy(nanohist + homelen, "/.nano_history");
|
||||
}
|
||||
|
||||
return nanohist;
|
||||
}
|
||||
|
||||
@@ -2381,9 +2454,9 @@ void load_history(void)
|
||||
;
|
||||
}
|
||||
} else {
|
||||
/* Load a history (first the search history, then the
|
||||
* replace history) from oldest to newest. Assume the last
|
||||
* history entry is a blank line. */
|
||||
/* Load a history list (first the search history, then the
|
||||
* replace history) from the oldest entry to the newest.
|
||||
* Assume the last history entry is a blank line. */
|
||||
filestruct **history = &search_history;
|
||||
char *line = NULL;
|
||||
size_t buflen = 0;
|
||||
@@ -2415,8 +2488,8 @@ bool writehist(FILE *hist, filestruct *h)
|
||||
{
|
||||
filestruct *p;
|
||||
|
||||
/* Write history from oldest to newest. Assume the last history
|
||||
* entry is a blank line. */
|
||||
/* Write a history list from the oldest entry to the newest. Assume
|
||||
* the last history entry is a blank line. */
|
||||
for (p = h; p != NULL; p = p->next) {
|
||||
size_t p_len = strlen(p->data);
|
||||
|
||||
|
||||
525
src/global.c
525
src/global.c
File diff suppressed because it is too large
Load Diff
133
src/help.c
133
src/help.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* help.c *
|
||||
* *
|
||||
* Copyright (C) 2000-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -32,25 +32,28 @@
|
||||
static char *help_text = NULL;
|
||||
/* The text displayed in the help window. */
|
||||
|
||||
/* Our dynamic, shortcut list-compliant help function. refresh_func is
|
||||
* the function we will call to refresh the edit 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))
|
||||
{
|
||||
int kbinput = ERR;
|
||||
bool meta_key, func_key, old_no_help = ISSET(NO_HELP);
|
||||
bool abort = FALSE;
|
||||
/* Whether we should abort the help browser. */
|
||||
size_t line = 0;
|
||||
/* The line number in help_text of the first displayed help
|
||||
* line. This variable is zero-based. */
|
||||
size_t last_line = 0;
|
||||
/* The line number in help_text of the last help line. This
|
||||
* variable is zero-based. */
|
||||
int kbinput = ERR;
|
||||
bool meta_key, func_key;
|
||||
bool old_no_help = ISSET(NO_HELP);
|
||||
#ifndef DISABLE_MOUSE
|
||||
const shortcut *oldshortcut = currshortcut;
|
||||
/* We will set currshortcut to allow clicking on the help
|
||||
* screen's shortcut list. */
|
||||
/* The current shortcut list. */
|
||||
#endif
|
||||
const char *ptr;
|
||||
/* The current line of the help text. */
|
||||
size_t old_line = (size_t)-1;
|
||||
/* The line we were on before the current line. */
|
||||
|
||||
curs_set(0);
|
||||
blank_edit();
|
||||
@@ -76,6 +79,7 @@ void do_help(void (*refresh_func)(void))
|
||||
}
|
||||
|
||||
bottombars(help_list);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
/* Get the last line of the help text. */
|
||||
ptr = help_text;
|
||||
@@ -88,23 +92,52 @@ void do_help(void (*refresh_func)(void))
|
||||
if (last_line > 0)
|
||||
last_line--;
|
||||
|
||||
do {
|
||||
while (!abort) {
|
||||
size_t i;
|
||||
/* Generic loop variable. */
|
||||
size_t old_line = line;
|
||||
/* We redisplay the help only if it moved. */
|
||||
|
||||
ptr = help_text;
|
||||
/* Display the help text if we don't have a key, or if the help
|
||||
* text has moved. */
|
||||
if (kbinput == ERR || line != old_line) {
|
||||
blank_edit();
|
||||
|
||||
ptr = help_text;
|
||||
|
||||
/* Calculate where in the text we should be, based on the
|
||||
* page. */
|
||||
for (i = 0; i < line; i++) {
|
||||
ptr += help_line_len(ptr);
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
|
||||
for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
|
||||
size_t j = help_line_len(ptr);
|
||||
|
||||
mvwaddnstr(edit, i, 0, ptr, j);
|
||||
ptr += j;
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
wnoutrefresh(edit);
|
||||
|
||||
old_line = line;
|
||||
|
||||
kbinput = get_kbinput(edit, &meta_key, &func_key);
|
||||
parse_help_input(&kbinput, &meta_key, &func_key);
|
||||
|
||||
switch (kbinput) {
|
||||
#ifndef DISABLE_MOUSE
|
||||
case KEY_MOUSE:
|
||||
{
|
||||
int mouse_x, mouse_y;
|
||||
|
||||
get_mouseinput(&mouse_x, &mouse_y, TRUE);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
/* Redraw the screen. */
|
||||
case NANO_REFRESH_KEY:
|
||||
total_redraw();
|
||||
break;
|
||||
@@ -115,7 +148,7 @@ void do_help(void (*refresh_func)(void))
|
||||
line = 0;
|
||||
break;
|
||||
case NANO_NEXTPAGE_KEY:
|
||||
if (line + (editwinrows - 2) <= last_line)
|
||||
if (line + (editwinrows - 1) < last_line)
|
||||
line += editwinrows - 2;
|
||||
break;
|
||||
case NANO_PREVLINE_KEY:
|
||||
@@ -123,48 +156,25 @@ void do_help(void (*refresh_func)(void))
|
||||
line--;
|
||||
break;
|
||||
case NANO_NEXTLINE_KEY:
|
||||
if (line + editwinrows <= last_line)
|
||||
if (line + (editwinrows - 1) < last_line)
|
||||
line++;
|
||||
break;
|
||||
case NANO_FIRSTLINE_ALTKEY:
|
||||
case NANO_FIRSTLINE_METAKEY:
|
||||
if (meta_key)
|
||||
line = 0;
|
||||
break;
|
||||
case NANO_LASTLINE_ALTKEY:
|
||||
case NANO_LASTLINE_METAKEY:
|
||||
if (meta_key) {
|
||||
if (line + (editwinrows - 1) < last_line)
|
||||
line = last_line - (editwinrows - 1);
|
||||
}
|
||||
break;
|
||||
/* Abort the help browser. */
|
||||
case NANO_EXIT_KEY:
|
||||
abort = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((kbinput != ERR && line == old_line) || kbinput ==
|
||||
NANO_REFRESH_KEY)
|
||||
goto skip_redisplay;
|
||||
|
||||
blank_edit();
|
||||
|
||||
/* Calculate where in the text we should be, based on the
|
||||
* page. */
|
||||
for (i = 0; i < line; i++) {
|
||||
ptr += help_line_len(ptr);
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
|
||||
for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
|
||||
size_t j = help_line_len(ptr);
|
||||
|
||||
mvwaddnstr(edit, i, 0, ptr, j);
|
||||
ptr += j;
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
|
||||
skip_redisplay:
|
||||
kbinput = get_kbinput(edit, &meta_key, &func_key);
|
||||
parse_help_input(&kbinput, &meta_key, &func_key);
|
||||
} while (kbinput != NANO_EXIT_KEY);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
currshortcut = oldshortcut;
|
||||
@@ -345,7 +355,7 @@ void help_init(void)
|
||||
#endif /* !NANO_TINY */
|
||||
else {
|
||||
/* Default to the main help list. */
|
||||
htx[0] = N_(" nano help text\n\n "
|
||||
htx[0] = N_("Main nano help text\n\n "
|
||||
"The nano editor is designed to emulate the "
|
||||
"functionality and ease-of-use of the UW Pico text "
|
||||
"editor. There are four main sections of the editor. "
|
||||
@@ -354,15 +364,16 @@ void help_init(void)
|
||||
"has been modified. Next is the main editor window "
|
||||
"showing the file being edited. The status line is "
|
||||
"the third line from the bottom and shows important "
|
||||
"messages. The bottom two lines show the most "
|
||||
"commonly used shortcuts in the editor.\n\n");
|
||||
htx[1] = N_(" The notation for shortcuts is as follows: "
|
||||
"Control-key sequences are notated with a caret (^) "
|
||||
"symbol and can be entered either by using the Control "
|
||||
"(Ctrl) key or pressing the Escape (Esc) key twice. "
|
||||
"Escape-key sequences are notated with the Meta (M) "
|
||||
"symbol and can be entered using either the Esc, Alt, "
|
||||
"or Meta key depending on your keyboard setup. ");
|
||||
"messages. ");
|
||||
htx[1] = N_("The bottom two lines show the most commonly used "
|
||||
"shortcuts in the editor.\n\n The notation for "
|
||||
"shortcuts is as follows: Control-key sequences are "
|
||||
"notated with a caret (^) symbol and can be entered "
|
||||
"either by using the Control (Ctrl) key or pressing "
|
||||
"the Escape (Esc) key twice. Escape-key sequences are "
|
||||
"notated with the Meta (M-) symbol and can be entered "
|
||||
"using either the Esc, Alt, or Meta key depending on "
|
||||
"your keyboard setup. ");
|
||||
htx[2] = N_("Also, pressing Esc twice and then typing a "
|
||||
"three-digit decimal number from 000 to 255 will enter "
|
||||
"the character with the corresponding value. The "
|
||||
@@ -482,7 +493,7 @@ void help_init(void)
|
||||
}
|
||||
/* Yucky sentinel values that we can't handle a better
|
||||
* way. */
|
||||
if (s->metaval == NANO_ALT_SPACE && entries == 1) {
|
||||
if (s->metaval == NANO_META_SPACE && entries == 1) {
|
||||
char *space_ptr = display_string(_("Space"), 0, 13,
|
||||
FALSE);
|
||||
|
||||
@@ -564,7 +575,7 @@ void parse_help_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||
{
|
||||
get_shortcut(help_list, kbinput, meta_key, func_key);
|
||||
|
||||
if (*meta_key == FALSE) {
|
||||
if (!*meta_key) {
|
||||
switch (*kbinput) {
|
||||
/* For consistency with the file browser. */
|
||||
case ' ':
|
||||
@@ -575,6 +586,8 @@ void parse_help_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||
break;
|
||||
/* Cancel is equivalent to Exit here. */
|
||||
case NANO_CANCEL_KEY:
|
||||
case 'E':
|
||||
case 'e':
|
||||
*kbinput = NANO_EXIT_KEY;
|
||||
break;
|
||||
}
|
||||
@@ -596,8 +609,8 @@ size_t help_line_len(const char *ptr)
|
||||
while (*(ptr + retval) != '\0' && *(ptr + retval) != '\n')
|
||||
retval += move_mbright(ptr + retval, 0);
|
||||
|
||||
/* If the entire line doesn't go more than 1 column beyond where we
|
||||
* tried to break it, we should display it as-is. Otherwise, we
|
||||
/* 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;
|
||||
|
||||
157
src/move.c
157
src/move.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* move.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -85,7 +85,7 @@ void do_page_up(void)
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window up a page. */
|
||||
edit_scroll(UP, editwinrows - 2);
|
||||
edit_scroll(UP_DIR, editwinrows - 2);
|
||||
}
|
||||
|
||||
/* Move down one page. */
|
||||
@@ -121,7 +121,7 @@ void do_page_down(void)
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window down a page. */
|
||||
edit_scroll(DOWN, editwinrows - 2);
|
||||
edit_scroll(DOWN_DIR, editwinrows - 2);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -272,8 +272,7 @@ bool do_next_word(bool allow_punct, bool allow_update)
|
||||
|
||||
free(char_mb);
|
||||
|
||||
/* If we haven't found it, leave the cursor at the end of the
|
||||
* file. */
|
||||
/* If we haven't found it, move to the end of the file. */
|
||||
if (openfile->current == NULL)
|
||||
openfile->current = openfile->filebot;
|
||||
|
||||
@@ -371,8 +370,7 @@ bool do_prev_word(bool allow_punct, bool allow_update)
|
||||
}
|
||||
}
|
||||
|
||||
/* If we haven't found it, leave the cursor at the beginning of the
|
||||
* file. */
|
||||
/* 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
|
||||
@@ -471,11 +469,23 @@ void do_end(void)
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
/* Move up one line. */
|
||||
void do_up(void)
|
||||
/* If scroll_only is FALSE, move up one line. If scroll_only is TRUE,
|
||||
* scroll up one line without scrolling the cursor. */
|
||||
void do_up(
|
||||
#ifndef NANO_TINY
|
||||
bool scroll_only
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
)
|
||||
{
|
||||
/* If we're at the top of the file, get out. */
|
||||
if (openfile->current == openfile->fileage)
|
||||
/* If we're at the top of the file, or if scroll_only is TRUE and
|
||||
* the top of the file is onscreen, get out. */
|
||||
if (openfile->current == openfile->fileage
|
||||
#ifndef NANO_TINY
|
||||
|| (scroll_only && openfile->edittop == openfile->fileage)
|
||||
#endif
|
||||
)
|
||||
return;
|
||||
|
||||
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
||||
@@ -485,47 +495,60 @@ void do_up(void)
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* If we're on the first line of the edit window, scroll the edit
|
||||
* window up one line if we're in smooth scrolling mode, or up half
|
||||
* a page if we're not. */
|
||||
if (openfile->current_y == 0)
|
||||
edit_scroll(UP,
|
||||
/* If scroll_only is FALSE and if we're on the first line of the
|
||||
* edit window, scroll the edit window up one line if we're in
|
||||
* smooth scrolling mode, or up half a page if we're not. If
|
||||
* scroll_only is TRUE, scroll the edit window up one line
|
||||
* unconditionally. */
|
||||
if (openfile->current_y == 0
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
|| scroll_only
|
||||
#endif
|
||||
)
|
||||
edit_scroll(UP_DIR,
|
||||
#ifndef NANO_TINY
|
||||
(ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
/* Update the line we were on before and the line we're on now. The
|
||||
* former needs to be redrawn if we're not on the first page, and
|
||||
* the latter needs to be drawn unconditionally. */
|
||||
else {
|
||||
|
||||
/* If we're below the first line of the edit window, update the
|
||||
* line we were on before and the line we're on now. The former
|
||||
* 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))
|
||||
update_line(openfile->current->next, 0);
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
}
|
||||
|
||||
/* Move up one line. */
|
||||
void do_up_void(void)
|
||||
{
|
||||
do_up(
|
||||
#ifndef NANO_TINY
|
||||
FALSE
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Scroll up one line without scrolling the cursor. */
|
||||
void do_scroll_up(void)
|
||||
{
|
||||
/* If the top of the file is onscreen, get out. */
|
||||
if (openfile->edittop == openfile->fileage)
|
||||
return;
|
||||
|
||||
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
||||
|
||||
/* Move the current line of the edit window up. */
|
||||
openfile->current = openfile->current->prev;
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window up one line. */
|
||||
edit_scroll(UP, 1);
|
||||
do_up(TRUE);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
#endif
|
||||
|
||||
/* Move down one line. */
|
||||
void do_down(void)
|
||||
/* If scroll_only is FALSE, move down one line. If scroll_only is TRUE,
|
||||
* scroll down one line without scrolling the cursor. */
|
||||
void do_down(
|
||||
#ifndef NANO_TINY
|
||||
bool scroll_only
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
)
|
||||
{
|
||||
/* If we're at the bottom of the file, get out. */
|
||||
if (openfile->current == openfile->filebot)
|
||||
@@ -538,44 +561,50 @@ void do_down(void)
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* If we're on the last line of the edit window, scroll the edit
|
||||
* window down one line if we're in smooth scrolling mode, or down
|
||||
* half a page if we're not. */
|
||||
if (openfile->current_y == editwinrows - 1)
|
||||
edit_scroll(DOWN,
|
||||
/* If scroll_only is FALSE and if we're on the first line of the
|
||||
* edit window, scroll the edit window down one line if we're in
|
||||
* smooth scrolling mode, or down half a page if we're not. If
|
||||
* scroll_only is TRUE, scroll the edit window down one line
|
||||
* unconditionally. */
|
||||
if (openfile->current_y == editwinrows - 1
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
|| scroll_only
|
||||
#endif
|
||||
)
|
||||
edit_scroll(DOWN_DIR,
|
||||
#ifndef NANO_TINY
|
||||
(ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
/* Update the line we were on before and the line we're on now. The
|
||||
* former needs to be redrawn if we're not on the first page, and
|
||||
* the latter needs to be drawn unconditionally. */
|
||||
else {
|
||||
|
||||
/* If we're above the last line of the edit window, update the line
|
||||
* we were on before and the line we're on now. The former needs to
|
||||
* be redrawn if we're not on the first page, and the latter needs
|
||||
* to be drawn unconditionally. */
|
||||
if (openfile->current_y < editwinrows - 1) {
|
||||
if (need_vertical_update(0))
|
||||
update_line(openfile->current->prev, 0);
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
}
|
||||
|
||||
/* Move down one line. */
|
||||
void do_down_void(void)
|
||||
{
|
||||
do_down(
|
||||
#ifndef NANO_TINY
|
||||
FALSE
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Scroll down one line without scrolling the cursor. */
|
||||
void do_scroll_down(void)
|
||||
{
|
||||
/* If we're at the bottom of the file, get out. */
|
||||
if (openfile->current == openfile->filebot)
|
||||
return;
|
||||
|
||||
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
|
||||
|
||||
/* Move the current line of the edit window down. */
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window down one line. */
|
||||
edit_scroll(DOWN, 1);
|
||||
do_down(TRUE);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
#endif
|
||||
|
||||
/* Move left one character. */
|
||||
void do_left(void)
|
||||
@@ -586,7 +615,7 @@ void do_left(void)
|
||||
openfile->current_x = move_mbleft(openfile->current->data,
|
||||
openfile->current_x);
|
||||
else if (openfile->current != openfile->fileage) {
|
||||
do_up();
|
||||
do_up_void();
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
}
|
||||
|
||||
@@ -607,7 +636,7 @@ void do_right(void)
|
||||
openfile->current_x = move_mbright(openfile->current->data,
|
||||
openfile->current_x);
|
||||
else if (openfile->current != openfile->filebot) {
|
||||
do_down();
|
||||
do_down_void();
|
||||
openfile->current_x = 0;
|
||||
}
|
||||
|
||||
|
||||
112
src/nano.c
112
src/nano.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* nano.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -29,15 +29,16 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <locale.h>
|
||||
#include <termios.h>
|
||||
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
static bool no_rcfiles = FALSE;
|
||||
@@ -46,10 +47,10 @@ static bool no_rcfiles = FALSE;
|
||||
static struct termios oldterm;
|
||||
/* The user's original terminal settings. */
|
||||
static struct sigaction act;
|
||||
/* For all our fun signal handlers. */
|
||||
/* Used to set up all our fun signal handlers. */
|
||||
|
||||
/* Create a new filestruct node. Note that we specifically do not set
|
||||
* prevnode->next equal to the new line. */
|
||||
/* Create a new filestruct node. Note that we do not set prevnode->next
|
||||
* to the new line. */
|
||||
filestruct *make_new_node(filestruct *prevnode)
|
||||
{
|
||||
filestruct *newnode = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
@@ -167,8 +168,8 @@ void renumber(filestruct *fileptr)
|
||||
fileptr->lineno = ++line;
|
||||
}
|
||||
|
||||
/* Partition a filestruct so it begins at (top, top_x) and ends at (bot,
|
||||
* bot_x). */
|
||||
/* Partition a filestruct so that it begins at (top, top_x) and ends at
|
||||
* (bot, bot_x). */
|
||||
partition *partition_filestruct(filestruct *top, size_t top_x,
|
||||
filestruct *bot, size_t bot_x)
|
||||
{
|
||||
@@ -220,8 +221,8 @@ partition *partition_filestruct(filestruct *top, size_t top_x,
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Unpartition a filestruct so it begins at (fileage, 0) and ends at
|
||||
* (filebot, strlen(filebot->data)) again. */
|
||||
/* Unpartition a filestruct so that it begins at (fileage, 0) and ends
|
||||
* at (filebot, strlen(filebot->data)) again. */
|
||||
void unpartition_filestruct(partition **p)
|
||||
{
|
||||
char *tmp;
|
||||
@@ -519,19 +520,19 @@ void free_openfilestruct(openfilestruct *src)
|
||||
/* Display a warning about a key disabled in view mode. */
|
||||
void print_view_warning(void)
|
||||
{
|
||||
statusbar(_("Key illegal in VIEW mode"));
|
||||
statusbar(_("Key invalid in view mode"));
|
||||
}
|
||||
|
||||
/* What we do when we're all set to exit. */
|
||||
/* Make nano exit gracefully. */
|
||||
void finish(void)
|
||||
{
|
||||
/* Blank the statusbar (and shortcut list, if applicable), and move
|
||||
* the cursor to the last line of the screen. */
|
||||
if (!ISSET(NO_HELP))
|
||||
blank_bottombars();
|
||||
else
|
||||
blank_statusbar();
|
||||
|
||||
wrefresh(bottomwin);
|
||||
|
||||
endwin();
|
||||
|
||||
/* Restore the old terminal settings. */
|
||||
@@ -546,10 +547,11 @@ void finish(void)
|
||||
thanks_for_all_the_fish();
|
||||
#endif
|
||||
|
||||
/* Get out. */
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* Die (gracefully?). */
|
||||
/* Make nano die gracefully. */
|
||||
void die(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -604,15 +606,14 @@ void die_save_file(const char *die_filename)
|
||||
if (ISSET(RESTRICTED))
|
||||
return;
|
||||
|
||||
/* If we can't save, we have REAL bad problems, but we might as well
|
||||
* TRY. */
|
||||
/* If we can't save, we have really bad problems, but we might as
|
||||
* well try. */
|
||||
if (die_filename[0] == '\0')
|
||||
die_filename = "nano";
|
||||
|
||||
retval = get_next_filename(die_filename, ".save");
|
||||
if (retval[0] != '\0')
|
||||
failed = (write_file(retval, NULL, TRUE, OVERWRITE,
|
||||
TRUE) == -1);
|
||||
failed = !write_file(retval, NULL, TRUE, OVERWRITE, TRUE);
|
||||
|
||||
if (!failed)
|
||||
fprintf(stderr, _("\nBuffer written to %s\n"), retval);
|
||||
@@ -674,7 +675,7 @@ void disable_mouse_support(void)
|
||||
/* Enable mouse support. */
|
||||
void enable_mouse_support(void)
|
||||
{
|
||||
mousemask(BUTTON1_RELEASED, NULL);
|
||||
mousemask(ALL_MOUSE_EVENTS, NULL);
|
||||
mouseinterval(50);
|
||||
}
|
||||
|
||||
@@ -697,7 +698,7 @@ void mouse_init(void)
|
||||
|
||||
/* Print one usage string to the screen. This cuts down on duplicate
|
||||
* strings to translate, and leaves out the parts that shouldn't be
|
||||
* translatable (the flag names). */
|
||||
* translatable (i.e. the flag names). */
|
||||
void print_opt_full(const char *shortflag
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
, const char *longflag
|
||||
@@ -724,7 +725,7 @@ void print_opt_full(const char *shortflag
|
||||
/* Explain how to properly use nano and its command line options. */
|
||||
void usage(void)
|
||||
{
|
||||
printf(_("Usage: nano [OPTIONS] [[+LINE[,COLUMN]] FILE]...\n\n"));
|
||||
printf(_("Usage: nano [OPTIONS] [[+LINE,COLUMN] FILE]...\n\n"));
|
||||
printf(
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
_("Option\t\tGNU long option\t\tMeaning\n")
|
||||
@@ -733,7 +734,7 @@ void usage(void)
|
||||
#endif
|
||||
);
|
||||
print_opt("-h, -?", "--help", N_("Show this message"));
|
||||
print_opt(_("+LINE[,COLUMN]"), "",
|
||||
print_opt(_("+LINE,COLUMN"), "",
|
||||
N_("Start at line LINE, column COLUMN"));
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-A", "--smarthome", N_("Enable smart home key"));
|
||||
@@ -766,7 +767,7 @@ void usage(void)
|
||||
print_opt("-N", "--noconvert",
|
||||
N_("Don't convert files from DOS/Mac format"));
|
||||
#endif
|
||||
print_opt("-O", "--morespace", N_("Use more space for editing"));
|
||||
print_opt("-O", "--morespace", N_("Use one more line for editing"));
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
print_opt(_("-Q <str>"), _("--quotestr=<str>"),
|
||||
N_("Quoting string"));
|
||||
@@ -776,7 +777,7 @@ void usage(void)
|
||||
print_opt("-S", "--smooth", N_("Smooth scrolling"));
|
||||
#endif
|
||||
print_opt(_("-T <#cols>"), _("--tabsize=<#cols>"),
|
||||
N_("Set width of a tab in cols to #cols"));
|
||||
N_("Set width of a tab to #cols columns"));
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-U", "--quickblank", N_("Do quick statusbar blanking"));
|
||||
#endif
|
||||
@@ -788,7 +789,7 @@ void usage(void)
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
print_opt(_("-Y <str>"), _("--syntax=<str>"),
|
||||
N_("Syntax definition to use"));
|
||||
N_("Syntax definition to use for coloring"));
|
||||
#endif
|
||||
print_opt("-c", "--const", N_("Constantly show cursor position"));
|
||||
print_opt("-d", "--rebinddelete",
|
||||
@@ -811,7 +812,7 @@ void usage(void)
|
||||
N_("Preserve XON (^Q) and XOFF (^S) keys"));
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
print_opt(_("-r <#cols>"), _("--fill=<#cols>"),
|
||||
N_("Set fill cols to (wrap lines at) #cols"));
|
||||
N_("Set wrapping point at column #cols"));
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
print_opt(_("-s <prog>"), _("--speller=<prog>"),
|
||||
@@ -819,7 +820,7 @@ void usage(void)
|
||||
#endif
|
||||
print_opt("-t", "--tempfile",
|
||||
N_("Auto save on exit, don't prompt"));
|
||||
print_opt("-v", "--view", N_("View (read only) mode"));
|
||||
print_opt("-v", "--view", N_("View mode (read-only)"));
|
||||
#ifndef DISABLE_WRAPPING
|
||||
print_opt("-w", "--nowrap", N_("Don't wrap long lines"));
|
||||
#endif
|
||||
@@ -871,7 +872,7 @@ void version(void)
|
||||
#ifdef DISABLE_WRAPPING
|
||||
printf(" --disable-wrapping");
|
||||
#endif
|
||||
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
|
||||
#ifdef DISABLE_ROOTWRAPPING
|
||||
printf(" --disable-wrapping-as-root");
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
@@ -923,6 +924,11 @@ void nano_disabled_msg(void)
|
||||
statusbar(_("Sorry, support for this function has been disabled"));
|
||||
}
|
||||
|
||||
/* If the current file buffer has been modified, and the TEMP_FILE flag
|
||||
* isn't set, ask whether or not to save the file buffer. If the
|
||||
* TEMP_FILE flag is set, save it unconditionally. Then, if more than
|
||||
* one file buffer is open, close the current file buffer and switch to
|
||||
* the next one. If only one file buffer is open, exit from nano. */
|
||||
void do_exit(void)
|
||||
{
|
||||
int i;
|
||||
@@ -945,7 +951,7 @@ void do_exit(void)
|
||||
|
||||
/* If the user chose not to save, or if the user chose to save and
|
||||
* the save succeeded, we're ready to exit. */
|
||||
if (i == 0 || (i == 1 && do_writeout(TRUE) == 0)) {
|
||||
if (i == 0 || (i == 1 && do_writeout(TRUE))) {
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Exit only if there are no more open file buffers. */
|
||||
if (!close_buffer())
|
||||
@@ -1011,7 +1017,8 @@ RETSIGTYPE do_suspend(int signal)
|
||||
disable_mouse_support();
|
||||
#endif
|
||||
|
||||
/* Blank the screen, and move the cursor to the last line of it. */
|
||||
/* Blank the screen, and move the cursor to the last line of the
|
||||
* screen. */
|
||||
erase();
|
||||
move(LINES - 1, 0);
|
||||
refresh();
|
||||
@@ -1056,6 +1063,7 @@ RETSIGTYPE do_continue(int signal)
|
||||
|
||||
/* Redraw the contents of the windows that need it. */
|
||||
blank_statusbar();
|
||||
wnoutrefresh(bottomwin);
|
||||
total_refresh();
|
||||
#endif
|
||||
}
|
||||
@@ -1116,6 +1124,7 @@ RETSIGTYPE handle_sigwinch(int signal)
|
||||
|
||||
/* Redraw the contents of the windows that need it. */
|
||||
blank_statusbar();
|
||||
wnoutrefresh(bottomwin);
|
||||
currshortcut = main_list;
|
||||
total_refresh();
|
||||
|
||||
@@ -1322,7 +1331,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
if (allow_funcs) {
|
||||
/* If we got a mouse click and it was on a shortcut, read in the
|
||||
* shortcut character. */
|
||||
if (*func_key == TRUE && input == KEY_MOUSE) {
|
||||
if (*func_key && input == KEY_MOUSE) {
|
||||
if (do_mouse())
|
||||
input = get_kbinput(edit, meta_key, func_key);
|
||||
else {
|
||||
@@ -1360,9 +1369,8 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
|
||||
/* If we got a non-high-bit control key, a meta key sequence, or a
|
||||
* function key, and it's not a shortcut or toggle, throw it out. */
|
||||
if (*s_or_t == FALSE) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key == TRUE ||
|
||||
*func_key == TRUE) {
|
||||
if (!*s_or_t) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key || *func_key) {
|
||||
statusbar(_("Unknown Command"));
|
||||
beep();
|
||||
*meta_key = FALSE;
|
||||
@@ -1376,7 +1384,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
* it's a normal text character. Display the warning if we're
|
||||
* in view mode, or add the character to the input buffer if
|
||||
* we're not. */
|
||||
if (input != ERR && *s_or_t == FALSE) {
|
||||
if (input != ERR && !*s_or_t) {
|
||||
if (ISSET(VIEW_MODE))
|
||||
print_view_warning();
|
||||
else {
|
||||
@@ -1392,13 +1400,13 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
* output all the characters in the input buffer if it isn't
|
||||
* empty. Note that it should be empty if we're in view
|
||||
* mode. */
|
||||
if (*s_or_t == TRUE || get_key_buffer_len() == 0) {
|
||||
if (*s_or_t || get_key_buffer_len() == 0) {
|
||||
#ifndef DISABLE_WRAPPING
|
||||
/* If we got a shortcut or toggle, and it's not the shortcut
|
||||
* for verbatim input, turn off prepending of wrapped
|
||||
* text. */
|
||||
if (*s_or_t == TRUE && (!have_shortcut || s == NULL ||
|
||||
s->func != do_verbatim_input))
|
||||
if (*s_or_t && (!have_shortcut || s == NULL || s->func !=
|
||||
do_verbatim_input))
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
@@ -1550,8 +1558,8 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
current_len = strlen(openfile->current->data);
|
||||
|
||||
while (i < output_len) {
|
||||
/* If allow_cntrls is FALSE, filter out nulls and newlines,
|
||||
* since they're ASCII control characters. */
|
||||
/* If allow_cntrls is TRUE, convert nulls and newlines
|
||||
* properly. */
|
||||
if (allow_cntrls) {
|
||||
/* Null to newline, if needed. */
|
||||
if (output[i] == '\0')
|
||||
@@ -1576,7 +1584,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
continue;
|
||||
|
||||
/* If the NO_NEWLINES flag isn't set, when a character is
|
||||
* added to the magicline, it means we need a new magicline! */
|
||||
* added to the magicline, it means we need a new magicline. */
|
||||
if (!ISSET(NO_NEWLINES) && openfile->filebot ==
|
||||
openfile->current)
|
||||
new_magicline();
|
||||
@@ -1726,7 +1734,7 @@ int main(int argc, char **argv)
|
||||
if (locale != NULL && (strcasestr(locale, "UTF8") != NULL ||
|
||||
strcasestr(locale, "UTF-8") != NULL)) {
|
||||
#ifdef USE_SLANG
|
||||
SLutf8_enable(TRUE);
|
||||
SLutf8_enable(1);
|
||||
#endif
|
||||
utf8_init();
|
||||
}
|
||||
@@ -1740,9 +1748,9 @@ int main(int argc, char **argv)
|
||||
textdomain(PACKAGE);
|
||||
#endif
|
||||
|
||||
#if !defined(ENABLE_NANORC) && defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
|
||||
/* If we don't have rcfile support, we're root, and
|
||||
* --disable-wrapping-as-root is used, turn wrapping off. */
|
||||
#if !defined(ENABLE_NANORC) && defined(DISABLE_ROOTWRAPPING)
|
||||
/* If we don't have rcfile support, --disable-wrapping-as-root is
|
||||
* used, and we're root, turn wrapping off. */
|
||||
if (geteuid() == NANO_ROOT_UID)
|
||||
SET(NO_WRAP);
|
||||
#endif
|
||||
@@ -1919,7 +1927,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/* If the executable filename starts with 'r', we use restricted
|
||||
/* If the executable filename starts with 'r', enable restricted
|
||||
* mode. */
|
||||
if (*(tail(argv[0])) == 'r')
|
||||
SET(RESTRICTED);
|
||||
@@ -2005,7 +2013,9 @@ int main(int argc, char **argv)
|
||||
tabsize = tabsize_cpy;
|
||||
flags |= flags_cpy;
|
||||
}
|
||||
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
|
||||
#ifdef DISABLE_ROOTWRAPPING
|
||||
/* If we don't have any rcfiles, --disable-wrapping-as-root is used,
|
||||
* and we're root, turn wrapping off. */
|
||||
else if (geteuid() == NANO_ROOT_UID)
|
||||
SET(NO_WRAP);
|
||||
#endif
|
||||
@@ -2232,6 +2242,10 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Just in case we were at the statusbar prompt, make sure the
|
||||
* statusbar cursor position is reset. */
|
||||
do_prompt_abort();
|
||||
|
||||
/* If constant cursor position display is on, and there are no
|
||||
* keys waiting in the input buffer, display the current cursor
|
||||
* position on the statusbar. */
|
||||
|
||||
240
src/nano.h
240
src/nano.h
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* nano.h *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -29,7 +29,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef __TANDEM
|
||||
/* Tandem NonStop Kernel. */
|
||||
/* Tandem NonStop Kernel support. */
|
||||
#include <floss.h>
|
||||
#define NANO_ROOT_UID 65535
|
||||
#else
|
||||
@@ -50,7 +50,7 @@
|
||||
#define ISSET(bit) ((flags & bit) != 0)
|
||||
#define TOGGLE(bit) flags ^= bit
|
||||
|
||||
/* Macros for character allocation, etc. */
|
||||
/* Macros for character allocation and more. */
|
||||
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
|
||||
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
@@ -138,14 +138,8 @@
|
||||
#define getline ngetline
|
||||
#endif
|
||||
|
||||
/* If we don't have regex support, turn the color support off, as it
|
||||
* depends on the use of regexes. */
|
||||
#ifndef HAVE_REGEX_H
|
||||
#undef ENABLE_COLOR
|
||||
#endif
|
||||
|
||||
/* If we aren't using ncurses, turn the mouse support off, as it's
|
||||
* ncurses-specific. */
|
||||
/* If we aren't using ncurses with mouse support, turn the mouse support
|
||||
* off, as it's useless then. */
|
||||
#ifndef NCURSES_MOUSE_VERSION
|
||||
#define DISABLE_MOUSE 1
|
||||
#endif
|
||||
@@ -164,7 +158,7 @@ typedef enum {
|
||||
} append_type;
|
||||
|
||||
typedef enum {
|
||||
UP, DOWN
|
||||
UP_DIR, DOWN_DIR
|
||||
} scroll_dir;
|
||||
|
||||
typedef enum {
|
||||
@@ -297,11 +291,12 @@ typedef struct shortcut {
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help;
|
||||
/* The help file entry text for this function. */
|
||||
#endif
|
||||
bool blank_after;
|
||||
/* Whether there should be a blank line after the help entry
|
||||
* text for this function. */
|
||||
/* Key values that aren't used should be set to NANO_NO_KEY. */
|
||||
#endif
|
||||
/* Note: Key values that aren't used should be set to
|
||||
* NANO_NO_KEY. */
|
||||
int ctrlval;
|
||||
/* The special sentinel key or control key we want bound, if
|
||||
* any. */
|
||||
@@ -326,9 +321,11 @@ typedef struct toggle {
|
||||
const char *desc;
|
||||
/* The description of the toggle, e.g. "Cut to end"; we'll
|
||||
* append Enabled or Disabled to it. */
|
||||
#ifndef DISABLE_HELP
|
||||
bool blank_after;
|
||||
/* Whether there should be a blank line after the description of
|
||||
* the toggle. */
|
||||
#endif
|
||||
long flag;
|
||||
/* Which flag actually gets toggled. */
|
||||
struct toggle *next;
|
||||
@@ -415,54 +412,54 @@ typedef struct rcoption {
|
||||
#define NANO_CONTROL_8 127
|
||||
|
||||
/* Meta key sequences. */
|
||||
#define NANO_ALT_SPACE ' '
|
||||
#define NANO_ALT_LPARENTHESIS '('
|
||||
#define NANO_ALT_RPARENTHESIS ')'
|
||||
#define NANO_ALT_PLUS '+'
|
||||
#define NANO_ALT_COMMA ','
|
||||
#define NANO_ALT_MINUS '-'
|
||||
#define NANO_ALT_PERIOD '.'
|
||||
#define NANO_ALT_SLASH '/'
|
||||
#define NANO_ALT_0 '0'
|
||||
#define NANO_ALT_6 '6'
|
||||
#define NANO_ALT_9 '9'
|
||||
#define NANO_ALT_LCARET '<'
|
||||
#define NANO_ALT_EQUALS '='
|
||||
#define NANO_ALT_RCARET '>'
|
||||
#define NANO_ALT_QUESTION '?'
|
||||
#define NANO_ALT_BACKSLASH '\\'
|
||||
#define NANO_ALT_RBRACKET ']'
|
||||
#define NANO_ALT_CARET '^'
|
||||
#define NANO_ALT_UNDERSCORE '_'
|
||||
#define NANO_ALT_A 'a'
|
||||
#define NANO_ALT_B 'b'
|
||||
#define NANO_ALT_C 'c'
|
||||
#define NANO_ALT_D 'd'
|
||||
#define NANO_ALT_E 'e'
|
||||
#define NANO_ALT_F 'f'
|
||||
#define NANO_ALT_G 'g'
|
||||
#define NANO_ALT_H 'h'
|
||||
#define NANO_ALT_I 'i'
|
||||
#define NANO_ALT_J 'j'
|
||||
#define NANO_ALT_K 'k'
|
||||
#define NANO_ALT_L 'l'
|
||||
#define NANO_ALT_M 'm'
|
||||
#define NANO_ALT_N 'n'
|
||||
#define NANO_ALT_O 'o'
|
||||
#define NANO_ALT_P 'p'
|
||||
#define NANO_ALT_Q 'q'
|
||||
#define NANO_ALT_R 'r'
|
||||
#define NANO_ALT_S 's'
|
||||
#define NANO_ALT_T 't'
|
||||
#define NANO_ALT_U 'u'
|
||||
#define NANO_ALT_V 'v'
|
||||
#define NANO_ALT_W 'w'
|
||||
#define NANO_ALT_X 'x'
|
||||
#define NANO_ALT_Y 'y'
|
||||
#define NANO_ALT_Z 'z'
|
||||
#define NANO_ALT_LCURLYBRACKET '{'
|
||||
#define NANO_ALT_PIPE '|'
|
||||
#define NANO_ALT_RCURLYBRACKET '}'
|
||||
#define NANO_META_SPACE ' '
|
||||
#define NANO_META_LPARENTHESIS '('
|
||||
#define NANO_META_RPARENTHESIS ')'
|
||||
#define NANO_META_PLUS '+'
|
||||
#define NANO_META_COMMA ','
|
||||
#define NANO_META_MINUS '-'
|
||||
#define NANO_META_PERIOD '.'
|
||||
#define NANO_META_SLASH '/'
|
||||
#define NANO_META_0 '0'
|
||||
#define NANO_META_6 '6'
|
||||
#define NANO_META_9 '9'
|
||||
#define NANO_META_LCARET '<'
|
||||
#define NANO_META_EQUALS '='
|
||||
#define NANO_META_RCARET '>'
|
||||
#define NANO_META_QUESTION '?'
|
||||
#define NANO_META_BACKSLASH '\\'
|
||||
#define NANO_META_RBRACKET ']'
|
||||
#define NANO_META_CARET '^'
|
||||
#define NANO_META_UNDERSCORE '_'
|
||||
#define NANO_META_A 'a'
|
||||
#define NANO_META_B 'b'
|
||||
#define NANO_META_C 'c'
|
||||
#define NANO_META_D 'd'
|
||||
#define NANO_META_E 'e'
|
||||
#define NANO_META_F 'f'
|
||||
#define NANO_META_G 'g'
|
||||
#define NANO_META_H 'h'
|
||||
#define NANO_META_I 'i'
|
||||
#define NANO_META_J 'j'
|
||||
#define NANO_META_K 'k'
|
||||
#define NANO_META_L 'l'
|
||||
#define NANO_META_M 'm'
|
||||
#define NANO_META_N 'n'
|
||||
#define NANO_META_O 'o'
|
||||
#define NANO_META_P 'p'
|
||||
#define NANO_META_Q 'q'
|
||||
#define NANO_META_R 'r'
|
||||
#define NANO_META_S 's'
|
||||
#define NANO_META_T 't'
|
||||
#define NANO_META_U 'u'
|
||||
#define NANO_META_V 'v'
|
||||
#define NANO_META_W 'w'
|
||||
#define NANO_META_X 'x'
|
||||
#define NANO_META_Y 'y'
|
||||
#define NANO_META_Z 'z'
|
||||
#define NANO_META_LCURLYBRACKET '{'
|
||||
#define NANO_META_PIPE '|'
|
||||
#define NANO_META_RCURLYBRACKET '}'
|
||||
|
||||
/* Some semi-changeable keybindings; don't play with these unless you're
|
||||
* sure you know what you're doing. Assume ERR is defined as -1. */
|
||||
@@ -483,22 +480,22 @@ typedef struct rcoption {
|
||||
#define NANO_WRITEOUT_FKEY KEY_F(3)
|
||||
#define NANO_GOTOLINE_KEY NANO_CONTROL_7
|
||||
#define NANO_GOTOLINE_FKEY KEY_F(13)
|
||||
#define NANO_GOTOLINE_ALTKEY NANO_ALT_G
|
||||
#define NANO_GOTOLINE_METAKEY NANO_META_G
|
||||
#define NANO_GOTODIR_KEY NANO_CONTROL_7
|
||||
#define NANO_GOTODIR_FKEY KEY_F(13)
|
||||
#define NANO_GOTODIR_ALTKEY NANO_ALT_G
|
||||
#define NANO_GOTODIR_METAKEY NANO_META_G
|
||||
#define NANO_TOGOTOLINE_KEY NANO_CONTROL_T
|
||||
#define NANO_HELP_KEY NANO_CONTROL_G
|
||||
#define NANO_HELP_FKEY KEY_F(1)
|
||||
#define NANO_WHEREIS_KEY NANO_CONTROL_W
|
||||
#define NANO_WHEREIS_FKEY KEY_F(6)
|
||||
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
|
||||
#define NANO_WHEREIS_NEXT_KEY NANO_META_W
|
||||
#define NANO_WHEREIS_NEXT_FKEY KEY_F(16)
|
||||
#define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T
|
||||
#define NANO_REGEXP_KEY NANO_ALT_R
|
||||
#define NANO_REGEXP_KEY NANO_META_R
|
||||
#define NANO_REPLACE_KEY NANO_CONTROL_4
|
||||
#define NANO_REPLACE_FKEY KEY_F(14)
|
||||
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
||||
#define NANO_REPLACE_METAKEY NANO_META_R
|
||||
#define NANO_TOOTHERSEARCH_KEY NANO_CONTROL_R
|
||||
#define NANO_PREVPAGE_KEY NANO_CONTROL_Y
|
||||
#define NANO_PREVPAGE_FKEY KEY_F(7)
|
||||
@@ -506,8 +503,8 @@ typedef struct rcoption {
|
||||
#define NANO_NEXTPAGE_FKEY KEY_F(8)
|
||||
#define NANO_CUT_KEY NANO_CONTROL_K
|
||||
#define NANO_CUT_FKEY KEY_F(9)
|
||||
#define NANO_COPY_KEY NANO_ALT_CARET
|
||||
#define NANO_COPY_ALTKEY NANO_ALT_6
|
||||
#define NANO_COPY_KEY NANO_META_CARET
|
||||
#define NANO_COPY_METAKEY NANO_META_6
|
||||
#define NANO_UNCUT_KEY NANO_CONTROL_U
|
||||
#define NANO_UNCUT_FKEY KEY_F(10)
|
||||
#define NANO_CURSORPOS_KEY NANO_CONTROL_C
|
||||
@@ -516,20 +513,20 @@ typedef struct rcoption {
|
||||
#define NANO_SPELL_FKEY KEY_F(12)
|
||||
#define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY
|
||||
#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY
|
||||
#define NANO_FIRSTLINE_ALTKEY NANO_ALT_BACKSLASH
|
||||
#define NANO_FIRSTLINE_ALTKEY2 NANO_ALT_PIPE
|
||||
#define NANO_FIRSTLINE_METAKEY NANO_META_BACKSLASH
|
||||
#define NANO_FIRSTLINE_METAKEY2 NANO_META_PIPE
|
||||
#define NANO_FIRSTFILE_KEY NANO_FIRSTLINE_KEY
|
||||
#define NANO_FIRSTFILE_FKEY NANO_FIRSTLINE_FKEY
|
||||
#define NANO_FIRSTFILE_ALTKEY NANO_FIRSTLINE_ALTKEY
|
||||
#define NANO_FIRSTFILE_ALTKEY2 NANO_FIRSTLINE_ALTKEY2
|
||||
#define NANO_FIRSTFILE_METAKEY NANO_FIRSTLINE_METAKEY
|
||||
#define NANO_FIRSTFILE_METAKEY2 NANO_FIRSTLINE_METAKEY2
|
||||
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
||||
#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY
|
||||
#define NANO_LASTLINE_ALTKEY NANO_ALT_SLASH
|
||||
#define NANO_LASTLINE_ALTKEY2 NANO_ALT_QUESTION
|
||||
#define NANO_LASTLINE_METAKEY NANO_META_SLASH
|
||||
#define NANO_LASTLINE_METAKEY2 NANO_META_QUESTION
|
||||
#define NANO_LASTFILE_KEY NANO_LASTLINE_KEY
|
||||
#define NANO_LASTFILE_FKEY NANO_LASTLINE_FKEY
|
||||
#define NANO_LASTFILE_ALTKEY NANO_LASTLINE_ALTKEY
|
||||
#define NANO_LASTFILE_ALTKEY2 NANO_LASTLINE_ALTKEY2
|
||||
#define NANO_LASTFILE_METAKEY NANO_LASTLINE_METAKEY
|
||||
#define NANO_LASTFILE_METAKEY2 NANO_LASTLINE_METAKEY2
|
||||
#define NANO_REFRESH_KEY NANO_CONTROL_L
|
||||
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
|
||||
#define NANO_JUSTIFY_FKEY KEY_F(4)
|
||||
@@ -540,43 +537,42 @@ typedef struct rcoption {
|
||||
#define NANO_FORWARD_KEY NANO_CONTROL_F
|
||||
#define NANO_BACK_KEY NANO_CONTROL_B
|
||||
#define NANO_MARK_KEY NANO_CONTROL_6
|
||||
#define NANO_MARK_ALTKEY NANO_ALT_A
|
||||
#define NANO_MARK_METAKEY NANO_META_A
|
||||
#define NANO_MARK_FKEY KEY_F(15)
|
||||
#define NANO_HOME_KEY NANO_CONTROL_A
|
||||
#define NANO_END_KEY NANO_CONTROL_E
|
||||
#define NANO_DELETE_KEY NANO_CONTROL_D
|
||||
#define NANO_BACKSPACE_KEY NANO_CONTROL_H
|
||||
#define NANO_TAB_KEY NANO_CONTROL_I
|
||||
#define NANO_INDENTMARKED_KEY NANO_ALT_RCURLYBRACKET
|
||||
#define NANO_UNINDENTMARKED_KEY NANO_ALT_LCURLYBRACKET
|
||||
#define NANO_INDENT_KEY NANO_META_RCURLYBRACKET
|
||||
#define NANO_UNINDENT_KEY NANO_META_LCURLYBRACKET
|
||||
#define NANO_SUSPEND_KEY NANO_CONTROL_Z
|
||||
#define NANO_ENTER_KEY NANO_CONTROL_M
|
||||
#define NANO_TOFILES_KEY NANO_CONTROL_T
|
||||
#define NANO_APPEND_KEY NANO_ALT_A
|
||||
#define NANO_PREPEND_KEY NANO_ALT_P
|
||||
#define NANO_PREVFILE_KEY NANO_ALT_LCARET
|
||||
#define NANO_PREVFILE_ALTKEY NANO_ALT_COMMA
|
||||
#define NANO_NEXTFILE_KEY NANO_ALT_RCARET
|
||||
#define NANO_NEXTFILE_ALTKEY NANO_ALT_PERIOD
|
||||
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
|
||||
#define NANO_APPEND_KEY NANO_META_A
|
||||
#define NANO_PREPEND_KEY NANO_META_P
|
||||
#define NANO_PREVFILE_KEY NANO_META_LCARET
|
||||
#define NANO_PREVFILE_METAKEY NANO_META_COMMA
|
||||
#define NANO_NEXTFILE_KEY NANO_META_RCARET
|
||||
#define NANO_NEXTFILE_METAKEY NANO_META_PERIOD
|
||||
#define NANO_BRACKET_KEY NANO_META_RBRACKET
|
||||
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
||||
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
||||
#define NANO_WORDCOUNT_KEY NANO_ALT_D
|
||||
#define NANO_SCROLLUP_KEY NANO_ALT_MINUS
|
||||
#define NANO_SCROLLDOWN_KEY NANO_ALT_PLUS
|
||||
#define NANO_SCROLLUP_ALTKEY NANO_ALT_UNDERSCORE
|
||||
#define NANO_SCROLLDOWN_ALTKEY NANO_ALT_EQUALS
|
||||
#define NANO_CUTTILLEND_KEY NANO_CONTROL_X
|
||||
#define NANO_CUTTILLEND_ALTKEY NANO_ALT_T
|
||||
#define NANO_PREVWORD_KEY NANO_META_SPACE
|
||||
#define NANO_WORDCOUNT_KEY NANO_META_D
|
||||
#define NANO_SCROLLUP_KEY NANO_META_MINUS
|
||||
#define NANO_SCROLLDOWN_KEY NANO_META_PLUS
|
||||
#define NANO_SCROLLUP_METAKEY NANO_META_UNDERSCORE
|
||||
#define NANO_SCROLLDOWN_METAKEY NANO_META_EQUALS
|
||||
#define NANO_CUTTILLEND_METAKEY NANO_META_T
|
||||
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
||||
#define NANO_PARABEGIN_ALTKEY NANO_ALT_LPARENTHESIS
|
||||
#define NANO_PARABEGIN_ALTKEY2 NANO_ALT_9
|
||||
#define NANO_PARABEGIN_METAKEY NANO_META_LPARENTHESIS
|
||||
#define NANO_PARABEGIN_METAKEY2 NANO_META_9
|
||||
#define NANO_PARAEND_KEY NANO_CONTROL_O
|
||||
#define NANO_PARAEND_ALTKEY NANO_ALT_RPARENTHESIS
|
||||
#define NANO_PARAEND_ALTKEY2 NANO_ALT_0
|
||||
#define NANO_PARAEND_METAKEY NANO_META_RPARENTHESIS
|
||||
#define NANO_PARAEND_METAKEY2 NANO_META_0
|
||||
#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U
|
||||
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||
#define NANO_FULLJUSTIFY_METAKEY NANO_META_J
|
||||
#define NANO_VERBATIM_KEY NANO_META_V
|
||||
|
||||
/* Toggles do not exist if NANO_TINY is defined. */
|
||||
#ifndef NANO_TINY
|
||||
@@ -585,26 +581,26 @@ typedef struct rcoption {
|
||||
#define TOGGLE_NO_KEY -2
|
||||
|
||||
/* Normal toggles. */
|
||||
#define TOGGLE_NOHELP_KEY NANO_ALT_X
|
||||
#define TOGGLE_CONST_KEY NANO_ALT_C
|
||||
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
|
||||
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
||||
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
|
||||
#define TOGGLE_SYNTAX_KEY NANO_ALT_Y
|
||||
#define TOGGLE_SMARTHOME_KEY NANO_ALT_H
|
||||
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
||||
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
||||
#define TOGGLE_WRAP_KEY NANO_ALT_L
|
||||
#define TOGGLE_TABSTOSPACES_KEY NANO_ALT_Q
|
||||
#define TOGGLE_BACKUP_KEY NANO_ALT_B
|
||||
#define TOGGLE_MULTIBUFFER_KEY NANO_ALT_F
|
||||
#define TOGGLE_MOUSE_KEY NANO_ALT_M
|
||||
#define TOGGLE_NOCONVERT_KEY NANO_ALT_N
|
||||
#define TOGGLE_SUSPEND_KEY NANO_ALT_Z
|
||||
#define TOGGLE_CASE_KEY NANO_ALT_C
|
||||
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
||||
#define TOGGLE_DOS_KEY NANO_ALT_D
|
||||
#define TOGGLE_MAC_KEY NANO_ALT_M
|
||||
#define TOGGLE_NOHELP_KEY NANO_META_X
|
||||
#define TOGGLE_CONST_KEY NANO_META_C
|
||||
#define TOGGLE_MORESPACE_KEY NANO_META_O
|
||||
#define TOGGLE_SMOOTH_KEY NANO_META_S
|
||||
#define TOGGLE_WHITESPACE_KEY NANO_META_P
|
||||
#define TOGGLE_SYNTAX_KEY NANO_META_Y
|
||||
#define TOGGLE_SMARTHOME_KEY NANO_META_H
|
||||
#define TOGGLE_AUTOINDENT_KEY NANO_META_I
|
||||
#define TOGGLE_CUTTOEND_KEY NANO_META_K
|
||||
#define TOGGLE_WRAP_KEY NANO_META_L
|
||||
#define TOGGLE_TABSTOSPACES_KEY NANO_META_Q
|
||||
#define TOGGLE_BACKUP_KEY NANO_META_B
|
||||
#define TOGGLE_MULTIBUFFER_KEY NANO_META_F
|
||||
#define TOGGLE_MOUSE_KEY NANO_META_M
|
||||
#define TOGGLE_NOCONVERT_KEY NANO_META_N
|
||||
#define TOGGLE_SUSPEND_KEY NANO_META_Z
|
||||
#define TOGGLE_CASE_KEY NANO_META_C
|
||||
#define TOGGLE_BACKWARDS_KEY NANO_META_B
|
||||
#define TOGGLE_DOS_KEY NANO_META_D
|
||||
#define TOGGLE_MAC_KEY NANO_META_M
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#define VIEW TRUE
|
||||
|
||||
121
src/prompt.c
121
src/prompt.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* prompt.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -28,11 +28,15 @@
|
||||
#include <string.h>
|
||||
|
||||
static char *prompt = NULL;
|
||||
/* The prompt string for statusbar questions. */
|
||||
/* The prompt string used for statusbar questions. */
|
||||
static size_t statusbar_x = (size_t)-1;
|
||||
/* The cursor position in answer. */
|
||||
static size_t statusbar_pww = (size_t)-1;
|
||||
/* The place we want in answer. */
|
||||
static size_t old_statusbar_x = (size_t)-1;
|
||||
/* The old cursor position in answer, if any. */
|
||||
static size_t old_pww = (size_t)-1;
|
||||
/* The old place we want in answer, if any. */
|
||||
static bool reset_statusbar_x = FALSE;
|
||||
/* Should we reset the cursor position at the statusbar
|
||||
* prompt? */
|
||||
@@ -71,7 +75,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
if (allow_funcs) {
|
||||
/* If we got a mouse click and it was on a shortcut, read in the
|
||||
* shortcut character. */
|
||||
if (*func_key == TRUE && input == KEY_MOUSE) {
|
||||
if (*func_key && input == KEY_MOUSE) {
|
||||
if (do_statusbar_mouse())
|
||||
input = get_kbinput(bottomwin, meta_key, func_key);
|
||||
else {
|
||||
@@ -97,7 +101,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
#ifndef NANO_TINY
|
||||
input == NANO_NEXTWORD_KEY ||
|
||||
#endif
|
||||
(*meta_key == TRUE && (
|
||||
(*meta_key && (
|
||||
#ifndef NANO_TINY
|
||||
input == NANO_PREVWORD_KEY || input == NANO_BRACKET_KEY ||
|
||||
#endif
|
||||
@@ -108,9 +112,8 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
|
||||
/* If we got a non-high-bit control key, a meta key sequence, or a
|
||||
* function key, and it's not a shortcut or toggle, throw it out. */
|
||||
if (*s_or_t == FALSE) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key == TRUE ||
|
||||
*func_key == TRUE) {
|
||||
if (!*s_or_t) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key || *func_key) {
|
||||
beep();
|
||||
*meta_key = FALSE;
|
||||
*func_key = FALSE;
|
||||
@@ -123,7 +126,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
* it's a normal text character. Display the warning if we're
|
||||
* in view mode, or add the character to the input buffer if
|
||||
* we're not. */
|
||||
if (input != ERR && *s_or_t == FALSE) {
|
||||
if (input != ERR && !*s_or_t) {
|
||||
/* If we're using restricted mode, the filename isn't blank,
|
||||
* and we're at the "Write File" prompt, disable text
|
||||
* input. */
|
||||
@@ -139,7 +142,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
/* If we got a shortcut, or if there aren't any other characters
|
||||
* waiting after the one we read in, we need to display all the
|
||||
* characters in the input buffer if it isn't empty. */
|
||||
if (*s_or_t == TRUE || get_key_buffer_len() == 0) {
|
||||
if (*s_or_t || get_key_buffer_len() == 0) {
|
||||
if (kbinput != NULL) {
|
||||
/* Display all the characters in the input buffer at
|
||||
* once, filtering out control characters. */
|
||||
@@ -192,7 +195,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
do_statusbar_next_word(FALSE);
|
||||
break;
|
||||
case NANO_PREVWORD_KEY:
|
||||
if (*meta_key == TRUE)
|
||||
if (*meta_key)
|
||||
do_statusbar_prev_word(FALSE);
|
||||
break;
|
||||
#endif
|
||||
@@ -204,12 +207,12 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
case NANO_BRACKET_KEY:
|
||||
if (*meta_key == TRUE)
|
||||
if (*meta_key)
|
||||
do_statusbar_find_bracket();
|
||||
break;
|
||||
#endif
|
||||
case NANO_VERBATIM_KEY:
|
||||
if (*meta_key == TRUE) {
|
||||
if (*meta_key) {
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable verbatim input. */
|
||||
@@ -221,10 +224,12 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
|
||||
do_statusbar_verbatim_input(&got_enter);
|
||||
|
||||
/* If we got the Enter key, set input to the
|
||||
* key value for Enter, and set finished to
|
||||
* TRUE to indicate that we're done. */
|
||||
/* If we got the Enter key, remove it from
|
||||
* the input buffer, set input to the key
|
||||
* value for Enter, and set finished to TRUE
|
||||
* to indicate that we're done. */
|
||||
if (got_enter) {
|
||||
get_input(NULL, 1);
|
||||
input = NANO_ENTER_KEY;
|
||||
*finished = TRUE;
|
||||
}
|
||||
@@ -323,8 +328,8 @@ void do_statusbar_output(char *output, size_t output_len, bool
|
||||
*got_enter = FALSE;
|
||||
|
||||
while (i < output_len) {
|
||||
/* If allow_cntrls is FALSE, filter out nulls and newlines,
|
||||
* since they're ASCII control characters. */
|
||||
/* If allow_cntrls is TRUE, convert nulls and newlines
|
||||
* properly. */
|
||||
if (allow_cntrls) {
|
||||
/* Null to newline, if needed. */
|
||||
if (output[i] == '\0')
|
||||
@@ -840,7 +845,7 @@ void do_statusbar_find_bracket(void)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Return the placewewant associated with statusbar_x, i.e, the
|
||||
/* Return the placewewant associated with statusbar_x, i.e. the
|
||||
* zero-based column position of the cursor. The value will be no
|
||||
* smaller than statusbar_x. */
|
||||
size_t statusbar_xplustabs(void)
|
||||
@@ -902,16 +907,18 @@ void update_statusbar_line(const char *curranswer, size_t index)
|
||||
reset_statusbar_cursor();
|
||||
|
||||
wattroff(bottomwin, reverse_attr);
|
||||
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
|
||||
/* Return TRUE if we need an update after moving horizontally, and FALSE
|
||||
* otherwise. We need one if old_pww and statusbar_pww are on different
|
||||
* pages. */
|
||||
bool need_statusbar_horizontal_update(size_t old_pww)
|
||||
* otherwise. We need one if pww_save and statusbar_pww are on
|
||||
* different pages. */
|
||||
bool need_statusbar_horizontal_update(size_t pww_save)
|
||||
{
|
||||
size_t start_col = strlenpt(prompt) + 1;
|
||||
|
||||
return get_statusbar_page_start(start_col, start_col + old_pww) !=
|
||||
return get_statusbar_page_start(start_col, start_col + pww_save) !=
|
||||
get_statusbar_page_start(start_col, start_col + statusbar_pww);
|
||||
}
|
||||
|
||||
@@ -964,13 +971,20 @@ int get_prompt_string(bool allow_tabs,
|
||||
answer = mallocstrcpy(answer, curranswer);
|
||||
curranswer_len = strlen(answer);
|
||||
|
||||
/* Only put statusbar_x at the end of the string (and change
|
||||
* statusbar_pww to match) if it's uninitialized, if it would be
|
||||
* past the end of curranswer, or if reset_statusbar_x is TRUE.
|
||||
* Otherwise, leave it alone. This is so the cursor position stays
|
||||
* at the same place if a prompt-changing toggle is pressed. */
|
||||
if (statusbar_x == (size_t)-1 || statusbar_x > curranswer_len ||
|
||||
reset_statusbar_x) {
|
||||
/* If reset_statusbar_x is TRUE, restore statusbar_x and
|
||||
* statusbar_pww to what they were before this prompt. Then, if
|
||||
* statusbar_x is uninitialized or past the end of curranswer, put
|
||||
* statusbar_x at the end of the string and update statusbar_pww
|
||||
* based on it. We do these things so that the cursor position
|
||||
* stays at the right place if a prompt-changing toggle is pressed,
|
||||
* or if this prompt was started from another prompt and we cancel
|
||||
* out of it. */
|
||||
if (reset_statusbar_x) {
|
||||
statusbar_x = old_statusbar_x;
|
||||
statusbar_pww = old_pww;
|
||||
}
|
||||
|
||||
if (statusbar_x == (size_t)-1 || statusbar_x > curranswer_len) {
|
||||
statusbar_x = curranswer_len;
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
}
|
||||
@@ -985,7 +999,7 @@ int get_prompt_string(bool allow_tabs,
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
/* If we're using restricted mode, we aren't allowed to change the
|
||||
* name of a file once it has one because that would allow writing
|
||||
* name of a file once it has one, because that would allow writing
|
||||
* to files not specified on the command line. In this case,
|
||||
* disable all keys that would change the text if the filename isn't
|
||||
* blank and we're at the "Write File" prompt. */
|
||||
@@ -1121,13 +1135,22 @@ int get_prompt_string(bool allow_tabs,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We finished putting in an answer or ran a normal shortcut's
|
||||
* associated function, so reset statusbar_x and statusbar_pww. */
|
||||
/* 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 (kbinput == NANO_CANCEL_KEY || kbinput == NANO_ENTER_KEY ||
|
||||
ran_func) {
|
||||
statusbar_x = (size_t)-1;
|
||||
statusbar_pww = (size_t)-1;
|
||||
}
|
||||
statusbar_x = old_statusbar_x;
|
||||
statusbar_pww = old_pww;
|
||||
|
||||
if (!ran_func)
|
||||
reset_statusbar_x = TRUE;
|
||||
/* Otherwise, we're still putting in an answer or a shortcut with
|
||||
* an associated function, so leave the statusbar cursor position
|
||||
* alone. */
|
||||
} else
|
||||
reset_statusbar_x = FALSE;
|
||||
|
||||
return kbinput;
|
||||
}
|
||||
@@ -1191,16 +1214,19 @@ int do_prompt(bool allow_tabs,
|
||||
free(prompt);
|
||||
prompt = NULL;
|
||||
|
||||
reset_statusbar_x = FALSE;
|
||||
/* We're done with the prompt, so save the statusbar cursor
|
||||
* position. */
|
||||
old_statusbar_x = statusbar_x;
|
||||
old_pww = statusbar_pww;
|
||||
|
||||
/* If we left the prompt via Cancel or Enter, set the return value
|
||||
* properly. */
|
||||
switch (retval) {
|
||||
case NANO_CANCEL_KEY:
|
||||
retval = -1;
|
||||
reset_statusbar_x = TRUE;
|
||||
break;
|
||||
case NANO_ENTER_KEY:
|
||||
retval = (answer[0] == '\0') ? -2 : 0;
|
||||
reset_statusbar_x = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1223,10 +1249,13 @@ int do_prompt(bool allow_tabs,
|
||||
}
|
||||
|
||||
/* This function forces a reset of the statusbar cursor position. It
|
||||
* should only be called after do_prompt(), and is only needed if the
|
||||
* user leaves the prompt via something other than Enter or Cancel. */
|
||||
* should be called when we get out of all statusbar prompts. */
|
||||
void do_prompt_abort(void)
|
||||
{
|
||||
/* Uninitialize the old cursor position in answer. */
|
||||
old_statusbar_x = (size_t)-1;
|
||||
old_pww = (size_t)-1;
|
||||
|
||||
reset_statusbar_x = TRUE;
|
||||
}
|
||||
|
||||
@@ -1310,10 +1339,10 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
case KEY_MOUSE:
|
||||
get_mouseinput(&mouse_x, &mouse_y, FALSE);
|
||||
|
||||
if (mouse_x != -1 && mouse_y != -1 && !ISSET(NO_HELP) &&
|
||||
wenclose(bottomwin, mouse_y, mouse_x) &&
|
||||
mouse_x < (width * 2) && mouse_y - (2 -
|
||||
no_more_space()) - editwinrows - 1 >= 0) {
|
||||
if (wenclose(bottomwin, mouse_y, mouse_x) &&
|
||||
!ISSET(NO_HELP) && mouse_x < (width * 2) &&
|
||||
mouse_y - (2 - no_more_space()) -
|
||||
editwinrows - 1 >= 0) {
|
||||
int x = mouse_x / width;
|
||||
/* Calculate the x-coordinate relative to the
|
||||
* two columns of the Yes/No/All shortcuts in
|
||||
@@ -1322,7 +1351,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
editwinrows - 1;
|
||||
/* Calculate the y-coordinate relative to the
|
||||
* beginning of the Yes/No/All shortcuts in
|
||||
* bottomwin, i.e, with the sizes of topwin,
|
||||
* bottomwin, i.e. with the sizes of topwin,
|
||||
* edit, and the first line of bottomwin
|
||||
* subtracted out. */
|
||||
|
||||
|
||||
100
src/proto.h
100
src/proto.h
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* proto.h *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "nano.h"
|
||||
|
||||
/* Public externs. See global.c for descriptions of them. */
|
||||
/* All external variables. See global.c for their descriptions. */
|
||||
#ifndef NANO_TINY
|
||||
extern sigjmp_buf jump_buf;
|
||||
extern bool jump_buf_main;
|
||||
@@ -141,13 +141,14 @@ extern int reverse_attr;
|
||||
|
||||
extern char *homedir;
|
||||
|
||||
/* Public functions in browser.c. */
|
||||
/* All functions in browser.c. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
char *do_browser(char *path, DIR *dir);
|
||||
char *do_browse_from(const char *inpath);
|
||||
void browser_init(const char *path, DIR *dir);
|
||||
void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key);
|
||||
void browser_refresh(void);
|
||||
bool browser_select_filename(const char *needle);
|
||||
int filesearch_init(void);
|
||||
bool findnextfile(bool no_sameline, size_t begin, const char *needle);
|
||||
void findnextfile_wrap_reset(void);
|
||||
@@ -156,10 +157,10 @@ void do_filesearch(void);
|
||||
void do_fileresearch(void);
|
||||
void do_first_file(void);
|
||||
void do_last_file(void);
|
||||
void striponedir(char *path);
|
||||
char *striponedir(const char *path);
|
||||
#endif
|
||||
|
||||
/* Public functions in chars.c. */
|
||||
/* All functions in chars.c. */
|
||||
#ifdef ENABLE_UTF8
|
||||
void utf8_init(void);
|
||||
bool using_utf8(void);
|
||||
@@ -241,14 +242,14 @@ bool is_valid_unicode(wchar_t wc);
|
||||
bool is_valid_mbstring(const char *s);
|
||||
#endif
|
||||
|
||||
/* Public functions in color.c. */
|
||||
/* All functions in color.c. */
|
||||
#ifdef ENABLE_COLOR
|
||||
void set_colorpairs(void);
|
||||
void color_init(void);
|
||||
void color_update(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in cut.c. */
|
||||
/* All functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
void cut_line(void);
|
||||
#ifndef NANO_TINY
|
||||
@@ -270,7 +271,7 @@ void do_cut_till_end(void);
|
||||
#endif
|
||||
void do_uncut_text(void);
|
||||
|
||||
/* Public functions in files.c. */
|
||||
/* All functions in files.c. */
|
||||
void make_new_buffer(void);
|
||||
void initialize_buffer(void);
|
||||
void initialize_buffer_text(void);
|
||||
@@ -309,13 +310,13 @@ bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
||||
void init_backup_dir(void);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out);
|
||||
int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
append, bool nonamechange);
|
||||
#ifndef NANO_TINY
|
||||
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
append_type append);
|
||||
#endif
|
||||
int do_writeout(bool exiting);
|
||||
bool do_writeout(bool exiting);
|
||||
void do_writeout_void(void);
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
|
||||
@@ -323,6 +324,7 @@ int diralphasort(const void *va, const void *vb);
|
||||
void free_chararray(char **array, size_t len);
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool is_dir(const char *buf);
|
||||
char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||
size_t buflen);
|
||||
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||
@@ -338,26 +340,29 @@ bool writehist(FILE *hist, filestruct *histhead);
|
||||
void save_history(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in global.c. */
|
||||
/* All functions in global.c. */
|
||||
size_t length_of_list(const shortcut *s);
|
||||
#ifndef NANO_TINY
|
||||
void toggle_init_one(int val, const char *desc, bool blank_after, long
|
||||
flag);
|
||||
void toggle_init_one(int val
|
||||
#ifndef DISABLE_HELP
|
||||
, const char *desc, bool blank_after
|
||||
#endif
|
||||
, long flag);
|
||||
void toggle_init(void);
|
||||
#endif
|
||||
void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
|
||||
void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help,
|
||||
, const char *help, bool blank_after
|
||||
#endif
|
||||
bool blank_after, int metaval, int funcval, int miscval, bool
|
||||
view, void (*func)(void));
|
||||
, int metaval, int funcval, int miscval, bool view, void
|
||||
(*func)(void));
|
||||
void shortcut_init(bool unjustify);
|
||||
void free_shortcutage(shortcut **shortcutage);
|
||||
#ifdef DEBUG
|
||||
void thanks_for_all_the_fish(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in help.c. */
|
||||
/* All functions in help.c. */
|
||||
#ifndef DISABLE_HELP
|
||||
void do_help(void (*refresh_func)(void));
|
||||
void do_help_void(void);
|
||||
@@ -369,7 +374,7 @@ void parse_help_input(int *kbinput, bool *meta_key, bool *func_key);
|
||||
size_t help_line_len(const char *ptr);
|
||||
#endif
|
||||
|
||||
/* Public functions in move.c. */
|
||||
/* All functions in move.c. */
|
||||
void do_first_line(void);
|
||||
void do_last_line(void);
|
||||
void do_page_up(void);
|
||||
@@ -388,18 +393,32 @@ void do_prev_word_void(void);
|
||||
#endif
|
||||
void do_home(void);
|
||||
void do_end(void);
|
||||
void do_up(void);
|
||||
void do_up(
|
||||
#ifndef NANO_TINY
|
||||
bool scroll_only
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
);
|
||||
void do_up_void(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_scroll_up(void);
|
||||
#endif
|
||||
void do_down(void);
|
||||
void do_down(
|
||||
#ifndef NANO_TINY
|
||||
bool scroll_only
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
);
|
||||
void do_down_void(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_scroll_down(void);
|
||||
#endif
|
||||
void do_left(void);
|
||||
void do_right(void);
|
||||
|
||||
/* Public functions in nano.c. */
|
||||
/* 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
|
||||
@@ -470,7 +489,7 @@ bool do_mouse(void);
|
||||
#endif
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls);
|
||||
|
||||
/* Public functions in prompt.c. */
|
||||
/* All functions in prompt.c. */
|
||||
int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
bool *ran_func, bool *finished, bool allow_funcs, void
|
||||
(*refresh_func)(void));
|
||||
@@ -500,7 +519,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 old_pww);
|
||||
bool need_statusbar_horizontal_update(size_t pww_save);
|
||||
void total_statusbar_refresh(void (*refresh_func)(void));
|
||||
int get_prompt_string(bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
@@ -527,7 +546,7 @@ int do_prompt(bool allow_tabs,
|
||||
void do_prompt_abort(void);
|
||||
int do_yesno_prompt(bool all, const char *msg);
|
||||
|
||||
/* Public functions in rcfile.c. */
|
||||
/* All functions in rcfile.c. */
|
||||
#ifdef ENABLE_NANORC
|
||||
void rcfile_error(const char *msg, ...);
|
||||
char *parse_next_word(char *ptr);
|
||||
@@ -548,9 +567,9 @@ void parse_rcfile(FILE *rcstream
|
||||
void do_rcfile(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in search.c. */
|
||||
/* All functions in search.c. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
int regexp_init(const char *regexp);
|
||||
bool regexp_init(const char *regexp);
|
||||
void regexp_cleanup(void);
|
||||
#endif
|
||||
void not_found_msg(const char *str);
|
||||
@@ -604,7 +623,7 @@ char *get_history_completion(filestruct **h, const char *s, size_t len);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Public functions in text.c. */
|
||||
/* All functions in text.c. */
|
||||
#ifndef NANO_TINY
|
||||
void do_mark(void);
|
||||
#endif
|
||||
@@ -612,9 +631,9 @@ void do_delete(void);
|
||||
void do_backspace(void);
|
||||
void do_tab(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_indent_marked(ssize_t cols);
|
||||
void do_indent_marked_void(void);
|
||||
void do_unindent_marked_void(void);
|
||||
void do_indent(ssize_t cols);
|
||||
void do_indent_void(void);
|
||||
void do_unindent(void);
|
||||
#endif
|
||||
void do_enter(void);
|
||||
#ifndef NANO_TINY
|
||||
@@ -661,7 +680,7 @@ void do_wordlinechar_count(void);
|
||||
#endif
|
||||
void do_verbatim_input(void);
|
||||
|
||||
/* Public functions in utils.c. */
|
||||
/* All functions in utils.c. */
|
||||
int digits(size_t n);
|
||||
void get_homedir(void);
|
||||
bool parse_num(const char *str, ssize_t *val);
|
||||
@@ -709,7 +728,7 @@ void dump_filestruct(const filestruct *inptr);
|
||||
void dump_filestruct_reverse(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in winio.c. */
|
||||
/* All functions in winio.c. */
|
||||
void get_key_buffer(WINDOW *win);
|
||||
size_t get_key_buffer_len(void);
|
||||
void unget_input(int *input, size_t input_len);
|
||||
@@ -717,10 +736,9 @@ void unget_kbinput(int kbinput, bool meta_key, bool func_key);
|
||||
int *get_input(WINDOW *win, size_t input_len);
|
||||
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
||||
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
||||
int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
||||
*ignore_seq);
|
||||
int get_escape_seq_kbinput(const int *seq, size_t seq_len);
|
||||
int get_escape_seq_abcd(int kbinput);
|
||||
int parse_escape_seq_kbinput(int kbinput, bool *ignore_seq);
|
||||
int parse_escape_seq_kbinput(WINDOW *win, int kbinput);
|
||||
int get_byte_kbinput(int kbinput);
|
||||
#ifdef ENABLE_UTF8
|
||||
long add_unicode_digit(int kbinput, long factor, long *uni);
|
||||
@@ -756,10 +774,10 @@ void reset_cursor(void);
|
||||
void edit_draw(const filestruct *fileptr, const char *converted, int
|
||||
line, size_t start);
|
||||
void update_line(const filestruct *fileptr, size_t index);
|
||||
bool need_horizontal_update(size_t old_pww);
|
||||
bool need_vertical_update(size_t old_pww);
|
||||
bool need_horizontal_update(size_t pww_save);
|
||||
bool need_vertical_update(size_t pww_save);
|
||||
void edit_scroll(scroll_dir direction, ssize_t nlines);
|
||||
void edit_redraw(const filestruct *old_current, size_t old_pww);
|
||||
void edit_redraw(const filestruct *old_current, size_t pww_save);
|
||||
void edit_refresh(void);
|
||||
void edit_update(update_type location);
|
||||
void total_redraw(void);
|
||||
|
||||
29
src/rcfile.c
29
src/rcfile.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* rcfile.c *
|
||||
* *
|
||||
* Copyright (C) 2001-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
|
||||
const static rcoption rcopts[] = {
|
||||
static const rcoption rcopts[] = {
|
||||
{"boldtext", BOLD_TEXT},
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
{"brackets", 0},
|
||||
@@ -97,8 +97,7 @@ const static rcoption rcopts[] = {
|
||||
static bool errors = FALSE;
|
||||
/* Whether we got any errors while parsing an rcfile. */
|
||||
static size_t lineno = 0;
|
||||
/* If we did, the line number where the current error
|
||||
* occurred. */
|
||||
/* If we did, the line number where the last error occurred. */
|
||||
static char *nanorc = NULL;
|
||||
/* The path to the rcfile we're parsing. */
|
||||
#ifdef ENABLE_COLOR
|
||||
@@ -108,8 +107,9 @@ static colortype *endcolor = NULL;
|
||||
/* The end of the color list for the current syntax. */
|
||||
#endif
|
||||
|
||||
/* We have an error in some part of the rcfile. Put it on stderr and
|
||||
* make the user hit Enter to continue starting nano. */
|
||||
/* We have an error in some part of the rcfile. Print the error message
|
||||
* on stderr, and then make the user hit Enter to continue starting
|
||||
* nano. */
|
||||
void rcfile_error(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -127,8 +127,9 @@ void rcfile_error(const char *msg, ...)
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
/* Parse the next word from the string. Return points to '\0' if we hit
|
||||
* the end of the line. */
|
||||
/* Parse the next word from the string, null-terminate it, and return
|
||||
* a pointer to the first character after the null terminator. The
|
||||
* returned pointer will point to '\0' if we hit the end of the line. */
|
||||
char *parse_next_word(char *ptr)
|
||||
{
|
||||
while (!isblank(*ptr) && *ptr != '\0')
|
||||
@@ -202,7 +203,7 @@ char *parse_next_regex(char *ptr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Null terminate and advance ptr. */
|
||||
/* Null-terminate and advance ptr. */
|
||||
*ptr++ = '\0';
|
||||
|
||||
while (isblank(*ptr))
|
||||
@@ -834,9 +835,11 @@ void parse_rcfile(FILE *rcstream
|
||||
rcfile_error(N_("Unknown flag \"%s\""), option);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
if (endsyntax != NULL && endcolor == NULL)
|
||||
rcfile_error(N_("Syntax \"%s\" has no color commands"),
|
||||
endsyntax->desc);
|
||||
#endif
|
||||
|
||||
free(buf);
|
||||
fclose(rcstream);
|
||||
@@ -880,10 +883,10 @@ void do_rcfile(void)
|
||||
#endif
|
||||
);
|
||||
|
||||
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
|
||||
#ifdef DISABLE_ROOTWRAPPING
|
||||
/* We've already read SYSCONFDIR/nanorc, if it's there. If we're
|
||||
* root and --disable-wrapping-as-root is used, turn wrapping
|
||||
* off now. */
|
||||
* root, and --disable-wrapping-as-root is used, turn wrapping off
|
||||
* now. */
|
||||
if (geteuid() == NANO_ROOT_UID)
|
||||
SET(NO_WRAP);
|
||||
#endif
|
||||
|
||||
48
src/search.c
48
src/search.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* search.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -39,21 +39,20 @@ static bool history_changed = FALSE;
|
||||
static bool regexp_compiled = FALSE;
|
||||
/* Have we compiled any regular expressions? */
|
||||
|
||||
/* Regular expression helper functions. */
|
||||
|
||||
/* Compile the given regular expression. Return value 0 means the
|
||||
* expression was invalid, and we wrote an error message on the status
|
||||
* bar. Return value 1 means success. */
|
||||
int regexp_init(const char *regexp)
|
||||
/* Compile the regular expression regexp to see if it's valid. Return
|
||||
* TRUE if it is, or FALSE otherwise. */
|
||||
bool regexp_init(const char *regexp)
|
||||
{
|
||||
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED
|
||||
int rc;
|
||||
|
||||
assert(!regexp_compiled);
|
||||
|
||||
rc = regcomp(&search_regexp, regexp, REG_EXTENDED
|
||||
#ifndef NANO_TINY
|
||||
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
|
||||
#endif
|
||||
);
|
||||
|
||||
assert(!regexp_compiled);
|
||||
|
||||
if (rc != 0) {
|
||||
size_t len = regerror(rc, &search_regexp, NULL, 0);
|
||||
char *str = charalloc(len);
|
||||
@@ -61,11 +60,13 @@ int regexp_init(const char *regexp)
|
||||
regerror(rc, &search_regexp, str, len);
|
||||
statusbar(_("Bad regex \"%s\": %s"), regexp, str);
|
||||
free(str);
|
||||
return 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
regexp_compiled = TRUE;
|
||||
return 1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Decompile the compiled regular expression we used in the last
|
||||
@@ -218,9 +219,8 @@ int search_init(bool replacing, bool use_answer)
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Use last_search if answer is an empty string, or
|
||||
* answer if it isn't. */
|
||||
if (ISSET(USE_REGEXP) &&
|
||||
regexp_init((i == -2) ? last_search :
|
||||
answer) == 0)
|
||||
if (ISSET(USE_REGEXP) && !regexp_init((i == -2) ?
|
||||
last_search : answer))
|
||||
return -1;
|
||||
#endif
|
||||
break;
|
||||
@@ -421,7 +421,7 @@ void do_search(void)
|
||||
{
|
||||
filestruct *fileptr = openfile->current;
|
||||
size_t fileptr_x = openfile->current_x;
|
||||
size_t old_pww = openfile->placewewant;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
int i;
|
||||
bool didfind;
|
||||
|
||||
@@ -493,7 +493,7 @@ void do_search(void)
|
||||
}
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
edit_redraw(fileptr, old_pww);
|
||||
edit_redraw(fileptr, pww_save);
|
||||
search_replace_abort();
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ void do_research(void)
|
||||
{
|
||||
filestruct *fileptr = openfile->current;
|
||||
size_t fileptr_x = openfile->current_x;
|
||||
size_t old_pww = openfile->placewewant;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
bool didfind;
|
||||
|
||||
search_init_globals();
|
||||
@@ -511,7 +511,7 @@ void do_research(void)
|
||||
if (last_search[0] != '\0') {
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Since answer is "", use last_search! */
|
||||
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
|
||||
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -555,7 +555,7 @@ void do_research(void)
|
||||
statusbar(_("No current search pattern"));
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
edit_redraw(fileptr, old_pww);
|
||||
edit_redraw(fileptr, pww_save);
|
||||
search_replace_abort();
|
||||
}
|
||||
#endif
|
||||
@@ -576,7 +576,7 @@ int replace_regexp(char *string, bool create)
|
||||
/* Iterate through the replacement text to handle subexpression
|
||||
* replacement using \1, \2, \3, etc. */
|
||||
while (*c != '\0') {
|
||||
int num = (int)(*(c + 1) - '0');
|
||||
int num = (*(c + 1) - '0');
|
||||
|
||||
if (*c != '\\' || num < 1 || num > 9 || num >
|
||||
search_regexp.re_nsub) {
|
||||
@@ -977,7 +977,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
if (interactive) {
|
||||
char *ans = mallocstrcpy(NULL, answer);
|
||||
|
||||
/* Ask for it. */
|
||||
/* Ask for the line and column. */
|
||||
int i = do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
@@ -1342,7 +1342,7 @@ void update_history(filestruct **h, const char *s)
|
||||
}
|
||||
|
||||
/* Add the new entry to the end. */
|
||||
(*hbot)->data = mallocstrcpy(NULL, s);
|
||||
(*hbot)->data = mallocstrcpy((*hbot)->data, s);
|
||||
splice_node(*hbot, make_new_node(*hbot), (*hbot)->next);
|
||||
*hbot = (*hbot)->next;
|
||||
(*hbot)->data = mallocstrcpy(NULL, "");
|
||||
|
||||
96
src/text.c
96
src/text.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* text.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -55,7 +55,7 @@ void do_mark(void)
|
||||
openfile->mark_begin = openfile->current;
|
||||
openfile->mark_begin_x = openfile->current_x;
|
||||
} else {
|
||||
statusbar(_("Mark UNset"));
|
||||
statusbar(_("Mark Unset"));
|
||||
openfile->mark_begin = NULL;
|
||||
openfile->mark_begin_x = 0;
|
||||
edit_refresh();
|
||||
@@ -63,7 +63,7 @@ void do_mark(void)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Delete one character. */
|
||||
/* Delete the character under the cursor. */
|
||||
void do_delete(void)
|
||||
{
|
||||
bool do_refresh = FALSE;
|
||||
@@ -150,7 +150,7 @@ void do_delete(void)
|
||||
}
|
||||
|
||||
/* Backspace over one character. That is, move the cursor left one
|
||||
* character, and then delete the character there. */
|
||||
* character, and then delete the character under the cursor. */
|
||||
void do_backspace(void)
|
||||
{
|
||||
if (openfile->current != openfile->fileage ||
|
||||
@@ -191,12 +191,12 @@ void do_tab(void)
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Indent or unindent all lines covered by the mark len columns,
|
||||
* depending on whether len is positive or negative. If the
|
||||
* TABS_TO_SPACES flag is set, indent/unindent by len spaces.
|
||||
* Otherwise, indent/unindent by (len / tabsize) tabs and (len %
|
||||
* tabsize) spaces. */
|
||||
void do_indent_marked(ssize_t cols)
|
||||
/* Indent or unindent the current line (or, if the mark is on, all lines
|
||||
* covered by the mark) len columns, depending on whether len is
|
||||
* positive or negative. If the TABS_TO_SPACES flag is set, indent or
|
||||
* unindent by len spaces. Otherwise, indent or unindent by (len /
|
||||
* tabsize) tabs and (len % tabsize) spaces. */
|
||||
void do_indent(ssize_t cols)
|
||||
{
|
||||
bool indent_changed = FALSE;
|
||||
/* Whether any indenting or unindenting was done. */
|
||||
@@ -212,13 +212,6 @@ void do_indent_marked(ssize_t cols)
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
/* If the mark isn't on, indicate it on the statusbar and get
|
||||
* out. */
|
||||
if (!openfile->mark_set) {
|
||||
statusbar(_("No lines selected, nothing to do!"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* If cols is zero, get out. */
|
||||
if (cols == 0)
|
||||
return;
|
||||
@@ -233,9 +226,15 @@ void do_indent_marked(ssize_t cols)
|
||||
} else
|
||||
indent_changed = TRUE;
|
||||
|
||||
/* Get the coordinates of the marked text. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
/* If the mark is on, use all lines covered by the mark. */
|
||||
if (openfile->mark_set)
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
/* Otherwise, use the current line. */
|
||||
else {
|
||||
top = openfile->current;
|
||||
bot = top;
|
||||
}
|
||||
|
||||
if (!unindent) {
|
||||
/* Set up the text we'll be using as indentation. */
|
||||
@@ -260,7 +259,7 @@ void do_indent_marked(ssize_t cols)
|
||||
line_indent[line_indent_len] = '\0';
|
||||
}
|
||||
|
||||
/* Go through each line of the marked text. */
|
||||
/* Go through each line of the text. */
|
||||
for (f = top; f != bot->next; f = f->next) {
|
||||
size_t line_len = strlen(f->data);
|
||||
size_t indent_len = indent_length(f->data);
|
||||
@@ -276,8 +275,8 @@ void do_indent_marked(ssize_t cols)
|
||||
openfile->totsize += line_indent_len;
|
||||
|
||||
/* Keep track of the change in the current line. */
|
||||
if (f == openfile->mark_begin && openfile->mark_begin_x >=
|
||||
indent_len)
|
||||
if (openfile->mark_set && f == openfile->mark_begin &&
|
||||
openfile->mark_begin_x >= indent_len)
|
||||
openfile->mark_begin_x += line_indent_len;
|
||||
|
||||
if (f == openfile->current && openfile->current_x >=
|
||||
@@ -311,7 +310,7 @@ void do_indent_marked(ssize_t cols)
|
||||
openfile->totsize -= indent_shift;
|
||||
|
||||
/* Keep track of the change in the current line. */
|
||||
if (f == openfile->mark_begin &&
|
||||
if (openfile->mark_set && f == openfile->mark_begin &&
|
||||
openfile->mark_begin_x > indent_new) {
|
||||
if (openfile->mark_begin_x <= indent_len)
|
||||
openfile->mark_begin_x = indent_new;
|
||||
@@ -347,16 +346,18 @@ void do_indent_marked(ssize_t cols)
|
||||
}
|
||||
}
|
||||
|
||||
/* Indent all lines covered by the mark tabsize columns. */
|
||||
void do_indent_marked_void(void)
|
||||
/* Indent the current line, or all lines covered by the mark if the mark
|
||||
* is on, tabsize columns. */
|
||||
void do_indent_void(void)
|
||||
{
|
||||
do_indent_marked(tabsize);
|
||||
do_indent(tabsize);
|
||||
}
|
||||
|
||||
/* Unindent all lines covered by the mark tabsize columns. */
|
||||
void do_unindent_marked_void(void)
|
||||
/* Unindent the current line, or all lines covered by the mark if the
|
||||
* mark is on, tabsize columns. */
|
||||
void do_unindent(void)
|
||||
{
|
||||
do_indent_marked(-tabsize);
|
||||
do_indent(-tabsize);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -496,11 +497,6 @@ bool execute_command(const char *command)
|
||||
|
||||
read_file(f, "stdin");
|
||||
|
||||
/* If multibuffer mode is on, we could be here in view mode. If so,
|
||||
* don't set the modification flag. */
|
||||
if (!ISSET(VIEW_MODE))
|
||||
set_modified();
|
||||
|
||||
if (wait(NULL) == -1)
|
||||
nperror("wait");
|
||||
|
||||
@@ -1946,7 +1942,7 @@ const char *do_int_speller(const char *tempfile_name)
|
||||
|
||||
/* A new process to run spell in. */
|
||||
if ((pid_spell = fork()) == 0) {
|
||||
/* Child continues (i.e, future spell process). */
|
||||
/* Child continues (i.e. future spell process). */
|
||||
close(spell_fd[0]);
|
||||
|
||||
/* Replace the standard input with the temp file. */
|
||||
@@ -1976,7 +1972,7 @@ const char *do_int_speller(const char *tempfile_name)
|
||||
|
||||
/* A new process to run sort in. */
|
||||
if ((pid_sort = fork()) == 0) {
|
||||
/* Child continues (i.e, future spell process). Replace the
|
||||
/* Child continues (i.e. future spell process). Replace the
|
||||
* standard input with the standard output of the old pipe. */
|
||||
if (dup2(spell_fd[0], STDIN_FILENO) != STDIN_FILENO)
|
||||
goto close_pipes_and_exit;
|
||||
@@ -2002,7 +1998,7 @@ const char *do_int_speller(const char *tempfile_name)
|
||||
|
||||
/* A new process to run uniq in. */
|
||||
if ((pid_uniq = fork()) == 0) {
|
||||
/* Child continues (i.e, future uniq process). Replace the
|
||||
/* Child continues (i.e. future uniq process). Replace the
|
||||
* standard input with the standard output of the old pipe. */
|
||||
if (dup2(sort_fd[0], STDIN_FILENO) != STDIN_FILENO)
|
||||
goto close_pipes_and_exit;
|
||||
@@ -2201,7 +2197,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
|
||||
if (!WIFEXITED(alt_spell_status) ||
|
||||
WEXITSTATUS(alt_spell_status) != 0) {
|
||||
char *altspell_error;
|
||||
char *alt_spell_error;
|
||||
char *invoke_error = _("Error invoking \"%s\"");
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -2209,11 +2205,11 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
openfile->mark_set = old_mark_set;
|
||||
#endif
|
||||
|
||||
altspell_error =
|
||||
alt_spell_error =
|
||||
charalloc(strlen(invoke_error) +
|
||||
strlen(alt_speller) + 1);
|
||||
sprintf(altspell_error, invoke_error, alt_speller);
|
||||
return altspell_error;
|
||||
sprintf(alt_spell_error, invoke_error, alt_speller);
|
||||
return alt_spell_error;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -2305,7 +2301,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
* specified, use it. Otherwise, use the internal spell checker. */
|
||||
void do_spell(void)
|
||||
{
|
||||
int i;
|
||||
bool status;
|
||||
FILE *temp_file;
|
||||
char *temp = safe_tempfile(&temp_file);
|
||||
const char *spell_msg;
|
||||
@@ -2315,14 +2311,14 @@ void do_spell(void)
|
||||
return;
|
||||
}
|
||||
|
||||
status =
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set)
|
||||
i = write_marked_file(temp, temp_file, TRUE, OVERWRITE);
|
||||
else
|
||||
openfile->mark_set ? write_marked_file(temp, temp_file, TRUE,
|
||||
OVERWRITE) :
|
||||
#endif
|
||||
i = write_file(temp, temp_file, TRUE, OVERWRITE, FALSE);
|
||||
write_file(temp, temp_file, TRUE, OVERWRITE, FALSE);
|
||||
|
||||
if (i == -1) {
|
||||
if (!status) {
|
||||
statusbar(_("Error writing temp file: %s"), strerror(errno));
|
||||
free(temp);
|
||||
return;
|
||||
@@ -2450,6 +2446,8 @@ void do_verbatim_input(void)
|
||||
output[i] = (char)kbinput[i];
|
||||
output[i] = '\0';
|
||||
|
||||
free(kbinput);
|
||||
|
||||
do_output(output, kbinput_len, TRUE);
|
||||
|
||||
free(output);
|
||||
|
||||
22
src/utils.c
22
src/utils.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* utils.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* 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 2, or (at your option) *
|
||||
@@ -35,14 +35,18 @@ int digits(size_t n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; n >= 10; n /= 10, 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 getpwuid(). */
|
||||
* we fall back on the home directory of the effective user ID. */
|
||||
void get_homedir(void)
|
||||
{
|
||||
if (homedir == NULL) {
|
||||
@@ -143,7 +147,7 @@ void unsunder(char *str, size_t true_len)
|
||||
}
|
||||
|
||||
/* For non-null-terminated lines. A line, by definition, shouldn't
|
||||
* normally have newlines in it, so decode its newlines into nulls. */
|
||||
* normally have newlines in it, so decode its newlines as nulls. */
|
||||
void sunder(char *str)
|
||||
{
|
||||
assert(str != NULL);
|
||||
@@ -228,7 +232,7 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
*n += MAX_BUF_SIZE;
|
||||
}
|
||||
|
||||
/* Null terminate the buffer. */
|
||||
/* Null-terminate the buffer. */
|
||||
null_at(lineptr, indx++);
|
||||
*n = indx;
|
||||
|
||||
@@ -425,7 +429,7 @@ size_t get_page_start(size_t column)
|
||||
return column - (COLS - 2);
|
||||
}
|
||||
|
||||
/* Return the placewewant associated with current_x, i.e, the zero-based
|
||||
/* Return the placewewant associated with current_x, i.e. the zero-based
|
||||
* column position of the cursor. The value will be no smaller than
|
||||
* current_x. */
|
||||
size_t xplustabs(void)
|
||||
@@ -434,7 +438,7 @@ size_t xplustabs(void)
|
||||
}
|
||||
|
||||
/* Return the index in s of the character displayed at the given column,
|
||||
* i.e, the largest value such that strnlenpt(s, actual_x(s, column)) <=
|
||||
* i.e. the largest value such that strnlenpt(s, actual_x(s, column)) <=
|
||||
* column. */
|
||||
size_t actual_x(const char *s, size_t column)
|
||||
{
|
||||
|
||||
765
src/winio.c
765
src/winio.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user