aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-16 06:35:30 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-02-16 07:18:06 +0800
commitc1fa8789c1ba5549dc37163dfa9be039c5092a41 (patch)
tree9c39a44906067eb3e9dffc762f0ce7a36dbfd27b /test/functional/legacy
parentd60eeacae4ce4aa780636b90199ac20af609e91b (diff)
downloadrneovim-c1fa8789c1ba5549dc37163dfa9be039c5092a41.tar.gz
rneovim-c1fa8789c1ba5549dc37163dfa9be039c5092a41.tar.bz2
rneovim-c1fa8789c1ba5549dc37163dfa9be039c5092a41.zip
vim-patch:9.1.0112: Remove undo information, when cleaning quickfix buffer
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 https://github.com/vim/vim/commit/f0d3d4a42657dca996e790aa829de3c6be7fdb63 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'test/functional/legacy')
-rw-r--r--test/functional/legacy/autocmd_spec.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/functional/legacy/autocmd_spec.lua b/test/functional/legacy/autocmd_spec.lua
new file mode 100644
index 0000000000..97051f3d3f
--- /dev/null
+++ b/test/functional/legacy/autocmd_spec.lua
@@ -0,0 +1,40 @@
+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)