]> granicus.if.org Git - vim/commitdiff
patch 8.1.1813: ATTENTION prompt for a preview popup window v8.1.1813
authorBram Moolenaar <Bram@vim.org>
Sun, 4 Aug 2019 18:44:19 +0000 (20:44 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 4 Aug 2019 18:44:19 +0000 (20:44 +0200)
Problem:    ATTENTION prompt for a preview popup window.
Solution:   Close the popup window if aborting the buffer load.  Avoid getting
            the ATTENTION dialog.

runtime/doc/windows.txt
src/ex_cmds.c
src/memline.c
src/tag.c
src/version.c
src/vim.h

index 87a5d6f6d817d3f6e3f635b53fc50049968ffb8a..fa9489659d06ac3fc7d377f7b962a348bf0a7395 100644 (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
@@ -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
index f79f054ec50fb704d1ab6ba831c43f57f49e23ff..98f5070bcb5eeed57b70048b73cd3d2d9dcf8319 100644 (file)
@@ -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
     }
index e401c73fa20709df6b70533b334387ccdaba7ed8..b6f0300516ccfd1f883bde70f7ff82485e6d2362 100644 (file)
@@ -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;
index 03587938bb368caaf9bad126a439bd16365f3bd9..e288e4d8394b6ab4a015340afe789fbfb2895b11 100644 (file)
--- 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:
index 71a14ad66b846d5d534a8d5521583ea6edff2f33..7c9ba68ad5b66ddea1b4758557ba1c961b084763 100644 (file)
@@ -773,6 +773,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1813,
 /**/
     1812,
 /**/
index 70fcf3a12cece1be9ebc62ddbc8dafa4e69cb699..1011be7c68cb0f77a08eb94bc6b02f9fc4ba1a20 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -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)