Skip to content

Commit a37cb55

Browse files
committed
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)
1 parent f36a2c7 commit a37cb55

3 files changed

Lines changed: 15 additions & 13 deletions

File tree

src/popupwin.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -452,24 +452,22 @@ apply_move_options(win_T *wp, dict_T *d)
452452
wp->w_popup_prop_type = 0;
453453
if (*str != NUL)
454454
{
455-
nr = find_prop_type_id(str, wp->w_buffer);
455+
wp->w_popup_prop_win = curwin;
456+
di = dict_find(d, (char_u *)"textpropwin", -1);
457+
if (di != NULL)
458+
{
459+
wp->w_popup_prop_win = find_win_by_nr_or_id(&di->di_tv);
460+
if (!win_valid(wp->w_popup_prop_win))
461+
wp->w_popup_prop_win = curwin;
462+
}
463+
464+
nr = find_prop_type_id(str, wp->w_popup_prop_win->w_buffer);
456465
if (nr <= 0)
457466
nr = find_prop_type_id(str, NULL);
458467
if (nr <= 0)
459468
semsg(_(e_invarg2), str);
460469
else
461-
{
462470
wp->w_popup_prop_type = nr;
463-
wp->w_popup_prop_win = curwin;
464-
465-
di = dict_find(d, (char_u *)"textpropwin", -1);
466-
if (di != NULL)
467-
{
468-
wp->w_popup_prop_win = find_win_by_nr_or_id(&di->di_tv);
469-
if (win_valid(wp->w_popup_prop_win))
470-
wp->w_popup_prop_win = curwin;
471-
}
472-
}
473471
}
474472
}
475473

src/testdir/test_popupwin_textprop.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ func Test_textprop_popup()
1313
50
1414
normal zz
1515
set scrolloff=0
16-
call prop_type_add('popupMarker', #{highlight: 'DiffAdd'})
16+
call prop_type_add('popupMarker', #{highlight: 'DiffAdd', bufnr: bufnr('%')})
1717
call prop_add(50, 11, #{
1818
\ length: 7,
1919
\ type: 'popupMarker',
20+
\ bufnr: bufnr('%'),
2021
\ })
2122
let winid = popup_create('the text', #{
2223
\ pos: 'botleft',
@@ -68,6 +69,7 @@ func Test_textprop_popup_corners()
6869
let winid = popup_create('bottom left', #{
6970
\ pos: 'botleft',
7071
\ textprop: 'popupMarker',
72+
\ textpropwin: win_getid(),
7173
\ padding: [0,1,0,1],
7274
\ })
7375
let winid = popup_create('bottom right', #{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
2307,
744746
/**/
745747
2306,
746748
/**/

0 commit comments

Comments
 (0)