Patch 7.4.2049
Problem:There is no way to get a list of the error lists.
Solution: Add ":chistory" and ":lhistory".
Files: src/ex_cmds.h, src/quickfix.c, src/ex_docmd.c, src/message.c,
src/proto/quickfix.pro, src/testdir/test_quickfix.vim
*** ../vim-7.4.2048/src/ex_cmds.h 2016-07-09 17:55:24.902980302 +0200
--- src/ex_cmds.h 2016-07-16 15:05:59.091544898 +0200
***
*** 310,315
--- 310,318
EX(CMD_checktime, "checktime",ex_checktime,
RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR,
ADDR_LINES),
+ EX(CMD_chistory, "chistory", qf_history,
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_clist, "clist",qf_list,
BANG|EXTRA|TRLBAR|CMDWIN,
ADDR_LINES),
***
*** 784,789
--- 787,795
EX(CMD_lhelpgrep, "lhelpgrep",ex_helpgrep,
EXTRA|NOTRLCOM|NEEDARG,
ADDR_LINES),
+ EX(CMD_lhistory, "lhistory", qf_history,
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_ll,"ll", ex_cc,
RANGE|NOTADR|COUNT|TRLBAR|BANG,
ADDR_LINES),
*** ../vim-7.4.2048/src/quickfix.c 2016-07-16 14:20:39.871128402 +0200
--- src/quickfix.c 2016-07-16 15:52:36.551749815 +0200
***
*** 120,126
static void ll_free_all(qf_info_T **pqi);
static intqf_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 intqf_get_fnum(qf_info_T *qi, char_u *, char_u *);
--- 120,125
***
*** 2544,2549
--- 2543,2571
buf[i] = NUL;
}
+ static void
+ qf_msg(qf_info_T *qi, int which, char *lead)
+ {
+ char *title = (char *)qi->qf_lists[which].qf_title;
+ intcount = 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,2610
++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);
#ifdef FEAT_WINDOWS
qf_update_buffer(qi, NULL);
#endif
}
/*
* Free error list "idx".
*/
--- 2613,2640
++qi->qf_curlist;
}
}
! 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".
*/
*** ../vim-7.4.2048/src/ex_docmd.c 2016-07-16 14:46:51.123240668 +0200
--- src/ex_docmd.c 2016-07-16 15:06:36.259177513 +0200
***
*** 122,127
--- 122,128
# define ex_cfile ex_ni
# define qf_list ex_ni
# define qf_age ex_ni
+ # define qf_history ex_ni
# define ex_helpgrep ex_ni
# define ex_vimgrep ex_ni
#endif
*** ../vim-7.4.2048/src/message.c 2016-07-12 21:11:28.711223556 +0200
--- src/message.c 2016-07-16 16:23:29.289072151 +0200
***
*** 313,321
len += n;
}
! /* Set the middle and copy the last part. */
! if (e + 3 < buflen)
{
mch_memmove(buf + e, "...", (size_t)3);
len = (int)STRLEN(s + i) + 1;
if (len >= buflen - e - 3)
--- 313,337
le