1
0
forked from aniani/vim

patch 7.4.1782

Problem:    strcharpart() does not work properly with some multi-byte
            characters.
Solution:   Use mb_cptr2len() instead of mb_char2len(). (Hirohito Higashi)
This commit is contained in:
Bram Moolenaar
2016-04-23 15:30:09 +02:00
parent da5b3dcf06
commit fca6600305
3 changed files with 14 additions and 2 deletions

View File

@@ -19764,7 +19764,7 @@ f_strcharpart(typval_T *argvars, typval_T *rettv)
if (nchar > 0)
while (nchar > 0 && nbyte < slen)
{
nbyte += mb_char2len(p[nbyte]);
nbyte += mb_cptr2len(p + nbyte);
--nchar;
}
else
@@ -19779,7 +19779,7 @@ f_strcharpart(typval_T *argvars, typval_T *rettv)
if (off < 0)
len += 1;
else
len += mb_char2len(p[off]);
len += mb_cptr2len(p + off);
--charlen;
}
}