diff src/testdir/test_popupwin.vim @ 18613:fa995154904e v8.1.2300

patch 8.1.2300: redraw breaks going through list of popup windows Commit: https://github.com/vim/vim/commit/afe45b68a67769a61b44a96b0ffe3bfce4e9316e Author: Bram Moolenaar <Bram@vim.org> Date: Wed Nov 13 22:35:19 2019 +0100 patch 8.1.2300: redraw breaks going through list of popup windows Problem: Redraw breaks going through list of popup windows. Solution: Use different flags for popup_reset_handled(). (closes https://github.com/vim/vim/issues/5216)
author Bram Moolenaar <Bram@vim.org>
date Wed, 13 Nov 2019 22:45:03 +0100
parents f249b44039e0
children 3089b422b9dc
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -2949,4 +2949,38 @@ func Test_popupwin_cancel()
   call assert_equal({}, popup_getpos(win3))
 endfunc
 
+func Test_popupwin_filter_redraw()
+  " Create two popups with a filter that closes the popup when typing "0".
+  " Both popups should close, even though the redraw also calls
+  " popup_reset_handled()
+
+  func CloseFilter(winid, key)
+    if a:key == '0'
+      call popup_close(a:winid)
+      redraw
+    endif
+    return 0  " pass the key
+  endfunc
+
+  let id1 = popup_create('first one', #{
+	\ line: 1,
+	\ col: 1,
+	\ filter: 'CloseFilter',
+	\ })
+  let id2 = popup_create('second one', #{
+	\ line: 9,
+	\ col: 1,
+	\ filter: 'CloseFilter',
+	\ })
+  call assert_equal(1, popup_getpos(id1).line)
+  call assert_equal(9, popup_getpos(id2).line)
+
+  call feedkeys('0', 'xt')
+  call assert_equal({}, popup_getpos(id1))
+  call assert_equal({}, popup_getpos(id2))
+
+  call popup_clear()
+  delfunc CloseFilter
+endfunc
+
 " vim: shiftwidth=2 sts=2