mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 17:06:30 +00:00
spell: remove enc_utf8 dead code
This commit is contained in:
@@ -1026,26 +1026,25 @@ match_checkcompoundpattern (
|
|||||||
|
|
||||||
// Returns true if "flags" is a valid sequence of compound flags and "word"
|
// Returns true if "flags" is a valid sequence of compound flags and "word"
|
||||||
// does not have too many syllables.
|
// does not have too many syllables.
|
||||||
static bool can_compound(slang_T *slang, char_u *word, char_u *flags)
|
static bool can_compound(slang_T *slang, const char_u *word,
|
||||||
|
const char_u *flags)
|
||||||
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
char_u uflags[MAXWLEN * 2];
|
char_u uflags[MAXWLEN * 2] = { 0 };
|
||||||
int i;
|
|
||||||
char_u *p;
|
|
||||||
|
|
||||||
if (slang->sl_compprog == NULL)
|
if (slang->sl_compprog == NULL) {
|
||||||
return false;
|
return false;
|
||||||
if (enc_utf8) {
|
}
|
||||||
// Need to convert the single byte flags to utf8 characters.
|
// Need to convert the single byte flags to utf8 characters.
|
||||||
p = uflags;
|
char_u *p = uflags;
|
||||||
for (i = 0; flags[i] != NUL; i++) {
|
for (int i = 0; flags[i] != NUL; i++) {
|
||||||
p += utf_char2bytes(flags[i], p);
|
p += utf_char2bytes(flags[i], p);
|
||||||
}
|
}
|
||||||
*p = NUL;
|
*p = NUL;
|
||||||
p = uflags;
|
p = uflags;
|
||||||
} else
|
if (!vim_regexec_prog(&slang->sl_compprog, false, p, 0)) {
|
||||||
p = flags;
|
|
||||||
if (!vim_regexec_prog(&slang->sl_compprog, false, p, 0))
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Count the number of syllables. This may be slow, do it last. If there
|
// Count the number of syllables. This may be slow, do it last. If there
|
||||||
// are too many syllables AND the number of compound words is above
|
// are too many syllables AND the number of compound words is above
|
||||||
@@ -4268,9 +4267,8 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
|
|||||||
// For changing a composing character adjust
|
// For changing a composing character adjust
|
||||||
// the score from SCORE_SUBST to
|
// the score from SCORE_SUBST to
|
||||||
// SCORE_SUBCOMP.
|
// SCORE_SUBCOMP.
|
||||||
if (enc_utf8
|
if (utf_iscomposing(utf_ptr2char(tword + sp->ts_twordlen
|
||||||
&& utf_iscomposing(utf_ptr2char(tword + sp->ts_twordlen
|
- sp->ts_tcharlen))
|
||||||
- sp->ts_tcharlen))
|
|
||||||
&& utf_iscomposing(utf_ptr2char(fword
|
&& utf_iscomposing(utf_ptr2char(fword
|
||||||
+ sp->ts_fcharstart))) {
|
+ sp->ts_fcharstart))) {
|
||||||
sp->ts_score -= SCORE_SUBST - SCORE_SUBCOMP;
|
sp->ts_score -= SCORE_SUBST - SCORE_SUBCOMP;
|
||||||
@@ -5855,7 +5853,7 @@ static void spell_soundfold_sofo(slang_T *slang, char_u *inword, char_u *res)
|
|||||||
// 255, sl_sal the rest.
|
// 255, sl_sal the rest.
|
||||||
for (s = inword; *s != NUL; ) {
|
for (s = inword; *s != NUL; ) {
|
||||||
c = mb_cptr2char_adv((const char_u **)&s);
|
c = mb_cptr2char_adv((const char_u **)&s);
|
||||||
if (enc_utf8 ? utf_class(c) == 0 : ascii_iswhite(c)) {
|
if (utf_class(c) == 0) {
|
||||||
c = ' ';
|
c = ' ';
|
||||||
} else if (c < 256) {
|
} else if (c < 256) {
|
||||||
c = slang->sl_sal_first[c];
|
c = slang->sl_sal_first[c];
|
||||||
@@ -5932,9 +5930,10 @@ static void spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res)
|
|||||||
const char_u *t = s;
|
const char_u *t = s;
|
||||||
c = mb_cptr2char_adv((const char_u **)&s);
|
c = mb_cptr2char_adv((const char_u **)&s);
|
||||||
if (slang->sl_rem_accents) {
|
if (slang->sl_rem_accents) {
|
||||||
if (enc_utf8 ? utf_class(c) == 0 : ascii_iswhite(c)) {
|
if (utf_class(c) == 0) {
|
||||||
if (did_white)
|
if (did_white) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
c = ' ';
|
c = ' ';
|
||||||
did_white = true;
|
did_white = true;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user