diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-14 22:13:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-14 22:13:59 +0100 |
commit | ebd0e8bb853cb744b60bf4f57011c4379ae4aaed (patch) | |
tree | bda75c257efb71dacc825e7162b006eb72205d6a /src/textprop.c | |
parent | e697d488901b6321ddaad68b553f0a434c97d849 (diff) | |
download | vim-git-ebd0e8bb853cb744b60bf4f57011c4379ae4aaed.tar.gz |
patch 9.0.0466: virtual text wrong after adding line break after linev9.0.0466
Problem: Virtual text wrong after adding line break after line.
Solution: Pass an "eol" flag to where text properties are adjusted.
(closes #11131)
Diffstat (limited to 'src/textprop.c')
-rw-r--r-- | src/textprop.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/textprop.c b/src/textprop.c index ba21e751b..6e5c1447f 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -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; |