Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
18743:06e8fc69df42 | 18744:b29d8a06e72c |
---|---|
136 sign_in_group(sign_entry_T *sign, char_u *group) | 136 sign_in_group(sign_entry_T *sign, char_u *group) |
137 { | 137 { |
138 return ((group != NULL && STRCMP(group, "*") == 0) | 138 return ((group != NULL && STRCMP(group, "*") == 0) |
139 || (group == NULL && sign->se_group == NULL) | 139 || (group == NULL && sign->se_group == NULL) |
140 || (group != NULL && sign->se_group != NULL | 140 || (group != NULL && sign->se_group != NULL |
141 && STRCMP(group, sign->se_group->sg_name) == 0)); | 141 && STRCMP(group, sign->se_group->sg_name) == 0)); |
142 } | |
143 | |
144 /* | |
145 * Return TRUE if "sign" is to be displayed in window "wp". | |
146 * If the group name starts with "PopUp" it only shows in a popup window. | |
147 */ | |
148 static int | |
149 sign_group_for_window(sign_entry_T *sign, win_T *wp) | |
150 { | |
151 int for_popup = sign->se_group != NULL | |
152 && STRNCMP("PopUp", sign->se_group->sg_name, 5) == 0; | |
153 | |
154 return WIN_IS_POPUP(wp) ? for_popup : !for_popup; | |
142 } | 155 } |
143 | 156 |
144 /* | 157 /* |
145 * Get the next free sign identifier in the specified group | 158 * Get the next free sign identifier in the specified group |
146 */ | 159 */ |
482 // for signs after the specified line number 'lnum'. | 495 // for signs after the specified line number 'lnum'. |
483 break; | 496 break; |
484 | 497 |
485 if (sign->se_lnum == lnum | 498 if (sign->se_lnum == lnum |
486 # ifdef FEAT_TEXT_PROP | 499 # ifdef FEAT_TEXT_PROP |
487 && sign_in_group(sign, (char_u *)"popupmenu") | 500 && sign_group_for_window(sign, wp) |
488 == (WIN_IS_POPUP(wp) ? TRUE : FALSE) | |
489 # endif | 501 # endif |
490 ) | 502 ) |
491 { | 503 { |
492 sattr->sat_typenr = sign->se_typenr; | 504 sattr->sat_typenr = sign->se_typenr; |
493 sp = find_sign_by_typenr(sign->se_typenr); | 505 sp = find_sign_by_typenr(sign->se_typenr); |
2643 get_first_valid_sign(win_T *wp) | 2655 get_first_valid_sign(win_T *wp) |
2644 { | 2656 { |
2645 sign_entry_T *sign = wp->w_buffer->b_signlist; | 2657 sign_entry_T *sign = wp->w_buffer->b_signlist; |
2646 | 2658 |
2647 # ifdef FEAT_TEXT_PROP | 2659 # ifdef FEAT_TEXT_PROP |
2648 while (sign != NULL && sign_in_group(sign, (char_u *)"popupmenu") | 2660 while (sign != NULL && !sign_group_for_window(sign, wp)) |
2649 == (WIN_IS_POPUP(wp) ? FALSE : TRUE)) | |
2650 sign = sign->se_next; | 2661 sign = sign->se_next; |
2651 # endif | 2662 # endif |
2652 return sign; | 2663 return sign; |
2653 } | 2664 } |
2654 | 2665 |