To: vim_dev@googlegroups.com Subject: Patch 8.0.0033 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0033 Problem: Cannot use overlapping positions with matchaddpos(). Solution: Check end of match. (Ozaki Kiichi) Add a test (Hirohito Higashi) Files: src/screen.c, src/testdir/test_match.vim *** ../vim-8.0.0032/src/screen.c 2016-10-02 23:09:27.643153731 +0200 --- src/screen.c 2016-10-15 14:52:51.297854046 +0200 *************** *** 7786,7806 **** shl->lnum = 0; for (i = posmatch->cur; i < MAXPOSMATCH; i++) { ! if (posmatch->pos[i].lnum == 0) break; ! if (posmatch->pos[i].col < mincol) continue; ! if (posmatch->pos[i].lnum == lnum) { if (shl->lnum == lnum) { /* partially sort positions by column numbers * on the same line */ ! if (posmatch->pos[i].col < posmatch->pos[bot].col) { ! llpos_T tmp = posmatch->pos[i]; ! posmatch->pos[i] = posmatch->pos[bot]; posmatch->pos[bot] = tmp; } } --- 7786,7808 ---- shl->lnum = 0; for (i = posmatch->cur; i < MAXPOSMATCH; i++) { ! llpos_T *pos = &posmatch->pos[i]; ! ! if (pos->lnum == 0) break; ! if (pos->col + pos->len - 1 <= mincol) continue; ! if (pos->lnum == lnum) { if (shl->lnum == lnum) { /* partially sort positions by column numbers * on the same line */ ! if (pos->col < posmatch->pos[bot].col) { ! llpos_T tmp = *pos; ! *pos = posmatch->pos[bot]; posmatch->pos[bot] = tmp; } } *** ../vim-8.0.0032/src/testdir/test_match.vim 2016-08-27 18:28:13.000000000 +0200 --- src/testdir/test_match.vim 2016-10-15 14:50:58.442694482 +0200 *************** *** 181,186 **** --- 181,196 ---- redraw! call assert_equal(screenattr(2,2), screenattr(1,6)) + " Check overlapping pos + call clearmatches() + call setline(1, ['1234567890', 'NH']) + call matchaddpos('Error', [[1,1,5], [1,3,5], [2,2]]) + redraw! + call assert_notequal(screenattr(2,2), 0) + call assert_equal(screenattr(2,2), screenattr(1,5)) + call assert_equal(screenattr(2,2), screenattr(1,7)) + call assert_notequal(screenattr(2,2), screenattr(1,8)) + nohl syntax off set hlsearch& *** ../vim-8.0.0032/src/version.c 2016-10-12 17:52:39.199701825 +0200 --- src/version.c 2016-10-15 14:54:57.816912413 +0200 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 33, /**/ -- Q: Why does /dev/null accept only integers? A: You can't sink a float. /// 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 ///