aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/eval/buffer.c')
-rw-r--r--src/nvim/eval/buffer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/eval/buffer.c b/src/nvim/eval/buffer.c
index 72eb0f8d67..6ebf54ef0f 100644
--- a/src/nvim/eval/buffer.c
+++ b/src/nvim/eval/buffer.c
@@ -86,6 +86,8 @@ static void find_win_for_curbuf(void)
///
/// Information is saved in "cob" and MUST be restored by calling
/// change_other_buffer_restore().
+///
+/// If this fails then "curbuf" will not be equal to "buf".
static void change_other_buffer_prepare(cob_T *cob, buf_T *buf)
{
CLEAR_POINTER(cob);
@@ -103,7 +105,9 @@ static void change_other_buffer_prepare(cob_T *cob, buf_T *buf)
// curwin->w_buffer differ from "curbuf", use the autocmd window.
curbuf = curwin->w_buffer;
aucmd_prepbuf(&cob->cob_aco, buf);
- cob->cob_using_aco = true;
+ if (curbuf == buf) {
+ cob->cob_using_aco = true;
+ }
}
}