From ff244a1309482e818c6731038f0232fae613431c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 21 Jun 2019 22:44:33 -0400 Subject: vim-patch:8.1.0165: :clist output can be very long Problem: :clist output can be very long. Solution: Support filtering :clist entries. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/4cde86c2ef885e82fff3d925dee9fb5671c025cf --- src/nvim/quickfix.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/nvim/quickfix.c') diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 3c744310b3..fb753609bd 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,23 @@ void qf_list(exarg_T *eap) vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", i, (char *)fname); } } + + // Support for filtering entries using :filter /pat/ clist + int filter_entry = 1; + if (qfp->qf_module != NULL && *qfp->qf_module != NUL) { + filter_entry &= message_filtered(qfp->qf_module); + } + if (fname != NULL) { + filter_entry &= message_filtered(fname); + } + if (qfp->qf_pattern != NULL) { + filter_entry &= message_filtered(qfp->qf_pattern); + } + 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 +2596,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; -- cgit From 98801ec7aea199b80373d1dc072021a98db63a8b Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 22 Jun 2019 04:30:48 -0400 Subject: vim-patch:8.1.0166: using dict_add_nr_str() is clumsy Problem: Using dict_add_nr_str() is clumsy. Solution: Split into two functions. (Ozaki Kiichi, closes vim/vim#3154) https://github.com/vim/vim/commit/e0be167a805fd547c25ec1ec97fd4c7f13046236 --- src/nvim/quickfix.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/nvim/quickfix.c') diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index fb753609bd..81da410826 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -4739,11 +4739,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 -- cgit From 3a49fa8f8b348b48e90860ec3fdf005d301ba9d0 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 22 Jun 2019 06:28:49 -0400 Subject: vim-patch:8.1.0169: calling message_filtered() a bit too often Problem: Calling message_filtered() a bit too often. Solution: Only call message_filtered() when filtering is already false. https://github.com/vim/vim/commit/a9defadb8f03ecd03f3297305d5482ba380774dc --- src/nvim/quickfix.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/nvim/quickfix.c') diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 81da410826..6779f4e05d 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -2551,17 +2551,21 @@ void qf_list(exarg_T *eap) } // Support for filtering entries using :filter /pat/ clist - int filter_entry = 1; + // 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 (fname != NULL) { + if (filter_entry && fname != NULL) { filter_entry &= message_filtered(fname); } - if (qfp->qf_pattern != NULL) { + if (filter_entry && qfp->qf_pattern != NULL) { filter_entry &= message_filtered(qfp->qf_pattern); } - filter_entry &= message_filtered(qfp->qf_text); + if (filter_entry) { + filter_entry &= message_filtered(qfp->qf_text); + } if (filter_entry) { goto next_entry; } -- cgit