0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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.
This commit is contained in:
Bram Moolenaar
2019-08-04 20:44:19 +02:00
parent fb06d767a8
commit 2debf1c16b
6 changed files with 41 additions and 7 deletions

View File

@@ -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 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 width maximum width of the popup
Example: > Example: >
:set previewpopup=height:10,width:60 :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* *:ptag*
:pta[g][!] [tagname] :pta[g][!] [tagname]
Does ":tag[!] [tagname]" and shows the found tag in a Does ":tag[!] [tagname]" and shows the found tag in a

View File

@@ -2454,7 +2454,7 @@ do_wqall(exarg_T *eap)
/* /*
* Check the 'write' option. * 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 int
not_writing(void) not_writing(void)
@@ -3118,6 +3118,12 @@ do_ecmd(
topline = curwin->w_topline; topline = curwin->w_topline;
if (!oldbuf) /* need to read the file */ 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; swap_exists_action = SEA_DIALOG;
curbuf->b_flags |= BF_CHECK_RO; /* set/reset 'ro' flag */ curbuf->b_flags |= BF_CHECK_RO; /* set/reset 'ro' flag */
@@ -3131,6 +3137,9 @@ do_ecmd(
(void)open_buffer(FALSE, eap, readfile_flags); (void)open_buffer(FALSE, eap, readfile_flags);
#endif #endif
#ifdef FEAT_TEXT_PROP
curbuf->b_flags &= ~BF_NO_SEA;
#endif
if (swap_exists_action == SEA_QUIT) if (swap_exists_action == SEA_QUIT)
retval = FAIL; retval = FAIL;
handle_swap_exists(&old_curbuf); handle_swap_exists(&old_curbuf);
@@ -3173,7 +3182,7 @@ do_ecmd(
maketitle(); maketitle();
#endif #endif
#ifdef FEAT_TEXT_PROP #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); popup_set_title(curwin);
#endif #endif
} }

View File

@@ -4860,7 +4860,8 @@ findswapname(
* (happens when all .swp files are in one directory). * (happens when all .swp files are in one directory).
*/ */
if (!recoverymode && buf_fname != NULL 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; int fd;
struct block0 b0; struct block0 b0;

View File

@@ -3663,7 +3663,7 @@ jumpto_tag(
if (g_do_tagpreview != 0 if (g_do_tagpreview != 0
&& curwin != curwin_save && win_valid(curwin_save)) && curwin != curwin_save && win_valid(curwin_save))
{ {
/* Return cursor to where we were */ // Return cursor to where we were
validate_cursor(); validate_cursor();
redraw_later(VALID); redraw_later(VALID);
win_enter(curwin_save, TRUE); win_enter(curwin_save, TRUE);
@@ -3675,11 +3675,23 @@ jumpto_tag(
else else
{ {
--RedrawingDisabled; --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); win_close(curwin, FALSE);
postponed_split = 0; 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: erret:

View File

@@ -773,6 +773,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 */
/**/
1813,
/**/ /**/
1812, 1812,
/**/ /**/

View File

@@ -714,6 +714,7 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring);
#define BF_DUMMY 0x80 // dummy buffer, only used internally #define BF_DUMMY 0x80 // dummy buffer, only used internally
#define BF_PRESERVED 0x100 // ":preserve" was used #define BF_PRESERVED 0x100 // ":preserve" was used
#define BF_SYN_SET 0x200 // 'syntax' option was set #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 */ /* Mask to check for flags that prevent normal writing */
#define BF_WRITE_MASK (BF_NOTEDITED + BF_NEW + BF_READERR) #define BF_WRITE_MASK (BF_NOTEDITED + BF_NEW + BF_READERR)