changeset 18356:596a04c49d76 v8.1.2172

patch 8.1.2172: spell highlight is wrong at start of the line Commit: https://github.com/vim/vim/commit/7751d1d1a3d447d0d48f57f34e0da9f7c6ac433d Author: Bram Moolenaar <Bram@vim.org> Date: Fri Oct 18 20:37:08 2019 +0200 patch 8.1.2172: spell highlight is wrong at start of the line Problem: Spell highlight is wrong at start of the line. Solution: Fix setting the "v" variable. (closes https://github.com/vim/vim/issues/5078)
author Bram Moolenaar <Bram@vim.org>
date Fri, 18 Oct 2019 20:45:03 +0200
parents 2deddc48eb5c
children ffe2ff94a3e0
files src/drawline.c src/testdir/dumps/Test_spell_1.dump src/testdir/test_spell.vim src/version.c
diffstat 4 files changed, 38 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1824,6 +1824,7 @@ win_line(
 		// Only do this when there is no syntax highlighting, the
 		// @Spell cluster is not used or the current syntax item
 		// contains the @Spell cluster.
+		v = (long)(ptr - line);
 		if (has_spell && v >= word_end && v > cur_checked_col)
 		{
 		    spell_attr = 0;
@@ -1874,7 +1875,8 @@ win_line(
 			    // Remember that the good word continues at the
 			    // start of the next line.
 			    checked_lnum = lnum + 1;
-			    checked_col = (int)((p - nextline) + len - nextline_idx);
+			    checked_col = (int)((p - nextline)
+							 + len - nextline_idx);
 			}
 
 			// Turn index into actual attributes.
new file mode 100644
--- /dev/null
+++ b/src/testdir/dumps/Test_spell_1.dump
@@ -0,0 +1,8 @@
+>T+0&#ffffff0|h|i|s| |i|s| |s|o|m|e| |t|e|x|t| |w|i|t|h|o|u|t| |a|n|y| |s|p|e|l@1| |e|r@1|o|r|s|.| @1|E|v|e|r|y|t|h|i|n|g| @19
+|s|h|o|u|l|d| |j|u|s|t| |b|e| |b|l|a|c|k|,| |n|o|t|h|i|n|g| |w|r|o|n|g| |h|e|r|e|.| @33
+@75
+|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|.| @28
+|A+0&#ffd7d7255|n|d| |a|n|d| +0&#ffffff0|t|h|i|s| |i|s| |t+0&#ffd7d7255|h|e| |t|h|e| +0&#ffffff0|d|u|p|l|i|c|a|t|i|o|n|.| @38
+|w+0&#5fd7ff255|i|t|h| +0&#ffffff0|m|i|s@1|i|n|g| |c|a|p|s| |h|e|r|e|.| @51
+|~+0#4040ff13&| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1| 
--- a/src/testdir/test_spell.vim
+++ b/src/testdir/test_spell.vim
@@ -4,6 +4,8 @@
 source check.vim
 CheckFeature spell
 
+source screendump.vim
+
 func TearDown()
   set nospell
   call delete('Xtest.aff')
@@ -460,6 +462,29 @@ func RunGoodBad(good, bad, expected_word
   bwipe!
 endfunc
 
+func Test_spell_screendump()
+  CheckScreendump
+
+  let lines =<< trim END
+       call setline(1, [
+             \ "This is some text without any spell errors.  Everything",
+             \ "should just be black, nothing wrong here.",
+             \ "",
+             \ "This line has a sepll error. and missing caps.",
+             \ "And and this is the the duplication.",
+             \ "with missing caps here.",
+             \ ])
+       set spell spelllang=en_nz
+  END
+  call writefile(lines, 'XtestSpell')
+  let buf = RunVimInTerminal('-S XtestSpell', {'rows': 8})
+  call VerifyScreenDump(buf, 'Test_spell_1', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XtestSpell')
+endfunc
+
 let g:test_data_aff1 = [
       \"SET ISO8859-1",
       \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2172,
+/**/
     2171,
 /**/
     2170,