DirChanged: support <buffer> (#8140)

This commit is contained in:
Marco Hinz 2018-03-16 07:29:20 +01:00 committed by Justin M. Keyes
parent 0093c25dd3
commit cca407b43e
2 changed files with 8 additions and 1 deletions

View File

@ -1560,7 +1560,7 @@ void do_autocmd_dirchanged(char *new_dir, CdScope scope)
tv_dict_set_keys_readonly(dict); tv_dict_set_keys_readonly(dict);
apply_autocmds(EVENT_DIRCHANGED, (char_u *)buf, (char_u *)new_dir, false, apply_autocmds(EVENT_DIRCHANGED, (char_u *)buf, (char_u *)new_dir, false,
NULL); curbuf);
tv_dict_clear(dict); tv_dict_clear(dict);

View File

@ -154,4 +154,11 @@ describe('autocmd DirChanged', function()
eq('Failed to change directory', string.match(err, ': (.*)')) eq('Failed to change directory', string.match(err, ': (.*)'))
eq({cwd=dirs[2], scope='global'}, eval('g:ev')) eq({cwd=dirs[2], scope='global'}, eval('g:ev'))
end) end)
it('works when local to buffer', function()
command('let g:triggered = 0')
command('autocmd DirChanged <buffer> let g:triggered = 1')
command('cd '..dirs[1])
eq(1, eval('g:triggered'))
end)
end) end)