summaryrefslogtreecommitdiff
path: root/src/regexp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regexp.c')
-rw-r--r--src/regexp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/regexp.c b/src/regexp.c
index bf0f67a03..071663f66 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -7014,7 +7014,14 @@ vim_regsub_both(source, dest, copy, magic, backslash)
#ifdef FEAT_MBYTE
if (has_mbyte)
{
- int l = mb_ptr2len(s) - 1;
+ int l;
+
+ /* Copy composing characters separately, one
+ * at a time. */
+ if (enc_utf8)
+ l = utf_ptr2len(s) - 1;
+ else
+ l = mb_ptr2len(s) - 1;
s += l;
len -= l;