Skip to content

Commit 4287ed3

Browse files
committed
patch 8.0.1522: popup menu is positioned in the wrong place
Problem: Popup menu is positioned in the wrong place. (Davit Samvelyan, Boris Staletic) Solution: Correct computation of the column and the conditions for that. (Hirohito Higashi, closes #2640)
1 parent 73cddfd commit 4287ed3

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

src/popupmnu.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,26 +252,30 @@ pum_display(
252252
{
253253
/* align right pum edge with "col" */
254254
#ifdef FEAT_RIGHTLEFT
255-
if (curwin->w_p_rl)
255+
if (curwin->w_p_rl
256+
&& col < max_width + pum_scrollbar + 1)
256257
{
257258
pum_col = col + max_width + pum_scrollbar + 1;
258259
if (pum_col >= Columns)
259260
pum_col = Columns - 1;
260261
}
261-
else
262+
else if (!curwin->w_p_rl)
262263
#endif
263264
{
264-
pum_col = col - max_width - pum_scrollbar;
265-
if (pum_col < 0)
266-
pum_col = 0;
265+
if (col > Columns - max_width - pum_scrollbar)
266+
{
267+
pum_col = Columns - max_width - pum_scrollbar;
268+
if (pum_col < 0)
269+
pum_col = 0;
270+
}
267271
}
268272

269273
#ifdef FEAT_RIGHTLEFT
270274
if (curwin->w_p_rl)
271-
pum_width = W_ENDCOL(curwin) - pum_col - pum_scrollbar + 1;
275+
pum_width = pum_col - pum_scrollbar + 1;
272276
else
273277
#endif
274-
pum_width = pum_col - pum_scrollbar;
278+
pum_width = Columns - pum_col - pum_scrollbar;
275279

276280
if (pum_width < p_pw)
277281
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,8 @@ static char *(features[]) =
771771

772772
static int included_patches[] =
773773
{ /* Add new patch number below this line */
774+
/**/
775+
1522,
774776
/**/
775777
1521,
776778
/**/

0 commit comments

Comments
 (0)