aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorZviRackover <zvirack@gmail.com>2018-09-02 01:36:18 +0300
committerZviRackover <zvirack@gmail.com>2018-09-09 10:45:50 +0300
commitac13e65ae0ce98516e816ba4fcf468d19e750c30 (patch)
treee039a2201ece3358068a659b4bb84b204afd866b /src/nvim/regexp.c
parentcbdbc4f63d68a6b17b9eea5c67130e37d3d0f278 (diff)
downloadrneovim-ac13e65ae0ce98516e816ba4fcf468d19e750c30.tar.gz
rneovim-ac13e65ae0ce98516e816ba4fcf468d19e750c30.tar.bz2
rneovim-ac13e65ae0ce98516e816ba4fcf468d19e750c30.zip
Remove has_mbytes local to lines changed in parent commit
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 7152a38815..085b70ad7e 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -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);
-
- /* 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;
- }
+ 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;
}
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++;