1
0
forked from aniani/vim

patch 9.1.0949: popups inconsistently shifted to the left

Problem:  popups inconsistently shifted to the left
Solution: always shift non-fixed popups to the left when the
          text would be truncated
          (no matter whether 'wrap' is set or not)
          (Boris Staletic)

fixes: #16231
closes: #16247

Signed-off-by: Boris Staletic <boris.staletic@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Boris Staletic
2024-12-19 20:22:19 +01:00
committed by Christian Brabandt
parent 83029a354e
commit 13c1153eef
4 changed files with 34 additions and 20 deletions

View File

@@ -1434,17 +1434,7 @@ popup_adjust_position(win_T *wp)
len = linetabsize(wp, lnum);
wp->w_width = w_width;
if (wp->w_p_wrap)
{
while (len + margin_width > maxwidth)
{
++wrapped;
len -= maxwidth - margin_width;
wp->w_width = maxwidth;
used_maxwidth = TRUE;
}
}
else if (len + margin_width > maxwidth
if (len + margin_width > maxwidth
&& allow_adjust_left
&& (wp->w_popup_pos == POPPOS_TOPLEFT
|| wp->w_popup_pos == POPPOS_BOTLEFT))
@@ -1456,7 +1446,6 @@ popup_adjust_position(win_T *wp)
{
int truncate_shift = shift_by - wp->w_wincol;
len -= truncate_shift;
shift_by -= truncate_shift;
}
@@ -1464,6 +1453,16 @@ popup_adjust_position(win_T *wp)
maxwidth += shift_by;
wp->w_width = maxwidth;
}
if (wp->w_p_wrap)
{
while (len + margin_width > maxwidth)
{
++wrapped;
len -= maxwidth - margin_width;
wp->w_width = maxwidth;
used_maxwidth = TRUE;
}
}
if (wp->w_width < len + margin_width)
{
wp->w_width = len + margin_width;