summaryrefslogtreecommitdiffstats
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-03-17 16:39:46 +0100
committerBram Moolenaar <Bram@vim.org>2019-03-17 16:39:46 +0100
commit647e24ba3dbf7ff448aa471b1a659a18267ae056 (patch)
tree175eac74e7e268d58fc5a37df25b649d75564bc1 /src/quickfix.c
parent38db5276cd8f45fdf3dea8997e8994676e71b105 (diff)
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer numberv8.1.1015
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)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index 6ecb75e69c..d332e2364e 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -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,
};
/*
@@ -5977,6 +5978,17 @@ qf_winid(qf_info_T *qi)
}
/*
+ * 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.
*/
static int
@@ -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;
}