To: vim_dev@googlegroups.com Subject: Patch 9.0.0969 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0969 Problem: Matchparen highlight is not updated when switching buffers. Solution: Listen to the BufLeave and the BufWinEnter autocmd events. (closes #11626) Files: runtime/plugin/matchparen.vim, src/testdir/test_display.vim, src/testdir/dumps/Test_matchparen_clear_highlight_1.dump, src/testdir/dumps/Test_matchparen_clear_highlight_2.dump *** ../vim-9.0.0968/runtime/plugin/matchparen.vim 2021-04-08 19:44:09.000000000 +0100 --- runtime/plugin/matchparen.vim 2022-11-28 22:12:04.633110181 +0000 *************** *** 1,12 **** " Vim plugin for showing matching parens " Maintainer: Bram Moolenaar ! " Last Change: 2021 Apr 08 " Exit quickly when: " - this plugin was already loaded (or disabled) " - when 'compatible' is set ! " - the "CursorMoved" autocmd event is not available. ! if exists("g:loaded_matchparen") || &cp || !exists("##CursorMoved") finish endif let g:loaded_matchparen = 1 --- 1,11 ---- " Vim plugin for showing matching parens " Maintainer: Bram Moolenaar ! " Last Change: 2022 Nov 28 " Exit quickly when: " - this plugin was already loaded (or disabled) " - when 'compatible' is set ! if exists("g:loaded_matchparen") || &cp finish endif let g:loaded_matchparen = 1 *************** *** 20,27 **** augroup matchparen " Replace all matchparen autocommands ! autocmd! CursorMoved,CursorMovedI,WinEnter * call s:Highlight_Matching_Pair() ! autocmd! WinLeave * call s:Remove_Matches() if exists('##TextChanged') autocmd! TextChanged,TextChangedI * call s:Highlight_Matching_Pair() endif --- 19,26 ---- augroup matchparen " Replace all matchparen autocommands ! autocmd! CursorMoved,CursorMovedI,WinEnter,BufWinEnter,WinScrolled * call s:Highlight_Matching_Pair() ! autocmd! WinLeave,BufLeave * call s:Remove_Matches() if exists('##TextChanged') autocmd! TextChanged,TextChangedI * call s:Highlight_Matching_Pair() endif *** ../vim-9.0.0968/src/testdir/test_display.vim 2022-10-15 14:24:25.940988629 +0100 --- src/testdir/test_display.vim 2022-11-28 22:16:04.381623743 +0000 *************** *** 237,242 **** --- 237,273 ---- call StopVimInTerminal(buf) endfunc + " Test for clearing paren highlight when switching buffers + func Test_matchparen_clear_highlight() + CheckScreendump + + let lines =<< trim END + source $VIMRUNTIME/plugin/matchparen.vim + set hidden + call setline(1, ['()']) + normal 0 + + func OtherBuffer() + enew + exe "normal iaa\0" + endfunc + END + call writefile(lines, 'XMatchparenClear', 'D') + let buf = RunVimInTerminal('-S XMatchparenClear', #{rows: 5}) + call VerifyScreenDump(buf, 'Test_matchparen_clear_highlight_1', {}) + + call term_sendkeys(buf, ":call OtherBuffer()\:\") + call VerifyScreenDump(buf, 'Test_matchparen_clear_highlight_2', {}) + + call term_sendkeys(buf, "\:\") + call VerifyScreenDump(buf, 'Test_matchparen_clear_highlight_1', {}) + + call term_sendkeys(buf, "\:\") + call VerifyScreenDump(buf, 'Test_matchparen_clear_highlight_2', {}) + + call StopVimInTerminal(buf) + endfunc + func Test_display_scroll_at_topline() CheckScreendump *** ../vim-9.0.0968/src/testdir/dumps/Test_matchparen_clear_highlight_1.dump 2022-11-28 22:19:47.042209445 +0000 --- src/testdir/dumps/Test_matchparen_clear_highlight_1.dump 2022-11-28 22:13:02.565112407 +0000 *************** *** 0 **** --- 1,5 ---- + >(+0(ffff15|)| +0&#ffffff0@72 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + | +0#0000000&@56|1|,|1| @10|A|l@1| *** ../vim-9.0.0968/src/testdir/dumps/Test_matchparen_clear_highlight_2.dump 2022-11-28 22:19:47.046209454 +0000 --- src/testdir/dumps/Test_matchparen_clear_highlight_2.dump 2022-11-28 22:15:22.049486000 +0000 *************** *** 0 **** --- 1,5 ---- + >a+0&#ffffff0@1| @72 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + | +0#0000000&@56|1|,|1| @10|A|l@1| *** ../vim-9.0.0968/src/version.c 2022-11-28 21:20:44.420909577 +0000 --- src/version.c 2022-11-28 22:02:15.437067539 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 969, /**/ -- hundred-and-one symptoms of being an internet addict: 175. You send yourself e-mail before you go to bed to remind you what to do when you wake up. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///