Karsten Hopp 03da20
To: vim-dev@vim.org
Karsten Hopp 03da20
Subject: Patch 7.2.120
Karsten Hopp 03da20
Fcc: outbox
Karsten Hopp 03da20
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 03da20
Mime-Version: 1.0
Karsten Hopp 03da20
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 03da20
Content-Transfer-Encoding: 8bit
Karsten Hopp 03da20
------------
Karsten Hopp 03da20
Karsten Hopp 03da20
Patch 7.2.120
Karsten Hopp 03da20
Problem:    When opening the quickfix window or splitting the window and
Karsten Hopp 03da20
            setting the location list, the location list is copied and then
Karsten Hopp 03da20
            deleted, which is inefficient.
Karsten Hopp 03da20
Solution:   Don't copy the location list when not needed. (Lech Lorens)
Karsten Hopp 03da20
Files:      src/quickfix.c, src/vim.h, src/window.c
Karsten Hopp 03da20
Karsten Hopp 03da20
Karsten Hopp 03da20
*** ../vim-7.2.119/src/quickfix.c	Sun Feb 22 00:01:42 2009
Karsten Hopp 03da20
--- src/quickfix.c	Sat Feb 21 22:54:25 2009
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 1419,1424 ****
Karsten Hopp 03da20
--- 1419,1425 ----
Karsten Hopp 03da20
      int			opened_window = FALSE;
Karsten Hopp 03da20
      win_T		*win;
Karsten Hopp 03da20
      win_T		*altwin;
Karsten Hopp 03da20
+     int			flags;
Karsten Hopp 03da20
  #endif
Karsten Hopp 03da20
      win_T		*oldwin = curwin;
Karsten Hopp 03da20
      int			print_message = TRUE;
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 1531,1537 ****
Karsten Hopp 03da20
      if (qf_ptr->qf_type == 1 && (!curwin->w_buffer->b_help || cmdmod.tab != 0))
Karsten Hopp 03da20
      {
Karsten Hopp 03da20
  	win_T	*wp;
Karsten Hopp 03da20
- 	int	n;
Karsten Hopp 03da20
  
Karsten Hopp 03da20
  	if (cmdmod.tab != 0)
Karsten Hopp 03da20
  	    wp = NULL;
Karsten Hopp 03da20
--- 1532,1537 ----
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 1547,1559 ****
Karsten Hopp 03da20
  	     * Split off help window; put it at far top if no position
Karsten Hopp 03da20
  	     * specified, the current window is vertically split and narrow.
Karsten Hopp 03da20
  	     */
Karsten Hopp 03da20
! 	    n = WSP_HELP;
Karsten Hopp 03da20
  # ifdef FEAT_VERTSPLIT
Karsten Hopp 03da20
  	    if (cmdmod.split == 0 && curwin->w_width != Columns
Karsten Hopp 03da20
  						      && curwin->w_width < 80)
Karsten Hopp 03da20
! 		n |= WSP_TOP;
Karsten Hopp 03da20
  # endif
Karsten Hopp 03da20
! 	    if (win_split(0, n) == FAIL)
Karsten Hopp 03da20
  		goto theend;
Karsten Hopp 03da20
  	    opened_window = TRUE;	/* close it when fail */
Karsten Hopp 03da20
  
Karsten Hopp 03da20
--- 1547,1562 ----
Karsten Hopp 03da20
  	     * Split off help window; put it at far top if no position
Karsten Hopp 03da20
  	     * specified, the current window is vertically split and narrow.
Karsten Hopp 03da20
  	     */
Karsten Hopp 03da20
! 	    flags = WSP_HELP;
Karsten Hopp 03da20
  # ifdef FEAT_VERTSPLIT
Karsten Hopp 03da20
  	    if (cmdmod.split == 0 && curwin->w_width != Columns
Karsten Hopp 03da20
  						      && curwin->w_width < 80)
Karsten Hopp 03da20
! 		flags |= WSP_TOP;
Karsten Hopp 03da20
  # endif
Karsten Hopp 03da20
! 	    if (qi != &ql_info)
Karsten Hopp 03da20
! 		flags |= WSP_NEWLOC;  /* don't copy the location list */
Karsten Hopp 03da20
! 
Karsten Hopp 03da20
! 	    if (win_split(0, flags) == FAIL)
Karsten Hopp 03da20
  		goto theend;
Karsten Hopp 03da20
  	    opened_window = TRUE;	/* close it when fail */
Karsten Hopp 03da20
  
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 1563,1569 ****
Karsten Hopp 03da20
  	    if (qi != &ql_info)	    /* not a quickfix list */
Karsten Hopp 03da20
  	    {
Karsten Hopp 03da20
  		/* The new window should use the supplied location list */
Karsten Hopp 03da20
- 		qf_free_all(curwin);
Karsten Hopp 03da20
  		curwin->w_llist = qi;
Karsten Hopp 03da20
  		qi->qf_refcount++;
Karsten Hopp 03da20
  	    }
Karsten Hopp 03da20
--- 1566,1571 ----
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 1624,1630 ****
Karsten Hopp 03da20
  	{
Karsten Hopp 03da20
  	    ll_ref = curwin->w_llist_ref;
Karsten Hopp 03da20
  
Karsten Hopp 03da20
! 	    if (win_split(0, WSP_ABOVE) == FAIL)
Karsten Hopp 03da20
  		goto failed;		/* not enough room for window */
Karsten Hopp 03da20
  	    opened_window = TRUE;	/* close it when fail */
Karsten Hopp 03da20
  	    p_swb = empty_option;	/* don't split again */
Karsten Hopp 03da20
--- 1626,1635 ----
Karsten Hopp 03da20
  	{
Karsten Hopp 03da20
  	    ll_ref = curwin->w_llist_ref;
Karsten Hopp 03da20
  
Karsten Hopp 03da20
! 	    flags = WSP_ABOVE;
Karsten Hopp 03da20
! 	    if (ll_ref != NULL)
Karsten Hopp 03da20
! 		flags |= WSP_NEWLOC;
Karsten Hopp 03da20
! 	    if (win_split(0, flags) == FAIL)
Karsten Hopp 03da20
  		goto failed;		/* not enough room for window */
Karsten Hopp 03da20
  	    opened_window = TRUE;	/* close it when fail */
Karsten Hopp 03da20
  	    p_swb = empty_option;	/* don't split again */
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 1636,1642 ****
Karsten Hopp 03da20
  	    {
Karsten Hopp 03da20
  		/* The new window should use the location list from the
Karsten Hopp 03da20
  		 * location list window */
Karsten Hopp 03da20
- 		qf_free_all(curwin);
Karsten Hopp 03da20
  		curwin->w_llist = ll_ref;
Karsten Hopp 03da20
  		ll_ref->qf_refcount++;
Karsten Hopp 03da20
  	    }
Karsten Hopp 03da20
--- 1641,1646 ----
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 2311,2325 ****
Karsten Hopp 03da20
  	if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
Karsten Hopp 03da20
  	    /* Create the new window at the very bottom. */
Karsten Hopp 03da20
  	    win_goto(lastwin);
Karsten Hopp 03da20
! 	if (win_split(height, WSP_BELOW) == FAIL)
Karsten Hopp 03da20
  	    return;		/* not enough room for window */
Karsten Hopp 03da20
  #ifdef FEAT_SCROLLBIND
Karsten Hopp 03da20
  	curwin->w_p_scb = FALSE;
Karsten Hopp 03da20
  #endif
Karsten Hopp 03da20
  
Karsten Hopp 03da20
- 	/* Remove the location list for the quickfix window */
Karsten Hopp 03da20
- 	qf_free_all(curwin);
Karsten Hopp 03da20
- 
Karsten Hopp 03da20
  	if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
Karsten Hopp 03da20
  	{
Karsten Hopp 03da20
  	    /*
Karsten Hopp 03da20
--- 2315,2326 ----
Karsten Hopp 03da20
  	if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
Karsten Hopp 03da20
  	    /* Create the new window at the very bottom. */
Karsten Hopp 03da20
  	    win_goto(lastwin);
Karsten Hopp 03da20
! 	if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)
Karsten Hopp 03da20
  	    return;		/* not enough room for window */
Karsten Hopp 03da20
  #ifdef FEAT_SCROLLBIND
Karsten Hopp 03da20
  	curwin->w_p_scb = FALSE;
Karsten Hopp 03da20
  #endif
Karsten Hopp 03da20
  
Karsten Hopp 03da20
  	if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
Karsten Hopp 03da20
  	{
Karsten Hopp 03da20
  	    /*
Karsten Hopp 03da20
*** ../vim-7.2.119/src/vim.h	Thu Nov 20 14:11:47 2008
Karsten Hopp 03da20
--- src/vim.h	Sat Feb 21 22:53:03 2009
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 1057,1062 ****
Karsten Hopp 03da20
--- 1057,1063 ----
Karsten Hopp 03da20
  #define WSP_HELP	16	/* creating the help window */
Karsten Hopp 03da20
  #define WSP_BELOW	32	/* put new window below/right */
Karsten Hopp 03da20
  #define WSP_ABOVE	64	/* put new window above/left */
Karsten Hopp 03da20
+ #define WSP_NEWLOC	128	/* don't copy location list */
Karsten Hopp 03da20
  
Karsten Hopp 03da20
  /*
Karsten Hopp 03da20
   * arguments for gui_set_shellsize()
Karsten Hopp 03da20
*** ../vim-7.2.119/src/window.c	Sat Feb 21 20:27:00 2009
Karsten Hopp 03da20
--- src/window.c	Sat Feb 21 23:56:41 2009
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 12,18 ****
Karsten Hopp 03da20
  static int path_is_url __ARGS((char_u *p));
Karsten Hopp 03da20
  #if defined(FEAT_WINDOWS) || defined(PROTO)
Karsten Hopp 03da20
  static int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
Karsten Hopp 03da20
! static void win_init __ARGS((win_T *newp, win_T *oldp));
Karsten Hopp 03da20
  static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
Karsten Hopp 03da20
  static void frame_setheight __ARGS((frame_T *curfrp, int height));
Karsten Hopp 03da20
  #ifdef FEAT_VERTSPLIT
Karsten Hopp 03da20
--- 12,18 ----
Karsten Hopp 03da20
  static int path_is_url __ARGS((char_u *p));
Karsten Hopp 03da20
  #if defined(FEAT_WINDOWS) || defined(PROTO)
Karsten Hopp 03da20
  static int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
Karsten Hopp 03da20
! static void win_init __ARGS((win_T *newp, win_T *oldp, int flags));
Karsten Hopp 03da20
  static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
Karsten Hopp 03da20
  static void frame_setheight __ARGS((frame_T *curfrp, int height));
Karsten Hopp 03da20
  #ifdef FEAT_VERTSPLIT
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 911,917 ****
Karsten Hopp 03da20
  	    return FAIL;
Karsten Hopp 03da20
  
Karsten Hopp 03da20
  	/* make the contents of the new window the same as the current one */
Karsten Hopp 03da20
! 	win_init(wp, curwin);
Karsten Hopp 03da20
      }
Karsten Hopp 03da20
  
Karsten Hopp 03da20
      /*
Karsten Hopp 03da20
--- 911,917 ----
Karsten Hopp 03da20
  	    return FAIL;
Karsten Hopp 03da20
  
Karsten Hopp 03da20
  	/* make the contents of the new window the same as the current one */
Karsten Hopp 03da20
! 	win_init(wp, curwin, flags);
Karsten Hopp 03da20
      }
Karsten Hopp 03da20
  
Karsten Hopp 03da20
      /*
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 1160,1170 ****
Karsten Hopp 03da20
   * Initialize window "newp" from window "oldp".
Karsten Hopp 03da20
   * Used when splitting a window and when creating a new tab page.
Karsten Hopp 03da20
   * The windows will both edit the same buffer.
Karsten Hopp 03da20
   */
Karsten Hopp 03da20
      static void
Karsten Hopp 03da20
! win_init(newp, oldp)
Karsten Hopp 03da20
      win_T	*newp;
Karsten Hopp 03da20
      win_T	*oldp;
Karsten Hopp 03da20
  {
Karsten Hopp 03da20
      int		i;
Karsten Hopp 03da20
  
Karsten Hopp 03da20
--- 1160,1174 ----
Karsten Hopp 03da20
   * Initialize window "newp" from window "oldp".
Karsten Hopp 03da20
   * Used when splitting a window and when creating a new tab page.
Karsten Hopp 03da20
   * The windows will both edit the same buffer.
Karsten Hopp 03da20
+  * WSP_NEWLOC may be specified in flags to prevent the location list from
Karsten Hopp 03da20
+  * being copied.
Karsten Hopp 03da20
   */
Karsten Hopp 03da20
+ /*ARGSUSED*/
Karsten Hopp 03da20
      static void
Karsten Hopp 03da20
! win_init(newp, oldp, flags)
Karsten Hopp 03da20
      win_T	*newp;
Karsten Hopp 03da20
      win_T	*oldp;
Karsten Hopp 03da20
+     int		 flags;
Karsten Hopp 03da20
  {
Karsten Hopp 03da20
      int		i;
Karsten Hopp 03da20
  
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 1189,1195 ****
Karsten Hopp 03da20
      copy_jumplist(oldp, newp);
Karsten Hopp 03da20
  #endif
Karsten Hopp 03da20
  #ifdef FEAT_QUICKFIX
Karsten Hopp 03da20
!     copy_loclist(oldp, newp);
Karsten Hopp 03da20
  #endif
Karsten Hopp 03da20
      if (oldp->w_localdir != NULL)
Karsten Hopp 03da20
  	newp->w_localdir = vim_strsave(oldp->w_localdir);
Karsten Hopp 03da20
--- 1193,1206 ----
Karsten Hopp 03da20
      copy_jumplist(oldp, newp);
Karsten Hopp 03da20
  #endif
Karsten Hopp 03da20
  #ifdef FEAT_QUICKFIX
Karsten Hopp 03da20
!     if (flags & WSP_NEWLOC)
Karsten Hopp 03da20
!     {
Karsten Hopp 03da20
! 	/* Don't copy the location list.  */
Karsten Hopp 03da20
! 	newp->w_llist = NULL;
Karsten Hopp 03da20
! 	newp->w_llist_ref = NULL;
Karsten Hopp 03da20
!     }
Karsten Hopp 03da20
!     else
Karsten Hopp 03da20
! 	copy_loclist(oldp, newp);
Karsten Hopp 03da20
  #endif
Karsten Hopp 03da20
      if (oldp->w_localdir != NULL)
Karsten Hopp 03da20
  	newp->w_localdir = vim_strsave(oldp->w_localdir);
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 3219,3225 ****
Karsten Hopp 03da20
      else
Karsten Hopp 03da20
      {
Karsten Hopp 03da20
  	/* First window in new tab page, initialize it from "oldwin". */
Karsten Hopp 03da20
! 	win_init(curwin, oldwin);
Karsten Hopp 03da20
  
Karsten Hopp 03da20
  # ifdef FEAT_SCROLLBIND
Karsten Hopp 03da20
  	/* We don't want scroll-binding in the first window. */
Karsten Hopp 03da20
--- 3230,3236 ----
Karsten Hopp 03da20
      else
Karsten Hopp 03da20
      {
Karsten Hopp 03da20
  	/* First window in new tab page, initialize it from "oldwin". */
Karsten Hopp 03da20
! 	win_init(curwin, oldwin, 0);
Karsten Hopp 03da20
  
Karsten Hopp 03da20
  # ifdef FEAT_SCROLLBIND
Karsten Hopp 03da20
  	/* We don't want scroll-binding in the first window. */
Karsten Hopp 03da20
*** ../vim-7.2.119/src/version.c	Sun Feb 22 01:13:45 2009
Karsten Hopp 03da20
--- src/version.c	Sun Feb 22 02:32:14 2009
Karsten Hopp 03da20
***************
Karsten Hopp 03da20
*** 678,679 ****
Karsten Hopp 03da20
--- 678,681 ----
Karsten Hopp 03da20
  {   /* Add new patch number below this line */
Karsten Hopp 03da20
+ /**/
Karsten Hopp 03da20
+     120,
Karsten Hopp 03da20
  /**/
Karsten Hopp 03da20
Karsten Hopp 03da20
-- 
Karsten Hopp 03da20
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 03da20
110. You actually volunteer to become your employer's webmaster.
Karsten Hopp 03da20
Karsten Hopp 03da20
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 03da20
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 03da20
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 03da20
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///