summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-27 13:35:35 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-27 13:35:35 +0200
commit2b529bb6260b52246e92429375d995b9b5ce76b6 (patch)
treef0ea1f4a33648939dbb109aa5a5b2106f14f2d22
parentd29459baa61819e59961804ed258efac5733ec70 (diff)
patch 7.4.2264v7.4.2264
Problem: When adding entries to an empty quickfix list the title is reset. Solution: Improve handling of the title. (Yegappan Lakshmanan)
-rw-r--r--src/quickfix.c15
-rw-r--r--src/testdir/test_quickfix.vim10
-rw-r--r--src/version.c2
3 files changed, 25 insertions, 2 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index f808da4995..23cabb2988 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4753,11 +4753,15 @@ qf_add_entries(
}
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;
int retval = FAIL;
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 */
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
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)
@@ -4813,7 +4824,7 @@ set_errorlist(
}
if (what != NULL)
- retval = qf_set_properties(qi, what);
+ retval = qf_set_properties(qi, what, action);
else
retval = qf_add_entries(qi, list, title, action);
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index b7d985d0df..5c514776a0 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -1527,6 +1527,16 @@ function Xproperty_tests(cchar)
call assert_equal('Sample', w:quickfix_title)
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
call assert_fails('call g:Xgetlist([])', 'E715')
call assert_fails('call g:Xsetlist([], "a", [])', 'E715')
diff --git a/src/version.c b/src/version.c
index 934eecb290..abf86a6348 100644
--- a/src/version.c
+++ b/src/version.c
@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2264,
+/**/
2263,
/**/
2262,