To: vim_dev@googlegroups.com Subject: Patch 8.2.3762 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3762 Problem: If the quickfix buffer is wiped out getqflist() still returns its number. Solution: Use zero if the buffer is no longer present. (Yegappan Lakshmanan, closes #9306) Files: src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.2.3761/src/quickfix.c 2021-12-08 20:03:27.875867028 +0000 --- src/quickfix.c 2021-12-09 09:19:43.336588910 +0000 *************** *** 6793,6805 **** /* * Returns the number of the buffer displayed in the quickfix/location list ! * window. If there is no buffer associated with the list, then returns 0. */ static int qf_getprop_qfbufnr(qf_info_T *qi, dict_T *retdict) { ! return dict_add_number(retdict, "qfbufnr", ! (qi == NULL) ? 0 : qi->qf_bufnr); } /* --- 6793,6810 ---- /* * Returns the number of the buffer displayed in the quickfix/location list ! * window. If there is no buffer associated with the list or the buffer is ! * wiped out, then returns 0. */ static int qf_getprop_qfbufnr(qf_info_T *qi, dict_T *retdict) { ! int bufnum = 0; ! ! if (qi != NULL && buflist_findnr(qi->qf_bufnr) != NULL) ! bufnum = qi->qf_bufnr; ! ! return dict_add_number(retdict, "qfbufnr", bufnum); } /* *** ../vim-8.2.3761/src/testdir/test_quickfix.vim 2021-12-08 20:03:27.875867028 +0000 --- src/testdir/test_quickfix.vim 2021-12-09 09:19:43.336588910 +0000 *************** *** 4626,4631 **** --- 4626,4638 ---- call assert_equal(qfbnum, bufnr('')) Xclose + " When quickfix buffer is wiped out, getqflist() should return 0 + %bw! + Xexpr "" + Xopen + bw! + call assert_equal(0, g:Xgetlist({'qfbufnr': 0}).qfbufnr) + if a:cchar == 'l' %bwipe " For a location list, when both the file window and the location list *** ../vim-8.2.3761/src/version.c 2021-12-08 22:13:13.105328552 +0000 --- src/version.c 2021-12-09 09:23:58.199881419 +0000 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 3762, /**/ -- The Feynman problem solving Algorithm: 1) Write down the problem 2) Think real hard 3) Write down the answer /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///