comparison src/quickfix.c @ 14299:932dde1d8a71 v8.1.0165

patch 8.1.0165: :clist output can be very long commit https://github.com/vim/vim/commit/4cde86c2ef885e82fff3d925dee9fb5671c025cf Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 8 16:01:08 2018 +0200 patch 8.1.0165: :clist output can be very long Problem: :clist output can be very long. Solution: Support filtering :clist entries. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Sun, 08 Jul 2018 16:15:05 +0200
parents ca6ccee4823f
children 3c80092eb211
comparison
equal deleted inserted replaced
14298:4a588e3afd4a 14299:932dde1d8a71
3049 char_u *arg = eap->arg; 3049 char_u *arg = eap->arg;
3050 int plus = FALSE; 3050 int plus = FALSE;
3051 int qfFileAttr; 3051 int qfFileAttr;
3052 int qfSepAttr; 3052 int qfSepAttr;
3053 int qfLineAttr; 3053 int qfLineAttr;
3054 int filter_entry;
3054 int all = eap->forceit; /* if not :cl!, only show 3055 int all = eap->forceit; /* if not :cl!, only show
3055 recognised errors */ 3056 recognised errors */
3056 qf_info_T *qi = &ql_info; 3057 qf_info_T *qi = &ql_info;
3057 3058
3058 if (eap->cmdidx == CMD_llist) 3059 if (eap->cmdidx == CMD_llist)
3118 qfp = qi->qf_lists[qi->qf_curlist].qf_start; 3119 qfp = qi->qf_lists[qi->qf_curlist].qf_start;
3119 for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; ) 3120 for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; )
3120 { 3121 {
3121 if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2) 3122 if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2)
3122 { 3123 {
3123 msg_putchar('\n');
3124 if (got_int) 3124 if (got_int)
3125 break; 3125 break;
3126 3126
3127 fname = NULL; 3127 fname = NULL;
3128 if (qfp->qf_module != NULL && *qfp->qf_module != NUL) 3128 if (qfp->qf_module != NULL && *qfp->qf_module != NUL)
3139 sprintf((char *)IObuff, "%2d", i); 3139 sprintf((char *)IObuff, "%2d", i);
3140 else 3140 else
3141 vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", 3141 vim_snprintf((char *)IObuff, IOSIZE, "%2d %s",
3142 i, (char *)fname); 3142 i, (char *)fname);
3143 } 3143 }
3144
3145 // Support for filtering entries using :filter /pat/ clist
3146 filter_entry = 1;
3147 if (qfp->qf_module != NULL && *qfp->qf_module != NUL)
3148 filter_entry &= message_filtered(qfp->qf_module);
3149 if (fname != NULL)
3150 filter_entry &= message_filtered(fname);
3151 if (qfp->qf_pattern != NULL)
3152 filter_entry &= message_filtered(qfp->qf_pattern);
3153 filter_entry &= message_filtered(qfp->qf_text);
3154 if (filter_entry)
3155 goto next_entry;
3156
3157 msg_putchar('\n');
3144 msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index 3158 msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index
3145 ? HL_ATTR(HLF_QFL) : qfFileAttr); 3159 ? HL_ATTR(HLF_QFL) : qfFileAttr);
3146 3160
3147 if (qfp->qf_lnum != 0) 3161 if (qfp->qf_lnum != 0)
3148 msg_puts_attr((char_u *)":", qfSepAttr); 3162 msg_puts_attr((char_u *)":", qfSepAttr);
3173 IObuff, IOSIZE); 3187 IObuff, IOSIZE);
3174 msg_prt_line(IObuff, FALSE); 3188 msg_prt_line(IObuff, FALSE);
3175 out_flush(); /* show one line at a time */ 3189 out_flush(); /* show one line at a time */
3176 } 3190 }
3177 3191
3192 next_entry:
3178 qfp = qfp->qf_next; 3193 qfp = qfp->qf_next;
3179 if (qfp == NULL) 3194 if (qfp == NULL)
3180 break; 3195 break;
3181 ++i; 3196 ++i;
3182 ui_breakcheck(); 3197 ui_breakcheck();
4184 if (qi == NULL) 4199 if (qi == NULL)
4185 goto cleanup; 4200 goto cleanup;
4186 } 4201 }
4187 if (res >= 0) 4202 if (res >= 0)
4188 qf_list_changed(qi, qi->qf_curlist); 4203 qf_list_changed(qi, qi->qf_curlist);
4204
4189 // Remember the current quickfix list identifier, so that we can 4205 // Remember the current quickfix list identifier, so that we can
4190 // check for autocommands changing the current quickfix list. 4206 // check for autocommands changing the current quickfix list.
4191 save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; 4207 save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
4192 if (au_name != NULL) 4208 if (au_name != NULL)
4193 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, 4209 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,