summaryrefslogtreecommitdiffstats
path: root/src/drawline.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-12-03 17:50:47 +0100
committerChristian Brabandt <cb@256bit.org>2023-12-03 17:50:47 +0100
commit4e26a9aab6ad0ceb6bab0fd70e1031abb429f233 (patch)
tree87581217708b233d30ccb37f2258ab9045d0deae /src/drawline.c
parentc089c3816b7109a6f12bd8e7bdd7cba071ce840d (diff)
patch 9.0.2144: Text properties causes wrong line wrappingv9.0.2144
Problem: Text properties causes wrong line wrapping to be drawn. Solution: Find the index of the last text property that inserts text. closes: #13611 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/drawline.c')
-rw-r--r--src/drawline.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/drawline.c b/src/drawline.c
index 309fcd4469..6909e0f1fd 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1149,6 +1149,7 @@ win_line(
#ifdef FEAT_PROP_POPUP
int did_line = FALSE; // set to TRUE when line text done
int text_prop_count;
+ int last_textprop_text_idx = -1;
int text_prop_next = 0; // next text property to use
textprop_T *text_props = NULL;
int *text_prop_idxs = NULL;
@@ -1616,6 +1617,11 @@ win_line(
area_highlighting = TRUE;
extra_check = TRUE;
+ /* Find the last text property that inserts text. */
+ for (int i = 0; i < text_prop_count; ++i)
+ if (text_props[i].tp_id < 0)
+ last_textprop_text_idx = i;
+
// When skipping virtual text the props need to be sorted. The
// order is reversed!
if (lnum == wp->w_topline && wp->w_skipcol > 0)
@@ -3791,7 +3797,7 @@ win_line(
|| (wlv.n_extra > 0 && (wlv.c_extra != NUL
|| *wlv.p_extra != NUL))
#ifdef FEAT_PROP_POPUP
- || text_prop_next < text_prop_count
+ || text_prop_next <= last_textprop_text_idx
#endif
))
{
@@ -4083,7 +4089,7 @@ win_line(
#endif
#ifdef FEAT_PROP_POPUP
|| text_prop_above || text_prop_follows
- || text_prop_next < text_prop_count
+ || text_prop_next <= last_textprop_text_idx
#endif
|| (wp->w_p_list && wp->w_lcs_chars.eol != NUL
&& wlv.p_extra != at_end_str)