diff src/testdir/test_popupwin.vim @ 17934:0bf8cb0258be v8.1.1963

patch 8.1.1963: popup window filter may be called recursively Commit: https://github.com/vim/vim/commit/934470e562df7bc778ff916db44918f3ccecc7cc Author: Bram Moolenaar <Bram@vim.org> Date: Sun Sep 1 23:27:05 2019 +0200 patch 8.1.1963: popup window filter may be called recursively Problem: Popup window filter may be called recursively when using a Normal mode command. Solution: Prevent recursiveness. (closes #4887) Also restore KeyTyped.
author Bram Moolenaar <Bram@vim.org>
date Sun, 01 Sep 2019 23:30:03 +0200
parents ad7a4bd65f20
children 664cc72f50c5
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -1919,6 +1919,31 @@ func Test_popupwin_with_buffer()
   call delete('XsomeFile')
 endfunc
 
+func Test_popupwin_with_buffer_and_filter()
+  new Xwithfilter
+  call setline(1, range(100))
+  let bufnr = bufnr()
+  hide
+
+  func BufferFilter(win, key)
+    if a:key == 'G'
+      " recursive use of "G" does not cause problems.
+      call win_execute(a:win, 'normal! G')
+      return 1
+    endif
+    return 0
+  endfunc
+
+  let winid = popup_create(bufnr, #{maxheight: 5, filter: 'BufferFilter'})
+  call assert_equal(1, popup_getpos(winid).firstline)
+  redraw
+  call feedkeys("G", 'xt')
+  call assert_equal(99, popup_getpos(winid).firstline)
+
+  call popup_close(winid)
+  exe 'bwipe! ' .. bufnr
+endfunc
+
 func Test_popupwin_width()
   let winid = popup_create(repeat(['short', 'long long long line', 'medium width'], 50), #{
 	\ maxwidth: 40,