0
0
mirror of https://github.com/vim/vim.git synced 2025-10-02 05:04:20 -04:00

patch 8.2.0845: text properties crossing lines not handled correctly

Problem:    Text properties crossing lines not handled correctly.
Solution:   When joining lines merge text properties if possible.
            (Axel Forsman, closes #5839, closes #5683)
This commit is contained in:
Bram Moolenaar
2020-05-30 15:32:02 +02:00
parent a9d4b84d97
commit 87be9be1db
7 changed files with 243 additions and 225 deletions

View File

@@ -3420,7 +3420,6 @@ adjust_text_props_for_delete(
int done_del;
int done_this;
textprop_T prop_del;
textprop_T prop_this;
bhdr_T *hp;
DATA_BL *dp;
int idx;
@@ -3451,7 +3450,8 @@ adjust_text_props_for_delete(
if (idx == 0) // first line in block, text at the end
line_size = dp->db_txt_end - line_start;
else
line_size = ((dp->db_index[idx - 1]) & DB_INDEX_MASK) - line_start;
line_size = ((dp->db_index[idx - 1]) & DB_INDEX_MASK)
- line_start;
text = (char_u *)dp + line_start;
textlen = STRLEN(text) + 1;
if ((long)textlen >= line_size)
@@ -3466,24 +3466,24 @@ adjust_text_props_for_delete(
}
found = FALSE;
for (done_this = 0; done_this < this_props_len; done_this += sizeof(textprop_T))
for (done_this = 0; done_this < this_props_len;
done_this += sizeof(textprop_T))
{
mch_memmove(&prop_this, text + textlen + done_del, sizeof(textprop_T));
if (prop_del.tp_id == prop_this.tp_id
int flag = above ? TP_FLAG_CONT_NEXT
: TP_FLAG_CONT_PREV;
textprop_T prop_this;
mch_memmove(&prop_this, text + textlen + done_del,
sizeof(textprop_T));
if ((prop_this.tp_flags & flag)
&& prop_del.tp_id == prop_this.tp_id
&& prop_del.tp_type == prop_this.tp_type)
{
int flag = above ? TP_FLAG_CONT_NEXT : TP_FLAG_CONT_PREV;
found = TRUE;
if (prop_this.tp_flags & flag)
{
prop_this.tp_flags &= ~flag;
mch_memmove(text + textlen + done_del, &prop_this, sizeof(textprop_T));
}
else if (above)
internal_error("text property above deleted line does not continue");
else
internal_error("text property below deleted line does not continue");
prop_this.tp_flags &= ~flag;
mch_memmove(text + textlen + done_del, &prop_this,
sizeof(textprop_T));
break;
}
}
if (!found)