aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/autochdir_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-03-06 08:11:52 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-03-07 06:43:03 +0800
commitda9bc96152efedfa80fabf0d1aabe52b7269181e (patch)
treeb4bfaf0636451f8278fecb0a9c0822cad2ec583a /test/functional/legacy/autochdir_spec.lua
parent1a5409db0d21c2cf4fe59c825ed73d8a64f62693 (diff)
downloadrneovim-da9bc96152efedfa80fabf0d1aabe52b7269181e.tar.gz
rneovim-da9bc96152efedfa80fabf0d1aabe52b7269181e.tar.bz2
rneovim-da9bc96152efedfa80fabf0d1aabe52b7269181e.zip
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
Diffstat (limited to 'test/functional/legacy/autochdir_spec.lua')
-rw-r--r--test/functional/legacy/autochdir_spec.lua14
1 files changed, 14 insertions, 0 deletions
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)