diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-01-20 23:02:51 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-01-20 23:02:51 +0000 |
commit | 2d3f489e09a1cc50f5b7601eff568a4eb87fbd51 (patch) | |
tree | a29e0aabb8e2ee8bba220b843d536dca3fdf2100 /src/spell.c | |
parent | 8ada17c4d9d783b370d081c2a947ea1350cc8338 (diff) | |
download | vim-git-2d3f489e09a1cc50f5b7601eff568a4eb87fbd51.tar.gz |
updated for version 7.0183
Diffstat (limited to 'src/spell.c')
-rw-r--r-- | src/spell.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/spell.c b/src/spell.c index 882cc50ee..ceb5b829e 100644 --- a/src/spell.c +++ b/src/spell.c @@ -59,7 +59,8 @@ # define SPELL_PRINTTREE #endif -/* Use DEBUG_TRIEWALK to print the changes made in suggest_trie_walk(). */ +/* Use DEBUG_TRIEWALK to print the changes made in suggest_trie_walk() for a + * specific word. */ #if 0 # define DEBUG_TRIEWALK #endif @@ -328,6 +329,9 @@ typedef long idx_T; #define WF_HAS_AFF 0x0100 /* word includes affix */ #define WF_NEEDCOMP 0x0200 /* word only valid in compound */ +/* only used for su_badflags */ +#define WF_MIXCAP 0x20 /* mix of upper and lower case: macaRONI */ + #define WF_CAPMASK (WF_ONECAP | WF_ALLCAP | WF_KEEPCAP | WF_FIXCAP) /* flags for <pflags> */ @@ -4328,6 +4332,9 @@ badword_captype(word, end) flags |= WF_ALLCAP; else if (first) flags |= WF_ONECAP; + + if (u >= 2 && l >= 2) /* maCARONI maCAroni */ + flags |= WF_MIXCAP; } return flags; } @@ -10895,9 +10902,29 @@ suggest_trie_walk(su, lp, fword, soundfold) /* Add the suggestion if the score isn't too bad. */ if (score <= su->su_maxscore) + { add_suggestion(su, &su->su_ga, preword, sp->ts_fidx - repextra, score, 0, FALSE, lp->lp_sallang, FALSE); + + if (su->su_badflags & WF_MIXCAP) + { + /* We really don't know if the word should be + * upper or lower case, add both. */ + c = captype(preword, NULL); + if (c == 0 || c == WF_ALLCAP) + { + make_case_word(tword + sp->ts_splitoff, + preword + sp->ts_prewordlen, + c == 0 ? WF_ALLCAP : 0); + + add_suggestion(su, &su->su_ga, preword, + sp->ts_fidx - repextra, + score + SCORE_ICASE, 0, FALSE, + lp->lp_sallang, FALSE); + } + } + } } } |