]> granicus.if.org Git - vim/commitdiff
patch 8.2.2471: popup_setoptions() does not set textprop in other tab v8.2.2471
authorBram Moolenaar <Bram@vim.org>
Sat, 6 Feb 2021 13:59:27 +0000 (14:59 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 6 Feb 2021 13:59:27 +0000 (14:59 +0100)
Problem:    Popup_setoptions() does not set textprop in other tab.
Solution:   use win_valid_any_tab(). (closes #7788)

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

index 0896f1700d64c4d7bef1b5f3f4a34eeb31727568..436238f9ba897ba5a8fe06fbbfb079a5c06e7373 100644 (file)
@@ -461,7 +461,7 @@ apply_move_options(win_T *wp, dict_T *d)
            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))
+               if (!win_valid_any_tab(wp->w_popup_prop_win))
                    wp->w_popup_prop_win = curwin;
            }
 
index 11b1c4a9940516cb1f1f2363befd653ec5851fa0..0d9d326bcc2cdb3b1dc5ae7abb85718706c03112 100644 (file)
@@ -3813,8 +3813,27 @@ func Test_popup_getoptions_other_tab()
   call assert_equal(['textprop', 'textpropid', 'textpropwin'], popup_getoptions(id)->keys()->filter({_, v -> v =~ 'textprop'}))
 
   tabclose
+  call popup_close(id)
   bwipe!
   call prop_type_delete('textprop')
 endfunc
 
+
+func Test_popup_setoptions_other_tab()
+  new Xfile
+  let winid = win_getid()
+  call setline(1, 'some text')
+  call prop_type_add('textprop', {})
+  call prop_add(1, 1, #{type: 'textprop', length: 1})
+  let id = popup_create('TEST', #{textprop: 'textprop'})
+  tab sp
+  call popup_setoptions(id, #{textprop: 'textprop', textpropwin: winid})
+  call assert_equal(winid, popup_getoptions(id).textpropwin)
+
+  tabclose
+  call popup_close(id)
+  bwipe! Xfile
+  call prop_type_delete('textprop')
+endfunc
+
 " vim: shiftwidth=2 sts=2
index 73bb1e211c8bc1b917c5a1b64ea221bf2669d82e..2beec07bc39dde8892c84168730e031862e55d00 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2471,
 /**/
     2470,
 /**/