comparison src/quickfix.c @ 16019:096b8ccd855e v8.1.1015

patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number commit https://github.com/vim/vim/commit/647e24ba3dbf7ff448aa471b1a659a18267ae056 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 17 16:39:46 2019 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 Mar 2019 16:45:11 +0100
parents 416e067411ab
children c19853508d3e
comparison
equal deleted inserted replaced
16018:aa208549a80b 16019:096b8ccd855e
5905 QF_GETLIST_ID = 0x20, 5905 QF_GETLIST_ID = 0x20,
5906 QF_GETLIST_IDX = 0x40, 5906 QF_GETLIST_IDX = 0x40,
5907 QF_GETLIST_SIZE = 0x80, 5907 QF_GETLIST_SIZE = 0x80,
5908 QF_GETLIST_TICK = 0x100, 5908 QF_GETLIST_TICK = 0x100,
5909 QF_GETLIST_FILEWINID = 0x200, 5909 QF_GETLIST_FILEWINID = 0x200,
5910 QF_GETLIST_ALL = 0x3FF, 5910 QF_GETLIST_QFBUFNR = 0x400,
5911 QF_GETLIST_ALL = 0x7FF,
5911 }; 5912 };
5912 5913
5913 /* 5914 /*
5914 * Parse text from 'di' and return the quickfix list items. 5915 * Parse text from 'di' and return the quickfix list items.
5915 * Existing quickfix lists are not modified. 5916 * Existing quickfix lists are not modified.
5975 return win->w_id; 5976 return win->w_id;
5976 return 0; 5977 return 0;
5977 } 5978 }
5978 5979
5979 /* 5980 /*
5981 * Returns the number of the buffer displayed in the quickfix/location list
5982 * window. If there is no buffer associated with the list, then returns 0.
5983 */
5984 static int
5985 qf_getprop_qfbufnr(qf_info_T *qi, dict_T *retdict)
5986 {
5987 return dict_add_number(retdict, "qfbufnr",
5988 (qi == NULL) ? 0 : qi->qf_bufnr);
5989 }
5990
5991 /*
5980 * Convert the keys in 'what' to quickfix list property flags. 5992 * Convert the keys in 'what' to quickfix list property flags.
5981 */ 5993 */
5982 static int 5994 static int
5983 qf_getprop_keys2flags(dict_T *what, int loclist) 5995 qf_getprop_keys2flags(dict_T *what, int loclist)
5984 { 5996 {
6019 if (dict_find(what, (char_u *)"changedtick", -1) != NULL) 6031 if (dict_find(what, (char_u *)"changedtick", -1) != NULL)
6020 flags |= QF_GETLIST_TICK; 6032 flags |= QF_GETLIST_TICK;
6021 6033
6022 if (loclist && dict_find(what, (char_u *)"filewinid", -1) != NULL) 6034 if (loclist && dict_find(what, (char_u *)"filewinid", -1) != NULL)
6023 flags |= QF_GETLIST_FILEWINID; 6035 flags |= QF_GETLIST_FILEWINID;
6036
6037 if (dict_find(what, (char_u *)"qfbufnr", -1) != NULL)
6038 flags |= QF_GETLIST_QFBUFNR;
6024 6039
6025 return flags; 6040 return flags;
6026 } 6041 }
6027 6042
6028 /* 6043 /*
6112 status = dict_add_number(retdict, "size", 0); 6127 status = dict_add_number(retdict, "size", 0);
6113 if ((status == OK) && (flags & QF_GETLIST_TICK)) 6128 if ((status == OK) && (flags & QF_GETLIST_TICK))
6114 status = dict_add_number(retdict, "changedtick", 0); 6129 status = dict_add_number(retdict, "changedtick", 0);
6115 if ((status == OK) && locstack && (flags & QF_GETLIST_FILEWINID)) 6130 if ((status == OK) && locstack && (flags & QF_GETLIST_FILEWINID))
6116 status = dict_add_number(retdict, "filewinid", 0); 6131 status = dict_add_number(retdict, "filewinid", 0);
6132 if ((status == OK) && (flags & QF_GETLIST_QFBUFNR))
6133 status = qf_getprop_qfbufnr(qi, retdict);
6117 6134
6118 return status; 6135 return status;
6119 } 6136 }
6120 6137
6121 /* 6138 /*
6257 status = dict_add_number(retdict, "size", qfl->qf_count); 6274 status = dict_add_number(retdict, "size", qfl->qf_count);
6258 if ((status == OK) && (flags & QF_GETLIST_TICK)) 6275 if ((status == OK) && (flags & QF_GETLIST_TICK))
6259 status = dict_add_number(retdict, "changedtick", qfl->qf_changedtick); 6276 status = dict_add_number(retdict, "changedtick", qfl->qf_changedtick);
6260 if ((status == OK) && (wp != NULL) && (flags & QF_GETLIST_FILEWINID)) 6277 if ((status == OK) && (wp != NULL) && (flags & QF_GETLIST_FILEWINID))
6261 status = qf_getprop_filewinid(wp, qi, retdict); 6278 status = qf_getprop_filewinid(wp, qi, retdict);
6279 if ((status == OK) && (flags & QF_GETLIST_QFBUFNR))
6280 status = qf_getprop_qfbufnr(qi, retdict);
6262 6281
6263 return status; 6282 return status;
6264 } 6283 }
6265 6284
6266 /* 6285 /*