patch 8.1.1959: when using "firstline" in popup window text may jump

Problem:    When using "firstline" in popup window text may jump when
            redrawing it. (Nick Jensen)
Solution:   Set 'scrolloff' to zero in a popup window. (closes #4882)
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index a6d4d62..f0959e7 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -371,6 +371,24 @@
   call popup_close(winid)
 endfunc
 
+func Test_popup_noscrolloff()
+  set scrolloff=5
+  let winid = popup_create(['xxx']->repeat(50), #{
+	\ maxheight: 5,
+	\ firstline: 11,
+	\ })
+  redraw
+  call assert_equal(11, popup_getoptions(winid).firstline)
+  call assert_equal(11, popup_getpos(winid).firstline)
+
+  call popup_setoptions(winid, #{firstline: 0})
+  call win_execute(winid, "normal! \<c-y>")
+  call assert_equal(0, popup_getoptions(winid).firstline)
+  call assert_equal(10, popup_getpos(winid).firstline)
+
+  call popup_close(winid)
+endfunc
+
 func Test_popup_drag()
   CheckScreendump
 
@@ -1019,14 +1037,18 @@
   " global/buffer-local
   setlocal path=/there
   " global/window-local
-  setlocal scrolloff=9
+  setlocal statusline=2
 
   let winid = popup_create('hello', {})
   call assert_equal(0, getwinvar(winid, '&number'))
   call assert_equal(1, getwinvar(winid, '&wrap'))
   call assert_equal('', getwinvar(winid, '&omnifunc'))
   call assert_equal(&g:path, getwinvar(winid, '&path'))
-  call assert_equal(&g:scrolloff, getwinvar(winid, '&scrolloff'))
+  call assert_equal(&g:statusline, getwinvar(winid, '&statusline'))
+
+  " 'scrolloff' is reset to zero
+  call assert_equal(5, &scrolloff)
+  call assert_equal(0, getwinvar(winid, '&scrolloff'))
 
   call popup_close(winid)
   bwipe
@@ -1713,6 +1735,7 @@
   call VerifyScreenDump(buf, 'Test_popupwin_scroll_4', {})
 
   call term_sendkeys(buf, ":call popup_setoptions(winid, #{scrollbarhighlight: 'ScrollBar', thumbhighlight: 'ScrollThumb', firstline: 5})\<CR>")
+  " this scrolls two lines (half the window height)
   call term_sendkeys(buf, ":call ScrollUp()\<CR>")
   call VerifyScreenDump(buf, 'Test_popupwin_scroll_5', {})