Remove has_mbytes local to lines changed in parent commit

This commit is contained in:
ZviRackover
2018-09-02 01:36:18 +03:00
parent cbdbc4f63d
commit ac13e65ae0
11 changed files with 51 additions and 128 deletions

View File

@@ -2538,10 +2538,8 @@ static void regc(int b)
*/
static void regmbc(int c)
{
if (!has_mbyte && c > 0xff)
return;
if (regcode == JUST_CALC_SIZE)
regsize += (*mb_char2len)(c);
regsize += utf_char2len(c);
else
regcode += utf_char2bytes(c, regcode);
}
@@ -6759,27 +6757,22 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
cc = c;
}
if (has_mbyte) {
int totlen = mb_ptr2len(src - 1);
int totlen = utfc_ptr2len(src - 1);
if (copy)
utf_char2bytes(cc, dst);
dst += mb_char2len(cc) - 1;
if (enc_utf8) {
int clen = utf_ptr2len(src - 1);
dst += utf_char2len(cc) - 1;
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)
memmove(dst + 1, src - 1 + clen,
(size_t)(totlen - clen));
dst += totlen - clen;
}
/* If the character length is shorter than "totlen", there
* are composing characters; copy them as-is. */
if (clen < totlen) {
if (copy)
memmove(dst + 1, src - 1 + clen,
(size_t)(totlen - clen));
dst += totlen - clen;
}
src += totlen - 1;
} else if (copy)
*dst = cc;
dst++;
} else {
if (REG_MULTI) {
@@ -6861,13 +6854,13 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
if (enc_utf8)
l = utf_ptr2len(s) - 1;
else
l = mb_ptr2len(s) - 1;
l = utfc_ptr2len(s) - 1;
s += l;
len -= l;
if (copy)
utf_char2bytes(cc, dst);
dst += mb_char2len(cc) - 1;
dst += utf_char2len(cc) - 1;
} else if (copy)
*dst = cc;
dst++;