0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.2307: positioning popup doesn't work for buffer-local textprop

Problem:    Positioning popup doesn't work for buffer-local textprop.
Solution:   Make it work. (closes #5225)
This commit is contained in:
Bram Moolenaar 2019-11-16 20:03:31 +01:00
parent f36a2c7e60
commit a37cb55da6
3 changed files with 15 additions and 13 deletions

View File

@ -452,24 +452,22 @@ apply_move_options(win_T *wp, dict_T *d)
wp->w_popup_prop_type = 0; wp->w_popup_prop_type = 0;
if (*str != NUL) if (*str != NUL)
{ {
nr = find_prop_type_id(str, wp->w_buffer); wp->w_popup_prop_win = curwin;
di = dict_find(d, (char_u *)"textpropwin", -1);
if (di != NULL)
{
wp->w_popup_prop_win = find_win_by_nr_or_id(&di->di_tv);
if (!win_valid(wp->w_popup_prop_win))
wp->w_popup_prop_win = curwin;
}
nr = find_prop_type_id(str, wp->w_popup_prop_win->w_buffer);
if (nr <= 0) if (nr <= 0)
nr = find_prop_type_id(str, NULL); nr = find_prop_type_id(str, NULL);
if (nr <= 0) if (nr <= 0)
semsg(_(e_invarg2), str); semsg(_(e_invarg2), str);
else else
{
wp->w_popup_prop_type = nr; wp->w_popup_prop_type = nr;
wp->w_popup_prop_win = curwin;
di = dict_find(d, (char_u *)"textpropwin", -1);
if (di != NULL)
{
wp->w_popup_prop_win = find_win_by_nr_or_id(&di->di_tv);
if (win_valid(wp->w_popup_prop_win))
wp->w_popup_prop_win = curwin;
}
}
} }
} }

View File

@ -13,10 +13,11 @@ func Test_textprop_popup()
50 50
normal zz normal zz
set scrolloff=0 set scrolloff=0
call prop_type_add('popupMarker', #{highlight: 'DiffAdd'}) call prop_type_add('popupMarker', #{highlight: 'DiffAdd', bufnr: bufnr('%')})
call prop_add(50, 11, #{ call prop_add(50, 11, #{
\ length: 7, \ length: 7,
\ type: 'popupMarker', \ type: 'popupMarker',
\ bufnr: bufnr('%'),
\ }) \ })
let winid = popup_create('the text', #{ let winid = popup_create('the text', #{
\ pos: 'botleft', \ pos: 'botleft',
@ -68,6 +69,7 @@ func Test_textprop_popup_corners()
let winid = popup_create('bottom left', #{ let winid = popup_create('bottom left', #{
\ pos: 'botleft', \ pos: 'botleft',
\ textprop: 'popupMarker', \ textprop: 'popupMarker',
\ textpropwin: win_getid(),
\ padding: [0,1,0,1], \ padding: [0,1,0,1],
\ }) \ })
let winid = popup_create('bottom right', #{ let winid = popup_create('bottom right', #{

View File

@ -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 */
/**/
2307,
/**/ /**/
2306, 2306,
/**/ /**/