0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 9.0.0466: virtual text wrong after adding line break after line

Problem:    Virtual text wrong after adding line break after line.
Solution:   Pass an "eol" flag to where text properties are adjusted.
            (closes #11131)
This commit is contained in:
Bram Moolenaar
2022-09-14 22:13:59 +01:00
parent e697d48890
commit ebd0e8bb85
6 changed files with 60 additions and 12 deletions

View File

@@ -2232,13 +2232,15 @@ adjust_prop_columns(
* "lnum_top" is the top line.
* "kept" is the number of bytes kept in the first line, while
* "deleted" is the number of bytes deleted.
* "at_eol" is true if the split is after the end of the line.
*/
void
adjust_props_for_split(
linenr_T lnum_props,
linenr_T lnum_top,
int kept,
int deleted)
linenr_T lnum_props,
linenr_T lnum_top,
int kept,
int deleted,
int at_eol)
{
char_u *props;
int count;
@@ -2276,9 +2278,16 @@ adjust_props_for_split(
// a text prop "above" behaves like it is on the first text column
prop_col = (prop.tp_flags & TP_FLAG_ALIGN_ABOVE) ? 1 : prop.tp_col;
cont_prev = prop_col != MAXCOL && prop_col + !start_incl <= kept;
cont_next = prop_col != MAXCOL
&& skipped <= prop_col + prop.tp_len - !end_incl;
if (prop_col == MAXCOL)
{
cont_prev = at_eol;
cont_next = !at_eol;
}
else
{
cont_prev = prop_col + !start_incl <= kept;
cont_next = skipped <= prop_col + prop.tp_len - !end_incl;
}
// when a prop has text it is never copied
if (prop.tp_id < 0 && cont_next)
cont_prev = FALSE;
@@ -2297,7 +2306,7 @@ adjust_props_for_split(
// Only add the property to the next line if the length is bigger than
// zero.
if ((cont_next || prop_col == MAXCOL) && ga_grow(&nextprop, 1) == OK)
if (cont_next && ga_grow(&nextprop, 1) == OK)
{
textprop_T *p = ((textprop_T *)nextprop.ga_data) + nextprop.ga_len;