Patch 8.1.1622
Problem: Wrong width if displaying a lot of lines in a popup window.
Solution: Accurately compute the line overflow.
Files: src/popupwin.c, src/testdir/test_popupwin.vim,
src/testdir/dumps/Test_popupwin_firstline.dump
*** ../vim-8.1.1621/src/popupwin.c 2019-07-03 22:50:37.200501406 +0200
--- src/popupwin.c 2019-07-03 23:15:17.883091670 +0200
***************
*** 855,862 ****
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)
break;
}
--- 855,862 ----
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
! && lnum - wp->w_topline + 1 + wrapped > wp->w_maxheight)
break;
}
*** ../vim-8.1.1621/src/testdir/test_popupwin.vim 2019-07-03
22:50:37.200501406 +0200
--- src/testdir/test_popupwin.vim 2019-07-03 23:15:31.287002572 +0200
***************
*** 1697,1699 ****
--- 1697,1712 ----
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
*** ../vim-8.1.1621/src/testdir/dumps/Test_popupwin_firstline.dump
2019-06-26 03:39:59.897650758 +0200
--- src/testdir/dumps/Test_popupwin_firstline.dump 2019-07-03
23:17:23.998252553 +0200
***************
*** 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
|8| @73
|9| @73
@57|1|,|1| @10|T|o|p|
--- 1,10 ----
>1+0&#ffffff0| @73
|2| @73
|3| @73
! |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|
*** ../vim-8.1.1621/src/version.c 2019-07-03 22:53:03.579656609 +0200
--- src/version.c 2019-07-03 23:17:14.506315757 +0200
***************
*** 779,780 ****
--- 779,782 ----
{ /* Add new patch number below this line */
+ /**/
+ 1622,
/**/
--
Yah, well, we had to carve our electrons out of driftwood we'd
find. In the winter. Uphill. Both ways.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201907032120.x63LKZYQ029295%40masaka.moolenaar.net.
For more options, visit https://groups.google.com/d/optout.