1
0
forked from aniani/vim

patch 8.2.4513: window-local directory is not applied if 'acd' fails

Problem:    Window-local directory is not applied if 'acd' fails.
Solution:   Don't call do_autochdir(). (closes #9891)
This commit is contained in:
zeertzjq
2022-03-05 17:00:31 +00:00
committed by Bram Moolenaar
parent df1bbea436
commit b29ae15977
3 changed files with 11 additions and 9 deletions

View File

@@ -86,22 +86,27 @@ func Test_verbose_pwd()
set acd set acd
wincmd w wincmd w
call assert_match('\[autochdir\].*testdir$', execute('verbose pwd')) call assert_match('\[autochdir\].*testdir$', execute('verbose pwd'))
execute 'lcd' cwd
call assert_match('\[window\].*testdir$', execute('verbose pwd'))
execute 'tcd' cwd execute 'tcd' cwd
call assert_match('\[tabpage\].*testdir$', execute('verbose pwd')) call assert_match('\[tabpage\].*testdir$', execute('verbose pwd'))
execute 'cd' cwd execute 'cd' cwd
call assert_match('\[global\].*testdir$', execute('verbose pwd')) call assert_match('\[global\].*testdir$', execute('verbose pwd'))
execute 'lcd' cwd
call assert_match('\[window\].*testdir$', execute('verbose pwd'))
edit edit
call assert_match('\[autochdir\].*testdir$', execute('verbose pwd')) call assert_match('\[autochdir\].*testdir$', execute('verbose pwd'))
enew
wincmd w
call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd'))
wincmd w
call assert_match('\[window\].*testdir$', execute('verbose pwd'))
wincmd w wincmd w
call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd')) call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd'))
set noacd set noacd
call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd')) call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd'))
wincmd w wincmd w
call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd')) call assert_match('\[window\].*testdir$', execute('verbose pwd'))
execute 'cd' cwd execute 'cd' cwd
call assert_match('\[global\].*testdir', execute('verbose pwd')) call assert_match('\[global\].*testdir$', execute('verbose pwd'))
wincmd w wincmd w
call assert_match('\[window\].*testdir[/\\]Xautodir', execute('verbose pwd')) call assert_match('\[window\].*testdir[/\\]Xautodir', execute('verbose pwd'))

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
4513,
/**/ /**/
4512, 4512,
/**/ /**/

View File

@@ -4772,11 +4772,6 @@ win_enter(win_T *wp, int undo_sync)
static void static void
fix_current_dir(void) fix_current_dir(void)
{ {
#ifdef FEAT_AUTOCHDIR
if (p_acd)
do_autochdir();
else
#endif
if (curwin->w_localdir != NULL || curtab->tp_localdir != NULL) if (curwin->w_localdir != NULL || curtab->tp_localdir != NULL)
{ {
char_u *dirname; char_u *dirname;