# HG changeset patch # User Bram Moolenaar # Date 1564944305 -7200 # Node ID 5278e5a2a4e36bbf80e65a7ccb58a9cb8977e2a6 # Parent 1f3f6e1d69cf455cf891f54694e37bd1a100c91c patch 8.1.1813: ATTENTION prompt for a preview popup window commit https://github.com/vim/vim/commit/2debf1c16b93f8693a785f675320d9e949c96a97 Author: Bram Moolenaar Date: Sun Aug 4 20:44:19 2019 +0200 patch 8.1.1813: ATTENTION prompt for a preview popup window Problem: ATTENTION prompt for a preview popup window. Solution: Close the popup window if aborting the buffer load. Avoid getting the ATTENTION dialog. diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1,4 +1,4 @@ -*windows.txt* For Vim version 8.1. Last change: 2019 Jul 27 +*windows.txt* For Vim version 8.1. Last change: 2019 Aug 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -874,7 +874,16 @@ settings. The option is a comma separat width maximum width of the popup Example: > :set previewpopup=height:10,width:60 -< + +A few peculiarities: +- If the file is in a buffer already, it will be re-used. This will allow for + editing the file while it's visible in the popup window. +- No ATTENTION dialog will be used, since you can't edit the file in the popup + window. However, if you later open the same buffer in a normal window, you + may not notice it's edited elsewhere. And when then using ":edit" to + trigger the ATTENTION and responding "A" for Abort, the preview window will + become empty. + *:pta* *:ptag* :pta[g][!] [tagname] Does ":tag[!] [tagname]" and shows the found tag in a diff --git a/src/ex_cmds.c b/src/ex_cmds.c --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -2454,7 +2454,7 @@ do_wqall(exarg_T *eap) /* * Check the 'write' option. - * Return TRUE and give a message when it's not st. + * Return TRUE and give a message when it's not set. */ int not_writing(void) @@ -3118,6 +3118,12 @@ do_ecmd( topline = curwin->w_topline; if (!oldbuf) /* need to read the file */ { +#ifdef FEAT_TEXT_PROP + // Don't use the swap-exists dialog for a popup window, can't edit + // the buffer. + if (WIN_IS_POPUP(curwin)) + curbuf->b_flags |= BF_NO_SEA; +#endif swap_exists_action = SEA_DIALOG; curbuf->b_flags |= BF_CHECK_RO; /* set/reset 'ro' flag */ @@ -3131,6 +3137,9 @@ do_ecmd( (void)open_buffer(FALSE, eap, readfile_flags); #endif +#ifdef FEAT_TEXT_PROP + curbuf->b_flags &= ~BF_NO_SEA; +#endif if (swap_exists_action == SEA_QUIT) retval = FAIL; handle_swap_exists(&old_curbuf); @@ -3173,7 +3182,7 @@ do_ecmd( maketitle(); #endif #ifdef FEAT_TEXT_PROP - if (popup_is_popup(curwin) && curwin->w_p_pvw) + if (WIN_IS_POPUP(curwin) && curwin->w_p_pvw && retval != FAIL) popup_set_title(curwin); #endif } diff --git a/src/memline.c b/src/memline.c --- a/src/memline.c +++ b/src/memline.c @@ -4860,7 +4860,8 @@ findswapname( * (happens when all .swp files are in one directory). */ if (!recoverymode && buf_fname != NULL - && !buf->b_help && !(buf->b_flags & BF_DUMMY)) + && !buf->b_help + && !(buf->b_flags & (BF_DUMMY | BF_NO_SEA))) { int fd; struct block0 b0; diff --git a/src/tag.c b/src/tag.c --- a/src/tag.c +++ b/src/tag.c @@ -3663,7 +3663,7 @@ jumpto_tag( if (g_do_tagpreview != 0 && curwin != curwin_save && win_valid(curwin_save)) { - /* Return cursor to where we were */ + // Return cursor to where we were validate_cursor(); redraw_later(VALID); win_enter(curwin_save, TRUE); @@ -3675,11 +3675,23 @@ jumpto_tag( else { --RedrawingDisabled; - if (postponed_split) /* close the window */ + got_int = FALSE; // don't want entering window to fail + + if (postponed_split) // close the window { win_close(curwin, FALSE); postponed_split = 0; } +#if defined(FEAT_QUICKFIX) && defined(FEAT_TEXT_PROP) + else if (WIN_IS_POPUP(curwin)) + { + win_T *wp = curwin; + + if (win_valid(curwin_save)) + win_enter(curwin_save, TRUE); + popup_close(wp->w_id); + } +#endif } erret: diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -774,6 +774,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1813, +/**/ 1812, /**/ 1811, diff --git a/src/vim.h b/src/vim.h --- a/src/vim.h +++ b/src/vim.h @@ -714,6 +714,7 @@ extern int (*dyn_libintl_wputenv)(const #define BF_DUMMY 0x80 // dummy buffer, only used internally #define BF_PRESERVED 0x100 // ":preserve" was used #define BF_SYN_SET 0x200 // 'syntax' option was set +#define BF_NO_SEA 0x400 // no swap_exists_action (ATTENTION prompt) /* Mask to check for flags that prevent normal writing */ #define BF_WRITE_MASK (BF_NOTEDITED + BF_NEW + BF_READERR)