]> granicus.if.org Git - vim/commitdiff
patch 8.1.2362: cannot place signs in a popup window v8.1.2362
authorBram Moolenaar <Bram@vim.org>
Sat, 30 Nov 2019 13:21:53 +0000 (14:21 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 30 Nov 2019 13:21:53 +0000 (14:21 +0100)
Problem:    Cannot place signs in a popup window. (Maxim Kim)
Solution:   Use the group prefix "PopUp" to specify which signs should show up
            in a popup window. (closes #5277)

runtime/doc/sign.txt
src/popupwin.c
src/sign.c
src/testdir/dumps/Test_popupwin_sign_1.dump [new file with mode: 0644]
src/version.c

index 972b43c192865d1977cfc2a9226697abd79a3a32..57bd0a76f10397771e1930fb6ac395240c1bf75f 100644 (file)
@@ -73,6 +73,10 @@ other plugins using signs.
 
 The group name "popupmenu" is used by popup windows where 'cursorline' is set.
 
+To place a sign in a popup window the group name must start with "PopUp".
+Other signs will not show in a popup window.  The group name "PopUpMenu" is
+used by popup windows where 'cursorline' is set.
+
                                                        *sign-priority*
 Each placed sign is assigned a priority value. When multiple signs are placed
 on the same line, the attributes of the sign with the highest priority is used
index 3b808e2e3ab13b87a2ba3c6e4c911308d5da58f4..e1c21acb289fab9e263a91ca7fda2e7eaa7737bf 100644 (file)
@@ -611,7 +611,7 @@ popup_highlight_curline(win_T *wp)
     int            sign_id = 0;
     char_u  *sign_name = popup_get_sign_name(wp);
 
-    buf_delete_signs(wp->w_buffer, (char_u *)"popupmenu");
+    buf_delete_signs(wp->w_buffer, (char_u *)"PopUpMenu");
 
     if ((wp->w_popup_flags & POPF_CURSORLINE) != 0)
     {
@@ -626,7 +626,7 @@ popup_highlight_curline(win_T *wp)
            sign_define_by_name(sign_name, NULL, (char_u *)linehl, NULL, NULL);
        }
 
-       sign_place(&sign_id, (char_u *)"popupmenu", sign_name,
+       sign_place(&sign_id, (char_u *)"PopUpMenu", sign_name,
                               wp->w_buffer, wp->w_cursor.lnum, SIGN_DEF_PRIO);
        redraw_win_later(wp, NOT_VALID);
     }
index 134edf09f0b7a76cc32cc0f24db226cb455abce7..f3a1f9df9e916eb5f0579fb53c0c76147f003fb3 100644 (file)
@@ -138,7 +138,20 @@ sign_in_group(sign_entry_T *sign, char_u *group)
     return ((group != NULL && STRCMP(group, "*") == 0)
            || (group == NULL && sign->se_group == NULL)
            || (group != NULL && sign->se_group != NULL
-                                && STRCMP(group, sign->se_group->sg_name) == 0));
+                             && STRCMP(group, sign->se_group->sg_name) == 0));
+}
+
+/*
+ * Return TRUE if "sign" is to be displayed in window "wp".
+ * If the group name starts with "PopUp" it only shows in a popup window.
+ */
+    static int
+sign_group_for_window(sign_entry_T *sign, win_T *wp)
+{
+    int for_popup = sign->se_group != NULL
+                       && STRNCMP("PopUp", sign->se_group->sg_name, 5) == 0;
+
+    return WIN_IS_POPUP(wp) ? for_popup : !for_popup;
 }
 
 /*
@@ -484,8 +497,7 @@ buf_get_signattrs(win_T *wp, linenr_T lnum, sign_attrs_T *sattr)
 
        if (sign->se_lnum == lnum
 # ifdef FEAT_TEXT_PROP
-               && sign_in_group(sign, (char_u *)"popupmenu")
-                                         == (WIN_IS_POPUP(wp) ? TRUE : FALSE)
+               && sign_group_for_window(sign, wp)
 # endif
                )
        {
@@ -2645,8 +2657,7 @@ get_first_valid_sign(win_T *wp)
     sign_entry_T *sign = wp->w_buffer->b_signlist;
 
 # ifdef FEAT_TEXT_PROP
-    while (sign != NULL && sign_in_group(sign, (char_u *)"popupmenu")
-                                         == (WIN_IS_POPUP(wp) ? FALSE : TRUE))
+    while (sign != NULL && !sign_group_for_window(sign, wp))
        sign = sign->se_next;
 # endif
     return sign;
diff --git a/src/testdir/dumps/Test_popupwin_sign_1.dump b/src/testdir/dumps/Test_popupwin_sign_1.dump
new file mode 100644 (file)
index 0000000..59cc904
--- /dev/null
@@ -0,0 +1,10 @@
+|>+0#e000002#ffffff0@1>0+0#ffffff16#ff404010| @71
+| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|2+0#0000000#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|3+0#0000000#ffffff0| @23|#+0#ffffff16#ff404010|!|h+0#0000001#ffff4012|e|l@1|o| @12| +0#0000000#ffffff0@27
+| +0#0000e05#a8a8a8255@1|4+0#0000000#ffffff0| @23| +0#0000e05#a8a8a8255@1|b+0#0000001#ffd7ff255|r|i|g|h|t| @11| +0#0000000#ffffff0@27
+| +0#0000e05#a8a8a8255@1|5+0#0000000#ffffff0| @23| +0#0000e05#a8a8a8255@1|w+0#0000001#ffd7ff255|o|r|l|d| @12| +0#0000000#ffffff0@27
+| +0#0000e05#a8a8a8255@1|6+0#0000000#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|7+0#0000000#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|8+0#0000000#ffffff0| @71
+@57|1|,|1| @10|T|o|p| 
index 5747085512f0deb9cd37684ead3ba6f30e5606c6..5833f382475be9cbb2c8c5a332cec3a4d0b09867 100644 (file)
@@ -737,6 +737,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2362,
 /**/
     2361,
 /**/