Mercurial > vim
comparison src/testdir/test_quickfix.vim @ 15740:2fe4a503c5ad v8.1.0877
patch 8.1.0877: new buffer used every time the quickfix window is opened
commit https://github.com/vim/vim/commit/ee8188fc74a7cf9ee7acb634b2bb7a032d0cb24c
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 5 21:23:04 2019 +0100
patch 8.1.0877: new buffer used every time the quickfix window is opened
Problem: New buffer used every time the quickfix window is opened.
Solution: Reuse the buffer. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/3902)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 05 Feb 2019 21:30:06 +0100 |
parents | b8a2362073bb |
children | 77e97f159554 |
comparison
equal
deleted
inserted
replaced
15739:ae6b78344fb9 | 15740:2fe4a503c5ad |
---|---|
3897 | 3897 |
3898 enew | only | 3898 enew | only |
3899 set efm& | 3899 set efm& |
3900 call delete('Xfile1') | 3900 call delete('Xfile1') |
3901 endfunc | 3901 endfunc |
3902 | |
3903 " Test for the quickfix window buffer | |
3904 func Xqfbuf_test(cchar) | |
3905 call s:setup_commands(a:cchar) | |
3906 | |
3907 " Quickfix buffer should be reused across closing and opening a quickfix | |
3908 " window | |
3909 Xexpr "F1:10:Line10" | |
3910 Xopen | |
3911 let qfbnum = bufnr('') | |
3912 Xclose | |
3913 " Even after the quickfix window is closed, the buffer should be loaded | |
3914 call assert_true(bufloaded(qfbnum)) | |
3915 Xopen | |
3916 " Buffer should be reused when opening the window again | |
3917 call assert_equal(qfbnum, bufnr('')) | |
3918 Xclose | |
3919 | |
3920 if a:cchar == 'l' | |
3921 %bwipe | |
3922 " For a location list, when both the file window and the location list | |
3923 " window for the list are closed, then the buffer should be freed. | |
3924 new | only | |
3925 lexpr "F1:10:Line10" | |
3926 let wid = win_getid() | |
3927 lopen | |
3928 let qfbnum = bufnr('') | |
3929 call assert_match(qfbnum . ' %a- "\[Location List]"', execute('ls')) | |
3930 close | |
3931 " When the location list window is closed, the buffer name should not | |
3932 " change to 'Quickfix List' | |
3933 call assert_match(qfbnum . ' h- "\[Location List]"', execute('ls')) | |
3934 call assert_true(bufloaded(qfbnum)) | |
3935 | |
3936 new | only | |
3937 call assert_false(bufloaded(qfbnum)) | |
3938 endif | |
3939 endfunc | |
3940 | |
3941 func Test_qfbuf() | |
3942 call Xqfbuf_test('c') | |
3943 call Xqfbuf_test('l') | |
3944 endfunc |