To: vim_dev@googlegroups.com Subject: Patch 8.2.4799 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4799 Problem: Popup does not use correct topline. Solution: Also add one when firstline is negative. (closes #10229) Files: src/popupwin.c, src/testdir/test_popupwin.vim *** ../vim-8.2.4798/src/popupwin.c 2022-04-04 16:56:50.772629666 +0100 --- src/popupwin.c 2022-04-20 19:43:56.496069859 +0100 *************** *** 1414,1420 **** } if (wp->w_firstline < 0) ! wp->w_topline = lnum > 0 ? lnum + 1 : lnum; wp->w_has_scrollbar = wp->w_want_scrollbar && (wp->w_topline > 1 || lnum <= wp->w_buffer->b_ml.ml_line_count); --- 1414,1420 ---- } if (wp->w_firstline < 0) ! wp->w_topline = lnum + 1; wp->w_has_scrollbar = wp->w_want_scrollbar && (wp->w_topline > 1 || lnum <= wp->w_buffer->b_ml.ml_line_count); *** ../vim-8.2.4798/src/testdir/test_popupwin.vim 2022-04-04 16:56:50.772629666 +0100 --- src/testdir/test_popupwin.vim 2022-04-20 19:47:07.975960038 +0100 *************** *** 514,519 **** --- 514,532 ---- call assert_equal(5, popup_getpos(winid).firstline) call popup_close(winid) + + " Popup with less elements than the maximum height and negative firstline: + " check that the popup height is correctly computed. + let winid = popup_create(['xxx']->repeat(4), #{ + \ firstline: -1, + \ maxheight: 6, + \ }) + + let pos = popup_getpos(winid) + call assert_equal(3, pos.width) + call assert_equal(4, pos.height) + + call popup_close(winid) endfunc func Test_popup_firstline_cursorline() *** ../vim-8.2.4798/src/version.c 2022-04-20 19:08:45.289292854 +0100 --- src/version.c 2022-04-20 19:46:29.547981871 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4799, /**/ -- `The Guide says there is an art to flying,' said Ford, `or at least a knack. The knack lies in learning how to throw yourself at the ground and miss.' He smiled weakly. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///