0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.0.0058

Problem:    Positioning of the popup menu is not good.
Solution:   Position it better. (Hirohito Higashi)
This commit is contained in:
Bram Moolenaar
2016-11-04 20:08:52 +01:00
parent 9376f5f482
commit 91e44a3305
2 changed files with 24 additions and 24 deletions

View File

@@ -54,18 +54,21 @@ pum_display(
int kind_width; int kind_width;
int extra_width; int extra_width;
int i; int i;
int top_clear;
int row; int row;
int context_lines; int context_lines;
int col; int col;
int above_row = cmdline_row; int above_row;
int below_row;
int redo_count = 0; int redo_count = 0;
win_T *pvwin;
redo: redo:
def_width = PUM_DEF_WIDTH; def_width = PUM_DEF_WIDTH;
max_width = 0; max_width = 0;
kind_width = 0; kind_width = 0;
extra_width = 0; extra_width = 0;
above_row = 0;
below_row = cmdline_row;
/* Pretend the pum is already there to avoid that must_redraw is set when /* Pretend the pum is already there to avoid that must_redraw is set when
* 'cuc' is on. */ * 'cuc' is on. */
@@ -76,18 +79,16 @@ redo:
row = curwin->w_wrow + W_WINROW(curwin); row = curwin->w_wrow + W_WINROW(curwin);
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
if (firstwin->w_p_pvw) FOR_ALL_WINDOWS(pvwin)
top_clear = firstwin->w_height; if (pvwin->w_p_pvw)
else break;
#endif if (pvwin != NULL)
top_clear = 0; {
if (W_WINROW(pvwin) < W_WINROW(curwin))
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) above_row = W_WINROW(pvwin) + pvwin->w_height;
/* When the preview window is at the bottom stop just above it. Also else if (W_WINROW(pvwin) > W_WINROW(curwin) + curwin->w_height)
* avoid drawing over the status line so that it's clear there is a window below_row = W_WINROW(pvwin);
* boundary. */ }
if (lastwin->w_p_pvw)
above_row -= lastwin->w_height + lastwin->w_status_height + 1;
#endif #endif
/* /*
@@ -102,8 +103,7 @@ redo:
/* Put the pum below "row" if possible. If there are few lines decide on /* Put the pum below "row" if possible. If there are few lines decide on
* where there is more room. */ * where there is more room. */
if (row + 2 >= above_row - pum_height if (row - above_row >= below_row - row)
&& row > (above_row - top_clear) / 2)
{ {
/* pum above "row" */ /* pum above "row" */
@@ -141,8 +141,8 @@ redo:
+ curwin->w_cline_height - curwin->w_wrow; + curwin->w_cline_height - curwin->w_wrow;
pum_row = row + context_lines; pum_row = row + context_lines;
if (size > above_row - pum_row) if (size > below_row - pum_row)
pum_height = above_row - pum_row; pum_height = below_row - pum_row;
else else
pum_height = size; pum_height = size;
if (p_ph > 0 && pum_height > p_ph) if (p_ph > 0 && pum_height > p_ph)
@@ -154,13 +154,11 @@ redo:
return; return;
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
/* If there is a preview window at the top avoid drawing over it. */ /* If there is a preview window at the above avoid drawing over it. */
if (firstwin->w_p_pvw if (pvwin != NULL && pum_row < above_row && pum_height > above_row)
&& pum_row < firstwin->w_height
&& pum_height > firstwin->w_height + 4)
{ {
pum_row += firstwin->w_height; pum_row += above_row;
pum_height -= firstwin->w_height; pum_height -= above_row;
} }
#endif #endif

View File

@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
58,
/**/ /**/
57, 57,
/**/ /**/