0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number

Problem:    Quickfix buffer shows up in list, can't get buffer number.
Solution:   Make the quickfix buffer unlisted when the quickfix window is
            closed.  get the quickfix buffer number with getqflist().
            (Yegappan Lakshmanan, closes #4113)
This commit is contained in:
Bram Moolenaar
2019-03-17 16:39:46 +01:00
parent 38db5276cd
commit 647e24ba3d
6 changed files with 81 additions and 26 deletions

View File

@@ -5907,7 +5907,8 @@ enum {
QF_GETLIST_SIZE = 0x80,
QF_GETLIST_TICK = 0x100,
QF_GETLIST_FILEWINID = 0x200,
QF_GETLIST_ALL = 0x3FF,
QF_GETLIST_QFBUFNR = 0x400,
QF_GETLIST_ALL = 0x7FF,
};
/*
@@ -5976,6 +5977,17 @@ qf_winid(qf_info_T *qi)
return 0;
}
/*
* 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.
*/
static int
qf_getprop_qfbufnr(qf_info_T *qi, dict_T *retdict)
{
return dict_add_number(retdict, "qfbufnr",
(qi == NULL) ? 0 : qi->qf_bufnr);
}
/*
* Convert the keys in 'what' to quickfix list property flags.
*/
@@ -6022,6 +6034,9 @@ qf_getprop_keys2flags(dict_T *what, int loclist)
if (loclist && dict_find(what, (char_u *)"filewinid", -1) != NULL)
flags |= QF_GETLIST_FILEWINID;
if (dict_find(what, (char_u *)"qfbufnr", -1) != NULL)
flags |= QF_GETLIST_QFBUFNR;
return flags;
}
@@ -6114,6 +6129,8 @@ qf_getprop_defaults(qf_info_T *qi, int flags, int locstack, dict_T *retdict)
status = dict_add_number(retdict, "changedtick", 0);
if ((status == OK) && locstack && (flags & QF_GETLIST_FILEWINID))
status = dict_add_number(retdict, "filewinid", 0);
if ((status == OK) && (flags & QF_GETLIST_QFBUFNR))
status = qf_getprop_qfbufnr(qi, retdict);
return status;
}
@@ -6259,6 +6276,8 @@ qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict)
status = dict_add_number(retdict, "changedtick", qfl->qf_changedtick);
if ((status == OK) && (wp != NULL) && (flags & QF_GETLIST_FILEWINID))
status = qf_getprop_filewinid(wp, qi, retdict);
if ((status == OK) && (flags & QF_GETLIST_QFBUFNR))
status = qf_getprop_qfbufnr(qi, retdict);
return status;
}