mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
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.
90c317f224
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user