summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_popup.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-06-15 15:37:11 +0200
committerChristian Brabandt <cb@256bit.org>2024-06-15 15:37:11 +0200
commit883018feff43413813770dd1e13d4f950aa38524 (patch)
tree1a27b0c6f2b9c9312e595e04f28fce789ff415ab /src/testdir/test_popup.vim
parent105f741fac1b3242909c3c69384f00e4dcd9356e (diff)
patch 9.1.0491: Cmdline pum doesn't work properly with 'rightleft'v9.1.0491
Problem: Cmdline pum doesn't work properly with 'rightleft'. Solution: Don't use curwin->w_p_rl in cmdline mode in pum_redraw(). Use a static variable since pum_may_redraw() may be called in any mode. Also correct position of other popups with 'rightleft'. (zeertzjq) closes: #15005 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir/test_popup.vim')
-rw-r--r--src/testdir/test_popup.vim38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index ace1021a60..b9c6b92d01 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -908,6 +908,13 @@ func Test_popup_command_dump()
call term_sendkeys(buf, "\<Esc>")
+ if has('rightleft')
+ call term_sendkeys(buf, ":set rightleft\<CR>")
+ call term_sendkeys(buf, "/X\<CR>:popup PopUp\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_command_rl', {})
+ call term_sendkeys(buf, "\<Esc>:set norightleft\<CR>")
+ endif
+
" Set a timer to change a menu entry while it's displayed. The text should
" not change but the command does. Making the screendump also verifies that
" "changed" shows up, which means the timer triggered.
@@ -930,6 +937,37 @@ func Test_popup_command_dump()
call StopVimInTerminal(buf)
endfunc
+" Test position of right-click menu when clicking near window edge.
+func Test_mouse_popup_position()
+ CheckFeature menu
+ CheckScreendump
+
+ let script =<< trim END
+ set mousemodel=popup_setpos
+ source $VIMRUNTIME/menu.vim
+ call setline(1, join(range(20)))
+ func Trigger(col)
+ call test_setmouse(1, a:col)
+ call feedkeys("\<RightMouse>", 't')
+ endfunc
+ END
+ call writefile(script, 'XmousePopupPosition', 'D')
+ let buf = RunVimInTerminal('-S XmousePopupPosition', #{rows: 20, cols: 50})
+
+ call term_sendkeys(buf, ":call Trigger(45)\<CR>")
+ call VerifyScreenDump(buf, 'Test_mouse_popup_position_01', {})
+ call term_sendkeys(buf, "\<Esc>")
+
+ if has('rightleft')
+ call term_sendkeys(buf, ":set rightleft\<CR>")
+ call term_sendkeys(buf, ":call Trigger(50 + 1 - 45)\<CR>")
+ call VerifyScreenDump(buf, 'Test_mouse_popup_position_02', {})
+ call term_sendkeys(buf, "\<Esc>:set norightleft\<CR>")
+ endif
+
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_popup_complete_backwards()
new
call setline(1, ['Post', 'Port', 'Po'])