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>
diff --git a/src/popupwin.c b/src/popupwin.c
index 8c56717..4045490 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -1434,17 +1434,7 @@
 	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 @@
 	    {
 		int truncate_shift = shift_by - wp->w_wincol;
 
-		len -= truncate_shift;
 		shift_by -= truncate_shift;
 	    }
 
@@ -1464,6 +1453,16 @@
 	    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;