diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-06-24 02:35:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-24 02:35:25 +0200 |
commit | 7d604a1e6158cda79f7ac485e0ef0e349014f8bf (patch) | |
tree | 4234b4bc08bfa6023b91f385642d899266bc825a /src/nvim/quickfix.c | |
parent | 9fd4a0b52697db053143f51822e68da95c6886aa (diff) | |
parent | fa3db26f100bcb1c27b62b491bd63aed0800795b (diff) | |
download | rneovim-7d604a1e6158cda79f7ac485e0ef0e349014f8bf.tar.gz rneovim-7d604a1e6158cda79f7ac485e0ef0e349014f8bf.tar.bz2 rneovim-7d604a1e6158cda79f7ac485e0ef0e349014f8bf.zip |
Merge #10294 from janlazo/vim-8.0.1239
vim-patch:8.0.1239,8.1.{112,125,165,166,167,169,181,242,270,272,747,850,853,1519}
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 3c744310b3..6779f4e05d 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -2528,9 +2528,9 @@ void qf_list(exarg_T *eap) qfp = qi->qf_lists[qi->qf_curlist].qf_start; for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; ) { if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2) { - msg_putchar('\n'); - if (got_int) + if (got_int) { break; + } fname = NULL; if (qfp->qf_module != NULL && *qfp->qf_module != NUL) { @@ -2549,6 +2549,27 @@ void qf_list(exarg_T *eap) vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", i, (char *)fname); } } + + // Support for filtering entries using :filter /pat/ clist + // Match against the module name, file name, search pattern and + // text of the entry. + bool filter_entry = true; + if (qfp->qf_module != NULL && *qfp->qf_module != NUL) { + filter_entry &= message_filtered(qfp->qf_module); + } + if (filter_entry && fname != NULL) { + filter_entry &= message_filtered(fname); + } + if (filter_entry && qfp->qf_pattern != NULL) { + filter_entry &= message_filtered(qfp->qf_pattern); + } + if (filter_entry) { + filter_entry &= message_filtered(qfp->qf_text); + } + if (filter_entry) { + goto next_entry; + } + msg_putchar('\n'); msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index ? HL_ATTR(HLF_QFL) : HL_ATTR(HLF_D)); if (qfp->qf_lnum == 0) { @@ -2579,6 +2600,7 @@ void qf_list(exarg_T *eap) ui_flush(); /* show one line at a time */ } +next_entry: qfp = qfp->qf_next; if (qfp == NULL) { break; @@ -4721,11 +4743,8 @@ static int qf_getprop_defaults(qf_info_T *qi, int flags, dict_T *retdict) /// Return the quickfix list title as 'title' in retdict static int qf_getprop_title(qf_info_T *qi, int qf_idx, dict_T *retdict) { - char_u *t = qi->qf_lists[qf_idx].qf_title; - if (t == NULL) { - t = (char_u *)""; - } - return tv_dict_add_str(retdict, S_LEN("title"), (const char *)t); + return tv_dict_add_str(retdict, S_LEN("title"), + (const char *)qi->qf_lists[qf_idx].qf_title); } /// Return the quickfix list items/entries as 'items' in retdict |