summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2022-08-09 12:25:10 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-09 12:25:10 +0100
commitafa23d1b99692e3c726eb694933ab348b442a1e4 (patch)
tree056fb741d590d046e5da3d3257767322768387d7
parentad6d9cc679259936b7c8453f17c0ec9d7ab7dcd0 (diff)
downloadvim-git-afa23d1b99692e3c726eb694933ab348b442a1e4.tar.gz
patch 9.0.0175: spell checking for capital not working with trailing spacev9.0.0175
Problem: Spell checking for capital not working with trailing space. Solution: Do not calculate cap_col at the end of the line. (Christian Brabandt, closes #10870, issue #10838)
-rw-r--r--src/drawline.c4
-rw-r--r--src/testdir/dumps/Test_spell_2.dump8
-rw-r--r--src/testdir/test_spell.vim23
-rw-r--r--src/version.c2
4 files changed, 36 insertions, 1 deletions
diff --git a/src/drawline.c b/src/drawline.c
index a435e4e84..3a9c7a3a4 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -2279,7 +2279,9 @@ win_line(
if (has_spell && v >= word_end && v > cur_checked_col)
{
spell_attr = 0;
- if (c != 0 && (
+ // do not calculate cap_col at the end of the line or when
+ // only white space is following
+ if (c != 0 && (*skipwhite(prev_ptr) != NUL) && (
# ifdef FEAT_SYN_HL
!has_syntax ||
# endif
diff --git a/src/testdir/dumps/Test_spell_2.dump b/src/testdir/dumps/Test_spell_2.dump
new file mode 100644
index 000000000..961949bfb
--- /dev/null
+++ b/src/testdir/dumps/Test_spell_2.dump
@@ -0,0 +1,8 @@
+> +0&#ffffff0@2|T|h|i|s| |l|i|n|e| |h|a|s| |a| |s+0&#ffd7d7255|e|p|l@1| +0&#ffffff0|e|r@1|o|r|.| |a+0&#5fd7ff255|n|d| +0&#ffffff0|m|i|s@1|i|n|g| |c|a|p|s| |a|n|d| |t|r|a|i|l|i|n|g| |s|p|a|c|e|s|.| @5
+|a+0&#5fd7ff255|n|o|t|h|e|r| +0&#ffffff0|m|i|s@1|i|n|g| |c|a|p| |h|e|r|e|.| @49
+@75
+|a+0&#5fd7ff255|n|d| +0&#ffffff0|h|e|r|e|.| @65
+@75
+|a+0&#5fd7ff255|n|d| +0&#ffffff0|h|e|r|e|.| @65
+|~+0#4040ff13&| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1|
diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim
index 94ea3d7fe..3ea9afff1 100644
--- a/src/testdir/test_spell.vim
+++ b/src/testdir/test_spell.vim
@@ -965,6 +965,29 @@ func Test_spell_screendump()
call delete('XtestSpell')
endfunc
+func Test_spell_screendump_spellcap()
+ CheckScreendump
+
+ let lines =<< trim END
+ call setline(1, [
+ \ " This line has a sepll error. and missing caps and trailing spaces. ",
+ \ "another missing cap here.",
+ \ "",
+ \ "and here.",
+ \ " ",
+ \ "and here."
+ \ ])
+ set spell spelllang=en
+ END
+ call writefile(lines, 'XtestSpellCap')
+ let buf = RunVimInTerminal('-S XtestSpellCap', {'rows': 8})
+ call VerifyScreenDump(buf, 'Test_spell_2', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestSpellCap')
+endfunc
+
let g:test_data_aff1 = [
\"SET ISO8859-1",
\"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
diff --git a/src/version.c b/src/version.c
index 840a1eb67..39449539c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 175,
+/**/
174,
/**/
173,