vim-patch:7.4.2264 (#6275)

Problem:    When adding entries to an empty quickfix list the title is reset.
Solution:   Improve handling of the title. (Yegappan Lakshmanan)

2b529bb626
This commit is contained in:
lonerover 2017-03-14 22:07:48 +08:00 committed by Justin M. Keyes
parent 36fd879b25
commit 227859ea79
3 changed files with 23 additions and 3 deletions

View File

@ -4214,11 +4214,15 @@ static int qf_add_entries(qf_info_T *qi, list_T *list, char_u *title,
return retval;
}
static int qf_set_properties(qf_info_T *qi, dict_T *what)
static int qf_set_properties(qf_info_T *qi, dict_T *what, int action)
{
dictitem_T *di;
int retval = FAIL;
int newlist = false;
if (action == ' ' || qi->qf_curlist == qi->qf_listcount) {
newlist = true;
}
int qf_idx = qi->qf_curlist; // default is the current list
if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) {
// Use the specified quickfix/location list
@ -4230,6 +4234,12 @@ static int 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) {
@ -4260,7 +4270,7 @@ int set_errorlist(win_T *wp, list_T *list, int action, char_u *title,
}
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);
}

View File

@ -1508,6 +1508,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')

View File

@ -176,7 +176,7 @@ static int included_patches[] = {
// 2267 NA
// 2266,
2265,
// 2264,
2264,
// 2263,
// 2262 NA
// 2261 NA