Patch 8.2.4957
Problem: Text properties in a wrong position after a block change.
Solution: Adjust the properties columns. (closes #10427)
Files: src/ops.c, src/testdir/test_textprop.vim
*** ../vim-8.2.4956/src/ops.c 2022-05-14 11:52:19.205341190 +0100
--- src/ops.c 2022-05-15 13:04:10.262911144 +0100
***************
*** 1814,1819 ****
--- 1814,1825 ----
oldp += bd.textcol;
STRMOVE(newp + offset, oldp);
ml_replace(linenr, newp, FALSE);
+ #ifdef FEAT_PROP_POPUP
+ // Shift the properties for linenr as edit() would do.
+ if (curbuf->b_has_textprop)
+ adjust_prop_columns(linenr, bd.textcol,
+ vpos.coladd + ins_len, 0);
+ #endif
}
}
check_cursor();
*** ../vim-8.2.4956/src/testdir/test_textprop.vim 2022-05-14 18:47:58.807259718 +0100
--- src/testdir/test_textprop.vim 2022-05-15 13:07:48.026695212 +0100
***************
*** 2003,2006 ****
--- 2003,2039 ----
bwipe!
endfunc
+ func Test_prop_blockwise_change()
+ new
+ call AddPropTypes()
+
+ call setline(1, ['foooooo', 'bar', 'baaaaz'])
+ call prop_add(1, 1, #{end_col: 3, type: 'one'})
+ call prop_add(2, 1, #{end_col: 3, type: 'two'})
+ call prop_add(3, 1, #{end_col: 3, type: 'three'})
+
+ " Replace the first two columns with '123', since 'start_incl' is false the
+ " prop is not extended.
+ call feedkeys("gg\<c-v>2jc123\<Esc>", 'nxt')
+
+ let lines =<< trim END
+ 123oooooo
+ 123ar
+ 123aaaaz
+ END
+ call assert_equal(lines, getline(1, '$'))
+ let expected = [
+ \ {'lnum': 1, 'id': 0, 'col': 4, 'type_bufnr': 0, 'end': 1, 'type': 'one',
+ \ 'length': 1, 'start': 1},
+ \ {'lnum': 2, 'id': 0, 'col': 4, 'type_bufnr': 0, 'end': 1, 'type': 'two',
+ \ 'length': 1, 'start': 1},
+ \ {'lnum': 3, 'id': 0, 'col': 4, 'type_bufnr': 0, 'end': 1 ,
+ \ 'type': 'three', 'length': 1, 'start': 1}
+ \ ]
+ call assert_equal(expected, prop_list(1, #{end_lnum: 10}))
+
+ call DeletePropTypes()
+ bwipe!
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4956/src/version.c 2022-05-14 21:29:40.665782815 +0100
--- src/version.c 2022-05-15 13:06:04.546797716 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4957,
/**/
--
Spam seems to be something useful to novices. Later you realize that
it's a bunch of indigestable junk that only clogs your system.
Applies to both the food and the e-mail!
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///