Skip to content

Commit 86f100d

Browse files
committed
patch 8.0.0687: minor issues related to quickfix
Problem: Minor issues related to quickfix. Solution: Set the proper return status for all cases in setqflist() and at test cases for this. Move the "adding" flag outside of FEAT_WINDOWS. Minor update to the setqflist() help text. (Yegappan Lakshmanan)
1 parent 9f5f7bf commit 86f100d

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

runtime/doc/eval.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7008,7 +7008,8 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()*
70087008
title quickfix list title text
70097009
Unsupported keys in {what} are ignored.
70107010
If the "nr" item is not present, then the current quickfix list
7011-
is modified.
7011+
is modified. When creating a new quickfix list, "nr" can be
7012+
set to a value one greater than the quickfix stack size.
70127013

70137014
Examples: >
70147015
:call setqflist([], 'r', {'title': 'My search'})

src/quickfix.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,8 +1163,8 @@ qf_init_ext(
11631163
qffields_T fields;
11641164
#ifdef FEAT_WINDOWS
11651165
qfline_T *old_last = NULL;
1166-
int adding = FALSE;
11671166
#endif
1167+
int adding = FALSE;
11681168
static efm_T *fmt_first = NULL;
11691169
char_u *efm;
11701170
static char_u *last_efm = NULL;
@@ -1199,14 +1199,15 @@ qf_init_ext(
11991199
if (newlist || qi->qf_curlist == qi->qf_listcount)
12001200
/* make place for a new list */
12011201
qf_new_list(qi, qf_title);
1202-
#ifdef FEAT_WINDOWS
1203-
else if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
1202+
else
12041203
{
12051204
/* Adding to existing list, use last entry. */
12061205
adding = TRUE;
1207-
old_last = qi->qf_lists[qi->qf_curlist].qf_last;
1208-
}
1206+
#ifdef FEAT_WINDOWS
1207+
if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
1208+
old_last = qi->qf_lists[qi->qf_curlist].qf_last;
12091209
#endif
1210+
}
12101211

12111212
/* Use the local value of 'errorformat' if it's set. */
12121213
if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL)
@@ -4785,6 +4786,8 @@ get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
47854786
(void)get_errorlist(wp, qf_idx, l);
47864787
dict_add_list(retdict, "items", l);
47874788
}
4789+
else
4790+
status = FAIL;
47884791
}
47894792

47904793
if ((status == OK) && (flags & QF_GETLIST_CONTEXT))
@@ -4795,9 +4798,12 @@ get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
47954798
if (di != NULL)
47964799
{
47974800
copy_tv(qi->qf_lists[qf_idx].qf_ctx, &di->di_tv);
4798-
if (dict_add(retdict, di) == FAIL)
4801+
status = dict_add(retdict, di);
4802+
if (status == FAIL)
47994803
dictitem_free(di);
48004804
}
4805+
else
4806+
status = FAIL;
48014807
}
48024808
else
48034809
status = dict_add_nr_str(retdict, "context", 0L, (char_u *)"");
@@ -5020,6 +5026,7 @@ qf_set_properties(qf_info_T *qi, dict_T *what, int action)
50205026
if (ctx != NULL)
50215027
copy_tv(&di->di_tv, ctx);
50225028
qi->qf_lists[qf_idx].qf_ctx = ctx;
5029+
retval = OK;
50235030
}
50245031

50255032
return retval;

src/testdir/test_quickfix.vim

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,8 @@ func Xproperty_tests(cchar)
17201720
Xopen
17211721
wincmd p
17221722
call g:Xsetlist([{'filename':'foo', 'lnum':27}])
1723-
call g:Xsetlist([], 'a', {'title' : 'Sample'})
1723+
let s = g:Xsetlist([], 'a', {'title' : 'Sample'})
1724+
call assert_equal(0, s)
17241725
let d = g:Xgetlist({"title":1})
17251726
call assert_equal('Sample', d.title)
17261727

@@ -1774,7 +1775,8 @@ func Xproperty_tests(cchar)
17741775
endif
17751776

17761777
" Context related tests
1777-
call g:Xsetlist([], 'a', {'context':[1,2,3]})
1778+
let s = g:Xsetlist([], 'a', {'context':[1,2,3]})
1779+
call assert_equal(0, s)
17781780
call test_garbagecollect_now()
17791781
let d = g:Xgetlist({'context':1})
17801782
call assert_equal([1,2,3], d.context)
@@ -1839,8 +1841,9 @@ func Xproperty_tests(cchar)
18391841
" Test for setting/getting items
18401842
Xexpr ""
18411843
let qfprev = g:Xgetlist({'nr':0})
1842-
call g:Xsetlist([], ' ', {'title':'Green',
1844+
let s = g:Xsetlist([], ' ', {'title':'Green',
18431845
\ 'items' : [{'filename':'F1', 'lnum':10}]})
1846+
call assert_equal(0, s)
18441847
let qfcur = g:Xgetlist({'nr':0})
18451848
call assert_true(qfcur.nr == qfprev.nr + 1)
18461849
let l = g:Xgetlist({'items':1})

src/version.c

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

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
687,
767769
/**/
768770
686,
769771
/**/

0 commit comments

Comments
 (0)