Compare commits

...

492 Commits

Author SHA1 Message Date
David Lawrence Ramsey
bec01bd97d GNU nano 1.3.6
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2403 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-20 20:02:51 +00:00
David Lawrence Ramsey
3dd744f392 and make the locale string checks use the #defined strcasestr() alias if
necessary


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2402 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-20 07:26:47 +00:00
David Lawrence Ramsey
adc30a839b put the old #defined aliases for strcasecmp(), strncasecmp(),
strcasestr(), and strnlen() back with the #defined aliases for getline()
and getdelim(), as they make things simpler


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2401 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-20 07:24:49 +00:00
David Lawrence Ramsey
8974efa27b when checking the locale string, use nstrcasestr() if we don't have
strcasestr()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2400 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-20 06:50:26 +00:00
David Lawrence Ramsey
d96ee5260a add asserts to do_wrap()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2399 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-20 03:10:31 +00:00
David Lawrence Ramsey
ba1ab86db5 check for a UTF-8-supporting version of slang
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2398 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-20 02:50:31 +00:00
David Lawrence Ramsey
1fc55a268f miscellaneous documentation updates
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2397 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-19 21:33:13 +00:00
David Lawrence Ramsey
543ecf65a6 update changelog again
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2396 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-19 21:20:20 +00:00
David Lawrence Ramsey
735b30c13f minor indentation fix for configure.ac, and mention UTF-8 support in
AUTHORS


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2395 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-19 21:19:26 +00:00
David Lawrence Ramsey
40e211bcec add full multibyte character support to do_wrap()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2394 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-19 21:15:30 +00:00
David Lawrence Ramsey
9bd56204ee add multibyte character support to help_line_len(), so that UTF-8 help
text is wrapped properly


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2393 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-18 21:29:33 +00:00
David Lawrence Ramsey
d456bfa10d add more locale string checks beyond case-sensitive "UTF-8" so that we
can better detect UTF-8 locales, adapted from Debian's UTF-8 patch for
slang


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2392 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-18 19:07:25 +00:00
David Lawrence Ramsey
22a3564a2e update changelog
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2391 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-18 05:26:54 +00:00
David Lawrence Ramsey
d44a005e3d make the #ifdef around indent_len() match that of its prototype, so that
we can compile with NANO_SMALL and !DISABLE_JUSTIFY again; also add a
comment fix


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2390 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-18 05:20:54 +00:00
David Lawrence Ramsey
df21a2cbdf minor documentation fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2389 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-18 04:38:19 +00:00
David Lawrence Ramsey
b349c80f0d allow refreshing of the file browser window, as Pico does
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2388 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-17 19:10:29 +00:00
David Lawrence Ramsey
85616c499b add missing blank line, and rename total_blank() to total_update(), as
the latter is more accurate


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2387 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-17 18:11:08 +00:00
David Lawrence Ramsey
b9ddb80123 allow refreshing of the help browser window, as Pico does, and remove a
few stray spaces from the main help text


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2386 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-17 17:56:48 +00:00
David Lawrence Ramsey
27f2b258d3 initialize indent_string later in the justify code, so as to avoid a
possible memory leak


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2385 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-17 05:08:15 +00:00
David Lawrence Ramsey
102d01da6c fix justify code regression: if we're justifying the entire file, and we
haven't found any paragraph(s), we should refresh the screen and get out
instead of breaking out of the loop and acting as though we've justified
something, so as to avoid a segfault


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2384 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-17 04:48:14 +00:00
David Lawrence Ramsey
fd81a7189b fix paragraph searching code regression: if trying to move to the line
after the end of the next paragraph leaves us on the same line where we
were before, the search should fail in order to avoid an infinite loop


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2383 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-17 04:24:12 +00:00
David Lawrence Ramsey
efec641a82 control characters can only be properly filtered out in both non-UTF-8
and UTF-8 mode inside the output routines, so do it there instead of
inside the input routines


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2382 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-17 03:52:08 +00:00
David Lawrence Ramsey
77abec7ecf fix misplaced #endif
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2381 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-16 17:00:27 +00:00
David Lawrence Ramsey
ba5b12c1fa comment clarifications
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2380 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-16 16:40:21 +00:00
David Lawrence Ramsey
40ea2a2ea0 actually, we can swallow non-ASCII control characters if we're not in
UTF-8 mode


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2379 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-16 16:32:33 +00:00
David Lawrence Ramsey
496488c5d2 when getting printable input from the edit window or statusbar prompt,
don't swallow non-ASCII control characters, since they're parts of UTF-8
sequences


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2378 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-16 15:34:22 +00:00
David Lawrence Ramsey
a17a130d6c add debugging statement
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2377 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-16 14:39:42 +00:00
David Lawrence Ramsey
2161fa6254 check for wget_wch() again instead of get_wch() when looking for the
wide version of curses, since get_wch() might be a macro instead of a
function


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2376 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-16 03:03:41 +00:00
David Lawrence Ramsey
bb0060eb96 documentation update
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2375 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-15 07:20:52 +00:00
David Lawrence Ramsey
631242dd96 a few last minor fixes to do_credits()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2374 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-15 07:06:54 +00:00
David Lawrence Ramsey
4dc5838ccc in do_credits(), display Florian König's name properly in UTF-8 mode;
since we can't dynamically set that element of the array to its UTF-8
equivalent when in UTF-8 mode, we have to use the ISO-8859-1 version and
pass every string in the credits through make_mbstring() to make sure
they're all UTF-8 (sigh)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2373 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-15 06:58:02 +00:00
David Lawrence Ramsey
0099a8f45c fix potential memory corruption problem in make_mbstring(), and also fix
compilation with -pedantic


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2372 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-15 06:34:09 +00:00
David Lawrence Ramsey
38156d4491 make the rest of the justify code support multibyte characters
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2371 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-15 05:44:03 +00:00
David Lawrence Ramsey
666644efbc fix more inaccurate comments
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2370 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-14 20:32:00 +00:00
David Lawrence Ramsey
15540051ac when justifying, don't remove a space after a duplicate character in
punct anymore, as it doesn't really make us more compatible with Pico


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2369 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-14 20:06:23 +00:00
David Lawrence Ramsey
7b918c76ee add missing blank lines
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2368 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-14 19:17:27 +00:00
David Lawrence Ramsey
7d7e7d58ad fix erroneous #ifdef
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2367 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-14 18:54:33 +00:00
David Lawrence Ramsey
f0195a8839 make sure all rcfile arguments are valid multibyte strings
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2366 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-14 18:47:21 +00:00
David Lawrence Ramsey
08c70ae1e9 formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2365 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-14 17:47:17 +00:00
David Lawrence Ramsey
9389ca29cf add more multibyte character support to break_line()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2364 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-14 06:14:02 +00:00
David Lawrence Ramsey
af40eeaa06 more comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2363 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-14 04:31:44 +00:00
David Lawrence Ramsey
b159605a5b add missing blank lines
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2362 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-14 00:38:36 +00:00
David Lawrence Ramsey
801a8b51d1 remove erroneous if clause in the overhauled justify code
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2361 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-14 00:29:37 +00:00
David Lawrence Ramsey
ff4a487efa overhaul the paragraph-searching code to make it simpler too
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2360 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-13 21:12:25 +00:00
David Lawrence Ramsey
9ec5db8b42 comment improvement
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2359 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-13 20:39:33 +00:00
David Lawrence Ramsey
8d0d3abb72 more comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2358 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-13 16:42:36 +00:00
David Lawrence Ramsey
7f9ed903ec fix regressions caused by the justify overhaul: when adjusting the mark,
take the indentation length into account, and don't declare an
indent_len variable inside a loop when we already have one outside


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2357 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-13 16:05:47 +00:00
David Lawrence Ramsey
96b21be5cf fix regression caused by the justify overhaul: when justifying a quoted
paragraph, don't put the indentation of the first line at the beginning
of every broken line unless that indentation was at the beginning of
every line originally


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2356 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-13 15:48:36 +00:00
David Lawrence Ramsey
7253929a55 fix erroneous comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2355 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-13 06:03:33 +00:00
David Lawrence Ramsey
e9ac1d7930 overhaul the justify code to make it leave the right number of spaces at
the ends of the lines of a paragraph, and also to make it simpler


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2354 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-13 03:28:37 +00:00
David Lawrence Ramsey
59fe758a10 fix problem where mark_beginx wouldn't be saved properly in
backup_lines(), and add a few more cosmetic fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2353 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-12 20:29:22 +00:00
David Lawrence Ramsey
cefd29e9fe undo erroneous tweaks
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2352 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-11 20:32:06 +00:00
David Lawrence Ramsey
bca59d6ac0 add a slightly tweaked version of Mike Frysinger's manpage regex, and do
various documentation updates


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2351 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-11 20:22:48 +00:00
David Lawrence Ramsey
800dd18fa4 when using slang, call the right function to enable UTF-8 support
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2350 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-11 17:46:01 +00:00
David Lawrence Ramsey
b1d9b418b8 formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2349 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-11 04:22:34 +00:00
David Lawrence Ramsey
e0fb4d5641 improve the handling of whitespace display mode in multibyte locales:
use new function make_mbstring() instead of display_string() to make
sure the multibyte string is valid and interpreted properly


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2348 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-11 04:03:32 +00:00
Jordi Mallach
55dfc3d3e9 Updated Malay from the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2347 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-10 23:55:20 +00:00
David Lawrence Ramsey
6e60db6989 make whitespace display mode work with multibyte characters
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2346 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-10 22:52:21 +00:00
David Lawrence Ramsey
202d3c2f97 add DB's overhaul of the rcfile parsing code and related miscellaneous
bits


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2345 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-10 20:55:11 +00:00
David Lawrence Ramsey
40f11ae622 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2344 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-10 17:35:41 +00:00
David Lawrence Ramsey
3cf525d46f fix wording problem
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2343 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-09 23:20:56 +00:00
David Lawrence Ramsey
23f7e1b138 make the latest faq entry more accurate
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2342 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-09 23:14:01 +00:00
David Lawrence Ramsey
256a8908aa add faq entry about how to open files with names starting with '+'s
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2341 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-09 22:53:11 +00:00
David Lawrence Ramsey
b199caef7d make sure that the universal statusbar prompt functions are fully in
sync with their edit window counterparts, and add a few cosmetic fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2340 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-09 20:35:10 +00:00
David Lawrence Ramsey
c275dc575a attempt at fixing a problem tracked down by Jim Uhl, where nano will go
into an infinite loop if the terminal it's running in dies unexpectedly
due to a signal


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2339 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-08 17:45:36 +00:00
David Lawrence Ramsey
9d69169072 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2338 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-08 16:41:53 +00:00
David Lawrence Ramsey
09b1c02c62 reorganize changelog a bit
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2337 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-04 18:25:56 +00:00
David Lawrence Ramsey
5f9acfeee5 add a few more missing blank lines, and fix two instances where totsize
is miscalculated in multibyte/wide character mode


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2336 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-04 17:09:41 +00:00
David Lawrence Ramsey
9adace8c76 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2335 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-04 15:09:55 +00:00
David Lawrence Ramsey
bd2eb289fb comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2334 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-02 19:34:59 +00:00
David Lawrence Ramsey
e6bbee8fe4 formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2333 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-01 23:36:34 +00:00
David Lawrence Ramsey
7e110bd28f add missing blank line
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2332 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-01 23:21:21 +00:00
David Lawrence Ramsey
eb4d81f3c1 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2331 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-03-01 22:47:00 +00:00
David Lawrence Ramsey
aed09427f8 remove unneeded blank line
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2330 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-25 21:06:43 +00:00
David Lawrence Ramsey
5d2ab88f0e another cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2329 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-25 20:29:44 +00:00
David Lawrence Ramsey
65ef166a40 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2328 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-25 20:21:45 +00:00
David Lawrence Ramsey
b6e79fddaf start adding multibyte/wide character support to the help browser code
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2327 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-25 19:17:57 +00:00
David Lawrence Ramsey
0c23aed600 fix erroneous statusbar message truncation with multibyte strings
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2326 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-23 22:10:38 +00:00
David Lawrence Ramsey
ad96aff50d rework things so that strrchrn() is no longer needed, and remove it
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2325 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-22 23:22:37 +00:00
David Lawrence Ramsey
60e329e3b2 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2324 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-22 22:24:14 +00:00
David Lawrence Ramsey
32f56814c7 remove unnecessary #include
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2323 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-14 18:25:32 +00:00
David Lawrence Ramsey
45edf361a8 mention typo fix in changelog
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2322 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-14 05:38:06 +00:00
David Lawrence Ramsey
4c75faa211 typo fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2321 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-14 05:37:09 +00:00
David Lawrence Ramsey
7d367710ae add DB's overhaul of the file browser code to increase efficiency and
add multibyte character support, plus a few tweaks of mine


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2320 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-14 05:00:15 +00:00
David Lawrence Ramsey
b680326c37 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2319 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-12 23:59:20 +00:00
David Lawrence Ramsey
e1c16b3744 add multibyte character support to is_whole_word(), plus a comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2318 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-12 23:09:27 +00:00
David Lawrence Ramsey
bc14941e34 fix misplaced #ifdefs
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2317 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-11 20:23:00 +00:00
David Lawrence Ramsey
1b9d3f9898 port over DB's overhaul of safe_tempnam() and his changes to
check_operating_dir() to make it use boolean values (plus a few more
boolean-related tweaks of mine); also stop wrapping the bad_chr
parameter of parse_mbchar() in #ifdefs for cleanliness, as the
allow_tabcomp parameter of check_operating_dir() isn't wrapped in
#ifdefs, and don't set bad_chr to TRUE when we get a null byte in a
multibyte string, as it's not an invalid multibyte character


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2316 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-11 20:09:11 +00:00
David Lawrence Ramsey
2724c88717 set statusbar_xend properly when doing tab completion
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2315 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-11 16:23:56 +00:00
David Lawrence Ramsey
54dca7b7b3 revert diralphasort() tweak
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2314 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-11 16:02:54 +00:00
David Lawrence Ramsey
0df875a45d cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2313 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-10 02:26:08 +00:00
David Lawrence Ramsey
d7ca85c86c add DB's overhauls of get_full_path() and check_writable_directory(),
plus a few tweaks of mine


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2312 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-09 18:56:21 +00:00
David Lawrence Ramsey
d9661dc301 remove inaccurate comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2311 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-08 21:48:15 +00:00
David Lawrence Ramsey
0b80f936bf add missing #ifdef
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2310 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-08 20:39:28 +00:00
David Lawrence Ramsey
65e6ecb1d4 add DB's pverhaul the tab completion code and a few related functions to
increase efficiency and support multibyte characters; also add a few
miscellaneous tweaks of mine


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2309 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-08 20:37:53 +00:00
David Lawrence Ramsey
daa533a767 fix off-by-one error when calculating totsize in read_file(), introduced
when totsize was converted to hold the total number of multibyte
characters


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2308 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-02-07 05:31:51 +00:00
David Lawrence Ramsey
3eeb823f92 add multibyte character support to indent_length(), convert the "smart
home" routines to use it (since it returns the number of bytes taken up
by spacing characters at the beginning of the line), and rearrange a few
initializations near asserts


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2307 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-31 18:59:30 +00:00
David Lawrence Ramsey
2921be2f38 when detecting wide character support in curses, check for get_wch()
instead of wget_wch()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2306 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-28 20:09:45 +00:00
David Lawrence Ramsey
d15de73bf3 properly enable UTF-8 support when using slang
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2305 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-28 19:37:23 +00:00
David Lawrence Ramsey
798e67e0a1 tweak get_mouseinput() to work properly when -O/--morespace is used
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2304 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-28 19:11:51 +00:00
David Lawrence Ramsey
96de1b0650 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2303 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-27 21:00:10 +00:00
David Lawrence Ramsey
23c44504ad miscellaneous bits: change flags to an unsigned long and totsize to a
size_t, store the number of multibyte characters instead of the number
of single-byte characters in totsize, and add a few formatting fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2302 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-27 20:49:07 +00:00
David Lawrence Ramsey
7c60eab744 tweak do_mouse() to work properly when -O/--morespace is used
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2301 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-27 06:35:56 +00:00
David Lawrence Ramsey
3f9c63589e turn string functions that don't take length arguments into wrappers for
the versions that take length arguments, add multibyte equivalent of
strlen(), and fix potential segfault in mbstrnlen()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2300 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-25 19:21:11 +00:00
David Lawrence Ramsey
14ace1711d in edit_add(), make sure we use the right variable when painting marked
selections, and add a few cosmetic tweaks


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2299 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-24 21:51:07 +00:00
David Lawrence Ramsey
3e93c63e60 comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2298 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-24 14:57:57 +00:00
David Lawrence Ramsey
83ba47a964 add another cleanup
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2297 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-24 01:21:09 +00:00
David Lawrence Ramsey
345260c624 add multibyte version of revstrcasestr()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2296 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-24 01:14:17 +00:00
David Lawrence Ramsey
3ee4cf3027 cosmetic and formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2295 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-22 20:49:14 +00:00
David Lawrence Ramsey
17b8a36d17 rename a variable in the strcasestr() equivalent order to match DB's
original cleanup of it, and port the change to the multibyte version too


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2294 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-22 19:56:16 +00:00
David Lawrence Ramsey
42abfe057e add multibyte equivalent of strcasestr(), plus some miscellaneous
cleanups


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2293 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-22 18:24:16 +00:00
David Lawrence Ramsey
159bdfdc60 add support for characters to the "c-file" regexes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2292 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-20 16:40:24 +00:00
David Lawrence Ramsey
122ae849b8 oops; replace the previous tweak with a proper merge of DB's code with
the no_more_space() function


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2290 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-19 20:55:42 +00:00
David Lawrence Ramsey
5040666fbb add DB's (slightly tweaked) changes to make resizing more flexible, and
also add his replacement of RETSIGTYPE with void, which avoids some
potential problems


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2289 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-19 19:52:42 +00:00
David Lawrence Ramsey
b80077dae3 add support for moving to the next or previous word at the statusbar
prompt


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2288 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-18 21:25:38 +00:00
David Lawrence Ramsey
314be2cfa9 formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2287 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-18 21:12:28 +00:00
David Lawrence Ramsey
21954765ca reorganization: move revstrstr() back to chars.c, and move is_byte()
there too, since they both deal with strings and hence characters


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2286 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-18 17:00:00 +00:00
David Lawrence Ramsey
2bd22761ac #define fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2285 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-18 16:43:18 +00:00
Jordi Mallach
d23277fbc9 Updated Brazilian Portuguese translation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2284 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-18 09:41:30 +00:00
David Lawrence Ramsey
4ce3b49597 update documentation copyright years and modification dates
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2283 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-17 05:35:00 +00:00
David Lawrence Ramsey
5cc14f2f9a various documentation updates
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2282 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-17 05:24:26 +00:00
David Lawrence Ramsey
637b8bb36c add -O/--morespace command line option, plus a corresponding Meta-O
toggle and a "morespace" rcfile option; when these are used, the
normally-unused blank line below the titlebar will be treated as part of
the edit window


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2281 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-17 05:06:55 +00:00
David Lawrence Ramsey
65658ef574 make sure the multibyte string operations operate using multibyte
character counts instead of byte character counts


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2280 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-16 20:05:36 +00:00
David Lawrence Ramsey
18d616f253 put revstrstr() back in utils.c, as it's case sensitive and hance should
work with multibyte strings as-is


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2279 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-16 19:30:48 +00:00
David Lawrence Ramsey
c5e21dafb7 assert fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2278 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-16 18:58:03 +00:00
David Lawrence Ramsey
3a1fc8f0ab start making multibyte equivalents of the string functions in utils.c
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2277 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-16 18:49:19 +00:00
David Lawrence Ramsey
721fe6704a improve the checks needed to determine if wide character support is
available


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2276 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-16 17:48:49 +00:00
David Lawrence Ramsey
63d8f2b42f remove duplicate prototype
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2275 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-16 17:01:51 +00:00
David Lawrence Ramsey
776cf3771d tweak do_next_word() and do_prev_word() to make sure they don't parse
the same multibyte character twice


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2274 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-15 15:05:20 +00:00
David Lawrence Ramsey
ce0451348c make do_prev_word() work with multibyte strings, and update various
comments in do_next_word() and do_prev_word()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2273 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-15 00:34:57 +00:00
David Lawrence Ramsey
31055b3ba8 add missing free()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2272 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 22:08:18 +00:00
David Lawrence Ramsey
7801d7bed9 revert previously added extra calls to move_mbright(); it's more
efficient to just add the return value of parse_char() directly instead
of having move_mbright() return it (except in the cursor movement
functions, which should be kept simple)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2271 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 21:59:01 +00:00
David Lawrence Ramsey
d24fbb760d rename move_left() and move_right() to move_mbleft() and move_mbright(),
and move them to chars.c


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2270 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 21:50:32 +00:00
David Lawrence Ramsey
1fe2eebf74 add multibyte and wide equivalents of isalnum(), make do_next_word()
work with multibyte strings, and tweak the "smart home" routines to use
move_right() for consistency


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2269 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 21:33:47 +00:00
David Lawrence Ramsey
52e5f23184 more cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2268 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 21:26:38 +00:00
David Lawrence Ramsey
b3aeb13682 add missing changelog update
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2267 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 21:19:06 +00:00
David Lawrence Ramsey
c4c45aa532 make do_statusbar_cut_text() respect the CUT_TO_END flag
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2266 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 21:10:14 +00:00
David Lawrence Ramsey
e3013e3ed0 in src/Makefile.am, if we're installing and the "rnano" symlink already
exists, remove it so that we can create it again without an error


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2265 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 18:47:42 +00:00
David Lawrence Ramsey
f6e4d33afc tweak new_file() to use mallocstrcpy() instead of charalloc() followed
by a null character initialization, for consistency


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2264 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 17:17:11 +00:00
David Lawrence Ramsey
1bdccc5281 use the right number of characters when calling the multibyte equivalent
of strnlen()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2263 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 15:27:33 +00:00
David Lawrence Ramsey
9b95ca8c29 minor fixes involving is_byte()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2262 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 06:02:10 +00:00
David Lawrence Ramsey
8eb9c029be fix the previous fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2261 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 04:45:18 +00:00
David Lawrence Ramsey
8f2906ba61 fix the multibyte equivalent of strnlen() so that it actually works
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2260 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 04:38:48 +00:00
David Lawrence Ramsey
5508cc5b0a move nstrnlen() to chars.c, and add a multibyte equivalent of strnlen()
to it


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2259 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 04:22:14 +00:00
David Lawrence Ramsey
49ff08b251 add missing memory corruption fix to do_statusbar_output()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2258 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 04:13:45 +00:00
David Lawrence Ramsey
116c828c50 add asserts, plus a few more cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2257 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-14 03:22:54 +00:00
David Lawrence Ramsey
78dadd4550 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2256 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-13 15:24:05 +00:00
David Lawrence Ramsey
ea9370f231 a few forgotten copyright year updates
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2255 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-12 19:29:44 +00:00
David Lawrence Ramsey
610929c6ed the is_xxx_char() functions should take unsigned ints for consistency
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2254 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-12 18:46:08 +00:00
David Lawrence Ramsey
c1e3d941a5 fix problem where displaying multiline regexes that have their start on
one page of a line and their end on a different page of the same line
would paint past the end of the regex by tweaking DB's changes to add
multibyte string support to edit_add(); now calculate paintlen the same
way the original working code did, but keep accounting for multibyte
characters as DB'S new code did


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2253 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-12 18:23:09 +00:00
David Lawrence Ramsey
487d08cad0 use actual UTF-8 in do_credits()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2252 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-12 18:16:17 +00:00
David Lawrence Ramsey
0c9df578ea add comments
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2251 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-12 16:20:18 +00:00
David Lawrence Ramsey
8a31afdc55 make the "smart home" routines handle multibyte blank characters
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2250 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-12 05:10:53 +00:00
David Lawrence Ramsey
4c6956b433 add minor fixes to make the displaying of invalid multibyte sequences
work again


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2249 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-12 04:32:43 +00:00
David Lawrence Ramsey
b54155c4a4 massive updates to multibyte/wide character support; deal with multibyte
characters and strings instead of wide characters and strings as much as
possible, and move multibyte/wide character-specific functions into
their own source file, chars.c


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2248 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-12 03:25:57 +00:00
David Lawrence Ramsey
775d46daf9 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2247 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-11 23:08:36 +00:00
David Lawrence Ramsey
cac0293bce miscellaneous high-level input routine fixes: in do_statusbar_input(),
indicate when we run a normal shortcut's associated function with the
ran_func parameter, reset the statusbar cursor position when we do, and
don't call print_view_warning() when we try to run a function not
allowed in view mode; also apply the first of these changes to
do_input() so that both the edit window and statusbar routines are in
sync again


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2246 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-11 23:05:05 +00:00
David Lawrence Ramsey
577298a3f9 remove display_string_len() again for the time being, since it's still
prone to off-by-one errors that lead to memory corruption and I can't
find anything obviously wrong with it; always allocate enough space for
len columns of text now; any extra space that isn't used will be removed
by the null_at() call at the end of display_string() anyway


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2245 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-08 07:21:41 +00:00
David Lawrence Ramsey
f4a799aaec more minor shortcut-related fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2244 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-08 06:16:19 +00:00
David Lawrence Ramsey
35e9713543 remove erroneous #ifdef around a currshortcut reference, do another int
-> bool conversion, and change a value of 0 for func to NULL in all
sc_init_one() calls


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2243 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-08 06:04:19 +00:00
David Lawrence Ramsey
d96851f534 miscellaneous cleanups for the multibyte parsing functions
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2242 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-07 22:39:43 +00:00
David Lawrence Ramsey
12054fe11b add a cosmetic fix and a fix for a potential compilation problem exposed
by -pedantic


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2241 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-07 22:37:01 +00:00
David Lawrence Ramsey
1307aae01a minor utility tweaks
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2240 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-07 19:02:47 +00:00
David Lawrence Ramsey
6d594a9cbb really fix the memory corruption problem in display_string()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2239 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 21:43:43 +00:00
David Lawrence Ramsey
9ac20c85b0 remove redundant code
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2238 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 20:41:55 +00:00
David Lawrence Ramsey
0251bdb0a5 fix display problem caused by the memory corruption fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2237 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 19:05:04 +00:00
David Lawrence Ramsey
8ec1e2d903 when NANO_WIDE is defined, use MB_CUR_MAX only when the NO_UTF8 flag is
not set


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2236 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 18:33:04 +00:00
David Lawrence Ramsey
851bea2ccd remove now-unneeded comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2235 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 17:04:03 +00:00
David Lawrence Ramsey
bbd63e136d fix potential memory corruption in display_string() when adding UTF-8
characters, found by valgrind (and caused by a bad merge of part of DB's
code)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2234 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 16:59:49 +00:00
David Lawrence Ramsey
28e19f8bbc fix potential memory corruption in do_output() when adding UTF-8
characters, found by valgrind


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2233 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 15:42:45 +00:00
David Lawrence Ramsey
9dffac90e7 put back two of the hacks of DB's that are actually needed (we need one
since we can't add half a two-column character to converted in
display_string(), and we need the other to keep the "$" from spilling
over to the next line if the line contains two-column characters in the
right places)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2232 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 06:09:34 +00:00
David Lawrence Ramsey
930b1d7809 remove DB's hacks to work around problems with ncurses' display of
two-column characters at the beginnings and ends of long lines (i.e,
lines with $'s added), as the problems don't occur with ncurses 5.4, and
there's no easy way to fix the same type of problem with doing a regex
replace of "^" on a line beginning with a two-column character


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2231 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 05:22:42 +00:00
David Lawrence Ramsey
913db834d2 add DB's (modified) UTF-8 support tweaks to do_replace_highlight()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2230 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 05:08:14 +00:00
David Lawrence Ramsey
b6fbdd00cf tweak the charealloc() in do_output() to more closely match the old
charealloc() in do_char(), to avoid another memory corruption problem


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2229 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-04 04:02:45 +00:00
David Lawrence Ramsey
d90d64f718 set the value of alloc_len properly again, as in DB's patch, in order to
avoid memory corruption problems


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2228 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-04 03:09:55 +00:00
David Lawrence Ramsey
179f0ea742 undo the initialization of index, as the warning was indirectly caused
by a missing snippet of code that also broke color regex display, and
add the aforementioned snippet


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2227 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-04 02:55:45 +00:00
David Lawrence Ramsey
22e5eff432 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2226 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-03 22:56:38 +00:00
David Lawrence Ramsey
4d709f351c make sure index is initialized in order to avoid a warning
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2225 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-03 22:29:42 +00:00
David Lawrence Ramsey
68e3016557 add DB's (modified) UTF-8 support tweaks to edit_add(); they're not
perfect, but they work better than what's currently there


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2224 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-03 22:23:00 +00:00
David Lawrence Ramsey
2524a70a49 fix assert
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2223 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-03 21:34:55 +00:00
David Lawrence Ramsey
f647c48035 update more documentation dealing with double-Escape and verbatim input
of characters in decimal and hexadecimal, including the changelog


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2222 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-03 20:07:26 +00:00
David Lawrence Ramsey
f0a53f02a1 readd get_byte_kbinput(), modify get_word_kbinput() to handle
hexadecimal instead of decimal values, make normal input use
get_byte_kbinput(), make verbatim input use get_word_kbinput(), and
update faq.html to mention these changes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2221 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-03 19:56:56 +00:00
David Lawrence Ramsey
423326fc71 another int -> bool conversion
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2220 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-03 19:14:39 +00:00
David Lawrence Ramsey
956da0d0e1 miscellaneous fixes: skip over invalid wide characters, and if wcwidth()
returns -1, don't add its value to any column counter; also update
another copyright year


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2219 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-03 06:56:38 +00:00
David Lawrence Ramsey
6e1cd06b96 when we get a newline via verbatim input at the statusbar prompt, set
input to NANO_ENTER_KEY so that the cursor position is reset properly


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2218 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-02 23:50:29 +00:00
David Lawrence Ramsey
1b1e8b632f add missing NANO_SMALL #ifdef
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2217 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-02 23:35:19 +00:00
David Lawrence Ramsey
d9ad76ba3c properly handle newlines read in via verbatim input at the statusbar
prompt


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2216 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-02 22:35:31 +00:00
David Lawrence Ramsey
11c83d3ed3 implement verbatim input for the statusbar prompt
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2215 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-02 21:26:53 +00:00
David Lawrence Ramsey
b8a2a6d7e5 in do_input() and do_statusbar_input(), func_key is an int* and not an
int; fix bad code due to the latter assumption


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2214 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-02 21:13:36 +00:00
David Lawrence Ramsey
08cd7ef274 fix an assert, update another copyright year, and add a few more of DB's
tweaks to fix a few minor bugs with UTF-8 display at the statusbar
prompt


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2213 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-02 20:30:15 +00:00
David Lawrence Ramsey
4840cb557f get rid of the last remnant of the NO_UTF8 toggle that I erroneously
left in


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2212 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-01 07:55:15 +00:00
David Lawrence Ramsey
295d172f2d implement cutting from the current position to the end of the file,
using Ctrl-X from the search prompt and Meta-T from the edit window;
also update the copyright years of more modified files


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2211 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-01 07:43:32 +00:00
David Lawrence Ramsey
c13b7f0699 overhaul the high-level input routines for the statusbar to make them
more flexible, among other things, and add UTF-8 support to them in the
process; also update the copyright years of the modified files


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2210 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-01 07:28:15 +00:00
David Lawrence Ramsey
3e81914b82 miscellaneous bits: fix the full justify segfault in a way that doesn't
break some normal full justifies, do a few more int -> bool conversions,
and fix a comment


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2209 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-31 04:10:28 +00:00
David Lawrence Ramsey
0d847aadd9 handle wctomb() failure in parse_char() too
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2208 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-29 22:05:02 +00:00
David Lawrence Ramsey
f282428a42 handle wctomb() failures properly in display_stirng_len() and
display_string()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2207 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-29 21:32:22 +00:00
David Lawrence Ramsey
4d97a588e6 cosmetic totsize-related cleanups
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2206 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-29 16:42:48 +00:00
David Lawrence Ramsey
c8ade44741 set totsize properly when deleting a character or backspacing over it
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2205 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-28 22:36:13 +00:00
David Lawrence Ramsey
a9b9913c6b properly increment start_col when the line begins with a character that
takes up two columns


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2204 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-27 23:35:25 +00:00
David Lawrence Ramsey
c195820456 clarify the warning message when sufficient wide character support isn't
found, and merge missing part of DB's patch to handle tabs properly in
display_string()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2203 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-27 23:21:34 +00:00
David Lawrence Ramsey
6a643cd596 fix the NANO_WIDE #ifdefs again, and put display_string_len() back in
now that it doesn't corrupt memory anymore (as far as I can tell)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2202 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-27 23:11:59 +00:00
David Lawrence Ramsey
a35bdd1f03 add a few missing NANO_WIDE #ifdefs, and remove display_string_len()
until I can fix it to no longer cause memory corruption


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2201 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-27 18:53:38 +00:00
David Lawrence Ramsey
4fd76bab73 configure.ac and related cleanups
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2200 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-24 18:11:53 +00:00
David Lawrence Ramsey
fe3627ddfd fix display problem caused by backwards comparisons of column and
start_col


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2199 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-24 17:52:17 +00:00
David Lawrence Ramsey
61a71403f4 revert last change, as it's actually redundant, and fix a few comments
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2198 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-24 15:45:36 +00:00
David Lawrence Ramsey
7ddca3a9a6 fix if block
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2197 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-24 15:23:10 +00:00
David Lawrence Ramsey
1903ace275 fix statusbar() and onekey() to properly handle multibyte strings too
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2196 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-24 00:43:41 +00:00
David Lawrence Ramsey
93c4a5656b #ifdef fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2195 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-23 21:32:27 +00:00
David Lawrence Ramsey
9ec76e5573 remove command line and rcfile option for --noutf8, as UTF-8 support is
now autodetected, and add #ifdefs around two variables that are unused
when NANO_WIDE isn't defined


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2194 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-23 19:55:57 +00:00
David Lawrence Ramsey
fc693210d5 more steps toward UTF-8 support: port all the parts of DB's UTF-8 patch
that I currently understand to current CVS, with modifications of mine
to autodetect UTF-8 support and to display multibyte strings instead of
wide strings


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2193 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-23 17:43:27 +00:00
David Lawrence Ramsey
c0b9d19ed7 yet another cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2192 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-22 21:38:43 +00:00
David Lawrence Ramsey
415b5d91cf fix misplaced #ifdef
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2191 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-21 16:39:45 +00:00
David Lawrence Ramsey
3ba9c3512c check for wget_wch() instead of addwstr() when looking for a wide
version of curses


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2190 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-20 15:39:12 +00:00
David Lawrence Ramsey
f3bea022d6 revert erroneous change
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2189 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-20 01:18:49 +00:00
David Lawrence Ramsey
6a2f068c7f still more cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2188 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-20 01:13:55 +00:00
David Lawrence Ramsey
e750fe68cf another cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2187 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-18 22:43:23 +00:00
David Lawrence Ramsey
4564170c61 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2186 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-18 20:29:42 +00:00
Jordi Mallach
6eea1473b4 Updated Italian translation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2185 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-15 19:42:07 +00:00
Jordi Mallach
fbba5bf249 Updated Swedish translation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2184 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-15 09:06:30 +00:00
Jordi Mallach
6a2f58e2ef Updated Swedish translation by Christian Rose.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2183 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-13 17:29:42 +00:00
David Lawrence Ramsey
78ea5e4a8a improvements to wide/multibyte character input and output, using wide
curses functions where applicable


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2182 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-12 19:04:56 +00:00
David Lawrence Ramsey
164bf36ea8 add missing reset
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2181 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-09 17:00:15 +00:00
David Lawrence Ramsey
c2ac02ff46 add missing casts
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2180 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-09 03:05:45 +00:00
David Lawrence Ramsey
abc9423709 check for nulls and newlines earlier in do_output(), and add a few more
cosmetic fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2179 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-08 23:24:31 +00:00
David Lawrence Ramsey
60448895f6 reset the mbtowc() and wctomb() state machines at the right places
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2178 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-08 16:52:52 +00:00
David Lawrence Ramsey
263240c7c7 when adding to the keystroke buffer, filter out bad keystrokes with one
pass instead of two


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2177 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-08 15:47:38 +00:00
David Lawrence Ramsey
32085a88e8 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2176 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-08 04:00:26 +00:00
David Lawrence Ramsey
eae97caa83 go back to storing multibyte characters in non-dynamically allocated
arrays of MB_LEN_MAX length, as it's less complex


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2175 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-07 22:24:03 +00:00
David Lawrence Ramsey
43953bba6f store multibyte characters in dynamically allocated arrays of MB_CUR_MAX
length, and add a few comment fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2174 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-07 21:23:39 +00:00
David Lawrence Ramsey
91851f3e60 rename a few variables for consistency
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2173 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-07 21:22:48 +00:00
David Lawrence Ramsey
bed32a370b comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2172 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-07 18:05:38 +00:00
David Lawrence Ramsey
f812e4f7d9 rearrange a few variables
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2171 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-07 17:35:14 +00:00
David Lawrence Ramsey
10820de467 fix bad cast
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2168 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-07 05:02:21 +00:00
Jordi Mallach
98b61e3702 Italian and Romanian update.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2167 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-06 23:44:55 +00:00
David Lawrence Ramsey
95a0224820 miscellaneous fixes for the buffered inout and output routines and their
associated UTF-8 handling: have unget_input() filter out invalid wide
characters, put back the result of a word sequence instead of returning
it directly, don't erroneously filter out keystrokes if they're neither
extended keypad values nor ASCII characters, and add a few comment
tweaks


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2166 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-06 04:14:42 +00:00
David Lawrence Ramsey
eb711b034b formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2165 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-05 22:24:39 +00:00
David Lawrence Ramsey
bfcba16761 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2164 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-05 06:11:01 +00:00
David Lawrence Ramsey
2c70a4e608 document the last titlebar() change
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2163 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-05 06:03:46 +00:00
David Lawrence Ramsey
bce3aad885 in titlebar(), space should be an int instead of a size_t
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2162 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-05 06:02:39 +00:00
David Lawrence Ramsey
f326ed7910 add some miscellaneous fixes for titlebar()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2161 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-05 05:42:46 +00:00
David Lawrence Ramsey
846658eb6b when we get the whitespace display toggle, update the titlebar as well
as the edit window, in case the filename displayed on the titlebar
contains spaces or tabs; also add a few miscellaneous cosmetic fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2160 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-05 04:18:26 +00:00
David Lawrence Ramsey
c41285fb0b fix entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2159 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-04 21:09:35 +00:00
David Lawrence Ramsey
9c3edc026b add return to the "c-file" regexes in nanorc.sample
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2158 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-04 18:14:12 +00:00
David Lawrence Ramsey
7483571f7f massive overhaul to support buffered input and output, the first steps
toward proper wide character input and output, etc.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2157 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-04 17:41:52 +00:00
David Lawrence Ramsey
68ebb61fb1 fix potential segfault when doing a full justify
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2156 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-04 17:36:14 +00:00
David Lawrence Ramsey
fc54d6e431 per Jeremy Huddleston's patch, fix compilation problem caused by
break_line()'s returning int when it should return ssize_t according to
its prototype


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2155 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-02 17:37:09 +00:00
Jordi Mallach
c0e42bd3c5 Update Catalan, French and Norwegian from the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2154 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-01 16:31:29 +00:00
David Lawrence Ramsey
3ece0b9aeb change references to "open files" to "open file buffers" for
consistency, and add DB's changes to die() so that it works properly
with the overhauled multibuffer routines


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2153 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-01 15:11:27 +00:00
David Lawrence Ramsey
1483ee3db1 remove malfunctioning wide character support, and add a few
miscellaneous fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2152 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-29 00:30:07 +00:00
David Lawrence Ramsey
63e73cbd14 comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2151 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-28 04:52:57 +00:00
David Lawrence Ramsey
53d3db4ba6 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2150 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-28 03:53:01 +00:00
David Lawrence Ramsey
832db768a4 typo fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2149 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-27 23:28:39 +00:00
David Lawrence Ramsey
6ecbdd30b1 remove specific references to control key shortcuts in configure.ac
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2148 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-27 21:39:01 +00:00
David Lawrence Ramsey
40a6c8cb64 more formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2147 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-27 21:10:11 +00:00
David Lawrence Ramsey
800ee0d3f9 remove another unneeded blank space
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2146 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-27 20:42:46 +00:00
David Lawrence Ramsey
7a6fb48cf5 remove unneeded blank spaces
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2145 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-27 20:39:26 +00:00
David Lawrence Ramsey
62a217d35d formatting and cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2144 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-27 16:54:00 +00:00
David Lawrence Ramsey
c109549a7e in unget_kbinput(), free s after the wctomb() call, since we don't need
it after that


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2143 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-27 15:18:34 +00:00
David Lawrence Ramsey
15dbc6ef07 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2142 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-27 15:07:07 +00:00
David Lawrence Ramsey
c82997d460 in get_verbatim_kbinput(), don't pass v_kbinput in as a parameter, since
we're dynamically allocating it and then returning it


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2141 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-27 15:00:18 +00:00
David Lawrence Ramsey
08eab72517 add debug messages to get_shortcut() and get_toggle()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2140 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-27 06:43:06 +00:00
David Lawrence Ramsey
e08765dca5 formatting and cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2139 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-26 20:17:49 +00:00
David Lawrence Ramsey
ca018c3e23 in get_full_path(), remove unneeded NANO_SMALL #ifdef, so that it's
included whenever its prototype is, and so it can compile when
DISABLE_OPERATINGDIR isn't defined and NANO_SMALL is


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2138 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-26 20:14:19 +00:00
David Lawrence Ramsey
2dbcc801bf formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2137 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-26 18:10:07 +00:00
David Lawrence Ramsey
698263ca5c in the low-level input routines, make the ascii_digits variables ints
instead of size_t's, since they will only hold very small values


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2136 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-25 05:05:41 +00:00
David Lawrence Ramsey
12642edfc9 formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2135 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-25 04:56:50 +00:00
David Lawrence Ramsey
5b3dd0f423 add DB's overhaul of the multibuffer code for efficiency, plus a few
tweaks and additions of mine


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2134 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-25 04:39:07 +00:00
David Lawrence Ramsey
329d6a3259 formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2133 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-24 23:46:04 +00:00
David Lawrence Ramsey
8a2c0ba4b6 formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2132 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-24 20:36:36 +00:00
David Lawrence Ramsey
eeec999548 oops again; adding an extra magicline unconditionally when uncutting is
inconsistent with how file insertion behaves, so it apparently is a bug;
revert the previous behavior


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2131 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-24 20:12:57 +00:00
David Lawrence Ramsey
cc89513f14 oops; Pico's adding a new magicline unconditionally when uncutting
leaves the cursor on the current magicline is actually consistent (and
hence not a bug), so duplicate that behavior again


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2130 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-23 23:42:12 +00:00
David Lawrence Ramsey
6e738ac712 formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2129 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-23 22:30:32 +00:00
David Lawrence Ramsey
d994ad5284 in get_edit_input(), readd parameter allow_funcs, as it's now needed as
a workaround for when unjustified text is stored in the justify buffer
and either the justify or the full justify shortcut is hit


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2128 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-23 21:40:26 +00:00
David Lawrence Ramsey
304129315c in shortcut_init(), fix misplaced #endif keeping the "Full Justify"
shortcut in the search shortcut list from being included when NANO_SMALL
is defined but DISABLE_JUSTIFY isn't


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2127 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-23 20:42:35 +00:00
David Lawrence Ramsey
4d6ec37676 in do_cut_text(), if keep_cutbuffer is FALSE, only blow away the text in
the cutbuffer if the cutbuffer isn't empty


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2126 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-23 17:59:32 +00:00
David Lawrence Ramsey
bc3b92605e comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2125 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-23 04:17:19 +00:00
David Lawrence Ramsey
93c8405bfa overhaul the cutting and uncutting routines and the justify-related
routines to back up and restore unjustified text to use the partitioning
code, as it greatly simplifies how they work; also back up and restore
unjustified text in its own buffer instead of the cutbuffer, and add a
few minor bug fixes to the overhauled routines


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2124 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-23 04:08:28 +00:00
David Lawrence Ramsey
b5a7a5a2d6 in do_wrap(), make wrap_loc and word_back ssize_t's, to match fill, and
add a few minor cosmetic fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2123 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-23 03:42:43 +00:00
David Lawrence Ramsey
962202e4fa Back to CVS
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2122 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-22 17:58:06 +00:00
David Lawrence Ramsey
2c86dc6dc9 GNU nano 1.3.5
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2120 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-22 17:55:17 +00:00
David Lawrence Ramsey
3de81bc33d in do_replace_loop(), treat real_current as current and real_current_x
as current_x instead of using copies of them (which aren't kept up to
date) when calling findnextstr(); this fixes a problem where the search
can wrap when it shouldn't and skip over all matches after the wrap
point


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2119 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-22 17:08:41 +00:00
David Lawrence Ramsey
3f35864b10 fix get_totals() so it properly handles NULL parameters, and restore
totlines after marked spell-check the way the justify routine does
instead of saving it and readding it later


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2118 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-22 16:04:18 +00:00
David Lawrence Ramsey
74d87073f0 unpartition_filestruct() should take a partition** instead of a
partition*, so that the partition it refers to is properly set to NULL


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2117 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-22 00:16:23 +00:00
David Lawrence Ramsey
e56d936bd4 documentation fix: list sh as an example of a Bourne shell
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2116 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-21 18:51:30 +00:00
David Lawrence Ramsey
831c640e62 in README.CVS, mention the need for ssh to do cvs checkouts
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2115 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-21 18:44:23 +00:00
David Lawrence Ramsey
b908a36d60 add another cvs command fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2114 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-21 17:50:23 +00:00
David Lawrence Ramsey
b75763e07e update the given cvs commands in README.CVS so that they work again
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2113 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-21 17:45:25 +00:00
David Lawrence Ramsey
188f169e1d in README.CVS, mention the requirement for groff in order to create html
versions of the manpages


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2112 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-20 16:16:47 +00:00
Jordi Mallach
c0d3b20bdc Get rid of config.rpath.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2111 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-20 00:39:02 +00:00
Jordi Mallach
42ca620e11 Updated French translation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2110 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-18 22:25:16 +00:00
Jordi Mallach
69a90c6b3b Updated Malay translation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2109 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-18 22:13:47 +00:00
Jordi Mallach
d7b632560c Don't use DEFS to define stuff. Use INCLUDES instead.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2108 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-18 00:05:14 +00:00
Jordi Mallach
55381aa614 Include <config.h> only if HAVE_CONFIG_H.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2107 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-17 23:17:05 +00:00
David Lawrence Ramsey
f6159047bc use top_x and bot_x where possible instead of recalculating entire
string lengths


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2106 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-17 20:47:14 +00:00
David Lawrence Ramsey
4db3d0adf7 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2105 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-17 17:44:29 +00:00
David Lawrence Ramsey
6b769e5f5b formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2104 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-17 16:59:34 +00:00
David Lawrence Ramsey
0317c86a8a fix breakage of ASCII character sequence mode introduced with the UTF-8
sequence support


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2103 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-16 22:51:07 +00:00
David Lawrence Ramsey
a98fd75b32 spell Ulf Härnhammar's name right
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2102 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-16 13:09:43 +00:00
David Lawrence Ramsey
8091d334a3 add Ulf Harnhammar's input_tab() segfault fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2101 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-16 02:23:10 +00:00
David Lawrence Ramsey
9df069cc5f comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2100 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-16 02:20:48 +00:00
David Lawrence Ramsey
97b9046239 document the last fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2099 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-15 23:10:56 +00:00
David Lawrence Ramsey
036a3d4646 fix cursor placement problem when inserting into the current buffer at
the bottom of the edit window with smooth scrolling on


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2098 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-15 21:49:21 +00:00
David Lawrence Ramsey
4a3879f1ed fix cursor placement problem when inserting into the current buffer at
the top of the edit window


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2097 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-15 20:42:31 +00:00
David Lawrence Ramsey
56cf034a12 comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2096 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-15 18:44:30 +00:00
David Lawrence Ramsey
649b431171 in cut_marked_segment(), respect concatenate_cut, as we need to use it
if we do a marked cut and immediately follow it with a cut-to-end (which
uses that function)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2095 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-13 01:32:17 +00:00
David Lawrence Ramsey
bfb98f8bd4 in do_cut_text(), set concatenate_cut to TRUE unconditionally when doing
a marked cut; this fixes an incompatibility with Pico where an extra
line is uncut if we do a marked cut that includes the magicline and
immediately follow it with an unmarked cut


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2094 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-12 21:46:14 +00:00
David Lawrence Ramsey
8001e27e67 yet more cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2093 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-12 00:48:18 +00:00
David Lawrence Ramsey
907725fde8 revert the handle_sigwinch() change, as other breakage occurs when
resizing or continuing from a suspend after a justify and it can't be
properly fixed without a rewrite


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2092 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-12 00:09:20 +00:00
David Lawrence Ramsey
8781fc62cb fix entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2091 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-11 22:02:48 +00:00
David Lawrence Ramsey
1f1ebb85b7 in handle_sigwinch(), call shortcut_init(FALSE) defore redisplaying the
main list, so that "UnJustify" isn't erroneously displayed when we
justify, suspend, and then continue; also add a few last cosmetic fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2090 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-11 21:50:01 +00:00
David Lawrence Ramsey
e3016d90aa in m4/Makefile.am, add glib-2.0.m4 to EXTRA_DIST, so that nano builds
from CVS with automake 1.7.x again; for some reason, automake 1.9.x
didn't have a problem with its (erroneously) being left out; also add
some formatting fixes to other Makefile.am's dealing with too many or
too few blank lines


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2089 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-11 14:35:31 +00:00
David Lawrence Ramsey
6299b0d752 improve another assertion
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2088 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-08 03:22:23 +00:00
David Lawrence Ramsey
2c31540fa9 improve assertion
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2087 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-08 03:19:10 +00:00
David Lawrence Ramsey
fd9da07e6c fix enum/#define conflict
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2086 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-07 23:05:48 +00:00
David Lawrence Ramsey
fdd3becc1e allow blank buffers at the "Execute Command" prompt, and document it in
the help text


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2085 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-07 21:30:55 +00:00
David Lawrence Ramsey
c136f75f62 don't create a new buffer if we're in multibuffer mode and command
execution mode


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2084 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-07 18:35:53 +00:00
David Lawrence Ramsey
a084ad94f7 in multibuffer mode, using a blank filename at the "Read File" prompt
shouldn't cancel out of it


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2083 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-07 18:22:33 +00:00
David Lawrence Ramsey
c15802f8c3 partition the filestruct properly when executing a command
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2082 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-07 18:09:41 +00:00
David Lawrence Ramsey
7105cf4f8e formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2081 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-07 16:13:19 +00:00
David Lawrence Ramsey
02085d7b92 in the search prompt shortcut list, move "Full Justify" to after
"History", so that the latter is visible onscreen again


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2080 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-07 16:04:18 +00:00
David Lawrence Ramsey
50af6ea21e in proto.h, add missing NANO_SMALL #ifdef around the
cut_marked_segment() prototype


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2079 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-07 15:29:40 +00:00
David Lawrence Ramsey
8ae06a86b8 comment update
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2078 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-07 01:26:39 +00:00
David Lawrence Ramsey
29f446ec40 don't let remove_magicline() remove the magicline if it's the only line
in the file


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2077 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-07 01:22:20 +00:00
David Lawrence Ramsey
eb5d8383c8 preemptively update the version number in the documentation
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2076 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-06 21:26:09 +00:00
David Lawrence Ramsey
00cca05ebb in do_uncut_text(), maintain current_y's value when uncutting blocks so
that smooth scrolling works correctly; also add a few miscellaneous
cleanups


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2075 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-06 20:33:43 +00:00
David Lawrence Ramsey
8c16bacbbf more int -> bool conversions
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2074 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-06 15:10:57 +00:00
David Lawrence Ramsey
bde3e0e294 in both the internal and alternate spell checker, put the beginning and
the end of the mark at the beginning and the end of the spell-checked
text


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2073 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-06 02:37:25 +00:00
David Lawrence Ramsey
cb09337993 rearrange a few if blocks for consistency
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2072 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-06 00:18:27 +00:00
David Lawrence Ramsey
46c604a14e oops; only work around the problem of the mark's being in the middle of
a spell checked word if the mark was on in the first place


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2071 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 23:55:58 +00:00
David Lawrence Ramsey
90e59c1a18 when doing marked spell-check, properly handle the case where the mark
ends in the middle of a word and that word is spell-checked; also move
the logic to detect an upside-down mark to mark_order() instead of using
the same logic in three different places, and rename a few variables for
consistency


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2070 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 23:03:03 +00:00
David Lawrence Ramsey
93eb293fbb more faq updates: add questions about selecting text in an X terminal
when mouse support is turned on and typing F13-F16 when the keyboard
only has F1-F12, plus a few other miscellaneous bits


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2069 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 18:01:33 +00:00
David Lawrence Ramsey
d5402232ac document the last update
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2068 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 17:29:43 +00:00
David Lawrence Ramsey
0432e70850 fixed FAQ inaccuracy: Pico compatibility mode was made the default in
nano 1.1.99pre1, not 1.2.2


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2067 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 17:09:11 +00:00
David Lawrence Ramsey
78d644a635 don't change the file format when we insert another file into the
current one


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2066 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 16:24:35 +00:00
David Lawrence Ramsey
1c293d2e28 comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2065 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 16:22:27 +00:00
David Lawrence Ramsey
31f99361b6 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2064 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 16:01:04 +00:00
David Lawrence Ramsey
3d67c11473 fix entry: "... opened the file, added all of it to the cutbuffer,
closed the file, and uncut at the current cursor position" is clearer


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2063 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 15:39:36 +00:00
David Lawrence Ramsey
b73c0c0b09 if we're not inserting a file into a new buffer, partition the current
buffer so that it's effectively a new buffer just before inserting the
file, and only restore placewewant afterwards; this is the same behavior
we would get if we opened the file, added all of it to the cutbuffer,
uncut at the current cursor position, and closed the file


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2062 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 15:25:53 +00:00
David Lawrence Ramsey
1539837fe0 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2061 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 15:03:12 +00:00
David Lawrence Ramsey
dcc201b5b2 clean up the partitioning-related if blocks
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2060 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-05 14:37:18 +00:00
David Lawrence Ramsey
f643fc2149 remove a bit of redundant code, and add a few more comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2059 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-04 17:42:41 +00:00
David Lawrence Ramsey
f978f040bd when (un)partitioning, don't save or restore fileage or filebot if
they're the same as top or bot; also add a few comment fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2058 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-04 16:45:48 +00:00
David Lawrence Ramsey
8cbd4cb67f avoid potential segfaults while unpartitioning a filestruct
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2057 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-04 15:31:43 +00:00
David Lawrence Ramsey
07e2589f80 in cut.c, make marked_line a static enum instead of a static int, and
add a few formatting cleanups


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2056 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-04 13:47:28 +00:00
David Lawrence Ramsey
be246c008b fix entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2055 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-04 13:40:58 +00:00
David Lawrence Ramsey
3e0c8a614d remove the DOS_FILE and MAC_FILE flags, as they're only used in files.c,
and replace them with a static file_format enum; change the
openfilestruct structure accordingly in order to handle this; also add a
few miscellaneous cleanups


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2054 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-04 04:08:18 +00:00
David Lawrence Ramsey
84d0d59cbb remove most redundant includes of sys/stat.h; it's included in nano.h,
so it doesn't need to be included in files that include nano.h


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2053 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-04 03:53:11 +00:00
David Lawrence Ramsey
164c79883b remove unneeded space
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2052 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-04 03:27:48 +00:00
David Lawrence Ramsey
e1ee22fba2 in search_init(), when we're replacing and the mark is on, display a
prompt indicating that we're replacing text only in the selection
instead of the usual prompt


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2051 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-03 23:05:11 +00:00
David Lawrence Ramsey
40bdb686aa add code to partition a filestruct between a set of arbitrary
coordinates; given the coordinates of the beginning and end of the mark,
this allows proper and easier handling of saving marked selections,
replacing text only in marked selections, and spell-checking marked
selections using either the internal or alternate spell checker; do all
these using a global partition structure


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2050 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-03 22:03:41 +00:00
David Lawrence Ramsey
29f03dcff9 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2049 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-03 21:11:38 +00:00
David Lawrence Ramsey
182b2c936f in do_replace_loop(), make real_current_x a const filestruct* again
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2048 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-03 16:02:41 +00:00
David Lawrence Ramsey
6d9aa085d1 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2047 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-03 14:58:04 +00:00
David Lawrence Ramsey
99869f54b5 fix crash in mallocstrncpy() call
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2046 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-02 20:48:37 +00:00
David Lawrence Ramsey
4a1fc558cf add new function mallocstrncpy()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2045 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-02 15:18:30 +00:00
David Lawrence Ramsey
1e1f572c51 in get_kbinput(), make sure meta_key and func_key are set properly in
all cases


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2044 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-02 02:48:02 +00:00
David Lawrence Ramsey
4b4b608806 leave "Mark Text" and "Where Is Next" out entirely when NANO_SMALL is
defined; since they aren't in the visible main list, there's no point in
having them in but disabled; also add a few formatting fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2043 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-01 22:54:40 +00:00
David Lawrence Ramsey
8381fdd83a add new key aliases: F15 for "Mark Text" and F16 for "Where Is Next";
also add support for their corresponding escape sequences


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2042 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-01 22:40:02 +00:00
David Lawrence Ramsey
d402e71a2f document the help browser display fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2041 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-01 22:37:36 +00:00
David Lawrence Ramsey
2e83a50e95 properly handle the case of a function key with no preceding control key
in the help browser


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2040 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-11-01 22:35:26 +00:00
David Lawrence Ramsey
3d002ed602 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2039 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-31 22:45:24 +00:00
David Lawrence Ramsey
add65085d6 add missing attribution
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2038 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-31 14:40:40 +00:00
David Lawrence Ramsey
e5e88fd9f2 fix problem found by Rocco: make search_last_line static to search.c
instead of local to findnextstr() so that search wrapping detection
works properly again


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2037 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-31 13:20:30 +00:00
David Lawrence Ramsey
85f8f46c40 remove erroneous entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2036 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-31 13:13:19 +00:00
David Lawrence Ramsey
687776b1a8 make mark_beginx a size_t instead of an int
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2035 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-30 01:16:08 +00:00
David Lawrence Ramsey
7a97e18667 make current_x a size_t instead of an int
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2034 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-30 01:03:15 +00:00
David Lawrence Ramsey
59f5e04fa8 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2033 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-29 15:48:40 +00:00
David Lawrence Ramsey
ace1037faf cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2032 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-29 15:42:02 +00:00
David Lawrence Ramsey
77b284af68 revert the marked replace code; it's hackish, and there appears to be no
easy way to make it work with the internal spell checker as is; it
should eventually be reimplemented to work at the findnextstr() level


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2031 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-27 02:21:01 +00:00
David Lawrence Ramsey
233f336112 add missing blank line
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2030 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-27 02:15:44 +00:00
David Lawrence Ramsey
d4ca9f2acb cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2029 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-26 21:14:56 +00:00
David Lawrence Ramsey
9bf486fe5d in do_replace_loop(), add new parameter canceled, set to TRUE if we
canceled at the prompt and FALSE otherwise; use it to make sure that
canceling works properly in all cases when using the internal spell
checker


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2028 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-26 20:58:30 +00:00
David Lawrence Ramsey
410efe9a47 add Rocco Corsi's patch to fix a problem in do_int_spell_fix() where if
the cursor is in the middle of a file, the spell checker will sometimes
only correct the misspelled word instances that appear before the cursor
position and then stop


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2027 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-26 16:54:19 +00:00
David Lawrence Ramsey
1758640682 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2026 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-26 16:29:21 +00:00
David Lawrence Ramsey
0ff01a92bc put DB's old efficiency tweaks back in bottombars()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2025 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-25 15:00:38 +00:00
David Lawrence Ramsey
cc823ab6d6 cosmetic fix: "Hurd console" -> "Mach console"
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2024 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-24 22:51:39 +00:00
David Lawrence Ramsey
cfa4a9c4fe remove the global DOS/Mac format toggles, for consistency with other
file operations like Append/Prepend that are specific to the "Write
File" prompt, and change the Mac format toggle to Meta-M, since that no
longer conflicts with the mouse support toggle; update the documentation
accordingly


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2023 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-24 17:20:31 +00:00
David Lawrence Ramsey
e93e03e1dc in nano.1 and nano.texi, eliminate references to the now removed
-D/--dos and -M/--mac command line options


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2022 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-24 16:47:54 +00:00
David Lawrence Ramsey
c151b475e7 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2021 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-24 16:45:40 +00:00
David Lawrence Ramsey
da952f8ded consistency fix for the ^^ help entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2020 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-24 16:18:17 +00:00
David Lawrence Ramsey
2690bafa15 add missing parentheses
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2019 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-23 14:59:32 +00:00
David Lawrence Ramsey
e7c4168ee1 consistency fix for the ^I help entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2018 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-23 14:53:07 +00:00
David Lawrence Ramsey
9abd1d18e4 simplify the key-interpreting logic in get_shortcut()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2017 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-23 13:50:57 +00:00
David Lawrence Ramsey
7975408f66 fix wrong word
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2016 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-23 02:48:13 +00:00
David Lawrence Ramsey
c59979f067 add UTF-8 support to unget_kbinput(), and fix a minor memory leak in the
UTF-8 support code in get_kbinput()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2015 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-23 02:47:39 +00:00
David Lawrence Ramsey
bf1346f342 in main(), tweak the command line parsing routine so that multiple +LINE
flags are properly interpreted in multibuffer mode


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2014 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-22 20:25:56 +00:00
David Lawrence Ramsey
6a715b69a7 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2013 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-22 16:11:55 +00:00
David Lawrence Ramsey
ca92becf9d apply patch from DB: in write_file(), if we've tried to write to an
unwritable file and we're not prepending, tempname is NULL when it's
passed to unlink(); this can cause problems if unlink() can't handle
NULL, so don't call it in that case


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2012 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-22 03:33:54 +00:00
David Lawrence Ramsey
2c4e34cfce another indentation fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2011 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-22 03:30:39 +00:00
David Lawrence Ramsey
d9fb3e6bde remove more unneeded casts, and add an indentation fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2010 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-21 22:49:51 +00:00
David Lawrence Ramsey
1601c28976 remove unnecessary casts
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2009 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-21 22:06:40 +00:00
David Lawrence Ramsey
fe65657f6f in nanorc.sample, change the included speller value to "aspell -x -c";
the -x option makes aspell not create backup files, and this is
consistent with the internal spell checker's behavior


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2008 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-21 17:11:40 +00:00
David Lawrence Ramsey
484352241e in do_replace_loop(), check for more than one wrap at the right place
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2007 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-21 16:51:45 +00:00
David Lawrence Ramsey
2eb745939e when saving or changing file positions, be sure not to ignore
placewewant; also move a misplaced changelog entry


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2006 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-21 16:25:44 +00:00
David Lawrence Ramsey
3288925efb do the check for being outside the mark after the zero-length regexes
check, so that zero-length regex replaces work properly again


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2005 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-21 15:44:36 +00:00
David Lawrence Ramsey
9819ed031b fix infinite loop when we're doing a replace of marked text and the only
matches found are outside the marked text


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2004 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-21 15:32:11 +00:00
David Lawrence Ramsey
27fbc69ec4 yet more search code cleanups
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2003 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-19 21:09:37 +00:00
David Lawrence Ramsey
53752e8f9a fix findnextstr() so wholewords works properly with regular expressions
and in conjunction with no_sameline, and add a few other minor cosmetic
fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2002 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-18 22:19:22 +00:00
David Lawrence Ramsey
b802e70208 add glib-2.0.m4 from glib 2.4.7 to the m4 directory; this is needed to
detect glib 2.x on systems that may not have it installed


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2001 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-18 19:28:10 +00:00
David Lawrence Ramsey
db85ac7564 rely on glib 2.x only if the system doesn't have v?snprintf(), and
update README.CVS accordingly


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2000 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-18 14:13:28 +00:00
David Lawrence Ramsey
cbc13a2a62 add missing line
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1999 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-18 02:17:18 +00:00
David Lawrence Ramsey
c6899cb734 document the last miscellaneous fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1998 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-18 02:11:46 +00:00
David Lawrence Ramsey
2cc2a57dea rearrange the mark-handling code in do_replace_loop() a bit, and add one
more miscellaneous fix


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1997 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-18 02:06:53 +00:00
David Lawrence Ramsey
381d483986 help text updates, and a few more miscellaneous fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1996 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-18 01:51:43 +00:00
David Lawrence Ramsey
6be5339265 more minor cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1995 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-16 15:41:57 +00:00
David Lawrence Ramsey
439fbe3e93 in do_alt_speller(), call terminal_init() unconditionally after running
the alternate spell checker, so that the terminal state is properly
restored in all cases


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1994 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-16 04:56:34 +00:00
David Lawrence Ramsey
9cf7b28248 another minor cleanup
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1993 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-15 16:35:34 +00:00
David Lawrence Ramsey
4b7e3c3efa minor cleanups
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1992 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-15 16:25:56 +00:00
David Lawrence Ramsey
fc965a4869 make the UTF-8 character reading support work in more instances
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1991 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-15 01:51:36 +00:00
David Lawrence Ramsey
1f204c0204 fix spurious warning message in do_gotoline() that was introduced when
it was overhauled, and also fix some indentation in statusq()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1990 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-15 01:39:46 +00:00
David Lawrence Ramsey
4e8e495301 add support for reading in UTF-8 sequences to some of the low-level
input functions


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1989 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-14 21:59:45 +00:00
David Lawrence Ramsey
a870ca2d72 simplify the curses library tests in configure.ac by checking for
initscr() instead of tgetent() where possible


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1988 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-14 21:59:00 +00:00
David Lawrence Ramsey
5780b24759 make get_escape_seq_kbinput()'s escape_seq parameter a const int*, since
it's never modified


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1987 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-14 20:48:38 +00:00
David Lawrence Ramsey
e53181d423 remove resetstatuspos prototype left over from when it was global
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1986 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-14 20:36:47 +00:00
David Lawrence Ramsey
646bf9111c add missing word
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1985 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-11 14:00:46 +00:00
David Lawrence Ramsey
49d5c1bf1c minor fixes involving case insensitive searches and NANO_SMALL
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1984 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-11 13:55:33 +00:00
David Lawrence Ramsey
731e7f28e7 oops, Pico doesn't preserve placewewant when inserting a file; we do it
for consistency


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1983 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-09 20:16:17 +00:00
David Lawrence Ramsey
1929982ec3 in do_insertfile(), when inserting a file in non-multibuffer mode,
preserve placewewant as well as current_x, for compatibility with Pico


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1982 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-09 20:12:04 +00:00
David Lawrence Ramsey
b6377c9d14 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1981 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-09 20:10:55 +00:00
David Lawrence Ramsey
b112fe627d fix backwards #ifdefs
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1980 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-09 17:15:46 +00:00
David Lawrence Ramsey
d93ee682c0 in do_int_spell_fix(), move the REVERSE_SEARCH flag toggling into the
NANO_SMALL #ifdef, since the tiny version of nano doesn't support
reverse searching; also, turn the USE_REGEXP flag off during spell
checking in order to avoid a potential segfault


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1979 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-09 16:59:43 +00:00
David Lawrence Ramsey
3497666a21 in do_replace_loop(), if the mark is on when we start, skip over all
matches not found inside the marked text; this makes marked spell
checking when using the internal spell checker work as expected, and
also allows replacing only marked text when the mark is on


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1978 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-09 16:26:32 +00:00
David Lawrence Ramsey
491cad3e5d miscellaneous cleanups in do_replace_loop(): set current to real_current
and current_x to current_x_save, only turn the mark off and call
edit_refresh() if the mark was originally on, and make length_change a
ssize_t


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1977 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-08 23:06:01 +00:00
David Lawrence Ramsey
f3b10e8e05 another comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1976 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-08 20:37:44 +00:00
David Lawrence Ramsey
6b1c2adc86 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1975 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-08 20:34:53 +00:00
David Lawrence Ramsey
7cfea8bb8c in mark_order(), add check for MARK_ISSET's not being set; also make one
more int -> bool conversion and cosmetic fix


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1974 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-08 15:35:33 +00:00
David Lawrence Ramsey
28caf14863 remove the -D/--dos and -M/--mac command line options, as they aren't
much use with the new file format autodetection


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1973 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-07 20:54:52 +00:00
Jordi Mallach
211dc82738 Update Basque translation by Mikel Olasagasti.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1972 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-07 17:36:56 +00:00
David Lawrence Ramsey
b6d97c15ac remove DOS line endings, and fix a typo in a comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1971 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-06 21:11:21 +00:00
David Lawrence Ramsey
487149e713 in do_insertfile(), add missing #ifdefs around the wrap_reset() call so
that nano compiles with wrapping disabled again


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1970 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-05 20:24:48 +00:00
David Lawrence Ramsey
045883aa34 really fix the resetstatus problems this time, and add a few other
miscellaneous fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1969 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-05 20:11:31 +00:00
David Lawrence Ramsey
056c5ef4a6 another int -> bool conversion
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1968 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-05 16:14:19 +00:00
David Lawrence Ramsey
b49daec3f2 in do_insertfile(), if file browsing succeeds, copy the filename we
browsed to into ans, put back Enter, and show the prompt one last time
so that it's exited properly and the cursor position at the statusbar is
reset


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1967 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-05 02:46:24 +00:00
David Lawrence Ramsey
4dd723a095 make resetstatuspos static to just statusq()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1966 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-05 02:29:52 +00:00
David Lawrence Ramsey
d532f197b0 add parameter use_answer to search_init(); when it's TRUE, only set
backupstring to answer, so that we can preserve the text of the
statusbar when switching to the search prompt from the "Go To Line"
prompt; also, set backupstring before doing anything else, add one minor
efficiency tweak, and preserve the text of the statusbar no matter what
when switching from the search prompt to the "Go To Line" prompt, since
the toggling works both ways now and non-numeric text shouldn't be lost
when going only one of those ways


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1965 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-04 22:37:56 +00:00
David Lawrence Ramsey
e663dcd6aa comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1964 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-04 22:35:43 +00:00
David Lawrence Ramsey
4c9e8f4211 remove redundancy erroneously introduced when adding the ^T toggle to
the "Go To Line" prompt


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1963 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-04 16:01:37 +00:00
David Lawrence Ramsey
77e02a3e74 add another cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1962 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-04 15:53:40 +00:00
David Lawrence Ramsey
951d7148d1 add minor cosmetic fixes, and do another int -> bool conversion
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1961 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-04 15:23:47 +00:00
David Lawrence Ramsey
f1c395da79 remove stray dash
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1960 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-03 19:26:13 +00:00
David Lawrence Ramsey
3e189a8b9c in open_(prev|next)_file(), translate the "New Buffer" string when
displaying "Switched to" messages on the statusbar; also do a few more
int -> bool conversions


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1959 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-03 19:18:48 +00:00
David Lawrence Ramsey
7c1f17ab6d 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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1958 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-03 13:47:26 +00:00
David Lawrence Ramsey
360191c434 consistency fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1957 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-01 21:37:36 +00:00
David Lawrence Ramsey
ca744153fd add missing blank line
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1956 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-01 18:47:17 +00:00
David Lawrence Ramsey
be908f6992 for consistency, make do_insertfile() take a parameter to indicate
whether it's in "Execute Command" mode; also add continue and goto to
the "c-file" regexes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1955 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-10-01 18:34:30 +00:00
David Lawrence Ramsey
e5d8f32834 add a bunch of key-related fixes: put Meta-( (Meta-9), Meta-) (Meta-0),
and Meta-J back in the shortcut list since Meta-G is used in the file
browser and not as a toggle, tweak nanogetstr() and statusq() so that
resetstatuspos can be reduced to a static bool, change the names of some
keys to be more consistent, and add the ^R^X^X and ^W^T^T shortcuts
(note that the latter doesn't preserve the contents of the statusbar yet
when ^T is pressed at the "Go To Line" prompt), and add a few other
miscellaneous tweaks


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1954 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-30 22:07:21 +00:00
David Lawrence Ramsey
47e82b1752 fix #ifdef breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1953 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-28 22:21:46 +00:00
David Lawrence Ramsey
04a8d1c040 add a multibuffer mode toggle to the "Execute Command" prompt, for
consistency with the "Read File" prompt


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1952 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-28 22:14:58 +00:00
David Lawrence Ramsey
03225330dc simplify do_insertfile() by reusing variables where possible
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1951 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-28 20:50:50 +00:00
David Lawrence Ramsey
25884f3bdb more int -> bool conversions
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1950 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-28 20:37:03 +00:00
David Lawrence Ramsey
9bab9ff5b4 consistency fix: the convention for shortcuts lists other than the main
list is apparently to only allow meta shortcuts as toggles, so only
allow the meta shortcuts for searching for the beginning and end of the
paragraph and justifying the entire file to go in the main list


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1949 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-28 16:51:08 +00:00
David Lawrence Ramsey
670a56c241 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1948 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-28 16:03:03 +00:00
David Lawrence Ramsey
9b6e476a46 resetstatuspos should be a bool, not an int
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1947 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-28 15:58:56 +00:00
David Lawrence Ramsey
1e7297116b in shortcut_init(), change an erroneous _() around the "New Buffer"
string to N_()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1946 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-28 15:17:47 +00:00
David Lawrence Ramsey
b77ec62cde for consistency, at the "Go To Line" prompt, display "Cancelled" instead
of "Aborted" if we cancel


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1945 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-28 15:06:15 +00:00
David Lawrence Ramsey
45f971d69b add missing func_key reference
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1944 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-27 01:10:48 +00:00
David Lawrence Ramsey
eb16f43cf9 add a func_key flag to the low-level input functions and the currently
existing high-level input functions, to indicate extended keypad values


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1943 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-27 01:04:50 +00:00
David Lawrence Ramsey
72d8e54f6e refresh the screen when Ctrl-L is pressed at the statusbar prompt, as
Pico does


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1942 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-25 00:45:07 +00:00
David Lawrence Ramsey
09b34ed34e cosmetic comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1941 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-24 21:48:40 +00:00
David Lawrence Ramsey
f3ca80e11d remove redundant include of limits.h from nano.c
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1940 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-23 21:52:58 +00:00
David Lawrence Ramsey
013344c4c5 turn off extended input processing (the IEXTEN termios flag) as nano
1.2.x does


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1939 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-22 22:45:08 +00:00
David Lawrence Ramsey
d08348b99c make some ints that use the value of fill and can be greater than COLS
ssize_t's for consistency, and add a few minor cosmetic fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1938 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-18 22:02:21 +00:00
David Lawrence Ramsey
e6ef8b9bb9 revert the blocking of meta sequences in main(), as it doesn't solve the
problem of meta sequences' sometimes being interpreted as printable
characters when they shouldn't be


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1937 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-12 22:01:38 +00:00
David Lawrence Ramsey
807657b0fe document keeping meta sequences from getting through to do_char() in the
changelog, and update a related comment


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1936 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-12 21:40:04 +00:00
David Lawrence Ramsey
f887298c6e don't let meta sequences get through to do_char()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1935 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-12 21:30:36 +00:00
David Lawrence Ramsey
db6015c7d7 make the help menu shortcut display more flexible, add more intuitive
aliases for moving to the beginning and end of a paragraph and
justifying the entire file, and make those aliases available in the main
shortcut list too, since Pico's practice of putting them in the search
menu is rather odd


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1934 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-11 21:41:13 +00:00
David Lawrence Ramsey
fd73c462f4 for more compatibility with Pico, remove extra space after a character
in punct if that character is the same as the one before it


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1933 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-11 21:28:36 +00:00
Jordi Mallach
12d5b2f6bd Updated manpages by Jean-Philippe.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1932 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-10 22:18:53 +00:00
David Lawrence Ramsey
c7ca28a6ba make get_edit_input() respect view mode, and clarify its changelog entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1931 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-07 21:51:49 +00:00
David Lawrence Ramsey
6ccf0e2386 minor cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1930 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-07 15:45:14 +00:00
David Lawrence Ramsey
1a5c4c691c when calling AC_TRY_RUN() to test for a broken regexec() function, set
the fourth parameter to default to "no" (since it apparently only occurs
on glibc 2.2.3-based systems) so that cross-compiling will work


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1929 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-07 00:48:49 +00:00
David Lawrence Ramsey
02517e0a0f add DB's overhaul of the file loading code to increase efficiency,
remove ugly workarounds for most cases of edittop's or current's being
NULL (as those cases no longer occur due to the overhaul), and remove
detection of binary files (since it wasn't always accurate and will only
cause problems when UTF-8 support is added); also add a few minor fixes
of mine


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1928 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-05 21:40:31 +00:00
David Lawrence Ramsey
8bf08097ee remove reference to @includedir@ in src/Makefile.am, as it's unneeded
and can break cross-compilation


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1927 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-09-01 22:08:57 +00:00
Jordi Mallach
1fabded68f Updated French manpages from Jean-Philippe.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1926 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-31 18:26:28 +00:00
Jordi Mallach
30d82b787d Update Spanish translation from Javi.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1925 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-31 18:13:07 +00:00
Jordi Mallach
cc79a9ae96 Updated translations.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1924 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-31 00:23:16 +00:00
Jordi Mallach
66e19ba5f3 Updated French translation by Jean-Philippe Guérard.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1923 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-31 00:22:02 +00:00
David Lawrence Ramsey
2a60ea8fe3 in nanorc.sample, remove specific references to control key shortcuts
other than XON and XOFF


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1922 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-29 14:42:03 +00:00
David Lawrence Ramsey
4aece064db remove snippet of edit_update() that's redundant now that findnextstr()
maintains current_y properly


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1921 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-28 16:34:28 +00:00
David Lawrence Ramsey
6da969e44b work around the need to put back the first non-escape character when
reading an escape sequence


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1920 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-28 15:51:07 +00:00
David Lawrence Ramsey
146bb6026a in do_insertfile(), readd the NANO_SMALL #ifdef around the start_again:
label to avoid a warning


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1919 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-27 21:02:38 +00:00
David Lawrence Ramsey
c510042bcd do more int ->bool conversions, change the order of the parameters in
findnextstr(), and make findnextstr() maintain the value of current_y
too


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1918 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-27 20:28:34 +00:00
David Lawrence Ramsey
50c7f2de2f have edit_refresh() call edit_update() with NONE when smooth scrolling
is on so that smooth scrolling applies everywhere instead of just to the
movement functions, fix a potential infinite loop when edit_update() is
called with NONE and current_y is greater than (editwinrows - 1), and
have do_para_begin() and do_para_end() maintain current_y as
do_justify() does (and as they did before)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1917 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-27 17:02:05 +00:00
Jordi Mallach
0c4c58e457 Updated Catalan and German.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1916 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-27 10:18:47 +00:00
David Lawrence Ramsey
20b83508f4 simplify edit_update() so as not to require the fileptr parameter
anymore, since it's set to current in all calls


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1915 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-26 18:07:58 +00:00
David Lawrence Ramsey
d1322107a5 do another int -> bool conversion, and simplify the search/replace
"Cancelled" messages


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1914 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-26 04:22:54 +00:00
David Lawrence Ramsey
fe0d366ce2 in get_mouseinput(), make clicking on meta shortcuts work properly
again, and properly handle the case of whereis_list's being longer than
MAIN_VISIBLE as bottombars() does


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1913 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-26 01:43:16 +00:00
David Lawrence Ramsey
a16b27f102 remove redundant #ifdef
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1912 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-26 01:29:25 +00:00
David Lawrence Ramsey
dfca1c4ea6 add unget_kbinput(), a wrapper for ungetch()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1911 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-25 16:37:06 +00:00
David Lawrence Ramsey
a0b5ba2f7f convert ints to bools in the low-level input routines, and consolidate
the high-level input routines for the edit window


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1910 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-25 15:39:10 +00:00
David Lawrence Ramsey
19420aac9d add missing brackets around an if statement block in parse_rcfile() so
that parsing the numeric argument after "tabsize" works properly again


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1909 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-18 16:14:18 +00:00
David Lawrence Ramsey
013e8d1eb1 Back to CVS
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1908 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-08-17 20:44:31 +00:00
47 changed files with 20471 additions and 17944 deletions

View File

@@ -11,6 +11,7 @@ config.h
config.h.in
config.log
config.status
config.rpath
configure
config.guess
config.sub

21
AUTHORS
View File

@@ -1,16 +1,16 @@
$Id$
This file lists people who have made significant contribution to the nano
editor. Please see the ChangeLog for specific changes by author.
This file lists people who have made significant contribution to the
nano editor. Please see the ChangeLog for specific changes by author.
-------------------------------------------------------------------------
Chris Allegretta <chrisa@asty.org>
* Original program author, stable series maintainer.
David Lawrence Ramsey <pooka_regent@sluggy.net>
* Development series maintainer. Multiple buffer support,
operating dir (-o) option, bug fixes for display routines,
wrapping code, spelling fixes, const mode and various other
fixes.
* Development series maintainer. Multiple buffer support,
operating dir (-o) option, bug fixes for display routines,
wrapping code, spelling fixes, const mode, parts of the UTF-8
support, and various other fixes.
Jordi Mallach <jordi@sindominio.net>
* Debian package maintainer, fellow bug squasher.
@@ -27,10 +27,11 @@ Robert Siemborski <rjs3@andrew.cmu.edu>
edit display routines.
Rocco Corsi <rocco.corsi@sympatico.ca>
* Internal spelling code, many optimizations and bug fixes for
findnextstr and search-related functions, various display and
file handling fixes.
* Internal spelling code, many optimizations and bug fixes for
findnextstr() and search-related functions, various display
and file handling fixes.
David Benbennick <dbenbenn@math.cornell.edu>
* Wrap and justify bugfixes/enhancements, new color syntax
code, memleak fixes and other miscellaneous fixes.
code, memleak fixes, parts of the UTF-8 support, and other
miscellaneous fixes.

815
ChangeLog
View File

@@ -1,3 +1,808 @@
GNU nano 1.3.6 - 2005.03.20
- General:
- More int -> bool conversions. (DLR and David Benbennick)
- Overhaul the cutting and uncutting routines to use the
partitioning code, as it greatly simplifies how they work.
New functions move_to_filestruct(), copy_from_filestruct(),
cut_line(), cut_marked(), and cut_to_eol(); changes to
add_to_cutbuffer(), do_cut_text(), do_uncut_text(), etc.;
removal of functions get_cutbottom(), add_to_cutbuffer(), and
cut_marked_segment(). (DLR)
- Overhaul the justify-related routines to back up and restore
unjustified text to use the partitioning code, as it greatly
simplifies how they work, and to store such text in its own
buffer rather than the cutbuffer. Changes to backup_lines(),
do_justify(), etc. (DLR)
- Overhaul the multibuffer routines to increase efficiency, most
importantly making them use a doubly linked list for the open
files so that switching between them is no longer O(N), and
only including free_openfilestruct() when --enable-debug is
used. Also use some of the same efficiency tweaks when
dealing with filestruct nodes. New function
open_prevnext_file(); changes to make_new_opennode(),
splice_opennode(), unlink_opennode(), delete_opennode(),
free_openfilestruct(), add_open_file(), load_open_file(),
close_open_file(), shortcut_init(), die(), make_new_node(),
copy_node(), splice_node(), delete_node(), and
free_filestruct(); removal of open_prevfile() and
open_nextfile(). (David Benbennick, minor tweaks and additions
by DLR)
- Change references to "open files" to "open file buffers", for
consistency. (DLR)
- Add flag to disable UTF-8 sequence interpretation, so that
people using single-byte encodings such as KOI8-R can type
properly again. (DLR, found by Arthur Ivanov)
- Massively overhaul the input and output routines to support
buffered input and output, the first steps toward
wide/multibyte character input and output, and verbatim input
of double-byte Unicode characters instead of single-byte ASCII
characters. New functions is_byte(), get_buffer(),
get_buffer_len(), buffer_to_keys(), unget_input(),
get_input(), parse_kbinput(), and parse_verbatim_kbinput();
new macro charcpy(); changes to do_char() (renamed to
do_output()), get_edit_input() (renamed to do_input() and
moved to nano.c), get_edit_mouse() (renamed do_mouse() and
moved to nano.c), do_verbatim_input(), do_tab(), main(), and
get_ascii_kbinput() (renamed to get_byte_kbinput()). The wide
version of ncurses is required in order for wide/multibyte
input and output to work properly. (DLR; buffered input/output
based on ideas from mutt 1.4.2.1; input of Unicode characters
in hexadecimal suggested by Michael Piefel)
- More steps toward wide character/multibyte character support.
New functions control_rep(), parse_char(), move_left(), and
move_right(); changes to do_left(), do_right(), do_delete(),
breakable(), break_line(), do_output(), get_buffer(),
unget_input(), actual_x(), strnlenpt(), display_string(),
titlebar(), statusbar(), onekey(), edit_add(),
do_replace_highlight(), and do_credits(). (David Benbennick
and DLR)
- Overhaul the high-level input routines for the statusbar to
make them read the shortcut lists for functions instead of
manually running them, to make nanogetstr() less complex, and
to increase flexibility. Note that currshortcut is now used
regardless of #ifdefs, and that cutting text at the statusbar
now respects the CUT_TO_END flag. Changes to shortcut_init()
and nanogetstr(); new functions do_statusbar_input(),
do_statusbar_mouse(), do_statusbar_home(), do_statusbar_end(),
do_statusbar_right(), do_statusbar_left(),
do_statusbar_backspace(), do_statusbar_delete(),
do_statusbar_cut_text(), and do_statusbar_output(). (DLR)
- Even more steps toward wide character/multibyte character
support. Movement and cursor display at the statusbar prompt
should now (mostly) work properly with a string containing
multibyte characters, and text display of such strings should
now (mostly) work properly as well. Changes to search_init(),
nanoget_repaint(), do_statusbar_right(), do_statusbar_left(),
do_statusbar_backspace(), and do_statusbar_delete(). (David
Benbennick and DLR)
- Implement cutting from the current position to the end of the
file, using Ctrl-X from the search prompt and Meta-T from the
edit window. New function do_cut_till_end(). Note that this
is disabled when NANO_SMALL is defined. (DLR, based on ideas
from a patch for Pico by Eduardo Chappa, suggested by Ryan
Dlugosz and Paul Adams)
- Implement verbatim input for the statusbar prompt. Changes to
do_statusbar_input() and do_statusbar_output(); new functions
keys_to_buffer(), unparse_kbinput(), and
do_statusbar_verbatim_input(). (DLR)
- Yet more steps toward full wide character/multibyte character
support. Overhaul the functions that already have support for
them to work with multibyte strings as much as possible, add
support to a few more functions as well, and move multibyte
character-specific functions to their own source file. New
file chars.c; new functions is_alnum_char(),
is_alnum_mbchar(), is_alnum_wchar(), is_blank_mbchar(),
is_blank_wchar(), is_cntrl_mbchar(), is_cntrl_wchar(),
control_mbrep(), control_wrep(), mbwidth(), mb_cur_max(),
make_mbchar(), mbstrlen(), mbstrnlen(), mbstrcasecmp(),
mbstrncasecmp(), mbstrcasestr(), and mbrevstrcasestr();
changes to help_init(), do_wrap(), break_line(), is_byte()
(moved to chars.c), is_blank_char() (moved to chars.c),
is_cntrl_char() (moved to chars.c), nstricmp() (renamed
nstrcasecmp() and moved to chars.c), nstrnicmp() (renamed
nstrncasecmp() and moved to chars.c), nstristr() (renamed
nstrcasestr() and moved to chars.c), revstrstr() (moved to
chars.c), revstristr() (renamed revstrcasestr() and moved to
chars.c), nstrnlen() (moved to chars.c), parse_char() (renamed
parse_mbchar() and moved to chars.c), move_left() (renamed
move_mbleft() and moved to chars.c), move_right() (renamed
move_mbright() and moved to chars.c), do_home(),
do_verbatim_input(), do_delete(), do_tab(), do_enter(),
indent_length(), do_next_word(), do_prev_word(), do_wrap(),
do_input(), do_output(), is_whole_word(), strstrwrapper(),
get_buffer(), unget_input(), unget_kbinput(), get_input(),
parse_kbinput(), unparse_kbinput(), parse_verbatim_kbinput(),
do_statusbar_input(), do_statusbar_home(),
do_statusbar_verbatim_kbinput(), do_statusbar_output(),
do_help(), help_line_len(), and display_string(); removal of
buffer_to_keys() and keys_to_buffer(). (DLR)
- Add -O/--morespace command line option, plus a corresponding
Meta-O toggle and a "morespace" rcfile option. When these are
used, the normally-unused blank line below the titlebar will
be treated as part of the edit window. New functions
no_more_space() and blank_topbar(); changes to global_init(),
window_init(), handle_sigwinch(), do_toggle(), do_mouse(),
get_mouseinput(), etc. (DLR; suggested by Mike Frysinger,
Rocco, and Robert Schultz)
- Add support for moving to the next or previous word at the
statusbar prompt. New functions do_statusbar_next_word() and
do_statusbar_prev_word(); changes to do_statusbar_input().
(DLR)
- Make resizing more flexible. We now can work with as few as
one row, and with no limit on the number of columns (except of
course the curses-imposed limit that it be greater than zero).
New function resize_variables(); changes to die_too_small()
(renamed check_die_too_small()), global_init(), window_init(),
and handle_sigwinch(). (David Benbennick)
- Use void instead of RETSIGTYPE, as signal handlers are
supposed to return void anyway. Also, the value of RETSIGTYPE
is sometimes misdetected as int, leading to compilation
warnings or errors. Changes to cancel_fork(),
handle_hupterm(), do_suspend(), and do_cont(). (David
Benbennick)
- Change flags to an unsigned long, and totsize to a size_t.
(DLR)
- Store the number of multibyte characters instead of the number
of single-byte characters in totsize, and use get_totals() to
get the value of totsize in a few more places. Changes to
read_line(), read_file(), do_delete(), do_input(),
get_totals(), and do_cursorpos(). (DLR)
- Overhaul the tab completion code, the file browser code, and
related functions to increase efficiency and support multibyte
characters. New function is_dir(); changes to
get_full_path(), check_writable_directory(), safe_tempnam(),
diralphasort(), username_tab_completion(),
cwd_tab_completion(), input_tab(), tail(), striponedir(),
browser_init(), do_browser(), and do_browse_from(); removal of
append_slash_if_dir(), readable_dir(), and
check_wildcard_match(). (David Benbennick) DLR: Move the
routine to get the current user's home directory into the new
function get_homedir(), and use it where necessary. Also add
a few miscellaneous tweaks.
- Overhaul the rcfile parsing code to make it simpler and more
accurate, remove now-redundant checks from the color code,
change the COLOR_SYNTAX toggle to the NO_COLOR_SYMTAX toggle,
and improve various debugging messsages. Changes to
set_colorpairs(), do_colorinit(), parse_next_word(),
parse_argument(), colortoint(), parse_next_regex(),
parse_syntax(), parse_colors(), parse_rcfile(), do_rcfile(),
etc. (David Benbennick) DLR: Rename colortoint() to
color_to_int(), and add a few miscellaneous tweaks.
- Overhaul the paragraph-searching code to make it use the
paragraph-searching utility functions when possible instead of
duplicating code. Also overhaul the justify code to make it
leave the right number of spaces at the ends of the lines of a
paragraph, to make it support multibyte characters, and to
make it simpler. Also, don't remove a space after a duplicate
character in punct anymore, as it doesn't really make us more
compatible with Pico. New functions mbstrchr(),
do_para_begin_void(), and do_para_end_void(); changes to
justify_format(), do_para_begin(), inpar(), do_para_end(),
break_line(), do_para_search() (renamed find_paragraph()), and
do_justify(); removal of breakable(). (DLR)
- Still more steps toward full wide/multibyte character support.
Make sure all rcfile arguments are valid multibyte strings,
make whitespace display mode work with multibyte characters,
and add a few related documentation updates. New function
make_mbstring(); changes to make_mbchar(), make_mbstring(),
main(), parse_rcfile(), display_string(), and do_help(). (DLR)
- cut.c:
do_cut_text()
- If keep_cutbuffer is FALSE, only blow away the text in the
cutbuffer if the cutbuffer isn't empty. (DLR)
do_uncut_text()
- No longer duplicate Pico's adding an extra magicline to the
file if uncutting leaves the cursor on the current one. This
behavior appears to be a bug, as inserting a file in the same
manner doesn't add an extra magicline. (DLR)
- files.c:
get_full_path()
- Remove unneeded NANO_SMALL #ifdef, so that it's included
whenever its prototype is, and so it can compile when
DISABLE_OPERATINGDIR isn't defined and NANO_SMALL is. (DLR)
do_browser()
- Refresh the screen when Ctrl-L is pressed in the file browser,
as Pico does. (DLR)
- global.c:
shortcut_init()
- Fix misplaced #endif keeping the "Full Justify" shortcut in
the search shortcut list from being included when NANO_SMALL
is defined but DISABLE_JUSTIFY isn't. (DLR)
- Use NULL instead of 0 when a shortcut has no associated
function. (DLR)
thanks_for_all_the_fish()
- Free the justify buffer if it isn't empty. (DLR)
- nano.c:
help_init()
- Clarify the text describing double-escape character input.
Since ASCII is technically only seven bits wide, characters
128-255 aren't ASCII. (DLR, suggested by Michael Piefel)
do_toggle()
- When we get the whitespace display toggle, update the titlebar
as well as the edit window, in case the filename displayed on
the titlebar contains spaces or tabs. (DLR)
handle_sigwinch()
- If the justify buffer isn't empty, blow it away and don't
display "UnJustify" in the shortcut list anymore. (DLR)
usage()
- Typo fix. (DLR)
do_wrap()
- Make wrap_loc and word_back ssize_t's, to match fill. (DLR)
break_line()
- Fix compilation problem caused by its returning int when it
should return ssize_t according to its prototype. (Jeremy
Huddleston)
indent_length()
- Make the #ifdef around it match that of its prototype to avoid
compilation problems when compiling with --enable-tiny and
without DISABLE_JUSTIFY's being defined. (DLR)
do_justify()
- For consistency, preserve placewewant if we didn't unjustify
instead of setting it to 0. (DLR)
- When justifying the entire file, properly break out of the
loop if we've found at least one paragraph, there are no more
paragraphs after the current one, and the paragraph search
left us on the magicline. This avoids a segfault. (DLR)
do_input()
- Add finished parameter, used to indicate when we run or try to
run a function associated with a shortcut. (DLR)
main()
- Try to automatically detect whether UTF-8 support is needed by
setting the NO_UTF8 flag if setlocale() returns a string that
doesn't contain "UTF8" or "UTF-8", case insensitively. When
using slang 2.x, enable UTF-8 support with SLutf8_enable().
(DLR, string checks beyond case-sensitive "UTF-8" adapted from
Debian's UTF-8 patch for slang)
- nano.h:
- Remove now-unneeded #defines for functions that now have
multibyte equivalents. (DLR)
- Remove now-unneeded MIN_EDITOR_COLS. (David Benbennick)
- utils.c:
regexec_safe()
- Remove redundant regexec #define, and move the regexec #undef
to nano.h. (DLR)
is_blank_char()
- Rewrite to use ctype functions instead of checking directly
for spaces and tabs. (DLR)
revstrstr(), revstristr()
- Add asserts. (DLR)
- winio.c:
get_buffer()
- If we get ERR when using blocking input, it means that the
input source that we were using is gone. In this case, call
handle_hupterm(), so that nano dies gracefully instead of
going into an infinite loop. (DLR, found by Jim Uhl)
titlebar()
- Rename some variables for consistency, make space an int
instead of a size_t, properly handle the case where the prefix
length plus the path length is greater than the amount of
space available, and fix a typo in an assert. (DLR)
unget_kbinput()
- Remove the wide character handling, as it didn't work properly
with respect to function keys. (DLR)
get_kbinput(), get_translated_kbinput(), get_ascii_kbinput(),
get_untranslated_kbinput()
- Make the ascii_digits variables ints instead of size_t's,
since they will only hold very small values. (DLR)
get_kbinput()
- Remove the wide character handling, as it didn't work properly
with respect to adding multiple wide characters at once, and
ungetting them just caused other problems elsewhere. (DLR)
get_translated_kbinput()
- Remove the wide character handling, as it didn't work properly
with respect to adding multiple wide characters at once, and
ungetting them just caused other problems elsewhere. (DLR)
- Use if statements instead of switch/case statements to handle
ASCII character sequence mode, as they take up less room.
get_ascii_kbinput()
- Use if statements instead of switch/case statements to handle
ASCII character sequence mode, as they take up less room.
get_verbatim_kbinput()
- Don't pass v_kbinput in as a parameter, since we're
dynamically allocating it and then returning it. (DLR)
- Remove v_first parameter, and go back to the old behavior of
putting back the first character of the escape sequence, as it
worked just as well and was less complicated. (DLR)
get_mouseinput()
- Return TRUE instead of FALSE only when we have a control key,
a prinary meta key sequence, or both. (DLR)
get_shortcut()
- Add a debug message. (DLR)
- Take kbinput as a reference instead of a value, so that it's
translated when the key is translated to its equivalent
control key or meta key shortcut. (DLR)
- Return s instead of NULL only when we have a control key, a
prinary meta key sequence, or both. (DLR)
get_toggle()
- Add a debug message. (DLR)
bottombars()
- Initialize foo, in case a keystroke meets none of the handled
cases. (DLR)
total_refresh()
- 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().
do_help()
- Refresh the screen when Ctrl-L is pressed in the help browser,
as Pico does. (DLR)
- configure.ac:
- Remove specific references to control key shortcuts. (DLR)
- Check for the wide versions of ncurses or slang, without which
multibyte strings don't seem to be displayed properly, and
associated multibyte/wide character functions. (DLR)
- Check for wchar.h, for those systems that need it for the
wcwidth() prototype. (DLR)
- Remove checks for all include files that we include
unconditionally. (DLR)
- Remove references to termio.h here and elsewhere, since it's
obsolete and it defines a struct termio that we don't use
anywhere. (DLR)
- Typo fixes. (DLR)
- Add checks for isascii(), iswalnum(), iswblank() or
iswspace(), mblen(), and wctype.h. (DLR)
- README:
- Updated for the 1.3 branch. (DLR)
- README.CVS:
- Updated to mention the need for a wide character-supporting
version of curses or slang if UTF-8 support is desired. (DLR)
- doc/faq.html:
- Remove now-inaccurate note about verbatim input's not working
at prompts, and update its description to mention that it
handles hexadecimal values now. (DLR)
- Add question about opening files with names beginning with
'+'s, and add a few more miscellaneous cosmetic fixes.
- nanorc.sample:
- Add return to the "c-file" regexes. (DLR)
- Clarify the text describing good values for whitespace
display. Since ASCII is technically only seven bits wide,
characters 128-255 aren't ASCII. (DLR, suggested by Michael
Piefel)
- Add the "morespace" option. (DLR)
- Add support for characters to the "c-file" regexes. (DLR)
- Add the hexadecimal equivalents of the decimal values
suggested for whitespace display, now that it can handle
multibyte characters. (DLR)
- Add "manpage" regex. (Mike Frysinger, minor tweaks by DLR)
- nano.1. nanorc.5, nano.texi:
- Add the "morespace" option, and sync with the descriptions in
nanorc.sample in a few places. (DLR)
- Miscellaneous wording tweaks. (DLR)
- src/Makefile.am:
- Add chars.c to nano_SOURCES. (DLR)
- If we're installing and the "rnano" symlink already exists,
remove it so that we can create it again without an error.
(DLR)
- AUTHORS:
- Updated to mention UTF-8 support.
GNU nano 1.3.5 - 2004.11.22
- General:
- Convert more ints that hold only TRUE and FALSE values to
bools. (DLR)
- Consolidate the code for finding and running a shortcut in a
shortcut list, the code for finding and toggling a toggle in a
toggle list, and the code for doing both of those and
interpreting mouse clicks in the edit window. Also move the
code for do_mouse() to get_edit_mouse() and tweak it to
properly handle cases where a shortcut isn't clicked. New
functions get_shortcut(), get_toggle(), get_edit_input(), and
get_edit_mouse(); changes to do_browser(), do_justify(),
do_help(), and main(). (DLR)
- Simplify a few more translated messages. (DLR)
- Translation updates (see po/ChangeLog for details).
- Remove reference to @includedir@ in src/Makefile.am, as it's
unneeded and can break cross-compilation. (DLR, found by Mike
Frysinger)
- Overhaul the file opening, reading, and loading operations to
increase efficiency, avoid problems on invalid filenames
specified on the command line, and eliminate corner cases that
erroneously leave edittop or current NULL when they shouldn't
be. Also split out the code to execute a command into a
separate function, eliminate a workaround for one of the
aforementioned corner cases, handle files with a mix of DOS
and Mac format lines, and remove the code to turn on the
NO_CONVERT flag when opening a binary file, as it's not always
reliable and will cause problems with UTF-8 text files. New
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:
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
line endings from read_line() to read_file() to avoid
inaccurate statusbar messages and to reduce fileformat to a
local variable in read_file(), eliminate another workaround in
edit_update(), rename open_the_file() to open_file() since the
latter has been removed, and rename load_a_file() to
load_buffer().
- Add alternative shortcuts to the main and search shortcut
lists for moving to the beginning and end of a paragraph and
justifying the entire file: Meta-( (Meta-9), Meta-) (Meta-0),
and Meta-J, respectively. Do this because Pico's practice of
putting these shortcuts only in the search shortcut list is
rather odd. (DLR)
- Turn off extended input processing (the IEXTEN termios flag)
as nano 1.2.x does. New function disable_extended_input();
changes to terminal_init(). (DLR)
- Remove redundant include of limits.h from nano.c. nano.c
includes nano.h and nano.h includes limits.h. (DLR)
- Add a func_key flag to the low-level input functions and the
currently existing high-level input functions, to indicate
extended keypad values. This is needed for UTF-8 support.
Changes to unget_kbinput(), get_kbinput(),
get_translated_kbinput(), get_shortcut(), get_edit_input(),
etc. (DLR)
- Add a multibuffer mode toggle to the "Execute Command" prompt,
for consistency with the "Read File" prompt. Changes to
do_insertfile() and shortcut_init(). (DLR)
- Add an ^X toggle to the "Execute Command" prompt to go back to
the "Insert File" prompt, and add a ^T toggle to the "Go To
Line" prompt to go back to the "Where Is" prompt. Changes to
do_insertfile(), shortcut_init(), do_gotoline(), etc.
- Make sure a few uninitialized static variables are initialized
to sane values. (DLR)
- 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,
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
remove the global versions of the toggles, so that they can
only be used at the "Write File" prompt as similar options
can. Finally, change the Mac format toggle to Meta-M, since
that no longer conflicts with the global -m/--mouse toggle.
(DLR)
- Add support for reading in UTF-8 sequences to the low-level
input routines. Changes to get_kbinput() and
get_translated_kbinput(). (DLR)
- Reduce search_last_line to a static variable in search.c, and
allow it to be set to FALSE via a function. New function
findnextstr_wrap_reset(); changes to do_int_spell_fix(),
findnextstr(), do_search(), do_research(), do_replace_loop(),
do_replace(), and do_find_bracket(). (DLR, problem with making
search_last_line local to findnextstr() found by Rocco)
- When saving or changing file positions, be sure not to ignore
placewewant. Changes to do_int_spell_fix(), findnextstr(),
do_replace_loop(), and do_replace(). (DLR)
- Convert current_x and mark_beginx to size_t's, and convert
some functions that use them as a parameter to use size_t as
well. Also change some related assertions to handle them.
(David Benbennick and DLR)
- Add code to partition a filestruct between a set of arbitrary
coordinates. Given the coordinates of the beginning and end
of the mark, this allows proper and easier handling of saving
marked selections, replacing text only in marked selections
(suggested by Joseph Birthisel), and spell-checking marked
selections using either the internal or alternate spell
checker. Do all these using a global partition structure.
New functions partition_filestruct(),
unpartition_filestruct(), remove_magicline(), and
get_totals(); changes to write_marked(), do_int_spell_fix(),
do_alt_speller(), handle_sigwinch(), and do_replace_loop().
(DLR)
- Remove most redundant includes of sys/stat.h. It's included
in nano.h, so it doesn't need to be included in files that
include nano.h. (DLR)
- Remove the DOS_FILE and MAC_FILE flags, as they're only used
in files.c, and replace them with a static file_format enum.
Change the openfilestruct structure accordingly in order to
handle this. (DLR)
- Convert some ints with predefined boundaries to enums. (DLR)
- Include config.h only if HAVE_CONFIG_H. (Jordi)
- cut.c:
cut_marked_segment()
- Respect concatenate_cut, as we need to use it if we do a
marked cut and immediately follow it with a cut-to-end (which
uses this function). (DLR)
do_cut_text()
- Set concatenate_cut to TRUE unconditionally when doing a
marked cut. This fixes an incompatibility with Pico where an
extra line is uncut if we do a marked cut that includes the
magicline and immediately follow it with an unmarked cut.
(DLR)
do_uncut_text()
- Maintain current_y's value when uncutting blocks so that
smooth scrolling works correctly. (DLR)
- files.c:
read_file()
- Rename variable fileformat to format, to avoid confusion with
the file_format enum type. (DLR)
load_buffer()
- Don't change the file format when we insert another file into
the current one. (DLR)
do_insertfile()
- Simplify by reusing variables whereever possible, and add a
parameter execute to indicate whether or not to be in "Execute
Command" mode. (DLR)
- Rework so that goto is no longer needed, using do_writeout()
as a model. (DLR)
- If file browsing succeeds, call statusq_abort() so that the
cursor position at the statusbar is reset. (DLR)
- Add missing #ifdefs around the wrap_reset() call so that nano
compiles with wrapping disabled again. (DLR)
- If we're not inserting a file into a new buffer, partition the
current buffer so that it's effectively a new buffer just
before inserting the file, and only restore placewewant
afterwards. This is the same behavior we would get if we
opened the file, added all of it to the cutbuffer, closed the
file, and uncut at the current cursor position. (DLR)
- Maintain current_y's value when inserting so that smooth
scrolling works correctly. (DLR)
do_writeout()
- Restructure if blocks for greater efficiency, using
do_insertfile() as a model. (DLR)
- Simplify where possible, and use an int retval to hold the
return value instead of i. (DLR)
- If file browsing succeeds, call statusq_abort() so that the
cursor position at the statusbar is reset. (DLR)
- Remove unneeded calls to display_main_list(). (DLR)
do_writeout_void()
- Call display_main_list(), for consistency with
do_insertfile_void(). (DLR)
write_file()
- If we've tried to write to an unwritable file and we're not
prepending, tempname is NULL when it's passed to unlink().
This can cause problems if unlink() can't handle NULL, so
don't call it in that case. (David Benbennick)
write_marked()
- Remove check for MARK_ISSET's not being set. (DLR)
open_prevfile(), open_nextfile()
- Translate the "New Buffer" string when displaying "Switched
to" messages on the statusbar. (DLR)
input_tab()
- Fix snprintf() call so that we don't segfault when trying to
complete a filename containing %'s. (Ulf Härnhammar)
- global.c:
shortcut_init()
- Remove redundant NANO_SMALL #ifdef. (DLR)
- Change an erroneous _() around the "New Buffer" string to
N_(). (DLR)
- Add new key aliases: F15 for "Mark Text" (DLR) and F16 for
"Where Is Next" (Chris).
- Leave "Mark Text" and "Where Is Next" out entirely when
NANO_SMALL is defined. Since they aren't in the visible main
list, there's no point in having them in but disabled. (DLR)
- In the search prompt shortcut list, move "Full Justify" to
after "History", so that the latter is visible onscreen
again. (DLR)
- nano.c:
die_save_file()
- Clarify the error message when there are too many backup files
and the current one can't be written. (DLR)
help_init()
- Rework to be a bit more flexible. Only add tabs for shortcut
key entries if those entries exist, and if there's only one
entry left but there's room for more than one, add enough tabs
to put that entry at the end. Also, make sure a function key
is displayed in the middle if it's the first entry. These
changes allow e.g. the miscellaneous meta key sequence to be
displayed in a shortcut that has a control key, a primary meta
key sequence, and a miscellaneous meta key sequence, but no
function key. (DLR)
- Update the help text to mention replacing and spell checking
only selected text, and also add a few cosmetic fixes to it.
(DLR)
- Update the help text to mention how to get a blank buffer at
the "Execute Command" prompt. (DLR)
do_prev_word()
- Tweak to avoid an infinite loop, since current_x is now a
size_t and hence is unsigned. (DLR)
do_int_spell_fix()
- Move the REVERSE_SEARCH flag toggling into the NANO_SMALL
#ifdef, since the tiny version of nano doesn't support reverse
searching. Move the CASE_SENSITIVE flag toggling out in order
to allow the internal spell checker to work properly when
NANO_SMALL is defined and DISABLE_SPELLER isn't. Also, turn
the USE_REGEXP flag off during spell checking in order to
avoid a potential segfault. (DLR)
- Fix a problem where if the cursor is in the middle of a file,
the spell checker will sometimes only correct the misspelled
word instances that appear before the cursor position and then
stop. (Rocco)
- Use do_replace_loop()'s canceled parameter in order to ensure
that the spell checking stops if we canceled at the replace
prompt. (DLR)
do_alt_speller()
- Call terminal_init() unconditionally after running the
alternate spell checker, so that the terminal state is
properly restored in all cases. (DLR)
justify_format()
- For more compatibility with Pico, remove extra space after a
character in punct if that character is the same as the one
before it. For example, with the default values of punct and
brackets, only one space will be left after "...". (DLR)
do_para_begin(), do_para_end()
- Maintain current_y's value when moving up or down lines so
that smooth scrolling works correctly. (DLR)
breakable(), break_line()
- Make goal a ssize_t instead of an int, since fill is now a
ssize_t, and the position at which a line is broken can be
greater than COLS. (DLR)
main()
- Tweak the command line parsing routine so that multiple +LINE
flags are properly interpreted in multibuffer mode. (DLR)
- nano.h:
- Add WIDTH_OF_TAB #define, containing the default width of a
tab. (DLR)
- Move the PATH_MAX #define here from files.c.
- Remove unused COPYFILEBLOCKSIZE #define. (DLR)
- proto.h:
- Add missing NANO_SMALL #ifdef around the cut_marked_segment()
prototype. (DLR)
- rcfile.c:
parse_rcfile()
- Add missing brackets around an if statement block so that
parsing the numeric argument after "tabsize" works properly
again. (DLR, found by Mike Frysinger)
- Since flag values are longs, use "%ld" instead of "%d" in the
debugging messages indicating when a flag is set or unset.
(DLR)
- search.c:
regexp_init()
- If NANO_SMALL is defined, don't bother checking the
CASE_SENSITIVE flag or using its value when compiling a list
of matching regular expressions. (DLR)
search_init()
- Add parameter use_answer. When it's TRUE, only set
backupstring to answer. This is needed to preserve the text
of the statusbar when switching to the search prompt from
the "Go To Line" prompt. Also, set backupstring before doing
anything else, add one minor efficiency tweak, and preserve
the text of the statusbar no matter what when switching from
the search prompt to the "Go To Line" prompt, since the
toggling works both ways now and non-numeric text shouldn't be
lost when going only one of those ways. (DLR)
- When we're replacing and the mark is on, display a prompt
indicating that we're replacing text only in the selection
instead of the usual prompt. (DLR)
findnextstr()
- Take the no_sameline parameter after can_display_wrap and
wholewords, not after all other parameters. (DLR)
- Maintain current_y's value when moving up or down lines so
that smooth scrolling works correctly. (DLR)
- Fix handling of the wholewords flag so that it works with
regular expressions and in conjunction with the no_sameline
flag, and add new parameter needle_len (used to return the
length of the match). (DLR)
do_replace_loop()
- Miscellaneous cleanups: treat real_current as current and
real_current_x as current_x, only turn the mark off and call
edit_refresh() if the mark was originally on, and make
length_change a ssize_t. (DLR)
- Return ssize_t instead of int. (DLR)
- Add new parameter canceled, set to TRUE if we canceled at the
prompt and FALSE otherwise. (DLR)
- utils.c:
regexp_bol_or_eol()
- Don't assume any longer that string will be found if
REG_NOTBOL and REG_NOTEOL are not set. (DLR)
mallocstrncpy()
- New function, used as a malloc()ing equivalent of strncpy().
(DLR)
mallocstrcpy()
- Refactor to be a wrapper for mallocstrncpy(). (DLR)
mark_order()
- Add new parameter right_side_up. Set it to TRUE If the mark
begins with (mark_beginbuf, mark_beginx) and ends with
(current, current_x), or FALSE otherwise. (DLR)
- winio.c:
unget_kbinput()
- New function used as a wrapper for ungetch(). (DLR)
get_kbinput()
- When reading an escape sequence, set get_verbatim_kbinput()'s
new first parameter to the first character of the sequence
instead of putting that character back and reading the entire
sequence afterwards. (DLR)
get_escape_seq_kbinput()
- Make the escape_seq parameter a const int*, since it's never
modified. (DLR)
- Support the escape sequences for F15 and F16. (DLR)
get_verbatim_kbinput()
- Add new parameter first. If first isn't ERR, make it the
first character in the returned sequence instead of reading
the first character in via blocking input. (DLR)
get_mouseinput()
- Consolidate two if statements to increase efficiency. (DLR)
- Check kbinput against metaval instead of (erroneously) ctrlval
when putting back a meta sequence. (DLR)
- If there are more than MAIN_VISIBLE shortcuts available, only
register clicks on the first MAIN_VISIBLE shortcuts, since
bottombars() only shows that many shortcuts. (DLR)
check_statblank()
- Rename to check_statusblank(), and rename its associated
global int statusblank too. (DLR)
nanogetstr()
- Refresh the screen when Ctrl-L is pressed at the statusbar
prompt, as Pico does. (DLR)
- Always return the key pressed by the user. (DLR)
statusq()
- Rework slightly to reset the cursor position when the user
hits Enter as well as Cancel. This means that resetstatuspos
no longer needs to be global. (DLR)
statusq_abort()
- New function to set resetstatuspos to FALSE when we don't
properly exit the statusbar prompt, e.g. when we get a file
from the file browser). (DLR)
bottombars()
- For efficiency, no longer dynamically allocate space for each
visible shortcut, as they're all of a constant short length.
(David Benbennick)
reset_cursor()
- If this is called before any files have been opened, as it can
be by statusbar(), put the cursor at the top left corner of
the edit window before getting out. (DLR)
edit_refresh()
- Call edit_update() with NONE instead of CENTER when smooth
scrolling is on, for consistency with the movement routines.
(DLR)
edit_update()
- Simplify so as not to require the fileptr parameter anymore,
since it's set to current in all calls. (DLR)
- Add comments better explaining what the update actually does,
and avoid an infinite loop when location is NONE and current_y
is greater than (editwinrows - 1). (DLR)
do_yesno()
- Don't bother assigning the value of get_mouseinput() to
anything. Since allow_shortcuts is FALSE, its return value
will always be FALSE. (DLR)
- configure.ac:
- When calling AC_TRY_RUN() to test for a broken regexec()
function, set the fourth parameter to default to "no" (since
it apparently only occurs on glibc 2.2.3-based systems) so
that cross-compiling will work. (DLR, found by Mike Frysinger)
- Simplify the curses library tests by only checking for
initscr(), which ncurses, curses, and pdcurses should all
have, and not tgetent(), which is a termcap-specific function.
(DLR)
- Check only for glib 2.x, as it's much more common than
glib 1.2.x now, and it has a better v?snprintf()
implementation. (DLR, suggested by Jordi)
- nanorc.sample:
- Remove specific references to control key shortcuts other than
XON and XOFF. (DLR)
- Add continue and goto to the "c-file" regexes. (DLR)
- Change the included speller value to "aspell -x -c". The -x
option makes aspell not create backup files, and this is
consistent with the internal spell checker's behavior. (DLR)
- doc/man/fr/nano.1, doc/man/fr/nanorc.1:
- Updated manpage translations by Jean-Philippe Guérard.
- README.CVS:
- Mention the requirement for glib 2.x on systems lacking
v?snprintf(), and add minor formatting changes.
- Mention the requirement for groff in order to create html
versions of the manpages. (DLR)
- Update the given cvs commands so that they work again, and
mention the need for ssh to do cvs checkouts. (DLR)
- List sh as an example of a Bourne shell. (DLR)
- faq.html:
- Fixed inaccuracy: Pico compatibility mode was made the default
in nano 1.1.99pre1, not 1.2.2. (DLR)
- Added question about how to type F13-F16 on terminals lacking
keys past F12 (suggested by Chris), question about how to
select text for the clipboard in X terminals with nano's mouse
support turned on (answer found by Joseph Birthisel), and
miscellaneous fixes and link updates. (DLR)
- nano.1:
- Eliminate references to the now removed -D/--dos and -M/--mac
command line options. (DLR)
- nano.texi:
- Eliminate references to the now removed -D/--dos and -M/--mac
command line options, and their corresponding toggles. (DLR)
- m4/Makefile.am:
- Add glib-2.0.m4 to EXTRA_DIST, so that nano builds from CVS
with automake 1.7.x again. For some reason, automake 1.9.x
didn't have a problem with its (erroneously) being left out.
(DLR, problem found by Chris)
- m4/glib-2.0.m4:
- New file imported from glib 2.4.7. This is needed to detect
glib 2.x on systems that may not have it installed. (DLR,
suggested by Jordi)
- src/Makefile.am:
- Don't use DEFS to define things. Use INCLUDES instead. (Jordi)
GNU nano 1.3.4 - 2004.08.17
- General:
- More minor comment cleanups. (DLR)
@@ -80,7 +885,7 @@ GNU nano 1.3.4 - 2004.08.17
- Consolidate some if blocks to remove some redundant code.
(David Benbennick)
- Fix warnings when compiling with ENABLE_NLS undefined and with
-the fwritable-strings option. (David Benbennick)
the fwritable-strings option. (David Benbennick)
- Add various #ifdefs to fix warnings and compilation problems
when compiling with every option manually turned on, including
NANO_SMALL. (David Benbennick)
@@ -110,7 +915,7 @@ GNU nano 1.3.4 - 2004.08.17
write_file()
- For consistency with nano 1.2.x and with other editors, make
the mode of newly created files 666 instead of 600 before
it's modified by the umask. (DLR)
it's modified by the umask. (DLR, found by Toni Suokas)
do_writeout()
- If we're in restricted mode and the current filename isn't
blank, we can't change it, so disable tab completion in that
@@ -704,7 +1509,6 @@ GNU nano 1.3.3 - 2004.06.28
- config.rpath:
- Replace usage of egrep with grep -E, avoiding a XSI:ism (David
Weinehall)
- faq.html:
- Removed question about the NumLock glitch, as it's no longer
needed. (DLR)
@@ -1460,8 +2264,8 @@ GNU nano 1.2.1 - 2003.04.19
- General:
- Translation updates (see po/ChangeLog for details).
- Work around broken regexec() on some systems that segfaults
when passed an empty string. New function regexec_safe().
(David Benbennick)
when passed an empty string. This is known to be in glibc
2.2.3. New function regexec_safe(). (David Benbennick)
- Fix various bugs with search string history logging: don't
print a broken error message and freeze if ~/.nano_history is
unreadable, actually show an error message in save_history()
@@ -2657,6 +3461,7 @@ GNU nano 1.1.9 - 05/12/2002
- Indonesian translation updates (Tedi Heriyanto).
- po/sv.po:
- Swedish translation updates (Christian Rose).
GNU nano 1.1.8 - 03/30/2002
- General
- Type misalignments and mem leaks in renumber_all, do_justify

View File

@@ -3,7 +3,6 @@ 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

39
NEWS
View File

@@ -1,3 +1,42 @@
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
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;
improvements to input and output so that pasted text
displays faster, improvements to the statusbar prompt so
that more edit window shortcuts, including verbatim
input and previous/next word search, work in it; a new
option to allow using the formerly always-blank second
line of the screen as part of the edit window; and the
ability to refresh the help browser and file browser
windows via Ctrl-L. Notable bug fixes include a fix for
a segfault when using full justify, and a fix for the
long-standing bug where nano would keep running if the
terminal it was in died unexpectedly. Enjoy.
2004.11.22 - GNU nano 1.3.5 hurls itself forward. New features in this
release include the ability to replace only marked text
when the mark is on, improvements to smooth scrolling so
that it applies everywhere instead of just affecting the
movement keys, improvements to how files are opened so
that they are no longer displayed unnecessarily, support
for multiple +LINE arguments in addition to multiple
filenames on the command line, autodetection of the
format to save a file in based on the format it was in
when it was opened, the ability to toggle both ways
between the "Read File" and "Execute Command" prompts
and the "Search" and "Go to Line" prompts, and support
for cross-compiling nano. As for bug fixes, the
"tabsize" nanorc option works again, mouse clicks on the
shortcut list trigger the right shortcuts again,
tab-completing a filename with %'s in it no longer
causes a segfault, the internal spell checker no longer
skips words after the cursor position when the cursor is
in the middle of the file, and spell checking of only
marked text now works properly. Have fun with it.
2004.08.17 - GNU nano 1.3.4 marches forth after a false start. This
release mainly features fixes for the bugs that crept
into the last release. Among other things, nano now

9
README
View File

@@ -35,7 +35,7 @@ How to compile and install nano
Web Page
http://www.nano-editor.org
http://www.nano-editor.org/
Mailing List and Bug Reports
@@ -60,10 +60,9 @@ Mailing List and Bug Reports
Current Status
GNU nano has reached its second major milestone, 1.2.x.
Development of new features will continue in the 1.3.x branch,
while 1.2.x versions will be dedicated to bugfixing and
polishing.
GNU nano has reached its second stable milestone, 1.2.x.
Development of new features continues in the 1.3.x branch, while
1.2.x versions are dedicated to bug-fixing and polishing.
Chris Allegretta (chrisa@asty.org)

View File

@@ -1,38 +1,46 @@
INSTRUCTIONS TO COMPILE AND INSTALL NANO CVS VERSIONS
-----------------------------------------------------
GNU nano is available from CVS, but building this needs a bit
more care than the official stable and unstable tarballs.
GNU nano is available from CVS, but building this needs a bit more care
than the official stable and unstable tarballs.
To successfully compile GNU nano from CVS, you'll need the
following packages:
To successfully compile GNU nano from CVS, you'll need the following
packages:
- autoconf (version >= 2.54)
- automake (version >= 1.7)
- gettext (version >= 0.11.5)
- groff
- texinfo
- cvs
- glib (if your system doesn't have snprintf() and/or vsnprintf())
- make, gcc and the normal development libraries (ncurses, etc)
These should be available on your GNU mirror.
- ssh (with support for the SSH version 2 protocol)
- glib 2.x (if your system doesn't have snprintf() and/or vsnprintf())
- make, gcc and the normal development libraries (curses or slang, etc.)
These should be available on your GNU mirror. Note that you'll need a
version of curses or slang with wide character support if you want nano
to use UTF-8.
To download the CVS tree, execute the following command:
$ cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/nano login
and press enter at the password prompt.
Then, do
$ cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/nano checkout nano
and the nano tree will download.
If you want to checkout the stable CVS branch, append -r nano_1_0_branch:
$ cvs -z3 -d:pserver:anonymous@subversions.gnu.org:/cvsroot/nano checkout -r nano_1_0_branch nano
First, you need to set up cvs to download the CVS tree using ssh. If
you're using a Bourne shell (e.g. bash or sh), do
$ export CVS_RSH=ssh
If you're using a C shell (e.g. tcsh or csh), do
$ 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
Once you have the sources in the "nano" directory, cd into it, and
execute the "autogen.sh" script in the top dir. This will setup a
configure script and Makefile.in, and you will be ready to compile with
execute the "autogen.sh" script in the top directory. This will set up
a configure script and Makefile.in, and you will be ready to compile
with
$ ./configure [--add-options-here] && make
Once it's done compiling,
$ make install
(as root) should put the required files in their respective directories.
Please submit any bugs in the CVS branch to nano-devel@gnu.org.

14
TODO
View File

@@ -2,20 +2,20 @@ TODO file (? means the feature may be implemented, but not definitely)
-----------------------------------------------------------------------------
For version 1.4:
- UTF-8 support.
- UTF-8 support. [DONE except for the NO_CONVERT flag, which should
allow editing UTF-8 as raw bytes.]
- 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?
- Rebindable keys?
- Keystroke to implement "Add next sequence as raw" like vi's ^V.
[DONE for edit window, needs to be done for statusbar prompt]
- Keystroke to implement "Add next sequence as raw" like vi's ^V. [DONE]
- Spell check selected text only. [DONE]
- Make "To line" (^W^T) and "Read from Command" (^R^X) re-enter their
- Make "To Line" (^W^T) and "Read from Command" (^R^X) reenter their
parent menu when their keystroke is entered a second time (^W^T^T and
(^R^X^X)(requires figuring out when to keep cursor pos and when not
to).
- Fix resetstatuspos global which we shouldn't have.
(^R^X^X) (requires figuring out when to keep cursor position and when
not to). [DONE]
- Fix resetstatuspos global which we shouldn't have. [DONE]
- Rewrite the nano FAQ in SGML.
Old requests:

View File

@@ -1,513 +0,0 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2002 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, 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.
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# All known linkers require a `.a' archive for static linking (except M$VC,
# which needs '.lib').
libext=a
shlibext=
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix3* | aix4* | aix5*)
wl='-Wl,'
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6*)
wl='-Wl,'
;;
linux*)
echo '__INTEL_COMPILER' > conftest.$ac_ext
if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null
then
:
else
# Intel icc
wl='-Qoption,ld,'
fi
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
solaris*)
wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
if test "x$host_vendor" = xsni; then
wl='-LD'
else
wl='-Wl,'
fi
;;
esac
fi
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
case "$host_os" in
aix3* | aix4* | aix5*)
# On AIX, the GNU linker is very broken
ld_shlibs=no
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we can use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
;;
solaris* | sysv5*)
if $LD -v 2>&1 | grep -E 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
hardcode_direct=yes
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
esac
fi
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
fi
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
cygwin* | mingw* | pw32*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
hardcode_direct=yes
;;
freebsd1*)
ld_shlibs=no
;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd2*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9* | hpux10* | hpux11*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
hardcode_minus_L=yes # Not in the search PATH, but as the default
# location of the library.
;;
irix5* | irix6*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
openbsd*)
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
sco3.2v5*)
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
if test "x$host_vendor" = xsno; then
hardcode_direct=yes # is this really true???
else
hardcode_direct=no # Motorola manual says yes, but my tests say they lie
fi
;;
sysv4.3*)
;;
sysv5*)
hardcode_libdir_flag_spec=
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4.2uw2*)
hardcode_direct=yes
hardcode_minus_L=no
;;
sysv5uw7* | unixware7*)
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
libname_spec='lib$name'
sys_lib_dlsearch_path_spec="/lib /usr/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
case "$host_os" in
aix3*)
shlibext=so
;;
aix4* | aix5*)
shlibext=so
;;
amigaos*)
shlibext=ixlibrary
;;
beos*)
shlibext=so
;;
bsdi4*)
shlibext=so
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
;;
cygwin* | mingw* | pw32*)
case $GCC,$host_os in
yes,cygwin*)
shlibext=dll.a
;;
yes,mingw*)
shlibext=dll
sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
;;
yes,pw32*)
shlibext=dll
;;
*)
shlibext=dll
;;
esac
;;
darwin* | rhapsody*)
shlibext=dylib
;;
freebsd1*)
;;
freebsd*)
shlibext=so
;;
gnu*)
shlibext=so
;;
hpux9* | hpux10* | hpux11*)
shlibext=sl
;;
irix5* | irix6*)
shlibext=so
case "$host_os" in
irix5*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 ") libsuff= shlibsuff= ;;
*-n32|*"-n32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
;;
linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
;;
linux-gnu*)
shlibext=so
;;
netbsd*)
shlibext=so
;;
newsos6)
shlibext=so
;;
openbsd*)
shlibext=so
;;
os2*)
libname_spec='$name'
shlibext=dll
;;
osf3* | osf4* | osf5*)
shlibext=so
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
;;
sco3.2v5*)
shlibext=so
;;
solaris*)
shlibext=so
;;
sunos4*)
shlibext=so
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
shlibext=so
case "$host_vendor" in
motorola)
sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
;;
esac
;;
uts4*)
shlibext=so
;;
dgux*)
shlibext=so
;;
sysv4*MP*)
if test -d /usr/nec; then
shlibext=so
fi
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
# Compile-time system search path for libraries
sys_lib_search_path_spec="$escaped_sys_lib_search_path_spec"
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec="$escaped_sys_lib_dlsearch_path_spec"
EOF

View File

@@ -19,10 +19,11 @@
#
# $Id$
AC_INIT([GNU nano], [1.3.4], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [1.3.6], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER([config.h:config.h.in])
AC_CONFIG_HEADERS([config.h])
AC_PREREQ(2.54)
@@ -39,7 +40,7 @@ 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 termio.h termios.h unistd.h)
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_TRY_RUN([
@@ -56,9 +57,9 @@ int main(void)
return 0;
}],
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_MSG_RESULT(yes)
AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions.]),
AC_MSG_RESULT([cross-compiling; assuming no])))
dnl options
AC_ARG_ENABLE(debug,
@@ -84,7 +85,7 @@ AC_ARG_ENABLE(tiny,
[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_HELP, 1, [Define this to disable the ^G help menu.])
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).])
@@ -99,9 +100,9 @@ AC_ARG_ENABLE(browser,
fi])
AC_ARG_ENABLE(help,
[ --disable-help Disable help function (^G)],
[ --disable-help Disable help function],
[if test x$enableval != xyes; then
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the ^G help menu.])
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
fi])
AC_ARG_ENABLE(justify,
@@ -152,7 +153,6 @@ AC_ARG_ENABLE(color,
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
AC_MSG_WARN([
***********************************************************************
*** WARNING: Color support is far from perfect, but functional. ***
*** Be careful with syntax in your .nanorc or nano may malfunction. ***
@@ -180,7 +180,6 @@ AC_ARG_ENABLE(all,
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
AC_MSG_WARN([
***********************************************************************
*** WARNING: Color support is far from perfect, but functional. ***
*** Be careful with syntax in your .nanorc or nano may malfunction. ***
@@ -206,12 +205,31 @@ AC_ARG_WITH(slang,
fi
AC_CHECK_HEADER(slcurses.h,
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
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;
@@ -224,19 +242,39 @@ int main(void)
else
CURSES_LIB="-lslang"
fi
CURSES_LIB_NAME=slang], [
AC_MSG_RESULT(no)
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])
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
LIBS="$LIBS $tcap"
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 $tcap"
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;
@@ -249,14 +287,33 @@ int main(void)
else
CURSES_LIB="-lslang $tcap"
fi
CURSES_LIB_NAME=slang], [
AC_MSG_RESULT(no)
CURSES_LIB_NAME=slang],
[AC_MSG_RESULT(no)
# We might need the math library
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
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 "$with_slang" != "yes"; then
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
else
CURSES_LIB="-lslang $tcap -lm"
fi
CURSES_LIB_NAME=slang],
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
AC_TRY_RUN([
#include <slcurses.h>
int main(void)
{
SLtt_initialize(NULL);
return 0;
@@ -272,7 +329,10 @@ int main(void)
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_WARN([*** Can not use slang when cross-compiling])),
AC_MSG_ERROR([
*** The header file slcurses.h was not found. If you wish to use
@@ -290,16 +350,15 @@ AC_MSG_WARN([*** Can not use slang when cross-compiling])),
esac], [AC_MSG_RESULT(no)])
dnl Checks for functions
AC_CHECK_FUNCS(snprintf vsnprintf isblank strcasecmp strncasecmp strcasestr strnlen getline getdelim)
if test "x$ac_cv_func_snprintf" = "xno" -o "xac_cv_func_vsnprintf" = "xno"
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,,
[AM_PATH_GLIB(1.2.4,,
[AC_MSG_ERROR([
*** snprintf() and/or vsnprintf() not found. GLIB not found either.
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)])
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
glib)
fi
dnl Checks for typedefs, structures, and compiler characteristics.
@@ -310,44 +369,39 @@ AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getopt_long)
dnl Checks for libraries.
if eval "test x$CURSES_LIB_NAME = x"
then
AC_CHECK_HEADERS(curses.h ncurses.h)
AC_CHECK_LIB(ncurses, tgetent, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
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])
fi
fi
if eval "test x$CURSES_LIB_NAME = x"
then
AC_CHECK_LIB(curses, tgetent, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
fi
# Fallback for PDCurses and less useful curses libs...
if eval "test x$CURSES_LIB_NAME = x"
then
AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
fi
if eval "test x$CURSES_LIB_NAME = x"
then
AC_CHECK_LIB(termcap, tgetent, [CURSES_LIB="-ltermcap" CURSES_LIB_NAME=termcap])
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
AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
fi
fi
if eval "test x$CURSES_LIB_NAME = x"
then
AC_MSG_WARN([
*** No termcap lib available, consider getting the official ncurses
*** No curses lib available. Consider getting the official ncurses
*** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
*** errors compiling nano.])
else
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the termcap library])
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
fi
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.]))
dnl Parse any configure options
dnl Parse any configure options.
LIBS="$LIBS $CURSES_LIB"
@@ -362,6 +416,13 @@ 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()).])
else
AC_MSG_WARN([Insufficient wide character support found. nano will not be able to support UTF-8.])
fi
AC_CONFIG_FILES([
Makefile
doc/Makefile

View File

@@ -3,10 +3,9 @@
<head>
<title>The GNU nano editor FAQ</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.73 [en] (X11; U; Linux 2.2.16 i586) [Netscape]">
</head>
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
<h1>The nano FAQ</h1>
<h1>The GNU nano editor FAQ</h1>
<h2>Table of Contents</h2>
<h2><a href="#1">1. General</a></h2>
<blockquote><p><a href="#1.1">1.1 About this FAQ</a><br>
@@ -25,21 +24,24 @@
<blockquote><p><a href="#3.1">3.1. How do I install the RPM or DEB package?</a><br>
<a href="#3.2">3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</a><br>
<a href="#3.3">3.3. Why does everything go into /usr/local?</a><br>
<a href="#3.4">3.4. I get errors about 'bindtextdomain','gettext' and/or 'gettextdomain'. What can I do about it?</a><br>
<a href="#3.4">3.4. I get errors about 'bindtextdomain','gettext', and/or 'gettextdomain'. What can I do about it?</a><br>
<a href="#3.5">3.5. Nano should automatically run strip on the binary when installing it!</a><br>
<a href="#3.6">3.6. How can I make the executable smaller? This is too bloated!</a><br>
<a href="#3.7">3.7. Tell me more about this multibuffer stuff!</a><br>
<a href="#3.8">3.8. Tell me more about this verbatim input stuff!</a><br>
<a href="#3.9">3.9. How do I make a .nanorc file that nano will read when I start it?</a></p></blockquote>
<h2><a href="#4">4. Running</a></h2>
<blockquote><p><a href="#4.1">4.1. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</a><br>
<a href="#4.2">4.2. Nano crashes when I type &lt;insert keystroke here&gt;!</a><br>
<a href="#4.3">4.3. Nano crashes when I resize my window. How can I fix that?</a><br>
<a href="#4.4">4.4. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
<a href="#4.5a">4.5a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
<a href="#4.5b">4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
<a href="#4.6">4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
<a href="#4.7">4.7. I've compiled nano with color support, but I don't see any color when I run it!</a></p></blockquote>
<blockquote><p><a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
<a href="#4.2">4.2. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</a><br>
<a href="#4.3">4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
<a href="#4.4">4.4. Nano crashes when I type &lt;insert keystroke here&gt;!</a><br>
<a href="#4.5">4.5. Nano crashes when I resize my window. How can I fix that?</a><br>
<a href="#4.6">4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
<a href="#4.7a">4.7a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
<a href="#4.7b">4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
<a href="#4.8">4.8. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
<a href="#4.9">4.9. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
<a href="#4.10">4.10. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a></p></blockquote>
<h2><a href="#5">5. Internationalization</a></h2>
<blockquote><p><a href="#5.1">5.1. There's no translation for my language!</a><br>
<a href="#5.2">5.2. I don't like the translation for &lt;x&gt; in my language. How can I fix it?</a></p></blockquote>
@@ -51,7 +53,7 @@
<a href="#6.5">6.5. Why doesn't UW simply change their license?</a><br>
<a href="#6.6">6.6. What if tomorrow UW changes the license to be truly Free Software?</a></p></blockquote>
<h2><a href="#7">7. Miscellaneous</a></h2>
<blockquote><p><a href="#7.1">7.1. Nano related mailing lists.</a><br>
<blockquote><p><a href="#7.1">7.1. Nano-related mailing lists.</a><br>
<a href="#7.2">7.2. I want to send the development team a big load of cash (or just a thank you).</a><br>
<a href="#7.3">7.3. How do I submit a patch?</a><br>
<a href="#7.4">7.4. How do I join the development team?</a><br>
@@ -78,9 +80,9 @@
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program &quot;establishes a full duplex terminal connection to a remote host&quot;, 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.4. 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.6. 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.2/nano.1.html">here</a>.</p></blockquote>
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.3/nano.1.html">here</a>.</p></blockquote>
<hr width="100%">
<h1><a name="2"></a>2. Where to get GNU nano.</h1>
<h2><a name="2.1"></a>2.1. FTP and WWW sites that carry nano.</h2>
@@ -133,56 +135,65 @@
<blockquote><p>Well, that's what the <b>configure</b> script defaults to. If you wish to change this, simply do this:</p>
<p><b>./configure --prefix=/usr</b></p>
<p>to put nano into /usr/bin when you run <b>make install</b>.</p></blockquote>
<h2><a name="3.4"></a>3.4. I get errors about 'bindtextdomain', 'gettext' and/or 'gettextdomain'. What can I do about it?</h2>
<h2><a name="3.4"></a>3.4. I get errors about 'bindtextdomain', 'gettext', and/or 'gettextdomain'. What can I do about it?</h2>
<blockquote><p>Try doing a <b>./configure --with-included-gettext</b> and see if that solves your problem. You may need to do a <b>make clean; make</b> to get it to work fully.</p></blockquote>
<h2><a name="3.5"></a>3.5. Nano should automatically run strip on the binary when installing it!</h2>
<blockquote><p>Actually, it does, but you have to use <b>make install-strip</b>. The default make install does not, and will not, run strip automatically.</p></blockquote>
<h2><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h2>
<blockquote><p>Actually, there are several parts of the editor that can be disabled. You can pass arguments to the <b>configure</b> script that disable certain features. Here's a brief list:</p>
<pre>
<b>--disable-tabcomp</b> Disables tab completion code for a smaller binary
<b>--disable-tabcomp</b> Disable tab completion code for a smaller
binary
<b>--disable-justify</b> Disable justify/unjustify function
<b>--disable-speller</b> Disables spell checker function
<b>--disable-help</b> Disables help function (^G)
<b>--disable-browser</b> Disables mini file browser
<b>--disable-wrapping</b> Disables all wrapping of text (and -w flag)
<b>--disable-mouse</b> Disables mouse support (and -m flag)
<b>--disable-speller</b> Disable spell checker function
<b>--disable-help</b> Disable help function
<b>--disable-browser</b> Disable mini file browser
<b>--disable-wrapping</b> Disable all wrapping of text (and -w flag)
<b>--disable-mouse</b> Disable mouse support (and -m flag)
<b>--disable-operatingdir</b> Disable setting of operating directory</pre>
<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-nanorc</b> Enable use of .nanorc file
<b>--enable-color</b> Enables color and syntax highlighting
<b>--enable-multibuffer</b> Enables having multiple file buffers open
<b>--enable-all</b> Enables all of the above features</pre></blockquote>
<b>--enable-color</b> Enable color and syntax highlighting
<b>--enable-multibuffer</b> Enable having multiple file buffers open
<b>--enable-all</b> Enable all of the above features
<b>--disable-wrapping-as-root</b>
Turn off wrapping of text by default when the
user is root</pre></blockquote>
<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>
<p>You can move between the buffers you have open with the <b>Meta-&lt;</b> and <b>Meta-&gt;</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 &quot;Close&quot;, instead of the normal &quot;Exit&quot; 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 &quot;Verbatim input&quot;.) 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 three-digit ASCII code from 000 to 255, and the character with that ASCII code will be inserted instead.</p>
<p><b>NOTE:</b> Verbatim input doesn't work at prompts right now. This will be fixed soon.</p></blockquote>
<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 &quot;set nowrap&quot; or &quot;set suspend&quot;.</p></blockquote>
<hr width="100%">
<h1><a name="4"></a>4. Running</h1>
<h2><a name="4.1"></a>4.1. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</h2>
<h2><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h2>
<blockquote><p>If a command line option that begins with '+' is followed by another option, the former is always treated as a starting line number and the latter is always treated as a filename. If a command line option that begins with '+' isn't followed by another option, it's always treated as a filename. Examples:</p>
<p>To open '+filename.txt' starting on line 1: <b>nano +filename.txt</b><br>
To open '+filename.txt' starting on line 10: <b>nano +10 +filename.txt</b><br>
To open '+filename.txt' starting on line 1 and 'filename.txt' starting on line 10 (if nano has been compiled with multibuffer support): <b>nano +1 +filename.txt +20 filename.txt</b></p></blockquote>
<h2><a name="4.2"></a>4.2. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</h2>
<blockquote><p>Try setting your $TERM variable to 'vt100'. Nano doesn't yet support every term entry under the sun.</p>
<p>Bourne shell users (like bash): <b>export TERM=vt100</b><br>
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
<h2><a name="4.2"></a>4.2. Nano crashes when I type &lt;insert keystroke here&gt;!</h2>
<h2><a name="4.3"></a>4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, or Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
<h2><a name="4.4"></a>4.4. Nano crashes when I type &lt;insert keystroke here&gt;!</h2>
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or to <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</p></blockquote>
<h2><a name="4.3"></a>4.3. Nano crashes when I resize my window. How can I fix that?</h2>
<h2><a name="4.5"></a>4.5. Nano crashes when I resize my window. How can I fix that?</h2>
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9 would be great, 0.9.12 is recommended).</p></blockquote>
<h2><a name="4.4"></a>4.4. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
<h2><a name="4.6"></a>4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
<blockquote><p>The help (^G) and justify (^J) function were among the last to be written. To show the improvements that nano had over Pico (go to line # and replace), ^_ and ^\ were put on the shortcut list. Later, ^G came back in place of ^_ as it proved to be very valuable for new Unix users. If you use the <b>-p</b> option to nano (or hit Meta-P) you will get the same shortcuts at the bottom as Pico.</p></blockquote>
<a name="4.5"></a>
<h2><a name="4.5a"></a>4.5a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
<h2><a name="4.7a"></a>4.7a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
<blockquote><p>In nano version 0.9.20, the default is to have a completely consistent user interface across all user input functions. This means that regardless of whether you're being asked for a filename to insert or write, or a string to search for, the previous value is already inserted before the cursor. If you prefer the old behavior, use the Pico emulation mode (-p or --pico) or just hit Meta-P while in nano (see the ^G help text for more details).</p></blockquote>
<h2><a name="4.5b"></a>4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
<h2><a name="4.7b"></a>4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
<blockquote><p>It was decided that consistency was nice, but people are used to Pico's inconsistent behavior. Also, in version 1.1.99pre1, search and replace history was introduced. If you wish to edit your previous search/replace entry (or any previous entry), you can do so by hitting the up arrow to cycle through your history. This method allows the best of both worlds: You don't need to erase the previous string if you want to enter a new one, but you can with one keystroke recall previous entries for editing. Therefore there is now no "Pico mode", nano is and has always been a Pico <b>clone</b>, and clones by default should be compatible.</p></blockquote>
<h2><a name="4.6"></a>4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
<h2><a name="4.8"></a>4.8. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
<p>or if you use tcsh put this in your <b>.cshrc</b> file:</p>
@@ -195,8 +206,10 @@
<p>Mutt users should see an effect immediately the next time you log in, no further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
<h2><a name="4.7"></a>4.7. I've compiled nano with color support, but I don't see any color when I run it!</h2>
<h2><a name="4.9"></a>4.9. I've compiled nano with color support, but I don't see any color when I run it!</h2>
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Some example configurations are in the <b>nanorc.sample</b> that comes with the nano source or your nano package. See Section <a href="#3.9">3.9</a>.</p></blockquote>
<h2><a name="4.10"></a>4.10. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
<blockquote><p>Try holding down the Shift key and selecting the text as you normally would.</p></blockquote>
<hr width="100%">
<h1><a name="5"></a>5. Internationalization</h1>
<h2><a name="5.1"></a>5.1. There's no translation for my language!</h2>
@@ -221,13 +234,13 @@
<blockquote><p>Honestly nothing would make me happier than to see that happen. Nano would continue to be developed independently until such time as Pico had all the features nano did or the projects merged. That just does not seem very likely given that there has been no sign of any changes in the past few years in a positive direction.</p></blockquote>
<hr width="100%">
<h1><a name="7"></a>7. Miscellaneous</h1>
<h2><a name="7.1"></a>7.1. Nano related mailing lists.</h2>
<h2><a name="7.1"></a>7.1. Nano-related mailing lists.</h2>
<blockquote><p>There are three mailing lists for nano hosted at <a href="http://savannah.gnu.org/">Savannah</a>, info-nano, help-nano and nano-devel. Info-nano is a very low traffic list where new versions of nano are announced (surprise!) Help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. Nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
<p>info-nano - <a href="http://mail.gnu.org/mailman/listinfo/info-nano/">http://mail.gnu.org/mailman/listinfo/info-nano/</a><br>
help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
<h2><a name="7.2"></a>7.2. I want to send the development team a big load of cash (or just a thank you).</h2>
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v1.2/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v1.2/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v1.3/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v1.3/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
<h2><a name="7.3"></a>7.3. How do I submit a patch?</h2>
<blockquote><p>See Section <a href="#7.2">7.2</a>.</p></blockquote>
<h2><a name="7.4"></a>7.4. How do I join the development team?</h2>
@@ -237,6 +250,10 @@
<h2><a name="8"></a>8. ChangeLog</h2>
<blockquote>
<p>
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>
2004/11/05 - Fixed inaccuracy: Pico compatibility mode was made the default in nano 1.1.99pre1, not 1.2.2. Also added question about how to type F13-F16 on terminals lacking keys past F12 (suggested by Chris), question about how to select text for the clipboard in X terminals with nano's mouse support turned on (answer found by Joseph Birthisel), and misc. fixes and link updates. (DLR)<br>
2004/04/07 - Removed NumLock glitch question, as it's no longer needed. (DLR)<br>
2004/01/30 - Fixed inaccuracy: multibuffer mode was first in nano 1.1.0, not 1.1.12. (DLR)<br>
2003/12/31 - Added question about the new verbatim input function, and a few minor fixes. Removed reference to &quot;set pico&quot; (DLR).<br>

View File

@@ -2,19 +2,22 @@
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003 by
.\" Chris Allegretta <chrisa@asty.org>
.\"
.\" (c) 2003 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
.\" (c) 2003-2004 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
.\" pour l'adaptation française
.\"
.\" This is free documentation, see the latest version of the GNU General
.\" Public License for copying conditions. There is NO warranty.
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" Ce document est libre. Reportez-vous à la dernière version de la
.\" licence publique générale GNU (GNU GPL) pour connaître ses
.\" licence publique générale GNU (GNU GPL) pour connaître ses
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
.\"
.TH NANO 1 "19 juin 2003 (v.f. du 25 août 2003)"
.\" $Id$
.TH NANO 1 "version 1.3.4" "17 août 2004"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\"
.SH NOM
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
@@ -25,23 +28,31 @@ nano \- NAno un NOuvel
.br
.SH DESCRIPTION
Cette page de manuel décrit brièvement la commande \fBnano\fP.
Cette page de manuel décrit brièvement la commande \fBnano\fR.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
.\" respectively.
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à remplacer
Pico, l'éditeur par défaut du paquet non-libre Pine. \fBnano\fP ne se
contentant pas de copier l'interface et l'ergonomie de Pico, il offre
également certaines fonctionnalités manquantes (ou désactivées par
défaut) de Pico. Ces fonctionnalités sont, par exemple, les fonctions de
recherche et de remplacement, et la possibilité de sauter directement à
un numéro de ligne.
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à remplacer
Pico, l'éditeur par défaut du paquet non libre Pine. \fBnano\fR ne se
contentant pas de copier l'interface et l'ergonomie de Pico, il offre
également certaines fonctions manquantes (ou désactivées par défaut)
dans Pico. Ces fonctionnalités sont, par exemple, les fonctions de
recherche et de remplacement, et la possibilité de sauter directement à un
numéro de ligne.
.SH OPTIONS
.TP
.B \+\fILIGNE\fP
Démarre avec le curseur positionné à la ligne numéro \fILIGNE\fP.
.B \+\fILIGNE\fR
Démarre avec le curseur positionné à la ligne numéro \fILIGNE\fR.
.TP
.B \-A (\-\-smarthome)
Active le fonctionnement évolué de la touche «\ Début\ ». Lorsque cette
touche est pressée à n'importe quel endroit excepté au tout début du
texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur se
positionnera à ce début de ligne (qu'il soit en avant ou en arrière). Si
le curseur est déjà au tout début de la ligne, il se placera au vrai
début de la ligne.
.TP
.B \-B (\-\-backup)
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
@@ -50,55 +61,46 @@ version pr
.B \-D (\-\-dos)
Écrit le fichier au format DOS.
.TP
.B \-E \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
de sécurité si celles-ci sont activées.
.TP
.B \-F (\-\-multibuffer)
Active le mode multifichiers, autorisant l'édition simultanée de
plusieurs fichiers, si ce mode est disponible.
Active le mode multifichier, autorisant l'édition simultanée de plusieurs
fichiers, si ce mode est disponible.
.TP
.B \-H (\-\-historylog)
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
remplacement dans le fichier
.I ~/.nano_history
afin de permettre leur réutilisation. Ceci n'est possible que si
.B nano
est capable d'utiliser les fichiers
nanorc.
remplacement dans le fichier \fI~/.nano_history\fR afin de permettre leur
réutilisation. Ceci n'est possible que si \fBnano\fR est configuré pour
utiliser les fichiers nanorc.
.TP
.B \-I (\-\-ignorercfiles)
N'utilise pas les fichiers
.I $SYSCONFDIR/nanorc
et
.IR ~/.nanorc ,
même si
.B nano
est capable de les utiliser.
.TP
.B \-K (\-\-keypad)
Essaie au maximum de ne pas utiliser les appels keypad() de ncurses.
Utilisez ce paramètre si vous vous apercevez que les flèches du pavé
numérique ne fonctionnent pas sous nano.
N'utilise pas les fichiers \fISYSCONFDIR/nanorc\fR et \fI~/.nanorc\fR, même si
\fBnano\fR est capable de les utiliser.
.TP
.B \-M (\-\-mac)
Écrit le fichier au format Mac.
.TP
.B \-N (\-\-noconvert)
Désactive la conversion automatique des fichiers depuis les
formats Mac et DOS.
Désactive la conversion automatique des fichiers depuis les formats Mac et
DOS.
.TP
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
pour réaliser une justification correcte des citations.
Si nano est capable d'utiliser des expressions rationnelles, le préfixe
par défaut sera "^([\ \\t]*[|>:}#])+", sinon, ce sera ">\ ".
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
pour réaliser une justification correcte des citations. Si nano est
capable d'utiliser des expressions rationnelles, le préfixe par défaut
sera "^([\ \\t]*[|>:}#])+", sinon, ce sera ">\ ".
.TP
.B \-R (\-\-regexp)
Active l'utilisation d'expressions rationnelles lors des recherches,
ainsi que la possibilité d'utiliser \\\fIn\fP dans les chaînes de
remplacement pour faire référence à la \fIn\fP-ième sous-expression du
motif de recherche, si cette fonction est disponible.
Active l'utilisation d'expressions rationnelles lors des recherches, ainsi
que la possibilité d'utiliser \\n dans les chaînes de remplacement pour
faire référence à la n-ième sous-expression du motif de recherche, si
cette fonction est disponible.
.TP
.B \-S (\-\-smooth)
Active le défilement progressif. Le texte défilera ligne-par-ligne au
lieu de défiler morceau-par-morceau.
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
de défiler morceau-par-morceau.
.TP
.B \-T \fInombre\fP (\-\-tabsize=\fInombre\fP)
Définit la taille (largeur) des tabulations.
@@ -108,55 +110,68 @@ Affiche le num
.TP
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
Indique quel mode de colorisation syntaxique adopter, parmi les modes
définis dans le fichier
.IR .nanorc ,
si cette fonctionnalité est disponible.
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
disponible.
.TP
.B \-Z (\-\-restricted)
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
sur la ligne de commande, pas de lecture des fichiers nanorc,
interdiction de suspendre et interdiction de sauvegarder (ou d'ajouter
en tête ou en fin) un fichier ayant déjà un nom sous un nom différent.
Cette option peut aussi être activée en appelant \fBnano\fP sous un nom
commençant par «\ r\ » (par exemple «\ rnano\ »).
.TP
.B \-c (\-\-const)
Affiche en permanence la position du curseur.
.TP
.B \-d (\-\-rebinddelete)
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous devriez n'avoir besoin de cette option que si la touche
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
sur votre système.
.TP
.B \-h (\-\-help)
Affiche de la liste des options disponibles en ligne de commande.
Affiche un résumé des options disponibles en ligne de commande.
.TP
.B \-i (\-\-autoindent)
Indentation automatique. Commence chaque nouvelle ligne au même niveau
que la ligne précédente. Utile pour l'édition de code source.
Indentation automatique. Commence chaque nouvelle ligne au même niveau que
la ligne précédente. Utile pour l'édition de code source.
.TP
.B \-k (\-\-cut)
^K coupe le texte du curseur à la fin de la ligne, au lieu de couper la
^K coupe le texte du curseur à la fin de la ligne, au lieu de couper la
ligne entière.
.TP
.B \-l (\-\-nofollow)
Si le fichier édité est un lien symbolique, remplace le lien par le
nouveau fichier, sans le suivre. Ce mode ne serait-il pas utile pour
éditer les fichiers de
.IR /tmp \ ?
Si le fichier édité est un lien symbolique, remplace le lien par le
nouveau fichier, sans le suivre. Ce mode ne serait-il pas utile pour éditer
les fichiers de \fI/tmp\fR ?
.TP
.B \-m (\-\-mouse)
Active l'utilisation de la souris (si elle est disponible sur votre
Active l'utilisation de la souris (si elle est disponible sur votre
système).
.TP
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
Définit le répertoire de travail. Demande à nano de mettre en place
quelque-chose de similaire à une cage chroot.
Définit le répertoire de travail. Demande à nano de mettre en place
quelque chose de similaire à un environnement d'exécution restreint
(\fIchroot\fR).
.TP
.B \-p (\-\-preserve)
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient
reçues par le terminal.
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient reçues
par le terminal.
.TP
.B \-r \fIcolonne\fP (\-\-fill=\fIcolonne\fP)
Passe automatiquement à la ligne à la colonne \fIcolonne\fP. Par défaut,
le passage à la ligne se fait à la taille de l'écran moins huit. Si la
valeur indiquée est négative, le point de passage à la ligne sera
calculé relativement au bord droit de l'écran. Cela permet de faire
varier le point de passage à la ligne lorsque l'on change la taille de
l'écran.
Passe automatiquement à la ligne à la colonne \fIcolonne\fR. Par défaut, le
passage à la ligne se fait à la taille de l'écran moins huit. Si la
valeur indiquée est négative, le point de passage à la ligne sera
calculé relativement au bord droit de l'écran. Cela permet de faire varier
le point de passage à la ligne lorsque l'on change la taille de l'écran.
.TP
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
Choix d'un correcteur orthographique de remplacement.
.TP
.B \-t (\-\-tempfile)
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
demande de confirmation. Identique à l'option -t de Pico.
.TP
.B \-v (\-\-view)
@@ -174,56 +189,58 @@ Autorise
.B \-a, \-b, \-e, \-f, \-g, \-j
Ignoré, pour être compatible avec Pico.
.SH FICHIERS D'INITIALISATION
\fBnano\fP lit les fichiers d'initialisation dans l'ordre suivant\ :
\fI$SYSCONFDIR/nanorc\fP, puis \fI~/.nanorc\fP. Reportez-vous à la page
de manuel de \fBnanorc\fP(5) et au fichier-exemple \fInanorc.sample\fP
qui devrait être livré avec \fBnano\fP.
.SH "FICHIERS D'INITIALISATION"
\fBnano\fR lit les fichiers d'initialisation dans l'ordre suivant\ :
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de manuel
de \fBnanorc\fR(5) et au fichier-exemple \fInanorc.sample\fR qui devrait être
livré avec \fBnano\fR.
.SH NOTES
Dans certains cas, \fBnano\fP essaiera de sauvegarder le fichier en
cours d'édition dans un fichier de secours. Cela arrivera
principalement si \fBnano\fP reçoit un signal SIGHUP ou SIGTERM, ou
bien se trouve à court de mémoire. Le nom de ce fichier de secours sera
\fInano.save\fP si le fichier en cours n'avait pas encore de nom, ou
sera composé du nom du fichier en cours suivi du suffixe «\ .save\ ». Si
un fichier de ce nom existe déjà dans le répertoire, un «\ .save\ » et
un nombre seront ajoutée à la fin du nom du fichier en cours afin de le
rendre unique (par exemple, «\ .save.1\ »). En mode multifichiers,
\fBnano\fP réalisera une sauvegarde de tous les fichiers en cours dans
leurs fichiers de secours respectifs.
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
ligne de commande ou dans le fichier nanorc, \fBnano\fR prendra
la commande indiquée par la variable d'environnement \fBSPELL\fR si
elle est définie.
Dans certains cas, \fBnano\fR essaiera de sauvegarder le fichier en cours
d'édition dans un fichier de secours. Cela arrivera principalement si
\fBnano\fR reçoit un signal SIGHUP ou SIGTERM, ou bien se trouve à court de
mémoire. Le nom de ce fichier de secours sera \fInano.save\fR si le fichier en
cours n'avait pas encore de nom, ou sera composé du nom du fichier en cours
suivi du suffixe «\ .save\ ». Si un fichier de ce nom existe déjà dans
le répertoire, un «\ .save\ » et un nombre seront ajoutés à la fin du
nom du fichier en cours afin de le rendre unique (par exemple,
«\ .save.1\ »). En mode multifichier, \fBnano\fR réalisera une
sauvegarde de tous les fichiers en cours dans leurs fichiers de secours
respectifs.
.SH BOGUES
Merci de nous faire parvenir vos commentaires et de nous signaler les
bogues, en écrivant, en anglais, à
.BR nano@nano-editor.org .
Merci de nous faire parvenir vos commentaires et de nous signaler les
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
N'hésitez pas à faire parvenir vos suggestions et commentaires relatifs
à la version française de \fBnano\fP à
.BR jean-philippe.guerard@corbeaunoir.org .
La liste de discussion anglophone \fBnano\fR est disponible via
\fBnano-devel@gnu.org\fR.
La liste de discussion anglophone \fBnano\fP est disponible via
.BR nano-devel@gnu.org .
Pour vous abonner, envoyez un courrier électronique à
.BR nano-devel-request@gnu.org ,
ayant pour objet «\ subscribe\ ».
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
.SH SITE INTERNET
.SH "SITE INTERNET"
http://www.nano-editor.org/
.SH VOIR AUSSI
.SH "VOIR AUSSI"
.PD 0
.TP
\fBnanorc\fP(5)
\fBnanorc\fR(5)
.PP
\fI/usr/share/doc/nano/\fP (ou son équivalent sur votre système)
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
.SH AUTEUR
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
\fIAUTHORS\fP et \fITHANKS\fP pour plus d'information). Cette page de
manuel a été initialement rédigée par Jordi Mallach
<jordi@sindominio.net> pour le système GNU Debian (mais elle peut être
utilisée par d'autres).
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
\fIAUTHORS\fR et \fITHANKS\fR pour plus d'information). Cette page de manuel a
été initialement rédigée par Jordi Mallach
<jordi@sindominio.net> pour le système GNU Debian (mais elle peut
être utilisée par d'autres).
.SH TRADUCTION
Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>, 2003.
Adaptation française du 4\ septembre\ 2004 par
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.

View File

@@ -1,7 +1,7 @@
.\" Hey, EMACS: -*- nroff -*-
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
.\"
.\" (c) 2003 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
.\" (c) 2003-2004 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
.\" pour l'adaptation française
.\"
.\" This is free documentation, see the latest version of the GNU General
@@ -11,11 +11,12 @@
.\" licence publique générale GNU (GNU GPL) pour connaître ses
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
.\"
.TH NANORC 5 "19 juin 2003 (v.f. du 25 août 2003)"
.\" $Id$
.TH NANORC 5 "version 1.3.4" "17 août 2004"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.SH NAME
.SH NOM
nanorc \- fichier de configuration de l'éditeur nano du projet GNU
.SH DESCRIPTION
@@ -32,7 +33,7 @@ sauter directement
.PP
Le fichier \fInanorc\fP contient les paramètres par défaut de
\fBnano\fP. Lors de son démarrage, nano commence par lire le fichier de
configuration général \fI$SYSCONFDIR/nanorc\fP, puis lit le fichier de
configuration général \fISYSCONFDIR/nanorc\fP, puis lit le fichier de
configuration personnel de l'utilisateur \fI~/.nanorc\fP.
.SH OPTIONS
@@ -44,9 +45,9 @@ De plus, les mots clefs
sont utilisés pour définir les règles de colorisation pour différents
motifs de texte. Nano lira une commande par ligne.
Les options du fichier de configuration ont priorité sur les valeurs par
défaut utilisées par nano. Les options données sur la ligne de commande
permettent d'outrepasser les options du fichier de configuration.
Les options du fichier de configuration ont priorité sur les valeurs par
défaut utilisées par nano. Les options de la ligne de commande sont
prioritaires par rapport aux options du fichier de configuration.
Les options sont désactivées (unset) par défaut, sauf les options
prenant un argument.
@@ -58,16 +59,15 @@ Les commandes et arguments reconnus sont\ :
Active l'indentation automatique.
.TP
\fBset/unset backup\fP
Crée des copie de sécurité appelées
Crée des copie de sécurité nommées
.IR nom_du_fichier~ .
.TP
\fBset/unset const\fP
Affiche en permanence la position du curseur dans la barre
d'information.
Affiche en permanence la position du curseur dans la ligne d'état.
.TP
\fBset/unset cut\fP
Par défaut, utilise ^K pour couper le texte du curseur à la fin de la
ligne, au lieu de couper la ligne entière.
Par défaut, ^K coupe le texte du curseur jusqu'à la fin de la ligne, au
lieu de couper la ligne entière.
.TP
\fBset fill \fIn\fP\fP
Passe automatiquement à la ligne à la colonne \fIn\fP. Si la valeur
@@ -80,11 +80,9 @@ Active l'utilisation de
pour enregistrer et relire les chaînes ayant fait l'objet d'une
recherche ou d'un remplacement.
.TP
\fBset/unset keypad\fP
Utilise l'autre gestion du pavé numérique.
.TP
\fBset/unset multibuffer\fP
Permet de charger simultanément plusieurs fichiers.
Mode multifichier\ : permet de charger les fichiers dans leur propre
espace.
.TP
\fBset/unset noconvert\fP
Pas de conversion depuis les formats DOS et Mac.
@@ -93,7 +91,7 @@ Pas de conversion depuis les formats DOS et Mac.
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
.TP
\fBset/unset nohelp\fP
Désactive la barre d'aide affichée en bas de l'écran.
Désactive les lignes d'aide affichée en bas de l'écran.
.TP
\fBset/unset nowrap\fP
Désactive le passage automatique à la ligne.
@@ -101,12 +99,24 @@ D
\fBset operatingdir "\fIrépertoire\fP"\fP
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
le répertoire courant, afin que les fichiers soient écrits dans ce
dossier. Par défaut, cette fonction est désactivée.
le répertoire courant, afin que les fichiers soient lus depuis ce
répertoire. Par défaut, cette fonction est désactivée.
.TP
\fBset/unset preserve\fP
Préserve les séquences XON et XOFF (^Q et ^S).
.TP
\fBset punct "\fIchaîne\fP"\fP
Définit les caractères interprétés comme des ponctuations terminales.
Ces caractères ne peuvent inclure d'espaces ou de tabulations. Seules les
ponctuations terminales, éventuellement suivies de crochets fermants,
peuvent terminer une phrase.
(N.D.T.\ : ce réglage permet de conserver 2\ espaces au lieu d'une
derrière les ponctuations terminales lors de la justification, ce qui
correspond aux normes typographiques anglo-saxonnes, mais n'a pas lieu
d'être en français. Pour le français, le plus simple est d'indiquer dans
le fichier nanorc une chaîne vide pour ce paramètre.)
.TP
\fBset quotestr "\fIchaîne\fP"\fP
Définit le préfixe par défaut utilisé pour les citations dans les
courriers électroniques. Ce préfixe est utilisé pour réaliser une
@@ -120,9 +130,24 @@ expressions rationnelles, la valeur par d
Sinon, ce sera ">\ ". Notez que le «\ \\t\ » ci-dessus correspond à un
caractère de tabulation.
.TP
\fBset/unset rebinddelete\fP
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous devriez uniquement avoir besoin de cette option si la touche
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
sur votre système.
.TP
\fBset/unset regexp\fP
Utilise par défaut des expressions rationnelles pour les recherches.
.TP
\fBset/unset smarthome\fP
Active le fonctionnement évolué de la touche «\ Début\ ». Lorsque cette
touche est pressée à n'importe quel endroit excepté au tout début du
texte d'une ligne (i.\ e. au premier caractère non-blanc), le curseur se
positionnera à ce début de ligne (qu'il soit en avant ou en arrière). Si
le curseur est déjà au tout début de la ligne, il se placera au vrai
début de la ligne.
.TP
\fBset/unset smooth\fP
Active le défilement ligne-par-ligne du texte.
.TP
@@ -138,18 +163,23 @@ Utilise une largeur de tabulation de \fIn\fP au lieu de la valeur par
défaut (8). Cette valeur doit être supérieur à 0.
.TP
\fBset/unset tempfile\fP
S'il a été modifié, le fichier sera sauvegardé automatiquement
sans demande de confirmation.
S'il a été modifié, le fichier sera sauvegardé automatiquement en
quittant, sans demande de confirmation.
.TP
\fBset/unset view\fP
Interdit la modification du fichier.
.TP
\fBset whitespace "\fIchaîne\fP"\fP
Définit les deux caractères utilisés pour afficher les premiers
caractères de tabulations et d'espaces. Cela ne doit pas être
des caractère de contrôle.
.TP
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
l'option \fB-Y\fP, ou qui sera automatiquement activé si le nom du
fichier en cours correspond au \fImotif_de_fichier\fP. Toutes les
instructions de colorisation \fBcolor\fP suivantes s'appliqueront à cette
syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
instructions suivantes de colorisation \fBcolor\fP s'appliqueront à
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
.TP
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
@@ -170,7 +200,7 @@ par \fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
et éventuellement la couleur de fond \fIcouleur_fond\fP. Cela permet à
la colorisation syntaxique de s'étendre sur plusieurs lignes. Notez que
toutes les occurrences successives de \fImotif_début\fP après le
\fImotif_début\fP initial seront colorées jusqu'à la prochaine instance
\fImotif_début\fP initial seront surlignées jusqu'à la prochaine instance
de \fImotif_fin\fP.
.SH FICHIERS
@@ -195,4 +225,6 @@ Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
manuel a été rédigée par Jordi Mallach <jordi@gnu.org>.
.SH TRADUCTION
Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>, 2003.
Adaptation française du 4\ septembre\ 2004 par
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.

View File

@@ -1,12 +1,12 @@
.\" Hey, EMACS: -*- nroff -*-
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003 by
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by
.\" Chris Allegretta <chrisa@asty.org>
.\"
.\" This is free documentation, see the latest version of the GNU General
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" $Id$
.TH NANO 1 "version 1.3.4" "August 17, 2004"
.TH NANO 1 "version 1.3.6" "March 11, 2005"
.\" Please adjust this date whenever revising the manpage.
.\"
@@ -46,9 +46,6 @@ line.
When saving a file, back up the previous version of it to the current
filename suffixed with a ~.
.TP
.B \-D (\-\-dos)
Write file in DOS format.
.TP
.B \-E \fIdir\fP (\-\-backupdir=\fIdir\fP)
Set the directory where \fBnano\fP puts the backup files if file backups
are enabled.
@@ -69,12 +66,12 @@ or
.IR ~/.nanorc ,
if nanorc support is available.
.TP
.B \-M (\-\-mac)
Write file in Mac format.
.TP
.B \-N (\-\-noconvert)
Disable automatic conversion of files from DOS/Mac format.
.TP
.B \-O (\-\-morespace)
Use the blank line below the titlebar as extra editing space.
.TP
.B \-Q \fIstr\fP (\-\-quotestr=\fIstr\fP)
Set the quoting string for justifying. The default is
"^([\ \\t]*[|>:}#])+" if regular expression support is available, or
@@ -122,11 +119,11 @@ Indent new lines to the previous line's indentation. Useful when
editing source code.
.TP
.B \-k (\-\-cut)
Enable cut from cursor to end of line with ^K.
Enable cut from cursor to end of line.
.TP
.B \-l (\-\-nofollow)
If the file being edited is a symbolic link, replace the link with
a new file, do not follow it. Good for editing files in
a new file instead of following it. Good for editing files in
.IR /tmp ,
perhaps?
.TP
@@ -151,7 +148,7 @@ to vary along with the screen width if resized.
Enable alternative spell checker command.
.TP
.B \-t (\-\-tempfile)
Always save changed buffer without prompting. Same as Pico -t option.
Always save changed buffer without prompting. Same as Pico's -t option.
.TP
.B \-v (\-\-view)
View file (read only) mode.

View File

@@ -1,11 +1,12 @@
.\" Hey, EMACS: -*- nroff -*-
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
.\" nanorc.5 is Copyright (C) 2003, 2004, 2005 Free Software
.\" Foundation, Inc.
.\"
.\" This is free documentation, see the latest version of the GNU General
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" $Id$
.TH NANORC 5 "version 1.3.4" "August 17, 2004"
.TH NANORC 5 "version 1.3.6" "March 11, 2005"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -59,7 +60,7 @@ closing brackets, can end sentences.
Constantly display the cursor position in the status bar.
.TP
\fBset/unset cut\fP
Use cut to end of line with ^K by default.
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
@@ -70,6 +71,13 @@ Enable
.I ~/.nano_history
for saving and reading search/replace strings.
.TP
\fBset/unset morespace\fP
Allow use of the blank line below the titlebar as extra editing space.
.TP
\fBset/unset mouse\fP
Enable mouse support, so that mouse clicks can be used to set the mark
and run shortcuts.
.TP
\fBset/unset multibuffer\fP
Allow inserting files into their own buffers.
.TP
@@ -132,7 +140,7 @@ Use spelling checker \fIspellprog\fP instead of the built-in one, which
calls \fIspell\fP.
.TP
\fBset/unset suspend\fP
Allow nano to be suspended with ^Z.
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

View File

@@ -26,7 +26,7 @@
## Constantly display the cursor position in the status bar.
# set const
## Use cut to end of line with ^K by default.
## Use cut to end of line by default.
# set cut
## Set the line length for wrapping text and justifying paragraphs.
@@ -38,13 +38,16 @@
## Enable ~/.nano_history for saving and reading search/replace strings.
# set historylog
## Enable mouse support so that mouse clicks can be used to set the mark
## and run shortcuts.
## Use the blank line below the titlebar as extra editing space.
# set morespace
## Enable mouse support, so that mouse clicks can be used to set the
## mark and run shortcuts.
# set mouse
## Allow multiple file buffers (using ^R will insert into a separate
## buffer). You must have configured with --enable-multibuffer or
## --enable-extra for this to work.
## 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.
##
# set multibuffer
@@ -104,9 +107,9 @@
## Use this spelling checker instead of the internal one. This option
## does not properly have a default value.
##
# set speller "aspell -c"
# set speller "aspell -x -c"
## Allow nano to be suspended with ^Z.
## Allow nano to be suspended.
# set suspend
## Use this tab size instead of the default; it must be greater than 0.
@@ -115,11 +118,12 @@
## Save automatically on exit, don't prompt.
# set tempfile
## Disallow file modification, why would you want this in an rc file? ;)
## 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. ASCII 187 and ASCII 183 seem to be good values for these.
## spaces. 187 decimal (00BB hexadecimal) and 183 decimal (00B7
## hexadecimal) seem to be good values for these.
# set whitespace " "
## Color setup
@@ -139,8 +143,9 @@
# syntax "c-file" "\.(c|h)$"
# 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|break)\>"
# 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 brightmagenta "'([^\]|(\\['abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
##
## You will in general want your comments and strings to come last,
## because syntax highlighting rules will be applied in the order they
@@ -236,18 +241,28 @@
# color brightyellow "^@@.*"
# color magenta "^diff.*"
## Here is an example for manpages
##
# syntax "manpage" "\.[1-9]x?$"
# color green "\.(S|T)H.*$"
# color brightgreen "\.(S|T)H" "\.TP"
# color brightred "\.(BR?|I[PR]?).*$"
# color brightblue "\.(BR?|I[PR]?|PP)"
# color brightwhite "\\f[BIPR]"
# color yellow "\.(br|DS|RS|RE|PD)"
## Here is an example for your .nanorc
##
#syntax "nanorc" "(\.|/|)nanorc$"
# syntax "nanorc" "(\.|/|)nanorc$"
## highlight possible errors and parameters
#color brightwhite "^ *(set|unset|syntax|color).*$"
# color brightwhite "^ *(set|unset|syntax|color).*$"
## set, unset and syntax
#color cyan "^ *(set|unset) +(autoindent|backup|backupdir|brackets|const|cut|fill|historylog|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)\>"
# 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)\>"
## 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)="
# 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)="
## strings
#color white "\"(\\.|[^\"])*\""
# color white "\"(\\.|[^\"])*\""
## comments
#color blue "^ *#.*$"
# color blue "^ *#.*$"

View File

@@ -1,4 +1,5 @@
info_TEXINFOS = nano.texi
MAKEINFO = makeinfo --no-split
EXTRA_DIST = nano.info

View File

@@ -8,8 +8,8 @@
@c Run `makeinfo' rather than `texinfo-format-buffer'.
@smallbook
@set EDITION 0.1
@set VERSION 1.3.4
@set UPDATED 17 Aug 2004
@set VERSION 1.3.6
@set UPDATED 11 Mar 2005
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @code{nano}
@subtitle a small and friendly text editor.
@subtitle version 1.3.4
@subtitle version 1.3.6
@author Chris Allegretta
@page
@@ -33,7 +33,7 @@ editor.
This manual is part of the GNU @code{nano} distribution.@*
@sp4
Copyright (C) 1999, 2000, 2001, 2002 Chris Allegretta.
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Chris Allegretta.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@@ -118,9 +118,6 @@ line.
When saving a file, back up the previous version of it to the current
filename suffixed with a ~.
@item -D, --dos
Write file in DOS format.
@item -E, --backupdir=[dir]
Set the directory where @code{nano} puts the backup files if file
backups are enabled.
@@ -132,9 +129,6 @@ Enable multiple file buffers, if available.
Don't look at SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
available.
@item -M, --mac
Write file in Mac format.
@item -N, --noconvert
Do not convert files from DOS/Mac format.
@@ -187,16 +181,15 @@ Automatically indent new lines to the same number of spaces and tabs as
the previous line.
@item -k, --cut
Makes ^K cut from the current cursor position to the end of the current
line.
Cut from the current cursor position to the end of the current line.
@item -l, --nofollow
When writing files, if the given file is a symbolic link it is removed
When writing files, if the given file is a symbolic link, it is removed
and a new file is created.
@item -m, --mouse
Enables the use of the mouse to select text (currently only useful for
running under the X window system).
running under the X Window System).
@item -o [dir], --operatingdir=[dir]
Set operating directory. Makes @code{nano} set up something similar to
@@ -348,16 +341,13 @@ The following global toggles are available:
@item Backup File Toggle (Meta-B)
toggles the -B (@code{--backup}) command line flag.
@item DOS Format Toggle (Meta-D)
toggles the -D (@code{--dos}) command line flag.
@item Multiple Files Toggle (Meta-F)
@item Multiple File Buffers Toggle (Meta-F)
toggles the -F (@code{--multibuffer}) command line flag.
@item Backup File Toggle (Meta-H)
toggles the -A (@code{--smarthome}) command line flag.
@item AutoIndent Toggle (Meta-I)
@item Auto Indent Toggle (Meta-I)
toggles the -i (@code{--autoindent}) command line flag.
@item Cut To End Toggle (Meta-K)
@@ -369,8 +359,8 @@ toggles the -w (@code{--nowrap}) command line flag.
@item Mouse Toggle (Meta-M)
toggles the -m (@code{--mouse}) command line flag.
@item Mac Format Toggle (Meta-O)
toggles the -M (@code{--mac}) command line flag.
@item More Space Toggle (Meta-O)
toggles the -O (@code{--morespace}) command line flag.
@item Smooth Scrolling Toggle (Meta-S)
toggles the -S (@code{--smooth}) command line flag.

View File

@@ -1,4 +1,4 @@
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
iconv.m4 lcmessage.m4 glib-2.0.m4

212
m4/glib-2.0.m4 Normal file
View File

@@ -0,0 +1,212 @@
# Configure paths for GLIB
# Owen Taylor 1997-2001
dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
dnl gthread is specified in MODULES, pass to pkg-config
dnl
AC_DEFUN([AM_PATH_GLIB_2_0],
[dnl
dnl Get the cflags and libraries from pkg-config
dnl
AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
, enable_glibtest=yes)
pkg_config_args=glib-2.0
for module in . $4
do
case "$module" in
gmodule)
pkg_config_args="$pkg_config_args gmodule-2.0"
;;
gobject)
pkg_config_args="$pkg_config_args gobject-2.0"
;;
gthread)
pkg_config_args="$pkg_config_args gthread-2.0"
;;
esac
done
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
no_glib=""
if test x$PKG_CONFIG != xno ; then
if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
:
else
echo *** pkg-config too old; version 0.7 or better required.
no_glib=yes
PKG_CONFIG=no
fi
else
no_glib=yes
fi
min_glib_version=ifelse([$1], ,2.0.0,$1)
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
if test x$PKG_CONFIG != xno ; then
## don't try to run the test against uninstalled libtool libs
if $PKG_CONFIG --uninstalled $pkg_config_args; then
echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
enable_glibtest=no
fi
if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
:
else
no_glib=yes
fi
fi
if test x"$no_glib" = x ; then
GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_glibtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$GLIB_LIBS $LIBS"
dnl
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
dnl checks the results of pkg-config to some extent)
dnl
rm -f conf.glibtest
AC_TRY_RUN([
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.glibtest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = g_strdup("$min_glib_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_glib_version");
exit(1);
}
if ((glib_major_version != $glib_config_major_version) ||
(glib_minor_version != $glib_config_minor_version) ||
(glib_micro_version != $glib_config_micro_version))
{
printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
glib_major_version, glib_minor_version, glib_micro_version);
printf ("*** was found! If pkg-config was correct, then it is best\n");
printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
printf("*** to point to the correct configuration files\n");
}
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
(glib_minor_version != GLIB_MINOR_VERSION) ||
(glib_micro_version != GLIB_MICRO_VERSION))
{
printf("*** GLIB header files (version %d.%d.%d) do not match\n",
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
printf("*** library (version %d.%d.%d)\n",
glib_major_version, glib_minor_version, glib_micro_version);
}
else
{
if ((glib_major_version > major) ||
((glib_major_version == major) && (glib_minor_version > minor)) ||
((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
glib_major_version, glib_minor_version, glib_micro_version);
printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
major, minor, micro);
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
printf("*** correct copy of pkg-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
}
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_glib" = x ; then
AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$PKG_CONFIG" = "no" ; then
echo "*** A new enough version of pkg-config was not found."
echo "*** See http://www.freedesktop.org/software/pkgconfig/"
else
if test -f conf.glibtest ; then
:
else
echo "*** Could not run GLIB test program, checking why..."
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$LIBS $GLIB_LIBS"
AC_TRY_LINK([
#include <glib.h>
#include <stdio.h>
], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
GLIB_CFLAGS=""
GLIB_LIBS=""
GLIB_GENMARSHAL=""
GOBJECT_QUERY=""
GLIB_MKENUMS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_GENMARSHAL)
AC_SUBST(GOBJECT_QUERY)
AC_SUBST(GLIB_MKENUMS)
rm -f conf.glibtest
])

View File

@@ -1,3 +1,70 @@
2005-03-11 Jordi Mallach <jordi@gnu.org>
* ms.po: Updated Malay translation by
Sharuzzaman Ahmat Raslan.
2005-01-17 Jordi Mallach <jordi@gnu.org>
* pt_BR.po: Updated Brazilian Portuguese translation by
Joao Victor Duarte Martins.
2004-12-15 Jordi Mallach <jordi@gnu.org>
* it.po: Updated Italian translation by Marco Colombo.
2004-12-15 Jordi Mallach <jordi@gnu.org>
* sv.po: Updated Swedish translation by Christian Rose.
2004-12-13 Jordi Mallach <jordi@gnu.org>
* sv.po: Updated Swedish translation by Christian Rose.
2004-12-07 Jordi Mallach <jordi@gnu.org>
* it.po: Updated Italian translation by
Marco Colombo.
* ro.po: Updated Romanian translation by
Laurentiu Buzdugan.
2004-12-01 Jordi Mallach <jordi@gnu.org>
* ca.po: Updated Catalan translation.
* nb: Updated Norwegian bokmål translation by
Geir Helland.
* fr.po: Updated French translation by
Jean-Philippe Guérard.
2004-11-18 Jordi Mallach <jordi@gnu.org>
* fr.po: Updated French translation by
Jean-Philippe Guérard.
2004-11-18 Jordi Mallach <jordi@gnu.org>
* ms.po: Updated Malay translation by
Sharuzzaman Ahmat Raslan.
2004-10-07 Jordi Mallach <jordi@gnu.org>
* eu.po: Updated Basque translation by
Mikel Olasagasti.
2004-08-31 Jordi Mallach <jordi@gnu.org>
* es.po: Updated Spanish translation by
Ricardo Javier Cárdenes Medina.
2004-08-31 Jordi Mallach <jordi@gnu.org>
* fr.po: Updated Catalan translation by
Jean-Philippe Guérard.
2004-08-27 Jordi Mallach <jordi@gnu.org>
* ca.po: Updated Catalan translation.
* de.po: Updated German translation by Michael Piefel.
2004-06-01 Jordi Mallach <jordi@gnu.org>
* zh_TW.po: Added Traditional Chinese translation by

2072
po/ca.po

File diff suppressed because it is too large Load Diff

1840
po/de.po

File diff suppressed because it is too large Load Diff

2128
po/es.po

File diff suppressed because it is too large Load Diff

2135
po/eu.po

File diff suppressed because it is too large Load Diff

2017
po/fr.po

File diff suppressed because it is too large Load Diff

1945
po/it.po

File diff suppressed because it is too large Load Diff

1701
po/ms.po

File diff suppressed because it is too large Load Diff

2430
po/nb.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1692
po/ro.po

File diff suppressed because it is too large Load Diff

1982
po/sv.po

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
# Tranditional Chinese Messages for the nano editor
# Traditional Chinese Messages for the nano editor
# Copyright (C) 2004 Free Software Foundation, Inc.
# This file is distributed under the same license as the nano package.
# 趙惟倫 <chaoweilun@pcmail.com.tw>, 2004

View File

@@ -1,11 +1,11 @@
DEFS= -DSYSCONFDIR=\"$(sysconfdir)\"
localedir = $(datadir)/locale
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\"
ACLOCAL_AMFLAGS = -I m4
bin_PROGRAMS = nano
nano_SOURCES = color.c \
nano_SOURCES = chars.c \
color.c \
cut.c \
files.c \
global.c \
@@ -21,4 +21,4 @@ nano_SOURCES = color.c \
nano_LDADD = @GLIB_LIBS@ @LIBINTL@
install-exec-hook:
cd $(DESTDIR)$(bindir) && $(LN_S) nano rnano
cd $(DESTDIR)$(bindir) && rm -f rnano && $(LN_S) nano rnano

836
src/chars.c Normal file
View File

@@ -0,0 +1,836 @@
/* $Id$ */
/**************************************************************************
* chars.c *
* *
* Copyright (C) 2005 Chris Allegretta *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
* 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. *
* *
* 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. *
* *
**************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "proto.h"
#include "nano.h"
#ifdef NANO_WIDE
#ifdef HAVE_WCHAR_H
#include <wchar.h>
#endif
#ifdef HAVE_WCTYPE_H
#include <wctype.h>
#endif
#endif
/* Return TRUE if the value of c is in byte range, and FALSE
* otherwise. */
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)) {
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 is_alnum_wchar(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
;
}
/* This function is equivalent to isblank() for multibyte characters. */
bool is_blank_mbchar(const char *c)
{
assert(c != NULL);
#ifdef NANO_WIDE
if (!ISSET(NO_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 is_blank_wchar(wc);
} else
#endif
return is_blank_char((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)
{
return (-128 <= c && c < -96) || (0 <= c && c < 32) ||
(127 <= c && c < 160);
}
/* This function is equivalent to iscntrl() for multibyte characters,
* except in that it also handles multibyte control characters with
* their high bits set. */
bool is_cntrl_mbchar(const char *c)
{
assert(c != NULL);
#ifdef NANO_WIDE
if (!ISSET(NO_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 is_cntrl_wchar(wc);
} else
#endif
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)
{
return (0 <= wc && wc < 32) || (127 <= wc && wc < 160);
}
#endif
/* 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)
{
/* Treat newlines embedded in a line as encoded nulls. */
if (c == '\n')
return '@';
else if (c == NANO_CONTROL_8)
return '?';
else
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. */
wchar_t control_wrep(wchar_t wc)
{
/* Treat newlines embedded in a line as encoded nulls. */
if (wc == '\n')
return '@';
else if (wc == NANO_CONTROL_8)
return '?';
else
return wc + 64;
}
#endif
/* This function is equivalent to wcwidth() for multibyte characters. */
int mbwidth(const char *c)
{
assert(c != NULL);
#ifdef NANO_WIDE
if (!ISSET(NO_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX), width;
if (c_mb_len <= 0) {
mbtowc(NULL, NULL, 0);
wc = (unsigned char)*c;
}
width = wcwidth(wc);
if (width == -1)
width++;
return width;
} else
#endif
return 1;
}
/* Return the maximum width in bytes of a multibyte character. */
int mb_cur_max(void)
{
return
#ifdef NANO_WIDE
!ISSET(NO_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. */
char *make_mbchar(int chr, int *chr_mb_len)
{
char *chr_mb;
assert(chr_mb != NULL && chr_mb_len != NULL);
#ifdef NANO_WIDE
if (!ISSET(NO_UTF8)) {
chr_mb = charalloc(MB_CUR_MAX);
*chr_mb_len = wctomb(chr_mb, chr);
if (*chr_mb_len <= 0) {
wctomb(NULL, 0);
*chr_mb_len = 0;
}
} else {
#endif
*chr_mb_len = 1;
chr_mb = charalloc(1);
*chr_mb = (char)chr;
#ifdef NANO_WIDE
}
#endif
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
* character. If col isn't NULL, store the new display width in it. If
* *str is '\t', we expect col to have the current display width. */
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
*col)
{
int buf_mb_len;
assert(buf != NULL);
if (bad_chr != NULL)
*bad_chr = FALSE;
#ifdef NANO_WIDE
if (!ISSET(NO_UTF8)) {
/* Get the number of bytes in the multibyte character. */
buf_mb_len = mblen(buf, MB_CUR_MAX);
/* If buf contains a null byte or an invalid multibyte
* character, set bad_chr to TRUE (if it contains the latter)
* and interpret buf's first byte. */
if (buf_mb_len <= 0) {
mblen(NULL, 0);
if (buf_mb_len < 0 && bad_chr != NULL)
*bad_chr = TRUE;
buf_mb_len = 1;
}
/* Save the multibyte character in chr. */
if (chr != NULL) {
int i;
for (i = 0; i < buf_mb_len; i++)
chr[i] = buf[i];
}
/* Save the column width of the wide character in col. */
if (col != NULL) {
/* If we have a tab, get its width in columns using the
* current value of col. */
if (*buf == '\t')
*col += tabsize - *col % tabsize;
/* If we have a control character, get its width using one
* column for the "^" that will be displayed in front of it,
* and the width in columns of its visible equivalent as
* returned by control_mbrep(). */
else if (is_cntrl_mbchar(buf)) {
char *ctrl_buf_mb = charalloc(MB_CUR_MAX);
int ctrl_buf_mb_len;
(*col)++;
ctrl_buf_mb = control_mbrep(buf, ctrl_buf_mb,
&ctrl_buf_mb_len);
*col += mbwidth(ctrl_buf_mb);
free(ctrl_buf_mb);
/* If we have a normal character, get its width in columns
* normally. */
} else
*col += mbwidth(buf);
}
} else {
#endif
/* Get the number of bytes in the byte character. */
buf_mb_len = 1;
/* Save the byte character in chr. */
if (chr != NULL)
*chr = *buf;
if (col != NULL) {
/* If we have a tab, get its width in columns using the
* current value of col. */
if (*buf == '\t')
*col += tabsize - *col % tabsize;
/* If we have a control character, it's two columns wide:
* one column for the "^" that will be displayed in front of
* it, and one column for its visible equivalent as returned
* by control_mbrep(). */
else if (is_cntrl_char((unsigned char)*buf))
*col += 2;
/* If we have a normal character, it's one column wide. */
else
(*col)++;
}
#ifdef NANO_WIDE
}
#endif
return buf_mb_len;
}
/* Return the index in buf of the beginning of the multibyte character
* before the one at pos. */
size_t move_mbleft(const char *buf, size_t pos)
{
size_t pos_prev = pos;
assert(str != 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. */
while (TRUE) {
int buf_mb_len = parse_mbchar(buf + pos - pos_prev, NULL, NULL,
NULL);
if (pos_prev <= (size_t)buf_mb_len)
break;
pos_prev -= buf_mb_len;
}
return pos - pos_prev;
}
/* Return the index in buf of the beginning of the multibyte character
* after the one at pos. */
size_t move_mbright(const char *buf, size_t pos)
{
return pos + parse_mbchar(buf + pos, NULL, NULL, NULL);
}
#ifndef HAVE_STRCASECMP
/* This function is equivalent to strcasecmp(). */
int nstrcasecmp(const char *s1, const char *s2)
{
return strncasecmp(s1, s2, (size_t)-1);
}
#endif
/* This function is equivalent to strcasecmp() for multibyte strings. */
int mbstrcasecmp(const char *s1, const char *s2)
{
return mbstrncasecmp(s1, s2, (size_t)-1);
}
#ifndef HAVE_STRNCASECMP
/* This function is equivalent to strncasecmp(). */
int nstrncasecmp(const char *s1, const char *s2, size_t n)
{
assert(s1 != NULL && s2 != NULL);
for (; n > 0 && *s1 != '\0' && *s2 != '\0'; n--, s1++, s2++) {
if (tolower(*s1) != tolower(*s2))
break;
}
if (n > 0)
return (tolower(*s1) - tolower(*s2));
else
return 0;
}
#endif
/* This function is equivalent to strncasecmp() for multibyte
* strings. */
int mbstrncasecmp(const char *s1, const char *s2, size_t n)
{
#ifdef NANO_WIDE
if (!ISSET(NO_UTF8)) {
char *s1_mb = charalloc(MB_CUR_MAX);
char *s2_mb = charalloc(MB_CUR_MAX);
wchar_t ws1, ws2;
assert(s1 != NULL && s2 != NULL);
while (n > 0 && *s1 != '\0' && *s2 != '\0') {
int s1_mb_len, s2_mb_len;
s1_mb_len = parse_mbchar(s1, s1_mb, NULL, NULL);
if (mbtowc(&ws1, s1_mb, s1_mb_len) <= 0) {
mbtowc(NULL, NULL, 0);
ws1 = (unsigned char)*s1_mb;
}
s2_mb_len = parse_mbchar(s2, s2_mb, NULL, NULL);
if (mbtowc(&ws2, s2_mb, s2_mb_len) <= 0) {
mbtowc(NULL, NULL, 0);
ws2 = (unsigned char)*s2_mb;
}
if (n == 0 || towlower(ws1) != towlower(ws2))
break;
s1 += s1_mb_len;
s2 += s2_mb_len;
n--;
}
free(s1_mb);
free(s2_mb);
return (towlower(ws1) - towlower(ws2));
} else
#endif
return strncasecmp(s1, s2, n);
}
#ifndef HAVE_STRCASESTR
/* This function is equivalent to strcasestr(). It was adapted from
* mutt's mutt_stristr() function. */
const char *nstrcasestr(const char *haystack, const char *needle)
{
assert(haystack != NULL && needle != NULL);
for (; *haystack != '\0'; haystack++) {
const char *r = haystack, *q = needle;
for (; tolower(*r) == tolower(*q) && *q != '\0'; r++, q++)
;
if (*q == '\0')
return haystack;
}
return NULL;
}
#endif
/* This function is equivalent to strcasestr() for multibyte strings. */
const char *mbstrcasestr(const char *haystack, const char *needle)
{
#ifdef NANO_WIDE
if (!ISSET(NO_UTF8)) {
char *r_mb = charalloc(MB_CUR_MAX);
char *q_mb = charalloc(MB_CUR_MAX);
wchar_t wr, wq;
bool found_needle = FALSE;
assert(haystack != NULL && needle != NULL);
while (*haystack != '\0') {
const char *r = haystack, *q = needle;
int r_mb_len, q_mb_len;
while (*q != '\0') {
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;
}
q_mb_len = parse_mbchar(q, q_mb, NULL, NULL);
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
mbtowc(NULL, NULL, 0);
wq = (unsigned char)*q;
}
if (towlower(wr) != towlower(wq))
break;
r += r_mb_len;
q += q_mb_len;
}
if (*q == '\0') {
found_needle = TRUE;
break;
}
haystack += move_mbright(haystack, 0);
}
free(r_mb);
free(q_mb);
return found_needle ? haystack : NULL;
} else
#endif
return strcasestr(haystack, needle);
}
#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
/* This function is equivalent to strstr(), except in that it scans the
* string in reverse, starting at rev_start. */
const char *revstrstr(const char *haystack, const char *needle, const
char *rev_start)
{
assert(haystack != NULL && needle != NULL && rev_start != NULL);
for (; rev_start >= haystack; rev_start--) {
const char *r, *q;
for (r = rev_start, q = needle; *r == *q && *q != '\0'; r++, q++)
;
if (*q == '\0')
return rev_start;
}
return NULL;
}
#endif
#ifndef NANO_SMALL
/* This function is equivalent to strcasestr(), except in that it scans
* the string in reverse, starting at rev_start. */
const char *revstrcasestr(const char *haystack, const char *needle,
const char *rev_start)
{
assert(haystack != NULL && needle != NULL && rev_start != NULL);
for (; rev_start >= haystack; rev_start--) {
const char *r = rev_start, *q = needle;
for (; tolower(*r) == tolower(*q) && *q != '\0'; r++, q++)
;
if (*q == '\0')
return rev_start;
}
return NULL;
}
/* This function is equivalent to strcasestr() for multibyte strings,
* except in that it scans the string in reverse, starting at
* rev_start. */
const char *mbrevstrcasestr(const char *haystack, const char *needle,
const char *rev_start)
{
#ifdef NANO_WIDE
if (!ISSET(NO_UTF8)) {
char *r_mb = charalloc(MB_CUR_MAX);
char *q_mb = charalloc(MB_CUR_MAX);
wchar_t wr, wq;
bool begin_line = FALSE, found_needle = FALSE;
assert(haystack != NULL && needle != NULL && rev_start != NULL);
while (!begin_line) {
const char *r = rev_start, *q = needle;
int r_mb_len, q_mb_len;
while (*q != '\0') {
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;
}
q_mb_len = parse_mbchar(q, q_mb, NULL, NULL);
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
mbtowc(NULL, NULL, 0);
wq = (unsigned char)*q;
}
if (towlower(wr) != towlower(wq))
break;
r += r_mb_len;
q += q_mb_len;
}
if (*q == '\0') {
found_needle = TRUE;
break;
}
if (rev_start == haystack)
begin_line = TRUE;
else
rev_start = haystack + move_mbleft(haystack, rev_start -
haystack);
}
free(r_mb);
free(q_mb);
return found_needle ? rev_start : NULL;
} else
#endif
return revstrcasestr(haystack, needle, rev_start);
}
#endif
/* This function is equivalent to strlen() for multibyte strings. */
size_t mbstrlen(const char *s)
{
return mbstrnlen(s, (size_t)-1);
}
#ifndef HAVE_STRNLEN
/* This function is equivalent to strnlen(). */
size_t nstrnlen(const char *s, size_t maxlen)
{
size_t n = 0;
assert(s != NULL);
for (; maxlen > 0 && *s != '\0'; maxlen--, n++, s++)
;
return n;
}
#endif
/* This function is equivalent to strnlen() for multibyte strings. */
size_t mbstrnlen(const char *s, size_t maxlen)
{
assert(s != NULL);
#ifdef NANO_WIDE
if (!ISSET(NO_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);
if (maxlen == 0)
break;
maxlen--;
s += s_mb_len;
n++;
}
free(s_mb);
return n;
} else
#endif
return strnlen(s, maxlen);
}
#ifndef DISABLE_JUSTIFY
/* 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)) {
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);
if (c_mb_len <= 0) {
mbtowc(NULL, NULL, 0);
wc = (unsigned char)*c;
}
while (*s != '\0') {
s_mb_len = parse_mbchar(s, s_mb, NULL, NULL);
if (mbtowc(&ws, s_mb, s_mb_len) <= 0) {
mbtowc(NULL, NULL, 0);
ws = (unsigned char)*s;
}
if (ws == wc)
break;
s += s_mb_len;
q += s_mb_len;
}
free(s_mb);
if (ws != wc)
q = NULL;
return (char *)q;
} else
#endif
return strchr(s, *c);
}
#endif

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* color.c *
* *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 1999-2005 Chris Allegretta *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -19,13 +19,14 @@
* *
**************************************************************************/
#include "config.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "proto.h"
#include "nano.h"
@@ -45,14 +46,14 @@ void set_colorpairs(void)
for (; this_color != NULL; this_color = this_color->next) {
const colortype *beforenow = this_syntax->color;
for (; beforenow != NULL && beforenow != this_color &&
(beforenow->fg != this_color->fg ||
beforenow->bg != this_color->bg ||
beforenow->bright != this_color->bright);
beforenow = beforenow->next)
for (; beforenow != this_color &&
(beforenow->fg != this_color->fg ||
beforenow->bg != this_color->bg ||
beforenow->bright != this_color->bright);
beforenow = beforenow->next)
;
if (beforenow != NULL && beforenow != this_color)
if (beforenow != this_color)
this_color->pairnum = beforenow->pairnum;
else {
this_color->pairnum = color_pair;
@@ -67,14 +68,14 @@ void do_colorinit(void)
if (has_colors()) {
const colortype *tmpcolor = NULL;
#ifdef HAVE_USE_DEFAULT_COLORS
int defok;
bool defok;
#endif
start_color();
/* Add in colors, if available */
/* Add in colors, if available. */
#ifdef HAVE_USE_DEFAULT_COLORS
defok = use_default_colors() != ERR;
defok = (use_default_colors() != ERR);
#endif
for (tmpcolor = colorstrings; tmpcolor != NULL;
@@ -90,8 +91,8 @@ void do_colorinit(void)
init_pair(tmpcolor->pairnum, tmpcolor->fg, background);
#ifdef DEBUG
fprintf(stderr, "Running %s with fg = %d and bg = %d\n",
"init_pair()", tmpcolor->fg, tmpcolor->bg);
fprintf(stderr, "init_pair(): fg = %d, bg = %d\n",
tmpcolor->fg, tmpcolor->bg);
#endif
}
}
@@ -103,11 +104,12 @@ void update_color(void)
const syntaxtype *tmpsyntax;
colorstrings = NULL;
for (tmpsyntax = syntaxes; tmpsyntax != NULL; tmpsyntax = tmpsyntax->next) {
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) {
const exttype *e;
for (e = tmpsyntax->extensions; e != NULL; e = e->next) {
/* Set colorstrings if we matched the extension regex */
/* Set colorstrings if we matched the extension regex. */
if (regexec(&e->val, filename, 0, NULL, 0) == 0)
colorstrings = tmpsyntax->color;
@@ -116,10 +118,10 @@ void update_color(void)
}
}
/* if we haven't found a match, use the override string */
/* If we haven't found a match, use the override string. */
if (colorstrings == NULL && syntaxstr != NULL) {
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) {
tmpsyntax = tmpsyntax->next) {
if (strcasecmp(tmpsyntax->desc, syntaxstr) == 0)
colorstrings = tmpsyntax->color;
}

477
src/cut.c
View File

@@ -2,7 +2,7 @@
/**************************************************************************
* cut.c *
* *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 1999-2005 Chris Allegretta *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -19,7 +19,9 @@
* *
**************************************************************************/
#include "config.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
@@ -30,13 +32,6 @@
static bool keep_cutbuffer = FALSE;
/* Should we keep the contents of the cutbuffer? */
static int marked_cut;
/* Is the cutbuffer from a mark? 0 means whole-line cut, 1
* means mark, and 2 means cut-from-cursor. */
#ifndef NANO_SMALL
static bool concatenate_cut;
/* Should we add this cut string to the end of the last one? */
#endif
static filestruct *cutbottom = NULL;
/* Pointer to end of cutbuffer. */
@@ -45,423 +40,153 @@ void cutbuffer_reset(void)
keep_cutbuffer = FALSE;
}
filestruct *get_cutbottom(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. */
void cut_line(void)
{
return cutbottom;
}
void add_to_cutbuffer(filestruct *inptr, bool allow_concat)
{
#ifdef DEBUG
fprintf(stderr, "add_to_cutbuffer(): inptr->data = %s\n", inptr->data);
#endif
if (cutbuffer == NULL)
cutbuffer = inptr;
#ifndef NANO_SMALL
else if (allow_concat && concatenate_cut) {
/* Just tack the text in inptr onto the text in cutbottom,
* unless allow_concat is FALSE. */
cutbottom->data = charealloc(cutbottom->data,
strlen(cutbottom->data) + strlen(inptr->data) + 1);
strcat(cutbottom->data, inptr->data);
return;
}
#endif
else {
cutbottom->next = inptr;
inptr->prev = cutbottom;
}
cutbottom = inptr;
cutbottom->next = NULL;
if (current->next != NULL)
move_to_filestruct(&cutbuffer, &cutbottom, current, 0,
current->next, 0);
}
#ifndef NANO_SMALL
/* Cut a marked segment instead of a whole line.
*
* The first cut character is top->data[top_x]. Unless top == bot, the
* last cut line has length bot_x. That is, if bot_x > 0 then we cut to
* bot->data[bot_x - 1].
*
* We maintain totsize, totlines, filebot, the magicline, and line
* numbers. Also, we set current and current_x so the cursor will be on
* the first character after what was cut. We do not do any screen
* updates.
*
* Note cutbuffer might not be NULL if cut to end is used. */
void cut_marked_segment(void)
/* Move all currently marked text to the cutbuffer, and set the current
* place we want to where the text used to start. */
void cut_marked(void)
{
filestruct *top;
filestruct *bot;
filestruct *tmp;
size_t top_x;
size_t bot_x;
size_t newsize;
filestruct *top, *bot;
size_t top_x, bot_x;
/* If the mark doesn't cover any text, get out. */
if (current == mark_beginbuf && current_x == mark_beginx)
return;
assert(current != NULL && mark_beginbuf != NULL);
/* Set up the top and bottom lines and coordinates of the marked
* text. */
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x);
(const filestruct **)&bot, &bot_x, NULL);
/* Make the first cut line manually. Move the cut part of the top
* line into tmp, and set newsize to that partial line's length. */
tmp = copy_node(top);
newsize = (top == bot ? bot_x - top_x : strlen(top->data + top_x));
charmove(tmp->data, tmp->data + top_x, newsize);
null_at(&tmp->data, newsize);
/* Add the contents of tmp to the cutbuffer. Note that cutbuffer
* might be non-NULL if we have cut to end enabled. */
if (cutbuffer == NULL) {
cutbuffer = tmp;
cutbottom = tmp;
} else {
cutbottom->next = tmp;
tmp->prev = cutbottom;
cutbottom = tmp;
}
/* And make the top remainder line manually too. Update current_x
* and totlines to account for all the cut text, and update totsize
* to account for the length of the cut part of the first line. */
current_x = top_x;
totsize -= newsize;
totlines -= bot->lineno - top->lineno;
/* Now set newsize to be the length of the top remainder line plus
* the bottom remainder line, plus one for the null terminator. */
newsize = top_x + strlen(bot->data + bot_x) + 1;
if (top == bot) {
/* In this case, we're only cutting one line or part of one
* line, so the remainder line is shorter. This means that we
* must move text from the end forward first. */
charmove(top->data + top_x, bot->data + bot_x, newsize - top_x);
top->data = charealloc(top->data, newsize);
cutbottom->next = NULL;
#ifdef DEBUG
dump_buffer(cutbuffer);
#endif
return;
}
/* Update totsize to account for the cut part of the last line. */
totsize -= bot_x + 1;
/* Here, the top remainder line might get longer (if the bottom
* remainder line is added to the end of it), so we realloc() it
* first. */
top->data = charealloc(top->data, newsize);
charmove(top->data + top_x, bot->data + bot_x, newsize - top_x);
assert(cutbottom != NULL && cutbottom->next != NULL);
/* We're cutting multiple lines, so in particular the next line is
* cut too. */
cutbottom->next->prev = cutbottom;
/* Update totsize to account for all the complete lines that have
* been cut. After this, totsize is fully up to date. */
for (tmp = top->next; tmp != bot; tmp = tmp->next)
totsize -= strlen(tmp->data) + 1;
/* Make the last cut line manually. */
null_at(&bot->data, bot_x);
/* Move the rest of the cut text (other than the cut part of the top
* line) from the buffer to the end of the cutbuffer, and fix the
* edit buffer to account for the cut text. */
top->next = bot->next;
cutbottom = bot;
cutbottom->next = NULL;
if (top->next != NULL)
top->next->prev = top;
renumber(top);
current = top;
/* If the bottom line of the cut was the magicline, set filebot
* properly, and add a new magicline if the top remainder line
* (which is now the new bottom line) is non-blank. */
if (bot == filebot) {
filebot = top;
assert(bot_x == 0);
if (top_x > 0)
new_magicline();
}
#ifdef DEBUG
dump_buffer(cutbuffer);
#endif
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,
* not counting the newline at the end, to the cutbuffer. If we are,
* and we're not on the magicline, move the newline at the end to the
* cutbuffer, and set the current place we want to where the newline
* used to be. */
void cut_to_eol(void)
{
size_t data_len = strlen(current->data);
assert(current_x <= data_len);
if (current_x < data_len)
/* If we're not at the end of the line, move all the text from
* the current position up to it, not counting the newline at
* the end, to the cutbuffer. */
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. */
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
current->next, 0);
placewewant = xplustabs();
}
}
/* Move text from the current filestruct into the cutbuffer. */
void do_cut_text(void)
{
filestruct *fileptr;
assert(current != NULL && current->data != NULL);
check_statblank();
check_statusblank();
if (!keep_cutbuffer) {
/* If keep_cutbuffer is FALSE and the cutbuffer isn't empty, blow
* away the text in the cutbuffer. */
if (!keep_cutbuffer && cutbuffer != NULL) {
free_filestruct(cutbuffer);
cutbuffer = NULL;
marked_cut = 0;
#ifndef NANO_SMALL
concatenate_cut = FALSE;
#endif
#ifdef DEBUG
fprintf(stderr, "Blew away cutbuffer =)\n");
#endif
}
/* You can't cut the magicline except with the mark. But trying
* does clear the cutbuffer if keep_cutbuffer is FALSE. */
if (current == filebot
#ifndef NANO_SMALL
&& !ISSET(MARK_ISSET)
#endif
)
return;
/* Set keep_cutbuffer to TRUE, so that the text we're going to move
* into the cutbuffer will be added to the text already in the
* cutbuffer instead of replacing it. */
keep_cutbuffer = TRUE;
#ifndef NANO_SMALL
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
assert(current_x >= 0 && current_x <= strlen(current->data));
if (current->data[current_x] == '\0') {
/* If the line is empty and we didn't just cut a non-blank
* line, create a dummy blank line and add it to the
* cutbuffer. */
if (marked_cut != 1 && current->next != filebot) {
filestruct *junk = make_new_node(current);
junk->data = charalloc(1);
junk->data[0] = '\0';
add_to_cutbuffer(junk, TRUE);
#ifdef DEBUG
dump_buffer(cutbuffer);
#endif
}
do_delete();
marked_cut = 2;
return;
} else {
SET(MARK_ISSET);
mark_beginx = strlen(current->data);
mark_beginbuf = current;
}
}
if (ISSET(MARK_ISSET)) {
cut_marked_segment();
placewewant = xplustabs();
/* If the mark is on, move the marked text to the cutbuffer and
* turn the mark off. */
cut_marked();
UNSET(MARK_ISSET);
} else
#endif
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
/* Otherwise, move the entire line into the cutbuffer. */
cut_line();
/* If we just did a marked cut of part of a line, we should add
* the first line of any cut done immediately afterward to the
* end of this cut, as Pico does. */
if (current == mark_beginbuf && current_x < strlen(current->data))
concatenate_cut = TRUE;
marked_cut = 1;
edit_refresh();
set_modified();
return;
}
#endif /* !NANO_SMALL */
edit_refresh();
set_modified();
totlines--;
totsize -= strlen(current->data) + 1;
fileptr = current;
current = current->next;
current->prev = fileptr->prev;
add_to_cutbuffer(fileptr, TRUE);
#ifdef DEBUG
dump_buffer(cutbuffer);
#endif
if (fileptr == fileage)
fileage = current;
else
current->prev->next = current;
if (fileptr == edittop)
edittop = current;
renumber(current);
current_x = 0;
edit_refresh();
set_modified();
marked_cut = 0;
#ifndef NANO_SMALL
concatenate_cut = FALSE;
#endif
}
#ifndef NANO_SMALL
/* Cut from the current cursor position to the end of the file. */
void do_cut_till_end(void)
{
assert(current != NULL && current->data != NULL);
check_statusblank();
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
filebot, 0);
edit_refresh();
set_modified();
#ifdef DEBUG
dump_buffer(cutbuffer);
#endif
}
#endif
/* Copy text from the cutbuffer into the current filestruct. */
void do_uncut_text(void)
{
filestruct *tmp = current;
filestruct *newbuf = NULL;
filestruct *newend = NULL;
assert(current != NULL && current->data != NULL);
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
check_statblank();
if (cutbuffer == NULL || current == NULL)
return; /* AIEEEEEEEEEEEE */
/* If we're uncutting a previously non-marked block, uncut to end if
* we're not at the beginning of the line. If we are at the
* beginning of the line, set placewewant to 0. Pico does both of
* these. */
if (marked_cut == 0) {
if (current_x != 0)
marked_cut = 2;
else
placewewant = 0;
}
check_statusblank();
/* If we're going to uncut on the magicline, always make a new
* magicline in advance, as Pico does. */
if (current->next == NULL)
new_magicline();
if (marked_cut == 0 || cutbuffer->next != NULL) {
newbuf = copy_filestruct(cutbuffer);
for (newend = newbuf; newend->next != NULL && newend != NULL;
newend = newend->next)
totlines++;
}
/* Hook newbuf in at current. */
if (marked_cut != 0) {
filestruct *hold = current;
/* If there's only one line in the cutbuffer... */
if (cutbuffer->next == NULL) {
size_t buf_len = strlen(cutbuffer->data);
size_t cur_len = strlen(current->data);
current->data = charealloc(current->data, cur_len + buf_len + 1);
charmove(current->data + current_x + buf_len,
current->data + current_x, cur_len - current_x + 1);
strncpy(current->data + current_x, cutbuffer->data, buf_len);
/* Use strncpy() to not copy the null terminator. */
current_x += buf_len;
totsize += buf_len;
placewewant = xplustabs();
} else { /* Yuck -- no kidding! */
char *tmpstr, *tmpstr2;
tmp = current->next;
/* New beginning. */
tmpstr = charalloc(current_x + strlen(newbuf->data) + 1);
strncpy(tmpstr, current->data, current_x);
strcpy(&tmpstr[current_x], newbuf->data);
totsize += strlen(newbuf->data) + strlen(newend->data) + 1;
/* New end. */
tmpstr2 = charalloc(strlen(newend->data) +
strlen(&current->data[current_x]) + 1);
strcpy(tmpstr2, newend->data);
strcat(tmpstr2, &current->data[current_x]);
free(current->data);
current->data = tmpstr;
current->next = newbuf->next;
newbuf->next->prev = current;
delete_node(newbuf);
current_x = strlen(newend->data);
placewewant = xplustabs();
free(newend->data);
newend->data = tmpstr2;
newend->next = tmp;
/* If tmp isn't NULL, we're in the middle: update the
* prev pointer. If it IS NULL, we're at the end; update
* the filebot pointer. */
if (tmp != NULL)
tmp->prev = newend;
else {
filebot = newend;
new_magicline();
}
/* Now why don't we update the totsize also? */
for (tmp = current->next; tmp != newend; tmp = tmp->next)
totsize += strlen(tmp->data) + 1;
current = newend;
}
/* If marked cut == 2, it means that we're doing a cut to end
* and we don't want anything else on the line, so we have to
* screw up all the work we just did and separate the line. */
if (marked_cut == 2) {
tmp = make_new_node(current);
tmp->data = mallocstrcpy(NULL, current->data + current_x);
splice_node(current, tmp, current->next);
null_at(&current->data, current_x);
current = current->next;
current_x = 0;
placewewant = 0;
/* Extra line added; update stuff. */
totlines++;
totsize++;
}
/* Renumber from BEFORE where we pasted ;) */
renumber(hold);
#ifdef DEBUG
dump_buffer(fileage);
dump_buffer(cutbuffer);
#endif
set_modified();
edit_refresh();
/* If the cutbuffer is empty, get out. */
if (cutbuffer == NULL)
return;
}
if (current != fileage) {
tmp = current->prev;
tmp->next = newbuf;
newbuf->prev = tmp;
} else
fileage = newbuf;
totlines++; /* Unmarked uncuts don't split lines. */
/* Add a copy of the text in the cutbuffer to the current filestruct
* at the current cursor position. */
copy_from_filestruct(cutbuffer, cutbottom);
/* This is so uncutting at the top of the buffer will work => */
if (current_y == 0)
edittop = newbuf;
/* Set the current place we want to where the text from the
* cutbuffer ends. */
placewewant = xplustabs();
/* Connect the end of the buffer to the filestruct. */
newend->next = current;
current->prev = newend;
/* Recalculate size *sigh* */
for (tmp = newbuf; tmp != current; tmp = tmp->next)
totsize += strlen(tmp->data) + 1;
renumber(newbuf);
edit_refresh();
set_modified();
#ifdef DEBUG
dump_buffer_reverse();
#endif
set_modified();
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* global.c *
* *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 1999-2005 Chris Allegretta *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -19,11 +19,12 @@
* *
**************************************************************************/
#include "config.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <assert.h>
#include <sys/stat.h>
#include "proto.h"
#include "nano.h"
@@ -39,9 +40,9 @@ 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? */
long flags = 0; /* Our flag containing many options */
unsigned long flags = 0; /* Our flag containing many options */
WINDOW *topwin; /* Top buffer */
WINDOW *edit; /* The file portion of the editor */
WINDOW *topwin; /* Top line of screen */
WINDOW *bottomwin; /* Bottom buffer */
char *filename = NULL; /* Name of the file */
@@ -52,24 +53,32 @@ struct stat originalfilestat; /* Stat for the file as we loaded it */
int editwinrows = 0; /* How many rows long is the edit
window? */
filestruct *current; /* Current buffer pointer */
int current_x = 0, current_y = 0; /* Current position of X and Y in
the editor - relative to edit
window (0,0) */
size_t current_x = 0; /* Current x-coordinate in the edit
window */
int 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
buffer with respect to the
file struct */
filestruct *filebot = NULL; /* Last node in the file struct */
filestruct *cutbuffer = NULL; /* A place to store cut text */
#ifndef DISABLE_JUSTIFY
filestruct *jusbuffer = NULL; /* A place to store unjustified text */
#endif
partition *filepart = NULL; /* A place to store a portion of the
file struct */
#ifdef ENABLE_MULTIBUFFER
openfilestruct *open_files = NULL; /* The list of open files */
openfilestruct *open_files = NULL; /* The list of open file
buffers */
#endif
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
char *whitespace = NULL; /* Characters used when displaying
the first characters of tabs and
spaces. */
int whitespace_len[2]; /* The length of the characters. */
#endif
#ifndef DISABLE_JUSTIFY
@@ -93,11 +102,10 @@ size_t quotelen; /* strlen(quotestr) */
char *backup_dir = NULL; /* Backup directory. */
#endif
int resetstatuspos; /* Hack for resetting the status bar
cursor position */
char *answer = NULL; /* Answer str to many questions */
int totlines = 0; /* Total number of lines in the file */
long totsize = 0; /* Total number of bytes 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
to jump to when we go to the
next or previous line */
@@ -114,7 +122,7 @@ char *help_text; /* The text in the help window */
#ifndef NANO_SMALL
filestruct *mark_beginbuf; /* The begin marker buffer */
int mark_beginx; /* X value in the string to start */
size_t mark_beginx; /* X value in the string to start */
#endif
#ifndef DISABLE_OPERATINGDIR
@@ -130,7 +138,7 @@ shortcut *main_list = NULL;
shortcut *whereis_list = NULL;
shortcut *replace_list = NULL;
shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */
shortcut *goto_list = NULL;
shortcut *gotoline_list = NULL;
shortcut *writefile_list = NULL;
shortcut *insertfile_list = NULL;
#ifndef DISABLE_HELP
@@ -153,9 +161,7 @@ syntaxtype *syntaxes = NULL;
char *syntaxstr = NULL;
#endif
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
const shortcut *currshortcut; /* Current shortcut list we're using */
#endif
#ifndef NANO_SMALL
toggle *toggles = NULL;
@@ -178,9 +184,7 @@ bool curses_ended = FALSE; /* Indicates to statusbar() to simply
* write to stderr, since endwin() has
* ended curses mode. */
#ifdef ENABLE_NANORC
char *homedir = NULL; /* $HOME or from /etc/passwd. */
#endif
size_t length_of_list(const shortcut *s)
{
@@ -196,7 +200,7 @@ void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
#ifndef DISABLE_HELP
const char *help,
#endif
int metaval, int funcval, int miscval, int view, void
int metaval, int funcval, int miscval, bool view, void
(*func)(void))
{
shortcut *s;
@@ -224,7 +228,7 @@ void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
s->next = NULL;
}
void shortcut_init(int unjustify)
void shortcut_init(bool unjustify)
{
const char *get_help_msg = N_("Get Help");
const char *exit_msg = N_("Exit");
@@ -235,6 +239,14 @@ void shortcut_init(int unjustify)
const char *cancel_msg = N_("Cancel");
const char *first_line_msg = N_("First Line");
const char *last_line_msg = N_("Last Line");
#ifndef NANO_SMALL
const char *cut_till_end_msg = N_("CutTillEnd");
#endif
#ifndef DISABLE_JUSTIFY
const char *beg_of_par_msg = N_("Beg of Par");
const char *end_of_par_msg = N_("End of Par");
const char *fulljstify_msg = N_("FullJstify");
#endif
#ifndef NANO_SMALL
const char *case_sens_msg = N_("Case Sens");
const char *direction_msg = N_("Direction");
@@ -242,6 +254,9 @@ void shortcut_init(int unjustify)
const char *regexp_msg = N_("Regexp");
#endif
const char *history_msg = N_("History");
#ifdef ENABLE_MULTIBUFFER
const char *new_buffer_msg = N_("New Buffer");
#endif
#endif /* !NANO_SMALL */
#ifndef DISABLE_BROWSER
const char *to_files_msg = N_("To Files");
@@ -269,8 +284,12 @@ void shortcut_init(int unjustify)
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_goto_msg = N_("Go to a specific line number");
const char *nano_gotoline_msg = N_("Go to a specific line 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");
const char *nano_whereis_next_msg = N_("Repeat last search");
#endif
const char *nano_prevline_msg = N_("Move to the previous line");
const char *nano_nextline_msg = N_("Move to the next line");
const char *nano_forward_msg = N_("Move forward one character");
@@ -278,38 +297,41 @@ void shortcut_init(int unjustify)
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_mark_msg = N_("Mark text at the current cursor location");
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 = N_("Insert a tab character");
const char *nano_tab_msg =
N_("Insert a tab character at the cursor position");
const char *nano_enter_msg =
N_("Insert a carriage return at the cursor position");
#ifndef NANO_SMALL
const char *nano_nextword_msg = N_("Move forward one word");
const char *nano_prevword_msg = N_("Move backward one word");
#endif
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
#ifdef ENABLE_MULTIBUFFER
const char *nano_openprev_msg = N_("Switch to previous file buffer");
const char *nano_opennext_msg = N_("Switch to next file buffer");
#endif
#ifndef NANO_SMALL
#ifdef HAVE_REGEX_H
const char *nano_bracket_msg = N_("Find other bracket");
#endif
const char *nano_whereis_next_msg = N_("Repeat last search");
#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");
#ifndef DISABLE_JUSTIFY
const char *nano_parabegin_msg =
N_("Go to the beginning of the current paragraph");
const char *nano_paraend_msg =
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");
#endif
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
#ifndef NANO_SMALL
const char *nano_cut_till_end_msg =
N_("Cut from the cursor position to the end of the file");
#endif
#ifndef DISABLE_JUSTIFY
const char *nano_fulljustify_msg = N_("Justify the entire file");
#endif
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
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");
#ifndef NANO_SMALL
const char *nano_case_msg =
N_("Make the current search/replace case (in)sensitive");
@@ -335,7 +357,7 @@ void shortcut_init(int unjustify)
const char *nano_backup_msg = N_("Back up original file when saving");
const char *nano_execute_msg = N_("Execute external command");
#endif
#if defined(ENABLE_MULTIBUFFER) && !defined(NANO_SMALL)
#if !defined(NANO_SMALL) && defined(ENABLE_MULTIBUFFER)
const char *nano_multibuffer_msg = N_("Insert into new buffer");
#endif
#ifndef DISABLE_BROWSER
@@ -366,18 +388,14 @@ void shortcut_init(int unjustify)
#endif
);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_EXIT_KEY,
#ifdef ENABLE_MULTIBUFFER
if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL))
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_EXIT_KEY, N_("Close"),
IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
NANO_NO_KEY, VIEW, do_exit);
else
open_files != NULL && open_files != open_files->next ?
N_("Close") :
#endif
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_EXIT_KEY, exit_msg,
IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
NANO_NO_KEY, VIEW, do_exit);
exit_msg, IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
NANO_NO_KEY, VIEW, do_exit);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_WRITEOUT_KEY, N_("WriteOut"),
@@ -409,7 +427,8 @@ void shortcut_init(int unjustify)
#else
NOVIEW
#endif
, !ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg);
, !ISSET(RESTRICTED) ? do_insertfile_void :
nano_disabled_msg);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_WHEREIS_KEY, N_("Where Is"),
@@ -435,7 +454,7 @@ void shortcut_init(int unjustify)
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, N_("UnJustify"),
IFHELP(NULL, NANO_NO_KEY), NANO_UNJUSTIFY_FKEY,
NANO_NO_KEY, NOVIEW, 0);
NANO_NO_KEY, NOVIEW, NULL);
else
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_UNCUT_KEY, N_("UnCut Txt"),
@@ -459,13 +478,23 @@ void shortcut_init(int unjustify)
#endif
nano_disabled_msg);
sc_init_one(&main_list, NANO_GOTO_KEY, go_to_line_msg,
IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
NANO_NO_KEY, VIEW, do_gotoline_void);
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);
sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg,
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), NANO_REPLACE_FKEY,
NANO_NO_KEY, NOVIEW, do_replace);
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
NANO_REPLACE_FKEY, NANO_NO_KEY, NOVIEW, do_replace);
#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);
sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"),
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, do_research);
#endif
sc_init_one(&main_list, NANO_PREVLINE_KEY, N_("Prev Line"),
IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY,
@@ -495,16 +524,6 @@ void shortcut_init(int unjustify)
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, total_refresh);
sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
NANO_NO_KEY, NANO_NO_KEY, NOVIEW,
#ifndef NANO_SMALL
do_mark
#else
nano_disabled_msg
#endif
);
sc_init_one(&main_list, NANO_DELETE_KEY, N_("Delete"),
IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, do_delete);
@@ -531,9 +550,17 @@ void shortcut_init(int unjustify)
NANO_NO_KEY, VIEW, do_prev_word);
#endif
sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, do_verbatim_input);
#ifndef DISABLE_JUSTIFY
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_NO_KEY, beg_of_par_msg,
IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin_void);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_NO_KEY, end_of_par_msg,
IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
#endif
#ifdef ENABLE_MULTIBUFFER
sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
@@ -545,18 +572,30 @@ void shortcut_init(int unjustify)
NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
#endif
sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, do_verbatim_input);
#ifndef NANO_SMALL
#ifdef HAVE_REGEX_H
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_NO_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
#ifndef DISABLE_JUSTIFY
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_NO_KEY, fulljstify_msg,
IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY),
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
#endif
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"),
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, do_find_bracket);
#endif
sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"),
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
NANO_NO_KEY, NANO_NO_KEY, VIEW, do_research);
#endif
free_shortcutage(&whereis_list);
sc_init_one(&whereis_list, NANO_HELP_KEY, get_help_msg,
@@ -572,7 +611,7 @@ void shortcut_init(int unjustify)
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_CANCEL_KEY, cancel_msg,
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, first_line_msg,
@@ -585,59 +624,63 @@ void shortcut_init(int unjustify)
NANO_NO_KEY, VIEW, do_last_line);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, replace_msg,
sc_init_one(&whereis_list, NANO_TOOTHERSEARCH_KEY, replace_msg,
IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
NANO_NO_KEY, VIEW, do_replace);
NANO_NO_KEY, VIEW, NULL);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, go_to_line_msg,
IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
NANO_NO_KEY, VIEW, do_gotoline_void);
sc_init_one(&whereis_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
NANO_NO_KEY, VIEW, NULL);
#ifndef DISABLE_JUSTIFY
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, N_("Beg of Par"),
IFHELP(nano_parabegin_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, do_para_begin);
sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, beg_of_par_msg,
IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin_void);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_PARAEND_KEY, N_("End of Par"),
IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, do_para_end);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, N_("FullJstify"),
IFHELP(nano_fulljustify_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, do_full_justify);
sc_init_one(&whereis_list, NANO_PARAEND_KEY, end_of_par_msg,
IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
#endif
#ifndef NANO_SMALL
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_NO_KEY, case_sens_msg,
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
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,
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
#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,
NANO_NO_KEY, VIEW, 0);
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,
NANO_NO_KEY, VIEW, 0);
#endif
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 */
#ifndef DISABLE_JUSTIFY
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, fulljstify_msg,
IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY),
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
#endif
free_shortcutage(&replace_list);
sc_init_one(&replace_list, NANO_HELP_KEY, get_help_msg,
@@ -652,7 +695,7 @@ void shortcut_init(int unjustify)
sc_init_one(&replace_list, NANO_CANCEL_KEY, cancel_msg,
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, first_line_msg,
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY,
@@ -663,32 +706,32 @@ void shortcut_init(int unjustify)
NANO_NO_KEY, VIEW, do_last_line);
/* Translators: try to keep this string under 12 characters long */
sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, N_("No Replace"),
sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"),
IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
NANO_NO_KEY, VIEW, do_search);
NANO_NO_KEY, VIEW, NULL);
sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, go_to_line_msg,
IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
NANO_NO_KEY, VIEW, do_gotoline_void);
sc_init_one(&replace_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
NANO_NO_KEY, VIEW, NULL);
#ifndef NANO_SMALL
sc_init_one(&replace_list, NANO_NO_KEY, case_sens_msg,
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
sc_init_one(&replace_list, NANO_NO_KEY, direction_msg,
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
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, 0);
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,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
#endif /* !NANO_SMALL */
free_shortcutage(&replace_list_2);
@@ -705,7 +748,7 @@ void shortcut_init(int unjustify)
sc_init_one(&replace_list_2, NANO_CANCEL_KEY, cancel_msg,
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, first_line_msg,
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
@@ -718,12 +761,12 @@ void shortcut_init(int unjustify)
#ifndef NANO_SMALL
sc_init_one(&replace_list_2, NANO_HISTORY_KEY, history_msg,
IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
#endif
free_shortcutage(&goto_list);
free_shortcutage(&gotoline_list);
sc_init_one(&goto_list, NANO_HELP_KEY, get_help_msg,
sc_init_one(&gotoline_list, NANO_HELP_KEY, get_help_msg,
IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
NANO_NO_KEY, VIEW,
#ifndef DISABLE_HELP
@@ -733,40 +776,48 @@ void shortcut_init(int unjustify)
#endif
);
sc_init_one(&goto_list, NANO_CANCEL_KEY, cancel_msg,
sc_init_one(&gotoline_list, NANO_CANCEL_KEY, cancel_msg,
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, first_line_msg,
sc_init_one(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg,
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, do_first_line);
sc_init_one(&goto_list, NANO_LASTLINE_KEY, last_line_msg,
sc_init_one(&gotoline_list, NANO_LASTLINE_KEY, last_line_msg,
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, do_last_line);
sc_init_one(&gotoline_list, NANO_TOOTHERWHEREIS_KEY,
N_("Go To Text"), IFHELP(nano_whereis_msg, NANO_NO_KEY),
NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
#ifndef DISABLE_HELP
free_shortcutage(&help_list);
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, 0);
NANO_NO_KEY, VIEW, NULL);
sc_init_one(&help_list, NANO_NEXTPAGE_KEY, next_page_msg,
IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
sc_init_one(&help_list, NANO_PREVLINE_KEY, N_("Prev Line"),
IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
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, 0);
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, 0);
NANO_NO_KEY, VIEW, NULL);
#endif
free_shortcutage(&writefile_list);
@@ -783,7 +834,7 @@ void shortcut_init(int unjustify)
sc_init_one(&writefile_list, NANO_CANCEL_KEY, cancel_msg,
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
#ifndef DISABLE_BROWSER
/* If we're using restricted mode, the file browser is disabled.
@@ -792,7 +843,7 @@ void shortcut_init(int unjustify)
if (!ISSET(RESTRICTED))
sc_init_one(&writefile_list, NANO_TOFILES_KEY, to_files_msg,
IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, 0);
NANO_NO_KEY, NOVIEW, NULL);
#endif
#ifndef NANO_SMALL
@@ -806,33 +857,33 @@ void shortcut_init(int unjustify)
if (!ISSET(RESTRICTED))
sc_init_one(&writefile_list, NANO_NO_KEY, N_("DOS Format"),
IFHELP(nano_dos_msg, TOGGLE_DOS_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, 0);
NANO_NO_KEY, NOVIEW, NULL);
/* Translators: try to keep this string under 16 characters long */
if (!ISSET(RESTRICTED))
sc_init_one(&writefile_list, NANO_NO_KEY, N_("Mac Format"),
IFHELP(nano_mac_msg, TOGGLE_MAC_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, 0);
NANO_NO_KEY, NOVIEW, NULL);
#endif
/* Translators: try to keep this string under 16 characters long */
if (!ISSET(RESTRICTED))
sc_init_one(&writefile_list, NANO_NO_KEY, N_("Append"),
IFHELP(nano_append_msg, NANO_APPEND_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, 0);
NANO_NO_KEY, NOVIEW, NULL);
/* Translators: try to keep this string under 16 characters long */
if (!ISSET(RESTRICTED))
sc_init_one(&writefile_list, NANO_NO_KEY, N_("Prepend"),
IFHELP(nano_prepend_msg, NANO_PREPEND_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, 0);
NANO_NO_KEY, NOVIEW, NULL);
#ifndef NANO_SMALL
/* Translators: try to keep this string under 16 characters long */
if (!ISSET(RESTRICTED))
sc_init_one(&writefile_list, NANO_NO_KEY, N_("Backup File"),
IFHELP(nano_backup_msg, TOGGLE_BACKUP_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, 0);
NANO_NO_KEY, NOVIEW, NULL);
#endif
free_shortcutage(&insertfile_list);
@@ -849,7 +900,7 @@ void shortcut_init(int unjustify)
sc_init_one(&insertfile_list, NANO_CANCEL_KEY, cancel_msg,
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
#ifndef DISABLE_BROWSER
/* If we're using restricted mode, the file browser is disabled.
@@ -857,7 +908,7 @@ void shortcut_init(int unjustify)
if (!ISSET(RESTRICTED))
sc_init_one(&insertfile_list, NANO_TOFILES_KEY, to_files_msg,
IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, 0);
NANO_NO_KEY, NOVIEW, NULL);
#endif
#ifndef NANO_SMALL
@@ -865,18 +916,18 @@ void shortcut_init(int unjustify)
* It's useless since inserting files is disabled. */
/* Translators: try to keep this string under 22 characters long */
if (!ISSET(RESTRICTED))
sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, N_("Execute Command"),
IFHELP(nano_execute_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, 0);
sc_init_one(&insertfile_list, NANO_TOOTHERINSERT_KEY,
N_("Execute Command"), IFHELP(nano_execute_msg,
NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
#ifdef ENABLE_MULTIBUFFER
/* If we're using restricted mode, the multibuffer toggle is
* disabled. It's useless since inserting files is disabled. */
/* Translators: try to keep this string under 22 characters long */
if (!ISSET(RESTRICTED))
sc_init_one(&insertfile_list, NANO_NO_KEY, _("New Buffer"),
IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, 0);
sc_init_one(&insertfile_list, NANO_NO_KEY, new_buffer_msg,
IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY),
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
#endif
#endif
@@ -895,7 +946,7 @@ void shortcut_init(int unjustify)
sc_init_one(&spell_list, NANO_CANCEL_KEY, cancel_msg,
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
#endif
#ifndef NANO_SMALL
@@ -913,7 +964,17 @@ void shortcut_init(int unjustify)
sc_init_one(&extcmd_list, NANO_CANCEL_KEY, cancel_msg,
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
sc_init_one(&extcmd_list, NANO_TOOTHERINSERT_KEY, N_("Insert File"),
IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, NULL);
#ifdef ENABLE_MULTIBUFFER
sc_init_one(&extcmd_list, NANO_NO_KEY, new_buffer_msg,
IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY),
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
#endif
#endif
#ifndef DISABLE_BROWSER
@@ -931,20 +992,24 @@ void shortcut_init(int unjustify)
sc_init_one(&browser_list, NANO_EXIT_KEY, exit_msg,
IFHELP(nano_exitbrowser_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
sc_init_one(&browser_list, NANO_PREVPAGE_KEY, prev_page_msg,
IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, next_page_msg,
IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
NANO_NO_KEY, VIEW, 0);
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_GOTO_KEY, N_("Go To Dir"),
IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
NANO_NO_KEY, VIEW, 0);
sc_init_one(&browser_list, NANO_GOTOLINE_KEY, N_("Go To Dir"),
IFHELP(nano_gotodir_msg, NANO_GOTOLINE_ALTKEY),
NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, NULL);
free_shortcutage(&gotodir_list);
@@ -960,12 +1025,11 @@ void shortcut_init(int unjustify)
sc_init_one(&gotodir_list, NANO_CANCEL_KEY, cancel_msg,
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, 0);
NANO_NO_KEY, VIEW, NULL);
#endif
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
currshortcut = main_list;
#endif
#ifndef NANO_SMALL
toggle_init();
#endif
@@ -1017,12 +1081,13 @@ void toggle_init(void)
/* 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);
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);
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
@@ -1034,29 +1099,30 @@ void toggle_init(void)
#ifndef DISABLE_MOUSE
toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE);
#endif
/* If we're using restricted mode, the no-conversion, DOS format,
* Mac format, and backup toggles are disabled. The first, second,
* and third are useless since inserting files is disabled, and the
* fourth is useless since backups are disabled. */
if (!ISSET(RESTRICTED)) {
/* If we're using restricted mode, the DOS/Mac conversion toggle is
* disabled. It's useless since inserting files is disabled. */
if (!ISSET(RESTRICTED))
toggle_init_one(TOGGLE_NOCONVERT_KEY,
N_("No conversion from DOS/Mac format"), NO_CONVERT);
toggle_init_one(TOGGLE_DOS_KEY, N_("Writing file in DOS format"),
DOS_FILE);
toggle_init_one(TOGGLE_MAC_KEY, N_("Writing file in Mac format"),
MAC_FILE);
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"), BACKUP_FILE);
}
toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"), SMOOTHSCROLL);
toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"), SMART_HOME);
/* If we're using restricted mode, the backup toggle is disabled.
* It's useless since backups are disabled. */
if (!ISSET(RESTRICTED))
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"),
BACKUP_FILE);
toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"),
SMOOTHSCROLL);
toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"),
SMART_HOME);
#ifdef ENABLE_COLOR
toggle_init_one(TOGGLE_SYNTAX_KEY, N_("Color syntax highlighting"),
COLOR_SYNTAX);
NO_COLOR_SYNTAX);
#endif
#ifdef ENABLE_NANORC
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
@@ -1123,12 +1189,15 @@ void thanks_for_all_the_fish(void)
free(answer);
if (cutbuffer != NULL)
free_filestruct(cutbuffer);
#ifndef DISABLE_JUSTIFY
if (jusbuffer != NULL)
free_filestruct(jusbuffer);
#endif
free_shortcutage(&main_list);
free_shortcutage(&whereis_list);
free_shortcutage(&replace_list);
free_shortcutage(&replace_list_2);
free_shortcutage(&goto_list);
free_shortcutage(&gotoline_list);
free_shortcutage(&writefile_list);
free_shortcutage(&insertfile_list);
#ifndef DISABLE_HELP

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* move.c *
* *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 1999-2005 Chris Allegretta *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -19,7 +19,9 @@
* *
**************************************************************************/
#include "config.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
@@ -30,37 +32,36 @@
void do_first_line(void)
{
size_t old_pww = placewewant;
size_t pww_save = placewewant;
current = fileage;
placewewant = 0;
current_x = 0;
if (edittop != fileage || need_vertical_update(old_pww))
edit_update(current, TOP);
if (edittop != fileage || need_vertical_update(pww_save))
edit_update(TOP);
}
void do_last_line(void)
{
size_t old_pww = placewewant;
size_t pww_save = placewewant;
current = filebot;
placewewant = 0;
current_x = 0;
if (edittop->lineno + (editwinrows / 2) != filebot->lineno ||
need_vertical_update(old_pww))
edit_update(current, CENTER);
need_vertical_update(pww_save))
edit_update(CENTER);
}
void do_home(void)
{
size_t old_pww = placewewant;
size_t pww_save = placewewant;
#ifndef NANO_SMALL
if (ISSET(SMART_HOME)) {
int old_current_x = current_x;
size_t current_x_save = current_x;
for (current_x = 0; isblank(current->data[current_x]) &&
current->data[current_x] != '\0'; current_x++)
;
current_x = indent_length(current->data);
if (current_x == old_current_x || current->data[current_x] == '\0')
if (current_x == current_x_save ||
current->data[current_x] == '\0')
current_x = 0;
placewewant = xplustabs();
@@ -71,25 +72,25 @@ void do_home(void)
#ifndef NANO_SMALL
}
#endif
check_statblank();
if (need_horizontal_update(old_pww))
check_statusblank();
if (need_horizontal_update(pww_save))
update_line(current, current_x);
}
void do_end(void)
{
size_t old_pww = placewewant;
size_t pww_save = placewewant;
current_x = strlen(current->data);
placewewant = xplustabs();
check_statblank();
if (need_horizontal_update(old_pww))
check_statusblank();
if (need_horizontal_update(pww_save))
update_line(current, current_x);
}
void do_page_up(void)
{
size_t old_pww = placewewant;
const filestruct *old_current = current;
size_t pww_save = placewewant;
const filestruct *current_save = current;
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
@@ -127,15 +128,15 @@ void do_page_up(void)
current_x = actual_x(current->data, placewewant);
/* Update all the lines that need to be updated. */
edit_redraw(old_current, old_pww);
edit_redraw(current_save, pww_save);
check_statblank();
check_statusblank();
}
void do_page_down(void)
{
size_t old_pww = placewewant;
const filestruct *old_current = current;
size_t pww_save = placewewant;
const filestruct *current_save = current;
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
@@ -174,9 +175,9 @@ void do_page_down(void)
current_x = actual_x(current->data, placewewant);
/* Update all the lines that need to be updated. */
edit_redraw(old_current, old_pww);
edit_redraw(current_save, pww_save);
check_statblank();
check_statusblank();
}
void do_up(void)
@@ -184,12 +185,13 @@ void do_up(void)
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
check_statblank();
check_statusblank();
if (current->prev == NULL)
return;
assert(current_y == current->lineno - edittop->lineno);
current = current->prev;
current_x = actual_x(current->data, placewewant);
@@ -217,7 +219,7 @@ void do_down(void)
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
check_statblank();
check_statusblank();
if (current->next == NULL)
return;
@@ -245,18 +247,18 @@ void do_down(void)
update_line(current, current_x);
}
void do_left(int allow_update)
void do_left(bool allow_update)
{
size_t old_pww = placewewant;
size_t pww_save = placewewant;
if (current_x > 0)
current_x--;
current_x = move_mbleft(current->data, current_x);
else if (current != fileage) {
do_up();
current_x = strlen(current->data);
}
placewewant = xplustabs();
check_statblank();
if (allow_update && need_horizontal_update(old_pww))
check_statusblank();
if (allow_update && need_horizontal_update(pww_save))
update_line(current, current_x);
}
@@ -265,20 +267,20 @@ void do_left_void(void)
do_left(TRUE);
}
void do_right(int allow_update)
void do_right(bool allow_update)
{
size_t old_pww = placewewant;
size_t pww_save = placewewant;
assert(current_x <= strlen(current->data));
if (current->data[current_x] != '\0')
current_x++;
current_x = move_mbright(current->data, current_x);
else if (current->next != NULL) {
do_down();
current_x = 0;
}
placewewant = xplustabs();
check_statblank();
if (allow_update && need_horizontal_update(old_pww))
check_statusblank();
if (allow_update && need_horizontal_update(pww_save))
update_line(current, current_x);
}

3437
src/nano.c

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* nano.h *
* *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 1999-2005 Chris Allegretta *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -34,23 +34,27 @@
#include <limits.h>
#endif
/* Macros for the flags long... */
/* Macros for the flags long. */
#define SET(bit) flags |= bit
#define UNSET(bit) flags &= ~bit
#define ISSET(bit) ((flags & bit) != 0)
#define TOGGLE(bit) flags ^= bit
/* Define charalloc as a macro rather than duplicating code */
/* Macros for character allocation. */
#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))
#ifdef BROKEN_REGEXEC
#undef regexec
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
#endif
#ifndef NANO_SMALL
/* For the backup file copy ... */
#define COPYFILEBLOCKSIZE 1024
/* Set a default value for PATH_MAX, so we can use it in lines like
* "path = getcwd(NULL, PATH_MAX + 1);". */
#ifndef PATH_MAX
#define PATH_MAX -1
#endif
#ifdef USE_SLANG
@@ -67,60 +71,52 @@
#endif /* CURSES_H */
#ifdef ENABLE_NLS
# ifdef HAVE_LIBINTL_H
# include <libintl.h>
# endif
# define _(string) gettext(string)
# define P_(singular, plural, number) ngettext(singular, plural, number)
#ifdef HAVE_LIBINTL_H
#include <libintl.h>
#endif
#define _(string) gettext(string)
#define P_(singular, plural, number) ngettext(singular, plural, number)
#else
# define _(string) (string)
# define P_(singular, plural, number) (number == 1 ? singular : plural)
#define _(string) (string)
#define P_(singular, plural, number) (number == 1 ? singular : plural)
#endif
#define gettext_noop(string) (string)
#define N_(string) gettext_noop(string)
/* 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()/vsnprintf(), use the versions from glib. */
/* If no snprintf() or vsnprintf(), use the versions from glib. */
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
#include <glib.h>
# ifndef HAVE_SNPRINTF
# define snprintf g_snprintf
# endif
# ifndef HAVE_VSNPRINTF
# define vsnprintf g_vsnprintf
# endif
#endif
/* If no isblank(), strcasecmp(), strncasecmp(), strcasestr(),
* strnlen(), getdelim(), or getline(), use the versions we have. */
#ifndef HAVE_ISBLANK
#define isblank is_blank_char
#ifndef HAVE_SNPRINTF
#define snprintf g_snprintf
#endif
#ifndef HAVE_VSNPRINTF
#define vsnprintf g_vsnprintf
#endif
#endif
/* If no strcasecmp(), strncasecmp(), strcasestr(), strnlen(),
* getdelim(), or getline(), use the versions we have. */
#ifndef HAVE_STRCASECMP
#define strcasecmp nstricmp
#define strcasecmp nstrcasecmp
#endif
#ifndef HAVE_STRNCASECMP
#define strncasecmp nstrnicmp
#define strncasecmp nstrncasecmp
#endif
#ifndef HAVE_STRCASESTR
#define strcasestr nstristr
#define strcasestr nstrcasestr
#endif
#ifndef HAVE_STRNLEN
#define strnlen nstrnlen
#endif
#ifndef HAVE_GETDELIM
#define getdelim ngetdelim
#endif
#ifndef HAVE_GETLINE
#define getline ngetline
#endif
@@ -142,6 +138,19 @@
#define DISABLE_WRAPJUSTIFY 1
#endif
/* Enumeration types. */
typedef enum {
NIX_FILE, DOS_FILE, MAC_FILE
} file_format;
typedef enum {
UP, DOWN
} updown;
typedef enum {
TOP, CENTER, NONE
} topmidnone;
/* Structure types. */
typedef struct filestruct {
char *data;
@@ -156,32 +165,43 @@ typedef struct openfilestruct {
#ifndef NANO_SMALL
struct stat originalfilestat;
#endif
struct openfilestruct *next; /* Next node. */
struct openfilestruct *prev; /* Previous node. */
struct filestruct *fileage; /* Current file. */
struct filestruct *filebot; /* Current file's last line. */
struct openfilestruct *next;
/* Next node. */
struct openfilestruct *prev;
/* Previous node. */
filestruct *fileage; /* Current file. */
filestruct *filebot; /* Current file's last line. */
filestruct *edittop; /* Current top of edit window. */
filestruct *current; /* Current file's line. */
#ifndef NANO_SMALL
struct filestruct *file_mark_beginbuf;
filestruct *mark_beginbuf;
/* Current file's beginning marked
* line. */
int file_mark_beginx; /* Current file's beginning marked
size_t mark_beginx; /* Current file's beginning marked
* line's x-coordinate position. */
#endif
int file_current_x; /* Current file's x-coordinate
size_t current_x; /* Current file's x-coordinate
* position. */
int file_current_y; /* Current file's y-coordinate
* position. */
long file_flags; /* Current file's flags: modification
size_t placewewant; /* Current file's place we want. */
int totlines; /* Current file's total number of
* lines. */
size_t totsize; /* Current file's total size. */
unsigned long flags; /* Current file's flags: modification
* status (and marking status, if
* available). */
size_t file_placewewant; /* Current file's place we want. */
int file_totlines; /* Current file's total number of
* lines. */
long file_totsize; /* Current file's total size. */
int file_lineno; /* Current file's line number. */
file_format fmt; /* Current file's format. */
} openfilestruct;
#endif
typedef struct partition {
filestruct *fileage;
filestruct *top_prev;
char *top_data;
filestruct *filebot;
filestruct *bot_next;
char *bot_data;
} partition;
typedef struct shortcut {
/* Key values that aren't used should be set to NANO_NO_KEY. */
int ctrlval; /* Special sentinel key or control key we want
@@ -189,7 +209,7 @@ typedef struct shortcut {
int metaval; /* Meta key we want bound. */
int funcval; /* Function key we want bound. */
int miscval; /* Other Meta key we want bound. */
int viewok; /* Is this function legal in view mode? */
bool viewok; /* Is this function legal in view mode? */
void (*func)(void); /* Function to call when we catch this key. */
const char *desc; /* Description, e.g. "Page Up". */
#ifndef DISABLE_HELP
@@ -208,17 +228,16 @@ typedef struct toggle {
long flag; /* What flag actually gets toggled. */
struct toggle *next;
} toggle;
#endif /* !NANO_SMALL */
#endif
#ifdef ENABLE_NANORC
typedef struct rcoption {
const char *name;
long flag;
} rcoption;
#endif /* ENABLE_NANORC */
#endif
#ifdef ENABLE_COLOR
typedef struct colortype {
int fg; /* fg color */
int bg; /* bg color */
@@ -240,8 +259,7 @@ typedef struct syntaxtype {
colortype *color; /* color struct for this syntax */
struct syntaxtype *next;
} syntaxtype;
#endif /* ENABLE_COLOR */
#endif
#ifndef NANO_SMALL
typedef struct historytype {
@@ -249,6 +267,7 @@ typedef struct historytype {
struct historytype *prev;
char *data;
} historytype;
typedef struct historyheadtype {
struct historytype *next; /* Keep *next and *prev members
* together. */
@@ -259,7 +278,7 @@ typedef struct historyheadtype {
int count;
int len;
} historyheadtype;
#endif /* !NANO_SMALL */
#endif
/* Bitwise flags so we can save space (or more correctly, not waste
* it). */
@@ -279,21 +298,21 @@ typedef struct historyheadtype {
#define CUT_TO_END (1<<13)
#define REVERSE_SEARCH (1<<14)
#define MULTIBUFFER (1<<15)
#define DOS_FILE (1<<16)
#define MAC_FILE (1<<17)
#define SMOOTHSCROLL (1<<18)
#define DISABLE_CURPOS (1<<19) /* Damn, we still need it. */
#define REBIND_DELETE (1<<20)
#define NO_CONVERT (1<<21)
#define BACKUP_FILE (1<<22)
#define NO_RCFILE (1<<23)
#define COLOR_SYNTAX (1<<24)
#define PRESERVE (1<<25)
#define HISTORY_CHANGED (1<<26)
#define HISTORYLOG (1<<27)
#define RESTRICTED (1<<28)
#define SMART_HOME (1<<29)
#define WHITESPACE_DISPLAY (1<<30)
#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)
/* Control key sequences, changing these would be very very bad. */
#define NANO_CONTROL_SPACE 0
@@ -330,6 +349,8 @@ typedef struct historyheadtype {
#define NANO_CONTROL_7 31
#define NANO_CONTROL_8 127
#define NANO_ALT_9 '9'
#define NANO_ALT_0 '0'
#define NANO_ALT_A 'a'
#define NANO_ALT_B 'b'
#define NANO_ALT_C 'c'
@@ -358,6 +379,8 @@ typedef struct historyheadtype {
#define NANO_ALT_Z 'z'
#define NANO_ALT_PERIOD '.'
#define NANO_ALT_COMMA ','
#define NANO_ALT_LPAREN '('
#define NANO_ALT_RPAREN ')'
#define NANO_ALT_LCARAT '<'
#define NANO_ALT_RCARAT '>'
#define NANO_ALT_RBRACKET ']'
@@ -375,24 +398,29 @@ typedef struct historyheadtype {
/* Normal keys. */
#define NANO_XON_KEY NANO_CONTROL_Q
#define NANO_XOFF_KEY NANO_CONTROL_S
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
#define NANO_INSERTFILE_FKEY KEY_F(5)
#define NANO_CANCEL_KEY NANO_CONTROL_C
#define NANO_EXIT_KEY NANO_CONTROL_X
#define NANO_EXIT_FKEY KEY_F(2)
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
#define NANO_INSERTFILE_FKEY KEY_F(5)
#define NANO_TOOTHERINSERT_KEY NANO_CONTROL_X
#define NANO_WRITEOUT_KEY NANO_CONTROL_O
#define NANO_WRITEOUT_FKEY KEY_F(3)
#define NANO_GOTO_KEY NANO_CONTROL_7
#define NANO_GOTO_FKEY KEY_F(13)
#define NANO_ALT_GOTO_KEY NANO_ALT_G
#define NANO_GOTOLINE_KEY NANO_CONTROL_7
#define NANO_GOTOLINE_FKEY KEY_F(13)
#define NANO_GOTOLINE_ALTKEY NANO_ALT_G
#define NANO_TOGOTOLINE_KEY NANO_CONTROL_T
#define NANO_HELP_KEY NANO_CONTROL_G
#define NANO_HELP_FKEY KEY_F(1)
#define NANO_WHEREIS_KEY NANO_CONTROL_W
#define NANO_WHEREIS_FKEY KEY_F(6)
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
#define NANO_WHEREIS_NEXT_FKEY KEY_F(16)
#define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T
#define NANO_REPLACE_KEY NANO_CONTROL_4
#define NANO_REPLACE_FKEY KEY_F(14)
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
#define NANO_OTHERSEARCH_KEY NANO_CONTROL_R
#define NANO_TOOTHERSEARCH_KEY NANO_CONTROL_R
#define NANO_PREVPAGE_KEY NANO_CONTROL_Y
#define NANO_PREVPAGE_FKEY KEY_F(7)
#define NANO_NEXTPAGE_KEY NANO_CONTROL_V
@@ -409,7 +437,6 @@ typedef struct historyheadtype {
#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY
#define NANO_CANCEL_KEY NANO_CONTROL_C
#define NANO_REFRESH_KEY NANO_CONTROL_L
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
#define NANO_JUSTIFY_FKEY KEY_F(4)
@@ -420,7 +447,8 @@ typedef struct historyheadtype {
#define NANO_FORWARD_KEY NANO_CONTROL_F
#define NANO_BACK_KEY NANO_CONTROL_B
#define NANO_MARK_KEY NANO_CONTROL_6
#define NANO_ALT_MARK_KEY NANO_ALT_A
#define NANO_MARK_ALTKEY NANO_ALT_A
#define NANO_MARK_FKEY KEY_F(15)
#define NANO_HOME_KEY NANO_CONTROL_A
#define NANO_END_KEY NANO_CONTROL_E
#define NANO_DELETE_KEY NANO_CONTROL_D
@@ -428,7 +456,6 @@ typedef struct historyheadtype {
#define NANO_TAB_KEY NANO_CONTROL_I
#define NANO_SUSPEND_KEY NANO_CONTROL_Z
#define NANO_ENTER_KEY NANO_CONTROL_M
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
#define NANO_TOFILES_KEY NANO_CONTROL_T
#define NANO_APPEND_KEY NANO_ALT_A
#define NANO_PREPEND_KEY NANO_ALT_P
@@ -437,12 +464,18 @@ typedef struct historyheadtype {
#define NANO_OPENPREV_ALTKEY NANO_ALT_COMMA
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
#define NANO_EXTCMD_KEY NANO_CONTROL_X
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
#define NANO_CUTTILLEND_KEY NANO_CONTROL_X
#define NANO_CUTTILLEND_ALTKEY NANO_ALT_T
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
#define NANO_PARABEGIN_ALTKEY1 NANO_ALT_LPAREN
#define NANO_PARABEGIN_ALTKEY2 NANO_ALT_9
#define NANO_PARAEND_KEY NANO_CONTROL_O
#define NANO_PARAEND_ALTKEY1 NANO_ALT_RPAREN
#define NANO_PARAEND_ALTKEY2 NANO_ALT_0
#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
#define NANO_VERBATIM_KEY NANO_ALT_V
#ifndef NANO_SMALL
@@ -459,13 +492,14 @@ typedef struct historyheadtype {
#define TOGGLE_CASE_KEY NANO_ALT_C
#define TOGGLE_MULTIBUFFER_KEY NANO_ALT_F
#define TOGGLE_DOS_KEY NANO_ALT_D
#define TOGGLE_MAC_KEY NANO_ALT_O
#define TOGGLE_MAC_KEY NANO_ALT_M
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
#define TOGGLE_NOCONVERT_KEY NANO_ALT_N
#define TOGGLE_BACKUP_KEY NANO_ALT_B
#define TOGGLE_SYNTAX_KEY NANO_ALT_Y
#define TOGGLE_SMARTHOME_KEY NANO_ALT_H
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
#endif /* !NANO_SMALL */
#define MAIN_VISIBLE 12
@@ -473,24 +507,16 @@ typedef struct historyheadtype {
#define VIEW TRUE
#define NOVIEW FALSE
typedef enum {
UP, DOWN
} updown;
typedef enum {
TOP, CENTER, NONE
} topmidnone;
/* Minimum editor window rows required for nano to work correctly. */
#define MIN_EDITOR_ROWS 3
/* Minimum editor window cols required for nano to work correctly. */
#define MIN_EDITOR_COLS 10
#define MIN_EDITOR_ROWS 1
/* Default number of characters from end-of-line where text wrapping
* occurs. */
#define CHARS_FROM_EOL 8
/* Default width of a tab. */
#define WIDTH_OF_TAB 8
/* Maximum number of search history strings saved, same value used for
* replace history. */
#define MAX_SEARCH_HISTORY 100

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* proto.h *
* *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 1999-2005 Chris Allegretta *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -21,8 +21,9 @@
/* Externs. */
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#ifdef HAVE_REGEX_H
#include <regex.h>
#endif
@@ -32,19 +33,21 @@
extern ssize_t wrap_at;
#endif
extern int editwinrows;
extern int current_x, current_y, totlines;
extern size_t current_x;
extern int current_y;
extern int totlines;
extern size_t placewewant;
#ifndef NANO_SMALL
extern int mark_beginx;
extern size_t mark_beginx;
#endif
extern long totsize;
extern long flags;
extern size_t totsize;
extern unsigned long flags;
extern ssize_t tabsize;
extern int search_last_line;
extern int currslen;
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
extern char *whitespace;
extern int whitespace_len[2];
#endif
#ifndef DISABLE_JUSTIFY
@@ -82,10 +85,13 @@ extern char *full_operating_dir;
extern char *alt_speller;
#endif
extern int resetstatuspos;
extern struct stat fileinfo;
extern filestruct *current, *fileage, *edittop, *filebot;
extern filestruct *cutbuffer;
#ifndef DISABLE_JUSTIFY
extern filestruct *jusbuffer;
#endif
extern partition *filepart;
#ifndef NANO_SMALL
extern filestruct *mark_beginbuf;
#endif
@@ -102,7 +108,7 @@ extern char *syntaxstr;
extern shortcut *shortcut_list;
extern shortcut *main_list, *whereis_list;
extern shortcut *replace_list, *goto_list;
extern shortcut *replace_list, *gotoline_list;
extern shortcut *writefile_list, *insertfile_list;
extern shortcut *replace_list_2;
#ifndef NANO_SMALL
@@ -118,9 +124,7 @@ extern shortcut *spell_list;
extern shortcut *browser_list, *gotodir_list;
#endif
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
extern const shortcut *currshortcut;
#endif
#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
@@ -142,89 +146,167 @@ extern historyheadtype replace_history;
extern bool curses_ended;
#ifdef ENABLE_NANORC
extern char *homedir;
#endif
/* Functions we want available. */
/* Public functions in color.c */
/* Public functions in chars.c. */
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);
#ifdef NANO_WIDE
wchar_t control_wrep(wchar_t c);
#endif
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);
size_t move_mbright(const char *buf, size_t pos);
#ifndef HAVE_STRCASECMP
int nstrcasecmp(const char *s1, const char *s2);
#endif
int mbstrcasecmp(const char *s1, const char *s2);
#ifndef HAVE_STRNCASECMP
int nstrncasecmp(const char *s1, const char *s2, size_t n);
#endif
int mbstrncasecmp(const char *s1, const char *s2, size_t n);
#ifndef HAVE_STRCASESTR
const char *nstrcasestr(const char *haystack, const char *needle);
#endif
const char *mbstrcasestr(const char *haystack, const char *needle);
#ifndef NANO_SMALL
const char *revstrstr(const char *haystack, const char *needle, const
char *rev_start);
const char *revstrcasestr(const char *haystack, const char *needle,
const char *rev_start);
const char *mbrevstrcasestr(const char *haystack, const char *needle,
const char *rev_start);
#endif
size_t mbstrlen(const char *s);
#ifndef HAVE_STRNLEN
size_t nstrnlen(const char *s, size_t maxlen);
#endif
size_t mbstrnlen(const char *s, size_t maxlen);
#ifndef DISABLE_JUSTIFY
char *mbstrchr(const char *s, char *c);
#endif
/* Public functions in color.c. */
#ifdef ENABLE_COLOR
void set_colorpairs(void);
void do_colorinit(void);
void update_color(void);
#endif /* ENABLE_COLOR */
/* Public functions in cut.c */
/* Public functions in cut.c. */
void cutbuffer_reset(void);
filestruct *get_cutbottom(void);
void add_to_cutbuffer(filestruct *inptr, bool allow_concat);
void cut_marked_segment(void);
void cut_line(void);
#ifndef NANO_SMALL
void cut_marked(void);
#endif
void cut_to_eol(void);
void do_cut_text(void);
#ifndef NANO_SMALL
void do_cut_till_end(void);
#endif
void do_uncut_text(void);
/* Public functions in files.c */
void load_file(int update);
/* Public functions in files.c. */
void new_file(void);
filestruct *read_line(char *buf, filestruct *prev, int *line1ins, size_t
len);
void read_file(FILE *f, const char *filename, int quiet);
bool open_file(const char *filename, int insert, int quiet);
filestruct *read_line(char *buf, filestruct *prev, bool *first_line_ins,
size_t 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);
void do_insertfile(int loading_file);
#ifndef NANO_SMALL
void execute_command(const char *command);
#endif
void load_buffer(const char *name);
void do_insertfile(
#ifndef NANO_SMALL
bool execute
#else
void
#endif
);
void do_insertfile_void(void);
#ifdef ENABLE_MULTIBUFFER
openfilestruct *make_new_opennode(openfilestruct *prevnode);
openfilestruct *make_new_opennode(void);
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
openfilestruct *end);
void unlink_opennode(const openfilestruct *fileptr);
void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
#ifdef DEBUG
void free_openfilestruct(openfilestruct *src);
void add_open_file(int update);
#endif
void add_open_file(bool update);
void load_open_file(void);
void open_prevfile(int closing_file);
void open_prevnext_file(bool next);
void open_prevfile_void(void);
void open_nextfile(int closing_file);
void open_nextfile_void(void);
int close_open_file(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(const char *dirname, const char *filename_prefix);
char *safe_tempnam(void);
#endif
#ifndef DISABLE_OPERATINGDIR
void init_operating_dir(void);
int check_operating_dir(const char *currpath, int allow_tabcomp);
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
#endif
#ifndef NANO_SMALL
void init_backup_dir(void);
#endif
int copy_file(FILE *inn, FILE *out);
int write_file(const char *name, int tmp, int append, int nonamechange);
int write_file(const char *name, bool tmp, int append, bool
nonamechange);
#ifndef NANO_SMALL
int write_marked(const char *name, int tmp, int append);
int write_marked(const char *name, bool tmp, int append);
#endif
int do_writeout(int exiting);
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);
#endif
#ifndef DISABLE_TABCOMP
int append_slash_if_dir(char *buf, bool *lastwastab, int *place);
char **username_tab_completion(char *buf, int *num_matches);
char **cwd_tab_completion(char *buf, int *num_matches);
char *input_tab(char *buf, int place, bool *lastwastab, int *newplace,
bool *list);
char **username_tab_completion(const char *buf, size_t *num_matches,
size_t buflen);
char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
buflen);
char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
#endif
const char *tail(const char *foo);
#ifndef DISABLE_BROWSER
int diralphasort(const void *va, const void *vb);
void free_charptrarray(char **array, size_t len);
void striponedir(char *foo);
int readable_dir(const char *path);
char **browser_init(const char *path, int *longest, int *numents);
char *do_browser(const char *inpath);
void striponedir(char *path);
char **browser_init(const char *path, int *longest, size_t *numents, DIR
*dir);
char *do_browser(char *path, DIR *dir);
char *do_browse_from(const char *inpath);
#endif
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
@@ -234,7 +316,7 @@ bool writehist(FILE *hist, historyheadtype *histhead);
void save_history(void);
#endif
/* Public functions in global.c */
/* Public functions in global.c. */
size_t length_of_list(const shortcut *s);
#ifndef NANO_SMALL
void toggle_init_one(int val, const char *desc, long flag);
@@ -247,15 +329,15 @@ void sc_init_one(shortcut **shortcutage, int key, const char *desc,
#ifndef DISABLE_HELP
const char *help,
#endif
int metaval, int funcval, int miscval, int view, void
int metaval, int funcval, int miscval, bool view, void
(*func)(void));
void shortcut_init(int unjustify);
void shortcut_init(bool unjustify);
void free_shortcutage(shortcut **shortcutage);
#ifdef DEBUG
void thanks_for_all_the_fish(void);
#endif
/* Public functions in move.c */
/* Public functions in move.c. */
void do_first_line(void);
void do_last_line(void);
void do_home(void);
@@ -264,17 +346,18 @@ void do_page_up(void);
void do_page_down(void);
void do_up(void);
void do_down(void);
void do_left(int allow_update);
void do_left(bool allow_update);
void do_left_void(void);
void do_right(int allow_update);
void do_right(bool allow_update);
void do_right_void(void);
/* Public functions in nano.c */
/* Public functions in nano.c. */
void print_view_warning(void);
void finish(void);
void die(const char *msg, ...);
void die_save_file(const char *die_filename);
void die_too_small(void);
void print_view_warning(void);
void check_die_too_small(void);
void resize_variables(void);
void global_init(bool save_cutbuffer);
void window_init(void);
#ifndef DISABLE_MOUSE
@@ -291,22 +374,25 @@ void unlink_node(const filestruct *fileptr);
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
void free_filestruct(filestruct *src);
partition *partition_filestruct(filestruct *top, size_t top_x,
filestruct *bot, size_t bot_x);
void unpartition_filestruct(partition **p);
void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
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 usage(void);
void version(void);
int no_more_space(void);
int no_help(void);
void nano_disabled_msg(void);
#ifndef NANO_SMALL
RETSIGTYPE cancel_fork(int signal);
void cancel_fork(int signal);
bool open_pipe(const char *command);
#endif
#ifndef DISABLE_MOUSE
void do_mouse(void);
#endif
void do_char(char ch);
void do_verbatim_input(void);
void do_backspace(void);
void do_delete(void);
@@ -319,7 +405,7 @@ void do_mark(void);
#endif
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(filestruct *inptr);
bool do_wrap(filestruct *line);
#endif
#ifndef DISABLE_SPELLER
bool do_int_spell_fix(const char *word);
@@ -327,34 +413,37 @@ const char *do_int_speller(const char *tempfile_name);
const char *do_alt_speller(char *tempfile_name);
void do_spell(void);
#endif
#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
ssize_t break_line(const char *line, ssize_t goal, bool newline);
#endif
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
size_t indent_length(const char *line);
#endif
#ifndef DISABLE_JUSTIFY
void justify_format(filestruct *line, size_t skip);
void justify_format(filestruct *paragraph, size_t skip);
size_t quote_length(const char *line);
bool quotes_match(const char *a_line, size_t a_quote, const char
*b_line);
bool indents_match(const char *a_line, size_t a_indent, const char
*b_line, size_t b_indent);
bool begpar(const filestruct *const foo);
void do_para_begin(void);
bool inpar(const char *str);
void do_para_end(void);
void do_para_begin(bool allow_update);
void do_para_begin_void(void);
bool inpar(const filestruct *const foo);
void do_para_end(bool allow_update);
void do_para_end_void(void);
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
quote_len);
bool breakable(const char *line, int goal);
int break_line(const char *line, int goal, bool force);
bool do_para_search(size_t *const quote, size_t *const par);
bool find_paragraph(size_t *const quote, size_t *const par);
void do_justify(bool full_justify);
void do_justify_void(void);
void do_full_justify(void);
#endif /* !DISABLE_JUSTIFY */
void do_exit(void);
void signal_init(void);
RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_cont(int signal);
void handle_hupterm(int signal);
void do_suspend(int signal);
void do_cont(int signal);
#ifndef NANO_SMALL
void handle_sigwinch(int s);
void allow_pending_sigwinch(bool allow);
@@ -362,6 +451,7 @@ void allow_pending_sigwinch(bool allow);
#ifndef NANO_SMALL
void do_toggle(const toggle *which);
#endif
void disable_extended_input(void);
void disable_signals(void);
#ifndef NANO_SMALL
void enable_signals(void);
@@ -369,16 +459,22 @@ void enable_signals(void);
void disable_flow_control(void);
void enable_flow_control(void);
void terminal_init(void);
int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
*ran_func, bool *finished, bool allow_funcs);
#ifndef DISABLE_MOUSE
bool do_mouse(void);
#endif
void do_output(char *output, size_t output_len, bool allow_cntrls);
/* Public functions in rcfile.c */
/* Public functions in rcfile.c. */
#ifdef ENABLE_NANORC
void rcfile_error(const char *msg, ...);
char *parse_next_word(char *ptr);
char *parse_argument(char *ptr);
#ifdef ENABLE_COLOR
int colortoint(const char *colorname, int *bright);
int color_to_int(const char *colorname, bool *bright);
char *parse_next_regex(char *ptr);
int nregcomp(regex_t *preg, const char *regex, int eflags);
bool nregcomp(regex_t *preg, const char *regex, int eflags);
void parse_syntax(char *ptr);
void parse_colors(char *ptr);
#endif /* ENABLE_COLOR */
@@ -386,7 +482,7 @@ void parse_rcfile(FILE *rcstream);
void do_rcfile(void);
#endif /* ENABLE_NANORC */
/* Public functions in search.c */
/* Public functions in search.c. */
#ifdef HAVE_REGEX_H
int regexp_init(const char *regexp);
void regexp_cleanup(void);
@@ -394,27 +490,29 @@ void regexp_cleanup(void);
void not_found_msg(const char *str);
void search_abort(void);
void search_init_globals(void);
int search_init(int replacing);
int is_whole_word(int curr_pos, const char *datastr, const char
*searchword);
int findnextstr(int can_display_wrap, int wholeword, const filestruct
*begin, size_t beginx, const char *needle, int no_sameline);
int search_init(bool replacing, bool use_answer);
bool is_whole_word(size_t pos, const char *buf, const char *word);
bool findnextstr(bool can_display_wrap, bool wholeword, bool
no_sameline, const filestruct *begin, size_t beginx, const char
*needle, size_t *needle_len);
void findnextstr_wrap_reset(void);
void do_search(void);
#ifndef NANO_SMALL
void do_research(void);
#endif
void replace_abort(void);
#ifdef HAVE_REGEX_H
int replace_regexp(char *string, int create_flag);
int replace_regexp(char *string, bool create_flag);
#endif
char *replace_line(const char *needle);
int do_replace_loop(const char *needle, const filestruct *real_current,
size_t *real_current_x, int wholewords);
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);
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
void do_gotopos(int line, int pos_x, int pos_y, size_t pos_pww);
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww);
#endif
void do_find_bracket(void);
#ifndef NANO_SMALL
@@ -431,7 +529,7 @@ void free_history(historyheadtype *h);
#endif
#endif
/* Public functions in utils.c */
/* 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,
@@ -439,34 +537,13 @@ int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
#endif
int regexp_bol_or_eol(const regex_t *preg, const char *string);
#endif
#ifndef HAVE_ISBLANK
int is_blank_char(int c);
#endif
int is_cntrl_char(int c);
int num_of_digits(int n);
void get_homedir(void);
bool parse_num(const char *str, ssize_t *val);
void align(char **strp);
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
#ifndef HAVE_STRCASECMP
int nstricmp(const char *s1, const char *s2);
#endif
#ifndef HAVE_STRNCASECMP
int nstrnicmp(const char *s1, const char *s2, size_t n);
#endif
#ifndef HAVE_STRCASESTR
const char *nstristr(const char *haystack, const char *needle);
#endif
#ifndef NANO_SMALL
const char *revstrstr(const char *haystack, const char *needle, const
char *rev_start);
const char *revstristr(const char *haystack, const char *needle, const
char *rev_start);
#endif
#ifndef HAVE_STRNLEN
size_t nstrnlen(const char *s, size_t maxlen);
#endif
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
#ifndef HAVE_GETLINE
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
@@ -480,58 +557,91 @@ const char *strstrwrapper(const char *haystack, const char *needle,
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
char *mallocstrncpy(char *dest, const char *src, size_t n);
char *mallocstrcpy(char *dest, const char *src);
char *mallocstrassn(char *dest, char *src);
void new_magicline(void);
#ifndef NANO_SMALL
void remove_magicline(void);
void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x);
#endif
#ifndef DISABLE_TABCOMP
int check_wildcard_match(const char *text, const char *pattern);
**bot, size_t *bot_x, bool *right_side_up);
#endif
void get_totals(const filestruct *begin, const filestruct *end, int
*lines, size_t *size);
/* Public functions in winio.c */
/* Public functions in winio.c. */
#ifndef NANO_SMALL
void reset_kbinput(void);
#endif
int get_kbinput(WINDOW *win, int *meta_key);
int get_translated_kbinput(int kbinput, int *es
void get_buffer(WINDOW *win);
size_t get_buffer_len(void);
void unget_input(int *input, size_t input_len);
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
int *get_input(WINDOW *win, size_t input_len);
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
#ifndef NANO_SMALL
, int reset
, bool reset
#endif
);
int get_ascii_kbinput(int kbinput, size_t ascii_digits
int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
*ignore_seq);
int get_escape_seq_abcd(int kbinput);
int get_byte_kbinput(int kbinput
#ifndef NANO_SMALL
, int reset
, bool reset
#endif
);
int get_word_kbinput(int kbinput
#ifndef NANO_SMALL
, bool reset
#endif
);
int get_control_kbinput(int kbinput);
int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int
*ignore_seq);
int get_escape_seq_abcd(int kbinput);
int *get_verbatim_kbinput(WINDOW *win, int *v_kbinput, size_t *v_len,
int allow_ascii);
int get_untranslated_kbinput(int kbinput, size_t position, int
allow_ascii
#ifndef NANO_SMALL
, int reset
#endif
);
void unparse_kbinput(char *output, size_t output_len);
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
#ifndef DISABLE_MOUSE
int get_mouseinput(int *mouse_x, int *mouse_y, int allow_shortcuts);
bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
#endif
const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
*meta_key, bool *func_key);
#ifndef NANO_SMALL
const toggle *get_toggle(int kbinput, bool meta_key);
#endif
int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
bool *ran_func, bool *finished, bool allow_funcs);
#ifndef DISABLE_MOUSE
bool do_statusbar_mouse(void);
#endif
void do_statusbar_home(void);
void do_statusbar_end(void);
void do_statusbar_right(void);
void do_statusbar_left(void);
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);
#endif
void do_statusbar_verbatim_input(bool *got_enter);
void do_statusbar_output(char *output, size_t output_len, bool
*got_enter, bool allow_cntrls);
size_t xplustabs(void);
size_t actual_x(const char *str, size_t xplus);
size_t strnlenpt(const char *buf, size_t size);
size_t strlenpt(const char *buf);
void blank_titlebar(void);
void blank_topbar(void);
void blank_edit(void);
void blank_statusbar(void);
void check_statblank(void);
void blank_bottombars(void);
char *display_string(const char *buf, size_t start_col, size_t len);
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(int allowtabs, const char *buf, const char *def,
int nanogetstr(bool allow_tabs, const char *buf, const char *def,
#ifndef NANO_SMALL
historyheadtype *history_list,
#endif
@@ -540,6 +650,12 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
, bool *list
#endif
);
int statusq(bool allow_tabs, const shortcut *s, const char *def,
#ifndef NANO_SMALL
historyheadtype *history_list,
#endif
const char *msg, ...);
void statusq_abort(void);
void titlebar(const char *path);
void set_modified(void);
void statusbar(const char *msg, ...);
@@ -558,22 +674,18 @@ int need_vertical_update(size_t old_pww);
void edit_scroll(updown direction, int nlines);
void edit_redraw(const filestruct *old_current, size_t old_pww);
void edit_refresh(void);
void edit_update(filestruct *fileptr, topmidnone location);
int statusq(int allowtabs, const shortcut *s, const char *def,
#ifndef NANO_SMALL
historyheadtype *history_list,
#endif
const char *msg, ...);
int do_yesno(int all, const char *msg);
void edit_update(topmidnone location);
int do_yesno(bool all, const char *msg);
void total_update(void);
void total_refresh(void);
void display_main_list(void);
void do_cursorpos(int constant);
void do_cursorpos(bool constant);
void do_cursorpos_void(void);
#ifndef DISABLE_HELP
int help_line_len(const char *ptr);
size_t help_line_len(const char *ptr);
void do_help(void);
#endif
void do_replace_highlight(int highlight_flag, const char *word);
void do_replace_highlight(bool highlight_flag, const char *word);
#ifdef DEBUG
void dump_buffer(const filestruct *inptr);
void dump_buffer_reverse(void);

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* rcfile.c *
* *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 1999-2005 Chris Allegretta *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -19,7 +19,9 @@
* *
**************************************************************************/
#include "config.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <stdarg.h>
@@ -27,9 +29,6 @@
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pwd.h>
#include <ctype.h>
#include <assert.h>
#include "proto.h"
@@ -62,6 +61,7 @@ const static rcoption rcopts[] = {
#ifdef ENABLE_MULTIBUFFER
{"multibuffer", MULTIBUFFER},
#endif
{"morespace", MORE_SPACE},
#ifndef NANO_SMALL
{"noconvert", NO_CONVERT},
#endif
@@ -101,10 +101,16 @@ const static rcoption rcopts[] = {
static bool errors = FALSE;
static int lineno = 0;
static const char *nanorc;
static char *nanorc = NULL;
#ifdef ENABLE_COLOR
static syntaxtype *endsyntax = NULL;
/* The end of the list of syntaxes. */
static colortype *endcolor = NULL;
/* The end of the color list for the current syntax. */
#endif
/* We have an error in some part of the rcfile; put it on stderr and
make the user hit return to continue starting up nano. */
/* 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. */
void rcfile_error(const char *msg, ...)
{
va_list ap;
@@ -122,31 +128,32 @@ void rcfile_error(const char *msg, ...)
fprintf(stderr, "\n");
}
/* Parse the next word from the string. Returns NULL if we hit EOL. */
/* Parse the next word from the string. Return points to '\0' if we hit
* the end of the line. */
char *parse_next_word(char *ptr)
{
while (!isblank(*ptr) && *ptr != '\n' && *ptr != '\0')
while (!is_blank_char(*ptr) && *ptr != '\0')
ptr++;
if (*ptr == '\0')
return NULL;
return ptr;
/* Null terminate and advance ptr */
*ptr++ = 0;
/* Null-terminate and advance ptr. */
*ptr++ = '\0';
while (isblank(*ptr))
while (is_blank_char(*ptr))
ptr++;
return ptr;
}
/* The keywords operatingdir, backupdir, fill, tabsize, speller,
* punct, brackets, quotestr, and whitespace take an argument when set.
* Among these, operatingdir, backupdir, speller, punct, brackets,
* quotestr, and whitespace have to allow tabs and spaces in the
* argument. Thus, if the next word starts with a ", we say it ends
* with the last " of the line. Otherwise, the word is interpreted as
* usual. That is so the arguments can contain "s too. */
/* The keywords operatingdir, backupdir, fill, tabsize, speller, punct,
* brackets, quotestr, and whitespace take an argument when set. Among
* these, operatingdir, backupdir, speller, punct, brackets, quotestr,
* and whitespace have to allow tabs and spaces in the argument. Thus,
* if the next word starts with a ", we say it ends with the last " of
* the line. Otherwise, the word is interpreted as usual. That is so
* the arguments can contain "s too. */
char *parse_argument(char *ptr)
{
const char *ptr_bak = ptr;
@@ -161,7 +168,7 @@ char *parse_argument(char *ptr)
ptr++;
if (*ptr == '"')
last_quote = ptr;
} while (*ptr != '\n' && *ptr != '\0');
} while (*ptr != '\0');
if (last_quote == NULL) {
if (*ptr == '\0')
@@ -174,22 +181,25 @@ char *parse_argument(char *ptr)
ptr = last_quote + 1;
}
if (ptr != NULL)
while (isblank(*ptr))
while (is_blank_char(*ptr))
ptr++;
return ptr;
}
#ifdef ENABLE_COLOR
int colortoint(const char *colorname, int *bright)
int color_to_int(const char *colorname, bool *bright)
{
int mcolor = 0;
int mcolor = -1;
if (colorname == NULL)
if (colorname == NULL) {
rcfile_error(N_("Missing color name"));
return -1;
}
assert(bright != NULL);
if (strncasecmp(colorname, "bright", 6) == 0) {
*bright = 1;
*bright = TRUE;
colorname += 6;
}
@@ -209,38 +219,46 @@ int colortoint(const char *colorname, int *bright)
mcolor = COLOR_MAGENTA;
else if (strcasecmp(colorname, "black") == 0)
mcolor = COLOR_BLACK;
else {
else
rcfile_error(N_("Color %s not understood.\n"
"Valid colors are \"green\", \"red\", \"blue\", \n"
"\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
"\"black\", with the optional prefix \"bright\" \n"
"Valid colors are \"green\", \"red\", \"blue\",\n"
"\"white\", \"yellow\", \"cyan\", \"magenta\" and\n"
"\"black\", with the optional prefix \"bright\"\n"
"for foreground colors."), colorname);
mcolor = -1;
}
return mcolor;
}
char *parse_next_regex(char *ptr)
{
while ((*ptr != '"' || (*(ptr + 1) != ' ' && *(ptr + 1) != '\n'))
&& *ptr != '\n' && *ptr != '\0')
assert(ptr != NULL);
/* 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)) &&
*(ptr + 1) != '\0')) && *ptr != '\0')
ptr++;
if (*ptr == '\0')
assert(*ptr == '"' || *ptr == '\0');
if (*ptr == '\0') {
rcfile_error(
N_("Regex strings must begin and end with a \" character"));
return NULL;
}
/* Null terminate and advance ptr. */
*ptr++ = '\0';
while (isblank(*ptr))
while (is_blank_char(*ptr))
ptr++;
return ptr;
}
/* Compile the regular expression regex to preg. Returns FALSE on
/* Compile the regular expression regex to preg. Return FALSE on
* success, or TRUE if the expression is invalid. */
int nregcomp(regex_t *preg, const char *regex, int eflags)
bool nregcomp(regex_t *preg, const char *regex, int eflags)
{
int rc = regcomp(preg, regex, REG_EXTENDED | eflags);
@@ -252,80 +270,80 @@ int nregcomp(regex_t *preg, const char *regex, int eflags)
rcfile_error(N_("Bad regex \"%s\": %s"), regex, str);
free(str);
}
return rc != 0;
return (rc != 0);
}
void parse_syntax(char *ptr)
{
syntaxtype *tmpsyntax = NULL;
const char *fileregptr = NULL, *nameptr = NULL;
exttype *endext = NULL;
/* The end of the extensions list for this syntax. */
while (*ptr == ' ')
ptr++;
assert(ptr != NULL);
if (*ptr == '\n' || *ptr == '\0')
return;
if (*ptr != '"') {
rcfile_error(N_("Regex strings must begin and end with a \" character"));
if (*ptr == '\0') {
rcfile_error(N_("Missing syntax name"));
return;
}
if (*ptr != '"') {
rcfile_error(
N_("Regex strings must begin and end with a \" character"));
return;
}
ptr++;
nameptr = ptr;
ptr = parse_next_regex(ptr);
if (ptr == NULL) {
rcfile_error(N_("Missing syntax name"));
if (ptr == NULL)
return;
}
if (syntaxes == NULL) {
syntaxes = (syntaxtype *)nmalloc(sizeof(syntaxtype));
tmpsyntax = syntaxes;
SET(COLOR_SYNTAX);
endsyntax = syntaxes;
} else {
for (tmpsyntax = syntaxes; tmpsyntax->next != NULL;
tmpsyntax = tmpsyntax->next)
;
tmpsyntax->next = (syntaxtype *)nmalloc(sizeof(syntaxtype));
tmpsyntax = tmpsyntax->next;
endsyntax->next = (syntaxtype *)nmalloc(sizeof(syntaxtype));
endsyntax = endsyntax->next;
#ifdef DEBUG
fprintf(stderr, "Adding new syntax after 1st\n");
fprintf(stderr, "Adding new syntax after first one\n");
#endif
}
tmpsyntax->desc = mallocstrcpy(NULL, nameptr);
tmpsyntax->color = NULL;
tmpsyntax->extensions = NULL;
tmpsyntax->next = NULL;
endsyntax->desc = mallocstrcpy(NULL, nameptr);
endsyntax->color = NULL;
endcolor = NULL;
endsyntax->extensions = NULL;
endsyntax->next = NULL;
#ifdef DEBUG
fprintf(stderr, "Starting a new syntax type\n");
fprintf(stderr, "string val=%s\n", nameptr);
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
#endif
/* Now load in the extensions to their part of the struct */
while (*ptr != '\n' && *ptr != '\0') {
/* Now load the extensions into their part of the struct. */
while (*ptr != '\0') {
exttype *newext;
/* The new extension structure. */
while (*ptr != '"' && *ptr != '\n' && *ptr != '\0')
while (*ptr != '"' && *ptr != '\0')
ptr++;
if (*ptr == '\n' || *ptr == '\0')
if (*ptr == '\0')
return;
ptr++;
fileregptr = ptr;
ptr = parse_next_regex(ptr);
if (ptr == NULL)
break;
newext = (exttype *)nmalloc(sizeof(exttype));
if (nregcomp(&newext->val, fileregptr, REG_NOSUB) != 0)
if (nregcomp(&newext->val, fileregptr, REG_NOSUB))
free(newext);
else {
if (endext == NULL)
tmpsyntax->extensions = newext;
endsyntax->extensions = newext;
else
endext->next = newext;
endext = newext;
@@ -334,83 +352,83 @@ void parse_syntax(char *ptr)
}
}
/* Parse the color stuff into the colorstrings array */
/* Parse the color stuff into the colorstrings array. */
void parse_colors(char *ptr)
{
int fg, bg, bright = 0;
int expectend = 0; /* Do we expect an end= line? */
int fg, bg;
bool bright = FALSE;
char *fgstr;
colortype *tmpcolor = NULL;
syntaxtype *tmpsyntax = NULL;
fgstr = ptr;
ptr = parse_next_word(ptr);
assert(ptr != NULL);
if (ptr == NULL) {
if (*ptr == '\0') {
rcfile_error(N_("Missing color name"));
return;
}
if (strstr(fgstr, ",")) {
fgstr = ptr;
ptr = parse_next_word(ptr);
if (strchr(fgstr, ',') != NULL) {
char *bgcolorname;
strtok(fgstr, ",");
bgcolorname = strtok(NULL, ",");
if (strncasecmp(bgcolorname, "bright", 6) == 0) {
rcfile_error(N_("Background color %s cannot be bright"), bgcolorname);
rcfile_error(
N_("Background color %s cannot be bright"),
bgcolorname);
return;
}
bg = colortoint(bgcolorname, &bright);
bg = color_to_int(bgcolorname, &bright);
} else
bg = -1;
fg = colortoint(fgstr, &bright);
fg = color_to_int(fgstr, &bright);
/* Don't try and parse screwed up fg colors */
/* Don't try to parse screwed-up foreground colors. */
if (fg == -1)
return;
if (syntaxes == NULL) {
rcfile_error(N_("Cannot add a color directive without a syntax line"));
rcfile_error(
N_("Cannot add a color directive without a syntax line"));
return;
}
for (tmpsyntax = syntaxes; tmpsyntax->next != NULL;
tmpsyntax = tmpsyntax->next)
;
/* Now for the fun part. Start adding regexps to individual strings
* in the colorstrings array, woo! */
/* Now the fun part, start adding regexps to individual strings
in the colorstrings array, woo! */
while (*ptr != '\0') {
while (ptr != NULL && *ptr != '\0') {
colortype *newcolor;
/* The new color structure. */
int cancelled = 0;
bool cancelled = FALSE;
/* The start expression was bad. */
while (*ptr == ' ')
ptr++;
if (*ptr == '\n' || *ptr == '\0')
break;
bool expectend = FALSE;
/* Do we expect an end= line? */
if (strncasecmp(ptr, "start=", 6) == 0) {
ptr += 6;
expectend = 1;
expectend = TRUE;
}
if (*ptr != '"') {
rcfile_error(N_("Regex strings must begin and end with a \" character"));
rcfile_error(
N_("Regex strings must begin and end with a \" character"));
ptr = parse_next_regex(ptr);
continue;
}
ptr++;
newcolor = (colortype *)nmalloc(sizeof(colortype));
fgstr = ptr;
ptr = parse_next_regex(ptr);
if (nregcomp(&newcolor->start, fgstr, 0) != 0) {
if (ptr == NULL)
break;
if (nregcomp(&newcolor->start, fgstr, 0)) {
free(newcolor);
cancelled = 1;
cancelled = TRUE;
} else {
newcolor->fg = fg;
newcolor->bg = bg;
@@ -418,84 +436,84 @@ void parse_colors(char *ptr)
newcolor->next = NULL;
newcolor->end = NULL;
if (tmpsyntax->color == NULL) {
tmpsyntax->color = newcolor;
if (endcolor == NULL) {
endsyntax->color = newcolor;
#ifdef DEBUG
fprintf(stderr, "Starting a new colorstring for fg %d bg %d\n", fg, bg);
fprintf(stderr, "Starting a new colorstring for fg %d, bg %d\n", fg, bg);
#endif
} else {
for (tmpcolor = tmpsyntax->color; tmpcolor->next != NULL;
tmpcolor = tmpcolor->next)
;
#ifdef DEBUG
fprintf(stderr, "Adding new entry for fg %d bg %d\n", fg, bg);
fprintf(stderr, "Adding new entry for fg %d, bg %d\n", fg, bg);
#endif
tmpcolor->next = newcolor;
endcolor->next = newcolor;
}
endcolor = newcolor;
}
if (expectend) {
if (ptr == NULL || strncasecmp(ptr, "end=", 4) != 0) {
rcfile_error(N_("\"start=\" requires a corresponding \"end=\""));
rcfile_error(
N_("\"start=\" requires a corresponding \"end=\""));
return;
}
ptr += 4;
if (*ptr != '"') {
rcfile_error(N_("Regex strings must begin and end with a \" character"));
rcfile_error(
N_("Regex strings must begin and end with a \" character"));
continue;
}
ptr++;
fgstr = ptr;
ptr = parse_next_regex(ptr);
if (ptr == NULL)
break;
/* If the start regex was invalid, skip past the end regex to
* stay in sync. */
if (cancelled)
continue;
newcolor->end = (regex_t *)nmalloc(sizeof(regex_t));
if (nregcomp(newcolor->end, fgstr, 0) != 0) {
if (nregcomp(newcolor->end, fgstr, 0)) {
free(newcolor->end);
newcolor->end = NULL;
}
}
}
}
#endif /* ENABLE_COLOR */
/* Parse the RC file, once it has been opened successfully */
/* Parse the rcfile, once it has been opened successfully. */
void parse_rcfile(FILE *rcstream)
{
char *buf, *ptr, *keyword, *option;
int set = 0, i;
char *buf = NULL;
ssize_t len;
size_t n;
while ((len = getline(&buf, &n, rcstream)) > 0) {
char *ptr, *keyword, *option;
int set = 0, i;
/* Ignore the \n. */
buf[len - 1] = '\0';
buf = charalloc(1024);
while (fgets(buf, 1023, rcstream) != 0) {
lineno++;
ptr = buf;
while (isblank(*ptr))
while (is_blank_char(*ptr))
ptr++;
if (*ptr == '\n' || *ptr == '\0')
/* If we have a blank line or a comment, skip to the next
* line. */
if (*ptr == '\0' || *ptr == '#')
continue;
if (*ptr == '#') {
#ifdef DEBUG
fprintf(stderr, "%s: Read a comment\n", "parse_rcfile()");
#endif
continue; /* Skip past commented lines */
}
/* Else skip to the next space */
/* Otherwise, skip to the next space. */
keyword = ptr;
ptr = parse_next_word(ptr);
if (ptr == NULL)
continue;
/* Else try to parse the keyword */
/* Try to parse the keyword. */
if (strcasecmp(keyword, "set") == 0)
set = 1;
else if (strcasecmp(keyword, "unset") == 0)
@@ -505,138 +523,155 @@ void parse_rcfile(FILE *rcstream)
parse_syntax(ptr);
else if (strcasecmp(keyword, "color") == 0)
parse_colors(ptr);
#endif /* ENABLE_COLOR */
else {
#endif /* ENABLE_COLOR */
else
rcfile_error(N_("Command %s not understood"), keyword);
if (set == 0)
continue;
if (*ptr == '\0') {
rcfile_error(N_("Missing flag"));
continue;
}
option = ptr;
ptr = parse_next_word(ptr);
/* We don't care if ptr == NULL, as it should if using proper syntax */
if (set != 0) {
for (i = 0; rcopts[i].name != NULL; i++) {
if (strcasecmp(option, rcopts[i].name) == 0) {
for (i = 0; rcopts[i].name != NULL; i++) {
if (strcasecmp(option, rcopts[i].name) == 0) {
#ifdef DEBUG
fprintf(stderr, "%s: Parsing option %s\n",
"parse_rcfile()", rcopts[i].name);
fprintf(stderr, "parse_rcfile(): name = \"%s\"\n", rcopts[i].name);
#endif
if (set == 1) {
if (strcasecmp(rcopts[i].name, "tabsize") == 0
#ifndef DISABLE_OPERATINGDIR
|| strcasecmp(rcopts[i].name, "operatingdir") == 0
#endif
#ifndef DISABLE_WRAPJUSTIFY
|| strcasecmp(rcopts[i].name, "fill") == 0
#endif
#ifndef NANO_SMALL
|| strcasecmp(rcopts[i].name, "whitespace") == 0
#endif
#ifndef DISABLE_JUSTIFY
|| strcasecmp(rcopts[i].name, "punct") == 0
|| strcasecmp(rcopts[i].name, "brackets") == 0
|| strcasecmp(rcopts[i].name, "quotestr") == 0
#endif
#ifndef NANO_SMALL
|| strcasecmp(rcopts[i].name, "backupdir") == 0
#endif
#ifndef DISABLE_SPELLER
|| strcasecmp(rcopts[i].name, "speller") == 0
#endif
) {
if (*ptr == '\n' || *ptr == '\0') {
rcfile_error(N_("Option %s requires an argument"), rcopts[i].name);
continue;
}
option = ptr;
if (*option == '"')
option++;
ptr = parse_argument(ptr);
if (set == 1) {
if (rcopts[i].flag != 0)
/* This option has a flag, so it doesn't take an
* argument. */
SET(rcopts[i].flag);
else {
/* This option doesn't have a flag, so it takes
* an argument. */
if (*ptr == '\0') {
rcfile_error(
N_("Option %s requires an argument"),
rcopts[i].name);
break;
}
option = ptr;
if (*option == '"')
option++;
ptr = parse_argument(ptr);
option = make_mbstring(option);
#ifdef DEBUG
fprintf(stderr, "option = %s\n", option);
fprintf(stderr, "option = \"%s\"\n", option);
#endif
#ifndef DISABLE_OPERATINGDIR
if (strcasecmp(rcopts[i].name, "operatingdir") == 0)
operating_dir = mallocstrcpy(NULL, option);
else
if (strcasecmp(rcopts[i].name, "operatingdir") == 0)
operating_dir = option;
else
#endif
#ifndef DISABLE_WRAPJUSTIFY
if (strcasecmp(rcopts[i].name, "fill") == 0) {
if (!parse_num(option, &wrap_at)) {
rcfile_error(N_("Requested fill size %s invalid"), option);
wrap_at = -CHARS_FROM_EOL;
}
if (strcasecmp(rcopts[i].name, "fill") == 0) {
if (!parse_num(option, &wrap_at)) {
rcfile_error(
N_("Requested fill size %s invalid"),
option);
wrap_at = -CHARS_FROM_EOL;
} else
free(option);
} else
#endif
#ifndef NANO_SMALL
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
size_t ws_len;
whitespace = mallocstrcpy(NULL, option);
ws_len = strlen(whitespace);
if (ws_len != 2 || (ws_len == 2 && (is_cntrl_char(whitespace[0]) || is_cntrl_char(whitespace[1])))) {
rcfile_error(N_("Two non-control characters required"));
free(whitespace);
whitespace = NULL;
}
} else
#endif
#ifndef DISABLE_JUSTIFY
if (strcasecmp(rcopts[i].name, "punct") == 0) {
punct = mallocstrcpy(NULL, option);
if (strchr(punct, '\t') != NULL || strchr(punct, ' ') != NULL) {
rcfile_error(N_("Non-tab and non-space characters required"));
free(punct);
punct = NULL;
}
} else if (strcasecmp(rcopts[i].name, "brackets") == 0) {
brackets = mallocstrcpy(NULL, option);
if (strchr(brackets, '\t') != NULL || strchr(brackets, ' ') != NULL) {
rcfile_error(N_("Non-tab and non-space characters required"));
free(brackets);
brackets = NULL;
}
} else if (strcasecmp(rcopts[i].name, "quotestr") == 0)
quotestr = mallocstrcpy(NULL, option);
else
#endif
#ifndef NANO_SMALL
if (strcasecmp(rcopts[i].name, "backupdir") == 0)
backup_dir = mallocstrcpy(NULL, option);
else
#endif
#ifndef DISABLE_SPELLER
if (strcasecmp(rcopts[i].name, "speller") == 0)
alt_speller = mallocstrcpy(NULL, option);
else
#endif
if (strcasecmp(rcopts[i].name, "tabsize") == 0) {
if (!parse_num(option, &tabsize) || tabsize <= 0)
rcfile_error(N_("Requested tab size %s invalid"), option);
tabsize = -1;
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
whitespace = option;
if (mbstrlen(whitespace) != 2 || strlenpt(whitespace) != 2) {
rcfile_error(
N_("Two single-column characters required"));
free(whitespace);
whitespace = NULL;
} else {
whitespace_len[0] =
parse_mbchar(whitespace, NULL,
NULL, NULL);
whitespace_len[1] =
parse_mbchar(whitespace +
whitespace_len[0], NULL,
NULL, NULL);
}
} else
SET(rcopts[i].flag);
#ifdef DEBUG
fprintf(stderr, "set flag %d!\n",
rcopts[i].flag);
#endif
} else {
UNSET(rcopts[i].flag);
#ifdef DEBUG
fprintf(stderr, "unset flag %d!\n",
rcopts[i].flag);
#ifndef DISABLE_JUSTIFY
if (strcasecmp(rcopts[i].name, "punct") == 0) {
punct = option;
if (strchr(punct, '\t') != NULL ||
strchr(punct, ' ') != NULL) {
rcfile_error(
N_("Non-tab and non-space characters required"));
free(punct);
punct = NULL;
}
} else if (strcasecmp(rcopts[i].name,
"brackets") == 0) {
brackets = option;
if (strchr(brackets, '\t') != NULL ||
strchr(brackets, ' ') != NULL) {
rcfile_error(
N_("Non-tab and non-space characters required"));
free(brackets);
brackets = NULL;
}
} else if (strcasecmp(rcopts[i].name,
"quotestr") == 0)
quotestr = option;
else
#endif
#ifndef NANO_SMALL
if (strcasecmp(rcopts[i].name,
"backupdir") == 0)
backup_dir = option;
else
#endif
#ifndef DISABLE_SPELLER
if (strcasecmp(rcopts[i].name, "speller") == 0)
alt_speller = option;
else
#endif
if (strcasecmp(rcopts[i].name,
"tabsize") == 0) {
if (!parse_num(option, &tabsize) ||
tabsize <= 0) {
rcfile_error(
N_("Requested tab size %s invalid"),
option);
tabsize = -1;
} else
free(option);
} else
assert(FALSE);
}
}
#ifdef DEBUG
fprintf(stderr, "flag = %d\n", rcopts[i].flag);
#endif
} else if (rcopts[i].flag != 0)
UNSET(rcopts[i].flag);
else
rcfile_error(N_("Cannot unset flag %s"),
rcopts[i].name);
break;
}
}
if (rcopts[i].name == NULL)
rcfile_error(N_("Unknown flag %s"), option);
}
free(buf);
fclose(rcstream);
lineno = 0;
if (errors) {
errors = FALSE;
fprintf(stderr, _("\nPress Return to continue starting nano\n"));
fprintf(stderr,
_("\nPress Return to continue starting nano\n"));
while (getchar() != '\n')
;
}
@@ -651,62 +686,42 @@ void do_rcfile(void)
#ifdef SYSCONFDIR
assert(sizeof(SYSCONFDIR) == strlen(SYSCONFDIR) + 1);
nanorc = SYSCONFDIR "/nanorc";
/* Try to open system nanorc */
nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");
/* Try to open the system-wide nanorc. */
rcstream = fopen(nanorc, "r");
if (rcstream != NULL) {
/* Parse it! */
if (rcstream != NULL)
parse_rcfile(rcstream);
fclose(rcstream);
}
#endif
lineno = 0;
{
const char *homenv = getenv("HOME");
/* Rely on $HOME, fall back on getpwuid() */
if (homenv == NULL) {
const struct passwd *userage = getpwuid(geteuid());
if (userage != NULL)
homenv = userage->pw_dir;
}
homedir = mallocstrcpy(NULL, homenv);
}
if (homedir == NULL) {
rcfile_error(N_("I can't find my home directory! Wah!"));
SET(NO_RCFILE);
} else {
size_t homelen = strlen(homedir);
char *nanorcf = charalloc(homelen + 9);
nanorc = nanorcf;
strcpy(nanorcf, homedir);
strcpy(nanorcf + homelen, "/.nanorc");
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
/* If we've already read SYSCONFDIR/nanorc (if it's there), we're
root, and --disable-wrapping-as-root is used, turn wrapping off */
if (geteuid() == NANO_ROOT_UID)
SET(NO_WRAP);
/* We've already read SYSCONFDIR/nanorc, if it's there. If we're
* root and --disable-wrapping-as-root is used, turn wrapping
* off now. */
if (geteuid() == NANO_ROOT_UID)
SET(NO_WRAP);
#endif
get_homedir();
if (homedir == NULL)
rcfile_error(N_("I can't find my home directory! Wah!"));
else {
nanorc = charealloc(nanorc, strlen(homedir) + 9);
sprintf(nanorc, "%s/.nanorc", homedir);
rcstream = fopen(nanorc, "r");
if (rcstream == NULL) {
/* Don't complain about the file not existing */
if (errno != ENOENT) {
rcfile_error(N_("Error reading %s: %s"), nanorc, strerror(errno));
SET(NO_RCFILE);
}
} else {
/* Don't complain about the file's not existing. */
if (errno != ENOENT)
rcfile_error(N_("Error reading %s: %s"), nanorc,
strerror(errno));
} else
parse_rcfile(rcstream);
fclose(rcstream);
}
free(nanorcf);
}
lineno = 0;
free(nanorc);
nanorc = NULL;
#ifdef ENABLE_COLOR
set_colorpairs();

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* search.c *
* *
* Copyright (C) 2000-2004 Chris Allegretta *
* Copyright (C) 2000-2005 Chris Allegretta *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -19,7 +19,9 @@
* *
**************************************************************************/
#include "config.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
@@ -31,9 +33,11 @@
#include "proto.h"
#include "nano.h"
static bool search_last_line = FALSE;
/* Have we gone past the last line while searching? */
#ifdef HAVE_REGEX_H
static int regexp_compiled = FALSE;
static bool regexp_compiled = FALSE;
/* Have we compiled any regular expressions? */
/* Regular expression helper functions. */
@@ -42,8 +46,11 @@ static int regexp_compiled = FALSE;
* bar. Return value 1 means success. */
int regexp_init(const char *regexp)
{
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED |
(ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE));
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED
#ifndef NANO_SMALL
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
#endif
);
assert(!regexp_compiled);
if (rc != 0) {
@@ -76,11 +83,11 @@ void not_found_msg(const char *str)
assert(str != NULL);
disp = display_string(str, 0, (COLS / 2) + 1);
numchars = strnlen(disp, COLS / 2);
disp = display_string(str, 0, (COLS / 2) + 1, FALSE);
numchars = actual_x(disp, mbstrnlen(disp, COLS / 2));
statusbar(_("\"%.*s%s\" not found"), numchars, disp,
disp[numchars] == '\0' ? "" : "...");
(disp[numchars] == '\0') ? "" : "...");
free(disp);
}
@@ -99,59 +106,60 @@ void search_abort(void)
void search_init_globals(void)
{
if (last_search == NULL) {
last_search = charalloc(1);
last_search[0] = '\0';
}
if (last_replace == NULL) {
last_replace = charalloc(1);
last_replace[0] = '\0';
}
if (last_search == NULL)
last_search = mallocstrcpy(NULL, "");
if (last_replace == NULL)
last_replace = mallocstrcpy(NULL, "");
}
/* Set up the system variables for a search or replace. Return -1 if
* the search should be cancelled (due to Cancel, Go to Line, or a
* failed regcomp()). Return 0 on success, and 1 on rerun calling
* program. Return -2 to run opposite program (search -> replace,
* replace -> search).
/* Set up the system variables for a search or replace. If use_answer
* is TRUE, only set backupstring to answer. Return -2 to run opposite
* program (search -> replace, replace -> search), return -1 if the
* search should be canceled (due to Cancel, Go to Line, or a failed
* regcomp()), return 0 on success, and return 1 on rerun calling
* program.
*
* replacing = 1 if we call from do_replace(), 0 if called from
* do_search(). */
int search_init(int replacing)
* replacing is TRUE if we call from do_replace(), and FALSE if called
* from do_search(). */
int search_init(bool replacing, bool use_answer)
{
int i = 0;
char *buf;
static char *backupstring = NULL;
/* The search string we'll be using. */
/* If backupstring doesn't exist, initialize it to "". */
if (backupstring == NULL)
backupstring = mallocstrcpy(NULL, "");
/* If use_answer is TRUE, set backupstring to answer and get out. */
if (use_answer) {
backupstring = mallocstrcpy(backupstring, answer);
return 0;
}
/* We display the search prompt below. If the user types a partial
* search string and then Replace or a toggle, we will return to
* do_search() or do_replace() and be called again. In that case,
* we should put the same search string back up. backupstring holds
* this string. */
* we should put the same search string back up. */
search_init_globals();
/* If we don't already have a backupstring, set it. */
if (backupstring == NULL)
backupstring = mallocstrcpy(NULL, "");
#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);
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
buf = charalloc(COLS / 3 + 7);
buf = charalloc(strlen(disp) + 7);
/* We use COLS / 3 here because we need to see more on the
* line. */
sprintf(buf, " [%s%s]", disp,
strlenpt(last_search) > COLS / 3 ? "..." : "");
free(disp);
} else {
buf = charalloc(1);
buf[0] = '\0';
}
} else
buf = mallocstrcpy(NULL, "");
/* This is now one simple call. It just does a lot. */
i = statusq(FALSE, replacing ? replace_list : whereis_list,
@@ -182,7 +190,16 @@ int search_init(int replacing)
#endif
"",
replacing ? _(" (to replace)") : "",
replacing ?
#ifndef NANO_SMALL
(ISSET(MARK_ISSET) ? _(" (to replace) in selection") :
#endif
_(" (to replace)")
#ifndef NANO_SMALL
)
#endif
: "",
buf);
/* Release buf now that we don't need it anymore. */
@@ -194,129 +211,187 @@ int search_init(int replacing)
/* Cancel any search, or just return with no previous search. */
if (i == -1 || (i < 0 && last_search[0] == '\0') ||
(!replacing && i == 0 && answer[0] == '\0')) {
statusbar(_("Search Cancelled"));
statusbar(_("Cancelled"));
#ifndef NANO_SMALL
search_history.current = search_history.next;
#endif
return -1;
} else {
switch (i) {
case -2: /* It's the same string. */
case -2: /* It's the same string. */
#ifdef HAVE_REGEX_H
/* Since answer is "", use last_search! */
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
return -1;
/* Since answer is "", use last_search! */
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
return -1;
#endif
break;
case 0: /* They entered something new. */
last_replace[0] = '\0';
break;
case 0: /* They entered something new. */
last_replace[0] = '\0';
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP) && regexp_init(answer) == 0)
return -1;
if (ISSET(USE_REGEXP) && regexp_init(answer) == 0)
return -1;
#endif
break;
break;
#ifndef NANO_SMALL
case TOGGLE_CASE_KEY:
TOGGLE(CASE_SENSITIVE);
backupstring = mallocstrcpy(backupstring, answer);
return 1;
case TOGGLE_BACKWARDS_KEY:
TOGGLE(REVERSE_SEARCH);
backupstring = mallocstrcpy(backupstring, answer);
return 1;
case TOGGLE_CASE_KEY:
TOGGLE(CASE_SENSITIVE);
backupstring = mallocstrcpy(backupstring, answer);
return 1;
case TOGGLE_BACKWARDS_KEY:
TOGGLE(REVERSE_SEARCH);
backupstring = mallocstrcpy(backupstring, answer);
return 1;
#ifdef HAVE_REGEX_H
case TOGGLE_REGEXP_KEY:
TOGGLE(USE_REGEXP);
backupstring = mallocstrcpy(backupstring, answer);
return 1;
case TOGGLE_REGEXP_KEY:
TOGGLE(USE_REGEXP);
backupstring = mallocstrcpy(backupstring, answer);
return 1;
#endif
#endif /* !NANO_SMALL */
case NANO_OTHERSEARCH_KEY:
backupstring = mallocstrcpy(backupstring, answer);
return -2; /* Call the opposite search function. */
case NANO_FROMSEARCHTOGOTO_KEY:
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;
search_history.current = search_history.next;
#endif
/* If answer parses as an integer, put it up on the
* statusbar. */
do_gotoline(parse_num(answer, NULL) ? -1 : 0, FALSE);
/* Fall through. */
default:
return -1;
do_gotoline(-1, FALSE); /* Put answer up on the
* statusbar and fall
* through. */
default:
return -1;
}
}
return 0;
}
int is_whole_word(int curr_pos, const char *datastr, const char
*searchword)
bool is_whole_word(size_t pos, const char *buf, const char *word)
{
size_t sln = curr_pos + strlen(searchword);
char *p = charalloc(mb_cur_max()), *r = charalloc(mb_cur_max());
size_t word_end = pos + strlen(word);
bool retval;
/* Start of line or previous character is not a letter and end of
* line or next character is not a letter. */
return (curr_pos < 1 || !isalpha((int)datastr[curr_pos - 1])) &&
(sln == strlen(datastr) || !isalpha((int)datastr[sln]));
assert(buf != NULL && pos <= strlen(buf) && word != NULL);
parse_mbchar(buf + move_mbleft(buf, pos), p, NULL, NULL);
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));
free(p);
free(r);
return retval;
}
/* Look for needle, starting at current, column current_x. If
* no_sameline is nonzero, skip over begin when looking for needle.
* begin is the line where we first started searching, at column beginx.
* If can_display_wrap is nonzero, we put messages on the statusbar, and
* wrap around the file boundaries. The return value specifies whether
* we found anything. */
int findnextstr(int can_display_wrap, int wholeword, const filestruct
*begin, size_t beginx, const char *needle, int no_sameline)
/* Look for needle, starting at (current, current_x). If no_sameline is
* TRUE, skip over begin when looking for needle. begin is the line
* where we first started searching, at column beginx. If
* can_display_wrap is TRUE, we put messages on the statusbar, wrap
* around the file boundaries. The return value specifies whether we
* found anything. If we did, set needle_len to the length of the
* string we found if it isn't NULL. */
bool findnextstr(bool can_display_wrap, bool wholeword, bool
no_sameline, const filestruct *begin, size_t beginx, const char
*needle, size_t *needle_len)
{
filestruct *fileptr = current;
const char *rev_start = NULL, *found = NULL;
size_t found_len;
/* The length of the match we found. */
size_t current_x_find = 0;
/* Where needle was found. */
/* The location of the match we found. */
int 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()
* will return immediately and say that no match was found, and
* rev_start will be properly set when the search continues on the
* previous or next line. */
rev_start =
#ifndef NANO_SMALL
if (ISSET(REVERSE_SEARCH))
rev_start = fileptr->data + (current_x - 1);
else
ISSET(REVERSE_SEARCH) ? fileptr->data + (current_x - 1) :
#endif
rev_start = fileptr->data + (current_x + 1);
fileptr->data + (current_x + 1);
/* Look for needle in searchstr. */
while (TRUE) {
found = strstrwrapper(fileptr->data, needle, rev_start);
if (found != NULL && (!wholeword || is_whole_word(found -
fileptr->data, fileptr->data, needle))) {
if (!no_sameline || fileptr != current)
/* We've found a potential match. */
if (found != NULL) {
bool found_whole = FALSE;
/* Is this potential match a whole word? */
/* Set found_len to the length of the potential match. */
found_len =
#ifdef HAVE_REGEX_H
ISSET(USE_REGEXP) ?
regmatches[0].rm_eo - regmatches[0].rm_so :
#endif
strlen(needle);
/* If we're searching for whole words, see if this potential
* match is a whole word. */
if (wholeword) {
char *word = mallocstrncpy(NULL, found, found_len + 1);
word[found_len] = '\0';
found_whole = is_whole_word(found - fileptr->data,
fileptr->data, word);
free(word);
}
/* If we're searching for whole words and this potential
* match isn't a whole word, or if we're not allowed to find
* a match on the same line we started on and this potential
* match is on that line, continue searching. */
if ((!wholeword || found_whole) && (!no_sameline ||
fileptr != current))
break;
}
/* Finished processing file, get out. */
/* We've finished processing the file, so get out. */
if (search_last_line) {
if (can_display_wrap)
not_found_msg(needle);
return 0;
return FALSE;
}
fileptr =
#ifndef NANO_SMALL
ISSET(REVERSE_SEARCH) ? fileptr->prev :
#endif
fileptr->next;
/* Start or end of buffer reached; wrap around. */
#ifndef NANO_SMALL
if (ISSET(REVERSE_SEARCH)) {
fileptr = fileptr->prev;
current_y_find--;
} else {
#endif
fileptr = fileptr->next;
current_y_find++;
#ifndef NANO_SMALL
}
#endif
/* Start or end of buffer reached, so wrap around. */
if (fileptr == NULL) {
if (!can_display_wrap)
return 0;
fileptr =
return FALSE;
#ifndef NANO_SMALL
ISSET(REVERSE_SEARCH) ? filebot :
if (ISSET(REVERSE_SEARCH)) {
fileptr = filebot;
current_y_find = editwinrows - 1;
} else {
#endif
fileage;
fileptr = fileage;
current_y_find = 0;
#ifndef NANO_SMALL
}
#endif
if (can_display_wrap)
statusbar(_("Search Wrapped"));
}
@@ -324,6 +399,7 @@ int findnextstr(int can_display_wrap, int wholeword, const filestruct
/* Original start line reached. */
if (fileptr == begin)
search_last_line = TRUE;
rev_start = fileptr->data;
#ifndef NANO_SMALL
if (ISSET(REVERSE_SEARCH))
@@ -346,27 +422,40 @@ int findnextstr(int can_display_wrap, int wholeword, const filestruct
if (can_display_wrap)
not_found_msg(needle);
return 0;
return FALSE;
}
/* Set globals now that we are sure we found something. */
current = fileptr;
current_x = current_x_find;
current_y = current_y_find;
placewewant = xplustabs();
return 1;
/* needle_len holds the length of needle. */
if (needle_len != NULL)
*needle_len = found_len;
return TRUE;
}
void findnextstr_wrap_reset(void)
{
search_last_line = FALSE;
}
/* Search for a string. */
void do_search(void)
{
size_t old_pww = placewewant, fileptr_x = current_x;
int i, didfind;
int i;
bool didfind;
filestruct *fileptr = current;
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
i = search_init(0);
i = search_init(FALSE, FALSE);
if (i == -1) /* Cancel, Go to Line, blank search string, or
* regcomp() failed. */
search_abort();
@@ -394,8 +483,9 @@ void do_search(void)
update_history(&search_history, answer);
#endif
search_last_line = FALSE;
didfind = findnextstr(TRUE, FALSE, current, current_x, answer, FALSE);
findnextstr_wrap_reset();
didfind = findnextstr(TRUE, FALSE, FALSE, current, current_x,
answer, NULL);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
@@ -408,8 +498,8 @@ void do_search(void)
* which case it's the only occurrence. */
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
last_search)) {
didfind = findnextstr(TRUE, FALSE, current, current_x,
answer, TRUE);
didfind = findnextstr(TRUE, FALSE, TRUE, current, current_x,
answer, NULL);
if (fileptr == current && fileptr_x == current_x && !didfind)
statusbar(_("This is the only occurrence"));
} else {
@@ -430,12 +520,13 @@ void do_search(void)
void do_research(void)
{
size_t old_pww = placewewant, fileptr_x = current_x;
int didfind;
bool didfind;
filestruct *fileptr = current;
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
search_init_globals();
if (last_search[0] != '\0') {
@@ -446,9 +537,9 @@ void do_research(void)
return;
#endif
search_last_line = FALSE;
didfind = findnextstr(TRUE, FALSE, current, current_x,
last_search, FALSE);
findnextstr_wrap_reset();
didfind = findnextstr(TRUE, FALSE, FALSE, current, current_x,
last_search, NULL);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
@@ -461,8 +552,8 @@ void do_research(void)
* found again, in which case it's the only occurrence. */
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
last_search)) {
didfind = findnextstr(TRUE, FALSE, current, current_x,
answer, TRUE);
didfind = findnextstr(TRUE, FALSE, TRUE, current,
current_x, answer, NULL);
if (fileptr == current && fileptr_x == current_x && !didfind)
statusbar(_("This is the only occurrence"));
} else {
@@ -491,9 +582,9 @@ void replace_abort(void)
}
#ifdef HAVE_REGEX_H
int replace_regexp(char *string, int create_flag)
int replace_regexp(char *string, bool create_flag)
{
/* Split personality here - if create_flag is zero, just calculate
/* Split personality here - if create_flag is FALSE, just calculate
* the size of the replacement line (necessary because of
* subexpressions \1 to \9 in the replaced text). */
@@ -506,7 +597,8 @@ int replace_regexp(char *string, int create_flag)
while (*c != '\0') {
int num = (int)(*(c + 1) - '0');
if (*c != '\\' || num < 1 || num > 9 || num > search_regexp.re_nsub) {
if (*c != '\\' || num < 1 || num > 9 ||
num > search_regexp.re_nsub) {
if (create_flag)
*string++ = *c;
c++;
@@ -520,7 +612,7 @@ int replace_regexp(char *string, int create_flag)
/* But add the length of the subexpression to new_size. */
new_size += i;
/* And if create_flag is nonzero, append the result of the
/* And if create_flag is TRUE, append the result of the
* subexpression match to the new line. */
if (create_flag) {
strncpy(string, current->data + current_x +
@@ -579,31 +671,51 @@ char *replace_line(const char *needle)
}
/* Step through each replace word and prompt user before replacing.
* Parameters real_current and real_current_x are needed by the internal
* speller, to allow the cursor position to be updated when a word
* before the cursor is replaced by a shorter word.
* Parameters real_current and real_current_x are needed in order to
* allow the cursor position to be updated when a word before the cursor
* is replaced by a shorter word.
*
* needle is the string to seek. We replace it with answer. Return -1
* if needle isn't found, else the number of replacements performed. */
int do_replace_loop(const char *needle, const filestruct *real_current,
size_t *real_current_x, int wholewords)
* if needle isn't found, else the number of replacements performed. If
* canceled isn't NULL, set it to TRUE if we canceled. */
ssize_t do_replace_loop(const char *needle, const filestruct
*real_current, size_t *real_current_x, bool wholewords, bool
*canceled)
{
int replaceall = FALSE, numreplaced = -1;
size_t old_pww = placewewant, current_x_save = current_x;
const filestruct *current_save = current;
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. */
int begin_line = FALSE, bol_or_eol = FALSE;
bool begin_line = FALSE, bol_or_eol = FALSE;
#endif
#ifndef NANO_SMALL
int mark_set = ISSET(MARK_ISSET);
bool old_mark_set = ISSET(MARK_ISSET);
filestruct *edittop_save = edittop, *top, *bot;
size_t top_x, bot_x;
bool right_side_up = FALSE;
/* TRUE if (mark_beginbuf, mark_beginx) is the top of the mark,
* FALSE if (current, current_x) is. */
UNSET(MARK_ISSET);
edit_refresh();
if (old_mark_set) {
/* If the mark is on, partition the filestruct so that it
* contains only the marked text, set edittop to the top of the
* partition, turn the mark off, and refresh the screen. */
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
filepart = partition_filestruct(top, top_x, bot, bot_x);
edittop = fileage;
UNSET(MARK_ISSET);
edit_refresh();
}
#endif
while (findnextstr(TRUE, wholewords, current_save, current_x_save,
needle,
if (canceled != NULL)
*canceled = FALSE;
findnextstr_wrap_reset();
while (findnextstr(TRUE, wholewords,
#ifdef HAVE_REGEX_H
/* We should find a bol and/or eol regex only once per line. If
* the bol_or_eol flag is set, it means that the last search
@@ -613,10 +725,9 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
#else
FALSE
#endif
) != 0) {
, real_current, *real_current_x, needle, &match_len)) {
int i = 0;
size_t match_len;
#ifdef HAVE_REGEX_H
/* If the bol_or_eol flag is set, we've found a match on the
@@ -636,19 +747,12 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
#endif
if (!replaceall) {
placewewant = xplustabs();
edit_redraw(current_save, old_pww);
old_pww = placewewant;
edit_redraw(real_current, pww_save);
pww_save = placewewant;
}
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP))
match_len = regmatches[0].rm_eo - regmatches[0].rm_so;
else
#endif
match_len = strlen(needle);
/* Record for the return value that we found the search string. */
/* Record for the return value that we found the search
* string. */
if (numreplaced == -1)
numreplaced = 0;
@@ -657,7 +761,8 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
size_t xpt = xplustabs();
exp_word = display_string(current->data, xpt,
strnlenpt(current->data, match_len + current_x) - xpt);
strnlenpt(current->data, match_len + current_x) - xpt,
FALSE);
curs_set(0);
do_replace_highlight(TRUE, exp_word);
@@ -668,8 +773,11 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
free(exp_word);
curs_set(1);
if (i == -1) /* We canceled the replace. */
if (i == -1) { /* We canceled the replace. */
if (canceled != NULL)
*canceled = TRUE;
break;
}
}
#ifdef HAVE_REGEX_H
@@ -682,7 +790,7 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
if (i > 0 || replaceall) { /* Yes, replace it!!!! */
char *copy;
int length_change;
size_t length_change;
if (i == 2)
replaceall = TRUE;
@@ -692,24 +800,38 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
length_change = strlen(copy) - strlen(current->data);
#ifndef NANO_SMALL
if (current == mark_beginbuf && mark_beginx > current_x) {
if (mark_beginx < current_x + match_len)
mark_beginx = current_x;
else
mark_beginx += length_change;
/* If the mark was on and (mark_beginbuf, mark_begin_x) was
* the top of it, don't change mark_beginx. */
if (!old_mark_set || !right_side_up) {
/* Keep mark_beginx in sync with the text changes. */
if (current == mark_beginbuf &&
mark_beginx > current_x) {
if (mark_beginx < current_x + match_len)
mark_beginx = current_x;
else
mark_beginx += length_change;
}
}
/* If the mark was on and (current, current_x) was the top
* of it, don't change real_current_x. */
if (!old_mark_set || right_side_up) {
#endif
/* Keep real_current_x in sync with the text changes. */
if (current == real_current &&
current_x <= *real_current_x) {
if (*real_current_x < current_x + match_len)
*real_current_x = current_x + match_len;
*real_current_x += length_change;
}
#ifndef NANO_SMALL
}
#endif
assert(0 <= match_len + length_change);
if (current == real_current && current_x <= *real_current_x) {
if (*real_current_x < current_x + match_len)
*real_current_x = current_x + match_len;
*real_current_x += length_change;
}
/* Set the cursor at the last character of the replacement
* text, so searching will resume after the replacement
* text. Note that current_x might be set to -1 here. */
* text. Note that current_x might be set to (size_t)-1
* here. */
#ifndef NANO_SMALL
if (!ISSET(REVERSE_SEARCH))
#endif
@@ -722,7 +844,7 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
if (!replaceall) {
#ifdef ENABLE_COLOR
if (ISSET(COLOR_SYNTAX))
if (!ISSET(NO_COLOR_SYNTAX))
edit_refresh();
else
#endif
@@ -734,24 +856,32 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
}
}
#ifndef NANO_SMALL
if (old_mark_set) {
/* If the mark was on, unpartition the filestruct so that it
* contains all the text again, set edittop back to what it was
* before, turn the mark back on, and refresh the screen. */
unpartition_filestruct(&filepart);
edittop = edittop_save;
SET(MARK_ISSET);
edit_refresh();
}
#endif
/* If text has been added to the magicline, make a new magicline. */
if (filebot->data[0] != '\0')
new_magicline();
#ifndef NANO_SMALL
if (mark_set)
SET(MARK_ISSET);
#endif
return numreplaced;
}
/* Replace a string. */
void do_replace(void)
{
int i, numreplaced;
int i;
filestruct *edittop_save, *begin;
size_t beginx;
size_t beginx, pww_save;
ssize_t numreplaced;
if (ISSET(VIEW_MODE)) {
print_view_warning();
@@ -759,7 +889,7 @@ void do_replace(void)
return;
}
i = search_init(1);
i = search_init(TRUE, FALSE);
if (i == -1) { /* Cancel, Go to Line, blank search
* string, or regcomp() failed. */
replace_abort();
@@ -805,7 +935,7 @@ void do_replace(void)
if (i == -1) { /* Cancel. */
if (last_replace[0] != '\0')
answer = mallocstrcpy(answer, last_replace);
statusbar(_("Replace Cancelled"));
statusbar(_("Cancelled"));
}
replace_abort();
return;
@@ -814,23 +944,26 @@ void do_replace(void)
last_replace = mallocstrcpy(last_replace, answer);
/* Save where we are. */
edittop_save = edittop;
begin = current;
beginx = current_x;
edittop_save = edittop;
search_last_line = FALSE;
pww_save = placewewant;
numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE);
numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE,
NULL);
/* Restore where we were. */
edittop = edittop_save;
current = begin;
current_x = beginx;
placewewant = pww_save;
renumber_all();
edit_refresh();
if (numreplaced >= 0)
statusbar(P_("Replaced %d occurrence", "Replaced %d occurrences",
numreplaced), numreplaced);
statusbar(P_("Replaced %ld occurrence", "Replaced %ld occurrences",
(long)numreplaced), (long)numreplaced);
replace_abort();
}
@@ -839,7 +972,7 @@ void do_gotoline(int line, bool save_pos)
{
if (line <= 0) { /* Ask for it. */
char *ans = mallocstrcpy(NULL, answer);
int st = statusq(FALSE, goto_list, line < 0 ? ans : "",
int i = statusq(FALSE, gotoline_list, line < 0 ? ans : "",
#ifndef NANO_SMALL
NULL,
#endif
@@ -848,16 +981,25 @@ void do_gotoline(int line, bool save_pos)
free(ans);
/* Cancel, or Enter with blank string. */
if (st == -1 || st == -2)
statusbar(_("Aborted"));
if (st != 0) {
if (i < 0) {
statusbar(_("Cancelled"));
display_main_list();
return;
}
/* Bounds check. */
if (i == NANO_TOOTHERWHEREIS_KEY) {
/* Keep answer up on the statusbar. */
search_init(TRUE, TRUE);
do_search();
return;
}
/* 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) {
statusbar(_("Come on, be reasonable"));
if (i == 0)
statusbar(_("Come on, be reasonable"));
display_main_list();
return;
}
@@ -877,7 +1019,7 @@ void do_gotoline(int line, bool save_pos)
/* If save_pos is TRUE, don't change the cursor position when
* updating the edit window. */
edit_update(current, save_pos ? NONE : CENTER);
edit_update(save_pos ? NONE : CENTER);
placewewant = 0;
display_main_list();
@@ -889,7 +1031,7 @@ void do_gotoline_void(void)
}
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
void do_gotopos(int line, int pos_x, int pos_y, size_t pos_pww)
void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww)
{
/* Since do_gotoline() resets the x-coordinate but not the
* y-coordinate, set the coordinates up this way. */
@@ -913,9 +1055,9 @@ void do_find_bracket(void)
char ch_under_cursor, wanted_ch;
const char *pos, *brackets = "([{<>}])";
char regexp_pat[] = "[ ]";
size_t old_pww, current_x_save;
size_t current_x_save, pww_save;
int count = 1;
long flags_save;
unsigned long flags_save;
filestruct *current_save;
ch_under_cursor = current->data[current_x];
@@ -927,17 +1069,17 @@ void do_find_bracket(void)
}
assert(strlen(brackets) % 2 == 0);
wanted_ch = brackets[(strlen(brackets) - 1) - (pos - brackets)];
old_pww = placewewant;
current_x_save = current_x;
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)) {
/* On a left bracket. */
regexp_pat[1] = wanted_ch;
@@ -951,27 +1093,28 @@ void do_find_bracket(void)
}
regexp_init(regexp_pat);
/* We constructed regexp_pat to be a valid expression. */
assert(regexp_compiled);
search_last_line = FALSE;
findnextstr_wrap_reset();
while (TRUE) {
if (findnextstr(FALSE, FALSE, current, current_x, regexp_pat,
FALSE) != 0) {
if (findnextstr(FALSE, FALSE, FALSE, current, current_x,
regexp_pat, NULL)) {
/* Found identical bracket. */
if (current->data[current_x] == ch_under_cursor)
count++;
/* Found complementary bracket. */
else if (--count == 0) {
placewewant = xplustabs();
edit_redraw(current_save, old_pww);
edit_redraw(current_save, pww_save);
break;
}
} else {
/* Didn't find either a left or right bracket. */
statusbar(_("No matching bracket"));
current_x = current_x_save;
current = current_save;
current_x = current_x_save;
update_line(current, current_x);
break;
}

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* utils.c *
* *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 1999-2005 Chris Allegretta *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -19,12 +19,15 @@
* *
**************************************************************************/
#include "config.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <pwd.h>
#include <ctype.h>
#include <errno.h>
#include <assert.h>
@@ -33,7 +36,6 @@
#ifdef HAVE_REGEX_H
#ifdef BROKEN_REGEXEC
#undef regexec
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags)
{
@@ -41,34 +43,16 @@ int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
return regexec(preg, string, nmatch, pmatch, eflags);
return REG_NOMATCH;
}
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
#endif /* BROKEN_REGEXEC */
#endif
/* Assume that string will be found by regexec() if the REG_NOTBOL and
* REG_NOTEOL glags are not set. */
int regexp_bol_or_eol(const regex_t *preg, const char *string)
{
return (regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
return (regexec(preg, string, 0, NULL, 0) == 0 &&
regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
REG_NOMATCH);
}
#endif /* HAVE_REGEX_H */
#ifndef HAVE_ISBLANK
/* This function is equivalent to isblank(). */
int is_blank_char(int c)
{
return (c == '\t' || c == ' ');
}
#endif
/* This function is equivalent to iscntrl(), except in that it also
* handles control characters with their high bits set. */
int is_cntrl_char(int c)
{
return (-128 <= c && c < -96) || (0 <= c && c < 32) ||
(127 <= c && c < 160);
}
int num_of_digits(int n)
{
int i = 1;
@@ -84,20 +68,41 @@ int num_of_digits(int n)
return i;
}
/* Read an int from str, and store it in *val (if val is not NULL). On
* error, we return FALSE and don't change *val. Otherwise, we return
* TRUE. */
/* Return the user's home directory. We use $HOME, and if that fails,
* we fall back on getpwuid(). */
void get_homedir(void)
{
if (homedir == NULL) {
const char *homenv = getenv("HOME");
if (homenv == NULL) {
const struct passwd *userage = getpwuid(geteuid());
if (userage != NULL)
homenv = userage->pw_dir;
}
homedir = mallocstrcpy(NULL, homenv);
}
}
/* Read a ssize_t from str, and store it in *val (if val is not NULL).
* On error, we return FALSE and don't change *val. Otherwise, we
* return TRUE. */
bool parse_num(const char *str, ssize_t *val)
{
char *first_error;
ssize_t j;
assert(str != NULL);
j = (ssize_t)strtol(str, &first_error, 10);
if (errno == ERANGE || *str == '\0' || *first_error != '\0')
return FALSE;
if (val != NULL)
*val = j;
return TRUE;
}
@@ -139,107 +144,6 @@ void sunder(char *str)
}
}
#ifndef HAVE_STRCASECMP
/* This function is equivalent to strcasecmp(). */
int nstricmp(const char *s1, const char *s2)
{
assert(s1 != NULL && s2 != NULL);
for (; *s1 != '\0' && *s2 != '\0'; s1++, s2++) {
if (tolower(*s1) != tolower(*s2))
break;
}
return (tolower(*s1) - tolower(*s2));
}
#endif
#ifndef HAVE_STRNCASECMP
/* This function is equivalent to strncasecmp(). */
int nstrnicmp(const char *s1, const char *s2, size_t n)
{
assert(s1 != NULL && s2 != NULL);
for (; n > 0 && *s1 != '\0' && *s2 != '\0'; n--, s1++, s2++) {
if (tolower(*s1) != tolower(*s2))
break;
}
if (n > 0)
return (tolower(*s1) - tolower(*s2));
else
return 0;
}
#endif
#ifndef HAVE_STRCASESTR
/* This function is equivalent to strcasestr(). It was adapted from
* mutt's mutt_stristr() function. */
const char *nstristr(const char *haystack, const char *needle)
{
assert(haystack != NULL && needle != NULL);
for (; *haystack != '\0'; haystack++) {
const char *p = haystack;
const char *q = needle;
for (; tolower(*p) == tolower(*q) && *q != '\0'; p++, q++)
;
if (*q == '\0')
return haystack;
}
return NULL;
}
#endif
/* None of this is needed if we're using NANO_SMALL! */
#ifndef NANO_SMALL
const char *revstrstr(const char *haystack, const char *needle, const
char *rev_start)
{
for (; rev_start >= haystack; rev_start--) {
const char *r, *q;
for (r = rev_start, q = needle ; *q == *r && *q != '\0'; r++, q++)
;
if (*q == '\0')
return rev_start;
}
return NULL;
}
const char *revstristr(const char *haystack, const char *needle, const
char *rev_start)
{
for (; rev_start >= haystack; rev_start--) {
const char *r = rev_start, *q = needle;
for (; (tolower(*q) == tolower(*r)) && (*q != '\0') ; r++, q++)
;
if (*q == '\0')
return rev_start;
}
return NULL;
}
#endif /* !NANO_SMALL */
#ifndef HAVE_STRNLEN
/* This function is equivalent to strnlen(). */
size_t nstrnlen(const char *s, size_t maxlen)
{
size_t n = 0;
assert(s != NULL);
for (; maxlen > 0 && *s != '\0'; maxlen--, n++, s++)
;
return n;
}
#endif
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
#ifndef HAVE_GETLINE
/* This function is equivalent to getline(). It was adapted from
@@ -310,7 +214,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
const char *start)
{
/* start can be 1 character before the start or after the end of the
* line. In either case, we just say there is no match found. */
* 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);
@@ -322,7 +226,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
&& haystack + regmatches[0].rm_so <= start) {
const char *retval = haystack + regmatches[0].rm_so;
/* Search forward until there is no more match. */
/* 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)
@@ -336,7 +240,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
} else
#endif /* !NANO_SMALL */
if (regexec(&search_regexp, start, 10, regmatches,
start > haystack ? REG_NOTBOL : 0) == 0) {
(start > haystack) ? REG_NOTBOL : 0) == 0) {
const char *retval = start + regmatches[0].rm_so;
regexec(&search_regexp, retval, 10, regmatches, 0);
@@ -345,7 +249,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
return NULL;
}
#endif /* HAVE_REGEX_H */
#if !defined(DISABLE_SPELLER) || !defined(NANO_SMALL)
#if !defined(NANO_SMALL) || !defined(DISABLE_SPELLER)
if (ISSET(CASE_SENSITIVE)) {
#ifndef NANO_SMALL
if (ISSET(REVERSE_SEARCH))
@@ -357,9 +261,9 @@ const char *strstrwrapper(const char *haystack, const char *needle,
#endif /* !DISABLE_SPELLER || !NANO_SMALL */
#ifndef NANO_SMALL
else if (ISSET(REVERSE_SEARCH))
return revstristr(haystack, needle, start);
return mbrevstrcasestr(haystack, needle, start);
#endif
return strcasestr(start, needle);
return mbstrcasestr(start, needle);
}
/* This is a wrapper for the perror() function. The wrapper takes care
@@ -395,9 +299,10 @@ void *nrealloc(void *ptr, size_t howmuch)
return r;
}
/* Copy one malloc()ed string to another pointer. Should be used as:
* dest = mallocstrcpy(dest, src); */
char *mallocstrcpy(char *dest, const char *src)
/* Copy the first n characters of one malloc()ed string to another
* pointer. Should be used as: "dest = mallocstrncpy(dest, src,
* n);". */
char *mallocstrncpy(char *dest, const char *src, size_t n)
{
if (src == NULL)
src = "";
@@ -405,18 +310,33 @@ char *mallocstrcpy(char *dest, const char *src)
if (src != dest)
free(dest);
dest = charalloc(strlen(src) + 1);
strcpy(dest, src);
dest = charalloc(n);
strncpy(dest, src, n);
return dest;
}
/* Append a new magic-line to filebot. */
/* Copy one malloc()ed string to another pointer. Should be used as:
* "dest = mallocstrcpy(dest, src);". */
char *mallocstrcpy(char *dest, const char *src)
{
return mallocstrncpy(dest, src, src == NULL ? 1 : strlen(src) + 1);
}
/* Free the malloc()ed string at dest and return the malloc()ed string
* at src. Should be used as: "answer = mallocstrassn(answer,
* real_dir_from_tilde(answer));". */
char *mallocstrassn(char *dest, char *src)
{
free(dest);
return src;
}
/* Append a new magicline to filebot. */
void new_magicline(void)
{
filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
filebot->next->data = charalloc(1);
filebot->next->data[0] = '\0';
filebot->next->data = mallocstrcpy(NULL, "");
filebot->next->prev = filebot;
filebot->next->next = NULL;
filebot->next->lineno = filebot->lineno + 1;
@@ -426,125 +346,89 @@ void new_magicline(void)
}
#ifndef NANO_SMALL
/* Remove the magicline from filebot, if there is one and it isn't the
* only line in the file. */
void remove_magicline(void)
{
if (filebot->data[0] == '\0' && filebot->prev != NULL) {
filebot = filebot->prev;
free_filestruct(filebot->next);
filebot->next = NULL;
totlines--;
totsize--;
}
}
/* Set top_x and bot_x to the top and bottom x-coordinates of the mark,
* respectively, based on the locations of top and bot. */
* respectively, based on the locations of top and bot. If
* right_side_up isn't NULL, set it to TRUE If the mark begins with
* (mark_beginbuf, mark_beginx) and ends with (current, current_x), or
* FALSE otherwise. */
void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x)
**bot, size_t *bot_x, bool *right_side_up)
{
assert(top != NULL && top_x != NULL && bot != NULL && bot_x != NULL);
if ((current->lineno == mark_beginbuf->lineno && current_x > mark_beginx)
|| current->lineno > mark_beginbuf->lineno) {
if ((current->lineno == mark_beginbuf->lineno && current_x >
mark_beginx) || current->lineno > mark_beginbuf->lineno) {
*top = mark_beginbuf;
*top_x = mark_beginx;
*bot = current;
*bot_x = current_x;
if (right_side_up != NULL)
*right_side_up = TRUE;
} else {
*bot = mark_beginbuf;
*bot_x = mark_beginx;
*top = current;
*top_x = current_x;
if (right_side_up != NULL)
*right_side_up = FALSE;
}
}
#endif
#ifndef DISABLE_TABCOMP
/*
* Routine to see if a text string is matched by a wildcard pattern.
* Returns TRUE if the text is matched, or FALSE if it is not matched
* or if the pattern is invalid.
* * matches zero or more characters
* ? matches a single character
* [abc] matches 'a', 'b' or 'c'
* \c quotes character c
* Adapted from code written by Ingo Wilken, and
* then taken from sash, Copyright (c) 1999 by David I. Bell
* Permission is granted to use, distribute, or modify this source,
* provided that this copyright notice remains intact.
* Permission to distribute this code under the GPL has been granted.
*/
int check_wildcard_match(const char *text, const char *pattern)
/* 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
*lines, size_t *size)
{
const char *retrypat;
const char *retrytext;
int ch;
int found;
int len;
const filestruct *f;
retrypat = NULL;
retrytext = NULL;
if (lines != NULL)
*lines = 0;
if (size != NULL)
*size = 0;
while (*text != '\0' || *pattern != '\0') {
ch = *pattern++;
/* Go through the lines from begin to end->prev, if we can. */
for (f = begin; f != NULL && f != end; f = f->next) {
/* Count this line. */
if (lines != NULL)
(*lines)++;
switch (ch) {
case '*':
retrypat = pattern;
retrytext = text;
break;
/* Count the number of characters on this line. */
if (size != NULL) {
*size += mbstrlen(f->data);
case '[':
found = FALSE;
while ((ch = *pattern++) != ']') {
if (ch == '\\')
ch = *pattern++;
if (ch == '\0')
return FALSE;
if (*text == ch)
found = TRUE;
}
len = strlen(text);
if (!found && len != 0) {
return FALSE;
}
if (found) {
if (strlen(pattern) == 0 && len == 1) {
return TRUE;
}
if (len != 0) {
text++;
continue;
}
}
/* fall into next case */
case '?':
if (*text++ == '\0')
return FALSE;
break;
case '\\':
ch = *pattern++;
if (ch == '\0')
return FALSE;
/* fall into next case */
default:
if (*text == ch) {
if (*text != '\0')
text++;
break;
}
if (*text != '\0') {
pattern = retrypat;
text = ++retrytext;
break;
}
return FALSE;
/* Count the newline if we have one. */
if (f->next != NULL)
(*size)++;
}
if (pattern == NULL)
return FALSE;
}
return TRUE;
/* Go through the line at end, if we can. */
if (f != NULL) {
/* Count this line. */
if (lines != NULL)
(*lines)++;
/* Count the number of characters on this line. */
if (size != NULL) {
*size += mbstrlen(f->data);
/* Count the newline if we have one. */
if (f->next != NULL)
(*size)++;
}
}
}
#endif

File diff suppressed because it is too large Load Diff