Patch 8.2.3759

3 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 8, 2021, 3:04:41 PM12/8/21
to vim...@googlegroups.com

Patch 8.2.3759
Problem: Quickfix buffer becomes hidden while still in a window.
Solution: Check if the closed window is the last window showing the quickfix
buffer. (Yegappan Lakshmanan, closes #9303, closes #9300)
Files: src/quickfix.c, src/testdir/test_quickfix.vim, src/window.c


*** ../vim-8.2.3758/src/quickfix.c 2021-12-01 10:54:21.030251525 +0000
--- src/quickfix.c 2021-12-08 19:55:32.815879198 +0000
***************
*** 2818,2824 ****
}

/*
! * Find a window displaying a Vim help file.
*/
static win_T *
qf_find_help_win(void)
--- 2818,2824 ----
}

/*
! * Find a window displaying a Vim help file in the current tab page.
*/
static win_T *
qf_find_help_win(void)
***************
*** 2893,2900 ****
}

/*
! * Find a non-quickfix window in the current tabpage using the given location
! * list stack.
* Returns NULL if a matching window is not found.
*/
static win_T *
--- 2893,2900 ----
}

/*
! * Find a non-quickfix window using the given location list stack in the
! * current tabpage.
* Returns NULL if a matching window is not found.
*/
static win_T *
***************
*** 2910,2916 ****
}

/*
! * Find a window containing a normal buffer
*/
static win_T *
qf_find_win_with_normal_buf(void)
--- 2910,2916 ----
}

/*
! * Find a window containing a normal buffer in the current tab page.
*/
static win_T *
qf_find_win_with_normal_buf(void)
***************
*** 2981,2987 ****

if (win == NULL)
{
! // Find the window showing the selected file
FOR_ALL_WINDOWS(win)
if (win->w_buffer->b_fnum == qf_fnum)
break;
--- 2981,2987 ----

if (win == NULL)
{
! // Find the window showing the selected file in the current tab page.
FOR_ALL_WINDOWS(win)
if (win->w_buffer->b_fnum == qf_fnum)
break;
***************
*** 4394,4401 ****
}

/*
! * Find a window displaying the quickfix/location stack 'qi'
! * Only searches in the current tabpage.
*/
static win_T *
qf_find_win(qf_info_T *qi)
--- 4394,4401 ----
}

/*
! * Find a window displaying the quickfix/location stack 'qi' in the current tab
! * page.
*/
static win_T *
qf_find_win(qf_info_T *qi)
***************
*** 4410,4416 ****

/*
* Find a quickfix buffer.
! * Searches in windows opened in all the tabs.
*/
static buf_T *
qf_find_buf(qf_info_T *qi)
--- 4410,4416 ----

/*
* Find a quickfix buffer.
! * Searches in windows opened in all the tab pages.
*/
static buf_T *
qf_find_buf(qf_info_T *qi)
*** ../vim-8.2.3758/src/testdir/test_quickfix.vim 2021-12-01 10:54:21.034251519 +0000
--- src/testdir/test_quickfix.vim 2021-12-08 19:55:32.815879198 +0000
***************
*** 5636,5639 ****
--- 5636,5675 ----
cclose
endfunc

+ " Test for opening the quickfix window in two tab pages and then closing one
+ " of the quickfix windows. This should not make the quickfix buffer unlisted.
+ " (github issue #9300).
+ func Test_two_qf_windows()
+ cexpr "F1:1:line1"
+ copen
+ tabnew
+ copen
+ call assert_true(&buflisted)
+ cclose
+ tabfirst
+ call assert_true(&buflisted)
+ let bnum = bufnr()
+ cclose
+ " if all the quickfix windows are closed, then buffer should be unlisted.
+ call assert_false(buflisted(bnum))
+ %bw!
+
+ " Repeat the test for a location list
+ lexpr "F2:2:line2"
+ lopen
+ let bnum = bufnr()
+ tabnew
+ exe "buffer" bnum
+ tabfirst
+ lclose
+ tablast
+ call assert_true(buflisted(bnum))
+ tabclose
+ lopen
+ call assert_true(buflisted(bnum))
+ lclose
+ call assert_false(buflisted(bnum))
+ %bw!
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3758/src/window.c 2021-12-04 22:03:30.716421330 +0000
--- src/window.c 2021-12-08 19:55:32.815879198 +0000
***************
*** 2433,2440 ****
#endif

#ifdef FEAT_QUICKFIX
! // When the quickfix/location list window is closed, unlist the buffer.
! if (win->w_buffer != NULL && bt_quickfix(win->w_buffer))
win->w_buffer->b_p_bl = FALSE;
#endif

--- 2433,2442 ----
#endif

#ifdef FEAT_QUICKFIX
! // When a quickfix/location list window is closed and the buffer is
! // displayed in only one window, then unlist the buffer.
! if (win->w_buffer != NULL && bt_quickfix(win->w_buffer)
! && win->w_buffer->b_nwindows == 1)
win->w_buffer->b_p_bl = FALSE;
#endif

*** ../vim-8.2.3758/src/version.c 2021-12-08 10:45:43.329331491 +0000
--- src/version.c 2021-12-08 19:57:11.967886994 +0000
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 3759,
/**/

--
hundred-and-one symptoms of being an internet addict:
6. You refuse to go to a vacation spot with no electricity and no phone lines.

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages