mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
c1fa8789c1
Problem: When the quickfix buffer has been modified an autocommand
may invalidate the undo stack (kawarimidoll)
Solution: When clearing the quickfix buffer, also wipe the undo stack
fixes: vim/vim#13905
closes: vim/vim#13928
f0d3d4a426
Co-authored-by: Christian Brabandt <cb@256bit.org>
41 lines
1007 B
Lua
41 lines
1007 B
Lua
local helpers = require('test.functional.helpers')(after_each)
|
|
local clear = helpers.clear
|
|
local write_file = helpers.write_file
|
|
local command = helpers.command
|
|
local feed = helpers.feed
|
|
local api = helpers.api
|
|
local eq = helpers.eq
|
|
|
|
before_each(clear)
|
|
|
|
-- oldtest: Test_autocmd_invalidates_undo_on_textchanged()
|
|
it('no E440 in quickfix window when autocommand invalidates undo', function()
|
|
write_file(
|
|
'XTest_autocmd_invalidates_undo_on_textchanged',
|
|
[[
|
|
set hidden
|
|
" create quickfix list (at least 2 lines to move line)
|
|
vimgrep /u/j %
|
|
|
|
" enter quickfix window
|
|
cwindow
|
|
|
|
" set modifiable
|
|
setlocal modifiable
|
|
|
|
" set autocmd to clear quickfix list
|
|
|
|
autocmd! TextChanged <buffer> call setqflist([])
|
|
" move line
|
|
move+1
|
|
]]
|
|
)
|
|
finally(function()
|
|
os.remove('XTest_autocmd_invalidates_undo_on_textchanged')
|
|
end)
|
|
command('edit XTest_autocmd_invalidates_undo_on_textchanged')
|
|
command('so %')
|
|
feed('G')
|
|
eq('', api.nvim_get_vvar('errmsg'))
|
|
end)
|