diff src/testdir/test_popupwin.vim @ 26165:7b07f361b1d4 v8.2.3614

patch 8.2.3614: zindex of popup windows not used when redrawing popup menu Commit: https://github.com/vim/vim/commit/6555500bcf280716187eea9dba22d4f69bc0a501 Author: Bakudankun <bakudankun@gmail.com> Date: Wed Nov 17 20:40:16 2021 +0000 patch 8.2.3614: zindex of popup windows not used when redrawing popup menu Problem: zindex of popup windows not used when redrawing popup menu. Solution: Check the zindex when redrawing the popup menu. (closes https://github.com/vim/vim/issues/9129, closes #9089)
author Bram Moolenaar <Bram@vim.org>
date Wed, 17 Nov 2021 21:45:05 +0100
parents 7cb1597067e0
children 0374f55a16be
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -3328,6 +3328,32 @@ func Get_popupmenu_lines()
 	endif
       endfunc
 
+      func OpenOtherPopups()
+	call popup_create([
+		\ 'popup below',
+		\ 'popup below',
+		\ 'popup below',
+		\ 'popup below',
+	      \ ], #{
+		\ line: 'cursor',
+		\ col: 'cursor+3',
+		\ highlight: 'ErrorMsg',
+		\ minwidth: 17,
+		\ zindex: 50,
+	      \ })
+	call popup_create([
+		\ 'popup on top',
+		\ 'popup on top',
+		\ 'popup on top',
+	      \ ], #{
+		\ line: 'cursor+3',
+		\ col: 'cursor-10',
+		\ highlight: 'Search',
+		\ minwidth: 10,
+		\ zindex: 200,
+	      \ })
+      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
@@ -3520,6 +3546,29 @@ func Test_popupmenu_info_too_wide()
   call delete('XtestInfoPopupWide')
 endfunc
 
+func Test_popupmenu_masking()
+  " Test that popup windows that are opened while popup menu is open are
+  " properly displayed.
+  CheckScreendump
+  CheckFeature quickfix
+
+  let lines = Get_popupmenu_lines()
+  call add(lines, 'inoremap <C-A> <Cmd>call OpenOtherPopups()<CR>')
+  call writefile(lines, 'XtestPopupmenuMasking')
+
+  let buf = RunVimInTerminal('-S XtestPopupmenuMasking', #{rows: 14})
+  call TermWait(buf, 25)
+
+  call term_sendkeys(buf, "A\<C-X>\<C-U>\<C-A>")
+  call VerifyScreenDump(buf, 'Test_popupwin_popupmenu_masking_1', {})
+
+  call term_sendkeys(buf, "\<Esc>")
+  call VerifyScreenDump(buf, 'Test_popupwin_popupmenu_masking_2', {})
+
+  call StopVimInTerminal(buf)
+  call delete('XtestPopupmenuMasking')
+endfunc
+
 func Test_popupwin_recycle_bnr()
   let bufnr = popup_notification('nothing wrong', {})->winbufnr()
   call popup_clear()