popupmenu: fix positioning with vsplits

This commit is contained in:
Björn Linse 2019-01-01 15:14:43 +01:00
parent 4e5f5e93c2
commit cdfa395ad8
2 changed files with 77 additions and 1 deletions

View File

@ -94,7 +94,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed)
if (curwin->w_p_rl) {
col = curwin->w_width - curwin->w_wcol - 1;
} else {
col = curwin->w_wincol + curwin->w_wcol;
col = curwin->w_wcol;
}
int grid = (int)curwin->w_grid.handle;

View File

@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed = helpers.clear, helpers.feed
local source = helpers.source
local insert = helpers.insert
describe('ui/ext_popupmenu', function()
local screen
@ -257,4 +258,79 @@ describe('popup placement', function()
{2:-- }{5:match 1 of 10} |
]])
end)
it('works with vsplits', function()
insert('aaa aab aac\n')
feed(':vsplit<cr>')
screen:expect([[
aaa aab aac {3:}aaa aab aac|
^ {3:} |
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{4:[No Name] [+] }{3:<Name] [+] }|
:vsplit |
]])
feed('ibbb a<c-x><c-n>')
screen:expect([[
aaa aab aac {3:}aaa aab aac|
bbb aaa^ {3:}bbb aaa |
{1:~ }{s: aaa }{1: }{3:}{1:~ }|
{1:~ }{n: aab }{1: }{3:}{1:~ }|
{1:~ }{n: aac }{1: }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{4:[No Name] [+] }{3:<Name] [+] }|
{2:-- }{5:match 1 of 3} |
]])
feed('<esc><c-w><c-w>oc a<c-x><c-n>')
screen:expect([[
aaa aab aac{3:}aaa aab aac |
bbb aaa {3:}bbb aaa |
c aaa {3:}c aaa^ |
{1:~ }{3:}{1:~}{s: aaa }{1: }|
{1:~ }{3:}{1:~}{n: aab }{1: }|
{1:~ }{3:}{1:~}{n: aac }{1: }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{1:~ }{3:}{1:~ }|
{3:<Name] [+] }{4:[No Name] [+] }|
{2:-- }{5:match 1 of 3} |
]])
end)
end)