0
0
mirror of https://github.com/vim/vim.git synced 2025-10-29 09:37:35 -04:00

patch 9.1.1660: popups without decoration are positioned wrong at bottom of screen

Problem:  Popups without border/padding/title don't flip position when
          cursor is near bottom of screen, while decorated popups do
          flip correctly.
Solution: Use original height instead of truncated height for position
          inversion check, except for info popups to preserve existing
          behavior (glepnir).

fixes: #12546
closes: #18054

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
glepnir
2025-08-20 21:43:15 +02:00
committed by Christian Brabandt
parent bb1233d328
commit 38315295ef
4 changed files with 76 additions and 6 deletions

View File

@@ -1536,11 +1536,7 @@ popup_adjust_position(win_T *wp)
if (wp->w_has_scrollbar && wp->w_minwidth > 0)
{
int off = wp->w_width - maxwidth;
if (off > right_extra)
extra_width -= right_extra;
else
extra_width -= off;
extra_width -= MIN(off, right_extra);
wp->w_width = maxwidth_no_scrollbar;
}
else
@@ -1637,8 +1633,11 @@ popup_adjust_position(win_T *wp)
else if (wp->w_popup_pos == POPPOS_TOPRIGHT
|| wp->w_popup_pos == POPPOS_TOPLEFT)
{
int check_height = (wp->w_popup_flags & POPF_INFO) ? wp->w_height
: w_height_before_limit;
if (wp != popup_dragwin
&& wantline + (wp->w_height + extra_height) - 1 > Rows
&& wantline + (check_height + extra_height) - 1 > Rows
&& wantline * 2 > Rows
&& (wp->w_popup_flags & POPF_POSINVERT))
{