0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 9.1.0272: autocmd may change cwd after :tcd and :lcd

Problem:  Autocommand may change currect directory after :tcd and :lcd.
Solution: Also clear tp_localdir and w_localdir when using aucmd_win.
          (zeertzjq)

closes: #14435

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2024-04-07 18:16:10 +02:00
committed by Christian Brabandt
parent a44ced5763
commit 9d956ee8ea
6 changed files with 62 additions and 5 deletions

View File

@@ -4437,8 +4437,7 @@ win_init_popup_win(win_T *wp, buf_T *buf)
++buf->b_nwindows;
win_init_empty(wp); // set cursor and topline to safe values
// Make sure w_localdir and globaldir are NULL to avoid a chdir() in
// win_enter_ext().
// Make sure w_localdir is NULL to avoid a chdir() in win_enter_ext().
VIM_CLEAR(wp->w_localdir);
}
@@ -5445,8 +5444,8 @@ win_enter(win_T *wp, int undo_sync)
* Used after making another window the current one: change directory if
* needed.
*/
static void
fix_current_dir(void)
void
win_fix_current_dir(void)
{
if (curwin->w_localdir != NULL || curtab->tp_localdir != NULL)
{
@@ -5567,7 +5566,7 @@ win_enter_ext(win_T *wp, int flags)
}
#endif
fix_current_dir();
win_fix_current_dir();
#ifdef FEAT_JOB_CHANNEL
entering_window(curwin);