Mercurial > vim
diff src/testdir/test_match.vim @ 9885:4e8b05fa12c6 v7.4.2217
commit https://github.com/vim/vim/commit/4f416e41243ca151b95d39d81ce23d00b1484755
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 16 16:08:18 2016 +0200
patch 7.4.2217
Problem: When using matchaddpos() a character after the end of the line can
be highlighted.
Solution: Only highlight existing characters. (Hirohito Higashi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 16 Aug 2016 16:15:06 +0200 |
parents | 2409d7038822 |
children | 3ee84d270ea7 |
line wrap: on
line diff
--- a/src/testdir/test_match.vim +++ b/src/testdir/test_match.vim @@ -1,7 +1,7 @@ " Test for :match, :2match, :3match, clearmatches(), getmatches(), matchadd(), " matchaddpos(), matcharg(), matchdelete(), matchstrpos() and setmatches(). -function Test_matcharg() +function Test_match() highlight MyGroup1 term=bold ctermbg=red guibg=red highlight MyGroup2 term=italic ctermbg=green guibg=green highlight MyGroup3 term=underline ctermbg=blue guibg=blue @@ -162,4 +162,28 @@ func Test_matchstrpos() call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img')) endfunc +func Test_matchaddpos() + syntax on + set hlsearch + + call setline(1, ['12345', 'NP']) + call matchaddpos('Error', [[1,2], [1,6], [2,2]]) + redraw! + call assert_notequal(screenattr(2,2), 0) + call assert_equal(screenattr(2,2), screenattr(1,2)) + call assert_notequal(screenattr(2,2), screenattr(1,6)) + 1 + call matchadd('Search', 'N\|\n') + redraw! + call assert_notequal(screenattr(2,1), 0) + call assert_equal(screenattr(2,1), screenattr(1,6)) + exec "norm! i0\<Esc>" + redraw! + call assert_equal(screenattr(2,2), screenattr(1,6)) + + nohl + syntax off + set hlsearch& +endfunc + " vim: et ts=2 sw=2