diff src/popupwin.c @ 17442:57b9fca8c7d2 v8.1.1719

patch 8.1.1719: popup too wide when 'showbreak' is set commit https://github.com/vim/vim/commit/331bafd481fddfe542099d8cccd38d240c10c011 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 20 17:46:05 2019 +0200 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 https://github.com/vim/vim/issues/4701)
author Bram Moolenaar <Bram@vim.org>
date Sat, 20 Jul 2019 18:00:07 +0200
parents a5874fdc8f3a
children 74b6674b99fd
line wrap: on
line diff
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -971,9 +971,16 @@ popup_adjust_position(win_T *wp)
     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)
 	{