Mercurial > vim
comparison src/testdir/test_autocmd.vim @ 34363:3b654f4462c5 v9.1.0112
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Commit: https://github.com/vim/vim/commit/f0d3d4a42657dca996e790aa829de3c6be7fdb63
Author: Christian Brabandt <cb@256bit.org>
Date: Thu Feb 15 20:15:04 2024 +0100
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: #13905
closes: #13928
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 15 Feb 2024 20:30:04 +0100 |
parents | a66a01e2094a |
children | f8fed6c8bb60 |
comparison
equal
deleted
inserted
replaced
34362:5904297858aa | 34363:3b654f4462c5 |
---|---|
4411 call assert_equal(3, bytes->len()) | 4411 call assert_equal(3, bytes->len()) |
4412 | 4412 |
4413 delfunc SetupVimTest_shm | 4413 delfunc SetupVimTest_shm |
4414 endfunc | 4414 endfunc |
4415 | 4415 |
4416 func Test_autocmd_invalidates_undo_on_textchanged() | |
4417 CheckRunVimInTerminal | |
4418 let script =<< trim END | |
4419 set hidden | |
4420 " create quickfix list (at least 2 lines to move line) | |
4421 vimgrep /u/j % | |
4422 | |
4423 " enter quickfix window | |
4424 cwindow | |
4425 | |
4426 " set modifiable | |
4427 setlocal modifiable | |
4428 | |
4429 " set autocmd to clear quickfix list | |
4430 | |
4431 autocmd! TextChanged <buffer> call setqflist([]) | |
4432 " move line | |
4433 move+1 | |
4434 END | |
4435 call writefile(script, 'XTest_autocmd_invalidates_undo_on_textchanged', 'D') | |
4436 let buf = RunVimInTerminal('XTest_autocmd_invalidates_undo_on_textchanged', {'rows': 20}) | |
4437 call term_sendkeys(buf, ":so %\<cr>") | |
4438 call term_sendkeys(buf, "G") | |
4439 call WaitForAssert({-> assert_match('^XTest_autocmd_invalidates_undo_on_textchanged\s*$', term_getline(buf, 20))}, 1000) | |
4440 | |
4441 call StopVimInTerminal(buf) | |
4442 endfunc | |
4443 | |
4416 " vim: shiftwidth=2 sts=2 expandtab | 4444 " vim: shiftwidth=2 sts=2 expandtab |