Commit a90e6c32 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

in do_replace_loop(), fix problem where replacing e.g. single-byte

characters with multibyte ones could result in openfile->totsize's being
miscalculated


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4130 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 5 additions and 1 deletion
+5 -1
......@@ -7,6 +7,9 @@
has_blank_mbchars): Simplify by using for loops instead of while
loops where possible, to match the single-byte versions of these
functions.
* search.c (do_replace_loop): Fix problem where replacing e.g.
single-byte characters with multibyte ones could result in
openfile->totsize's being miscalculated.
2007-07-06 David Lawrence Ramsey <pooka109@gmail.com>
......
......@@ -827,7 +827,8 @@ ssize_t do_replace_loop(
openfile->current_x += match_len + length_change - 1;
/* Cleanup. */
openfile->totsize += length_change;
openfile->totsize += mbstrlen(copy) -
mbstrlen(openfile->current->data);
free(openfile->current->data);
openfile->current->data = copy;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment