aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-24 09:12:58 -0500
committerGitHub <noreply@github.com>2020-11-24 09:12:58 -0500
commit7e0e0782a17b91a9d90d493f326770dcf33c7598 (patch)
treea60af4ce50f0661744fa6ce4cc0cf2abefa09817 /src/nvim/testdir
parent71d4f5851f068eeb432af34850dddda8cc1c71e3 (diff)
downloadrneovim-7e0e0782a17b91a9d90d493f326770dcf33c7598.tar.gz
rneovim-7e0e0782a17b91a9d90d493f326770dcf33c7598.tar.bz2
rneovim-7e0e0782a17b91a9d90d493f326770dcf33c7598.zip
vim-patch:8.2.2036: buffer messed up if creating the quickfix window fails (#13365)
Problem: Current buffer is messed up if creating a new buffer for the quickfix window fails. Solution: Check that creating the buffer succeeds. (closes vim/vim#7352) https://github.com/vim/vim/commit/9e40c4b15ebfbc84947a3f34b1bd53e397b57f51
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_quickfix.vim35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index 3e97cd2dd0..9c5f0777c6 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -4423,4 +4423,39 @@ func Test_add_invalid_entry_with_qf_window()
cclose
endfunc
+" Test for very weird problem: autocommand causes a failure, resulting opening
+" the quickfix window to fail. This still splits the window, but otherwise
+" should not mess up buffers.
+func Test_quickfix_window_fails_to_open()
+ CheckScreendump
+
+ let lines =<< trim END
+ anything
+ try
+ anything
+ endtry
+ END
+ call writefile(lines, 'XquickfixFails')
+
+ let lines =<< trim END
+ split XquickfixFails
+ silent vimgrep anything %
+ normal o
+ au BufLeave * ++once source XquickfixFails
+ " This will trigger the autocommand, which causes an error, what follows
+ " is aborted but the window was already split.
+ silent! cwindow
+ END
+ call writefile(lines, 'XtestWinFails')
+ let buf = RunVimInTerminal('-S XtestWinFails', #{rows: 13})
+ call VerifyScreenDump(buf, 'Test_quickfix_window_fails', {})
+
+ " clean up
+ call term_sendkeys(buf, ":bwipe!\<CR>")
+ call term_wait(buf)
+ call StopVimInTerminal(buf)
+ call delete('XtestWinFails')
+ call delete('XquickfixFails')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab