mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 16:58:17 +00:00
vim-patch:8.1.1281: cannot specify a count with :chistory
Problem: Cannot specify a count with :chistory.
Solution: Add a count to :chistory and :lhistory. (Yegappan Lakshmanan,
closes vim/vim#4344)
8ffc7c8b5f
This commit is contained in:
@@ -836,14 +836,19 @@ lists. They set one of the existing error lists as the current one.
|
||||
the current window instead of the quickfix list.
|
||||
|
||||
*:chistory* *:chi*
|
||||
:chi[story] Show the list of error lists. The current list is
|
||||
:[count]chi[story] Show the list of error lists. The current list is
|
||||
marked with ">". The output looks like:
|
||||
error list 1 of 3; 43 errors ~
|
||||
> error list 2 of 3; 0 errors ~
|
||||
error list 3 of 3; 15 errors ~
|
||||
|
||||
When [count] is given, then the count'th quickfix
|
||||
list is made the current list. Example: >
|
||||
" Make the 4th quickfix list current
|
||||
:4chistory
|
||||
<
|
||||
*:lhistory* *:lhi*
|
||||
:lhi[story] Show the list of location lists, otherwise like
|
||||
:[count]lhi[story] Show the list of location lists, otherwise like
|
||||
`:chistory`.
|
||||
|
||||
When adding a new error list, it becomes the current list.
|
||||
|
@@ -490,8 +490,8 @@ module.cmds = {
|
||||
},
|
||||
{
|
||||
command='chistory',
|
||||
flags=bit.bor(TRLBAR),
|
||||
addr_type='ADDR_NONE',
|
||||
flags=bit.bor(RANGE, COUNT, TRLBAR),
|
||||
addr_type='ADDR_UNSIGNED',
|
||||
func='qf_history',
|
||||
},
|
||||
{
|
||||
@@ -1470,8 +1470,8 @@ module.cmds = {
|
||||
},
|
||||
{
|
||||
command='lhistory',
|
||||
flags=bit.bor(TRLBAR),
|
||||
addr_type='ADDR_NONE',
|
||||
flags=bit.bor(RANGE, COUNT, TRLBAR),
|
||||
addr_type='ADDR_UNSIGNED',
|
||||
func='qf_history',
|
||||
},
|
||||
{
|
||||
|
@@ -3300,6 +3300,24 @@ void qf_history(exarg_T *eap)
|
||||
qf_info_T *qi = qf_cmd_get_stack(eap, false);
|
||||
int i;
|
||||
|
||||
if (eap->addr_count > 0) {
|
||||
if (qi == NULL) {
|
||||
EMSG(_(e_loclist));
|
||||
return;
|
||||
}
|
||||
|
||||
// Jump to the specified quickfix list
|
||||
if (eap->line2 > 0 && eap->line2 <= qi->qf_listcount) {
|
||||
qi->qf_curlist = (int)(eap->line2 - 1);
|
||||
qf_msg(qi, qi->qf_curlist, "");
|
||||
qf_update_buffer(qi, NULL);
|
||||
} else {
|
||||
EMSG(_(e_invrange));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (qf_stack_empty(qi)) {
|
||||
MSG(_("No entries"));
|
||||
} else {
|
||||
|
@@ -1918,9 +1918,23 @@ func HistoryTest(cchar)
|
||||
call assert_equal(' error list 2 of 3; 2 ' . common, res[1])
|
||||
call assert_equal('> error list 3 of 3; 3 ' . common, res[2])
|
||||
|
||||
" Test for changing the quickfix lists
|
||||
call assert_equal(3, g:Xgetlist({'nr' : 0}).nr)
|
||||
exe '1' . a:cchar . 'hist'
|
||||
call assert_equal(1, g:Xgetlist({'nr' : 0}).nr)
|
||||
exe '3' . a:cchar . 'hist'
|
||||
call assert_equal(3, g:Xgetlist({'nr' : 0}).nr)
|
||||
call assert_fails('-2' . a:cchar . 'hist', 'E16:')
|
||||
call assert_fails('4' . a:cchar . 'hist', 'E16:')
|
||||
|
||||
call g:Xsetlist([], 'f')
|
||||
let l = split(execute(a:cchar . 'hist'), "\n")
|
||||
call assert_equal('No entries', l[0])
|
||||
if a:cchar == 'c'
|
||||
call assert_fails('4chist', 'E16:')
|
||||
else
|
||||
call assert_fails('4lhist', 'E776:')
|
||||
endif
|
||||
|
||||
" An empty list should still show the stack history
|
||||
call g:Xsetlist([])
|
||||
|
Reference in New Issue
Block a user