Skip to content

Commit b6f72e4

Browse files
committed
vim-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 vim/vim#5078) vim/vim@7751d1d
1 parent c7d109c commit b6f72e4

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

src/nvim/screen.c

+1
Original file line numberDiff line numberDiff line change
@@ -3476,6 +3476,7 @@ win_line (
34763476
* Only do this when there is no syntax highlighting, the
34773477
* @Spell cluster is not used or the current syntax item
34783478
* contains the @Spell cluster. */
3479+
v = (long)(ptr - line);
34793480
if (has_spell && v >= word_end && v > cur_checked_col) {
34803481
spell_attr = 0;
34813482
if (!attr_pri) {

src/nvim/testdir/check.vim

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
source shared.vim
2+
source term_util.vim
3+
4+
" Command to check that making screendumps is supported.
5+
" Caller must source screendump.vim
6+
command CheckScreendump call CheckScreendump()
7+
func CheckScreendump()
8+
if !CanRunVimInTerminal()
9+
throw 'Skipped: cannot make screendumps'
10+
endif
11+
endfunc

src/nvim/testdir/test_spell.vim

+41
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
" Test spell checking
22
" Note: this file uses latin1 encoding, but is used with utf-8 encoding.
33

4+
source check.vim
45
if !has('spell')
56
finish
67
endif
78

9+
source screendump.vim
10+
811
func TearDown()
912
set nospell
1013
call delete('Xtest.aff')
@@ -477,6 +480,44 @@ func RunGoodBad(good, bad, expected_words, expected_bad_words)
477480
bwipe!
478481
endfunc
479482

483+
func Test_spell_screendump()
484+
CheckScreendump
485+
486+
let lines =<< trim END
487+
call setline(1, [
488+
\ "This is some text without any spell errors. Everything",
489+
\ "should just be black, nothing wrong here.",
490+
\ "",
491+
\ "This line has a sepll error. and missing caps.",
492+
\ "And and this is the the duplication.",
493+
\ "with missing caps here.",
494+
\ ])
495+
set spell spelllang=en_nz
496+
END
497+
call writefile(lines, 'XtestSpell')
498+
let buf = RunVimInTerminal('-S XtestSpell', {'rows': 8})
499+
call VerifyScreenDump(buf, 'Test_spell_1', {})
500+
501+
let lines =<< trim END
502+
call setline(1, [
503+
\ "This is some text without any spell errors. Everything",
504+
\ "should just be black, nothing wrong here.",
505+
\ "",
506+
\ "This line has a sepll error. and missing caps.",
507+
\ "And and this is the the duplication.",
508+
\ "with missing caps here.",
509+
\ ])
510+
set spell spelllang=en_nz
511+
END
512+
call writefile(lines, 'XtestSpell')
513+
let buf = RunVimInTerminal('-S XtestSpell', {'rows': 8})
514+
call VerifyScreenDump(buf, 'Test_spell_1', {})
515+
516+
" clean up
517+
call StopVimInTerminal(buf)
518+
call delete('XtestSpell')
519+
endfunc
520+
480521
let g:test_data_aff1 = [
481522
\"SET ISO8859-1",
482523
\"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",

0 commit comments

Comments
 (0)