To: vim_dev@googlegroups.com Subject: Patch 8.1.2362 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2362 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) Files: runtime/doc/sign.txt, src/popupwin.c, src/sign.c, src/testdir/dumps/Test_popupwin_sign_1.dump *** ../vim-8.1.2361/runtime/doc/sign.txt 2019-09-06 22:00:50.369745851 +0200 --- runtime/doc/sign.txt 2019-11-30 13:49:17.317236915 +0100 *************** *** 71,76 **** --- 71,80 ---- sign group allows Vim plugins to use unique signs without interfering with other plugins using signs. + 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 *** ../vim-8.1.2361/src/popupwin.c 2019-11-22 19:22:05.136022491 +0100 --- src/popupwin.c 2019-11-30 13:49:58.549036550 +0100 *************** *** 611,617 **** int sign_id = 0; char_u *sign_name = popup_get_sign_name(wp); ! buf_delete_signs(wp->w_buffer, (char_u *)"popupmenu"); if ((wp->w_popup_flags & POPF_CURSORLINE) != 0) { --- 611,617 ---- int sign_id = 0; char_u *sign_name = popup_get_sign_name(wp); ! buf_delete_signs(wp->w_buffer, (char_u *)"PopUpMenu"); if ((wp->w_popup_flags & POPF_CURSORLINE) != 0) { *************** *** 626,632 **** sign_define_by_name(sign_name, NULL, (char_u *)linehl, NULL, NULL); } ! 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); } --- 626,632 ---- sign_define_by_name(sign_name, NULL, (char_u *)linehl, NULL, NULL); } ! 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); } *** ../vim-8.1.2361/src/sign.c 2019-11-12 22:33:32.085004082 +0100 --- src/sign.c 2019-11-30 14:05:34.560506440 +0100 *************** *** 138,144 **** 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)); } /* --- 138,157 ---- 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)); ! } ! ! /* ! * 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,491 **** if (sign->se_lnum == lnum # ifdef FEAT_TEXT_PROP ! && sign_in_group(sign, (char_u *)"popupmenu") ! == (WIN_IS_POPUP(wp) ? TRUE : FALSE) # endif ) { --- 497,503 ---- if (sign->se_lnum == lnum # ifdef FEAT_TEXT_PROP ! && sign_group_for_window(sign, wp) # endif ) { *************** *** 2645,2652 **** 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)) sign = sign->se_next; # endif return sign; --- 2657,2663 ---- sign_entry_T *sign = wp->w_buffer->b_signlist; # ifdef FEAT_TEXT_PROP ! while (sign != NULL && !sign_group_for_window(sign, wp)) sign = sign->se_next; # endif return sign; *** ../vim-8.1.2361/src/testdir/dumps/Test_popupwin_sign_1.dump 2019-11-30 14:20:41.332091677 +0100 --- src/testdir/dumps/Test_popupwin_sign_1.dump 2019-11-30 14:08:12.551739455 +0100 *************** *** 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| *** ../vim-8.1.2361/src/version.c 2019-11-29 23:15:22.120220547 +0100 --- src/version.c 2019-11-30 14:08:57.287522023 +0100 *************** *** 739,740 **** --- 739,742 ---- { /* Add new patch number below this line */ + /**/ + 2362, /**/ -- We are the Borg of GNU GPL. We will assimilate your source code. Resistance is futile. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///