mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.1521: when a popup window is closed the buffer remains
Problem: When a popup window is closed the buffer remains. Solution: Wipe out the buffer.
This commit is contained in:
parent
451d4b5b7c
commit
7c7f01e2b2
@ -272,12 +272,17 @@ endfunc
|
|||||||
func Test_popup_in_tab()
|
func Test_popup_in_tab()
|
||||||
" default popup is local to tab, not visible when in other tab
|
" default popup is local to tab, not visible when in other tab
|
||||||
let winid = popup_create("text", {})
|
let winid = popup_create("text", {})
|
||||||
|
let bufnr = winbufnr(winid)
|
||||||
call assert_equal(1, popup_getpos(winid).visible)
|
call assert_equal(1, popup_getpos(winid).visible)
|
||||||
tabnew
|
tabnew
|
||||||
call assert_equal(0, popup_getpos(winid).visible)
|
call assert_equal(0, popup_getpos(winid).visible)
|
||||||
quit
|
quit
|
||||||
call assert_equal(1, popup_getpos(winid).visible)
|
call assert_equal(1, popup_getpos(winid).visible)
|
||||||
|
|
||||||
|
call assert_equal(1, bufexists(bufnr))
|
||||||
call popup_clear()
|
call popup_clear()
|
||||||
|
" buffer is gone now
|
||||||
|
call assert_equal(0, bufexists(bufnr))
|
||||||
|
|
||||||
" global popup is visible in any tab
|
" global popup is visible in any tab
|
||||||
let winid = popup_create("text", {'tab': -1})
|
let winid = popup_create("text", {'tab': -1})
|
||||||
|
@ -777,6 +777,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 */
|
||||||
|
/**/
|
||||||
|
1521,
|
||||||
/**/
|
/**/
|
||||||
1520,
|
1520,
|
||||||
/**/
|
/**/
|
||||||
|
12
src/window.c
12
src/window.c
@ -2324,12 +2324,13 @@ close_last_window_tabpage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close the buffer of "win" and unload it if "free_buf" is TRUE.
|
* Close the buffer of "win" and unload it if "action" is DOBUF_UNLOAD.
|
||||||
|
* "action" can also be zero (do nothing) or DOBUF_WIPE.
|
||||||
* "abort_if_last" is passed to close_buffer(): abort closing if all other
|
* "abort_if_last" is passed to close_buffer(): abort closing if all other
|
||||||
* windows are closed.
|
* windows are closed.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
win_close_buffer(win_T *win, int free_buf, int abort_if_last)
|
win_close_buffer(win_T *win, int action, int abort_if_last)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
// Free independent synblock before the buffer is freed.
|
// Free independent synblock before the buffer is freed.
|
||||||
@ -2350,8 +2351,7 @@ win_close_buffer(win_T *win, int free_buf, int abort_if_last)
|
|||||||
|
|
||||||
set_bufref(&bufref, curbuf);
|
set_bufref(&bufref, curbuf);
|
||||||
win->w_closing = TRUE;
|
win->w_closing = TRUE;
|
||||||
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0,
|
close_buffer(win, win->w_buffer, action, abort_if_last);
|
||||||
abort_if_last);
|
|
||||||
if (win_valid_any_tab(win))
|
if (win_valid_any_tab(win))
|
||||||
win->w_closing = FALSE;
|
win->w_closing = FALSE;
|
||||||
// Make sure curbuf is valid. It can become invalid if 'bufhidden' is
|
// Make sure curbuf is valid. It can become invalid if 'bufhidden' is
|
||||||
@ -2462,7 +2462,7 @@ win_close(win_T *win, int free_buf)
|
|||||||
out_flush();
|
out_flush();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
win_close_buffer(win, free_buf, TRUE);
|
win_close_buffer(win, free_buf ? DOBUF_UNLOAD : 0, TRUE);
|
||||||
|
|
||||||
if (only_one_window() && win_valid(win) && win->w_buffer == NULL
|
if (only_one_window() && win_valid(win) && win->w_buffer == NULL
|
||||||
&& (last_window() || curtab != prev_curtab
|
&& (last_window() || curtab != prev_curtab
|
||||||
@ -4894,7 +4894,7 @@ win_unlisted(win_T *wp)
|
|||||||
void
|
void
|
||||||
win_free_popup(win_T *win)
|
win_free_popup(win_T *win)
|
||||||
{
|
{
|
||||||
win_close_buffer(win, TRUE, FALSE);
|
win_close_buffer(win, DOBUF_WIPE, FALSE);
|
||||||
# if defined(FEAT_TIMERS)
|
# if defined(FEAT_TIMERS)
|
||||||
if (win->w_popup_timer != NULL)
|
if (win->w_popup_timer != NULL)
|
||||||
stop_timer(win->w_popup_timer);
|
stop_timer(win->w_popup_timer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user