summaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-05-13 15:29:04 +0200
committerBram Moolenaar <Bram@vim.org>2018-05-13 15:29:04 +0200
commit8b62e31003693fee4b288e7aea49170f032aeef3 (patch)
treeb0a22cbb3ae08fc2428abc3ba487ccbfc45f0d0b /src/quickfix.c
parent05c4a471d235987b914a9cc3ca44b98c46abd157 (diff)
downloadvim-git-8b62e31003693fee4b288e7aea49170f032aeef3.tar.gz
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'v8.0.1831
Problem: Sometimes the quickfix title is incorrectly prefixed with ':'. Solution: Prepend the colon in another way. (Yegappan Lakshmanan, closes #2905)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index 9e21191e7..98360d019 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -1025,6 +1025,8 @@ qf_parse_get_fields(
fields->type = 0;
*tail = NULL;
+ /* Always ignore case when looking for a matching error. */
+ regmatch.rm_ic = TRUE;
regmatch.regprog = fmt_ptr->prog;
r = vim_regexec(&regmatch, linebuf, (colnr_T)0);
fmt_ptr->prog = regmatch.regprog;
@@ -1498,11 +1500,26 @@ qf_store_title(qf_info_T *qi, int qf_idx, char_u *title)
qi->qf_lists[qf_idx].qf_title = p;
if (p != NULL)
- sprintf((char *)p, ":%s", (char *)title);
+ STRCPY(p, title);
}
}
/*
+ * The title of a quickfix/location list is set, by default, to the command
+ * that created the quickfix list with the ":" prefix.
+ * Create a quickfix list title string by prepending ":" to a user command.
+ * Returns a pointer to a static buffer with the title.
+ */
+ static char_u *
+qf_cmdtitle(char_u *cmd)
+{
+ static char_u qftitle_str[IOSIZE];
+
+ vim_snprintf((char *)qftitle_str, IOSIZE, ":%s", (char *)cmd);
+ return qftitle_str;
+}
+
+/*
* Prepare for adding a new quickfix list. If the current list is in the
* middle of the stack, then all the following lists are freed and then
* the new list is added.
@@ -4020,7 +4037,7 @@ ex_make(exarg_T *eap)
&& eap->cmdidx != CMD_lmake) ? p_gefm : p_efm,
(eap->cmdidx != CMD_grepadd
&& eap->cmdidx != CMD_lgrepadd),
- *eap->cmdlinep, enc);
+ qf_cmdtitle(*eap->cmdlinep), enc);
if (wp != NULL)
qi = GET_LOC_LIST(wp);
if (res >= 0 && qi != NULL)
@@ -4413,7 +4430,8 @@ ex_cfile(exarg_T *eap)
* quickfix list then a new list is created.
*/
res = qf_init(wp, p_ef, p_efm, (eap->cmdidx != CMD_caddfile
- && eap->cmdidx != CMD_laddfile), *eap->cmdlinep, enc);
+ && eap->cmdidx != CMD_laddfile),
+ qf_cmdtitle(*eap->cmdlinep), enc);
if (wp != NULL)
qi = GET_LOC_LIST(wp);
if (res >= 0 && qi != NULL)
@@ -4749,7 +4767,7 @@ ex_vimgrep(exarg_T *eap)
/* Get the search pattern: either white-separated or enclosed in // */
regmatch.regprog = NULL;
- title = vim_strsave(*eap->cmdlinep);
+ title = vim_strsave(qf_cmdtitle(*eap->cmdlinep));
p = skip_vimgrep_pat(eap->arg, &s, &flags);
if (p == NULL)
{
@@ -4773,7 +4791,7 @@ ex_vimgrep(exarg_T *eap)
&& eap->cmdidx != CMD_lvimgrepadd)
|| qi->qf_curlist == qi->qf_listcount)
/* make place for a new list */
- qf_new_list(qi, title != NULL ? title : *eap->cmdlinep);
+ qf_new_list(qi, title != NULL ? title : qf_cmdtitle(*eap->cmdlinep));
/* parse the list of arguments */
if (get_arglist_exp(p, &fcount, &fnames, TRUE) == FAIL)
@@ -4828,7 +4846,7 @@ ex_vimgrep(exarg_T *eap)
/* Check whether the quickfix list is still valid. When loading a
* buffer above, autocommands might have changed the quickfix list. */
- if (!vgr_qflist_valid(wp, qi, save_qfid, *eap->cmdlinep))
+ if (!vgr_qflist_valid(wp, qi, save_qfid, qf_cmdtitle(*eap->cmdlinep)))
{
FreeWild(fcount, fnames);
goto theend;
@@ -6125,7 +6143,7 @@ ex_cbuffer(exarg_T *eap)
EMSG(_(e_invrange));
else
{
- char_u *qf_title = *eap->cmdlinep;
+ char_u *qf_title = qf_cmdtitle(*eap->cmdlinep);
if (buf->b_sfname)
{
@@ -6203,8 +6221,8 @@ ex_cexpr(exarg_T *eap)
res = qf_init_ext(qi, qi->qf_curlist, NULL, NULL, tv, p_efm,
(eap->cmdidx != CMD_caddexpr
&& eap->cmdidx != CMD_laddexpr),
- (linenr_T)0, (linenr_T)0, *eap->cmdlinep,
- NULL);
+ (linenr_T)0, (linenr_T)0,
+ qf_cmdtitle(*eap->cmdlinep), NULL);
if (res >= 0)
qf_list_changed(qi, qi->qf_curlist);
if (au_name != NULL)
@@ -6476,7 +6494,7 @@ ex_helpgrep(exarg_T *eap)
if (regmatch.regprog != NULL)
{
/* create a new quickfix list */
- qf_new_list(qi, *eap->cmdlinep);
+ qf_new_list(qi, qf_cmdtitle(*eap->cmdlinep));
hgr_search_in_rtp(qi, &regmatch, eap->arg);