mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.1.0988: deleting location list buffer breaks location list window
Problem: Deleting a location list buffer breaks location list window functionality. Solution: (Yegappan Lakshmanan, closes #4056)
This commit is contained in:
@@ -3980,6 +3980,27 @@ qf_goto_cwindow(qf_info_T *qi, int resize, int sz, int vertsplit)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set options for the buffer in the quickfix or location list window.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
qf_set_cwindow_options(void)
|
||||||
|
{
|
||||||
|
// switch off 'swapfile'
|
||||||
|
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
|
||||||
|
set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix",
|
||||||
|
OPT_LOCAL);
|
||||||
|
set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL);
|
||||||
|
RESET_BINDING(curwin);
|
||||||
|
#ifdef FEAT_DIFF
|
||||||
|
curwin->w_p_diff = FALSE;
|
||||||
|
#endif
|
||||||
|
#ifdef FEAT_FOLDING
|
||||||
|
set_option_value((char_u *)"fdm", 0L, (char_u *)"manual",
|
||||||
|
OPT_LOCAL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open a new quickfix or location list window, load the quickfix buffer and
|
* Open a new quickfix or location list window, load the quickfix buffer and
|
||||||
* set the appropriate options for the window.
|
* set the appropriate options for the window.
|
||||||
@@ -4032,23 +4053,16 @@ qf_open_new_cwindow(qf_info_T *qi, int height)
|
|||||||
// Create a new quickfix buffer
|
// Create a new quickfix buffer
|
||||||
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin);
|
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin);
|
||||||
|
|
||||||
// switch off 'swapfile'
|
|
||||||
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
|
|
||||||
set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix",
|
|
||||||
OPT_LOCAL);
|
|
||||||
set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL);
|
|
||||||
RESET_BINDING(curwin);
|
|
||||||
#ifdef FEAT_DIFF
|
|
||||||
curwin->w_p_diff = FALSE;
|
|
||||||
#endif
|
|
||||||
#ifdef FEAT_FOLDING
|
|
||||||
set_option_value((char_u *)"fdm", 0L, (char_u *)"manual",
|
|
||||||
OPT_LOCAL);
|
|
||||||
#endif
|
|
||||||
// save the number of the new buffer
|
// save the number of the new buffer
|
||||||
qi->qf_bufnr = curbuf->b_fnum;
|
qi->qf_bufnr = curbuf->b_fnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the options for the quickfix buffer/window (if not already done)
|
||||||
|
// Do this even if the quickfix buffer was already present, as an autocmd
|
||||||
|
// might have previously deleted (:bdelete) the quickfix buffer.
|
||||||
|
if (curbuf->b_p_bt[0] != 'q')
|
||||||
|
qf_set_cwindow_options();
|
||||||
|
|
||||||
// Only set the height when still in the same tab page and there is no
|
// Only set the height when still in the same tab page and there is no
|
||||||
// window to the side.
|
// window to the side.
|
||||||
if (curtab == prevtab && curwin->w_width == Columns)
|
if (curtab == prevtab && curwin->w_width == Columns)
|
||||||
|
@@ -3933,6 +3933,16 @@ func Xqfbuf_test(cchar)
|
|||||||
call assert_match(qfbnum . ' h- "\[Location List]"', execute('ls'))
|
call assert_match(qfbnum . ' h- "\[Location List]"', execute('ls'))
|
||||||
call assert_true(bufloaded(qfbnum))
|
call assert_true(bufloaded(qfbnum))
|
||||||
|
|
||||||
|
" After deleting a location list buffer using ":bdelete", opening the
|
||||||
|
" location list window should mark the buffer as a location list buffer.
|
||||||
|
exe "bdelete " . qfbnum
|
||||||
|
lopen
|
||||||
|
call assert_equal("quickfix", &buftype)
|
||||||
|
call assert_equal(1, getwininfo(win_getid(winnr()))[0].loclist)
|
||||||
|
call assert_equal(wid, getloclist(0, {'filewinid' : 0}).filewinid)
|
||||||
|
call assert_false(&swapfile)
|
||||||
|
lclose
|
||||||
|
|
||||||
" When the location list is cleared for the window, the buffer should be
|
" When the location list is cleared for the window, the buffer should be
|
||||||
" removed
|
" removed
|
||||||
call setloclist(0, [], 'f')
|
call setloclist(0, [], 'f')
|
||||||
|
@@ -779,6 +779,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
988,
|
||||||
/**/
|
/**/
|
||||||
987,
|
987,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user