0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

updated for version 7.2-241

This commit is contained in:
Bram Moolenaar
2009-07-29 10:10:29 +00:00
parent 9f8650c969
commit 6bef63c651
4 changed files with 27 additions and 2 deletions

View File

@@ -8420,6 +8420,10 @@ aucmd_prepbuf(aco, buf)
if (aucmd_win == NULL) if (aucmd_win == NULL)
win = curwin; win = curwin;
} }
if (win == NULL && aucmd_win_used)
/* Strange recursive autocommand, fall back to using the current
* window. Expect a few side effects... */
win = curwin;
aco->save_curwin = curwin; aco->save_curwin = curwin;
aco->save_curbuf = curbuf; aco->save_curbuf = curbuf;
@@ -8428,6 +8432,7 @@ aucmd_prepbuf(aco, buf)
/* There is a window for "buf" in the current tab page, make it the /* There is a window for "buf" in the current tab page, make it the
* curwin. This is preferred, it has the least side effects (esp. if * curwin. This is preferred, it has the least side effects (esp. if
* "buf" is curbuf). */ * "buf" is curbuf). */
aco->use_aucmd_win = FALSE;
curwin = win; curwin = win;
} }
else else
@@ -8436,9 +8441,20 @@ aucmd_prepbuf(aco, buf)
* effects, insert it in a the current tab page. * effects, insert it in a the current tab page.
* Anything related to a window (e.g., setting folds) may have * Anything related to a window (e.g., setting folds) may have
* unexpected results. */ * unexpected results. */
aco->use_aucmd_win = TRUE;
aucmd_win_used = TRUE;
aucmd_win->w_buffer = buf; aucmd_win->w_buffer = buf;
++buf->b_nwindows; ++buf->b_nwindows;
win_init_empty(aucmd_win); /* set cursor and topline to safe values */ win_init_empty(aucmd_win); /* set cursor and topline to safe values */
vim_free(aucmd_win->w_localdir);
aucmd_win->w_localdir = NULL;
/* Make sure w_localdir and globaldir are NULL to avoid a chdir() in
* win_enter_ext(). */
aucmd_win->w_localdir = NULL;
aco->globaldir = globaldir;
globaldir = NULL;
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
/* Split the current window, put the aucmd_win in the upper half. /* Split the current window, put the aucmd_win in the upper half.
@@ -8472,7 +8488,7 @@ aucmd_restbuf(aco)
int dummy; int dummy;
#endif #endif
if (aco->new_curwin == aucmd_win) if (aco->use_aucmd_win)
{ {
--curbuf->b_nwindows; --curbuf->b_nwindows;
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
@@ -8499,6 +8515,7 @@ aucmd_restbuf(aco)
/* Remove the window and frame from the tree of frames. */ /* Remove the window and frame from the tree of frames. */
(void)winframe_remove(curwin, &dummy, NULL); (void)winframe_remove(curwin, &dummy, NULL);
win_remove(curwin, NULL); win_remove(curwin, NULL);
aucmd_win_used = FALSE;
last_status(FALSE); /* may need to remove last status line */ last_status(FALSE); /* may need to remove last status line */
restore_snapshot(SNAP_AUCMD_IDX, FALSE); restore_snapshot(SNAP_AUCMD_IDX, FALSE);
(void)win_comp_pos(); /* recompute window positions */ (void)win_comp_pos(); /* recompute window positions */
@@ -8517,6 +8534,9 @@ aucmd_restbuf(aco)
#endif #endif
curbuf = curwin->w_buffer; curbuf = curwin->w_buffer;
vim_free(globaldir);
globaldir = aco->globaldir;
/* the buffer contents may have changed */ /* the buffer contents may have changed */
check_cursor(); check_cursor();
if (curwin->w_topline > curbuf->b_ml.ml_line_count) if (curwin->w_topline > curbuf->b_ml.ml_line_count)
@@ -8541,7 +8561,7 @@ aucmd_restbuf(aco)
#endif #endif
{ {
/* Restore the buffer which was previously edited by curwin, if /* Restore the buffer which was previously edited by curwin, if
* it was chagned, we are still the same window and the buffer is * it was changed, we are still the same window and the buffer is
* valid. */ * valid. */
if (curwin == aco->new_curwin if (curwin == aco->new_curwin
&& curbuf != aco->new_curbuf && curbuf != aco->new_curbuf

View File

@@ -541,6 +541,7 @@ EXTERN win_T *curwin; /* currently active window */
#ifdef FEAT_AUTOCMD #ifdef FEAT_AUTOCMD
EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */ EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */
EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */
#endif #endif
/* /*

View File

@@ -2288,9 +2288,11 @@ typedef struct
{ {
buf_T *save_curbuf; /* saved curbuf */ buf_T *save_curbuf; /* saved curbuf */
#ifdef FEAT_AUTOCMD #ifdef FEAT_AUTOCMD
int use_aucmd_win; /* using aucmd_win */
win_T *save_curwin; /* saved curwin */ win_T *save_curwin; /* saved curwin */
win_T *new_curwin; /* new curwin */ win_T *new_curwin; /* new curwin */
buf_T *new_curbuf; /* new curbuf */ buf_T *new_curbuf; /* new curbuf */
char_u *globaldir; /* saved value of globaldir */
#endif #endif
} aco_save_T; } aco_save_T;

View File

@@ -676,6 +676,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
241,
/**/ /**/
240, 240,
/**/ /**/