diff src/popupwin.c @ 17354:102ed3a26a5d v8.1.1676

patch 8.1.1676: "maxwidth" of popup window does not always work properly commit https://github.com/vim/vim/commit/017c2699381be17131a02f051ecb812067289856 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 13 14:17:51 2019 +0200 patch 8.1.1676: "maxwidth" of popup window does not always work properly Problem: "maxwidth" of popup window does not always work properly. Solution: Adjust the computation. (Naruhiko Nishino, closes https://github.com/vim/vim/issues/4653)
author Bram Moolenaar <Bram@vim.org>
date Sat, 13 Jul 2019 14:30:05 +0200
parents d82b0cfb1e82
children d1ea88736ebd
line wrap: on
line diff
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -799,6 +799,8 @@ popup_height(win_T *wp)
     int
 popup_width(win_T *wp)
 {
+    // w_leftcol is how many columns of the core are left of the screen
+    // w_popup_rightoff is how many columns of the core are right of the screen
     return wp->w_width + wp->w_leftcol
 	+ wp->w_popup_padding[3] + wp->w_popup_border[3]
 	+ wp->w_popup_padding[1] + wp->w_popup_border[1]
@@ -924,7 +926,11 @@ popup_adjust_position(win_T *wp)
 	    wp->w_width = maxwidth;
 	}
 	if (wp->w_width < len)
+	{
 	    wp->w_width = len;
+	    if (wp->w_maxwidth > 0 && wp->w_width > wp->w_maxwidth)
+		wp->w_width = wp->w_maxwidth;
+	}
 	// do not use the width of lines we're not going to show
 	if (wp->w_maxheight > 0
 		       && lnum - wp->w_topline + 1 + wrapped > wp->w_maxheight)