diff src/testdir/test_popupwin.vim @ 18558:e5ef5d820b5b v8.1.2273

patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor() Commit: https://github.com/vim/vim/commit/4dd8fe0b4f49ec267640fb457672452825b11df0 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 9 15:33:31 2019 +0100 patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor() Problem: Wrong default when "pos" is changed with popup_atcursor(). Solution: Adjust the default line and col when "pos" is not the default value. (#5151)
author Bram Moolenaar <Bram@vim.org>
date Sat, 09 Nov 2019 15:45:04 +0100
parents a6dbbedddce1
children 78e43be18f6b
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -1294,6 +1294,42 @@ func Test_popup_atcursor()
   bwipe!
 endfunc
 
+func Test_popup_atcursor_pos()
+  CheckScreendump
+
+  let lines =<< trim END
+	call setline(1, repeat([repeat('-', 60)], 15))
+	set so=0
+
+	normal 9G3|r#
+	let winid1 = popup_atcursor(['first', 'second'], #{
+	      \ moved: [0, 0, 0],
+	      \ })
+	normal 9G21|r&
+	let winid1 = popup_atcursor(['FIrsT', 'SEcoND'], #{
+	      \ pos: 'botright',
+	      \ moved: [0, 0, 0],
+	      \ })
+	normal 3G27|r%
+	let winid1 = popup_atcursor(['fiRSt', 'seCOnd'], #{
+	      \ pos: 'topleft',
+	      \ moved: [0, 0, 0],
+	      \ })
+	normal 3G45|r@
+	let winid1 = popup_atcursor(['First', 'SeconD'], #{
+	      \ pos: 'topright',
+	      \ moved: [0, 0, 0],
+	      \ })
+  END
+  call writefile(lines, 'XtestPopupAtcursorPos')
+  let buf = RunVimInTerminal('-S XtestPopupAtcursorPos', #{rows: 12})
+  call VerifyScreenDump(buf, 'Test_popupwin_atcursor_pos', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XtestPopupAtcursorPos')
+endfunc
+
 func Test_popup_beval()
   CheckScreendump
   CheckFeature balloon_eval_term