Merge pull request #12968 from erw7/fix-substitute2

fix substitute problem with inccommand
This commit is contained in:
Thomas Vigouroux
2020-10-02 09:56:57 +02:00
committed by GitHub
5 changed files with 37 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ local meths = helpers.meths
local funcs = helpers.funcs
local pcall_err = helpers.pcall_err
local ok = helpers.ok
local assert_alive = helpers.assert_alive
describe('API: highlight',function()
local expected_rgb = {
@@ -145,4 +146,15 @@ describe('API: highlight',function()
eq({foreground=tonumber("0x888888"), background=tonumber("0x888888")},
meths.get_hl_by_name("Shrubbery", true))
end)
it("nvim_buf_add_highlight to other buffer doesn't crash if undo is disabled #12873", function()
command('vsplit file')
local err, _ = pcall(meths.buf_set_option, 1, 'undofile', false)
eq(true, err)
err, _ = pcall(meths.buf_set_option, 1, 'undolevels', -1)
eq(true, err)
err, _ = pcall(meths.buf_add_highlight, 1, -1, 'Question', 0, 0, -1)
eq(true, err)
assert_alive()
end)
end)

View File

@@ -2750,6 +2750,26 @@ it(':substitute with inccommand, timer-induced :redraw #9777', function()
]])
end)
it(":substitute doesn't crash with inccommand, if undo is empty #12932", function()
local screen = Screen.new(10,5)
clear()
command('set undolevels=-1')
common_setup(screen, 'split', 'test')
feed(':%s/test')
sleep(100)
feed('/')
sleep(100)
feed('f')
screen:expect([[
{12:f} |
{15:~ }|
{15:~ }|
{15:~ }|
:%s/test/f^ |
]])
assert_alive()
end)
it('long :%s/ with inccommand does not collapse cmdline', function()
local screen = Screen.new(10,5)
clear()