diff src/testdir/test_popupwin.vim @ 21339:608f674c6035 v8.2.1220

patch 8.2.1220: memory access error when dragging a popup window Commit: https://github.com/vim/vim/commit/452143c6bf0dcf76ef415281b0e4fbc3edff4b6b Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 15 17:38:21 2020 +0200 patch 8.2.1220: memory access error when dragging a popup window Problem: memory access error when dragging a popup window over a buffer with folding. Solution: Avoid going over the end of the cache. (closes #6438)
author Bram Moolenaar <Bram@vim.org>
date Wed, 15 Jul 2020 17:45:03 +0200
parents 3fd32bf5fff0
children 3d73cdd173ab
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -584,9 +584,16 @@ func Test_popup_drag_termwin()
 
   " create a popup that covers the terminal window
   let lines =<< trim END
+	set foldmethod=marker
+	call setline(1, range(100))
+	for nr in range(7)
+	  call setline(nr * 12 + 1, "fold {{{")
+	  call setline(nr * 12 + 11 , "end }}}")
+	endfor
+	%foldclose
 	set shell=/bin/sh noruler
 	let $PS1 = 'vim> '
-        terminal
+        terminal ++rows=4
 	$wincmd w
 	let winid = popup_create(['1111', '2222'], #{
 	      \ drag: 1,
@@ -594,19 +601,33 @@ func Test_popup_drag_termwin()
 	      \ border: [],
 	      \ line: 3,
 	      \ })
-	func Dragit()
+	func DragitLeft()
 	  call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt")
 	endfunc
+	func DragitDown()
+	  call feedkeys("\<F4>\<LeftMouse>\<F5>\<LeftDrag>\<LeftRelease>", "xt")
+	endfunc
+	func DragitDownLeft()
+	  call feedkeys("\<F5>\<LeftMouse>\<F6>\<LeftDrag>\<LeftRelease>", "xt")
+	endfunc
 	map <silent> <F3> :call test_setmouse(3, &columns / 2)<CR>
 	map <silent> <F4> :call test_setmouse(3, &columns / 2 - 20)<CR>
+	map <silent> <F5> :call test_setmouse(12, &columns / 2)<CR>
+	map <silent> <F6> :call test_setmouse(12, &columns / 2 - 20)<CR>
   END
   call writefile(lines, 'XtestPopupTerm')
-  let buf = RunVimInTerminal('-S XtestPopupTerm', #{rows: 10})
+  let buf = RunVimInTerminal('-S XtestPopupTerm', #{rows: 16})
   call VerifyScreenDump(buf, 'Test_popupwin_term_01', {})
 
-  call term_sendkeys(buf, ":call Dragit()\<CR>")
+  call term_sendkeys(buf, ":call DragitLeft()\<CR>")
   call VerifyScreenDump(buf, 'Test_popupwin_term_02', {})
 
+  call term_sendkeys(buf, ":call DragitDown()\<CR>")
+  call VerifyScreenDump(buf, 'Test_popupwin_term_03', {})
+
+  call term_sendkeys(buf, ":call DragitDownLeft()\<CR>")
+  call VerifyScreenDump(buf, 'Test_popupwin_term_04', {})
+
   " clean up
   call StopVimInTerminal(buf)
   call delete('XtestPopupTerm')