patch 8.1.0165: :clist output can be very long
Problem: :clist output can be very long.
Solution: Support filtering :clist entries. (Yegappan Lakshmanan)
diff --git a/src/quickfix.c b/src/quickfix.c
index ad25297..ddb9230 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -3051,6 +3051,7 @@
int qfFileAttr;
int qfSepAttr;
int qfLineAttr;
+ int filter_entry;
int all = eap->forceit; /* if not :cl!, only show
recognised errors */
qf_info_T *qi = &ql_info;
@@ -3120,7 +3121,6 @@
{
if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2)
{
- msg_putchar('\n');
if (got_int)
break;
@@ -3141,6 +3141,20 @@
vim_snprintf((char *)IObuff, IOSIZE, "%2d %s",
i, (char *)fname);
}
+
+ // Support for filtering entries using :filter /pat/ clist
+ 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) : qfFileAttr);
@@ -3175,6 +3189,7 @@
out_flush(); /* show one line at a time */
}
+next_entry:
qfp = qfp->qf_next;
if (qfp == NULL)
break;
@@ -4186,6 +4201,7 @@
}
if (res >= 0)
qf_list_changed(qi, qi->qf_curlist);
+
// Remember the current quickfix list identifier, so that we can
// check for autocommands changing the current quickfix list.
save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;