vim-patch:9.0.0969: matchparen highlight is not updated when switching buffers (#21227)

Problem:    Matchparen highlight is not updated when switching buffers.
Solution:   Listen to the BufLeave and the BufWinEnter autocmd events.
            (closes vim/vim#11626)

28a896f54d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2022-11-29 10:17:57 +08:00
committed by GitHub
parent 615f124003
commit 65e8ed45de
8 changed files with 96 additions and 24 deletions

View File

@@ -58,6 +58,51 @@ describe('display', function()
]])
end)
-- oldtest: Test_matchparen_clear_highlight()
it('matchparen highlight is cleared when switching buffer', function()
local screen = Screen.new(20, 5)
screen:set_default_attr_ids({
[0] = {bold = true, foreground = Screen.colors.Blue},
[1] = {background = Screen.colors.Cyan},
})
screen:attach()
local screen1 = [[
{1:^()} |
{0:~ }|
{0:~ }|
{0:~ }|
|
]]
local screen2 = [[
^aa |
{0:~ }|
{0:~ }|
{0:~ }|
|
]]
exec([[
source $VIMRUNTIME/plugin/matchparen.vim
set hidden
call setline(1, ['()'])
normal 0
]])
screen:expect(screen1)
exec([[
enew
exe "normal iaa\<Esc>0"
]])
screen:expect(screen2)
feed('<C-^>')
screen:expect(screen1)
feed('<C-^>')
screen:expect(screen2)
end)
local function run_test_display_lastline(euro)
local screen = Screen.new(75, 10)
screen:set_default_attr_ids({