forked from aniani/vim
patch 8.2.3762: if quickfix buffer is wiped out getqflist() still returns it
Problem: If the quickfix buffer is wiped out getqflist() still returns its number. Solution: Use zero if the buffer is no longer present. (Yegappan Lakshmanan, closes #9306)
This commit is contained in:
parent
a48d4e44a2
commit
56150da687
@ -6793,13 +6793,18 @@ qf_winid(qf_info_T *qi)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the number of the buffer displayed in the quickfix/location list
|
* Returns the number of the buffer displayed in the quickfix/location list
|
||||||
* window. If there is no buffer associated with the list, then returns 0.
|
* window. If there is no buffer associated with the list or the buffer is
|
||||||
|
* wiped out, then returns 0.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
qf_getprop_qfbufnr(qf_info_T *qi, dict_T *retdict)
|
qf_getprop_qfbufnr(qf_info_T *qi, dict_T *retdict)
|
||||||
{
|
{
|
||||||
return dict_add_number(retdict, "qfbufnr",
|
int bufnum = 0;
|
||||||
(qi == NULL) ? 0 : qi->qf_bufnr);
|
|
||||||
|
if (qi != NULL && buflist_findnr(qi->qf_bufnr) != NULL)
|
||||||
|
bufnum = qi->qf_bufnr;
|
||||||
|
|
||||||
|
return dict_add_number(retdict, "qfbufnr", bufnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4626,6 +4626,13 @@ func Xqfbuf_test(cchar)
|
|||||||
call assert_equal(qfbnum, bufnr(''))
|
call assert_equal(qfbnum, bufnr(''))
|
||||||
Xclose
|
Xclose
|
||||||
|
|
||||||
|
" When quickfix buffer is wiped out, getqflist() should return 0
|
||||||
|
%bw!
|
||||||
|
Xexpr ""
|
||||||
|
Xopen
|
||||||
|
bw!
|
||||||
|
call assert_equal(0, g:Xgetlist({'qfbufnr': 0}).qfbufnr)
|
||||||
|
|
||||||
if a:cchar == 'l'
|
if a:cchar == 'l'
|
||||||
%bwipe
|
%bwipe
|
||||||
" For a location list, when both the file window and the location list
|
" For a location list, when both the file window and the location list
|
||||||
|
@ -753,6 +753,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3762,
|
||||||
/**/
|
/**/
|
||||||
3761,
|
3761,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user