]> granicus.if.org Git - vim/commitdiff
patch 8.1.2172: spell highlight is wrong at start of the line v8.1.2172
authorBram Moolenaar <Bram@vim.org>
Fri, 18 Oct 2019 18:37:08 +0000 (20:37 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 18 Oct 2019 18:37:08 +0000 (20:37 +0200)
Problem:    Spell highlight is wrong at start of the line.
Solution:   Fix setting the "v" variable. (closes #5078)

src/drawline.c
src/testdir/dumps/Test_spell_1.dump [new file with mode: 0644]
src/testdir/test_spell.vim
src/version.c

index 9a4ff7dc5d9d0ef4e0e9d80edd6cee8563d3ec3d..333eeba29739ed712f8d62dc08ce2d489cc8139b 100644 (file)
@@ -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.
diff --git a/src/testdir/dumps/Test_spell_1.dump b/src/testdir/dumps/Test_spell_1.dump
new file mode 100644 (file)
index 0000000..2025be1
--- /dev/null
@@ -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| 
index 9cbfaa50e89c3d46bfe7aafe384fb4e8f8b2fbd4..146e421d030af93bbfe04d27a222534df03b42c6 100644 (file)
@@ -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_words, expected_bad_words)
   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",
index 0dd36774db726616c633ab79adaf204e36859c3b..901bf32ccfc167f5e8d3eabd6dabfff0e01669d9 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2172,
 /**/
     2171,
 /**/