patch 8.2.1714: text properties corrupted with substitute command

Problem:    Text properties corrupted with substitute command. (Filipe
            Brandenburger)
Solution:   Get the changed line again after using u_savesub(). (closes #6984)
This commit is contained in:
Bram Moolenaar
2020-09-20 21:04:35 +02:00
parent 7795bfea6d
commit 8902b31f1b
3 changed files with 19 additions and 0 deletions

View File

@ -1132,6 +1132,19 @@ func Test_proptype_substitute2()
bwipe! bwipe!
endfunc endfunc
" This was causing property corruption.
func Test_proptype_substitute3()
new
call setline(1, ['abcxxx', 'def'])
call prop_type_add("test", {"highlight": "Search"})
call prop_add(1, 2, {"end_lnum": 2, "end_col": 2, "type": "test"})
%s/x\+$//
redraw
call prop_type_delete('test')
bwipe!
endfunc
func SaveOptions() func SaveOptions()
let d = #{tabstop: &tabstop, let d = #{tabstop: &tabstop,
\ softtabstop: &softtabstop, \ softtabstop: &softtabstop,

View File

@ -1349,6 +1349,10 @@ adjust_prop_columns(
&& u_savesub(lnum) == FAIL) && u_savesub(lnum) == FAIL)
return FALSE; return FALSE;
dirty = TRUE; dirty = TRUE;
// u_savesub() may have updated curbuf->b_ml, fetch it again
if (curbuf->b_ml.ml_line_lnum != lnum)
proplen = get_text_props(curbuf, lnum, &props, TRUE);
} }
if (res.can_drop) if (res.can_drop)
continue; // Drop this text property continue; // Drop this text property

View File

@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1714,
/**/ /**/
1713, 1713,
/**/ /**/