aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/window.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index d86584e9ce..85ed73bd6d 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -752,8 +752,15 @@ void win_set_buf(win_T *win, buf_T *buf, Error *err)
goto cleanup;
}
+ // temporarily disable 'autochdir' when using win_set_buf
+ // on non-current window
+ int save_acd = p_acd;
+ if (!switchwin.sw_same_win) {
+ p_acd = false;
+ }
try_start();
int result = do_buffer(DOBUF_GOTO, DOBUF_FIRST, FORWARD, buf->b_fnum, 0);
+ p_acd = save_acd;
if (!try_end(err) && result == FAIL) {
api_set_error(err,
kErrorTypeException,