0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.1.2295: if buffer of popup is in another window cursorline sign shows

Problem:    If buffer of popup is in another window cursorline sign shows.
Solution:   Check the group of the sign.
This commit is contained in:
Bram Moolenaar
2019-11-12 22:33:45 +01:00
parent cbee635eee
commit 4eb7dae255
9 changed files with 78 additions and 31 deletions

View File

@@ -467,10 +467,11 @@ buf_change_sign_type(
* 'lnum', FALSE otherwise.
*/
int
buf_get_signattrs(buf_T *buf, linenr_T lnum, sign_attrs_T *sattr)
buf_get_signattrs(win_T *wp, linenr_T lnum, sign_attrs_T *sattr)
{
sign_entry_T *sign;
sign_T *sp;
buf_T *buf = wp->w_buffer;
vim_memset(sattr, 0, sizeof(sign_attrs_T));
@@ -481,7 +482,12 @@ buf_get_signattrs(buf_T *buf, linenr_T lnum, sign_attrs_T *sattr)
// for signs after the specified line number 'lnum'.
break;
if (sign->se_lnum == lnum)
if (sign->se_lnum == lnum
# ifdef FEAT_TEXT_PROP
&& sign_in_group(sign, (char_u *)"popupmenu")
== (WIN_IS_POPUP(wp) ? TRUE : FALSE)
# endif
)
{
sattr->sat_typenr = sign->se_typenr;
sp = find_sign_by_typenr(sign->se_typenr);
@@ -2633,6 +2639,42 @@ cleanup:
return retval;
}
sign_entry_T *
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))
sign = sign->se_next;
# endif
return sign;
}
/*
* Return TRUE when window "wp" has a column to draw signs in.
*/
int
signcolumn_on(win_T *wp)
{
// If 'signcolumn' is set to 'number', signs are displayed in the 'number'
// column (if present). Otherwise signs are to be displayed in the sign
// column.
if (*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u')
return get_first_valid_sign(wp) != NULL && !wp->w_p_nu && !wp->w_p_rnu;
if (*wp->w_p_scl == 'n')
return FALSE;
if (*wp->w_p_scl == 'y')
return TRUE;
return (get_first_valid_sign(wp) != NULL
# ifdef FEAT_NETBEANS_INTG
|| wp->w_buffer->b_has_sign_column
# endif
);
}
/*
* "sign_unplace()" function
*/