# HG changeset patch # User Bram Moolenaar # Date 1571424303 -7200 # Node ID 596a04c49d767cbb55f2a2d3a8cda8580d4d3582 # Parent 2deddc48eb5cb5047bc9274f359b1615d014b9bb patch 8.1.2172: spell highlight is wrong at start of the line Commit: https://github.com/vim/vim/commit/7751d1d1a3d447d0d48f57f34e0da9f7c6ac433d Author: Bram Moolenaar 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) diff --git a/src/drawline.c b/src/drawline.c --- 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. diff --git a/src/testdir/dumps/Test_spell_1.dump b/src/testdir/dumps/Test_spell_1.dump 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+0fd7ff255|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+0fd7ff255|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| diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim --- 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", diff --git a/src/version.c b/src/version.c --- 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,