Mercurial > vim
changeset 2307:81527f127fb1 vim73
Fix: Composing characters in :s substitute text were dropped.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Mon, 12 Jul 2010 22:42:33 +0200 |
parents | 9577a28005e1 |
children | cb025511f6b6 |
files | src/regexp.c |
diffstat | 1 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/regexp.c +++ b/src/regexp.c @@ -7140,10 +7140,26 @@ vim_regsub_both(source, dest, copy, magi #ifdef FEAT_MBYTE if (has_mbyte) { - src += mb_ptr2len(src - 1) - 1; + int totlen = mb_ptr2len(src - 1); + if (copy) mb_char2bytes(cc, dst); dst += mb_char2len(cc) - 1; + if (enc_utf8) + { + int clen = utf_ptr2len(src - 1); + + /* If the character length is shorter than "totlen", there + * are composing characters; copy them as-is. */ + if (clen < totlen) + { + if (copy) + mch_memmove(dst + 1, src - 1 + clen, + (size_t)(totlen - clen)); + dst += totlen - clen; + } + } + src += totlen - 1; } else #endif