vim-patch:8.0.0520: using a function pointer while the function is known (#8513)

Problem:    Using a function pointer instead of the actual function, which we
            know.
Solution:   Change mb_ functions to utf_ functions when already checked for
            Unicode. (Dominique Pelle, closes vim/vim#1582)
ace95989ed
This commit is contained in:
KunMing Xie
2018-06-10 18:31:51 +08:00
committed by Justin M. Keyes
parent bbb88607c9
commit 7cc9d2b2b2
5 changed files with 63 additions and 64 deletions

View File

@@ -286,7 +286,7 @@ void trunc_string(char_u *s, char_u *buf, int room_in, int buflen)
half = i = (int)STRLEN(s);
for (;;) {
do {
half = half - (*mb_head_off)(s, s + half - 1) - 1;
half = half - utf_head_off(s, s + half - 1) - 1;
} while (half > 0 && utf_iscomposing(utf_ptr2char(s + half)));
n = ptr2cells(s + half);
if (len + n > room || half == 0) {