To: vim_dev@googlegroups.com Subject: Patch 8.1.2250 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2250 Problem: CTRL-U and CTRL-D don't work in popup window. Solution: Initialize 'scroll'. Add "lastline" in popup_getpos(). (closes #5170) Files: src/popupwin.c, src/testdir/test_popupwin.vim, runtime/doc/popup.txt *** ../vim-8.1.2249/src/popupwin.c 2019-11-02 20:21:02.467050123 +0100 --- src/popupwin.c 2019-11-03 22:09:25.057858932 +0100 *************** *** 1373,1378 **** --- 1373,1380 ---- wp->w_height = wp->w_maxheight; if (wp->w_height > Rows - wp->w_winrow) wp->w_height = Rows - wp->w_winrow; + if (wp->w_height != org_height) + win_comp_scroll(wp); if (center_vert) { *************** *** 2500,2505 **** --- 2502,2508 ---- dict_add_number(dict, "scrollbar", wp->w_has_scrollbar); dict_add_number(dict, "firstline", wp->w_topline); + dict_add_number(dict, "lastline", wp->w_botline - 1); dict_add_number(dict, "visible", win_valid(wp) && (wp->w_popup_flags & POPF_HIDDEN) == 0); *** ../vim-8.1.2249/src/testdir/test_popupwin.vim 2019-11-02 22:00:10.774005213 +0100 --- src/testdir/test_popupwin.vim 2019-11-03 22:28:17.569964180 +0100 *************** *** 142,147 **** --- 142,148 ---- \ height: 3, \ core_height: 1, \ firstline: 1, + \ lastline: 1, \ scrollbar: 0, \ visible: 1} let winid = popup_create('hello border', #{line: 2, col: 3, border: []})", *************** *** 186,191 **** --- 187,193 ---- \ scrollbar: 0, \ core_height: 1, \ firstline: 1, + \ lastline: 1, \ visible: 1}, popup_getpos(winid)) call popup_clear() *************** *** 385,390 **** --- 387,410 ---- call assert_equal(0, popup_getoptions(winid).firstline) call assert_equal(10, popup_getpos(winid).firstline) + " CTRL-D scrolls down half a page + let winid = popup_create(['xxx']->repeat(50), #{ + \ maxheight: 8, + \ }) + redraw + call assert_equal(1, popup_getpos(winid).firstline) + call win_execute(winid, "normal! \") + call assert_equal(5, popup_getpos(winid).firstline) + call win_execute(winid, "normal! \") + call assert_equal(9, popup_getpos(winid).firstline) + call win_execute(winid, "normal! \") + call assert_equal(5, popup_getpos(winid).firstline) + + call win_execute(winid, "normal! \") + call assert_equal(11, popup_getpos(winid).firstline) + call win_execute(winid, "normal! \") + call assert_equal(5, popup_getpos(winid).firstline) + call popup_close(winid) endfunc *************** *** 1795,1800 **** --- 1815,1821 ---- \ minheight: 4, \ maxheight: 4, \ firstline: 1, + \ lastline: 4, \ wrap: v:true, \ scrollbar: v:true, \ mapping: v:false, *** ../vim-8.1.2249/runtime/doc/popup.txt 2019-10-20 18:45:59.716195126 +0200 --- runtime/doc/popup.txt 2019-11-03 22:17:20.836052056 +0100 *************** *** 361,367 **** core_width width of the text box in screen cells core_height height of the text box in screen cells firstline line of the buffer at top (1 unless scrolled) ! (not the value of the "firstline" property) scrollbar non-zero if a scrollbar is displayed visible one if the popup is displayed, zero if hidden Note that these are the actual screen positions. They differ --- 361,368 ---- core_width width of the text box in screen cells core_height height of the text box in screen cells firstline line of the buffer at top (1 unless scrolled) ! (not the value of the "firstline" property) ! lastline line of the buffer at the bottom scrollbar non-zero if a scrollbar is displayed visible one if the popup is displayed, zero if hidden Note that these are the actual screen positions. They differ *** ../vim-8.1.2249/src/version.c 2019-11-03 21:46:16.425213135 +0100 --- src/version.c 2019-11-03 22:10:35.837600161 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2250, /**/ -- How To Keep A Healthy Level Of Insanity: 16. Have your coworkers address you by your wrestling name, Rock Hard Kim. /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///