mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
fix(undo): fix crash caused by checking undolevels in wrong buffer
fixes #24894
This commit is contained in:
@@ -16,6 +16,7 @@ local command = helpers.command
|
||||
local bufmeths = helpers.bufmeths
|
||||
local feed = helpers.feed
|
||||
local pcall_err = helpers.pcall_err
|
||||
local assert_alive = helpers.assert_alive
|
||||
|
||||
describe('api/buf', function()
|
||||
before_each(clear)
|
||||
@@ -41,6 +42,14 @@ describe('api/buf', function()
|
||||
eq(1, curbuf_depr('line_count'))
|
||||
end)
|
||||
|
||||
it("doesn't crash just after set undolevels=1 #24894", function()
|
||||
local buf = meths.create_buf(false, true)
|
||||
meths.buf_set_option(buf, 'undolevels', -1)
|
||||
meths.buf_set_lines(buf, 0, 1, false, { })
|
||||
|
||||
assert_alive()
|
||||
end)
|
||||
|
||||
it('cursor position is maintained after lines are inserted #9961', function()
|
||||
-- replace the buffer contents with these three lines.
|
||||
request('nvim_buf_set_lines', 0, 0, -1, 1, {"line1", "line2", "line3", "line4"})
|
||||
|
Reference in New Issue
Block a user