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/spell.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/spell.c')
-rw-r--r-- | src/nvim/spell.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 686962704a..0db1578e8d 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -1031,8 +1031,9 @@ static bool can_compound(slang_T *slang, char_u *word, char_u *flags) if (enc_utf8) { // Need to convert the single byte flags to utf8 characters. p = uflags; - for (i = 0; flags[i] != NUL; ++i) - p += mb_char2bytes(flags[i], p); + for (i = 0; flags[i] != NUL; i++) { + p += utf_char2bytes(flags[i], p); + } *p = NUL; p = uflags; } else @@ -4269,28 +4270,23 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so // the score from SCORE_SUBST to // SCORE_SUBCOMP. if (enc_utf8 - && utf_iscomposing( - mb_ptr2char(tword - + sp->ts_twordlen - - sp->ts_tcharlen)) - && utf_iscomposing( - mb_ptr2char(fword - + sp->ts_fcharstart))) - sp->ts_score -= - SCORE_SUBST - SCORE_SUBCOMP; - - // For a similar character adjust score from - // SCORE_SUBST to SCORE_SIMILAR. - else if (!soundfold - && slang->sl_has_map - && similar_chars(slang, - mb_ptr2char(tword - + sp->ts_twordlen - - sp->ts_tcharlen), - mb_ptr2char(fword - + sp->ts_fcharstart))) - sp->ts_score -= - SCORE_SUBST - SCORE_SIMILAR; + && utf_iscomposing(utf_ptr2char(tword + sp->ts_twordlen + - sp->ts_tcharlen)) + && utf_iscomposing(utf_ptr2char(fword + + sp->ts_fcharstart))) { + sp->ts_score -= SCORE_SUBST - SCORE_SUBCOMP; + } else if (!soundfold + && slang->sl_has_map + && similar_chars(slang, + mb_ptr2char(tword + + sp->ts_twordlen + - sp->ts_tcharlen), + mb_ptr2char(fword + + sp->ts_fcharstart))) { + // For a similar character adjust score from + // SCORE_SUBST to SCORE_SIMILAR. + sp->ts_score -= SCORE_SUBST - SCORE_SIMILAR; + } } else if (sp->ts_isdiff == DIFF_INSERT && sp->ts_twordlen > sp->ts_tcharlen) { p = tword + sp->ts_twordlen - sp->ts_tcharlen; |