aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/popupmnu.c
diff options
context:
space:
mode:
authorRonan Pigott <rpigott@berkeley.edu>2018-09-16 04:15:46 -0500
committerJustin M. Keyes <justinkz@gmail.com>2018-09-16 11:15:46 +0200
commit9ed46a77e6496e3a16c17b05ef4595393db6437b (patch)
tree1fbe6b299b67496e6019953bb9c08019a1098540 /src/nvim/popupmnu.c
parent3bce5207cf4649974f194b51ffe3e34e08d5184d (diff)
downloadrneovim-9ed46a77e6496e3a16c17b05ef4595393db6437b.tar.gz
rneovim-9ed46a77e6496e3a16c17b05ef4595393db6437b.tar.bz2
rneovim-9ed46a77e6496e3a16c17b05ef4595393db6437b.zip
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)
Diffstat (limited to 'src/nvim/popupmnu.c')
-rw-r--r--src/nvim/popupmnu.c12
1 files changed, 9 insertions, 3 deletions
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.