patch 8.1.1636: crash when popup has fitting scrollbar
Problem: Crash when popup has fitting scrollbar. (Trygve Aaberge)
Solution: Don't divide by zero if the scrollbar just fits. (closes #4615)
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 4e798c6..3983b57 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -1565,6 +1565,18 @@
call delete('XtestPopupScroll')
endfunc
+func Test_popup_fitting_scrollbar()
+ " this was causing a crash, divide by zero
+ let winid = popup_create([
+ \ 'one', 'two', 'longer line that wraps', 'four', 'five'], {
+ \ 'scrollbar': 1,
+ \ 'maxwidth': 10,
+ \ 'maxheight': 5,
+ \ 'firstline': 2})
+ redraw
+ call popup_clear()
+endfunc
+
func Test_popup_settext()
if !CanRunVimInTerminal()
throw 'Skipped: cannot make screendumps'