mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 23:38:17 +00:00
vim-patch:7.4.2049
Problem: There is no way to get a list of the error lists.
Solution: Add ":chistory" and ":lhistory".
f6acffbe83
This commit is contained in:
@@ -461,6 +461,12 @@ return {
|
|||||||
addr_type=ADDR_LINES,
|
addr_type=ADDR_LINES,
|
||||||
func='ex_checktime',
|
func='ex_checktime',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
command='chistory',
|
||||||
|
flags=bit.bor(TRLBAR),
|
||||||
|
addr_type=ADDR_LINES,
|
||||||
|
func='qf_history',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
command='clist',
|
command='clist',
|
||||||
flags=bit.bor(BANG, EXTRA, TRLBAR, CMDWIN),
|
flags=bit.bor(BANG, EXTRA, TRLBAR, CMDWIN),
|
||||||
@@ -1399,6 +1405,12 @@ return {
|
|||||||
addr_type=ADDR_LINES,
|
addr_type=ADDR_LINES,
|
||||||
func='ex_helpgrep',
|
func='ex_helpgrep',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
command='lhistory',
|
||||||
|
flags=bit.bor(TRLBAR),
|
||||||
|
addr_type=ADDR_LINES,
|
||||||
|
func='qf_history',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
command='ll',
|
command='ll',
|
||||||
flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG),
|
flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG),
|
||||||
|
@@ -297,8 +297,22 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)
|
|||||||
len += n;
|
len += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the middle and copy the last part. */
|
if (i <= e + 3) {
|
||||||
if (e + 3 < buflen) {
|
// text fits without truncating
|
||||||
|
if (s != buf) {
|
||||||
|
len = STRLEN(s);
|
||||||
|
if (len >= buflen) {
|
||||||
|
len = buflen - 1;
|
||||||
|
}
|
||||||
|
len = len - e + 1;
|
||||||
|
if (len < 1) {
|
||||||
|
buf[e - 1] = NUL;
|
||||||
|
} else {
|
||||||
|
memmove(buf + e, s + e, len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (e + 3 < buflen) {
|
||||||
|
// set the middle and copy the last part
|
||||||
memmove(buf + e, "...", (size_t)3);
|
memmove(buf + e, "...", (size_t)3);
|
||||||
len = (int)STRLEN(s + i) + 1;
|
len = (int)STRLEN(s + i) + 1;
|
||||||
if (len >= buflen - e - 3)
|
if (len >= buflen - e - 3)
|
||||||
@@ -306,7 +320,8 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)
|
|||||||
memmove(buf + e + 3, s + i, len);
|
memmove(buf + e + 3, s + i, len);
|
||||||
buf[e + 3 + len - 1] = NUL;
|
buf[e + 3 + len - 1] = NUL;
|
||||||
} else {
|
} else {
|
||||||
buf[e - 1] = NUL; /* make sure it is truncated */
|
// can't fit in the "...", just truncate it
|
||||||
|
buf[e - 1] = NUL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2105,6 +2105,28 @@ static void qf_fmt_text(char_u *text, char_u *buf, int bufsize)
|
|||||||
buf[i] = NUL;
|
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.
|
* ":colder [count]": Up in the quickfix stack.
|
||||||
* ":cnewer [count]": Down in the quickfix stack.
|
* ":cnewer [count]": Down in the quickfix stack.
|
||||||
@@ -2145,15 +2167,26 @@ void qf_age(exarg_T *eap)
|
|||||||
++qi->qf_curlist;
|
++qi->qf_curlist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qf_msg(qi);
|
qf_msg(qi, qi->qf_curlist, "");
|
||||||
|
qf_update_buffer(qi, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qf_msg(qf_info_T *qi)
|
void qf_history(exarg_T *eap)
|
||||||
{
|
{
|
||||||
smsg(_("error list %d of %d; %d errors"),
|
qf_info_T *qi = &ql_info;
|
||||||
qi->qf_curlist + 1, qi->qf_listcount,
|
int i;
|
||||||
qi->qf_lists[qi->qf_curlist].qf_count);
|
|
||||||
qf_update_buffer(qi, NULL);
|
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 ? "> " : " ");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -1420,3 +1420,27 @@ function Test_cbottom()
|
|||||||
call XbottomTests('c')
|
call XbottomTests('c')
|
||||||
call XbottomTests('l')
|
call XbottomTests('l')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function HistoryTest(cchar)
|
||||||
|
call s:setup_commands(a:cchar)
|
||||||
|
|
||||||
|
call assert_fails(a:cchar . 'older 99', 'E380:')
|
||||||
|
" clear all lists after the first one, then replace the first one.
|
||||||
|
call g:Xsetlist([])
|
||||||
|
Xolder
|
||||||
|
let entry = {'filename': 'foo', 'lnum': 42}
|
||||||
|
call g:Xsetlist([entry], 'r')
|
||||||
|
call g:Xsetlist([entry, entry])
|
||||||
|
call g:Xsetlist([entry, entry, entry])
|
||||||
|
let res = split(execute(a:cchar . 'hist'), "\n")
|
||||||
|
call assert_equal(3, len(res))
|
||||||
|
let common = 'errors :set' . (a:cchar == 'c' ? 'qf' : 'loc') . 'list()'
|
||||||
|
call assert_equal(' error list 1 of 3; 1 ' . common, res[0])
|
||||||
|
call assert_equal(' error list 2 of 3; 2 ' . common, res[1])
|
||||||
|
call assert_equal('> error list 3 of 3; 3 ' . common, res[2])
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_history()
|
||||||
|
call HistoryTest('c')
|
||||||
|
call HistoryTest('l')
|
||||||
|
endfunc
|
||||||
|
@@ -391,7 +391,7 @@ static int included_patches[] = {
|
|||||||
// 2052 NA
|
// 2052 NA
|
||||||
// 2051,
|
// 2051,
|
||||||
// 2050,
|
// 2050,
|
||||||
// 2049,
|
2049,
|
||||||
// 2048 NA
|
// 2048 NA
|
||||||
// 2047,
|
// 2047,
|
||||||
// 2046,
|
// 2046,
|
||||||
|
Reference in New Issue
Block a user