From 65e8ed45de98bf93491c6740772f0a42834696ab Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 29 Nov 2022 10:17:57 +0800 Subject: 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) https://github.com/vim/vim/commit/28a896f54d4b2f2b4bef8ef4144dde1673c9d6e7 Co-authored-by: Bram Moolenaar --- test/functional/legacy/display_spec.lua | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'test/functional/legacy/display_spec.lua') diff --git a/test/functional/legacy/display_spec.lua b/test/functional/legacy/display_spec.lua index 9160129a02..f9b78f5dcd 100644 --- a/test/functional/legacy/display_spec.lua +++ b/test/functional/legacy/display_spec.lua @@ -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\0" + ]]) + screen:expect(screen2) + + feed('') + screen:expect(screen1) + + feed('') + screen:expect(screen2) + end) + local function run_test_display_lastline(euro) local screen = Screen.new(75, 10) screen:set_default_attr_ids({ -- cgit