comparison src/testdir/test_popupwin.vim @ 17897:fa032e079825 v8.1.1945

patch 8.1.1945: popup window "firstline" cannot be reset Commit: https://github.com/vim/vim/commit/9e67b6a6a126f401417590dedf1bd38f71bfbae4 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 30 17:34:08 2019 +0200 patch 8.1.1945: popup window "firstline" cannot be reset Problem: Popup window "firstline" cannot be reset. Solution: Allow for setting "firstline" to zero. Fix that the text jumps to the top when using win_execute(). (closes #4876)
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Aug 2019 17:45:04 +0200
parents bdddd215bf09
children fb773f73a4be
comparison
equal deleted inserted replaced
17896:6807cb2ca23c 17897:fa032e079825
331 \ firstline: 3, 331 \ firstline: 3,
332 \ }) 332 \ })
333 call assert_equal(3, popup_getoptions(winid).firstline) 333 call assert_equal(3, popup_getoptions(winid).firstline)
334 call popup_setoptions(winid, #{firstline: 1}) 334 call popup_setoptions(winid, #{firstline: 1})
335 call assert_equal(1, popup_getoptions(winid).firstline) 335 call assert_equal(1, popup_getoptions(winid).firstline)
336 call popup_close(winid)
337
338 let winid = popup_create(['xxx']->repeat(50), #{
339 \ maxheight: 3,
340 \ firstline: 11,
341 \ })
342 redraw
343 call assert_equal(11, popup_getoptions(winid).firstline)
344 call assert_equal(11, popup_getpos(winid).firstline)
345
346 " Normal command changes what is displayed but not "firstline"
347 call win_execute(winid, "normal! \<c-y>")
348 call assert_equal(11, popup_getoptions(winid).firstline)
349 call assert_equal(10, popup_getpos(winid).firstline)
350
351 " Making some property change applies "firstline" again
352 call popup_setoptions(winid, #{line: 4})
353 call assert_equal(11, popup_getoptions(winid).firstline)
354 call assert_equal(11, popup_getpos(winid).firstline)
355
356 " Remove "firstline" property and scroll
357 call popup_setoptions(winid, #{firstline: 0})
358 call win_execute(winid, "normal! \<c-y>")
359 call assert_equal(0, popup_getoptions(winid).firstline)
360 call assert_equal(10, popup_getpos(winid).firstline)
361
362 " Making some property change has no side effect
363 call popup_setoptions(winid, #{line: 3})
364 call assert_equal(0, popup_getoptions(winid).firstline)
365 call assert_equal(10, popup_getpos(winid).firstline)
336 366
337 call popup_close(winid) 367 call popup_close(winid)
338 endfunc 368 endfunc
339 369
340 func Test_popup_drag() 370 func Test_popup_drag()
1676 1706
1677 call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: 9})\<CR>") 1707 call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: 9})\<CR>")
1678 call term_sendkeys(buf, ":\<CR>") 1708 call term_sendkeys(buf, ":\<CR>")
1679 call VerifyScreenDump(buf, 'Test_popupwin_scroll_4', {}) 1709 call VerifyScreenDump(buf, 'Test_popupwin_scroll_4', {})
1680 1710
1681 call term_sendkeys(buf, ":call popup_setoptions(winid, #{scrollbarhighlight: 'ScrollBar', thumbhighlight: 'ScrollThumb'})\<CR>") 1711 call term_sendkeys(buf, ":call popup_setoptions(winid, #{scrollbarhighlight: 'ScrollBar', thumbhighlight: 'ScrollThumb', firstline: 5})\<CR>")
1682 call term_sendkeys(buf, ":call ScrollUp()\<CR>") 1712 call term_sendkeys(buf, ":call ScrollUp()\<CR>")
1683 call VerifyScreenDump(buf, 'Test_popupwin_scroll_5', {}) 1713 call VerifyScreenDump(buf, 'Test_popupwin_scroll_5', {})
1684 1714
1685 call term_sendkeys(buf, ":call ScrollDown()\<CR>") 1715 call term_sendkeys(buf, ":call ScrollDown()\<CR>")
1686 call VerifyScreenDump(buf, 'Test_popupwin_scroll_6', {}) 1716 call VerifyScreenDump(buf, 'Test_popupwin_scroll_6', {})