]> granicus.if.org Git - vim/commitdiff
patch 8.1.2307: positioning popup doesn't work for buffer-local textprop v8.1.2307
authorBram Moolenaar <Bram@vim.org>
Sat, 16 Nov 2019 19:03:31 +0000 (20:03 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 16 Nov 2019 19:03:31 +0000 (20:03 +0100)
Problem:    Positioning popup doesn't work for buffer-local textprop.
Solution:   Make it work. (closes #5225)

src/popupwin.c
src/testdir/test_popupwin_textprop.vim
src/version.c

index 48c017f67f2ee8ca9c0dc3f4bc797f428d5b4660..efcc3959817bf8cc0ac876c5291a2a4ccf3813a1 100644 (file)
@@ -452,24 +452,22 @@ apply_move_options(win_T *wp, dict_T *d)
        wp->w_popup_prop_type = 0;
        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)
                nr = find_prop_type_id(str, NULL);
            if (nr <= 0)
                semsg(_(e_invarg2), str);
            else
-           {
                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;
-               }
-           }
        }
     }
 
index 8a68f15d7e13d708b3ef2c75ad18e33415cc2754..b1127557cab9dba5fc085494d99f7c7cede53c6c 100644 (file)
@@ -13,10 +13,11 @@ func Test_textprop_popup()
        50
        normal zz
        set scrolloff=0
-       call prop_type_add('popupMarker', #{highlight: 'DiffAdd'})
+       call prop_type_add('popupMarker', #{highlight: 'DiffAdd', bufnr: bufnr('%')})
        call prop_add(50, 11, #{
                \ length: 7,
                \ type: 'popupMarker',
+               \ bufnr: bufnr('%'),
                \ })
        let winid = popup_create('the text', #{
              \ pos: 'botleft', 
@@ -68,6 +69,7 @@ func Test_textprop_popup_corners()
        let winid = popup_create('bottom left', #{
              \ pos: 'botleft', 
              \ textprop: 'popupMarker',
+             \ textpropwin: win_getid(),
              \ padding: [0,1,0,1],
              \ })
        let winid = popup_create('bottom right', #{
index dc6caed5fb81a95f449de6032a6b7219a77a4776..a682517de2320ed2a9164a02f8ddb8ae21a6c31e 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2307,
 /**/
     2306,
 /**/