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 <dylan.ah.smith@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/textprop.c b/src/textprop.c
index 168b180..cd07844 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -758,6 +758,11 @@
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 @@
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);