diff options
author | Jurica Bradaric <jbradaric@gmail.com> | 2017-07-16 14:23:56 +0200 |
---|---|---|
committer | Jurica Bradaric <jbradaric@gmail.com> | 2017-07-16 17:48:50 +0200 |
commit | 33efad7dbc26750486d1910157345c508684125e (patch) | |
tree | 3a568317f21577c928268f99a2358120ef96c74e /src | |
parent | 4dee942e732d41ad62b732c0a39719d9405bc928 (diff) | |
download | rneovim-33efad7dbc26750486d1910157345c508684125e.tar.gz rneovim-33efad7dbc26750486d1910157345c508684125e.tar.bz2 rneovim-33efad7dbc26750486d1910157345c508684125e.zip |
vim-patch:8.0.0017
Problem: Cannot get the number of the current quickfix or location list.
Solution: Use the current list if "nr" in "what" is zero. (Yegappan
Lakshmanan) Remove debug command from test.
https://github.com/vim/vim/commit/890680ca6364386fabb271c85e0755bcaa6a33c1
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/quickfix.c | 9 | ||||
-rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 9 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index bd5dfa92cc..6797632008 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -4025,9 +4025,12 @@ int get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict) if ((di = tv_dict_find(what, S_LEN("nr"))) != NULL) { // Use the specified quickfix/location list if (di->di_tv.v_type == VAR_NUMBER) { - qf_idx = (int)di->di_tv.vval.v_number - 1; - if (qf_idx < 0 || qf_idx >= qi->qf_listcount) { - return FAIL; + // for zero use the current list + if (di->di_tv.vval.v_number != 0) { + qf_idx = (int)di->di_tv.vval.v_number - 1; + if (qf_idx < 0 || qf_idx >= qi->qf_listcount) { + return FAIL; + } } flags |= QF_GETLIST_NR; } else { diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 75ab01f013..64d0173965 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -1427,12 +1427,10 @@ function! Test_two_windows() laddexpr 'one.txt:3:one one one' let loc_one = getloclist(one_id) -echo string(loc_one) call assert_equal('Xone/a/one.txt', bufname(loc_one[1].bufnr)) call assert_equal(3, loc_one[1].lnum) let loc_two = getloclist(two_id) -echo string(loc_two) call assert_equal('Xtwo/a/two.txt', bufname(loc_two[1].bufnr)) call assert_equal(5, loc_two[1].lnum) @@ -1532,6 +1530,11 @@ function Xproperty_tests(cchar) call assert_equal('N1', g:Xgetlist({'all':1}).title) call g:Xsetlist([], ' ', {'title' : 'N2'}) call assert_equal(qfnr + 1, g:Xgetlist({'all':1}).nr) + + let res = g:Xgetlist({'nr': 0}) + call assert_equal(qfnr + 1, res.nr) + call assert_equal(['nr'], keys(res)) + call g:Xsetlist([], ' ', {'title' : 'N3'}) call assert_equal('N2', g:Xgetlist({'nr':2, 'title':1}).title) @@ -1544,7 +1547,7 @@ function Xproperty_tests(cchar) call assert_equal({}, g:Xgetlist({'abc':1})) if a:cchar == 'l' - call assert_equal({}, getloclist(99, ['title'])) + call assert_equal({}, getloclist(99, {'title': 1})) endif endfunction diff --git a/src/nvim/version.c b/src/nvim/version.c index c7b8220776..a8b1e4d22d 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -712,7 +712,7 @@ static const int included_patches[] = { // 20, 19, // 18, - // 17, + 17, // 16 NA // 15 NA // 14 NA |