]> granicus.if.org Git - vim/commitdiff
patch 8.1.0355: incorrect adjusting the popup menu for the preview window v8.1.0355
authorBram Moolenaar <Bram@vim.org>
Sun, 9 Sep 2018 13:27:59 +0000 (15:27 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 9 Sep 2018 13:27:59 +0000 (15:27 +0200)
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)

src/popupmnu.c
src/version.c

index 52482172556be0fb5217a56ffa789d966d2cfbc3..0f920dc69ea4a5354af6004365f2fce897026c2f 100644 (file)
@@ -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
 
index 480d20e8b1540a786746302ef262314384e2a030..26825b9f81183a193b16d931f969a633bc44cc41 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    355,
 /**/
     354,
 /**/