diff options
-rw-r--r-- | src/evalwindow.c | 17 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/evalwindow.c b/src/evalwindow.c index f2d9a0b444..a47a0c0470 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -707,13 +707,26 @@ f_win_execute(typval_T *argvars, typval_T *rettv) { pos_T curpos = wp->w_cursor; char_u cwd[MAXPATHL]; - int cwd_status; + int cwd_status = FAIL; #ifdef FEAT_AUTOCHDIR char_u autocwd[MAXPATHL]; int apply_acd = FALSE; #endif - cwd_status = mch_dirname(cwd, MAXPATHL); + // Getting and setting directory can be slow on some systems, only do + // this when the current or target window/tab have a local directory or + // 'acd' is set. + if (curwin != wp + && (curwin->w_localdir != NULL + || wp->w_localdir != NULL + || (curtab != tp + && (curtab->tp_localdir != NULL + || tp->tp_localdir != NULL)) +#ifdef FEAT_AUTOCHDIR + || p_acd +#endif + )) + cwd_status = mch_dirname(cwd, MAXPATHL); #ifdef FEAT_AUTOCHDIR // If 'acd' is set, check we are using that directory. If yes, then diff --git a/src/version.c b/src/version.c index 27f63212a9..d1c88fce4f 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4060, +/**/ 4059, /**/ 4058, |