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:
Ronan Pigott
2018-09-16 04:15:46 -05:00
committed by Justin M. Keyes
parent 3bce5207cf
commit 9ed46a77e6
2 changed files with 50 additions and 14 deletions

View File

@@ -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 (pvwin != NULL && pum_row < above_row && pum_height > above_row) {
pum_row += above_row;
pum_height -= above_row;
// Do keep at least 10 entries.
if (pvwin != NULL && pum_row < above_row && pum_height > 10) {
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.