]> granicus.if.org Git - vim/commitdiff
patch 8.1.0643: computing byte offset wrong v8.1.0643
authorBram Moolenaar <Bram@vim.org>
Wed, 26 Dec 2018 22:42:10 +0000 (23:42 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 26 Dec 2018 22:42:10 +0000 (23:42 +0100)
Problem:    Computing byte offset wrong. (Bjorn Linse)
Solution:   Use the right variable for array index.

src/memline.c
src/testdir/test_textprop.vim
src/version.c

index d79e7ce8c08efa39fcbc5be3285d22f8afae2fa3..6b4a766346e012d7a240849e17e69b202807e149 100644 (file)
@@ -5380,7 +5380,7 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
            // lengths.
            len = 0;
            for (i = start_idx; i <= idx; ++i)
-               len += STRLEN((char_u *)dp + ((dp->db_index[idx]) & DB_INDEX_MASK)) + 1;
+               len += STRLEN((char_u *)dp + ((dp->db_index[i]) & DB_INDEX_MASK)) + 1;
        }
        else
 #endif
index ccf7d2846054712a0a99d3419915e6a13bea5137..e63ce6bf0757446a351ec2ba81d38b4064618de5 100644 (file)
@@ -229,11 +229,11 @@ endfunc
 func Test_prop_byteoff()
   call prop_type_add('comment', {'highlight': 'Directory'})
   new
-  call setline(1, ['line1', 'line2', ''])
+  call setline(1, ['line1', 'second line', ''])
   set ff=unix
-  call assert_equal(13, line2byte(3))
+  call assert_equal(19, line2byte(3))
   call prop_add(1, 1, {'end_col': 3, 'type': 'comment'})
-  call assert_equal(13, line2byte(3))
+  call assert_equal(19, line2byte(3))
 
   bwipe!
   call prop_type_delete('comment')
index dc1135827dedb1584c58d0115b3dbc064780d751..06f7a8a49ec9844acc38e6481da97fc08225c38a 100644 (file)
@@ -799,6 +799,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    643,
 /**/
     642,
 /**/