summaryrefslogtreecommitdiff
path: root/src/testdir/test_match.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-16 16:08:18 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-16 16:08:18 +0200
commit4f416e41243ca151b95d39d81ce23d00b1484755 (patch)
tree2e560a4c537b04744dff89b978a4842963f52a68 /src/testdir/test_match.vim
parent22177f0c0826e3b2411a5e9d050b50200877ecd3 (diff)
downloadvim-4f416e41243ca151b95d39d81ce23d00b1484755.zip
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)
Diffstat (limited to 'src/testdir/test_match.vim')
-rw-r--r--src/testdir/test_match.vim26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/testdir/test_match.vim b/src/testdir/test_match.vim
index 57dde19ba..67f3ea737 100644
--- 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