summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-10 22:17:58 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-10 22:17:58 +0200
commite0ebeda4d8219a8955001b43ef7a9268452ef7f5 (patch)
tree1cf60545d69830a4379529789eb3c622d1720be5
parent215f49c4d720367be29f56168f363a0ee9eaf86b (diff)
downloadvim-git-e0ebeda4d8219a8955001b43ef7a9268452ef7f5.tar.gz
patch 8.2.0956: spell test failsv8.2.0956
Problem: Spell test fails. Solution: Add missing change the spell checking.
-rw-r--r--src/spell.c26
-rw-r--r--src/version.c2
2 files changed, 27 insertions, 1 deletions
diff --git a/src/spell.c b/src/spell.c
index 102355f7c..8558d3908 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -173,6 +173,8 @@ spell_check(
int wrongcaplen = 0;
int lpi;
int count_word = docount;
+ int use_camel_case = *wp->w_s->b_p_spo != NUL;
+ int camel_case = 0;
// A word never starts at a space or a control character. Return quickly
// then, skipping over the character.
@@ -204,9 +206,27 @@ spell_check(
mi.mi_fend = ptr;
if (spell_iswordp(mi.mi_fend, wp))
{
+ int prev_upper;
+ int this_upper;
+
+ if (use_camel_case)
+ {
+ c = PTR2CHAR(mi.mi_fend);
+ this_upper = SPELL_ISUPPER(c);
+ }
+
do
+ {
MB_PTR_ADV(mi.mi_fend);
- while (*mi.mi_fend != NUL && spell_iswordp(mi.mi_fend, wp));
+ if (use_camel_case)
+ {
+ prev_upper = this_upper;
+ c = PTR2CHAR(mi.mi_fend);
+ this_upper = SPELL_ISUPPER(c);
+ camel_case = !prev_upper && this_upper;
+ }
+ } while (*mi.mi_fend != NUL && spell_iswordp(mi.mi_fend, wp)
+ && !camel_case);
if (capcol != NULL && *capcol == 0 && wp->w_s->b_cap_prog != NULL)
{
@@ -237,6 +257,10 @@ spell_check(
MAXWLEN + 1);
mi.mi_fwordlen = (int)STRLEN(mi.mi_fword);
+ if (camel_case)
+ // Introduce a fake word end space into the folded word.
+ mi.mi_fword[mi.mi_fwordlen - 1] = ' ';
+
// The word is bad unless we recognize it.
mi.mi_result = SP_BAD;
mi.mi_result2 = SP_BAD;
diff --git a/src/version.c b/src/version.c
index 9600f65f8..66f01def3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 956,
+/**/
955,
/**/
954,