Skip to content

Commit

Permalink
patch 7.4.1591
Browse files Browse the repository at this point in the history
Problem:    The quickfix title is truncated.
Solution:   Save the command before it is truncated. (Anton Lindqvist)
  • Loading branch information
brammool committed Mar 18, 2016
1 parent 3f242a8 commit 5584df6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/quickfix.c
Original file line number Diff line number Diff line change
Expand Up @@ -3286,6 +3286,7 @@ ex_vimgrep(exarg_T *eap)
int fcount;
char_u **fnames;
char_u *fname;
char_u *title;
char_u *s;
char_u *p;
int fi;
Expand Down Expand Up @@ -3354,6 +3355,7 @@ ex_vimgrep(exarg_T *eap)

/* Get the search pattern: either white-separated or enclosed in // */
regmatch.regprog = NULL;
title = vim_strsave(*eap->cmdlinep);
p = skip_vimgrep_pat(eap->arg, &s, &flags);
if (p == NULL)
{
Expand Down Expand Up @@ -3390,7 +3392,7 @@ 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;
Expand Down Expand Up @@ -3669,6 +3671,7 @@ ex_vimgrep(exarg_T *eap)
}

theend:
vim_free(title);
vim_free(dirname_now);
vim_free(dirname_start);
vim_free(target_dir);
Expand Down
17 changes: 17 additions & 0 deletions src/testdir/test_quickfix.vim
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,23 @@ func Test_errortitle()
augroup! QfBufWinEnter
endfunc

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

function XqfTitleTests(cchar)
let Xgetexpr = a:cchar . 'getexpr'
if a:cchar == 'c'
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1591,
/**/
1590,
/**/
Expand Down

0 comments on commit 5584df6

Please sign in to comment.