]> granicus.if.org Git - vim/commitdiff
patch 8.2.1989: info popup triggers WinEnter and WinLeave autocommands v8.2.1989
authorBram Moolenaar <Bram@vim.org>
Sun, 15 Nov 2020 13:09:37 +0000 (14:09 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 15 Nov 2020 13:09:37 +0000 (14:09 +0100)
Problem:    Info popup triggers WinEnter and WinLeave autocommands.
Solution:   Suppress autocommands for the info popup. (closes #7296)

src/popupmenu.c
src/testdir/test_popupwin.vim
src/version.c

index 279a68d7a42f406a4b11937c4c2bd304fbd60223..8033d7211177abbbb247db74352490ff774ff4c8 100644 (file)
@@ -795,6 +795,10 @@ pum_set_selected(int n, int repeat UNUSED)
                use_popup = USEPOPUP_NORMAL;
            else
                use_popup = USEPOPUP_NONE;
+           if (use_popup != USEPOPUP_NONE)
+               // don't use WinEnter or WinLeave autocommands for the info
+               // popup
+               block_autocmds();
 # endif
            // Open a preview window and set "curwin" to it.
            // 3 lines by default, prefer 'previewheight' if set and smaller.
@@ -972,6 +976,10 @@ pum_set_selected(int n, int repeat UNUSED)
            if (WIN_IS_POPUP(curwin))
                // can't keep focus in a popup window
                win_enter(firstwin, TRUE);
+# endif
+# ifdef FEAT_PROP_POPUP
+           if (use_popup != USEPOPUP_NONE)
+               unblock_autocmds();
 # endif
        }
 #endif
index fdfa305ba572a32a69cb2fafc7385b6d932f04eb..e5d4697e5fe86d2d6e961e442cab11a9a3192593 100644 (file)
@@ -3243,6 +3243,10 @@ func Get_popupmenu_lines()
          call popup_show(id)
        endif
       endfunc
+
+      " Check that no autocommands are triggered for the info popup
+      au WinEnter * if win_gettype() == 'popup' | call setline(2, 'WinEnter') | endif
+      au WinLeave * if win_gettype() == 'popup' | call setline(2, 'WinLeave') | endif
   END
   return lines
 endfunc
index 502a876da48590bec73b511898e70a262a4fc842..39900760977941cedd2629fd4fe5fa51d93cfaff 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1989,
 /**/
     1988,
 /**/