To: vim_dev@googlegroups.com Subject: Patch 8.2.1982 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1982 Problem: Quickfix window not updated when adding invalid entries. Solution: Update the quickfix buffer properly. (Yegappan Lakshmanan, closes #7291, closes #7271) Files: src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.2.1981/src/quickfix.c 2020-10-24 20:49:37.502683026 +0200 --- src/quickfix.c 2020-11-14 13:14:25.338867904 +0100 *************** *** 4674,4687 **** *dirname = NUL; // Add one line for each error ! if (old_last == NULL || old_last->qf_next == NULL) { qfp = qfl->qf_start; lnum = 0; } else { ! qfp = old_last->qf_next; lnum = buf->b_ml.ml_line_count; } --- 4674,4690 ---- *dirname = NUL; // Add one line for each error ! if (old_last == NULL) { qfp = qfl->qf_start; lnum = 0; } else { ! if (old_last->qf_next != NULL) ! qfp = old_last->qf_next; ! else ! qfp = old_last; lnum = buf->b_ml.ml_line_count; } *** ../vim-8.2.1981/src/testdir/test_quickfix.vim 2020-11-02 20:03:51.615794746 +0100 --- src/testdir/test_quickfix.vim 2020-11-14 13:14:25.338867904 +0100 *************** *** 5145,5148 **** --- 5145,5161 ---- %bw! endfunc + " Test for adding an invalid entry with the quickfix window open and making + " sure that the window contents are not changed + func Test_add_invalid_entry_with_qf_window() + call setqflist([], 'f') + cexpr "Xfile1:10:aa" + copen + call setqflist(['bb'], 'a') + call assert_equal(1, line('$')) + call assert_equal(['Xfile1|10| aa'], getline(1, '$')) + call assert_equal([{'lnum': 10, 'bufnr': bufnr('Xfile1'), 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'aa'}], getqflist()) + cclose + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.1981/src/version.c 2020-11-13 17:47:24.481785818 +0100 --- src/version.c 2020-11-14 13:14:55.606790797 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1982, /**/ -- If you're sending someone Styrofoam, what do you pack it in? /// 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 ///