Mercurial > vim
comparison src/spellsuggest.c @ 24872:59cfa23bd9eb v8.2.2974
patch 8.2.2974: Greek spell checking uses wrong case folding
Commit: https://github.com/vim/vim/commit/4f135275984722c1b1e9ace72eeeb7ce7e4ec983
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jun 11 19:07:40 2021 +0200
patch 8.2.2974: Greek spell checking uses wrong case folding
Problem: Greek spell checking uses wrong case folding.
Solution: Fold capital sigma depending on whether it is at the end of a
word or not. (closes #299)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 11 Jun 2021 19:15:04 +0200 |
parents | 21f49d327f00 |
children | f48c435bd1df |
comparison
equal
deleted
inserted
replaced
24871:7551b2508d35 | 24872:59cfa23bd9eb |
---|---|
789 su->su_maxscore = SCORE_MAXINIT; | 789 su->su_maxscore = SCORE_MAXINIT; |
790 | 790 |
791 if (su->su_badlen >= MAXWLEN) | 791 if (su->su_badlen >= MAXWLEN) |
792 su->su_badlen = MAXWLEN - 1; // just in case | 792 su->su_badlen = MAXWLEN - 1; // just in case |
793 vim_strncpy(su->su_badword, su->su_badptr, su->su_badlen); | 793 vim_strncpy(su->su_badword, su->su_badptr, su->su_badlen); |
794 (void)spell_casefold(su->su_badptr, su->su_badlen, | 794 (void)spell_casefold(curwin, su->su_badptr, su->su_badlen, |
795 su->su_fbadword, MAXWLEN); | 795 su->su_fbadword, MAXWLEN); |
796 // TODO: make this work if the case-folded text is longer than the original | 796 // TODO: make this work if the case-folded text is longer than the original |
797 // text. Currently an illegal byte causes wrong pointer computations. | 797 // text. Currently an illegal byte causes wrong pointer computations. |
798 su->su_fbadword[su->su_badlen] = NUL; | 798 su->su_fbadword[su->su_badlen] = NUL; |
799 | 799 |
1174 // to find matches (esp. REP items). Append some more text, changing | 1174 // to find matches (esp. REP items). Append some more text, changing |
1175 // chars after the bad word may help. | 1175 // chars after the bad word may help. |
1176 STRCPY(fword, su->su_fbadword); | 1176 STRCPY(fword, su->su_fbadword); |
1177 n = (int)STRLEN(fword); | 1177 n = (int)STRLEN(fword); |
1178 p = su->su_badptr + su->su_badlen; | 1178 p = su->su_badptr + su->su_badlen; |
1179 (void)spell_casefold(p, (int)STRLEN(p), fword + n, MAXWLEN - n); | 1179 (void)spell_casefold(curwin, p, (int)STRLEN(p), fword + n, MAXWLEN - n); |
1180 | 1180 |
1181 for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) | 1181 for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) |
1182 { | 1182 { |
1183 lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi); | 1183 lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi); |
1184 | 1184 |
3003 if (lendiff >= 0) | 3003 if (lendiff >= 0) |
3004 pbad = badsound; | 3004 pbad = badsound; |
3005 else | 3005 else |
3006 { | 3006 { |
3007 // soundfold the bad word with more characters following | 3007 // soundfold the bad word with more characters following |
3008 (void)spell_casefold(su->su_badptr, stp->st_orglen, fword, MAXWLEN); | 3008 (void)spell_casefold(curwin, |
3009 su->su_badptr, stp->st_orglen, fword, MAXWLEN); | |
3009 | 3010 |
3010 // When joining two words the sound often changes a lot. E.g., "t he" | 3011 // When joining two words the sound often changes a lot. E.g., "t he" |
3011 // sounds like "t h" while "the" sounds like "@". Avoid that by | 3012 // sounds like "t h" while "the" sounds like "@". Avoid that by |
3012 // removing the space. Don't do it when the good word also contains a | 3013 // removing the space. Don't do it when the good word also contains a |
3013 // space. | 3014 // space. |