mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
fix(api): load buffer first on nvim_buf_set_lines (#25823)
Fix #22670 Fix #8659
This commit is contained in:
@@ -713,6 +713,21 @@ describe('api/buf', function()
|
||||
feed('<c-w>p')
|
||||
eq(3, funcs.winnr())
|
||||
end)
|
||||
|
||||
it('set_lines on unloaded buffer #8659 #22670', function()
|
||||
local bufnr = curbuf('get_number')
|
||||
meths.buf_set_lines(bufnr, 0, -1, false, {'a', 'b', 'c'})
|
||||
meths.buf_set_name(bufnr, 'set_lines')
|
||||
finally(function()
|
||||
os.remove('set_lines')
|
||||
end)
|
||||
command('write!')
|
||||
command('new')
|
||||
command('bunload! '..bufnr)
|
||||
local new_bufnr = funcs.bufnr('set_lines', true)
|
||||
meths.buf_set_lines(new_bufnr, 0, -1, false, {})
|
||||
eq({''}, meths.buf_get_lines(new_bufnr, 0, -1, false))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('nvim_buf_set_text', function()
|
||||
|
Reference in New Issue
Block a user