Compare commits

...

242 Commits

Author SHA1 Message Date
David Lawrence Ramsey
5a9d4935eb GNU nano 1.3.9
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3046 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-24 01:44:23 +00:00
Jordi Mallach
92dd91cd0b French manpage updates.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3045 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-23 19:53:43 +00:00
Jordi Mallach
dad746e6dd Mass update from the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3044 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-23 18:50:44 +00:00
David Lawrence Ramsey
45e3452b3e in nanorc.sample, tweak one "TeX" regex to use the "icolor" directive
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3043 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-11 19:20:52 +00:00
David Lawrence Ramsey
4005fc6257 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3042 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-08 06:12:41 +00:00
David Lawrence Ramsey
90b07fc2fd in do_tab(), make sure that we insert the correct number of spaces if
the TABS_TO_SPACES flag is set and placewewant is greater than the
current column position of the cursor


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3041 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-07 15:57:48 +00:00
David Lawrence Ramsey
7b71f573e7 add missing string translation
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3040 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-06 20:46:11 +00:00
Jordi Mallach
4071de1989 Update Catalan to match the TP file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3039 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-06 20:20:50 +00:00
David Lawrence Ramsey
6f5de42702 in get_key_buffer(), only save all open buffers and hang up when a
blocking wgetch() returns ERR and errno is set to EIO (input/output
error); if errno is set to something else, recover properly; this fixes
problems with nano's erroneously hanging up while e.g. resizing or
unsuspending in a chroot


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3038 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-06 05:28:37 +00:00
David Lawrence Ramsey
7de4dc8d08 add the last of Mike Frysinger's "c-file" regex improvements, slightly
simplified by me


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3037 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-04 04:52:06 +00:00
David Lawrence Ramsey
0ed9c5fb37 add most of Mike Frysinger's "c-file" regex tweaks and improvements
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3036 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-04 04:21:43 +00:00
David Lawrence Ramsey
37dd775f98 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3035 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-04 03:41:32 +00:00
David Lawrence Ramsey
86b6c3e5db in display_string(), *really* avoid a memory corruption problem by
allocating enough space for (COLS + 1) characters


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3034 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-10-04 03:40:41 +00:00
David Lawrence Ramsey
62a2528ab8 preemptively update the version number
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3033 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-27 19:56:12 +00:00
David Lawrence Ramsey
e283b0d638 cosmetic fix: sort the meta sequence #defines in ASCII order
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3032 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-26 02:58:16 +00:00
David Lawrence Ramsey
d04499202c minor documentation updates
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3031 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-26 02:14:37 +00:00
David Lawrence Ramsey
ec729750b0 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3030 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-25 18:42:05 +00:00
David Lawrence Ramsey
8f36d09d18 in get_escape_seq_kbinput(), fix a typo preventing the
VT100/VT220/VT320/xterm/rxvt escape sequence for ',' on the numeric
keypad with NumLock off from being interpreted properly


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3029 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-24 19:42:48 +00:00
David Lawrence Ramsey
ae4c3a6206 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3028 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-20 19:46:39 +00:00
David Lawrence Ramsey
95ef337b1a revert previous changes, as lines are broken on tabs regardless of goal
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3027 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-20 19:44:19 +00:00
David Lawrence Ramsey
9c4488bf0c in break_line(), fix another problem where goal could be miscalculated
on lines containing tabs


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3026 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-20 19:36:39 +00:00
David Lawrence Ramsey
5ab12ca761 miscellaneous minor fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3025 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-20 17:52:52 +00:00
David Lawrence Ramsey
ca37ee67d9 *really* fix the previous break_line() problem
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3024 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-20 17:47:27 +00:00
David Lawrence Ramsey
bdc1b9b568 really fix the previous break_line() problem
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3023 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-20 16:36:08 +00:00
David Lawrence Ramsey
cd9a5f0377 in break_line(), fix a problem where a line could be broken in the
middle of a multibyte character


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3022 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-20 06:12:54 +00:00
David Lawrence Ramsey
c4b854d5c7 in display_string(), really avoid a memory corruption problem by
allocating enough space for COLS characters


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3021 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-20 04:15:33 +00:00
David Lawrence Ramsey
a03d9c0ecd fix another minor spacing problem in titlebar()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3020 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-16 17:24:22 +00:00
David Lawrence Ramsey
23bdb27155 comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3019 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-14 20:20:58 +00:00
David Lawrence Ramsey
3c4dc46fdc in (control_)?mbrep(), if crep is an invalid multibyte sequence, copy
Unicode 0xFFFD (Replacement Character) into it using strncpy() instead
of assigning the former to it; this avoids segfaults when freeing crep
later, since it's supposed to be dynamically allocated


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3018 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-14 19:17:56 +00:00
David Lawrence Ramsey
1c3bfa9f2b remove do_(left|right)()'s ability to optionally not update the current
line, as this was only used in do_backspace(), and it didn't always
update the screen properly


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3017 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-13 04:53:44 +00:00
David Lawrence Ramsey
feb89db8a0 more miscellaneous minor fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3016 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-13 04:45:46 +00:00
David Lawrence Ramsey
239b415786 fix changelog entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3015 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-06 06:25:25 +00:00
David Lawrence Ramsey
7f26c7384d in display_string(), if column is less than start_col and the
character's a tab, which can be possible if there are enough tabs and
the terminal size is sufficiently large, don't try to display it using
control_mbrep()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3014 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-05 01:36:47 +00:00
David Lawrence Ramsey
1c367b6949 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3013 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-04 03:29:47 +00:00
David Lawrence Ramsey
f56229948d in configure.ac, update the description of the ENABLE_COLOR option to
mention the need for regex.h


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3012 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-02 19:13:27 +00:00
David Lawrence Ramsey
093d500e15 if we don't have regex.h and hence regex support, disable color support,
as it depends on the use of regexes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3011 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-02 19:09:36 +00:00
David Lawrence Ramsey
93bef536f7 minor documentation fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3010 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-02 04:42:44 +00:00
David Lawrence Ramsey
e4e6173389 in move_to_filestruct(), fix problem where edittop wouldn't be reset
properly if it was inside the text moved to another filestruct; also add
comment fixes and miscellaneous cleanups to it and
copy_from_filestruct()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3009 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-02 04:35:58 +00:00
David Lawrence Ramsey
be614ec3b4 formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3008 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-09-02 03:08:09 +00:00
David Lawrence Ramsey
e014fbda80 fix compilation with -pedantic
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3007 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-29 19:11:26 +00:00
David Lawrence Ramsey
7fc0ada6cc fix compilation with --enable-debug
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3006 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-29 18:52:06 +00:00
David Lawrence Ramsey
20d3cb0614 fix credits length
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3005 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-29 18:51:27 +00:00
David Lawrence Ramsey
47daf0279d add Mike Frysinger to credits
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3004 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-29 18:29:02 +00:00
David Lawrence Ramsey
79d9795c80 make is_valid_unicode() catch more invalid Unicode
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3003 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-28 03:07:13 +00:00
David Lawrence Ramsey
738893f9c7 more email address updates
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3002 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-27 16:26:57 +00:00
David Lawrence Ramsey
c83512ac6a fix changelog entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3001 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-27 16:18:15 +00:00
David Lawrence Ramsey
111f37a853 update email address
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3000 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-27 16:16:36 +00:00
Jordi Mallach
c6836ec6d5 Credit Bulgarian and Dutch translators.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2999 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-22 08:47:16 +00:00
Jordi Mallach
a8db26010b Convert to UTF-8.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2998 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-22 08:45:37 +00:00
Jordi Mallach
8bcf43b137 New Bulgarian translation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2997 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-22 08:40:19 +00:00
David Lawrence Ramsey
6834650570 really fix edit_scroll() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2996 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-16 03:03:15 +00:00
David Lawrence Ramsey
8ad58bcde3 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2995 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-16 03:02:46 +00:00
David Lawrence Ramsey
a9b862c804 fix more edit_scroll() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2994 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-16 01:27:05 +00:00
Jordi Mallach
21bec6c96d Updated Catalan translation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2993 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-15 23:17:33 +00:00
Jordi Mallach
11219babbf Updated Dutch from the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2992 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-15 23:12:15 +00:00
David Lawrence Ramsey
c71e031d8a clean up do_credits() even more
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2991 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-14 21:17:37 +00:00
David Lawrence Ramsey
84fdb90e52 use doupdate() instead of refresh() to reenter curses mode
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2990 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-14 20:08:49 +00:00
David Lawrence Ramsey
31de105eec turn the keypad on in topwin again, and clean up do_credits() a bit
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2989 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-14 19:25:16 +00:00
David Lawrence Ramsey
85ea1de1c7 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2988 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-13 20:05:06 +00:00
David Lawrence Ramsey
4fde119362 for consistency, display high-bit single-byte control characters as Unicode FFFD in UTF-8 mode
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2987 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-13 19:54:40 +00:00
David Lawrence Ramsey
4cf2246f04 add missing comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2986 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-11 18:30:47 +00:00
David Lawrence Ramsey
9fece9deb0 still more various documentation updates
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2985 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-10 23:32:08 +00:00
David Lawrence Ramsey
d7f0fe9243 various documentation updates
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2984 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-10 22:51:49 +00:00
David Lawrence Ramsey
4f03daff91 add new -W/--wordbounds command line option, and new "wordbounds" rcfile
option, to control whether the word movement functions treat punctuation
characters as part of a word


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2983 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-10 22:12:28 +00:00
David Lawrence Ramsey
6a3ac36420 in usage(), remove unneeded translation of "--quickblank"
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2982 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-10 21:52:59 +00:00
David Lawrence Ramsey
4adb37ed1d clarify changelog entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2981 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-10 21:26:32 +00:00
David Lawrence Ramsey
057edf7384 readd the option to turn the keypad off by default from nano 1.2.x, with
a few tweaks


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2980 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-10 21:22:15 +00:00
David Lawrence Ramsey
abd8993660 in update_history(), add a check to make sure the parameter we pass to
renumber() isn't NULL, and update related comments


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2979 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-10 20:03:58 +00:00
David Lawrence Ramsey
8c7a562394 cover the full range of Unicode
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2978 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-08 23:47:28 +00:00
David Lawrence Ramsey
8b006c2912 store Unicode values in longs instead of ints
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2977 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-08 23:03:25 +00:00
David Lawrence Ramsey
815fb0a2a2 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2976 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-05 19:38:11 +00:00
David Lawrence Ramsey
6ff695c154 even better handling of invalid Unicode characters
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2975 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-05 03:14:29 +00:00
David Lawrence Ramsey
71dd8c1ca6 don't allow entering invalid Unicode in make_mbchar() either
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2974 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-04 21:38:41 +00:00
David Lawrence Ramsey
8c55d21bd6 add better handling of invalid Unicode, plus a few miscellaneous minor
fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2973 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-04 20:24:26 +00:00
David Lawrence Ramsey
b7bf27a509 more get_unicode_kbinput() fixes: properly discard hexadecimal FFFE to
FFFF instead of xxxE and xxxF, and discard hexadecimal D800 to DFFF as
well, as they're also invalid Unicode characters


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2972 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-02 19:54:25 +00:00
David Lawrence Ramsey
c25ed534eb cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2971 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 21:53:54 +00:00
David Lawrence Ramsey
258497fb5c fix misplaced code in previous edit_scroll() fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2970 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 21:17:38 +00:00
David Lawrence Ramsey
107e816324 eliminate still more redundant screen updates
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2969 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 21:05:29 +00:00
David Lawrence Ramsey
6a83647a11 rename get_word_kbinput() to get_unicode_kbinput(), and also rename
related variables


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2968 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 19:12:05 +00:00
David Lawrence Ramsey
56e36ef7b5 in get_word_kbinput(), limit the input word to hexadecimal FFFD instead
of FFFF, as FFFE and FFFF are invalid Unicode characters


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2967 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 18:56:46 +00:00
David Lawrence Ramsey
bf0e47dc37 miscellaneous enum cleanups, including making the file-writing
functions' append parameter an enum instead of an int


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2966 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 18:27:10 +00:00
David Lawrence Ramsey
5d552195ea cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2965 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 05:55:07 +00:00
David Lawrence Ramsey
e796a7b5b9 formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2964 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 05:54:11 +00:00
David Lawrence Ramsey
492e501fb3 document the "none" and "default" syntaxes in nanorc.5
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2963 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 05:08:01 +00:00
David Lawrence Ramsey
7aec89e9c9 document the explanation of the "none" syntax in nanorc.sample
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2962 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 05:01:30 +00:00
David Lawrence Ramsey
d152ad378b port over Brand Huntsman's reserved "none" syntax to counteract his
"default" syntax when necessary (the latter *is* actually ported mostly
from his patch with a few tweaks; the "default-syntax" option is
apparently something else entirely)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2961 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 04:59:34 +00:00
David Lawrence Ramsey
5a584ccda3 treat color syntax names case sensitively, for consistency with how
their filename regexes are treated


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2960 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 04:34:27 +00:00
David Lawrence Ramsey
179b1bad87 more color updates: add a "default" syntax that takes no extensions for
those files that don't match any other syntax's extensions (ported from
Brand Huntsman's old patch, but modified to work with a syntax named
"default" instead of requiring a "default-syntax" keyword, and to fit
into the existing color architecture)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2959 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 04:23:29 +00:00
David Lawrence Ramsey
eab0fd808c the old assert is actually needed, so put it back too
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2958 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 03:05:53 +00:00
David Lawrence Ramsey
04f65f2e17 revert previous simplification, as it only moved complexity from one
place to another, and add formatting fixes to the old code


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2957 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-08-01 02:18:05 +00:00
David Lawrence Ramsey
db57ad757f comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2956 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-31 20:57:38 +00:00
David Lawrence Ramsey
5745c0a11f simplify further
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2955 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-31 20:20:37 +00:00
David Lawrence Ramsey
15d6857b27 fix cursor position display breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2954 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-31 20:15:01 +00:00
David Lawrence Ramsey
4ab80154e9 simplify do_cursorpos(), and remove an unneeded assert from it
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2953 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-31 18:51:51 +00:00
David Lawrence Ramsey
c879f55691 in parse_syntax(), flag duplicate syntax names as errors
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2952 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-30 21:53:05 +00:00
David Lawrence Ramsey
6135bf3f6b port over more of Brand Huntsman's old patch: a color syntax specified
on the command line will now override the syntax associated with the
current file extension


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2951 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-30 21:24:56 +00:00
David Lawrence Ramsey
ab73dd4816 fix extension decompilation breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2950 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-29 22:08:56 +00:00
David Lawrence Ramsey
5295cfe72c add missing bit from last patch
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2949 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-29 21:59:44 +00:00
David Lawrence Ramsey
2385c1aa9b port over more of Brand Huntsman's old patch (with a few tweaks):
compile the file extension regexes on an as-needed basis too


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2948 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-29 21:42:08 +00:00
David Lawrence Ramsey
282a940745 formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2947 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-29 21:41:04 +00:00
David Lawrence Ramsey
3f4520b348 fix display breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2946 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-29 03:28:09 +00:00
David Lawrence Ramsey
d4e3c59f27 remove unnecessary can_change_colors() call
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2945 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-27 03:12:22 +00:00
David Lawrence Ramsey
d6c24c4133 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2944 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-27 03:11:41 +00:00
David Lawrence Ramsey
6d8e495c37 remove still more redundant screen updates; change all wrefresh() calls
to wnoutrefresh() calls, except for those in total_update() and
do_credits(); call doupdate() just before using blocking input, since
nano spends the most time using it, for blocking input; and only do
constant sursor position display if we're just about to use blocking
input


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2943 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-26 14:42:57 +00:00
David Lawrence Ramsey
75a29b749e more comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2942 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-26 14:26:47 +00:00
David Lawrence Ramsey
96452cb60c handle invalid multibyte characters more efficiently
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2941 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-26 06:13:45 +00:00
David Lawrence Ramsey
d4defccded comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2940 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-26 05:20:02 +00:00
David Lawrence Ramsey
f9782e0437 typo fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2939 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-26 04:18:17 +00:00
David Lawrence Ramsey
3fe08acd27 and don't let a SIGWINCH throw out the changes made by the alternate
spell checker, either


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2938 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-26 01:17:16 +00:00
David Lawrence Ramsey
6969c995d1 remove redundant code, and add a comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2937 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-26 00:42:48 +00:00
David Lawrence Ramsey
b18482e1b0 simplify the previous fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2936 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-26 00:06:34 +00:00
David Lawrence Ramsey
4401862e12 fix resizing while the alternate spell checker is running
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2935 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 23:40:12 +00:00
David Lawrence Ramsey
3f12ada4ef add various fill-related cleanups, plus some related cosmetic and
formatting fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2934 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 22:54:16 +00:00
David Lawrence Ramsey
520a90c8d9 since the total number of lines in a file is the same as the number of
its last line when all its lines are numbered properly, use that in
place of openfile->totlines, and eliminate references to
openfile->totlines


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2933 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 21:23:11 +00:00
David Lawrence Ramsey
94d7cb6826 *really* fix mouse support breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2932 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 20:36:27 +00:00
David Lawrence Ramsey
56d083779f really fix mouse support breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2931 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 20:28:21 +00:00
David Lawrence Ramsey
c35e351dd0 fix mouse support breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2930 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 20:08:18 +00:00
David Lawrence Ramsey
22ae034f2d add more miscellaneous mouse support-related fixes, and move
do_statusbar_output() after do_statusbar_mouse(), to match do_output()'s
being after do_mouse() in nano.c


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2929 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 20:01:57 +00:00
David Lawrence Ramsey
3d5e94560d in do_mouse(), avoid redundant screen updates by using edit_redraw()
instead of edit_refresh(), and remove now-erroneous code that disables
setting the mark while in view mode


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2928 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 19:04:20 +00:00
David Lawrence Ramsey
78a81b29b1 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2927 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 18:59:24 +00:00
David Lawrence Ramsey
07d5df4aeb simplify do_wordlinechar_count()'s final message a bit more
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2926 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 04:46:58 +00:00
David Lawrence Ramsey
8e94234b00 rename do_word_count() do_wordlinechar_count(), and simplify its final
message a bit


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2925 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 04:21:46 +00:00
David Lawrence Ramsey
72936854c4 expand do_word_count() to also count the number of lines and characters
in the file or selection, as wc does


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2924 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 03:47:08 +00:00
David Lawrence Ramsey
7ea09e540f move mark setting, deleting, backspacing, tabbing, and entering of
newlines to text.c too


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2923 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 02:41:59 +00:00
David Lawrence Ramsey
cc8185fe2b reorder a few functions
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2922 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-25 02:33:45 +00:00
David Lawrence Ramsey
150d889965 make color_to_short() actually return a short
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2921 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-24 20:23:40 +00:00
David Lawrence Ramsey
4e5e1ae1a3 remove erroneous static declaration of fill; it's global now, since
text.c needs it too


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2920 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-24 19:59:54 +00:00
David Lawrence Ramsey
691698a954 move advanced text operations (command execution in a buffer, wrapping,
spell checking, justifying, and word counting) to their own source file,
text.c


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2919 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-24 19:57:51 +00:00
David Lawrence Ramsey
2a73131f0e cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2918 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-24 17:06:56 +00:00
David Lawrence Ramsey
ce78cdb722 really fix inconsistency
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2917 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-23 22:57:46 +00:00
David Lawrence Ramsey
acefd9e9b5 fix inconsistency
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2916 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-23 22:50:02 +00:00
David Lawrence Ramsey
945a91357a eliminate still more redundant screen updates in edit_scroll()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2915 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-23 21:06:22 +00:00
David Lawrence Ramsey
27865304d7 remove more redundant screen updates in edit_scroll(), and add a few
more miscellaneous cleanups


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2914 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-23 20:39:41 +00:00
David Lawrence Ramsey
c00513b65e fix alternate spell checker breakage: don't lose colors after using it
on a file


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2913 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-23 00:41:45 +00:00
David Lawrence Ramsey
c009759c23 allow scrolling more than editwinrows lines via edit_scroll(), take 2
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2912 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-22 23:17:19 +00:00
David Lawrence Ramsey
47bb888ad2 revert broken edit_scroll() changes for now
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2911 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-22 22:56:03 +00:00
David Lawrence Ramsey
44ca4f898c allow scrolling more than editwinrows lines via edit_scroll()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2910 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-22 22:19:36 +00:00
David Lawrence Ramsey
61f567378a display invalid multibyte sequences as Unicode FFFD, take 2; also clean
up the character-parsing functions


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2909 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-21 22:12:03 +00:00
David Lawrence Ramsey
66444c37b3 more function reordering
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2908 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-21 18:05:27 +00:00
David Lawrence Ramsey
d1dc23bd78 cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2907 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-21 17:52:36 +00:00
David Lawrence Ramsey
7f343a6dc4 add comment and formatting fixes, and remove now-useless global-specific code
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2906 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-21 05:56:42 +00:00
David Lawrence Ramsey
3a9a32996b in do_find_bracket(), add comments and minor cleanups
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2905 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-21 02:20:01 +00:00
David Lawrence Ramsey
c4037f3055 move do_(next|prev)_word(_void())? to move.c too
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2904 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-20 21:31:19 +00:00
David Lawrence Ramsey
e99494f21a add miscellaneous color and openfilestruct cleanups, and move the
openfilestruct functions to nano.c, since they're no longer specific to
file operations


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2903 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-20 21:08:38 +00:00
David Lawrence Ramsey
ca62f9fa2b move the paragraph-searching functions to move.c, as they're movement
functions, and make them call check_statusblank() too; also reorder some
other movement functions


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2902 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-20 19:24:11 +00:00
David Lawrence Ramsey
38f70a5edd comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2901 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-19 18:46:02 +00:00
Jordi Mallach
7866cd3ef7 Doh, fixup ChangeLog.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2900 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-19 17:10:05 +00:00
Jordi Mallach
03777799d4 Updated Malay translation from the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2899 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-19 15:09:09 +00:00
Jordi Mallach
e4b0742e9e Update French manpages by Jean-Philippe Guérard.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2898 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-19 15:07:35 +00:00
David Lawrence Ramsey
239c3d47dd in nanogetstr(), make sure that magichistory is properly updated when we
change it and then move up


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2897 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-19 05:58:00 +00:00
David Lawrence Ramsey
96e6d56571 in find_history() and get_history_completion(), make parameters const
where possible


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2896 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-19 04:53:45 +00:00
David Lawrence Ramsey
826fbea8e1 add missing blank lines
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2895 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-19 04:50:55 +00:00
David Lawrence Ramsey
e3bae98aab in mbstrchr(), don't count matches between valid and invalid multibyte
sequences anymore, for consistency


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2894 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-18 19:47:13 +00:00
David Lawrence Ramsey
91d468d7fd for consistency, revert handling of cases where a search string and a
match to it are not the same length in bytes, since the same technique
can't be made to work with tab completion matches


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2893 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-18 19:29:27 +00:00
David Lawrence Ramsey
7dc531a801 miscellaneous minor fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2892 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-18 18:43:39 +00:00
Jordi Mallach
0dd50d6f62 Updated French translation from the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2891 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-18 14:37:11 +00:00
David Lawrence Ramsey
0e581b3524 make sure that the current position in the history list is properly set
to the bottom if we cancel out of the prompt


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2890 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-18 07:48:50 +00:00
David Lawrence Ramsey
24b1563068 comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2889 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-18 05:23:04 +00:00
David Lawrence Ramsey
a0aa4df041 properly handle cases where a search string and a match to it are not
the same length in bytes, i.e, when the latter contains invalid
multibyte characters interpreted as normal characters


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2888 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-18 05:17:59 +00:00
David Lawrence Ramsey
091068982d add comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2887 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-18 05:16:04 +00:00
David Lawrence Ramsey
f7bcbeb87e don't display invalid multibyte sequences as Unicode 0xFFFD in
display_string() anymore, as it's inconsistent with how we handle them
elsewhere


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2886 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-18 03:23:37 +00:00
David Lawrence Ramsey
de0c5eb899 better edit_scroll() redundancy fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2885 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-17 22:51:44 +00:00
David Lawrence Ramsey
dbeb503316 fix edit_scroll() redundancy
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2884 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-17 15:42:21 +00:00
David Lawrence Ramsey
4c221675a8 comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2883 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-17 15:40:49 +00:00
David Lawrence Ramsey
50a33dbbb7 per DB'S patch, in do_spell(), when displaying an error message from
do_(int|alt)_speller(), don't display the error message corresponding to
errno if errno is zero


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2882 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-17 03:50:22 +00:00
David Lawrence Ramsey
7eb30a8353 change NANO_WIDE #define to ENABLE_UTF8, as the latter is clearer
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2881 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-17 02:40:07 +00:00
David Lawrence Ramsey
a7f488b51f fix glitch in edit_scroll() where scrolling up to the top line of the
file with fewer than nlines lines available to scroll would leave half
the screen unupdated


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2880 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-17 02:19:47 +00:00
David Lawrence Ramsey
c104ef15a6 simplify get_totals() (renamed get_totsize()) to only get the total
number of characters, and eliminate dependence on its old ability to get
the total number of lines by renumber()ing when necessary and using the
number of the last line of a filestruct


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2879 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-17 01:44:35 +00:00
David Lawrence Ramsey
5e146e815f add missing check_statusblank() calls
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2878 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-17 00:01:18 +00:00
David Lawrence Ramsey
157ce9120b speed up character output, and fix edit_refresh() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2877 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-16 23:36:10 +00:00
David Lawrence Ramsey
4d46437f87 properly overhaul edit_scroll() to update the screen on its own this
time, convert the vertical movement functions to use the new version of
it, and simplify them where possible


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2876 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-16 22:50:30 +00:00
David Lawrence Ramsey
5b44f373fd really fix color breakage by decoupling edit_update() and
edit_refresh(); edit_update() is only called without edit_refresh() in
do_gotolinecolumn() if allow_update is FALSE, and in edit_refresh()
itself if edittop is out of range of current


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2875 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-16 22:47:12 +00:00
David Lawrence Ramsey
8f4762a842 cosmetic and #ifdef fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2874 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-16 22:35:11 +00:00
David Lawrence Ramsey
8f1afee813 fix color breakage; also, in main(), when opening files with
"+LINE,COLUMN" arguments on the command line, don't update the screen
when moving to their specified lines and columns


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2873 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-16 07:06:36 +00:00
David Lawrence Ramsey
b00f7e3c6f comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2872 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-16 03:23:56 +00:00
David Lawrence Ramsey
e5806be519 clean up edit_redraw() a bit
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2871 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-16 02:12:18 +00:00
David Lawrence Ramsey
6a74c9224c fix stat breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2870 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-15 19:37:32 +00:00
David Lawrence Ramsey
cb8d845ad7 still more miscellaneous color fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2869 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-15 01:08:52 +00:00
David Lawrence Ramsey
538dc352c5 a few more miscellaneous color fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2868 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-15 00:36:49 +00:00
David Lawrence Ramsey
a74f2f8618 split overly long changelog entry
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2867 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-15 00:22:28 +00:00
David Lawrence Ramsey
8f948fa1eb handle unspecified foreground colors
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2866 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-15 00:17:13 +00:00
David Lawrence Ramsey
26ee759503 add one last breakage fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2865 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-15 00:08:23 +00:00
David Lawrence Ramsey
0532296a10 more miscellaneous minor fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2864 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-14 23:51:52 +00:00
David Lawrence Ramsey
443a766fe2 more miscellaneous breakage fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2863 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-14 23:06:22 +00:00
David Lawrence Ramsey
fa82853aea fix more color breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2862 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-14 22:28:22 +00:00
David Lawrence Ramsey
47a153f538 comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2861 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-14 22:19:20 +00:00
David Lawrence Ramsey
b802a13c5a it turns out edit_redraw() is needed after all when doing
PageUp/PageDown; revert all the movement code and edit_scroll() changes
except for added comments and edit_scroll() simplifications


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2860 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-14 22:15:09 +00:00
David Lawrence Ramsey
1458891b9f add comments, and fix some edit_scroll() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2859 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-14 20:37:01 +00:00
David Lawrence Ramsey
d2361f0761 add minor fixes to the new color code, and merge parts of Brand
Huntsman's old patch in where applicable


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2858 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-14 18:33:51 +00:00
David Lawrence Ramsey
43cf7a1be3 prototype fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2857 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-14 18:31:45 +00:00
David Lawrence Ramsey
f00c9612b3 make the movement code simpler by tweaking edit_scroll() to redraw all
necessary lines instead of calling it and then calling edit_redraw()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2856 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-14 18:01:08 +00:00
David Lawrence Ramsey
a8da623410 typo fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2855 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-14 17:31:39 +00:00
David Lawrence Ramsey
db95802a18 add breakage fixes, type fixes, and as-needed color regex compilation
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2854 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-13 20:18:46 +00:00
David Lawrence Ramsey
0c4ca3509f *really* fix more breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2853 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-12 23:25:00 +00:00
David Lawrence Ramsey
e5c7e928c9 still more breakage fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2852 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-12 23:06:22 +00:00
David Lawrence Ramsey
222b201afe miscellaneous minor fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2851 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-12 20:09:24 +00:00
David Lawrence Ramsey
5128de8308 fix marking breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2850 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-12 17:40:16 +00:00
David Lawrence Ramsey
16349c992a typo fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2849 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-11 20:50:43 +00:00
David Lawrence Ramsey
112620432a per Ken Tyler's suggestion, simplify do_gotoline_msg further; also, in
usage(), properly mention the support for "[+LINE,COLUMN]" at the
command line when HAVE_GETOPT_LONG isn't defined


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2848 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-11 20:19:59 +00:00
David Lawrence Ramsey
90f772b250 fixing titlebar(), take three
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2847 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-11 07:12:33 +00:00
David Lawrence Ramsey
caa86591f4 *really* fix titlebar()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2846 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-10 23:57:32 +00:00
David Lawrence Ramsey
d4dab46ebc really fix titlebar()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2845 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-10 23:45:23 +00:00
David Lawrence Ramsey
b386a905e6 use blank_line() instead of hblank/mvwhline(), and fix more breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2844 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-10 02:37:38 +00:00
David Lawrence Ramsey
b1ce64a375 remove redundancy
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2843 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-09 05:52:08 +00:00
David Lawrence Ramsey
2d705caec7 fix still more breakage caused by the overhaul
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2842 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-09 05:38:21 +00:00
David Lawrence Ramsey
1d696c0047 work around slang brokenness
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2841 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-09 05:24:33 +00:00
David Lawrence Ramsey
a0ebc813f1 replace almost all mvwaddstr(hblank) calls with mvwhline(' ', COLS)
calls, which do the same thing


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2840 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-09 04:49:09 +00:00
David Lawrence Ramsey
56001845cd yet more breakage fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2839 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-09 04:42:47 +00:00
David Lawrence Ramsey
be5cdb2748 add one last breakage fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2838 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-09 03:40:44 +00:00
David Lawrence Ramsey
76c25f582a still more breakage fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2837 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 21:12:39 +00:00
David Lawrence Ramsey
dbcaa3b1fb fix some breakage caused by the restructuring
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2836 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 20:59:24 +00:00
David Lawrence Ramsey
6ad59cd29b restructure things so that every file has its own openfilestruct, and so
that the values in it are used directly instead of being periodically
synced up with the globals; accordingly, remove the globals; this
changes pretty much every function


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2835 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 20:09:16 +00:00
David Lawrence Ramsey
64661ac140 rename filebuffer to openfile. as it's shorter
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2834 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 19:57:25 +00:00
David Lawrence Ramsey
9d8396d340 miscellaneous minor fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2833 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 04:53:51 +00:00
David Lawrence Ramsey
f8cb832b50 another formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2832 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 03:15:09 +00:00
David Lawrence Ramsey
503f278547 rename variable open_files filebuffer, for consistency
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2831 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 02:51:58 +00:00
David Lawrence Ramsey
90573296ea reorder some functions for consistency
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2830 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 02:47:05 +00:00
David Lawrence Ramsey
826ab5a4fe formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2829 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 02:36:16 +00:00
David Lawrence Ramsey
d41b468975 more cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2828 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 02:18:23 +00:00
David Lawrence Ramsey
3e0f523d59 cosmetic fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2827 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 02:05:39 +00:00
David Lawrence Ramsey
de03989e86 add more int -> ssize_t line number fixes, plus one formatting fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2826 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 02:01:07 +00:00
David Lawrence Ramsey
757f739367 reword an error message for consistency
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2825 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 01:49:43 +00:00
David Lawrence Ramsey
1228699f2c fix renumber_all() as well as renumber()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2824 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 01:11:27 +00:00
David Lawrence Ramsey
d72bdf17f4 in renumber(), when renumbering, properly use a ssize_t instead of an
int


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2823 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-08 01:08:25 +00:00
David Lawrence Ramsey
9c1fef04a2 in shortcut_init(), per Jordi's suggestion, simplify wording of
nano_gotoline_msg


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2822 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-07 20:11:17 +00:00
Jordi Mallach
c275f068ab Italian and Catalan update from the TP.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2821 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-07 20:02:39 +00:00
David Lawrence Ramsey
62d616b62b comment fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2820 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-06 19:20:32 +00:00
David Lawrence Ramsey
9838a5182e in display_string(), display invalid multibyte sequences as Unicode
0xFFFD (Replacement Character)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2819 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-06 19:12:41 +00:00
David Lawrence Ramsey
ec01074075 add missing dashes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2818 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-06 19:11:15 +00:00
David Lawrence Ramsey
504ae90a8e in faq.html, 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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2817 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-05 01:02:11 +00:00
David Lawrence Ramsey
405ed0f822 typo fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2816 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-05 00:54:40 +00:00
David Lawrence Ramsey
da50e73c40 with the removal of the last snprintf(), we now only use vsnprintf(), so
remove snprintf()-related #ifdefs and checks


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2815 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-04 04:22:30 +00:00
David Lawrence Ramsey
e927ce59d1 more minor variable tweaks
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2814 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-04 03:55:13 +00:00
David Lawrence Ramsey
892396bb7d in do_alt_speller(), if we can't invoke the spell checker, use sprintf()
instead of snprintf() to write the error string we return, as
altspell_error will always be long enough to hold it


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2813 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-04 03:43:54 +00:00
David Lawrence Ramsey
658f7e6630 minor variable tweaks
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2812 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-04 03:26:43 +00:00
David Lawrence Ramsey
32263ede86 add Mike Frysinger's Bourne shell script regexes, with a few minor
tweaks


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2811 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-03 22:00:29 +00:00
David Lawrence Ramsey
0c3d3c9fed add missing colon
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2810 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-02 22:12:27 +00:00
David Lawrence Ramsey
612b41615b clean up the search code a bit
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2809 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-02 17:56:29 +00:00
David Lawrence Ramsey
e3df8788b7 in do_replace(), blank out last_replace properly again just before
displaying the "Replace" prompt


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2808 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-02 17:49:27 +00:00
David Lawrence Ramsey
a549a82c32 more cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2807 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-01 23:11:52 +00:00
David Lawrence Ramsey
9c3249c893 minor cosmetic and constant cursor position display fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2806 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-07-01 22:58:47 +00:00
David Lawrence Ramsey
d5092294cd Back to CVS
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2805 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-06-30 17:17:41 +00:00
39 changed files with 13443 additions and 10347 deletions

View File

@@ -6,7 +6,7 @@ nano editor. Please see the ChangeLog for specific changes by author.
Chris Allegretta <chrisa@asty.org>
* Original program author, stable series maintainer.
David Lawrence Ramsey <pooka_regent@sluggy.net>
David Lawrence Ramsey <pooka109@cox.net>
* Development series maintainer. Multiple buffer support,
operating dir (-o) option, bug fixes for display routines,
wrapping code, spelling fixes, const mode, parts of the UTF-8
@@ -35,3 +35,9 @@ David Benbennick <dbenbenn@math.cornell.edu>
* Wrap and justify bugfixes/enhancements, new color syntax
code, memleak fixes, parts of the UTF-8 support, and other
miscellaneous fixes.
Mike Frysinger <vapier@gentoo.org>
* Gentoo package maintainer. Whitespace display mode,
--enable-utf8/--disable-utf8 configure options for ncurses,
many new color regexes and improvements to existing color
regexes for nanorc.sample, and miscellaneous bug fixes.

472
ChangeLog
View File

@@ -1,3 +1,425 @@
GNU nano 1.3.9 - 2005.10.23
- General:
- Miscellaneous comment fixes. (DLR)
- More int -> bool conversions. (DLR)
- Fix a few last instances of the current line number's being
saved as an int instead of a ssize_t. Changes to
renumber_all(), renumber(), do_alt_speller(), and
backup_lines(). (DLR)
- Reorder some functions for consistency. (DLR)
- Rename variable open_files openfile, for consistency. (DLR)
- Remove renumber()'s dependency on the main filestruct.
Changes to renumber(); removal of renumber_all(). (DLR)
- Restructure things so that every file has its own
openfilestruct, and so that the values in it are used directly
instead of being periodically synced up with the globals.
Accordingly, remove the globals. Changes to pretty much
every function. Rename add_open_file() make_new_buffer(),
rename load_buffer() open_buffer(), rename load_open_file()
display_buffer(), rename open_prevnext_file()
switch_to_prevnext_buffer(), rename open_prevfile_void()
switch_to_prev_buffer(), rename open_nextfile_void()
switch_to_next_buffer(), rename write_marked()
write_marked_file(), remove load_file(), rename cancel_fork()
cancel_command(), rename open_pipe() execute_command(), remove
execute_command(), rename resize_variables(), rename
global_init() window_size_init(), rename get_buffer()
get_key_buffer(), and rename get_buffer_len()
get_key_buffer_len(). (DLR)
- Replace all mvwaddstr(hblank) calls with a new function that
does the same thing without the need for hblank. New function
blank_line(); changes to do_browser(), blank_titlebar(),
blank_topbar(), blank_edit(), blank_statusbar(),
blank_bottombars(), update_line(), and edit_refresh(). (DLR)
- Make the static pid variable used by execute_command() and
cancel_command() a pid_t instead of an int, for consistency.
(DLR)
- Consistently make the flags global and any variables used to
hold it longs. (DLR)
- Make edit_scroll() sophisticated enough to keep track of
current and current_x, update the lines before and after the
scrolled region, and properly scroll more than editwinrows
lines; and change the movement functions that use
edit_scroll() to (a) set current and current_x before calling
it, and (b) no longer call edit_redraw() afterward, as it's
now unnecessary. These changes eliminate redundant screen
updates when the mark is on, since the mark display depends on
current and current_x. Also change edit_redraw() to use
edit_scroll() instead of edit_refresh() when one of its two
reference lines is offscreen. Changes to edit_scroll(),
do_page_up(), do_page_down(), do_up(), and do_down(). (DLR)
- Consistently make the fg and bg colortype struct entries and
any variables used to hold them shorts. Changes to
do_colorinit() (renamed color_init()), color_to_int() (renamed
color_to_short()), and parse_colors(). (DLR)
- Change color handling to save only the extension and color
regex strings constantly, and to actually compile them on an
as-needed basis. Also, make a color syntax specified on the
command line override the syntax associated with the current
file extension, add a "default" syntax that takes no
extensions for those files that don't match any other
syntax's extensions, and add a "none" syntax that's the same
as having no syntax at all. Changes to update_color(),
thanks_for_all_the_fish(), nregcomp(), parse_syntax(), and
parse_colors(). (Brand Huntsman and DLR)
- Various other color fixes. Handle unspecified foreground
colors properly, treat syntax names case sensitively, flag
duplicate syntax names as errors, don't automatically
reinitialize the displayed colors every time we update the
current buffer's colors (since the buffer may not be displayed
immediately), don't bother doing complete refreshes of the
screen when color support is enabled if there's no regex
associated with the current file, and rename variable
exttype->val to exttype->ext, for consistency. Changes to
do_colorinit() (renamed color_init()), update_color() (renamed
color_update()), write_file(), do_input(), do_output(), and
parse_syntax(). (DLR)
- Simplify get_totals() to only get the total number of
characters, and eliminate dependence on its old ability to get
the total number of lines by renumber()ing when necessary and
using the number of the last line of a filestruct. Changes to
read_file(), move_to_filestruct(), copy_from_filestruct(),
do_justify(), get_totals() (renamed get_totsize()), and
do_cursorpos(). (DLR)
- Change the NANO_WIDE #define to ENABLE_UTF8, as the latter is
clearer. (DLR)
- Minor history code fixes: Make sure that the current position
in the history list is properly set to the bottom if we cancel
out of the prompt, and that magichistory is properly updated
when we change it and then move up. New function
history_reset(); changes to nanogetstr(). (DLR)
- Various character-handling cleanups. If we get an invalid
multibyte sequence, treat it as Unicode FFFD (Replacement
Character), unless we're searching for a match to it. Also,
remove unneeded variables and checks when parsing multibyte
sequences. Changes to is_alnum_mbchar(), is_blank_mbchar(),
is_cntrl_mbchar(), is_punct_mbchar(), control_mbrep(),
mbwidth(), make_mbchar(), parse_mbchar(), mbstrncasecmp(),
mbstrcasestr(), mbrevstrcasestr(), mbstrchr(), and
display_string(). (DLR)
- Move advanced text operations (command execution in a buffer,
wrapping, spell checking, justifying, and word counting) to
their own source file, and adjust related variables
accordingly. New file text.c; changes to cancel_command(),
execute_command(), do_backspace(), do_delete(), do_tab(),
do_enter(), do_mark(), wrap_reset(), do_wrap(),
do_int_spell_fix(), do_int_speller(), do_alt_speller(),
do_spell(), break_line(), indent_length(), justify_format(),
quote_length(), quotes_match(), indents_match(), begpar(),
inpar(), backup_lines(), find_paragraph(), do_justify(),
do_justify_void(), do_full_justify(), and do_word_count() (all
moved to text.c). (DLR)
- Since the total number of lines in a file is the same as the
number of its last line when all its lines are numbered
properly, use that in place of openfile->totlines, and
eliminate references to openfile->totlines. Changes to
initialize_buffer_text(), read_file(), move_to_filestruct(),
copy_from_filestruct(), do_delete(), do_enter(), do_wrap(),
do_justify(), do_alt_speller(), do_wordlinechar_count(),
new_magicline(), remove_magicline(), and do_cursorpos(). (DLR)
- Various fill-related cleanups. Move check_die_too_small() and
window_size_init()'s code into window_init(), as they really
belong there, remove associated separate calls to them, make
sure window_init() is always called at the same time when
redrawing the screen, and turn the keypad on in topwin in case
we ever read input from it. Changes to window_init(), main(),
and do_alt_speller(); removal of check_die_too_small() and
window_size_init(). (DLR)
- Remove still more redundant screen updates. Change all
wrefresh() calls to wnoutrefresh() calls, except for those in
total_update() and do_credits(); call doupdate() just before
using blocking input, since nano spends the most time using
it, for blocking input; and only do constant sursor position
display if we're just about to use blocking input. Changes to
input_tab(), do_browser(), do_output(), main(),
get_key_buffer(), check_statusblank(), nanogetstr(),
titlebar(), statusbar(), bottombars(), edit_refresh(),
do_yesno(), and do_help(). (DLR)
- Treat the Unicode characters D800-DFFF, FDD0-FDEF, and
xxFFFE-xxFFFF, as invalid, since the C library's multibyte
functions don't seem to. New function is_valid_unicode();
changes to mbrep() and make_mbchar(). (DLR)
- Store Unicode values in longs instead of ints, and cover the
entire range of Unicode. Changes to make_mbchar(),
is_valid_unicode(), parse_kbinput(), get_unicode_kbinput(),
parse_verbatim_kbinput(), and faq.html. (DLR)
- Readd the option to turn the keypad off by default from nano
1.2.x, but rename the long option from --keypad to
--rebindkeypad, clarify its description on the command line,
and add an updated FAQ entry about its use. Changes to
window_init(), usage(), main(), get_verbatim_kbinput(),
nanorc.sample, nano.1, nanorc.5, nano.texi, and faq.html.
(DLR)
- Add new -W/--wordbounds command line option, and new
"wordbounds" rcfile option, to control whether
the word movement functions treat punctuation characters as
part of a word. Changes to do_next_word_void(),
do_prev_word_void(), usage(), main(), nano.1, nanorc.5,
nano.texi, and nanorc.sample. (DLR, suggested by Mike
Frysinger)
- Update email address. Changes to faq.html and AUTHORS. (DLR)
- Remove do_(left|right)()'s ability to optionally not update
the current line, as this was only used in do_backspace(), and
it didn't always update the screen properly. Changes to
shortcut_init(), do_left(), do_right(), and do_backspace();
removal of do_left_void() and do_right_void(). (DLR; problem
found by Mike Frysinger)
- color.c:
- Remove unneeded fcntl.h include. (DLR)
- chars.c:
control_rep(), control_mbrep()
- Assert that the multibyte character passed in is a control
character if it's valid. (DLR)
- If crep is an invalid multibyte sequence, copy Unicode 0xFFFD
(Replacement Character) into it using strncpy() instead of
assigning the former to it. This avoids segfaults when freeing
crep later, since it's supposed to be dynamically allocated.
(DLR)
mbrep()
- New function, the equivalent of control_mbrep() for non-control
characters. (DLR)
parse_mbchar()
- Remove now-unneeded bad_chr parameter. (DLR)
mbstrchr()
- Don't count matches between valid and invalid multibyte
sequences anymore, for consistency. (DLR)
- files.c:
open_file()
- Assert that filename isn't NULL, and don't do anything special
if it's blank, as the the former case shouldn't occur, and the
latter case is now handled elsewhere. (DLR)
write_file(), write_marked_file(), do_writeout()
- Make append an append_type enum instead of an int. (DLR)
input_tab()
- Make columns an int instead of a size_t, since it's limited by
COLS. (DLR)
- global.c:
shortcut_init()
- Simplify wording of nano_gotoline_msg. (Jordi and Ken Tyler)
- Clarify wording of nano_wordcount_msg, as it will only go
through the marked portions of the file if the mark is on.
(DLR)
- move.c:
do_first_line(), do_last_line()
- Simplify by only using edit_redraw(), and also make them call
check_statusblank(). (DLR)
do_page_up(), do_page_down()
- If there's less than a page of text onscreen, just call
do_(first|last)_line(). (DLR)
do_para_begin(), do_para_begin_void(), do_para_end(),
do_para_end_void(), do_next_word(), do_next_word_void(),
do_prev_word(), do_prev_word_void()
- Move here from nano.c, as they're movement functions, and also
make them call check_statusblank().
- nano.c:
move_to_filestruct()
- Fix problem where edittop wouldn't be reset properly if it was
inside the text moved to another filestruct. (DLR)
copy_from_filestruct()
- Miscellaneous cleanups. (DLR)
usage()
- Properly mention the support for "[+LINE,COLUMN]" on the
command line when HAVE_GETOPT_LONG isn't defined. (DLR)
- Remove unneeded translation of "--quickblank". (DLR)
do_verbatim_input()
- If constant cursor position display is on, make sure the
cursor position is displayed properly when we finish. (DLR)
do_next_word()
- Rework to be more like do_prev_word(), to avoid a potential
problem if we start at the end of a line. (DLR)
do_mouse()
- Avoid redundant screen updates by using edit_redraw() instead
of edit_refresh(), and remove now-erroneous code that disables
setting the mark while in view mode. (DLR)
do_output()
- When adding a character, just add its length in bytes to
current_x instead of calling do_right(), and set placewewant
afterward. (DLR)
do_alt_speller()
- If we can't invoke the spell checker, use sprintf() instead of
snprintf() to write the error string we return, as the one
formatted value is a simple string, and so altspell_error will
always be long enough to hold it. Also remove unnecessary
initialization of altspell_error, refactor so that msglen is
no longer needed, and make the error message more similar to
what the internal spell checker returns under the same
circumstances. (DLR)
- Block any pending SIGWINCHes while the alternate spell checker
is running, so that it can handle them, and unblock them once
it's finished and we've loaded the spell-checked file back in.
(DLR)
- Use doupdate() to reenter curses mode instead of refresh().
(DLR)
do_spell()
- When displaying an error message from do_(int|alt)_speller(),
don't display the error message corresponding to errno if
errno is zero. (David Benbennick)
do_justify()
- If constant cursor position display is on, make sure the
cursor position is displayed properly when we finish. (DLR)
handle_sigwinch()
- Use doupdate() to reenter curses mode instead of refresh().
(DLR)
allow_pending_sigwinch()
- Simplify by using the "?" operator instead of an if clause.
(DLR)
main()
- When opening files with "+LINE,COLUMN" arguments on the
command line, don't update the screen when moving to their
specified lines and columns. (DLR)
- Rename variable fill_flag_used to fill_used, for consistency.
(DLR)
- nano.h:
- Since we only use vsnprintf() now, remove the #ifdef block for
HAVE_SNPRINTF. (DLR)
- Remove TOP from the topmidnone enum, and rename the latter
centernone. (DLR)
- Move stdlib.h, dirent.h, regex.h, and assert.h includes here,
as every source file needs them. (DLR)
- Rename the updown enum scroll_dir and the centernone enum
update_type for clarity, and add an append_type enum. (DLR)
- If we don't have regex.h and hence regex support, disable
color support, as it depends on the use of regexes. (DLR)
- rcfile.c:
nregcomp()
- Return TRUE when the compilation succeeds and FALSE otherwise,
instead of the other way around. (DLR)
- search.c:
search_init()
- Don't blank out last_replace anymore when we get a new string,
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)
replace_abort()
- Remove unnecessary update of placewewant. (DLR)
do_replace()
- Blank out last_replace properly again just before displaying
the "Replace" prompt. (DLR, found by Mike Frysinger)
- Remove unnecessary renumber(). (DLR)
do_gotolinecolumn()
- Add parameter allow_update to control whether the screen is
updated after moving. If it's TRUE, call edit_refresh() after
edit_update(). (DLR)
do_gotopos()
- Only include this function when DISABLE_SPELLER isn't defined,
as the alternate spell checking code is now the only place
where it's used. (DLR)
do_find_bracket()
- Add comments and minor cleanups. (DLR)
find_history()
- Make parameters const where possible. (DLR)
update_history()
- Don't renumber the history list starting after the entry we
found if the entry we found is at the bottom of the list.
(DLR, found by Simon Strandman)
get_history_completion()
- Make parameters const where possible. (DLR)
- text.c:
do_tab()
- Make sure that we insert the correct number of spaces if the
TABS_TO_SPACES flag is set and placewewant is greater than the
current column position of the cursor. (DLR)
do_enter()
- Don't update the edit window until we set placewewant. (DLR)
break_line()
- Fix a problem where a line could be broken in the middle of a
multibyte character. (DLR)
do_word_count()
- Rename to do_wordlinechar_count(), and expand to also count
the number of lines and characters in the file or selection,
as wc does. (DLR)
- winio.c:
get_key_buffer()
- Only save all open buffers and hang up when a blocking
wgetch() returns ERR and errno is set to EIO (input/output
error). If errno is set to something else, recover properly.
This fixes problems with nano's erroneously hanging up while
e.g. resizing or unsuspending in a chroot. (DLR, found by Mike
Frysinger)
get_escape_seq_kbinput()
- Fix typo preventing the VT100/VT220/VT320/xterm/rxvt escape
sequence for ',' on the numeric keypad with NumLock off from
being interpreted properly. (DLR)
get_word_kbinput()
- Multiply the entered digits by hexadecimal numbers instead of
decimal numbers for clarity, rename to get_unicode_kbinput(),
and rename variables word and word_digits to uni and
uni_digits. (DLR)
parse_verbatim_kbinput()
- Rename variables word_mb and word_mb_len to uni_mb and
uni_mb_len. (DLR)
display_string()
- Instead of using parse_mbchar()'s bad_chr parameter, use
mbrep() to get the representation of a bad character. (DLR)
- If column is less than start_col and the character's a tab,
which can be possible if there are enough tabs and the
terminal size is sufficiently large, don't try to display it
using control_mbrep(). (DLR, found by Duncan Geoffry Doyle)
- Really avoid a memory corruption problem by allocating enough
space for COLS characters. (DLR)
edit_redraw(), edit_refresh()
- Clean up and simplify. (DLR)
edit_update()
- Since we no longer use TOP, remove references to it. Also,
don't call edit_refresh() anymore; it will call us. (DLR)
do_statusbar_next_word()
- Rework to be more like do_statusbar_prev_word(), to avoid a
potential problem if we start at the end of a line. (DLR)
do_statusbar_input()
- Call do_statusbar_mouse() instead of do_mouse(). (DLR)
do_statusbar_output()
- When adding a character, just add its length in bytes to
statusbar_x instead of calling do_statusbar_right(). (DLR)
titlebar()
- Rework to display only one space after the version number, so
that there's more room for other things, and to not display
the status when we're in the file browser, since Pico doesn't.
(DLR)
do_credits()
- Various cleanups. Turn on the MORE_SPACE and NO_HELP flags
before showing the credits, so that they use as much of the
screen as possible, and set the flags back to their original
values afterward. Also, call wscrl(1) instead of scroll(),
only call scrollok() just before and after we scroll, and
tweak where screen updates occur so that messages are properly
displayed when they first scroll onto the bottom line of the
screen. (DLR)
- Add Mike Frysinger to credits. (DLR)
- configure.ac:
- Since we only use vsnprintf() now, remove the tests for
snprintf(). (DLR)
- Change the description of "sufficient wide character support"
to "sufficient UTF-8 support", as the latter is clearer. (DLR)
- Update the description of the ENABLE_COLOR option to mention
the need for regex.h. (DLR)
- doc/faq.html:
- 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)
- doc/nanorc.sample:
- Add regexes for Bourne shell scripts. (Mike Frysinger, minor
tweaks by DLR)
- Explain how the "none" and "default" syntaxes work. (DLR)
- Tweaks and additions to the "c-file" regexes: handle #defined
constants more accurately and use a brighter color for them,
support C99 standard integer types, support more GCC builtins,
and color code flow control statements differently. (Mike
Frysinger) DLR: Slightly simplify the integer types regex.
- Tweak one "TeX" regex to use the "icolor" directive. (DLR)
- doc/man/nanorc.5:
- Explain how the "none" and "default" syntaxes work. (DLR)
- doc/man/fr/nano.1, doc/man/fr/nanorc.5:
- Updated translation by Jean-Philippe Guérard.
- src/Makefile.am:
- Add text.c to nano_SOURCES. (DLR)
- AUTHORS:
- Add Mike Frysinger. (DLR)
- README.CVS:
- Since we only use vsnprintf() now, remove the mention of
snprintf(). (DLR)
- THANKS:
- Add Bulgarian and Dutch translators.
GNU nano 1.3.8 - 2005.06.30
- General:
- Miscellaneous comment fixes. (DLR)
@@ -127,7 +549,7 @@ GNU nano 1.3.8 - 2005.06.30
totlines a size_t, and change related variables to match.
(DLR, initial problem with parse_line_column() found by Mike
Frysinger)
- Rework the credits handling to display Florian König's name
- Rework the credits handling to display Florian König's name
properly whether we're in a UTF-8 locale or not, and without
requiring a massive function that we only use once. Changes
to do_credits(); removal of make_valid_mbstring(). (DLR)
@@ -1138,7 +1560,7 @@ GNU nano 1.3.5 - 2004.11.22
to" messages on the statusbar. (DLR)
input_tab()
- Fix snprintf() call so that we don't segfault when trying to
complete a filename containing %'s. (Ulf Härnhammar)
complete a filename containing %'s. (Ulf Härnhammar)
- global.c:
shortcut_init()
- Remove redundant NANO_SMALL #ifdef. (DLR)
@@ -1352,7 +1774,7 @@ GNU nano 1.3.5 - 2004.11.22
option makes aspell not create backup files, and this is
consistent with the internal spell checker's behavior. (DLR)
- doc/man/fr/nano.1, doc/man/fr/nanorc.1:
- Updated manpage translations by Jean-Philippe Guérard.
- Updated manpage translations by Jean-Philippe Guérard.
- README.CVS:
- Mention the requirement for glib 2.x on systems lacking
v?snprintf(), and add minor formatting changes.
@@ -2476,7 +2898,7 @@ GNU nano 1.3.1 - 2004.01.09
do_writeout()
- Prompt the user if we're trying to save an existing file (and
not just a selection of it) under a different name. (DLR;
suggested by Jean-Philippe Guérard)
suggested by Jean-Philippe Guérard)
- Overhaul the code used to write a selection of a file to
temporarily set fileage and filebot to the top and bottom of
the selection and then call write_file(), instead of following
@@ -2764,7 +3186,7 @@ GNU nano 1.3.0 - 2003.10.22
interpreted as Ctrl-[character], and the support for Pico's
Esc Esc [three-digit decimal ASCII code] input method, if
applicable. (DLR)
- French translation by Jean-Philippe Guérard.
- French translation by Jean-Philippe Guérard.
- nano.1.html, nanorc.5.html:
- Regenerated. (DLR)
- nanorc.sample:
@@ -2778,7 +3200,7 @@ GNU nano 1.3.0 - 2003.10.22
as such when parsed by color regexes. Accordingly, simplify
regexes that handle both spaces and tabs to just handle
spaces, as the results are the same. (DLR)
- AUTHORS
- AUTHORS:
- Updated to show 1.2/1.3 maintainers.
- 1.3 tree forks here
@@ -2831,7 +3253,7 @@ GNU nano 1.2.2 - 2003.08.11
comments) added by DLR.
- THANKS:
- Added Laurentiu Buzdugan, for Romanian.
- Added Geir Helland, for Norwegian Bokmål.
- Added Geir Helland, for Norwegian Bokmål.
- TODO:
- Move the items for nano 1.2 to the "Old Requests" section,
and mark color syntax highlighting as done. (David Benbennick)
@@ -2839,7 +3261,7 @@ GNU nano 1.2.2 - 2003.08.11
- Added question about nano's not showing color when it's
compiled with color support. (DLR; suggested by Jordi)
- nano.1, nanorc.5:
- Formatting improvements by Jean-Philippe Guérard.
- Formatting improvements by Jean-Philippe Guérard.
- Minor fixes by DLR.
- nano.1.html, nanorc.5.html:
- Regenerated from nano.1 and nanorc.5. (DLR)
@@ -4030,7 +4452,7 @@ GNU nano 1.1.9 - 05/12/2002
- po/de.po:
- German translation updates (Michael Piefel).
- po/fr.po:
- French translation updates (Jean-Philippe Guérard).
- French translation updates (Jean-Philippe Guérard).
- po/ca.po, po/es.po:
- Catalan and Spanish translation updates (Jordi).
- po/sv.po:
@@ -4096,7 +4518,7 @@ GNU nano 1.1.8 - 03/30/2002
- Fix errno->strerror(errno) mismatch.
parse_rcfile()
- Don't use i for both for loop and atoi(), fixes lots of
potential crashes, 1st reported by Jean-Philippe Guérard.
potential crashes, 1st reported by Jean-Philippe Guérard.
rcfile_error()
- Don't print out the file name if we haven't opened the file
yet (lineno == 0).
@@ -4129,7 +4551,7 @@ GNU nano 1.1.8 - 03/30/2002
- Catalan and Spanish translation updates (Jordi).
- Typo (DLR).
- po/fr.po:
- French translation updates (Jean-Philippe Guérard).
- French translation updates (Jean-Philippe Guérard).
- po/gl.po:
- Galician translation updates (Jacobo Tarrio).
- po/uk.po, po/ru.po:
@@ -4137,7 +4559,7 @@ GNU nano 1.1.8 - 03/30/2002
- po/pl.po:
- Polish translation updates (Wojciech Kotwica).
- po/fr.po:
- French translation updates (Jean-Philippe Guérard).
- French translation updates (Jean-Philippe Guérard).
- po/it.po:
- Italian translation updates (Marco Colombo).
- po/da.po:
@@ -4240,7 +4662,7 @@ GNU nano 1.1.7 - 03/05/2002
- po/sv.po:
- Swedish translation updates (Christian Rose).
- po/fr.po:
- French translation updates (Jean-Philippe Guérard).
- French translation updates (Jean-Philippe Guérard).
- po/nn.po:
- Norwegian nynorsk translation updates (Kjetil Torgrim Homme).
- po/de.po:
@@ -4257,7 +4679,7 @@ GNU nano 1.1.7 - 03/05/2002
- po/da.po:
- Danish translation updates (Keld Simonsen).
- po/nb.po:
- Norwegian bokmål translation updates (Stig E Sandoe).
- Norwegian bokmål translation updates (Stig E Sandoe).
- po/nl.po:
- Dutch translation updates (Guus Sliepen).
- po/pl.po:
@@ -4342,7 +4764,7 @@ nano-1.1.6 - 01/25/2002
users into the fact that their regex is doing something bad.
- THANKS:
- Oops, correct Eivind's entry. His translation was Norwegian nynorsk,
not bokmål as we claimed (Jordi).
not bokmål as we claimed (Jordi).
- .cvsignore
- Added config.guess config.sub install-sh missing & mkinstalldirs
- po/ca.po, po/es.po:
@@ -4352,7 +4774,7 @@ nano-1.1.6 - 01/25/2002
- po/de.po:
- German translation update (Michael Piefel).
- po/fr.po:
- French translation update (Jean-Philippe Guérard).
- French translation update (Jean-Philippe Guérard).
- po/ru.po, po/uk.po:
- Russian and Ukrainian translation updates (Sergey A. Ribalchenko).
- po/no.po:
@@ -4360,7 +4782,7 @@ nano-1.1.6 - 01/25/2002
- po/nn.po:
- Norwegian nynorsk translation updates (Kjetil Torgrim Homme).
- po/nb.po:
- New Norwegian bokmål translation (Stig E Sandoe <stig@ii.uib.no>).
- New Norwegian bokmål translation (Stig E Sandoe <stig@ii.uib.no>).
- po/da.po:
- Danish translation update (Keld Simonsen).
@@ -4431,13 +4853,13 @@ nano-1.1.5 - 01/05/2002
- po/fr.po:
- French translation update (Michel Robitaille).
- po/gl.po:
- Galician translation update (Jacobo Tarrío).
- Galician translation update (Jacobo Tarrío).
- po/it.po:
- Italian translation update (Marco Colombo).
- po/de.po:
- German translation update (Michael Piefel).
- po/fr.po:
- French translation update (Jean-Philippe Guérard).
- French translation update (Jean-Philippe Guérard).
nano-1.1.4 - 12/11/2001
- General
@@ -4642,7 +5064,7 @@ nano-1.1.2 - 10/03/2001
- po/ca.po, po/es.po:
- Updated Catalan and Spanish translation (Jordi).
- po/gl.po:
- Updated Galician translation (Jacobo Tarrío).
- Updated Galician translation (Jacobo Tarrío).
- po/da.po:
- New Danish translation, by Keld Simonsen <keld@dkuug.dk>.
- po/sv.po:
@@ -4862,7 +5284,7 @@ nano-1.1.0 - 07/15/2001
- po/es.po, po/ca.po:
- Updated (Jordi).
- po/gl.po:
- Galician translation by Jacobo Tarrío.
- Galician translation by Jacobo Tarrío.
- po/uk.po, po/ru.po:
- New Ukrainian and Russian translations by Sergey A. Ribalchenko
<fisher@obu.ck.ua>, thanks!
@@ -4871,7 +5293,7 @@ nano-1.1.0 - 07/15/2001
- po/it.po
- Updated Italian translation by Marco Colombo.
- po/no.po:
- New Norwegian translation by Eivind Kjørstad <ekj@vestdata.no>.
- New Norwegian translation by Eivind Kjørstad <ekj@vestdata.no>.
- po/sv.po:
- New Swedish translation by Christian Rose <menthos@menthos.com>.
@@ -4978,7 +5400,7 @@ nano-0.9.99pre3 - 02/19/2001
- Added localized yes, no and all strings to function and rewrote
handler for the new format.
- de.po:
- Translation updates by Florian König.
- Translation updates by Florian König.
- fi.po:
- Translation updates by Pauli Virtanen.
- hu.po:
@@ -5869,7 +6291,7 @@ nano-0.9.7 - 05/14/2000
- nano.c:
do_home(), do_end():
- Added calls to update_line for the current line, fixes
lack of update (bug discovered by Alberto García).
lack of update (bug discovered by Alberto García).
main():
- Added SET(FOLLOW_SYMLINKS) before getopt call, fixes not
following symlinks even when -l isn't set, and "no changes"
@@ -6305,7 +6727,7 @@ nano-0.7.8 - 01/23/2000
buffer, cut support. (Adam Rogoyski)
blank_edit(): New function, blanks edit buffer. Added call to it in
total_refresh().
- configure: Checks for glib if snprintf of vsnprintf aren't available
- configure: Checks for glib if snprintf or vsnprintf aren't available
(Andy Kahn). Changed warning message when no termcap lib
is found.

21
NEWS
View File

@@ -1,3 +1,24 @@
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,
expansion of the word count option to also count lines
and characters in the file or selection, more efficient
screen update routines, a readded -K/--rebindkeypad
option to work around numeric keypad problems on
terminals that don't show the usual NumLock glitch, a
new -W/--wordbounds option to properly detect words
containing punctuation when moving among them, and
massive improvements to the color code such as handling
of unspecified foreground colors, more efficient memory
usage for color regexes, and new reserved syntaxes
"default" and "none". The bugfixes include fixes for
the rewritten history code, fixes for potential line
numbering problems on 64-bit platforms, fixes for a few
long-standing minor display problems, a fix for erroneous
hangups occurring while waiting for input, and a fix for
a segfault when displaying certain overly long lines.
Have fun with it.
2005.06.30 - GNU nano 1.3.8 floats at its own level. This release
contains several new features. Among other things, you
can now move to a specified column number as well as

View File

@@ -14,7 +14,7 @@ packages:
- texinfo
- cvs
- ssh (with support for the SSH version 2 protocol)
- glib 2.x (if your system doesn't have snprintf() and/or vsnprintf())
- glib 2.x (if your system doesn't have vsnprintf())
- make, gcc and the normal development libraries (curses or slang, etc.)
These should be available on your GNU mirror. Note that you'll need a

19
THANKS
View File

@@ -1,24 +1,26 @@
The following people have helped GNU nano in some way or another.
If we missed you here, let us know!
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com>
Malay translator
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian translator
CHAO Wei-Lun <chaoweilun@pcmail.com.tw> Traditional Chinese translator
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish translator
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish translator
Marco Colombo <magicdice@inwind.it> Italian translator
Yavor Doganov <yavor@doganov.org> Bulgarian translator
Karl Eichwalder <keichwa@gmx.net> German translator
Doruk Fisek <dfisek@fisek.com.tr> Turkish translator
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net>
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net>
French translator
Geir Helland Norwegian bokmål translator
Geir Helland Norwegian bokmål translator
Tedi Heriyanto <tedi_h@gmx.net> Indonesian translator
Václav Haisman <V.Haisman@sh.cvut.cz> Czech translator
Václav Haisman <V.Haisman@sh.cvut.cz> Czech translator
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu>
Hungarian translator
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish Translator
Eivind Kjørstad <ekj@vestdata.no> Norwegian nynorsk translator
Florian König <floki@bigfoot.com> German translator
Eivind Kjørstad <ekj@vestdata.no> Norwegian nynorsk translator
Florian König <floki@bigfoot.com> German translator
Wojciech Kotwica <wkotwica@post.pl> Polish translator
Clement Laforet <clem_laf@wanadoo.fr> French translator
Gergely Nagy <algernon@debian.org> Hungarian translator
@@ -28,13 +30,14 @@ 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
Christian Rose <menthos@menthos.com> Swedish translator
Stig E Sandoe <stig@ii.uib.no> Norwegian bokmål translator
Stig E Sandoe <stig@ii.uib.no> Norwegian bokmål translator
Benno Schulenberg <benno@nietvergeten.nl> Dutch translator
Danilo Segan <dsegan@gmx.net> Serbian translator
Keld Simonsen <keld@dkuug.dk> Danish translator
Guus Sliepen <guus@nl.linux.org> Dutch translator
Cezary Sliwa <sliwa@cft.edu.pl> Polish translator
Pierre Tane <tanep@bigfoot.com> French translator
Jacobo Tarrío <jtarrio@trasno.net> Galician translator
Jacobo Tarrío <jtarrio@trasno.net> Galician translator
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian nynorsk translator
Miquel Vidal <miquel@sindominio.net> Catalan translator
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese translator

View File

@@ -19,7 +19,7 @@
#
# $Id$
AC_INIT([GNU nano], [1.3.8], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [1.3.9], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE
@@ -154,7 +154,7 @@ AC_ARG_ENABLE(color,
[ --enable-color Enable color and syntax highlighting],
[if test x$enableval = xyes; then
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
AC_MSG_WARN([
***********************************************************************
*** WARNING: Color support is far from perfect, but functional. ***
@@ -179,7 +179,7 @@ AC_ARG_ENABLE(all,
[ --enable-all Enable ALL extra nano functionality (kitchen sink option)],
[if test x$enableval = xyes; then
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
AC_MSG_WARN([
@@ -398,18 +398,18 @@ int main(void)
dnl Checks for functions.
AC_CHECK_FUNCS(getdelim getline isblank snprintf strcasecmp strcasestr strncasecmp strnlen vsnprintf)
AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
if test x$enable_utf8 != xno; then
AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace mblen mbstowcs mbtowc wctomb wcwidth)
fi
if test x$ac_cv_func_snprintf = xno || test x$ac_cv_func_vsnprintf = xno; then
if test x$ac_cv_func_vsnprintf = xno; then
AM_PATH_GLIB_2_0(2.0.0,,
AC_MSG_ERROR([
*** snprintf() and/or vsnprintf() not found. GLIB 2.x not found either.
*** You need both snprintf() and vsnprintf(). Alternatively you can
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
*** vsnprintf() not found. GLIB 2.x not found either. You should
*** install the GLIB 2.x library which can be found at
*** ftp://ftp.gtk.org/.]),
glib)
fi
@@ -455,7 +455,7 @@ else
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
fi
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.]))
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors() command.]))
dnl Parse any configure options.
@@ -480,7 +480,7 @@ if test x$enable_utf8 != xno && \
test x$ac_cv_func_mbtowc = xyes && \
test x$ac_cv_func_wctomb = xyes && \
test x$ac_cv_func_wcwidth = xyes; then
AC_DEFINE(NANO_WIDE, 1, [Define this if your system has sufficient wide character support (a wide curses library, iswalnum(), iswpunct(), iswblank() or iswspace(), mblen(), mbstowcs(), mbtowc(), wctomb(), and wcwidth()).])
AC_DEFINE(ENABLE_UTF8, 1, [Define this if your system has sufficient UTF-8 support (a wide curses library, iswalnum(), iswpunct(), iswblank() or iswspace(), mblen(), mbstowcs(), mbtowc(), wctomb(), and wcwidth()).])
else
if test x$enable_utf8 = xyes; then
AC_MSG_ERROR([

View File

@@ -33,15 +33,16 @@
<h2><a href="#4">4. Running</a></h2>
<blockquote><p><a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
<a href="#4.2">4.2. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</a><br>
<a href="#4.3">4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
<a href="#4.4">4.4. Nano crashes when I type &lt;insert keystroke here&gt;!</a><br>
<a href="#4.5">4.5. Nano crashes when I resize my window. How can I fix that?</a><br>
<a href="#4.6">4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
<a href="#4.7a">4.7a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
<a href="#4.7b">4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
<a href="#4.8">4.8. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
<a href="#4.9">4.9. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
<a href="#4.10">4.10. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a></p></blockquote>
<a href="#4.3">4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</a><br>
<a href="#4.4">4.4. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
<a href="#4.5">4.5. Nano crashes when I type &lt;insert keystroke here&gt;!</a><br>
<a href="#4.6">4.6. Nano crashes when I resize my window. How can I fix that?</a><br>
<a href="#4.7">4.7. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
<a href="#4.8a">4.8a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
<a href="#4.8b">4.8b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
<a href="#4.9">4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
<a href="#4.10">4.10. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
<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>
@@ -62,7 +63,7 @@
<hr width="100%">
<h1><a name="1"></a>1. General</h1>
<h2><a name="1.1"></a>1.1 About this FAQ</h2>
<blockquote><p>This FAQ was originally written and maintained by Chris Allegretta &lt;<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>&gt;, who also happens to be the creator of nano. It is currently maintained by David Lawrence Ramsey &lt;<a href="mailto:pooka_regent@sluggy.net">pooka_regent@sluggy.net</a>&gt;. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
<blockquote><p>This FAQ was originally written and maintained by Chris Allegretta &lt;<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>&gt;, who also happens to be the creator of nano. It is currently maintained by David Lawrence Ramsey &lt;<a href="mailto:pooka109@cox.net">pooka109@cox.net</a>&gt;. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
<h2><a name="1.2"></a>1.2. How do I contribute to it?</h2>
<blockquote><p>Your best bet is to send it to the nano email address, <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a> and if it is useful enough it will be included in future versions.</p></blockquote>
<h2><a name="1.3"></a>1.3. What is GNU nano?</h2>
@@ -80,7 +81,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.8. 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.9. 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%">
@@ -167,7 +168,7 @@
<p>You can move between the buffers you have open with the <b>Meta-&lt;</b> and <b>Meta-&gt;</b> keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say &quot;Close&quot;, instead of the normal &quot;Exit&quot; when only one buffer is open.</p></blockquote>
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
<blockquote><p>To use verbatim input, you must be using nano 1.3.1 or newer. When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b>. (If you're not at a prompt, you'll get the message &quot;Verbatim Input&quot;.) Then press the key(s) that generate the character you want.</p>
<p>Alternatively, you can press <b>Meta-V</b> and then type a four-digit hexadecimal code from 0000 to ffff (case-insensitive), and the character with the corresponding value will be inserted instead.</p></blockquote>
<p>Alternatively, you can press <b>Meta-V</b> and then type a six-digit hexadecimal code from 000000 to 10FFFF (case-insensitive), and the character with the corresponding value will be inserted instead.</p></blockquote>
<h2><a name="3.9"></a>3.9. How do I make a .nanorc file that nano will read when I start it?</h2>
<blockquote><p>It's not hard at all! But, your version of nano must have been compiled with <b>--enable-nanorc</b>, and again must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the word <b>set</b> and the getopt_long flag for the feature, for example &quot;set nowrap&quot; or &quot;set suspend&quot;.</p></blockquote>
<hr width="100%">
@@ -181,19 +182,21 @@
<blockquote><p>Try setting your $TERM variable to 'vt100'. Nano doesn't yet support every term entry under the sun.</p>
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
<h2><a name="4.3"></a>4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
<h2><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h2>
<blockquote><p>You can use the <b>-K</b> or <b>--rebindkeypad</b> options on the command line, or add the line <b>set rebindkeypad</b> to your .nanorc. However, nano's mouse support won't work properly if you do any of these things.</p></blockquote>
<h2><a name="4.4"></a>4.4. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, or Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
<h2><a name="4.4"></a>4.4. Nano crashes when I type &lt;insert keystroke here&gt;!</h2>
<h2><a name="4.5"></a>4.5. Nano crashes when I type &lt;insert keystroke here&gt;!</h2>
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or to <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</p></blockquote>
<h2><a name="4.5"></a>4.5. Nano crashes when I resize my window. How can I fix that?</h2>
<h2><a name="4.6"></a>4.6. Nano crashes when I resize my window. How can I fix that?</h2>
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9 would be great, 0.9.12 is recommended).</p></blockquote>
<h2><a name="4.6"></a>4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
<h2><a name="4.7"></a>4.7. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
<blockquote><p>The help (^G) and justify (^J) function were among the last to be written. To show the improvements that nano had over Pico (go to line # and replace), ^_ and ^\ were put on the shortcut list. Later, ^G came back in place of ^_ as it proved to be very valuable for new Unix users. If you use the <b>-p</b> option to nano (or hit Meta-P) you will get the same shortcuts at the bottom as Pico.</p></blockquote>
<h2><a name="4.7a"></a>4.7a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
<h2><a name="4.8a"></a>4.8a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
<blockquote><p>In nano version 0.9.20, the default is to have a completely consistent user interface across all user input functions. This means that regardless of whether you're being asked for a filename to insert or write, or a string to search for, the previous value is already inserted before the cursor. If you prefer the old behavior, use the Pico emulation mode (-p or --pico) or just hit Meta-P while in nano (see the ^G help text for more details).</p></blockquote>
<h2><a name="4.7b"></a>4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
<h2><a name="4.8b"></a>4.8b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
<blockquote><p>It was decided that consistency was nice, but people are used to Pico's inconsistent behavior. Also, in version 1.1.99pre1, search and replace history was introduced. If you wish to edit your previous search/replace entry (or any previous entry), you can do so by hitting the up arrow to cycle through your history. This method allows the best of both worlds: You don't need to erase the previous string if you want to enter a new one, but you can with one keystroke recall previous entries for editing. Therefore there is now no "Pico mode", nano is and has always been a Pico <b>clone</b>, and clones by default should be compatible.</p></blockquote>
<h2><a name="4.8"></a>4.8. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
<h2><a name="4.9"></a>4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
<p>or if you use tcsh put this in your <b>.cshrc</b> file:</p>
@@ -206,10 +209,10 @@
<p>Mutt users should see an effect immediately the next time you log in, no further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
<h2><a name="4.9"></a>4.9. I've compiled nano with color support, but I don't see any color when I run it!</h2>
<h2><a name="4.10"></a>4.10. I've compiled nano with color support, but I don't see any color when I run it!</h2>
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Some example configurations are in the <b>nanorc.sample</b> that comes with the nano source or your nano package. See Section <a href="#3.9">3.9</a>.</p></blockquote>
<h2><a name="4.10"></a>4.10. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
<blockquote><p>Try holding down the Shift key and selecting the text as you normally would.</p></blockquote>
<h2><a name="4.11"></a>4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
<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>
@@ -249,7 +252,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>
<p>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>
2005/06/15 - Update description of --enable-extra, and add missing line breaks. (DLR)<br>
2005/06/13 - Minor capitalization and wording fixes. (DLR)<br>
2005/06/08 - Updated section 1.1 to mention the current maintainer. (DLR)<br>

View File

@@ -1,30 +1,30 @@
.\" Hey, EMACS: -*- nroff -*-
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003 by
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by
.\" Chris Allegretta <chrisa@asty.org>
.\"
.\" (c) 2003-2004 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
.\" pour l'adaptation française
.\" Adaptation française (c) 2003-2005 par
.\" Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
.\"
.\" This is free documentation, see the latest version of the GNU General
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" Ce document est libre. Reportez-vous à la dernière version de la
.\" licence publique générale GNU (GNU GPL) pour connaître ses
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
.\" conditions d'utilisation. Ce document est distribué sans
.\" AUCUNE garantie.
.\"
.\" $Id$
.TH NANO 1 "version 1.3.4" "17 août 2004"
.TH NANO 1 "version 1.3.9" "23 octobre 2005"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
.\"
.SH NOM
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
.SH SYNOPSIS
.B nano
.I [\+LIGNE]\ [options]\ [fichier]
.I [\+LIGNE,COLONNE]\ [options]\ [fichier]
.br
.SH DESCRIPTION
@@ -43,31 +43,35 @@ num
.SH OPTIONS
.TP
.B \+\fILIGNE\fR
Démarre avec le curseur positionné à la ligne numéro \fILIGNE\fR.
.B \+\fILIGNE\fP,\fICOLONNE\fP
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
la ligne \fILIGNE\fR au lieu de démarrer à la colonne\ 1, ligne\ 1.
.TP
.B \-?
Identique à \fB-h (\-\-help)\fP.
.TP
.B \-A (\-\-smarthome)
Active le fonctionnement évolué de la touche «\ Début\ ». Lorsque cette
touche est pressée à n'importe quel endroit excepté au tout début du
texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur se
positionnera à ce début de ligne (qu'il soit en avant ou en arrière). Si
le curseur est déjà au tout début de la ligne, il se placera au vrai
début de la ligne.
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque l'on
appuie sur cette touche à n'importe quel endroit excepté au tout début
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
arrière). Si le curseur est déjà , il se placera au vrai début de la
ligne.
.TP
.B \-B (\-\-backup)
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
version précédente, en ajoutant un tilde (~) au nom du fichier.
.TP
.B \-D (\-\-dos)
Écrit le fichier au format DOS.
.TP
.B \-E \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
.B \-C \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
de sécurité si celles-ci sont activées.
de sécurité uniques si celles-ci sont activées.
.TP
.B \-E (\-\-tabstospaces)
Convertit les tabulations clavier en espaces.
.TP
.B \-F (\-\-multibuffer)
Active le mode multifichier, autorisant l'édition simultanée de plusieurs
fichiers, si ce mode est disponible.
Active le mode multifichier, autorisant l'édition simultanée de
plusieurs fichiers, si ce mode est disponible.
.TP
.B \-H (\-\-historylog)
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
@@ -76,60 +80,73 @@ r
utiliser les fichiers nanorc.
.TP
.B \-I (\-\-ignorercfiles)
N'utilise pas les fichiers \fISYSCONFDIR/nanorc\fR et \fI~/.nanorc\fR, même si
\fBnano\fR est capable de les utiliser.
Ne pas utiliser pas les fichiers \fISYSCONFDIR/nanorc\fR et
\fI~/.nanorc\fR (si \fBnano\fR est capable de les utiliser).
.TP
.B \-M (\-\-mac)
Écrit le fichier au format Mac.
.B \-K (\-\-rebindkeypad)
Interprète les touches du pavé numérique afin qu'elles fonctionnent
toutes correctement. Vous ne devriez utiliser cette option que si ce
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
correctement lorsque cette option sera activée.
.TP
.B \-N (\-\-noconvert)
Désactive la conversion automatique des fichiers depuis les formats Mac et
DOS.
.TP
.B \-O (\-\-morespace)
Utiliser la ligne blanche située sous la ligne de titre comme
espace supplémentaire d'édition.
.TP
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
pour réaliser une justification correcte des citations. Si nano est
capable d'utiliser des expressions rationnelles, le préfixe par défaut
sera "^([\ \\t]*[|>:}#])+", sinon, ce sera ">\ ".
.TP
.B \-R (\-\-regexp)
Active l'utilisation d'expressions rationnelles lors des recherches, ainsi
que la possibilité d'utiliser \\n dans les chaînes de remplacement pour
faire référence à la n-ième sous-expression du motif de recherche, si
cette fonction est disponible.
.B \-R (\-\-restricted)
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
sur la ligne de commande, pas de lecture des fichiers nanorc,
interdiction de suspendre, interdiction d'ajouter au début, à la fin
ou de sauvegarder un fichier ayant déjà un nom sous un nom différent.
Cette option peut aussi être activée en appelant \fBnano\fP sous un nom
commençant par «\ r\ » (par exemple «\ rnano\ »).
.TP
.B \-S (\-\-smooth)
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
de défiler morceau-par-morceau.
.TP
.B \-T \fInombre\fP (\-\-tabsize=\fInombre\fP)
Définit la taille (largeur) des tabulations.
Définit la taille (largeur) des tabulations en nombre de colonnes. Le
nombre indiqué doit être strictement supérieur à 0. La valeur par défaut
est de 8.
.TP
.B \-U (\-\-quickblank)
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
d'état disparaîtront après une frappe clavier au lieu de 25. Notez que
\fB-c\fP annule cette option.
.TP
.B \-V (\-\-version)
Affiche le numéro de version et l'auteur.
.TP
.B \-W (\-\-wordbounds)
Détection plus précise des limites de mots, obtenue en considérant les
caractères de ponctuation comme faisant partie des mots.
.TP
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
Indique quel mode de colorisation syntaxique adopter, parmi les modes
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
disponible.
.TP
.B \-Z (\-\-restricted)
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
sur la ligne de commande, pas de lecture des fichiers nanorc,
interdiction de suspendre et interdiction de sauvegarder (ou d'ajouter
en tête ou en fin) un fichier ayant déjà un nom sous un nom différent.
Cette option peut aussi être activée en appelant \fBnano\fP sous un nom
commençant par «\ r\ » (par exemple «\ rnano\ »).
.TP
.B \-c (\-\-const)
Affiche en permanence la position du curseur.
Affiche en permanence la position du curseur. Notez que cette option
annule l'option \fB-U\fP.
.TP
.B \-d (\-\-rebinddelete)
Interprète différemment la touche «\ Supprimer\ », afin que les touches
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous devriez n'avoir besoin de cette option que si la touche
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
sur votre système.
Vous ne devriez avoir besoin de cette option que si, sur votre système,
la touche «\ Effacement arrière\ » produit l'effet de la touche
«\ Supprimer\ ».
.TP
.B \-h (\-\-help)
Affiche un résumé des options disponibles en ligne de commande.
@@ -139,16 +156,16 @@ Indentation automatique. Commence chaque nouvelle ligne au m
la ligne précédente. Utile pour l'édition de code source.
.TP
.B \-k (\-\-cut)
^K coupe le texte du curseur à la fin de la ligne, au lieu de couper la
Coupe le texte du curseur à la fin de la ligne, au lieu de couper la
ligne entière.
.TP
.B \-l (\-\-nofollow)
Si le fichier édité est un lien symbolique, remplace le lien par le
nouveau fichier, sans le suivre. Ce mode ne serait-il pas utile pour éditer
les fichiers de \fI/tmp\fR ?
Si le fichier édité est un lien symbolique, au lieu de le suivre,
remplace le lien par le nouveau fichier. Sans doute utile pour éditer
les fichiers de \fI/tmp\fR, non\ ?
.TP
.B \-m (\-\-mouse)
Active l'utilisation de la souris (si elle est disponible sur votre
Active l'utilisation de la souris (si elle est disponible pour votre
système).
.TP
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
@@ -161,18 +178,18 @@ Pr
par le terminal.
.TP
.B \-r \fIcolonne\fP (\-\-fill=\fIcolonne\fP)
Passe automatiquement à la ligne à la colonne \fIcolonne\fR. Par défaut, le
passage à la ligne se fait à la taille de l'écran moins huit. Si la
valeur indiquée est négative, le point de passage à la ligne sera
calculé relativement au bord droit de l'écran. Cela permet de faire varier
le point de passage à la ligne lorsque l'on change la taille de l'écran.
Passe automatiquement à la ligne une fois arrivé à la colonne
\fIcolonne\fR. Si la valeur indiquée est de 0 ou moins, le point de
passage à la ligne aura lieu à la taille de l'écran moins \fIcolonne\fR.
Cela permet de faire varier le point de passage à la ligne lorsque l'on
change la taille de l'écran. La valeur par défaut est de -8.
.TP
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
Choix d'un correcteur orthographique de remplacement.
.TP
.B \-t (\-\-tempfile)
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
demande de confirmation. Identique à l'option -t de Pico.
demande de confirmation. Identique à l'option \fB-t\fP de Pico.
.TP
.B \-v (\-\-view)
Mode visualisation (lecture seule).
@@ -190,14 +207,14 @@ Autorise
Ignoré, pour être compatible avec Pico.
.SH "FICHIERS D'INITIALISATION"
\fBnano\fR lit les fichiers d'initialisation dans l'ordre suivant\ :
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de manuel
de \fBnanorc\fR(5) et au fichier-exemple \fInanorc.sample\fR qui devrait être
livré avec \fBnano\fR.
\fBnano\fR lit les fichiers d'initialisation dans l'ordre suivant\ :
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de
manuel de \fBnanorc(5)\fR et au fichier d'exemple \fInanorc.sample\fR,
qui devraient tous les deux être livrés avec \fBnano\fR.
.SH NOTES
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
ligne de commande ou dans le fichier nanorc, \fBnano\fR prendra
ligne de commande ou dans l'un des fichiers nanorc, \fBnano\fR prendra
la commande indiquée par la variable d'environnement \fBSPELL\fR si
elle est définie.
@@ -223,6 +240,10 @@ La liste de discussion anglophone \fBnano\fR est disponible via
Pour vous abonner, envoyez un courrier électronique à
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
N'hésitez pas également à envoyez vos commentaires, suggestions et
corrections relatives à l'adaptation française de cette page de manuel
ou du logiciel à \fBjean-philippe.guerard@corbeaunoir.org\fR.
.SH "SITE INTERNET"
http://www.nano-editor.org/
@@ -234,13 +255,25 @@ http://www.nano-editor.org/
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
.SH AUTEUR
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
\fIAUTHORS\fR et \fITHANKS\fR pour plus d'information). Cette page de manuel a
été initialement rédigée par Jordi Mallach
<jordi@sindominio.net> pour le système GNU Debian (mais elle peut
être utilisée par d'autres).
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
\fIAUTHORS\fR et \fITHANKS\fR pour plus d'information). Cette page de
manuel a été initialement rédigée par Jordi Mallach
<jordi@sindominio.net> pour le système GNU Debian (mais elle peut être
utilisée par d'autres).
.SH TRADUCTION
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.
Cette version a été relue par Gérard Delafond.
Adaptation française du 4\ septembre\ 2004 par
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
traducteur.
La version originale la plus à jour de ce document est toujours
consultable via la commande :
LANGUAGE=en man nano

View File

@@ -1,7 +1,8 @@
.\" Hey, EMACS: -*- nroff -*-
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
.\" nanorc.5 is Copyright (C) 2003, 2004, 2005 Free Software
.\" Foundation, Inc.
.\"
.\" (c) 2003-2004 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
.\" (c) 2003-2005 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
.\" pour l'adaptation française
.\"
.\" This is free documentation, see the latest version of the GNU General
@@ -9,10 +10,11 @@
.\"
.\" Ce document est libre. Reportez-vous à la dernière version de la
.\" licence publique générale GNU (GNU GPL) pour connaître ses
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
.\" conditions d'utilisation. Ce document est distribué sans
.\" AUCUNE garantie.
.\"
.\" $Id$
.TH NANORC 5 "version 1.3.4" "17 août 2004"
\" $Id$
.TH NANORC 5 "version 1.3.9" "23 octobre 2005"
.\" Please adjust this date whenever revising the manpage.
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
@@ -21,27 +23,27 @@ nanorc \- fichier de configuration de l'
.SH DESCRIPTION
Cette page de manuel décrit brièvement le fichier de configuration de
l'éditeur \fBnano\fP du projet GNU.
l'éditeur \fBnano\fP GNU.
.PP
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à
remplacer Pico, l'éditeur par défaut du paquet non-libre Pine.
remplacer Pico, l'éditeur par défaut du paquet non libre Pine.
\fBnano\fP ne se contentant pas de copier l'interface et l'ergonomie de
Pico, il offre également certaines fonctionnalités manquantes (ou
désactivées par défaut) de Pico. Ces fonctionnalités sont, par exemple,
les fonctions de recherche et de remplacement, et la possibilité de
les fonctions de recherche et de remplacement et la possibilité de
sauter directement à un numéro de ligne.
.PP
Le fichier \fInanorc\fP contient les paramètres par défaut de
\fBnano\fP. Lors de son démarrage, nano commence par lire le fichier de
configuration général \fISYSCONFDIR/nanorc\fP, puis lit le fichier de
configuration personnel de l'utilisateur \fI~/.nanorc\fP.
\fBnano\fP. Lors de son démarrage, nano commencera par lire le fichier
de configuration général \fISYSCONFDIR/nanorc\fP, puis lira le fichier
de configuration personnel de l'utilisateur \fI~/.nanorc\fP.
.SH OPTIONS
Le fichier de configuration accepte une série de commandes «\ set\ »
(activer) et «\ unset\ » (désactiver), qui permettent de définir la
configuration de nano au démarrage sans avoir à utiliser d'options sur
la ligne de commande.
De plus, les mots clefs «\ syntax\ » (syntaxe) et «\ color\ » (couleur)
la ligne de commande. De plus, les mots clefs «\ syntax\ » (syntaxe),
«\ color\ » (couleur) et «\ icolor\ » (couleur insensible à la casse)
sont utilisés pour définir les règles de colorisation pour différents
motifs de texte. Nano lira une commande par ligne.
@@ -59,20 +61,42 @@ Les commandes et arguments reconnus sont\ :
Active l'indentation automatique.
.TP
\fBset/unset backup\fP
Crée des copie de sécurité nommées
Crée des copies de sécurité nommées
.IR nom_du_fichier~ .
.TP
.B set backupdir \fIrépertoire\fP
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
de sécurité uniques, si l'enregistrement de copies de sécurité est
activé.
.TP
.B set/unset backwards
Par défaut, les recherches se font vers l'arrière.
.TP
.B set brackets \fIchaîne\fP
Définit les caractères considérés comme des fermetures de parenthèses.
Ces caractères ne doivent pas contenir d'espaces. Seules les
ponctuations terminales, éventuellement suivies de parenthèses
fermantes, peuvent terminer une phrase.
(N.D.T.\ : reportez-vous au paragraphe sur l'option \fBpunct\fR pour
plus d'informations.)
.TP
.B set/unset casesensitive
Par défaut, les recherches ne tiennent pas compte de la casse.
.TP
\fBset/unset const\fP
Affiche en permanence la position du curseur dans la ligne d'état.
.TP
\fBset/unset cut\fP
Par défaut, ^K coupe le texte du curseur jusqu'à la fin de la ligne, au
lieu de couper la ligne entière.
Par défaut, coupe le texte du curseur à la fin de la ligne, au lieu de
couper la ligne entière.
.TP
\fBset fill \fIn\fP\fP
Passe automatiquement à la ligne à la colonne \fIn\fP. Si la valeur
indiquée est 0 ou moins, la longueur de la ligne sera égale à la largeur
de l'écran moins \fIn\fP. La valeur par défaut est -8.
Passe automatiquement à la ligne une fois arrivé à la colonne \fIn\fR.
Si la valeur indiquée est de 0 ou moins, le point de passage à la ligne
aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de faire
varier le point de passage à la ligne lorsque l'on change la taille de
l'écran. La valeur par défaut est de -8.
.TP
\fBset/unset historylog\fP
Active l'utilisation de
@@ -80,6 +104,14 @@ Active l'utilisation de
pour enregistrer et relire les chaînes ayant fait l'objet d'une
recherche ou d'un remplacement.
.TP
.B set/unset morespace
Utiliser la ligne blanche située sous la ligne de titre comme espace
supplémentaire d'édition.
.TP
.B set/unset mouse
Active l'utilisation de la souris, afin que des clics souris puissent
être utilisés pour marquer le texte ou accéder aux raccourcis.
.TP
\fBset/unset multibuffer\fP
Mode multifichier\ : permet de charger les fichiers dans leur propre
espace.
@@ -96,7 +128,7 @@ D
\fBset/unset nowrap\fP
Désactive le passage automatique à la ligne.
.TP
\fBset operatingdir "\fIrépertoire\fP"\fP
\fBset operatingdir \fIrépertoire\fP\fP
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
le répertoire courant, afin que les fichiers soient lus depuis ce
@@ -105,19 +137,23 @@ r
\fBset/unset preserve\fP
Préserve les séquences XON et XOFF (^Q et ^S).
.TP
\fBset punct "\fIchaîne\fP"\fP
\fBset punct \fIchaîne\fP\fP
Définit les caractères interprétés comme des ponctuations terminales.
Ces caractères ne peuvent inclure d'espaces ou de tabulations. Seules les
ponctuations terminales, éventuellement suivies de crochets fermants,
peuvent terminer une phrase.
Ces caractères ne peuvent inclure de blancs. Seules les ponctuations
terminales, éventuellement suivies de parenthèses fermantes, peuvent
terminer une phrase.
(N.D.T.\ : ce réglage permet de conserver 2\ espaces au lieu d'une
derrière les ponctuations terminales lors de la justification, ce qui
(N.D.T.\ : ce réglage permet, lors de la justification, de conserver 2\
espaces au lieu d'une derrière les ponctuations terminales, ce qui
correspond aux normes typographiques anglo-saxonnes, mais n'a pas lieu
d'être en français. Pour le français, le plus simple est d'indiquer dans
le fichier nanorc une chaîne vide pour ce paramètre.)
d'être en français. Pour le français, le plus simple est d'indiquer,
dans le fichier nanorc, une chaîne vide pour ce paramètre.)
.TP
\fBset quotestr "\fIchaîne\fP"\fP
.B set/unset quickblank
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
d'état disparaîtront après une frappe clavier au lieu de 25.
.TP
\fBset quotestr \fIchaîne\fP\fP
Définit le préfixe par défaut utilisé pour les citations dans les
courriers électroniques. Ce préfixe est utilisé pour réaliser une
justification correcte de ces citations. Il s'agira, si votre système le
@@ -131,22 +167,28 @@ Sinon, ce sera ">\ ". Notez que le
caractère de tabulation.
.TP
\fBset/unset rebinddelete\fP
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous devriez uniquement avoir besoin de cette option si la touche
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
sur votre système.
Interprète différemment la touche «\ Supprimer\ », afin que les touches
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
Vous ne devriez avoir besoin de cette option que si, sur votre système,
la touche «\ Effacement arrière\ » produit l'effet de la touche «\
Supprimer\ ».
.TP
.B set/unset rebindkeypad
Interprète les touches du pavé numérique afin qu'elles fonctionnent
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
\fBset/unset regexp\fP
Utilise par défaut des expressions rationnelles pour les recherches.
.TP
\fBset/unset smarthome\fP
Active le fonctionnement évolué de la touche «\ Début\ ». Lorsque cette
touche est pressée à n'importe quel endroit excepté au tout début du
texte d'une ligne (i.\ e. au premier caractère non-blanc), le curseur se
positionnera à ce début de ligne (qu'il soit en avant ou en arrière). Si
le curseur est déjà au tout début de la ligne, il se placera au vrai
début de la ligne.
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque
cette touche est pressée à n'importe quel endroit excepté au tout début
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
arrière). Si le curseur est déjà , il se placera au vrai début de la
ligne.
.TP
\fBset/unset smooth\fP
Active le défilement ligne-par-ligne du texte.
@@ -156,52 +198,76 @@ Utilise le correcteur orthographique \fIprogramme\fP au lieu du
correcteur intégré, qui s'appuie sur \fIspell\fP.
.TP
\fBset/unset suspend\fP
Autorise à suspendre nano avec ^Z.
Autorise à suspendre nano.
.TP
\fBset tabsize \fIn\fP\fP
Utilise une largeur de tabulation de \fIn\fP au lieu de la valeur par
défaut (8). Cette valeur doit être supérieur à 0.
Utilise une taille de tabulation de \fIn\fP colonnes. Cette valeur doit
être strictement supérieure à 0. La valeur par défaut est de\ 8.
.TP
.B set/unset tabstospaces
Convertit les tabulations clavier en espaces.
.TP
\fBset/unset tempfile\fP
S'il a été modifié, le fichier sera sauvegardé automatiquement en
quittant, sans demande de confirmation.
.TP
\fBset/unset view\fP
Interdit la modification du fichier.
Interdit de modifier les fichiers.
.TP
\fBset whitespace "\fIchaîne\fP"\fP
\fBset whitespace \fIchaîne\fP\fP
Définit les deux caractères utilisés pour afficher les premiers
caractères de tabulations et d'espaces. Cela ne doit pas être
des caractère de contrôle.
caractères des tabulations et des espaces. Ces deux caractères doivent
être mono-colonne.
.TP
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
.B set/unset wordbounds
Détection plus précise des limites de mots, obtenue en considérant les
caractères de ponctuation comme faisant partie des mots.
.TP
.B syntax \fIchaîne\fP ["\fImotif_de_fichier\fP" ... ]
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
l'option \fB-Y\fP, ou qui sera automatiquement activé si le nom du
l'option \fB-Y\fP ou qui sera automatiquement activée si le nom du
fichier en cours correspond au \fImotif_de_fichier\fP. Toutes les
instructions suivantes de colorisation \fBcolor\fP s'appliqueront à
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
instructions suivantes de colorisation \fBcolor\fP ou \fBicolor\fP
s'appliqueront à cette syntaxe, jusqu'à la définition d'une nouvelle
syntaxe.
La syntaxe nommée \fInone\fP (aucune) est réservée\ ; si elle est
indiquée dans la ligne de commande, cela revient à ne définir aucune
syntaxe. La syntaxe nommée \fIdefault\fP (par défaut) est spéciale, elle
ne nécessite aucun motif de \fImotif_de_fichier\fP, et s'applique aux
fichiers ne correspondant à aucun des \fImotif_de_fichier\fP des autres
syntaxes.
.TP
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
l'expression rationnelle \fImotif\fP en utilisant la couleur de texte
\fIcouleur_texte\fP et éventuellement la couleur de fond
\fIcouleur_fond\fP. Les couleurs acceptées par \fBnano\fP pour le
texte et le fond sont\ : \fIwhite\fP (blanc), \fIblack\fP (noir),
\fIred\fP (rouge), \fIblue\fP (bleu), \fIgreen\fP (vert), \fIyellow\fP
(jaune), \fImagenta\fP, et \fIcyan\fP. Vous pouvez ajouter à
ces couleurs le préfixe \fIbright\fP pour obtenir une couleur plus
lumineuse. Si votre terminal est capable de gérer la transparence, ne
pas spécifier de \fIcouleur_fond\fP indique à \fBnano\fP d'essayer
d'utiliser un fond transparent.
\fIcouleur_texte\fP et la couleur de fond \fIcouleur_fond\fP, l'une de
ces deux couleurs au moins devant être définie. Les couleurs acceptées
par \fBnano\fP pour le texte et le fond sont\ : \fIwhite\fP (blanc),
\fIblack\fP (noir), \fIred\fP (rouge), \fIblue\fP (bleu), \fIgreen\fP
(vert), \fIyellow\fP (jaune), \fImagenta\fP, et \fIcyan\fP. Pour la
couleur du texte, vous pouvez ajouter à ces couleurs le préfixe
\fIbright\fP (lumineux) pour obtenir une couleur plus lumineuse. Si
votre terminal est capable de gérer la transparence, ne pas spécifier de
\fIcouleur_fond\fP indique à \fBnano\fP d'essayer d'utiliser un fond
transparent.
.TP
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
compte de la casse.
.TP
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
Affiche les expressions commençant par \fImotif_début\fP et se terminant
par \fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
et éventuellement la couleur de fond \fIcouleur_fond\fP. Cela permet à
la colorisation syntaxique de s'étendre sur plusieurs lignes. Notez que
toutes les occurrences successives de \fImotif_début\fP après le
\fImotif_début\fP initial seront surlignées jusqu'à la prochaine instance
de \fImotif_fin\fP.
et la couleur de fond \fIcouleur_fond\fP, l'une de ces deux couleurs au
moins devant être définie. Cela permet à la colorisation syntaxique de
s'étendre sur plusieurs lignes. Notez que toutes les occurrences
successives de \fImotif_début\fP après le \fImotif_début\fP initial
seront surlignées jusqu'à la prochaine instance de \fImotif_fin\fP.
.TP
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
compte de la casse.
.SH FICHIERS
.TP
@@ -225,6 +291,18 @@ Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
manuel a été rédigée par Jordi Mallach <jordi@gnu.org>.
.SH TRADUCTION
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.
Cette version a été relue par Gérard Delafond.
Adaptation française du 4\ septembre\ 2004 par
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.
Un maximum de soin a été apporté lors de l'élaboration de cette
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
vous en rencontrez, que ce soit dans la version française ou dans la
version originale, n'hésitez pas à les signaler à l'auteur ou au
traducteur.
La version originale la plus à jour de ce document est toujours
consultable via la commande :
LANGUAGE=en man nano

View File

@@ -6,7 +6,7 @@
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" $Id$
.TH NANO 1 "version 1.3.8" "June 27, 2005"
.TH NANO 1 "version 1.3.9" "September 27, 2005"
.\" Please adjust this date whenever revising the manpage.
.\"
@@ -68,6 +68,11 @@ stored for later editing, if nanorc support is configured.
Don't look at \fISYSCONFDIR/nanorc\fP or \fI~/.nanorc\fP, if nanorc
support is available.
.TP
.B \-K (\-\-rebindkeypad)
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
.TP
.B \-N (\-\-noconvert)
Disable automatic conversion of files from DOS/Mac format.
.TP
@@ -101,6 +106,10 @@ keystroke instead of 25. Note that \fB-c\fP cancels this out.
.B \-V (\-\-version)
Show the current version number and author.
.TP
.B \-W (\-\-wordbounds)
Detect word boundaries more accurately by treating punctuation
characters as part of a word.
.TP
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
Specify a specific syntax highlighting from the \fInanorc\fP to use, if
available.

View File

@@ -6,7 +6,7 @@
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" $Id$
.TH NANORC 5 "version 1.3.8" "June 27, 2005"
.TH NANORC 5 "version 1.3.9" "September 27, 2005"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -112,7 +112,7 @@ Set the characters treated as closing punctuation. They cannot contain
blank characters. Only closing punctuation, optionally followed by
closing brackets, can end sentences.
.TP
.B set quickblank
.B set/unset quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25.
.TP
@@ -131,6 +131,11 @@ Interpret the Delete key differently so that both Backspace and Delete
work properly. You should only need to use this option if Backspace
acts like Delete on your system.
.TP
.B set/unset rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
.TP
.B set/unset regexp
Do regular expression searches by default.
.TP
@@ -168,11 +173,20 @@ Disallow file modification.
Set the two characters used to display the first characters of tabs and
spaces. They must be single-column characters.
.TP
.B set/unset wordbounds
Detect word boundaries more accurately by treating punctuation
characters as part of a word.
.TP
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
Defines a syntax named \fIstr\fP which can be activated via the \fB-Y\fP
flag, or will be automatically activated if the current filename matches
\fIfileregex\fP. All following \fBcolor\fP and \fBicolor\fP statements
will apply to \fIsyntax\fP until a new syntax is defined.
The \fInone\fP syntax is reserved; specifying it on the command line is
the same as not having a syntax at all. The \fIdefault\fP syntax is
special: it takes no \fIfileregex\fP, and applies to files that don't
match any other syntax's \fIfileregex\fP.
.TP
.B color \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
For the currently defined syntax, display all expressions matching

View File

@@ -103,6 +103,9 @@
## Fix Backspace/Delete confusion problem.
# set rebinddelete
## Fix numeric keypad key confusion problem.
# set rebindkeypad
## Do extended regular expression searches by default.
# set regexp
@@ -141,18 +144,27 @@
## (00B7 hexadecimal) seem to be good values for these.
# set whitespace " "
## Detect word boundaries more accurately by treating punctuation
## characters as part of a word.
# set wordbounds
## Color setup
##
## Format:
##
## syntax "short description" ["filename regex" ...]
##
## (The "none" syntax is reserved; specifying it on the command line is
## the same as not having a syntax at all. The "default" syntax is
## special: it takes no filename regexes, and applies to files that
## don't match any other syntax's filename regexes.)
##
## color foreground,background "regex" ["regex"...]
## or
## icolor foreground,background "regex" ["regex"...]
##
## "color" will do case sensitive matches, while "icolor" will do case
## insensitive matches.
## ("color" will do case sensitive matches, while "icolor" will do case
## insensitive matches.)
##
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
## You may use the prefix "bright" to mean a stronger color highlight
@@ -165,17 +177,19 @@
## to set the background color to black or white.
##
# syntax "c-file" "\.(c|C|cc|cpp|cxx|h|H|hh|hpp|hxx)$"
# color red "\<[A-Z_]{2,}\>"
# color brightred "\<[A-Z_][A-Z_0-9]+\>"
# color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
# color green "\<(u_?)?int(8|16|32|64|ptr)_t\>"
# color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
# color brightyellow "\<(for|if|while|do|else|case|default|switch|goto|continue|break|return)\>"
# color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
# color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
# color magenta "\<(goto|continue|break|return)\>"
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
# color brightmagenta "'([^\]|(\\['abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
##
## GCC builtins
##
# color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(asm|builtin|inline|restrict|typeof)__"
# color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
##
## You will in general want your comments and strings to come last,
## because syntax highlighting rules will be applied in the order they
@@ -183,7 +197,7 @@
##
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
##
## This string is VERY resource intensive!!!
## This string is VERY resource intensive!
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
##
## And we want to have some nice comment highlighting too
@@ -197,7 +211,7 @@
## Here is a short example for TeX files
# syntax "TeX" "\.tex$"
# color green "\\.|\\[A-Za-z]*"
# icolor green "\\.|\\[A-Z]*"
# color magenta "[{}]"
# color blue "%.*"
@@ -297,13 +311,26 @@
# color brightblue "//.*"
# color brightblue start="/\*" end="\*/"
## Here is an example for Bourne shell scripts
##
# syntax "shellscript" "\.sh$"
# icolor brightgreen "^[_A-Z0-9]+\(\)"
# color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>"
# color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
# color green "-(L|d|e|f|g|r|u|w|x)\>"
# color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
# color brightblue "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>"
# icolor brightred "\$\{?[_A-Z0-9]+\}?"
# color yellow "#.*$"
# color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
## Here is an example for your .nanorc
##
# syntax "nanorc" "(\.|/|)nanorc$"
## 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:]]+(regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace)\>"
# 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 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

@@ -8,8 +8,8 @@
@c Run `makeinfo' rather than `texinfo-format-buffer'.
@smallbook
@set EDITION 0.1
@set VERSION 1.3.8
@set UPDATED 27 Jun 2005
@set VERSION 1.3.9
@set UPDATED 27 Sep 2005
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @code{nano}
@subtitle a small and friendly text editor.
@subtitle version 1.3.8
@subtitle version 1.3.9
@author Chris Allegretta
@page
@@ -138,6 +138,11 @@ Enable multiple file buffers, if available.
Don't look at SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
available.
@item -K, --rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
@item -N, --noconvert
Do not convert files from DOS/Mac format.
@@ -172,6 +177,10 @@ keystroke instead of 25. Note that -c cancels this out.
@item -V, --version
Print the version number and copyright and quit.
@item -W, --wordbounds
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
available.

View File

@@ -1,9 +1,54 @@
2005-06-28 David Lawrence Ramsey <pooka_regent@sluggy.net>
2006-10-23 Jordi Mallach <jordi@gnu.org>
* ca.po: Updated Catalan translation.
* eu.po: Updated Basque translation by Mikel Olasagasti.
* fr.po: Updated French translation by Jean-Philippe Guérard.
* it.po: Updated Italian translation by Marco Colombo.
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
* nl.po: Updated Dutch translation by Benno Schulenberg.
* zh_TW: Updated Traditional Chinese translation by
Wei-Lun Chao.
2006-08-22 Jordi Mallach <jordi@gnu.org>
* bg.po: New Bulgarian translation by
Yavor Doganov <yavor@doganov.org>.
* LINGUAS: Added "bg".
2005-08-16 Jordi Mallach <jordi@gnu.org>
* ca.po: Updated Catalan translation.
2005-08-16 Jordi Mallach <jordi@gnu.org>
* nl.po: Updated Dutch translation by
Benno Schulenberg and Reinout van Schouwen.
2005-07-24 David Lawrence Ramsey <pooka109@cox.net>
* POTFILES.in: Add text.c.
2005-07-19 Jordi Mallach <jordi@gnu.org>
* ms.po: Updated Malay translation by
Sharuzzaman Ahmat Raslan.
2005-07-18 Jordi Mallach <jordi@gnu.org>
* fr.po: Updated French translation by
Jean-Philippe Guérard.
2005-07-07 Jordi Mallach <jordi@gnu.org>
* it.po: Updated Italian translation by Marco Colombo.
* ca.po: Updated Catalan translation.
2005-06-28 David Lawrence Ramsey <pooka109@cox.net>
* POTFILES.in: Remove source files that contain no translatable
strings.
2005-06-19 David Lawrence Ramsey <pooka_regent@sluggy.net>
2005-06-19 David Lawrence Ramsey <pooka109@cox.net>
* pt_BR.po: Typo fix.

View File

@@ -1,2 +1,2 @@
# List of available languages.
ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk vi zh_TW
bg ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk vi zh_TW

View File

@@ -6,5 +6,6 @@ src/global.c
src/nano.c
src/rcfile.c
src/search.c
src/text.c
src/utils.c
src/winio.c

1682
po/bg.po Normal file

File diff suppressed because it is too large Load Diff

1150
po/ca.po

File diff suppressed because it is too large Load Diff

1545
po/eu.po

File diff suppressed because it is too large Load Diff

1269
po/fr.po

File diff suppressed because it is too large Load Diff

1118
po/it.po

File diff suppressed because it is too large Load Diff

1592
po/ms.po

File diff suppressed because it is too large Load Diff

2388
po/nl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -15,6 +15,7 @@ nano_SOURCES = chars.c \
proto.h \
rcfile.c \
search.c \
text.c \
utils.c \
winio.c

View File

@@ -24,19 +24,25 @@
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "proto.h"
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
#ifdef HAVE_WCHAR_H
#include <wchar.h>
#endif
#ifdef HAVE_WCTYPE_H
#include <wctype.h>
#endif
static const wchar_t bad_wchar = 0xFFFD;
/* If we get an invalid multibyte sequence, we treat it as
* Unicode FFFD (Replacement Character), unless we're
* determining if it's a control character or searching for a
* match to it. */
static const char *bad_mbchar = "\xEF\xBF\xBD";
static const int bad_mbchar_len = 3;
#endif
#ifndef HAVE_ISBLANK
@@ -47,7 +53,7 @@ bool nisblank(int c)
}
#endif
#if !defined(HAVE_ISWBLANK) && defined(NANO_WIDE)
#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
/* This function is equivalent to iswblank(). */
bool niswblank(wchar_t wc)
{
@@ -67,14 +73,13 @@ bool is_alnum_mbchar(const char *c)
{
assert(c != NULL);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len <= 0) {
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
mbtowc(NULL, NULL, 0);
wc = (unsigned char)*c;
wc = bad_wchar;
}
return iswalnum(wc);
@@ -88,14 +93,13 @@ bool is_blank_mbchar(const char *c)
{
assert(c != NULL);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len <= 0) {
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
mbtowc(NULL, NULL, 0);
wc = (unsigned char)*c;
wc = bad_wchar;
}
return iswblank(wc);
@@ -105,14 +109,14 @@ bool is_blank_mbchar(const char *c)
}
/* This function is equivalent to iscntrl(), except in that it also
* handles control characters with their high bits set. */
* handles high-bit control characters. */
bool is_cntrl_char(int c)
{
return (-128 <= c && c < -96) || (0 <= c && c < 32) ||
(127 <= c && c < 160);
}
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
/* This function is equivalent to iscntrl() for wide characters, except
* in that it also handles wide control characters with their high bits
* set. */
@@ -129,14 +133,13 @@ bool is_cntrl_mbchar(const char *c)
{
assert(c != NULL);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len <= 0) {
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
mbtowc(NULL, NULL, 0);
wc = (unsigned char)*c;
wc = bad_wchar;
}
return is_cntrl_wchar(wc);
@@ -150,14 +153,14 @@ bool is_punct_mbchar(const char *c)
{
assert(c != NULL);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len <= 0) {
if (c_mb_len < 0) {
mbtowc(NULL, NULL, 0);
wc = (unsigned char)*c;
wc = bad_wchar;
}
return iswpunct(wc);
@@ -178,9 +181,11 @@ bool is_word_mbchar(const char *c, bool allow_punct)
}
/* c is a control character. It displays as ^@, ^?, or ^[ch], where ch
* is c + 64. We return that character. */
* is (c + 64). We return that character. */
char control_rep(char c)
{
assert(is_cntrl_char(c));
/* Treat newlines embedded in a line as encoded nulls. */
if (c == '\n')
return '@';
@@ -190,11 +195,13 @@ char control_rep(char c)
return c + 64;
}
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
/* c is a wide control character. It displays as ^@, ^?, or ^[ch],
* where ch is c + 64. We return that wide character. */
* where ch is (c + 64). We return that wide character. */
wchar_t control_wrep(wchar_t wc)
{
assert(is_cntrl_wchar(wc));
/* Treat newlines embedded in a line as encoded nulls. */
if (wc == '\n')
return '@';
@@ -206,31 +213,69 @@ wchar_t control_wrep(wchar_t wc)
#endif
/* c is a multibyte control character. It displays as ^@, ^?, or ^[ch],
* where ch is c + 64. We return that multibyte character. */
* where ch is (c + 64). We return that multibyte character. If crep
* is an invalid multibyte sequence, it will be replaced with Unicode
* 0xFFFD (Replacement Character). */
char *control_mbrep(const char *c, char *crep, int *crep_len)
{
assert(c != NULL && crep != NULL && crep_len != NULL);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) <= 0) {
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
mbtowc(NULL, NULL, 0);
wc = (unsigned char)*c;
}
*crep_len = bad_mbchar_len;
strncpy(crep, bad_mbchar, *crep_len);
} else {
*crep_len = wctomb(crep, control_wrep(wc));
*crep_len = wctomb(crep, control_wrep(wc));
if (*crep_len <= 0) {
wctomb(NULL, 0);
*crep_len = 0;
if (*crep_len < 0) {
wctomb(NULL, 0);
*crep_len = 0;
}
}
} else {
#endif
*crep_len = 1;
*crep = control_rep(*c);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
}
#endif
return crep;
}
/* c is a multibyte non-control character. We return that multibyte
* character. If crep is an invalid multibyte sequence, it will be
* replaced with Unicode 0xFFFD (Replacement Character). */
char *mbrep(const char *c, char *crep, int *crep_len)
{
assert(c != NULL && crep != NULL && crep_len != NULL);
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
wchar_t wc;
/* Reject invalid Unicode characters. */
if (mbtowc(&wc, c, MB_CUR_MAX) < 0 || !is_valid_unicode(wc)) {
mbtowc(NULL, NULL, 0);
*crep_len = bad_mbchar_len;
strncpy(crep, bad_mbchar, *crep_len);
} else {
*crep_len = wctomb(crep, wc);
if (*crep_len < 0) {
wctomb(NULL, 0);
*crep_len = 0;
}
}
} else {
#endif
*crep_len = 1;
*crep = *c;
#ifdef ENABLE_UTF8
}
#endif
@@ -242,14 +287,14 @@ int mbwidth(const char *c)
{
assert(c != NULL);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX), width;
int width;
if (c_mb_len <= 0) {
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
mbtowc(NULL, NULL, 0);
wc = (unsigned char)*c;
wc = bad_wchar;
}
width = wcwidth(wc);
@@ -267,29 +312,30 @@ int mbwidth(const char *c)
int mb_cur_max(void)
{
return
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
ISSET(USE_UTF8) ? MB_CUR_MAX :
#endif
1;
}
/* Convert the value in chr to a multibyte character with the same
* wide character value as chr, if possible. If the conversion
/* Convert the Unicode value in chr to a multibyte character with the
* same wide character value as chr, if possible. If the conversion
* succeeds, return the (dynamically allocated) multibyte character and
* its length. Otherwise, return an undefined (dynamically allocated)
* multibyte character and a length of zero. */
char *make_mbchar(int chr, int *chr_mb_len)
char *make_mbchar(long chr, int *chr_mb_len)
{
char *chr_mb;
assert(chr_mb_len != NULL);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
chr_mb = charalloc(MB_CUR_MAX);
*chr_mb_len = wctomb(chr_mb, chr);
*chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
if (*chr_mb_len <= 0) {
/* Reject invalid Unicode characters. */
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
wctomb(NULL, 0);
*chr_mb_len = 0;
}
@@ -297,7 +343,7 @@ char *make_mbchar(int chr, int *chr_mb_len)
#endif
*chr_mb_len = 1;
chr_mb = mallocstrncpy(NULL, (char *)&chr, 1);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
}
#endif
@@ -306,33 +352,26 @@ char *make_mbchar(int chr, int *chr_mb_len)
/* Parse a multibyte character from buf. Return the number of bytes
* used. If chr isn't NULL, store the multibyte character in it. If
* bad_chr isn't NULL, set it to TRUE if we have a bad multibyte
* character. If col isn't NULL, store the new display width in it. If
* *str is '\t', we expect col to have the current display width. */
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
*col)
* col isn't NULL, store the new display width in it. If *buf is '\t',
* we expect col to have the current display width. */
int parse_mbchar(const char *buf, char *chr, size_t *col)
{
int buf_mb_len;
assert(buf != NULL);
if (bad_chr != NULL)
*bad_chr = FALSE;
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
/* Get the number of bytes in the multibyte character. */
buf_mb_len = mblen(buf, MB_CUR_MAX);
/* If buf contains a null byte or an invalid multibyte
* character, set bad_chr to TRUE (if it contains the latter)
* and interpret buf's first byte. */
if (buf_mb_len <= 0) {
/* If buf contains an invalid multibyte character, set bad_chr
* to TRUE and interpret buf's first byte. */
if (buf_mb_len < 0) {
mblen(NULL, 0);
if (buf_mb_len < 0 && bad_chr != NULL)
*bad_chr = TRUE;
buf_mb_len = 1;
}
} else if (buf_mb_len == 0)
buf_mb_len++;
/* Save the multibyte character in chr. */
if (chr != NULL) {
@@ -393,7 +432,7 @@ int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
else
(*col)++;
}
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
}
#endif
@@ -411,8 +450,7 @@ size_t move_mbleft(const char *buf, size_t pos)
/* There is no library function to move backward one multibyte
* character. Here is the naive, O(pos) way to do it. */
while (TRUE) {
int buf_mb_len = parse_mbchar(buf + pos - pos_prev, NULL, NULL,
NULL);
int buf_mb_len = parse_mbchar(buf + pos - pos_prev, NULL, NULL);
if (pos_prev <= (size_t)buf_mb_len)
break;
@@ -427,7 +465,7 @@ size_t move_mbleft(const char *buf, size_t pos)
* after the one at pos. */
size_t move_mbright(const char *buf, size_t pos)
{
return pos + parse_mbchar(buf + pos, NULL, NULL, NULL);
return pos + parse_mbchar(buf + pos, NULL, NULL);
}
#ifndef HAVE_STRCASECMP
@@ -466,7 +504,7 @@ int nstrncasecmp(const char *s1, const char *s2, size_t n)
* strings. */
int mbstrncasecmp(const char *s1, const char *s2, size_t n)
{
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
char *s1_mb = charalloc(MB_CUR_MAX);
char *s2_mb = charalloc(MB_CUR_MAX);
@@ -478,17 +516,17 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
bool bad_s1_mb = FALSE, bad_s2_mb = FALSE;
int s1_mb_len, s2_mb_len;
s1_mb_len = parse_mbchar(s1, s1_mb, NULL, NULL);
s1_mb_len = parse_mbchar(s1, s1_mb, NULL);
if (mbtowc(&ws1, s1_mb, s1_mb_len) <= 0) {
if (mbtowc(&ws1, s1_mb, s1_mb_len) < 0) {
mbtowc(NULL, NULL, 0);
ws1 = (unsigned char)*s1_mb;
bad_s1_mb = TRUE;
}
s2_mb_len = parse_mbchar(s2, s2_mb, NULL, NULL);
s2_mb_len = parse_mbchar(s2, s2_mb, NULL);
if (mbtowc(&ws2, s2_mb, s2_mb_len) <= 0) {
if (mbtowc(&ws2, s2_mb, s2_mb_len) < 0) {
mbtowc(NULL, NULL, 0);
ws2 = (unsigned char)*s2_mb;
bad_s2_mb = TRUE;
@@ -536,7 +574,7 @@ const char *nstrcasestr(const char *haystack, const char *needle)
/* This function is equivalent to strcasestr() for multibyte strings. */
const char *mbstrcasestr(const char *haystack, const char *needle)
{
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
char *r_mb = charalloc(MB_CUR_MAX);
char *q_mb = charalloc(MB_CUR_MAX);
@@ -552,17 +590,17 @@ const char *mbstrcasestr(const char *haystack, const char *needle)
while (*q != '\0') {
bool bad_r_mb = FALSE, bad_q_mb = FALSE;
r_mb_len = parse_mbchar(r, r_mb, NULL, NULL);
r_mb_len = parse_mbchar(r, r_mb, NULL);
if (mbtowc(&wr, r_mb, r_mb_len) <= 0) {
if (mbtowc(&wr, r_mb, r_mb_len) < 0) {
mbtowc(NULL, NULL, 0);
wr = (unsigned char)*r;
bad_r_mb = TRUE;
}
q_mb_len = parse_mbchar(q, q_mb, NULL, NULL);
q_mb_len = parse_mbchar(q, q_mb, NULL);
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
if (mbtowc(&wq, q_mb, q_mb_len) < 0) {
mbtowc(NULL, NULL, 0);
wq = (unsigned char)*q;
bad_q_mb = TRUE;
@@ -642,7 +680,7 @@ const char *revstrcasestr(const char *haystack, const char *needle,
const char *mbrevstrcasestr(const char *haystack, const char *needle,
const char *rev_start)
{
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
char *r_mb = charalloc(MB_CUR_MAX);
char *q_mb = charalloc(MB_CUR_MAX);
@@ -658,17 +696,17 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
while (*q != '\0') {
bool bad_r_mb = FALSE, bad_q_mb = FALSE;
r_mb_len = parse_mbchar(r, r_mb, NULL, NULL);
r_mb_len = parse_mbchar(r, r_mb, NULL);
if (mbtowc(&wr, r_mb, r_mb_len) <= 0) {
if (mbtowc(&wr, r_mb, r_mb_len) < 0) {
mbtowc(NULL, NULL, 0);
wr = (unsigned char)*r;
bad_r_mb = TRUE;
}
q_mb_len = parse_mbchar(q, q_mb, NULL, NULL);
q_mb_len = parse_mbchar(q, q_mb, NULL);
if (mbtowc(&wq, q_mb, q_mb_len) <= 0) {
if (mbtowc(&wq, q_mb, q_mb_len) < 0) {
mbtowc(NULL, NULL, 0);
wq = (unsigned char)*q;
bad_q_mb = TRUE;
@@ -730,13 +768,13 @@ size_t mbstrnlen(const char *s, size_t maxlen)
{
assert(s != NULL);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
size_t n = 0;
int s_mb_len;
while (*s != '\0') {
s_mb_len = parse_mbchar(s, NULL, NULL, NULL);
s_mb_len = parse_mbchar(s, NULL, NULL);
if (maxlen == 0)
break;
@@ -753,6 +791,52 @@ size_t mbstrnlen(const char *s, size_t maxlen)
}
#ifndef DISABLE_JUSTIFY
/* This function is equivalent to strchr() for multibyte strings. */
char *mbstrchr(const char *s, char *c)
{
assert(s != NULL && c != NULL);
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
bool bad_c_mb = FALSE, bad_s_mb = FALSE;
char *s_mb = charalloc(MB_CUR_MAX);
const char *q = s;
wchar_t ws, wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len < 0) {
mbtowc(NULL, NULL, 0);
wc = (unsigned char)*c;
bad_c_mb = TRUE;
}
while (*s != '\0') {
int s_mb_len = parse_mbchar(s, s_mb, NULL);
if (mbtowc(&ws, s_mb, s_mb_len) < 0) {
mbtowc(NULL, NULL, 0);
ws = (unsigned char)*s;
bad_s_mb = TRUE;
}
if (bad_s_mb == bad_c_mb && ws == wc)
break;
s += s_mb_len;
q += s_mb_len;
}
free(s_mb);
if (ws != wc)
q = NULL;
return (char *)q;
} else
#endif
return strchr(s, *c);
}
#ifdef ENABLE_NANORC
/* Return TRUE if the string s contains one or more blank characters,
* and FALSE otherwise. */
@@ -774,7 +858,7 @@ bool has_blank_mbchars(const char *s)
{
assert(s != NULL);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
if (ISSET(USE_UTF8)) {
char *chr_mb = charalloc(MB_CUR_MAX);
bool retval = FALSE;
@@ -782,7 +866,7 @@ bool has_blank_mbchars(const char *s)
while (*s != '\0') {
int chr_mb_len;
chr_mb_len = parse_mbchar(s, chr_mb, NULL, NULL);
chr_mb_len = parse_mbchar(s, chr_mb, NULL);
if (is_blank_mbchar(chr_mb)) {
retval = TRUE;
@@ -800,51 +884,18 @@ bool has_blank_mbchars(const char *s)
return has_blank_chars(s);
}
#endif /* ENABLE_NANORC */
/* This function is equivalent to strchr() for multibyte strings. */
char *mbstrchr(const char *s, char *c)
{
assert(s != NULL && c != NULL);
#ifdef NANO_WIDE
if (ISSET(USE_UTF8)) {
char *s_mb = charalloc(MB_CUR_MAX);
const char *q = s;
wchar_t ws, wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len <= 0) {
mbtowc(NULL, NULL, 0);
wc = (unsigned char)*c;
}
while (*s != '\0') {
int s_mb_len = parse_mbchar(s, s_mb, NULL, NULL);
if (mbtowc(&ws, s_mb, s_mb_len) <= 0) {
mbtowc(NULL, NULL, 0);
ws = (unsigned char)*s;
}
if (ws == wc)
break;
s += s_mb_len;
q += s_mb_len;
}
free(s_mb);
if (ws != wc)
q = NULL;
return (char *)q;
} else
#endif
return strchr(s, *c);
}
#endif /* !DISABLE_JUSTIFY */
#ifdef ENABLE_UTF8
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
bool is_valid_unicode(wchar_t wc)
{
return ((0 <= wc && wc <= 0x10FFFF) && (wc <= 0xD7FF || 0xE000 <=
wc) && (wc <= 0xFDCF || 0xFDF0 <= wc) && ((wc & 0xFFFF) <=
0xFFFD));
}
#endif
#ifdef ENABLE_NANORC
/* Check if the string s is a valid multibyte string. Return TRUE if it
* is, and FALSE otherwise. */
@@ -853,7 +904,7 @@ bool is_valid_mbstring(const char *s)
assert(s != NULL);
return
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
ISSET(USE_UTF8) ?
(mbstowcs(NULL, s, 0) != (size_t)-1) :
#endif

View File

@@ -24,11 +24,8 @@
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include "proto.h"
#ifdef ENABLE_COLOR
@@ -63,70 +60,147 @@ void set_colorpairs(void)
}
}
void do_colorinit(void)
/* Initialize the color information. */
void color_init(void)
{
assert(openfile != NULL);
if (has_colors()) {
const colortype *tmpcolor = NULL;
const colortype *tmpcolor;
#ifdef HAVE_USE_DEFAULT_COLORS
bool defok;
#endif
start_color();
/* Add in colors, if available. */
#ifdef HAVE_USE_DEFAULT_COLORS
/* Add in colors, if available. */
defok = (use_default_colors() != ERR);
#endif
for (tmpcolor = colorstrings; tmpcolor != NULL;
for (tmpcolor = openfile->colorstrings; tmpcolor != NULL;
tmpcolor = tmpcolor->next) {
short background = tmpcolor->bg;
short foreground = tmpcolor->fg, background = tmpcolor->bg;
if (foreground == -1) {
#ifdef HAVE_USE_DEFAULT_COLORS
if (!defok)
#endif
foreground = COLOR_WHITE;
}
if (background == -1)
if (background == -1) {
#ifdef HAVE_USE_DEFAULT_COLORS
if (!defok)
#endif
background = COLOR_BLACK;
}
init_pair(tmpcolor->pairnum, tmpcolor->fg, background);
init_pair(tmpcolor->pairnum, foreground, background);
#ifdef DEBUG
fprintf(stderr, "init_pair(): fg = %d, bg = %d\n",
tmpcolor->fg, tmpcolor->bg);
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", tmpcolor->fg, tmpcolor->bg);
#endif
}
}
}
/* Update the color information based on the current filename. */
void update_color(void)
void color_update(void)
{
const syntaxtype *tmpsyntax;
colortype *tmpcolor, *defcolor = NULL;
colorstrings = NULL;
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) {
const exttype *e;
assert(openfile != NULL);
for (e = tmpsyntax->extensions; e != NULL; e = e->next) {
/* Set colorstrings if we matched the extension regex. */
if (regexec(&e->val, filename, 0, NULL, 0) == 0)
colorstrings = tmpsyntax->color;
openfile->colorstrings = NULL;
if (colorstrings != NULL)
/* If we specified a syntax override string, use it. */
if (syntaxstr != NULL) {
/* If the syntax override is "none", it's the same as not having
* a syntax at all, so get out. */
if (strcmp(syntaxstr, "none") == 0)
return;
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) {
if (strcmp(tmpsyntax->desc, syntaxstr) == 0)
openfile->colorstrings = tmpsyntax->color;
if (openfile->colorstrings != NULL)
break;
}
}
/* If we haven't found a match, use the override string. */
if (colorstrings == NULL && syntaxstr != NULL) {
/* If we didn't specify a syntax override string, or if we did and
* there was no syntax by that name, get the syntax based on the
* file extension. */
if (openfile->colorstrings == NULL) {
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) {
if (mbstrcasecmp(tmpsyntax->desc, syntaxstr) == 0)
colorstrings = tmpsyntax->color;
exttype *e;
/* If this is the default syntax, it has no associated
* extensions. (We've checked for this and for duplicate
* syntax names elsewhere.) Skip over it here, but keep
* track of its color regexes. */
if (strcmp(tmpsyntax->desc, "default") == 0) {
defcolor = syntaxes->color;
continue;
}
for (e = tmpsyntax->extensions; e != NULL; e = e->next) {
bool not_compiled = (e->ext == NULL);
/* e->ext_regex has already been checked for validity
* elsewhere. Compile its specified regex if we haven't
* already. */
if (not_compiled) {
e->ext = (regex_t *)nmalloc(sizeof(regex_t));
regcomp(e->ext, e->ext_regex, REG_EXTENDED);
}
/* Set colorstrings if we matched the extension
* regex. */
if (regexec(e->ext, openfile->filename, 0, NULL,
0) == 0)
openfile->colorstrings = tmpsyntax->color;
if (openfile->colorstrings != NULL)
break;
/* Decompile e->ext_regex's specified regex if we aren't
* going to use it. */
if (not_compiled) {
regfree(e->ext);
free(e->ext);
e->ext = NULL;
}
}
}
}
/* If we didn't get a syntax based on the file extension, and we
* have a default syntax, use it. */
if (openfile->colorstrings == NULL && defcolor != NULL)
openfile->colorstrings = defcolor;
for (tmpcolor = openfile->colorstrings; tmpcolor != NULL;
tmpcolor = tmpcolor->next) {
/* tmpcolor->start_regex and tmpcolor->end_regex have already
* been checked for validity elsewhere. Compile their specified
* regexes if we haven't already. */
if (tmpcolor->start == NULL) {
tmpcolor->start = (regex_t *)nmalloc(sizeof(regex_t));
regcomp(tmpcolor->start, tmpcolor->start_regex,
REG_EXTENDED | (tmpcolor->icase ? REG_ICASE : 0));
}
if (tmpcolor->end_regex != NULL && tmpcolor->end == NULL) {
tmpcolor->end = (regex_t *)nmalloc(sizeof(regex_t));
regcomp(tmpcolor->end, tmpcolor->end_regex,
REG_EXTENDED | (tmpcolor->icase ? REG_ICASE : 0));
}
}
do_colorinit();
}
#endif /* ENABLE_COLOR */

View File

@@ -24,10 +24,8 @@
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "proto.h"
static bool keep_cutbuffer = FALSE;
@@ -45,10 +43,10 @@ void cutbuffer_reset(void)
* place we want to where the line used to start. */
void cut_line(void)
{
if (current->next != NULL) {
move_to_filestruct(&cutbuffer, &cutbottom, current, 0,
current->next, 0);
placewewant = xplustabs();
if (openfile->current->next != NULL) {
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current, 0,
openfile->current->next, 0);
openfile->placewewant = xplustabs();
}
}
@@ -64,7 +62,7 @@ void cut_marked(void)
(const filestruct **)&bot, &bot_x, NULL);
move_to_filestruct(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
placewewant = xplustabs();
openfile->placewewant = xplustabs();
}
/* If we're not at the end of the current line, move all the text from
@@ -75,24 +73,24 @@ void cut_marked(void)
* used to be. */
void cut_to_eol(void)
{
size_t data_len = strlen(current->data);
size_t data_len = strlen(openfile->current->data);
assert(current_x <= data_len);
assert(openfile->current_x <= data_len);
if (current_x < data_len)
if (openfile->current_x < data_len)
/* If we're not at the end of the line, move all the text from
* the current position up to it, not counting the newline at
* the end, to the cutbuffer. */
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
current, data_len);
else if (current->next != NULL) {
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. */
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
current->next, 0);
placewewant = xplustabs();
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
openfile->current_x, openfile->current->next, 0);
openfile->placewewant = xplustabs();
}
}
#endif /* !NANO_SMALL */
@@ -100,7 +98,7 @@ void cut_to_eol(void)
/* Move text from the current filestruct into the cutbuffer. */
void do_cut_text(void)
{
assert(current != NULL && current->data != NULL);
assert(openfile->current != NULL && openfile->current->data != NULL);
check_statusblank();
@@ -120,11 +118,11 @@ void do_cut_text(void)
keep_cutbuffer = TRUE;
#ifndef NANO_SMALL
if (ISSET(MARK_ISSET)) {
if (openfile->mark_set) {
/* If the mark is on, move the marked text to the cutbuffer and
* turn the mark off. */
cut_marked();
UNSET(MARK_ISSET);
openfile->mark_set = FALSE;
} else if (ISSET(CUT_TO_END))
/* Otherwise, if the CUT_TO_END flag is set, move all text up to
* the end of the line into the cutbuffer. */
@@ -138,7 +136,7 @@ void do_cut_text(void)
set_modified();
#ifdef DEBUG
dump_buffer(cutbuffer);
dump_filestruct(cutbuffer);
#endif
}
@@ -146,18 +144,18 @@ void do_cut_text(void)
/* Cut from the current cursor position to the end of the file. */
void do_cut_till_end(void)
{
assert(current != NULL && current->data != NULL);
assert(openfile->current != NULL && openfile->current->data != NULL);
check_statusblank();
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
filebot, 0);
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
openfile->current_x, openfile->filebot, 0);
edit_refresh();
set_modified();
#ifdef DEBUG
dump_buffer(cutbuffer);
dump_filestruct(cutbuffer);
#endif
}
#endif /* !NANO_SMALL */
@@ -165,7 +163,7 @@ void do_cut_till_end(void)
/* Copy text from the cutbuffer into the current filestruct. */
void do_uncut_text(void)
{
assert(current != NULL && current->data != NULL);
assert(openfile->current != NULL && openfile->current->data != NULL);
#ifndef DISABLE_WRAPPING
wrap_reset();
@@ -183,12 +181,12 @@ void do_uncut_text(void)
/* Set the current place we want to where the text from the
* cutbuffer ends. */
placewewant = xplustabs();
openfile->placewewant = xplustabs();
edit_refresh();
set_modified();
#ifdef DEBUG
dump_buffer_reverse();
dump_filestruct_reverse();
#endif
}

File diff suppressed because it is too large Load Diff

View File

@@ -24,43 +24,29 @@
#include <config.h>
#endif
#include <stdlib.h>
#include <assert.h>
#include "proto.h"
/* Global variables */
#ifndef DISABLE_WRAPJUSTIFY
/* wrap_at might be set in rcfile.c or nano.c. */
ssize_t wrap_at = -CHARS_FROM_EOL; /* Right justified fill value,
allows resize */
ssize_t fill = 0; /* The column where we will wrap
* lines. */
ssize_t wrap_at = -CHARS_FROM_EOL;
/* The position where we will wrap
* lines. fill is equal to this if it's
* greater than zero, and equal to
* (COLS + this) if it isn't. */
#endif
char *last_search = NULL; /* Last string we searched for */
char *last_replace = NULL; /* Last replacement string */
unsigned long flags = 0; /* Our flag containing many options */
WINDOW *topwin; /* Top buffer */
long flags = 0; /* Our flag containing many options */
WINDOW *topwin; /* Top subwindow */
WINDOW *edit; /* The file portion of the editor */
WINDOW *bottomwin; /* Bottom buffer */
char *filename = NULL; /* Name of the file */
#ifndef NANO_SMALL
struct stat originalfilestat; /* Stat for the file as we loaded it */
#endif
WINDOW *bottomwin; /* Bottom subwindow */
int editwinrows = 0; /* How many rows long is the edit
window? */
filestruct *current; /* Current buffer pointer */
size_t current_x = 0; /* Current x-coordinate in the edit
window */
ssize_t current_y = 0; /* Current y-coordinate in the edit
window */
filestruct *fileage = NULL; /* Our file buffer */
filestruct *edittop = NULL; /* Pointer to the top of the edit
buffer with respect to the
file struct */
filestruct *filebot = NULL; /* Last node in the file struct */
filestruct *cutbuffer = NULL; /* A place to store cut text */
#ifndef DISABLE_JUSTIFY
filestruct *jusbuffer = NULL; /* A place to store unjustified text */
@@ -68,10 +54,8 @@ filestruct *jusbuffer = NULL; /* A place to store unjustified text */
partition *filepart = NULL; /* A place to store a portion of the
file struct */
#ifdef ENABLE_MULTIBUFFER
openfilestruct *open_files = NULL; /* The list of open file
buffers */
#endif
openfilestruct *openfile = NULL;
/* The list of open file buffers */
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
char *whitespace = NULL; /* Characters used when displaying
@@ -102,28 +86,14 @@ char *backup_dir = NULL; /* Backup directory. */
#endif
char *answer = NULL; /* Answer str to many questions */
size_t totlines = 0; /* Total number of lines in the file */
size_t totsize = 0; /* Total number of characters in the
file */
size_t placewewant = 0; /* The column we'd like the cursor
to jump to when we go to the
next or previous line */
ssize_t tabsize = -1; /* Our internal tabsize variable. The
default value is set in main(). */
char *hblank = NULL; /* A horizontal blank line */
#ifndef DISABLE_HELP
char *help_text; /* The text in the help window */
#endif
/* More stuff for the marker select */
#ifndef NANO_SMALL
filestruct *mark_beginbuf; /* The begin marker buffer */
size_t mark_beginx; /* X value in the string to start */
#endif
#ifndef DISABLE_OPERATINGDIR
char *operating_dir = NULL; /* Operating directory, which we can't */
char *full_operating_dir = NULL;/* go higher than */
@@ -155,7 +125,6 @@ shortcut *gotodir_list = NULL;
#endif
#ifdef ENABLE_COLOR
const colortype *colorstrings = NULL;
syntaxtype *syntaxes = NULL;
char *syntaxstr = NULL;
#endif
@@ -197,7 +166,8 @@ size_t length_of_list(const shortcut *s)
return i;
}
/* Initialize a struct *without* our lovely braces =( */
/* Create a new shortcut structure, at the end of the shortcuts linked
* list. */
void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
#ifndef DISABLE_HELP
const char *help,
@@ -292,8 +262,7 @@ void shortcut_init(bool unjustify)
N_("Show the position of the cursor");
const char *nano_spell_msg =
N_("Invoke the spell checker, if available");
const char *nano_gotoline_msg =
N_("Go to a specific line number and column number");
const char *nano_gotoline_msg = N_("Go to line and column number");
const char *nano_replace_msg = N_("Replace text within the editor");
#ifndef NANO_SMALL
const char *nano_mark_msg = N_("Mark text at the cursor position");
@@ -321,7 +290,7 @@ void shortcut_init(bool unjustify)
const char *nano_nextword_msg = N_("Move forward one word");
const char *nano_prevword_msg = N_("Move backward one word");
const char *nano_wordcount_msg =
N_("Count the number of words in the file");
N_("Count the number of words, lines, and characters");
#endif
#ifndef DISABLE_JUSTIFY
const char *nano_parabegin_msg =
@@ -330,9 +299,9 @@ void shortcut_init(bool unjustify)
N_("Go to the end of the current paragraph");
#endif
#ifdef ENABLE_MULTIBUFFER
const char *nano_openprev_msg =
const char *nano_prevfile_msg =
N_("Switch to the previous file buffer");
const char *nano_opennext_msg =
const char *nano_nextfile_msg =
N_("Switch to the next file buffer");
#endif
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
@@ -412,7 +381,7 @@ void shortcut_init(bool unjustify)
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_EXIT_KEY,
#ifdef ENABLE_MULTIBUFFER
open_files != NULL && open_files != open_files->next ?
openfile != NULL && openfile != openfile->next ?
N_("Close") :
#endif
exit_msg, IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
@@ -528,11 +497,11 @@ void shortcut_init(bool unjustify)
sc_init_one(&main_list, NANO_FORWARD_KEY, N_("Forward"),
IFHELP(nano_forward_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, do_right_void);
NANO_NO_KEY, VIEW, do_right);
sc_init_one(&main_list, NANO_BACK_KEY, N_("Back"),
IFHELP(nano_back_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, do_left_void);
NANO_NO_KEY, VIEW, do_left);
sc_init_one(&main_list, NANO_HOME_KEY, N_("Home"),
IFHELP(nano_home_msg, NANO_NO_KEY), NANO_NO_KEY,
@@ -573,7 +542,7 @@ void shortcut_init(bool unjustify)
sc_init_one(&main_list, NANO_NO_KEY, N_("Word Count"),
IFHELP(nano_wordcount_msg, NANO_WORDCOUNT_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, do_word_count);
NANO_NO_KEY, VIEW, do_wordlinechar_count);
#endif
#ifndef DISABLE_JUSTIFY
@@ -590,12 +559,12 @@ void shortcut_init(bool unjustify)
#ifdef ENABLE_MULTIBUFFER
sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY), NANO_NO_KEY,
NANO_OPENPREV_ALTKEY, VIEW, open_prevfile_void);
IFHELP(nano_prevfile_msg, NANO_PREVFILE_KEY), NANO_NO_KEY,
NANO_PREVFILE_ALTKEY, VIEW, switch_to_prev_buffer_void);
sc_init_one(&main_list, NANO_NO_KEY, N_("Next File"),
IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY), NANO_NO_KEY,
NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
IFHELP(nano_nextfile_msg, NANO_NEXTFILE_KEY), NANO_NO_KEY,
NANO_NEXTFILE_ALTKEY, VIEW, switch_to_next_buffer_void);
#endif
sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
@@ -1074,7 +1043,7 @@ void free_shortcutage(shortcut **shortcutage)
}
#ifndef NANO_SMALL
/* Create one new toggle structure, at the end of the toggles linked
/* Create a new toggle structure, at the end of the toggles linked
* list. */
void toggle_init_one(int val, const char *desc, long flag)
{
@@ -1191,8 +1160,6 @@ void thanks_for_all_the_fish(void)
free(last_search);
if (last_replace != NULL)
free(last_replace);
if (hblank != NULL)
free(hblank);
#ifndef DISABLE_SPELLER
if (alt_speller != NULL)
free(alt_speller);
@@ -1201,8 +1168,6 @@ void thanks_for_all_the_fish(void)
if (help_text != NULL)
free(help_text);
#endif
if (filename != NULL)
free(filename);
if (answer != NULL)
free(answer);
if (cutbuffer != NULL)
@@ -1240,19 +1205,9 @@ void thanks_for_all_the_fish(void)
free(t);
}
#endif
#ifdef ENABLE_MULTIBUFFER
/* Free the memory associated with each open file buffer. */
if (open_files != NULL) {
/* Make sure open_files->fileage is up to date, in case we've
* cut the top line of the file. */
open_files->fileage = fileage;
free_openfilestruct(open_files);
}
#else
if (fileage != NULL)
free_filestruct(fileage);
#endif
if (openfile != NULL)
free_openfilestruct(openfile);
#ifdef ENABLE_COLOR
if (syntaxstr != NULL)
free(syntaxstr);
@@ -1264,17 +1219,28 @@ void thanks_for_all_the_fish(void)
exttype *bob = syntaxes->extensions;
syntaxes->extensions = bob->next;
regfree(&bob->val);
free(bob->ext_regex);
if (bob->ext != NULL) {
regfree(bob->ext);
free(bob->ext);
}
free(bob);
}
while (syntaxes->color != NULL) {
colortype *bob = syntaxes->color;
syntaxes->color = bob->next;
regfree(&bob->start);
if (bob->end != NULL)
free(bob->start_regex);
if (bob->start != NULL) {
regfree(bob->start);
free(bob->start);
}
if (bob->end_regex != NULL)
free(bob->end_regex);
if (bob->end != NULL) {
regfree(bob->end);
free(bob->end);
free(bob->end);
}
free(bob);
}
syntaxes = syntaxes->next;

View File

@@ -24,268 +24,570 @@
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "proto.h"
void do_first_line(void)
{
size_t pww_save = placewewant;
current = fileage;
placewewant = 0;
current_x = 0;
if (edittop != fileage || need_vertical_update(pww_save))
edit_update(TOP);
const filestruct *current_save = openfile->current;
size_t pww_save = openfile->placewewant;
check_statusblank();
openfile->current = openfile->fileage;
openfile->current_x = 0;
openfile->placewewant = 0;
edit_redraw(current_save, pww_save);
}
void do_last_line(void)
{
size_t pww_save = placewewant;
current = filebot;
placewewant = 0;
current_x = 0;
if (edittop->lineno + (editwinrows / 2) != filebot->lineno ||
need_vertical_update(pww_save))
edit_update(CENTER);
}
const filestruct *current_save = openfile->current;
size_t pww_save = openfile->placewewant;
void do_home(void)
{
size_t pww_save = placewewant;
#ifndef NANO_SMALL
if (ISSET(SMART_HOME)) {
size_t current_x_save = current_x;
current_x = indent_length(current->data);
if (current_x == current_x_save ||
current->data[current_x] == '\0')
current_x = 0;
placewewant = xplustabs();
} else {
#endif
current_x = 0;
placewewant = 0;
#ifndef NANO_SMALL
}
#endif
check_statusblank();
if (need_horizontal_update(pww_save))
update_line(current, current_x);
}
void do_end(void)
{
size_t pww_save = placewewant;
current_x = strlen(current->data);
placewewant = xplustabs();
check_statusblank();
if (need_horizontal_update(pww_save))
update_line(current, current_x);
openfile->current = openfile->filebot;
openfile->current_x = 0;
openfile->placewewant = 0;
openfile->current_y = editwinrows - 1;
edit_redraw(current_save, pww_save);
}
void do_page_up(void)
{
size_t pww_save = placewewant;
const filestruct *current_save = current;
int i;
check_statusblank();
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If the first line of the file is onscreen, move current up there
* and put the cursor at the beginning of the line. */
if (edittop == fileage) {
current = fileage;
placewewant = 0;
} else {
edit_scroll(UP, editwinrows - 2);
#ifndef NANO_SMALL
/* If we're in smooth scrolling mode and there's at least one
* page of text left, move the current line of the edit window
* up a page. */
if (ISSET(SMOOTH_SCROLL) && current->lineno > editwinrows - 2) {
int i;
for (i = 0; i < editwinrows - 2; i++)
current = current->prev;
}
/* If we're not in smooth scrolling mode or there isn't at least
* one page of text left, put the cursor at the beginning of the
* top line of the edit window, as Pico does. */
else {
#endif
current = edittop;
placewewant = 0;
#ifndef NANO_SMALL
}
#endif
/* If there's less than a page of text left on the screen, put the
* cursor at the beginning of the first line of the file, and then
* update the edit window. */
if (openfile->current->lineno <= editwinrows - 2) {
do_first_line();
return;
}
/* Get the equivalent x-coordinate of the new line. */
current_x = actual_x(current->data, placewewant);
/* 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
if (!ISSET(SMOOTH_SCROLL)) {
#endif
openfile->current = openfile->edittop;
openfile->placewewant = 0;
#ifndef NANO_SMALL
}
#endif
/* Update all the lines that need to be updated. */
edit_redraw(current_save, pww_save);
for (i = editwinrows - 2; i > 0 && openfile->current->prev != NULL;
i--)
openfile->current = openfile->current->prev;
check_statusblank();
openfile->current_x = actual_x(openfile->current->data,
openfile->placewewant);
/* Scroll the edit window up a page. */
edit_scroll(UP, editwinrows - 2);
}
void do_page_down(void)
{
size_t pww_save = placewewant;
const filestruct *current_save = current;
int i;
check_statusblank();
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If the last line of the file is onscreen, move current down
* there and put the cursor at the beginning of the line. */
if (edittop->lineno + editwinrows > filebot->lineno) {
current = filebot;
placewewant = 0;
} else {
edit_scroll(DOWN, editwinrows - 2);
#ifndef NANO_SMALL
/* If we're in smooth scrolling mode and there's at least one
* page of text left, move the current line of the edit window
* down a page. */
if (ISSET(SMOOTH_SCROLL) && current->lineno + editwinrows - 2 <=
filebot->lineno) {
int i;
for (i = 0; i < editwinrows - 2; i++)
current = current->next;
}
/* If we're not in smooth scrolling mode or there isn't at least
* one page of text left, put the cursor at the beginning of the
* top line of the edit window, as Pico does. */
else {
#endif
current = edittop;
placewewant = 0;
#ifndef NANO_SMALL
}
#endif
/* If there's less than a page of text left on the screen, put the
* cursor at the beginning of the last line of the file, and then
* update the edit window. */
if (openfile->current->lineno + editwinrows - 2 >=
openfile->filebot->lineno) {
do_last_line();
return;
}
/* Get the equivalent x-coordinate of the new line. */
current_x = actual_x(current->data, placewewant);
/* 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
if (!ISSET(SMOOTH_SCROLL)) {
#endif
openfile->current = openfile->edittop;
openfile->placewewant = 0;
#ifndef NANO_SMALL
}
#endif
/* Update all the lines that need to be updated. */
edit_redraw(current_save, pww_save);
for (i = editwinrows - 2; i > 0 && openfile->current->next != NULL;
i--)
openfile->current = openfile->current->next;
openfile->current_x = actual_x(openfile->current->data,
openfile->placewewant);
/* Scroll the edit window down a page. */
edit_scroll(DOWN, editwinrows - 2);
}
#ifndef DISABLE_JUSTIFY
/* Move up to the last beginning-of-paragraph line before the current
* line. */
void do_para_begin(bool allow_update)
{
const filestruct *current_save = openfile->current;
const size_t pww_save = openfile->placewewant;
check_statusblank();
openfile->current_x = 0;
openfile->placewewant = 0;
if (openfile->current->prev != NULL) {
do {
openfile->current = openfile->current->prev;
openfile->current_y--;
} while (!begpar(openfile->current));
}
if (allow_update)
edit_redraw(current_save, pww_save);
}
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. */
void do_para_end(bool allow_update)
{
const filestruct *const current_save = openfile->current;
const size_t pww_save = openfile->placewewant;
check_statusblank();
openfile->current_x = 0;
openfile->placewewant = 0;
while (openfile->current->next != NULL && !inpar(openfile->current))
openfile->current = openfile->current->next;
while (openfile->current->next != NULL &&
inpar(openfile->current->next) &&
!begpar(openfile->current->next)) {
openfile->current = openfile->current->next;
openfile->current_y++;
}
if (openfile->current->next != NULL)
openfile->current = openfile->current->next;
if (allow_update)
edit_redraw(current_save, pww_save);
}
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. */
bool do_next_word(bool allow_punct, bool allow_update)
{
size_t pww_save = openfile->placewewant;
const filestruct *current_save = openfile->current;
char *char_mb;
int char_mb_len;
bool end_line = FALSE, started_on_word = FALSE;
assert(openfile->current != NULL && openfile->current->data != NULL);
check_statusblank();
char_mb = charalloc(mb_cur_max());
/* Move forward until we find the character after the last letter of
* the current word. */
while (!end_line) {
char_mb_len = parse_mbchar(openfile->current->data +
openfile->current_x, char_mb, NULL);
/* If we've found it, stop moving forward through the current
* line. */
if (!is_word_mbchar(char_mb, allow_punct))
break;
/* If we haven't found it, then we've started on a word, so set
* started_on_word to TRUE. */
started_on_word = TRUE;
if (openfile->current->data[openfile->current_x] == '\0')
end_line = TRUE;
else
openfile->current_x += char_mb_len;
}
/* Move forward until we find the first letter of the next word. */
if (openfile->current->data[openfile->current_x] == '\0')
end_line = TRUE;
else
openfile->current_x += char_mb_len;
for (; openfile->current != NULL;
openfile->current = openfile->current->next) {
while (!end_line) {
char_mb_len = parse_mbchar(openfile->current->data +
openfile->current_x, char_mb, NULL);
/* If we've found it, stop moving forward through the
* current line. */
if (is_word_mbchar(char_mb, allow_punct))
break;
if (openfile->current->data[openfile->current_x] == '\0')
end_line = TRUE;
else
openfile->current_x += char_mb_len;
}
/* If we've found it, stop moving forward to the beginnings of
* subsequent lines. */
if (!end_line)
break;
if (openfile->current->next != NULL) {
end_line = FALSE;
openfile->current_x = 0;
}
}
free(char_mb);
/* If we haven't found it, leave the cursor at the end of the
* file. */
if (openfile->current == NULL)
openfile->current = openfile->filebot;
openfile->placewewant = xplustabs();
/* If allow_update is TRUE, update the screen. */
if (allow_update)
edit_redraw(current_save, pww_save);
/* Return whether we started on a word. */
return started_on_word;
}
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. */
bool do_prev_word(bool allow_punct, bool allow_update)
{
size_t pww_save = openfile->placewewant;
const filestruct *current_save = openfile->current;
char *char_mb;
int char_mb_len;
bool begin_line = FALSE, started_on_word = FALSE;
assert(openfile->current != NULL && openfile->current->data != NULL);
check_statusblank();
char_mb = charalloc(mb_cur_max());
/* Move backward until we find the character before the first letter
* of the current word. */
while (!begin_line) {
char_mb_len = parse_mbchar(openfile->current->data +
openfile->current_x, char_mb, NULL);
/* If we've found it, stop moving backward through the current
* line. */
if (!is_word_mbchar(char_mb, allow_punct))
break;
/* If we haven't found it, then we've started on a word, so set
* started_on_word to TRUE. */
started_on_word = TRUE;
if (openfile->current_x == 0)
begin_line = TRUE;
else
openfile->current_x = move_mbleft(openfile->current->data,
openfile->current_x);
}
/* Move backward until we find the last letter of the previous
* word. */
if (openfile->current_x == 0)
begin_line = TRUE;
else
openfile->current_x = move_mbleft(openfile->current->data,
openfile->current_x);
for (; openfile->current != NULL;
openfile->current = openfile->current->prev) {
while (!begin_line) {
char_mb_len = parse_mbchar(openfile->current->data +
openfile->current_x, char_mb, NULL);
/* If we've found it, stop moving backward through the
* current line. */
if (is_word_mbchar(char_mb, allow_punct))
break;
if (openfile->current_x == 0)
begin_line = TRUE;
else
openfile->current_x =
move_mbleft(openfile->current->data,
openfile->current_x);
}
/* If we've found it, stop moving backward to the ends of
* previous lines. */
if (!begin_line)
break;
if (openfile->current->prev != NULL) {
begin_line = FALSE;
openfile->current_x = strlen(openfile->current->prev->data);
}
}
/* If we haven't found it, leave the cursor at the beginning of the
* file. */
if (openfile->current == NULL)
openfile->current = openfile->fileage;
/* If we've found it, move backward until we find the character
* before the first letter of the previous word. */
else if (!begin_line) {
if (openfile->current_x == 0)
begin_line = TRUE;
else
openfile->current_x = move_mbleft(openfile->current->data,
openfile->current_x);
while (!begin_line) {
char_mb_len = parse_mbchar(openfile->current->data +
openfile->current_x, char_mb, NULL);
/* If we've found it, stop moving backward through the
* current line. */
if (!is_word_mbchar(char_mb, allow_punct))
break;
if (openfile->current_x == 0)
begin_line = TRUE;
else
openfile->current_x =
move_mbleft(openfile->current->data,
openfile->current_x);
}
/* If we've found it, move forward to the first letter of the
* previous word. */
if (!begin_line)
openfile->current_x += char_mb_len;
}
free(char_mb);
openfile->placewewant = xplustabs();
/* If allow_update is TRUE, update the screen. */
if (allow_update)
edit_redraw(current_save, pww_save);
/* Return whether we started on a word. */
return started_on_word;
}
void do_prev_word_void(void)
{
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
}
#endif /* !NANO_SMALL */
void do_home(void)
{
size_t pww_save = openfile->placewewant;
check_statusblank();
#ifndef NANO_SMALL
if (ISSET(SMART_HOME)) {
size_t current_x_save = openfile->current_x;
openfile->current_x = indent_length(openfile->current->data);
if (openfile->current_x == current_x_save ||
openfile->current->data[openfile->current_x] == '\0')
openfile->current_x = 0;
openfile->placewewant = xplustabs();
} else {
#endif
openfile->current_x = 0;
openfile->placewewant = 0;
#ifndef NANO_SMALL
}
#endif
if (need_horizontal_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
void do_end(void)
{
size_t pww_save = openfile->placewewant;
check_statusblank();
openfile->current_x = strlen(openfile->current->data);
openfile->placewewant = xplustabs();
if (need_horizontal_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
void do_up(void)
{
check_statusblank();
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
check_statusblank();
if (current->prev == NULL)
/* If we're at the top of the file, get out. */
if (openfile->current->prev == NULL)
return;
assert(current_y == current->lineno - edittop->lineno);
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
current = current->prev;
current_x = actual_x(current->data, placewewant);
/* Move the current line of the edit window up. */
openfile->current = openfile->current->prev;
openfile->current_x = actual_x(openfile->current->data,
openfile->placewewant);
/* If we're on the first row of the edit window, scroll up one line
* if we're in smooth scrolling mode, or up half a page if we're
* not. */
if (current_y == 0)
/* If we're on the first line of the edit window, scroll the edit
* window up one line if we're in smooth scrolling mode, or up half
* a page if we're not. */
if (openfile->current_y == 0)
edit_scroll(UP,
#ifndef NANO_SMALL
ISSET(SMOOTH_SCROLL) ? 1 :
#endif
editwinrows / 2);
/* Update the lines left alone by edit_scroll(): the line we were on
* before and the line we're on now. The former needs to be redrawn
* if we're not on the first page, and the latter needs to be
* drawn. */
if (need_vertical_update(0))
update_line(current->next, 0);
update_line(current, current_x);
/* Update the line we were on before and the line we're on now. The
* former needs to be redrawn if we're not on the first page, and
* the latter needs to be drawn unconditionally. */
else {
if (need_vertical_update(0))
update_line(openfile->current->next, 0);
update_line(openfile->current, openfile->current_x);
}
}
void do_down(void)
{
check_statusblank();
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
check_statusblank();
if (current->next == NULL)
/* If we're at the bottom of the file, get out. */
if (openfile->current->next == NULL)
return;
assert(current_y == current->lineno - edittop->lineno);
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
current = current->next;
current_x = actual_x(current->data, placewewant);
/* Move the current line of the edit window down. */
openfile->current = openfile->current->next;
openfile->current_x = actual_x(openfile->current->data,
openfile->placewewant);
/* If we're on the last row of the edit window, scroll down one line
* if we're in smooth scrolling mode, or down half a page if we're
* not. */
if (current_y == editwinrows - 1)
/* If we're on the last line of the edit window, scroll the edit
* window down one line if we're in smooth scrolling mode, or down
* half a page if we're not. */
if (openfile->current_y == editwinrows - 1)
edit_scroll(DOWN,
#ifndef NANO_SMALL
ISSET(SMOOTH_SCROLL) ? 1 :
#endif
editwinrows / 2);
/* Update the lines left alone by edit_scroll(): the line we were on
* before and the line we're on now. The former needs to be redrawn
* if we're not on the first page, and the latter needs to be
* drawn. */
if (need_vertical_update(0))
update_line(current->prev, 0);
update_line(current, current_x);
/* Update the line we were on before and the line we're on now. The
* former needs to be redrawn if we're not on the first page, and
* the latter needs to be drawn unconditionally. */
else {
if (need_vertical_update(0))
update_line(openfile->current->prev, 0);
update_line(openfile->current, openfile->current_x);
}
}
void do_left(bool allow_update)
void do_left(void)
{
size_t pww_save = placewewant;
if (current_x > 0)
current_x = move_mbleft(current->data, current_x);
else if (current != fileage) {
size_t pww_save = openfile->placewewant;
check_statusblank();
if (openfile->current_x > 0)
openfile->current_x = move_mbleft(openfile->current->data,
openfile->current_x);
else if (openfile->current != openfile->fileage) {
do_up();
current_x = strlen(current->data);
openfile->current_x = strlen(openfile->current->data);
}
placewewant = xplustabs();
openfile->placewewant = xplustabs();
if (need_horizontal_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
void do_right(void)
{
size_t pww_save = openfile->placewewant;
check_statusblank();
if (allow_update && need_horizontal_update(pww_save))
update_line(current, current_x);
}
void do_left_void(void)
{
do_left(TRUE);
}
assert(openfile->current_x <= strlen(openfile->current->data));
void do_right(bool allow_update)
{
size_t pww_save = placewewant;
assert(current_x <= strlen(current->data));
if (current->data[current_x] != '\0')
current_x = move_mbright(current->data, current_x);
else if (current->next != NULL) {
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) {
do_down();
current_x = 0;
openfile->current_x = 0;
}
placewewant = xplustabs();
check_statusblank();
if (allow_update && need_horizontal_update(pww_save))
update_line(current, current_x);
}
void do_right_void(void)
{
do_right(TRUE);
openfile->placewewant = xplustabs();
if (need_horizontal_update(pww_save))
update_line(openfile->current, openfile->current_x);
}

3457
src/nano.c

File diff suppressed because it is too large Load Diff

View File

@@ -90,19 +90,20 @@
/* Mark a string that will be sent to gettext() later. */
#include <stddef.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#ifdef HAVE_REGEX_H
#include <regex.h>
#endif
#include <assert.h>
/* If no snprintf() or vsnprintf(), use the versions from glib 2.x. */
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
#include <glib.h>
#ifndef HAVE_SNPRINTF
#define snprintf g_snprintf
#endif
/* If no vsnprintf(), use the version from glib 2.x. */
#ifndef HAVE_VSNPRINTF
#include <glib.h>
#define vsnprintf g_vsnprintf
#endif
#endif
/* If no isblank(), iswblank(), strcasecmp(), strncasecmp(),
* strcasestr(), strnlen(), getdelim(), or getline(), use the versions
@@ -134,6 +135,12 @@
#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
#undef ENABLE_COLOR
#endif
/* If we aren't using ncurses, turn the mouse support off, as it's
* ncurses-specific. */
#ifndef NCURSES_MOUSE_VERSION
@@ -150,12 +157,16 @@ typedef enum {
} file_format;
typedef enum {
UP, DOWN
} updown;
OVERWRITE, APPEND, PREPEND
} append_type;
typedef enum {
TOP, CENTER, NONE
} topmidnone;
UP, DOWN
} scroll_dir;
typedef enum {
CENTER, NONE
} update_type;
/* Structure types. */
typedef struct filestruct {
@@ -165,40 +176,6 @@ typedef struct filestruct {
ssize_t lineno; /* The line number. */
} filestruct;
#ifdef ENABLE_MULTIBUFFER
typedef struct openfilestruct {
char *filename;
#ifndef NANO_SMALL
struct stat originalfilestat;
#endif
struct openfilestruct *next;
/* Next node. */
struct openfilestruct *prev;
/* Previous node. */
filestruct *fileage; /* Current file. */
filestruct *filebot; /* Current file's last line. */
filestruct *edittop; /* Current top of edit window. */
filestruct *current; /* Current file's line. */
#ifndef NANO_SMALL
filestruct *mark_beginbuf;
/* Current file's beginning marked
* line. */
size_t mark_beginx; /* Current file's beginning marked
* line's x-coordinate position. */
#endif
size_t current_x; /* Current file's x-coordinate
* position. */
size_t placewewant; /* Current file's place we want. */
size_t totlines; /* Current file's total number of
* lines. */
size_t totsize; /* Current file's total size. */
unsigned long flags; /* Current file's flags: modification
* status (and marking status, if
* available). */
file_format fmt; /* Current file's format. */
} openfilestruct;
#endif
typedef struct partition {
filestruct *fileage;
filestruct *top_prev;
@@ -208,6 +185,74 @@ typedef struct partition {
char *bot_data;
} 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. */
struct colortype *next;
} colortype;
typedef struct exttype {
char *ext_regex; /* Extensions that match this syntax. */
regex_t *ext; /* Compiled extensions that match this
* syntax. */
struct exttype *next;
} exttype;
typedef struct syntaxtype {
char *desc; /* Name of this syntax type. */
exttype *extensions; /* List of extensions that this syntax
* applies to. */
colortype *color; /* Color struct for this syntax. */
struct syntaxtype *next;
} 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. */
#endif
#ifdef ENABLE_COLOR
colortype *colorstrings; /* Current file's associated colors. */
#endif
struct openfilestruct *next;
/* Next node. */
struct openfilestruct *prev;
/* 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
@@ -243,66 +288,38 @@ typedef struct rcoption {
} rcoption;
#endif
#ifdef ENABLE_COLOR
typedef struct colortype {
int fg; /* Foreground color. */
int bg; /* Background color. */
bool bright; /* Is this color A_BOLD? */
int pairnum; /* Color pair number used for this
* foreground/background. */
regex_t start; /* Start (or all) of the regex
* string. */
regex_t *end; /* End (if any) of the regex string. */
struct colortype *next;
} colortype;
typedef struct exttype {
regex_t val; /* The extensions that match this
* syntax. */
struct exttype *next;
} 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. */
struct syntaxtype *next;
} syntaxtype;
#endif
/* Bitwise flags so that we can save space (or, more correctly, not
* waste it). */
#define MODIFIED (1<<0)
#define CASE_SENSITIVE (1<<1)
#define MARK_ISSET (1<<2)
#define CONST_UPDATE (1<<3)
#define NO_HELP (1<<4)
#define NOFOLLOW_SYMLINKS (1<<5)
#define SUSPEND (1<<6)
#define NO_WRAP (1<<7)
#define AUTOINDENT (1<<8)
#define VIEW_MODE (1<<9)
#define USE_MOUSE (1<<10)
#define USE_REGEXP (1<<11)
#define TEMP_FILE (1<<12)
#define CUT_TO_END (1<<13)
#define BACKWARDS_SEARCH (1<<14)
#define MULTIBUFFER (1<<15)
#define SMOOTH_SCROLL (1<<16)
#define REBIND_DELETE (1<<17)
#define NO_CONVERT (1<<18)
#define BACKUP_FILE (1<<19)
#define NO_RCFILE (1<<20)
#define NO_COLOR_SYNTAX (1<<21)
#define PRESERVE (1<<22)
#define HISTORYLOG (1<<23)
#define RESTRICTED (1<<24)
#define SMART_HOME (1<<25)
#define WHITESPACE_DISPLAY (1<<26)
#define MORE_SPACE (1<<27)
#define TABS_TO_SPACES (1<<28)
#define QUICK_BLANK (1<<29)
#define CASE_SENSITIVE (1<<0)
#define CONST_UPDATE (1<<1)
#define NO_HELP (1<<2)
#define NOFOLLOW_SYMLINKS (1<<3)
#define SUSPEND (1<<4)
#define NO_WRAP (1<<5)
#define AUTOINDENT (1<<6)
#define VIEW_MODE (1<<7)
#define USE_MOUSE (1<<8)
#define USE_REGEXP (1<<9)
#define TEMP_FILE (1<<10)
#define CUT_TO_END (1<<11)
#define BACKWARDS_SEARCH (1<<12)
#define MULTIBUFFER (1<<13)
#define SMOOTH_SCROLL (1<<14)
#define REBIND_DELETE (1<<15)
#define REBIND_KEYPAD (1<<16)
#define NO_CONVERT (1<<17)
#define BACKUP_FILE (1<<18)
#define NO_RCFILE (1<<19)
#define NO_COLOR_SYNTAX (1<<20)
#define PRESERVE (1<<21)
#define HISTORYLOG (1<<22)
#define RESTRICTED (1<<23)
#define SMART_HOME (1<<24)
#define WHITESPACE_DISPLAY (1<<25)
#define MORE_SPACE (1<<26)
#define TABS_TO_SPACES (1<<27)
#define QUICK_BLANK (1<<28)
#define WORD_BOUNDS (1<<29)
#define USE_UTF8 (1<<30)
/* Control key sequences. Changing these would be very, very bad. */
@@ -340,8 +357,16 @@ typedef struct syntaxtype {
#define NANO_CONTROL_7 31
#define NANO_CONTROL_8 127
#define NANO_ALT_SPACE ' '
#define NANO_ALT_LPAREN '('
#define NANO_ALT_RPAREN ')'
#define NANO_ALT_COMMA ','
#define NANO_ALT_PERIOD '.'
#define NANO_ALT_9 '9'
#define NANO_ALT_0 '0'
#define NANO_ALT_LCARAT '<'
#define NANO_ALT_RCARAT '>'
#define NANO_ALT_RBRACKET ']'
#define NANO_ALT_A 'a'
#define NANO_ALT_B 'b'
#define NANO_ALT_C 'c'
@@ -368,14 +393,6 @@ typedef struct syntaxtype {
#define NANO_ALT_X 'x'
#define NANO_ALT_Y 'y'
#define NANO_ALT_Z 'z'
#define NANO_ALT_PERIOD '.'
#define NANO_ALT_COMMA ','
#define NANO_ALT_LPAREN '('
#define NANO_ALT_RPAREN ')'
#define NANO_ALT_LCARAT '<'
#define NANO_ALT_RCARAT '>'
#define NANO_ALT_RBRACKET ']'
#define NANO_ALT_SPACE ' '
/* Some semi-changeable keybindings; don't play with these unless you're
* sure you know what you're doing. Assume ERR is defined as -1. */
@@ -448,10 +465,10 @@ typedef struct syntaxtype {
#define NANO_TOFILES_KEY NANO_CONTROL_T
#define NANO_APPEND_KEY NANO_ALT_A
#define NANO_PREPEND_KEY NANO_ALT_P
#define NANO_OPENPREV_KEY NANO_ALT_LCARAT
#define NANO_OPENNEXT_KEY NANO_ALT_RCARAT
#define NANO_OPENPREV_ALTKEY NANO_ALT_COMMA
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
#define NANO_PREVFILE_KEY NANO_ALT_LCARAT
#define NANO_NEXTFILE_KEY NANO_ALT_RCARAT
#define NANO_PREVFILE_ALTKEY NANO_ALT_COMMA
#define NANO_NEXTFILE_ALTKEY NANO_ALT_PERIOD
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
#define NANO_PREVWORD_KEY NANO_ALT_SPACE

View File

@@ -24,28 +24,14 @@
#define PROTO_H 1
/* Externs. */
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#ifdef HAVE_REGEX_H
#include <regex.h>
#endif
#include "nano.h"
#ifndef DISABLE_WRAPJUSTIFY
extern ssize_t fill;
extern ssize_t wrap_at;
#endif
extern int editwinrows;
extern size_t current_x;
extern ssize_t current_y;
extern size_t totlines;
extern size_t placewewant;
#ifndef NANO_SMALL
extern size_t mark_beginx;
#endif
extern size_t totsize;
extern unsigned long flags;
extern long flags;
extern ssize_t tabsize;
extern int currslen;
@@ -72,10 +58,7 @@ extern char *backup_dir;
#endif
extern WINDOW *topwin, *edit, *bottomwin;
extern char *filename;
extern struct stat originalfilestat;
extern char *answer;
extern char *hblank;
#ifndef DISABLE_HELP
extern char *help_text;
#endif
@@ -90,22 +73,15 @@ extern char *alt_speller;
#endif
extern struct stat fileinfo;
extern filestruct *current, *fileage, *edittop, *filebot;
extern filestruct *cutbuffer;
#ifndef DISABLE_JUSTIFY
extern filestruct *jusbuffer;
#endif
extern partition *filepart;
#ifndef NANO_SMALL
extern filestruct *mark_beginbuf;
#endif
#ifdef ENABLE_MULTIBUFFER
extern openfilestruct *open_files;
#endif
extern openfilestruct *openfile;
#ifdef ENABLE_COLOR
extern const colortype *colorstrings;
extern syntaxtype *syntaxes;
extern char *syntaxstr;
#endif
@@ -162,29 +138,29 @@ extern char *homedir;
#ifndef HAVE_ISBLANK
bool nisblank(int c);
#endif
#if !defined(HAVE_ISWBLANK) && defined(NANO_WIDE)
#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
bool niswblank(wchar_t wc);
#endif
bool is_byte(int c);
bool is_alnum_mbchar(const char *c);
bool is_blank_mbchar(const char *c);
bool is_cntrl_char(int c);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
bool is_cntrl_wchar(wchar_t wc);
#endif
bool is_cntrl_mbchar(const char *c);
bool is_punct_mbchar(const char *c);
bool is_word_mbchar(const char *c, bool allow_punct);
char control_rep(char c);
#ifdef NANO_WIDE
#ifdef ENABLE_UTF8
wchar_t control_wrep(wchar_t c);
#endif
char *control_mbrep(const char *c, char *crep, int *crep_len);
char *mbrep(const char *c, char *crep, int *crep_len);
int mbwidth(const char *c);
int mb_cur_max(void);
char *make_mbchar(int chr, int *chr_mb_len);
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
*col);
char *make_mbchar(long chr, int *chr_mb_len);
int parse_mbchar(const char *buf, char *chr, size_t *col);
size_t move_mbleft(const char *buf, size_t pos);
size_t move_mbright(const char *buf, size_t pos);
#ifndef HAVE_STRCASECMP
@@ -215,11 +191,14 @@ 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
bool has_blank_chars(const char *s);
bool has_blank_mbchars(const char *s);
#endif
char *mbstrchr(const char *s, char *c);
#endif
#ifdef ENABLE_UTF8
bool is_valid_unicode(wchar_t wc);
#endif
#ifdef ENABLE_NANORC
bool is_valid_mbstring(const char *s);
@@ -228,8 +207,8 @@ bool is_valid_mbstring(const char *s);
/* Public functions in color.c. */
#ifdef ENABLE_COLOR
void set_colorpairs(void);
void do_colorinit(void);
void update_color(void);
void color_init(void);
void color_update(void);
#endif /* ENABLE_COLOR */
/* Public functions in cut.c. */
@@ -246,17 +225,22 @@ void do_cut_till_end(void);
void do_uncut_text(void);
/* Public functions in files.c. */
void new_file(void);
void make_new_buffer(void);
void initialize_buffer(void);
void initialize_buffer_text(void);
void open_buffer(const char *filename);
void display_buffer(void);
#ifdef ENABLE_MULTIBUFFER
void switch_to_prevnext_buffer(bool next);
void switch_to_prev_buffer_void(void);
void switch_to_next_buffer_void(void);
bool close_buffer(void);
#endif
filestruct *read_line(char *buf, filestruct *prevnode, bool
*first_line_ins, size_t buf_len);
void load_file(void);
void read_file(FILE *f, const char *filename);
int open_file(const char *filename, bool newfie, FILE **f);
char *get_next_filename(const char *name, const char *suffix);
#ifndef NANO_SMALL
void execute_command(const char *command);
#endif
void load_buffer(const char *name);
void do_insertfile(
#ifndef NANO_SMALL
bool execute
@@ -265,22 +249,6 @@ void do_insertfile(
#endif
);
void do_insertfile_void(void);
#ifdef ENABLE_MULTIBUFFER
openfilestruct *make_new_opennode(void);
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
openfilestruct *end);
void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
#ifdef DEBUG
void free_openfilestruct(openfilestruct *src);
#endif
void add_open_file(bool update);
void load_open_file(void);
void open_prevnext_file(bool next_file);
void open_prevfile_void(void);
void open_nextfile_void(void);
bool close_open_file(void);
#endif
char *get_full_path(const char *origpath);
char *check_writable_directory(const char *path);
char *safe_tempfile(FILE **f);
@@ -292,10 +260,11 @@ bool check_operating_dir(const char *currpath, bool allow_tabcomp);
void init_backup_dir(void);
#endif
int copy_file(FILE *inn, FILE *out);
int write_file(const char *name, FILE *f_open, bool tmp, int append,
bool nonamechange);
int write_file(const char *name, FILE *f_open, bool tmp, append_type
append, bool nonamechange);
#ifndef NANO_SMALL
int write_marked(const char *name, FILE *f_open, bool tmp, int append);
int write_marked_file(const char *name, FILE *f_open, bool tmp,
append_type append);
#endif
int do_writeout(bool exiting);
void do_writeout_void(void);
@@ -347,32 +316,28 @@ void thanks_for_all_the_fish(void);
/* Public functions in move.c. */
void do_first_line(void);
void do_last_line(void);
void do_home(void);
void do_end(void);
void do_page_up(void);
void do_page_down(void);
#ifndef DISABLE_JUSTIFY
void do_para_begin(bool allow_update);
void do_para_begin_void(void);
void do_para_end(bool allow_update);
void do_para_end_void(void);
#endif
#ifndef NANO_SMALL
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
bool do_prev_word(bool allow_punct, bool allow_update);
void do_prev_word_void(void);
#endif
void do_home(void);
void do_end(void);
void do_up(void);
void do_down(void);
void do_left(bool allow_update);
void do_left_void(void);
void do_right(bool allow_update);
void do_right_void(void);
void do_left(void);
void do_right(void);
/* Public functions in nano.c. */
void print_view_warning(void);
void finish(void);
void die(const char *msg, ...);
void die_save_file(const char *die_filename);
void check_die_too_small(void);
void resize_variables(void);
void global_init(bool save_cutbuffer);
void window_init(void);
#ifndef DISABLE_MOUSE
void mouse_init(void);
#endif
#ifndef DISABLE_HELP
void help_init(void);
#endif
filestruct *make_new_node(filestruct *prevnode);
filestruct *copy_node(const filestruct *src);
void splice_node(filestruct *begin, filestruct *newnode, filestruct
@@ -381,14 +346,32 @@ void unlink_node(const filestruct *fileptr);
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
void free_filestruct(filestruct *src);
void renumber(filestruct *fileptr);
partition *partition_filestruct(filestruct *top, size_t top_x,
filestruct *bot, size_t bot_x);
void unpartition_filestruct(partition **p);
void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
void renumber_all(void);
void renumber(filestruct *fileptr);
openfilestruct *make_new_opennode(void);
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
openfilestruct *end);
void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
#ifdef DEBUG
void free_openfilestruct(openfilestruct *src);
#endif
void print_view_warning(void);
void finish(void);
void die(const char *msg, ...);
void die_save_file(const char *die_filename);
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
@@ -399,59 +382,7 @@ void version(void);
int no_more_space(void);
int no_help(void);
void nano_disabled_msg(void);
#ifndef NANO_SMALL
void cancel_fork(int signal);
bool open_pipe(const char *command);
#endif
void do_verbatim_input(void);
void do_backspace(void);
void do_delete(void);
void do_tab(void);
void do_enter(void);
#ifndef NANO_SMALL
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
bool do_prev_word(bool allow_punct, bool allow_update);
void do_prev_word_void(void);
void do_word_count(void);
void do_mark(void);
#endif
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(filestruct *line);
#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
#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
ssize_t break_line(const char *line, ssize_t goal, bool newline);
#endif
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
size_t indent_length(const char *line);
#endif
#ifndef DISABLE_JUSTIFY
void justify_format(filestruct *paragraph, size_t skip);
size_t quote_length(const char *line);
bool quotes_match(const char *a_line, size_t a_quote, const char
*b_line);
bool indents_match(const char *a_line, size_t a_indent, const char
*b_line, size_t b_indent);
bool begpar(const filestruct *const foo);
void do_para_begin(bool allow_update);
void do_para_begin_void(void);
bool inpar(const filestruct *const foo);
void do_para_end(bool allow_update);
void do_para_end_void(void);
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
quote_len);
bool find_paragraph(size_t *const quote, size_t *const par);
void do_justify(bool full_justify);
void do_justify_void(void);
void do_full_justify(void);
#endif /* !DISABLE_JUSTIFY */
void do_exit(void);
void signal_init(void);
void handle_hupterm(int signal);
@@ -485,9 +416,9 @@ void rcfile_error(const char *msg, ...);
char *parse_next_word(char *ptr);
char *parse_argument(char *ptr);
#ifdef ENABLE_COLOR
int color_to_int(const char *colorname, bool *bright);
short color_to_short(const char *colorname, bool *bright);
char *parse_next_regex(char *ptr);
bool nregcomp(regex_t *preg, const char *regex, int eflags);
bool nregcomp(const char *regex, int eflags);
void parse_syntax(char *ptr);
void parse_colors(char *ptr, bool icase);
#endif /* ENABLE_COLOR */
@@ -504,9 +435,8 @@ void not_found_msg(const char *str);
void search_abort(void);
void search_init_globals(void);
int search_init(bool replacing, bool use_answer);
bool is_whole_word(size_t pos, const char *buf, const char *word);
bool findnextstr(bool can_display_wrap, bool wholeword, bool
no_sameline, const filestruct *begin, size_t beginx, const char
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);
@@ -523,9 +453,9 @@ ssize_t do_replace_loop(const char *needle, const filestruct
*canceled);
void do_replace(void);
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive, bool save_pos);
bool interactive, bool save_pos, bool allow_update);
void do_gotolinecolumn_void(void);
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
#ifndef DISABLE_SPELLER
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
pos_pww);
#endif
@@ -537,24 +467,66 @@ void do_find_bracket(void);
bool history_has_changed(void);
#endif
void history_init(void);
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
char *s, size_t len);
void history_reset(const filestruct *h);
filestruct *find_history(const filestruct *h_start, const filestruct
*h_end, const char *s, size_t len);
void update_history(filestruct **h, const char *s);
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
#ifndef DISABLE_TABCOMP
char *get_history_completion(filestruct **h, char *s, size_t len);
char *get_history_completion(filestruct **h, const char *s, size_t len);
#endif
#endif /* !NANO_SMALL */
/* Public functions in text.c. */
#ifndef NANO_SMALL
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);
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);
#endif
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
size_t indent_length(const char *line);
#endif
#ifndef DISABLE_JUSTIFY
void justify_format(filestruct *paragraph, size_t skip);
size_t quote_length(const char *line);
bool quotes_match(const char *a_line, size_t a_quote, const char
*b_line);
bool indents_match(const char *a_line, size_t a_indent, const char
*b_line, size_t b_indent);
bool begpar(const filestruct *const foo);
bool inpar(const filestruct *const foo);
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
quote_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 */
#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
void do_wordlinechar_count(void);
#endif
/* Public functions in utils.c. */
#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);
#endif
int digits(size_t n);
void get_homedir(void);
bool parse_num(const char *str, ssize_t *val);
@@ -571,6 +543,14 @@ ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
#endif
#endif /* !NANO_SMALL && ENABLE_NANORC */
#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);
#endif
bool is_whole_word(size_t pos, const char *buf, const char *word);
const char *strstrwrapper(const char *haystack, const char *needle,
const char *start);
void nperror(const char *s);
@@ -585,15 +565,14 @@ void remove_magicline(void);
void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x, bool *right_side_up);
#endif
void get_totals(const filestruct *begin, const filestruct *end, size_t
*lines, size_t *size);
size_t get_totsize(const filestruct *begin, const filestruct *end);
/* Public functions in winio.c. */
#ifndef NANO_SMALL
void reset_kbinput(void);
#endif
void get_buffer(WINDOW *win);
size_t get_buffer_len(void);
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
void unget_input(int *input, size_t input_len);
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
int *get_input(WINDOW *win, size_t input_len);
@@ -611,7 +590,7 @@ int get_byte_kbinput(int kbinput
, bool reset
#endif
);
int get_word_kbinput(int kbinput
long get_unicode_kbinput(int kbinput
#ifndef NANO_SMALL
, bool reset
#endif
@@ -633,6 +612,8 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
#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);
@@ -645,12 +626,11 @@ bool do_statusbar_next_word(bool allow_punct);
bool do_statusbar_prev_word(bool allow_punct);
#endif
void do_statusbar_verbatim_input(bool *got_enter);
void do_statusbar_output(char *output, size_t output_len, bool
*got_enter, bool allow_cntrls);
size_t xplustabs(void);
size_t actual_x(const char *str, size_t xplus);
size_t strnlenpt(const char *buf, size_t size);
size_t strlenpt(const char *buf);
void blank_line(WINDOW *win, int y, int x, int n);
void blank_titlebar(void);
void blank_topbar(void);
void blank_edit(void);
@@ -685,12 +665,12 @@ void reset_cursor(void);
void edit_add(const filestruct *fileptr, const char *converted, int
yval, size_t start);
void update_line(const filestruct *fileptr, size_t index);
int need_horizontal_update(size_t old_pww);
int need_vertical_update(size_t old_pww);
void edit_scroll(updown direction, int nlines);
bool need_horizontal_update(size_t old_pww);
bool need_vertical_update(size_t old_pww);
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(topmidnone location);
void edit_update(update_type location);
int do_yesno(bool all, const char *msg);
void total_redraw(void);
void total_refresh(void);
@@ -706,8 +686,8 @@ void do_replace_highlight(bool highlight, const char *word);
int check_linenumbers(const filestruct *fileptr);
#endif
#ifdef DEBUG
void dump_buffer(const filestruct *inptr);
void dump_buffer_reverse(void);
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
#ifdef NANO_EXTRA
void do_credits(void);

View File

@@ -24,14 +24,12 @@
#include <config.h>
#endif
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <ctype.h>
#include <assert.h>
#include "proto.h"
#ifdef ENABLE_NANORC
@@ -65,6 +63,7 @@ const static rcoption rcopts[] = {
{"quotestr", 0},
#endif
{"rebinddelete", REBIND_DELETE},
{"rebindkeypad", REBIND_KEYPAD},
#ifdef HAVE_REGEX_H
{"regexp", USE_REGEXP},
#endif
@@ -89,6 +88,7 @@ const static rcoption rcopts[] = {
{"smooth", SMOOTH_SCROLL},
{"tabstospaces", TABS_TO_SPACES},
{"whitespace", 0},
{"wordbounds", WORD_BOUNDS},
#endif
{NULL, 0}
};
@@ -112,8 +112,7 @@ void rcfile_error(const char *msg, ...)
fprintf(stderr, "\n");
if (lineno > 0) {
errors = TRUE;
fprintf(stderr, _("Error in %s on line %lu: "), nanorc,
(unsigned long)lineno);
fprintf(stderr, _("Error in %s on line %lu: "), nanorc, (unsigned long)lineno);
}
va_start(ap, msg);
@@ -182,9 +181,9 @@ char *parse_argument(char *ptr)
}
#ifdef ENABLE_COLOR
int color_to_int(const char *colorname, bool *bright)
short color_to_short(const char *colorname, bool *bright)
{
int mcolor = -1;
short mcolor = -1;
assert(colorname != NULL && bright != NULL);
@@ -246,27 +245,31 @@ char *parse_next_regex(char *ptr)
return ptr;
}
/* Compile the regular expression regex to preg. Return FALSE on
* success, or TRUE if the expression is invalid. */
bool nregcomp(regex_t *preg, const char *regex, int eflags)
/* Compile the regular expression regex to see if it's valid. Return
* TRUE if it is, or FALSE otherwise. */
bool nregcomp(const char *regex, int eflags)
{
int rc = regcomp(preg, regex, REG_EXTENDED | eflags);
regex_t preg;
int rc = regcomp(&preg, regex, REG_EXTENDED | eflags);
if (rc != 0) {
size_t len = regerror(rc, preg, NULL, 0);
size_t len = regerror(rc, &preg, NULL, 0);
char *str = charalloc(len);
regerror(rc, preg, str, len);
regerror(rc, &preg, str, len);
rcfile_error(N_("Bad regex \"%s\": %s"), regex, str);
free(str);
}
return (rc != 0);
regfree(&preg);
return (rc == 0);
}
void parse_syntax(char *ptr)
{
const char *fileregptr = NULL, *nameptr = NULL;
const syntaxtype *tmpsyntax;
exttype *endext = NULL;
/* The end of the extensions list for this syntax. */
@@ -291,6 +294,14 @@ void parse_syntax(char *ptr)
if (ptr == NULL)
return;
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) {
if (strcmp(nameptr, tmpsyntax->desc) == 0) {
rcfile_error(N_("Duplicate syntax name %s"), nameptr);
return;
}
}
if (syntaxes == NULL) {
syntaxes = (syntaxtype *)nmalloc(sizeof(syntaxtype));
endsyntax = syntaxes;
@@ -301,15 +312,31 @@ void parse_syntax(char *ptr)
fprintf(stderr, "Adding new syntax after first one\n");
#endif
}
endsyntax->desc = mallocstrcpy(NULL, nameptr);
endsyntax->color = NULL;
endcolor = NULL;
endsyntax->extensions = NULL;
endsyntax->next = NULL;
#ifdef DEBUG
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
#endif
/* The "none" syntax is the same as not having a syntax at all, so
* we can't assign any extensions or colors to it. */
if (strcmp(endsyntax->desc, "none") == 0) {
rcfile_error(N_("The \"none\" syntax is reserved"));
return;
}
/* The default syntax should have no associated extensions. */
if (strcmp(endsyntax->desc, "default") == 0 && *ptr != '\0') {
rcfile_error(
N_("The \"default\" syntax must take no extensions"));
return;
}
/* Now load the extensions into their part of the struct. */
while (*ptr != '\0') {
exttype *newext;
@@ -329,16 +356,20 @@ void parse_syntax(char *ptr)
break;
newext = (exttype *)nmalloc(sizeof(exttype));
if (nregcomp(&newext->val, fileregptr, REG_NOSUB))
free(newext);
else {
/* Save the extension regex if it's valid. */
if (nregcomp(fileregptr, REG_NOSUB)) {
newext->ext_regex = mallocstrcpy(NULL, fileregptr);
newext->ext = NULL;
if (endext == NULL)
endsyntax->extensions = newext;
else
endext->next = newext;
endext = newext;
endext->next = NULL;
}
} else
free(newext);
}
}
@@ -346,7 +377,7 @@ void parse_syntax(char *ptr)
* treat the color stuff as case insensitive. */
void parse_colors(char *ptr, bool icase)
{
int fg, bg;
short fg, bg;
bool bright = FALSE, no_fgcolor = FALSE;
char *fgstr;
@@ -377,12 +408,12 @@ void parse_colors(char *ptr, bool icase)
bgcolorname);
return;
}
bg = color_to_int(bgcolorname, &bright);
bg = color_to_short(bgcolorname, &bright);
} else
bg = -1;
if (!no_fgcolor) {
fg = color_to_int(fgstr, &bright);
fg = color_to_short(fgstr, &bright);
/* Don't try to parse screwed-up foreground colors. */
if (fg == -1)
@@ -425,34 +456,45 @@ void parse_colors(char *ptr, bool icase)
ptr++;
newcolor = (colortype *)nmalloc(sizeof(colortype));
fgstr = ptr;
ptr = parse_next_regex(ptr);
if (ptr == NULL)
break;
if (nregcomp(&newcolor->start, fgstr, icase ? REG_ICASE : 0)) {
free(newcolor);
cancelled = TRUE;
} else {
newcolor = (colortype *)nmalloc(sizeof(colortype));
/* Save the starting regex string if it's valid, and set up the
* color information. */
if (nregcomp(fgstr, icase ? REG_ICASE : 0)) {
newcolor->fg = fg;
newcolor->bg = bg;
newcolor->bright = bright;
newcolor->next = NULL;
newcolor->icase = icase;
newcolor->start_regex = mallocstrcpy(NULL, fgstr);
newcolor->start = NULL;
newcolor->end_regex = NULL;
newcolor->end = NULL;
newcolor->next = NULL;
if (endcolor == NULL) {
endsyntax->color = newcolor;
#ifdef DEBUG
fprintf(stderr, "Starting a new colorstring for fg %d, bg %d\n", fg, bg);
fprintf(stderr, "Starting a new colorstring for fg %hd, bg %hd\n", fg, bg);
#endif
} else {
#ifdef DEBUG
fprintf(stderr, "Adding new entry for fg %d, bg %d\n", fg, bg);
fprintf(stderr, "Adding new entry for fg %hd, bg %hd\n", fg, bg);
#endif
endcolor->next = newcolor;
}
endcolor = newcolor;
} else {
free(newcolor);
cancelled = TRUE;
}
if (expectend) {
@@ -480,11 +522,9 @@ void parse_colors(char *ptr, bool icase)
if (cancelled)
continue;
newcolor->end = (regex_t *)nmalloc(sizeof(regex_t));
if (nregcomp(newcolor->end, fgstr, icase ? REG_ICASE : 0)) {
free(newcolor->end);
newcolor->end = NULL;
}
/* Save the ending regex string if it's valid. */
newcolor->end_regex = (nregcomp(fgstr, icase ? REG_ICASE :
0)) ? mallocstrcpy(NULL, fgstr) : NULL;
}
}
}
@@ -610,11 +650,10 @@ void parse_rcfile(FILE *rcstream)
} else {
whitespace_len[0] =
parse_mbchar(whitespace, NULL,
NULL, NULL);
NULL);
whitespace_len[1] =
parse_mbchar(whitespace +
whitespace_len[0], NULL,
NULL, NULL);
whitespace_len[0], NULL, NULL);
}
} else
#endif
@@ -686,8 +725,7 @@ void parse_rcfile(FILE *rcstream)
if (errors) {
errors = FALSE;
fprintf(stderr,
_("\nPress Return to continue starting nano\n"));
fprintf(stderr, _("\nPress Return to continue starting nano\n"));
while (getchar() != '\n')
;
}

View File

@@ -24,13 +24,11 @@
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <assert.h>
#include "proto.h"
static bool search_last_line = FALSE;
@@ -57,6 +55,7 @@ int regexp_init(const char *regexp)
);
assert(!regexp_compiled);
if (rc != 0) {
size_t len = regerror(rc, &search_regexp, NULL, 0);
char *str = charalloc(len);
@@ -100,7 +99,7 @@ void search_abort(void)
{
display_main_list();
#ifndef NANO_SMALL
if (ISSET(MARK_ISSET))
if (openfile->mark_set)
edit_refresh();
#endif
#ifdef HAVE_REGEX_H
@@ -153,7 +152,7 @@ int search_init(bool replacing, bool use_answer)
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
buf = charalloc(strlen(disp) + 7);
/* We use COLS / 3 here because we need to see more on the
/* We use (COLS / 3) here because we need to see more on the
* line. */
sprintf(buf, " [%s%s]", disp,
strlenpt(last_search) > COLS / 3 ? "..." : "");
@@ -192,13 +191,9 @@ int search_init(bool replacing, bool use_answer)
replacing ?
#ifndef NANO_SMALL
(ISSET(MARK_ISSET) ? _(" (to replace) in selection") :
openfile->mark_set ? _(" (to replace) in selection") :
#endif
_(" (to replace)")
#ifndef NANO_SMALL
)
#endif
: "",
_(" (to replace)") : "",
buf);
@@ -215,17 +210,14 @@ int search_init(bool replacing, bool use_answer)
return -1;
} else {
switch (i) {
case -2: /* It's the same string. */
case -2: /* It's an empty string. */
case 0: /* It's a new string. */
#ifdef HAVE_REGEX_H
/* Since answer is "", use last_search! */
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
return -1;
#endif
break;
case 0: /* They entered something new. */
last_replace[0] = '\0';
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP) && regexp_init(answer) == 0)
/* Use last_search if answer is an empty string, or
* answer if it isn't. */
if (ISSET(USE_REGEXP) &&
regexp_init((i == -2) ? last_search :
answer) == 0)
return -1;
#endif
break;
@@ -249,8 +241,9 @@ int search_init(bool replacing, bool use_answer)
backupstring = mallocstrcpy(backupstring, answer);
return -2; /* Call the opposite search function. */
case NANO_TOGOTOLINE_KEY:
do_gotolinecolumn(current->lineno, placewewant + 1,
TRUE, TRUE, FALSE);
do_gotolinecolumn(openfile->current->lineno,
openfile->placewewant + 1, TRUE, TRUE, FALSE,
TRUE);
/* Put answer up on the statusbar and
* fall through. */
default:
@@ -261,48 +254,24 @@ int search_init(bool replacing, bool use_answer)
return 0;
}
bool is_whole_word(size_t pos, const char *buf, const char *word)
{
char *p = charalloc(mb_cur_max()), *r = charalloc(mb_cur_max());
size_t word_end = pos + strlen(word);
bool retval;
assert(buf != NULL && pos <= strlen(buf) && word != NULL);
parse_mbchar(buf + move_mbleft(buf, pos), p, NULL, NULL);
parse_mbchar(buf + word_end, r, NULL, NULL);
/* If we're at the beginning of the line or the character before the
* word isn't a non-punctuation "word" character, and if we're at
* the end of the line or the character after the word isn't a
* non-punctuation "word" character, we have a whole word. */
retval = (pos == 0 || !is_word_mbchar(p, FALSE)) &&
(word_end == strlen(buf) || !is_word_mbchar(r, FALSE));
free(p);
free(r);
return retval;
}
/* Look for needle, starting at (current, current_x). If no_sameline is
* TRUE, skip over begin when looking for needle. begin is the line
* where we first started searching, at column beginx. If
* 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 beginx, const char
no_sameline, const filestruct *begin, size_t begin_x, const char
*needle, size_t *needle_len)
{
filestruct *fileptr = current;
filestruct *fileptr = openfile->current;
const char *rev_start = NULL, *found = NULL;
size_t found_len;
/* The length of the match we found. */
size_t current_x_find = 0;
/* The location of the match we found. */
ssize_t current_y_find = current_y;
ssize_t current_y_find = openfile->current_y;
/* rev_start might end up 1 character before the start or after the
* end of the line. This won't be a problem because strstrwrapper()
@@ -311,9 +280,10 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
* previous or next line. */
rev_start =
#ifndef NANO_SMALL
ISSET(BACKWARDS_SEARCH) ? fileptr->data + (current_x - 1) :
ISSET(BACKWARDS_SEARCH) ?
fileptr->data + (openfile->current_x - 1) :
#endif
fileptr->data + (current_x + 1);
fileptr->data + (openfile->current_x + 1);
/* Look for needle in searchstr. */
while (TRUE) {
@@ -348,7 +318,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
* a match on the same line we started on and this potential
* match is on that line, continue searching. */
if ((!wholeword || found_whole) && (!no_sameline ||
fileptr != current))
fileptr != openfile->current))
break;
}
@@ -378,11 +348,11 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
#ifndef NANO_SMALL
if (ISSET(BACKWARDS_SEARCH)) {
fileptr = filebot;
fileptr = openfile->filebot;
current_y_find = editwinrows - 1;
} else {
#endif
fileptr = fileage;
fileptr = openfile->fileage;
current_y_find = 0;
#ifndef NANO_SMALL
}
@@ -409,10 +379,10 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
/* Ensure we haven't wrapped around again! */
if (search_last_line &&
#ifndef NANO_SMALL
((!ISSET(BACKWARDS_SEARCH) && current_x_find > beginx) ||
(ISSET(BACKWARDS_SEARCH) && current_x_find < beginx))
((!ISSET(BACKWARDS_SEARCH) && current_x_find > begin_x) ||
(ISSET(BACKWARDS_SEARCH) && current_x_find < begin_x))
#else
current_x_find > beginx
current_x_find > begin_x
#endif
) {
if (can_display_wrap)
@@ -420,11 +390,11 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
return FALSE;
}
/* Set globals now that we are sure we found something. */
current = fileptr;
current_x = current_x_find;
current_y = current_y_find;
placewewant = xplustabs();
/* We've definitely found something. */
openfile->current = fileptr;
openfile->current_x = current_x_find;
openfile->current_y = current_y_find;
openfile->placewewant = xplustabs();
/* needle_len holds the length of needle. */
if (needle_len != NULL)
@@ -441,10 +411,11 @@ void findnextstr_wrap_reset(void)
/* Search for a string. */
void do_search(void)
{
size_t old_pww = placewewant, fileptr_x = current_x;
filestruct *fileptr = openfile->current;
size_t fileptr_x = openfile->current_x;
size_t old_pww = openfile->placewewant;
int i;
bool didfind;
filestruct *fileptr = current;
#ifndef DISABLE_WRAPPING
wrap_reset();
@@ -479,12 +450,13 @@ void do_search(void)
#endif
findnextstr_wrap_reset();
didfind = findnextstr(TRUE, FALSE, FALSE, current, current_x,
answer, NULL);
didfind = findnextstr(TRUE, FALSE, 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. */
if (fileptr == current && fileptr_x == current_x && didfind) {
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && didfind) {
#ifdef HAVE_REGEX_H
/* Do the search again, skipping over the current line, if we're
* doing a bol and/or eol regex search ("^", "$", or "^$"), so
@@ -493,9 +465,10 @@ 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, current, current_x,
answer, NULL);
if (fileptr == current && fileptr_x == current_x && !didfind)
didfind = findnextstr(TRUE, FALSE, TRUE, openfile->current,
openfile->current_x, answer, NULL);
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && !didfind)
statusbar(_("This is the only occurrence"));
} else {
#endif
@@ -505,7 +478,7 @@ void do_search(void)
#endif
}
placewewant = xplustabs();
openfile->placewewant = xplustabs();
edit_redraw(fileptr, old_pww);
search_abort();
}
@@ -514,9 +487,10 @@ void do_search(void)
/* Search for the next string without prompting. */
void do_research(void)
{
size_t old_pww = placewewant, fileptr_x = current_x;
filestruct *fileptr = openfile->current;
size_t fileptr_x = openfile->current_x;
size_t old_pww = openfile->placewewant;
bool didfind;
filestruct *fileptr = current;
#ifndef DISABLE_WRAPPING
wrap_reset();
@@ -533,12 +507,13 @@ void do_research(void)
#endif
findnextstr_wrap_reset();
didfind = findnextstr(TRUE, FALSE, FALSE, current, current_x,
last_search, NULL);
didfind = findnextstr(TRUE, FALSE, 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. */
if (fileptr == current && fileptr_x == current_x && didfind) {
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && didfind) {
#ifdef HAVE_REGEX_H
/* Do the search again, skipping over the current line, if
* we're doing a bol and/or eol regex search ("^", "$", or
@@ -547,10 +522,11 @@ 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, current,
current_x, answer, NULL);
if (fileptr == current && fileptr_x == current_x &&
!didfind)
didfind = findnextstr(TRUE, FALSE, TRUE,
openfile->current, openfile->current_x, answer,
NULL);
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && !didfind)
statusbar(_("This is the only occurrence"));
} else {
#endif
@@ -562,7 +538,7 @@ void do_research(void)
} else
statusbar(_("No current search pattern"));
placewewant = xplustabs();
openfile->placewewant = xplustabs();
edit_redraw(fileptr, old_pww);
search_abort();
}
@@ -570,11 +546,8 @@ void do_research(void)
void replace_abort(void)
{
/* Identical to search_abort(), so we'll call it here. If it does
* something different later, we can change it back. For now, it's
* just a waste to duplicate code. */
/* For now, we do the same thing as search_abort(). */
search_abort();
placewewant = xplustabs();
}
#ifdef HAVE_REGEX_H
@@ -585,18 +558,18 @@ int replace_regexp(char *string, bool create)
* subexpressions \1 to \9 in the replaced text). */
const char *c = last_replace;
size_t search_match_count =
regmatches[0].rm_eo - regmatches[0].rm_so;
size_t new_line_size =
strlen(current->data) + 1 - search_match_count;
size_t search_match_count = regmatches[0].rm_eo -
regmatches[0].rm_so;
size_t new_line_size = strlen(openfile->current->data) + 1 -
search_match_count;
/* Iterate through the replacement text to handle subexpression
* replacement using \1, \2, \3, etc. */
while (*c != '\0') {
int num = (int)(*(c + 1) - '0');
if (*c != '\\' || num < 1 || num > 9 ||
num > search_regexp.re_nsub) {
if (*c != '\\' || num < 1 || num > 9 || num >
search_regexp.re_nsub) {
if (create)
*string++ = *c;
c++;
@@ -613,8 +586,8 @@ int replace_regexp(char *string, bool create)
/* And if create is TRUE, append the result of the
* subexpression match to the new line. */
if (create) {
strncpy(string, current->data + current_x +
regmatches[num].rm_so, i);
strncpy(string, openfile->current->data +
openfile->current_x + regmatches[num].rm_so, i);
string += i;
}
}
@@ -640,8 +613,8 @@ char *replace_line(const char *needle)
} else {
#endif
search_match_count = strlen(needle);
new_line_size = strlen(current->data) - search_match_count +
strlen(answer) + 1;
new_line_size = strlen(openfile->current->data) -
search_match_count + strlen(answer) + 1;
#ifdef HAVE_REGEX_H
}
#endif
@@ -650,20 +623,21 @@ char *replace_line(const char *needle)
copy = charalloc(new_line_size);
/* The head of the original line. */
strncpy(copy, current->data, current_x);
strncpy(copy, openfile->current->data, openfile->current_x);
/* The replacement text. */
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP))
replace_regexp(copy + current_x, TRUE);
replace_regexp(copy + openfile->current_x, TRUE);
else
#endif
strcpy(copy + current_x, answer);
strcpy(copy + openfile->current_x, answer);
/* The tail of the original line. */
assert(current_x + search_match_count <= strlen(current->data));
assert(openfile->current_x + search_match_count <= strlen(openfile->current->data));
strcat(copy, current->data + current_x + search_match_count);
strcat(copy, openfile->current->data + openfile->current_x +
search_match_count);
return copy;
}
@@ -688,11 +662,11 @@ ssize_t do_replace_loop(const char *needle, const filestruct
bool begin_line = FALSE, bol_or_eol = FALSE;
#endif
#ifndef NANO_SMALL
bool old_mark_set = ISSET(MARK_ISSET);
filestruct *edittop_save = edittop, *top, *bot;
bool old_mark_set = openfile->mark_set;
filestruct *edittop_save = openfile->edittop, *top, *bot;
size_t top_x, bot_x;
bool right_side_up = FALSE;
/* TRUE if (mark_beginbuf, mark_beginx) is the top of the mark,
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
* FALSE if (current, current_x) is. */
if (old_mark_set) {
@@ -702,8 +676,8 @@ ssize_t do_replace_loop(const char *needle, const filestruct
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
filepart = partition_filestruct(top, top_x, bot, bot_x);
edittop = fileage;
UNSET(MARK_ISSET);
openfile->edittop = openfile->fileage;
openfile->mark_set = FALSE;
edit_refresh();
}
#endif
@@ -730,13 +704,14 @@ ssize_t do_replace_loop(const char *needle, const filestruct
* beginning line already, and we're still on the beginning line
* after the search, it means that we've wrapped around, so
* we're done. */
if (bol_or_eol && begin_line && current == real_current)
if (bol_or_eol && begin_line && openfile->current ==
real_current)
break;
/* Otherwise, set the begin_line flag if we've found a match on
* the beginning line, reset the bol_or_eol flag, and
* continue. */
else {
if (current == real_current)
if (openfile->current == real_current)
begin_line = TRUE;
bol_or_eol = FALSE;
}
@@ -751,9 +726,9 @@ ssize_t do_replace_loop(const char *needle, const filestruct
if (!replaceall) {
size_t xpt = xplustabs();
char *exp_word = display_string(current->data, xpt,
strnlenpt(current->data, current_x + match_len) - xpt,
FALSE);
char *exp_word = display_string(openfile->current->data,
xpt, strnlenpt(openfile->current->data,
openfile->current_x + match_len) - xpt, FALSE);
curs_set(0);
@@ -791,19 +766,21 @@ ssize_t do_replace_loop(const char *needle, const filestruct
copy = replace_line(needle);
length_change = strlen(copy) - strlen(current->data);
length_change = strlen(copy) -
strlen(openfile->current->data);
#ifndef NANO_SMALL
/* If the mark was on and (mark_beginbuf, mark_begin_x) was
* the top of it, don't change mark_beginx. */
/* If the mark was on and (mark_begin, mark_begin_x) was the
* top of it, don't change mark_begin_x. */
if (!old_mark_set || !right_side_up) {
/* Keep mark_beginx in sync with the text changes. */
if (current == mark_beginbuf &&
mark_beginx > current_x) {
if (mark_beginx < current_x + match_len)
mark_beginx = current_x;
/* Keep mark_begin_x in sync with the text changes. */
if (openfile->current == openfile->mark_begin &&
openfile->mark_begin_x > openfile->current_x) {
if (openfile->mark_begin_x < openfile->current_x +
match_len)
openfile->mark_begin_x = openfile->current_x;
else
mark_beginx += length_change;
openfile->mark_begin_x += length_change;
}
}
@@ -812,10 +789,12 @@ ssize_t do_replace_loop(const char *needle, const filestruct
if (!old_mark_set || right_side_up) {
#endif
/* Keep real_current_x in sync with the text changes. */
if (current == real_current &&
current_x <= *real_current_x) {
if (*real_current_x < current_x + match_len)
*real_current_x = current_x + match_len;
if (openfile->current == real_current &&
openfile->current_x <= *real_current_x) {
if (*real_current_x <
openfile->current_x + match_len)
*real_current_x = openfile->current_x +
match_len;
*real_current_x += length_change;
}
#ifndef NANO_SMALL
@@ -829,20 +808,23 @@ ssize_t do_replace_loop(const char *needle, const filestruct
#ifndef NANO_SMALL
if (!ISSET(BACKWARDS_SEARCH))
#endif
current_x += match_len + length_change - 1;
openfile->current_x += match_len + length_change - 1;
/* Cleanup. */
totsize += length_change;
free(current->data);
current->data = copy;
openfile->totsize += length_change;
free(openfile->current->data);
openfile->current->data = copy;
if (!replaceall) {
#ifdef ENABLE_COLOR
if (!ISSET(NO_COLOR_SYNTAX))
/* If color syntaxes are available and turned on, we
* need to call edit_refresh(). */
if (openfile->colorstrings != NULL &&
!ISSET(NO_COLOR_SYNTAX))
edit_refresh();
else
#endif
update_line(current, current_x);
update_line(openfile->current, openfile->current_x);
}
set_modified();
@@ -856,14 +838,14 @@ ssize_t do_replace_loop(const char *needle, const filestruct
* contains all the text again, set edittop back to what it was
* before, turn the mark back on, and refresh the screen. */
unpartition_filestruct(&filepart);
edittop = edittop_save;
SET(MARK_ISSET);
openfile->edittop = edittop_save;
openfile->mark_set = TRUE;
edit_refresh();
}
#endif
/* If text has been added to the magicline, make a new magicline. */
if (filebot->data[0] != '\0')
if (openfile->filebot->data[0] != '\0')
new_magicline();
return numreplaced;
@@ -872,10 +854,10 @@ ssize_t do_replace_loop(const char *needle, const filestruct
/* Replace a string. */
void do_replace(void)
{
int i;
filestruct *edittop_save, *begin;
size_t beginx, pww_save;
size_t begin_x, pww_save;
ssize_t numreplaced;
int i;
if (ISSET(VIEW_MODE)) {
print_view_warning();
@@ -907,6 +889,8 @@ void do_replace(void)
last_search = mallocstrcpy(last_search, answer);
}
last_replace = mallocstrcpy(last_replace, "");
i = statusq(FALSE, replace_list_2, last_replace,
#ifndef NANO_SMALL
&replace_history,
@@ -933,21 +917,20 @@ void do_replace(void)
last_replace = mallocstrcpy(last_replace, answer);
/* Save where we are. */
edittop_save = edittop;
begin = current;
beginx = current_x;
pww_save = placewewant;
edittop_save = openfile->edittop;
begin = openfile->current;
begin_x = openfile->current_x;
pww_save = openfile->placewewant;
numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE,
numreplaced = do_replace_loop(last_search, begin, &begin_x, FALSE,
NULL);
/* Restore where we were. */
edittop = edittop_save;
current = begin;
current_x = beginx;
placewewant = pww_save;
openfile->edittop = edittop_save;
openfile->current = begin;
openfile->current_x = begin_x;
openfile->placewewant = pww_save;
renumber_all();
edit_refresh();
if (numreplaced >= 0)
@@ -960,12 +943,15 @@ void do_replace(void)
/* Go to the specified line and column, or ask for them if interactive
* is TRUE. Save the x-coordinate and y-coordinate if save_pos is TRUE.
* Note that both the line and column numbers should be one-based. */
* Update the screen afterwards if allow_update is TRUE. Note that both
* the line and column numbers should be one-based. */
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive, bool save_pos)
bool interactive, bool save_pos, bool allow_update)
{
if (interactive) { /* Ask for it. */
if (interactive) {
char *ans = mallocstrcpy(NULL, answer);
/* Ask for it. */
int i = statusq(FALSE, gotoline_list, use_answer ? ans : "",
#ifndef NANO_SMALL
NULL,
@@ -1001,43 +987,49 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
}
} else {
if (line < 1)
line = current->lineno;
line = openfile->current->lineno;
if (column < 1)
column = placewewant + 1;
column = openfile->placewewant + 1;
}
for (current = fileage; current->next != NULL && line > 1; line--)
current = current->next;
for (openfile->current = openfile->fileage;
openfile->current->next != NULL && line > 1; line--)
openfile->current = openfile->current->next;
current_x = actual_x(current->data, column - 1);
placewewant = column - 1;
openfile->current_x = actual_x(openfile->current->data, column - 1);
openfile->placewewant = column - 1;
/* If save_pos is TRUE, don't change the cursor position when
* updating the edit window. */
/* Put the top line of the edit window in range of the current line.
* If save_pos is TRUE, don't change the cursor position when doing
* it. */
edit_update(save_pos ? NONE : CENTER);
/* If allow_update is TRUE, update the screen. */
if (allow_update)
edit_refresh();
display_main_list();
}
void do_gotolinecolumn_void(void)
{
do_gotolinecolumn(current->lineno, placewewant + 1, FALSE, TRUE,
FALSE);
do_gotolinecolumn(openfile->current->lineno,
openfile->placewewant + 1, FALSE, TRUE, FALSE, TRUE);
}
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
#ifndef DISABLE_SPELLER
void do_gotopos(ssize_t 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. */
current_y = pos_y;
do_gotolinecolumn(line, pos_x + 1, FALSE, FALSE, TRUE);
openfile->current_y = pos_y;
do_gotolinecolumn(line, pos_x + 1, FALSE, FALSE, TRUE, TRUE);
/* Set the rest of the coordinates up. */
placewewant = pos_pww;
update_line(current, pos_x);
openfile->placewewant = pos_pww;
update_line(openfile->current, pos_x);
}
#endif
@@ -1045,77 +1037,88 @@ void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
#ifdef HAVE_REGEX_H
void do_find_bracket(void)
{
const char *pos, *bracket_pat = "([{<>}])";
char cursor_ch, wanted_ch, regexp_pat[] = "[ ]";
const char *bracket_pat = "()<>[]{}", *pos;
char regex_pat[] = "[ ]", ch, wanted_ch;
filestruct *current_save;
size_t current_x_save, pww_save;
int count = 1;
bool regexp_set = ISSET(USE_REGEXP);
bool backwards_search_set = ISSET(BACKWARDS_SEARCH);
filestruct *current_save;
int count = 1;
cursor_ch = current->data[current_x];
pos = strchr(bracket_pat, cursor_ch);
assert(strlen(bracket_pat) % 2 == 0);
if (cursor_ch == '\0' || pos == NULL) {
ch = openfile->current->data[openfile->current_x];
if (ch == '\0' || (pos = strchr(bracket_pat, ch)) == NULL) {
statusbar(_("Not a bracket"));
return;
}
assert(strlen(bracket_pat) % 2 == 0);
/* Save where we are. */
current_save = openfile->current;
current_x_save = openfile->current_x;
pww_save = openfile->placewewant;
wanted_ch =
bracket_pat[(strlen(bracket_pat) - 1) - (pos - bracket_pat)];
current_save = current;
current_x_save = current_x;
pww_save = placewewant;
/* Turn regular expression searches on. */
SET(USE_REGEXP);
/* Apparent near redundancy with regexp_pat[] here is needed.
* "[][]" works, "[[]]" doesn't. */
if (pos < bracket_pat + (strlen(bracket_pat) / 2)) {
/* On a left bracket. */
regexp_pat[1] = wanted_ch;
regexp_pat[2] = cursor_ch;
/* 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 {
/* On a right bracket. */
regexp_pat[1] = cursor_ch;
regexp_pat[2] = wanted_ch;
wanted_ch = *(pos - 1);
regex_pat[1] = ch;
regex_pat[2] = wanted_ch;
SET(BACKWARDS_SEARCH);
}
regexp_init(regexp_pat);
/* Compile the regular expression in regex_pat. */
regexp_init(regex_pat);
/* We constructed regexp_pat to be a valid regular expression. */
/* The regular expression in regex_pat should always be valid. */
assert(regexp_compiled);
findnextstr_wrap_reset();
while (TRUE) {
if (findnextstr(FALSE, FALSE, FALSE, current, current_x,
regexp_pat, NULL)) {
/* Found identical bracket. */
if (current->data[current_x] == cursor_ch)
count++;
/* Found complementary bracket. */
else if (--count == 0) {
placewewant = xplustabs();
if (findnextstr(FALSE, FALSE, FALSE, openfile->current,
openfile->current_x, regex_pat, NULL)) {
/* 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;
/* If count is zero, we've found a matching bracket. Update
* the screen and get out. */
if (count == 0) {
edit_redraw(current_save, pww_save);
break;
}
} else {
/* Didn't find either a left or right bracket. */
/* We didn't find either an opening or closing bracket.
* Indicate this, restore where we were, and get out. */
statusbar(_("No matching bracket"));
current = current_save;
current_x = current_x_save;
update_line(current, current_x);
openfile->current = current_save;
openfile->current_x = current_x_save;
openfile->placewewant = pww_save;
break;
}
}
/* Decompile the regular expression in regex_pat. */
regexp_cleanup();
/* Restore search direction. */
/* Restore search/replace direction. */
if (backwards_search_set)
SET(BACKWARDS_SEARCH);
else
@@ -1149,17 +1152,26 @@ void history_init(void)
replacebot = replace_history;
}
/* Set the current position in the history list h to the bottom. */
void history_reset(const filestruct *h)
{
if (h == search_history)
search_history = searchbot;
else if (h == replace_history)
replace_history = replacebot;
}
/* Return the first node containing the first len characters of the
* string s in the history list, starting at h_start and ending at
* h_end, or NULL if there isn't one. */
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
char *s, size_t len)
filestruct *find_history(const filestruct *h_start, const filestruct
*h_end, const char *s, size_t len)
{
filestruct *p;
const filestruct *p;
for (p = h_start; p != h_end->next && p != NULL; p = p->next) {
if (strncmp(s, p->data, len) == 0)
return p;
return (filestruct *)p;
}
return NULL;
@@ -1199,11 +1211,13 @@ void update_history(filestruct **h, const char *s)
bar = p->next;
unlink_node(foo);
delete_node(foo);
renumber(bar);
if (bar != NULL)
renumber(bar);
}
/* If the history is full, delete the beginning entry to make room
* for the new entry at the end. */
* for the new entry at the end. We assume that MAX_SEARCH_HISTORY
* is greater than zero. */
if ((*hbot)->lineno == MAX_SEARCH_HISTORY + 1) {
filestruct *foo = *hage;
@@ -1261,7 +1275,7 @@ char *get_history_newer(filestruct **h)
* looking at only the first len characters of s, and return that
* string. If there isn't one, or if len is 0, don't move h and return
* s. */
char *get_history_completion(filestruct **h, char *s, size_t len)
char *get_history_completion(filestruct **h, const char *s, size_t len)
{
assert(s != NULL);
@@ -1308,7 +1322,7 @@ char *get_history_completion(filestruct **h, char *s, size_t len)
/* If we're here, we didn't find a match, we didn't find an inexact
* match, or len is 0. Return s. */
return s;
return (char *)s;
}
#endif
#endif /* !DISABLE_TABCOMP */
#endif /* !NANO_SMALL */

2141
src/text.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -24,37 +24,14 @@
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <pwd.h>
#include <ctype.h>
#include <errno.h>
#include <assert.h>
#include "proto.h"
#ifdef HAVE_REGEX_H
#ifdef BROKEN_REGEXEC
/* Work around a potential segfault in glibc 2.2.3's regexec(). */
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags)
{
if (string != NULL && *string != '\0')
return regexec(preg, string, nmatch, pmatch, eflags);
return REG_NOMATCH;
}
#endif
int regexp_bol_or_eol(const regex_t *preg, const char *string)
{
return (regexec(preg, string, 0, NULL, 0) == 0 &&
regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
REG_NOMATCH);
}
#endif /* HAVE_REGEX_H */
int digits(size_t n)
{
int i = 1;
@@ -240,6 +217,52 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
#endif
#endif /* !NANO_SMALL && ENABLE_NANORC */
#ifdef HAVE_REGEX_H
#ifdef BROKEN_REGEXEC
/* Work around a potential segfault in glibc 2.2.3's regexec(). */
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags)
{
if (string != NULL && *string != '\0')
return regexec(preg, string, nmatch, pmatch, eflags);
return REG_NOMATCH;
}
#endif
int regexp_bol_or_eol(const regex_t *preg, const char *string)
{
return (regexec(preg, string, 0, NULL, 0) == 0 &&
regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
REG_NOMATCH);
}
#endif /* HAVE_REGEX_H */
/* 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)
{
char *p = charalloc(mb_cur_max()), *r = charalloc(mb_cur_max());
size_t word_end = pos + strlen(word);
bool retval;
assert(buf != NULL && pos <= strlen(buf) && word != NULL);
parse_mbchar(buf + move_mbleft(buf, pos), p, NULL);
parse_mbchar(buf + word_end, r, NULL);
/* If we're at the beginning of the line or the character before the
* word isn't a non-punctuation "word" character, and if we're at
* the end of the line or the character after the word isn't a
* non-punctuation "word" character, we have a whole word. */
retval = (pos == 0 || !is_word_mbchar(p, FALSE)) &&
(word_end == strlen(buf) || !is_word_mbchar(r, FALSE));
free(p);
free(r);
return retval;
}
/* If we are searching backwards, we will find the last match that
* starts no later than start. Otherwise we find the first match
* starting no earlier than start. If we are doing a regexp search, we
@@ -375,14 +398,13 @@ char *mallocstrassn(char *dest, char *src)
/* Append a new magicline to filebot. */
void new_magicline(void)
{
filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
filebot->next->data = mallocstrcpy(NULL, "");
filebot->next->prev = filebot;
filebot->next->next = NULL;
filebot->next->lineno = filebot->lineno + 1;
filebot = filebot->next;
totlines++;
totsize++;
openfile->filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
openfile->filebot->next->data = mallocstrcpy(NULL, "");
openfile->filebot->next->prev = openfile->filebot;
openfile->filebot->next->next = NULL;
openfile->filebot->next->lineno = openfile->filebot->lineno + 1;
openfile->filebot = openfile->filebot->next;
openfile->totsize++;
}
#ifndef NANO_SMALL
@@ -390,85 +412,71 @@ void new_magicline(void)
* only line in the file. */
void remove_magicline(void)
{
if (filebot->data[0] == '\0' && filebot->prev != NULL) {
filebot = filebot->prev;
free_filestruct(filebot->next);
filebot->next = NULL;
totlines--;
totsize--;
if (openfile->filebot->data[0] == '\0' &&
openfile->filebot->prev != NULL) {
openfile->filebot = openfile->filebot->prev;
free_filestruct(openfile->filebot->next);
openfile->filebot->next = NULL;
openfile->totsize--;
}
}
/* Set top_x and bot_x to the top and bottom x-coordinates of the mark,
* respectively, based on the locations of top and bot. If
* right_side_up isn't NULL, set it to TRUE If the mark begins with
* (mark_beginbuf, mark_beginx) and ends with (current, current_x), or
* (mark_begin, mark_begin_x) and ends with (current, current_x), or
* FALSE otherwise. */
void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x, bool *right_side_up)
{
assert(top != NULL && top_x != NULL && bot != NULL && bot_x != NULL);
if ((current->lineno == mark_beginbuf->lineno && current_x >
mark_beginx) || current->lineno > mark_beginbuf->lineno) {
*top = mark_beginbuf;
*top_x = mark_beginx;
*bot = current;
*bot_x = current_x;
if ((openfile->current->lineno == openfile->mark_begin->lineno &&
openfile->current_x > openfile->mark_begin_x) ||
openfile->current->lineno > openfile->mark_begin->lineno) {
*top = openfile->mark_begin;
*top_x = openfile->mark_begin_x;
*bot = openfile->current;
*bot_x = openfile->current_x;
if (right_side_up != NULL)
*right_side_up = TRUE;
} else {
*bot = mark_beginbuf;
*bot_x = mark_beginx;
*top = current;
*top_x = current_x;
*bot = openfile->mark_begin;
*bot_x = openfile->mark_begin_x;
*top = openfile->current;
*top_x = openfile->current_x;
if (right_side_up != NULL)
*right_side_up = FALSE;
}
}
#endif
/* Calculate the number of lines and the number of characters between
* begin and end, and return them in lines and size, respectively. */
void get_totals(const filestruct *begin, const filestruct *end, size_t
*lines, size_t *size)
/* Calculate the number of characters between begin and end, and return
* it. */
size_t get_totsize(const filestruct *begin, const filestruct *end)
{
size_t totsize = 0;
const filestruct *f;
if (lines != NULL)
*lines = 0;
if (size != NULL)
*size = 0;
/* Go through the lines from begin to end->prev, if we can. */
for (f = begin; f != NULL && f != end; f = f->next) {
/* Count this line. */
if (lines != NULL)
(*lines)++;
for (f = begin; f != end && f != NULL; f = f->next) {
/* Count the number of characters on this line. */
if (size != NULL) {
*size += mbstrlen(f->data);
totsize += mbstrlen(f->data);
/* Count the newline if we have one. */
if (f->next != NULL)
(*size)++;
}
/* Count the newline if we have one. */
if (f->next != NULL)
totsize++;
}
/* Go through the line at end, if we can. */
if (f != NULL) {
/* Count this line. */
if (lines != NULL)
(*lines)++;
/* Count the number of characters on this line. */
if (size != NULL) {
*size += mbstrlen(f->data);
totsize += mbstrlen(f->data);
/* Count the newline if we have one. */
if (f->next != NULL)
(*size)++;
}
/* Count the newline if we have one. */
if (f->next != NULL)
totsize++;
}
return totsize;
}

File diff suppressed because it is too large Load Diff