From 9ed46a77e6496e3a16c17b05ef4595393db6437b Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Sun, 16 Sep 2018 04:15:46 -0500 Subject: 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) --- src/nvim/popupmnu.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index 4c51f5de5e..68c8967b91 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -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. -- cgit