diff src/testdir/test_textprop.vim @ 15347:f6b522596993 v8.1.0681

patch 8.1.0681: text properties as not adjusted for deleted text commit https://github.com/vim/vim/commit/33c8ca923ed6d5638fa98afabb2e25b5056dd47b Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 2 18:00:27 2019 +0100 patch 8.1.0681: text properties as not adjusted for deleted text Problem: Text properties as not adjusted for deleted text. Solution: Adjust text properties when backspacing to delete text.
author Bram Moolenaar <Bram@vim.org>
date Wed, 02 Jan 2019 18:15:04 +0100
parents 03a7a9fdb792
children 6abee072b93c
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -177,6 +177,29 @@ func Test_prop_add_remove_buf()
   bwipe!
 endfunc
 
+func Test_prop_backspace()
+  new
+  set bs=2
+  call setline(1, 'xonex xtwoxx')
+  call AddPropTypes()
+  call prop_add(1, 2, {'length': 3, 'id': 11, 'type': 'one'})
+  call prop_add(1, 8, {'length': 3, 'id': 12, 'type': 'two'})
+  let expected = [
+	\ {'col': 2, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1},
+	\ {'col': 8, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1},
+	\]
+  call assert_equal(expected, prop_list(1))
+
+  exe "normal 0li\<BS>\<Esc>fxli\<BS>\<Esc>"
+  call assert_equal('one xtwoxx', getline(1))
+  let expected[0].col = 1
+  let expected[1].col = 6
+  call assert_equal(expected, prop_list(1))
+
+  call DeletePropTypes()
+  bwipe!
+  set bs&
+endfunc
 
 func Test_prop_clear()
   new
@@ -319,6 +342,7 @@ funct Test_textprop_screenshots()
 	\ "hi clear SpellBad",
 	\ "set spell",
 	\ "normal 3G0llix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>",
+	\ "normal 3G0lli\<BS>\<Esc>",
 	\], 'XtestProp')
   let buf = RunVimInTerminal('-S XtestProp', {'rows': 6})
   call VerifyScreenDump(buf, 'Test_textprop_01', {})