neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit aca226d728418e791b897a908631d52aa24157fe
parent fbaa2787736173e417a93b958a9ca61e888e567d
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Fri, 28 Apr 2023 05:50:08 +0800

vim-patch:9.0.1493: popup menu position wrong in window with toolbar

Problem:    Popup menu position wrong in window with toolbar.
Solution:   Take the window toolbar into account when positioning the popup
            menu. (closes vim/vim#12308)

https://github.com/vim/vim/commit/4e1ca0d9a6c6d66987da67155e97f83f286ffbcc

Fixed in the previous commit. Test only.

Diffstat:
Mtest/functional/ui/popupmenu_spec.lua | 28++++++++++++++++++++++++++++
Mtest/old/testdir/test_popup.vim | 17++++++++++++-----
2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua @@ -4508,6 +4508,34 @@ describe('builtin popupmenu', function() {1:~ }| pasted | ]]) + + -- Add a window toolbar to the window and check the :popup menu position. + command('setlocal winbar=TEST') + feed('/X<CR>:popup PopUp<CR>') + screen:expect([[ + {2:TEST }| + one two three four five | + and one two {7:^X}three four five | + one more tw{n: Undo } | + {1:~ }{n: }{1: }| + {1:~ }{n: Paste }{1: }| + {1:~ }{n: }{1: }| + {1:~ }{n: Select Word }{1: }| + {1:~ }{n: Select Sentence }{1: }| + {1:~ }{n: Select Paragraph }{1: }| + {1:~ }{n: Select Line }{1: }| + {1:~ }{n: Select Block }{1: }| + {1:~ }{n: Select All }{1: }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + :popup PopUp | + ]]) + + feed('<Esc>') end) describe('"kind" and "menu"', function() diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim @@ -885,14 +885,14 @@ func Test_popup_command_dump() echomsg 'changed' endfunc END - call writefile(script, 'XtimerScript') + call writefile(script, 'XtimerScript', 'D') let lines =<< trim END one two three four five and one two Xthree four five one more two three four five END - call writefile(lines, 'Xtest') + call writefile(lines, 'Xtest', 'D') let buf = RunVimInTerminal('-S XtimerScript Xtest', {}) call term_sendkeys(buf, ":source $VIMRUNTIME/menu.vim\<CR>") call term_sendkeys(buf, "/X\<CR>:popup PopUp\<CR>") @@ -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,9 +918,16 @@ 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) - call delete('Xtest') - call delete('XtimerScript') endfunc func Test_popup_complete_backwards()