Patch 8.2.3739

6 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 4, 2021, 5:04:11 PM12/4/21
to vim...@googlegroups.com

Patch 8.2.3739
Problem: In wrong directory when using win_execute() with 'acd' set.
Solution: Restore the directory when returning to the window. (closes #9276)
Files: src/window.c, src/testdir/test_autochdir.vim


*** ../vim-8.2.3738/src/window.c 2021-11-29 20:39:06.682101619 +0000
--- src/window.c 2021-12-04 21:44:57.295890211 +0000
***************
*** 4858,4863 ****
--- 4858,4868 ----
void
fix_current_dir(void)
{
+ #ifdef FEAT_AUTOCHDIR
+ if (p_acd)
+ do_autochdir();
+ else
+ #endif
if (curwin->w_localdir != NULL || curtab->tp_localdir != NULL)
{
char_u *dirname;
*** ../vim-8.2.3738/src/testdir/test_autochdir.vim 2021-11-19 11:59:04.927685669 +0000
--- src/testdir/test_autochdir.vim 2021-12-04 21:56:58.477636540 +0000
***************
*** 25,30 ****
--- 25,57 ----
call delete('samples/Xtest')
endfunc

+ func Test_set_filename_other_window()
+ call ch_logfile('logfile', 'w')
+ let cwd = getcwd()
+ call test_autochdir()
+ call mkdir('Xa')
+ call mkdir('Xb')
+ call mkdir('Xc')
+ try
+ args Xa/aaa.txt Xb/bbb.txt
+ set acd
+ let winid = win_getid()
+ snext
+ call assert_equal('Xb', substitute(getcwd(), '.*/\([^/]*\)$', '\1', ''))
+ call win_execute(winid, 'file ' .. cwd .. '/Xc/ccc.txt')
+ call assert_equal('Xb', substitute(getcwd(), '.*/\([^/]*\)$', '\1', ''))
+ finally
+ set noacd
+ call chdir(cwd)
+ call delete('Xa', 'rf')
+ call delete('Xb', 'rf')
+ call delete('Xc', 'rf')
+ bwipe! aaa.txt
+ bwipe! bbb.txt
+ bwipe! ccc.txt
+ endtry
+ endfunc
+
func Test_verbose_pwd()
let cwd = getcwd()
call test_autochdir()
***************
*** 53,58 ****
--- 80,87 ----
set noacd
call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd'))
wincmd w
+ call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd'))
+ execute 'cd' cwd
call assert_match('\[global\].*testdir', execute('verbose pwd'))
wincmd w
call assert_match('\[window\].*testdir[/\\]Xautodir', execute('verbose pwd'))
*** ../vim-8.2.3738/src/version.c 2021-12-04 17:20:22.535448236 +0000
--- src/version.c 2021-12-04 21:41:34.528533882 +0000
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 3739,
/**/

--
Git catch 22: "merge is not possible because you have unmerged files."

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages