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)
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index eb30c04..08b93df 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -620,6 +620,25 @@
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')