summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-02-16 22:11:02 +0000
committerBram Moolenaar <Bram@vim.org>2006-02-16 22:11:02 +0000
commitf740b29ae2a346e44c34001b3bf8ecfa0c7857bd (patch)
tree5b62807af1359d3df97367448927cdbb53969448 /src/main.c
parent4c7ed462cb7813730b4f15f9cb09f1b26d097fca (diff)
updated for version 7.0199v7.0199
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/main.c b/src/main.c
index 81e41b692f..1a71be9088 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1133,6 +1133,7 @@ getout(exitval)
#ifdef FEAT_AUTOCMD
buf_T *buf;
win_T *wp;
+ tabpage_T *tp, *next_tp;
#endif
exiting = TRUE;
@@ -1160,23 +1161,28 @@ getout(exitval)
#ifdef FEAT_AUTOCMD
/* Trigger BufWinLeave for all windows, but only once per buffer. */
- for (wp = firstwin; wp != NULL; )
+# if defined FEAT_WINDOWS
+ for (tp = first_tabpage; tp != NULL; tp = next_tp)
{
- buf = wp->w_buffer;
- if (buf->b_changedtick != -1)
+ next_tp = tp->tp_next;
+ for (wp = (tp->tp_topframe == topframe)
+ ? firstwin : tp->tp_firstwin; wp != NULL; wp = wp->w_next)
{
- apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname,
+ buf = wp->w_buffer;
+ if (buf->b_changedtick != -1)
+ {
+ apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname,
FALSE, buf);
- buf->b_changedtick = -1; /* note that we did it already */
- wp = firstwin; /* restart, window may be closed */
+ buf->b_changedtick = -1; /* note that we did it already */
+ /* start all over, autocommands may mess up the lists */
+ next_tp = first_tabpage;
+ break;
+ }
}
-# ifdef FEAT_WINDOWS
- else
- wp = wp->w_next;
+ }
# else
- break;
+ apply_autocmds(EVENT_BUFWINLEAVE, curbuf, curbuf->b_fname, FALSE, curbuf);
# endif
- }
/* Trigger BufUnload for buffers that are loaded */
for (buf = firstbuf; buf != NULL; buf = buf->b_next)