diff src/sign.c @ 18603:f249b44039e0 v8.1.2295

patch 8.1.2295: if buffer of popup is in another window cursorline sign shows Commit: https://github.com/vim/vim/commit/4eb7dae255abc271cf313d4c75839577f1424183 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 12 22:33:45 2019 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Tue, 12 Nov 2019 22:45:05 +0100
parents 1848b3e07266
children b29d8a06e72c
line wrap: on
line diff
--- a/src/sign.c
+++ b/src/sign.c
@@ -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 l
 	    // 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
  */