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)
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 081d4ab..3ec6ea8 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -226,5 +226,17 @@
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