diff options
author | zeertzjq <zeertzjq@outlook.com> | 2021-10-17 22:04:53 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2021-10-17 22:04:53 +0800 |
commit | e91dee5c21ffca22ac821336ad23bce6339b5f7c (patch) | |
tree | 255c0c0e08203f8af3badb29d858460a0bcee6ee /test | |
parent | eed89d5e0c3bd6870e6e9959ccfdbf99549dce6b (diff) | |
download | rneovim-e91dee5c21ffca22ac821336ad23bce6339b5f7c.tar.gz rneovim-e91dee5c21ffca22ac821336ad23bce6339b5f7c.tar.bz2 rneovim-e91dee5c21ffca22ac821336ad23bce6339b5f7c.zip |
vim-patch:8.1.0602: DirChanged is also triggered when directory didn't change
Problem: DirChanged is also triggered when the directory didn't change.
(Daniel Hahler)
Solution: Compare the current with the new directory. (closes vim/vim#3697)
https://github.com/vim/vim/commit/2caad3fbbdbf1486a176c9f6bfbc3d9be90e09f7
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/autocmd/dirchanged_spec.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/functional/autocmd/dirchanged_spec.lua b/test/functional/autocmd/dirchanged_spec.lua index 6f2da24cf2..2e1aff3914 100644 --- a/test/functional/autocmd/dirchanged_spec.lua +++ b/test/functional/autocmd/dirchanged_spec.lua @@ -113,6 +113,42 @@ describe('autocmd DirChanged', function() eq(2, eval('g:cdcount')) end) + it('does not trigger if diretory has not changed', function() + command('lcd '..dirs[1]) + eq({cwd=dirs[1], scope='window', changed_window=false}, eval('g:ev')) + eq(1, eval('g:cdcount')) + command('let g:ev = {}') + command('lcd '..dirs[1]) + eq({}, eval('g:ev')) + eq(1, eval('g:cdcount')) + + command('tcd '..dirs[2]) + eq({cwd=dirs[2], scope='tab', changed_window=false}, eval('g:ev')) + eq(2, eval('g:cdcount')) + command('let g:ev = {}') + command('tcd '..dirs[2]) + eq({}, eval('g:ev')) + eq(2, eval('g:cdcount')) + + command('cd '..dirs[3]) + eq({cwd=dirs[3], scope='global', changed_window=false}, eval('g:ev')) + eq(3, eval('g:cdcount')) + command('let g:ev = {}') + command('cd '..dirs[3]) + eq({}, eval('g:ev')) + eq(3, eval('g:cdcount')) + + command('set autochdir') + + command('split '..dirs[1]..'/foo') + eq({cwd=dirs[1], scope='window', changed_window=false}, eval('g:ev')) + eq(4, eval('g:cdcount')) + command('let g:ev = {}') + command('split '..dirs[1]..'/bar') + eq({}, eval('g:ev')) + eq(4, eval('g:cdcount')) + end) + it("is triggered by switching to win/tab with different CWD #6054", function() command('lcd '..dirs[3]) -- window 3 command('split '..dirs[2]..'/foo') -- window 2 |