Compare commits

..

278 Commits

Author SHA1 Message Date
David Lawrence Ramsey
fb7a6bde7b GNU nano 1.3.11, with the version number fixed
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3330 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-30 06:37:00 +00:00
David Lawrence Ramsey
1856ec4425 GNU nano 1.3.11
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3328 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-30 06:34:43 +00:00
David Lawrence Ramsey
3c43d3d688 replace VERMSG #define with PACKAGE_STRING #define (as defined by
autoconf)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3327 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-30 01:18:29 +00:00
David Lawrence Ramsey
1f479ee9fc more formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3326 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-29 19:58:49 +00:00
David Lawrence Ramsey
804e107474 yet more cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3325 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-29 19:43:32 +00:00
David Lawrence Ramsey
81bfd8244b typo fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3324 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-26 17:41:47 +00:00
David Lawrence Ramsey
12c08ddf6e more cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3323 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-25 15:56:40 +00:00
David Lawrence Ramsey
e006c5131d cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3322 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-25 15:23:55 +00:00
David Lawrence Ramsey
354597f0c2 in get_get_buffer(), die gracefully if input fails MAX_BUF_SIZE times,
not (MAX_BUF_SIZE + 1) times


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3321 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-24 16:04:44 +00:00
David Lawrence Ramsey
b8d9fb551b remove unneeded #include
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3320 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-24 15:55:34 +00:00
David Lawrence Ramsey
04716301e0 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3319 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-24 15:32:52 +00:00
David Lawrence Ramsey
9efbdea09c fix breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3318 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-24 05:36:16 +00:00
David Lawrence Ramsey
017dde2c81 formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3317 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-24 05:28:03 +00:00
David Lawrence Ramsey
572207da79 formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3316 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-24 04:22:45 +00:00
David Lawrence Ramsey
231158d61a in do_browser(), make old_selected a size_t too, to match selected
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3315 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-23 23:17:27 +00:00
David Lawrence Ramsey
20323a82be comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3314 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-23 22:14:40 +00:00
David Lawrence Ramsey
e6958d517d cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3313 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-23 21:25:04 +00:00
David Lawrence Ramsey
27ad0cdb37 in do_browser(), make fileline and the static selected size_t's, since
the latter can hold the value of the former, and the former can be that
large


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3312 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-23 20:36:29 +00:00
David Lawrence Ramsey
9b33d51774 in get_key_buffer(), simplify the check for a lost input source, since
the errno check is unreliable


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3311 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-20 04:46:48 +00:00
David Lawrence Ramsey
ec8a055ffd cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3310 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-19 19:26:52 +00:00
David Lawrence Ramsey
9149325400 in get_key_buffer(), if we fail to get a character over MAX_BUF_SIZE
times in a row, hang up regardless of the value of errno; this fixes a
problem where nano doesn't terminate properly under xterm if the user
su's to root, runs nano, and then closes the terminal window


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3309 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-19 19:25:29 +00:00
David Lawrence Ramsey
1ec74ee30c remove unneeded blank line
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3308 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-19 19:14:30 +00:00
David Lawrence Ramsey
7a27f68c5c preemptively update the version number
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3307 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-16 19:31:18 +00:00
David Lawrence Ramsey
5115fa6767 in faq.html, change the character set to UTF-8, and remove broken links
to contributed RedHat nano packages


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3306 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-16 19:30:52 +00:00
David Lawrence Ramsey
167a4b7f9c in faq.html, update the Free Translation Project's address
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3305 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-16 19:16:28 +00:00
David Lawrence Ramsey
7369c75828 remove erroneous assert
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3304 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-16 17:45:12 +00:00
Jordi Mallach
6ac73c9408 Update Swedish credits.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3303 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-15 22:44:43 +00:00
Jordi Mallach
20494f514c Update Swedish from the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3302 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-15 22:40:01 +00:00
David Lawrence Ramsey
ee150506d8 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3301 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-12 19:47:48 +00:00
David Lawrence Ramsey
05454cfb75 preemptively update the version numbers of all manpages, and remove
unneeded comments from rnano.1


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3300 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-12 19:34:22 +00:00
David Lawrence Ramsey
3e7821006d mention that quotes inside string parameters don't need to be escaped
with backslashes in nanorc.5 and nanorc.sample


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3299 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-12 19:27:32 +00:00
Jordi Mallach
535dc9cd13 Updated Vietnamese translation by Phan Vinh Thinh.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3298 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-03-06 17:59:32 +00:00
David Lawrence Ramsey
ac0361df6e in do_writeout(), remove unneeded setting of currshortcut
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3297 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-24 19:38:20 +00:00
David Lawrence Ramsey
6816007242 make sure browser_refresh() is used when refreshing or doing tab
completion at the prompt in the file browser


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3296 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-18 21:32:29 +00:00
David Lawrence Ramsey
1f907c7413 rename browser_draw() to browser_refresh() for consistency
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3295 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-10 19:02:30 +00:00
David Lawrence Ramsey
d83af2fea7 fix file browser breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3294 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-10 03:27:48 +00:00
David Lawrence Ramsey
d4bae13d8d move the browser drawing routines to a separate function, browser_draw()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3293 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-09 23:26:26 +00:00
David Lawrence Ramsey
a8a9050083 really fix input parsing in the file browser
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3292 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-09 22:53:54 +00:00
David Lawrence Ramsey
8326254643 go back to using a while loop in get_prompt_string(), as it's simpler
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3291 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-09 22:42:14 +00:00
David Lawrence Ramsey
162ed2af24 in get_prompt_string(), initialize finished to FALSE so that the
do/while loop works properly


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3290 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-09 22:35:04 +00:00
David Lawrence Ramsey
3326603341 in get_prompt_string(), redraw the prompt and set finished to FALSE when
NANO_HELP_KEY is pressed, so that we don't leave the prompt, enter the
help browser, and restart the prompt after leaving it; this will
properly preserve the cursor position after doing the last of these


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3289 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-09 21:43:14 +00:00
David Lawrence Ramsey
08f4974093 in shortcut_init(), remove erroneous handling of the "Get Help" shortcut
in the file browser shortcut list


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3288 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-08 20:33:45 +00:00
David Lawrence Ramsey
591c409f3f in get_prompt_string(), use a do/while loop instead of a while loop, for
consistency


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3287 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-08 20:14:49 +00:00
David Lawrence Ramsey
c0dcdf43c6 in do_browser(), properly restore the file list display after returning
from the help browser at the "Go To Directory" prompt, and rename
variable j to i, for consistency


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3286 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-08 19:27:02 +00:00
David Lawrence Ramsey
47d917eea7 remove redundant code
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3285 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-08 05:16:32 +00:00
David Lawrence Ramsey
8a1a886fbe add another missing blank line
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3284 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-08 05:01:58 +00:00
David Lawrence Ramsey
5443b46241 add missing blank lines
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3283 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-08 04:02:30 +00:00
David Lawrence Ramsey
9b268c2ebf fix compilation problem
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3282 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-07 21:16:46 +00:00
David Lawrence Ramsey
33f2a08b5c update copyright years
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3281 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-07 21:11:49 +00:00
David Lawrence Ramsey
9d8c284135 allow tab completion of directories at the "Go To Directory" prompt
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3280 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-07 21:11:05 +00:00
David Lawrence Ramsey
ef9dc83a4b fix file browser breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3279 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-07 20:10:28 +00:00
David Lawrence Ramsey
3d8d29d08a another formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3278 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-07 18:35:26 +00:00
David Lawrence Ramsey
fc8e5cb0f2 cosmetic and formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3277 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-07 18:32:22 +00:00
David Lawrence Ramsey
24e0a465c1 in do_browser(), properly set currshortcut back to the file browser
shortcut list after a "Go To Directory" prompt


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3276 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-07 05:14:55 +00:00
David Lawrence Ramsey
91a2a69c4f rework input parsing in the file browser to be more flexible
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3275 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-07 04:41:44 +00:00
David Lawrence Ramsey
9ffe78aa57 update copyright years
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3274 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-03 18:59:17 +00:00
David Lawrence Ramsey
99e3733fc6 fix changelog entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3273 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-03 04:02:25 +00:00
David Lawrence Ramsey
114cfb63f4 in display_string(), fix memory corruption problems caused by not
allocating enough space for converted when a line ends in a tab(s) and
we're not in UTF-8 mode


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3272 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-03 03:58:49 +00:00
David Lawrence Ramsey
1f104f8079 fix a comment in nano.h and a minor memory leak in display_string()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3271 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-03 03:51:51 +00:00
David Lawrence Ramsey
66d3ebf6a6 fix potential infinite loop in mbrevstrpbrk()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3270 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-02-02 22:30:40 +00:00
David Lawrence Ramsey
3a5e6f9317 handle Shift-Delete properly when the -d option is used
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3266 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-30 21:23:51 +00:00
David Lawrence Ramsey
475c402b65 in parse_kbinput(), interpret Shift-Begin, Shift-Delete, Shift-End,
Shift-Home, Shift-Insert, and Shift-Suspend as Begin, Delete, End, Home,
Insert, and Suspend, respectively, regardless of whether --rebindkeypad
is used


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3265 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-30 01:32:41 +00:00
David Lawrence Ramsey
4a2e0000f7 fix more bracket matching breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3264 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-28 06:04:59 +00:00
David Lawrence Ramsey
a6eb8480ea really fix the previous display problem with searches that move the
cursor offscreen and from a page other than the first one onto a
different page by reverting the erroneous change to edit_scroll() and
adding the proper fix to edit_redraw()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3263 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-10 07:51:49 +00:00
David Lawrence Ramsey
76f9485b02 in ngetdelim(), do sanity checks manually again instead of in an assert,
and set errno to EINVAL as well as return -1 if they fail; this matches
the manual page


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3262 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-09 03:23:29 +00:00
David Lawrence Ramsey
db2dc81cee fix multibyte bracket search breakage, and add documentation fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3261 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-06 22:35:52 +00:00
David Lawrence Ramsey
1a16df9284 fix "matchbrackets" breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3260 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-06 22:04:38 +00:00
David Lawrence Ramsey
d89617fb17 allow specifying matching bracket characters other than the default via
the "matchbrackets" rcfile option


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3259 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-06 21:51:10 +00:00
David Lawrence Ramsey
a248863b43 rework the bracket searching code to handle multibyte bracket characters
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3258 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-06 07:10:30 +00:00
David Lawrence Ramsey
5978f9b11d in mbstrchr(), make parameter c const
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3257 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-06 05:54:44 +00:00
David Lawrence Ramsey
5329f23345 sort the default strings for brackets and punct, and the "or" atom in
the default regex string for quotestr, in order according to ASCII, and
add minor related documentation updates


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3256 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-03 04:53:41 +00:00
David Lawrence Ramsey
cb475886b1 clarify another comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3255 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-02 17:09:35 +00:00
David Lawrence Ramsey
47cfd197b8 in edit_scroll(), redraw the lines before and after the scrolled region
even if the scrolled region was only one line; this fixes a display
problem that occurs after doing a search that scrolls the screen down
one line and leaves the cursor on the last line of the screen, in which
case we need to update the line after the scrolled region


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3254 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2006-01-02 04:30:33 +00:00
David Lawrence Ramsey
5b7b3e3c9c cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3253 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-31 21:22:54 +00:00
David Lawrence Ramsey
30bdadd4d5 revert previous erroneous change, and clarify comments
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3252 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-31 21:08:10 +00:00
David Lawrence Ramsey
89b6e6b9dd in justify_format(), remove redundant character parsing
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3251 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-31 20:37:56 +00:00
David Lawrence Ramsey
ce029f2b11 remove unnecessary #ifdef around termios.h #include in nano.c
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3250 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-28 05:01:00 +00:00
David Lawrence Ramsey
1e73bcfe29 fix inaccurate comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3249 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-23 20:18:06 +00:00
David Lawrence Ramsey
da959919fc Back to CVS
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3248 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-23 16:15:34 +00:00
David Lawrence Ramsey
2cd986cdef GNU nano 1.3.10
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3246 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-23 16:08:19 +00:00
David Lawrence Ramsey
5e4d81c99e in README.CVS, mention that the minimum required version of groff is
1.12, since that's the first version that supports generating HTML


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3245 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-23 16:07:00 +00:00
David Lawrence Ramsey
628c4e2928 French manpage updates.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3244 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-23 15:46:26 +00:00
David Lawrence Ramsey
e57bd4993e in parse_line_column(), simplify parsing of the column number
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3243 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-23 03:15:12 +00:00
Jordi Mallach
bf38aad0be Bulgarian translation from the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3242 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-21 20:08:59 +00:00
Jordi Mallach
7859d5254c Translation updates from the TP: ca, fr, ms, zh_TW.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3241 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-21 20:05:30 +00:00
David Lawrence Ramsey
5aaaad4a63 in README.CVS, update the given cvs commands so that they work again
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3240 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-15 04:46:13 +00:00
Jordi Mallach
abaa9a81f7 Updated it, nl and de from the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3239 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-12 23:08:14 +00:00
David Lawrence Ramsey
b0e04c0de3 a few last comment and consistency fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3238 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-08 07:24:54 +00:00
David Lawrence Ramsey
6d6a36c647 add descriptive comments to pretty much all functions and major
variables that don't have them, plus a few miscellaneous minor fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3237 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-08 07:09:08 +00:00
David Lawrence Ramsey
034b994eb5 since proto.h includes nano.h, and nano.h includes config.h first,
include proto.h first and remove redundant includes of config.h in all
non-header source files


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3236 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-08 02:47:10 +00:00
David Lawrence Ramsey
8befda6490 readd RETSIGTYPE return types for signal handlers, since any problems
with its being defined as the wrong type aren't nano's fault


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3235 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-06 19:39:56 +00:00
David Lawrence Ramsey
24777c0740 fix compilation with --enable-debug, and remove unneeded assert
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3234 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-12-01 05:49:08 +00:00
David Lawrence Ramsey
a685468a18 efficiency and comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3233 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-30 21:19:42 +00:00
David Lawrence Ramsey
26ebd35d54 in ngetdelim(), do sanity checks in an assert instead of checking them
manually and returning -1 if they fail


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3232 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-30 19:33:56 +00:00
David Lawrence Ramsey
13b6115894 update the Free Software Foundation's address as needed in the copyright
notices taken from other sources


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3231 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-30 18:57:05 +00:00
David Lawrence Ramsey
783062a0cc cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3230 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-30 16:41:54 +00:00
David Lawrence Ramsey
c7c04bb665 in brak_line(), in the surrounding #ifdef, replace the combination of
!DISABLE_JUSTIFY and !DISABLE_WRAPPING with !DISABLE_WRAPJUSTIFY, for
consistency


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3229 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 21:30:00 +00:00
David Lawrence Ramsey
3239ff22c8 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3228 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 20:01:06 +00:00
David Lawrence Ramsey
e6fb106cf0 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3227 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 19:01:04 +00:00
David Lawrence Ramsey
ad1b64cdfa in do_justify(), renumber after justifying each individual paragraph,
since find_paragraph() needs the line numbers to be right as well as
edit_refresh(); this fixes a potential segfault when doing full justify
with auto-indent turned on


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3226 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 19:00:09 +00:00
David Lawrence Ramsey
79383beef3 revert last changes, as they make full justify and justify act
differently


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3225 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 18:34:45 +00:00
David Lawrence Ramsey
9a065c089f in find_paragraph(), add parameter begin, the line that we can't move
further back than when searching for a paragraph; this is needed to
ensure that we don't justify the same lines more than once if
auto-indent is turned on, and the indentation of what should be the
previous paragraph matches that of what should be the current paragraph


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3224 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 18:25:53 +00:00
David Lawrence Ramsey
1932dfb131 another comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3223 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 05:52:49 +00:00
David Lawrence Ramsey
eae8571ae4 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3222 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 05:48:06 +00:00
David Lawrence Ramsey
2e2112cad1 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3221 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 05:39:31 +00:00
David Lawrence Ramsey
5da68ee193 in execute_command(), instead of hardcoding /bin/sh as the shell to use
when executing a command, use $SHELL, and only fall back to /bin/sh if
$SHELL isn't set


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3220 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 05:21:06 +00:00
David Lawrence Ramsey
da1f55cec7 add missing update
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3219 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 04:27:07 +00:00
David Lawrence Ramsey
43eee6ed44 sort more configure options consistently
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3218 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 04:25:57 +00:00
David Lawrence Ramsey
ace033d834 in configure.ac, disable wrapping entirely when --enable-tiny is used,
as it matches the FAQ, it makes nano even smaller, and it eliminates the
need for --disable-wrapping-as-root in that case (in which it's
impossible to turn wrapping back on without nanorc support)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3217 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 04:17:53 +00:00
David Lawrence Ramsey
5453b0accf in version(), if DISABLE_WRAPPING is defined, the code in
DISABLE_ROOTWRAP #ifdefs isn't included, so don't display
"--disable-wrapping-as-root" in that case


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3216 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-29 04:16:43 +00:00
David Lawrence Ramsey
315eb3280a adjust copyright notices in all source files to account for Chris'
reassigning the 2005-2006 copyright on nano to me


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3215 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-28 19:35:29 +00:00
David Lawrence Ramsey
b4e5c02474 more miscellaneous do_wrap() fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3214 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-25 13:48:09 +00:00
David Lawrence Ramsey
4db1b099dd properly update the revision date
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3213 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-23 05:47:06 +00:00
David Lawrence Ramsey
b919f37c85 merge one last update
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3212 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-23 05:46:10 +00:00
David Lawrence Ramsey
219a814de2 remove redundant code
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3211 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-22 22:08:01 +00:00
David Lawrence Ramsey
615f4c71c0 tweak do_wrap() to remove the assumption that the file always ends in a
magicline


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3210 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-22 21:48:24 +00:00
David Lawrence Ramsey
b9b2fd52ff in break_line(), only include the newline parameter if DISABLE_HELP
isn't defined, as it's only used then


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3209 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-22 21:13:36 +00:00
David Lawrence Ramsey
708de360dc in configure.ac, clarify description of --disable-speller
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3208 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-22 20:24:22 +00:00
David Lawrence Ramsey
853a44d3f0 preemptively update the version number
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3207 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-21 21:45:07 +00:00
David Lawrence Ramsey
d1ab408965 in faq.html, clarify section 5.3 to better explain how to enable Unicode
support, and remove the mention of quirks, since they turned out to not
be a nano problem


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3206 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-21 20:08:42 +00:00
David Lawrence Ramsey
fa35aef359 merge a few minor updates from nano.1 into rnano.1
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3205 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-21 16:16:38 +00:00
Jordi Mallach
7949e6ae09 Add rnano manpage from Thijs.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3204 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-21 09:36:11 +00:00
David Lawrence Ramsey
4ffdb1bbec in nano.1, make one non-bold instance of "nano" bold, for consistency
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3203 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-21 03:36:29 +00:00
David Lawrence Ramsey
7a07cdb51e in faq.html, add a new section 5.3 to explain the status of nano's
Unicode support


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3202 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-19 06:14:31 +00:00
David Lawrence Ramsey
ccd1b7b50a miscellaneous minor fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3201 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-18 20:21:48 +00:00
David Lawrence Ramsey
d15c92d41a more comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3200 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-17 18:58:56 +00:00
David Lawrence Ramsey
8dec783333 comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3199 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-17 04:13:01 +00:00
David Lawrence Ramsey
87397ba37b add missing documentation
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3198 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-17 03:53:58 +00:00
David Lawrence Ramsey
391cef12c9 documentation fix: the LGPLed ngetdelim() and ngetline() functions are
converted to the GPL not only to avoid including a copy of the LGPL, but
also because the changes made to integrate these functions with nano
make them dependent on nano's GPLed functions and hence useless
elsewhere


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3197 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-17 03:52:00 +00:00
David Lawrence Ramsey
ad074011c9 in get_prompt_string(), adjust #ifdefs to leave out disabled keys
entirely instead of keeping enough code to just ignore them


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3196 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 21:34:46 +00:00
David Lawrence Ramsey
c009ec56f5 breakage and comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3195 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 13:57:21 +00:00
David Lawrence Ramsey
5ab56eaa8d refactor the statusbar prompt's bracket searching code to be closer to
the edit window's bracket searching code


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3194 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 13:45:41 +00:00
David Lawrence Ramsey
45d344b72c comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3193 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 08:14:16 +00:00
David Lawrence Ramsey
29fb951fcd miscellaneous documentation fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3192 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 07:35:01 +00:00
David Lawrence Ramsey
4580f1502c add missing changelog entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3191 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 06:42:11 +00:00
David Lawrence Ramsey
cf9c34acef only include code related to whole word searches when DISABLE_SPELLER
isn't defined, as only the internal spell checker uses it


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3190 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 05:59:06 +00:00
David Lawrence Ramsey
bd0b3cd39b in do_justify(), don't save current_y and restore it if the user
unjustifies, as the reset_cursor() called by edit_refresh() after
restoring edittop and current will ensure that current_y is restored to
its original value


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3189 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 04:41:31 +00:00
David Lawrence Ramsey
eba0711939 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3188 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 04:26:33 +00:00
David Lawrence Ramsey
c499382fec add the ability to do bracket searches at the statusbar prompt
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3187 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 04:14:03 +00:00
David Lawrence Ramsey
ebe4b3b52e remove unneeded variable
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3186 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 03:54:22 +00:00
David Lawrence Ramsey
cfffbf71ce in reset_statusbar_cursor(), fix cursor placement problem by modeling
the code more closely after reset_cursor()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3185 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 03:14:11 +00:00
David Lawrence Ramsey
9d3a468ad8 in do_statusbar_input(), fix misplaced break when handling
NANO_VERBATIM_KEY


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3184 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-16 02:45:10 +00:00
David Lawrence Ramsey
c5c5230b9d overhaul the bracket searching code so that it no longer requires regex
support to work, and add some miscellaneous search code cleanups


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3183 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-15 23:45:29 +00:00
David Lawrence Ramsey
6c860c07c8 remove unneeded blank line
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3182 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-15 21:58:06 +00:00
David Lawrence Ramsey
1c3b211142 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3181 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-15 21:29:05 +00:00
David Lawrence Ramsey
b299a6a0d9 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3180 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-15 20:32:18 +00:00
David Lawrence Ramsey
bc8b7d74eb in mbstrchr(), detect the case where the character isn't found in the
string more accurately


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3179 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-15 19:01:07 +00:00
David Lawrence Ramsey
9c92634388 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3178 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-15 18:42:56 +00:00
David Lawrence Ramsey
979286c65e comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3177 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-15 06:47:22 +00:00
David Lawrence Ramsey
ebe3425f9f rename the NANO_SMALL #define to NANO_TINY
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3176 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-15 03:17:35 +00:00
David Lawrence Ramsey
023db6aa77 per Mike Frysinger's patch, don't install the localized versions of the
manpages if nano is built with --disable-nls


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3175 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-15 02:39:20 +00:00
David Lawrence Ramsey
41dd9122fe formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3174 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-15 02:09:03 +00:00
David Lawrence Ramsey
a1064d4279 for functions originally adapted from other sources, invoke LGPL clause
3 to convert all LGPLed functions to GPLed ones, so that we don't have
to include a copy of the LGPL


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3173 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-14 23:02:03 +00:00
David Lawrence Ramsey
3f7c8c5158 fix copyright years on source files; all functions in browser.c were
originally added in 2001; the oldest function in color.c is
do_colorinit() (now color_init()), which was originally added in 2001;
the oldest function in chars.c is revstrstr(), which was originally
added in 2001; the oldest function in help.c is do_help(), which was
originally added in 2000; the oldest function in prompt.c is statusq()
(now do_prompt()), which was originally added before 0.6.6, which was
apparently in 1999; all functions in rcfile.c were originally added in
2001; one of the oldest functions in search.c is do_search(), which was
originally added in 0.2.7, which was apparently in 1999; and one of the
oldest functions in text.c is do_wrap(), which was originally added in
0.3.1, which was apparently in 1999; also, for functions originally
adapted from other sources, add notices from the original files, as we
do with the tab completion functions adapted from busybox


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3172 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-14 22:20:35 +00:00
David Lawrence Ramsey
bbac1bb047 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3171 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-14 21:32:42 +00:00
David Lawrence Ramsey
aa20fcf7b0 remove unneeded blank line
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3170 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-13 07:05:37 +00:00
David Lawrence Ramsey
eb5e08fb98 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3169 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-12 20:04:18 +00:00
David Lawrence Ramsey
6533e235e8 when building, automatically generate an HTML version of the info page,
nano.html


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3168 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-12 07:50:03 +00:00
David Lawrence Ramsey
de39a2b05b in nano.texi, fix inconsistent punctuation
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3167 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-12 07:23:39 +00:00
David Lawrence Ramsey
fb0c3f85de in get_page_start(), fix test so that we scroll through the line in
8-character chunks when COLS is greater than 8, not when COLS is greater
than 9


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3166 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-12 05:20:14 +00:00
David Lawrence Ramsey
a24da6944c changelog fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3165 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-11 17:05:27 +00:00
David Lawrence Ramsey
b3c846cd98 in nano.texi, add more wording fixes, sort the configure options more
consistently, and add missing --disable-utf8 option


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3164 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-11 17:04:17 +00:00
David Lawrence Ramsey
1520350e20 in nano.texi, per Mike Frysinger's patch, add missing configure options,
so that all of them are documented


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3163 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-11 16:42:45 +00:00
David Lawrence Ramsey
da0691b4ad comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3162 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-11 05:21:38 +00:00
David Lawrence Ramsey
d82dae0925 fix the last of the breakage (I hope) in find_paragraph() and
do_justify()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3161 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-11 05:13:28 +00:00
David Lawrence Ramsey
bdff665b5d fix still more find_paragraph() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3160 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-11 04:14:33 +00:00
David Lawrence Ramsey
1be131a9f9 fix more find_paragraph() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3159 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-11 03:55:52 +00:00
David Lawrence Ramsey
8b203d6f22 fix yet more do_justify() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3158 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-11 03:17:44 +00:00
David Lawrence Ramsey
53f641f909 fix still more do_justify() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3157 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 21:57:56 +00:00
David Lawrence Ramsey
57f1bbd991 fix more do_justify() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3156 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 21:53:46 +00:00
David Lawrence Ramsey
cd8f73521e fix breakage in both backup_lines() and do_justify(); the latter's
return value is unneeded, as current will point to the same line when
it's done, and making first_par_line point to current in the former
ensures that the two will properly stay in sync


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3155 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 21:20:32 +00:00
David Lawrence Ramsey
52161ee3a1 more cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3154 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 19:56:26 +00:00
David Lawrence Ramsey
874ec8f259 fix more do_justify() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3153 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 19:28:27 +00:00
David Lawrence Ramsey
985d586c3a revert change to do_justify(), since it's used when fileage may be
temporarily out of range


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3152 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 16:46:50 +00:00
David Lawrence Ramsey
ae9eea7634 use more intuitive descriptions for the scrolling keys
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3151 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 07:40:55 +00:00
David Lawrence Ramsey
e74851451d more comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3150 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 07:11:51 +00:00
David Lawrence Ramsey
ad7cf31cbf comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3149 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 06:25:01 +00:00
David Lawrence Ramsey
75689f3901 fix still more find_paragraph() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3148 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 06:19:47 +00:00
David Lawrence Ramsey
82b5debb1b more do_justify() fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3147 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 06:07:57 +00:00
David Lawrence Ramsey
b2d1c5f5b2 fix yet more do_justify() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3146 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 06:01:41 +00:00
David Lawrence Ramsey
036a9d5341 comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3145 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 05:26:37 +00:00
David Lawrence Ramsey
b885c9c5e9 revert change to edit_update(), since it's used when fileage may be
temporarily out of range, and fix a comment


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3144 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 05:20:25 +00:00
David Lawrence Ramsey
e99223dd25 tweak do_wrap(), remove_magicline(), edit_scroll(), and edit_update() to
rely on fileage and filebot instead of NULL for their checks to detect
the top or bottom of the file


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3143 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 04:27:30 +00:00
David Lawrence Ramsey
6195f7c34c comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3142 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 04:14:51 +00:00
David Lawrence Ramsey
653a5a3a45 tweak do_justify() to rely on fileage instead of NULL for its check to
detect the top of the file


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3141 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 04:03:05 +00:00
David Lawrence Ramsey
e8d505ba02 fix still *more* backup_lines() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3140 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 03:40:45 +00:00
David Lawrence Ramsey
5d6f127948 fix still more backup_lines() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3139 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-10 03:32:59 +00:00
David Lawrence Ramsey
f0575cfa10 fix still more backup_lines() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3138 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 23:27:51 +00:00
David Lawrence Ramsey
af5a9997fd more do_justify() breakage fixes, and miscellaneous comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3137 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 23:06:44 +00:00
David Lawrence Ramsey
c82bc8ba84 fix more backup_lines() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3136 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 22:59:51 +00:00
David Lawrence Ramsey
1836a0fb7a fix break_lines() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3135 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 22:42:37 +00:00
David Lawrence Ramsey
12090dd320 fix more find_paragraph() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3134 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 21:53:21 +00:00
David Lawrence Ramsey
2101403824 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3133 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 20:33:42 +00:00
David Lawrence Ramsey
5455b6af46 fix more do_justify() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3132 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 20:17:12 +00:00
David Lawrence Ramsey
9bedc4b71c fix breakage in find_paragraph() and do_justify()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3131 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 19:51:48 +00:00
David Lawrence Ramsey
47b693e582 add comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3130 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 19:22:29 +00:00
David Lawrence Ramsey
2c5d0ecbb3 tweak find_paragraph() and do_justify() to remove the assumption that
the file always ends in a magicline; note that the latter isn't
completely fixed yet


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3129 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 19:06:01 +00:00
David Lawrence Ramsey
5c33e88b25 finish tweaking backup_lines() to remove the assumption that the file
always ends in a magicline, and add documentation fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3128 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 18:58:04 +00:00
David Lawrence Ramsey
8bd960bbc9 minor backup_lines() cleanups
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3127 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 18:49:16 +00:00
David Lawrence Ramsey
0083bd29d2 tweak begpar() to rely on fileage instead of NULL for its check to
detect the top of the file, and make it return NULL if foo is NULL, just
as inpar() does


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3126 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 18:26:44 +00:00
David Lawrence Ramsey
ce51bb2509 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3125 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 17:01:33 +00:00
David Lawrence Ramsey
c1a28fa9ae in get_next_filename(), store the value of digits(ULONG_MAX) in a
static, since it doesn't change and hence doesn't need to be
recalculated


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3124 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 15:13:00 +00:00
David Lawrence Ramsey
31d7b3667c tweak do_para_end() to remove the assumption that the file always ends
in a magicline


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3123 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 04:20:55 +00:00
David Lawrence Ramsey
32bd29e3cc cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3122 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 03:44:23 +00:00
David Lawrence Ramsey
970a809357 remove unneeded code
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3121 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 03:37:50 +00:00
David Lawrence Ramsey
53bd1ddad7 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3120 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 02:23:54 +00:00
David Lawrence Ramsey
212ab782df simplify cut_line() further
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3119 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 02:13:07 +00:00
David Lawrence Ramsey
1903713225 add prompt.c to the list of translated files, since it now has
translatable strings


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3118 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 00:34:52 +00:00
David Lawrence Ramsey
a016d1939d comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3117 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 00:25:30 +00:00
David Lawrence Ramsey
b387137af7 in cut_line(), since placewewant will always be zero after the line is
cut, set it to zero directly instead of assigning it the value of
xplustabs()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3116 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 00:23:12 +00:00
David Lawrence Ramsey
0f6236f556 *really* make deleting and cutting text consistent with each other, and
fix comments


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3115 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-09 00:08:29 +00:00
David Lawrence Ramsey
c9820ac098 more fixes for files that don't end in magiclines: make cut_line() cut
the text of the current line (if any), minus the nonexistent newline,
when we're on the last line of the file, and make sure again that the
file isn't marked as modified if the magicline is deleted and we're
supposed to have one, as it's more consistent that way (a marked cut of
the magicline adds a newline to the cutbuffer, while deleting the
magicline adds nothing)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3114 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 23:59:29 +00:00
David Lawrence Ramsey
0ed7171138 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3113 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 23:09:47 +00:00
David Lawrence Ramsey
4ed8134699 revert last change, as the new bahavior is consistent with the behavior
when you cut the magicline with the mark


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3112 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 23:08:08 +00:00
David Lawrence Ramsey
d84cfb03df tweak do_delete() to not mark the file as modified if we delete the
newline before filebot and a magicline is added as a result, as it did
before the NO_NEWLINES flag was added


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3111 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 22:59:10 +00:00
David Lawrence Ramsey
126cc1c8dd add missing changelog entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3110 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 19:40:59 +00:00
David Lawrence Ramsey
9c984e8e63 in do_alt_speller(), move the code that replaces the text of the current
file with the text of the spell-checked file into its own function,
replace_buffer()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3109 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 19:15:58 +00:00
David Lawrence Ramsey
1e0e235cbb make do_int_spell_fix() and do_alt_speller() take the NO_NEWLINES flag
into account


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3108 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 18:34:12 +00:00
David Lawrence Ramsey
8779a17ffe initialize the static pid_t pid in text.c, just in case
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3107 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 16:45:22 +00:00
David Lawrence Ramsey
f400c23279 tweak do_alt_speller() to remove the assumption that the file always
ends in a magicline


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3106 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 16:37:29 +00:00
David Lawrence Ramsey
eb02e3df4c remove unneeded blank line
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3105 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 04:55:59 +00:00
David Lawrence Ramsey
c0181c95ee cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3104 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 02:27:11 +00:00
David Lawrence Ramsey
f1a717291b correction: in mbwidth(), use the width of Unicode U+FFFD (Replacement
Character) instead of hardcoding a width of one for unprintable
characters


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3103 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 02:24:17 +00:00
David Lawrence Ramsey
4a8c9b6124 in mbwidth(), if wcwidth() returns -1 for the character passed in, treat
the character as being one column wide instead of zero columns wide,
since there are display problems that crop up with the latter approach


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3102 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 02:20:22 +00:00
David Lawrence Ramsey
069674c2d5 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3101 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 02:07:13 +00:00
David Lawrence Ramsey
ea9d03f135 make sure we refresh the statusbar prompt text when tab-completing or
moving through history


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3100 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-08 01:49:14 +00:00
David Lawrence Ramsey
e19449ec50 actually use statusbar_pww in the statusbar prompt code to cut down on
redundant updates, add related functions to do that, and rename a few of
the statusbar prompt functions for consistency


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3099 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-07 21:45:44 +00:00
David Lawrence Ramsey
af3314c376 add the statusbar prompt's equivalent of placewewant,statusbar_pww, to
prompt.c, and convert (most of) its functions to use it


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3098 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-07 06:32:07 +00:00
David Lawrence Ramsey
b3c6b40550 in update_line(), remove now-unneeded logic that set the index parameter
to zero if the fileptr parameter didn't point to current


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3097 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-07 06:20:02 +00:00
David Lawrence Ramsey
37ddfa9dbd move do_verbatim_input() from nano.c to text.c, since it's an advanced
text-based operation


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3096 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-07 06:06:05 +00:00
David Lawrence Ramsey
64844b6959 reorder functions
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3095 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-05 20:04:16 +00:00
David Lawrence Ramsey
43fff01ede move functions specific to the file browser to their own source file,
browser.c


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3094 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-05 20:01:11 +00:00
David Lawrence Ramsey
46f5665da2 tweak do_last_line() to remove the assumption that the file always ends
in a magicline


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3093 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-05 17:50:06 +00:00
David Lawrence Ramsey
c0e54d16cb fix changelog entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3092 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-05 17:37:39 +00:00
David Lawrence Ramsey
a0168ca896 add new -L/--nonewlines command line option, and new "nonewlines" rcfile
option, to control whether nano adds magiclines to the ends of files


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3091 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-05 17:35:44 +00:00
David Lawrence Ramsey
c3b3b9a28f tweak open_buffer() and read_file() to remove the assumption that the
file always ends in a magicline


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3090 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-05 17:20:39 +00:00
David Lawrence Ramsey
6619c43b88 formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3089 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-05 06:08:44 +00:00
David Lawrence Ramsey
4eeff48c5f cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3088 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-05 04:59:00 +00:00
David Lawrence Ramsey
b7dc8f3a12 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3087 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-04 16:34:51 +00:00
David Lawrence Ramsey
72ad7dc602 fix inconsistent wording in nano.texi
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3086 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-04 06:43:02 +00:00
David Lawrence Ramsey
6a0ea821e9 fix breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3085 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-04 06:21:39 +00:00
David Lawrence Ramsey
a50e36c6b2 simplify
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3084 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-04 05:59:41 +00:00
David Lawrence Ramsey
306049666a tweak write_file() to remove the assumption that the file always ends in
a magicline, and remove a bit of apparently unneeded logic from
read_file()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3083 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-04 05:44:01 +00:00
David Lawrence Ramsey
cf0efaab5d remove unneeded assert in do_rcfile()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3082 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-04 04:10:09 +00:00
David Lawrence Ramsey
29bf57ff67 revert erroneous change
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3081 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-03 21:38:51 +00:00
David Lawrence Ramsey
2ffdea4fc1 tweak a few functions to remove the assumption that the file always ends
in a magicline, and to rely on fileage and filebot instead of NULL for
their checks to detect the top or bottom of the file


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3080 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-03 21:08:39 +00:00
David Lawrence Ramsey
38ebba11b7 move do_yesno() to prompt.c too
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3079 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-03 21:07:24 +00:00
David Lawrence Ramsey
626bcd7cc2 remove unneeded sys/wait.h #include from files.c
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3078 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-03 02:45:54 +00:00
David Lawrence Ramsey
ee11c6a62f add missing stdio.h #include to text.c too
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3077 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-02 19:42:02 +00:00
David Lawrence Ramsey
00cc565ddd move check_linenumbers(), dump_buffer(), and dump_buffer_reverse() from
winio.c to utils.c too


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3076 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-02 15:44:01 +00:00
David Lawrence Ramsey
305c6459e9 in do_yesno(), make mouse clicks on the Yes/No/All shortcuts work properly when the MORE_SPACE flag is set
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3075 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-02 15:32:30 +00:00
David Lawrence Ramsey
d420b5a50c more function reordering, plus comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3074 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-01 23:00:56 +00:00
David Lawrence Ramsey
c359301955 reorder functions
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3073 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-01 20:11:55 +00:00
David Lawrence Ramsey
7e2d673b5f move functions specific to the help browser to their own source file,
help.c, and adjust related variables accordingly


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3072 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-01 19:32:45 +00:00
David Lawrence Ramsey
c85e4f43b5 formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3071 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-01 19:29:56 +00:00
David Lawrence Ramsey
56a8aad848 properly handle the case where the user resized the window while at the
statusbar prompt, in which case prompt won't be NULL when statusq() is
called


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3070 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-01 19:06:01 +00:00
David Lawrence Ramsey
bdc038db14 add missing changelog update
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3069 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-01 18:44:29 +00:00
David Lawrence Ramsey
744e97911c fix breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3068 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-01 18:39:07 +00:00
David Lawrence Ramsey
143b8c7b13 free prompt when it isn't used, and add missing stdio.h #includes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3067 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-01 18:35:47 +00:00
David Lawrence Ramsey
2b9d6a0e6c move get_page_start() from winio.c to utils.c too, and fix a few
comments


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3066 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-01 17:45:31 +00:00
David Lawrence Ramsey
d24d0a43e8 move functions specific to the statusbar prompt to their own source
file, prompt.c, and adjust related variables accordingly


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3065 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-11-01 17:37:44 +00:00
David Lawrence Ramsey
81c4e187f5 move xplustabs(), actual_x(), strnlenpt(), and strlenpt() from winio.c
to utils.c, as they're really utility functions


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3064 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-31 23:07:58 +00:00
David Lawrence Ramsey
67d1951e4d refactor the statusbar code to have and use statusbar_xplustabs(), for
consistency


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3063 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-31 19:36:37 +00:00
David Lawrence Ramsey
3e477263da in nanoget_repaint(), rename parameter inputbuf to buf, for consistency
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3062 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-31 01:32:46 +00:00
David Lawrence Ramsey
26f61a4503 remove declaration of the now-static char* prompt
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3061 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-28 17:14:11 +00:00
David Lawrence Ramsey
f726053325 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3060 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-28 17:12:58 +00:00
David Lawrence Ramsey
a0aff67a4d rename edit_add() to edit_draw(), and rename its parameter yval to line
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3059 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-27 20:10:45 +00:00
David Lawrence Ramsey
377098e617 in nanorc.sample, also tweak the "c-file" regex for characters to
properly reject '"' and '''


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3058 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-27 19:06:47 +00:00
David Lawrence Ramsey
20186f8849 in nanorc.sample, tweak the "c-file" regex for characters to properly
handle '\"'


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3057 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-27 18:59:23 +00:00
David Lawrence Ramsey
07a47017d7 fix inaccurate comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3056 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-27 15:33:05 +00:00
David Lawrence Ramsey
52320f344d make sure we don't treat a click on an empty area of the shortcut list
as a statusbar prompt click


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3055 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-27 15:27:09 +00:00
David Lawrence Ramsey
b5776ac698 make prompt a static instead of a global, since it's only used in
winio.c


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3054 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-27 05:00:48 +00:00
David Lawrence Ramsey
2c8cf48372 at long last, properly handle mouse clicks on the statusbar prompt text
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3053 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-27 04:51:41 +00:00
David Lawrence Ramsey
874703be5f cosmetically refactor statusbar()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3052 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-27 03:35:42 +00:00
David Lawrence Ramsey
3d12f0f53d refactor nanoget_repaint() to split out the new function
get_statusbar_page_start(), the statusbar prompt's equivalent of
get_page_start(); also make sure that the minimum allowed terminal size
in columns is 4, as the statusbar prompt code relies on this assumption
and will crash otherwise


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3051 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-26 23:14:59 +00:00
David Lawrence Ramsey
b2bf101d0c typo fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3050 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-25 06:27:38 +00:00
David Lawrence Ramsey
2de84c1c8d add the ability to scroll up or down single lines without scrolling the
cursor, via Meta-- and Meta-+; note that this is disabled when
NANO_SMALL is defined


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3049 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-24 02:12:09 +00:00
David Lawrence Ramsey
ae5d2dffff Back to CVS
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3048 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-24 01:46:27 +00:00
45 changed files with 11762 additions and 9431 deletions

466
ChangeLog
View File

@@ -1,3 +1,443 @@
GNU nano 1.3.11 - 2006.03.30
- General:
- Miscellaneous comment fixes. (DLR)
- Remove unnecessary #ifdef around termios.h #include in nano.c.
(DLR)
- Sort the default strings for brackets and punct, and the "or"
atom in the default regex string for quotestr, according to
ASCII. Changes to main(), nano.1, nanorc.5, and
nanorc.sample. (DLR)
- Rework the bracket searching code to handle multibyte bracket
characters, and allow specifying matching bracket characters
other than the default via the "matchbrackets" rcfile option.
New functions mbstrpbrk() and mbrevstrpbrk(); changes to
find_statusbar_bracket_match(), do_statusbar_find_bracket(),
find_bracket_match(), do_find_bracket(), main(),
parse_rcfile(), nanorc.5, and nanorc.sample. (DLR)
- Rework input parsing in the file browser to be more flexible.
New function parse_browser_input(); changes to do_browser().
(DLR)
- Allow tab completion of directories at the "Go To Directory"
prompt. Also, move the browser drawing routines to a separate
function, and make sure it's used when refreshing or doing tab
completion at the prompt in the file browser. New function
browser_refresh(); changes to do_browser(), browser_init(),
do_insertfile(), do_writeout(), cwd_tab_completion(),
input_tab(), do_statusbar_input(), get_prompt_string(),
do_prompt(), search_init(), do_replace(), do_gotolinecolumn(),
and do_int_spell_fix(). (DLR)
- browser.c:
do_browser()
- Properly set currshortcut back to the file browser shortcut
list after a "Go To Directory" prompt, and properly restore
the file list display after returning from the help browser at
the "Go To Directory" prompt. (DLR)
- Rename variable j to i, for consistency. (DLR)
- Make fileline, old_selected, and the static selected size_t's,
since the first and second can hold the value of the third,
and the first can be that large. (DLR)
- chars.c:
mbstrchr()
- Make parameter c const. (DLR)
- files.c:
do_writeout()
- Remove unneeded setting of currshortcut. (DLR)
is_dir()
- Rename parameter ret to retval, for consistency. (DLR)
- global.c:
shortcut_init()
- Remove erroneous handling of the "Get Help" shortcut in the
file browser shortcut list. (DLR)
- nano.h:
- Remove now-unneeded VERMSG #define. (DLR)
- prompt.c:
get_prompt_string()
- Redraw the prompt and set finished to FALSE when NANO_HELP_KEY
is pressed, so that we don't leave the prompt, enter the help
browser, and restart the prompt after leaving it. This will
properly preserve the cursor position after doing the last of
these. (DLR)
- utils.c:
ngetdelim()
- Do sanity checks manually again instead of in an assert, and
set errno to EINVAL as well as return -1 if they fail. This
matches the manual page. (DLR)
- winio.c:
get_key_buffer()
- If we fail to get a character MAX_BUF_SIZE times in a row,
hang up regardless of the value of errno. This fixes a
problem where nano doesn't terminate properly under xterm if
the user su's to root, runs nano, and then closes the terminal
window. errno isn't set properly to EIO then. (DLR, found by
John <acocaracha@gmail.com>)
parse_kbinput()
- Interpret Shift-Begin, Shift-Delete, Shift-End, Shift-Home,
Shift-Insert, and Shift-Suspend as Begin, Delete, End, Home,
Insert, and Suspend, respectively, regardless of whether
--rebindkeypad is used. (DLR, found by David Benbennick)
titlebar()
- Use PACKAGE_STRING, as defined by autoconf, instead of VERMSG.
(DLR)
edit_redraw()
- If either current or old_current is offscreen, we're not on
the first page, and/or we're not on the same page as before,
update old_current before scrolling the edit window. This
fixes a potential display problem when a search moves the
cursor offscreen and onto a different page. (DLR, found by
Mike Frysinger)
display_string()
- Fix minor memory leak. (DLR)
- Fix memory corruption problems caused by not allocating enough
space for converted when a line ends in a tab(s) and we're not
in UTF-8 mode. (DLR, found by Duncan Geoffry Doyle, Nick
Warne, and Mike Frysinger)
- doc/faq.html:
- Update the Free Translation Project's address, change the
character set to UTF-8, and remove broken links to contributed
RedHat nano packages. (DLR)
- doc/nano.1:
- Better display the default values for quotestr. (DLR)
- doc/nanorc.5:
- Give the default values for the brackets and punct options,
and better display the default values for quotestr. (DLR)
- Mention that quotes inside string parameters don't need to be
escaped with backslashes. (John M. Gabriele, minor tweaks by
DLR)
- doc/rnano.1:
- Remove unneeded comments. (DLR)
- doc/nanorc.sample:
- Remove unneeded comment. (DLR)
- Mention that quotes inside string parameters don't need to be
escaped with backslashes. (John M. Gabriele, minor tweaks by
DLR)
- THANKS:
- Add new Swedish translator.
GNU nano 1.3.10 - 2005.12.23
- General:
- Miscellaneous comment fixes. (DLR)
- More int -> bool conversions. (DLR)
- Add the ability to scroll up or down single lines without
scrolling the cursor, via Meta-- and Meta-+. Note that this
is disabled when NANO_SMALL is defined. New functions
do_scroll_up() and do_scroll_down(); changes to
shortcut_init(). (DLR, suggested by Mike Frysinger)
- Properly handle mouse clicks on the statusbar prompt text.
New functions statusbar_xplustabs() and
get_statusbar_page_start(); changes to do_statusbar_mouse(),
nanoget_repaint(), nanogetstr(), and statusq(). (DLR)
- Since the statusbar prompt code needs at least 4 columns in
order to work properly, make that the minimum number of
columns that nano requires in order to run, and remove
assertions and code that make use of a smaller number of
columns. Changes to window_init(), nanoget_repaint(),
titlebar(), statusbar(), and get_page_start(). (DLR)
- Move get_page_start(), xplustabs(), actual_x(), strnlenpt(),
strlenpt(), check_linenumbers(), dump_buffer(), and
dump_buffer_reverse() from winio.c to utils.c, as they're
really utility functions. (DLR)
- Add missing stdio.h #include to text.c and winio.c, and remove
unneeded sys/wait.h #include from files.c. (DLR)
- Move functions specific to the statusbar prompt to their own
source file, adjust related variables accordingly, and rename
variable resetstatuspos reset_statusbar_x. New file prompt.c;
changes to do_statusbar_input(), do_statusbar_mouse(),
do_statusbar_output(), do_statusbar_home(),
do_statusbar_end(), do_statusbar_right(), do_statusbar_left(),
do_statusbar_backspace(), do_statusbar_delete(),
do_statusbar_cut_text(), do_statusbar_next_word(),
do_statusbar_prev_word(), do_statusbar_verbatim_input(),
statusbar_xplustabs(), get_statusbar_page_start(),
nanoget_repaint(), nanogetstr(), statusq(), statusq_abort(),
and do_yesno() (all moved to prompt.c). (DLR)
- Move functions specific to the help browser to their own
source file, and adjust related variables accordingly. New
file help.c; changes to help_init(), help_line_len(), and
do_help() (all moved to help.c). (DLR)
- Tweak a few functions to remove the assumption that the file
always ends in a magicline. Changes to cut_line(),
do_cut_till_end(), open_buffer(), read_file(), write_file(),
do_last_line(), do_para_end(), do_wrap(), backup_lines(),
find_paragraph(), do_justify(), do_alt_speller(), and
do_wordlinechar_count(). (DLR)
- Tweak a few functions to rely on fileage and filebot instead
of NULL for their checks to detect the top or bottom of the
file. Changes to cut_line(), cut_to_eol(), do_page_up(),
do_page_down(), do_para_end(), do_next_word(), do_prev_word(),
do_up(), do_down(), do_scroll_down(), do_right(), do_mouse(),
do_gotolinecolumn(), do_delete(), begpar(), find_paragraph(),
do_wrap(), remove_magicline(), and edit_scroll(). (DLR)
- Add new -L/--nonewlines command line option, and new
"nonewlines" rcfile option, to control whether nano adds
magiclines to the ends of files. Changes to read_file(),
write_marked_file(), move_to_filestruct(),
copy_from_filestruct(), usage(), do_output(), main(),
do_replace_loop(), do_delete(), do_int_spell_fix(),
do_alt_speller(), nano.1, nanorc.5, nano.texi, and
nanorc.sample. (DLR, suggested by Jaime
<re2823@Safe-mail.net>)
- Move functions specific to the file browser to their own
source file, and adjust related variables accordingly. New
file browser.c; changes to striponedir(), browser_init(),
do_browser(), and do_browse_from() (all moved to browser.c).
(DLR)
- Add the statusbar prompt's equivalent of placewewant,
statusbar_pww, to prompt.c, and convert its functions to use
it. New functions reset_statusbar_cursor() and
need_statusbar_horizontal_update(); changes to
do_statusbar_mouse(), do_statusbar_output(),
do_statusbar_home(), do_statusbar_end(), do_statusbar_right(),
do_statusbar_left(), do_statusbar_delete(),
do_statusbar_cut_text(), do_statusbar_next_word(),
do_statusbar_prev_word(), do_statusbar_verbatim_input(),
nanoget_repaint() (renamed update_statusbar_line()),
nanogetstr() (renamed get_prompt_string()), statusq() (renamed
do_prompt()), statusq_abort() (renamed do_prompt_abort()), and
do_yesno() (renamed do_yesno_prompt()). (DLR)
- Initialize the static pid_t pid in text.c to -1. (DLR)
- Fix copyright years on source files. All functions in
browser.c were originally added in 2001; the oldest function
in color.c is do_colorinit() (now color_init()), which was
originally added in 2001; the oldest function in chars.c is
revstrstr(), which was originally added in 2001; the oldest
function in help.c is do_help(), which was originally added in
2000; the oldest function in prompt.c is statusq() (now
do_prompt()), which was originally added before 0.6.6, which
was apparently in 1999; all functions in rcfile.c were
originally added in 2001; one of the oldest functions in
search.c is do_search(), which was originally added in 0.2.7,
which was apparently in 1999; and one of the oldest functions
in text.c is do_wrap(), which was originally added in 0.3.1,
which was apparently in 1999. (DLR)
- For functions originally adapted from other sources, add
notices from the original files, as we do with the tab
completion functions adapted from busybox, updating the Free
Software Foundation's address as needed. Also, invoke LGPL
clause 3 to convert the LGPLed ngetdelim() and ngetline()
functions to use the GPL instead. This is done so that we
don't have to include a copy of the LGPL, and because the
changes made to integrate these functions with nano make them
dependent on nano's GPLed functions and hence useless
elsewhere. (DLR)
- Don't install the localized versions of the manpages if
nano is built with --disable-nls. Changes to Makefile.am and
doc/man/Makefile.am. (Mike Frysinger)
- Rename the NANO_SMALL #define to NANO_TINY. (DLR)
- Overhaul the bracket searching code so that it no longer
requires regex support to work. New functions revstrpbrk()
and find_bracket_match(); changes to shortcut_init() and
do_find_bracket(). (DLR)
- Add the ability to do bracket searches at the statusbar
prompt. New functions find_statusbar_bracket_match() and
do_statusbar_find_bracket(); changes to do_statusbar_input().
(DLR)
- Beep whenever we can't read a file or directory and have to
indicate it on the statusbar, as Pico does. Changes to
do_browser(), open_file(), and write_file(). (DLR)
- Adjust copyright notices in all source files to account for
Chris' reassigning the 2005-2006 copyright on nano to me.
Changes to do_credits(). (DLR)
- Readd RETSIGTYPE return types for signal handlers, since any
problems with its being defined as the wrong type aren't
nano's fault. Changes to handle_hupterm(), do_suspend(),
do_continue(), handle_sigwinch(), and cancel_command(). (DLR)
- Since proto.h includes nano.h, and nano.h includes config.h
first, include proto.h first and remove redundant includes of
config.h in all non-header source files. (DLR)
- Refer to the Enter key instead of the Return key for
consistency. Changes to load_history() and rcfile_error().
(DLR)
- browser.c:
do_browser()
- When setting the width of each file, use the "?" operator
instead of an if/else clause. (DLR)
- chars.c:
mbwidth()
- If wcwidth() returns -1 for the character passed in, treat the
character as having the width of Unicode U+FFFD (Replacement
Character) instead of having a width of zero, since display
problems can crop up with the latter approach. (DLR)
mbstrchr()
- Detect the case where the character isn't found in the string
more accurately. (DLR)
- cut.c:
cut_line()
- Since placewewant will always be zero after the line is cut,
set it to zero directly instead of assigning it the value of
xplustabs(). (DLR)
- files.c:
read_file()
- Remove apparently unneeded logic to handle a case where
current is NULL, since it shouldn't be NULL there. (DLR)
get_next_filename()
- Store the value of digits(ULONG_MAX) in a static, since it
doesn't change and hence doesn't need to be recalculated.
(DLR)
- global.c:
shortcut_init()
- Change the description of the Meta-] shortcut to "Find
matching bracket", as it's clearer. (DLR)
- nano.c:
version()
- If DISABLE_WRAPPING is defined, the code in DISABLE_ROOTWRAP
#ifdefs isn't included, so don't display
"--disable-wrapping-as-root" in that case. (DLR)
do_cont()
- Rename to do_continue(), and rename parameter s to signal, for
consistency. (DLR)
do_verbatim_input()
- Move to text.c, since it's an advanced text-based operation.
(DLR)
- nano.h:
- Readd MIN_EDITOR_COLS #define, set to 4. (DLR)
- proto.h:
- Remove now-unused externs for currslen, shortcut_list,
fileinfo, syntaxfile_regexp, and synfilematches. (DLR)
- prompt.c:
do_statusbar_input()
- Fix misplaced break when handling NANO_VERBATIM_KEY. (DLR)
reset_statusbar_cursor()
- Fix cursor placement problem by modeling the code more closely
after reset_cursor(). (DLR)
get_prompt_string()
- Adjust #ifdefs to leave out disabled keys entirely instead of
keeping enough code to just ignore them. (DLR)
- rcfile.c:
do_rcfile()
- Remove unneeded assert. (DLR)
- search.c:
search_abort()
- Rename to search_replace_abort(). (DLR)
findnextstr()
- Remove parameter can_display_wrap, as it's always set to TRUE
now, and rename parameter wholeword to whole_word, for
consistency. (DLR)
- Only include the whole_word parameter when DISABLE_SPELLER
isn't defined, as it's only used then. (DLR)
replace_abort()
- Replace with search_replace_abort(), since it does the same
things that this function does. (DLR)
do_replace_loop()
- Change order of parameters to more closely match those of
findnextstr(), and rename parameter wholewords to whole_word,
for consistency. (DLR)
- Only include the whole_word parameter when DISABLE_SPELLER
isn't defined, as it's only used then. (DLR)
- text.c:
execute_command()
- Instead of hardcoding /bin/sh as the shell to use when
executing a command, use $SHELL, and only fall back to /bin/sh
if $SHELL isn't set. (DLR)
do_wrap()
- Rename variable wrapping to prepending, to avoid confusion,
and rename the static bool same_line_wrap to prepend_wrap to
match. (DLR)
- Properly add a new magicline when needed if, in the process of
wrapping, we prepend text to the last line of the file. (DLR)
break_line()
- Only include the newline parameter if DISABLE_HELP isn't
defined, as it's only used then. (DLR)
- In the surrounding #ifdef, replace the combination of
!DISABLE_JUSTIFY and !DISABLE_WRAPPING with
!DISABLE_WRAPJUSTIFY, for consistency. (DLR)
begpar()
- Return FALSE if foo is NULL, as inpar() does. (DLR)
backup_lines()
- Return void instead of a pointer to the copy of the first
line, since current will point to the same location after the
text is copied and so can be used instead of the old return
value. (DLR)
- Remove unused quote_len parameter. (DLR)
do_justify()
- Don't save current_y and restore it if the user unjustifies,
as the reset_cursor() called by edit_refresh() after restoring
edittop and current will ensure that current_y is restored to
its original value. (DLR)
- Renumber after justifying each individual paragraph, since
find_paragraph() needs the line numbers to be right as well as
edit_refresh(). This fixes a potential segfault when doing
full justify with auto-indent turned on. (DLR)
do_alt_speller()
- Move the code that replaces the text of the current file with
the text of the spell-checked file into its own function,
replace_buffer(). (DLR)
- utils.c:
parse_line_column()
- Simplify parsing of the column number. (DLR)
ngetdelim()
- Do sanity checks in an assert instead of checking them
manually and returning -1 if they fail. (DLR)
is_whole_word()
- Only include when DISABLE_SPELLER isn't defined, as it's only
used then. (DLR)
get_page_start()
- Fix test so that we scroll through the line in 8-character
chunks when COLS is greater than 8, not when COLS is greater
than 9. (DLR)
remove_magicline()
- Add assert. (DLR)
- winio.c:
nanoget_repaint()
- Rename parameter inputbuf to buf, for consistency. (DLR)
reset_cursor()
- Rename variable x to xpt, to avoid confusion. (DLR)
update_line()
- Remove now-unneeded logic that set the index parameter to zero
if the fileptr parameter didn't point to current. (DLR)
edit_add()
- Rename to edit_draw(), and rename parameter yval to line.
(DLR)
do_cursorpos()
- Remove unneeded assert. (DLR)
do_yesno()
- Make mouse clicks on the Yes/No/All shortcuts work properly
when the MORE_SPACE flag is set. (DLR)
- configure.ac:
- Clarify description of --disable-speller. (DLR)
- Disable wrapping entirely when --enable-tiny is used, as it
matches the FAQ, it makes nano even smaller, and it eliminates
the need for --disable-wrapping-as-root in that case (in which
it's impossible to turn wrapping back on without nanorc
support). (DLR)
- README.CVS:
- Mention that the minimum required version of texinfo is 4.0,
since that's the first version that supports generating HTML.
(DLR)
- Mention that the minimum required version of groff is 1.12,
since that's the first version that supports generating HTML.
(DLR)
- Update the given cvs commands so that they work again. (DLR)
- doc/faq.html:
- Add a new section 5.3 to explain the status of nano's Unicode
support. (Mike Frysinger, minor tweaks by DLR)
- Clarify section 5.3 to better explain how to enable Unicode
support, and remove the mention of quirks, since they turned
out to not be a nano problem. (Mike Frysinger and DLR)
- doc/nano.1:
- Make one non-bold instance of "nano" bold, for consistency.
(DLR)
- doc/man/fr/nano.1, doc/man/fr/nanorc.5:
- Updated manpage translations by Jean-Philippe Guérard.
- doc/rnano.1:
- Add rnano.1 manpage from Thijs Kinkhorst. (Jordi) DLR: Merge
a few minor updates from nano.1.
- doc/nano.texi:
- Fix inconsistent wording and punctuation. (DLR)
- Add missing configure options. (Mike Frysinger, minor tweaks
by DLR)
- Sort the configure options more consistently, and add missing
--disable-utf8 option. (DLR)
- Move --disable-wrapping above --enable-tiny, as the latter now
turns it on. (DLR)
- doc/nanorc.sample:
- Tweak the "c-file" regex for characters to properly accept
'\"' and reject '"' and '''. (DLR)
- doc/texinfo/Makefile.am:
- Automatically generate an HTML version of the info page,
nano.html. (DLR)
- src/Makefile.am:
- Add browser.c, help.c, and prompt.c to nano_SOURCES. (DLR)
GNU nano 1.3.9 - 2005.10.23
- General:
- Miscellaneous comment fixes. (DLR)
@@ -290,6 +730,9 @@ GNU nano 1.3.9 - 2005.10.23
as it'll be blanked out in do_replace(). Also, consolidate
the cases for blank and new search strings, as they now differ
only in which string they pass to regexp_init(). (DLR)
is_whole_word()
- Move to utils.c, as it's really a utility function in the same
vein as regexp_bol_or_eol(). (DLR)
replace_abort()
- Remove unnecessary update of placewewant. (DLR)
do_replace()
@@ -1807,7 +2250,8 @@ GNU nano 1.3.5 - 2004.11.22
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)
- Don't use DEFS to define things. Use INCLUDES instead.
(Jordi)
GNU nano 1.3.4 - 2004.08.17
- General:
@@ -3048,14 +3492,14 @@ GNU nano 1.3.0 - 2003.10.22
the backup search string in one place in the search code
instead of several; and do some other minor refactoring of
related display functions to simplify them. New functions
mark_order() and display_string(); changes to actual_x(),
strnlenpt(), blank_bottombars(), blank_edit(),
get_page_start(), edit_add(), update_line(), statusbar(), and
do_replace_highlight(). (David Benbennick) DLR: Add minor
cosmetic tweaks, add missing NANO_SMALL #ifdef around the text
for a backwards search in the refactored code, and enclose
dump_buffer() and dump_buffer_reverse() in one ENABLE_DEBUG
#ifdef instead of two.
mark_order() and display_string(); new macro charmove();
changes to actual_x(), strnlenpt(), blank_bottombars(),
blank_edit(), get_page_start(), edit_add(), update_line(),
statusbar(), and do_replace_highlight(). (David Benbennick)
DLR: Add minor cosmetic tweaks, add missing NANO_SMALL #ifdef
around the text for a backwards search in the refactored code,
and enclose dump_buffer() and dump_buffer_reverse() in one
ENABLE_DEBUG #ifdef instead of two.
- Convert memmove() function calls to charmove() macro calls, as
the former all work on char*'s. (DLR)
- Miscellaneous #define cleanups: only include the prototype for
@@ -3500,7 +3944,7 @@ GNU nano 1.1.99pre2 - 2003.02.03
nano.c:breakable() (David Benbennick).
- Fix screen getting trashed on signals nano can catch
(TERM and HUP). New global variable curses_ended,
changes to winio.c:statubar() and nano.c:die()
changes to winio.c:statusbar() and nano.c:die()
(David Benbennick).
- cut.c:
do_cut_text()
@@ -4592,7 +5036,7 @@ GNU nano 1.1.7 - 03/05/2002
- Preliminary quoting support for justify. New arg -Q, --quotestr,
changes to do_justify(), global variable quotestr().
- Makefile.am:
- Add SYSCONFDIR to DEFS, so we can have an $SYSCONFDIR/nanorc.
- Add SYSCONFDIR to DEFS, so we can have a $SYSCONFDIR/nanorc.
- Change localedir line to 1.0's version.
- Moved m4/ stuff to its own m4/Makefile.am.
- m4/aclocal_inc.m4:

33
NEWS
View File

@@ -1,3 +1,34 @@
2006.03.30 - GNU nano 1.3.11 awakens from its fever dream. This release
focuses mostly on bugfixes, which include better
handling of the cursor at the statusbar prompt, support
for certain combinations of Shift and keyboard keys in
both normal and --rebind-keypad mode, a fix for a minor
display problem after some searches, a real fix for a
long-standing segfault when displaying overly long
lines, and a real fix for nano's not hanging up properly
in xterm under certain circumstances. There are also
several new features, such as the ability to set the
characters used as brackets when searching for matching
brackets, and tab completion of directories at the "Go
To Directory" prompt. Have fun.
2005.12.23 - GNU nano 1.3.10 rises to the surface. This release
contains several new features as well as fixes for
several longstanding bugs. The former include the
ability to scroll up or down single lines without
scrolling the cursor, reworked bracket searching code
that doesn't require regular expression support,
reworked command execution code that uses $SHELL if
available instead of hardcoding "/bin/sh", and the
ability to no longer add newlines to files that don't
end in them via the -L/--nonewlines option. The latter
include fixes to the statusbar prompt so that mouse
clicks work properly on it, fixes to the Yes/No/All
prompt so that mouse clicks on it work properly when
-O/--morespace is used, and fixes to the resize handling
so that nano dies properly when the terminal is too
small to display a prompt. Enjoy.
2005.10.23 - GNU nano 1.3.9 breaks through the wall. This release
includes major enhancements as well as bugfixes. The
enhancements include better handling of invalid UTF-8,
@@ -344,7 +375,7 @@
shows column as well as character position, and
multibuffer allows duplicate files, even unnamed ones.
Also, the static shortcut and toggle lengths are
history, nano now reads $SYSCONFDIR/nanorc if rc file
history, nano now reads SYSCONFDIR/nanorc if rc file
support is enabled, and nano is now built with (and
requires for rebuilding) autoconf 2.5.
This release also includes fixes for some memory

View File

@@ -10,8 +10,8 @@ packages:
- autoconf (version >= 2.54)
- automake (version >= 1.7)
- gettext (version >= 0.11.5)
- groff
- texinfo
- groff (version >= 1.12)
- texinfo (version >= 4.0)
- cvs
- ssh (with support for the SSH version 2 protocol)
- glib 2.x (if your system doesn't have vsnprintf())
@@ -28,10 +28,10 @@ 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
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout nano
If you want to download the stable CVS branch, add "-r nano_1_2_branch":
$ cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/nano checkout -r nano_1_2_branch nano
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout -r nano_1_2_branch nano
Once you have the sources in the "nano" directory, cd into it, and
execute the "autogen.sh" script in the top directory. This will set up

2
THANKS
View File

@@ -26,6 +26,7 @@ Clement Laforet <clem_laf@wanadoo.fr> French translator
Gergely Nagy <algernon@debian.org> Hungarian translator
Kalle Olavi Niemitalo <kon@iki.fi> Finnish Translator
Claudio Neves <cneves@nextis.com> Brazilian Portuguese translator
Daniel Nylander <po@danielnylander.se> Swedish Translator
Michael Piefel <piefel@informatik.hu-berlin.de> German translator
Sergey A. Ribalchenko <fisher@obu.ck.ua> Russian, Ukrainian translator
Michel Robitaille <robitail@IRO.UMontreal.CA> French translator
@@ -47,6 +48,7 @@ Peio Ziarsolo <peio@sindominio.net> Basque translator
Ben Armstrong <synrg@sanctuary.nslug.ns.ca> Negative -r value idea, code
Thomas Dickey <dickey@herndon4.his.com> Curses help and advice
Sven Guckes <guckes@math.fu-berlin.de> Advice and Advocacy
Thijs Kinkhorst <thijs@kinkhorst.com> rnano.1 manpage
Jim Knoble <jmknoble@pobox.com> Pico compat for browser
Ryan Krebs <fluffy@highwire.stanford.edu> Many bug fixes and testing
Roy Lanek <lanek@ranahminang.net> Advice and advocacy

View File

@@ -19,7 +19,7 @@
#
# $Id$
AC_INIT([GNU nano], [1.3.9], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [1.3.11], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE
@@ -39,6 +39,7 @@ dnl Internationalization macros.
AM_GNU_GETTEXT_VERSION(0.11.5)
AM_GNU_GETTEXT([external], [need-ngettext])
AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
dnl Checks for header files.
@@ -86,14 +87,15 @@ fi])
AC_ARG_ENABLE(tiny,
[ --enable-tiny Disable features for the sake of size],
[if test x$enableval = xyes; then
AC_DEFINE(NANO_SMALL, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable any and all text wrapping.])
fi])
AC_ARG_ENABLE(browser,
@@ -127,9 +129,9 @@ AC_ARG_ENABLE(operatingdir,
fi])
AC_ARG_ENABLE(speller,
[ --disable-speller Disable spell checker function],
[ --disable-speller Disable spell checker functions],
[if test x$enableval != xyes; then
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
fi])
AC_ARG_ENABLE(tabcomp,

View File

@@ -2,7 +2,7 @@
<html>
<head>
<title>The GNU nano editor FAQ</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
<h1>The GNU nano editor FAQ</h1>
@@ -45,7 +45,8 @@
<a href="#4.11">4.11. 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>
<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><br>
<a href="#5.3">5.3. What is the status of Unicode support?</a></p></blockquote>
<h2><a href="#6">6. Advocacy and Licensing</a></h2>
<blockquote><p><a href="#6.1">6.1. Why should I use nano instead of Pico?</a><br>
<a href="#6.2">6.2. Why should I use Pico instead of nano?</a><br>
@@ -81,7 +82,7 @@
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program &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.9. 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.11. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.3/nano.1.html">here</a>.</p></blockquote>
<hr width="100%">
@@ -100,11 +101,6 @@
<li><a href="http://www.nano-editor.org/dist/v1.2/RPMS/">http://www.nano-editor.org/dist/v1.2/RPMS/</a></li>
<li><a href="http://www.ewtoo.org/~astyanax/nano/dist/v1.2/RPMS/">http://www.ewtoo.org/~astyanax/nano/dist/v1.2/RPMS/</a></li>
</ul>
<p>Additionally, check out the RedHat contribs section at:</p>
<ul>
<li><a href="http://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/">http://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/</a></li>
<li><a href="ftp://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/">ftp://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/</a></li>
</ul>
</blockquote>
<h2><a name="2.3"></a>2.3. Debian (.deb) packages.</h2>
<blockquote><p>Debian users can check out the current nano packages for:</p>
@@ -216,11 +212,13 @@
<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>
<blockquote><p>On June of 2001, GNU nano entered the <a href="http://www.iro.umontreal.ca/contrib/po/HTML/">Free Translation Project</a> and since then, translations should be managed from there.</p>
<p>If there isn't a translation for your language, you could ask <a href="http://www.iro.umontreal.ca/contrib/po/HTML/teams.html">your language team</a> to translate nano, or better still, join your team and do it yourself. Joining a team is easy. You just need to ask the <a href="mailto:translation@iro.umontreal.ca">TP coordinator</a> to add you to your team, and send a <a href="http://www.iro.umontreal.ca/contrib/po/HTML/disclaim.html">translation disclaimer to the FSF</a> (this is necessary as nano is an official GNU package, but it does <b>not</b> mean that you transfer the rights of your work to the FSF, it's just so the FSF can legally manage them).</p>
<blockquote><p>On June of 2001, GNU nano entered the <a href="http://www.iro.umontreal.ca/translation/HTML/">Free Translation Project</a> and since then, translations should be managed from there.</p>
<p>If there isn't a translation for your language, you could ask <a href="http://www.iro.umontreal.ca/translation/HTML/teams.html">your language team</a> to translate nano, or better still, join your team and do it yourself. Joining a team is easy. You just need to ask the <a href="mailto:translation@iro.umontreal.ca">TP coordinator</a> to add you to your team, and send a <a href="http://www.iro.umontreal.ca/translation/HTML/disclaim.html">translation disclaimer to the FSF</a> (this is necessary as nano is an official GNU package, but it does <b>not</b> mean that you transfer the rights of your work to the FSF, it's just so the FSF can legally manage them).</p>
<p>In any case, translating nano is very easy. Just grab the <b>nano.pot</b> file from the latest and greatest nano distribution (it's in the <b>po/</b> directory) and translate each line into your native language on the <b>msgstr</b> line. When you're done, you should send it to the TP's central po repository.</p></blockquote>
<h2><a name="5.2"></a>5.2. I don't like the translation for &lt;x&gt; in my language. How can I fix it?</h2>
<blockquote><p>The best way would probably be to e-mail the person listed in the <code>Last-Translator:</code> field in the <b>&lt;your_language&gt;.po</b> file with your suggested corrections and they can make the changes reach the nano-devel list.</p></blockquote>
<h2><a name="5.3"></a>5.3. What is the status of Unicode support?</h2>
<blockquote><p>With the latest development version (1.3.10+), Unicode should be mostly usable. With your terminal, locale (LC_ALL and similar environment variables), and encoding configured to properly support UTF-8, you should be able to enter and save Unicode text.</p></blockquote>
<hr width="100%">
<h1><a name="6"></a>6. Advocacy and Licensing</h1>
<h2><a name="6.1"></a>6.1. Why should I use nano instead of Pico?</h2>
@@ -252,7 +250,10 @@
<blockquote><p>Re-read Section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
<h2><a name="8"></a>8. ChangeLog</h2>
<blockquote>
<p>2005/08/27 - Update email address. (DLR)<br>
<p>2006/03/16 - Update the Free Translation Project's address, change the character set to UTF-8, and remove broken links to contributed RedHat nano packages. (DLR)<br>
2005/11/21 - Clarify section 5.3 to better explain how to enable Unicode support, and remove the mention of quirks, since they turned out to not be a nano problem. (Mike Frysinger and DLR)<br>
2005/11/19 - Add a new section 5.3 to explain the status of nano's Unicode support. (Mike Frysinger, minor tweaks by DLR)<br>
2005/08/27 - Update email address. (DLR)<br>
2005/08/10 - Add a new section 4.3, and move all section 4 entries after it down one number, to explain how to deal with numeric keypad problems. (DLR)<br>
2005/08/08 - Update section 3.8 to mention that verbatim input mode now takes a six-digit hexadecimal number. (DLR)<br>
2005/07/04 - Update section 4.10 to mention that pasting from the X clipboard via the middle mouse button also works when the Shift key is used. (DLR)<br>

View File

@@ -1,12 +1,18 @@
if USE_NLS
SUBDIRS = fr
else
SUBDIRS =
endif
man_MANS = nano.1 nanorc.5
man_MANS = nano.1 nanorc.5 rnano.1
BUILT_SOURCES = nano.1.html nanorc.5.html
BUILT_SOURCES = nano.1.html nanorc.5.html rnano.1.html
nano.1.html: nano.1
cat $< | groff -t -mandoc -Thtml > $@
nanorc.5.html: nanorc.5
cat $< | groff -t -mandoc -Thtml > $@
rnano.1.html: rnano.1
cat $< | groff -t -mandoc -Thtml > $@
EXTRA_DIST = $(man_MANS) $(BUILT_SOURCES)

View File

@@ -14,7 +14,7 @@
.\" AUCUNE garantie.
.\"
.\" $Id$
.TH NANO 1 "version 1.3.9" "23 octobre 2005"
.TH NANO 1 "version 1.3.10" "15 décembre 2005"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\"
@@ -70,7 +70,7 @@ de s
Convertit les tabulations clavier en espaces.
.TP
.B \-F (\-\-multibuffer)
Active le mode multifichier, autorisant l'édition simultanée de
Active le mode multi-espace, autorisant l'édition simultanée de
plusieurs fichiers, si ce mode est disponible.
.TP
.B \-H (\-\-historylog)
@@ -89,6 +89,9 @@ toutes correctement. Vous ne devriez utiliser cette option que si ce
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
correctement lorsque cette option sera activée.
.TP
.B \-L (\-\-nonewlines)
Ne pas ajouter de passage à la ligne à la fin des fichiers.
.TP
.B \-N (\-\-noconvert)
Désactive la conversion automatique des fichiers depuis les formats Mac et
DOS.
@@ -169,7 +172,7 @@ Active l'utilisation de la souris (si elle est disponible pour 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
Définit le répertoire de travail. Demande à \fBnano\fP de mettre en place
quelque chose de similaire à un environnement d'exécution restreint
(\fIchroot\fR).
.TP
@@ -226,7 +229,7 @@ cours n'avait pas encore de nom, ou sera compos
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
«\ .save.1\ »). En mode multi-espace, \fBnano\fR réalisera une
sauvegarde de tous les fichiers en cours dans leurs fichiers de secours
respectifs.
@@ -263,8 +266,8 @@ utilis
.SH TRADUCTION
Cette adaptation française a été réalisé par Jean-Philippe\ Guérard
<jean-philippe.guerard@corbeaunoir.org> le 23\ octobre\ 2005 à partir
de la version du 27\ septembre\ 2005 de la page de manuel de nano 1.3.9.
<jean-philippe.guerard@corbeaunoir.org> le 15\ décembre\ 2005 à partir
de la version du 21\ novembre\ 2005 de la page de manuel de nano 1.3.10.
Cette version a été relue par Gérard Delafond.
Un maximum de soin a été apporté lors de l'élaboration de cette

View File

@@ -14,7 +14,7 @@
.\" AUCUNE garantie.
.\"
\" $Id$
.TH NANORC 5 "version 1.3.9" "23 octobre 2005"
.TH NANORC 5 "version 1.3.10" "15 décembre 2005"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
@@ -125,6 +125,9 @@ Ne suit pas les liens symboliques lors de l'
\fBset/unset nohelp\fP
Désactive les lignes d'aide affichée en bas de l'écran.
.TP
.B set/unset nonewlines
Ne pas ajouter de passage à la ligne à la fin des fichiers.
.TP
\fBset/unset nowrap\fP
Désactive le passage automatique à la ligne.
.TP
@@ -292,8 +295,8 @@ manuel a
.SH TRADUCTION
Cette adaptation française a été réalisé par Jean-Philippe\ Guérard
<jean-philippe.guerard@corbeaunoir.org> le 23\ octobre\ 2005 à partir de
la version du 27\ septembre\ 2005 de la page de manuel de nano 1.3.9.
<jean-philippe.guerard@corbeaunoir.org> le 15\ décembre\ 2005 à partir de
la version du 21\ novembre\ 2005 de la page de manuel de nano 1.3.10.
Cette version a été relue par Gérard Delafond.
Un maximum de soin a été apporté lors de l'élaboration de cette

View File

@@ -6,7 +6,7 @@
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" $Id$
.TH NANO 1 "version 1.3.9" "September 27, 2005"
.TH NANO 1 "version 1.3.11" "March 12, 2006"
.\" Please adjust this date whenever revising the manpage.
.\"
@@ -73,6 +73,9 @@ Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
.TP
.B \-L (\-\-nonewlines)
Don't add newlines to the ends of files.
.TP
.B \-N (\-\-noconvert)
Disable automatic conversion of files from DOS/Mac format.
.TP
@@ -81,8 +84,8 @@ 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
">\ " otherwise.
"\fI^([\ \\t]*[#:>\\|}])+\fP" if regular expression support is
available, or "\fI>\ \fP" otherwise.
.TP
.B \-R (\-\-restricted)
Restricted mode: Don't read or write to any file not specified on the
@@ -142,7 +145,7 @@ a new file instead of following it. Good for editing files in
Enable mouse support (if available for your system).
.TP
.B \-o \fIdir\fP (\-\-operatingdir=\fIdir\fP)
Set operating directory. Makes nano set up something similar to a
Set operating directory. Makes \fBnano\fP set up something similar to a
chroot.
.TP
.B \-p (\-\-preserve)

View File

@@ -6,7 +6,7 @@
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" $Id$
.TH NANORC 5 "version 1.3.9" "September 27, 2005"
.TH NANORC 5 "version 1.3.11" "March 12, 2006"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -37,6 +37,11 @@ line options override rcfile settings.
Options are unset by default, except for options that take an argument.
Quotes inside string parameters don't have to be escaped with
backslashes. The last double quote in the string will be treated as its
end. For example, for the brackets option, "\fI"')>]}\fP" will match
\fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP, and \fI}\fP.
The supported commands and arguments are:
.TP 3
@@ -56,7 +61,8 @@ Do backwards searches by default.
.B set brackets "\fIstring\fP"
Set the characters treated as closing brackets. They cannot contain
blank characters. Only closing punctuation, optionally followed by
closing brackets, can end sentences.
closing brackets, can end sentences. The default value is
"\fI"')>]}\fP".
.TP
.B set/unset casesensitive
Do case sensitive searches by default.
@@ -76,6 +82,12 @@ default value is -8.
Enable \fI~/.nano_history\fP for saving and reading search/replace
strings.
.TP
.B set matchbrackets "\fIstring\fP"
Set the opening and closing brackets that can be found by bracket
searches. They cannot contain blank characters. The former set must
come before the latter set, and both must be in the same order. The
default value is "\fI(<[{)>]}\fP".
.TP
.B set/unset morespace
Allow use of the blank line below the titlebar as extra editing space.
.TP
@@ -95,6 +107,9 @@ Don't follow symlinks when writing files.
.B set/unset nohelp
Don't display the help lists at the bottom of the screen.
.TP
.B set/unset nonewlines
Don't add newlines to the ends of files.
.TP
.B set/unset nowrap
Don't wrap text at all.
.TP
@@ -110,7 +125,7 @@ Preserve the XON and XOFF keys (^Q and ^S).
.B set punct "\fIstring\fP"
Set the characters treated as closing punctuation. They cannot contain
blank characters. Only closing punctuation, optionally followed by
closing brackets, can end sentences.
closing brackets, can end sentences. The default value is "\fI!.?\fP".
.TP
.B set/unset quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
@@ -120,11 +135,8 @@ keystroke instead of 25.
The email-quote string, used to justify email-quoted paragraphs. This
is an "extended regular expression" if your system supports them,
otherwise a literal string. The default value is
set quotestr "^([\ \\t]*[|>:}#])+"
if you have regexps, otherwise set quotestr ">\ ". Note that '\\t'
above stands for a literal Tab character.
"\fI^([\ \\t]*[#:>\\|}])+\fP" if you have regexps, or "\fI>\ \fP"
otherwise. Note that '\\t' stands for a literal Tab character.
.TP
.B set/unset rebinddelete
Interpret the Delete key differently so that both Backspace and Delete

80
doc/man/rnano.1 Normal file
View File

@@ -0,0 +1,80 @@
.\" Hey, EMACS: -*- nroff -*-
.\" rnano.1 is copyright 2005 by
.\" Thijs Kinkhorst <thijs@kinkhorst.com>;
.\" skeleton based on nano-tiny.1 by Jordi Mallach <jordi@debian.org>.
.\"
.\" This is free documentation, see the latest version of the GNU General
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" $Id$
.TH RNANO 1 "version 1.3.11" "March 12, 2005"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
rnano \- Restricted mode for Nano's ANOther editor, an enhanced free
Pico clone
.SH SYNOPSIS
.B rnano
.I [\+LINE,COLUMN]\ [options]\ [file]
.br
.SH DESCRIPTION
This manual page documents briefly the \fBrnano\fP command.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
.\" respectively.
\fBnano\fP is a small, free and friendly editor which aims to replace
Pico, the default editor included in the non-free Pine package. Rather
than just copying Pico's look and feel, \fBnano\fP also implements some
missing (or disabled by default) features in Pico, such as "search and
replace" and "go to line number".
.PP
\fBrnano\fP is a restricted version of \fBnano\fP, which only edits
specific files and doesn't allow the user access to the filesystem or a
command shell.
.PP
In restricted mode, \fBnano\fP will \fInot\fP:
.IP \[bu] 2
read or write to any file not specified on the command line;
.IP \[bu]
read any nanorc files;
.IP \[bu]
allow suspending;
.IP \[bu]
allow a file to be appended to, prepended to, or saved under a different
name;
.IP \[bu]
use backup files or spell checking.
.SH OPTIONS
.TP
.B \-?
Same as \fB-h (\-\-help)\fP.
.TP
.B \-h (\-\-help)
Display a summary of command line options.
.TP
.B \-V (\-\-version)
Show the current version number and author.
.PP
See the \fBnano\fP(1) manpage for the complete documentation of
\fBnano\fP.
.SH BUGS
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
The \fBnano\fP mailing list is available from \fBnano-devel@gnu.org\fP.
To subscribe, email to \fBnano-devel-request@gnu.org\fP with a subject
of "subscribe".
.SH HOMEPAGE
http://www.nano-editor.org/
.SH AUTHOR
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS for details).
This manual page was originally written by Thijs Kinkhorst
<thijs@kinkhorst.com>, for the Debian system (but may be used by
others).

View File

@@ -1,4 +1,5 @@
## Sample initialization file for GNU nano
## Sample initialization file for GNU nano.
##
## Please note that you must have configured nano with --enable-nanorc
## for this file to be read! Also note that characters specially
## interpreted by the shell should not be escaped here.
@@ -7,6 +8,11 @@
##
## For the options that take parameters, the default value is given.
## Other options are unset by default.
##
## Quotes inside string parameters don't have to be escaped with
## backslashes. The last double quote in the string will be treated as
## its end. For example, for the brackets option, ""')>]}" will match
## ", ', ), >, ], and }.
## Use auto-indentation.
# set autoindent
@@ -24,7 +30,7 @@
## blank characters. Only closing punctuation, optionally followed by
## closing brackets, can end sentences.
##
# set brackets "'")}]>"
# set brackets ""')>]}"
## Do case sensitive searches by default.
# set casesensitive
@@ -45,6 +51,12 @@
## Enable ~/.nano_history for saving and reading search/replace strings.
# set historylog
## The opening and closing brackets that can be found by bracket
## searches. They cannot contain blank characters. The former set must
## come before the latter set, and both must be in the same order.
##
# set matchbrackets "(<[{)>]}"
## Use the blank line below the titlebar as extra editing space.
# set morespace
@@ -67,6 +79,9 @@
## Don't display the helpful shortcut lists at the bottom of the screen.
# set nohelp
## Don't add newlines to the ends of files.
# set nonewlines
## Don't wrap text at all.
# set nowrap
@@ -84,7 +99,7 @@
## blank characters. Only closing punctuation, optionally followed by
## closing brackets, can end sentences.
##
# set punct ".?!"
# set punct "!.?"
## Do quick statusbar blanking. Statusbar messages will disappear after
## 1 keystroke instead of 25. Note that "const" cancels this out.
@@ -94,11 +109,9 @@
## The email-quote string, used to justify email-quoted paragraphs.
## This is an extended regular expression if your system supports them,
## otherwise a literal string. Default:
# set quotestr "^([ ]*[\|>:}#])+"
# set quotestr "^([ ]*[#:>\|}])+"
## if you have regexps, otherwise:
# set quotestr "> "
## You can get old nano quoted-justify behavior via:
# set quotestr "(> )+"
## Fix Backspace/Delete confusion problem.
# set rebinddelete
@@ -185,7 +198,7 @@
# color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
# color magenta "\<(goto|continue|break|return)\>"
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
# color brightmagenta "'([^\]|(\\['abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
# color brightmagenta "'([^"'\]|(\\["'abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
##
## GCC builtins
##
@@ -330,7 +343,7 @@
## highlight possible errors and parameters
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?color).*$"
## set, unset and syntax
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quickblank|quotestr|rebinddelete)\>" "^[[:space:]]*(set|unset)[[:space:]]+(rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct|quickblank)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
# icolor green "^[[:space:]]*(set|unset|syntax)\>"
## colors
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"

View File

@@ -2,4 +2,9 @@ info_TEXINFOS = nano.texi
MAKEINFO = makeinfo --no-split
EXTRA_DIST = nano.info
BUILT_SOURCES = nano.html
nano.html: nano.texi
cat $< | makeinfo --no-split --html > $@
EXTRA_DIST = $(info_TEXINFOS) $(BUILT_SOURCES)

View File

@@ -8,8 +8,8 @@
@c Run `makeinfo' rather than `texinfo-format-buffer'.
@smallbook
@set EDITION 0.1
@set VERSION 1.3.9
@set UPDATED 27 Sep 2005
@set VERSION 1.3.10
@set UPDATED 28 Nov 2005
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @code{nano}
@subtitle a small and friendly text editor.
@subtitle version 1.3.9
@subtitle version 1.3.10
@author Chris Allegretta
@page
@@ -143,8 +143,11 @@ Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
@item -L, --nonewlines
Don't add newlines to the ends of files.
@item -N, --noconvert
Do not convert files from DOS/Mac format.
Don't convert files from DOS/Mac format.
@item -Q [str], --quotestr [str]
Set the quoting string for justifying. The default is
@@ -182,7 +185,7 @@ Detect word boundaries more accurately by treating punctuation
characters as part of a word.
@item -Y, --syntax=[str]
Specify a specific syntax highlighting from the .nanorc to use, if
Specify a specific syntax highlighting from the nanorc to use, if
available.
@item -c, --const
@@ -233,7 +236,7 @@ set, its own interactive spell checker that requires the @code{spell}
program to be installed on your system.
@item -t, --tempfile
Do not ask whether or not to save the current contents of the file when
Don't ask whether or not to save the current contents of the file when
exiting, assume yes. This is most useful when using @code{nano} as the
composer of a mailer program.
@@ -247,16 +250,16 @@ Note: When accessing the help system, Expert Mode is temporarily
disabled to display the help system navigation keys.
@item -v, --view
Do not allow the contents of the file to be altered. Note that this
flag should NOT be used in place of correct file permissions to
Don't allow the contents of the file to be altered. Note that this
option should NOT be used in place of correct file permissions to
implement a read-only file.
@item -w, --nowrap
Do not wrap long lines at any length. This option overrides any value
Don't wrap long lines at any length. This option overrides any value
for -r.
@item -z, --suspend
Enable suspend ability of @code{nano} using the system's suspend
Enable @code{nano}'s suspend ability using the system's suspend
keystroke (usually ^Z).
@item -a, -b, -e, -f, -g, -j
@@ -350,61 +353,61 @@ and ^V (Page Down) keys. ^X exits the help system.
@chapter Feature Toggles
Toggles allow you to change certain aspects of the editor that
would normally be done via command line flags. They are invoked via
would normally be done via command line options. They are invoked via
certain Meta key sequences. @xref{Special Functions}, for more info.
The following global toggles are available:
@table @code
@item Backup Files Toggle (Meta-B)
toggles the -B (@code{--backup}) command line flag.
toggles the -B (@code{--backup}) command line option.
@item Constant Cursor Position Display Toggle (Meta-C)
toggles the -c (@code{--const}) command line flag.
toggles the -c (@code{--const}) command line option.
@item Multiple File Buffers Toggle (Meta-F)
toggles the -F (@code{--multibuffer}) command line flag.
toggles the -F (@code{--multibuffer}) command line option.
@item Smart Home Key Toggle (Meta-H)
toggles the -A (@code{--smarthome}) command line flag.
toggles the -A (@code{--smarthome}) command line option.
@item Auto Indent Toggle (Meta-I)
toggles the -i (@code{--autoindent}) command line flag.
toggles the -i (@code{--autoindent}) command line option.
@item Cut To End Toggle (Meta-K)
toggles the -k (@code{--cut}) command line flag.
toggles the -k (@code{--cut}) command line option.
@item Long Line Wrapping Toggle (Meta-L)
toggles the -w (@code{--nowrap}) command line flag.
toggles the -w (@code{--nowrap}) command line option.
@item Mouse Support Toggle (Meta-M)
toggles the -m (@code{--mouse}) command line flag.
toggles the -m (@code{--mouse}) command line option.
@item No Conversion From DOS/Mac Format Toggle (Meta-N)
toggles the -N (@code{--noconvert}) command line flag.
toggles the -N (@code{--noconvert}) command line option.
@item More Space For Editing Toggle (Meta-O)
toggles the -O (@code{--morespace}) command line flag.
toggles the -O (@code{--morespace}) command line option.
@item Whitespace Display Toggle (Meta-P)
toggles whitespace display mode if you have a "whitespace" option in
your .nanorc.
your nanorc.
@item Tabs to Spaces Toggle (Meta-Q)
toggles the -E (@code{--tabstospaces}) command line flag.
toggles the -E (@code{--tabstospaces}) command line option.
@item Smooth Scrolling Toggle (Meta-S)
toggles the -S (@code{--smooth}) command line flag.
toggles the -S (@code{--smooth}) command line option.
@item Expert/No Help Toggle (Meta-X)
toggles the -x (@code{--nohelp}) command line flag.
toggles the -x (@code{--nohelp}) command line option.
@item Color Syntax Highlighting Toggle (Meta-Y)
toggles color syntax highlighting if you have color syntaxes in your
.nanorc.
nanorc.
@item Suspend Toggle (Meta-Z)
toggles the -z (@code{--suspend}) command line flag.
toggles the -z (@code{--suspend}) command line option.
@end table
@@ -438,11 +441,11 @@ incompatible with Pico, method for entering search and replace strings.
In the old method, previous entries would be displayed by default as
editable text in front of the cursor, as opposed to being bracketed and
uneditable as it is in Pico. The old behavior could be made compatible
with Pico via the @code{-p} flag, but recent versions of Pico use the
@code{-p} flag to preserve the XON and XOFF sequences within the editor.
Since with the new method search and replace strings can still be edited
by simply hitting the up arrow key once, the old method was removed
completely.
with Pico via the @code{-p} option, but recent versions of Pico use the
@code{-p} option to preserve the XON and XOFF sequences within the
editor. Since with the new method search and replace strings can still
be edited by simply hitting the up arrow key once, the old method was
removed completely.
@item Writing or Appending Selected Text to Files
@@ -489,50 +492,83 @@ familiar with compiling programs with autoconf support:
@item make install
@end itemize
if you are looking to optimize @code{nano} for size, you may want to
consider the following command line options:
@table @code
@item --disable-browser
Disable the mini file browser when reading or writing files.
@item --disable-help
Disable the help function. Doing this makes the binary much smaller,
but makes it difficult for new users to learn more than very basic
things about using the editor.
@item --disable-justify
Disable the justify and unjustify functions.
@item --disable-mouse
Disable all mouse functionality. This also disables the -m command line
option, which enables the mouse functionality.
@item --disable-operatingdir
Disable setting the operating directory. This also disables the -o
command line option, which sets the operating directory.
@item --disable-speller
Disable use of the spell checker. This also disables the -s command
line option, which allows specifying an alternate spell checker.
@item --disable-tabcomp
Disable the tab completion code when reading or writing files.
@item --disable-justify
Disable the justify (^J)/unjustify (^U) functions in the editor.
@item --disable-speller
Disable spell checker ability.
@item --disable-help
Disable the help function (^G). Disabling this option makes the binary
much smaller, but makes it difficult for new users to learn more than
very basic things about using the editor.
@item --disable-browser
Disable the mini file browser (^T) when reading or writing files.
@item --disable-mouse
Disable all mouse functionality. This also disables the -m command line
flag, which enables the mouse functions.
@item --disable-operatingdir
Disable setting the operating directory. This also disables the -o
command line flag.
@item --disable-wrapping
Disable all long line wrapping. This also eliminates the -w command
line option, which enables long line wrapping.
@item --enable-tiny
This option disables all the above. It also disables some of the larger
internals of the editor, like the marker code (^^) and the cut to line
(-k) option, which depends on the marker code to work properly. It also
disables the function toggles.
internals of the editor, like the marking code and the cut to line code.
It also disables the function toggles.
@item --disable-wrapping
Disable all word wrapping in the editor. This also eliminates the -w
command line flag, as nonwrapping is then the default behavior.
@item --enable-debug
Enable support for runtime debug output. This can get pretty messy, so
chances are you only want this feature to work on the nano source.
@item --enable-extra
Enable extra features. At the moment, this is just easter egg-type
stuff.
@item --enable-color
Enable support for syntax coloring of files. See the nanorc
documentation for more details. The nanorc feature will also be
enabled.
@item --enable-multibuffer
Enable support for opening multiple files at a time and switching
between them on the fly.
@item --enable-nanorc
Enable support for reading the nanorc file at startup. You can store
custom settings in the nanorc file rather than having to pass command
line options to get desired behavior.
@item --enable-all
Shortcut for enabling the above four features (extra, color,
multibuffer, and nanorc).
@item --disable-nls
Disables Native Language support. This will make the available GNU
@code{nano} translations unusable.
Disables Native Language support. This will disable use of the
available GNU @code{nano} translations.
@item --disable-wrapping-as-root
Disable long line wrapping by default when nano is run as root.
@item --enable-utf8
Enable support for reading and writing Unicode files. This will require
either the wide version of ncurses, or a UTF-8-enabled version of Slang.
@item --disable-utf8
Disable support for reading and writing Unicode files.
@item --with-slang
Compiling @code{nano} with Slang is supported, and will make the binary

View File

@@ -1,3 +1,39 @@
2005-03-15 Jordi Mallach <jordi@gnu.org>
* sv.po: Updated Swedish translation by Daniel Nylander.
2005-03-06 Jordi Mallach <jordi@gnu.org>
* ca.po: Updated Vietnamese translation by
Phan Vinh Thinh.
2005-12-21 Jordi Mallach <jordi@gnu.org>
* bg.po: Updated Bulgarian translation by Anton Zinoviev.
* ca.po: Updated Catalan translation.
* fr.po: Updated French translation by Jean-Philippe Guérard.
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
* zh_TW: Updated Traditional Chinese translation by
Wei-Lun Chao.
2005-12-13 Jordi Mallach <jordi@gnu.org>
* it.po: Updated Italian translation by Marco Colombo.
* de.po: Updated German translation by Michael Piefel.
* nl.po: Updated Dutch translation by Benno Schulenberg.
2005-11-08 David Lawrence Ramsey <pooka109@cox.net>
* POTFILES.in: Add prompt.c.
2005-11-05 David Lawrence Ramsey <pooka109@cox.net>
* POTFILES.in: Add browser.c.
2005-11-01 David Lawrence Ramsey <pooka109@cox.net>
* POTFILES.in: Add help.c.
2006-10-23 Jordi Mallach <jordi@gnu.org>
* ca.po: Updated Catalan translation.

View File

@@ -1,9 +1,12 @@
# $Id$
# List of source files containing translatable strings.
src/browser.c
src/files.c
src/global.c
src/help.c
src/nano.c
src/prompt.c
src/rcfile.c
src/search.c
src/text.c

1228
po/bg.po

File diff suppressed because it is too large Load Diff

869
po/ca.po

File diff suppressed because it is too large Load Diff

1518
po/de.po

File diff suppressed because it is too large Load Diff

936
po/fr.po

File diff suppressed because it is too large Load Diff

869
po/it.po

File diff suppressed because it is too large Load Diff

866
po/ms.po

File diff suppressed because it is too large Load Diff

882
po/nl.po

File diff suppressed because it is too large Load Diff

1692
po/sv.po

File diff suppressed because it is too large Load Diff

1725
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -4,14 +4,17 @@ INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\"
ACLOCAL_AMFLAGS = -I m4
bin_PROGRAMS = nano
nano_SOURCES = chars.c \
nano_SOURCES = browser.c \
chars.c \
color.c \
cut.c \
files.c \
global.c \
help.c \
move.c \
nano.c \
nano.h \
prompt.c \
proto.h \
rcfile.c \
search.c \

608
src/browser.c Normal file
View File

@@ -0,0 +1,608 @@
/* $Id$ */
/**************************************************************************
* browser.c *
* *
* Copyright (C) 2001-2004 Chris Allegretta *
* Copyright (C) 2005-2006 David Lawrence Ramsey *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
* 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., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301, USA. *
* *
**************************************************************************/
#include "proto.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#ifndef DISABLE_BROWSER
static char **filelist = NULL;
/* The list of files to display in the browser. */
static size_t filelist_len = 0;
/* The number of files in the list. */
static int width = 0;
/* The number of columns to display the list in. */
static int longest = 0;
/* The number of columns in the longest filename in the list. */
static size_t selected = 0;
/* The currently selected filename in the list. */
/* Our browser function. path is the path to start browsing from.
* Assume path has already been tilde-expanded. */
char *do_browser(char *path, DIR *dir)
{
int kbinput;
bool meta_key, func_key;
bool old_const_update = ISSET(CONST_UPDATE);
char *ans = mallocstrcpy(NULL, "");
/* The last answer the user typed on the statusbar. */
char *retval = NULL;
curs_set(0);
blank_statusbar();
#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
currshortcut = browser_list;
#endif
bottombars(browser_list);
wnoutrefresh(bottomwin);
UNSET(CONST_UPDATE);
change_browser_directory:
/* We go here after the user selects a new directory. */
kbinput = ERR;
meta_key = FALSE;
func_key = FALSE;
width = 0;
selected = 0;
path = mallocstrassn(path, get_full_path(path));
/* Assume that path exists and ends with a slash. */
assert(path != NULL && path[strlen(path) - 1] == '/');
/* Get the list of files. */
browser_init(path, dir);
assert(filelist != NULL);
/* Sort the list. */
qsort(filelist, filelist_len, sizeof(char *), diralphasort);
titlebar(path);
do {
bool abort = FALSE;
struct stat st;
int i;
size_t fileline;
char *new_path;
/* Used by the "Go To Directory" prompt. */
#ifndef DISABLE_MOUSE
MEVENT mevent;
#endif
check_statusblank();
/* Compute the line number we're on now, so that we don't divide
* by 0. */
fileline = selected;
if (width != 0)
fileline /= width;
switch (kbinput) {
#ifndef DISABLE_MOUSE
case KEY_MOUSE:
if (getmouse(&mevent) == ERR)
break;
/* If we clicked in the edit window, we probably clicked
* on a file. */
if (wenclose(edit, mevent.y, mevent.x)) {
size_t old_selected = selected;
/* Subtract out the size of topwin. */
mevent.y -= 2 - no_more_space();
/* longest is the width of each column. There are
* two spaces between each column. */
selected = (fileline / editwinrows) * (editwinrows *
width) + (mevent.y * width) + (mevent.x /
(longest + 2));
/* If they clicked beyond the end of a row, select
* the end of that row. */
if (mevent.x > width * (longest + 2))
selected--;
/* If we're off the screen, reset to the last item.
* If we clicked the same place as last time, select
* this name! */
if (selected > filelist_len - 1)
selected = filelist_len - 1;
else if (old_selected == selected)
/* Put back the "Select" key, so that the file
* is selected. */
unget_kbinput(NANO_ENTER_KEY, FALSE, FALSE);
} else {
/* We must have clicked a shortcut. Put back the
* equivalent shortcut key. */
int mouse_x, mouse_y;
get_mouseinput(&mouse_x, &mouse_y, TRUE);
}
break;
#endif
case NANO_PREVLINE_KEY:
if (selected >= width)
selected -= width;
break;
case NANO_BACK_KEY:
if (selected > 0)
selected--;
break;
case NANO_NEXTLINE_KEY:
if (selected + width <= filelist_len - 1)
selected += width;
break;
case NANO_FORWARD_KEY:
if (selected < filelist_len - 1)
selected++;
break;
case NANO_PREVPAGE_KEY:
if (selected >= (editwinrows + fileline % editwinrows) *
width)
selected -= (editwinrows + fileline % editwinrows) *
width;
else
selected = 0;
break;
case NANO_NEXTPAGE_KEY:
selected += (editwinrows - fileline % editwinrows) *
width;
if (selected >= filelist_len)
selected = filelist_len - 1;
break;
case NANO_HELP_KEY:
#ifndef DISABLE_HELP
do_help();
curs_set(0);
#else
nano_disabled_msg();
#endif
break;
case NANO_ENTER_KEY:
/* You can't move up from "/". */
if (strcmp(filelist[selected], "/..") == 0) {
statusbar(_("Can't move up a directory"));
beep();
break;
}
#ifndef DISABLE_OPERATINGDIR
/* Note: the selected file can be outside the operating
* directory if it's ".." or if it's a symlink to a
* directory outside the operating directory. */
if (check_operating_dir(filelist[selected], FALSE)) {
statusbar(
_("Can't go outside of %s in restricted mode"),
operating_dir);
beep();
break;
}
#endif
if (stat(filelist[selected], &st) == -1) {
/* We can't open this file for some reason.
* Complain. */
statusbar(_("Error reading %s: %s"),
filelist[selected], strerror(errno));
beep();
break;
}
if (!S_ISDIR(st.st_mode)) {
retval = mallocstrcpy(retval, filelist[selected]);
abort = TRUE;
break;
}
dir = opendir(filelist[selected]);
if (dir == NULL) {
/* We can't open this dir for some reason.
* Complain. */
statusbar(_("Error reading %s: %s"),
filelist[selected], strerror(errno));
beep();
break;
}
path = mallocstrcpy(path, filelist[selected]);
/* Start over again with the new path value. */
free_chararray(filelist, filelist_len);
goto change_browser_directory;
/* Redraw the screen. */
case NANO_REFRESH_KEY:
total_redraw();
break;
/* Go to a specific directory. */
case NANO_GOTOLINE_KEY:
curs_set(1);
i = do_prompt(TRUE,
#ifndef DISABLE_TABCOMP
FALSE,
#endif
gotodir_list, ans,
#ifndef NANO_TINY
NULL,
#endif
browser_refresh, _("Go To Directory"));
curs_set(0);
#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
currshortcut = browser_list;
#endif
bottombars(browser_list);
if (i < 0) {
/* We canceled. Indicate that on the statusbar, and
* blank out ans, since we're done with it. */
statusbar(_("Cancelled"));
ans = mallocstrcpy(ans, "");
break;
} else if (i != 0) {
/* Put back the "Go to Directory" key and save
* answer in ans, so that the file list is displayed
* again, the prompt is displayed again, and what we
* typed before at the prompt is displayed again. */
unget_kbinput(NANO_GOTOLINE_KEY, FALSE, FALSE);
ans = mallocstrcpy(ans, answer);
break;
}
/* We have a directory. Blank out ans, since we're done
* with it. */
ans = mallocstrcpy(ans, "");
new_path = real_dir_from_tilde(answer);
if (new_path[0] != '/') {
new_path = charealloc(new_path, strlen(path) +
strlen(answer) + 1);
sprintf(new_path, "%s%s", path, answer);
}
#ifndef DISABLE_OPERATINGDIR
if (check_operating_dir(new_path, FALSE)) {
statusbar(
_("Can't go outside of %s in restricted mode"),
operating_dir);
free(new_path);
break;
}
#endif
dir = opendir(new_path);
if (dir == NULL) {
/* We can't open this dir for some reason.
* Complain. */
statusbar(_("Error reading %s: %s"), answer,
strerror(errno));
beep();
free(new_path);
break;
}
/* Start over again with the new path value. */
free(path);
path = new_path;
free_chararray(filelist, filelist_len);
goto change_browser_directory;
/* Abort the browser. */
case NANO_EXIT_KEY:
abort = TRUE;
break;
}
if (abort)
break;
browser_refresh();
kbinput = get_kbinput(edit, &meta_key, &func_key);
parse_browser_input(&kbinput, &meta_key, &func_key);
} while (kbinput != NANO_EXIT_KEY);
blank_edit();
titlebar(NULL);
edit_refresh();
curs_set(1);
if (old_const_update)
SET(CONST_UPDATE);
/* Clean up. */
free(path);
free(ans);
free_chararray(filelist, filelist_len);
return retval;
}
/* The file browser front end. We check to see if inpath has a dir in
* it. If it does, we start do_browser() from there. Otherwise, we
* start do_browser() from the current directory. */
char *do_browse_from(const char *inpath)
{
struct stat st;
char *path;
/* This holds the tilde-expanded version of inpath. */
DIR *dir = NULL;
assert(inpath != NULL);
path = real_dir_from_tilde(inpath);
/* Perhaps path is a directory. If so, we'll pass it to
* do_browser(). Or perhaps path is a directory / a file. If so,
* we'll try stripping off the last path element and passing it to
* do_browser(). Or perhaps path doesn't have a directory portion
* at all. If so, we'll just pass the current directory to
* do_browser(). */
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
striponedir(path);
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
free(path);
path = charalloc(PATH_MAX + 1);
path = getcwd(path, PATH_MAX + 1);
if (path != NULL)
align(&path);
}
}
#ifndef DISABLE_OPERATINGDIR
/* If the resulting path isn't in the operating directory, use
* the operating directory instead. */
if (check_operating_dir(path, FALSE)) {
if (path != NULL)
free(path);
path = mallocstrcpy(NULL, operating_dir);
}
#endif
if (path != NULL)
dir = opendir(path);
if (dir == NULL) {
beep();
free(path);
return NULL;
}
return do_browser(path, dir);
}
/* Set filelist to the list of files contained in the directory path,
* set filelist_len to the number of files in that list, and set longest
* to the width in columns of the longest filename in that list, up to
* COLS - 1 (but at least 7). Assume path exists and is a directory. */
void browser_init(const char *path, DIR *dir)
{
const struct dirent *nextdir;
size_t i = 0, path_len;
assert(dir != NULL);
longest = 0;
while ((nextdir = readdir(dir)) != NULL) {
size_t d_len;
/* Don't show the "." entry. */
if (strcmp(nextdir->d_name, ".") == 0)
continue;
i++;
d_len = strlenpt(nextdir->d_name);
if (d_len > longest)
longest = (d_len > COLS - 1) ? COLS - 1 : d_len;
}
filelist_len = i;
rewinddir(dir);
longest += 10;
filelist = (char **)nmalloc(filelist_len * sizeof(char *));
path_len = strlen(path);
i = 0;
while ((nextdir = readdir(dir)) != NULL && i < filelist_len) {
/* Don't show the "." entry. */
if (strcmp(nextdir->d_name, ".") == 0)
continue;
filelist[i] = charalloc(path_len + strlen(nextdir->d_name) + 1);
sprintf(filelist[i], "%s%s", path, nextdir->d_name);
i++;
}
/* Maybe the number of files in the directory changed between the
* first time we scanned and the second. i is the actual length of
* filelist, so record it. */
filelist_len = i;
closedir(dir);
if (longest > COLS - 1)
longest = COLS - 1;
if (longest < 7)
longest = 7;
}
/* Determine the shortcut key corresponding to the values of kbinput
* (the key itself), meta_key (whether the key is a meta sequence), and
* func_key (whether the key is a function key), if any. In the
* process, convert certain non-shortcut keys used by Pico's file
* browser into their corresponding shortcut keys. */
void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key)
{
get_shortcut(browser_list, kbinput, meta_key, func_key);
/* Pico compatibility. */
if (*meta_key == FALSE && *func_key == FALSE) {
switch (*kbinput) {
case ' ':
*kbinput = NANO_NEXTPAGE_KEY;
break;
case '-':
*kbinput = NANO_PREVPAGE_KEY;
break;
case '?':
*kbinput = NANO_HELP_KEY;
break;
case 'E':
case 'e':
*kbinput = NANO_EXIT_KEY;
break;
case 'G':
case 'g':
*kbinput = NANO_GOTOLINE_KEY;
break;
case 'S':
case 's':
*kbinput = NANO_ENTER_KEY;
break;
}
}
}
/* Calculate the number of columns needed to display the list of files
* in the array filelist, if necessary, and then display the list of
* files. */
void browser_refresh(void)
{
struct stat st;
int i;
int col = 0, filecols = 0, editline = 0;
size_t foo_len = mb_cur_max() * 7;
char *foo = charalloc(foo_len + 1);
i = (width != 0) ? width * editwinrows * ((selected / width) /
editwinrows) : 0;
blank_edit();
wmove(edit, 0, 0);
for (; i < filelist_len && editline <= editwinrows - 1; i++) {
char *disp = display_string(tail(filelist[i]), 0, longest,
FALSE);
/* Highlight the currently selected file/dir. */
if (i == selected)
wattron(edit, A_REVERSE);
blank_line(edit, editline, col, longest);
mvwaddstr(edit, editline, col, disp);
free(disp);
col += longest;
filecols++;
/* Show file info also. We don't want to report file sizes for
* links, so we use lstat(). Also, stat() and lstat() return an
* error if, for example, the file is deleted while the file
* browser is open. In that case, we report "--" as the file
* info. */
if (lstat(filelist[i], &st) == -1 || S_ISLNK(st.st_mode)) {
/* Aha! It's a symlink! Now, is it a dir? If so, mark it
* as such. */
if (stat(filelist[i], &st) == 0 && S_ISDIR(st.st_mode)) {
strncpy(foo, _("(dir)"), foo_len);
foo[foo_len] = '\0';
} else
strcpy(foo, "--");
} else if (S_ISDIR(st.st_mode)) {
strncpy(foo, _("(dir)"), foo_len);
foo[foo_len] = '\0';
} else if (st.st_size < (1 << 10)) /* less than 1 k. */
sprintf(foo, "%4u B", (unsigned int)st.st_size);
else if (st.st_size < (1 << 20)) /* less than 1 meg. */
sprintf(foo, "%4u KB", (unsigned int)(st.st_size >> 10));
else if (st.st_size < (1 << 30)) /* less than 1 gig. */
sprintf(foo, "%4u MB", (unsigned int)(st.st_size >> 20));
else
sprintf(foo, "%4u GB", (unsigned int)(st.st_size >> 30));
mvwaddnstr(edit, editline, col - strlen(foo), foo, foo_len);
if (i == selected)
wattroff(edit, A_REVERSE);
/* Add some space between the columns. */
col += 2;
/* If the next entry isn't going to fit on the line,
* move to the next line. */
if (col > COLS - longest) {
editline++;
col = 0;
/* Set the number of columns to display the list in, if
* necessary, so that we don't divide by 0. */
if (width == 0)
width = filecols;
}
wmove(edit, editline, col);
}
free(foo);
wnoutrefresh(edit);
}
/* Strip one directory from the end of path. */
void striponedir(char *path)
{
char *tmp;
assert(path != NULL);
tmp = strrchr(path, '/');
if (tmp != NULL)
*tmp = '\0';
}
#endif /* !DISABLE_BROWSER */

View File

@@ -2,7 +2,8 @@
/**************************************************************************
* chars.c *
* *
* Copyright (C) 2005 Chris Allegretta *
* Copyright (C) 2001-2004 Chris Allegretta *
* Copyright (C) 2005-2006 David Lawrence Ramsey *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -20,13 +21,10 @@
* *
**************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "proto.h"
#include <string.h>
#include <ctype.h>
#include "proto.h"
#ifdef ENABLE_UTF8
#ifdef HAVE_WCHAR_H
@@ -299,8 +297,10 @@ int mbwidth(const char *c)
width = wcwidth(wc);
if (width == -1)
width++;
if (width == -1) {
wc = bad_wchar;
width = wcwidth(wc);
}
return width;
} else
@@ -365,8 +365,8 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
/* Get the number of bytes in the multibyte character. */
buf_mb_len = mblen(buf, MB_CUR_MAX);
/* If buf contains an invalid multibyte character, set bad_chr
* to TRUE and interpret buf's first byte. */
/* If buf contains an invalid multibyte character, only
* interpret buf's first byte. */
if (buf_mb_len < 0) {
mblen(NULL, 0);
buf_mb_len = 1;
@@ -452,7 +452,7 @@ size_t move_mbleft(const char *buf, size_t pos)
while (TRUE) {
int buf_mb_len = parse_mbchar(buf + pos - pos_prev, NULL, NULL);
if (pos_prev <= (size_t)buf_mb_len)
if (pos_prev <= buf_mb_len)
break;
pos_prev -= buf_mb_len;
@@ -551,8 +551,31 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
}
#ifndef HAVE_STRCASESTR
/* This function is equivalent to strcasestr(). It was adapted from
* mutt's mutt_stristr() function. */
/* This function, nstrcasestr() (originally mutt_stristr()), was adapted
* from mutt 1.2.4i (lib.c). Here is the notice from that file, with
* the Free Software Foundation's address updated:
*
* Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
* Copyright (C) 1999-2000 Thomas Roessler <roessler@guug.de>
*
* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. */
/* This function is equivalent to strcasestr(). */
const char *nstrcasestr(const char *haystack, const char *needle)
{
assert(haystack != NULL && needle != NULL);
@@ -631,7 +654,7 @@ const char *mbstrcasestr(const char *haystack, const char *needle)
return strcasestr(haystack, needle);
}
#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
#if !defined(NANO_TINY) || !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
@@ -651,9 +674,9 @@ const char *revstrstr(const char *haystack, const char *needle, const
return NULL;
}
#endif /* !NANO_SMALL || !DISABLE_TABCOMP */
#endif /* !NANO_TINY || !DISABLE_TABCOMP */
#ifndef NANO_SMALL
#ifndef NANO_TINY
/* 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,
@@ -740,7 +763,7 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
#endif
return revstrcasestr(haystack, needle, rev_start);
}
#endif /* !NANO_SMALL */
#endif /* !NANO_TINY */
/* This function is equivalent to strlen() for multibyte strings. */
size_t mbstrlen(const char *s)
@@ -790,15 +813,15 @@ size_t mbstrnlen(const char *s, size_t maxlen)
return strnlen(s, maxlen);
}
#ifndef DISABLE_JUSTIFY
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
/* This function is equivalent to strchr() for multibyte strings. */
char *mbstrchr(const char *s, char *c)
char *mbstrchr(const char *s, const char *c)
{
assert(s != NULL && c != NULL);
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
bool bad_c_mb = FALSE, bad_s_mb = FALSE;
bool bad_s_mb = FALSE, bad_c_mb = FALSE;
char *s_mb = charalloc(MB_CUR_MAX);
const char *q = s;
wchar_t ws, wc;
@@ -828,7 +851,7 @@ char *mbstrchr(const char *s, char *c)
free(s_mb);
if (ws != wc)
if (*s == '\0')
q = NULL;
return (char *)q;
@@ -836,8 +859,80 @@ char *mbstrchr(const char *s, char *c)
#endif
return strchr(s, *c);
}
#endif /* !NANO_TINY || !DISABLE_JUSTIFY */
#ifdef ENABLE_NANORC
#ifndef NANO_TINY
/* This function is equivalent to strpbrk() for multibyte strings. */
char *mbstrpbrk(const char *s, const char *accept)
{
assert(s != NULL && accept != NULL);
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
while (*s != '\0') {
if (mbstrchr(accept, s) != NULL)
return (char *)s;
s += move_mbright(s, 0);
}
return NULL;
} else
#endif
return strpbrk(s, accept);
}
/* This function is equivalent to strpbrk(), except in that it scans the
* string in reverse, starting at rev_start. */
char *revstrpbrk(const char *s, const char *accept, const char
*rev_start)
{
assert(s != NULL && accept != NULL && rev_start != NULL);
for (; rev_start >= s; rev_start--) {
const char *q = (*rev_start == '\0') ? NULL : strchr(accept,
*rev_start);
if (q != NULL)
return (char *)rev_start;
}
return NULL;
}
/* This function is equivalent to strpbrk() for multibyte strings,
* except in that it scans the string in reverse, starting at
* rev_start. */
char *mbrevstrpbrk(const char *s, const char *accept, const char
*rev_start)
{
assert(s != NULL && accept != NULL && rev_start != NULL);
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
bool begin_line = FALSE;
while (!begin_line) {
const char *q = (*rev_start == '\0') ? NULL :
mbstrchr(accept, rev_start);
if (q != NULL)
return (char *)rev_start;
if (rev_start == s)
begin_line = TRUE;
else
rev_start = s + move_mbleft(s, rev_start - s);
}
return NULL;
} else
#endif
return revstrpbrk(s, accept, rev_start);
}
#endif /* !NANO_TINY */
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
/* Return TRUE if the string s contains one or more blank characters,
* and FALSE otherwise. */
bool has_blank_chars(const char *s)
@@ -883,8 +978,7 @@ bool has_blank_mbchars(const char *s)
#endif
return has_blank_chars(s);
}
#endif /* ENABLE_NANORC */
#endif /* !DISABLE_JUSTIFY */
#endif /* ENABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */
#ifdef ENABLE_UTF8
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */

View File

@@ -2,7 +2,8 @@
/**************************************************************************
* color.c *
* *
* Copyright (C) 1999-2005 Chris Allegretta *
* Copyright (C) 2001-2004 Chris Allegretta *
* Copyright (C) 2005-2006 David Lawrence Ramsey *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -20,18 +21,15 @@
* *
**************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "proto.h"
#include <stdio.h>
#include <string.h>
#include "proto.h"
#ifdef ENABLE_COLOR
/* For each syntax list entry, we go through the list of colors and
* assign color pairs. */
/* For each syntax list entry, go through the list of colors and assign
* color pairs. */
void set_colorpairs(void)
{
const syntaxtype *this_syntax = syntaxes;
@@ -74,7 +72,7 @@ void color_init(void)
start_color();
#ifdef HAVE_USE_DEFAULT_COLORS
/* Add in colors, if available. */
/* Use the default colors, if available. */
defok = (use_default_colors() != ERR);
#endif

View File

@@ -2,7 +2,8 @@
/**************************************************************************
* cut.c *
* *
* Copyright (C) 1999-2005 Chris Allegretta *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 2005 David Lawrence Ramsey *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -20,37 +21,40 @@
* *
**************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "proto.h"
#include <string.h>
#include <stdio.h>
#include "proto.h"
static bool keep_cutbuffer = FALSE;
/* Should we keep the contents of the cutbuffer? */
static filestruct *cutbottom = NULL;
/* Pointer to end of cutbuffer. */
/* Pointer to the end of the cutbuffer. */
/* Indicate that we should no longer keep the contents of the
* cutbuffer. */
void cutbuffer_reset(void)
{
keep_cutbuffer = FALSE;
}
/* If we're not on the magicline, move all the text of the current line,
* plus the newline at the end, to the cutbuffer, and set the current
* place we want to where the line used to start. */
/* If we're not on the last line of the file, move all the text of the
* current line, plus the newline at the end, to the cutbuffer. If we
* are, move all of the text of the current line to the cutbuffer. In
* both cases, set the current place we want to the beginning of the
* current line. */
void cut_line(void)
{
if (openfile->current->next != NULL) {
if (openfile->current != openfile->filebot)
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current, 0,
openfile->current->next, 0);
openfile->placewewant = xplustabs();
}
else
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current, 0,
openfile->current, strlen(openfile->current->data));
openfile->placewewant = 0;
}
#ifndef NANO_SMALL
#ifndef NANO_TINY
/* 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)
@@ -68,9 +72,9 @@ void cut_marked(void)
/* 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. */
* and we're not on the last line of the file, 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(openfile->current->data);
@@ -83,17 +87,17 @@ void cut_to_eol(void)
* the end, to the cutbuffer. */
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
openfile->current_x, openfile->current, data_len);
else if (openfile->current->next != NULL) {
/* If we're at the end of the line, and it isn't the magicline,
* move all the text from the current position up to the
* beginning of the next line, i.e, the newline at the end, to
* the cutbuffer. */
else if (openfile->current != openfile->filebot) {
/* If we're at the end of the line, and it isn't the last line
* of the file, move all the text from the current position up
* to the beginning of the next line, i.e, the newline at the
* end, to the cutbuffer. */
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
openfile->current_x, openfile->current->next, 0);
openfile->placewewant = xplustabs();
}
}
#endif /* !NANO_SMALL */
#endif /* !NANO_TINY */
/* Move text from the current filestruct into the cutbuffer. */
void do_cut_text(void)
@@ -117,7 +121,7 @@ void do_cut_text(void)
* cutbuffer instead of replacing it. */
keep_cutbuffer = TRUE;
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (openfile->mark_set) {
/* If the mark is on, move the marked text to the cutbuffer and
* turn the mark off. */
@@ -140,7 +144,7 @@ void do_cut_text(void)
#endif
}
#ifndef NANO_SMALL
#ifndef NANO_TINY
/* Cut from the current cursor position to the end of the file. */
void do_cut_till_end(void)
{
@@ -149,7 +153,8 @@ void do_cut_till_end(void)
check_statusblank();
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
openfile->current_x, openfile->filebot, 0);
openfile->current_x, openfile->filebot,
strlen(openfile->filebot->data));
edit_refresh();
set_modified();
@@ -158,7 +163,7 @@ void do_cut_till_end(void)
dump_filestruct(cutbuffer);
#endif
}
#endif /* !NANO_SMALL */
#endif /* !NANO_TINY */
/* Copy text from the cutbuffer into the current filestruct. */
void do_uncut_text(void)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

515
src/help.c Normal file
View File

@@ -0,0 +1,515 @@
/* $Id$ */
/**************************************************************************
* help.c *
* *
* Copyright (C) 2000-2004 Chris Allegretta *
* Copyright (C) 2005-2006 David Lawrence Ramsey *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
* 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., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301, USA. *
* *
**************************************************************************/
#include "proto.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#ifndef DISABLE_HELP
static char *help_text = NULL;
/* The text displayed in the help window. */
/* Our dynamic, shortcut-list-compliant help function. */
void do_help(void)
{
int line = 0;
/* The line number in help_text of the first displayed help
* line. This variable is zero-based. */
bool no_more = FALSE;
/* no_more means the end of the help text is shown, so don't go
* down any more. */
int kbinput = ERR;
bool meta_key, func_key;
bool old_no_help = ISSET(NO_HELP);
#ifndef DISABLE_MOUSE
const shortcut *oldshortcut = currshortcut;
/* We will set currshortcut to allow clicking on the help
* screen's shortcut list. */
#endif
curs_set(0);
blank_edit();
wattroff(bottomwin, A_REVERSE);
blank_statusbar();
/* Set help_text as the string to display. */
help_init();
assert(help_text != NULL);
#ifndef DISABLE_MOUSE
/* Set currshortcut to allow clicking on the help screen's shortcut
* list, after help_init() is called. */
currshortcut = help_list;
#endif
if (ISSET(NO_HELP)) {
/* Make sure that the help screen's shortcut list will actually
* be displayed. */
UNSET(NO_HELP);
window_init();
}
bottombars(help_list);
do {
int i;
int old_line = line;
/* We redisplay the help only if it moved. */
const char *ptr = help_text;
switch (kbinput) {
#ifndef DISABLE_MOUSE
case KEY_MOUSE:
{
int mouse_x, mouse_y;
get_mouseinput(&mouse_x, &mouse_y, TRUE);
}
break;
#endif
case NANO_PREVPAGE_KEY:
case NANO_PREVPAGE_FKEY:
if (line > 0) {
line -= editwinrows - 2;
if (line < 0)
line = 0;
}
break;
case NANO_NEXTPAGE_KEY:
case NANO_NEXTPAGE_FKEY:
if (!no_more)
line += editwinrows - 2;
break;
case NANO_PREVLINE_KEY:
if (line > 0)
line--;
break;
case NANO_NEXTLINE_KEY:
if (!no_more)
line++;
break;
}
if (kbinput == NANO_REFRESH_KEY)
/* Redraw the screen. */
total_redraw();
else {
if (kbinput != ERR && line == old_line)
goto skip_redisplay;
blank_edit();
}
/* Calculate where in the text we should be, based on the
* page. */
for (i = 0; i < line; i++) {
ptr += help_line_len(ptr);
if (*ptr == '\n')
ptr++;
}
for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
size_t j = help_line_len(ptr);
mvwaddnstr(edit, i, 0, ptr, j);
ptr += j;
if (*ptr == '\n')
ptr++;
}
no_more = (*ptr == '\0');
skip_redisplay:
kbinput = get_kbinput(edit, &meta_key, &func_key);
} while (kbinput != NANO_EXIT_KEY && kbinput != NANO_EXIT_FKEY);
#ifndef DISABLE_MOUSE
currshortcut = oldshortcut;
#endif
if (old_no_help) {
blank_bottombars();
wnoutrefresh(bottomwin);
SET(NO_HELP);
window_init();
} else
bottombars(currshortcut);
curs_set(1);
edit_refresh();
/* The help_init() at the beginning allocated help_text. Since
* help_text has now been written to the screen, we don't need it
* anymore. */
free(help_text);
help_text = NULL;
}
/* This function allocates help_text, and stores the help string in it.
* help_text should be NULL initially. */
void help_init(void)
{
size_t allocsize = 0; /* Space needed for help_text. */
const char *htx[3]; /* Untranslated help message. We break
* it up into three chunks in case the
* full string is too long for the
* compiler to handle. */
char *ptr;
const shortcut *s;
#ifndef NANO_TINY
const toggle *t;
#ifdef ENABLE_NANORC
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
UNSET(WHITESPACE_DISPLAY);
#endif
#endif
/* First, set up the initial help text for the current function. */
if (currshortcut == whereis_list || currshortcut == replace_list ||
currshortcut == replace_list_2) {
htx[0] = N_("Search Command Help Text\n\n "
"Enter the words or characters you would like to "
"search for, and then press Enter. If there is a "
"match for the text you entered, the screen will be "
"updated to the location of the nearest match for the "
"search string.\n\n The previous search string will be "
"shown in brackets after the search prompt. Hitting "
"Enter without entering any text will perform the "
"previous search. ");
htx[1] = N_("If you have selected text with the mark and then "
"search to replace, only matches in the selected text "
"will be replaced.\n\n The following function keys are "
"available in Search mode:\n\n");
htx[2] = NULL;
} else if (currshortcut == gotoline_list) {
htx[0] = N_("Go To Line Help Text\n\n "
"Enter the line number that you wish to go to and hit "
"Enter. If there are fewer lines of text than the "
"number you entered, you will be brought to the last "
"line of the file.\n\n The following function keys are "
"available in Go To Line mode:\n\n");
htx[1] = NULL;
htx[2] = NULL;
} else if (currshortcut == insertfile_list) {
htx[0] = N_("Insert File Help Text\n\n "
"Type in the name of a file to be inserted into the "
"current file buffer at the current cursor "
"location.\n\n If you have compiled nano with multiple "
"file buffer support, and enable multiple file buffers "
"with the -F or --multibuffer command line flags, the "
"Meta-F toggle, or a nanorc file, inserting a file "
"will cause it to be loaded into a separate buffer "
"(use Meta-< and > to switch between file buffers). ");
htx[1] = N_("If you need another blank buffer, do not enter "
"any filename, or type in a nonexistent filename at "
"the prompt and press Enter.\n\n The following "
"function keys are available in Insert File mode:\n\n");
htx[2] = NULL;
} else if (currshortcut == writefile_list) {
htx[0] = N_("Write File Help Text\n\n "
"Type the name that you wish to save the current file "
"as and press Enter to save the file.\n\n If you have "
"selected text with the mark, you will be prompted to "
"save only the selected portion to a separate file. To "
"reduce the chance of overwriting the current file with "
"just a portion of it, the current filename is not the "
"default in this mode.\n\n The following function keys "
"are available in Write File mode:\n\n");
htx[1] = NULL;
htx[2] = NULL;
}
#ifndef DISABLE_BROWSER
else if (currshortcut == browser_list) {
htx[0] = N_("File Browser Help Text\n\n "
"The file browser is used to visually browse the "
"directory structure to select a file for reading "
"or writing. You may use the arrow keys or Page Up/"
"Down to browse through the files, and S or Enter to "
"choose the selected file or enter the selected "
"directory. To move up one level, select the "
"directory called \"..\" at the top of the file "
"list.\n\n The following function keys are available "
"in the file browser:\n\n");
htx[1] = NULL;
htx[2] = NULL;
} else if (currshortcut == gotodir_list) {
htx[0] = N_("Browser Go To Directory Help Text\n\n "
"Enter the name of the directory you would like to "
"browse to.\n\n If tab completion has not been "
"disabled, you can use the Tab key to (attempt to) "
"automatically complete the directory name.\n\n The "
"following function keys are available in Browser Go "
"To Directory mode:\n\n");
htx[1] = NULL;
htx[2] = NULL;
}
#endif /* !DISABLE_BROWSER */
#ifndef DISABLE_SPELLER
else if (currshortcut == spell_list) {
htx[0] = N_("Spell Check Help Text\n\n "
"The spell checker checks the spelling of all text in "
"the current file. When an unknown word is "
"encountered, it is highlighted and a replacement can "
"be edited. It will then prompt to replace every "
"instance of the given misspelled word in the current "
"file, or, if you have selected text with the mark, in "
"the selected text.\n\n The following other functions "
"are available in Spell Check mode:\n\n");
htx[1] = NULL;
htx[2] = NULL;
}
#endif /* !DISABLE_SPELLER */
#ifndef NANO_TINY
else if (currshortcut == extcmd_list) {
htx[0] = N_("Execute Command Help Text\n\n "
"This menu allows you to insert the output of a "
"command run by the shell into the current buffer (or "
"a new buffer in multiple file buffer mode). If you "
"need another blank buffer, do not enter any "
"command.\n\n The following keys are available in "
"Execute Command mode:\n\n");
htx[1] = NULL;
htx[2] = NULL;
}
#endif /* !NANO_TINY */
else {
/* Default to the main help list. */
htx[0] = N_(" nano help text\n\n "
"The nano editor is designed to emulate the "
"functionality and ease-of-use of the UW Pico text "
"editor. There are four main sections of the editor. "
"The top line shows the program version, the current "
"filename being edited, and whether or not the file "
"has been modified. Next is the main editor window "
"showing the file being edited. The status line is "
"the third line from the bottom and shows important "
"messages. The bottom two lines show the most "
"commonly used shortcuts in the editor.\n\n ");
htx[1] = N_("The notation for shortcuts is as follows: "
"Control-key sequences are notated with a caret (^) "
"symbol and can be entered either by using the Control "
"(Ctrl) key or pressing the Escape (Esc) key twice. "
"Escape-key sequences are notated with the Meta (M) "
"symbol and can be entered using either the Esc, Alt, "
"or Meta key depending on your keyboard setup. ");
htx[2] = N_("Also, pressing Esc twice and then typing a "
"three-digit decimal number from 000 to 255 will enter "
"the character with the corresponding value. The "
"following keystrokes are available in the main editor "
"window. Alternative keys are shown in "
"parentheses:\n\n");
}
htx[0] = _(htx[0]);
if (htx[1] != NULL)
htx[1] = _(htx[1]);
if (htx[2] != NULL)
htx[2] = _(htx[2]);
allocsize += strlen(htx[0]);
if (htx[1] != NULL)
allocsize += strlen(htx[1]);
if (htx[2] != NULL)
allocsize += strlen(htx[2]);
/* The space needed for the shortcut lists, at most COLS characters,
* plus '\n'. */
allocsize += (COLS < 24 ? (24 * mb_cur_max()) :
((COLS + 1) * mb_cur_max())) * length_of_list(currshortcut);
#ifndef NANO_TINY
/* If we're on the main list, we also count the toggle help text.
* Each line has "M-%c\t\t\t", which fills 24 columns, plus a space,
* plus translated text, plus '\n'. */
if (currshortcut == main_list) {
size_t endis_len = strlen(_("enable/disable"));
for (t = toggles; t != NULL; t = t->next)
allocsize += 8 + strlen(t->desc) + endis_len;
}
#endif
/* help_text has been freed and set to NULL unless the user resized
* while in the help screen. */
if (help_text != NULL)
free(help_text);
/* Allocate space for the help text. */
help_text = charalloc(allocsize + 1);
/* Now add the text we want. */
strcpy(help_text, htx[0]);
if (htx[1] != NULL)
strcat(help_text, htx[1]);
if (htx[2] != NULL)
strcat(help_text, htx[2]);
ptr = help_text + strlen(help_text);
/* Now add our shortcut info. Assume that each shortcut has, at the
* very least, an equivalent control key, an equivalent primary meta
* key sequence, or both. Also assume that the meta key values are
* not control characters. We can display a maximum of 3 shortcut
* entries. */
for (s = currshortcut; s != NULL; s = s->next) {
int entries = 0;
/* Control key. */
if (s->ctrlval != NANO_NO_KEY) {
entries++;
/* Yucky sentinel values that we can't handle a better
* way. */
if (s->ctrlval == NANO_CONTROL_SPACE) {
char *space_ptr = display_string(_("Space"), 0, 6,
FALSE);
ptr += sprintf(ptr, "^%s", space_ptr);
free(space_ptr);
} else if (s->ctrlval == NANO_CONTROL_8)
ptr += sprintf(ptr, "^?");
/* Normal values. */
else
ptr += sprintf(ptr, "^%c", s->ctrlval + 64);
*(ptr++) = '\t';
}
/* Function key. */
if (s->funcval != NANO_NO_KEY) {
entries++;
/* If this is the first entry, put it in the middle. */
if (entries == 1) {
entries++;
*(ptr++) = '\t';
}
ptr += sprintf(ptr, "(F%d)", s->funcval - KEY_F0);
*(ptr++) = '\t';
}
/* Primary meta key sequence. If it's the first entry, don't
* put parentheses around it. */
if (s->metaval != NANO_NO_KEY) {
entries++;
/* If this is the last entry, put it at the end. */
if (entries == 2 && s->miscval == NANO_NO_KEY) {
entries++;
*(ptr++) = '\t';
}
/* Yucky sentinel values that we can't handle a better
* way. */
if (s->metaval == NANO_ALT_SPACE && entries == 1) {
char *space_ptr = display_string(_("Space"), 0, 5,
FALSE);
ptr += sprintf(ptr, "M-%s", space_ptr);
free(space_ptr);
} else
/* Normal values. */
ptr += sprintf(ptr, (entries == 1) ? "M-%c" : "(M-%c)",
toupper(s->metaval));
*(ptr++) = '\t';
}
/* Miscellaneous meta key sequence. */
if (entries < 3 && s->miscval != NANO_NO_KEY) {
entries++;
/* If this is the last entry, put it at the end. */
if (entries == 2) {
entries++;
*(ptr++) = '\t';
}
ptr += sprintf(ptr, "(M-%c)", toupper(s->miscval));
*(ptr++) = '\t';
}
/* Make sure all the help text starts at the same place. */
while (entries < 3) {
entries++;
*(ptr++) = '\t';
}
assert(s->help != NULL);
if (COLS > 24) {
char *help_ptr = display_string(s->help, 0, COLS - 24,
FALSE);
ptr += sprintf(ptr, help_ptr);
free(help_ptr);
}
ptr += sprintf(ptr, "\n");
}
#ifndef NANO_TINY
/* And the toggles... */
if (currshortcut == main_list) {
for (t = toggles; t != NULL; t = t->next) {
assert(t->desc != NULL);
ptr += sprintf(ptr, "M-%c\t\t\t%s %s\n", toupper(t->val),
t->desc, _("enable/disable"));
}
}
#ifdef ENABLE_NANORC
if (old_whitespace)
SET(WHITESPACE_DISPLAY);
#endif
#endif
/* If all went well, we didn't overwrite the allocated space for
* help_text. */
assert(strlen(help_text) <= allocsize + 1);
}
/* Calculate the next line of help_text, starting at ptr. */
size_t help_line_len(const char *ptr)
{
int help_cols = (COLS > 24) ? COLS - 8 : 24;
/* Try to break the line at (COLS - 8) columns if we have more than
* 24 columns, and at 24 columns otherwise. */
size_t retval = break_line(ptr, help_cols, TRUE);
size_t retval_save = retval;
/* Get the length of the entire line up to a null or a newline. */
while (*(ptr + retval) != '\0' && *(ptr + retval) != '\n')
retval += move_mbright(ptr + retval, 0);
/* If the entire line doesn't go more than 8 columns beyond where we
* tried to break it, we should display it as-is. Otherwise, we
* should display it only up to the break. */
if (strnlenpt(ptr, retval) > help_cols + 8)
retval = retval_save;
return retval;
}
#endif /* !DISABLE_HELP */

View File

@@ -2,7 +2,8 @@
/**************************************************************************
* move.c *
* *
* Copyright (C) 1999-2005 Chris Allegretta *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 2005 David Lawrence Ramsey *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -20,14 +21,12 @@
* *
**************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "proto.h"
#include <string.h>
#include <ctype.h>
#include "proto.h"
/* Move to the first line of the file. */
void do_first_line(void)
{
const filestruct *current_save = openfile->current;
@@ -42,6 +41,7 @@ void do_first_line(void)
edit_redraw(current_save, pww_save);
}
/* Move to the last line of the file. */
void do_last_line(void)
{
const filestruct *current_save = openfile->current;
@@ -50,13 +50,14 @@ void do_last_line(void)
check_statusblank();
openfile->current = openfile->filebot;
openfile->current_x = 0;
openfile->placewewant = 0;
openfile->current_x = strlen(openfile->filebot->data);
openfile->placewewant = xplustabs();
openfile->current_y = editwinrows - 1;
edit_redraw(current_save, pww_save);
}
/* Move up one page. */
void do_page_up(void)
{
int i;
@@ -77,17 +78,17 @@ void do_page_up(void)
/* If we're not in smooth scrolling mode, put the cursor at the
* beginning of the top line of the edit window, as Pico does. */
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (!ISSET(SMOOTH_SCROLL)) {
#endif
openfile->current = openfile->edittop;
openfile->placewewant = 0;
#ifndef NANO_SMALL
#ifndef NANO_TINY
}
#endif
for (i = editwinrows - 2; i > 0 && openfile->current->prev != NULL;
i--)
for (i = editwinrows - 2; i > 0 && openfile->current !=
openfile->fileage; i--)
openfile->current = openfile->current->prev;
openfile->current_x = actual_x(openfile->current->data,
@@ -97,6 +98,7 @@ void do_page_up(void)
edit_scroll(UP, editwinrows - 2);
}
/* Move down one page. */
void do_page_down(void)
{
int i;
@@ -118,17 +120,17 @@ void do_page_down(void)
/* If we're not in smooth scrolling mode, put the cursor at the
* beginning of the top line of the edit window, as Pico does. */
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (!ISSET(SMOOTH_SCROLL)) {
#endif
openfile->current = openfile->edittop;
openfile->placewewant = 0;
#ifndef NANO_SMALL
#ifndef NANO_TINY
}
#endif
for (i = editwinrows - 2; i > 0 && openfile->current->next != NULL;
i--)
for (i = editwinrows - 2; i > 0 && openfile->current !=
openfile->filebot; i--)
openfile->current = openfile->current->next;
openfile->current_x = actual_x(openfile->current->data,
@@ -139,8 +141,9 @@ void do_page_down(void)
}
#ifndef DISABLE_JUSTIFY
/* Move up to the last beginning-of-paragraph line before the current
* line. */
/* Move up to the beginning of the last beginning-of-paragraph line
* before the current line. If allow_update is TRUE, update the screen
* afterwards. */
void do_para_begin(bool allow_update)
{
const filestruct *current_save = openfile->current;
@@ -148,29 +151,33 @@ void do_para_begin(bool allow_update)
check_statusblank();
openfile->current_x = 0;
openfile->placewewant = 0;
if (openfile->current->prev != NULL) {
if (openfile->current != openfile->fileage) {
do {
openfile->current = openfile->current->prev;
openfile->current_y--;
} while (!begpar(openfile->current));
}
openfile->current_x = 0;
openfile->placewewant = 0;
if (allow_update)
edit_redraw(current_save, pww_save);
}
/* Move up to the beginning of the last beginning-of-paragraph line
* before the current line, and update the screen afterwards. */
void do_para_begin_void(void)
{
do_para_begin(TRUE);
}
/* Move down to the end of a paragraph, then one line farther. A line
* is the last line of a paragraph if it is in a paragraph, and the next
* line either is a beginning-of-paragraph line or isn't in a
* paragraph. */
/* Move down to the beginning of the last line of the current paragraph.
* Then move down one line farther if there is such a line, or to the
* end of the current line if not. If allow_update is TRUE, update the
* screen afterwards. A line is the last line of a paragraph if it is
* in a paragraph, and the next line either is the beginning line of a
* paragraph or isn't in a paragraph. */
void do_para_end(bool allow_update)
{
const filestruct *const current_save = openfile->current;
@@ -178,37 +185,44 @@ void do_para_end(bool allow_update)
check_statusblank();
openfile->current_x = 0;
openfile->placewewant = 0;
while (openfile->current->next != NULL && !inpar(openfile->current))
while (openfile->current != openfile->filebot &&
!inpar(openfile->current))
openfile->current = openfile->current->next;
while (openfile->current->next != NULL &&
while (openfile->current != openfile->filebot &&
inpar(openfile->current->next) &&
!begpar(openfile->current->next)) {
openfile->current = openfile->current->next;
openfile->current_y++;
}
if (openfile->current->next != NULL)
if (openfile->current != openfile->filebot) {
openfile->current = openfile->current->next;
openfile->current_x = 0;
openfile->placewewant = 0;
} else {
openfile->current_x = strlen(openfile->current->data);
openfile->placewewant = xplustabs();
}
if (allow_update)
edit_redraw(current_save, pww_save);
}
/* Move down to the beginning of the last line of the current paragraph.
* Then move down one line farther if there is such a line, or to the
* end of the current line if not, and update the screen afterwards. */
void do_para_end_void(void)
{
do_para_end(TRUE);
}
#endif /* !DISABLE_JUSTIFY */
#ifndef NANO_SMALL
/* Move to the next word in the current filestruct. If allow_punct is
* TRUE, treat punctuation as part of a word. If allow_update is TRUE,
* update the screen afterward. Return TRUE if we started on a word,
* and FALSE otherwise. */
#ifndef NANO_TINY
/* Move to the next word in the file. If allow_punct is TRUE, treat
* punctuation as part of a word. If allow_update is TRUE, update the
* screen afterwards. Return TRUE if we started on a word, and FALSE
* otherwise. */
bool do_next_word(bool allow_punct, bool allow_update)
{
size_t pww_save = openfile->placewewant;
@@ -272,7 +286,7 @@ bool do_next_word(bool allow_punct, bool allow_update)
if (!end_line)
break;
if (openfile->current->next != NULL) {
if (openfile->current != openfile->filebot) {
end_line = FALSE;
openfile->current_x = 0;
}
@@ -295,15 +309,18 @@ bool do_next_word(bool allow_punct, bool allow_update)
return started_on_word;
}
/* Move to the next word in the file, treating punctuation as part of a
* word if the WORD_BOUNDS flag is set, and update the screen
* afterwards. */
void do_next_word_void(void)
{
do_next_word(ISSET(WORD_BOUNDS), TRUE);
}
/* Move to the previous word in the current filestruct. If allow_punct
* is TRUE, treat punctuation as part of a word. If allow_update is
* TRUE, update the screen afterward. Return TRUE if we started on a
* word, and FALSE otherwise. */
/* Move to the previous word in the file. If allow_punct is TRUE, treat
* punctuation as part of a word. If allow_update is TRUE, update the
* screen afterwards. Return TRUE if we started on a word, and FALSE
* otherwise. */
bool do_prev_word(bool allow_punct, bool allow_update)
{
size_t pww_save = openfile->placewewant;
@@ -372,7 +389,7 @@ bool do_prev_word(bool allow_punct, bool allow_update)
if (!begin_line)
break;
if (openfile->current->prev != NULL) {
if (openfile->current != openfile->fileage) {
begin_line = FALSE;
openfile->current_x = strlen(openfile->current->prev->data);
}
@@ -426,19 +443,26 @@ bool do_prev_word(bool allow_punct, bool allow_update)
return started_on_word;
}
/* Move to the previous word in the file, treating punctuation as part
* of a word if the WORD_BOUNDS flag is set, and update the screen
* afterwards. */
void do_prev_word_void(void)
{
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
}
#endif /* !NANO_SMALL */
#endif /* !NANO_TINY */
/* Move to the beginning of the current line. If the SMART_HOME flag is
* set, move to the first non-whitespace character of the current line
* if we're not already there, or to the beginning of the current line
* if we are. */
void do_home(void)
{
size_t pww_save = openfile->placewewant;
check_statusblank();
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (ISSET(SMART_HOME)) {
size_t current_x_save = openfile->current_x;
@@ -453,7 +477,7 @@ void do_home(void)
#endif
openfile->current_x = 0;
openfile->placewewant = 0;
#ifndef NANO_SMALL
#ifndef NANO_TINY
}
#endif
@@ -461,6 +485,7 @@ void do_home(void)
update_line(openfile->current, openfile->current_x);
}
/* Move to the end of the current line. */
void do_end(void)
{
size_t pww_save = openfile->placewewant;
@@ -474,6 +499,7 @@ void do_end(void)
update_line(openfile->current, openfile->current_x);
}
/* Move up one line. */
void do_up(void)
{
check_statusblank();
@@ -483,7 +509,7 @@ void do_up(void)
#endif
/* If we're at the top of the file, get out. */
if (openfile->current->prev == NULL)
if (openfile->current == openfile->fileage)
return;
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
@@ -498,7 +524,7 @@ void do_up(void)
* a page if we're not. */
if (openfile->current_y == 0)
edit_scroll(UP,
#ifndef NANO_SMALL
#ifndef NANO_TINY
ISSET(SMOOTH_SCROLL) ? 1 :
#endif
editwinrows / 2);
@@ -512,6 +538,33 @@ void do_up(void)
}
}
#ifndef NANO_TINY
/* Scroll up one line without scrolling the cursor. */
void do_scroll_up(void)
{
check_statusblank();
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If the top of the file is onscreen, get out. */
if (openfile->edittop == openfile->fileage)
return;
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
/* Move the current line of the edit window up. */
openfile->current = openfile->current->prev;
openfile->current_x = actual_x(openfile->current->data,
openfile->placewewant);
/* Scroll the edit window up one line. */
edit_scroll(UP, 1);
}
#endif /* !NANO_TINY */
/* Move down one line. */
void do_down(void)
{
check_statusblank();
@@ -521,7 +574,7 @@ void do_down(void)
#endif
/* If we're at the bottom of the file, get out. */
if (openfile->current->next == NULL)
if (openfile->current == openfile->filebot)
return;
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
@@ -536,7 +589,7 @@ void do_down(void)
* half a page if we're not. */
if (openfile->current_y == editwinrows - 1)
edit_scroll(DOWN,
#ifndef NANO_SMALL
#ifndef NANO_TINY
ISSET(SMOOTH_SCROLL) ? 1 :
#endif
editwinrows / 2);
@@ -550,6 +603,33 @@ void do_down(void)
}
}
#ifndef NANO_TINY
/* Scroll down one line without scrolling the cursor. */
void do_scroll_down(void)
{
check_statusblank();
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If we're at the bottom of the file, get out. */
if (openfile->current == openfile->filebot)
return;
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
/* Move the current line of the edit window down. */
openfile->current = openfile->current->next;
openfile->current_x = actual_x(openfile->current->data,
openfile->placewewant);
/* Scroll the edit window down one line. */
edit_scroll(DOWN, 1);
}
#endif /* !NANO_TINY */
/* Move left one character. */
void do_left(void)
{
size_t pww_save = openfile->placewewant;
@@ -570,6 +650,7 @@ void do_left(void)
update_line(openfile->current, openfile->current_x);
}
/* Move right one character. */
void do_right(void)
{
size_t pww_save = openfile->placewewant;
@@ -581,7 +662,7 @@ void do_right(void)
if (openfile->current->data[openfile->current_x] != '\0')
openfile->current_x = move_mbright(openfile->current->data,
openfile->current_x);
else if (openfile->current->next != NULL) {
else if (openfile->current != openfile->filebot) {
do_down();
openfile->current_x = 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,8 @@
/**************************************************************************
* nano.h *
* *
* Copyright (C) 1999-2005 Chris Allegretta *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 2005-2006 David Lawrence Ramsey *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -63,15 +64,17 @@
#endif
#ifdef USE_SLANG
/* Slang support enabled. */
/* Slang support. */
#include <slcurses.h>
/* Slang curses emulation brain damage, part 2: Slang doesn't define the
* curses equivalents of the Insert or Delete keys. */
#define KEY_DC SL_KEY_DELETE
#define KEY_IC SL_KEY_IC
/* Ncurses support. */
#elif defined(HAVE_NCURSES_H)
#include <ncurses.h>
#else /* Uh oh. */
#else
/* Curses support. */
#include <curses.h>
#endif /* CURSES_H */
@@ -133,8 +136,6 @@
#define getline ngetline
#endif
#define VERMSG "GNU nano " VERSION
/* If we don't have regex support, turn the color support off, as it
* depends on the use of regexes. */
#ifndef HAVE_REGEX_H
@@ -171,120 +172,168 @@ typedef enum {
/* Structure types. */
typedef struct filestruct {
char *data;
struct filestruct *next; /* Next node. */
struct filestruct *prev; /* Previous node. */
ssize_t lineno; /* The line number. */
/* The text of this line. */
ssize_t lineno;
/* The number of this line. */
struct filestruct *next;
/* Next node. */
struct filestruct *prev;
/* Previous node. */
} filestruct;
typedef struct partition {
filestruct *fileage;
/* The top line of this portion of the file. */
filestruct *top_prev;
/* The line before the top line of this portion of the file. */
char *top_data;
/* The text before the beginning of the top line of this portion
* of the file. */
filestruct *filebot;
/* The bottom line of this portion of the file. */
filestruct *bot_next;
/* The line after the bottom line of this portion of the
* file. */
char *bot_data;
/* The text after the end of the bottom line of this portion of
* the file. */
} partition;
#ifdef ENABLE_COLOR
typedef struct colortype {
short fg; /* Foreground color. */
short bg; /* Background color. */
bool bright; /* Is this color A_BOLD? */
bool icase; /* Is this regex string case
* insensitive? */
int pairnum; /* Color pair number used for this
* foreground/background. */
char *start_regex; /* Start (or all) of the regex
* string. */
regex_t *start; /* Compiled start (or all) of the regex
* string. */
char *end_regex; /* End (if any) of the regex string. */
regex_t *end; /* Compiled end (if any) of the regex
* string. */
short fg;
/* This syntax's foreground color. */
short bg;
/* This syntax's background color. */
bool bright;
/* Is this color A_BOLD? */
bool icase;
/* Is this regex string case insensitive? */
int pairnum;
/* The color pair number used for this foreground color and
* background color. */
char *start_regex;
/* The start (or all) of the regex string. */
regex_t *start;
/* The compiled start (or all) of the regex string. */
char *end_regex;
/* The end (if any) of the regex string. */
regex_t *end;
/* The compiled end (if any) of the regex string. */
struct colortype *next;
/* Next set of colors. */
} colortype;
typedef struct exttype {
char *ext_regex; /* Extensions that match this syntax. */
regex_t *ext; /* Compiled extensions that match this
* syntax. */
char *ext_regex;
/* The extensions that match this syntax. */
regex_t *ext;
/* The compiled extensions that match this syntax. */
struct exttype *next;
/* Next set of extensions. */
} exttype;
typedef struct syntaxtype {
char *desc; /* Name of this syntax type. */
exttype *extensions; /* List of extensions that this syntax
* applies to. */
colortype *color; /* Color struct for this syntax. */
char *desc;
/* The name of this syntax. */
exttype *extensions;
/* The list of extensions that this syntax applies to. */
colortype *color;
/* The colors used in this syntax. */
struct syntaxtype *next;
/* Next syntax. */
} syntaxtype;
#endif /* ENABLE_COLOR */
typedef struct openfilestruct {
char *filename; /* Current file's name. */
filestruct *fileage; /* Current file's first line. */
filestruct *filebot; /* Current file's last line. */
filestruct *edittop; /* Current top of edit window. */
filestruct *current; /* Current file's line. */
size_t totsize; /* Current file's total number of
* characters. */
size_t current_x; /* Current file's x-coordinate
* position. */
size_t placewewant; /* Current file's place we want. */
ssize_t current_y; /* Current file's y-coordinate
* position. */
bool modified; /* Current file's modification
* status. */
#ifndef NANO_SMALL
bool mark_set; /* Current file's marking status. */
filestruct *mark_begin; /* Current file's beginning marked
* line. */
size_t mark_begin_x; /* Current file's beginning marked
* line's x-coordinate position. */
file_format fmt; /* Current file's format. */
struct stat *current_stat; /* Current file's stat. */
char *filename;
/* The current file's name. */
filestruct *fileage;
/* The current file's first line. */
filestruct *filebot;
/* The current file's last line. */
filestruct *edittop;
/* The current top of the edit window. */
filestruct *current;
/* The current file's current line. */
size_t totsize;
/* The current file's total number of characters. */
size_t current_x;
/* The current file's x-coordinate position. */
size_t placewewant;
/* The current file's place we want. */
ssize_t current_y;
/* The current file's y-coordinate position. */
bool modified;
/* Whether the current file has been modified. */
#ifndef NANO_TINY
bool mark_set;
/* Whether the mark is on in the current file. */
filestruct *mark_begin;
/* The current file's beginning marked line, if any. */
size_t mark_begin_x;
/* The current file's beginning marked line's x-coordinate
* position, if any. */
file_format fmt;
/* The current file's format. */
struct stat *current_stat;
/* The current file's stat. */
#endif
#ifdef ENABLE_COLOR
colortype *colorstrings; /* Current file's associated colors. */
colortype *colorstrings;
/* The current file's associated colors. */
#endif
struct openfilestruct *next;
/* Next node. */
/* Next node. */
struct openfilestruct *prev;
/* Previous node. */
/* Previous node. */
} openfilestruct;
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
* bound. */
int metaval; /* Meta key we want bound. */
int funcval; /* Function key we want bound. */
int miscval; /* Other Meta key we want bound. */
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". */
int ctrlval;
/* The special sentinel key or control key we want bound, if
* any. */
int metaval;
/* The meta key we want bound, if any. */
int funcval;
/* The function key we want bound, if any. */
int miscval;
/* The other meta key we want bound, if any. */
bool viewok;
/* Is this function allowed when in view mode? */
void (*func)(void);
/* The function to call when we get this key. */
const char *desc;
/* The function's description, e.g. "Page Up". */
#ifndef DISABLE_HELP
const char *help; /* Help file entry text. */
const char *help;
/* The help file entry text for this function. */
#endif
struct shortcut *next;
/* Next shortcut. */
} shortcut;
#ifndef NANO_SMALL
#ifndef NANO_TINY
typedef struct toggle {
int val; /* Sequence to toggle the key. Should only need
* one. */
const char *desc; /* Description for when toggle is, uh, toggled,
* e.g. "Cut to end"; we'll append Enabled or
* Disabled. */
long flag; /* What flag actually gets toggled. */
int val;
/* The sequence to toggle the key. We should only need one. */
const char *desc;
/* The description for when the toggle is, uh, toggled, e.g.
* "Cut to end"; we'll append Enabled or Disabled. */
long flag;
/* Which flag actually gets toggled. */
struct toggle *next;
/* Next toggle. */
} toggle;
#endif
#ifdef ENABLE_NANORC
typedef struct rcoption {
const char *name;
/* The name of the rcfile option. */
long flag;
/* The flag associated with it, if any. */
} rcoption;
#endif
@@ -320,7 +369,8 @@ typedef struct rcoption {
#define TABS_TO_SPACES (1<<27)
#define QUICK_BLANK (1<<28)
#define WORD_BOUNDS (1<<29)
#define USE_UTF8 (1<<30)
#define NO_NEWLINES (1<<30)
#define USE_UTF8 (1<<31)
/* Control key sequences. Changing these would be very, very bad. */
#define NANO_CONTROL_SPACE 0
@@ -360,13 +410,17 @@ typedef struct rcoption {
#define NANO_ALT_SPACE ' '
#define NANO_ALT_LPAREN '('
#define NANO_ALT_RPAREN ')'
#define NANO_ALT_PLUS '+'
#define NANO_ALT_COMMA ','
#define NANO_ALT_MINUS '-'
#define NANO_ALT_PERIOD '.'
#define NANO_ALT_9 '9'
#define NANO_ALT_0 '0'
#define NANO_ALT_LCARAT '<'
#define NANO_ALT_EQUALS '='
#define NANO_ALT_RCARAT '>'
#define NANO_ALT_RBRACKET ']'
#define NANO_ALT_USCORE '_'
#define NANO_ALT_A 'a'
#define NANO_ALT_B 'b'
#define NANO_ALT_C 'c'
@@ -446,8 +500,8 @@ typedef struct rcoption {
#define NANO_REFRESH_KEY NANO_CONTROL_L
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
#define NANO_JUSTIFY_FKEY KEY_F(4)
#define NANO_UNJUSTIFY_KEY NANO_UNCUT_KEY /* Same key as uncut. */
#define NANO_UNJUSTIFY_FKEY NANO_UNCUT_FKEY /* Same key as uncut. */
#define NANO_UNJUSTIFY_KEY NANO_UNCUT_KEY
#define NANO_UNJUSTIFY_FKEY NANO_UNCUT_FKEY
#define NANO_PREVLINE_KEY NANO_CONTROL_P
#define NANO_NEXTLINE_KEY NANO_CONTROL_N
#define NANO_FORWARD_KEY NANO_CONTROL_F
@@ -473,6 +527,10 @@ typedef struct rcoption {
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
#define NANO_WORDCOUNT_KEY NANO_ALT_D
#define NANO_SCROLLUP_KEY NANO_ALT_MINUS
#define NANO_SCROLLDOWN_KEY NANO_ALT_PLUS
#define NANO_SCROLLUP_ALTKEY NANO_ALT_USCORE
#define NANO_SCROLLDOWN_ALTKEY NANO_ALT_EQUALS
#define NANO_CUTTILLEND_KEY NANO_CONTROL_X
#define NANO_CUTTILLEND_ALTKEY NANO_ALT_T
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
@@ -485,8 +543,8 @@ typedef struct rcoption {
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
#define NANO_VERBATIM_KEY NANO_ALT_V
#ifndef NANO_SMALL
/* Toggles do not exist with NANO_SMALL. */
#ifndef NANO_TINY
/* Toggles do not exist with NANO_TINY. */
#define TOGGLE_CONST_KEY NANO_ALT_C
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
#define TOGGLE_SUSPEND_KEY NANO_ALT_Z
@@ -507,28 +565,30 @@ typedef struct rcoption {
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
#define TOGGLE_TABSTOSPACES_KEY NANO_ALT_Q
#endif /* !NANO_SMALL */
#endif /* !NANO_TINY */
#define MAIN_VISIBLE 12
#define VIEW TRUE
#define NOVIEW FALSE
/* Minimum editor window rows required for nano to work correctly. */
/* The minimum editor window columns and rows required for nano to work
* correctly. */
#define MIN_EDITOR_COLS 4
#define MIN_EDITOR_ROWS 1
/* Default number of characters from end-of-line where text wrapping
* occurs. */
/* The default number of characters from the end of the line where
* wrapping occurs. */
#define CHARS_FROM_EOL 8
/* Default width of a tab. */
/* The default width of a tab in spaces. */
#define WIDTH_OF_TAB 8
/* Maximum number of search/replace history strings saved, not counting
* the blank lines at their ends. */
/* The maximum number of search/replace history strings saved, not
* counting the blank lines at their ends. */
#define MAX_SEARCH_HISTORY 100
/* Maximum number of bytes we read from a file at one time. */
/* The maximum number of bytes buffered at one time. */
#define MAX_BUF_SIZE 128
#endif /* !NANO_H */

1318
src/prompt.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,8 @@
/**************************************************************************
* proto.h *
* *
* Copyright (C) 1999-2005 Chris Allegretta *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 2005-2006 David Lawrence Ramsey *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -23,19 +24,35 @@
#ifndef PROTO_H
#define PROTO_H 1
/* Externs. */
#include "nano.h"
/* Public externs. See global.c for descriptions of them. */
#ifndef DISABLE_WRAPJUSTIFY
extern ssize_t fill;
extern ssize_t wrap_at;
#endif
extern int editwinrows;
extern long flags;
extern ssize_t tabsize;
extern int currslen;
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
extern char *last_search;
extern char *last_replace;
extern long flags;
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;
extern filestruct *cutbuffer;
#ifndef DISABLE_JUSTIFY
extern filestruct *jusbuffer;
#endif
extern partition *filepart;
extern openfilestruct *openfile;
#ifndef NANO_TINY
extern char *matchbrackets;
#endif
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
extern char *whitespace;
extern int whitespace_len[2];
#endif
@@ -53,45 +70,30 @@ extern size_t quotelen;
#endif
#endif
#ifndef NANO_SMALL
extern char *answer;
extern ssize_t tabsize;
#ifndef NANO_TINY
extern char *backup_dir;
#endif
extern WINDOW *topwin, *edit, *bottomwin;
extern char *answer;
#ifndef DISABLE_HELP
extern char *help_text;
#endif
extern char *last_search;
extern char *last_replace;
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
extern char *full_operating_dir;
#endif
#ifndef DISABLE_SPELLER
extern char *alt_speller;
#endif
extern struct stat fileinfo;
extern filestruct *cutbuffer;
#ifndef DISABLE_JUSTIFY
extern filestruct *jusbuffer;
#endif
extern partition *filepart;
extern openfilestruct *openfile;
#ifdef ENABLE_COLOR
extern syntaxtype *syntaxes;
extern char *syntaxstr;
#endif
extern shortcut *shortcut_list;
extern shortcut *main_list, *whereis_list;
extern shortcut *replace_list, *gotoline_list;
extern shortcut *writefile_list, *insertfile_list;
extern shortcut *main_list;
extern shortcut *whereis_list;
extern shortcut *replace_list;
extern shortcut *replace_list_2;
#ifndef NANO_SMALL
extern shortcut *gotoline_list;
extern shortcut *writefile_list;
extern shortcut *insertfile_list;
#ifndef NANO_TINY
extern shortcut *extcmd_list;
#endif
#ifndef DISABLE_HELP
@@ -101,25 +103,21 @@ extern shortcut *help_list;
extern shortcut *spell_list;
#endif
#ifndef DISABLE_BROWSER
extern shortcut *browser_list, *gotodir_list;
extern shortcut *browser_list;
extern shortcut *gotodir_list;
#endif
#ifdef ENABLE_COLOR
extern syntaxtype *syntaxes;
extern char *syntaxstr;
#endif
extern const shortcut *currshortcut;
#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
extern regmatch_t regmatches[10];
#ifdef ENABLE_COLOR
extern regex_t syntaxfile_regexp;
extern regmatch_t synfilematches[1];
#endif /* ENABLE_COLOR */
#endif /* HAVE_REGEX_H */
#ifndef NANO_SMALL
#ifndef NANO_TINY
extern toggle *toggles;
#endif
#ifndef NANO_SMALL
#ifndef NANO_TINY
extern filestruct *search_history;
extern filestruct *searchage;
extern filestruct *searchbot;
@@ -128,11 +126,24 @@ extern filestruct *replaceage;
extern filestruct *replacebot;
#endif
#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
extern regmatch_t regmatches[10];
#endif
extern bool curses_ended;
extern char *homedir;
/* The functions we want available. */
/* Public functions in browser.c. */
#ifndef DISABLE_BROWSER
char *do_browser(char *path, DIR *dir);
char *do_browse_from(const char *inpath);
void browser_init(const char *path, DIR *dir);
void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key);
void browser_refresh(void);
void striponedir(char *path);
#endif
/* Public functions in chars.c. */
#ifndef HAVE_ISBLANK
@@ -175,11 +186,11 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n);
const char *nstrcasestr(const char *haystack, const char *needle);
#endif
const char *mbstrcasestr(const char *haystack, const char *needle);
#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
const char *revstrstr(const char *haystack, const char *needle, const
char *rev_start);
#endif
#ifndef NANO_SMALL
#ifndef NANO_TINY
const char *revstrcasestr(const char *haystack, const char *needle,
const char *rev_start);
const char *mbrevstrcasestr(const char *haystack, const char *needle,
@@ -190,13 +201,20 @@ size_t mbstrlen(const char *s);
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);
#ifdef ENABLE_NANORC
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
char *mbstrchr(const char *s, const char *c);
#endif
#ifndef NANO_TINY
char *mbstrpbrk(const char *s, const char *accept);
char *revstrpbrk(const char *s, const char *accept, const char
*rev_start);
char *mbrevstrpbrk(const char *s, const char *accept, const char
*rev_start);
#endif
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
bool has_blank_chars(const char *s);
bool has_blank_mbchars(const char *s);
#endif
#endif
#ifdef ENABLE_UTF8
bool is_valid_unicode(wchar_t wc);
#endif
@@ -209,17 +227,17 @@ bool is_valid_mbstring(const char *s);
void set_colorpairs(void);
void color_init(void);
void color_update(void);
#endif /* ENABLE_COLOR */
#endif
/* Public functions in cut.c. */
void cutbuffer_reset(void);
void cut_line(void);
#ifndef NANO_SMALL
#ifndef NANO_TINY
void cut_marked(void);
void cut_to_eol(void);
#endif
void do_cut_text(void);
#ifndef NANO_SMALL
#ifndef NANO_TINY
void do_cut_till_end(void);
#endif
void do_uncut_text(void);
@@ -229,6 +247,9 @@ void make_new_buffer(void);
void initialize_buffer(void);
void initialize_buffer_text(void);
void open_buffer(const char *filename);
#ifndef DISABLE_SPELLER
void replace_buffer(const char *filename);
#endif
void display_buffer(void);
#ifdef ENABLE_MULTIBUFFER
void switch_to_prevnext_buffer(bool next);
@@ -242,7 +263,7 @@ 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, const char *suffix);
void do_insertfile(
#ifndef NANO_SMALL
#ifndef NANO_TINY
bool execute
#else
void
@@ -256,13 +277,13 @@ char *safe_tempfile(FILE **f);
void init_operating_dir(void);
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
#endif
#ifndef NANO_SMALL
#ifndef NANO_TINY
void init_backup_dir(void);
#endif
int copy_file(FILE *inn, FILE *out);
int write_file(const char *name, FILE *f_open, bool tmp, append_type
append, bool nonamechange);
#ifndef NANO_SMALL
#ifndef NANO_TINY
int write_marked_file(const char *name, FILE *f_open, bool tmp,
append_type append);
#endif
@@ -276,19 +297,13 @@ void free_chararray(char **array, size_t len);
#ifndef DISABLE_TABCOMP
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);
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
*num_matches, size_t buflen);
char *input_tab(char *buf, bool allow_files, size_t *place, bool
*lastwastab, void (*refresh_func)(void), bool *list);
#endif
const char *tail(const char *foo);
#ifndef DISABLE_BROWSER
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)
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
char *histfilename(void);
void load_history(void);
bool writehist(FILE *hist, filestruct *histhead);
@@ -297,7 +312,7 @@ void save_history(void);
/* Public functions in global.c. */
size_t length_of_list(const shortcut *s);
#ifndef NANO_SMALL
#ifndef NANO_TINY
void toggle_init_one(int val, const char *desc, long flag);
void toggle_init(void);
#endif
@@ -313,6 +328,13 @@ void free_shortcutage(shortcut **shortcutage);
void thanks_for_all_the_fish(void);
#endif
/* Public functions in help.c. */
#ifndef DISABLE_HELP
void do_help(void);
void help_init(void);
size_t help_line_len(const char *ptr);
#endif
/* Public functions in move.c. */
void do_first_line(void);
void do_last_line(void);
@@ -324,7 +346,7 @@ void do_para_begin_void(void);
void do_para_end(bool allow_update);
void do_para_end_void(void);
#endif
#ifndef NANO_SMALL
#ifndef NANO_TINY
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
bool do_prev_word(bool allow_punct, bool allow_update);
@@ -333,7 +355,13 @@ void do_prev_word_void(void);
void do_home(void);
void do_end(void);
void do_up(void);
#ifndef NANO_TINY
void do_scroll_up(void);
#endif
void do_down(void);
#ifndef NANO_TINY
void do_scroll_down(void);
#endif
void do_left(void);
void do_right(void);
@@ -369,9 +397,6 @@ void window_init(void);
#ifndef DISABLE_MOUSE
void mouse_init(void);
#endif
#ifndef DISABLE_HELP
void help_init(void);
#endif
void print1opt_full(const char *shortflag
#ifdef HAVE_GETOPT_LONG
, const char *longflag
@@ -382,22 +407,21 @@ void version(void);
int no_more_space(void);
int no_help(void);
void nano_disabled_msg(void);
void do_verbatim_input(void);
void do_exit(void);
void signal_init(void);
void handle_hupterm(int signal);
void do_suspend(int signal);
void do_cont(int signal);
#ifndef NANO_SMALL
void handle_sigwinch(int s);
RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_continue(int signal);
#ifndef NANO_TINY
RETSIGTYPE handle_sigwinch(int signal);
void allow_pending_sigwinch(bool allow);
#endif
#ifndef NANO_SMALL
#ifndef NANO_TINY
void do_toggle(const toggle *which);
#endif
void disable_extended_io(void);
void disable_signals(void);
#ifndef NANO_SMALL
#ifndef NANO_TINY
void enable_signals(void);
#endif
void disable_flow_control(void);
@@ -410,6 +434,62 @@ bool do_mouse(void);
#endif
void do_output(char *output, size_t output_len, bool allow_cntrls);
/* Public functions in prompt.c. */
int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
bool *ran_func, bool *finished, bool allow_funcs, void
(*refresh_func)(void));
#ifndef DISABLE_MOUSE
bool do_statusbar_mouse(void);
#endif
void do_statusbar_output(char *output, size_t output_len, bool
*got_enter, bool allow_cntrls);
void do_statusbar_home(void);
void do_statusbar_end(void);
void do_statusbar_left(void);
void do_statusbar_right(void);
void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
#ifndef NANO_TINY
bool do_statusbar_next_word(bool allow_punct);
bool do_statusbar_prev_word(bool allow_punct);
#endif
void do_statusbar_verbatim_input(bool *got_enter);
#ifndef NANO_TINY
bool find_statusbar_bracket_match(bool reverse, const char
*bracket_set);
void do_statusbar_find_bracket(void);
#endif
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
void update_statusbar_line(const char *curranswer, size_t index);
void reset_statusbar_cursor(void);
bool need_statusbar_horizontal_update(size_t old_pww);
int get_prompt_string(bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool allow_files,
#endif
const char *curranswer,
#ifndef NANO_TINY
filestruct **history_list,
#endif
void (*refresh_func)(void), const shortcut *s
#ifndef DISABLE_TABCOMP
, bool *list
#endif
);
int do_prompt(bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool allow_files,
#endif
const shortcut *s, const char *curranswer,
#ifndef NANO_TINY
filestruct **history_list,
#endif
void (*refresh_func)(void), const char *msg, ...);
void do_prompt_abort(void);
int do_yesno_prompt(bool all, const char *msg);
/* Public functions in rcfile.c. */
#ifdef ENABLE_NANORC
void rcfile_error(const char *msg, ...);
@@ -421,10 +501,10 @@ char *parse_next_regex(char *ptr);
bool nregcomp(const char *regex, int eflags);
void parse_syntax(char *ptr);
void parse_colors(char *ptr, bool icase);
#endif /* ENABLE_COLOR */
#endif
void parse_rcfile(FILE *rcstream);
void do_rcfile(void);
#endif /* ENABLE_NANORC */
#endif
/* Public functions in search.c. */
#ifdef HAVE_REGEX_H
@@ -432,37 +512,41 @@ int regexp_init(const char *regexp);
void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
void search_abort(void);
void search_replace_abort(void);
void search_init_globals(void);
int search_init(bool replacing, bool use_answer);
bool findnextstr(bool can_display_wrap, bool wholeword, bool
no_sameline, const filestruct *begin, size_t begin_x, const char
*needle, size_t *needle_len);
bool findnextstr(
#ifndef DISABLE_SPELLER
bool whole_word,
#endif
bool no_sameline, const filestruct *begin, size_t begin_x, const
char *needle, size_t *needle_len);
void findnextstr_wrap_reset(void);
void do_search(void);
#ifndef NANO_SMALL
#ifndef NANO_TINY
void do_research(void);
#endif
void replace_abort(void);
#ifdef HAVE_REGEX_H
int replace_regexp(char *string, bool create);
#endif
char *replace_line(const char *needle);
ssize_t do_replace_loop(const char *needle, const filestruct
*real_current, size_t *real_current_x, bool wholewords, bool
*canceled);
ssize_t do_replace_loop(
#ifndef DISABLE_SPELLER
bool whole_word,
#endif
bool *canceled, const filestruct *real_current, size_t
*real_current_x, const char *needle);
void do_replace(void);
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive, bool save_pos, bool allow_update);
void do_gotolinecolumn_void(void);
#ifndef DISABLE_SPELLER
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
pos_pww);
#endif
#ifndef NANO_SMALL
#ifdef HAVE_REGEX_H
#ifndef NANO_TINY
bool find_bracket_match(bool reverse, const char *bracket_set);
void do_find_bracket(void);
#endif
#ifdef ENABLE_NANORC
bool history_has_changed(void);
#endif
@@ -476,28 +560,32 @@ char *get_history_newer(filestruct **h);
#ifndef DISABLE_TABCOMP
char *get_history_completion(filestruct **h, const char *s, size_t len);
#endif
#endif /* !NANO_SMALL */
#endif
/* Public functions in text.c. */
#ifndef NANO_SMALL
#ifndef NANO_TINY
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
void do_tab(void);
void do_enter(void);
#ifndef NANO_SMALL
void cancel_command(int signal);
#ifndef NANO_TINY
RETSIGTYPE cancel_command(int signal);
bool execute_command(const char *command);
#endif
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(filestruct *line);
#endif
#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
ssize_t break_line(const char *line, ssize_t goal, bool newline);
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
ssize_t break_line(const char *line, ssize_t goal
#ifndef DISABLE_HELP
, bool newline
#endif
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
);
#endif
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
size_t indent_length(const char *line);
#endif
#ifndef DISABLE_JUSTIFY
@@ -509,22 +597,22 @@ 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);
bool inpar(const filestruct *const foo);
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
quote_len);
void backup_lines(filestruct *first_line, size_t par_len);
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 */
#endif
#ifndef DISABLE_SPELLER
bool do_int_spell_fix(const char *word);
const char *do_int_speller(const char *tempfile_name);
const char *do_alt_speller(char *tempfile_name);
void do_spell(void);
#endif
#ifndef NANO_SMALL
#ifndef NANO_TINY
void do_wordlinechar_count(void);
#endif
void do_verbatim_input(void);
/* Public functions in utils.c. */
int digits(size_t n);
@@ -535,22 +623,24 @@ void align(char **str);
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#ifndef HAVE_GETLINE
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
#endif
#ifndef HAVE_GETDELIM
ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
#endif
#endif /* !NANO_SMALL && ENABLE_NANORC */
#endif
#ifdef HAVE_REGEX_H
#ifdef BROKEN_REGEXEC
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags);
#endif
int regexp_bol_or_eol(const regex_t *preg, const char *string);
bool regexp_bol_or_eol(const regex_t *preg, const char *string);
#endif
#ifndef DISABLE_SPELLER
bool is_whole_word(size_t pos, const char *buf, const char *word);
#endif
const char *strstrwrapper(const char *haystack, const char *needle,
const char *start);
void nperror(const char *s);
@@ -559,16 +649,28 @@ 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);
size_t get_page_start(size_t column);
size_t xplustabs(void);
size_t actual_x(const char *s, size_t column);
size_t strnlenpt(const char *s, size_t maxlen);
size_t strlenpt(const char *s);
void new_magicline(void);
#ifndef NANO_SMALL
#ifndef NANO_TINY
void remove_magicline(void);
void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x, bool *right_side_up);
#endif
size_t get_totsize(const filestruct *begin, const filestruct *end);
#ifndef NDEBUG
int check_linenumbers(const filestruct *fileptr);
#endif
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
/* Public functions in winio.c. */
#ifndef NANO_SMALL
#ifndef NANO_TINY
void reset_kbinput(void);
#endif
void get_key_buffer(WINDOW *win);
@@ -578,7 +680,7 @@ 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
#ifndef NANO_TINY
, bool reset
#endif
);
@@ -586,12 +688,12 @@ 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
#ifndef NANO_TINY
, bool reset
#endif
);
long get_unicode_kbinput(int kbinput
#ifndef NANO_SMALL
#ifndef NANO_TINY
, bool reset
#endif
);
@@ -604,32 +706,9 @@ 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
#ifndef NANO_TINY
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_output(char *output, size_t output_len, bool
*got_enter, bool allow_cntrls);
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
bool do_statusbar_next_word(bool allow_punct);
bool do_statusbar_prev_word(bool allow_punct);
#endif
void do_statusbar_verbatim_input(bool *got_enter);
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_line(WINDOW *win, int y, int x, int n);
void blank_titlebar(void);
void blank_topbar(void);
@@ -639,31 +718,14 @@ void blank_bottombars(void);
void check_statusblank(void);
char *display_string(const char *buf, size_t start_col, size_t len, bool
dollars);
void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
#ifndef NANO_SMALL
filestruct **history_list,
#endif
const shortcut *s
#ifndef DISABLE_TABCOMP
, bool *list
#endif
);
int statusq(bool allow_tabs, const shortcut *s, const char *curranswer,
#ifndef NANO_SMALL
filestruct **history_list,
#endif
const char *msg, ...);
void statusq_abort(void);
void titlebar(const char *path);
void set_modified(void);
void statusbar(const char *msg, ...);
void bottombars(const shortcut *s);
void onekey(const char *keystroke, const char *desc, size_t len);
size_t get_page_start(size_t column);
void reset_cursor(void);
void edit_add(const filestruct *fileptr, const char *converted, int
yval, size_t start);
void edit_draw(const filestruct *fileptr, const char *converted, int
line, size_t start);
void update_line(const filestruct *fileptr, size_t index);
bool need_horizontal_update(size_t old_pww);
bool need_vertical_update(size_t old_pww);
@@ -671,24 +733,12 @@ void edit_scroll(scroll_dir direction, ssize_t nlines);
void edit_redraw(const filestruct *old_current, size_t old_pww);
void edit_refresh(void);
void edit_update(update_type location);
int do_yesno(bool all, const char *msg);
void total_redraw(void);
void total_refresh(void);
void display_main_list(void);
void do_cursorpos(bool constant);
void do_cursorpos_void(void);
#ifndef DISABLE_HELP
size_t help_line_len(const char *ptr);
void do_help(void);
#endif
void do_replace_highlight(bool highlight, const char *word);
#ifndef NDEBUG
int check_linenumbers(const filestruct *fileptr);
#endif
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
#ifdef NANO_EXTRA
void do_credits(void);
#endif

View File

@@ -2,7 +2,8 @@
/**************************************************************************
* rcfile.c *
* *
* Copyright (C) 1999-2005 Chris Allegretta *
* Copyright (C) 2001-2004 Chris Allegretta *
* Copyright (C) 2005-2006 David Lawrence Ramsey *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -20,9 +21,7 @@
* *
**************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "proto.h"
#include <stdarg.h>
#include <string.h>
@@ -30,7 +29,6 @@
#include <errno.h>
#include <unistd.h>
#include <ctype.h>
#include "proto.h"
#ifdef ENABLE_NANORC
@@ -51,6 +49,7 @@ const static rcoption rcopts[] = {
{"morespace", MORE_SPACE},
{"nofollow", NOFOLLOW_SYMLINKS},
{"nohelp", NO_HELP},
{"nonewlines", NO_NEWLINES},
#ifndef DISABLE_WRAPPING
{"nowrap", NO_WRAP},
#endif
@@ -74,7 +73,7 @@ const static rcoption rcopts[] = {
{"tabsize", 0},
{"tempfile", TEMP_FILE},
{"view", VIEW_MODE},
#ifndef NANO_SMALL
#ifndef NANO_TINY
{"autoindent", AUTOINDENT},
{"backup", BACKUP_FILE},
{"backupdir", 0},
@@ -82,6 +81,7 @@ const static rcoption rcopts[] = {
{"casesensitive", CASE_SENSITIVE},
{"cut", CUT_TO_END},
{"historylog", HISTORYLOG},
{"matchbrackets", 0},
{"noconvert", NO_CONVERT},
{"quickblank", QUICK_BLANK},
{"smarthome", SMART_HOME},
@@ -94,8 +94,12 @@ const static rcoption rcopts[] = {
};
static bool errors = FALSE;
/* Whether we got any errors while parsing an rcfile. */
static size_t lineno = 0;
/* If we did, the line number where the current error
* occurred. */
static char *nanorc = NULL;
/* The path to the rcfile we're parsing. */
#ifdef ENABLE_COLOR
static syntaxtype *endsyntax = NULL;
/* The end of the list of syntaxes. */
@@ -104,7 +108,7 @@ static colortype *endcolor = NULL;
#endif
/* We have an error in some part of the rcfile. Put it on stderr and
* make the user hit Return to continue starting up nano. */
* make the user hit Enter to continue starting up nano. */
void rcfile_error(const char *msg, ...)
{
va_list ap;
@@ -141,13 +145,10 @@ char *parse_next_word(char *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. */
/* Parse an argument, with optional quotes, after a keyword that takes
* one. If the next word starts with a ", we say that it ends with the
* last " of the line. Otherwise, we interpret it as usual, so that the
* arguments can contain "'s too. */
char *parse_argument(char *ptr)
{
const char *ptr_bak = ptr;
@@ -181,6 +182,8 @@ char *parse_argument(char *ptr)
}
#ifdef ENABLE_COLOR
/* Return the short value corresponding to the color named in colorname,
* and set bright to TRUE if that color is bright. */
short color_to_short(const char *colorname, bool *bright)
{
short mcolor = -1;
@@ -218,6 +221,7 @@ short color_to_short(const char *colorname, bool *bright)
return mcolor;
}
/* Parse the next regex string from the line at ptr, and return it. */
char *parse_next_regex(char *ptr)
{
assert(ptr != NULL);
@@ -266,6 +270,8 @@ bool nregcomp(const char *regex, int eflags)
return (rc == 0);
}
/* Parse the next syntax string from the line at ptr, and add it to the
* global list of color syntaxes. */
void parse_syntax(char *ptr)
{
const char *fileregptr = NULL, *nameptr = NULL;
@@ -373,8 +379,9 @@ void parse_syntax(char *ptr)
}
}
/* Parse the color stuff into the colorstrings array. If icase is TRUE,
* treat the color stuff as case insensitive. */
/* Parse the color string in the line at ptr, and add it to the current
* file's associated colors. If icase is TRUE, treat the color string
* as case insensitive. */
void parse_colors(char *ptr, bool icase)
{
short fg, bg;
@@ -530,7 +537,8 @@ void parse_colors(char *ptr, bool icase)
}
#endif /* ENABLE_COLOR */
/* Parse the rcfile, once it has been opened successfully. */
/* Parse the rcfile, once it has been opened successfully at
* rcstream. */
void parse_rcfile(FILE *rcstream)
{
char *buf = NULL;
@@ -638,8 +646,18 @@ void parse_rcfile(FILE *rcstream)
free(option);
} else
#endif
#ifndef NANO_SMALL
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
#ifndef NANO_TINY
if (strcasecmp(rcopts[i].name,
"matchbrackets") == 0) {
matchbrackets = option;
if (has_blank_mbchars(matchbrackets)) {
rcfile_error(
N_("Non-blank characters required"));
free(matchbrackets);
matchbrackets = NULL;
}
} else if (strcasecmp(rcopts[i].name,
"whitespace") == 0) {
whitespace = option;
if (mbstrlen(whitespace) != 2 ||
strlenpt(whitespace) != 2) {
@@ -680,7 +698,7 @@ void parse_rcfile(FILE *rcstream)
quotestr = option;
else
#endif
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (strcasecmp(rcopts[i].name,
"backupdir") == 0)
backup_dir = option;
@@ -725,7 +743,7 @@ void parse_rcfile(FILE *rcstream)
if (errors) {
errors = FALSE;
fprintf(stderr, _("\nPress Return to continue starting nano\n"));
fprintf(stderr, _("\nPress Enter to continue starting nano\n"));
while (getchar() != '\n')
;
}
@@ -733,14 +751,13 @@ void parse_rcfile(FILE *rcstream)
return;
}
/* The main rc file function, tries to open the rc file */
/* The main rcfile function. It tries to open the system-wide rcfile,
* followed by the local rcfile. */
void do_rcfile(void)
{
FILE *rcstream;
#ifdef SYSCONFDIR
assert(sizeof(SYSCONFDIR) == strlen(SYSCONFDIR) + 1);
nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");
/* Try to open the system-wide nanorc. */
rcstream = fopen(nanorc, "r");

View File

@@ -2,7 +2,8 @@
/**************************************************************************
* search.c *
* *
* Copyright (C) 2000-2005 Chris Allegretta *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 2005-2006 David Lawrence Ramsey *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -20,20 +21,17 @@
* *
**************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "proto.h"
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include "proto.h"
static bool search_last_line = FALSE;
/* Have we gone past the last line while searching? */
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
static bool history_changed = FALSE;
/* Have any of the history lists changed? */
#endif
@@ -49,7 +47,7 @@ static bool regexp_compiled = FALSE;
int regexp_init(const char *regexp)
{
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED
#ifndef NANO_SMALL
#ifndef NANO_TINY
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
#endif
);
@@ -70,6 +68,8 @@ int regexp_init(const char *regexp)
return 1;
}
/* Decompile the compiled regular expression we used in the last
* search, if any. */
void regexp_cleanup(void)
{
if (regexp_compiled) {
@@ -79,6 +79,8 @@ void regexp_cleanup(void)
}
#endif
/* Indicate on the statusbar that the string at str was not found by the
* last search. */
void not_found_msg(const char *str)
{
char *disp;
@@ -95,10 +97,14 @@ void not_found_msg(const char *str)
free(disp);
}
void search_abort(void)
/* Abort the current search or replace. Clean up by displaying the main
* shortcut list, updating the screen if the mark was on before, and
* decompiling the compiled regular expression we used in the last
* search, if any. */
void search_replace_abort(void)
{
display_main_list();
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (openfile->mark_set)
edit_refresh();
#endif
@@ -107,6 +113,7 @@ void search_abort(void)
#endif
}
/* Initialize the global search and replace strings. */
void search_init_globals(void)
{
if (last_search == NULL)
@@ -116,11 +123,11 @@ void search_init_globals(void)
}
/* 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.
* is TRUE, only set backupstring to answer. Return -2 to run the
* opposite program (search -> replace, replace -> search), return -1 if
* the search should be canceled (due to Cancel, a blank search string,
* Go to Line, or a failed regcomp()), return 0 on success, and return 1
* on rerun calling program.
*
* replacing is TRUE if we call from do_replace(), and FALSE if called
* from do_search(). */
@@ -155,47 +162,43 @@ int search_init(bool replacing, bool use_answer)
/* We use (COLS / 3) here because we need to see more on the
* line. */
sprintf(buf, " [%s%s]", disp,
strlenpt(last_search) > COLS / 3 ? "..." : "");
(strlenpt(last_search) > COLS / 3) ? "..." : "");
free(disp);
} else
buf = mallocstrcpy(NULL, "");
/* This is now one simple call. It just does a lot. */
i = statusq(FALSE, replacing ? replace_list : whereis_list,
backupstring,
#ifndef NANO_SMALL
i = do_prompt(FALSE,
#ifndef DISABLE_TABCOMP
TRUE,
#endif
replacing ? replace_list : whereis_list, backupstring,
#ifndef NANO_TINY
&search_history,
#endif
"%s%s%s%s%s%s", _("Search"),
#ifndef NANO_SMALL
edit_refresh, "%s%s%s%s%s%s", _("Search"),
#ifndef NANO_TINY
/* This string is just a modifier for the search prompt; no
* grammar is implied. */
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") :
#endif
"",
"",
#ifdef HAVE_REGEX_H
/* This string is just a modifier for the search prompt; no
* grammar is implied. */
ISSET(USE_REGEXP) ? _(" [Regexp]") :
#endif
"",
#ifndef NANO_SMALL
"",
#ifndef NANO_TINY
/* This string is just a modifier for the search prompt; no
* grammar is implied. */
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") :
#endif
"",
replacing ?
#ifndef NANO_SMALL
openfile->mark_set ? _(" (to replace) in selection") :
"", replacing ?
#ifndef NANO_TINY
openfile->mark_set ? _(" (to replace) in selection") :
#endif
_(" (to replace)") : "",
buf);
_(" (to replace)") : "", buf);
/* Release buf now that we don't need it anymore. */
free(buf);
@@ -221,7 +224,7 @@ int search_init(bool replacing, bool use_answer)
return -1;
#endif
break;
#ifndef NANO_SMALL
#ifndef NANO_TINY
case TOGGLE_CASE_KEY:
TOGGLE(CASE_SENSITIVE);
backupstring = mallocstrcpy(backupstring, answer);
@@ -256,43 +259,46 @@ int search_init(bool replacing, bool use_answer)
/* 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 begin_x. 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 begin_x, const char
*needle, size_t *needle_len)
* where we first started searching, at column begin_x. The return
* value specifies whether we found anything. If we did, set needle_len
* to the length of the string we found if it isn't NULL. */
bool findnextstr(
#ifndef DISABLE_SPELLER
bool whole_word,
#endif
bool no_sameline, const filestruct *begin, size_t begin_x, const
char *needle, size_t *needle_len)
{
filestruct *fileptr = openfile->current;
const char *rev_start = NULL, *found = NULL;
size_t found_len;
/* The length of the match we found. */
/* The length of the match we find. */
size_t current_x_find = 0;
/* The location of the match we found. */
/* The location in the current line of the match we find. */
ssize_t current_y_find = openfile->current_y;
filestruct *fileptr = openfile->current;
const char *rev_start = fileptr->data, *found = NULL;
/* 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
rev_start +=
#ifndef NANO_TINY
ISSET(BACKWARDS_SEARCH) ?
fileptr->data + (openfile->current_x - 1) :
openfile->current_x - 1 :
#endif
fileptr->data + (openfile->current_x + 1);
openfile->current_x + 1;
/* Look for needle in searchstr. */
/* Look for needle in the current line we're searching. */
while (TRUE) {
found = strstrwrapper(fileptr->data, needle, rev_start);
/* We've found a potential match. */
if (found != NULL) {
#ifndef DISABLE_SPELLER
bool found_whole = FALSE;
/* Is this potential match a whole word? */
#endif
/* Set found_len to the length of the potential match. */
found_len =
@@ -302,9 +308,10 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
#endif
strlen(needle);
#ifndef DISABLE_SPELLER
/* If we're searching for whole words, see if this potential
* match is a whole word. */
if (wholeword) {
if (whole_word) {
char *word = mallocstrncpy(NULL, found, found_len + 1);
word[found_len] = '\0';
@@ -312,24 +319,28 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
fileptr->data, word);
free(word);
}
#endif
/* If we're searching for whole words and this potential
* match isn't a whole word, or if we're not allowed to find
* a match on the same line we started on and this potential
* match is on that line, continue searching. */
if ((!wholeword || found_whole) && (!no_sameline ||
fileptr != openfile->current))
if (
#ifndef DISABLE_SPELLER
(!whole_word || found_whole) &&
#endif
(!no_sameline || fileptr != openfile->current))
break;
}
/* We've finished processing the file, so get out. */
if (search_last_line) {
if (can_display_wrap)
not_found_msg(needle);
not_found_msg(needle);
return FALSE;
}
#ifndef NANO_SMALL
/* Move to the previous or next line in the file. */
#ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH)) {
fileptr = fileptr->prev;
current_y_find--;
@@ -337,16 +348,14 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
#endif
fileptr = fileptr->next;
current_y_find++;
#ifndef NANO_SMALL
#ifndef NANO_TINY
}
#endif
/* Start or end of buffer reached, so wrap around. */
/* We've reached the start or end of the buffer, so wrap
* around. */
if (fileptr == NULL) {
if (!can_display_wrap)
return FALSE;
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH)) {
fileptr = openfile->filebot;
current_y_find = editwinrows - 1;
@@ -354,20 +363,18 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
#endif
fileptr = openfile->fileage;
current_y_find = 0;
#ifndef NANO_SMALL
#ifndef NANO_TINY
}
#endif
if (can_display_wrap)
statusbar(_("Search Wrapped"));
statusbar(_("Search Wrapped"));
}
/* Original start line reached. */
/* We've reached the original starting line. */
if (fileptr == begin)
search_last_line = TRUE;
rev_start = fileptr->data;
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH))
rev_start += strlen(fileptr->data);
#endif
@@ -378,23 +385,22 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
/* Ensure we haven't wrapped around again! */
if (search_last_line &&
#ifndef NANO_SMALL
#ifndef NANO_TINY
((!ISSET(BACKWARDS_SEARCH) && current_x_find > begin_x) ||
(ISSET(BACKWARDS_SEARCH) && current_x_find < begin_x))
#else
current_x_find > begin_x
#endif
) {
if (can_display_wrap)
not_found_msg(needle);
not_found_msg(needle);
return FALSE;
}
/* We've definitely found something. */
openfile->current = fileptr;
openfile->current_x = current_x_find;
openfile->current_y = current_y_find;
openfile->placewewant = xplustabs();
openfile->current_y = current_y_find;
/* needle_len holds the length of needle. */
if (needle_len != NULL)
@@ -403,6 +409,8 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
return TRUE;
}
/* Clear the flag indicating that a search reached the last line of the
* file. We need to do this just before a new search. */
void findnextstr_wrap_reset(void)
{
search_last_line = FALSE;
@@ -424,10 +432,10 @@ void do_search(void)
i = search_init(FALSE, FALSE);
if (i == -1) /* Cancel, Go to Line, blank search string, or
* regcomp() failed. */
search_abort();
search_replace_abort();
else if (i == -2) /* Replace. */
do_replace();
#if !defined(NANO_SMALL) || defined(HAVE_REGEX_H)
#if !defined(NANO_TINY) || defined(HAVE_REGEX_H)
else if (i == 1) /* Case Sensitive, Backwards, or Regexp search
* toggle. */
do_search();
@@ -442,7 +450,7 @@ void do_search(void)
else
last_search = mallocstrcpy(last_search, answer);
#ifndef NANO_SMALL
#ifndef NANO_TINY
/* If answer is not "", add this search string to the search history
* list. */
if (answer[0] != '\0')
@@ -450,8 +458,11 @@ void do_search(void)
#endif
findnextstr_wrap_reset();
didfind = findnextstr(TRUE, FALSE, FALSE, openfile->current,
openfile->current_x, answer, NULL);
didfind = findnextstr(
#ifndef DISABLE_SPELLER
FALSE,
#endif
FALSE, openfile->current, openfile->current_x, answer, NULL);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
@@ -465,7 +476,11 @@ 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, TRUE, openfile->current,
didfind = findnextstr(
#ifndef DISABLE_SPELLER
FALSE,
#endif
TRUE, openfile->current,
openfile->current_x, answer, NULL);
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && !didfind)
@@ -480,11 +495,11 @@ void do_search(void)
openfile->placewewant = xplustabs();
edit_redraw(fileptr, old_pww);
search_abort();
search_replace_abort();
}
#ifndef NANO_SMALL
/* Search for the next string without prompting. */
#ifndef NANO_TINY
/* Search for the last string without prompting. */
void do_research(void)
{
filestruct *fileptr = openfile->current;
@@ -499,7 +514,6 @@ void do_research(void)
search_init_globals();
if (last_search[0] != '\0') {
#ifdef HAVE_REGEX_H
/* Since answer is "", use last_search! */
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
@@ -507,8 +521,12 @@ void do_research(void)
#endif
findnextstr_wrap_reset();
didfind = findnextstr(TRUE, FALSE, FALSE, openfile->current,
openfile->current_x, last_search, NULL);
didfind = findnextstr(
#ifndef DISABLE_SPELLER
FALSE,
#endif
FALSE, openfile->current, openfile->current_x,
last_search, NULL);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
@@ -522,9 +540,12 @@ 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, TRUE,
openfile->current, openfile->current_x, answer,
NULL);
didfind = findnextstr(
#ifndef DISABLE_SPELLER
FALSE,
#endif
TRUE, openfile->current, openfile->current_x,
answer, NULL);
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && !didfind)
statusbar(_("This is the only occurrence"));
@@ -540,16 +561,10 @@ void do_research(void)
openfile->placewewant = xplustabs();
edit_redraw(fileptr, old_pww);
search_abort();
search_replace_abort();
}
#endif
void replace_abort(void)
{
/* For now, we do the same thing as search_abort(). */
search_abort();
}
#ifdef HAVE_REGEX_H
int replace_regexp(char *string, bool create)
{
@@ -650,9 +665,12 @@ char *replace_line(const char *needle)
* needle is the string to seek. We replace it with answer. Return -1
* 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)
ssize_t do_replace_loop(
#ifndef DISABLE_SPELLER
bool whole_word,
#endif
bool *canceled, const filestruct *real_current, size_t
*real_current_x, const char *needle)
{
ssize_t numreplaced = -1;
size_t match_len;
@@ -661,7 +679,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
/* The starting-line match and bol/eol regex flags. */
bool begin_line = FALSE, bol_or_eol = FALSE;
#endif
#ifndef NANO_SMALL
#ifndef NANO_TINY
bool old_mark_set = openfile->mark_set;
filestruct *edittop_save = openfile->edittop, *top, *bot;
size_t top_x, bot_x;
@@ -686,7 +704,10 @@ ssize_t do_replace_loop(const char *needle, const filestruct
*canceled = FALSE;
findnextstr_wrap_reset();
while (findnextstr(TRUE, wholewords,
while (findnextstr(
#ifndef DISABLE_SPELLER
whole_word,
#endif
#ifdef HAVE_REGEX_H
/* We should find a bol and/or eol regex only once per line. If
* the bol_or_eol flag is set, it means that the last search
@@ -734,7 +755,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
do_replace_highlight(TRUE, exp_word);
i = do_yesno(TRUE, _("Replace this instance?"));
i = do_yesno_prompt(TRUE, _("Replace this instance?"));
do_replace_highlight(FALSE, exp_word);
@@ -769,7 +790,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
length_change = strlen(copy) -
strlen(openfile->current->data);
#ifndef NANO_SMALL
#ifndef NANO_TINY
/* If the mark was on and (mark_begin, mark_begin_x) was the
* top of it, don't change mark_begin_x. */
if (!old_mark_set || !right_side_up) {
@@ -797,7 +818,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
match_len;
*real_current_x += length_change;
}
#ifndef NANO_SMALL
#ifndef NANO_TINY
}
#endif
@@ -805,7 +826,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
* text, so searching will resume after the replacement
* text. Note that current_x might be set to (size_t)-1
* here. */
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (!ISSET(BACKWARDS_SEARCH))
#endif
openfile->current_x += match_len + length_change - 1;
@@ -832,7 +853,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
}
}
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (old_mark_set) {
/* If the mark was on, unpartition the filestruct so that it
* contains all the text again, set edittop back to what it was
@@ -844,8 +865,9 @@ ssize_t do_replace_loop(const char *needle, const filestruct
}
#endif
/* If text has been added to the magicline, make a new magicline. */
if (openfile->filebot->data[0] != '\0')
/* If the NO_NEWLINES flag isn't set, and text has been added to the
* magicline, make a new magicline. */
if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0')
new_magicline();
return numreplaced;
@@ -861,14 +883,14 @@ void do_replace(void)
if (ISSET(VIEW_MODE)) {
print_view_warning();
replace_abort();
search_replace_abort();
return;
}
i = search_init(TRUE, FALSE);
if (i == -1) { /* Cancel, Go to Line, blank search
* string, or regcomp() failed. */
replace_abort();
search_replace_abort();
return;
} else if (i == -2) { /* No Replace. */
do_search();
@@ -883,7 +905,7 @@ void do_replace(void)
/* If answer is not "", add answer to the search history list and
* copy answer into last_search. */
if (answer[0] != '\0') {
#ifndef NANO_SMALL
#ifndef NANO_TINY
update_history(&search_history, answer);
#endif
last_search = mallocstrcpy(last_search, answer);
@@ -891,13 +913,17 @@ void do_replace(void)
last_replace = mallocstrcpy(last_replace, "");
i = statusq(FALSE, replace_list_2, last_replace,
#ifndef NANO_SMALL
i = do_prompt(FALSE,
#ifndef DISABLE_TABCOMP
TRUE,
#endif
replace_list_2, last_replace,
#ifndef NANO_TINY
&replace_history,
#endif
_("Replace with"));
edit_refresh, _("Replace with"));
#ifndef NANO_SMALL
#ifndef NANO_TINY
/* Add this replace string to the replace history list. i == 0
* means that the string is not "". */
if (i == 0)
@@ -910,7 +936,7 @@ void do_replace(void)
answer = mallocstrcpy(answer, last_replace);
statusbar(_("Cancelled"));
}
replace_abort();
search_replace_abort();
return;
}
@@ -922,8 +948,11 @@ void do_replace(void)
begin_x = openfile->current_x;
pww_save = openfile->placewewant;
numreplaced = do_replace_loop(last_search, begin, &begin_x, FALSE,
NULL);
numreplaced = do_replace_loop(
#ifndef DISABLE_SPELLER
FALSE,
#endif
NULL, begin, &begin_x, last_search);
/* Restore where we were. */
openfile->edittop = edittop_save;
@@ -938,7 +967,7 @@ void do_replace(void)
"Replaced %lu occurrences", (unsigned long)numreplaced),
(unsigned long)numreplaced);
replace_abort();
search_replace_abort();
}
/* Go to the specified line and column, or ask for them if interactive
@@ -952,11 +981,15 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
char *ans = mallocstrcpy(NULL, answer);
/* Ask for it. */
int i = statusq(FALSE, gotoline_list, use_answer ? ans : "",
#ifndef NANO_SMALL
int i = do_prompt(FALSE,
#ifndef DISABLE_TABCOMP
TRUE,
#endif
gotoline_list, use_answer ? ans : "",
#ifndef NANO_TINY
NULL,
#endif
_("Enter line number, column number"));
edit_refresh, _("Enter line number, column number"));
free(ans);
@@ -994,7 +1027,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
}
for (openfile->current = openfile->fileage;
openfile->current->next != NULL && line > 1; line--)
openfile->current != openfile->filebot && line > 1; line--)
openfile->current = openfile->current->next;
openfile->current_x = actual_x(openfile->current->data, column - 1);
@@ -1012,6 +1045,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
display_main_list();
}
/* Go to the specified line and column, asking for them beforehand. */
void do_gotolinecolumn_void(void)
{
do_gotolinecolumn(openfile->current->lineno,
@@ -1019,13 +1053,16 @@ void do_gotolinecolumn_void(void)
}
#ifndef DISABLE_SPELLER
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
/* Go to the line with the number specified in pos_line, the
* x-coordinate specified in pos_x, the y-coordinate specified in pos_y,
* and the place we want specified in pos_pww. */
void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
pos_pww)
{
/* Since do_gotolinecolumn() resets the x-coordinate but not the
* y-coordinate, set the coordinates up this way. */
openfile->current_y = pos_y;
do_gotolinecolumn(line, pos_x + 1, FALSE, FALSE, TRUE, TRUE);
do_gotolinecolumn(pos_line, pos_x + 1, FALSE, FALSE, TRUE, TRUE);
/* Set the rest of the coordinates up. */
openfile->placewewant = pos_pww;
@@ -1033,23 +1070,103 @@ void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
}
#endif
#ifndef NANO_SMALL
#ifdef HAVE_REGEX_H
#ifndef NANO_TINY
/* Search for a match to one of the two characters in bracket_set. If
* reverse is TRUE, search backwards for the leftmost bracket.
* Otherwise, search forwards for the rightmost bracket. Return TRUE if
* we found a match, and FALSE otherwise. */
bool find_bracket_match(bool reverse, const char *bracket_set)
{
filestruct *fileptr = openfile->current;
const char *rev_start = NULL, *found = NULL;
ssize_t current_y_find = openfile->current_y;
assert(mbstrlen(bracket_set) == 2);
/* rev_start might end up 1 character before the start or after the
* end of the line. This won't be a problem because we'll skip over
* it below in that case, and rev_start will be properly set when
* the search continues on the previous or next line. */
rev_start = reverse ? fileptr->data + (openfile->current_x - 1) :
fileptr->data + (openfile->current_x + 1);
/* Look for either of the two characters in bracket_set. rev_start
* can be 1 character before the start or after the end of the line.
* In either case, just act as though no match is found. */
while (TRUE) {
found = ((rev_start > fileptr->data && *(rev_start - 1) ==
'\0') || rev_start < fileptr->data) ? NULL : (reverse ?
mbrevstrpbrk(fileptr->data, bracket_set, rev_start) :
mbstrpbrk(rev_start, bracket_set));
/* We've found a potential match. */
if (found != NULL)
break;
if (reverse) {
fileptr = fileptr->prev;
current_y_find--;
} else {
fileptr = fileptr->next;
current_y_find++;
}
/* We've reached the start or end of the buffer, so get out. */
if (fileptr == NULL)
return FALSE;
rev_start = fileptr->data;
if (reverse)
rev_start += strlen(fileptr->data);
}
/* We've definitely found something. */
openfile->current = fileptr;
openfile->current_x = found - fileptr->data;
openfile->placewewant = xplustabs();
openfile->current_y = current_y_find;
return TRUE;
}
/* Search for a match to the bracket at the current cursor position, if
* there is one. */
void do_find_bracket(void)
{
const char *bracket_pat = "()<>[]{}", *pos;
char regex_pat[] = "[ ]", ch, wanted_ch;
filestruct *current_save;
size_t current_x_save, pww_save;
bool regexp_set = ISSET(USE_REGEXP);
bool backwards_search_set = ISSET(BACKWARDS_SEARCH);
int count = 1;
const char *ch;
/* The location in matchbrackets of the bracket at the current
* cursor position. */
int ch_len;
/* The length of ch in bytes. */
const char *wanted_ch;
/* The location in matchbrackets of the bracket complementing
* the bracket at the current cursor position. */
int wanted_ch_len;
/* The length of wanted_ch in bytes. */
char *bracket_set;
/* The pair of characters in ch and wanted_ch. */
size_t i;
/* Generic loop variable. */
size_t matchhalf;
/* The number of single-byte characters in one half of
* matchbrackets. */
size_t mbmatchhalf;
/* The number of multibyte characters in one half of
* matchbrackets. */
size_t count = 1;
/* The initial bracket count. */
bool reverse;
/* The direction we search. */
char *found_ch;
/* The character we find. */
assert(strlen(bracket_pat) % 2 == 0);
assert(mbstrlen(matchbrackets) % 2 == 0);
ch = openfile->current->data[openfile->current_x];
ch = openfile->current->data + openfile->current_x;
if (ch == '\0' || (pos = strchr(bracket_pat, ch)) == NULL) {
if (ch == '\0' || (ch = mbstrchr(matchbrackets, ch)) == NULL) {
statusbar(_("Not a bracket"));
return;
}
@@ -1059,44 +1176,54 @@ void do_find_bracket(void)
current_x_save = openfile->current_x;
pww_save = openfile->placewewant;
/* Turn regular expression searches on. */
SET(USE_REGEXP);
/* If we're on an opening bracket, which must be in the first half
* of matchbrackets, we want to search forwards for a closing
* bracket. If we're on a closing bracket, which must be in the
* second half of matchbrackets, we want to search backwards for an
* opening bracket. */
matchhalf = 0;
mbmatchhalf = mbstrlen(matchbrackets) / 2;
/* If we're on an opening bracket, we want to search forwards for a
* closing bracket, and if we're on a closing bracket, we want to
* search backwards for an opening bracket.
*
* We replace the spaces in regex_pat with the opening and closing
* brackets, and then do a regular expression search using it. We
* have to put the closing bracket first when we do the latter,
* since "[[]]" won't work properly, but "[][]" will. */
if ((pos - bracket_pat) % 2 == 0) {
wanted_ch = *(pos + 1);
regex_pat[1] = wanted_ch;
regex_pat[2] = ch;
UNSET(BACKWARDS_SEARCH);
} else {
wanted_ch = *(pos - 1);
regex_pat[1] = ch;
regex_pat[2] = wanted_ch;
SET(BACKWARDS_SEARCH);
for (i = 0; i < mbmatchhalf; i++)
matchhalf += parse_mbchar(matchbrackets + matchhalf, NULL,
NULL);
reverse = ((ch - matchbrackets) >= matchhalf);
/* If we're on an opening bracket, set wanted_ch to the character
* that's matchhalf characters after ch. If we're on a closing
* bracket, set wanted_ch to the character that's matchhalf
* characters before ch. */
wanted_ch = ch;
while (mbmatchhalf > 0) {
if (reverse)
wanted_ch = matchbrackets + move_mbleft(matchbrackets,
wanted_ch - matchbrackets);
else
wanted_ch += move_mbright(wanted_ch, 0);
mbmatchhalf--;
}
/* Compile the regular expression in regex_pat. */
regexp_init(regex_pat);
ch_len = parse_mbchar(ch, NULL, NULL);
wanted_ch_len = parse_mbchar(wanted_ch, NULL, NULL);
/* The regular expression in regex_pat should always be valid. */
assert(regexp_compiled);
/* Fill bracket_set in with the values of ch and wanted_ch. */
bracket_set = charalloc((mb_cur_max() * 2) + 1);
strncpy(bracket_set, ch, ch_len);
strncpy(bracket_set + ch_len, wanted_ch, wanted_ch_len);
null_at(&bracket_set, ch_len + wanted_ch_len);
findnextstr_wrap_reset();
found_ch = charalloc(mb_cur_max() + 1);
while (TRUE) {
if (findnextstr(FALSE, FALSE, FALSE, openfile->current,
openfile->current_x, regex_pat, NULL)) {
if (find_bracket_match(reverse, bracket_set)) {
/* If we found an identical bracket, increment count. If we
* found a complementary bracket, decrement it. */
count += (openfile->current->data[openfile->current_x] ==
ch) ? 1 : -1;
parse_mbchar(openfile->current->data + openfile->current_x,
found_ch, NULL);
count += (strncmp(found_ch, ch, ch_len) == 0) ? 1 : -1;
/* If count is zero, we've found a matching bracket. Update
* the screen and get out. */
@@ -1115,20 +1242,10 @@ void do_find_bracket(void)
}
}
/* Decompile the regular expression in regex_pat. */
regexp_cleanup();
/* Restore search/replace direction. */
if (backwards_search_set)
SET(BACKWARDS_SEARCH);
else
UNSET(BACKWARDS_SEARCH);
/* Restore regular expression usage setting. */
if (!regexp_set)
UNSET(USE_REGEXP);
/* Clean up. */
free(bracket_set);
free(found_ch);
}
#endif /* HAVE_REGEX_H */
#ifdef ENABLE_NANORC
/* Indicate whether any of the history lists have changed. */
@@ -1325,4 +1442,4 @@ char *get_history_completion(filestruct **h, const char *s, size_t len)
return (char *)s;
}
#endif /* !DISABLE_TABCOMP */
#endif /* !NANO_SMALL */
#endif /* !NANO_TINY */

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,8 @@
/**************************************************************************
* utils.c *
* *
* Copyright (C) 1999-2005 Chris Allegretta *
* Copyright (C) 1999-2004 Chris Allegretta *
* Copyright (C) 2005-2006 David Lawrence Ramsey *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) *
@@ -20,9 +21,7 @@
* *
**************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "proto.h"
#include <string.h>
#include <stdio.h>
@@ -30,8 +29,8 @@
#include <pwd.h>
#include <ctype.h>
#include <errno.h>
#include "proto.h"
/* Return the number of decimal digits in n. */
int digits(size_t n)
{
int i = 1;
@@ -82,9 +81,9 @@ bool parse_num(const char *str, ssize_t *val)
return TRUE;
}
/* Read an int and a ssize_t, separated by a comma, from str, and store
* them in *line and *column (if they're not both NULL). On error, we
* return FALSE. Otherwise, we return TRUE. */
/* Read two ssize_t's, separated by a comma, from str, and store them in
* *line and *column (if they're not both NULL). Return FALSE on error,
* or TRUE otherwise. */
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
{
bool retval = TRUE;
@@ -95,7 +94,7 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
comma = strchr(str, ',');
if (comma != NULL && column != NULL) {
if (!parse_num(str + (comma - str + 1), column))
if (!parse_num(comma + 1, column))
retval = FALSE;
}
@@ -157,10 +156,33 @@ void sunder(char *str)
}
}
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
/* These functions, ngetline() (originally getline()) and ngetdelim()
* (originally getdelim()), were adapted from GNU mailutils 0.5
* (mailbox/getline.c). Here is the notice from that file, after
* converting to the GPL via LGPL clause 3, and with the Free Software
* Foundation's address updated:
*
* GNU Mailutils -- a suite of utilities for electronic mail
* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
*
* This library 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 library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301, USA. */
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#ifndef HAVE_GETLINE
/* This function is equivalent to getline(). It was adapted from
* GNU mailutils' getline() function. */
/* This function is equivalent to getline(). */
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream)
{
return getdelim(lineptr, n, '\n', stream);
@@ -168,16 +190,17 @@ ssize_t ngetline(char **lineptr, size_t *n, FILE *stream)
#endif
#ifndef HAVE_GETDELIM
/* This function is equivalent to getdelim(). It was adapted from
* GNU mailutils' getdelim() function. */
/* This function is equivalent to getdelim(). */
ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
{
size_t indx = 0;
int c;
/* Sanity checks. */
if (lineptr == NULL || n == NULL || stream == NULL)
if (lineptr == NULL || n == NULL || stream == NULL) {
errno = EINVAL;
return -1;
}
/* Allocate the line the first time. */
if (*lineptr == NULL) {
@@ -192,7 +215,7 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
*n += MAX_BUF_SIZE;
}
/* Push the result in the line. */
/* Put the result in the line. */
(*lineptr)[indx++] = (char)c;
/* Bail out. */
@@ -210,12 +233,12 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
null_at(lineptr, indx++);
*n = indx;
/* The last line may not have the delimiter, we have to return what
* we got and the error will be seen on the next iteration. */
/* The last line may not have the delimiter. We have to return what
* we got, and the error will be seen on the next iteration. */
return (c == EOF && (indx - 1) == 0) ? -1 : indx - 1;
}
#endif
#endif /* !NANO_SMALL && ENABLE_NANORC */
#endif /* !NANO_TINY && ENABLE_NANORC */
#ifdef HAVE_REGEX_H
#ifdef BROKEN_REGEXEC
@@ -230,7 +253,9 @@ int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
}
#endif
int regexp_bol_or_eol(const regex_t *preg, const char *string)
/* Do the compiled regex in preg and the regex in string match the
* beginning or end of a line? */
bool regexp_bol_or_eol(const regex_t *preg, const char *string)
{
return (regexec(preg, string, 0, NULL, 0) == 0 &&
regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
@@ -238,6 +263,7 @@ int regexp_bol_or_eol(const regex_t *preg, const char *string)
}
#endif /* HAVE_REGEX_H */
#ifndef DISABLE_SPELLER
/* Is the word starting at position pos in buf a whole word? */
bool is_whole_word(size_t pos, const char *buf, const char *word)
{
@@ -262,6 +288,7 @@ bool is_whole_word(size_t pos, const char *buf, const char *word)
return retval;
}
#endif /* !DISABLE_SPELLER */
/* If we are searching backwards, we will find the last match that
* starts no later than start. Otherwise we find the first match
@@ -281,7 +308,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP)) {
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH)) {
if (regexec(&search_regexp, haystack, 1, regmatches,
0) == 0 && haystack + regmatches[0].rm_so <= start) {
@@ -299,7 +326,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
return retval;
}
} else
#endif /* !NANO_SMALL */
#endif /* !NANO_TINY */
if (regexec(&search_regexp, start, 10, regmatches,
(start > haystack) ? REG_NOTBOL : 0) == 0) {
const char *retval = start + regmatches[0].rm_so;
@@ -310,17 +337,17 @@ const char *strstrwrapper(const char *haystack, const char *needle,
return NULL;
}
#endif /* HAVE_REGEX_H */
#if !defined(NANO_SMALL) || !defined(DISABLE_SPELLER)
#if !defined(NANO_TINY) || !defined(DISABLE_SPELLER)
if (ISSET(CASE_SENSITIVE)) {
#ifndef NANO_SMALL
#ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH))
return revstrstr(haystack, needle, start);
else
#endif
return strstr(start, needle);
}
#endif /* !DISABLE_SPELLER || !NANO_SMALL */
#ifndef NANO_SMALL
#endif /* !DISABLE_SPELLER || !NANO_TINY */
#ifndef NANO_TINY
else if (ISSET(BACKWARDS_SEARCH))
return mbrevstrcasestr(haystack, needle, start);
#endif
@@ -340,7 +367,9 @@ void nperror(const char *s)
}
}
/* Thanks, BG, many people have been asking for this... */
/* This is a wrapper for the malloc() function that properly handles
* things when we run out of memory. Thanks, BG, many people have been
* asking for this... */
void *nmalloc(size_t howmuch)
{
void *r = malloc(howmuch);
@@ -351,6 +380,8 @@ void *nmalloc(size_t howmuch)
return r;
}
/* This is a wrapper for the realloc() function that properly handles
* things when we run out of memory. */
void *nrealloc(void *ptr, size_t howmuch)
{
void *r = realloc(ptr, howmuch);
@@ -395,6 +426,87 @@ char *mallocstrassn(char *dest, char *src)
return src;
}
/* nano scrolls horizontally within a line in chunks. Return the column
* number of the first character displayed in the edit window when the
* cursor is at the given column. Note that (0 <= column -
* get_page_start(column) < COLS). */
size_t get_page_start(size_t column)
{
if (column == 0 || column < COLS - 1)
return 0;
else if (COLS > 8)
return column - 7 - (column - 7) % (COLS - 8);
else
return column - (COLS - 2);
}
/* Return the placewewant associated with current_x, i.e, the zero-based
* column position of the cursor. The value will be no smaller than
* current_x. */
size_t xplustabs(void)
{
return strnlenpt(openfile->current->data, openfile->current_x);
}
/* Return the index in s of the character displayed at the given column,
* i.e, the largest value such that strnlenpt(s, actual_x(s, column)) <=
* column. */
size_t actual_x(const char *s, size_t column)
{
size_t i = 0;
/* The position in s, returned. */
size_t len = 0;
/* The screen display width to s[i]. */
assert(s != NULL);
while (*s != '\0') {
int s_len = parse_mbchar(s, NULL, &len);
if (len > column)
break;
i += s_len;
s += s_len;
}
return i;
}
/* A strnlen() with tabs and multicolumn characters factored in, similar
* to xplustabs(). How many columns wide are the first maxlen characters
* of s? */
size_t strnlenpt(const char *s, size_t maxlen)
{
size_t len = 0;
/* The screen display width to s[i]. */
if (maxlen == 0)
return 0;
assert(s != NULL);
while (*s != '\0') {
int s_len = parse_mbchar(s, NULL, &len);
s += s_len;
if (maxlen <= s_len)
break;
maxlen -= s_len;
}
return len;
}
/* A strlen() with tabs and multicolumn characters factored in, similar
* to xplustabs(). How many columns wide is s? */
size_t strlenpt(const char *s)
{
return strnlenpt(s, (size_t)-1);
}
/* Append a new magicline to filebot. */
void new_magicline(void)
{
@@ -407,13 +519,16 @@ void new_magicline(void)
openfile->totsize++;
}
#ifndef NANO_SMALL
#ifndef NANO_TINY
/* Remove the magicline from filebot, if there is one and it isn't the
* only line in the file. */
* only line in the file. Assume that edittop and current are not at
* filebot. */
void remove_magicline(void)
{
if (openfile->filebot->data[0] == '\0' &&
openfile->filebot->prev != NULL) {
openfile->filebot != openfile->fileage) {
assert(openfile->filebot != openfile->edittop && openfile->filebot != openfile->current);
openfile->filebot = openfile->filebot->prev;
free_filestruct(openfile->filebot->next);
openfile->filebot->next = NULL;
@@ -480,3 +595,49 @@ size_t get_totsize(const filestruct *begin, const filestruct *end)
return totsize;
}
#ifndef NDEBUG
/* Return what the current line number should be, starting at edittop
* and ending at fileptr. */
int check_linenumbers(const filestruct *fileptr)
{
int check_line = 0;
const filestruct *filetmp;
for (filetmp = openfile->edittop; filetmp != fileptr;
filetmp = filetmp->next)
check_line++;
return check_line;
}
#endif /* !NDEBUG */
#ifdef DEBUG
/* Dump the filestruct inptr to stderr. */
void dump_filestruct(const filestruct *inptr)
{
if (inptr == openfile->fileage)
fprintf(stderr, "Dumping file buffer to stderr...\n");
else if (inptr == cutbuffer)
fprintf(stderr, "Dumping cutbuffer to stderr...\n");
else
fprintf(stderr, "Dumping a buffer to stderr...\n");
while (inptr != NULL) {
fprintf(stderr, "(%ld) %s\n", (long)inptr->lineno, inptr->data);
inptr = inptr->next;
}
}
/* Dump the current buffer's filestruct to stderr in reverse. */
void dump_filestruct_reverse(void)
{
const filestruct *fileptr = openfile->filebot;
while (fileptr != NULL) {
fprintf(stderr, "(%ld) %s\n", (long)fileptr->lineno,
fileptr->data);
fileptr = fileptr->prev;
}
}
#endif /* DEBUG */

File diff suppressed because it is too large Load Diff