Skip to content

Commit 2dfae04

Browse files
committed
patch 8.2.1989: info popup triggers WinEnter and WinLeave autocommands
Problem: Info popup triggers WinEnter and WinLeave autocommands. Solution: Suppress autocommands for the info popup. (closes #7296)
1 parent e41decc commit 2dfae04

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/popupmenu.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,10 @@ pum_set_selected(int n, int repeat UNUSED)
795795
use_popup = USEPOPUP_NORMAL;
796796
else
797797
use_popup = USEPOPUP_NONE;
798+
if (use_popup != USEPOPUP_NONE)
799+
// don't use WinEnter or WinLeave autocommands for the info
800+
// popup
801+
block_autocmds();
798802
# endif
799803
// Open a preview window and set "curwin" to it.
800804
// 3 lines by default, prefer 'previewheight' if set and smaller.
@@ -972,6 +976,10 @@ pum_set_selected(int n, int repeat UNUSED)
972976
if (WIN_IS_POPUP(curwin))
973977
// can't keep focus in a popup window
974978
win_enter(firstwin, TRUE);
979+
# endif
980+
# ifdef FEAT_PROP_POPUP
981+
if (use_popup != USEPOPUP_NONE)
982+
unblock_autocmds();
975983
# endif
976984
}
977985
#endif

src/testdir/test_popupwin.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3243,6 +3243,10 @@ func Get_popupmenu_lines()
32433243
call popup_show(id)
32443244
endif
32453245
endfunc
3246+
3247+
" Check that no autocommands are triggered for the info popup
3248+
au WinEnter * if win_gettype() == 'popup' | call setline(2, 'WinEnter') | endif
3249+
au WinLeave * if win_gettype() == 'popup' | call setline(2, 'WinLeave') | endif
32463250
END
32473251
return lines
32483252
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
1989,
753755
/**/
754756
1988,
755757
/**/

0 commit comments

Comments
 (0)