Mercurial > vim
changeset 28550:f59db757e4ef v8.2.4799
patch 8.2.4799: popup does not use correct topline
Commit: https://github.com/vim/vim/commit/0044e5100a0e76a0bc1ea18c63a432c20428de5e
Author: LemonBoy <thatlemon@gmail.com>
Date: Wed Apr 20 19:47:37 2022 +0100
patch 8.2.4799: popup does not use correct topline
Problem: Popup does not use correct topline.
Solution: Also add one when firstline is negative. (closes https://github.com/vim/vim/issues/10229)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 20 Apr 2022 21:00:06 +0200 |
parents | 1e7b46dbdaed |
children | 1c4958ff5542 |
files | src/popupwin.c src/testdir/test_popupwin.vim src/version.c |
diffstat | 3 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/popupwin.c +++ b/src/popupwin.c @@ -1414,7 +1414,7 @@ popup_adjust_position(win_T *wp) } if (wp->w_firstline < 0) - wp->w_topline = lnum > 0 ? lnum + 1 : lnum; + 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);
--- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -514,6 +514,19 @@ func Test_popup_firstline() 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()