To: vim_dev@googlegroups.com Subject: Patch 8.0.0580 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0580 Problem: Cannot set the valid flag with setqflist(). Solution: Add the "valid" argument. (Yegappan Lakshmanan, closes #1642) Files: runtime/doc/eval.txt, src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.0.0579/runtime/doc/eval.txt 2017-04-03 22:02:51.778787637 +0200 --- runtime/doc/eval.txt 2017-04-22 21:15:38.693001351 +0200 *************** *** 6905,6910 **** --- 6945,6951 ---- nr error number text description of the error type single-character error type, 'E', 'W', etc. + valid recognized error message The "col", "vcol", "nr", "type" and "text" entries are optional. Either "lnum" or "pattern" entry can be used to *************** *** 6914,6919 **** --- 6955,6962 ---- item will not be handled as an error line. If both "pattern" and "lnum" are present then "pattern" will be used. + If the "valid" entry is not supplied, then the valid flag is + set when "bufnr" is a valid buffer or "filename" exists. If you supply an empty {list}, the quickfix list will be cleared. Note that the list is not exactly the same as what *** ../vim-8.0.0579/src/quickfix.c 2017-04-20 22:44:42.600262225 +0200 --- src/quickfix.c 2017-04-22 21:16:46.232576623 +0200 *************** *** 4779,4784 **** --- 4779,4788 ---- bufnum = 0; } + /* If the 'valid' field is present it overrules the detected value. */ + if ((dict_find(d, (char_u *)"valid", -1)) != NULL) + valid = (int)get_dict_number(d, (char_u *)"valid"); + status = qf_add_entry(qi, NULL, /* dir */ filename, *** ../vim-8.0.0579/src/testdir/test_quickfix.vim 2017-04-22 15:42:48.969317185 +0200 --- src/testdir/test_quickfix.vim 2017-04-22 21:13:07.257953882 +0200 *************** *** 1201,1206 **** --- 1201,1225 ---- let l = g:Xgetlist() call assert_equal(0, len(l)) + " Tests for setting the 'valid' flag + call g:Xsetlist([{'bufnr':a:bnum, 'lnum':4, 'valid':0}]) + Xwindow + call assert_equal(1, winnr('$')) + let l = g:Xgetlist() + call g:Xsetlist(l) + call assert_equal(0, g:Xgetlist()[0].valid) + call g:Xsetlist([{'text':'Text1', 'valid':1}]) + Xwindow + call assert_equal(2, winnr('$')) + Xclose + let save_efm = &efm + set efm=%m + Xgetexpr 'TestMessage' + let l = g:Xgetlist() + call g:Xsetlist(l) + call assert_equal(1, g:Xgetlist()[0].valid) + let &efm = save_efm + " Error cases: " Refer to a non-existing buffer and pass a non-dictionary type call assert_fails("call g:Xsetlist([{'bufnr':998, 'lnum':4}," . *** ../vim-8.0.0579/src/version.c 2017-04-22 15:42:48.969317185 +0200 --- src/version.c 2017-04-22 21:14:33.493411421 +0200 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 580, /**/ -- FATHER: We are here today to witness the union of two young people in the joyful bond of the holy wedlock. Unfortunately, one of them, my son Herbert, has just fallen to his death. [Murmurs from CROWD; the BRIDE smiles with relief, coughs.] "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///