aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-24 18:37:52 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-24 18:52:27 +0800
commit81c87857f632d1afe147e9b77a97da38f8f3a887 (patch)
treeb9fbaa4fbc0bc9f8b89249574ccc92da2ec97552 /src/nvim/testdir
parent868d8d69627c4b8fd5225da0dff5905f75645946 (diff)
downloadrneovim-81c87857f632d1afe147e9b77a97da38f8f3a887.tar.gz
rneovim-81c87857f632d1afe147e9b77a97da38f8f3a887.tar.bz2
rneovim-81c87857f632d1afe147e9b77a97da38f8f3a887.zip
vim-patch:8.2.3698: match highlighting continues over breakindent
Problem: Match highlighting continues over breakindent. Solution: Stop before the end column. (closes vim/vim#9242) https://github.com/vim/vim/commit/0c359af5c0fd106d3f57cc0bb7cef1c89b5e1e10 Cherry-pick Test_matchdelete_redraw() from patch 8.2.1077. Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_match.vim37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_match.vim b/src/nvim/testdir/test_match.vim
index 5d9be99444..e9dae8d67e 100644
--- a/src/nvim/testdir/test_match.vim
+++ b/src/nvim/testdir/test_match.vim
@@ -363,4 +363,41 @@ func Test_matchadd_other_window()
call delete('XscriptMatchCommon')
endfunc
+func Test_match_in_linebreak()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set breakindent linebreak breakat+=]
+ call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1)
+ call matchaddpos('ErrorMsg', [[1, 51]])
+ END
+ call writefile(lines, 'XscriptMatchLinebreak')
+ let buf = RunVimInTerminal('-S XscriptMatchLinebreak', #{rows: 10})
+ call TermWait(buf)
+ call VerifyScreenDump(buf, 'Test_match_linebreak', {})
+
+ call StopVimInTerminal(buf)
+ call delete('XscriptMatchLinebreak')
+endfunc
+
+" Test for deleting matches outside of the screen redraw top/bottom lines
+" This should cause a redraw of those lines.
+func Test_matchdelete_redraw()
+ new
+ call setline(1, range(1, 500))
+ call cursor(250, 1)
+ let m1 = matchaddpos('Search', [[250]])
+ let m2 = matchaddpos('Search', [[10], [450]])
+ redraw!
+ let m3 = matchaddpos('Search', [[240], [260]])
+ call matchdelete(m2)
+ let m = getmatches()
+ call assert_equal(2, len(m))
+ call assert_equal([250], m[0].pos1)
+ redraw!
+ call matchdelete(m1)
+ call assert_equal(1, len(getmatches()))
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab