To: vim_dev@googlegroups.com Subject: Patch 8.2.1714 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1714 Problem: Text properties corrupted with substitute command. (Filipe Brandenburger) Solution: Get the changed line again after using u_savesub(). (closes #6984) Files: src/textprop.c, src/testdir/test_textprop.vim *** ../vim-8.2.1713/src/textprop.c 2020-09-05 20:59:55.104468987 +0200 --- src/textprop.c 2020-09-20 21:02:40.080454682 +0200 *************** *** 1349,1354 **** --- 1349,1358 ---- && 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 *** ../vim-8.2.1713/src/testdir/test_textprop.vim 2020-09-15 21:34:14.998383526 +0200 --- src/testdir/test_textprop.vim 2020-09-20 21:01:46.468721365 +0200 *************** *** 1132,1137 **** --- 1132,1150 ---- 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, *** ../vim-8.2.1713/src/version.c 2020-09-20 19:57:11.548720974 +0200 --- src/version.c 2020-09-20 21:03:58.576063934 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1714, /**/ -- "Lisp has all the visual appeal of oatmeal with nail clippings thrown in." -- Larry Wall /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///