forked from aniani/vim
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 #10229)
This commit is contained in:
@@ -1414,7 +1414,7 @@ popup_adjust_position(win_T *wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wp->w_firstline < 0)
|
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_has_scrollbar = wp->w_want_scrollbar
|
||||||
&& (wp->w_topline > 1 || lnum <= wp->w_buffer->b_ml.ml_line_count);
|
&& (wp->w_topline > 1 || lnum <= wp->w_buffer->b_ml.ml_line_count);
|
||||||
|
@@ -514,6 +514,19 @@ func Test_popup_firstline()
|
|||||||
call assert_equal(5, popup_getpos(winid).firstline)
|
call assert_equal(5, popup_getpos(winid).firstline)
|
||||||
|
|
||||||
call popup_close(winid)
|
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
|
endfunc
|
||||||
|
|
||||||
func Test_popup_firstline_cursorline()
|
func Test_popup_firstline_cursorline()
|
||||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4799,
|
||||||
/**/
|
/**/
|
||||||
4798,
|
4798,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user