diff src/testdir/test_textprop.vim @ 15255:19e79a1ed6b6 v8.1.0636

patch 8.1.0636: line2byte() gives wrong values with text properties commit https://github.com/vim/vim/commit/b413d2e6a8cc7b1611a41bfa9462b986393ca5fe Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 25 23:15:46 2018 +0100 patch 8.1.0636: line2byte() gives wrong values with text properties Problem: line2byte() gives wrong values with text properties. (Bjorn Linse) Solution: Compute byte offsets differently when text properties were added. (closes #3718)
author Bram Moolenaar <Bram@vim.org>
date Tue, 25 Dec 2018 23:30:07 +0100
parents 17525ca95e1e
children c5cb5151940d
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -226,5 +226,17 @@ func Test_prop_multiline()
   call prop_type_delete('comment')
 endfunc
 
+func Test_prop_byteoff()
+  call prop_type_add('comment', {'highlight': 'Directory'})
+  new
+  call setline(1, ['line1', 'line2', ''])
+  call assert_equal(13, line2byte(3))
+  call prop_add(1, 1, {'end_col': 3, 'type': 'comment'})
+  call assert_equal(13, line2byte(3))
+
+  bwipe!
+  call prop_type_delete('comment')
+endfunc
+
 
 " TODO: screenshot test with highlighting