diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2017-04-08 16:45:38 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2017-04-10 12:01:40 +0200 |
commit | db9ef6263ec5b7885782ccf0a93e06b0c71f6944 (patch) | |
tree | b8be451ab6edf79c97f198be7f6dddaf004f8455 /src/nvim/regexp.c | |
parent | 3b88e37b839fede81f40b5454490b6b8a89db5b7 (diff) | |
download | rneovim-db9ef6263ec5b7885782ccf0a93e06b0c71f6944.tar.gz rneovim-db9ef6263ec5b7885782ccf0a93e06b0c71f6944.tar.bz2 rneovim-db9ef6263ec5b7885782ccf0a93e06b0c71f6944.zip |
mbyte: replace vim_tolower with mb_tolower handling locale correctly
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 9baa53d2a2..7e2fc261f2 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -2350,7 +2350,7 @@ collection: break; case CLASS_LOWER: for (cu = 1; cu <= 255; cu++) { - if (vim_islower(cu) && cu != 170 && cu != 186) { + if (mb_islower(cu) && cu != 170 && cu != 186) { regmbc(cu); } } @@ -2376,7 +2376,7 @@ collection: break; case CLASS_UPPER: for (cu = 1; cu <= 255; cu++) { - if (vim_isupper(cu)) { + if (mb_isupper(cu)) { regmbc(cu); } } @@ -3474,7 +3474,7 @@ static long bt_regexec_both(char_u *line, || (ireg_ic && (((enc_utf8 && utf_fold(prog->regstart) == utf_fold(c))) || (c < 255 && prog->regstart < 255 - && vim_tolower(prog->regstart) == vim_tolower(c))))) { + && mb_tolower(prog->regstart) == mb_tolower(c))))) { retval = regtry(prog, col); } else { retval = 0; @@ -4155,7 +4155,7 @@ regmatch ( if (*opnd != *reginput && (!ireg_ic || (!enc_utf8 - && vim_tolower(*opnd) != vim_tolower(*reginput)))) { + && mb_tolower(*opnd) != mb_tolower(*reginput)))) { status = RA_NOMATCH; } else if (*opnd == NUL) { // match empty string always works; happens when "~" is @@ -4573,10 +4573,10 @@ regmatch ( if (OP(next) == EXACTLY) { rst.nextb = *OPERAND(next); if (ireg_ic) { - if (vim_isupper(rst.nextb)) - rst.nextb_ic = vim_tolower(rst.nextb); + if (mb_isupper(rst.nextb)) + rst.nextb_ic = mb_tolower(rst.nextb); else - rst.nextb_ic = vim_toupper(rst.nextb); + rst.nextb_ic = mb_toupper(rst.nextb); } else rst.nextb_ic = rst.nextb; } else { @@ -5339,8 +5339,8 @@ do_class: * would have been used for it. It does handle single-byte * characters, such as latin1. */ if (ireg_ic) { - cu = vim_toupper(*opnd); - cl = vim_tolower(*opnd); + cu = mb_toupper(*opnd); + cl = mb_tolower(*opnd); while (count < maxcount && (*scan == cu || *scan == cl)) { count++; scan++; @@ -6314,10 +6314,10 @@ static char_u *cstrchr(char_u *s, int c) * For UTF-8 need to use folded case. */ if (enc_utf8 && c > 0x80) cc = utf_fold(c); - else if (vim_isupper(c)) - cc = vim_tolower(c); - else if (vim_islower(c)) - cc = vim_toupper(c); + else if (mb_isupper(c)) + cc = mb_tolower(c); + else if (mb_islower(c)) + cc = mb_toupper(c); else return vim_strchr(s, c); @@ -6348,28 +6348,28 @@ static char_u *cstrchr(char_u *s, int c) static fptr_T do_upper(int *d, int c) { - *d = vim_toupper(c); + *d = mb_toupper(c); return (fptr_T)NULL; } static fptr_T do_Upper(int *d, int c) { - *d = vim_toupper(c); + *d = mb_toupper(c); return (fptr_T)do_Upper; } static fptr_T do_lower(int *d, int c) { - *d = vim_tolower(c); + *d = mb_tolower(c); return (fptr_T)NULL; } static fptr_T do_Lower(int *d, int c) { - *d = vim_tolower(c); + *d = mb_tolower(c); return (fptr_T)do_Lower; } |