Compare commits
394 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
665b1fbac6 | ||
|
|
5cbe08fc03 | ||
|
|
73bf89fa56 | ||
|
|
a73025d731 | ||
|
|
7bde05399f | ||
|
|
6168cb7391 | ||
|
|
44e0c03fff | ||
|
|
1aee5cc599 | ||
|
|
85c0b3c37e | ||
|
|
69163af499 | ||
|
|
f816119b36 | ||
|
|
5beae58597 | ||
|
|
4e05b755ed | ||
|
|
a96c819b50 | ||
|
|
5593e20964 | ||
|
|
651853aa21 | ||
|
|
9e21c62c68 | ||
|
|
43d3e9324b | ||
|
|
b2072b0999 | ||
|
|
9905b6ae74 | ||
|
|
3b2fdb00e4 | ||
|
|
2cf6d717f1 | ||
|
|
6ad6b85862 | ||
|
|
18d6a7ae1a | ||
|
|
5423680d67 | ||
|
|
7f7c66c237 | ||
|
|
b8351c1c8b | ||
|
|
27ae93d26b | ||
|
|
95a2db7a4a | ||
|
|
23555f29ba | ||
|
|
a899ab185f | ||
|
|
c5632a7e40 | ||
|
|
9c351e8831 | ||
|
|
23d3b7457b | ||
|
|
85f6a2daab | ||
|
|
6ea410e14e | ||
|
|
d4471ebe0e | ||
|
|
7f77e1dcdd | ||
|
|
a8824a197e | ||
|
|
059ba19ff7 | ||
|
|
bec2606ce2 | ||
|
|
9d658cec7a | ||
|
|
fe7d53e51e | ||
|
|
5e50e2f51e | ||
|
|
b2ca88cc74 | ||
|
|
7a3f49c019 | ||
|
|
bebfc6da0f | ||
|
|
0517c482e4 | ||
|
|
16799baccd | ||
|
|
d4ea5b69c5 | ||
|
|
8d5beb560c | ||
|
|
ba61cc382f | ||
|
|
3f301dd437 | ||
|
|
c3e52f16ba | ||
|
|
b725353ab7 | ||
|
|
99466bfa71 | ||
|
|
261da14301 | ||
|
|
6dd67790df | ||
|
|
01e13ea1c1 | ||
|
|
68c10963c4 | ||
|
|
d0c4d378b4 | ||
|
|
6c25819c34 | ||
|
|
bd11c0171b | ||
|
|
739fc8ac3d | ||
|
|
8d0fb01ff2 | ||
|
|
d7cf373358 | ||
|
|
e0a0d23f78 | ||
|
|
da419bcbe4 | ||
|
|
b2bff724da | ||
|
|
a62e8e3de9 | ||
|
|
483f3ac1b5 | ||
|
|
90d505cc4a | ||
|
|
9c6d78669e | ||
|
|
5290e1bc84 | ||
|
|
b5aaf72b6a | ||
|
|
1ea53709d8 | ||
|
|
0227ccca7c | ||
|
|
25799f6862 | ||
|
|
c54c4d1eea | ||
|
|
7431fe5e93 | ||
|
|
166da9c893 | ||
|
|
cd0210ff3e | ||
|
|
7098ec233c | ||
|
|
62898233ac | ||
|
|
26e637bf12 | ||
|
|
d873447f5f | ||
|
|
84635cd8e8 | ||
|
|
03987abebd | ||
|
|
c661853315 | ||
|
|
4f673d802c | ||
|
|
bf51aa4c0a | ||
|
|
954aba7430 | ||
|
|
3435a0ff64 | ||
|
|
66357b5462 | ||
|
|
e29111f7ec | ||
|
|
6399000a48 | ||
|
|
ea01474c4b | ||
|
|
077d0647c9 | ||
|
|
9b494fa90c | ||
|
|
18a89a6cef | ||
|
|
c4ca596a90 | ||
|
|
5c8197d78f | ||
|
|
62e117421f | ||
|
|
f3ecffd24d | ||
|
|
f774017801 | ||
|
|
d1cc007136 | ||
|
|
25fb1025e9 | ||
|
|
a9a3f4f599 | ||
|
|
e6a55fa1e5 | ||
|
|
95f7a7431e | ||
|
|
fa6c29cc2e | ||
|
|
b2b6976bd9 | ||
|
|
7a4aaa53a1 | ||
|
|
77d0feae05 | ||
|
|
c1b960947e | ||
|
|
4846ce7a6a | ||
|
|
34c75746c2 | ||
|
|
3129c2928b | ||
|
|
21374584e2 | ||
|
|
a2ea733e3b | ||
|
|
40ad177210 | ||
|
|
6f143c8124 | ||
|
|
072f86c5f9 | ||
|
|
f271f9c962 | ||
|
|
5a6caf0ca8 | ||
|
|
da72453859 | ||
|
|
203026c632 | ||
|
|
ed7ad33802 | ||
|
|
ff6c1997b9 | ||
|
|
a01690c410 | ||
|
|
ff1a0ea32b | ||
|
|
42e271d2d3 | ||
|
|
9c06f34ef9 | ||
|
|
ab41ab9246 | ||
|
|
2515ccc0a0 | ||
|
|
d1323e4e35 | ||
|
|
7ae1a79641 | ||
|
|
e221311f2e | ||
|
|
d26f1ebdf1 | ||
|
|
1e64db6629 | ||
|
|
ce9d299c47 | ||
|
|
bdfa927d62 | ||
|
|
789867b6a0 | ||
|
|
3a4eb48d5c | ||
|
|
bfc183ba10 | ||
|
|
6209e0eb15 | ||
|
|
e534aae701 | ||
|
|
d5d4dde1eb | ||
|
|
42af2216fe | ||
|
|
356d2482c5 | ||
|
|
399fe939f9 | ||
|
|
40c3cd1aa9 | ||
|
|
b300af3f63 | ||
|
|
30d0a81656 | ||
|
|
6a0d5b8fec | ||
|
|
7b601fdbe1 | ||
|
|
8b698f4a29 | ||
|
|
9880afc47a | ||
|
|
5ed8819f35 | ||
|
|
7291daabe3 | ||
|
|
d2edb8a538 | ||
|
|
33d07ef055 | ||
|
|
f26d386191 | ||
|
|
67287088dc | ||
|
|
d16d0bfb9a | ||
|
|
5b9f52265a | ||
|
|
a049c8364f | ||
|
|
1a76845aa5 | ||
|
|
e90f0b8a33 | ||
|
|
d232fa2fc3 | ||
|
|
e010edd1f8 | ||
|
|
19462616d4 | ||
|
|
d8640480c3 | ||
|
|
6315e2ff39 | ||
|
|
068edf44fc | ||
|
|
aeeb96e628 | ||
|
|
3db0dc3d8d | ||
|
|
c00f658026 | ||
|
|
8767da4e63 | ||
|
|
d0d5b8fc0e | ||
|
|
44491acfef | ||
|
|
8bcac8ad26 | ||
|
|
53aca71420 | ||
|
|
a9d45bba01 | ||
|
|
a644af58a3 | ||
|
|
7c78b45e76 | ||
|
|
746214d5aa | ||
|
|
0df61f1aac | ||
|
|
4428975e95 | ||
|
|
c7935e20b7 | ||
|
|
01458cd380 | ||
|
|
7bf86e1707 | ||
|
|
23d3cf4515 | ||
|
|
9af6a203fb | ||
|
|
092af14a82 | ||
|
|
3da5580c9c | ||
|
|
3925bdafda | ||
|
|
f47f150c82 | ||
|
|
457847f0fe | ||
|
|
7e62d109ba | ||
|
|
193b0e56f3 | ||
|
|
9b108c2110 | ||
|
|
da33153379 | ||
|
|
f4595bb5ae | ||
|
|
c4dbdd55f5 | ||
|
|
d29b9d5bd6 | ||
|
|
810d02c6a4 | ||
|
|
f99acbf29a | ||
|
|
6fdc81ae04 | ||
|
|
81dabf2be7 | ||
|
|
3db02389f4 | ||
|
|
cc81436f81 | ||
|
|
6529ab434a | ||
|
|
160c5fec87 | ||
|
|
81e49a0d4a | ||
|
|
c10d8ffe9f | ||
|
|
8fda94246b | ||
|
|
1addd601bc | ||
|
|
8e15674c70 | ||
|
|
5854a87070 | ||
|
|
47ae0d764e | ||
|
|
73857558ec | ||
|
|
854b71d775 | ||
|
|
cef24f2254 | ||
|
|
8d07efac66 | ||
|
|
d922f199a7 | ||
|
|
34bdc35d94 | ||
|
|
1726050ef9 | ||
|
|
8234f672d4 | ||
|
|
95778fda70 | ||
|
|
dac3bca274 | ||
|
|
e0b55138b9 | ||
|
|
5e068c6031 | ||
|
|
bec2f20da0 | ||
|
|
d20c0c34f5 | ||
|
|
0998a64fb9 | ||
|
|
527f1743f6 | ||
|
|
54b74cee91 | ||
|
|
b9b572236a | ||
|
|
df2a82509b | ||
|
|
1a1ea3d42f | ||
|
|
15aaa2c31a | ||
|
|
10796ac2fc | ||
|
|
aff5a1c6b1 | ||
|
|
217f241be5 | ||
|
|
11846fa576 | ||
|
|
32fe95d35e | ||
|
|
920e350d85 | ||
|
|
e5b23bd2ff | ||
|
|
7de678798a | ||
|
|
638cbe5407 | ||
|
|
0e0fef03c5 | ||
|
|
f1d3d9581a | ||
|
|
40e4acf55e | ||
|
|
5d8d0b19be | ||
|
|
86d8fc37d7 | ||
|
|
e8bb90bd2b | ||
|
|
e2ce2792a3 | ||
|
|
045d130cfa | ||
|
|
31b159c1b3 | ||
|
|
e4acb69611 | ||
|
|
e3970f503c | ||
|
|
16f88134f7 | ||
|
|
8b3266e83c | ||
|
|
0a8ec176e4 | ||
|
|
86a9452702 | ||
|
|
c5e9a434b1 | ||
|
|
67e3b93861 | ||
|
|
e5bc1c45ce | ||
|
|
2fba43c842 | ||
|
|
934f9687bb | ||
|
|
7ae4cc6964 | ||
|
|
0f476b99b7 | ||
|
|
30f164a015 | ||
|
|
86ce3903f9 | ||
|
|
6f25a67833 | ||
|
|
5754201944 | ||
|
|
172767187e | ||
|
|
d3d37433ae | ||
|
|
f83e5e2b13 | ||
|
|
650b39c43d | ||
|
|
9245f97960 | ||
|
|
60a9bddcf6 | ||
|
|
e1ce92c90f | ||
|
|
c5659d320e | ||
|
|
2f0cd35322 | ||
|
|
b68c01b753 | ||
|
|
50995bd024 | ||
|
|
9c8baed321 | ||
|
|
775eeba38a | ||
|
|
6e925cf330 | ||
|
|
066713e87e | ||
|
|
546f5b3d8a | ||
|
|
e781ddf3b1 | ||
|
|
6d39f4ba66 | ||
|
|
5ebd73f9a5 | ||
|
|
02173c05dc | ||
|
|
7f4dd35406 | ||
|
|
8f5e50991b | ||
|
|
340e5ca881 | ||
|
|
75f4b7cb84 | ||
|
|
5e73eec3cc | ||
|
|
0f83c89b09 | ||
|
|
6bc26a9a8b | ||
|
|
198bd592ff | ||
|
|
fcdfb7f75f | ||
|
|
e41e8dbead | ||
|
|
10f880c62f | ||
|
|
5e360dc065 | ||
|
|
6595b715d0 | ||
|
|
56c1e34e5a | ||
|
|
e4cb3158fd | ||
|
|
6439330d59 | ||
|
|
0bfec6e58d | ||
|
|
29be8031df | ||
|
|
c5fe41cec8 | ||
|
|
72bff8eee4 | ||
|
|
d4a1c0ad29 | ||
|
|
1ccada16ae | ||
|
|
5b2f17e591 | ||
|
|
3705924fc8 | ||
|
|
c596c0c4da | ||
|
|
9cf1df1f06 | ||
|
|
56074a1da6 | ||
|
|
f79a3fa51a | ||
|
|
b9180f4a82 | ||
|
|
ad11460eb7 | ||
|
|
04652518fd | ||
|
|
22425a204d | ||
|
|
e527e458f4 | ||
|
|
ac71fdde97 | ||
|
|
ffda704ef6 | ||
|
|
6a244b689f | ||
|
|
c2b07472e2 | ||
|
|
f1aed80922 | ||
|
|
95660ee4d9 | ||
|
|
ddedf2dbd4 | ||
|
|
c32a5e7b4e | ||
|
|
a3e5fad059 | ||
|
|
7accda6dd7 | ||
|
|
b9f28013a7 | ||
|
|
c504dffa39 | ||
|
|
fc0ebe982d | ||
|
|
dcb4e3a66d | ||
|
|
00762ffaeb | ||
|
|
4857728f6e | ||
|
|
c0718343f5 | ||
|
|
d9a4dedd35 | ||
|
|
de85d63520 | ||
|
|
53d7bce68a | ||
|
|
a716bf42bc | ||
|
|
403e0feced | ||
|
|
e61e2c6f49 | ||
|
|
d4a071e492 | ||
|
|
894d80fc5d | ||
|
|
612caef65f | ||
|
|
88ad64d597 | ||
|
|
aa683853d4 | ||
|
|
050469c595 | ||
|
|
4811b81456 | ||
|
|
050b13ae5d | ||
|
|
6a84684571 | ||
|
|
caac92012d | ||
|
|
32a285c1eb | ||
|
|
b80d49f071 | ||
|
|
fe605247cb | ||
|
|
78d05481db | ||
|
|
b56ca1b7bb | ||
|
|
d37f6a3f5c | ||
|
|
5f3695bdb5 | ||
|
|
d8367986ce | ||
|
|
6e0ed3c1c6 | ||
|
|
c15583da31 | ||
|
|
8ac9087d75 | ||
|
|
c8857a2c26 | ||
|
|
297851a647 | ||
|
|
cb4f14b8ce | ||
|
|
263b447323 | ||
|
|
bc6a36e40d | ||
|
|
eb5092226d | ||
|
|
cf4db89d56 | ||
|
|
4e0b1ae332 | ||
|
|
c4daf5d49e | ||
|
|
b41df4a140 | ||
|
|
a853e2d650 | ||
|
|
6b94e95ec9 | ||
|
|
aad85151ae | ||
|
|
7ec8d7c6a3 | ||
|
|
39e8ce6f8e | ||
|
|
afbcf68c1a | ||
|
|
b9dec213be | ||
|
|
928babf8a1 | ||
|
|
2d825bae79 | ||
|
|
3dfc879f63 |
590
ChangeLog
590
ChangeLog
@@ -1,3 +1,587 @@
|
||||
GNU nano 1.3.8 - 2005.06.30
|
||||
- General:
|
||||
- Miscellaneous comment fixes. (DLR)
|
||||
- Various #include fixes. Since proto.h includes nano.h, only
|
||||
include the former in source files. Also add an #include
|
||||
guard to proto.h, and make the config.h #include in nano.h
|
||||
match the config.h #includes everywhere else. (DLR)
|
||||
- Change all hardcoded instances of 128 bytes to MAX_BUF_SIZE,
|
||||
and #define MAX_BUF_SIZE as 128 in nano.h. (DLR)
|
||||
- Display the key to go to the previous strings in the
|
||||
search/replace history as "^P" instead of "Up". This makes
|
||||
mouse clicks work properly on it. Changes to shortcut_init(),
|
||||
help_init(), nanogetstr(), and do_statusbar_input(). (DLR)
|
||||
- Update the Free Software Foundation's mailing address in
|
||||
various comments. (DLR)
|
||||
- Add the ability to open a file on a specified column as well
|
||||
as a specified line, by allowing an argument of the form
|
||||
+LINE,COLUMN. New function parse_line_column(); changes to
|
||||
shortcut_init(), main(), do_gotoline() (renamed
|
||||
do_gotolinecolumn()), do_gotoline_void() (renamed
|
||||
do_gotolinecolumn_void()), nano.1, and nano.texi. (DLR,
|
||||
suggested by PFTank)
|
||||
- Overhaul the history code to work more consistently, and clean
|
||||
up various parts of it. New function history_has_changed();
|
||||
changes to load_history(), writehist(),
|
||||
thanks_for_all_the_fish(), history_init(), find_node()
|
||||
(renamed find_history()), update_history(),
|
||||
get_history_older(), get_history_newer(),
|
||||
get_history_completion(), do_search(), do_replace(),
|
||||
nanogetstr(), and statusq(); removal of remove_node() and
|
||||
insert_node(). (DLR)
|
||||
- Remove all instances of charcpy() and replace them with
|
||||
strncpy(), since there's no way to be sure that a charcpy()ed
|
||||
string will always be properly null-terminated, and strcpy()'s
|
||||
null termination is the only difference between it and
|
||||
charcpy(). (DLR)
|
||||
- When using a backup directory, make sure all the filenames
|
||||
written are unique by using get_next_filename() when
|
||||
necessary. Changes to get_next_filename(), write_file(),
|
||||
die(), usage(), nano.1, nanorc.5, nanorc.sample, and
|
||||
nano.texi. (DLR, suggested by James Collings)
|
||||
- Rework the file-writing routines so that they can work
|
||||
properly with already-opened files, such as the
|
||||
mkstemp()-created files used by the spell-checking code.
|
||||
Changes to safe_tempnam() (renamed safe_tempfile()),
|
||||
write_file(), write_marked(), die(), do_spell(), and
|
||||
do_exit(). (DLR)
|
||||
- Remove the -R/--regexp command line option and enable the
|
||||
toggle at the search prompt in tiny mode, as it already
|
||||
allows the prepend and append toggles at the search prompt.
|
||||
For consistency, rename TOGGLE_REGEXP_KEY to NANO_REGEXP_KEY,
|
||||
and move it out of the toggles block to where NANO_PREPEND_KEY
|
||||
and NANO_APPEND_KEY are. Also, change the short command line
|
||||
option for --restricted from -Z to -R. Changes to
|
||||
shortcut_init(), usage(), main(), search_init(), nano.1,
|
||||
nano.texi, etc. (DLR)
|
||||
- Various cleanups and improvements in chars.c. Remove some
|
||||
unnecessary w?ctype wrappers and variables; change the wctype
|
||||
wrappers to take wint_t instead of wchar_t to match the
|
||||
functions they wrap; rename some functions for consistency;
|
||||
add functions to detect blank characters in a string, for use
|
||||
in rcfile option parsing; and don't count matches between
|
||||
valid and invalid multibyte sequences anymore, as it causes
|
||||
problems when doing a replace. New functions
|
||||
is_valid_mbstring(), has_blank_chars(), and
|
||||
has_blank_mbchars(); changes to is_alnum_mbchar(),
|
||||
is_blank_char() (renamed nisblank()), is_blank_mbchar(),
|
||||
is_blank_wchar() (renamed niswblank()), is_cntrl_wchar(),
|
||||
control_rep(), control_mbrep(), make_mbstring() (renamed
|
||||
make_valid_mbstring()), mbstrncasecmp(), mbstrcasestr(),
|
||||
mbrevstrcasestr(), etc.; removal of is_alnum_char() and
|
||||
is_alnum_wchar(). (DLR)
|
||||
- Implement word count via Meta-D at the main window. Note that
|
||||
this is disabled when NANO_SMALL is defined. Also, convert
|
||||
all word detection functions to use the same wrapper function
|
||||
for ease of maintenance, and make them return more
|
||||
information. New functions is_punct_mbchar(),
|
||||
is_word_mbchar(), do_next_word_void(), do_prev_word_void(),
|
||||
and do_word_count(); changes to shortcut_init(),
|
||||
do_next_word(), do_prev_word(), is_whole_word(),
|
||||
do_statusbar_next_word(), and do_statusbar_prev_word(). (DLR)
|
||||
- Fix #ifdefs so that nano compiles with NANO_SMALL defined and
|
||||
DISABLE_TABCOMP undefined. Changes to revstrstr() and
|
||||
free_charptrarray() (renamed free_chararray()). (DLR)
|
||||
- Change the wctype wrappers to take wchar_t's again, as they
|
||||
still work the same way with them. This also fixes
|
||||
compilation on Mac OS X 10.4.1, which doesn't seem to define a
|
||||
wint_t type. (DLR, found by Emily Jackson)
|
||||
- Add the ability to convert typed tabs to spaces using
|
||||
the -E/--tabstospaces command line options, the "tabstospaces"
|
||||
rcfile option, and the toggle Meta-Q (since QBasic did this by
|
||||
default :)). Note that this doesn't affect tabs entered using
|
||||
verbatim input, and that it's disabled when NANO_SMALL is
|
||||
defined. Also, change the short command line option for
|
||||
--backupdir from -E to -C. Changes to toggle_init(), usage(),
|
||||
do_tab(), main(), nanorc.sample, nano.1, nanorc.5, and
|
||||
nano.texi. (DLR, suggested by many people)
|
||||
- Change the CONSTUPDATE, REVERSE_SEARCH, and SMOOTHSCROLL flags
|
||||
to the CONST_UPDATE, BACKWARDS_SEARCH, and SMOOTH_SCROLL
|
||||
flags, respectively. (DLR)
|
||||
- Change the SMOOTHSCROLL flag to the SMOOTH_SCROLL flag. (DLR)
|
||||
- Change the NO_UTF8 flag to the USE_UTF8 flag, and reverse its
|
||||
meaning. (DLR)
|
||||
- Add rcfile options "casesensitive" and "backwards", to do
|
||||
case sensitive and backwards searches by default. Changes to
|
||||
nanorc.sample and nanorc.5. (DLR)
|
||||
- Since the DISABLE_CURPOS flag is only used in winio.c, reduce
|
||||
it to a static bool there. Changes to statusbar() and
|
||||
disable_cursorpos(). (DLR)
|
||||
- Add -U/--quickblank option and a "quickblank" rcfile option to
|
||||
blank the statusbar after 1 keystroke instead of 25. Note
|
||||
that this obviously has no effect when constant cursor
|
||||
position display is turned on, and that this is disabled when
|
||||
NANO_SMALL is defined. Changes to usage(), main(),
|
||||
statusbar(), nanorc.sample, nano.1, and nanorc.5. (DLR,
|
||||
suggested by CHAO Wei-Lun)
|
||||
- Add support for case insensitive expression matching when
|
||||
using color syntax highlighting, via the "icolor" directive,
|
||||
and add it to those regexes that can use it. Changes to
|
||||
parse_colors(), parse_rcfile(), nanorc.sample, and nanorc.5.
|
||||
(Brand Huntsman, minor tweaks by DLR)
|
||||
- Add various type changes to avoid problems on systems where
|
||||
int and ssize_t are different sizes. Make filestruct->lineno
|
||||
a ssize_t (so that we can avoid negative line numbers at the
|
||||
"Go To Line" prompt), current_y a ssize_t (in order to hold
|
||||
the maximum difference between two filestruct->lineno's),
|
||||
totlines a size_t, and change related variables to match.
|
||||
(DLR, initial problem with parse_line_column() found by Mike
|
||||
Frysinger)
|
||||
- Rework the credits handling to display Florian König's name
|
||||
properly whether we're in a UTF-8 locale or not, and without
|
||||
requiring a massive function that we only use once. Changes
|
||||
to do_credits(); removal of make_valid_mbstring(). (DLR)
|
||||
- chars.c:
|
||||
make_mbstring()
|
||||
- Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a
|
||||
compilation problem when --enable-nanorc isn't used and
|
||||
--enable-extra is. (DLR)
|
||||
- color.c:
|
||||
update_color()
|
||||
- Use mbstrcasecmp() instead of strcasecmp(), so that UTF-8
|
||||
color syntax names are properly detected. (DLR)
|
||||
- cut.c:
|
||||
cut_line()
|
||||
- Set placewewant properly after cutting a line, to avoid a
|
||||
problem where the screen won't be updated if (a) we're not on
|
||||
the first page when we cut the line, and (b) immediately after
|
||||
we cut the line, we hit End to move to the end of the line
|
||||
after it. (DLR)
|
||||
- files.c:
|
||||
read_line()
|
||||
- Rename variable prev to prevnode to avoid confusion. (DLR)
|
||||
- Rename variable len to buf_len, for consistency. (DLR)
|
||||
load_open_file()
|
||||
- Remove an unneeded clearok(FALSE). (DLR)
|
||||
get_next_filename()
|
||||
- Use an unsigned long instead of an int for the number
|
||||
prepended to the filename. (DLR)
|
||||
do_insertfile()
|
||||
- Set i to 0 when we get a filename via the file browser, so
|
||||
that it's read in properly when we exit the file browser.
|
||||
(DLR)
|
||||
open_prevnext_file()
|
||||
- Move up a misplaced assert. (DLR)
|
||||
- Rename variable next to next_file, to avoid confusion. (DLR)
|
||||
write_file()
|
||||
- Since lineswritten is a size_t, print its value as an unsigned
|
||||
long instead of an unsigned int. (DLR)
|
||||
- Declare the size_t i only in the loop where it's used. (DLR)
|
||||
diralphasort()
|
||||
- Use mbstrcasecmp() instead of strcasecmp(), so that UTF-8
|
||||
filenames are sorted properly. (DLR)
|
||||
cwd_tab_completion(), browser_init()
|
||||
- Rename variable next to nextdir to avoid confusion. (DLR)
|
||||
input_tab()
|
||||
- Since list is a bool, set it to FALSE instead of 0. (DLR)
|
||||
- Add multibyte/wide character support, so that we don't end up
|
||||
with a string that contains only part of a multibyte
|
||||
character during tab completion. (DLR)
|
||||
- Rename variable buflen to buf_len, for consistency. (DLR)
|
||||
do_browser()
|
||||
- Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for
|
||||
consistency. (DLR)
|
||||
- When displaying "(dir)" in the available screen space, make
|
||||
sure that the string it's stored in is always null-terminated.
|
||||
(DLR)
|
||||
- Rename variable selectedbackup to old_selected, for
|
||||
consistency. (DLR)
|
||||
- Make mouse clicks in the browser window work properly when the
|
||||
MORE_SPACE flag is set. (DLR)
|
||||
- Make foo_len a size_t instead of an int. (DLR)
|
||||
save_history()
|
||||
- Properly save history when we're in view mode. (DLR)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Move the "Refresh" and "Exit" shortcuts to the beginning of
|
||||
the help browser shortcut list, for consistency. (DLR)
|
||||
- Remove unnecessary "Refresh" placeholder in the file browser
|
||||
shortcut list. (DLR)
|
||||
- Allow the mark to be used in view mode, as Pico does. (DLR)
|
||||
- Clarify the description of ^X when --enable-multibuffer is
|
||||
used. (DLR)
|
||||
- Change the description of the Meta-B toggle at the search
|
||||
prompt from "Direction" to "Backwards", for consistency. (DLR)
|
||||
toggle_init()
|
||||
- Clarify the descriptions of M-C and M-L. (DLR)
|
||||
- Reorder the toggles to put more toggles with similar functions
|
||||
together. (DLR)
|
||||
thanks_for_all_the_fish()
|
||||
- Remove free_toggles() and move its code here verbatim, as it's
|
||||
only called here anyway. (David Benbennick)
|
||||
- Fix the code to free all open file buffers to work properly
|
||||
with the previous overhaul of the multibuffer code instead of
|
||||
going into an infinite loop. (David Benbennick)
|
||||
- Add additional checks for variables' not being NULL before we
|
||||
try to free them, to avoid assertion failures. (DLR)
|
||||
- nano.c:
|
||||
die()
|
||||
- Rename variable ret to retval for consistency. (DLR)
|
||||
- Tweak the message displayed when a backup file can't be
|
||||
written, so as to not duplicate a translated string. (DLR)
|
||||
- If the current filestruct's been partitioned, unpartition it
|
||||
before saving the associated file. (DLR)
|
||||
resize_variables()
|
||||
- Use charset() instead of memset() to initialize hblank. (DLR)
|
||||
copy_filestruct()
|
||||
- Rename variable prev to copy to avoid confusion. (DLR)
|
||||
print1opt_full()
|
||||
- If desc should be empty, allow it to be NULL instead of
|
||||
"", since the latter is not necessarily translated as "".
|
||||
(DLR, found by Jordi)
|
||||
usage()
|
||||
- Add missing N_() around one message, so that it isn't
|
||||
erroneously translated twice. (DLR)
|
||||
- Remove inaccurate default listed for -Q/--quotestr. (DLR)
|
||||
version()
|
||||
- Add --enable-utf8 to the displayed compilation options, put
|
||||
the options in alphabetical order, and handle --enable-tiny
|
||||
the same way as all the other options. (DLR)
|
||||
do_tab()
|
||||
- Remove unneeded variable kbinput. (DLR)
|
||||
do_int_spell_fix()
|
||||
- Display highlighted misspelled words using display_string(),
|
||||
as do_replace_loop() does. (DLR)
|
||||
do_alt_speller()
|
||||
- Replace a set_modified() with SET(MODIFIED) to avoid an
|
||||
unnecessary update, and remove an unneeded clearok(FALSE).
|
||||
(DLR)
|
||||
- Move the spell checking error handling block down and refactor
|
||||
it so that we go back into curses mode, reinitialize the
|
||||
terminal, turn the cursor back on, and turn the mark back on
|
||||
if necessary before returning the error message. (DLR)
|
||||
do_spell()
|
||||
- If the spell-checker printed any error messages onscreen, call
|
||||
total_refresh() to make sure they're cleared off. (DLR, found
|
||||
by CHAO Wei-Lun)
|
||||
find_paragraph()
|
||||
- Reset placewewant as well as current_x to 0, in order to avoid
|
||||
a potential screen update problem. (DLR)
|
||||
do_justify()
|
||||
- Save placewewant, and restore it if we unjustify, in order to
|
||||
avoid a potential screen update problem. (DLR)
|
||||
do_output()
|
||||
- Properly allow wrapping when we insert a tab, for consistency.
|
||||
(DLR)
|
||||
- Don't set current_len until after it's been asserted that both
|
||||
current and current->data aren't NULL. (DLR)
|
||||
do_toggle()
|
||||
- Properly treat color syntax highlighting as enabled by
|
||||
default, and only treat wrapping as enabled by default when
|
||||
DISABLE_WRAPPING isn't defined. (DLR)
|
||||
disable_extended_input()
|
||||
- Disable extended output processing as well as extended input
|
||||
processing, and rename to disable_extended_io(). (DLR)
|
||||
disable_flow_control(), enable_flow_control()
|
||||
- Only turn off flow control on output, as it might be needed
|
||||
for input on slow terminals. (DLR)
|
||||
- nano.h:
|
||||
- Add macro charset(), a wrapper that calls memset(). (DLR)
|
||||
- Readd #defines for the isblank() and iswblank() equivalents.
|
||||
(DLR)
|
||||
- In the colortype struct, make bright a bool instead of an int,
|
||||
for consistency. (DLR)
|
||||
- proto.h:
|
||||
- Add missing NANO_SMALL and HAVE_REGEX_H #ifdefs around the
|
||||
do_find_bracket() prototype. (DLR)
|
||||
- rcfile.c:
|
||||
color_to_int()
|
||||
- Since colorname's being NULL is handled elsewhere now, assert
|
||||
that it isn't NULL at the beginning of the function. (DLR)
|
||||
parse_colors()
|
||||
- Properly parse a background color without a foreground color.
|
||||
(DLR)
|
||||
- Properly generate an error if we get a color directive without
|
||||
a regex string. (DLR)
|
||||
parse_rcfile()
|
||||
- Properly generate an error if we get an invalid multibyte
|
||||
string for an option, instead of working around it. (DLR)
|
||||
- Use has_blank_mbchars() to check for blank characters in the
|
||||
"punct" and "brackets" options, and clarify the error message
|
||||
displayed when we find blank characters. (DLR)
|
||||
- search.c:
|
||||
do_gotoline()
|
||||
- Properly show an error message if we try to go to line 0,
|
||||
since the first line in the file is 1. (DLR)
|
||||
- Start the search for a line from fileage instead of current
|
||||
(again). (DLR)
|
||||
replace_regexp()
|
||||
- Rename variables create_flag and new_size to create and
|
||||
new_line_size, for consistency. (DLR)
|
||||
- Make new_line_size, search_match_count, and i size_t's, for
|
||||
consistency. (DLR)
|
||||
replace_line()
|
||||
- Make new_line_size and search_match_count size_t's, for
|
||||
consistency. (DLR)
|
||||
do_replace_loop()
|
||||
- When moving to the next match, update the screen using
|
||||
edit_refresh() instead of edit_redraw(), as the latter won't
|
||||
work properly when we've replaced one or more instances of a
|
||||
string in copy and haven't yet updated current->data to match
|
||||
copy. (DLR)
|
||||
do_find_bracket()
|
||||
- Miscellaneous cleanups: rename variables for consistency, and
|
||||
save the search direction and regexp setting in two bools
|
||||
instead of one flags variable. (DLR)
|
||||
- utils.c:
|
||||
num_of_digits()
|
||||
- Use a size_t instead of an int, and rename to digits(). (DLR)
|
||||
align()
|
||||
- Rename variable strp to str for consistency. (DLR)
|
||||
- winio.c:
|
||||
do_statusbar_output()
|
||||
- Don't set answer_len until after it's been asserted that
|
||||
answer isn't NULL. (DLR)
|
||||
display_string()
|
||||
- Avoid a memory corruption problem by allocating enough space
|
||||
for len plus a trailing multibyte character and/or tab. (DLR)
|
||||
- Don't check for multicolumn characters if the NO_UTF8 flag
|
||||
isn't set. (DLR)
|
||||
- Free buf_mb when we're done using it. (DLR)
|
||||
nanogetstr()
|
||||
- Rename variable def to curranswer to avoid confusion. (DLR)
|
||||
- Only declare and use the tabbed variable if DISABLE_TABCOMP
|
||||
isn't defined. (DLR)
|
||||
- Refactor to replace unnecessary variable answer_len with
|
||||
curranswer_len, and hence avoid an assertion failure involving
|
||||
the former. (DLR)
|
||||
statusq()
|
||||
- Rename variable which_history to history_list, for
|
||||
consistency. (DLR)
|
||||
- Rename variables def and ret to curranswer and retval to avoid
|
||||
confusion. (DLR)
|
||||
- Call wnoutrefresh(bottomwin) after getting an answer and
|
||||
blanking out the statusbar, to make sure that the blanking is
|
||||
done. This fixes a problem where the statusbar is not
|
||||
properly blanked after using the "Go To Line" prompt with the
|
||||
NO_HELP flag set. (DLR)
|
||||
titlebar()
|
||||
- Use actual_x() to calculate the number of characters VERMSG
|
||||
takes up, in case it's UTF-8. (DLR)
|
||||
do_cursorpos()
|
||||
- Properly display the value of totsize as unsigned. (DLR)
|
||||
- If constant is TRUE, only display the cursor position when
|
||||
disable_cursorpos is FALSE. Don't refuse to display it when
|
||||
the cursor position hasn't changed, as that doesn't always
|
||||
keep it properly updated. (DLR, found by Mike Frysinger)
|
||||
do_help()
|
||||
- Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for
|
||||
consistency. (DLR)
|
||||
statusbar()
|
||||
- Set statusblank to 25 instead of 26, to match current Pico.
|
||||
(DLR)
|
||||
edit_redraw()
|
||||
- Make do_refresh a bool instead of an int. (DLR)
|
||||
do_yesno()
|
||||
- Allow refreshing the screen via Ctrl-L, as Pico does. (DLR)
|
||||
- Add a missing assert, and use actual_x() to calculate the
|
||||
number of characters buf takes up, in case it's UTF-8. (DLR)
|
||||
- Get input from bottomwin instead of edit, so that the cursor
|
||||
isn't erroneously put in the edit window while we wait for an
|
||||
answer. (DLR)
|
||||
- Call wnoutrefresh(edit) to make sure that the edit window is
|
||||
refreshed before we get input, as statusq() does. (DLR)
|
||||
total_redraw()
|
||||
- Simplify to just call wrefresh() on curscr, which updates the
|
||||
entire screen in one function call without moving the cursor
|
||||
from the window it's currently in. (DLR)
|
||||
- When using slang, use SLsmg_touch_screen() and SLsmg_refresh()
|
||||
to update the screen, as slang doesn't define curscr. (DLR)
|
||||
do_replace_highlight()
|
||||
- Use waddch() instead of waddstr() to display a space when we
|
||||
have a zero-length regex. (DLR)
|
||||
- Rename variable highlight_flag to highlight, for consistency.
|
||||
(DLR)
|
||||
do_credits()
|
||||
- Save the keystroke that breaks us out of the credits (if any)
|
||||
and put it back so that it isn't lost. This is especially
|
||||
needed if the keystroke is part of a multibyte character.
|
||||
(DLR)
|
||||
- nano.1:
|
||||
- Clarify and consolidate the descriptions of --fill and
|
||||
--tabsize. (DLR)
|
||||
- nanorc.5:
|
||||
- Update the description of how the "color" regex works. (DLR)
|
||||
- Clarify descriptions of the characters that aren't allowed
|
||||
in the "punct" or "brackets" options. (DLR)
|
||||
- Use .B instead of \fB ... \fP where possible, as nano.1 does.
|
||||
(DLR)
|
||||
- Clarify and consolidate the descriptions of "fill" and
|
||||
"tabsize". (DLR)
|
||||
- nano.texi:
|
||||
- Update the "Feature Toggles" section to match current nano.
|
||||
(DLR)
|
||||
- Clarify and consolidate the descriptions of --fill and
|
||||
--tabsize. (DLR)
|
||||
- configure.ac:
|
||||
- Minor tweaks to some of the test blocks to avoid XSI:isms.
|
||||
(DLR, adapted from a Debian patch for GNU ed by David
|
||||
Weinehall)
|
||||
- Don't refer to the built-in file browser as crappy anymore.
|
||||
(DLR)
|
||||
- Check for iswpunct() and mbstowcs(). (DLR)
|
||||
- Change the behavior of --enable-extra to only define
|
||||
NANO_EXTRA, instead of defining both it and
|
||||
ENABLE_MULTIBUFFER. (DLR)
|
||||
- Check for get_wch() instead of wget_wch() to determine if
|
||||
there's a wide curses library, as it's a more generic
|
||||
function. (DLR)
|
||||
- Check for possibly unavailable functions in alphabetical
|
||||
order. (DLR)
|
||||
- doc/faq.html:
|
||||
- Update section 1.1 to mention the current maintainer. (DLR)
|
||||
- Minor capitalization and wording fixes. (DLR)
|
||||
- Update description of --enable-extra, and add missing line
|
||||
breaks. (DLR)
|
||||
- doc/nanorc.sample:
|
||||
- In the "nanorc" regexes, tweak the "color" regex to properly
|
||||
color a line that specifies a background color without a
|
||||
foreground color, and update the associated comments. (DLR)
|
||||
- Clarify descriptions of the characters that aren't allowed
|
||||
in the "punct" or "brackets" options. (DLR)
|
||||
- Update comment referring to --enable-extra. (DLR)
|
||||
- Add "cxx" and "hxx" to the list of extensions that the
|
||||
"c-file" regexes apply to, and add "warning" and "error" to
|
||||
them as well. (Mike Frysinger)
|
||||
- Add regexes for assembler files. (Mike Frysinger)
|
||||
- In the preprocessor directives regex string in the "c-file"
|
||||
regexes, cover more whitespace characters than just " " by
|
||||
using "[[:space:]]" instead. (Mike Frysinger) DLR: Extend
|
||||
this to other regex strings whenever possible.
|
||||
- Move some overly long split-up regex strings that cover
|
||||
similar areas onto the same line. (DLR)
|
||||
- Add GCC builtins to the "c-file" regexes. (Mike Frysinger)
|
||||
- Simplify the file extension regex for groff. (DLR)
|
||||
- Clarify and consolidate the descriptions of "fill" and
|
||||
"tabsize". (DLR)
|
||||
- Makefile.am, m4/Makefile.am:
|
||||
- Make sure that the files in EXTRA_DIST are in alphabetical
|
||||
order, and that the lines are wrapped at 72 characters. (DLR)
|
||||
- doc/man/fr/Makefile.am:
|
||||
- Set mandir to @mandir@/fr, so French manpages get installed
|
||||
where they belong (Jordi).
|
||||
- THANKS:
|
||||
- Add new translators to the credits.
|
||||
|
||||
GNU nano 1.3.7 - 2005.04.10
|
||||
- General:
|
||||
- Miscellaneous comment fixes. (DLR)
|
||||
- After (re)initializing the terminal, make sure the cursor is
|
||||
always turned on. Changes to do_alt_speller(),
|
||||
handle_sigwinch(), and main(). (DLR)
|
||||
- Make sure that all references to cut-to-end are left out when
|
||||
NANO_SMALL is defined. Changes to cut_to_eol(),
|
||||
do_cut_text(), and do_statusbar_cut_text(). (DLR)
|
||||
- chars.c:
|
||||
make_mbchar()
|
||||
- Remove unneeded assert. (DLR)
|
||||
move_mbleft()
|
||||
- Fix assert to reference the proper variable, so that nano
|
||||
builds with DEBUG defined again. (Mike Frysinger, found by
|
||||
Dmitri Vassilenko)
|
||||
- files.c:
|
||||
do_insertfile()
|
||||
- Fix problem where going into the help browser at the "Insert
|
||||
File" prompt would always result in the current answer's being
|
||||
used as the filename afterward. (DLR)
|
||||
get_full_path()
|
||||
- Rework handling of the results of getcwd() in order to avoid
|
||||
segfaults if they fail, and to remove uses of the nonportable
|
||||
GNU extension where passing a size of 0 will get a string as
|
||||
long as we need. (DLR)
|
||||
do_browser()
|
||||
- Rename variable lineno to fileline to avoid confusion. (DLR)
|
||||
do_browse_from()
|
||||
- Rework handling of the results of getcwd() in order to avoid
|
||||
segfaults if they fail, and to remove uses of the nonportable
|
||||
GNU extension where passing a size of 0 will get a string as
|
||||
long as we need. (DLR)
|
||||
- nano.c:
|
||||
help_init()
|
||||
- When calculating allocsize, take multibyte characters into
|
||||
account, and keep the column number limits consistent. (DLR)
|
||||
- Break htx up into three chunks, in case the string is too long
|
||||
for the compiler to handle (e.g. an ISO C89 compiler that can
|
||||
only handle up to 509 characters). (DLR)
|
||||
- Minor wording fixes. (DLR)
|
||||
print1opt()
|
||||
- Don't include longflag if HAVE_GETOPT_LONG isn't defined.
|
||||
Rename this function to print1opt_full(), leave out the
|
||||
longflag parameter if HAVE_GETOPT_LONG isn't defined, and make
|
||||
print1opt() a macro for print1opt_full() that does that
|
||||
without the need for a lot of extra #ifdefs. (David
|
||||
Benbennick) DLR: Rename print1opt_f() to print1opt_full().
|
||||
- Rework the special case of options that are ignored for Pico
|
||||
compatibility so that they display more neatly when
|
||||
HAVE_GETOPT_LONG isn't defined. (DLR)
|
||||
usage()
|
||||
- Fix erroneous #ifdef that resulted in the -d/--rebinddelete
|
||||
option's not being printed when NANO_SMALL was defined. (DLR)
|
||||
find_paragraph()
|
||||
- Fix problem where a search for the next paragraph would skip
|
||||
over certain cases of one-line paragraphs. (DLR)
|
||||
do_justify()
|
||||
- Instead of breaking a line at a space and readding the space
|
||||
afterwards, just break the line after the space, as it's more
|
||||
efficient. (DLR)
|
||||
main()
|
||||
- Change 0 to NULL in the option struct where needed. (David
|
||||
Benbennick)
|
||||
- nano.h:
|
||||
- Define PATH_MAX as 4096 if it isn't defined, as passing a size
|
||||
of 0 to get a string as long as we need is a nonportable GNU
|
||||
extension, and hence it won't work on non-GNU systems that
|
||||
don't define PATH_MAX. (DLR)
|
||||
- rcfile.c:
|
||||
parse_rcfile()
|
||||
- Fix debugging message to display the long value of a flag
|
||||
properly. (DLR)
|
||||
- utils.c:
|
||||
regexec_safe()
|
||||
- Rename to safe_regexec() for consistency. (DLR)
|
||||
- winio.c:
|
||||
nanogetstr()
|
||||
- Fix misplaced break. (DLR)
|
||||
statusq()
|
||||
- Make sure that the vsnprintf(foo) call and foo's subsequent
|
||||
null termination both take the proper number of bytes when
|
||||
using multibyte characters, so that multibyte prompt strings
|
||||
aren't prematurely cut off. (DLR)
|
||||
titlebar()
|
||||
- Make sure that the (mv)?waddnstr() calls take the proper
|
||||
number of bytes when using multibyte characters, so that
|
||||
multibyte strings aren't prematurely cut off. (DLR, found by
|
||||
Jordi)
|
||||
- Allow the "View" state to be displayed when a filename is
|
||||
passed in, in case we're in multibuffer mode and inside the
|
||||
file browser. (DLR)
|
||||
help_line_len()
|
||||
- Make the text display more flexible, and closer to what nano
|
||||
1.2.x does. (DLR)
|
||||
- configure.ac:
|
||||
- Allow more flexible handling of UTF-8 support by allowing
|
||||
the --enable-utf8 and --disable-utf8 options. (Mike
|
||||
Frysinger) DLR: Extend these options to work with slang as
|
||||
well as curses, consolidate the warning and error messages
|
||||
dealing with UTF-8 support as much as possible, and add a few
|
||||
minor consistency fixes.
|
||||
- Mention explicitly that the check for the broken regexec() is
|
||||
needed for glibc 2.2.3. (DLR)
|
||||
- nanorc.sample:
|
||||
- Fix the description for the whitespace option to mention that
|
||||
only single-column characters are allowed. (DLR)
|
||||
- Add C++ regexes. (Neil Brown, merged into c-file regexes by
|
||||
DLR)
|
||||
- Break up overly long perl and nanorc regexes into separate
|
||||
regexes of no more than 256 bytes, as POSIX-compliant regexp
|
||||
implementations can reject regexes of over 256 bytes. (DLR)
|
||||
- nano.1, nano.texi:
|
||||
- Mention the -? alias for -h/--help, and add various
|
||||
consistency fixes. (DLR)
|
||||
- nanorc.5:
|
||||
- Fix the description for the whitespace option to mention that
|
||||
only single-column characters are allowed. (DLR)
|
||||
|
||||
GNU nano 1.3.6 - 2005.03.20
|
||||
- General:
|
||||
- More int -> bool conversions. (DLR and David Benbennick)
|
||||
@@ -322,7 +906,7 @@ GNU nano 1.3.6 - 2005.03.20
|
||||
- Refresh bottomwin using the value of currshortcut, and change
|
||||
the code around do_refresh() calls to accommodate this. (DLR)
|
||||
- Split out the code that updates the screen before refreshing
|
||||
it into the new function total_update().
|
||||
it into the new function total_redraw().
|
||||
do_help()
|
||||
- Refresh the screen when Ctrl-L is pressed in the help browser,
|
||||
as Pico does. (DLR)
|
||||
@@ -407,7 +991,7 @@ GNU nano 1.3.5 - 2004.11.22
|
||||
functions open_file(), execute_command(), and mallocstrassn();
|
||||
changes to read_line(), load_file(), read_file(), open_file(),
|
||||
get_next_filename(), do_insertfile(), do_insertfile_void(),
|
||||
do_alt_speller(), and edit_refresh(). (David Benbennick) DLR:
|
||||
do_alt_speller(), and edit_refresh(). (David Benbennick) DLR:
|
||||
Add a few minor fixes to make sure that current is set
|
||||
properly in all cases, indicate on the statusbar when the file
|
||||
has a mix of DOS and Mac format lines, move the test for DOS
|
||||
@@ -446,7 +1030,7 @@ GNU nano 1.3.5 - 2004.11.22
|
||||
- After reading in a file and detecting the format it's in, set
|
||||
the file format flags (DOS_FILE and MAC_FILE) to match, and
|
||||
preserve them across multiple file buffers. Changes to
|
||||
read_file(), add_open_file(), and load_open_file(). (DLR,
|
||||
read_file(), add_open_file(), and load_open_file(). (DLR,
|
||||
suggested by Bill Soudan)
|
||||
- Remove the -D/--dos and -M/--mac command line options, as they
|
||||
aren't much use with the new file format autodetection. Also
|
||||
|
||||
@@ -3,8 +3,8 @@ 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
|
||||
EXTRA_DIST = ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS \
|
||||
README THANKS TODO UPGRADE config.rpath install-sh \
|
||||
missing mkinstalldirs nano.spec
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
36
NEWS
36
NEWS
@@ -1,6 +1,40 @@
|
||||
2005.06.30 - GNU nano 1.3.8 floats at its own level. This release
|
||||
contains several new features. Among other things, you
|
||||
can now move to a specified column number as well as
|
||||
line number within a file, file backups saved in a
|
||||
backup directory will have unique names, the search and
|
||||
replace history routines should work more consistently,
|
||||
you can get a word count by pressing Meta-D at the edit
|
||||
window, and there's a new -E/--tabstospaces option to
|
||||
convert all typed tabs to spaces (--backupdir's short
|
||||
option has been changed to -C). In terms of bugfixes,
|
||||
this release contains fixes for minor problems with
|
||||
screen updates, UTF-8 display, and flow control; a fix
|
||||
for a segfault when displaying some lines ending with
|
||||
tabs; better handling of constant cursor position
|
||||
display; improved color parsing in the rcfile; and
|
||||
support for the "Regexp" toggle in tiny mode
|
||||
(-R/--regexp is gone, and --restricted's short option
|
||||
has been changed to -R), among other things. Enjoy.
|
||||
|
||||
2005.04.10 - GNU nano 1.3.7 claws its way to the top. This release
|
||||
mostly contains bugfixes for the massive amount of new
|
||||
code in 1.3.6. Among other things, nano builds with
|
||||
debug support again; going into the help browser at the
|
||||
"Read File" prompt no longer kicks you out of the prompt
|
||||
after you exit the help browser; paragraph searching no
|
||||
longer skips over certain cases of single-line
|
||||
paragraphs; the titlebar no longer cuts off some UTF-8
|
||||
strings prematurely; and the text displayed in the help
|
||||
browser is now wrapped as it was in nano 1.2.x, taking
|
||||
UTF-8 support into account. New features include an
|
||||
--enable/disable-utf8 configure option to explicitly
|
||||
turn detection of UTF-8 support on or off, and sample
|
||||
regexes for C++ as well as C. Have fun.
|
||||
|
||||
2005.03.20 - GNU nano 1.3.6 "shout it from the rooftops" is released.
|
||||
This release finally includes the long-awaited support
|
||||
for UTF-8. Other new features include the ability to
|
||||
for UTF-8. Other new features include the ability to
|
||||
insert UTF-8 characters using verbatim input; the
|
||||
ability to delete all text from the cursor position to
|
||||
the end of the file via ^W^X as (patched) Pico does;
|
||||
|
||||
@@ -30,8 +30,8 @@ $ setenv CVS_RSH ssh
|
||||
After it's set up, use the following command to download the CVS tree:
|
||||
$ cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/nano checkout nano
|
||||
|
||||
If you want to download the stable CVS branch, add "-r nano_1_0_branch":
|
||||
$ cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/nano checkout -r nano_1_0_branch nano
|
||||
If you want to download the stable CVS branch, add "-r nano_1_2_branch":
|
||||
$ cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/nano checkout -r nano_1_2_branch nano
|
||||
|
||||
Once you have the sources in the "nano" directory, cd into it, and
|
||||
execute the "autogen.sh" script in the top directory. This will set up
|
||||
|
||||
2
THANKS
2
THANKS
@@ -37,6 +37,7 @@ Pierre Tane <tanep@bigfoot.com> French translator
|
||||
Jacobo Tarrío <jtarrio@trasno.net> Galician translator
|
||||
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian nynorsk translator
|
||||
Miquel Vidal <miquel@sindominio.net> Catalan translator
|
||||
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese translator
|
||||
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish translator
|
||||
Peio Ziarsolo <peio@sindominio.net> Basque translator
|
||||
|
||||
@@ -53,5 +54,4 @@ Jeremy Robichaud <robicj@yahoo.com> Beta tester
|
||||
Bill Soudan <wes0472@rit.edu> Regex code, etc
|
||||
Ken Tyler <kent@werple.net.au> Search fixes and more
|
||||
|
||||
|
||||
$Id$
|
||||
|
||||
5
TODO
5
TODO
@@ -2,12 +2,11 @@ TODO file (? means the feature may be implemented, but not definitely)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
For version 1.4:
|
||||
- UTF-8 support. [DONE except for the NO_CONVERT flag, which should
|
||||
allow editing UTF-8 as raw bytes.]
|
||||
- UTF-8 support. [DONE]
|
||||
- Support for paragraph searches. [DONE]
|
||||
- Support for justifying the entire file at once. [DONE]
|
||||
- Support for filename searches in the file browser.
|
||||
- Undo/Redo key?
|
||||
- Undo/Redo keys?
|
||||
- Rebindable keys?
|
||||
- Keystroke to implement "Add next sequence as raw" like vi's ^V. [DONE]
|
||||
- Spell check selected text only. [DONE]
|
||||
|
||||
406
configure.ac
406
configure.ac
@@ -2,24 +2,24 @@
|
||||
#
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
#
|
||||
# GNU nano is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
# GNU nano 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) any
|
||||
# later version.
|
||||
#
|
||||
# GNU nano is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# GNU nano is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GNU nano; if not, write to the Free Software
|
||||
# Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [1.3.6], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [1.3.8], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
@@ -28,6 +28,7 @@ AC_CONFIG_HEADERS([config.h])
|
||||
AC_PREREQ(2.54)
|
||||
|
||||
dnl Checks for programs.
|
||||
|
||||
AC_GNU_SOURCE
|
||||
AC_PROG_CC
|
||||
AC_PROG_LN_S
|
||||
@@ -35,14 +36,16 @@ AC_ISC_POSIX
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
dnl Internationalization macros.
|
||||
|
||||
AM_GNU_GETTEXT_VERSION(0.11.5)
|
||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
||||
|
||||
dnl Checks for header files.
|
||||
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h regex.h termios.h wchar.h wctype.h)
|
||||
AC_CHECK_HEADER(regex.h,
|
||||
AC_MSG_CHECKING([for broken regexec])
|
||||
AC_MSG_CHECKING([for broken regexec from glibc 2.2.3])
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
@@ -58,94 +61,94 @@ int main(void)
|
||||
}],
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions.]),
|
||||
AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions, as the one from glibc 2.2.3 does.]),
|
||||
AC_MSG_RESULT([cross-compiling; assuming no])))
|
||||
|
||||
dnl options
|
||||
dnl Checks for options.
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Enable debugging (disabled by default)],
|
||||
[if test x$enableval = xyes; then
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
|
||||
debug_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
if test "$debug_support" != "yes"; then
|
||||
if test x$debug_support != xyes; then
|
||||
AC_DEFINE(NDEBUG, 1, [Shut up the assert warnings :-)])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(extra,
|
||||
[ --enable-extra Enable extra (optional) functions, including easter eggs],
|
||||
[ --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(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(tiny,
|
||||
[ --enable-tiny Disable features for the sake of size],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(NANO_SMALL, 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 (crappy) file browser.])
|
||||
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 menu.])
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
||||
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_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(browser,
|
||||
[ --disable-browser Disable mini file browser],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in (crappy) file browser.])
|
||||
fi])
|
||||
[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],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(justify,
|
||||
[ --disable-justify Disable justify/unjustify function],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(mouse,
|
||||
[ --disable-mouse Disable mouse support (and -m flag)],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(operatingdir,
|
||||
[ --disable-operatingdir Disable setting of operating directory (chroot of sorts)],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(speller,
|
||||
[ --disable-speller Disable spell checker function],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(tabcomp,
|
||||
[ --disable-tabcomp Disable tab completion code for a smaller binary],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(wrapping,
|
||||
[ --disable-wrapping Disable all wrapping of text (and -w flag)],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable any and all text wrapping.])
|
||||
fi])
|
||||
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
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_ROOTWRAP, 1, [Define this to disable wrapping as root by default.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(color,
|
||||
[ --enable-color Enable color and syntax highlighting],
|
||||
@@ -164,13 +167,13 @@ AC_ARG_ENABLE(multibuffer,
|
||||
[ --enable-multibuffer Enable multiple file buffers],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(nanorc,
|
||||
[ --enable-nanorc Enable use of .nanorc file],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(all,
|
||||
[ --enable-all Enable ALL extra nano functionality (kitchen sink option)],
|
||||
@@ -184,9 +187,20 @@ AC_ARG_ENABLE(all,
|
||||
*** WARNING: Color support is far from perfect, but functional. ***
|
||||
*** Be careful with syntax in your .nanorc or nano may malfunction. ***
|
||||
***********************************************************************
|
||||
])
|
||||
])
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING([whether to enable UTF-8 support])
|
||||
AC_ARG_ENABLE(utf8,
|
||||
[ --enable-utf8 Enable UTF-8 support],
|
||||
[if test x$enableval = xyes; then
|
||||
enable_utf8=yes
|
||||
else
|
||||
enable_utf8=no
|
||||
fi],
|
||||
[enable_utf8=auto])
|
||||
AC_MSG_RESULT($enable_utf8)
|
||||
|
||||
AC_MSG_CHECKING([whether to use slang])
|
||||
CURSES_LIB_NAME=""
|
||||
AC_ARG_WITH(slang,
|
||||
@@ -198,61 +212,17 @@ AC_ARG_WITH(slang,
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
|
||||
if test "$with_slang" != "yes"; then
|
||||
if test x$with_slang != xyes; then
|
||||
# Add additional search path
|
||||
LDFLAGS="-L$with_slang/lib $LDFLAGS"
|
||||
CPPFLAGS="-I$with_slang/include $CPPFLAGS"
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang])
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLutf8_enable(TRUE);
|
||||
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
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
else
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
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
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
else
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the term library
|
||||
for termlib in ncurses curses termcap terminfo termlib; do
|
||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
||||
test -n "$tcap" && break
|
||||
done
|
||||
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
|
||||
LIBS="$LIBS $tcap"
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang])
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
@@ -264,35 +234,22 @@ int main(void)
|
||||
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 "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
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
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the math library
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
|
||||
LIBS="$LIBS -lm"
|
||||
# We might need the term library
|
||||
for termlib in ncurses curses termcap terminfo termlib; do
|
||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
||||
test -n "$tcap" && break
|
||||
done
|
||||
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
|
||||
LIBS="$LIBS $tcap"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
@@ -304,16 +261,85 @@ int main(void)
|
||||
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 "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the math library
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLutf8_enable(TRUE);
|
||||
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
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** install a version of slang that includes the slcurses.h file or
|
||||
*** do not call the configure script with --with-slang
|
||||
]))
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
# Reset libs if the above slang tests failed
|
||||
if test x$enable_utf8 != xno; then
|
||||
LIBS=$_libs
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
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
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
else
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the term library
|
||||
for termlib in ncurses curses termcap terminfo termlib; do
|
||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
||||
test -n "$tcap" && break
|
||||
done
|
||||
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
|
||||
LIBS="$LIBS $tcap"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
@@ -321,44 +347,70 @@ int main(void)
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the math library
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
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
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** install a version of slang that includes the slcurses.h file or
|
||||
*** do not call the configure script with --with-slang
|
||||
]))
|
||||
]))
|
||||
fi
|
||||
|
||||
test "${_libs+set}" = "set" && LIBS=$_libs
|
||||
if test "${_libs+set}" = "set"; then
|
||||
LIBS=$_libs
|
||||
fi
|
||||
|
||||
if test "$with_slang" != "yes"; then
|
||||
if test x$with_slang != xyes; then
|
||||
LDFLAGS=${_ldflags}
|
||||
fi
|
||||
;;
|
||||
esac], [AC_MSG_RESULT(no)])
|
||||
|
||||
dnl Checks for functions
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf isblank iswalnum iswblank iswspace strcasecmp strncasecmp strcasestr strnlen getline getdelim mblen mbtowc wctomb wcwidth)
|
||||
if test "x$ac_cv_func_snprintf" = "xno" -o "x$ac_cv_func_vsnprintf" = "xno"
|
||||
then
|
||||
AM_PATH_GLIB_2_0(2.0.0,,
|
||||
AC_MSG_ERROR([
|
||||
dnl Checks for functions.
|
||||
|
||||
AC_CHECK_FUNCS(getdelim getline isblank snprintf strcasecmp strcasestr strncasecmp strnlen vsnprintf)
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace mblen mbstowcs mbtowc wctomb wcwidth)
|
||||
fi
|
||||
|
||||
if test x$ac_cv_func_snprintf = xno || test x$ac_cv_func_vsnprintf = xno; then
|
||||
AM_PATH_GLIB_2_0(2.0.0,,
|
||||
AC_MSG_ERROR([
|
||||
*** snprintf() and/or vsnprintf() not found. GLIB 2.x not found either.
|
||||
*** You need both snprintf() and vsnprintf(). Alternatively you can
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
|
||||
glib)
|
||||
glib)
|
||||
fi
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
@@ -369,28 +421,32 @@ AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS(getopt_long)
|
||||
|
||||
dnl Checks for libraries.
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_CHECK_HEADERS(ncurses.h)
|
||||
AC_CHECK_LIB(ncursesw, wget_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE="yes"])
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
|
||||
fi
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_CHECK_HEADERS(curses.h)
|
||||
AC_CHECK_LIB(curses, wget_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE="yes"])
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_LIB(curses, get_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE=yes])
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
|
||||
fi
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_MSG_WARN([
|
||||
*** No curses lib available. Consider getting the official ncurses
|
||||
*** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
|
||||
@@ -407,20 +463,40 @@ LIBS="$LIBS $CURSES_LIB"
|
||||
|
||||
AC_SUBST(CURSES_LIB)
|
||||
|
||||
if test "x$GLIB_CFLAGS" != "x"
|
||||
then
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
if test "x$GLIB_CFLAGS" != "x"; then
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
fi
|
||||
if test "x$GLIB_LIBS" != "x"
|
||||
then
|
||||
LDFLAGS="$LDFLAGS $GLIB_LIBS"
|
||||
if test "x$GLIB_LIBS" != "x"; then
|
||||
LDFLAGS="$LDFLAGS $GLIB_LIBS"
|
||||
fi
|
||||
|
||||
if test "x$CURSES_LIB_WIDE" = "xyes" -a "x$ac_cv_func_iswalnum" = "xyes" -a "x$ac_cv_func_mblen" = "xyes" -a "x$ac_cv_func_mbtowc" = "xyes" -a "x$ac_cv_func_wctomb" = "xyes" -a "x$ac_cv_func_wcwidth" = "xyes" && test "x$ac_cv_func_iswspace" = "xyes" -o "x$ac_cv_func_iswblank" = "xyes"
|
||||
then
|
||||
AC_DEFINE(NANO_WIDE, 1, [Define this if your system has sufficient wide character support (a wide curses library, iswalnum(), iswspace() or iswblank(), mblen(), mbtowc(), wctomb(), and wcwidth()).])
|
||||
if test x$enable_utf8 != xno && \
|
||||
test x$CURSES_LIB_WIDE = xyes && \
|
||||
test x$ac_cv_func_iswalnum = xyes && \
|
||||
test x$ac_cv_func_iswpunct = xyes && \
|
||||
(test x$ac_cv_func_iswblank = xyes || test x$ac_cv_func_iswspace = xyes) && \
|
||||
test x$ac_cv_func_mblen = xyes && \
|
||||
test x$ac_cv_func_mbstowcs = xyes && \
|
||||
test x$ac_cv_func_mbtowc = xyes && \
|
||||
test x$ac_cv_func_wctomb = xyes && \
|
||||
test x$ac_cv_func_wcwidth = xyes; then
|
||||
AC_DEFINE(NANO_WIDE, 1, [Define this if your system has sufficient wide character support (a wide curses library, iswalnum(), iswpunct(), iswblank() or iswspace(), mblen(), mbstowcs(), mbtowc(), wctomb(), and wcwidth()).])
|
||||
else
|
||||
AC_MSG_WARN([Insufficient wide character support found. nano will not be able to support UTF-8.])
|
||||
if test x$enable_utf8 = xyes; then
|
||||
AC_MSG_ERROR([
|
||||
*** UTF-8 support was requested, but insufficient UTF-8 support was
|
||||
*** detected in your curses and/or C libraries. Please verify that your
|
||||
*** slang was built with UTF-8 support or your curses was built with
|
||||
*** wide character support, and that your C library was built with wide
|
||||
*** character support.])
|
||||
elif test x$enable_utf8 != xno; then
|
||||
AC_MSG_WARN([
|
||||
*** Insufficient UTF-8 support was detected in your curses and/or C
|
||||
*** libraries. If you want UTF-8 support, please verify that your slang
|
||||
*** was built with UTF-8 support or your curses was built with wide
|
||||
*** character support, and that your C library was built with wide
|
||||
*** character support.])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
|
||||
13
doc/faq.html
13
doc/faq.html
@@ -62,7 +62,7 @@
|
||||
<hr width="100%">
|
||||
<h1><a name="1"></a>1. General</h1>
|
||||
<h2><a name="1.1"></a>1.1 About this FAQ</h2>
|
||||
<blockquote><p>This FAQ was written and is maintained by Chris Allegretta <<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>>, who also happens to be the creator of nano. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
|
||||
<blockquote><p>This FAQ was originally written and maintained by Chris Allegretta <<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>>, who also happens to be the creator of nano. It is currently maintained by David Lawrence Ramsey <<a href="mailto:pooka_regent@sluggy.net">pooka_regent@sluggy.net</a>>. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
|
||||
<h2><a name="1.2"></a>1.2. How do I contribute to it?</h2>
|
||||
<blockquote><p>Your best bet is to send it to the nano email address, <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a> and if it is useful enough it will be included in future versions.</p></blockquote>
|
||||
<h2><a name="1.3"></a>1.3. What is GNU nano?</h2>
|
||||
@@ -80,7 +80,7 @@
|
||||
<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.6. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano *should* be 1.3.8. 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>
|
||||
<hr width="100%">
|
||||
@@ -154,7 +154,7 @@
|
||||
<p>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the marker code that you use Control-^ to select with). Also, if you know you aren't going to be using other languages you can use <b>--disable-nls</b> to disable internationalization and save a few K to a few dozen K depending on if you have locale support on your system. And finally there's always good old <b>strip</b> to strip all debugging code and code that exists in libraries on your system.</p>
|
||||
<p>If, on the other hand, you can't live without bells and whistles, you could try:</p>
|
||||
<pre>
|
||||
<b>--enable-extra</b> Enable extra functions, including easter eggs
|
||||
<b>--enable-extra</b> Enable extra features, currently only easter eggs
|
||||
<b>--enable-nanorc</b> Enable use of .nanorc file
|
||||
<b>--enable-color</b> Enable color and syntax highlighting
|
||||
<b>--enable-multibuffer</b> Enable having multiple file buffers open
|
||||
@@ -163,10 +163,10 @@
|
||||
Turn off wrapping of text 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> or <b>--enable-extra</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>
|
||||
<blockquote><p>To use verbatim input, you must be using nano 1.3.1 or newer. When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b>. (If you're not at a prompt, you'll get the message "Verbatim Input".) Then press the key(s) that generate the character you want.</p>
|
||||
<p>Alternatively, you can press <b>Meta-V</b> and then type a four-digit hexadecimal code from 0000 to ffff (case-insensitive), and the character with the corresponding value will be inserted instead.</p></blockquote>
|
||||
<h2><a name="3.9"></a>3.9. How do I make a .nanorc file that nano will read when I start it?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your version of nano must have been compiled with <b>--enable-nanorc</b>, and again must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the word <b>set</b> and the getopt_long flag for the feature, for example "set nowrap" or "set suspend".</p></blockquote>
|
||||
@@ -250,6 +250,9 @@
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote>
|
||||
<p>
|
||||
2005/06/15 - Update description of --enable-extra, and add missing line breaks. (DLR)<br>
|
||||
2005/06/13 - Minor capitalization and wording fixes. (DLR)<br>
|
||||
2005/06/08 - Updated section 1.1 to mention the current maintainer. (DLR)<br>
|
||||
2005/03/09 - Added question about opening files with names beginning with '+'s, and added a few more miscellaneous cosmetic fixes. (DLR)<br>
|
||||
2005/01/03 - Removed now-inaccurate note about verbatim input's not working at prompts, and update its description to mention that it handles hexadecimal values now. (DLR)<br>
|
||||
2004/11/21 - Listed sh as an example of a Bourne shell. (DLR)<br>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
man_MANS = nano.1 nanorc.5
|
||||
|
||||
mandir = @mandir@/fr
|
||||
|
||||
BUILT_SOURCES = nano.1.html nanorc.5.html
|
||||
|
||||
nano.1.html: nano.1
|
||||
|
||||
137
doc/man/nano.1
137
doc/man/nano.1
@@ -6,7 +6,7 @@
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.6" "March 11, 2005"
|
||||
.TH NANO 1 "version 1.3.8" "June 27, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -15,7 +15,7 @@ nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [\+LINE]\ [options]\ [file]
|
||||
.I [\+LINE,COLUMN]\ [options]\ [file]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -32,8 +32,12 @@ replace" and "go to line number".
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILINE\fP
|
||||
Places cursor at \fILINE\fP on startup.
|
||||
.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.
|
||||
.TP
|
||||
.B \-?
|
||||
Same as \fB-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
@@ -46,25 +50,23 @@ line.
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
.TP
|
||||
.B \-E \fIdir\fP (\-\-backupdir=\fIdir\fP)
|
||||
Set the directory where \fBnano\fP puts the backup files if file backups
|
||||
are enabled.
|
||||
.B \-C \fIdir\fP (\-\-backupdir=\fIdir\fP)
|
||||
Set the directory where \fBnano\fP puts unique backup files if file
|
||||
backups are enabled.
|
||||
.TP
|
||||
.B \-E (\-\-tabstospaces)
|
||||
Convert typed tabs to spaces.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
Enable multiple file buffers, if available.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Log search and replace strings to
|
||||
.I ~/.nano_history
|
||||
so they may be stored for later editing, if nanorc support is
|
||||
configured.
|
||||
Log search and replace strings to \fI~/.nano_history\fP so they can be
|
||||
stored for later editing, if nanorc support is configured.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
Don't look at
|
||||
.I SYSCONFDIR/nanorc
|
||||
or
|
||||
.IR ~/.nanorc ,
|
||||
if nanorc support is available.
|
||||
Don't look at \fISYSCONFDIR/nanorc\fP or \fI~/.nanorc\fP, if nanorc
|
||||
support is available.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
@@ -77,34 +79,35 @@ Set the quoting string for justifying. The default is
|
||||
"^([\ \\t]*[|>:}#])+" if regular expression support is available, or
|
||||
">\ " otherwise.
|
||||
.TP
|
||||
.B \-R (\-\-regexp)
|
||||
Enable regular expression matching for search strings, as well as
|
||||
\\n subexpression replacement for replace strings, if available.
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
.TP
|
||||
.B \-T \fIcols\fP (\-\-tabsize=\fIcols\fP)
|
||||
Set the size (width) of a tab to \fIcols\fP columns.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Show the current version number and author.
|
||||
.TP
|
||||
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
|
||||
Specify a specific syntax highlighting from the
|
||||
.I nanorc
|
||||
to use, if available.
|
||||
.TP
|
||||
.B \-Z (\-\-restricted)
|
||||
.B \-R (\-\-restricted)
|
||||
Restricted mode: Don't read or write to any file not specified on the
|
||||
command line, read any nanorc files, allow suspending, or allow a file
|
||||
to be appended to, prepended to, or saved under a different name if it
|
||||
already has one. Also accessible by invoking \fBnano\fP with any name
|
||||
beginning with 'r' (e.g. "rnano").
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
.TP
|
||||
.B \-T \fIcols\fP (\-\-tabsize=\fIcols\fP)
|
||||
Set the size (width) of a tab to \fIcols\fP columns. The value of
|
||||
\fIcols\fP must be greater than 0. The default value is 8.
|
||||
.TP
|
||||
.B \-U (\-\-quickblank)
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25. Note that \fB-c\fP cancels this out.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Show the current version number and author.
|
||||
.TP
|
||||
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
|
||||
Specify a specific syntax highlighting from the \fInanorc\fP to use, if
|
||||
available.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Constantly show the cursor position.
|
||||
Constantly show the cursor position. Note that this cancels out
|
||||
\fB-U\fP.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
@@ -124,8 +127,7 @@ Enable cut from cursor to end of line.
|
||||
.B \-l (\-\-nofollow)
|
||||
If the file being edited is a symbolic link, replace the link with
|
||||
a new file instead of following it. Good for editing files in
|
||||
.IR /tmp ,
|
||||
perhaps?
|
||||
\fI/tmp\fP, perhaps?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Enable mouse support (if available for your system).
|
||||
@@ -139,16 +141,17 @@ Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
|
||||
by the terminal.
|
||||
.TP
|
||||
.B \-r \fIcols\fP (\-\-fill=\fIcols\fP)
|
||||
Wrap lines at column \fIcols\fP. By default, this is the width of the
|
||||
screen, less eight. If this value is negative, wrapping will occur at
|
||||
\fIcols\fP columns from the right of the screen, allowing the wrap point
|
||||
to vary along with the screen width if resized.
|
||||
Wrap lines at column \fIcols\fP. If this value is 0 or less, wrapping
|
||||
will occur at the width of the screen less \fIcols\fP columns, allowing
|
||||
the wrap point to vary along with the width of the screen if the screen
|
||||
is resized. The default value is -8.
|
||||
.TP
|
||||
.B \-s \fIprog\fP (\-\-speller=\fIprog\fP)
|
||||
Enable alternative spell checker command.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
Always save changed buffer without prompting. Same as Pico's -t option.
|
||||
Always save changed buffer without prompting. Same as Pico's \fB-t\fP
|
||||
option.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
View file (read only) mode.
|
||||
@@ -167,13 +170,9 @@ Ignored, for compatibility with Pico.
|
||||
|
||||
.SH INITIALIZATION FILE
|
||||
\fBnano\fP will read initialization files in the following order:
|
||||
.IR SYSCONFDIR/nanorc ,
|
||||
then
|
||||
.IR ~/.nanorc .
|
||||
Please see
|
||||
.BR nanorc (5)
|
||||
and the example file \fBnanorc.sample\fP which should be provided with
|
||||
\fBnano\fP.
|
||||
\fISYSCONFDIR/nanorc\fP, then \fI~/.nanorc\fP. Please see
|
||||
\fBnanorc(5)\fP and the example file \fBnanorc.sample\fP, both of which
|
||||
should be provided with \fBnano\fP.
|
||||
|
||||
.SH NOTES
|
||||
If no alternative spell checker command is specified on the command
|
||||
@@ -183,25 +182,20 @@ line or in one of the nanorc files, \fBnano\fP will check the
|
||||
\fBnano\fP will try to dump the buffer into an emergency file in some
|
||||
cases. Mainly, this will happen if \fBnano\fP receives a SIGHUP or
|
||||
SIGTERM or runs out of memory, when it will write the buffer into a file
|
||||
named
|
||||
.I nano.save
|
||||
if the buffer didn't have a name already, or will add a ".save" suffix
|
||||
to the current filename. If an emergency file with that name already
|
||||
exists in the current directory, ".save" and a number (e.g. ".save.1")
|
||||
will be suffixed to the current filename in order to make it unique. In
|
||||
multibuffer mode, \fBnano\fP will write all the open buffers to the
|
||||
respective emergency files.
|
||||
named \fInano.save\fP if the buffer didn't have a name already, or will
|
||||
add a ".save" suffix to the current filename. If an emergency file with
|
||||
that name already exists in the current directory, ".save" and a number
|
||||
(e.g. ".save.1") will be suffixed to the current filename in order to
|
||||
make it unique. In multibuffer mode, \fBnano\fP will write all the open
|
||||
buffers to their respective emergency files.
|
||||
|
||||
.SH BUGS
|
||||
Please send any comments or bug reports to
|
||||
.BR nano@nano-editor.org .
|
||||
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
|
||||
|
||||
The \fBnano\fP mailing list is available from
|
||||
.BR nano-devel@gnu.org .
|
||||
The \fBnano\fP mailing list is available from \fBnano-devel@gnu.org\fP.
|
||||
|
||||
To subscribe, email to
|
||||
.B nano-devel-request@gnu.org
|
||||
with a subject of "subscribe".
|
||||
To subscribe, email to \fBnano-devel-request@gnu.org\fP with a subject
|
||||
of "subscribe".
|
||||
|
||||
.SH HOMEPAGE
|
||||
http://www.nano-editor.org/
|
||||
@@ -214,10 +208,7 @@ http://www.nano-editor.org/
|
||||
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see
|
||||
.I AUTHORS
|
||||
and
|
||||
.I THANKS
|
||||
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).
|
||||
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).
|
||||
|
||||
156
doc/man/nanorc.5
156
doc/man/nanorc.5
@@ -6,7 +6,7 @@
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 1.3.6" "March 11, 2005"
|
||||
.TH NANORC 5 "version 1.3.8" "June 27, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -22,15 +22,14 @@ replace" and "go to line number".
|
||||
.PP
|
||||
The \fInanorc\fP file contains the default settings for \fBnano\fP.
|
||||
During startup, \fBnano\fP will first read its system-wide settings from
|
||||
.IR SYSCONFDIR/nanorc ,
|
||||
and then user-specific settings from
|
||||
.IR ~/.nanorc .
|
||||
\fISYSCONFDIR/nanorc\fP, and then user-specific settings from
|
||||
\fI~/.nanorc\fP.
|
||||
|
||||
.SH OPTIONS
|
||||
The configuration file accepts a series of "set" and "unset" commands,
|
||||
which can be used to configure nano on startup without using the
|
||||
command-line options. Additionally, the "syntax" and "color" keywords
|
||||
are used to define syntax highlighting rules for different text
|
||||
command-line options. Additionally, the "syntax", "color", and "icolor"
|
||||
keywords are used to define syntax highlighting rules for different text
|
||||
patterns. GNU nano will read one command per line.
|
||||
|
||||
Options in rcfiles take precedence over nano's defaults, and command
|
||||
@@ -41,73 +40,83 @@ Options are unset by default, except for options that take an argument.
|
||||
The supported commands and arguments are:
|
||||
|
||||
.TP 3
|
||||
\fBset/unset autoindent\fP
|
||||
.B set/unset autoindent
|
||||
Use auto-indentation.
|
||||
.TP
|
||||
\fBset/unset backup\fP
|
||||
Create backup files in
|
||||
.IR filename~ .
|
||||
.B set/unset backup
|
||||
Create backup files in \fIfilename~\fP.
|
||||
.TP
|
||||
\fBset backupdir "\fIdirectory\fP"\fP
|
||||
Set the directory where \fBnano\fP puts the backup files if file backups
|
||||
are enabled.
|
||||
\fBset brackets "\fIstring\fP"\fP
|
||||
.B set backupdir "\fIdirectory\fP"
|
||||
Set the directory where \fBnano\fP puts unique backup files if file
|
||||
backups are enabled.
|
||||
.TP
|
||||
.B set/unset backwards
|
||||
Do backwards searches by default.
|
||||
.TP
|
||||
.B set brackets "\fIstring\fP"
|
||||
Set the characters treated as closing brackets. They cannot contain
|
||||
tabs or spaces. Only closing punctuation, optionally followed by
|
||||
blank characters. Only closing punctuation, optionally followed by
|
||||
closing brackets, can end sentences.
|
||||
.TP
|
||||
\fBset/unset const\fP
|
||||
.B set/unset casesensitive
|
||||
Do case sensitive searches by default.
|
||||
.TP
|
||||
.B set/unset const
|
||||
Constantly display the cursor position in the status bar.
|
||||
.TP
|
||||
\fBset/unset cut\fP
|
||||
.B set/unset cut
|
||||
Use cut to end of line by default.
|
||||
.TP
|
||||
\fBset fill \fIn\fP\fP
|
||||
Wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the line
|
||||
length will be the screen width less \fIn\fP. The default value is -8.
|
||||
.B set fill \fIn\fP
|
||||
Wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the
|
||||
maximum line length will be the screen width less \fIn\fP columns. The
|
||||
default value is -8.
|
||||
.TP
|
||||
\fBset/unset historylog\fP
|
||||
Enable
|
||||
.I ~/.nano_history
|
||||
for saving and reading search/replace strings.
|
||||
.B set/unset historylog
|
||||
Enable \fI~/.nano_history\fP for saving and reading search/replace
|
||||
strings.
|
||||
.TP
|
||||
\fBset/unset morespace\fP
|
||||
.B set/unset morespace
|
||||
Allow use of the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
\fBset/unset mouse\fP
|
||||
.B set/unset mouse
|
||||
Enable mouse support, so that mouse clicks can be used to set the mark
|
||||
and run shortcuts.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
.B set/unset multibuffer
|
||||
Allow inserting files into their own buffers.
|
||||
.TP
|
||||
\fBset/unset noconvert\fP
|
||||
.B set/unset noconvert
|
||||
Don't convert files from DOS/Mac format.
|
||||
.TP
|
||||
\fBset/unset nofollow\fP
|
||||
.B set/unset nofollow
|
||||
Don't follow symlinks when writing files.
|
||||
.TP
|
||||
\fBset/unset nohelp\fP
|
||||
.B set/unset nohelp
|
||||
Don't display the help lists at the bottom of the screen.
|
||||
.TP
|
||||
\fBset/unset nowrap\fP
|
||||
.B set/unset nowrap
|
||||
Don't wrap text at all.
|
||||
.TP
|
||||
\fBset operatingdir "\fIdirectory\fP"\fP
|
||||
.B set operatingdir "\fIdirectory\fP"
|
||||
\fBnano\fP will only read and write files inside \fIdirectory\fP and its
|
||||
subdirectories. Also, the current directory is changed to here, so
|
||||
files are inserted from this dir. By default the operating directory
|
||||
feature is turned off.
|
||||
.TP
|
||||
\fBset/unset preserve\fP
|
||||
.B set/unset preserve
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
.TP
|
||||
\fBset punct "\fIstring\fP"\fP
|
||||
.B set punct "\fIstring\fP"
|
||||
Set the characters treated as closing punctuation. They cannot contain
|
||||
tabs or spaces. Only closing punctuation, optionally followed by
|
||||
blank characters. Only closing punctuation, optionally followed by
|
||||
closing brackets, can end sentences.
|
||||
.TP
|
||||
\fBset quotestr "\fIstring\fP"\fP
|
||||
.B set quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
.TP
|
||||
.B set quotestr "\fIstring\fP"
|
||||
The email-quote string, used to justify email-quoted paragraphs. This
|
||||
is an "extended regular expression" if your system supports them,
|
||||
otherwise a literal string. The default value is
|
||||
@@ -117,67 +126,77 @@ otherwise a literal string. The default value is
|
||||
if you have regexps, otherwise set quotestr ">\ ". Note that '\\t'
|
||||
above stands for a literal Tab character.
|
||||
.TP
|
||||
\fBset/unset rebinddelete\fP
|
||||
.B set/unset rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
.TP
|
||||
\fBset/unset regexp\fP
|
||||
.B set/unset regexp
|
||||
Do regular expression searches by default.
|
||||
.TP
|
||||
\fBset/unset smarthome\fP
|
||||
.B set/unset smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
.TP
|
||||
\fBset/unset smooth\fP
|
||||
.B set/unset smooth
|
||||
Use smooth scrolling by default.
|
||||
.TP
|
||||
\fBset speller \fIspellprog\fP\fP
|
||||
.B set speller \fIspellprog\fP
|
||||
Use spelling checker \fIspellprog\fP instead of the built-in one, which
|
||||
calls \fIspell\fP.
|
||||
.TP
|
||||
\fBset/unset suspend\fP
|
||||
.B set/unset suspend
|
||||
Allow nano to be suspended.
|
||||
.TP
|
||||
\fBset tabsize \fIn\fP\fP
|
||||
Use a tab size of \fIn\fP columns instead of the default (8); must be
|
||||
greater than 0.
|
||||
.B set tabsize \fIn\fP
|
||||
Use a tab size of \fIn\fP columns. The value of \fIn\fP must be greater
|
||||
than 0. The default value is 8.
|
||||
.TP
|
||||
\fBset/unset tempfile\fP
|
||||
.B set/unset tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
.TP
|
||||
.B set/unset tempfile
|
||||
Save automatically on exit, don't prompt.
|
||||
.TP
|
||||
\fBset/unset view\fP
|
||||
.B set/unset view
|
||||
Disallow file modification.
|
||||
.TP
|
||||
\fBset whitespace "\fIstring\fP"\fP
|
||||
.B set whitespace "\fIstring\fP"
|
||||
Set the two characters used to display the first characters of tabs and
|
||||
spaces. They cannot be control characters.
|
||||
spaces. They must be single-column characters.
|
||||
.TP
|
||||
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
|
||||
Defines a syntax named \fIstr\fP which can be activated via the \fB-Y\fP
|
||||
flag, or will be automatically activated if the current filename matches
|
||||
\fIfileregex\fP. All following \fBcolor\fP statements will apply to
|
||||
\fIsyntax\fP until a new syntax is defined.
|
||||
\fIfileregex\fP. All following \fBcolor\fP and \fBicolor\fP statements
|
||||
will apply to \fIsyntax\fP until a new syntax is defined.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP[,\fIbgcolor\fP] "\fIregex\fP" ...
|
||||
.B color \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
|
||||
For the currently defined syntax, display all expressions matching
|
||||
\fIregex\fP with foreground color \fIfgcolor\fP and optional background
|
||||
color \fIbgcolor\fP. Legal colors for foreground and background color
|
||||
are: white, black, red, blue, green, yellow, magenta, and cyan. You may
|
||||
use the prefix "bright" to force a stronger color highlight. If your
|
||||
terminal supports transparency, not specifying a \fIbgcolor\fP tells
|
||||
\fBnano\fP to attempt to use a transparent background.
|
||||
\fIregex\fP with foreground color \fIfgcolor\fP and background color
|
||||
\fIbgcolor\fP, at least one of which must be specified. Legal colors
|
||||
for foreground and background color are: white, black, red, blue, green,
|
||||
yellow, magenta, and cyan. You may use the prefix "bright" to force a
|
||||
stronger color highlight for the foreground. If your terminal supports
|
||||
transparency, not specifying a \fIbgcolor\fP tells \fBnano\fP to attempt
|
||||
to use a transparent background.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP[,\fIbgcolor\fP] start="\fIsr\fP" end="\fIer\fP"
|
||||
.B icolor \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
|
||||
Same as above, except that the expression matching is case insensitive.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP,\fIbgcolor\fP start="\fIsr\fP" end="\fIer\fP"
|
||||
Display expressions which start with \fIsr\fP and end with \fIer\fP
|
||||
with foreground color \fIfgcolor\fP and optional background color
|
||||
\fIbgcolor\fP. This allows syntax highlighting to span multiple lines.
|
||||
Note that all subsequent instances of \fIsr\fP after an initial \fIsr\fP
|
||||
is found will be highlighted until the first instance of \fIer\fP.
|
||||
\fI
|
||||
with foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
|
||||
at least one of which must be specified. This allows syntax
|
||||
highlighting to span multiple lines. Note that all subsequent instances
|
||||
of \fIsr\fP after an initial \fIsr\fP is found will be highlighted until
|
||||
the first instance of \fIer\fP.
|
||||
.TP
|
||||
.B icolor \fIfgcolor\fP,\fIbgcolor\fP start="\fIsr\fP" end="\fIer\fP"
|
||||
Same as above, except that the expression matching is case insensitive.
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
@@ -194,9 +213,6 @@ Per-user configuration file
|
||||
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (or equivalent on your
|
||||
system)
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see
|
||||
.I AUTHORS
|
||||
and
|
||||
.I THANKS
|
||||
for details).
|
||||
This manual page was written by Jordi Mallach <jordi@gnu.org>.
|
||||
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>.
|
||||
|
||||
@@ -14,23 +14,30 @@
|
||||
## Backup files to filename~.
|
||||
# set backup
|
||||
|
||||
## The directory to put the backup files in.
|
||||
## The directory to put unique backup files in.
|
||||
# set backupdir ""
|
||||
|
||||
## The characters treated as closing brackets. They cannot contain tabs
|
||||
## or spaces. Only closing punctuation, optionally followed by closing
|
||||
## brackets, can end sentences.
|
||||
## Do backwards searches by default.
|
||||
# set backwards
|
||||
|
||||
## The characters treated as closing brackets. They cannot contain
|
||||
## blank characters. Only closing punctuation, optionally followed by
|
||||
## closing brackets, can end sentences.
|
||||
##
|
||||
# set brackets "'")}]>"
|
||||
|
||||
## Constantly display the cursor position in the status bar.
|
||||
## Do case sensitive searches by default.
|
||||
# set casesensitive
|
||||
|
||||
## Constantly display the cursor position in the statusbar. Note that
|
||||
## this cancels out "quickblank".
|
||||
# set const
|
||||
|
||||
## Use cut to end of line by default.
|
||||
# set cut
|
||||
|
||||
## Set the line length for wrapping text and justifying paragraphs.
|
||||
## If fill is negative, the line length will be the screen width less
|
||||
## If fill is 0 or less, the line length will be the screen width less
|
||||
## this number.
|
||||
##
|
||||
# set fill -8
|
||||
@@ -47,7 +54,7 @@
|
||||
|
||||
## Allow multiple file buffers (inserting a file will put it into a
|
||||
## separate buffer). You must have configured with --enable-multibuffer
|
||||
## or --enable-extra for this to work.
|
||||
## for this to work.
|
||||
##
|
||||
# set multibuffer
|
||||
|
||||
@@ -74,11 +81,16 @@
|
||||
# set preserve
|
||||
|
||||
## The characters treated as closing punctuation. They cannot contain
|
||||
## tabs or spaces. Only closing punctuation, optionally followed by
|
||||
## blank characters. Only closing punctuation, optionally followed by
|
||||
## closing brackets, can end sentences.
|
||||
##
|
||||
# set punct ".?!"
|
||||
|
||||
## Do quick statusbar blanking. Statusbar messages will disappear after
|
||||
## 1 keystroke instead of 25. Note that "const" cancels this out.
|
||||
##
|
||||
# set quickblank
|
||||
|
||||
## The email-quote string, used to justify email-quoted paragraphs.
|
||||
## This is an extended regular expression if your system supports them,
|
||||
## otherwise a literal string. Default:
|
||||
@@ -115,46 +127,64 @@
|
||||
## Use this tab size instead of the default; it must be greater than 0.
|
||||
# set tabsize 8
|
||||
|
||||
## Convert typed tabs to spaces.
|
||||
# set tabstospaces
|
||||
|
||||
## Save automatically on exit, don't prompt.
|
||||
# set tempfile
|
||||
|
||||
## Disallow file modification; why would you want this in an rcfile? ;)
|
||||
# set view
|
||||
|
||||
## The two characters used to display the first characters of tabs and
|
||||
## spaces. 187 decimal (00BB hexadecimal) and 183 decimal (00B7
|
||||
## hexadecimal) seem to be good values for these.
|
||||
## The two single-column characters used to display the first characters
|
||||
## of tabs and spaces. 187 decimal (00BB hexadecimal) and 183 decimal
|
||||
## (00B7 hexadecimal) seem to be good values for these.
|
||||
# set whitespace " "
|
||||
|
||||
## Color setup
|
||||
##
|
||||
## Format:
|
||||
##
|
||||
## syntax "short description" ["filename regex" ...]
|
||||
##
|
||||
## color foreground,background "regex" ["regex"...]
|
||||
## or
|
||||
## icolor foreground,background "regex" ["regex"...]
|
||||
##
|
||||
## "color" will do case sensitive matches, while "icolor" will do case
|
||||
## insensitive matches.
|
||||
##
|
||||
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
|
||||
## You may use the prefix "bright" to mean a stronger color highlight.
|
||||
## You may use the prefix "bright" to mean a stronger color highlight
|
||||
## for the foreground.
|
||||
##
|
||||
## To use multi-line regexes use the start="regex" end="regex" format.
|
||||
## To use multi-line regexes, use the start="regex" end="regex" format.
|
||||
##
|
||||
## If your system supports transparency, not specifying a background
|
||||
## color will use a transparent color. If you don't want this, be sure
|
||||
## to set the background color to black or white.
|
||||
##
|
||||
# syntax "c-file" "\.(c|h)$"
|
||||
# syntax "c-file" "\.(c|C|cc|cpp|cxx|h|H|hh|hpp|hxx)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# color green "\<(float|double|char|int|short|long|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|switch|goto|continue|break|return)\>"
|
||||
# color brightcyan "^ *# *(define|undef|include|ifn?def|endif|elif|else|if)"
|
||||
# color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
|
||||
# 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|goto|continue|break|return)\>"
|
||||
# color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
# color brightmagenta "'([^\]|(\\['abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
|
||||
##
|
||||
## GCC builtins
|
||||
##
|
||||
# color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(asm|builtin|inline|restrict|typeof)__"
|
||||
##
|
||||
## You will in general want your comments and strings to come last,
|
||||
## because syntax highlighting rules will be applied in the order they
|
||||
## are read in.
|
||||
##
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
##
|
||||
## This string is VERY resource intensive!!!
|
||||
# color brightyellow start=""(\\.|[^\"])*\\ *$" end="^(\\.|[^\"])*""
|
||||
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
|
||||
##
|
||||
## And we want to have some nice comment highlighting too
|
||||
# color brightblue "//.*"
|
||||
@@ -163,7 +193,7 @@
|
||||
## Here is a short example for HTML
|
||||
# syntax "HTML" "\.html$"
|
||||
# color blue start="<" end=">"
|
||||
# color red "&[^; ]*;"
|
||||
# color red "&[^;[[:space:]]]*;"
|
||||
|
||||
## Here is a short example for TeX files
|
||||
# syntax "TeX" "\.tex$"
|
||||
@@ -177,10 +207,10 @@
|
||||
|
||||
## Here is an example for groff
|
||||
##
|
||||
# syntax "groff" "\.ms$" "\.mm$" "\.me$" "\.tmac$" "^tmac." ".rof"
|
||||
# syntax "groff" "\.m[ems]$" "\.tmac$" "^tmac." ".rof"
|
||||
## The argument of .nr or .ds
|
||||
# color cyan "^\.ds [^ ]*"
|
||||
# color cyan "^\.nr [^ ]*"
|
||||
# color cyan "^\.ds [^[[:space:]]]*"
|
||||
# color cyan "^\.nr [^[[:space:]]]*"
|
||||
## Single character escapes
|
||||
# color brightmagenta "\\."
|
||||
## Highlight the argument of \f or \s in the same color
|
||||
@@ -192,7 +222,7 @@
|
||||
# color cyan "(\\|\\\\)n\(.."
|
||||
# color cyan start="(\\|\\\\)n\[" end="]"
|
||||
## Requests
|
||||
# color brightgreen "^\. *[^ ]*"
|
||||
# color brightgreen "^\.[[:space:]]*[^[[:space:]]]*"
|
||||
## Comments
|
||||
# color yellow "^\.\\\".*$"
|
||||
## Strings
|
||||
@@ -208,7 +238,7 @@
|
||||
## Here is an example for perl
|
||||
##
|
||||
# syntax "perl" "\.p[lm]$"
|
||||
# color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork)|get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join|keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek|seekdir|se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr|y|truncate|umask|un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
# color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
# color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
|
||||
# color cyan start="[$@%]" end="( |\\W|-)"
|
||||
# color yellow "".*"|qq\|.*\|"
|
||||
@@ -228,7 +258,7 @@
|
||||
# color blue "//.*"
|
||||
# color blue start="/\*" end="\*/"
|
||||
# color brightblue start="/\*\*" end="\*/"
|
||||
# color brightgreen,green " +$"
|
||||
# color brightgreen,green "[[:space:]]+$"
|
||||
|
||||
## Here is an example for patch files
|
||||
##
|
||||
@@ -251,18 +281,34 @@
|
||||
# color brightwhite "\\f[BIPR]"
|
||||
# color yellow "\.(br|DS|RS|RE|PD)"
|
||||
|
||||
## Here is an example for assembler
|
||||
##
|
||||
# syntax "asm-file" "\.(S|s|asm)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# color brightgreen "\.(data|subsection|text)"
|
||||
# color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
|
||||
# color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
|
||||
# icolor brightred "^[[:space:]]*[._A-Z0-9]*:"
|
||||
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
## Highlight strings (note: VERY resource intensive)
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
|
||||
## Highlight comments
|
||||
# color brightblue "//.*"
|
||||
# color brightblue start="/\*" end="\*/"
|
||||
|
||||
## Here is an example for your .nanorc
|
||||
##
|
||||
# syntax "nanorc" "(\.|/|)nanorc$"
|
||||
## highlight possible errors and parameters
|
||||
# color brightwhite "^ *(set|unset|syntax|color).*$"
|
||||
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?color).*$"
|
||||
## set, unset and syntax
|
||||
# color cyan "^ *(set|unset) +(autoindent|backup|backupdir|brackets|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quotestr|rebinddelete|regexp|smarthome|smooth|speller|suspend|tabsize|tempfile|view|whitespace)"
|
||||
# color green "^ *(set|unset|syntax)\>"
|
||||
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quickblank|quotestr|rebinddelete)\>" "^[[:space:]]*(set|unset)[[:space:]]+(regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace)\>"
|
||||
# icolor green "^[[:space:]]*(set|unset|syntax)\>"
|
||||
## colors
|
||||
# color yellow "^ *color +(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
# color magenta "^ *color\>" "\<(start|end)="
|
||||
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
# icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
|
||||
## strings
|
||||
# color white "\"(\\.|[^\"])*\""
|
||||
# icolor white "\"(\\.|[^\"])*\""
|
||||
## comments
|
||||
# color blue "^ *#.*$"
|
||||
# icolor blue "^[[:space:]]*#.*$"
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
@c Run `makeinfo' rather than `texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.3.6
|
||||
@set UPDATED 11 Mar 2005
|
||||
@set VERSION 1.3.8
|
||||
@set UPDATED 27 Jun 2005
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.3.6
|
||||
@subtitle version 1.3.8
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -91,10 +91,10 @@ internationalization support, and filename tab completion.
|
||||
@node Overview, Command Line Options, Introduction, Introduction
|
||||
@section Overview
|
||||
|
||||
@code{nano} +LINE [GNU long option] [option] [ @var{file ...} ]
|
||||
@code{nano} +LINE,COLUMN [GNU long option] [option] [ @var{file ...} ]
|
||||
|
||||
The original goal for @code{nano} was a complete bug-for-bug compatible
|
||||
emulation of Pico, but nano's main goal is to be as compatible as
|
||||
emulation of Pico, but @code{nano}'s main goal is to be as compatible as
|
||||
possible while offering a superset of Pico's functionality. Also see
|
||||
@xref{Pico Compatibility}, for other differences.
|
||||
|
||||
@@ -106,6 +106,12 @@ 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 -?
|
||||
Same as @code{-h, --help}.
|
||||
|
||||
@item -A, --smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
@@ -118,10 +124,13 @@ line.
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
|
||||
@item -E, --backupdir=[dir]
|
||||
Set the directory where @code{nano} puts the backup files if file
|
||||
@item -C, --backupdir=[dir]
|
||||
Set the directory where @code{nano} puts unique backup files if file
|
||||
backups are enabled.
|
||||
|
||||
@item -E, --tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
|
||||
@item -F, --multibuffer
|
||||
Enable multiple file buffers, if available.
|
||||
|
||||
@@ -142,14 +151,23 @@ Set the quoting string for justifying. The default is
|
||||
if regular expression support is available, or ``> '' otherwise. Note
|
||||
that @code{\t} above stands for a literal Tab character.
|
||||
|
||||
@item -R, --regexp
|
||||
Turn on regular expression search and search/replace.
|
||||
@item -R, --restricted
|
||||
Restricted mode: Don't read or write to any file not specified on the
|
||||
command line, read any nanorc files, allow suspending, or allow a file
|
||||
to be appended to, prepended to, or saved under a different name if it
|
||||
already has one. Also accessible by invoking @code{nano} with any name
|
||||
beginning with 'r' (e.g. "rnano").
|
||||
|
||||
@item -S, --smooth
|
||||
Enable smooth scrolling.
|
||||
|
||||
@item -T [num], --tabsize=[#cols]
|
||||
Set the displayed tab length to [#cols] columns.
|
||||
Set the displayed tab length to #cols columns. The value of #cols must
|
||||
be greater than 0. The default value is 8.
|
||||
|
||||
@item -U, --quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25. Note that -c cancels this out.
|
||||
|
||||
@item -V, --version
|
||||
Print the version number and copyright and quit.
|
||||
@@ -158,15 +176,9 @@ Print the version number and copyright and quit.
|
||||
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||
available.
|
||||
|
||||
@item -Z, --restricted
|
||||
Restricted mode: Don't read or write to any file not specified on the
|
||||
command line, read any nanorc files, allow suspending, or allow a file
|
||||
to be appended to, prepended to, or saved under a different name if it
|
||||
already has one. Also accessible by invoking @code{nano} with any name
|
||||
beginning with 'r' (e.g. "rnano").
|
||||
|
||||
@item -c, --const
|
||||
Constantly display the cursor position and line number on the statusbar.
|
||||
Note that this cancels out -U.
|
||||
|
||||
@item -d, --rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
@@ -200,10 +212,10 @@ Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent to the
|
||||
editor can be can be stopped and started.
|
||||
|
||||
@item -r [#cols], --fill=[#cols].
|
||||
Wrap lines at column #cols. By default this is the width of the screen,
|
||||
less eight. If this value is negative, wrapping will occur at #cols
|
||||
from the right of the screen, allowing it to vary along with the screen
|
||||
width if the screen is resized.
|
||||
Wrap lines at column #cols. If this value is 0 or less, wrapping will
|
||||
occur at #cols less the width of the screen, allowing it to vary along
|
||||
with the width of the screen if the screen is resized. The default
|
||||
value is -8.
|
||||
|
||||
@item -s [prog], --speller=[prog]
|
||||
Invoke [prog] as the spell checker. By default, @code{nano} uses the
|
||||
@@ -240,9 +252,6 @@ keystroke (usually ^Z).
|
||||
|
||||
@item -a, -b, -e, -f, -g, -j
|
||||
Ignored, for compatibility with Pico.
|
||||
|
||||
@item +LINE
|
||||
Start at line number LINE instead of the default of line 1.
|
||||
@end table
|
||||
|
||||
@node Editor Basics, Online Help, Introduction, Top
|
||||
@@ -338,13 +347,16 @@ The following global toggles are available:
|
||||
|
||||
@table @code
|
||||
|
||||
@item Backup File Toggle (Meta-B)
|
||||
@item Backup Files Toggle (Meta-B)
|
||||
toggles the -B (@code{--backup}) command line flag.
|
||||
|
||||
@item Constant Cursor Position Display Toggle (Meta-C)
|
||||
toggles the -c (@code{--const}) command line flag.
|
||||
|
||||
@item Multiple File Buffers Toggle (Meta-F)
|
||||
toggles the -F (@code{--multibuffer}) command line flag.
|
||||
|
||||
@item Backup File Toggle (Meta-H)
|
||||
@item Smart Home Key Toggle (Meta-H)
|
||||
toggles the -A (@code{--smarthome}) command line flag.
|
||||
|
||||
@item Auto Indent Toggle (Meta-I)
|
||||
@@ -353,21 +365,35 @@ toggles the -i (@code{--autoindent}) command line flag.
|
||||
@item Cut To End Toggle (Meta-K)
|
||||
toggles the -k (@code{--cut}) command line flag.
|
||||
|
||||
@item Auto Line Wrap Toggle (Meta-L)
|
||||
@item Long Line Wrapping Toggle (Meta-L)
|
||||
toggles the -w (@code{--nowrap}) command line flag.
|
||||
|
||||
@item Mouse Toggle (Meta-M)
|
||||
@item Mouse Support Toggle (Meta-M)
|
||||
toggles the -m (@code{--mouse}) command line flag.
|
||||
|
||||
@item More Space Toggle (Meta-O)
|
||||
@item No Conversion From DOS/Mac Format Toggle (Meta-N)
|
||||
toggles the -N (@code{--noconvert}) command line flag.
|
||||
|
||||
@item More Space For Editing Toggle (Meta-O)
|
||||
toggles the -O (@code{--morespace}) command line flag.
|
||||
|
||||
@item Whitespace Display Toggle (Meta-P)
|
||||
toggles whitespace display mode if you have a "whitespace" option in
|
||||
your .nanorc.
|
||||
|
||||
@item Tabs to Spaces Toggle (Meta-Q)
|
||||
toggles the -E (@code{--tabstospaces}) command line flag.
|
||||
|
||||
@item Smooth Scrolling Toggle (Meta-S)
|
||||
toggles the -S (@code{--smooth}) command line flag.
|
||||
|
||||
@item Expert/Nohelp Toggle (Meta-X)
|
||||
@item Expert/No Help Toggle (Meta-X)
|
||||
toggles the -x (@code{--nohelp}) command line flag.
|
||||
|
||||
@item Color Syntax Highlighting Toggle (Meta-Y)
|
||||
toggles color syntax highlighting if you have color syntaxes in your
|
||||
.nanorc.
|
||||
|
||||
@item Suspend Toggle (Meta-Z)
|
||||
toggles the -z (@code{--suspend}) command line flag.
|
||||
|
||||
@@ -446,7 +472,8 @@ Building @code{nano} from source is fairly straightforward if you are
|
||||
familiar with compiling programs with autoconf support:
|
||||
|
||||
@itemize @bullet
|
||||
@item tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of nano)
|
||||
@item tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of
|
||||
@code{nano})
|
||||
@item cd nano-x.y.z/
|
||||
@item ./configure
|
||||
@item make
|
||||
@@ -499,9 +526,8 @@ Disables Native Language support. This will make the available GNU
|
||||
@code{nano} translations unusable.
|
||||
|
||||
@item --with-slang
|
||||
Compiling GNU @code{nano} with Slang is supported, and will make the
|
||||
binary notably smaller than if compiled with ncurses or other curses
|
||||
libraries.
|
||||
Compiling @code{nano} with Slang is supported, and will make the binary
|
||||
notably smaller than if compiled with ncurses or other curses libraries.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
EXTRA_DIST = ulonglong.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 \
|
||||
stdint_h.m4 uintmax_t.m4 isc-posix.m4 lib-ld.m4 lib-link.m4 \
|
||||
lib-prefix.m4 codeset.m4 glibc21.m4 progtest.m4 gettext.m4 \
|
||||
iconv.m4 lcmessage.m4 glib-2.0.m4
|
||||
EXTRA_DIST = codeset.m4 gettext.m4 glib-2.0.m4 glibc21.m4 iconv.m4 \
|
||||
intdiv0.m4 inttypes_h.m4 inttypes.m4 inttypes-pri.m4 \
|
||||
isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 \
|
||||
lib-prefix.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 \
|
||||
ulonglong.m4
|
||||
|
||||
80
po/ChangeLog
80
po/ChangeLog
@@ -1,3 +1,83 @@
|
||||
2005-06-28 David Lawrence Ramsey <pooka_regent@sluggy.net>
|
||||
|
||||
* POTFILES.in: Remove source files that contain no translatable
|
||||
strings.
|
||||
|
||||
2005-06-19 David Lawrence Ramsey <pooka_regent@sluggy.net>
|
||||
|
||||
* pt_BR.po: Typo fix.
|
||||
|
||||
2005-06-15 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* de.po: Typo fix by Jens Seidel.
|
||||
|
||||
2005-05-23 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by
|
||||
Jean-Philippe Guérard.
|
||||
|
||||
2005-04-27 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by
|
||||
Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2005-04-22 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Norwegian bokmål translation by
|
||||
Geir Helland.
|
||||
|
||||
2005-04-20 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by
|
||||
Sharuzzaman Ahmat Raslan.
|
||||
* ro.po: Updated Romanian translation by Laurentiu Buzdugan.
|
||||
* zh_TW.po: Updated Traditional Chinese translation by
|
||||
CHAO Wei-Lun.
|
||||
|
||||
2005-04-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* vi.po: Updated Vietnamese translation by Phan Vinh Thinh.
|
||||
|
||||
2005-04-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* ro.po: Updated Romanian translation by Laurentiu Buzdugan.
|
||||
|
||||
2005-04-14 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* es.po: Updated Spanish translation by
|
||||
Ricardo Javier Cárdenes Medina.
|
||||
|
||||
2005-04-13 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* vi.po: New Vietnamese translation by Phan Vinh Thinh.
|
||||
* LINGUAS: Added "vi".
|
||||
|
||||
2005-04-09 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* zh_TW.po: Added Plural-Forms header and fix format specification
|
||||
typos.
|
||||
|
||||
2005-04-08 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* zh_TW.po: Updated Traditional Chinese translation by
|
||||
CHAO Wei-Lun.
|
||||
|
||||
2005-04-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* rw.po: New Kinyarwanda translation by Steve Murphy.
|
||||
* LINGUAS: Added "rw".
|
||||
|
||||
2005-04-05 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by
|
||||
Jean-Philippe Guérard.
|
||||
* ro.po: Updated Romanian translation by
|
||||
Laurentiu Buzdugan.
|
||||
|
||||
2005-03-11 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru sr sv tr uk zh_TW
|
||||
ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk vi zh_TW
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
# $Id$
|
||||
# List of source files containing translatable strings.
|
||||
|
||||
# Package source files
|
||||
src/cut.c
|
||||
src/files.c
|
||||
src/global.c
|
||||
src/move.c
|
||||
src/nano.c
|
||||
src/rcfile.c
|
||||
src/search.c
|
||||
src/utils.c
|
||||
src/winio.c
|
||||
|
||||
# Package header files
|
||||
src/nano.h
|
||||
src/proto.h
|
||||
|
||||
2
po/de.po
2
po/de.po
@@ -174,7 +174,7 @@ msgstr "Dateiname zum Speichern"
|
||||
|
||||
#: src/files.c:1910
|
||||
msgid "File exists, OVERWRITE ? "
|
||||
msgstr "Datei exisitiert, ÜBERSCHREIBEN? "
|
||||
msgstr "Datei existiert, ÜBERSCHREIBEN? "
|
||||
|
||||
#: src/files.c:1923
|
||||
msgid "Save file under DIFFERENT NAME ? "
|
||||
|
||||
@@ -1333,7 +1333,7 @@ msgstr ""
|
||||
"Cor %s não foi entendida.\n"
|
||||
"Cores válidas são \"green\" (verde), \"red\" (vermelho), \n"
|
||||
"\"blue\" (azul), \"yellow\" (amarelo), \"cyan\" (ciano), \n"
|
||||
"\"magente\" (maguenta) e \"black\" (preto), com o prefixo \n"
|
||||
"\"magenta\" (maguenta) e \"black\" (preto), com o prefixo \n"
|
||||
"opcional \"bright\" (claro) para cores de fundo."
|
||||
|
||||
#: src/rcfile.c:253 src/search.c:61
|
||||
|
||||
15
po/update.pl
15
po/update.pl
@@ -5,19 +5,20 @@
|
||||
#
|
||||
# Copyright (C) 2000 Free Software Foundation.
|
||||
#
|
||||
# This script 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 of the
|
||||
# License, or (at your option) any later version.
|
||||
# This script 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 of the License, or (at
|
||||
# your option) any later version.
|
||||
#
|
||||
# This script is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# This script is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
#
|
||||
# Authors: Kenneth Christiansen <kenneth@gnu.org>
|
||||
#
|
||||
|
||||
2075
po/zh_TW.po
2075
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
395
src/chars.c
395
src/chars.c
@@ -8,14 +8,15 @@
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -28,7 +29,6 @@
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
#ifdef HAVE_WCHAR_H
|
||||
@@ -39,6 +39,22 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ISBLANK
|
||||
/* This function is equivalent to isblank(). */
|
||||
bool nisblank(int c)
|
||||
{
|
||||
return isspace(c) && (c == '\t' || !is_cntrl_char(c));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_ISWBLANK) && defined(NANO_WIDE)
|
||||
/* This function is equivalent to iswblank(). */
|
||||
bool niswblank(wchar_t wc)
|
||||
{
|
||||
return iswspace(wc) && (wc == '\t' || !is_cntrl_wchar(wc));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return TRUE if the value of c is in byte range, and FALSE
|
||||
* otherwise. */
|
||||
bool is_byte(int c)
|
||||
@@ -46,19 +62,13 @@ bool is_byte(int c)
|
||||
return ((unsigned int)c == (unsigned char)c);
|
||||
}
|
||||
|
||||
/* This function is equivalent to isalnum(). */
|
||||
bool is_alnum_char(int c)
|
||||
{
|
||||
return isalnum(c);
|
||||
}
|
||||
|
||||
/* This function is equivalent to isalnum() for multibyte characters. */
|
||||
bool is_alnum_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
@@ -67,30 +77,10 @@ bool is_alnum_mbchar(const char *c)
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
return is_alnum_wchar(wc);
|
||||
return iswalnum(wc);
|
||||
} else
|
||||
#endif
|
||||
return is_alnum_char((unsigned char)*c);
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* This function is equivalent to isalnum() for wide characters. */
|
||||
bool is_alnum_wchar(wchar_t wc)
|
||||
{
|
||||
return iswalnum(wc);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to isblank(). */
|
||||
bool is_blank_char(int c)
|
||||
{
|
||||
return
|
||||
#ifdef HAVE_ISBLANK
|
||||
isblank(c)
|
||||
#else
|
||||
isspace(c) && (c == '\t' || !is_cntrl_char(c))
|
||||
#endif
|
||||
;
|
||||
return isalnum((unsigned char)*c);
|
||||
}
|
||||
|
||||
/* This function is equivalent to isblank() for multibyte characters. */
|
||||
@@ -99,7 +89,7 @@ bool is_blank_mbchar(const char *c)
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
@@ -108,26 +98,12 @@ bool is_blank_mbchar(const char *c)
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
return is_blank_wchar(wc);
|
||||
return iswblank(wc);
|
||||
} else
|
||||
#endif
|
||||
return is_blank_char((unsigned char)*c);
|
||||
return isblank((unsigned char)*c);
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* This function is equivalent to isblank() for wide characters. */
|
||||
bool is_blank_wchar(wchar_t wc)
|
||||
{
|
||||
return
|
||||
#ifdef HAVE_ISWBLANK
|
||||
iswblank(wc)
|
||||
#else
|
||||
iswspace(wc) && (wc == '\t' || !is_cntrl_wchar(wc))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to iscntrl(), except in that it also
|
||||
* handles control characters with their high bits set. */
|
||||
bool is_cntrl_char(int c)
|
||||
@@ -136,6 +112,16 @@ bool is_cntrl_char(int c)
|
||||
(127 <= c && c < 160);
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* This function is equivalent to iscntrl() for wide characters, except
|
||||
* in that it also handles wide control characters with their high bits
|
||||
* set. */
|
||||
bool is_cntrl_wchar(wchar_t wc)
|
||||
{
|
||||
return (0 <= wc && wc < 32) || (127 <= wc && wc < 160);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to iscntrl() for multibyte characters,
|
||||
* except in that it also handles multibyte control characters with
|
||||
* their high bits set. */
|
||||
@@ -144,7 +130,7 @@ bool is_cntrl_mbchar(const char *c)
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
@@ -159,19 +145,41 @@ bool is_cntrl_mbchar(const char *c)
|
||||
return is_cntrl_char((unsigned char)*c);
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* This function is equivalent to iscntrl() for wide characters, except
|
||||
* in that it also handles wide control characters with their high bits
|
||||
* set. */
|
||||
bool is_cntrl_wchar(wchar_t wc)
|
||||
/* This function is equivalent to ispunct() for multibyte characters. */
|
||||
bool is_punct_mbchar(const char *c)
|
||||
{
|
||||
return (0 <= wc && wc < 32) || (127 <= wc && wc < 160);
|
||||
}
|
||||
#endif
|
||||
assert(c != NULL);
|
||||
|
||||
/* c is a control character. It displays as ^@, ^?, or ^[ch] where ch
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
return iswpunct(wc);
|
||||
} else
|
||||
#endif
|
||||
return ispunct((unsigned char)*c);
|
||||
}
|
||||
|
||||
/* Return TRUE for a multibyte character found in a word (currently only
|
||||
* an alphanumeric or punctuation character, and only the latter if
|
||||
* allow_punct is TRUE) and FALSE otherwise. */
|
||||
bool is_word_mbchar(const char *c, bool allow_punct)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
return is_alnum_mbchar(c) || (allow_punct ? is_punct_mbchar(c) :
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/* c is a control character. It displays as ^@, ^?, or ^[ch], where ch
|
||||
* is c + 64. We return that character. */
|
||||
unsigned char control_rep(unsigned char c)
|
||||
char control_rep(char c)
|
||||
{
|
||||
/* Treat newlines embedded in a line as encoded nulls. */
|
||||
if (c == '\n')
|
||||
@@ -182,48 +190,9 @@ unsigned char control_rep(unsigned char c)
|
||||
return c + 64;
|
||||
}
|
||||
|
||||
/* c is a multibyte control character. It displays as ^@, ^?, or ^[ch]
|
||||
* where ch is c + 64. We return that multibyte character. */
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
wchar_t wc, wcrep;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX), crep_mb_len;
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
wcrep = control_wrep(wc);
|
||||
|
||||
crep_mb_len = wctomb(crep, wcrep);
|
||||
|
||||
if (crep_mb_len <= 0) {
|
||||
wctomb(NULL, 0);
|
||||
crep_mb_len = 0;
|
||||
}
|
||||
|
||||
*crep_len = crep_mb_len;
|
||||
|
||||
return crep;
|
||||
} else {
|
||||
#endif
|
||||
*crep_len = 1;
|
||||
*crep = control_rep((unsigned char)*c);
|
||||
|
||||
return crep;
|
||||
#ifdef NANO_WIDE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
/* c is a wide control character. It displays as ^@, ^?, or ^[ch] where
|
||||
* ch is c + 64. We return that wide character. */
|
||||
/* c is a wide control character. It displays as ^@, ^?, or ^[ch],
|
||||
* where ch is c + 64. We return that wide character. */
|
||||
wchar_t control_wrep(wchar_t wc)
|
||||
{
|
||||
/* Treat newlines embedded in a line as encoded nulls. */
|
||||
@@ -236,13 +205,45 @@ wchar_t control_wrep(wchar_t wc)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* c is a multibyte control character. It displays as ^@, ^?, or ^[ch],
|
||||
* where ch is c + 64. We return that multibyte character. */
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len)
|
||||
{
|
||||
assert(c != NULL && crep != NULL && crep_len != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
}
|
||||
|
||||
*crep_len = wctomb(crep, control_wrep(wc));
|
||||
|
||||
if (*crep_len <= 0) {
|
||||
wctomb(NULL, 0);
|
||||
*crep_len = 0;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
*crep_len = 1;
|
||||
*crep = control_rep(*c);
|
||||
#ifdef NANO_WIDE
|
||||
}
|
||||
#endif
|
||||
|
||||
return crep;
|
||||
}
|
||||
|
||||
/* This function is equivalent to wcwidth() for multibyte characters. */
|
||||
int mbwidth(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
if (ISSET(USE_UTF8)) {
|
||||
wchar_t wc;
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX), width;
|
||||
|
||||
@@ -252,6 +253,7 @@ int mbwidth(const char *c)
|
||||
}
|
||||
|
||||
width = wcwidth(wc);
|
||||
|
||||
if (width == -1)
|
||||
width++;
|
||||
|
||||
@@ -266,22 +268,24 @@ int mb_cur_max(void)
|
||||
{
|
||||
return
|
||||
#ifdef NANO_WIDE
|
||||
!ISSET(NO_UTF8) ? MB_CUR_MAX :
|
||||
ISSET(USE_UTF8) ? MB_CUR_MAX :
|
||||
#endif
|
||||
1;
|
||||
}
|
||||
|
||||
/* Convert the value in chr to a multibyte character with the same
|
||||
* wide character value as chr. Return the (dynamically allocated)
|
||||
* multibyte character and its length. */
|
||||
* wide character value as chr, if possible. If the conversion
|
||||
* succeeds, return the (dynamically allocated) multibyte character and
|
||||
* its length. Otherwise, return an undefined (dynamically allocated)
|
||||
* multibyte character and a length of zero. */
|
||||
char *make_mbchar(int chr, int *chr_mb_len)
|
||||
{
|
||||
char *chr_mb;
|
||||
|
||||
assert(chr_mb != NULL && chr_mb_len != NULL);
|
||||
assert(chr_mb_len != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
if (ISSET(USE_UTF8)) {
|
||||
chr_mb = charalloc(MB_CUR_MAX);
|
||||
*chr_mb_len = wctomb(chr_mb, chr);
|
||||
|
||||
@@ -292,8 +296,7 @@ char *make_mbchar(int chr, int *chr_mb_len)
|
||||
} else {
|
||||
#endif
|
||||
*chr_mb_len = 1;
|
||||
chr_mb = charalloc(1);
|
||||
*chr_mb = (char)chr;
|
||||
chr_mb = mallocstrncpy(NULL, (char *)&chr, 1);
|
||||
#ifdef NANO_WIDE
|
||||
}
|
||||
#endif
|
||||
@@ -301,58 +304,6 @@ char *make_mbchar(int chr, int *chr_mb_len)
|
||||
return chr_mb;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_NANORC) || defined(ENABLE_EXTRA)
|
||||
/* Convert the string str to a valid multibyte string with the same wide
|
||||
* character values as str. Return the (dynamically allocated)
|
||||
* multibyte string. */
|
||||
char *make_mbstring(const char *str)
|
||||
{
|
||||
assert(str != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
char *chr_mb = charalloc(MB_CUR_MAX);
|
||||
int chr_mb_len;
|
||||
char *str_mb = charalloc((MB_CUR_MAX * strlen(str)) + 1);
|
||||
size_t str_mb_len = 0;
|
||||
|
||||
while (*str != '\0') {
|
||||
bool bad_char;
|
||||
int i;
|
||||
|
||||
chr_mb_len = parse_mbchar(str, chr_mb, &bad_char, NULL);
|
||||
|
||||
if (bad_char) {
|
||||
char *bad_chr_mb;
|
||||
int bad_chr_mb_len;
|
||||
|
||||
bad_chr_mb = make_mbchar((unsigned char)*chr_mb,
|
||||
&bad_chr_mb_len);
|
||||
|
||||
for (i = 0; i < bad_chr_mb_len; i++)
|
||||
str_mb[str_mb_len + i] = bad_chr_mb[i];
|
||||
str_mb_len += bad_chr_mb_len;
|
||||
|
||||
free(bad_chr_mb);
|
||||
} else {
|
||||
for (i = 0; i < chr_mb_len; i++)
|
||||
str_mb[str_mb_len + i] = chr_mb[i];
|
||||
str_mb_len += chr_mb_len;
|
||||
}
|
||||
|
||||
str += chr_mb_len;
|
||||
}
|
||||
|
||||
free(chr_mb);
|
||||
null_at(&str_mb, str_mb_len);
|
||||
|
||||
return str_mb;
|
||||
} else
|
||||
#endif
|
||||
return mallocstrcpy(NULL, str);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Parse a multibyte character from buf. Return the number of bytes
|
||||
* used. If chr isn't NULL, store the multibyte character in it. If
|
||||
* bad_chr isn't NULL, set it to TRUE if we have a bad multibyte
|
||||
@@ -369,7 +320,7 @@ int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
|
||||
*bad_chr = FALSE;
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
if (ISSET(USE_UTF8)) {
|
||||
/* Get the number of bytes in the multibyte character. */
|
||||
buf_mb_len = mblen(buf, MB_CUR_MAX);
|
||||
|
||||
@@ -455,7 +406,7 @@ size_t move_mbleft(const char *buf, size_t pos)
|
||||
{
|
||||
size_t pos_prev = pos;
|
||||
|
||||
assert(str != NULL && pos <= strlen(buf));
|
||||
assert(buf != NULL && pos <= strlen(buf));
|
||||
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. Here is the naive, O(pos) way to do it. */
|
||||
@@ -505,7 +456,7 @@ int nstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
return (tolower(*s1) - tolower(*s2));
|
||||
return tolower(*s1) - tolower(*s2);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -516,7 +467,7 @@ int nstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *s1_mb = charalloc(MB_CUR_MAX);
|
||||
char *s2_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t ws1, ws2;
|
||||
@@ -524,6 +475,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
|
||||
while (n > 0 && *s1 != '\0' && *s2 != '\0') {
|
||||
bool bad_s1_mb = FALSE, bad_s2_mb = FALSE;
|
||||
int s1_mb_len, s2_mb_len;
|
||||
|
||||
s1_mb_len = parse_mbchar(s1, s1_mb, NULL, NULL);
|
||||
@@ -531,6 +483,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
if (mbtowc(&ws1, s1_mb, s1_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws1 = (unsigned char)*s1_mb;
|
||||
bad_s1_mb = TRUE;
|
||||
}
|
||||
|
||||
s2_mb_len = parse_mbchar(s2, s2_mb, NULL, NULL);
|
||||
@@ -538,9 +491,11 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
if (mbtowc(&ws2, s2_mb, s2_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
ws2 = (unsigned char)*s2_mb;
|
||||
bad_s2_mb = TRUE;
|
||||
}
|
||||
|
||||
if (n == 0 || towlower(ws1) != towlower(ws2))
|
||||
if (n == 0 || bad_s1_mb != bad_s2_mb ||
|
||||
towlower(ws1) != towlower(ws2))
|
||||
break;
|
||||
|
||||
s1 += s1_mb_len;
|
||||
@@ -551,7 +506,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
free(s1_mb);
|
||||
free(s2_mb);
|
||||
|
||||
return (towlower(ws1) - towlower(ws2));
|
||||
return towlower(ws1) - towlower(ws2);
|
||||
} else
|
||||
#endif
|
||||
return strncasecmp(s1, s2, n);
|
||||
@@ -582,7 +537,7 @@ const char *nstrcasestr(const char *haystack, const char *needle)
|
||||
const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t wr, wq;
|
||||
@@ -595,11 +550,14 @@ const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
int r_mb_len, q_mb_len;
|
||||
|
||||
while (*q != '\0') {
|
||||
bool bad_r_mb = FALSE, bad_q_mb = FALSE;
|
||||
|
||||
r_mb_len = parse_mbchar(r, r_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&wr, r_mb, r_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wr = (unsigned char)*r;
|
||||
bad_r_mb = TRUE;
|
||||
}
|
||||
|
||||
q_mb_len = parse_mbchar(q, q_mb, NULL, NULL);
|
||||
@@ -607,9 +565,11 @@ const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wq = (unsigned char)*q;
|
||||
bad_q_mb = TRUE;
|
||||
}
|
||||
|
||||
if (towlower(wr) != towlower(wq))
|
||||
if (bad_r_mb != bad_q_mb ||
|
||||
towlower(wr) != towlower(wq))
|
||||
break;
|
||||
|
||||
r += r_mb_len;
|
||||
@@ -653,7 +613,7 @@ const char *revstrstr(const char *haystack, const char *needle, const
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL || !DISABLE_TABCOMP */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* This function is equivalent to strcasestr(), except in that it scans
|
||||
@@ -683,7 +643,7 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
const char *rev_start)
|
||||
{
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *r_mb = charalloc(MB_CUR_MAX);
|
||||
char *q_mb = charalloc(MB_CUR_MAX);
|
||||
wchar_t wr, wq;
|
||||
@@ -696,11 +656,14 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
int r_mb_len, q_mb_len;
|
||||
|
||||
while (*q != '\0') {
|
||||
bool bad_r_mb = FALSE, bad_q_mb = FALSE;
|
||||
|
||||
r_mb_len = parse_mbchar(r, r_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&wr, r_mb, r_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wr = (unsigned char)*r;
|
||||
bad_r_mb = TRUE;
|
||||
}
|
||||
|
||||
q_mb_len = parse_mbchar(q, q_mb, NULL, NULL);
|
||||
@@ -708,9 +671,11 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
wq = (unsigned char)*q;
|
||||
bad_q_mb = TRUE;
|
||||
}
|
||||
|
||||
if (towlower(wr) != towlower(wq))
|
||||
if (bad_r_mb != bad_q_mb ||
|
||||
towlower(wr) != towlower(wq))
|
||||
break;
|
||||
|
||||
r += r_mb_len;
|
||||
@@ -737,7 +702,7 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
#endif
|
||||
return revstrcasestr(haystack, needle, rev_start);
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* This function is equivalent to strlen() for multibyte strings. */
|
||||
size_t mbstrlen(const char *s)
|
||||
@@ -766,13 +731,12 @@ size_t mbstrnlen(const char *s, size_t maxlen)
|
||||
assert(s != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
if (ISSET(USE_UTF8)) {
|
||||
size_t n = 0;
|
||||
char *s_mb = charalloc(MB_CUR_MAX);
|
||||
int s_mb_len;
|
||||
|
||||
while (*s != '\0') {
|
||||
s_mb_len = parse_mbchar(s, s_mb, NULL, NULL);
|
||||
s_mb_len = parse_mbchar(s, NULL, NULL, NULL);
|
||||
|
||||
if (maxlen == 0)
|
||||
break;
|
||||
@@ -782,8 +746,6 @@ size_t mbstrnlen(const char *s, size_t maxlen)
|
||||
n++;
|
||||
}
|
||||
|
||||
free(s_mb);
|
||||
|
||||
return n;
|
||||
} else
|
||||
#endif
|
||||
@@ -791,17 +753,65 @@ size_t mbstrnlen(const char *s, size_t maxlen)
|
||||
}
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Return TRUE if the string s contains one or more blank characters,
|
||||
* and FALSE otherwise. */
|
||||
bool has_blank_chars(const char *s)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
for (; *s != '\0'; s++) {
|
||||
if (isblank(*s))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Return TRUE if the multibyte string s contains one or more blank
|
||||
* multibyte characters, and FALSE otherwise. */
|
||||
bool has_blank_mbchars(const char *s)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *chr_mb = charalloc(MB_CUR_MAX);
|
||||
bool retval = FALSE;
|
||||
|
||||
while (*s != '\0') {
|
||||
int chr_mb_len;
|
||||
|
||||
chr_mb_len = parse_mbchar(s, chr_mb, NULL, NULL);
|
||||
|
||||
if (is_blank_mbchar(chr_mb)) {
|
||||
retval = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
s += chr_mb_len;
|
||||
}
|
||||
|
||||
free(chr_mb);
|
||||
|
||||
return retval;
|
||||
} else
|
||||
#endif
|
||||
return has_blank_chars(s);
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* This function is equivalent to strchr() for multibyte strings. */
|
||||
char *mbstrchr(const char *s, char *c)
|
||||
{
|
||||
assert(s != NULL && c != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
if (ISSET(USE_UTF8)) {
|
||||
char *s_mb = charalloc(MB_CUR_MAX);
|
||||
const char *q = s;
|
||||
wchar_t ws, wc;
|
||||
int s_mb_len, c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
@@ -809,7 +819,7 @@ char *mbstrchr(const char *s, char *c)
|
||||
}
|
||||
|
||||
while (*s != '\0') {
|
||||
s_mb_len = parse_mbchar(s, s_mb, NULL, NULL);
|
||||
int s_mb_len = parse_mbchar(s, s_mb, NULL, NULL);
|
||||
|
||||
if (mbtowc(&ws, s_mb, s_mb_len) <= 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
@@ -833,4 +843,21 @@ char *mbstrchr(const char *s, char *c)
|
||||
#endif
|
||||
return strchr(s, *c);
|
||||
}
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Check if the string s is a valid multibyte string. Return TRUE if it
|
||||
* is, and FALSE otherwise. */
|
||||
bool is_valid_mbstring(const char *s)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
return
|
||||
#ifdef NANO_WIDE
|
||||
ISSET(USE_UTF8) ?
|
||||
(mbstowcs(NULL, s, 0) != (size_t)-1) :
|
||||
#endif
|
||||
|
||||
TRUE;
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
14
src/color.c
14
src/color.c
@@ -8,14 +8,15 @@
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -29,7 +30,6 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
@@ -122,7 +122,7 @@ void update_color(void)
|
||||
if (colorstrings == NULL && syntaxstr != NULL) {
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcasecmp(tmpsyntax->desc, syntaxstr) == 0)
|
||||
if (mbstrcasecmp(tmpsyntax->desc, syntaxstr) == 0)
|
||||
colorstrings = tmpsyntax->color;
|
||||
}
|
||||
}
|
||||
|
||||
36
src/cut.c
36
src/cut.c
@@ -8,14 +8,15 @@
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -28,7 +29,6 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
static bool keep_cutbuffer = FALSE;
|
||||
/* Should we keep the contents of the cutbuffer? */
|
||||
@@ -41,12 +41,15 @@ void cutbuffer_reset(void)
|
||||
}
|
||||
|
||||
/* If we're not on the magicline, move all the text of the current line,
|
||||
* plus the newline at the end, to the cutbuffer. */
|
||||
* plus the newline at the end, to the cutbuffer, and set the current
|
||||
* place we want to where the line used to start. */
|
||||
void cut_line(void)
|
||||
{
|
||||
if (current->next != NULL)
|
||||
if (current->next != NULL) {
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, 0,
|
||||
current->next, 0);
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -63,7 +66,6 @@ void cut_marked(void)
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If we're not at the end of the current line, move all the text from
|
||||
* the current cursor position to the end of the current line,
|
||||
@@ -84,15 +86,16 @@ void cut_to_eol(void)
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
current, data_len);
|
||||
else if (current->next != NULL) {
|
||||
/* If we're at the end of the line, and the next line isn't the
|
||||
* magicline, move all the text from the current position up to
|
||||
* the beginning of the next line, i.e, the newline at the
|
||||
* end, to the cutbuffer. */
|
||||
/* If we're at the end of the line, and it isn't the magicline,
|
||||
* move all the text from the current position up to the
|
||||
* beginning of the next line, i.e, the newline at the end, to
|
||||
* the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
current->next, 0);
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* Move text from the current filestruct into the cutbuffer. */
|
||||
void do_cut_text(void)
|
||||
@@ -122,13 +125,12 @@ void do_cut_text(void)
|
||||
* turn the mark off. */
|
||||
cut_marked();
|
||||
UNSET(MARK_ISSET);
|
||||
} else
|
||||
#endif
|
||||
if (ISSET(CUT_TO_END))
|
||||
} 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. */
|
||||
cut_to_eol();
|
||||
else
|
||||
#endif
|
||||
/* Otherwise, move the entire line into the cutbuffer. */
|
||||
cut_line();
|
||||
|
||||
@@ -158,7 +160,7 @@ void do_cut_till_end(void)
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* Copy text from the cutbuffer into the current filestruct. */
|
||||
void do_uncut_text(void)
|
||||
|
||||
720
src/files.c
720
src/files.c
File diff suppressed because it is too large
Load Diff
244
src/global.c
244
src/global.c
@@ -8,14 +8,15 @@
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -26,7 +27,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
/* Global variables */
|
||||
|
||||
@@ -38,7 +38,6 @@ ssize_t wrap_at = -CHARS_FROM_EOL; /* Right justified fill value,
|
||||
|
||||
char *last_search = NULL; /* Last string we searched for */
|
||||
char *last_replace = NULL; /* Last replacement string */
|
||||
int search_last_line; /* Is this the last search line? */
|
||||
|
||||
unsigned long flags = 0; /* Our flag containing many options */
|
||||
WINDOW *topwin; /* Top buffer */
|
||||
@@ -55,7 +54,7 @@ int editwinrows = 0; /* How many rows long is the edit
|
||||
filestruct *current; /* Current buffer pointer */
|
||||
size_t current_x = 0; /* Current x-coordinate in the edit
|
||||
window */
|
||||
int current_y = 0; /* Current y-coordinate in the edit
|
||||
ssize_t current_y = 0; /* Current y-coordinate in the edit
|
||||
window */
|
||||
filestruct *fileage = NULL; /* Our file buffer */
|
||||
filestruct *edittop = NULL; /* Pointer to the top of the edit
|
||||
@@ -103,7 +102,7 @@ char *backup_dir = NULL; /* Backup directory. */
|
||||
#endif
|
||||
|
||||
char *answer = NULL; /* Answer str to many questions */
|
||||
int totlines = 0; /* Total number of lines in the file */
|
||||
size_t totlines = 0; /* Total number of lines in the file */
|
||||
size_t totsize = 0; /* Total number of characters in the
|
||||
file */
|
||||
size_t placewewant = 0; /* The column we'd like the cursor
|
||||
@@ -168,12 +167,15 @@ toggle *toggles = NULL;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype search_history;
|
||||
historyheadtype replace_history;
|
||||
filestruct *search_history = NULL;
|
||||
filestruct *searchage = NULL;
|
||||
filestruct *searchbot = NULL;
|
||||
filestruct *replace_history = NULL;
|
||||
filestruct *replaceage = NULL;
|
||||
filestruct *replacebot = NULL;
|
||||
#endif
|
||||
|
||||
/* Regular expressions */
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
regex_t search_regexp; /* Global to store compiled search regexp */
|
||||
regmatch_t regmatches[10]; /* Match positions for parenthetical
|
||||
@@ -239,6 +241,7 @@ void shortcut_init(bool unjustify)
|
||||
const char *cancel_msg = N_("Cancel");
|
||||
const char *first_line_msg = N_("First Line");
|
||||
const char *last_line_msg = N_("Last Line");
|
||||
const char *refresh_msg = N_("Refresh");
|
||||
#ifndef NANO_SMALL
|
||||
const char *cut_till_end_msg = N_("CutTillEnd");
|
||||
#endif
|
||||
@@ -249,42 +252,48 @@ void shortcut_init(bool unjustify)
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
const char *case_sens_msg = N_("Case Sens");
|
||||
const char *direction_msg = N_("Direction");
|
||||
const char *backwards_msg = N_("Backwards");
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *regexp_msg = N_("Regexp");
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
const char *history_msg = N_("History");
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *new_buffer_msg = N_("New Buffer");
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
const char *to_files_msg = N_("To Files");
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
const char *nano_help_msg = N_("Invoke the help menu");
|
||||
const char *nano_exit_msg =
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
N_("Close currently loaded file/Exit from nano")
|
||||
N_("Close the current file buffer/Exit from nano")
|
||||
#else
|
||||
N_("Exit from nano")
|
||||
#endif
|
||||
;
|
||||
const char *nano_writeout_msg = N_("Write the current file to disk");
|
||||
const char *nano_writeout_msg =
|
||||
N_("Write the current file to disk");
|
||||
const char *nano_justify_msg = N_("Justify the current paragraph");
|
||||
const char *nano_insert_msg =
|
||||
N_("Insert another file into the current one");
|
||||
const char *nano_whereis_msg = N_("Search for text within the editor");
|
||||
const char *nano_whereis_msg =
|
||||
N_("Search for text within the editor");
|
||||
const char *nano_prevpage_msg = N_("Move to the previous screen");
|
||||
const char *nano_nextpage_msg = N_("Move to the next screen");
|
||||
const char *nano_cut_msg =
|
||||
N_("Cut the current line and store it in the cutbuffer");
|
||||
const char *nano_uncut_msg =
|
||||
N_("Uncut from the cutbuffer into the current line");
|
||||
const char *nano_cursorpos_msg = N_("Show the position of the cursor");
|
||||
const char *nano_spell_msg = N_("Invoke the spell checker, if available");
|
||||
const char *nano_gotoline_msg = N_("Go to a specific line number");
|
||||
const char *nano_cursorpos_msg =
|
||||
N_("Show the position of the cursor");
|
||||
const char *nano_spell_msg =
|
||||
N_("Invoke the spell checker, if available");
|
||||
const char *nano_gotoline_msg =
|
||||
N_("Go to a specific line number and column number");
|
||||
const char *nano_replace_msg = N_("Replace text within the editor");
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_mark_msg = N_("Mark text at the cursor position");
|
||||
@@ -294,10 +303,14 @@ void shortcut_init(bool unjustify)
|
||||
const char *nano_nextline_msg = N_("Move to the next line");
|
||||
const char *nano_forward_msg = N_("Move forward one character");
|
||||
const char *nano_back_msg = N_("Move back one character");
|
||||
const char *nano_home_msg = N_("Move to the beginning of the current line");
|
||||
const char *nano_end_msg = N_("Move to the end of the current line");
|
||||
const char *nano_refresh_msg = N_("Refresh (redraw) the current screen");
|
||||
const char *nano_delete_msg = N_("Delete the character under the cursor");
|
||||
const char *nano_home_msg =
|
||||
N_("Move to the beginning of the current line");
|
||||
const char *nano_end_msg =
|
||||
N_("Move to the end of the current line");
|
||||
const char *nano_refresh_msg =
|
||||
N_("Refresh (redraw) the current screen");
|
||||
const char *nano_delete_msg =
|
||||
N_("Delete the character under the cursor");
|
||||
const char *nano_backspace_msg =
|
||||
N_("Delete the character to the left of the cursor");
|
||||
const char *nano_tab_msg =
|
||||
@@ -307,6 +320,8 @@ void shortcut_init(bool unjustify)
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_nextword_msg = N_("Move forward one word");
|
||||
const char *nano_prevword_msg = N_("Move backward one word");
|
||||
const char *nano_wordcount_msg =
|
||||
N_("Count the number of words in the file");
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *nano_parabegin_msg =
|
||||
@@ -315,8 +330,10 @@ void shortcut_init(bool unjustify)
|
||||
N_("Go to the end of the current paragraph");
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *nano_openprev_msg = N_("Switch to the previous file buffer");
|
||||
const char *nano_opennext_msg = N_("Switch to the next file buffer");
|
||||
const char *nano_openprev_msg =
|
||||
N_("Switch to the previous file buffer");
|
||||
const char *nano_opennext_msg =
|
||||
N_("Switch to the next file buffer");
|
||||
#endif
|
||||
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
|
||||
#ifndef NANO_SMALL
|
||||
@@ -330,20 +347,23 @@ void shortcut_init(bool unjustify)
|
||||
const char *nano_bracket_msg = N_("Find other bracket");
|
||||
#endif
|
||||
const char *nano_cancel_msg = N_("Cancel the current function");
|
||||
const char *nano_firstline_msg = N_("Go to the first line of the file");
|
||||
const char *nano_lastline_msg = N_("Go to the last line of the file");
|
||||
const char *nano_firstline_msg =
|
||||
N_("Go to the first line of the file");
|
||||
const char *nano_lastline_msg =
|
||||
N_("Go to the last line of the file");
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_case_msg =
|
||||
N_("Make the current search/replace case (in)sensitive");
|
||||
const char *nano_reverse_msg =
|
||||
N_("Make the current search/replace go backwards");
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *nano_regexp_msg = N_("Use regular expressions");
|
||||
#endif
|
||||
const char *nano_editstr_msg =
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_history_msg =
|
||||
N_("Edit the previous search/replace strings");
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
const char *nano_tofiles_msg = N_("Go to file browser");
|
||||
#endif
|
||||
@@ -354,7 +374,8 @@ void shortcut_init(bool unjustify)
|
||||
const char *nano_append_msg = N_("Append to the current file");
|
||||
const char *nano_prepend_msg = N_("Prepend to the current file");
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_backup_msg = N_("Back up original file when saving");
|
||||
const char *nano_backup_msg =
|
||||
N_("Back up original file when saving");
|
||||
const char *nano_execute_msg = N_("Execute external command");
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_MULTIBUFFER)
|
||||
@@ -370,9 +391,9 @@ void shortcut_init(bool unjustify)
|
||||
* point is that sc_init_one() takes 9 arguments, unless DISABLE_HELP is
|
||||
* defined, when the 4th one should not be there. */
|
||||
#ifndef DISABLE_HELP
|
||||
# define IFHELP(help, nextvar) help, nextvar
|
||||
#define IFHELP(help, nextvar) help, nextvar
|
||||
#else
|
||||
# define IFHELP(help, nextvar) nextvar
|
||||
#define IFHELP(help, nextvar) nextvar
|
||||
#endif
|
||||
|
||||
free_shortcutage(&main_list);
|
||||
@@ -480,7 +501,8 @@ void shortcut_init(bool unjustify)
|
||||
|
||||
sc_init_one(&main_list, NANO_GOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_GOTOLINE_ALTKEY),
|
||||
NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW,
|
||||
do_gotolinecolumn_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg,
|
||||
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
||||
@@ -489,7 +511,7 @@ void shortcut_init(bool unjustify)
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
|
||||
IFHELP(nano_mark_msg, NANO_MARK_ALTKEY), NANO_MARK_FKEY,
|
||||
NANO_NO_KEY, NOVIEW, do_mark);
|
||||
NANO_NO_KEY, VIEW, do_mark);
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"),
|
||||
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
|
||||
@@ -520,7 +542,7 @@ void shortcut_init(bool unjustify)
|
||||
IFHELP(nano_end_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_end);
|
||||
|
||||
sc_init_one(&main_list, NANO_REFRESH_KEY, N_("Refresh"),
|
||||
sc_init_one(&main_list, NANO_REFRESH_KEY, refresh_msg,
|
||||
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, total_refresh);
|
||||
|
||||
@@ -543,11 +565,15 @@ void shortcut_init(bool unjustify)
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&main_list, NANO_NEXTWORD_KEY, N_("Next Word"),
|
||||
IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_next_word);
|
||||
NANO_NO_KEY, VIEW, do_next_word_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Prev Word"),
|
||||
IFHELP(nano_prevword_msg, NANO_PREVWORD_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_prev_word);
|
||||
NANO_NO_KEY, VIEW, do_prev_word_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Word Count"),
|
||||
IFHELP(nano_wordcount_msg, NANO_WORDCOUNT_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_word_count);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -652,27 +678,29 @@ void shortcut_init(bool unjustify)
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_NO_KEY, direction_msg,
|
||||
sc_init_one(&whereis_list, NANO_NO_KEY, backwards_msg,
|
||||
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_NO_KEY, regexp_msg,
|
||||
IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
|
||||
IFHELP(nano_regexp_msg, NANO_REGEXP_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_HISTORY_KEY, history_msg,
|
||||
IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg,
|
||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_CUTTILLEND_KEY, cut_till_end_msg,
|
||||
IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
@@ -719,20 +747,22 @@ void shortcut_init(bool unjustify)
|
||||
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&replace_list, NANO_NO_KEY, direction_msg,
|
||||
sc_init_one(&replace_list, NANO_NO_KEY, backwards_msg,
|
||||
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg,
|
||||
IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
sc_init_one(&replace_list, NANO_HISTORY_KEY, history_msg,
|
||||
IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg,
|
||||
IFHELP(nano_regexp_msg, NANO_REGEXP_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg,
|
||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&replace_list_2);
|
||||
|
||||
@@ -759,8 +789,8 @@ void shortcut_init(bool unjustify)
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&replace_list_2, NANO_HISTORY_KEY, history_msg,
|
||||
IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, history_msg,
|
||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
@@ -795,6 +825,14 @@ void shortcut_init(bool unjustify)
|
||||
#ifndef DISABLE_HELP
|
||||
free_shortcutage(&help_list);
|
||||
|
||||
sc_init_one(&help_list, NANO_REFRESH_KEY, refresh_msg,
|
||||
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&help_list, NANO_EXIT_KEY, exit_msg,
|
||||
IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&help_list, NANO_PREVPAGE_KEY, prev_page_msg,
|
||||
IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
@@ -810,14 +848,6 @@ void shortcut_init(bool unjustify)
|
||||
sc_init_one(&help_list, NANO_NEXTLINE_KEY, N_("Next Line"),
|
||||
IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&help_list, NANO_REFRESH_KEY, N_("Refresh"),
|
||||
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&help_list, NANO_EXIT_KEY, exit_msg,
|
||||
IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&writefile_list);
|
||||
@@ -1002,10 +1032,6 @@ void shortcut_init(bool unjustify)
|
||||
IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
sc_init_one(&browser_list, NANO_REFRESH_KEY, N_("Refresh"),
|
||||
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
sc_init_one(&browser_list, NANO_GOTOLINE_KEY, N_("Go To Dir"),
|
||||
IFHELP(nano_gotodir_msg, NANO_GOTOLINE_ALTKEY),
|
||||
@@ -1039,6 +1065,7 @@ void shortcut_init(bool unjustify)
|
||||
void free_shortcutage(shortcut **shortcutage)
|
||||
{
|
||||
assert(shortcutage != NULL);
|
||||
|
||||
while (*shortcutage != NULL) {
|
||||
shortcut *ps = *shortcutage;
|
||||
*shortcutage = (*shortcutage)->next;
|
||||
@@ -1077,28 +1104,33 @@ void toggle_init(void)
|
||||
return;
|
||||
|
||||
toggle_init_one(TOGGLE_NOHELP_KEY, N_("Help mode"), NO_HELP);
|
||||
toggle_init_one(TOGGLE_MORESPACE_KEY,
|
||||
N_("Use of more space for editing"), MORE_SPACE);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* If we're using restricted mode, the multibuffer toggle is
|
||||
* disabled. It's useless since inserting files is disabled. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
|
||||
N_("Multiple file buffers"), MULTIBUFFER);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_CONST_KEY, N_("Constant cursor position"),
|
||||
CONSTUPDATE);
|
||||
toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"),
|
||||
AUTOINDENT);
|
||||
#ifndef DISABLE_WRAPPING
|
||||
toggle_init_one(TOGGLE_WRAP_KEY, N_("Auto line wrap"), NO_WRAP);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_CUTTOEND_KEY, N_("Cut to end"), CUT_TO_END);
|
||||
#ifndef DISABLE_WRAPPING
|
||||
toggle_init_one(TOGGLE_WRAP_KEY, N_("Long line wrapping"),
|
||||
NO_WRAP);
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE);
|
||||
#endif
|
||||
/* If we're using restricted mode, the suspend toggle is disabled.
|
||||
* It's useless since suspending is disabled. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
toggle_init_one(TOGGLE_SUSPEND_KEY, N_("Suspend"), SUSPEND);
|
||||
#ifndef DISABLE_MOUSE
|
||||
toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_CONST_KEY,
|
||||
N_("Constant cursor position display"), CONST_UPDATE);
|
||||
toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"),
|
||||
AUTOINDENT);
|
||||
toggle_init_one(TOGGLE_TABSTOSPACES_KEY,
|
||||
N_("Conversion of typed tabs to spaces"), TABS_TO_SPACES);
|
||||
/* If we're using restricted mode, the DOS/Mac conversion toggle is
|
||||
* disabled. It's useless since inserting files is disabled. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
@@ -1110,7 +1142,7 @@ void toggle_init(void)
|
||||
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"),
|
||||
BACKUP_FILE);
|
||||
toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"),
|
||||
SMOOTHSCROLL);
|
||||
SMOOTH_SCROLL);
|
||||
toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"),
|
||||
SMART_HOME);
|
||||
#ifdef ENABLE_COLOR
|
||||
@@ -1121,22 +1153,7 @@ void toggle_init(void)
|
||||
toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"),
|
||||
WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_MORESPACE_KEY, N_("Use of more space for editing"),
|
||||
MORE_SPACE);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Deallocate all of the toggles. */
|
||||
void free_toggles(void)
|
||||
{
|
||||
while (toggles != NULL) {
|
||||
toggle *pt = toggles; /* Think "previous toggle". */
|
||||
|
||||
toggles = toggles->next;
|
||||
free(pt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* This function is called just before calling exit(). Practically, the
|
||||
@@ -1156,7 +1173,8 @@ void thanks_for_all_the_fish(void)
|
||||
free(quotestr);
|
||||
#ifdef HAVE_REGEX_H
|
||||
regfree("ereg);
|
||||
free(quoteerr);
|
||||
if (quoteerr != NULL)
|
||||
free(quoteerr);
|
||||
#endif
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
@@ -1213,24 +1231,31 @@ void thanks_for_all_the_fish(void)
|
||||
free_shortcutage(&browser_list);
|
||||
free_shortcutage(&gotodir_list);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
free_toggles();
|
||||
#endif
|
||||
/* Free the memory associated with each toggle. */
|
||||
while (toggles != NULL) {
|
||||
toggle *t = toggles;
|
||||
|
||||
toggles = toggles->next;
|
||||
free(t);
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Free the memory associated with each open file buffer. */
|
||||
if (open_files != NULL) {
|
||||
/* We free the memory associated with each open file. */
|
||||
while (open_files->prev != NULL)
|
||||
open_files = open_files->prev;
|
||||
/* Make sure open_files->fileage is up to date, in case we've
|
||||
* cut the top line of the file. */
|
||||
open_files->fileage = fileage;
|
||||
|
||||
free_openfilestruct(open_files);
|
||||
}
|
||||
#else
|
||||
free_filestruct(fileage);
|
||||
if (fileage != NULL)
|
||||
free_filestruct(fileage);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
free(syntaxstr);
|
||||
if (syntaxstr != NULL)
|
||||
free(syntaxstr);
|
||||
while (syntaxes != NULL) {
|
||||
syntaxtype *bill = syntaxes;
|
||||
|
||||
@@ -1257,12 +1282,15 @@ void thanks_for_all_the_fish(void)
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
#ifndef NANO_SMALL
|
||||
/* free history lists */
|
||||
free_history(&search_history);
|
||||
free_history(&replace_history);
|
||||
/* Free the search and replace history lists. */
|
||||
if (searchage != NULL)
|
||||
free_filestruct(searchage);
|
||||
if (replaceage != NULL)
|
||||
free_filestruct(replaceage);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
free(homedir);
|
||||
if (homedir != NULL)
|
||||
free(homedir);
|
||||
#endif
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
21
src/move.c
21
src/move.c
@@ -8,14 +8,15 @@
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -28,7 +29,6 @@
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
void do_first_line(void)
|
||||
{
|
||||
@@ -107,7 +107,7 @@ void do_page_up(void)
|
||||
/* If we're in smooth scrolling mode and there's at least one
|
||||
* page of text left, move the current line of the edit window
|
||||
* up a page. */
|
||||
if (ISSET(SMOOTHSCROLL) && current->lineno > editwinrows - 2) {
|
||||
if (ISSET(SMOOTH_SCROLL) && current->lineno > editwinrows - 2) {
|
||||
int i;
|
||||
for (i = 0; i < editwinrows - 2; i++)
|
||||
current = current->prev;
|
||||
@@ -153,7 +153,7 @@ void do_page_down(void)
|
||||
/* If we're in smooth scrolling mode and there's at least one
|
||||
* page of text left, move the current line of the edit window
|
||||
* down a page. */
|
||||
if (ISSET(SMOOTHSCROLL) && current->lineno + editwinrows - 2 <=
|
||||
if (ISSET(SMOOTH_SCROLL) && current->lineno + editwinrows - 2 <=
|
||||
filebot->lineno) {
|
||||
int i;
|
||||
for (i = 0; i < editwinrows - 2; i++)
|
||||
@@ -201,7 +201,7 @@ void do_up(void)
|
||||
if (current_y == 0)
|
||||
edit_scroll(UP,
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(SMOOTHSCROLL) ? 1 :
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
|
||||
@@ -225,6 +225,7 @@ void do_down(void)
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
|
||||
current = current->next;
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
|
||||
@@ -234,7 +235,7 @@ void do_down(void)
|
||||
if (current_y == editwinrows - 1)
|
||||
edit_scroll(DOWN,
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(SMOOTHSCROLL) ? 1 :
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
|
||||
|
||||
1042
src/nano.c
1042
src/nano.c
File diff suppressed because it is too large
Load Diff
153
src/nano.h
153
src/nano.h
@@ -8,22 +8,27 @@
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef NANO_H
|
||||
#define NANO_H 1
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef __TANDEM
|
||||
/* Tandem NonStop Kernel */
|
||||
/* Tandem NonStop Kernel. */
|
||||
#include <floss.h>
|
||||
#define NANO_ROOT_UID 65535
|
||||
#else
|
||||
@@ -34,27 +39,27 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
/* Macros for the flags long. */
|
||||
/* Macros for flags. */
|
||||
#define SET(bit) flags |= bit
|
||||
#define UNSET(bit) flags &= ~bit
|
||||
#define ISSET(bit) ((flags & bit) != 0)
|
||||
#define TOGGLE(bit) flags ^= bit
|
||||
|
||||
/* Macros for character allocation. */
|
||||
/* Macros for character allocation, etc. */
|
||||
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
|
||||
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
#define charcpy(dest, src, n) memcpy(dest, src, (n) * sizeof(char))
|
||||
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
|
||||
|
||||
/* Other macros. */
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#undef regexec
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) safe_regexec(preg, string, nmatch, pmatch, eflags)
|
||||
#endif
|
||||
|
||||
/* Set a default value for PATH_MAX, so we can use it in lines like
|
||||
* "path = getcwd(NULL, PATH_MAX + 1);". */
|
||||
/* Set a default value for PATH_MAX if there isn't one. */
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX -1
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLANG
|
||||
@@ -82,14 +87,13 @@
|
||||
#endif
|
||||
#define gettext_noop(string) (string)
|
||||
#define N_(string) gettext_noop(string)
|
||||
/* Mark a string that will be sent to gettext later. */
|
||||
/* Mark a string that will be sent to gettext() later. */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "config.h"
|
||||
|
||||
/* If no snprintf() or vsnprintf(), use the versions from glib. */
|
||||
/* If no snprintf() or vsnprintf(), use the versions from glib 2.x. */
|
||||
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
|
||||
#include <glib.h>
|
||||
#ifndef HAVE_SNPRINTF
|
||||
@@ -100,8 +104,15 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If no strcasecmp(), strncasecmp(), strcasestr(), strnlen(),
|
||||
* getdelim(), or getline(), use the versions we have. */
|
||||
/* If no isblank(), iswblank(), strcasecmp(), strncasecmp(),
|
||||
* strcasestr(), strnlen(), getdelim(), or getline(), use the versions
|
||||
* we have. */
|
||||
#ifndef HAVE_ISBLANK
|
||||
#define isblank nisblank
|
||||
#endif
|
||||
#ifndef HAVE_ISWBLANK
|
||||
#define iswblank niswblank
|
||||
#endif
|
||||
#ifndef HAVE_STRCASECMP
|
||||
#define strcasecmp nstrcasecmp
|
||||
#endif
|
||||
@@ -121,11 +132,6 @@
|
||||
#define getline ngetline
|
||||
#endif
|
||||
|
||||
/* Assume ERR is defined as -1. To avoid duplicate case values when
|
||||
* some key definitions are missing, we have to set all of these, and
|
||||
* all of the special sentinel values below, to different negative
|
||||
* values other than -1. */
|
||||
|
||||
#define VERMSG "GNU nano " VERSION
|
||||
|
||||
/* If we aren't using ncurses, turn the mouse support off, as it's
|
||||
@@ -156,7 +162,7 @@ typedef struct filestruct {
|
||||
char *data;
|
||||
struct filestruct *next; /* Next node. */
|
||||
struct filestruct *prev; /* Previous node. */
|
||||
int lineno; /* The line number. */
|
||||
ssize_t lineno; /* The line number. */
|
||||
} filestruct;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
@@ -183,7 +189,7 @@ typedef struct openfilestruct {
|
||||
size_t current_x; /* Current file's x-coordinate
|
||||
* position. */
|
||||
size_t placewewant; /* Current file's place we want. */
|
||||
int totlines; /* Current file's total number of
|
||||
size_t totlines; /* Current file's total number of
|
||||
* lines. */
|
||||
size_t totsize; /* Current file's total size. */
|
||||
unsigned long flags; /* Current file's flags: modification
|
||||
@@ -239,53 +245,38 @@ typedef struct rcoption {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
typedef struct colortype {
|
||||
int fg; /* fg color */
|
||||
int bg; /* bg color */
|
||||
int bright; /* Is this color A_BOLD? */
|
||||
int pairnum; /* Color pair number used for this fg/bg */
|
||||
regex_t start; /* Start (or all) of the regex string */
|
||||
regex_t *end; /* End of the regex string */
|
||||
int fg; /* Foreground color. */
|
||||
int bg; /* Background color. */
|
||||
bool bright; /* Is this color A_BOLD? */
|
||||
int pairnum; /* Color pair number used for this
|
||||
* foreground/background. */
|
||||
regex_t start; /* Start (or all) of the regex
|
||||
* string. */
|
||||
regex_t *end; /* End (if any) of the regex string. */
|
||||
struct colortype *next;
|
||||
} colortype;
|
||||
|
||||
typedef struct exttype {
|
||||
regex_t val; /* The extensions that match this syntax. */
|
||||
regex_t val; /* The extensions that match this
|
||||
* syntax. */
|
||||
struct exttype *next;
|
||||
} exttype;
|
||||
|
||||
typedef struct syntaxtype {
|
||||
char *desc; /* Name of this syntax type */
|
||||
exttype *extensions; /* List of extensions that this applies to */
|
||||
colortype *color; /* color struct for this syntax */
|
||||
char *desc; /* Name of this syntax type. */
|
||||
exttype *extensions; /* List of extensions that this syntax
|
||||
* applies to. */
|
||||
colortype *color; /* Color struct for this syntax. */
|
||||
struct syntaxtype *next;
|
||||
} syntaxtype;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
typedef struct historytype {
|
||||
struct historytype *next;
|
||||
struct historytype *prev;
|
||||
char *data;
|
||||
} historytype;
|
||||
|
||||
typedef struct historyheadtype {
|
||||
struct historytype *next; /* Keep *next and *prev members
|
||||
* together. */
|
||||
struct historytype *prev; /* And in same order as in
|
||||
* historytype. */
|
||||
struct historytype *tail;
|
||||
struct historytype *current;
|
||||
int count;
|
||||
int len;
|
||||
} historyheadtype;
|
||||
#endif
|
||||
|
||||
/* Bitwise flags so we can save space (or more correctly, not waste
|
||||
* it). */
|
||||
/* Bitwise flags so that we can save space (or, more correctly, not
|
||||
* waste it). */
|
||||
#define MODIFIED (1<<0)
|
||||
#define CASE_SENSITIVE (1<<1)
|
||||
#define MARK_ISSET (1<<2)
|
||||
#define CONSTUPDATE (1<<3)
|
||||
#define CONST_UPDATE (1<<3)
|
||||
#define NO_HELP (1<<4)
|
||||
#define NOFOLLOW_SYMLINKS (1<<5)
|
||||
#define SUSPEND (1<<6)
|
||||
@@ -296,25 +287,25 @@ typedef struct historyheadtype {
|
||||
#define USE_REGEXP (1<<11)
|
||||
#define TEMP_FILE (1<<12)
|
||||
#define CUT_TO_END (1<<13)
|
||||
#define REVERSE_SEARCH (1<<14)
|
||||
#define BACKWARDS_SEARCH (1<<14)
|
||||
#define MULTIBUFFER (1<<15)
|
||||
#define SMOOTHSCROLL (1<<16)
|
||||
#define DISABLE_CURPOS (1<<17) /* Damn, we still need it. */
|
||||
#define REBIND_DELETE (1<<18)
|
||||
#define NO_CONVERT (1<<19)
|
||||
#define BACKUP_FILE (1<<20)
|
||||
#define NO_RCFILE (1<<21)
|
||||
#define NO_COLOR_SYNTAX (1<<22)
|
||||
#define PRESERVE (1<<23)
|
||||
#define HISTORY_CHANGED (1<<24)
|
||||
#define HISTORYLOG (1<<25)
|
||||
#define RESTRICTED (1<<26)
|
||||
#define SMART_HOME (1<<27)
|
||||
#define WHITESPACE_DISPLAY (1<<28)
|
||||
#define MORE_SPACE (1<<29)
|
||||
#define NO_UTF8 (1<<30)
|
||||
#define SMOOTH_SCROLL (1<<16)
|
||||
#define REBIND_DELETE (1<<17)
|
||||
#define NO_CONVERT (1<<18)
|
||||
#define BACKUP_FILE (1<<19)
|
||||
#define NO_RCFILE (1<<20)
|
||||
#define NO_COLOR_SYNTAX (1<<21)
|
||||
#define PRESERVE (1<<22)
|
||||
#define HISTORYLOG (1<<23)
|
||||
#define RESTRICTED (1<<24)
|
||||
#define SMART_HOME (1<<25)
|
||||
#define WHITESPACE_DISPLAY (1<<26)
|
||||
#define MORE_SPACE (1<<27)
|
||||
#define TABS_TO_SPACES (1<<28)
|
||||
#define QUICK_BLANK (1<<29)
|
||||
#define USE_UTF8 (1<<30)
|
||||
|
||||
/* Control key sequences, changing these would be very very bad. */
|
||||
/* Control key sequences. Changing these would be very, very bad. */
|
||||
#define NANO_CONTROL_SPACE 0
|
||||
#define NANO_CONTROL_A 1
|
||||
#define NANO_CONTROL_B 2
|
||||
@@ -392,9 +383,6 @@ typedef struct historyheadtype {
|
||||
/* No key at all. */
|
||||
#define NANO_NO_KEY -2
|
||||
|
||||
/* Special sentinel key used for search/replace history. */
|
||||
#define NANO_HISTORY_KEY -3
|
||||
|
||||
/* Normal keys. */
|
||||
#define NANO_XON_KEY NANO_CONTROL_Q
|
||||
#define NANO_XOFF_KEY NANO_CONTROL_S
|
||||
@@ -417,6 +405,7 @@ typedef struct historyheadtype {
|
||||
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_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_REPLACE_KEY NANO_CONTROL_4
|
||||
#define NANO_REPLACE_FKEY KEY_F(14)
|
||||
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
||||
@@ -466,6 +455,7 @@ typedef struct historyheadtype {
|
||||
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
|
||||
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
||||
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
||||
#define NANO_WORDCOUNT_KEY NANO_ALT_D
|
||||
#define NANO_CUTTILLEND_KEY NANO_CONTROL_X
|
||||
#define NANO_CUTTILLEND_ALTKEY NANO_ALT_T
|
||||
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
||||
@@ -486,7 +476,6 @@ typedef struct historyheadtype {
|
||||
#define TOGGLE_NOHELP_KEY NANO_ALT_X
|
||||
#define TOGGLE_MOUSE_KEY NANO_ALT_M
|
||||
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
||||
#define TOGGLE_REGEXP_KEY NANO_ALT_R
|
||||
#define TOGGLE_WRAP_KEY NANO_ALT_L
|
||||
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
||||
#define TOGGLE_CASE_KEY NANO_ALT_C
|
||||
@@ -500,6 +489,7 @@ typedef struct historyheadtype {
|
||||
#define TOGGLE_SMARTHOME_KEY NANO_ALT_H
|
||||
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
|
||||
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
|
||||
#define TOGGLE_TABSTOSPACES_KEY NANO_ALT_Q
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
#define MAIN_VISIBLE 12
|
||||
@@ -517,8 +507,11 @@ typedef struct historyheadtype {
|
||||
/* Default width of a tab. */
|
||||
#define WIDTH_OF_TAB 8
|
||||
|
||||
/* Maximum number of search history strings saved, same value used for
|
||||
* replace history. */
|
||||
/* Maximum number of search/replace history strings saved, not counting
|
||||
* the blank lines at their ends. */
|
||||
#define MAX_SEARCH_HISTORY 100
|
||||
|
||||
/* Maximum number of bytes we read from a file at one time. */
|
||||
#define MAX_BUF_SIZE 128
|
||||
|
||||
#endif /* !NANO_H */
|
||||
|
||||
187
src/proto.h
187
src/proto.h
@@ -8,17 +8,21 @@
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef PROTO_H
|
||||
#define PROTO_H 1
|
||||
|
||||
/* Externs. */
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -34,8 +38,8 @@ extern ssize_t wrap_at;
|
||||
#endif
|
||||
extern int editwinrows;
|
||||
extern size_t current_x;
|
||||
extern int current_y;
|
||||
extern int totlines;
|
||||
extern ssize_t current_y;
|
||||
extern size_t totlines;
|
||||
extern size_t placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
extern size_t mark_beginx;
|
||||
@@ -140,44 +144,45 @@ extern toggle *toggles;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
extern historyheadtype search_history;
|
||||
extern historyheadtype replace_history;
|
||||
extern filestruct *search_history;
|
||||
extern filestruct *searchage;
|
||||
extern filestruct *searchbot;
|
||||
extern filestruct *replace_history;
|
||||
extern filestruct *replaceage;
|
||||
extern filestruct *replacebot;
|
||||
#endif
|
||||
|
||||
extern bool curses_ended;
|
||||
|
||||
extern char *homedir;
|
||||
|
||||
/* Functions we want available. */
|
||||
/* The functions we want available. */
|
||||
|
||||
/* Public functions in chars.c. */
|
||||
#ifndef HAVE_ISBLANK
|
||||
bool nisblank(int c);
|
||||
#endif
|
||||
#if !defined(HAVE_ISWBLANK) && defined(NANO_WIDE)
|
||||
bool niswblank(wchar_t wc);
|
||||
#endif
|
||||
bool is_byte(int c);
|
||||
bool is_alnum_char(int c);
|
||||
bool is_alnum_mbchar(const char *c);
|
||||
#ifdef NANO_WIDE
|
||||
bool is_alnum_wchar(wchar_t wc);
|
||||
#endif
|
||||
bool is_blank_char(int c);
|
||||
bool is_blank_mbchar(const char *c);
|
||||
#ifdef NANO_WIDE
|
||||
bool is_blank_wchar(wchar_t wc);
|
||||
#endif
|
||||
bool is_cntrl_char(int c);
|
||||
bool is_cntrl_mbchar(const char *c);
|
||||
#ifdef NANO_WIDE
|
||||
bool is_cntrl_wchar(wchar_t wc);
|
||||
#endif
|
||||
unsigned char control_rep(unsigned char c);
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len);
|
||||
bool is_cntrl_mbchar(const char *c);
|
||||
bool is_punct_mbchar(const char *c);
|
||||
bool is_word_mbchar(const char *c, bool allow_punct);
|
||||
char control_rep(char c);
|
||||
#ifdef NANO_WIDE
|
||||
wchar_t control_wrep(wchar_t c);
|
||||
#endif
|
||||
char *control_mbrep(const char *c, char *crep, int *crep_len);
|
||||
int mbwidth(const char *c);
|
||||
int mb_cur_max(void);
|
||||
char *make_mbchar(int chr, int *chr_mb_len);
|
||||
#if defined(ENABLE_NANORC) || defined(ENABLE_EXTRA)
|
||||
char *make_mbstring(const char *str);
|
||||
#endif
|
||||
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
|
||||
*col);
|
||||
size_t move_mbleft(const char *buf, size_t pos);
|
||||
@@ -194,9 +199,11 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n);
|
||||
const char *nstrcasestr(const char *haystack, const char *needle);
|
||||
#endif
|
||||
const char *mbstrcasestr(const char *haystack, const char *needle);
|
||||
#ifndef NANO_SMALL
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
|
||||
const char *revstrstr(const char *haystack, const char *needle, const
|
||||
char *rev_start);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
const char *revstrcasestr(const char *haystack, const char *needle,
|
||||
const char *rev_start);
|
||||
const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
@@ -208,8 +215,15 @@ size_t nstrnlen(const char *s, size_t maxlen);
|
||||
#endif
|
||||
size_t mbstrnlen(const char *s, size_t maxlen);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
#ifdef ENABLE_NANORC
|
||||
bool has_blank_chars(const char *s);
|
||||
bool has_blank_mbchars(const char *s);
|
||||
#endif
|
||||
char *mbstrchr(const char *s, char *c);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
bool is_valid_mbstring(const char *s);
|
||||
#endif
|
||||
|
||||
/* Public functions in color.c. */
|
||||
#ifdef ENABLE_COLOR
|
||||
@@ -223,8 +237,8 @@ void cutbuffer_reset(void);
|
||||
void cut_line(void);
|
||||
#ifndef NANO_SMALL
|
||||
void cut_marked(void);
|
||||
#endif
|
||||
void cut_to_eol(void);
|
||||
#endif
|
||||
void do_cut_text(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_cut_till_end(void);
|
||||
@@ -233,12 +247,12 @@ void do_uncut_text(void);
|
||||
|
||||
/* Public functions in files.c. */
|
||||
void new_file(void);
|
||||
filestruct *read_line(char *buf, filestruct *prev, bool *first_line_ins,
|
||||
size_t len);
|
||||
filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
*first_line_ins, size_t buf_len);
|
||||
void load_file(void);
|
||||
void read_file(FILE *f, const char *filename);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
char *get_next_filename(const char *name);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
#ifndef NANO_SMALL
|
||||
void execute_command(const char *command);
|
||||
#endif
|
||||
@@ -262,18 +276,14 @@ void free_openfilestruct(openfilestruct *src);
|
||||
#endif
|
||||
void add_open_file(bool update);
|
||||
void load_open_file(void);
|
||||
void open_prevnext_file(bool next);
|
||||
void open_prevnext_file(bool next_file);
|
||||
void open_prevfile_void(void);
|
||||
void open_nextfile_void(void);
|
||||
bool close_open_file(void);
|
||||
#endif
|
||||
#if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR)
|
||||
char *get_full_path(const char *origpath);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
char *check_writable_directory(const char *path);
|
||||
char *safe_tempnam(void);
|
||||
#endif
|
||||
char *safe_tempfile(FILE **f);
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
void init_operating_dir(void);
|
||||
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
||||
@@ -282,16 +292,17 @@ 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, bool tmp, int append, bool
|
||||
nonamechange);
|
||||
int write_file(const char *name, FILE *f_open, bool tmp, int append,
|
||||
bool nonamechange);
|
||||
#ifndef NANO_SMALL
|
||||
int write_marked(const char *name, bool tmp, int append);
|
||||
int write_marked(const char *name, FILE *f_open, bool tmp, int append);
|
||||
#endif
|
||||
int do_writeout(bool exiting);
|
||||
void do_writeout_void(void);
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
|
||||
int diralphasort(const void *va, const void *vb);
|
||||
void free_chararray(char **array, size_t len);
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||
@@ -302,7 +313,6 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
|
||||
#endif
|
||||
const char *tail(const char *foo);
|
||||
#ifndef DISABLE_BROWSER
|
||||
void free_charptrarray(char **array, size_t len);
|
||||
void striponedir(char *path);
|
||||
char **browser_init(const char *path, int *longest, size_t *numents, DIR
|
||||
*dir);
|
||||
@@ -312,7 +322,7 @@ char *do_browse_from(const char *inpath);
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
char *histfilename(void);
|
||||
void load_history(void);
|
||||
bool writehist(FILE *hist, historyheadtype *histhead);
|
||||
bool writehist(FILE *hist, filestruct *histhead);
|
||||
void save_history(void);
|
||||
#endif
|
||||
|
||||
@@ -321,9 +331,6 @@ size_t length_of_list(const shortcut *s);
|
||||
#ifndef NANO_SMALL
|
||||
void toggle_init_one(int val, const char *desc, long flag);
|
||||
void toggle_init(void);
|
||||
#ifdef DEBUG
|
||||
void free_toggles(void);
|
||||
#endif
|
||||
#endif
|
||||
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||
#ifndef DISABLE_HELP
|
||||
@@ -382,8 +389,11 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
|
||||
void renumber_all(void);
|
||||
void renumber(filestruct *fileptr);
|
||||
void print1opt(const char *shortflag, const char *longflag, const char
|
||||
*desc);
|
||||
void print1opt_full(const char *shortflag
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
, const char *longflag
|
||||
#endif
|
||||
, const char *desc);
|
||||
void usage(void);
|
||||
void version(void);
|
||||
int no_more_space(void);
|
||||
@@ -399,8 +409,11 @@ void do_delete(void);
|
||||
void do_tab(void);
|
||||
void do_enter(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_next_word(void);
|
||||
void do_prev_word(void);
|
||||
bool do_next_word(bool allow_punct, bool allow_update);
|
||||
void do_next_word_void(void);
|
||||
bool do_prev_word(bool allow_punct, bool allow_update);
|
||||
void do_prev_word_void(void);
|
||||
void do_word_count(void);
|
||||
void do_mark(void);
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
@@ -451,7 +464,7 @@ void allow_pending_sigwinch(bool allow);
|
||||
#ifndef NANO_SMALL
|
||||
void do_toggle(const toggle *which);
|
||||
#endif
|
||||
void disable_extended_input(void);
|
||||
void disable_extended_io(void);
|
||||
void disable_signals(void);
|
||||
#ifndef NANO_SMALL
|
||||
void enable_signals(void);
|
||||
@@ -476,7 +489,7 @@ int color_to_int(const char *colorname, bool *bright);
|
||||
char *parse_next_regex(char *ptr);
|
||||
bool nregcomp(regex_t *preg, const char *regex, int eflags);
|
||||
void parse_syntax(char *ptr);
|
||||
void parse_colors(char *ptr);
|
||||
void parse_colors(char *ptr, bool icase);
|
||||
#endif /* ENABLE_COLOR */
|
||||
void parse_rcfile(FILE *rcstream);
|
||||
void do_rcfile(void);
|
||||
@@ -502,45 +515,51 @@ void do_research(void);
|
||||
#endif
|
||||
void replace_abort(void);
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, bool create_flag);
|
||||
int replace_regexp(char *string, bool create);
|
||||
#endif
|
||||
char *replace_line(const char *needle);
|
||||
ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
*real_current, size_t *real_current_x, bool wholewords, bool
|
||||
*canceled);
|
||||
void do_replace(void);
|
||||
void do_gotoline(int line, bool save_pos);
|
||||
void do_gotoline_void(void);
|
||||
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
bool interactive, bool save_pos);
|
||||
void do_gotolinecolumn_void(void);
|
||||
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
|
||||
void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww);
|
||||
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
|
||||
pos_pww);
|
||||
#endif
|
||||
void do_find_bracket(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef HAVE_REGEX_H
|
||||
void do_find_bracket(void);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
bool history_has_changed(void);
|
||||
#endif
|
||||
void history_init(void);
|
||||
historytype *find_node(historytype *h, const char *s);
|
||||
void remove_node(historytype *r);
|
||||
void insert_node(historytype *h, const char *s);
|
||||
void update_history(historyheadtype *h, const char *s);
|
||||
char *get_history_older(historyheadtype *h);
|
||||
char *get_history_newer(historyheadtype *h);
|
||||
char *get_history_completion(historyheadtype *h, char *s);
|
||||
#ifdef DEBUG
|
||||
void free_history(historyheadtype *h);
|
||||
#endif
|
||||
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
|
||||
char *s, size_t len);
|
||||
void update_history(filestruct **h, const char *s);
|
||||
char *get_history_older(filestruct **h);
|
||||
char *get_history_newer(filestruct **h);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
char *get_history_completion(filestruct **h, char *s, size_t len);
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* Public functions in utils.c. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags);
|
||||
#endif
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string);
|
||||
#endif
|
||||
int num_of_digits(int n);
|
||||
int digits(size_t n);
|
||||
void get_homedir(void);
|
||||
bool parse_num(const char *str, ssize_t *val);
|
||||
void align(char **strp);
|
||||
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
|
||||
void align(char **str);
|
||||
void null_at(char **data, size_t index);
|
||||
void unsunder(char *str, size_t true_len);
|
||||
void sunder(char *str);
|
||||
@@ -566,7 +585,7 @@ void remove_magicline(void);
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
#endif
|
||||
void get_totals(const filestruct *begin, const filestruct *end, int
|
||||
void get_totals(const filestruct *begin, const filestruct *end, size_t
|
||||
*lines, size_t *size);
|
||||
|
||||
/* Public functions in winio.c. */
|
||||
@@ -622,8 +641,8 @@ void do_statusbar_backspace(void);
|
||||
void do_statusbar_delete(void);
|
||||
void do_statusbar_cut_text(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_statusbar_next_word(void);
|
||||
void do_statusbar_prev_word(void);
|
||||
bool do_statusbar_next_word(bool allow_punct);
|
||||
bool do_statusbar_prev_word(bool allow_punct);
|
||||
#endif
|
||||
void do_statusbar_verbatim_input(bool *got_enter);
|
||||
void do_statusbar_output(char *output, size_t output_len, bool
|
||||
@@ -641,29 +660,26 @@ void check_statusblank(void);
|
||||
char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||
dollars);
|
||||
void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
|
||||
int nanogetstr(bool allow_tabs, const char *buf, const char *def,
|
||||
int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const shortcut *s
|
||||
const shortcut *s
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, bool *list
|
||||
, bool *list
|
||||
#endif
|
||||
);
|
||||
int statusq(bool allow_tabs, const shortcut *s, const char *def,
|
||||
);
|
||||
int statusq(bool allow_tabs, const shortcut *s, const char *curranswer,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
const char *msg, ...);
|
||||
void statusq_abort(void);
|
||||
void titlebar(const char *path);
|
||||
void set_modified(void);
|
||||
void statusbar(const char *msg, ...);
|
||||
void bottombars(const shortcut *s);
|
||||
void onekey(const char *keystroke, const char *desc, size_t len);
|
||||
#ifndef NDEBUG
|
||||
int check_linenumbers(const filestruct *fileptr);
|
||||
#endif
|
||||
size_t get_page_start(size_t column);
|
||||
void reset_cursor(void);
|
||||
void edit_add(const filestruct *fileptr, const char *converted, int
|
||||
@@ -676,7 +692,7 @@ void edit_redraw(const filestruct *old_current, size_t old_pww);
|
||||
void edit_refresh(void);
|
||||
void edit_update(topmidnone location);
|
||||
int do_yesno(bool all, const char *msg);
|
||||
void total_update(void);
|
||||
void total_redraw(void);
|
||||
void total_refresh(void);
|
||||
void display_main_list(void);
|
||||
void do_cursorpos(bool constant);
|
||||
@@ -685,7 +701,10 @@ void do_cursorpos_void(void);
|
||||
size_t help_line_len(const char *ptr);
|
||||
void do_help(void);
|
||||
#endif
|
||||
void do_replace_highlight(bool highlight_flag, const char *word);
|
||||
void do_replace_highlight(bool highlight, const char *word);
|
||||
#ifndef NDEBUG
|
||||
int check_linenumbers(const filestruct *fileptr);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void dump_buffer(const filestruct *inptr);
|
||||
void dump_buffer_reverse(void);
|
||||
@@ -693,3 +712,5 @@ void dump_buffer_reverse(void);
|
||||
#ifdef NANO_EXTRA
|
||||
void do_credits(void);
|
||||
#endif
|
||||
|
||||
#endif /* !PROTO_H */
|
||||
|
||||
138
src/rcfile.c
138
src/rcfile.c
@@ -8,14 +8,15 @@
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -32,29 +33,17 @@
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
|
||||
const static rcoption rcopts[] = {
|
||||
#ifndef NANO_SMALL
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"backup", BACKUP_FILE},
|
||||
{"backupdir", 0},
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
{"brackets", 0},
|
||||
#endif
|
||||
{"const", CONSTUPDATE},
|
||||
#ifndef NANO_SMALL
|
||||
{"cut", CUT_TO_END},
|
||||
#endif
|
||||
{"const", CONST_UPDATE},
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
{"fill", 0},
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
{"historylog", HISTORYLOG},
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
{"mouse", USE_MOUSE},
|
||||
#endif
|
||||
@@ -62,9 +51,6 @@ const static rcoption rcopts[] = {
|
||||
{"multibuffer", MULTIBUFFER},
|
||||
#endif
|
||||
{"morespace", MORE_SPACE},
|
||||
#ifndef NANO_SMALL
|
||||
{"noconvert", NO_CONVERT},
|
||||
#endif
|
||||
{"nofollow", NOFOLLOW_SYMLINKS},
|
||||
{"nohelp", NO_HELP},
|
||||
#ifndef DISABLE_WRAPPING
|
||||
@@ -82,10 +68,6 @@ const static rcoption rcopts[] = {
|
||||
#ifdef HAVE_REGEX_H
|
||||
{"regexp", USE_REGEXP},
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
{"smarthome", SMART_HOME},
|
||||
{"smooth", SMOOTHSCROLL},
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
{"speller", 0},
|
||||
#endif
|
||||
@@ -94,13 +76,25 @@ const static rcoption rcopts[] = {
|
||||
{"tempfile", TEMP_FILE},
|
||||
{"view", VIEW_MODE},
|
||||
#ifndef NANO_SMALL
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"backup", BACKUP_FILE},
|
||||
{"backupdir", 0},
|
||||
{"backwards", BACKWARDS_SEARCH},
|
||||
{"casesensitive", CASE_SENSITIVE},
|
||||
{"cut", CUT_TO_END},
|
||||
{"historylog", HISTORYLOG},
|
||||
{"noconvert", NO_CONVERT},
|
||||
{"quickblank", QUICK_BLANK},
|
||||
{"smarthome", SMART_HOME},
|
||||
{"smooth", SMOOTH_SCROLL},
|
||||
{"tabstospaces", TABS_TO_SPACES},
|
||||
{"whitespace", 0},
|
||||
#endif
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
static bool errors = FALSE;
|
||||
static int lineno = 0;
|
||||
static size_t lineno = 0;
|
||||
static char *nanorc = NULL;
|
||||
#ifdef ENABLE_COLOR
|
||||
static syntaxtype *endsyntax = NULL;
|
||||
@@ -110,7 +104,7 @@ static colortype *endcolor = NULL;
|
||||
#endif
|
||||
|
||||
/* We have an error in some part of the rcfile. Put it on stderr and
|
||||
* make the user hit return to continue starting up nano. */
|
||||
* make the user hit Return to continue starting up nano. */
|
||||
void rcfile_error(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -118,7 +112,8 @@ void rcfile_error(const char *msg, ...)
|
||||
fprintf(stderr, "\n");
|
||||
if (lineno > 0) {
|
||||
errors = TRUE;
|
||||
fprintf(stderr, _("Error in %s on line %d: "), nanorc, lineno);
|
||||
fprintf(stderr, _("Error in %s on line %lu: "), nanorc,
|
||||
(unsigned long)lineno);
|
||||
}
|
||||
|
||||
va_start(ap, msg);
|
||||
@@ -132,7 +127,7 @@ void rcfile_error(const char *msg, ...)
|
||||
* the end of the line. */
|
||||
char *parse_next_word(char *ptr)
|
||||
{
|
||||
while (!is_blank_char(*ptr) && *ptr != '\0')
|
||||
while (!isblank(*ptr) && *ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\0')
|
||||
@@ -141,7 +136,7 @@ char *parse_next_word(char *ptr)
|
||||
/* Null-terminate and advance ptr. */
|
||||
*ptr++ = '\0';
|
||||
|
||||
while (is_blank_char(*ptr))
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
|
||||
return ptr;
|
||||
@@ -181,7 +176,7 @@ char *parse_argument(char *ptr)
|
||||
ptr = last_quote + 1;
|
||||
}
|
||||
if (ptr != NULL)
|
||||
while (is_blank_char(*ptr))
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
return ptr;
|
||||
}
|
||||
@@ -191,12 +186,7 @@ int color_to_int(const char *colorname, bool *bright)
|
||||
{
|
||||
int mcolor = -1;
|
||||
|
||||
if (colorname == NULL) {
|
||||
rcfile_error(N_("Missing color name"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
assert(bright != NULL);
|
||||
assert(colorname != NULL && bright != NULL);
|
||||
|
||||
if (strncasecmp(colorname, "bright", 6) == 0) {
|
||||
*bright = TRUE;
|
||||
@@ -235,7 +225,7 @@ char *parse_next_regex(char *ptr)
|
||||
|
||||
/* Continue until the end of the line, or a " followed by a space, a
|
||||
* blank character, or \0. */
|
||||
while ((*ptr != '"' || (!is_blank_char(*(ptr + 1)) &&
|
||||
while ((*ptr != '"' || (!isblank(*(ptr + 1)) &&
|
||||
*(ptr + 1) != '\0')) && *ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
@@ -250,7 +240,7 @@ char *parse_next_regex(char *ptr)
|
||||
/* Null terminate and advance ptr. */
|
||||
*ptr++ = '\0';
|
||||
|
||||
while (is_blank_char(*ptr))
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
|
||||
return ptr;
|
||||
@@ -352,11 +342,12 @@ void parse_syntax(char *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the color stuff into the colorstrings array. */
|
||||
void parse_colors(char *ptr)
|
||||
/* Parse the color stuff into the colorstrings array. If icase is TRUE,
|
||||
* treat the color stuff as case insensitive. */
|
||||
void parse_colors(char *ptr, bool icase)
|
||||
{
|
||||
int fg, bg;
|
||||
bool bright = FALSE;
|
||||
bool bright = FALSE, no_fgcolor = FALSE;
|
||||
char *fgstr;
|
||||
|
||||
assert(ptr != NULL);
|
||||
@@ -371,8 +362,15 @@ void parse_colors(char *ptr)
|
||||
|
||||
if (strchr(fgstr, ',') != NULL) {
|
||||
char *bgcolorname;
|
||||
|
||||
strtok(fgstr, ",");
|
||||
bgcolorname = strtok(NULL, ",");
|
||||
if (bgcolorname == NULL) {
|
||||
/* If we have a background color without a foreground color,
|
||||
* parse it properly. */
|
||||
bgcolorname = fgstr + 1;
|
||||
no_fgcolor = TRUE;
|
||||
}
|
||||
if (strncasecmp(bgcolorname, "bright", 6) == 0) {
|
||||
rcfile_error(
|
||||
N_("Background color %s cannot be bright"),
|
||||
@@ -383,11 +381,14 @@ void parse_colors(char *ptr)
|
||||
} else
|
||||
bg = -1;
|
||||
|
||||
fg = color_to_int(fgstr, &bright);
|
||||
if (!no_fgcolor) {
|
||||
fg = color_to_int(fgstr, &bright);
|
||||
|
||||
/* Don't try to parse screwed-up foreground colors. */
|
||||
if (fg == -1)
|
||||
return;
|
||||
/* Don't try to parse screwed-up foreground colors. */
|
||||
if (fg == -1)
|
||||
return;
|
||||
} else
|
||||
fg = -1;
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
rcfile_error(
|
||||
@@ -395,9 +396,13 @@ void parse_colors(char *ptr)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Now for the fun part. Start adding regexps to individual strings
|
||||
* in the colorstrings array, woo! */
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing regex string"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Now for the fun part. Start adding regexes to individual strings
|
||||
* in the colorstrings array, woo! */
|
||||
while (ptr != NULL && *ptr != '\0') {
|
||||
colortype *newcolor;
|
||||
/* The new color structure. */
|
||||
@@ -426,7 +431,7 @@ void parse_colors(char *ptr)
|
||||
if (ptr == NULL)
|
||||
break;
|
||||
|
||||
if (nregcomp(&newcolor->start, fgstr, 0)) {
|
||||
if (nregcomp(&newcolor->start, fgstr, icase ? REG_ICASE : 0)) {
|
||||
free(newcolor);
|
||||
cancelled = TRUE;
|
||||
} else {
|
||||
@@ -476,7 +481,7 @@ void parse_colors(char *ptr)
|
||||
continue;
|
||||
|
||||
newcolor->end = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
if (nregcomp(newcolor->end, fgstr, 0)) {
|
||||
if (nregcomp(newcolor->end, fgstr, icase ? REG_ICASE : 0)) {
|
||||
free(newcolor->end);
|
||||
newcolor->end = NULL;
|
||||
}
|
||||
@@ -501,7 +506,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
|
||||
lineno++;
|
||||
ptr = buf;
|
||||
while (is_blank_char(*ptr))
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
|
||||
/* If we have a blank line or a comment, skip to the next
|
||||
@@ -522,7 +527,9 @@ void parse_rcfile(FILE *rcstream)
|
||||
else if (strcasecmp(keyword, "syntax") == 0)
|
||||
parse_syntax(ptr);
|
||||
else if (strcasecmp(keyword, "color") == 0)
|
||||
parse_colors(ptr);
|
||||
parse_colors(ptr, FALSE);
|
||||
else if (strcasecmp(keyword, "icolor") == 0)
|
||||
parse_colors(ptr, TRUE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
else
|
||||
rcfile_error(N_("Command %s not understood"), keyword);
|
||||
@@ -561,10 +568,20 @@ void parse_rcfile(FILE *rcstream)
|
||||
if (*option == '"')
|
||||
option++;
|
||||
ptr = parse_argument(ptr);
|
||||
option = make_mbstring(option);
|
||||
|
||||
option = mallocstrcpy(NULL, option);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "option = \"%s\"\n", option);
|
||||
#endif
|
||||
|
||||
/* Make sure option is a valid multibyte
|
||||
* string. */
|
||||
if (!is_valid_mbstring(option)) {
|
||||
rcfile_error(
|
||||
N_("Option is not a valid multibyte string"));
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (strcasecmp(rcopts[i].name, "operatingdir") == 0)
|
||||
operating_dir = option;
|
||||
@@ -584,7 +601,8 @@ void parse_rcfile(FILE *rcstream)
|
||||
#ifndef NANO_SMALL
|
||||
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
||||
whitespace = option;
|
||||
if (mbstrlen(whitespace) != 2 || strlenpt(whitespace) != 2) {
|
||||
if (mbstrlen(whitespace) != 2 ||
|
||||
strlenpt(whitespace) != 2) {
|
||||
rcfile_error(
|
||||
N_("Two single-column characters required"));
|
||||
free(whitespace);
|
||||
@@ -603,20 +621,18 @@ void parse_rcfile(FILE *rcstream)
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
if (strcasecmp(rcopts[i].name, "punct") == 0) {
|
||||
punct = option;
|
||||
if (strchr(punct, '\t') != NULL ||
|
||||
strchr(punct, ' ') != NULL) {
|
||||
if (has_blank_mbchars(punct)) {
|
||||
rcfile_error(
|
||||
N_("Non-tab and non-space characters required"));
|
||||
N_("Non-blank characters required"));
|
||||
free(punct);
|
||||
punct = NULL;
|
||||
}
|
||||
} else if (strcasecmp(rcopts[i].name,
|
||||
"brackets") == 0) {
|
||||
brackets = option;
|
||||
if (strchr(brackets, '\t') != NULL ||
|
||||
strchr(brackets, ' ') != NULL) {
|
||||
if (has_blank_mbchars(brackets)) {
|
||||
rcfile_error(
|
||||
N_("Non-tab and non-space characters required"));
|
||||
N_("Non-blank characters required"));
|
||||
free(brackets);
|
||||
brackets = NULL;
|
||||
}
|
||||
@@ -650,7 +666,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
assert(FALSE);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "flag = %d\n", rcopts[i].flag);
|
||||
fprintf(stderr, "flag = %ld\n", rcopts[i].flag);
|
||||
#endif
|
||||
} else if (rcopts[i].flag != 0)
|
||||
UNSET(rcopts[i].flag);
|
||||
|
||||
511
src/search.c
511
src/search.c
@@ -8,14 +8,15 @@
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -31,10 +32,13 @@
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
static bool search_last_line = FALSE;
|
||||
/* Have we gone past the last line while searching? */
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
static bool history_changed = FALSE;
|
||||
/* Have any of the history lists changed? */
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
static bool regexp_compiled = FALSE;
|
||||
/* Have we compiled any regular expressions? */
|
||||
@@ -145,10 +149,6 @@ int search_init(bool replacing, bool use_answer)
|
||||
|
||||
search_init_globals();
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
search_history.current = (historytype *)&search_history.next;
|
||||
#endif
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||
|
||||
@@ -186,7 +186,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
#ifndef NANO_SMALL
|
||||
/* This string is just a modifier for the search prompt; no
|
||||
* grammar is implied. */
|
||||
ISSET(REVERSE_SEARCH) ? _(" [Backwards]") :
|
||||
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") :
|
||||
#endif
|
||||
"",
|
||||
|
||||
@@ -212,9 +212,6 @@ int search_init(bool replacing, bool use_answer)
|
||||
if (i == -1 || (i < 0 && last_search[0] == '\0') ||
|
||||
(!replacing && i == 0 && answer[0] == '\0')) {
|
||||
statusbar(_("Cancelled"));
|
||||
#ifndef NANO_SMALL
|
||||
search_history.current = search_history.next;
|
||||
#endif
|
||||
return -1;
|
||||
} else {
|
||||
switch (i) {
|
||||
@@ -238,30 +235,29 @@ int search_init(bool replacing, bool use_answer)
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
case TOGGLE_BACKWARDS_KEY:
|
||||
TOGGLE(REVERSE_SEARCH);
|
||||
TOGGLE(BACKWARDS_SEARCH);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
case TOGGLE_REGEXP_KEY:
|
||||
case NANO_REGEXP_KEY:
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
case NANO_TOOTHERSEARCH_KEY:
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
case NANO_TOGOTOLINE_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
search_history.current = search_history.next;
|
||||
#endif
|
||||
do_gotoline(-1, FALSE); /* Put answer up on the
|
||||
* statusbar and fall
|
||||
* through. */
|
||||
do_gotolinecolumn(current->lineno, placewewant + 1,
|
||||
TRUE, TRUE, FALSE);
|
||||
/* Put answer up on the statusbar and
|
||||
* fall through. */
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -277,11 +273,11 @@ bool is_whole_word(size_t pos, const char *buf, const char *word)
|
||||
parse_mbchar(buf + word_end, r, NULL, NULL);
|
||||
|
||||
/* If we're at the beginning of the line or the character before the
|
||||
* word isn't an alphanumeric character, and if we're at the end of
|
||||
* the line or the character after the word isn't an alphanumeric
|
||||
* character, we have a whole word. */
|
||||
retval = (pos == 0 || !is_alnum_mbchar(p)) &&
|
||||
(word_end == strlen(buf) || !is_alnum_mbchar(r));
|
||||
* word isn't a non-punctuation "word" character, and if we're at
|
||||
* the end of the line or the character after the word isn't a
|
||||
* non-punctuation "word" character, we have a whole word. */
|
||||
retval = (pos == 0 || !is_word_mbchar(p, FALSE)) &&
|
||||
(word_end == strlen(buf) || !is_word_mbchar(r, FALSE));
|
||||
|
||||
free(p);
|
||||
free(r);
|
||||
@@ -306,7 +302,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
/* The length of the match we found. */
|
||||
size_t current_x_find = 0;
|
||||
/* The location of the match we found. */
|
||||
int current_y_find = current_y;
|
||||
ssize_t current_y_find = current_y;
|
||||
|
||||
/* rev_start might end up 1 character before the start or after the
|
||||
* end of the line. This won't be a problem because strstrwrapper()
|
||||
@@ -315,7 +311,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
* previous or next line. */
|
||||
rev_start =
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(REVERSE_SEARCH) ? fileptr->data + (current_x - 1) :
|
||||
ISSET(BACKWARDS_SEARCH) ? fileptr->data + (current_x - 1) :
|
||||
#endif
|
||||
fileptr->data + (current_x + 1);
|
||||
|
||||
@@ -364,7 +360,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
fileptr = fileptr->prev;
|
||||
current_y_find--;
|
||||
} else {
|
||||
@@ -381,7 +377,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
return FALSE;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
fileptr = filebot;
|
||||
current_y_find = editwinrows - 1;
|
||||
} else {
|
||||
@@ -402,7 +398,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
|
||||
rev_start = fileptr->data;
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
rev_start += strlen(fileptr->data);
|
||||
#endif
|
||||
}
|
||||
@@ -413,13 +409,12 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
/* Ensure we haven't wrapped around again! */
|
||||
if (search_last_line &&
|
||||
#ifndef NANO_SMALL
|
||||
((!ISSET(REVERSE_SEARCH) && current_x_find > beginx) ||
|
||||
(ISSET(REVERSE_SEARCH) && current_x_find < beginx))
|
||||
((!ISSET(BACKWARDS_SEARCH) && current_x_find > beginx) ||
|
||||
(ISSET(BACKWARDS_SEARCH) && current_x_find < beginx))
|
||||
#else
|
||||
current_x_find > beginx
|
||||
#endif
|
||||
) {
|
||||
|
||||
if (can_display_wrap)
|
||||
not_found_msg(needle);
|
||||
return FALSE;
|
||||
@@ -461,7 +456,7 @@ void do_search(void)
|
||||
search_abort();
|
||||
else if (i == -2) /* Replace. */
|
||||
do_replace();
|
||||
#ifndef NANO_SMALL
|
||||
#if !defined(NANO_SMALL) || defined(HAVE_REGEX_H)
|
||||
else if (i == 1) /* Case Sensitive, Backwards, or Regexp search
|
||||
* toggle. */
|
||||
do_search();
|
||||
@@ -554,7 +549,8 @@ void do_research(void)
|
||||
last_search)) {
|
||||
didfind = findnextstr(TRUE, FALSE, TRUE, current,
|
||||
current_x, answer, NULL);
|
||||
if (fileptr == current && fileptr_x == current_x && !didfind)
|
||||
if (fileptr == current && fileptr_x == current_x &&
|
||||
!didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
} else {
|
||||
#endif
|
||||
@@ -582,15 +578,17 @@ void replace_abort(void)
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, bool create_flag)
|
||||
int replace_regexp(char *string, bool create)
|
||||
{
|
||||
/* Split personality here - if create_flag is FALSE, just calculate
|
||||
* the size of the replacement line (necessary because of
|
||||
/* We have a split personality here. If create is FALSE, just
|
||||
* calculate the size of the replacement line (necessary because of
|
||||
* subexpressions \1 to \9 in the replaced text). */
|
||||
|
||||
const char *c = last_replace;
|
||||
int search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
int new_size = strlen(current->data) + 1 - search_match_count;
|
||||
size_t search_match_count =
|
||||
regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
size_t new_line_size =
|
||||
strlen(current->data) + 1 - search_match_count;
|
||||
|
||||
/* Iterate through the replacement text to handle subexpression
|
||||
* replacement using \1, \2, \3, etc. */
|
||||
@@ -599,22 +597,22 @@ int replace_regexp(char *string, bool create_flag)
|
||||
|
||||
if (*c != '\\' || num < 1 || num > 9 ||
|
||||
num > search_regexp.re_nsub) {
|
||||
if (create_flag)
|
||||
if (create)
|
||||
*string++ = *c;
|
||||
c++;
|
||||
new_size++;
|
||||
new_line_size++;
|
||||
} else {
|
||||
int i = regmatches[num].rm_eo - regmatches[num].rm_so;
|
||||
size_t i = regmatches[num].rm_eo - regmatches[num].rm_so;
|
||||
|
||||
/* Skip over the replacement expression. */
|
||||
c += 2;
|
||||
|
||||
/* But add the length of the subexpression to new_size. */
|
||||
new_size += i;
|
||||
new_line_size += i;
|
||||
|
||||
/* And if create_flag is TRUE, append the result of the
|
||||
/* And if create is TRUE, append the result of the
|
||||
* subexpression match to the new line. */
|
||||
if (create_flag) {
|
||||
if (create) {
|
||||
strncpy(string, current->data + current_x +
|
||||
regmatches[num].rm_so, i);
|
||||
string += i;
|
||||
@@ -622,24 +620,23 @@ int replace_regexp(char *string, bool create_flag)
|
||||
}
|
||||
}
|
||||
|
||||
if (create_flag)
|
||||
if (create)
|
||||
*string = '\0';
|
||||
|
||||
return new_size;
|
||||
return new_line_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
char *replace_line(const char *needle)
|
||||
{
|
||||
char *copy;
|
||||
int new_line_size;
|
||||
int search_match_count;
|
||||
size_t new_line_size, search_match_count;
|
||||
|
||||
/* Calculate the size of the new line. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
new_line_size = replace_regexp(NULL, 0);
|
||||
new_line_size = replace_regexp(NULL, FALSE);
|
||||
} else {
|
||||
#endif
|
||||
search_match_count = strlen(needle);
|
||||
@@ -665,6 +662,7 @@ char *replace_line(const char *needle)
|
||||
|
||||
/* The tail of the original line. */
|
||||
assert(current_x + search_match_count <= strlen(current->data));
|
||||
|
||||
strcat(copy, current->data + current_x + search_match_count);
|
||||
|
||||
return copy;
|
||||
@@ -684,7 +682,6 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
{
|
||||
ssize_t numreplaced = -1;
|
||||
size_t match_len;
|
||||
size_t pww_save = placewewant;
|
||||
bool replaceall = FALSE;
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* The starting-line match and bol/eol regex flags. */
|
||||
@@ -726,7 +723,6 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
FALSE
|
||||
#endif
|
||||
, real_current, *real_current_x, needle, &match_len)) {
|
||||
|
||||
int i = 0;
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
@@ -746,31 +742,29 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!replaceall) {
|
||||
edit_redraw(real_current, pww_save);
|
||||
pww_save = placewewant;
|
||||
}
|
||||
if (!replaceall)
|
||||
edit_refresh();
|
||||
|
||||
/* Record for the return value that we found the search
|
||||
* string. */
|
||||
/* Indicate that we found the search string. */
|
||||
if (numreplaced == -1)
|
||||
numreplaced = 0;
|
||||
|
||||
if (!replaceall) {
|
||||
char *exp_word;
|
||||
size_t xpt = xplustabs();
|
||||
|
||||
exp_word = display_string(current->data, xpt,
|
||||
strnlenpt(current->data, match_len + current_x) - xpt,
|
||||
char *exp_word = display_string(current->data, xpt,
|
||||
strnlenpt(current->data, current_x + match_len) - xpt,
|
||||
FALSE);
|
||||
|
||||
curs_set(0);
|
||||
|
||||
do_replace_highlight(TRUE, exp_word);
|
||||
|
||||
i = do_yesno(TRUE, _("Replace this instance?"));
|
||||
|
||||
do_replace_highlight(FALSE, exp_word);
|
||||
|
||||
free(exp_word);
|
||||
|
||||
curs_set(1);
|
||||
|
||||
if (i == -1) { /* We canceled the replace. */
|
||||
@@ -833,7 +827,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
* text. Note that current_x might be set to (size_t)-1
|
||||
* here. */
|
||||
#ifndef NANO_SMALL
|
||||
if (!ISSET(REVERSE_SEARCH))
|
||||
if (!ISSET(BACKWARDS_SEARCH))
|
||||
#endif
|
||||
current_x += match_len + length_change - 1;
|
||||
|
||||
@@ -913,11 +907,6 @@ void do_replace(void)
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
replace_history.current = (historytype *)&replace_history.next;
|
||||
last_replace = mallocstrcpy(last_replace, "");
|
||||
#endif
|
||||
|
||||
i = statusq(FALSE, replace_list_2, last_replace,
|
||||
#ifndef NANO_SMALL
|
||||
&replace_history,
|
||||
@@ -962,21 +951,26 @@ void do_replace(void)
|
||||
edit_refresh();
|
||||
|
||||
if (numreplaced >= 0)
|
||||
statusbar(P_("Replaced %ld occurrence", "Replaced %ld occurrences",
|
||||
(long)numreplaced), (long)numreplaced);
|
||||
statusbar(P_("Replaced %lu occurrence",
|
||||
"Replaced %lu occurrences", (unsigned long)numreplaced),
|
||||
(unsigned long)numreplaced);
|
||||
|
||||
replace_abort();
|
||||
}
|
||||
|
||||
void do_gotoline(int line, bool save_pos)
|
||||
/* Go to the specified line and column, or ask for them if interactive
|
||||
* is TRUE. Save the x-coordinate and y-coordinate if save_pos is TRUE.
|
||||
* Note that both the line and column numbers should be one-based. */
|
||||
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
bool interactive, bool save_pos)
|
||||
{
|
||||
if (line <= 0) { /* Ask for it. */
|
||||
if (interactive) { /* Ask for it. */
|
||||
char *ans = mallocstrcpy(NULL, answer);
|
||||
int i = statusq(FALSE, gotoline_list, line < 0 ? ans : "",
|
||||
int i = statusq(FALSE, gotoline_list, use_answer ? ans : "",
|
||||
#ifndef NANO_SMALL
|
||||
NULL,
|
||||
#endif
|
||||
_("Enter line number"));
|
||||
_("Enter line number, column number"));
|
||||
|
||||
free(ans);
|
||||
|
||||
@@ -996,52 +990,50 @@ void do_gotoline(int line, bool save_pos)
|
||||
}
|
||||
|
||||
/* Do a bounds check. Display a warning on an out-of-bounds
|
||||
* line number only if we hit Enter at the statusbar prompt. */
|
||||
if (!parse_num(answer, &line) || line < 0) {
|
||||
* line or column number only if we hit Enter at the statusbar
|
||||
* prompt. */
|
||||
if (!parse_line_column(answer, &line, &column) || line < 1 ||
|
||||
column < 1) {
|
||||
if (i == 0)
|
||||
statusbar(_("Come on, be reasonable"));
|
||||
display_main_list();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (current->lineno > line) {
|
||||
for (; current->prev != NULL && current->lineno > line;
|
||||
current = current->prev)
|
||||
;
|
||||
} else {
|
||||
for (; current->next != NULL && current->lineno < line;
|
||||
current = current->next)
|
||||
;
|
||||
if (line < 1)
|
||||
line = current->lineno;
|
||||
|
||||
if (column < 1)
|
||||
column = placewewant + 1;
|
||||
}
|
||||
|
||||
current_x = 0;
|
||||
for (current = fileage; current->next != NULL && line > 1; line--)
|
||||
current = current->next;
|
||||
|
||||
current_x = actual_x(current->data, column - 1);
|
||||
placewewant = column - 1;
|
||||
|
||||
/* If save_pos is TRUE, don't change the cursor position when
|
||||
* updating the edit window. */
|
||||
edit_update(save_pos ? NONE : CENTER);
|
||||
|
||||
placewewant = 0;
|
||||
display_main_list();
|
||||
}
|
||||
|
||||
void do_gotoline_void(void)
|
||||
void do_gotolinecolumn_void(void)
|
||||
{
|
||||
do_gotoline(0, FALSE);
|
||||
do_gotolinecolumn(current->lineno, placewewant + 1, FALSE, TRUE,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
|
||||
void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww)
|
||||
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
|
||||
pos_pww)
|
||||
{
|
||||
/* Since do_gotoline() resets the x-coordinate but not the
|
||||
/* Since do_gotolinecolumn() resets the x-coordinate but not the
|
||||
* y-coordinate, set the coordinates up this way. */
|
||||
current_y = pos_y;
|
||||
do_gotoline(line, TRUE);
|
||||
|
||||
/* Make sure that the x-coordinate is sane here. */
|
||||
current_x = strlen(current->data);
|
||||
if (pos_x < current_x)
|
||||
current_x = pos_x;
|
||||
do_gotolinecolumn(line, pos_x + 1, FALSE, FALSE, TRUE);
|
||||
|
||||
/* Set the rest of the coordinates up. */
|
||||
placewewant = pos_pww;
|
||||
@@ -1049,52 +1041,53 @@ void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef HAVE_REGEX_H
|
||||
void do_find_bracket(void)
|
||||
{
|
||||
char ch_under_cursor, wanted_ch;
|
||||
const char *pos, *brackets = "([{<>}])";
|
||||
char regexp_pat[] = "[ ]";
|
||||
const char *pos, *bracket_pat = "([{<>}])";
|
||||
char cursor_ch, wanted_ch, regexp_pat[] = "[ ]";
|
||||
size_t current_x_save, pww_save;
|
||||
int count = 1;
|
||||
unsigned long flags_save;
|
||||
bool regexp_set = ISSET(USE_REGEXP);
|
||||
bool backwards_search_set = ISSET(BACKWARDS_SEARCH);
|
||||
filestruct *current_save;
|
||||
|
||||
ch_under_cursor = current->data[current_x];
|
||||
cursor_ch = current->data[current_x];
|
||||
pos = strchr(bracket_pat, cursor_ch);
|
||||
|
||||
pos = strchr(brackets, ch_under_cursor);
|
||||
if (ch_under_cursor == '\0' || pos == NULL) {
|
||||
if (cursor_ch == '\0' || pos == NULL) {
|
||||
statusbar(_("Not a bracket"));
|
||||
return;
|
||||
}
|
||||
|
||||
assert(strlen(brackets) % 2 == 0);
|
||||
assert(strlen(bracket_pat) % 2 == 0);
|
||||
|
||||
wanted_ch = brackets[(strlen(brackets) - 1) - (pos - brackets)];
|
||||
wanted_ch =
|
||||
bracket_pat[(strlen(bracket_pat) - 1) - (pos - bracket_pat)];
|
||||
|
||||
current_save = current;
|
||||
current_x_save = current_x;
|
||||
pww_save = placewewant;
|
||||
flags_save = flags;
|
||||
SET(USE_REGEXP);
|
||||
|
||||
/* Apparent near redundancy with regexp_pat[] here is needed.
|
||||
* "[][]" works, "[[]]" doesn't. */
|
||||
if (pos < brackets + (strlen(brackets) / 2)) {
|
||||
if (pos < bracket_pat + (strlen(bracket_pat) / 2)) {
|
||||
/* On a left bracket. */
|
||||
regexp_pat[1] = wanted_ch;
|
||||
regexp_pat[2] = ch_under_cursor;
|
||||
UNSET(REVERSE_SEARCH);
|
||||
regexp_pat[2] = cursor_ch;
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
} else {
|
||||
/* On a right bracket. */
|
||||
regexp_pat[1] = ch_under_cursor;
|
||||
regexp_pat[1] = cursor_ch;
|
||||
regexp_pat[2] = wanted_ch;
|
||||
SET(REVERSE_SEARCH);
|
||||
SET(BACKWARDS_SEARCH);
|
||||
}
|
||||
|
||||
regexp_init(regexp_pat);
|
||||
|
||||
/* We constructed regexp_pat to be a valid expression. */
|
||||
/* We constructed regexp_pat to be a valid regular expression. */
|
||||
assert(regexp_compiled);
|
||||
|
||||
findnextstr_wrap_reset();
|
||||
@@ -1102,7 +1095,7 @@ void do_find_bracket(void)
|
||||
if (findnextstr(FALSE, FALSE, FALSE, current, current_x,
|
||||
regexp_pat, NULL)) {
|
||||
/* Found identical bracket. */
|
||||
if (current->data[current_x] == ch_under_cursor)
|
||||
if (current->data[current_x] == cursor_ch)
|
||||
count++;
|
||||
/* Found complementary bracket. */
|
||||
else if (--count == 0) {
|
||||
@@ -1121,133 +1114,201 @@ void do_find_bracket(void)
|
||||
}
|
||||
|
||||
regexp_cleanup();
|
||||
flags = flags_save;
|
||||
|
||||
/* Restore search direction. */
|
||||
if (backwards_search_set)
|
||||
SET(BACKWARDS_SEARCH);
|
||||
else
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
|
||||
/* Restore regular expression usage setting. */
|
||||
if (!regexp_set)
|
||||
UNSET(USE_REGEXP);
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Indicate whether any of the history lists have changed. */
|
||||
bool history_has_changed(void)
|
||||
{
|
||||
return history_changed;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/*
|
||||
* search and replace history list support functions
|
||||
*/
|
||||
|
||||
/* initialize search and replace history lists */
|
||||
/* Initialize the search and replace history lists. */
|
||||
void history_init(void)
|
||||
{
|
||||
search_history.next = (historytype *)&search_history.prev;
|
||||
search_history.prev = NULL;
|
||||
search_history.tail = (historytype *)&search_history.next;
|
||||
search_history.current = search_history.next;
|
||||
search_history.count = 0;
|
||||
search_history.len = 0;
|
||||
search_history = make_new_node(NULL);
|
||||
search_history->data = mallocstrcpy(NULL, "");
|
||||
searchage = search_history;
|
||||
searchbot = search_history;
|
||||
|
||||
replace_history.next = (historytype *)&replace_history.prev;
|
||||
replace_history.prev = NULL;
|
||||
replace_history.tail = (historytype *)&replace_history.next;
|
||||
replace_history.current = replace_history.next;
|
||||
replace_history.count = 0;
|
||||
replace_history.len = 0;
|
||||
replace_history = make_new_node(NULL);
|
||||
replace_history->data = mallocstrcpy(NULL, "");
|
||||
replaceage = replace_history;
|
||||
replacebot = replace_history;
|
||||
}
|
||||
|
||||
/* find first node containing string *s in history list *h */
|
||||
historytype *find_node(historytype *h, const char *s)
|
||||
/* Return the first node containing the first len characters of the
|
||||
* string s in the history list, starting at h_start and ending at
|
||||
* h_end, or NULL if there isn't one. */
|
||||
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
|
||||
char *s, size_t len)
|
||||
{
|
||||
for (; h->next != NULL; h = h->next)
|
||||
if (strcmp(s, h->data) == 0)
|
||||
return h;
|
||||
filestruct *p;
|
||||
|
||||
for (p = h_start; p != h_end->next && p != NULL; p = p->next) {
|
||||
if (strncmp(s, p->data, len) == 0)
|
||||
return p;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* remove node *r */
|
||||
void remove_node(historytype *r)
|
||||
/* Update a history list. h should be the current position in the
|
||||
* list. */
|
||||
void update_history(filestruct **h, const char *s)
|
||||
{
|
||||
r->prev->next = r->next;
|
||||
r->next->prev = r->prev;
|
||||
free(r->data);
|
||||
free(r);
|
||||
}
|
||||
filestruct **hage = NULL, **hbot = NULL, *p;
|
||||
|
||||
/* add a node after node *h */
|
||||
void insert_node(historytype *h, const char *s)
|
||||
{
|
||||
historytype *a;
|
||||
assert(h != NULL && s != NULL);
|
||||
|
||||
a = (historytype *)nmalloc(sizeof(historytype));
|
||||
a->next = h->next;
|
||||
a->prev = h;
|
||||
h->next->prev = a;
|
||||
h->next = a;
|
||||
a->data = mallocstrcpy(NULL, s);
|
||||
}
|
||||
|
||||
/* update history list */
|
||||
void update_history(historyheadtype *h, const char *s)
|
||||
{
|
||||
historytype *p;
|
||||
|
||||
if ((p = find_node(h->next, s)) != NULL) {
|
||||
if (p == h->next) /* catch delete and re-insert of
|
||||
same string in 1st node */
|
||||
goto up_hs;
|
||||
remove_node(p); /* delete identical older string */
|
||||
h->count--;
|
||||
if (*h == search_history) {
|
||||
hage = &searchage;
|
||||
hbot = &searchbot;
|
||||
} else if (*h == replace_history) {
|
||||
hage = &replaceage;
|
||||
hbot = &replacebot;
|
||||
}
|
||||
if (h->count == MAX_SEARCH_HISTORY) { /* list 'full', delete oldest */
|
||||
remove_node(h->tail);
|
||||
h->count--;
|
||||
|
||||
assert(hage != NULL && hbot != NULL);
|
||||
|
||||
/* If this string is already in the history, delete it. */
|
||||
p = find_history(*hage, *hbot, s, (size_t)-1);
|
||||
|
||||
if (p != NULL) {
|
||||
filestruct *foo, *bar;
|
||||
|
||||
/* If the string is at the beginning, move the beginning down to
|
||||
* the next string. */
|
||||
if (p == *hage)
|
||||
*hage = (*hage)->next;
|
||||
|
||||
/* Delete the string. */
|
||||
foo = p;
|
||||
bar = p->next;
|
||||
unlink_node(foo);
|
||||
delete_node(foo);
|
||||
renumber(bar);
|
||||
}
|
||||
insert_node((historytype *)h, s);
|
||||
h->count++;
|
||||
SET(HISTORY_CHANGED);
|
||||
up_hs:
|
||||
h->current = h->next;
|
||||
}
|
||||
|
||||
/* return a pointer to either the next older history or NULL if no more */
|
||||
char *get_history_older(historyheadtype *h)
|
||||
{
|
||||
if (h->current->next != NULL) { /* any older entries? */
|
||||
h->current = h->current->next; /* yes */
|
||||
return h->current->data; /* return it */
|
||||
/* If the history is full, delete the beginning entry to make room
|
||||
* for the new entry at the end. */
|
||||
if ((*hbot)->lineno == MAX_SEARCH_HISTORY + 1) {
|
||||
filestruct *foo = *hage;
|
||||
|
||||
*hage = (*hage)->next;
|
||||
unlink_node(foo);
|
||||
delete_node(foo);
|
||||
renumber(*hage);
|
||||
}
|
||||
return NULL; /* end of list */
|
||||
}
|
||||
|
||||
char *get_history_newer(historyheadtype *h)
|
||||
{
|
||||
if (h->current->prev != NULL) {
|
||||
h->current = h->current->prev;
|
||||
if (h->current->prev != NULL)
|
||||
return h->current->data;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
/* Add the new entry to the end. */
|
||||
(*hbot)->data = mallocstrcpy(NULL, s);
|
||||
splice_node(*hbot, make_new_node(*hbot), (*hbot)->next);
|
||||
*hbot = (*hbot)->next;
|
||||
(*hbot)->data = mallocstrcpy(NULL, "");
|
||||
|
||||
/* get a completion */
|
||||
char *get_history_completion(historyheadtype *h, char *s)
|
||||
{
|
||||
historytype *p;
|
||||
|
||||
for (p = h->current->next; p->next != NULL; p = p->next) {
|
||||
if (strncmp(s, p->data, h->len) == 0 && strlen(p->data) != h->len) {
|
||||
h->current = p;
|
||||
return p->data;
|
||||
}
|
||||
}
|
||||
h->current = (historytype*)h;
|
||||
null_at(&s, h->len);
|
||||
return s;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* free a history list */
|
||||
void free_history(historyheadtype *h)
|
||||
{
|
||||
historytype *p;
|
||||
|
||||
for (p = h->next; p->next != NULL; p = p->next)
|
||||
remove_node(p);
|
||||
}
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Indicate that the history's been changed. */
|
||||
history_changed = TRUE;
|
||||
#endif
|
||||
|
||||
/* end of history support functions */
|
||||
/* Set the current position in the list to the bottom. */
|
||||
*h = *hbot;
|
||||
}
|
||||
|
||||
/* Move h to the string in the history list just before it, and return
|
||||
* that string. If there isn't one, don't move h and return NULL. */
|
||||
char *get_history_older(filestruct **h)
|
||||
{
|
||||
assert(h != NULL);
|
||||
|
||||
if ((*h)->prev == NULL)
|
||||
return NULL;
|
||||
|
||||
*h = (*h)->prev;
|
||||
|
||||
return (*h)->data;
|
||||
}
|
||||
|
||||
/* Move h to the string in the history list just after it, and return
|
||||
* that string. If there isn't one, don't move h and return NULL. */
|
||||
char *get_history_newer(filestruct **h)
|
||||
{
|
||||
assert(h != NULL);
|
||||
|
||||
if ((*h)->next == NULL)
|
||||
return NULL;
|
||||
|
||||
*h = (*h)->next;
|
||||
|
||||
return (*h)->data;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
/* Move h to the next string that's a tab completion of the string s,
|
||||
* looking at only the first len characters of s, and return that
|
||||
* string. If there isn't one, or if len is 0, don't move h and return
|
||||
* s. */
|
||||
char *get_history_completion(filestruct **h, char *s, size_t len)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
if (len > 0) {
|
||||
filestruct *hage = NULL, *hbot = NULL, *p;
|
||||
|
||||
assert(h != NULL);
|
||||
|
||||
if (*h == search_history) {
|
||||
hage = searchage;
|
||||
hbot = searchbot;
|
||||
} else if (*h == replace_history) {
|
||||
hage = replaceage;
|
||||
hbot = replacebot;
|
||||
}
|
||||
|
||||
assert(hage != NULL && hbot != NULL);
|
||||
|
||||
/* Search the history list from the current position to the
|
||||
* bottom for a match of len characters. Skip over an exact
|
||||
* match. */
|
||||
p = find_history((*h)->next, hbot, s, len);
|
||||
|
||||
while (p != NULL && strcmp(p->data, s) == 0)
|
||||
p = find_history(p->next, hbot, s, len);
|
||||
|
||||
if (p != NULL) {
|
||||
*h = p;
|
||||
return (*h)->data;
|
||||
}
|
||||
|
||||
/* Search the history list from the top to the current position
|
||||
* for a match of len characters. Skip over an exact match. */
|
||||
p = find_history(hage, *h, s, len);
|
||||
|
||||
while (p != NULL && strcmp(p->data, s) == 0)
|
||||
p = find_history(p->next, *h, s, len);
|
||||
|
||||
if (p != NULL) {
|
||||
*h = p;
|
||||
return (*h)->data;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're here, we didn't find a match, we didn't find an inexact
|
||||
* match, or len is 0. Return s. */
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
118
src/utils.c
118
src/utils.c
@@ -8,14 +8,15 @@
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
||||
* 02110-1301, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
@@ -32,15 +33,16 @@
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
/* Work around a potential segfault in glibc 2.2.3's regexec(). */
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
if (string != NULL && *string != '\0')
|
||||
return regexec(preg, string, nmatch, pmatch, eflags);
|
||||
|
||||
return REG_NOMATCH;
|
||||
}
|
||||
#endif
|
||||
@@ -53,13 +55,10 @@ int regexp_bol_or_eol(const regex_t *preg, const char *string)
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
int num_of_digits(int n)
|
||||
int digits(size_t n)
|
||||
{
|
||||
int i = 1;
|
||||
|
||||
if (n < 0)
|
||||
n = -n;
|
||||
|
||||
while (n > 10) {
|
||||
n /= 10;
|
||||
i++;
|
||||
@@ -106,18 +105,53 @@ bool parse_num(const char *str, ssize_t *val)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Fix the memory allocation for a string. */
|
||||
void align(char **strp)
|
||||
/* Read an int and a ssize_t, separated by a comma, from str, and store
|
||||
* them in *line and *column (if they're not both NULL). On error, we
|
||||
* return FALSE. Otherwise, we return TRUE. */
|
||||
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||
{
|
||||
assert(strp != NULL);
|
||||
if (*strp != NULL)
|
||||
*strp = charealloc(*strp, strlen(*strp) + 1);
|
||||
bool retval = TRUE;
|
||||
const char *comma;
|
||||
|
||||
assert(str != NULL);
|
||||
|
||||
comma = strchr(str, ',');
|
||||
|
||||
if (comma != NULL && column != NULL) {
|
||||
if (!parse_num(str + (comma - str + 1), column))
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
if (line != NULL) {
|
||||
if (comma != NULL) {
|
||||
char *str_line = mallocstrncpy(NULL, str, comma - str + 1);
|
||||
str_line[comma - str] = '\0';
|
||||
|
||||
if (str_line[0] != '\0' && !parse_num(str_line, line))
|
||||
retval = FALSE;
|
||||
|
||||
free(str_line);
|
||||
} else if (!parse_num(str, line))
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Fix the memory allocation for a string. */
|
||||
void align(char **str)
|
||||
{
|
||||
assert(str != NULL);
|
||||
|
||||
if (*str != NULL)
|
||||
*str = charealloc(*str, strlen(*str) + 1);
|
||||
}
|
||||
|
||||
/* Null a string at a certain index and align it. */
|
||||
void null_at(char **data, size_t index)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
*data = charealloc(*data, index + 1);
|
||||
(*data)[index] = '\0';
|
||||
}
|
||||
@@ -127,6 +161,7 @@ void null_at(char **data, size_t index)
|
||||
void unsunder(char *str, size_t true_len)
|
||||
{
|
||||
assert(str != NULL);
|
||||
|
||||
for (; true_len > 0; true_len--, str++) {
|
||||
if (*str == '\0')
|
||||
*str = '\n';
|
||||
@@ -138,6 +173,7 @@ void unsunder(char *str, size_t true_len)
|
||||
void sunder(char *str)
|
||||
{
|
||||
assert(str != NULL);
|
||||
|
||||
for (; *str != '\0'; str++) {
|
||||
if (*str == '\n')
|
||||
*str = '\0';
|
||||
@@ -168,15 +204,15 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
|
||||
/* Allocate the line the first time. */
|
||||
if (*lineptr == NULL) {
|
||||
*lineptr = charalloc(128);
|
||||
*n = 128;
|
||||
*lineptr = charalloc(MAX_BUF_SIZE);
|
||||
*n = MAX_BUF_SIZE;
|
||||
}
|
||||
|
||||
while ((c = getc(stream)) != EOF) {
|
||||
/* Check if more memory is needed. */
|
||||
if (indx >= *n) {
|
||||
*lineptr = charealloc(*lineptr, *n + 128);
|
||||
*n += 128;
|
||||
*lineptr = charealloc(*lineptr, *n + MAX_BUF_SIZE);
|
||||
*n += MAX_BUF_SIZE;
|
||||
}
|
||||
|
||||
/* Push the result in the line. */
|
||||
@@ -189,8 +225,8 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
|
||||
/* Make room for the null character. */
|
||||
if (indx >= *n) {
|
||||
*lineptr = charealloc(*lineptr, *n + 128);
|
||||
*n += 128;
|
||||
*lineptr = charealloc(*lineptr, *n + MAX_BUF_SIZE);
|
||||
*n += MAX_BUF_SIZE;
|
||||
}
|
||||
|
||||
/* Null terminate the buffer. */
|
||||
@@ -217,20 +253,22 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
* line. In either case, we just say no match was found. */
|
||||
if ((start > haystack && *(start - 1) == '\0') || start < haystack)
|
||||
return NULL;
|
||||
|
||||
assert(haystack != NULL && needle != NULL && start != NULL);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
if (regexec(&search_regexp, haystack, 1, regmatches, 0) == 0
|
||||
&& haystack + regmatches[0].rm_so <= start) {
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
if (regexec(&search_regexp, haystack, 1, regmatches,
|
||||
0) == 0 && haystack + regmatches[0].rm_so <= start) {
|
||||
const char *retval = haystack + regmatches[0].rm_so;
|
||||
|
||||
/* Search forward until there are no more matches. */
|
||||
while (regexec(&search_regexp, retval + 1, 1, regmatches,
|
||||
REG_NOTBOL) == 0 && retval + 1 +
|
||||
regmatches[0].rm_so <= start)
|
||||
retval += 1 + regmatches[0].rm_so;
|
||||
while (regexec(&search_regexp, retval + 1, 1,
|
||||
regmatches, REG_NOTBOL) == 0 &&
|
||||
retval + regmatches[0].rm_so + 1 <= start)
|
||||
retval += regmatches[0].rm_so + 1;
|
||||
/* Finally, put the subexpression matches in global
|
||||
* variable regmatches. The REG_NOTBOL flag doesn't
|
||||
* matter now. */
|
||||
@@ -252,7 +290,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_SPELLER)
|
||||
if (ISSET(CASE_SENSITIVE)) {
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
return revstrstr(haystack, needle, start);
|
||||
else
|
||||
#endif
|
||||
@@ -260,25 +298,26 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER || !NANO_SMALL */
|
||||
#ifndef NANO_SMALL
|
||||
else if (ISSET(REVERSE_SEARCH))
|
||||
else if (ISSET(BACKWARDS_SEARCH))
|
||||
return mbrevstrcasestr(haystack, needle, start);
|
||||
#endif
|
||||
return mbstrcasestr(start, needle);
|
||||
}
|
||||
|
||||
/* This is a wrapper for the perror() function. The wrapper takes care
|
||||
* of ncurses, calls perror (which writes to stderr), then refreshes the
|
||||
* screen. Note that nperror() causes the window to flicker once. */
|
||||
* of curses, calls perror() (which writes to stderr), and then
|
||||
* refreshes the screen. Note that nperror() causes the window to
|
||||
* flicker once. */
|
||||
void nperror(const char *s)
|
||||
{
|
||||
/* leave ncurses mode, go to the terminal */
|
||||
/* Leave curses mode and go to the terminal. */
|
||||
if (endwin() != ERR) {
|
||||
perror(s); /* print the error */
|
||||
total_refresh(); /* return to ncurses and repaint */
|
||||
perror(s); /* Print the error. */
|
||||
total_refresh(); /* Return to curses and refresh. */
|
||||
}
|
||||
}
|
||||
|
||||
/* Thanks BG, many ppl have been asking for this... */
|
||||
/* Thanks, BG, many people have been asking for this... */
|
||||
void *nmalloc(size_t howmuch)
|
||||
{
|
||||
void *r = malloc(howmuch);
|
||||
@@ -320,7 +359,8 @@ char *mallocstrncpy(char *dest, const char *src, size_t n)
|
||||
* "dest = mallocstrcpy(dest, src);". */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
{
|
||||
return mallocstrncpy(dest, src, src == NULL ? 1 : strlen(src) + 1);
|
||||
return mallocstrncpy(dest, src, (src == NULL) ? 1 :
|
||||
strlen(src) + 1);
|
||||
}
|
||||
|
||||
/* Free the malloc()ed string at dest and return the malloc()ed string
|
||||
@@ -390,7 +430,7 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
|
||||
/* Calculate the number of lines and the number of characters between
|
||||
* begin and end, and return them in lines and size, respectively. */
|
||||
void get_totals(const filestruct *begin, const filestruct *end, int
|
||||
void get_totals(const filestruct *begin, const filestruct *end, size_t
|
||||
*lines, size_t *size)
|
||||
{
|
||||
const filestruct *f;
|
||||
|
||||
728
src/winio.c
728
src/winio.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user