1
0
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:
Bram Moolenaar
2021-02-21 23:12:18 +01:00
parent b4893b8450
commit 6bfc475f71
3 changed files with 20 additions and 10 deletions

View File

@@ -873,19 +873,14 @@ 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)
if (nr != 0)
wp->w_popup_flags |= POPF_CURSORLINE;
else
wp->w_popup_flags &= ~POPF_CURSORLINE;
}
else
semsg(_(e_invargval), "cursorline");
}
di = dict_find(dict, (char_u *)"filter", -1);
if (di != NULL)

View File

@@ -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

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2541,
/**/
2540,
/**/