From 8055721c2d30f21cfabe7453014f526e7becfc06 Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Wed, 21 Feb 2024 21:00:59 +0100 Subject: patch 9.1.0124: display of below/right virtual text with non-virtual text overlap Problem: Virtual text with text_align 'right'/'below' wasn't being used when a non-virtual text property overlaps with the end of the line. This was because the non-virtual text property had a higher priority, preventing the virtual text from being used. Solution: Fix the sorting of text properties so virtual text properties have a higher priority than non-virtual text properties. (Dylan Thacker-Smith) related: #14063 Signed-off-by: Dylan Thacker-Smith Signed-off-by: Christian Brabandt --- src/textprop.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/textprop.c') diff --git a/src/textprop.c b/src/textprop.c index 168b1808fb..cd07844f14 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -758,6 +758,11 @@ text_prop_compare(const void *s1, const void *s2) tp2 = &text_prop_compare_props[idx2]; col1 = tp1->tp_col; col2 = tp2->tp_col; + + // property that inserts text has priority over one that doesn't + if ((tp1->tp_id < 0) != (tp2->tp_id < 0)) + return tp1->tp_id < 0 ? 1 : -1; + if (col1 == MAXCOL || col2 == MAXCOL) { int order1 = text_prop_order(tp1->tp_flags); @@ -768,10 +773,6 @@ text_prop_compare(const void *s1, const void *s2) return order1 < order2 ? 1 : -1; } - // property that inserts text has priority over one that doesn't - if ((tp1->tp_id < 0) != (tp2->tp_id < 0)) - return tp1->tp_id < 0 ? 1 : -1; - // check highest priority, defined by the type pt1 = text_prop_type_by_id(text_prop_compare_buf, tp1->tp_type); pt2 = text_prop_type_by_id(text_prop_compare_buf, tp2->tp_type); -- cgit v1.2.3