From da9bc96152efedfa80fabf0d1aabe52b7269181e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 6 Mar 2022 08:11:52 +0800 Subject: vim-patch:8.2.3920: restoring directory after using another window is inefficient Problem: Restoring directory after using another window is inefficient. Solution: Only restore the directory for win_execute(). Apply 'autochdir' only when needed. https://github.com/vim/vim/commit/90c317f2246a7fb4bd4e3feb0778b53627bc9fad --- test/functional/legacy/autochdir_spec.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/functional/legacy/autochdir_spec.lua') diff --git a/test/functional/legacy/autochdir_spec.lua b/test/functional/legacy/autochdir_spec.lua index 75df1f8c55..89651284b5 100644 --- a/test/functional/legacy/autochdir_spec.lua +++ b/test/functional/legacy/autochdir_spec.lua @@ -61,6 +61,20 @@ describe('autochdir behavior', function() expected_empty() end) + it('win_execute() does not change directory', function() + local subdir = 'Xfile' + command('cd '..dir) + command('set autochdir') + call('mkdir', subdir) + local winid = eval('win_getid()') + command('new '..subdir..'/file') + matches('.*'..dir..'[/\\]'..subdir, eval('getcwd()')) + command('cd ..') + matches('.*'..dir, eval('getcwd()')) + call('win_execute', winid, 'echo') + matches('.*'..dir, eval('getcwd()')) + end) + it(':verbose pwd shows whether autochdir is used', function() local subdir = 'Xautodir' command('cd '..dir) -- cgit