To: vim_dev@googlegroups.com Subject: Patch 8.2.2541 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2541 Problem: Popup_create() does not allow boolean for "cursorline". Solution: Use dict_get_bool(). (issue #7869) Files: src/popupwin.c, src/testdir/test_popupwin.vim *** ../vim-8.2.2540/src/popupwin.c 2021-02-13 21:31:14.252539788 +0100 --- src/popupwin.c 2021-02-21 22:57:12.981631548 +0100 *************** *** 873,890 **** handle_moved_argument(wp, di, TRUE); } ! di = dict_find(dict, (char_u *)"cursorline", -1); ! if (di != NULL) { ! 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; ! } else ! semsg(_(e_invargval), "cursorline"); } di = dict_find(dict, (char_u *)"filter", -1); --- 873,885 ---- handle_moved_argument(wp, di, TRUE); } ! nr = dict_get_bool(dict, (char_u *)"cursorline", -1); ! if (nr != -1) { ! if (nr != 0) ! wp->w_popup_flags |= POPF_CURSORLINE; else ! wp->w_popup_flags &= ~POPF_CURSORLINE; } di = dict_find(dict, (char_u *)"filter", -1); *** ../vim-8.2.2540/src/testdir/test_popupwin.vim 2021-02-13 21:31:14.252539788 +0100 --- src/testdir/test_popupwin.vim 2021-02-21 23:09:57.326637792 +0100 *************** *** 2978,2983 **** --- 2978,2987 ---- 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,3117 **** --- 3116,3130 ---- 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 *** ../vim-8.2.2540/src/version.c 2021-02-21 22:20:18.865587667 +0100 --- src/version.c 2021-02-21 22:59:18.513135477 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2541, /**/ -- ROBIN: The what? ARTHUR: The Holy Hand Grenade of Antioch. 'Tis one of the sacred relics Brother Maynard always carries with him. ALL: Yes. Of course. ARTHUR: (shouting) Bring up the Holy Hand Grenade! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///