Mercurial > vim
diff src/sign.c @ 18744:b29d8a06e72c v8.1.2362
patch 8.1.2362: cannot place signs in a popup window
Commit: https://github.com/vim/vim/commit/7257073043252c2e01c8e168e6842a1121797243
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Nov 30 14:21:53 2019 +0100
patch 8.1.2362: cannot place signs in a popup window
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 30 Nov 2019 14:30:05 +0100 |
parents | f249b44039e0 |
children | 49b78d6465e5 |
line wrap: on
line diff
--- a/src/sign.c +++ b/src/sign.c @@ -138,7 +138,20 @@ sign_in_group(sign_entry_T *sign, char_u 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 ln 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;