diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-29 10:17:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 10:17:57 +0800 |
commit | 65e8ed45de98bf93491c6740772f0a42834696ab (patch) | |
tree | e40c3905b1cc11ab5dee914ecc31916fb7967596 /test | |
parent | 615f124003376c007442319b31a172360796974c (diff) | |
download | rneovim-65e8ed45de98bf93491c6740772f0a42834696ab.tar.gz rneovim-65e8ed45de98bf93491c6740772f0a42834696ab.tar.bz2 rneovim-65e8ed45de98bf93491c6740772f0a42834696ab.zip |
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 <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/editor/completion_spec.lua | 3 | ||||
-rw-r--r-- | test/functional/legacy/display_spec.lua | 45 | ||||
-rw-r--r-- | test/functional/legacy/source_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/legacy/visual_mode_spec.lua | 25 | ||||
-rw-r--r-- | test/functional/ui/spell_spec.lua | 1 |
5 files changed, 60 insertions, 15 deletions
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua index 1b9899174b..c503d7ebfb 100644 --- a/test/functional/editor/completion_spec.lua +++ b/test/functional/editor/completion_spec.lua @@ -1029,7 +1029,8 @@ describe('completion', function() ]]) end) - it('TextChangedP autocommand', function() + -- oldtest: Test_ChangedP() + it('TextChangedI and TextChangedP autocommands', function() curbufmeths.set_lines(0, 1, false, { 'foo', 'bar', 'foobar'}) source([[ set complete=. completeopt=menuone 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\<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({ diff --git a/test/functional/legacy/source_spec.lua b/test/functional/legacy/source_spec.lua index 02e6385247..f31521607d 100644 --- a/test/functional/legacy/source_spec.lua +++ b/test/functional/legacy/source_spec.lua @@ -7,6 +7,7 @@ local write_file = helpers.write_file before_each(clear) describe(':source!', function() + -- oldtest: Test_nested_script() it('gives E22 when scripts nested too deep', function() write_file('Xscript.vim', [[ :source! Xscript.vim diff --git a/test/functional/legacy/visual_mode_spec.lua b/test/functional/legacy/visual_mode_spec.lua index 8b5dd0c2dc..1a08fb4c0e 100644 --- a/test/functional/legacy/visual_mode_spec.lua +++ b/test/functional/legacy/visual_mode_spec.lua @@ -1,31 +1,28 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') -local call = helpers.call local clear = helpers.clear local feed = helpers.feed -local feed_command = helpers.feed_command -local funcs = helpers.funcs -local meths = helpers.meths -local eq = helpers.eq local exec = helpers.exec -describe('visual line mode', function() - local screen +before_each(clear) +describe('visual line mode', function() + -- oldtest: Test_visual_block_scroll() it('redraws properly after scrolling with matchparen loaded and scrolloff=1', function() - clear{args={'-u', 'NORC'}} - screen = Screen.new(30, 7) + local screen = Screen.new(30, 7) screen:attach() screen:set_default_attr_ids({ [1] = {bold = true}, [2] = {background = Screen.colors.LightGrey}, }) - eq(1, meths.get_var('loaded_matchparen')) - feed_command('set scrolloff=1') - funcs.setline(1, {'a', 'b', 'c', 'd', 'e', '', '{', '}', '{', 'f', 'g', '}'}) - call('cursor', 5, 1) + exec([[ + source $VIMRUNTIME/plugin/matchparen.vim + set scrolloff=1 + call setline(1, ['a', 'b', 'c', 'd', 'e', '', '{', '}', '{', 'f', 'g', '}']) + call cursor(5, 1) + ]]) feed('V<c-d><c-d>') screen:expect([[ @@ -41,8 +38,8 @@ describe('visual line mode', function() end) describe('visual block mode', function() + -- oldtest: Test_visual_block_with_virtualedit() it('shows selection correctly with virtualedit=block', function() - clear() local screen = Screen.new(30, 7) screen:set_default_attr_ids({ [1] = {bold = true}, -- ModeMsg diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua index 5b43edbad4..361f83d1ce 100644 --- a/test/functional/ui/spell_spec.lua +++ b/test/functional/ui/spell_spec.lua @@ -51,6 +51,7 @@ describe("'spell'", function() end) + -- oldtest: Test_spell_screendump() it('has correct highlight at start of line', function() insert([[ "This is some text without any spell errors. Everything", |