diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-16 16:54:24 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-16 16:54:24 +0200 |
commit | f6acffbe83e622542d9fdf3066f51933e46e4954 (patch) | |
tree | 70664752ad37e9760fa63ce2c0f432896022628c /src/quickfix.c | |
parent | a06ecab7a5159e744448ace731036f0dc5f87dd4 (diff) | |
download | vim-f6acffbe83e622542d9fdf3066f51933e46e4954.zip |
patch 7.4.2049
Problem: There is no way to get a list of the error lists.
Solution: Add ":chistory" and ":lhistory".
Diffstat (limited to 'src/quickfix.c')
-rw-r--r-- | src/quickfix.c | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/src/quickfix.c b/src/quickfix.c index 689897554..1fb47a009 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -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". */ |