patch 8.1.1550: when a popup has left padding text may be cut off
Problem: When a popup has left padding text may be cut off.
Solution: Add the border and padding when computing the size.
diff --git a/src/popupwin.c b/src/popupwin.c
index adbc729..c0b5e13 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -588,7 +588,7 @@
// When centering or right aligned, use maximum width.
// When left aligned use the space available, but shift to the left when we
// hit the right of the screen.
- maxwidth = Columns - wp->w_wincol;
+ maxwidth = Columns - wp->w_wincol - left_extra;
if (wp->w_maxwidth > 0 && maxwidth > wp->w_maxwidth)
{
allow_adjust_left = FALSE;
@@ -622,11 +622,12 @@
|| wp->w_popup_pos == POPPOS_BOTLEFT))
{
// adjust leftwise to fit text on screen
- int shift_by = ( len - maxwidth );
+ int shift_by = len - maxwidth;
- if ( shift_by > wp->w_wincol )
+ if (shift_by > wp->w_wincol)
{
int truncate_shift = shift_by - wp->w_wincol;
+
len -= truncate_shift;
shift_by -= truncate_shift;
}