diff options
author | Dylan Thacker-Smith <dylan.ah.smith@gmail.com> | 2024-02-21 21:00:59 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-02-21 21:00:59 +0100 |
commit | 8055721c2d30f21cfabe7453014f526e7becfc06 (patch) | |
tree | 4e6d72393c68879f95ccdc4a7ee8513dc4fc7294 /src/textprop.c | |
parent | ec9c32637f566f38d097c566209d85d697182153 (diff) |
patch 9.1.0124: display of below/right virtual text with non-virtual text overlapv9.1.0124
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>
Diffstat (limited to 'src/textprop.c')
-rw-r--r-- | src/textprop.c | 9 |
1 files changed, 5 insertions, 4 deletions
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); |