diff options
| author | KunMing Xie <qqzz014@gmail.com> | 2018-06-10 18:31:51 +0800 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2018-06-10 12:31:51 +0200 |
| commit | 7cc9d2b2b2e2cc4e78bf37512ac03ded3e18d6c1 (patch) | |
| tree | 1c0e9383b3c201c12f3d7bcdb7d0b5c6d95bb570 /src/nvim/screen.c | |
| parent | bbb88607c9cc60a6fa332382e9a8cc0c8726c03f (diff) | |
| download | rneovim-7cc9d2b2b2e2cc4e78bf37512ac03ded3e18d6c1.tar.gz rneovim-7cc9d2b2b2e2cc4e78bf37512ac03ded3e18d6c1.tar.bz2 rneovim-7cc9d2b2b2e2cc4e78bf37512ac03ded3e18d6c1.zip | |
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)
https://github.com/vim/vim/commit/ace95989ed81929a84e205b26d0972cb9d6b4b19
Diffstat (limited to 'src/nvim/screen.c')
| -rw-r--r-- | src/nvim/screen.c | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index baa4d83bbf..f36d408b25 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -3106,9 +3106,9 @@ win_line ( if (n_extra > 0) { if (c_extra != NUL) { c = c_extra; - mb_c = c; /* doesn't handle non-utf-8 multi-byte! */ - if (enc_utf8 && (*mb_char2len)(c) > 1) { - mb_utf8 = TRUE; + mb_c = c; // doesn't handle non-utf-8 multi-byte! + if (enc_utf8 && utf_char2len(c) > 1) { + mb_utf8 = true; u8cc[0] = 0; c = 0xc0; } else @@ -3118,15 +3118,15 @@ win_line ( if (has_mbyte) { mb_c = c; if (enc_utf8) { - /* If the UTF-8 character is more than one byte: - * Decode it into "mb_c". */ - mb_l = (*mb_ptr2len)(p_extra); - mb_utf8 = FALSE; - if (mb_l > n_extra) + // If the UTF-8 character is more than one byte: + // Decode it into "mb_c". + mb_l = utfc_ptr2len(p_extra); + mb_utf8 = false; + if (mb_l > n_extra) { mb_l = 1; - else if (mb_l > 1) { + } else if (mb_l > 1) { mb_c = utfc_ptr2char(p_extra, u8cc); - mb_utf8 = TRUE; + mb_utf8 = true; c = 0xc0; } } else { @@ -3177,10 +3177,10 @@ win_line ( if (has_mbyte) { mb_c = c; if (enc_utf8) { - /* If the UTF-8 character is more than one byte: Decode it - * into "mb_c". */ - mb_l = (*mb_ptr2len)(ptr); - mb_utf8 = FALSE; + // If the UTF-8 character is more than one byte: Decode it + // into "mb_c". + mb_l = utfc_ptr2len(ptr); + mb_utf8 = false; if (mb_l > 1) { mb_c = utfc_ptr2char(ptr, u8cc); // Overlong encoded ASCII or ASCII with composing char @@ -3486,7 +3486,7 @@ win_line ( extra_attr = win_hl_attr(wp, HLF_0); saved_attr2 = char_attr; // save current attr mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) { + if (enc_utf8 && utf_char2len(c) > 1) { mb_utf8 = true; u8cc[0] = 0; c = 0xc0; @@ -3501,12 +3501,13 @@ win_line ( extra_attr = win_hl_attr(wp, HLF_0); saved_attr2 = char_attr; // save current attr mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) { - mb_utf8 = TRUE; + if (enc_utf8 && utf_char2len(c) > 1) { + mb_utf8 = true; u8cc[0] = 0; c = 0xc0; - } else - mb_utf8 = FALSE; + } else { + mb_utf8 = false; + } } } @@ -3602,8 +3603,8 @@ win_line ( extra_attr = win_hl_attr(wp, HLF_0); saved_attr2 = char_attr; // save current attr mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) { - mb_utf8 = TRUE; + if (enc_utf8 && utf_char2len(c) > 1) { + mb_utf8 = true; u8cc[0] = 0; c = 0xc0; } @@ -3647,8 +3648,8 @@ win_line ( extra_attr = win_hl_attr(wp, HLF_AT); n_attr = 1; mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) { - mb_utf8 = TRUE; + if (enc_utf8 && utf_char2len(c) > 1) { + mb_utf8 = true; u8cc[0] = 0; c = 0xc0; } else @@ -3762,8 +3763,8 @@ win_line ( n_skip = 1; } mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) { - mb_utf8 = TRUE; + if (enc_utf8 && utf_char2len(c) > 1) { + mb_utf8 = true; u8cc[0] = 0; c = 0xc0; } else @@ -3816,8 +3817,8 @@ win_line ( extra_attr = win_hl_attr(wp, HLF_AT); } mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) { - mb_utf8 = TRUE; + if (enc_utf8 && utf_char2len(c) > 1) { + mb_utf8 = true; u8cc[0] = 0; c = 0xc0; } else { @@ -4044,8 +4045,8 @@ win_line ( c = lcs_ext; char_attr = win_hl_attr(wp, HLF_AT); mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) { - mb_utf8 = TRUE; + if (enc_utf8 && utf_char2len(c) > 1) { + mb_utf8 = true; u8cc[0] = 0; c = 0xc0; } else |