Skip to content

Commit 5d96270

Browse files
committed
updated for version 7.4b.008
Problem: 'autochdir' causes setbufvar() to change the current directory. (Ben Fritz) Solution: When disabling autocommands also reset 'acd' temporarily. (Christian Brabandt)
1 parent 1150d04 commit 5d96270

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/fileio.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8861,6 +8861,7 @@ aucmd_prepbuf(aco, buf)
88618861
#ifdef FEAT_WINDOWS
88628862
int save_ea;
88638863
#endif
8864+
int save_acd;
88648865

88658866
/* Find a window that is for the new buffer */
88668867
if (buf == curbuf) /* be quick when buf is curbuf */
@@ -8909,11 +8910,10 @@ aucmd_prepbuf(aco, buf)
89098910
aucmd_win->w_s = &buf->b_s;
89108911
++buf->b_nwindows;
89118912
win_init_empty(aucmd_win); /* set cursor and topline to safe values */
8912-
vim_free(aucmd_win->w_localdir);
8913-
aucmd_win->w_localdir = NULL;
89148913

89158914
/* Make sure w_localdir and globaldir are NULL to avoid a chdir() in
89168915
* win_enter_ext(). */
8916+
vim_free(aucmd_win->w_localdir);
89178917
aucmd_win->w_localdir = NULL;
89188918
aco->globaldir = globaldir;
89198919
globaldir = NULL;
@@ -8926,9 +8926,15 @@ aucmd_prepbuf(aco, buf)
89268926
make_snapshot(SNAP_AUCMD_IDX);
89278927
save_ea = p_ea;
89288928
p_ea = FALSE;
8929+
8930+
/* Prevent chdir() call in win_enter_ext(), through do_autochdir(). */
8931+
save_acd = p_acd;
8932+
p_acd = FALSE;
8933+
89298934
(void)win_split_ins(0, WSP_TOP, aucmd_win, 0);
89308935
(void)win_comp_pos(); /* recompute window positions */
89318936
p_ea = save_ea;
8937+
p_acd = save_acd;
89328938
unblock_autocmds();
89338939
#endif
89348940
curwin = aucmd_win;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,8 @@ static char *(features[]) =
727727

728728
static int included_patches[] =
729729
{ /* Add new patch number below this line */
730+
/**/
731+
8,
730732
/**/
731733
7,
732734
/**/

0 commit comments

Comments
 (0)