mirror of
https://github.com/neovim/neovim.git
synced 2026-08-29 18:41:48 +00:00
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)7751d1d1a3Skip spell tests in OpenBSD. Nvim or screen likely crashed. Revist once issue #12104 is fixed. Skip the test for the following reasons: - unknown regression caused by https://github.com/neovim/neovim/issues/12104 - cannot revert failing test fromed0d135247
This commit is contained in:
@@ -3476,6 +3476,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;
|
||||
if (!attr_pri) {
|
||||
|
||||
11
src/nvim/testdir/check.vim
Normal file
11
src/nvim/testdir/check.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
source shared.vim
|
||||
source term_util.vim
|
||||
|
||||
" Command to check that making screendumps is supported.
|
||||
" Caller must source screendump.vim
|
||||
command CheckScreendump call CheckScreendump()
|
||||
func CheckScreendump()
|
||||
if !CanRunVimInTerminal()
|
||||
throw 'Skipped: cannot make screendumps'
|
||||
endif
|
||||
endfunc
|
||||
@@ -1,10 +1,13 @@
|
||||
" Test spell checking
|
||||
" Note: this file uses latin1 encoding, but is used with utf-8 encoding.
|
||||
|
||||
source check.vim
|
||||
if !has('spell')
|
||||
finish
|
||||
endif
|
||||
|
||||
source screendump.vim
|
||||
|
||||
func TearDown()
|
||||
set nospell
|
||||
call delete('Xtest.aff')
|
||||
@@ -477,6 +480,44 @@ 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', {})
|
||||
|
||||
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",
|
||||
|
||||
@@ -4,8 +4,9 @@ local helpers = require('test.functional.helpers')(after_each)
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local clear = helpers.clear
|
||||
local feed = helpers.feed
|
||||
local feed_command = helpers.feed_command
|
||||
local insert = helpers.insert
|
||||
local uname = helpers.uname
|
||||
local command = helpers.command
|
||||
|
||||
describe("'spell'", function()
|
||||
local screen
|
||||
@@ -16,12 +17,14 @@ describe("'spell'", function()
|
||||
screen:attach()
|
||||
screen:set_default_attr_ids( {
|
||||
[0] = {bold=true, foreground=Screen.colors.Blue},
|
||||
[1] = {special = Screen.colors.Red, undercurl = true}
|
||||
[1] = {special = Screen.colors.Red, undercurl = true},
|
||||
[2] = {special = Screen.colors.Blue1, undercurl = true},
|
||||
})
|
||||
end)
|
||||
|
||||
it('joins long lines #7937', function()
|
||||
feed_command('set spell')
|
||||
if uname() == 'openbsd' then pending('FIXME #12104', function() end) return end
|
||||
command('set spell')
|
||||
insert([[
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
@@ -42,4 +45,26 @@ describe("'spell'", function()
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it('has correct highlight at start of line', function()
|
||||
insert([[
|
||||
"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.",
|
||||
]])
|
||||
command('set spell spelllang=en_nz')
|
||||
screen:expect([[
|
||||
"This is some text without any spell errors. Everything", |
|
||||
"should just be black, nothing wrong here.", |
|
||||
"", |
|
||||
"This line has a {1:sepll} error. {2:and} missing caps.", |
|
||||
"{1:And and} this is {1:the the} duplication.", |
|
||||
"with missing caps here.", |
|
||||
^ |
|
||||
|
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user