Mercurial > vim
diff src/textprop.c @ 34397:f0cdbcf53264 v9.1.0124
patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Commit: https://github.com/vim/vim/commit/8055721c2d30f21cfabe7453014f526e7becfc06
Author: Dylan Thacker-Smith <dylan.ah.smith@gmail.com>
Date: Wed Feb 21 21:00:59 2024 +0100
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>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 21 Feb 2024 21:15:03 +0100 |
parents | 2c5ae1ce5af2 |
children | 9e093c96dff6 |
line wrap: on
line diff
--- a/src/textprop.c +++ b/src/textprop.c @@ -758,6 +758,11 @@ text_prop_compare(const void *s1, const 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 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);