summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-27 19:36:55 +0100
committerBram Moolenaar <Bram@vim.org>2023-04-27 19:36:55 +0100
commit4e1ca0d9a6c6d66987da67155e97f83f286ffbcc (patch)
tree63a7c548e7e2ad2ffad040a1998243cf6adcd805
parentb7f2270bab102d68f83a6300699b7f98efad81f2 (diff)
downloadvim-git-4e1ca0d9a6c6d66987da67155e97f83f286ffbcc.tar.gz
patch 9.0.1493: popup menu position wrong in window with toolbarv9.0.1493
Problem: Popup menu position wrong in window with toolbar. Solution: Take the window toolbar into account when positioning the popup menu. (closes #12308)
-rw-r--r--src/popupmenu.c2
-rw-r--r--src/testdir/dumps/Test_popup_command_06.dump20
-rw-r--r--src/testdir/test_popup.vim11
-rw-r--r--src/version.c2
4 files changed, 33 insertions, 2 deletions
diff --git a/src/popupmenu.c b/src/popupmenu.c
index 36d3b9944..9cba669e3 100644
--- a/src/popupmenu.c
+++ b/src/popupmenu.c
@@ -1649,7 +1649,7 @@ pum_make_popup(char_u *path_name, int use_mouse_pos)
{
// Hack: set mouse position at the cursor so that the menu pops up
// around there.
- mouse_row = curwin->w_winrow + curwin->w_wrow;
+ mouse_row = W_WINROW(curwin) + curwin->w_wrow;
mouse_col = curwin->w_wincol + curwin->w_wcol;
}
diff --git a/src/testdir/dumps/Test_popup_command_06.dump b/src/testdir/dumps/Test_popup_command_06.dump
new file mode 100644
index 000000000..0e89747a0
--- /dev/null
+++ b/src/testdir/dumps/Test_popup_command_06.dump
@@ -0,0 +1,20 @@
+| +0&#e0e0e08| +2#ffffff16#6c6c6c255|T|E|S|T| | +0#0000000#e0e0e08@67
+|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @51
+|a|n|d| |o|n|e| |t|w|o| >X|t|h|r|e@1| |f|o|u|r| |f|i|v|e| @46
+|o|n|e| |m|o|r|e| |t|w| +0#0000001#ffd7ff255|U|n|d|o| @12| +0#0000000#ffffff0@45
+|~+0#4040ff13&| @9| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@45
+|~| @9| +0#0000001#ffd7ff255|P|a|s|t|e| @11| +0#4040ff13#ffffff0@45
+|~| @9| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@45
+|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |W|o|r|d| @5| +0#4040ff13#ffffff0@45
+|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |S|e|n|t|e|n|c|e| @1| +0#4040ff13#ffffff0@45
+|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |P|a|r|a|g|r|a|p|h| | +0#4040ff13#ffffff0@45
+|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |L|i|n|e| @5| +0#4040ff13#ffffff0@45
+|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |B|l|o|c|k| @4| +0#4040ff13#ffffff0@45
+|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |A|l@1| @6| +0#4040ff13#ffffff0@45
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|:+0#0000000&|p|o|p|u|p| |P|o|p|U|p| @62
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 1b091e338..a0a1f745a 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -910,7 +910,7 @@ func Test_popup_command_dump()
" 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
+ " "changed" shows up, which means the timer triggered.
call term_sendkeys(buf, "/X\<CR>:call StartTimer() | popup PopUp\<CR>")
call VerifyScreenDump(buf, 'Test_popup_command_04', {})
@@ -918,6 +918,15 @@ func Test_popup_command_dump()
call term_sendkeys(buf, "jj\<CR>")
call VerifyScreenDump(buf, 'Test_popup_command_05', {})
+ call term_sendkeys(buf, "\<Esc>")
+
+ " Add a window toolbar to the window and check the :popup menu position.
+ call term_sendkeys(buf, ":nnoremenu WinBar.TEST :\<CR>")
+ call term_sendkeys(buf, "/X\<CR>:popup PopUp\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_command_06', {})
+
+ call term_sendkeys(buf, "\<Esc>")
+
call StopVimInTerminal(buf)
endfunc
diff --git a/src/version.c b/src/version.c
index 475c36778..bc2c94521 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1493,
+/**/
1492,
/**/
1491,