1
0
forked from aniani/vim

patch 7.4.2264

Problem:    When adding entries to an empty quickfix list the title is reset.
Solution:   Improve handling of the title. (Yegappan Lakshmanan)
This commit is contained in:
Bram Moolenaar
2016-08-27 13:35:35 +02:00
parent d29459baa6
commit 2b529bb626
3 changed files with 25 additions and 2 deletions

View File

@@ -4753,11 +4753,15 @@ qf_add_entries(
} }
static int static int
qf_set_properties(qf_info_T *qi, dict_T *what) qf_set_properties(qf_info_T *qi, dict_T *what, int action)
{ {
dictitem_T *di; dictitem_T *di;
int retval = FAIL; int retval = FAIL;
int qf_idx; int qf_idx;
int newlist = FALSE;
if (action == ' ' || qi->qf_curlist == qi->qf_listcount)
newlist = TRUE;
qf_idx = qi->qf_curlist; /* default is the current list */ qf_idx = qi->qf_curlist; /* default is the current list */
if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL)
@@ -4771,6 +4775,13 @@ qf_set_properties(qf_info_T *qi, dict_T *what)
} }
else else
return FAIL; return FAIL;
newlist = FALSE; /* use the specified list */
}
if (newlist)
{
qf_new_list(qi, NULL);
qf_idx = qi->qf_curlist;
} }
if ((di = dict_find(what, (char_u *)"title", -1)) != NULL) if ((di = dict_find(what, (char_u *)"title", -1)) != NULL)
@@ -4813,7 +4824,7 @@ set_errorlist(
} }
if (what != NULL) if (what != NULL)
retval = qf_set_properties(qi, what); retval = qf_set_properties(qi, what, action);
else else
retval = qf_add_entries(qi, list, title, action); retval = qf_add_entries(qi, list, title, action);

View File

@@ -1527,6 +1527,16 @@ function Xproperty_tests(cchar)
call assert_equal('Sample', w:quickfix_title) call assert_equal('Sample', w:quickfix_title)
Xclose Xclose
" Tests for action argument
silent! Xolder 999
let qfnr = g:Xgetlist({'all':1}).nr
call g:Xsetlist([], 'r', {'title' : 'N1'})
call assert_equal('N1', g:Xgetlist({'all':1}).title)
call g:Xsetlist([], ' ', {'title' : 'N2'})
call assert_equal(qfnr + 1, g:Xgetlist({'all':1}).nr)
call g:Xsetlist([], ' ', {'title' : 'N3'})
call assert_equal('N2', g:Xgetlist({'nr':2, 'title':1}).title)
" Invalid arguments " Invalid arguments
call assert_fails('call g:Xgetlist([])', 'E715') call assert_fails('call g:Xgetlist([])', 'E715')
call assert_fails('call g:Xsetlist([], "a", [])', 'E715') call assert_fails('call g:Xsetlist([], "a", [])', 'E715')

View File

@@ -763,6 +763,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2264,
/**/ /**/
2263, 2263,
/**/ /**/