Mercurial > vim
changeset 22331:0271c2b8bb35 v8.2.1714
patch 8.2.1714: text properties corrupted with substitute command
Commit: https://github.com/vim/vim/commit/8902b31f1b31c117915defc23ac45cdc1f5c671b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 20 21:04:35 2020 +0200
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 20 Sep 2020 21:15:04 +0200 |
parents | ca6d4f7199a9 |
children | 339f74bfd2bd |
files | src/testdir/test_textprop.vim src/textprop.c src/version.c |
diffstat | 3 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -1132,6 +1132,19 @@ func Test_proptype_substitute2() bwipe! 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() let d = #{tabstop: &tabstop, \ softtabstop: &softtabstop,
--- a/src/textprop.c +++ b/src/textprop.c @@ -1349,6 +1349,10 @@ adjust_prop_columns( && u_savesub(lnum) == FAIL) return FALSE; 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) continue; // Drop this text property