diff src/testdir/test_textprop.vim @ 28854:647d7f439622 v8.2.4950

patch 8.2.4950: text properties position wrong after shifting text Commit: https://github.com/vim/vim/commit/4b93674159d60c985de906c30f45dbaf2b64056f Author: LemonBoy <thatlemon@gmail.com> Date: Fri May 13 21:56:28 2022 +0100 patch 8.2.4950: text properties position wrong after shifting text Problem: Text properties position wrong after shifting text. Solution: Adjust the text properties when shifting a block of text. (closes #10418)
author Bram Moolenaar <Bram@vim.org>
date Fri, 13 May 2022 23:00:03 +0200
parents ba81f4ed59e2
children 92736a673e3c
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -1933,5 +1933,29 @@ func Test_prop_spell()
   bwipe!
 endfunc
 
+func Test_prop_shift_block()
+  new
+  call AddPropTypes()
+
+  call setline(1, ['some     highlighted text']->repeat(2))
+  call prop_add(1, 10, #{type: 'one', length: 11})
+  call prop_add(2, 10, #{type: 'two', length: 11})
+
+  call cursor(1, 1)
+  call feedkeys("5l\<c-v>>", 'nxt')
+  call cursor(2, 1)
+  call feedkeys("5l\<c-v><", 'nxt')
+
+  let expected = [
+      \ {'lnum': 1, 'id': 0, 'col': 8, 'type_bufnr': 0, 'end': 1, 'type': 'one',
+      \ 'length': 11, 'start' : 1},
+      \ {'lnum': 2, 'id': 0, 'col': 6, 'type_bufnr': 0, 'end': 1, 'type': 'two',
+      \ 'length': 11, 'start' : 1}
+      \ ]
+  call assert_equal(expected, prop_list(1, #{end_lnum: 2}))
+
+  call DeletePropTypes()
+  bwipe!
+endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab