mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.0355 Incorrect adjusting the popup menu (#8996)
Problem: Incorrect adjusting the popup menu for the preview window. Solution: Compute position and height properl. (Ronan Pigott) Also show at least ten items. (closes vim/vim#3414)
This commit is contained in:
parent
3bce5207cf
commit
9ed46a77e6
@ -201,9 +201,15 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If there is a preview window above, avoid drawing over it.
|
// If there is a preview window above, avoid drawing over it.
|
||||||
if (pvwin != NULL && pum_row < above_row && pum_height > above_row) {
|
// Do keep at least 10 entries.
|
||||||
pum_row += above_row;
|
if (pvwin != NULL && pum_row < above_row && pum_height > 10) {
|
||||||
pum_height -= above_row;
|
if (row - above_row < 10) {
|
||||||
|
pum_row = row - 10;
|
||||||
|
pum_height = 10;
|
||||||
|
} else {
|
||||||
|
pum_row = above_row;
|
||||||
|
pum_height = row - above_row;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the width of the widest match and the widest extra.
|
// Compute the width of the widest match and the widest extra.
|
||||||
|
@ -170,7 +170,37 @@ describe('popup placement', function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with preview-window above and inverted', function()
|
it('works with preview-window above and tall and inverted', function()
|
||||||
|
feed(':ped<CR><c-w>8+')
|
||||||
|
feed('iaa<cr>bb<cr>cc<cr>dd<cr>ee<cr>')
|
||||||
|
feed('ff<cr>gg<cr>hh<cr>ii<cr>jj<cr>')
|
||||||
|
feed('kk<cr>ll<cr>mm<cr>nn<cr>oo<cr>')
|
||||||
|
feed('<c-x><c-n>')
|
||||||
|
screen:expect([[
|
||||||
|
aa |
|
||||||
|
bb |
|
||||||
|
cc |
|
||||||
|
dd |
|
||||||
|
{s:aa }{c: }{3:ew][+] }|
|
||||||
|
{n:bb }{c: } |
|
||||||
|
{n:cc }{c: } |
|
||||||
|
{n:dd }{c: } |
|
||||||
|
{n:ee }{c: } |
|
||||||
|
{n:ff }{c: } |
|
||||||
|
{n:gg }{c: } |
|
||||||
|
{n:hh }{c: } |
|
||||||
|
{n:ii }{c: } |
|
||||||
|
{n:jj }{c: } |
|
||||||
|
{n:kk }{c: } |
|
||||||
|
{n:ll }{s: } |
|
||||||
|
{n:mm }{s: } |
|
||||||
|
aa^ |
|
||||||
|
{4:[No Name] [+] }|
|
||||||
|
{2:-- }{5:match 1 of 15} |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('works with preview-window above and short and inverted', function()
|
||||||
feed(':ped<CR><c-w>4+')
|
feed(':ped<CR><c-w>4+')
|
||||||
feed('iaa<cr>bb<cr>cc<cr>dd<cr>ee<cr>')
|
feed('iaa<cr>bb<cr>cc<cr>dd<cr>ee<cr>')
|
||||||
feed('ff<cr>gg<cr>hh<cr>ii<cr>jj<cr>')
|
feed('ff<cr>gg<cr>hh<cr>ii<cr>jj<cr>')
|
||||||
@ -183,16 +213,16 @@ describe('popup placement', function()
|
|||||||
ee |
|
ee |
|
||||||
ff |
|
ff |
|
||||||
gg |
|
gg |
|
||||||
hh |
|
{s:aa } |
|
||||||
{3:[No Name] [Preview][+] }|
|
{n:bb }{3:iew][+] }|
|
||||||
cc |
|
{n:cc } |
|
||||||
dd |
|
{n:dd } |
|
||||||
ee |
|
{n:ee } |
|
||||||
ff |
|
{n:ff } |
|
||||||
gg |
|
{n:gg } |
|
||||||
hh |
|
{n:hh } |
|
||||||
{s:aa }{c: } |
|
{n:ii } |
|
||||||
{n:bb }{s: } |
|
{n:jj } |
|
||||||
aa^ |
|
aa^ |
|
||||||
{4:[No Name] [+] }|
|
{4:[No Name] [+] }|
|
||||||
{2:-- }{5:match 1 of 10} |
|
{2:-- }{5:match 1 of 10} |
|
||||||
|
Loading…
Reference in New Issue
Block a user