vim-patch:7.4.1591

Problem:    The quickfix title is truncated.
Solution:   Save the command before it is truncated. (Anton Lindqvist)

5584df65a0
This commit is contained in:
James McCoy 2016-11-11 10:59:01 -05:00
parent 0213e99aaf
commit 7baa96b717
3 changed files with 26 additions and 2 deletions

View File

@ -2970,6 +2970,7 @@ void ex_vimgrep(exarg_T *eap)
/* Get the search pattern: either white-separated or enclosed in // */
regmatch.regprog = NULL;
char_u *title = vim_strsave(*eap->cmdlinep);
p = skip_vimgrep_pat(eap->arg, &s, &flags);
if (p == NULL) {
EMSG(_(e_invalpat));
@ -3001,7 +3002,7 @@ void ex_vimgrep(exarg_T *eap)
&& eap->cmdidx != CMD_vimgrepadd && eap->cmdidx != CMD_lvimgrepadd)
|| qi->qf_curlist == qi->qf_listcount) {
// make place for a new list
qf_new_list(qi, *eap->cmdlinep);
qf_new_list(qi, title != NULL ? title : *eap->cmdlinep);
} else if (qi->qf_lists[qi->qf_curlist].qf_count > 0) {
// Adding to existing list, find last entry.
for (prevp = qi->qf_lists[qi->qf_curlist].qf_start;
@ -3229,6 +3230,7 @@ void ex_vimgrep(exarg_T *eap)
}
theend:
xfree(title);
xfree(dirname_now);
xfree(dirname_start);
xfree(target_dir);

View File

@ -853,7 +853,7 @@ static int included_patches[] = {
// 1594 NA
// 1593 NA
1592,
// 1591,
1591,
// 1590,
// 1589,
1588,

View File

@ -389,6 +389,23 @@ describe('helpgrep', function()
augroup! testgroup
endfunction
func Test_vimgreptitle()
augroup QfBufWinEnter
au!
au BufWinEnter * :let g:a=get(w:, 'quickfix_title', 'NONE')
augroup END
try
vimgrep /pattern/j file
catch /E480/
endtry
copen
call assert_equal(': vimgrep /pattern/j file', g:a)
augroup QfBufWinEnter
au!
augroup END
augroup! QfBufWinEnter
endfunc
]])
end)
@ -447,6 +464,11 @@ describe('helpgrep', function()
eq(':setqflist()', eval('g:foo'))
end)
it('does not truncate quickfix title', function()
call('Test_vimgreptitle')
expected_empty()
end)
it('errors when an autocommand closes the location list\'s window', function()
call('Test_locationlist_curwin_was_closed')
expected_empty()