mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 15:38:33 +00:00
vim-patch:9.0.0664: bad redrawing with spell checking, using "C" and "$" in 'cpo'
Problem: Bad redrawing with spell checking, using "C" and "$" in 'cpo'.
Solution: Do not redraw the next line when "$" is in 'cpo'. (closes vim/vim#11285)
f3ef026c98
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -397,7 +397,10 @@ void changed_bytes(linenr_T lnum, colnr_T col)
|
|||||||
// When text has been changed at the end of the line, possibly the start of
|
// When text has been changed at the end of the line, possibly the start of
|
||||||
// the next line may have SpellCap that should be removed or it needs to be
|
// the next line may have SpellCap that should be removed or it needs to be
|
||||||
// displayed. Schedule the next line for redrawing just in case.
|
// displayed. Schedule the next line for redrawing just in case.
|
||||||
if (spell_check_window(curwin) && lnum < curbuf->b_ml.ml_line_count) {
|
// Don't do this when displaying '$' at the end of changed text.
|
||||||
|
if (spell_check_window(curwin)
|
||||||
|
&& lnum < curbuf->b_ml.ml_line_count
|
||||||
|
&& vim_strchr(p_cpo, CPO_DOLLAR) == NULL) {
|
||||||
redrawWinline(curwin, lnum + 1);
|
redrawWinline(curwin, lnum + 1);
|
||||||
}
|
}
|
||||||
// notify any channels that are watching
|
// notify any channels that are watching
|
||||||
|
@@ -1527,8 +1527,8 @@ void edit_unputchar(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when p_dollar is set: display a '$' at the end of the changed text
|
/// Called when "$" is in 'cpoptions': display a '$' at the end of the changed
|
||||||
// Only works when cursor is in the line that changes.
|
/// text. Only works when cursor is in the line that changes.
|
||||||
void display_dollar(colnr_T col_arg)
|
void display_dollar(colnr_T col_arg)
|
||||||
{
|
{
|
||||||
colnr_T col = col_arg < 0 ? 0 : col_arg;
|
colnr_T col = col_arg < 0 ? 0 : col_arg;
|
||||||
|
@@ -27,6 +27,7 @@ describe("'spell'", function()
|
|||||||
[6] = {foreground = Screen.colors.Red},
|
[6] = {foreground = Screen.colors.Red},
|
||||||
[7] = {foreground = Screen.colors.Blue},
|
[7] = {foreground = Screen.colors.Blue},
|
||||||
[8] = {foreground = Screen.colors.Blue, special = Screen.colors.Red, undercurl = true},
|
[8] = {foreground = Screen.colors.Blue, special = Screen.colors.Red, undercurl = true},
|
||||||
|
[9] = {bold = true},
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -141,6 +142,40 @@ describe("'spell'", function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- oldtest: Test_spell_compatible()
|
||||||
|
it([[redraws properly when using "C" and "$" is in 'cpo']], function()
|
||||||
|
exec([=[
|
||||||
|
call setline(1, [
|
||||||
|
\ "test "->repeat(20),
|
||||||
|
\ "",
|
||||||
|
\ "end",
|
||||||
|
\ ])
|
||||||
|
set spell cpo+=$
|
||||||
|
]=])
|
||||||
|
feed('51|C')
|
||||||
|
screen:expect([[
|
||||||
|
{2:test} test test test test test test test test test ^test test test test test test |
|
||||||
|
test test test test$ |
|
||||||
|
|
|
||||||
|
{2:end} |
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{9:-- INSERT --} |
|
||||||
|
]])
|
||||||
|
feed('x')
|
||||||
|
screen:expect([[
|
||||||
|
{2:test} test test test test test test test test test x^est test test test test test |
|
||||||
|
test test test test$ |
|
||||||
|
|
|
||||||
|
{2:end} |
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{9:-- INSERT --} |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
|
||||||
it('extmarks, "noplainbuffer" and syntax #20385 #23398', function()
|
it('extmarks, "noplainbuffer" and syntax #20385 #23398', function()
|
||||||
exec('set filetype=c')
|
exec('set filetype=c')
|
||||||
exec('syntax on')
|
exec('syntax on')
|
||||||
|
@@ -972,28 +972,12 @@ func Test_spell_screendump()
|
|||||||
\ ])
|
\ ])
|
||||||
set spell spelllang=en_nz
|
set spell spelllang=en_nz
|
||||||
END
|
END
|
||||||
call writefile(lines, 'XtestSpell')
|
call writefile(lines, 'XtestSpell', 'D')
|
||||||
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})
|
let buf = RunVimInTerminal('-S XtestSpell', {'rows': 8})
|
||||||
call VerifyScreenDump(buf, 'Test_spell_1', {})
|
call VerifyScreenDump(buf, 'Test_spell_1', {})
|
||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('XtestSpell')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_spell_screendump_spellcap()
|
func Test_spell_screendump_spellcap()
|
||||||
@@ -1010,7 +994,7 @@ func Test_spell_screendump_spellcap()
|
|||||||
\ ])
|
\ ])
|
||||||
set spell spelllang=en
|
set spell spelllang=en
|
||||||
END
|
END
|
||||||
call writefile(lines, 'XtestSpellCap')
|
call writefile(lines, 'XtestSpellCap', 'D')
|
||||||
let buf = RunVimInTerminal('-S XtestSpellCap', {'rows': 8})
|
let buf = RunVimInTerminal('-S XtestSpellCap', {'rows': 8})
|
||||||
call VerifyScreenDump(buf, 'Test_spell_2', {})
|
call VerifyScreenDump(buf, 'Test_spell_2', {})
|
||||||
|
|
||||||
@@ -1028,7 +1012,30 @@ func Test_spell_screendump_spellcap()
|
|||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('XtestSpellCap')
|
endfunc
|
||||||
|
|
||||||
|
func Test_spell_compatible()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
call setline(1, [
|
||||||
|
\ "test "->repeat(20),
|
||||||
|
\ "",
|
||||||
|
\ "end",
|
||||||
|
\ ])
|
||||||
|
set spell cpo+=$
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XtestSpellComp', 'D')
|
||||||
|
let buf = RunVimInTerminal('-S XtestSpellComp', {'rows': 8})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "51|C")
|
||||||
|
call VerifyScreenDump(buf, 'Test_spell_compatible_1', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "x")
|
||||||
|
call VerifyScreenDump(buf, 'Test_spell_compatible_2', {})
|
||||||
|
|
||||||
|
" clean up
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
let g:test_data_aff1 = [
|
let g:test_data_aff1 = [
|
||||||
|
Reference in New Issue
Block a user