summaryrefslogtreecommitdiff
path: root/src/popupmnu.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-09-09 15:27:59 +0200
committerBram Moolenaar <Bram@vim.org>2018-09-09 15:27:59 +0200
commita750ac2288eae4f751185597885552e9b6e4d27c (patch)
treea74cad834ec36b20644eedb479d32e99173684d2 /src/popupmnu.c
parent53c8a478cc4265549597b00214e0da812154742e (diff)
downloadvim-git-a750ac2288eae4f751185597885552e9b6e4d27c.tar.gz
patch 8.1.0355: incorrect adjusting the popup menu for the preview windowv8.1.0355
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 #3414)
Diffstat (limited to 'src/popupmnu.c')
-rw-r--r--src/popupmnu.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/popupmnu.c b/src/popupmnu.c
index 524821725..0f920dc69 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -141,8 +141,8 @@ pum_display(
if (p_ph > 0 && pum_height > p_ph)
pum_height = p_ph;
- /* Put the pum below "pum_win_row" if possible. If there are few lines decide
- * on where there is more room. */
+ /* Put the pum below "pum_win_row" if possible. If there are few lines
+ * decide on where there is more room. */
if (pum_win_row + 2 >= below_row - pum_height
&& pum_win_row - above_row > (below_row - above_row) / 2)
{
@@ -196,11 +196,20 @@ pum_display(
return;
#if defined(FEAT_QUICKFIX)
- /* If there is a preview window at the above avoid drawing over it. */
- if (pvwin != NULL && pum_row < above_row && pum_height > above_row)
+ // If there is a preview window at the above avoid drawing over it.
+ // Do keep at least 10 entries.
+ if (pvwin != NULL && pum_row < above_row && pum_height > 10)
{
- pum_row += above_row;
- pum_height -= above_row;
+ if (pum_win_row - above_row < 10)
+ {
+ pum_row = pum_win_row - 10;
+ pum_height = 10;
+ }
+ else
+ {
+ pum_row = above_row;
+ pum_height = pum_win_row - above_row;
+ }
}
#endif