diff src/testdir/test_textprop.vim @ 16714:ba592f30c082 v8.1.1359

patch 8.1.1359: text property wrong after :substitute with backslash commit https://github.com/vim/vim/commit/f3333b02f34526da46cdae608f7e2d869bb8c654 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 19 22:53:40 2019 +0200 patch 8.1.1359: text property wrong after :substitute with backslash Problem: Text property wrong after :substitute with backslash. Solution: Adjust text property columns when removing backslashes. (closes #4397)
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 May 2019 23:00:05 +0200
parents 23af483c4ceb
children 09c81f17f83c
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -620,6 +620,25 @@ func Test_prop_undo()
   undo
   let expected[0].col = 12
   call assert_equal(expected, prop_list(1))
+  call prop_clear(1)
+
+  " substitute with backslash
+  call setline(1, 'the number 123 is highlighted.')
+  call prop_add(1, 12, {'length': 3, 'type': 'comment'})
+  let expected = [{'col': 12, 'length': 3, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ]
+  call assert_equal(expected, prop_list(1))
+  1s/the/\The
+  call assert_equal(expected, prop_list(1))
+  1s/^/\\
+  let expected[0].col += 1
+  call assert_equal(expected, prop_list(1))
+  1s/^/\~
+  let expected[0].col += 1
+  call assert_equal(expected, prop_list(1))
+  1s/123/12\\3
+  let expected[0].length += 1
+  call assert_equal(expected, prop_list(1))
+  call prop_clear(1)
 
   bwipe!
   call prop_type_delete('comment')