Skip to content

Commit e0ebeda

Browse files
committed
patch 8.2.0956: spell test fails
Problem: Spell test fails. Solution: Add missing change the spell checking.
1 parent 215f49c commit e0ebeda

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

src/spell.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ spell_check(
173173
int wrongcaplen = 0;
174174
int lpi;
175175
int count_word = docount;
176+
int use_camel_case = *wp->w_s->b_p_spo != NUL;
177+
int camel_case = 0;
176178

177179
// A word never starts at a space or a control character. Return quickly
178180
// then, skipping over the character.
@@ -204,9 +206,27 @@ spell_check(
204206
mi.mi_fend = ptr;
205207
if (spell_iswordp(mi.mi_fend, wp))
206208
{
209+
int prev_upper;
210+
int this_upper;
211+
212+
if (use_camel_case)
213+
{
214+
c = PTR2CHAR(mi.mi_fend);
215+
this_upper = SPELL_ISUPPER(c);
216+
}
217+
207218
do
219+
{
208220
MB_PTR_ADV(mi.mi_fend);
209-
while (*mi.mi_fend != NUL && spell_iswordp(mi.mi_fend, wp));
221+
if (use_camel_case)
222+
{
223+
prev_upper = this_upper;
224+
c = PTR2CHAR(mi.mi_fend);
225+
this_upper = SPELL_ISUPPER(c);
226+
camel_case = !prev_upper && this_upper;
227+
}
228+
} while (*mi.mi_fend != NUL && spell_iswordp(mi.mi_fend, wp)
229+
&& !camel_case);
210230

211231
if (capcol != NULL && *capcol == 0 && wp->w_s->b_cap_prog != NULL)
212232
{
@@ -237,6 +257,10 @@ spell_check(
237257
MAXWLEN + 1);
238258
mi.mi_fwordlen = (int)STRLEN(mi.mi_fword);
239259

260+
if (camel_case)
261+
// Introduce a fake word end space into the folded word.
262+
mi.mi_fword[mi.mi_fwordlen - 1] = ' ';
263+
240264
// The word is bad unless we recognize it.
241265
mi.mi_result = SP_BAD;
242266
mi.mi_result2 = SP_BAD;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
956,
757759
/**/
758760
955,
759761
/**/

0 commit comments

Comments
 (0)