mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 19:36:40 +00:00
backport: fix(:source): copy curbuf lines to memory before sourcing #15111
It's possible for weirdness to happen if curbuf is modified while sourcing from it via :source (with no arguments). For example: - Deleting lines from or wiping curbuf can cause internal error E315 to be thrown from ml_get. - Changing the curbuf to another buffer while sourcing can cause lines from the new curbuf to then be sourced instead.
This commit is contained in:
@@ -60,6 +60,15 @@ describe(':source', function()
|
||||
eq('Vim(let):E15: Invalid expression: #{', exc_exec("'<,'>source"))
|
||||
end)
|
||||
|
||||
it('does not break if current buffer is modified while sourced', function()
|
||||
insert [[
|
||||
bwipeout!
|
||||
let a = 123
|
||||
]]
|
||||
command('source')
|
||||
eq('123', meths.exec('echo a', true))
|
||||
end)
|
||||
|
||||
it('multiline heredoc command', function()
|
||||
insert([[
|
||||
lua << EOF
|
||||
|
Reference in New Issue
Block a user