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 (!error) {
|
||||||
if (nchar > 0) {
|
if (nchar > 0) {
|
||||||
while (nchar > 0 && nbyte < slen) {
|
while (nchar > 0 && nbyte < slen) {
|
||||||
nbyte += mb_char2len(p[nbyte]);
|
nbyte += mb_cptr2len(p + nbyte);
|
||||||
nchar--;
|
nchar--;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -15777,9 +15777,9 @@ static void f_strcharpart(typval_T *argvars, typval_T *rettv, FunPtr fptr) {
|
|||||||
if (off < 0) {
|
if (off < 0) {
|
||||||
len += 1;
|
len += 1;
|
||||||
} else {
|
} else {
|
||||||
len += mb_char2len(p[off]);
|
len += mb_cptr2len(p + off);
|
||||||
charlen--;
|
|
||||||
}
|
}
|
||||||
|
charlen--;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
len = slen - nbyte; // default: all bytes that are available.
|
len = slen - nbyte; // default: all bytes that are available.
|
||||||
|
@ -660,7 +660,7 @@ static int included_patches[] = {
|
|||||||
// 1785,
|
// 1785,
|
||||||
// 1784 NA
|
// 1784 NA
|
||||||
// 1783,
|
// 1783,
|
||||||
// 1782,
|
1782,
|
||||||
// 1781,
|
// 1781,
|
||||||
// 1780,
|
// 1780,
|
||||||
1779,
|
1779,
|
||||||
|
Loading…
Reference in New Issue
Block a user