mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
Fix: Composing characters in :s substitute text were dropped.
This commit is contained in:
parent
4d770fb566
commit
0c56c60a0f
18
src/regexp.c
18
src/regexp.c
@ -7140,10 +7140,26 @@ vim_regsub_both(source, dest, copy, magic, backslash)
|
|||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
{
|
{
|
||||||
src += mb_ptr2len(src - 1) - 1;
|
int totlen = mb_ptr2len(src - 1);
|
||||||
|
|
||||||
if (copy)
|
if (copy)
|
||||||
mb_char2bytes(cc, dst);
|
mb_char2bytes(cc, dst);
|
||||||
dst += mb_char2len(cc) - 1;
|
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
|
else
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user