diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index ff37159f19..b05d35179c 100644 --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -1,6 +1,6 @@ " Vim plugin for showing matching parens " Maintainer: The Vim Project -" Last Change: 2025 Mar 14 +" Last Change: 2025 Apr 08 " Former Maintainer: Bram Moolenaar " Exit quickly when: diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua index 665393463d..5d7e9e85f9 100644 --- a/test/functional/legacy/matchparen_spec.lua +++ b/test/functional/legacy/matchparen_spec.lua @@ -261,4 +261,35 @@ describe('matchparen', function() {5:-- INSERT --} | ]]) end) + + -- oldtest: Test_scroll_winenter() + it('with scrolling', function() + local screen = Screen.new(30, 7) + exec([[ + source $VIMRUNTIME/plugin/matchparen.vim + set scrolloff=1 + call setline(1, ['foobar {', '', '', '', '}']) + call cursor(5, 1) + ]]) + screen:add_extra_attr_ids({ + [100] = { background = Screen.colors.Aqua }, + }) + local s1 = [[ + foobar {100:{} | + |*3 + {100:^}} | + {1:~ }| + | + ]] + screen:expect(s1) + feed('') + screen:expect([[ + |*3 + ^} | + {1:~ }|*2 + | + ]]) + feed('') + screen:expect(s1) + end) end) diff --git a/test/old/testdir/test_plugin_matchparen.vim b/test/old/testdir/test_plugin_matchparen.vim index 6739abcfde..5b0702cab6 100644 --- a/test/old/testdir/test_plugin_matchparen.vim +++ b/test/old/testdir/test_plugin_matchparen.vim @@ -177,4 +177,28 @@ func Test_matchparen_ignore_sh_case() call StopVimInTerminal(buf) endfunc +" Test for the WinScrolled event +func Test_scroll_winenter() + CheckScreendump + + let lines =<< trim END + source $VIMRUNTIME/plugin/matchparen.vim + set scrolloff=1 + call setline(1, ['foobar {', '', '', '', '}']) + call cursor(5, 1) + END + + let filename = 'Xmatchparen_winscrolled' + call writefile(lines, filename, 'D') + + let buf = RunVimInTerminal('-S '.filename, #{rows: 7}) + call VerifyScreenDump(buf, 'Test_matchparen_winscrolled1', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_matchparen_winscrolled2', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_matchparen_winscrolled1', {}) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab