Mercurial > vim
comparison src/window.c @ 17043:d99805d25b42 v8.1.1521
patch 8.1.1521: when a popup window is closed the buffer remains
commit https://github.com/vim/vim/commit/7c7f01e2b260c75d9996ca9ab621119eafe13a63
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 12 21:06:32 2019 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 12 Jun 2019 21:15:07 +0200 |
parents | 23645f9a5ce2 |
children | 221d4b82bc0b |
comparison
equal
deleted
inserted
replaced
17042:ea951d5610a5 | 17043:d99805d25b42 |
---|---|
2322 } | 2322 } |
2323 return FALSE; | 2323 return FALSE; |
2324 } | 2324 } |
2325 | 2325 |
2326 /* | 2326 /* |
2327 * Close the buffer of "win" and unload it if "free_buf" is TRUE. | 2327 * Close the buffer of "win" and unload it if "action" is DOBUF_UNLOAD. |
2328 * "action" can also be zero (do nothing) or DOBUF_WIPE. | |
2328 * "abort_if_last" is passed to close_buffer(): abort closing if all other | 2329 * "abort_if_last" is passed to close_buffer(): abort closing if all other |
2329 * windows are closed. | 2330 * windows are closed. |
2330 */ | 2331 */ |
2331 static void | 2332 static void |
2332 win_close_buffer(win_T *win, int free_buf, int abort_if_last) | 2333 win_close_buffer(win_T *win, int action, int abort_if_last) |
2333 { | 2334 { |
2334 #ifdef FEAT_SYN_HL | 2335 #ifdef FEAT_SYN_HL |
2335 // Free independent synblock before the buffer is freed. | 2336 // Free independent synblock before the buffer is freed. |
2336 if (win->w_buffer != NULL) | 2337 if (win->w_buffer != NULL) |
2337 reset_synblock(win); | 2338 reset_synblock(win); |
2348 { | 2349 { |
2349 bufref_T bufref; | 2350 bufref_T bufref; |
2350 | 2351 |
2351 set_bufref(&bufref, curbuf); | 2352 set_bufref(&bufref, curbuf); |
2352 win->w_closing = TRUE; | 2353 win->w_closing = TRUE; |
2353 close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, | 2354 close_buffer(win, win->w_buffer, action, abort_if_last); |
2354 abort_if_last); | |
2355 if (win_valid_any_tab(win)) | 2355 if (win_valid_any_tab(win)) |
2356 win->w_closing = FALSE; | 2356 win->w_closing = FALSE; |
2357 // Make sure curbuf is valid. It can become invalid if 'bufhidden' is | 2357 // Make sure curbuf is valid. It can become invalid if 'bufhidden' is |
2358 // "wipe". | 2358 // "wipe". |
2359 if (!bufref_valid(&bufref)) | 2359 if (!bufref_valid(&bufref)) |
2460 // win_free(). | 2460 // win_free(). |
2461 if (gui.in_use) | 2461 if (gui.in_use) |
2462 out_flush(); | 2462 out_flush(); |
2463 #endif | 2463 #endif |
2464 | 2464 |
2465 win_close_buffer(win, free_buf, TRUE); | 2465 win_close_buffer(win, free_buf ? DOBUF_UNLOAD : 0, TRUE); |
2466 | 2466 |
2467 if (only_one_window() && win_valid(win) && win->w_buffer == NULL | 2467 if (only_one_window() && win_valid(win) && win->w_buffer == NULL |
2468 && (last_window() || curtab != prev_curtab | 2468 && (last_window() || curtab != prev_curtab |
2469 || close_last_window_tabpage(win, free_buf, prev_curtab))) | 2469 || close_last_window_tabpage(win, free_buf, prev_curtab))) |
2470 { | 2470 { |
4892 * and assumes there is only one toplevel frame, no split. | 4892 * and assumes there is only one toplevel frame, no split. |
4893 */ | 4893 */ |
4894 void | 4894 void |
4895 win_free_popup(win_T *win) | 4895 win_free_popup(win_T *win) |
4896 { | 4896 { |
4897 win_close_buffer(win, TRUE, FALSE); | 4897 win_close_buffer(win, DOBUF_WIPE, FALSE); |
4898 # if defined(FEAT_TIMERS) | 4898 # if defined(FEAT_TIMERS) |
4899 if (win->w_popup_timer != NULL) | 4899 if (win->w_popup_timer != NULL) |
4900 stop_timer(win->w_popup_timer); | 4900 stop_timer(win->w_popup_timer); |
4901 # endif | 4901 # endif |
4902 vim_free(win->w_frame); | 4902 vim_free(win->w_frame); |