diff src/textprop.c @ 29607:33d7c1fa2dac v9.0.0144

patch 9.0.0144: text property cannot override 'cursorline' highlight Commit: https://github.com/vim/vim/commit/f4ba8bc47eb3c6b5899ef31d083b9b8f0d4ca456 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 5 17:05:04 2022 +0100 patch 9.0.0144: text property cannot override 'cursorline' highlight Problem: Text property cannot override 'cursorline' highlight. Solution: Add the "override" flag to prop_type_add(). (closes https://github.com/vim/vim/issues/5533, closes #8225).
author Bram Moolenaar <Bram@vim.org>
date Fri, 05 Aug 2022 18:15:08 +0200
parents e357bc89bb95
children e1c370197030
line wrap: on
line diff
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -238,9 +238,10 @@ prop_add_one(
 	    goto theend;
 	((char_u **)gap->ga_data)[gap->ga_len++] = text;
 
-	// change any Tab to a Space to make it simpler to compute the size
+	// change any control character (Tab, Newline, etc.) to a Space to make
+	// it simpler to compute the size
 	for (p = text; *p != NUL; MB_PTR_ADV(p))
-	    if (*p == TAB)
+	    if (*p < ' ')
 		*p = ' ';
 	text = NULL;
     }
@@ -1542,6 +1543,15 @@ prop_type_set(typval_T *argvars, int add
 		prop->pt_flags &= ~PT_FLAG_COMBINE;
 	}
 
+	di = dict_find(dict, (char_u *)"override", -1);
+	if (di != NULL)
+	{
+	    if (tv_get_bool(&di->di_tv))
+		prop->pt_flags |= PT_FLAG_OVERRIDE;
+	    else
+		prop->pt_flags &= ~PT_FLAG_OVERRIDE;
+	}
+
 	di = dict_find(dict, (char_u *)"priority", -1);
 	if (di != NULL)
 	    prop->pt_priority = tv_get_number(&di->di_tv);