diff src/testdir/test_execute_func.vim @ 26121:2c64a420ce7e v8.2.3593

patch 8.2.3593: directory is wrong after executing "lcd" with win_execute() Commit: https://github.com/vim/vim/commit/7f13b24ab6aca808262e68680d8fe5f082670ebd Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 14 11:41:31 2021 +0000 patch 8.2.3593: directory is wrong after executing "lcd" with win_execute() Problem: Directory is wrong after executing "lcd" with win_execute(). Solution: Correct the directory when going back to the original window. (closes #9132)
author Bram Moolenaar <Bram@vim.org>
date Sun, 14 Nov 2021 12:45:04 +0100
parents e8e2c4d33b9b
children a07323eb647f
line wrap: on
line diff
--- a/src/testdir/test_execute_func.vim
+++ b/src/testdir/test_execute_func.vim
@@ -105,6 +105,18 @@ func Test_win_execute()
 
   call win_gotoid(otherwin)
   bwipe!
+
+  " check :lcd in another window does not change directory
+  let curid = win_getid()
+  let curdir = getcwd()
+  split Xother
+  lcd ..
+  " Use :pwd to get the actual current directory
+  let otherdir = execute('pwd')
+  call win_execute(curid, 'lcd testdir')
+  call assert_equal(otherdir, execute('pwd'))
+  bwipe!
+  execute 'cd ' .. curdir
 endfunc
 
 func Test_win_execute_update_ruler()