summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-03 23:20:18 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-03 23:20:18 +0200
commite296e3177b67bdcaa8b1f144d2495b9413e7055c (patch)
tree925e3b981f50b4785b4d5be4d58f2ba9d055d80c /src
parent80edda1cf57d7bf8f22c021d724faab33c3c81d6 (diff)
patch 8.1.1622: wrong width if displaying a lot of lines in a popup windowv8.1.1622
Problem: Wrong width if displaying a lot of lines in a popup window. Solution: Accurately compute the line overflow.
Diffstat (limited to 'src')
-rw-r--r--src/popupwin.c4
-rw-r--r--src/testdir/dumps/Test_popupwin_firstline.dump8
-rw-r--r--src/testdir/test_popupwin.vim13
-rw-r--r--src/version.c2
4 files changed, 21 insertions, 6 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index df0cda83c0..099a0c26a3 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -855,8 +855,8 @@ popup_adjust_position(win_T *wp)
if (wp->w_width < len)
wp->w_width = len;
// do not use the width of lines we're not going to show
- if (wp->w_maxheight > 0 && wp->w_buffer->b_ml.ml_line_count
- - wp->w_topline + 1 + wrapped > wp->w_maxheight)
+ if (wp->w_maxheight > 0
+ && lnum - wp->w_topline + 1 + wrapped > wp->w_maxheight)
break;
}
diff --git a/src/testdir/dumps/Test_popupwin_firstline.dump b/src/testdir/dumps/Test_popupwin_firstline.dump
index 13712973dd..b3b0349305 100644
--- a/src/testdir/dumps/Test_popupwin_firstline.dump
+++ b/src/testdir/dumps/Test_popupwin_firstline.dump
@@ -1,10 +1,10 @@
>1+0&#ffffff0| @73
|2| @73
|3| @73
-|4| @33|3+0#0000001#ffd7ff255@4| +0#0000000#a8a8a8255| +0&#ffffff0@33
-|5| @33|4+0#0000001#ffd7ff255@1| @2| +0#0000000#0000001| +0&#ffffff0@33
-|6| @33|5+0#0000001#ffd7ff255| @3| +0#0000000#0000001| +0&#ffffff0@33
-|7| @33|6+0#0000001#ffd7ff255@4| +0#0000000#a8a8a8255| +0&#ffffff0@33
+|4| @32|3+0#0000001#ffd7ff255@4| | +0#0000000#a8a8a8255| +0&#ffffff0@33
+|5| @32|4+0#0000001#ffd7ff255@1| @3| +0#0000000#0000001| +0&#ffffff0@33
+|6| @32|5+0#0000001#ffd7ff255| @4| +0#0000000#0000001| +0&#ffffff0@33
+|7| @32|6+0#0000001#ffd7ff255@5| +0#0000000#a8a8a8255| +0&#ffffff0@33
|8| @73
|9| @73
@57|1|,|1| @10|T|o|p|
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index cc259762c2..f7579f5407 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -1697,3 +1697,16 @@ func Test_popupwin_with_buffer()
redraw
call popup_close(winid)
endfunc
+
+func Test_popupwin_width()
+ let winid = popup_create(repeat(['short', 'long long long line', 'medium width'], 50), {
+ \ 'maxwidth': 40,
+ \ 'maxheight': 10,
+ \ })
+ for top in range(1, 20)
+ call popup_setoptions(winid, {'firstline': top})
+ redraw
+ call assert_equal(19, popup_getpos(winid).width)
+ endfor
+ call popup_clear()
+endfunc
diff --git a/src/version.c b/src/version.c
index 8fd5239f12..efad64cad0 100644
--- a/src/version.c
+++ b/src/version.c
@@ -778,6 +778,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1622,
+/**/
1621,
/**/
1620,