diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-06-04 09:09:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-04 09:09:22 +0800 |
commit | 700cab00680fa25e0dbdf6f91f638f4da5a09909 (patch) | |
tree | 144c31711e574cdf5eb569a199fd39a4ce77f4b2 /test/functional | |
parent | 96e19533f60add50eea4598560bbd56de3b1fca3 (diff) | |
download | rneovim-700cab00680fa25e0dbdf6f91f638f4da5a09909.tar.gz rneovim-700cab00680fa25e0dbdf6f91f638f4da5a09909.tar.bz2 rneovim-700cab00680fa25e0dbdf6f91f638f4da5a09909.zip |
fix(events)!: trigger CursorMoved later on switching window (#23711)
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/autocmd/cursormoved_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/ui/float_spec.lua | 2 |
2 files changed, 12 insertions, 8 deletions
diff --git a/test/functional/autocmd/cursormoved_spec.lua b/test/functional/autocmd/cursormoved_spec.lua index 85d8628d7e..64b63c3205 100644 --- a/test/functional/autocmd/cursormoved_spec.lua +++ b/test/functional/autocmd/cursormoved_spec.lua @@ -5,19 +5,23 @@ local eq = helpers.eq local eval = helpers.eval local funcs = helpers.funcs local source = helpers.source +local command = helpers.command describe('CursorMoved', function() before_each(clear) - it('is triggered by changing windows', function() + it('is triggered after BufEnter when changing or splitting windows #11878 #12031', function() source([[ - let g:cursormoved = 0 - vsplit - autocmd CursorMoved * let g:cursormoved += 1 - wincmd w - wincmd w + call setline(1, 'foo') + let g:log = [] + autocmd BufEnter * let g:log += ['BufEnter' .. expand("<abuf>")] + autocmd CursorMoved * let g:log += ['CursorMoved' .. expand("<abuf>")] ]]) - eq(2, eval('g:cursormoved')) + eq({}, eval('g:log')) + command('new') + eq({'BufEnter2', 'CursorMoved2'}, eval('g:log')) + command('wincmd w') + eq({'BufEnter2', 'CursorMoved2', 'BufEnter1', 'CursorMoved1'}, eval('g:log')) end) it("is not triggered by functions that don't change the window", function() diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 19ad340dd5..46c2127c30 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -79,7 +79,7 @@ describe('float window', function() api.nvim_buf_set_lines(buf, 0, -1, true, contents) local winnr = vim.fn.win_id2win(floatwin) api.nvim_command('wincmd p') - api.nvim_command('autocmd CursorMoved * ++once '..winnr..'wincmd c') + api.nvim_command('autocmd BufEnter * ++once '..winnr..'wincmd c') return buf, floatwin end crashes{'foo'} |