patch 8.1.1719: popup too wide when 'showbreak' is set
Problem: Popup too wide when 'showbreak' is set.
Solution: Set window width when computing line length. (closes #4701)
diff --git a/src/popupwin.c b/src/popupwin.c
index d22c00d..a303582 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -971,9 +971,16 @@
wp->w_width = 1;
for (lnum = wp->w_topline; lnum <= wp->w_buffer->b_ml.ml_line_count; ++lnum)
{
- // count Tabs for what they are worth
- int len = win_linetabsize(wp, ml_get_buf(wp->w_buffer, lnum, FALSE),
+ int len;
+ int w_width = wp->w_width;
+
+ // Count Tabs for what they are worth and compute the length based on
+ // the maximum width (matters when 'showbreak' is set).
+ if (wp->w_width < maxwidth)
+ wp->w_width = maxwidth;
+ len = win_linetabsize(wp, ml_get_buf(wp->w_buffer, lnum, FALSE),
(colnr_T)MAXCOL);
+ wp->w_width = w_width;
if (wp->w_p_wrap)
{