summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-05-06 21:38:18 +0000
committerBram Moolenaar <Bram@vim.org>2006-05-06 21:38:18 +0000
commit773560bc6052d6ee44f5ca0bef1a476ea434f432 (patch)
tree35c16140ac818898856579c7dca7b457f50a6d4b /src/window.c
parent79783449725290436eff22548f676822640f88ec (diff)
downloadvim-git-773560bc6052d6ee44f5ca0bef1a476ea434f432.tar.gz
updated for version 7.0g05
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/window.c b/src/window.c
index cbcdd4eb9..c4cd31a71 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3425,19 +3425,22 @@ enter_tabpage(tp, old_curbuf)
buf_T *old_curbuf;
{
int old_off = tp->tp_firstwin->w_winrow;
+ win_T *next_prevwin = tp->tp_prevwin;
curtab = tp;
firstwin = tp->tp_firstwin;
lastwin = tp->tp_lastwin;
topframe = tp->tp_topframe;
-#ifdef FEAT_AUTOCMD
- apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
-#endif
+ /* We would like doing the TabEnter event first, but we don't have a
+ * valid current window yet, which may break some commands.
+ * This triggers autocommands, thus may make "tp" invalid. */
win_enter_ext(tp->tp_curwin, FALSE, TRUE);
- prevwin = tp->tp_prevwin;
+ prevwin = next_prevwin;
#ifdef FEAT_AUTOCMD
+ apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
+
if (old_curbuf != curbuf)
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
#endif