Karsten Hopp 6dde40
To: vim_dev@googlegroups.com
Karsten Hopp 6dde40
Subject: Patch 7.3.449
Karsten Hopp 6dde40
Fcc: outbox
Karsten Hopp 6dde40
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 6dde40
Mime-Version: 1.0
Karsten Hopp 6dde40
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 6dde40
Content-Transfer-Encoding: 8bit
Karsten Hopp 6dde40
------------
Karsten Hopp 6dde40
Karsten Hopp 6dde40
Patch 7.3.449
Karsten Hopp 6dde40
Problem:    Crash when a BufWinLeave autocommand closes the only other window.
Karsten Hopp 6dde40
	    (Daniel Hunt)
Karsten Hopp 6dde40
Solution:   Abort closing a buffer when it becomes the only one.
Karsten Hopp 6dde40
Files:	    src/buffer.c, src/proto/buffer.pro, src/ex_cmds.c, src/ex_getln.c,
Karsten Hopp 6dde40
	    src/misc2.c, src/quickfix.c, src/window.c, src/proto/window.pro
Karsten Hopp 6dde40
Karsten Hopp 6dde40
Karsten Hopp 6dde40
*** ../vim-7.3.448/src/buffer.c	2012-01-20 20:44:38.000000000 +0100
Karsten Hopp 6dde40
--- src/buffer.c	2012-02-22 14:50:42.000000000 +0100
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 64,69 ****
Karsten Hopp 6dde40
--- 64,72 ----
Karsten Hopp 6dde40
  static char *msg_loclist = N_("[Location List]");
Karsten Hopp 6dde40
  static char *msg_qflist = N_("[Quickfix List]");
Karsten Hopp 6dde40
  #endif
Karsten Hopp 6dde40
+ #ifdef FEAT_AUTOCMD
Karsten Hopp 6dde40
+ static char *e_auabort = N_("E855: Autocommands caused command to abort");
Karsten Hopp 6dde40
+ #endif
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
  /*
Karsten Hopp 6dde40
   * Open current buffer, that is: open the memfile and read the file into
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 96,102 ****
Karsten Hopp 6dde40
  	 * There MUST be a memfile, otherwise we can't do anything
Karsten Hopp 6dde40
  	 * If we can't create one for the current buffer, take another buffer
Karsten Hopp 6dde40
  	 */
Karsten Hopp 6dde40
! 	close_buffer(NULL, curbuf, 0);
Karsten Hopp 6dde40
  	for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next)
Karsten Hopp 6dde40
  	    if (curbuf->b_ml.ml_mfp != NULL)
Karsten Hopp 6dde40
  		break;
Karsten Hopp 6dde40
--- 99,105 ----
Karsten Hopp 6dde40
  	 * There MUST be a memfile, otherwise we can't do anything
Karsten Hopp 6dde40
  	 * If we can't create one for the current buffer, take another buffer
Karsten Hopp 6dde40
  	 */
Karsten Hopp 6dde40
! 	close_buffer(NULL, curbuf, 0, FALSE);
Karsten Hopp 6dde40
  	for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next)
Karsten Hopp 6dde40
  	    if (curbuf->b_ml.ml_mfp != NULL)
Karsten Hopp 6dde40
  		break;
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 316,327 ****
Karsten Hopp 6dde40
   * get a new buffer very soon!
Karsten Hopp 6dde40
   *
Karsten Hopp 6dde40
   * The 'bufhidden' option can force freeing and deleting.
Karsten Hopp 6dde40
   */
Karsten Hopp 6dde40
      void
Karsten Hopp 6dde40
! close_buffer(win, buf, action)
Karsten Hopp 6dde40
      win_T	*win;		/* if not NULL, set b_last_cursor */
Karsten Hopp 6dde40
      buf_T	*buf;
Karsten Hopp 6dde40
      int		action;
Karsten Hopp 6dde40
  {
Karsten Hopp 6dde40
  #ifdef FEAT_AUTOCMD
Karsten Hopp 6dde40
      int		is_curbuf;
Karsten Hopp 6dde40
--- 319,335 ----
Karsten Hopp 6dde40
   * get a new buffer very soon!
Karsten Hopp 6dde40
   *
Karsten Hopp 6dde40
   * The 'bufhidden' option can force freeing and deleting.
Karsten Hopp 6dde40
+  *
Karsten Hopp 6dde40
+  * When "abort_if_last" is TRUE then do not close the buffer if autocommands
Karsten Hopp 6dde40
+  * cause there to be only one window with this buffer.  e.g. when ":quit" is
Karsten Hopp 6dde40
+  * supposed to close the window but autocommands close all other windows.
Karsten Hopp 6dde40
   */
Karsten Hopp 6dde40
      void
Karsten Hopp 6dde40
! close_buffer(win, buf, action, abort_if_last)
Karsten Hopp 6dde40
      win_T	*win;		/* if not NULL, set b_last_cursor */
Karsten Hopp 6dde40
      buf_T	*buf;
Karsten Hopp 6dde40
      int		action;
Karsten Hopp 6dde40
+     int		abort_if_last;
Karsten Hopp 6dde40
  {
Karsten Hopp 6dde40
  #ifdef FEAT_AUTOCMD
Karsten Hopp 6dde40
      int		is_curbuf;
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 371,378 ****
Karsten Hopp 6dde40
      {
Karsten Hopp 6dde40
  	apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname,
Karsten Hopp 6dde40
  								  FALSE, buf);
Karsten Hopp 6dde40
! 	if (!buf_valid(buf))	    /* autocommands may delete the buffer */
Karsten Hopp 6dde40
  	    return;
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
  	/* When the buffer becomes hidden, but is not unloaded, trigger
Karsten Hopp 6dde40
  	 * BufHidden */
Karsten Hopp 6dde40
--- 379,390 ----
Karsten Hopp 6dde40
      {
Karsten Hopp 6dde40
  	apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname,
Karsten Hopp 6dde40
  								  FALSE, buf);
Karsten Hopp 6dde40
! 	/* Return if autocommands deleted the buffer or made it the only one. */
Karsten Hopp 6dde40
! 	if (!buf_valid(buf) || (abort_if_last && one_window()))
Karsten Hopp 6dde40
! 	{
Karsten Hopp 6dde40
! 	    EMSG(_(e_auabort));
Karsten Hopp 6dde40
  	    return;
Karsten Hopp 6dde40
+ 	}
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
  	/* When the buffer becomes hidden, but is not unloaded, trigger
Karsten Hopp 6dde40
  	 * BufHidden */
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 380,387 ****
Karsten Hopp 6dde40
  	{
Karsten Hopp 6dde40
  	    apply_autocmds(EVENT_BUFHIDDEN, buf->b_fname, buf->b_fname,
Karsten Hopp 6dde40
  								  FALSE, buf);
Karsten Hopp 6dde40
! 	    if (!buf_valid(buf))	/* autocmds may delete the buffer */
Karsten Hopp 6dde40
  		return;
Karsten Hopp 6dde40
  	}
Karsten Hopp 6dde40
  # ifdef FEAT_EVAL
Karsten Hopp 6dde40
  	if (aborting())	    /* autocmds may abort script processing */
Karsten Hopp 6dde40
--- 392,404 ----
Karsten Hopp 6dde40
  	{
Karsten Hopp 6dde40
  	    apply_autocmds(EVENT_BUFHIDDEN, buf->b_fname, buf->b_fname,
Karsten Hopp 6dde40
  								  FALSE, buf);
Karsten Hopp 6dde40
! 	    /* Return if autocommands deleted the buffer or made it the only
Karsten Hopp 6dde40
! 	     * one. */
Karsten Hopp 6dde40
! 	    if (!buf_valid(buf) || (abort_if_last && one_window()))
Karsten Hopp 6dde40
! 	    {
Karsten Hopp 6dde40
! 		EMSG(_(e_auabort));
Karsten Hopp 6dde40
  		return;
Karsten Hopp 6dde40
+ 	    }
Karsten Hopp 6dde40
  	}
Karsten Hopp 6dde40
  # ifdef FEAT_EVAL
Karsten Hopp 6dde40
  	if (aborting())	    /* autocmds may abort script processing */
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 775,781 ****
Karsten Hopp 6dde40
  	 * open a new, empty buffer. */
Karsten Hopp 6dde40
  	swap_exists_action = SEA_NONE;	/* don't want it again */
Karsten Hopp 6dde40
  	swap_exists_did_quit = TRUE;
Karsten Hopp 6dde40
! 	close_buffer(curwin, curbuf, DOBUF_UNLOAD);
Karsten Hopp 6dde40
  	if (!buf_valid(old_curbuf) || old_curbuf == curbuf)
Karsten Hopp 6dde40
  	    old_curbuf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED);
Karsten Hopp 6dde40
  	if (old_curbuf != NULL)
Karsten Hopp 6dde40
--- 792,798 ----
Karsten Hopp 6dde40
  	 * open a new, empty buffer. */
Karsten Hopp 6dde40
  	swap_exists_action = SEA_NONE;	/* don't want it again */
Karsten Hopp 6dde40
  	swap_exists_did_quit = TRUE;
Karsten Hopp 6dde40
! 	close_buffer(curwin, curbuf, DOBUF_UNLOAD, FALSE);
Karsten Hopp 6dde40
  	if (!buf_valid(old_curbuf) || old_curbuf == curbuf)
Karsten Hopp 6dde40
  	    old_curbuf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED);
Karsten Hopp 6dde40
  	if (old_curbuf != NULL)
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 1122,1128 ****
Karsten Hopp 6dde40
  	     * if the buffer still exists.
Karsten Hopp 6dde40
  	     */
Karsten Hopp 6dde40
  	    if (buf != curbuf && buf_valid(buf) && buf->b_nwindows == 0)
Karsten Hopp 6dde40
! 		close_buffer(NULL, buf, action);
Karsten Hopp 6dde40
  	    return retval;
Karsten Hopp 6dde40
  	}
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
--- 1139,1145 ----
Karsten Hopp 6dde40
  	     * if the buffer still exists.
Karsten Hopp 6dde40
  	     */
Karsten Hopp 6dde40
  	    if (buf != curbuf && buf_valid(buf) && buf->b_nwindows == 0)
Karsten Hopp 6dde40
! 		close_buffer(NULL, buf, action, FALSE);
Karsten Hopp 6dde40
  	    return retval;
Karsten Hopp 6dde40
  	}
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 1146,1152 ****
Karsten Hopp 6dde40
  	    close_windows(buf, FALSE);
Karsten Hopp 6dde40
  #endif
Karsten Hopp 6dde40
  	    if (buf != curbuf && buf_valid(buf) && buf->b_nwindows <= 0)
Karsten Hopp 6dde40
! 		close_buffer(NULL, buf, action);
Karsten Hopp 6dde40
  	    return OK;
Karsten Hopp 6dde40
  	}
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
--- 1163,1169 ----
Karsten Hopp 6dde40
  	    close_windows(buf, FALSE);
Karsten Hopp 6dde40
  #endif
Karsten Hopp 6dde40
  	    if (buf != curbuf && buf_valid(buf) && buf->b_nwindows <= 0)
Karsten Hopp 6dde40
! 		close_buffer(NULL, buf, action, FALSE);
Karsten Hopp 6dde40
  	    return OK;
Karsten Hopp 6dde40
  	}
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 1378,1384 ****
Karsten Hopp 6dde40
  	    close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, prevbuf,
Karsten Hopp 6dde40
  		    unload ? action : (action == DOBUF_GOTO
Karsten Hopp 6dde40
  			&& !P_HID(prevbuf)
Karsten Hopp 6dde40
! 			&& !bufIsChanged(prevbuf)) ? DOBUF_UNLOAD : 0);
Karsten Hopp 6dde40
  	}
Karsten Hopp 6dde40
      }
Karsten Hopp 6dde40
  #ifdef FEAT_AUTOCMD
Karsten Hopp 6dde40
--- 1395,1401 ----
Karsten Hopp 6dde40
  	    close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, prevbuf,
Karsten Hopp 6dde40
  		    unload ? action : (action == DOBUF_GOTO
Karsten Hopp 6dde40
  			&& !P_HID(prevbuf)
Karsten Hopp 6dde40
! 			&& !bufIsChanged(prevbuf)) ? DOBUF_UNLOAD : 0, FALSE);
Karsten Hopp 6dde40
  	}
Karsten Hopp 6dde40
      }
Karsten Hopp 6dde40
  #ifdef FEAT_AUTOCMD
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 2708,2714 ****
Karsten Hopp 6dde40
  		vim_free(ffname);
Karsten Hopp 6dde40
  		return FAIL;
Karsten Hopp 6dde40
  	    }
Karsten Hopp 6dde40
! 	    close_buffer(NULL, obuf, DOBUF_WIPE); /* delete from the list */
Karsten Hopp 6dde40
  	}
Karsten Hopp 6dde40
  	sfname = vim_strsave(sfname);
Karsten Hopp 6dde40
  	if (ffname == NULL || sfname == NULL)
Karsten Hopp 6dde40
--- 2725,2732 ----
Karsten Hopp 6dde40
  		vim_free(ffname);
Karsten Hopp 6dde40
  		return FAIL;
Karsten Hopp 6dde40
  	    }
Karsten Hopp 6dde40
! 	    /* delete from the list */
Karsten Hopp 6dde40
! 	    close_buffer(NULL, obuf, DOBUF_WIPE, FALSE);
Karsten Hopp 6dde40
  	}
Karsten Hopp 6dde40
  	sfname = vim_strsave(sfname);
Karsten Hopp 6dde40
  	if (ffname == NULL || sfname == NULL)
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 5638,5644 ****
Karsten Hopp 6dde40
      if (!aucmd)		    /* Don't trigger BufDelete autocommands here. */
Karsten Hopp 6dde40
  	block_autocmds();
Karsten Hopp 6dde40
  #endif
Karsten Hopp 6dde40
!     close_buffer(NULL, buf, DOBUF_WIPE);
Karsten Hopp 6dde40
  #ifdef FEAT_AUTOCMD
Karsten Hopp 6dde40
      if (!aucmd)
Karsten Hopp 6dde40
  	unblock_autocmds();
Karsten Hopp 6dde40
--- 5656,5662 ----
Karsten Hopp 6dde40
      if (!aucmd)		    /* Don't trigger BufDelete autocommands here. */
Karsten Hopp 6dde40
  	block_autocmds();
Karsten Hopp 6dde40
  #endif
Karsten Hopp 6dde40
!     close_buffer(NULL, buf, DOBUF_WIPE, FALSE);
Karsten Hopp 6dde40
  #ifdef FEAT_AUTOCMD
Karsten Hopp 6dde40
      if (!aucmd)
Karsten Hopp 6dde40
  	unblock_autocmds();
Karsten Hopp 6dde40
*** ../vim-7.3.448/src/proto/buffer.pro	2010-08-15 21:57:28.000000000 +0200
Karsten Hopp 6dde40
--- src/proto/buffer.pro	2012-02-22 14:04:26.000000000 +0100
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 1,7 ****
Karsten Hopp 6dde40
  /* buffer.c */
Karsten Hopp 6dde40
  int open_buffer __ARGS((int read_stdin, exarg_T *eap, int flags));
Karsten Hopp 6dde40
  int buf_valid __ARGS((buf_T *buf));
Karsten Hopp 6dde40
! void close_buffer __ARGS((win_T *win, buf_T *buf, int action));
Karsten Hopp 6dde40
  void buf_clear_file __ARGS((buf_T *buf));
Karsten Hopp 6dde40
  void buf_freeall __ARGS((buf_T *buf, int flags));
Karsten Hopp 6dde40
  void goto_buffer __ARGS((exarg_T *eap, int start, int dir, int count));
Karsten Hopp 6dde40
--- 1,7 ----
Karsten Hopp 6dde40
  /* buffer.c */
Karsten Hopp 6dde40
  int open_buffer __ARGS((int read_stdin, exarg_T *eap, int flags));
Karsten Hopp 6dde40
  int buf_valid __ARGS((buf_T *buf));
Karsten Hopp 6dde40
! void close_buffer __ARGS((win_T *win, buf_T *buf, int action, int abort_if_last));
Karsten Hopp 6dde40
  void buf_clear_file __ARGS((buf_T *buf));
Karsten Hopp 6dde40
  void buf_freeall __ARGS((buf_T *buf, int flags));
Karsten Hopp 6dde40
  void goto_buffer __ARGS((exarg_T *eap, int start, int dir, int count));
Karsten Hopp 6dde40
*** ../vim-7.3.448/src/ex_cmds.c	2011-12-30 15:01:55.000000000 +0100
Karsten Hopp 6dde40
--- src/ex_cmds.c	2012-02-22 14:00:32.000000000 +0100
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 3387,3393 ****
Karsten Hopp 6dde40
  		/* close the link to the current buffer */
Karsten Hopp 6dde40
  		u_sync(FALSE);
Karsten Hopp 6dde40
  		close_buffer(oldwin, curbuf,
Karsten Hopp 6dde40
! 				      (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD);
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
  #ifdef FEAT_AUTOCMD
Karsten Hopp 6dde40
  		/* Autocommands may open a new window and leave oldwin open
Karsten Hopp 6dde40
--- 3387,3393 ----
Karsten Hopp 6dde40
  		/* close the link to the current buffer */
Karsten Hopp 6dde40
  		u_sync(FALSE);
Karsten Hopp 6dde40
  		close_buffer(oldwin, curbuf,
Karsten Hopp 6dde40
! 			       (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE);
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
  #ifdef FEAT_AUTOCMD
Karsten Hopp 6dde40
  		/* Autocommands may open a new window and leave oldwin open
Karsten Hopp 6dde40
*** ../vim-7.3.448/src/ex_getln.c	2012-02-04 22:44:27.000000000 +0100
Karsten Hopp 6dde40
--- src/ex_getln.c	2012-02-22 14:01:56.000000000 +0100
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 6443,6449 ****
Karsten Hopp 6dde40
  	/* win_close() may have already wiped the buffer when 'bh' is
Karsten Hopp 6dde40
  	 * set to 'wipe' */
Karsten Hopp 6dde40
  	if (buf_valid(bp))
Karsten Hopp 6dde40
! 	    close_buffer(NULL, bp, DOBUF_WIPE);
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
  	/* Restore window sizes. */
Karsten Hopp 6dde40
  	win_size_restore(&winsizes);
Karsten Hopp 6dde40
--- 6443,6449 ----
Karsten Hopp 6dde40
  	/* win_close() may have already wiped the buffer when 'bh' is
Karsten Hopp 6dde40
  	 * set to 'wipe' */
Karsten Hopp 6dde40
  	if (buf_valid(bp))
Karsten Hopp 6dde40
! 	    close_buffer(NULL, bp, DOBUF_WIPE, FALSE);
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
  	/* Restore window sizes. */
Karsten Hopp 6dde40
  	win_size_restore(&winsizes);
Karsten Hopp 6dde40
*** ../vim-7.3.448/src/misc2.c	2012-02-20 22:18:22.000000000 +0100
Karsten Hopp 6dde40
--- src/misc2.c	2012-02-22 14:02:12.000000000 +0100
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 1173,1179 ****
Karsten Hopp 6dde40
      for (buf = firstbuf; buf != NULL; )
Karsten Hopp 6dde40
      {
Karsten Hopp 6dde40
  	nextbuf = buf->b_next;
Karsten Hopp 6dde40
! 	close_buffer(NULL, buf, DOBUF_WIPE);
Karsten Hopp 6dde40
  	if (buf_valid(buf))
Karsten Hopp 6dde40
  	    buf = nextbuf;	/* didn't work, try next one */
Karsten Hopp 6dde40
  	else
Karsten Hopp 6dde40
--- 1173,1179 ----
Karsten Hopp 6dde40
      for (buf = firstbuf; buf != NULL; )
Karsten Hopp 6dde40
      {
Karsten Hopp 6dde40
  	nextbuf = buf->b_next;
Karsten Hopp 6dde40
! 	close_buffer(NULL, buf, DOBUF_WIPE, FALSE);
Karsten Hopp 6dde40
  	if (buf_valid(buf))
Karsten Hopp 6dde40
  	    buf = nextbuf;	/* didn't work, try next one */
Karsten Hopp 6dde40
  	else
Karsten Hopp 6dde40
*** ../vim-7.3.448/src/quickfix.c	2012-01-20 13:39:03.000000000 +0100
Karsten Hopp 6dde40
--- src/quickfix.c	2012-02-22 14:02:20.000000000 +0100
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 3565,3571 ****
Karsten Hopp 6dde40
      buf_T	*buf;
Karsten Hopp 6dde40
  {
Karsten Hopp 6dde40
      if (curbuf != buf)		/* safety check */
Karsten Hopp 6dde40
! 	close_buffer(NULL, buf, DOBUF_UNLOAD);
Karsten Hopp 6dde40
  }
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
  #if defined(FEAT_EVAL) || defined(PROTO)
Karsten Hopp 6dde40
--- 3565,3571 ----
Karsten Hopp 6dde40
      buf_T	*buf;
Karsten Hopp 6dde40
  {
Karsten Hopp 6dde40
      if (curbuf != buf)		/* safety check */
Karsten Hopp 6dde40
! 	close_buffer(NULL, buf, DOBUF_UNLOAD, FALSE);
Karsten Hopp 6dde40
  }
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
  #if defined(FEAT_EVAL) || defined(PROTO)
Karsten Hopp 6dde40
*** ../vim-7.3.448/src/window.c	2012-01-10 22:26:12.000000000 +0100
Karsten Hopp 6dde40
--- src/window.c	2012-02-22 14:08:13.000000000 +0100
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 23,29 ****
Karsten Hopp 6dde40
  static void win_totop __ARGS((int size, int flags));
Karsten Hopp 6dde40
  static void win_equal_rec __ARGS((win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height));
Karsten Hopp 6dde40
  static int last_window __ARGS((void));
Karsten Hopp 6dde40
- static int one_window __ARGS((void));
Karsten Hopp 6dde40
  static win_T *win_free_mem __ARGS((win_T *win, int *dirp, tabpage_T *tp));
Karsten Hopp 6dde40
  static frame_T *win_altframe __ARGS((win_T *win, tabpage_T *tp));
Karsten Hopp 6dde40
  static tabpage_T *alt_tabpage __ARGS((void));
Karsten Hopp 6dde40
--- 23,28 ----
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 2083,2089 ****
Karsten Hopp 6dde40
   * Return TRUE if there is only one window other than "aucmd_win" in the
Karsten Hopp 6dde40
   * current tab page.
Karsten Hopp 6dde40
   */
Karsten Hopp 6dde40
!     static int
Karsten Hopp 6dde40
  one_window()
Karsten Hopp 6dde40
  {
Karsten Hopp 6dde40
  #ifdef FEAT_AUTOCMD
Karsten Hopp 6dde40
--- 2082,2088 ----
Karsten Hopp 6dde40
   * Return TRUE if there is only one window other than "aucmd_win" in the
Karsten Hopp 6dde40
   * current tab page.
Karsten Hopp 6dde40
   */
Karsten Hopp 6dde40
!     int
Karsten Hopp 6dde40
  one_window()
Karsten Hopp 6dde40
  {
Karsten Hopp 6dde40
  #ifdef FEAT_AUTOCMD
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 2109,2115 ****
Karsten Hopp 6dde40
   * Close window "win".  Only works for the current tab page.
Karsten Hopp 6dde40
   * If "free_buf" is TRUE related buffer may be unloaded.
Karsten Hopp 6dde40
   *
Karsten Hopp 6dde40
!  * called by :quit, :close, :xit, :wq and findtag()
Karsten Hopp 6dde40
   */
Karsten Hopp 6dde40
      void
Karsten Hopp 6dde40
  win_close(win, free_buf)
Karsten Hopp 6dde40
--- 2108,2114 ----
Karsten Hopp 6dde40
   * Close window "win".  Only works for the current tab page.
Karsten Hopp 6dde40
   * If "free_buf" is TRUE related buffer may be unloaded.
Karsten Hopp 6dde40
   *
Karsten Hopp 6dde40
!  * Called by :quit, :close, :xit, :wq and findtag().
Karsten Hopp 6dde40
   */
Karsten Hopp 6dde40
      void
Karsten Hopp 6dde40
  win_close(win, free_buf)
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 2222,2228 ****
Karsten Hopp 6dde40
       * Close the link to the buffer.
Karsten Hopp 6dde40
       */
Karsten Hopp 6dde40
      if (win->w_buffer != NULL)
Karsten Hopp 6dde40
! 	close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0);
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
      /* Autocommands may have closed the window already, or closed the only
Karsten Hopp 6dde40
       * other window or moved to another tab page. */
Karsten Hopp 6dde40
--- 2221,2227 ----
Karsten Hopp 6dde40
       * Close the link to the buffer.
Karsten Hopp 6dde40
       */
Karsten Hopp 6dde40
      if (win->w_buffer != NULL)
Karsten Hopp 6dde40
! 	close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, TRUE);
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
      /* Autocommands may have closed the window already, or closed the only
Karsten Hopp 6dde40
       * other window or moved to another tab page. */
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 2328,2334 ****
Karsten Hopp 6dde40
      int		free_tp = FALSE;
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
      /* Close the link to the buffer. */
Karsten Hopp 6dde40
!     close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0);
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
      /* Careful: Autocommands may have closed the tab page or made it the
Karsten Hopp 6dde40
       * current tab page.  */
Karsten Hopp 6dde40
--- 2327,2333 ----
Karsten Hopp 6dde40
      int		free_tp = FALSE;
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
      /* Close the link to the buffer. */
Karsten Hopp 6dde40
!     close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, FALSE);
Karsten Hopp 6dde40
  
Karsten Hopp 6dde40
      /* Careful: Autocommands may have closed the tab page or made it the
Karsten Hopp 6dde40
       * current tab page.  */
Karsten Hopp 6dde40
*** ../vim-7.3.448/src/proto/window.pro	2010-08-15 21:57:28.000000000 +0200
Karsten Hopp 6dde40
--- src/proto/window.pro	2012-02-22 14:08:28.000000000 +0100
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 1,13 ****
Karsten Hopp 6dde40
  /* window.c */
Karsten Hopp 6dde40
  void do_window __ARGS((int nchar, long Prenum, int xchar));
Karsten Hopp 6dde40
  int win_split __ARGS((int size, int flags));
Karsten Hopp 6dde40
! int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
Karsten Hopp 6dde40
  int win_valid __ARGS((win_T *win));
Karsten Hopp 6dde40
  int win_count __ARGS((void));
Karsten Hopp 6dde40
  int make_windows __ARGS((int count, int vertical));
Karsten Hopp 6dde40
  void win_move_after __ARGS((win_T *win1, win_T *win2));
Karsten Hopp 6dde40
  void win_equal __ARGS((win_T *next_curwin, int current, int dir));
Karsten Hopp 6dde40
  void close_windows __ARGS((buf_T *buf, int keep_curwin));
Karsten Hopp 6dde40
  void win_close __ARGS((win_T *win, int free_buf));
Karsten Hopp 6dde40
  void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp));
Karsten Hopp 6dde40
  void win_free_all __ARGS((void));
Karsten Hopp 6dde40
--- 1,14 ----
Karsten Hopp 6dde40
  /* window.c */
Karsten Hopp 6dde40
  void do_window __ARGS((int nchar, long Prenum, int xchar));
Karsten Hopp 6dde40
  int win_split __ARGS((int size, int flags));
Karsten Hopp 6dde40
! int win_split_ins __ARGS((int size, int flags, win_T *new_wp, int dir));
Karsten Hopp 6dde40
  int win_valid __ARGS((win_T *win));
Karsten Hopp 6dde40
  int win_count __ARGS((void));
Karsten Hopp 6dde40
  int make_windows __ARGS((int count, int vertical));
Karsten Hopp 6dde40
  void win_move_after __ARGS((win_T *win1, win_T *win2));
Karsten Hopp 6dde40
  void win_equal __ARGS((win_T *next_curwin, int current, int dir));
Karsten Hopp 6dde40
  void close_windows __ARGS((buf_T *buf, int keep_curwin));
Karsten Hopp 6dde40
+ int one_window __ARGS((void));
Karsten Hopp 6dde40
  void win_close __ARGS((win_T *win, int free_buf));
Karsten Hopp 6dde40
  void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp));
Karsten Hopp 6dde40
  void win_free_all __ARGS((void));
Karsten Hopp 6dde40
*** ../vim-7.3.448/src/version.c	2012-02-22 13:07:02.000000000 +0100
Karsten Hopp 6dde40
--- src/version.c	2012-02-22 14:55:21.000000000 +0100
Karsten Hopp 6dde40
***************
Karsten Hopp 6dde40
*** 716,717 ****
Karsten Hopp 6dde40
--- 716,719 ----
Karsten Hopp 6dde40
  {   /* Add new patch number below this line */
Karsten Hopp 6dde40
+ /**/
Karsten Hopp 6dde40
+     449,
Karsten Hopp 6dde40
  /**/
Karsten Hopp 6dde40
Karsten Hopp 6dde40
-- 
Karsten Hopp 6dde40
From "know your smileys":
Karsten Hopp 6dde40
 :-)-O	Smiling doctor with stethoscope
Karsten Hopp 6dde40
Karsten Hopp 6dde40
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 6dde40
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 6dde40
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 6dde40
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///