diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 2551ff25c1..35c9dc1b1f 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -7008,7 +7008,8 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()* title quickfix list title text Unsupported keys in {what} are ignored. If the "nr" item is not present, then the current quickfix list - is modified. + is modified. When creating a new quickfix list, "nr" can be + set to a value one greater than the quickfix stack size. Examples: > :call setqflist([], 'r', {'title': 'My search'}) diff --git a/src/ex_cmds.h b/src/ex_cmds.h index b50614780f..c559fd2d41 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -51,7 +51,9 @@ #define BUFUNL 0x20000L /* accepts unlisted buffer too */ #define ARGOPT 0x40000L /* allow "++opt=val" argument */ #define SBOXOK 0x80000L /* allowed in the sandbox */ -#define CMDWIN 0x100000L /* allowed in cmdline window */ +#define CMDWIN 0x100000L /* allowed in cmdline window; when missing + * disallows editing another buffer when + * curbuf_lock is set */ #define MODIFY 0x200000L /* forbidden in non-'modifiable' buffer */ #define EXFLAGS 0x400000L /* allow flags after count in argument */ #define FILES (XFILE | EXTRA) /* multiple extra files allowed */ @@ -1182,7 +1184,7 @@ EX(CMD_registers, "registers", ex_display, EXTRA|NOTRLCOM|TRLBAR|CMDWIN, ADDR_LINES), EX(CMD_resize, "resize", ex_resize, - RANGE|NOTADR|TRLBAR|WORD1, + RANGE|NOTADR|TRLBAR|WORD1|CMDWIN, ADDR_LINES), EX(CMD_retab, "retab", ex_retab, TRLBAR|RANGE|WHOLEFOLD|DFLALL|BANG|WORD1|CMDWIN|MODIFY, diff --git a/src/quickfix.c b/src/quickfix.c index 084d82ec0e..3889a95656 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -1163,8 +1163,8 @@ qf_init_ext( qffields_T fields; #ifdef FEAT_WINDOWS qfline_T *old_last = NULL; - int adding = FALSE; #endif + int adding = FALSE; static efm_T *fmt_first = NULL; char_u *efm; static char_u *last_efm = NULL; @@ -1199,14 +1199,15 @@ qf_init_ext( if (newlist || qi->qf_curlist == qi->qf_listcount) /* make place for a new list */ qf_new_list(qi, qf_title); -#ifdef FEAT_WINDOWS - else if (qi->qf_lists[qi->qf_curlist].qf_count > 0) + else { /* Adding to existing list, use last entry. */ adding = TRUE; - old_last = qi->qf_lists[qi->qf_curlist].qf_last; - } +#ifdef FEAT_WINDOWS + if (qi->qf_lists[qi->qf_curlist].qf_count > 0) + old_last = qi->qf_lists[qi->qf_curlist].qf_last; #endif + } /* Use the local value of 'errorformat' if it's set. */ 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) (void)get_errorlist(wp, qf_idx, l); dict_add_list(retdict, "items", l); } + else + status = FAIL; } if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) @@ -4795,9 +4798,12 @@ get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict) if (di != NULL) { copy_tv(qi->qf_lists[qf_idx].qf_ctx, &di->di_tv); - if (dict_add(retdict, di) == FAIL) + status = dict_add(retdict, di); + if (status == FAIL) dictitem_free(di); } + else + status = FAIL; } else 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) if (ctx != NULL) copy_tv(&di->di_tv, ctx); qi->qf_lists[qf_idx].qf_ctx = ctx; + retval = OK; } return retval; diff --git a/src/screen.c b/src/screen.c index 7cd46be386..7cb47cd403 100644 --- a/src/screen.c +++ b/src/screen.c @@ -648,6 +648,8 @@ update_screen(int type_arg) { screenclear(); /* will reset clear_cmdline */ type = NOT_VALID; + /* must_redraw may be set indirectly, avoid another redraw later */ + must_redraw = 0; } if (clear_cmdline) /* going to clear cmdline (done below) */ diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 755ea745c1..b3cc6891a5 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -1720,7 +1720,8 @@ func Xproperty_tests(cchar) Xopen wincmd p call g:Xsetlist([{'filename':'foo', 'lnum':27}]) - call g:Xsetlist([], 'a', {'title' : 'Sample'}) + let s = g:Xsetlist([], 'a', {'title' : 'Sample'}) + call assert_equal(0, s) let d = g:Xgetlist({"title":1}) call assert_equal('Sample', d.title) @@ -1774,7 +1775,8 @@ func Xproperty_tests(cchar) endif " Context related tests - call g:Xsetlist([], 'a', {'context':[1,2,3]}) + let s = g:Xsetlist([], 'a', {'context':[1,2,3]}) + call assert_equal(0, s) call test_garbagecollect_now() let d = g:Xgetlist({'context':1}) call assert_equal([1,2,3], d.context) @@ -1839,8 +1841,9 @@ func Xproperty_tests(cchar) " Test for setting/getting items Xexpr "" let qfprev = g:Xgetlist({'nr':0}) - call g:Xsetlist([], ' ', {'title':'Green', + let s = g:Xsetlist([], ' ', {'title':'Green', \ 'items' : [{'filename':'F1', 'lnum':10}]}) + call assert_equal(0, s) let qfcur = g:Xgetlist({'nr':0}) call assert_true(qfcur.nr == qfprev.nr + 1) let l = g:Xgetlist({'items':1}) @@ -2187,18 +2190,6 @@ func Test_bufoverflow() set efm&vim endfunc -func Test_cclose_from_copen() - augroup QF_Test - au! - au FileType qf :call assert_fails(':cclose', 'E788') - augroup END - copen - augroup QF_Test - au! - augroup END - augroup! QF_Test -endfunc - " Tests for getting the quickfix stack size func XsizeTests(cchar) call s:setup_commands(a:cchar) @@ -2228,6 +2219,18 @@ func Test_Qf_Size() call XsizeTests('l') endfunc +func Test_cclose_from_copen() + augroup QF_Test + au! + au FileType qf :call assert_fails(':cclose', 'E788') + augroup END + copen + augroup QF_Test + au! + augroup END + augroup! QF_Test +endfunc + func Test_cclose_in_autocmd() " Problem is only triggered if "starting" is zero, so that the OptionsSet " event will be triggered. @@ -2243,3 +2246,20 @@ func Test_cclose_in_autocmd() augroup! QF_Test call test_override('starting', 0) endfunc + +func Test_resize_from_copen() + augroup QF_Test + au! + au FileType qf resize 5 + augroup END + try + " This should succeed without any exception. No other buffers are + " involved in the autocmd. + copen + finally + augroup QF_Test + au! + augroup END + augroup! QF_Test + endtry +endfunc diff --git a/src/version.c b/src/version.c index 566527e49e..e335464b52 100644 --- a/src/version.c +++ b/src/version.c @@ -779,6 +779,12 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 688, +/**/ + 687, +/**/ + 686, /**/ 685, /**/