1
0
forked from aniani/vim

patch 7.4.2049

Problem:    There is no way to get a list of the error lists.
Solution:   Add ":chistory" and ":lhistory".
This commit is contained in:
Bram Moolenaar
2016-07-16 16:54:24 +02:00
parent a06ecab7a5
commit f6acffbe83
7 changed files with 94 additions and 13 deletions

View File

@@ -120,7 +120,6 @@ static void qf_new_list(qf_info_T *qi, char_u *qf_title);
static void ll_free_all(qf_info_T **pqi);
static int qf_add_entry(qf_info_T *qi, char_u *dir, char_u *fname, int bufnum, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid);
static qf_info_T *ll_new_list(void);
static void qf_msg(qf_info_T *qi);
static void qf_free(qf_info_T *qi, int idx);
static char_u *qf_types(int, int);
static int qf_get_fnum(qf_info_T *qi, char_u *, char_u *);
@@ -2544,6 +2543,29 @@ qf_fmt_text(char_u *text, char_u *buf, int bufsize)
buf[i] = NUL;
}
static void
qf_msg(qf_info_T *qi, int which, char *lead)
{
char *title = (char *)qi->qf_lists[which].qf_title;
int count = qi->qf_lists[which].qf_count;
char_u buf[IOSIZE];
vim_snprintf((char *)buf, IOSIZE, _("%serror list %d of %d; %d errors "),
lead,
which + 1,
qi->qf_listcount,
count);
if (title != NULL)
{
while (STRLEN(buf) < 34)
STRCAT(buf, " ");
STRCAT(buf, title);
}
trunc_string(buf, buf, Columns - 1, IOSIZE);
msg(buf);
}
/*
* ":colder [count]": Up in the quickfix stack.
* ":cnewer [count]": Down in the quickfix stack.
@@ -2591,20 +2613,28 @@ qf_age(exarg_T *eap)
++qi->qf_curlist;
}
}
qf_msg(qi);
}
static void
qf_msg(qf_info_T *qi)
{
smsg((char_u *)_("error list %d of %d; %d errors"),
qi->qf_curlist + 1, qi->qf_listcount,
qi->qf_lists[qi->qf_curlist].qf_count);
qf_msg(qi, qi->qf_curlist, "");
#ifdef FEAT_WINDOWS
qf_update_buffer(qi, NULL);
#endif
}
void
qf_history(exarg_T *eap)
{
qf_info_T *qi = &ql_info;
int i;
if (eap->cmdidx == CMD_lhistory)
qi = GET_LOC_LIST(curwin);
if (qi == NULL || (qi->qf_listcount == 0
&& qi->qf_lists[qi->qf_curlist].qf_count == 0))
MSG(_("No entries"));
else
for (i = 0; i < qi->qf_listcount; ++i)
qf_msg(qi, i, i == qi->qf_curlist ? "> " : " ");
}
/*
* Free error list "idx".
*/