]> granicus.if.org Git - vim/commitdiff
patch 8.2.2470: popup_getoptions() does not get textprop from other tab v8.2.2470
authorBram Moolenaar <Bram@vim.org>
Sat, 6 Feb 2021 13:22:32 +0000 (14:22 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 6 Feb 2021 13:22:32 +0000 (14:22 +0100)
Problem:    Popup_getoptions() does not get textprop from other tab.
Solution:   use win_valid_any_tab(). (closes #7786)

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

index fddcaa1b4e3283754c6f296e5e5120e13fc7ea50..0896f1700d64c4d7bef1b5f3f4a34eeb31727568 100644 (file)
@@ -2983,7 +2983,7 @@ f_popup_getoptions(typval_T *argvars, typval_T *rettv)
        dict_add_number(dict, "scrollbar", wp->w_want_scrollbar);
        dict_add_number(dict, "zindex", wp->w_zindex);
        dict_add_number(dict, "fixed", wp->w_popup_fixed);
-       if (wp->w_popup_prop_type && win_valid(wp->w_popup_prop_win))
+       if (wp->w_popup_prop_type && win_valid_any_tab(wp->w_popup_prop_win))
        {
            proptype_T *pt = text_prop_type_by_id(
                                 wp->w_popup_prop_win->w_buffer,
index 7335c1c13ab2087c2ebbe925e9e48148deb0e46a..11b1c4a9940516cb1f1f2363befd653ec5851fa0 100644 (file)
@@ -3803,4 +3803,18 @@ func Test_popup_filter_menu()
   call feedkeys("\<c-n>\<c-n>\<c-p>\<cr>", 'xt')
 endfunc
 
+func Test_popup_getoptions_other_tab()
+  new
+  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', highlight: 'ErrorMsg', tabpage: 1})
+  tab sp
+  call assert_equal(['textprop', 'textpropid', 'textpropwin'], popup_getoptions(id)->keys()->filter({_, v -> v =~ 'textprop'}))
+
+  tabclose
+  bwipe!
+  call prop_type_delete('textprop')
+endfunc
+
 " vim: shiftwidth=2 sts=2
index fb3a50ac6db113c3899f0d401209cb9c8b84f9ee..73bb1e211c8bc1b917c5a1b64ea221bf2669d82e 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2470,
 /**/
     2469,
 /**/