forked from aniani/vim
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Problem: Popup_create() does not allow boolean for "cursorline". Solution: Use dict_get_bool(). (issue #7869)
This commit is contained in:
@@ -873,18 +873,13 @@ apply_general_options(win_T *wp, dict_T *dict)
|
||||
handle_moved_argument(wp, di, TRUE);
|
||||
}
|
||||
|
||||
di = dict_find(dict, (char_u *)"cursorline", -1);
|
||||
if (di != NULL)
|
||||
nr = dict_get_bool(dict, (char_u *)"cursorline", -1);
|
||||
if (nr != -1)
|
||||
{
|
||||
if (di->di_tv.v_type == VAR_NUMBER)
|
||||
{
|
||||
if (di->di_tv.vval.v_number != 0)
|
||||
wp->w_popup_flags |= POPF_CURSORLINE;
|
||||
else
|
||||
wp->w_popup_flags &= ~POPF_CURSORLINE;
|
||||
}
|
||||
if (nr != 0)
|
||||
wp->w_popup_flags |= POPF_CURSORLINE;
|
||||
else
|
||||
semsg(_(e_invargval), "cursorline");
|
||||
wp->w_popup_flags &= ~POPF_CURSORLINE;
|
||||
}
|
||||
|
||||
di = dict_find(dict, (char_u *)"filter", -1);
|
||||
|
||||
@@ -2978,6 +2978,10 @@ func Test_popup_cursorline()
|
||||
call assert_equal(1, popup_getoptions(winid).cursorline)
|
||||
call popup_close(winid)
|
||||
|
||||
let winid = popup_create('some text', #{ cursorline: v:true, })
|
||||
call assert_equal(1, popup_getoptions(winid).cursorline)
|
||||
call popup_close(winid)
|
||||
|
||||
let winid = popup_create('some text', #{ cursorline: 0, })
|
||||
call assert_equal(0, popup_getoptions(winid).cursorline)
|
||||
call popup_close(winid)
|
||||
@@ -3112,6 +3116,15 @@ func Test_popup_cursorline()
|
||||
call delete('XtestPopupCursorLine')
|
||||
endfunc
|
||||
|
||||
def Test_popup_cursorline_vim9()
|
||||
var winid = popup_create('some text', { cursorline: true, })
|
||||
assert_equal(1, popup_getoptions(winid).cursorline)
|
||||
popup_close(winid)
|
||||
|
||||
assert_fails("popup_create('some text', { cursorline: 2, })", 'E1023:')
|
||||
popup_clear()
|
||||
enddef
|
||||
|
||||
func Test_previewpopup()
|
||||
CheckScreendump
|
||||
CheckFeature quickfix
|
||||
|
||||
@@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2541,
|
||||
/**/
|
||||
2540,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user