diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-04 20:44:19 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-04 20:44:19 +0200 |
commit | 2debf1c16b93f8693a785f675320d9e949c96a97 (patch) | |
tree | 5734e85cb84615af6c57aed4a7896543879488eb | |
parent | fb06d767a8d76eead5391302fc88115d6e3879d8 (diff) | |
download | vim-git-2debf1c16b93f8693a785f675320d9e949c96a97.tar.gz |
patch 8.1.1813: ATTENTION prompt for a preview popup windowv8.1.1813
Problem: ATTENTION prompt for a preview popup window.
Solution: Close the popup window if aborting the buffer load. Avoid getting
the ATTENTION dialog.
-rw-r--r-- | runtime/doc/windows.txt | 13 | ||||
-rw-r--r-- | src/ex_cmds.c | 13 | ||||
-rw-r--r-- | src/memline.c | 3 | ||||
-rw-r--r-- | src/tag.c | 16 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim.h | 1 |
6 files changed, 41 insertions, 7 deletions
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 87a5d6f6d..fa9489659 100644 --- 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 separated list of values: 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 index f79f054ec..98f5070bc 100644 --- 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 index e401c73fa..b6f030051 100644 --- 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; @@ -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 index 71a14ad66..7c9ba68ad 100644 --- 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, @@ -714,6 +714,7 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); #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) |