Commit Graph

218 Commits (577298a3f93a358cd4120df78539537717342c0f)

Author SHA1 Message Date
David Lawrence Ramsey 577298a3f9 remove display_string_len() again for the time being, since it's still
prone to off-by-one errors that lead to memory corruption and I can't
find anything obviously wrong with it; always allocate enough space for
len columns of text now; any extra space that isn't used will be removed
by the null_at() call at the end of display_string() anyway


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


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


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


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


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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2231 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 05:22:42 +00:00
David Lawrence Ramsey 913db834d2 add DB's (modified) UTF-8 support tweaks to do_replace_highlight()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2230 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-05 05:08:14 +00:00
David Lawrence Ramsey d90d64f718 set the value of alloc_len properly again, as in DB's patch, in order to
avoid memory corruption problems


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


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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2224 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-03 22:23:00 +00:00
David Lawrence Ramsey 2524a70a49 fix assert
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2223 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-03 21:34:55 +00:00
David Lawrence Ramsey f0a53f02a1 readd get_byte_kbinput(), modify get_word_kbinput() to handle
hexadecimal instead of decimal values, make normal input use
get_byte_kbinput(), make verbatim input use get_word_kbinput(), and
update faq.html to mention these changes


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


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


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


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


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


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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2210 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2005-01-01 07:28:15 +00:00
David Lawrence Ramsey f282428a42 handle wctomb() failures properly in display_stirng_len() and
display_string()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2207 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-29 21:32:22 +00:00
David Lawrence Ramsey a9b9913c6b properly increment start_col when the line begins with a character that
takes up two columns


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


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


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


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


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


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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2193 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-23 17:43:27 +00:00
David Lawrence Ramsey 6a2f068c7f still more cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2188 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-20 01:13:55 +00:00
David Lawrence Ramsey 78ea5e4a8a improvements to wide/multibyte character input and output, using wide
curses functions where applicable


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


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


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


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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2174 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2004-12-07 21:23:39 +00:00