mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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)
fca6600305
This commit is contained in:
parent
6bc0d9b8c7
commit
f6f77272b3
@ -15762,7 +15762,7 @@ static void f_strcharpart(typval_T *argvars, typval_T *rettv, FunPtr fptr) {
|
||||
if (!error) {
|
||||
if (nchar > 0) {
|
||||
while (nchar > 0 && nbyte < slen) {
|
||||
nbyte += mb_char2len(p[nbyte]);
|
||||
nbyte += mb_cptr2len(p + nbyte);
|
||||
nchar--;
|
||||
}
|
||||
} else {
|
||||
@ -15777,9 +15777,9 @@ static void f_strcharpart(typval_T *argvars, typval_T *rettv, FunPtr fptr) {
|
||||
if (off < 0) {
|
||||
len += 1;
|
||||
} else {
|
||||
len += mb_char2len(p[off]);
|
||||
charlen--;
|
||||
len += mb_cptr2len(p + off);
|
||||
}
|
||||
charlen--;
|
||||
}
|
||||
} else {
|
||||
len = slen - nbyte; // default: all bytes that are available.
|
||||
|
@ -272,7 +272,7 @@ return {
|
||||
strchars={args={1,2}},
|
||||
strdisplaywidth={args={1, 2}},
|
||||
strftime={args={1, 2}},
|
||||
strgetchar={args={2,2}},
|
||||
strgetchar={args={2, 2}},
|
||||
stridx={args={2, 3}},
|
||||
string={args=1},
|
||||
strlen={args=1},
|
||||
|
@ -660,7 +660,7 @@ static int included_patches[] = {
|
||||
// 1785,
|
||||
// 1784 NA
|
||||
// 1783,
|
||||
// 1782,
|
||||
1782,
|
||||
// 1781,
|
||||
// 1780,
|
||||
1779,
|
||||
|
Loading…
Reference in New Issue
Block a user