Skip to content

Commit 2b529bb

Browse files
committed
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)
1 parent d29459b commit 2b529bb

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

src/quickfix.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4753,11 +4753,15 @@ qf_add_entries(
47534753
}
47544754

47554755
static int
4756-
qf_set_properties(qf_info_T *qi, dict_T *what)
4756+
qf_set_properties(qf_info_T *qi, dict_T *what, int action)
47574757
{
47584758
dictitem_T *di;
47594759
int retval = FAIL;
47604760
int qf_idx;
4761+
int newlist = FALSE;
4762+
4763+
if (action == ' ' || qi->qf_curlist == qi->qf_listcount)
4764+
newlist = TRUE;
47614765

47624766
qf_idx = qi->qf_curlist; /* default is the current list */
47634767
if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL)
@@ -4771,6 +4775,13 @@ qf_set_properties(qf_info_T *qi, dict_T *what)
47714775
}
47724776
else
47734777
return FAIL;
4778+
newlist = FALSE; /* use the specified list */
4779+
}
4780+
4781+
if (newlist)
4782+
{
4783+
qf_new_list(qi, NULL);
4784+
qf_idx = qi->qf_curlist;
47744785
}
47754786

47764787
if ((di = dict_find(what, (char_u *)"title", -1)) != NULL)
@@ -4813,7 +4824,7 @@ set_errorlist(
48134824
}
48144825

48154826
if (what != NULL)
4816-
retval = qf_set_properties(qi, what);
4827+
retval = qf_set_properties(qi, what, action);
48174828
else
48184829
retval = qf_add_entries(qi, list, title, action);
48194830

src/testdir/test_quickfix.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,16 @@ function Xproperty_tests(cchar)
15271527
call assert_equal('Sample', w:quickfix_title)
15281528
Xclose
15291529

1530+
" Tests for action argument
1531+
silent! Xolder 999
1532+
let qfnr = g:Xgetlist({'all':1}).nr
1533+
call g:Xsetlist([], 'r', {'title' : 'N1'})
1534+
call assert_equal('N1', g:Xgetlist({'all':1}).title)
1535+
call g:Xsetlist([], ' ', {'title' : 'N2'})
1536+
call assert_equal(qfnr + 1, g:Xgetlist({'all':1}).nr)
1537+
call g:Xsetlist([], ' ', {'title' : 'N3'})
1538+
call assert_equal('N2', g:Xgetlist({'nr':2, 'title':1}).title)
1539+
15301540
" Invalid arguments
15311541
call assert_fails('call g:Xgetlist([])', 'E715')
15321542
call assert_fails('call g:Xsetlist([], "a", [])', 'E715')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2264,
766768
/**/
767769
2263,
768770
/**/

0 commit comments

Comments
 (0)