forked from aniani/vim
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Problem: Popup_setoptions(popup_getoptions()) does not work. Solution: Also accept a list with three entries for "moved" and "mousemoved". (closes #5081)
This commit is contained in:
@@ -474,6 +474,8 @@ popup_notification({what}, {options}) *popup_notification()*
|
|||||||
popup_show({id}) *popup_show()*
|
popup_show({id}) *popup_show()*
|
||||||
If {id} is a hidden popup, show it now.
|
If {id} is a hidden popup, show it now.
|
||||||
For {id} see `popup_hide()`.
|
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()*
|
popup_setoptions({id}, {options}) *popup_setoptions()*
|
||||||
@@ -680,8 +682,13 @@ The second argument of |popup_create()| is a dictionary with options:
|
|||||||
- "expr": if the cursor moved outside |<cexpr>|
|
- "expr": if the cursor moved outside |<cexpr>|
|
||||||
- [{start}, {end}]: if the cursor moved before column
|
- [{start}, {end}]: if the cursor moved before column
|
||||||
{start} or after {end}
|
{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
|
The popup also closes if the cursor moves to another
|
||||||
line or to another window.
|
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
|
cursorline non-zero: Highlight the cursor line. Also scrolls the
|
||||||
text to show this line (only works properly
|
text to show this line (only works properly
|
||||||
when 'wrap' is off).
|
when 'wrap' is off).
|
||||||
|
@@ -493,12 +493,28 @@ handle_moved_argument(win_T *wp, dictitem_T *di, int mousemoved)
|
|||||||
}
|
}
|
||||||
else if (di->di_tv.v_type == VAR_LIST
|
else if (di->di_tv.v_type == VAR_LIST
|
||||||
&& di->di_tv.vval.v_list != NULL
|
&& di->di_tv.vval.v_list != NULL
|
||||||
&& di->di_tv.vval.v_list->lv_len == 2)
|
&& (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;
|
list_T *l = di->di_tv.vval.v_list;
|
||||||
int mincol = tv_get_number(&l->lv_first->li_tv);
|
listitem_T *li = l->lv_first;
|
||||||
int maxcol = tv_get_number(&l->lv_first->li_next->li_tv);
|
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)
|
if (mousemoved)
|
||||||
{
|
{
|
||||||
wp->w_popup_mouse_mincol = mincol;
|
wp->w_popup_mouse_mincol = mincol;
|
||||||
|
@@ -170,6 +170,10 @@ func Test_popup_with_border_and_padding()
|
|||||||
call assert_equal(['Top', 'Right', 'Bottom', 'Left'], options.borderhighlight)
|
call assert_equal(['Top', 'Right', 'Bottom', 'Left'], options.borderhighlight)
|
||||||
call assert_equal(['1', '^', '2', '>', '3', 'v', '4', '<'], options.borderchars)
|
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: []})
|
let winid = popup_create('hello both', #{line: 3, col: 8, border: [], padding: []})
|
||||||
call assert_equal(#{
|
call assert_equal(#{
|
||||||
\ line: 3,
|
\ line: 3,
|
||||||
|
@@ -741,6 +741,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 */
|
||||||
|
/**/
|
||||||
|
2193,
|
||||||
/**/
|
/**/
|
||||||
2192,
|
2192,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user