From 14186937a43195078f0d8805c0ef2e6d4d90e6f2 Mon Sep 17 00:00:00 2001 From: edyfox Date: Tue, 2 Sep 2008 00:16:16 +0000 Subject: [PATCH] Patch 7.2.008 Problem: With a BufHidden autocommand that invokes ":bunload" the window count for a buffer can be wrong. (Bob Hiestand) Solution: Don't call enter_buffer() when already in that buffer. Files: src/buffer.c git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/branches/vim7.2@1173 2a77ed30-b011-0410-a7ad-c7884a0aa172 --- src/buffer.c | 7 ++++--- src/version.c | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index f1b4fd69..173a0f80 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1351,11 +1351,12 @@ set_curbuf(buf, action) } } #ifdef FEAT_AUTOCMD + /* An autocommand may have deleted "buf", already entered it (e.g., when + * it did ":bunload") or aborted the script processing! */ # ifdef FEAT_EVAL - /* An autocommand may have deleted buf or aborted the script processing! */ - if (buf_valid(buf) && !aborting()) + if (buf_valid(buf) && buf != curbuf && !aborting()) # else - if (buf_valid(buf)) /* an autocommand may have deleted buf! */ + if (buf_valid(buf) && buf != curbuf) # endif #endif enter_buffer(buf); diff --git a/src/version.c b/src/version.c index 64370d0f..16a0cee2 100644 --- a/src/version.c +++ b/src/version.c @@ -677,6 +677,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 8, +/**/ 7, /**/ 6, -- 2.11.4.GIT