To: vim_dev@googlegroups.com Subject: Patch 8.1.0643 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0643 Problem: Computing byte offset wrong. (Bjorn Linse) Solution: Use the right variable for array index. Files: src/memline.c, src/testdir/test_textprop.vim *** ../vim-8.1.0642/src/memline.c 2018-12-26 22:57:37.978550895 +0100 --- src/memline.c 2018-12-26 23:41:19.484193715 +0100 *************** *** 5380,5386 **** // lengths. len = 0; for (i = start_idx; i <= idx; ++i) ! len += STRLEN((char_u *)dp + ((dp->db_index[idx]) & DB_INDEX_MASK)) + 1; } else #endif --- 5380,5386 ---- // lengths. len = 0; for (i = start_idx; i <= idx; ++i) ! len += STRLEN((char_u *)dp + ((dp->db_index[i]) & DB_INDEX_MASK)) + 1; } else #endif *** ../vim-8.1.0642/src/testdir/test_textprop.vim 2018-12-26 01:08:56.344312939 +0100 --- src/testdir/test_textprop.vim 2018-12-26 23:39:15.261354947 +0100 *************** *** 229,239 **** func Test_prop_byteoff() call prop_type_add('comment', {'highlight': 'Directory'}) new ! call setline(1, ['line1', 'line2', '']) set ff=unix ! 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') --- 229,239 ---- func Test_prop_byteoff() call prop_type_add('comment', {'highlight': 'Directory'}) new ! call setline(1, ['line1', 'second line', '']) set ff=unix ! call assert_equal(19, line2byte(3)) call prop_add(1, 1, {'end_col': 3, 'type': 'comment'}) ! call assert_equal(19, line2byte(3)) bwipe! call prop_type_delete('comment') *** ../vim-8.1.0642/src/version.c 2018-12-26 22:57:37.978550895 +0100 --- src/version.c 2018-12-26 23:41:36.016040461 +0100 *************** *** 801,802 **** --- 801,804 ---- { /* Add new patch number below this line */ + /**/ + 643, /**/ -- "I don’t know how to make a screenshot" - Richard Stallman, July 2002 (when asked to send a screenshot of his desktop for unix.se) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///