Mercurial > vim
changeset 22884:68dc849715b5 v8.2.1989
patch 8.2.1989: info popup triggers WinEnter and WinLeave autocommands
Commit: https://github.com/vim/vim/commit/2dfae04f376a58d4c5a801cb652c8eae65900672
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 15 14:09:37 2020 +0100
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 https://github.com/vim/vim/issues/7296)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 15 Nov 2020 14:15:04 +0100 |
parents | f786ab06aee7 |
children | dc9330ed5a5c |
files | src/popupmenu.c src/testdir/test_popupwin.vim src/version.c |
diffstat | 3 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/popupmenu.c +++ b/src/popupmenu.c @@ -795,6 +795,10 @@ pum_set_selected(int n, int repeat UNUSE 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. @@ -973,6 +977,10 @@ pum_set_selected(int n, int repeat UNUSE // 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 }
--- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -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