To: vim_dev@googlegroups.com Subject: Patch 8.1.2193 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2193 Problem: Popup_setoptions(popup_getoptions()) does not work. Solution: Also accept a list with three entries for "moved" and "mousemoved". (closes #5081) Files: runtime/doc/popup.txt, src/popupwin.c, src/testdir/test_popupwin.vim *** ../vim-8.1.2192/runtime/doc/popup.txt 2019-09-25 22:14:26.698530906 +0200 --- runtime/doc/popup.txt 2019-10-20 18:37:07.762378768 +0200 *************** *** 474,479 **** --- 474,481 ---- popup_show({id}) *popup_show()* If {id} is a hidden popup, show it now. For {id} see `popup_hide()`. + If {id} is the info popup it will be positioned next to the + current popup menu item. popup_setoptions({id}, {options}) *popup_setoptions()* *************** *** 680,687 **** --- 682,694 ---- - "expr": if the cursor moved outside || - [{start}, {end}]: if the cursor moved before column {start} or after {end} + - [{lnum}, {start}, {end}]: if the cursor moved away + from line {lnum}, before column {start} or after + {end} The popup also closes if the cursor moves to another line or to another window. + mousemoved Like "moved" but referring to the mouse pointer + position cursorline non-zero: Highlight the cursor line. Also scrolls the text to show this line (only works properly when 'wrap' is off). *** ../vim-8.1.2192/src/popupwin.c 2019-10-20 18:17:08.363431719 +0200 --- src/popupwin.c 2019-10-20 18:34:33.254998180 +0200 *************** *** 493,504 **** } else if (di->di_tv.v_type == VAR_LIST && di->di_tv.vval.v_list != NULL ! && di->di_tv.vval.v_list->lv_len == 2) { ! list_T *l = di->di_tv.vval.v_list; ! int mincol = tv_get_number(&l->lv_first->li_tv); ! int maxcol = tv_get_number(&l->lv_first->li_next->li_tv); if (mousemoved) { wp->w_popup_mouse_mincol = mincol; --- 493,520 ---- } else if (di->di_tv.v_type == VAR_LIST && di->di_tv.vval.v_list != NULL ! && (di->di_tv.vval.v_list->lv_len == 2 ! || di->di_tv.vval.v_list->lv_len == 3)) { ! list_T *l = di->di_tv.vval.v_list; ! listitem_T *li = l->lv_first; ! int mincol; ! int maxcol; + if (di->di_tv.vval.v_list->lv_len == 3) + { + varnumber_T nr = tv_get_number(&l->lv_first->li_tv); + + // Three numbers, might be from popup_getoptions(). + if (mousemoved) + wp->w_popup_mouse_row = nr; + else + wp->w_popup_lnum = nr; + li = li->li_next; + } + + mincol = tv_get_number(&li->li_tv); + maxcol = tv_get_number(&li->li_next->li_tv); if (mousemoved) { wp->w_popup_mouse_mincol = mincol; *** ../vim-8.1.2192/src/testdir/test_popupwin.vim 2019-10-20 18:17:08.367431701 +0200 --- src/testdir/test_popupwin.vim 2019-10-20 18:41:57.169198036 +0200 *************** *** 170,175 **** --- 170,179 ---- call assert_equal(['Top', 'Right', 'Bottom', 'Left'], options.borderhighlight) call assert_equal(['1', '^', '2', '>', '3', 'v', '4', '<'], options.borderchars) + " Check that popup_setoptions() takes the output of popup_getoptions() + call popup_setoptions(winid, options) + call assert_equal(options, popup_getoptions(winid)) + let winid = popup_create('hello both', #{line: 3, col: 8, border: [], padding: []}) call assert_equal(#{ \ line: 3, *** ../vim-8.1.2192/src/version.c 2019-10-20 18:17:08.367431701 +0200 --- src/version.c 2019-10-20 18:39:31.753794014 +0200 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2193, /**/ -- LARGE MAN: Who's that then? CART DRIVER: (Grudgingly) I dunno, Must be a king. LARGE MAN: Why? CART DRIVER: He hasn't got shit all over him. "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 ///