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.
diff --git a/src/testdir/test_autochdir.vim b/src/testdir/test_autochdir.vim
index 861db72..5d36775 100644
--- a/src/testdir/test_autochdir.vim
+++ b/src/testdir/test_autochdir.vim
@@ -51,6 +51,26 @@
endtry
endfunc
+func Test_acd_win_execute()
+ let cwd = getcwd()
+ set acd
+ call test_autochdir()
+
+ call mkdir('Xfile')
+ let winid = win_getid()
+ new Xfile/file
+ call assert_match('testdir.Xfile$', getcwd())
+ cd ..
+ call assert_match('testdir$', getcwd())
+ call win_execute(winid, 'echo')
+ call assert_match('testdir$', getcwd())
+
+ bwipe!
+ set noacd
+ call chdir(cwd)
+ call delete('Xfile', 'rf')
+endfunc
+
func Test_verbose_pwd()
let cwd = getcwd()
call test_autochdir()