@@ -4294,6 +4294,66 @@ win_line(
42944294 }
42954295#endif
42964296
4297+ #ifdef FEAT_TEXT_PROP
4298+ if (text_props != NULL )
4299+ {
4300+ int pi ;
4301+
4302+ // Check if any active property ends.
4303+ for (pi = 0 ; pi < text_props_active ; ++ pi )
4304+ {
4305+ int tpi = text_prop_idxs [pi ];
4306+
4307+ if (col >= text_props [tpi ].tp_col - 1
4308+ + text_props [tpi ].tp_len )
4309+ {
4310+ if (pi + 1 < text_props_active )
4311+ mch_memmove (text_prop_idxs + pi ,
4312+ text_prop_idxs + pi + 1 ,
4313+ sizeof (int )
4314+ * (text_props_active - (pi + 1 )));
4315+ -- text_props_active ;
4316+ -- pi ;
4317+ }
4318+ }
4319+
4320+ // Add any text property that starts in this column.
4321+ while (text_prop_next < text_prop_count
4322+ && col >= text_props [text_prop_next ].tp_col - 1 )
4323+ text_prop_idxs [text_props_active ++ ] = text_prop_next ++ ;
4324+
4325+ text_prop_type = NULL ;
4326+ if (text_props_active > 0 )
4327+ {
4328+ int max_priority = INT_MIN ;
4329+ int max_col = 0 ;
4330+
4331+ // Get the property type with the highest priority
4332+ // and/or starting last.
4333+ for (pi = 0 ; pi < text_props_active ; ++ pi )
4334+ {
4335+ int tpi = text_prop_idxs [pi ];
4336+ proptype_T * pt ;
4337+
4338+ pt = text_prop_type_by_id (
4339+ curwin -> w_buffer , text_props [tpi ].tp_type );
4340+ if (pt != NULL
4341+ && (pt -> pt_priority > max_priority
4342+ || (pt -> pt_priority == max_priority
4343+ && text_props [tpi ].tp_col >= max_col )))
4344+ {
4345+ text_prop_type = pt ;
4346+ max_priority = pt -> pt_priority ;
4347+ max_col = text_props [tpi ].tp_col ;
4348+ }
4349+ }
4350+ if (text_prop_type != NULL )
4351+ text_prop_attr =
4352+ syn_id2attr (text_prop_type -> pt_hl_id );
4353+ }
4354+ }
4355+ #endif
4356+
42974357 /* Decide which of the highlight attributes to use. */
42984358 attr_pri = TRUE;
42994359#ifdef LINE_ATTR
@@ -4653,8 +4713,8 @@ win_line(
46534713#endif
46544714
46554715#ifdef FEAT_SYN_HL
4656- /* Get syntax attribute, unless still at the start of the line
4657- * (double-wide char that doesn't fit). */
4716+ // Get syntax attribute, unless still at the start of the line
4717+ // (double-wide char that doesn't fit).
46584718 v = (long )(ptr - line );
46594719 if (has_syntax && v > 0 )
46604720 {
@@ -4686,10 +4746,16 @@ win_line(
46864746 line = ml_get_buf (wp -> w_buffer , lnum , FALSE);
46874747 ptr = line + v ;
46884748
4689- if (!attr_pri )
4690- char_attr = syntax_attr ;
4691- else
4692- char_attr = hl_combine_attr (syntax_attr , char_attr );
4749+ # ifdef FEAT_TEXT_PROP
4750+ // Text properties overrule syntax highlighting.
4751+ if (text_prop_attr == 0 )
4752+ #endif
4753+ {
4754+ if (!attr_pri )
4755+ char_attr = syntax_attr ;
4756+ else
4757+ char_attr = hl_combine_attr (syntax_attr , char_attr );
4758+ }
46934759# ifdef FEAT_CONCEAL
46944760 /* no concealing past the end of the line, it interferes
46954761 * with line highlighting */
@@ -4701,66 +4767,6 @@ win_line(
47014767 }
47024768#endif
47034769
4704- #ifdef FEAT_TEXT_PROP
4705- if (text_props != NULL )
4706- {
4707- int pi ;
4708-
4709- // Check if any active property ends.
4710- for (pi = 0 ; pi < text_props_active ; ++ pi )
4711- {
4712- int tpi = text_prop_idxs [pi ];
4713-
4714- if (col >= text_props [tpi ].tp_col - 1
4715- + text_props [tpi ].tp_len )
4716- {
4717- if (pi + 1 < text_props_active )
4718- mch_memmove (text_prop_idxs + pi ,
4719- text_prop_idxs + pi + 1 ,
4720- sizeof (int )
4721- * (text_props_active - (pi + 1 )));
4722- -- text_props_active ;
4723- -- pi ;
4724- }
4725- }
4726-
4727- // Add any text property that starts in this column.
4728- while (text_prop_next < text_prop_count
4729- && col >= text_props [text_prop_next ].tp_col - 1 )
4730- text_prop_idxs [text_props_active ++ ] = text_prop_next ++ ;
4731-
4732- text_prop_type = NULL ;
4733- if (text_props_active > 0 )
4734- {
4735- int max_priority = INT_MIN ;
4736- int max_col = 0 ;
4737-
4738- // Get the property type with the highest priority
4739- // and/or starting last.
4740- for (pi = 0 ; pi < text_props_active ; ++ pi )
4741- {
4742- int tpi = text_prop_idxs [pi ];
4743- proptype_T * pt ;
4744-
4745- pt = text_prop_type_by_id (
4746- curwin -> w_buffer , text_props [tpi ].tp_type );
4747- if (pt != NULL
4748- && (pt -> pt_priority > max_priority
4749- || (pt -> pt_priority == max_priority
4750- && text_props [tpi ].tp_col >= max_col )))
4751- {
4752- text_prop_type = pt ;
4753- max_priority = pt -> pt_priority ;
4754- max_col = text_props [tpi ].tp_col ;
4755- }
4756- }
4757- if (text_prop_type != NULL )
4758- text_prop_attr =
4759- syn_id2attr (text_prop_type -> pt_hl_id );
4760- }
4761- }
4762- #endif
4763-
47644770#ifdef FEAT_SPELL
47654771 /* Check spelling (unless at the end of the line).
47664772 * Only do this when there is no syntax highlighting, the
0 commit comments