components/vim/vim72-patches/7.2.120
changeset 379 c6a17bba1da3
parent 378 f0b61ed1d10d
child 380 e92b3b4a1c66
equal deleted inserted replaced
378:f0b61ed1d10d 379:c6a17bba1da3
     1 To: [email protected]
       
     2 Subject: Patch 7.2.120
       
     3 Fcc: outbox
       
     4 From: Bram Moolenaar <[email protected]>
       
     5 Mime-Version: 1.0
       
     6 Content-Type: text/plain; charset=ISO-8859-1
       
     7 Content-Transfer-Encoding: 8bit
       
     8 ------------
       
     9 
       
    10 Patch 7.2.120
       
    11 Problem:    When opening the quickfix window or splitting the window and
       
    12             setting the location list, the location list is copied and then
       
    13             deleted, which is inefficient.
       
    14 Solution:   Don't copy the location list when not needed. (Lech Lorens)
       
    15 Files:      src/quickfix.c, src/vim.h, src/window.c
       
    16 
       
    17 
       
    18 *** ../vim-7.2.119/src/quickfix.c	Sun Feb 22 00:01:42 2009
       
    19 --- src/quickfix.c	Sat Feb 21 22:54:25 2009
       
    20 ***************
       
    21 *** 1419,1424 ****
       
    22 --- 1419,1425 ----
       
    23       int			opened_window = FALSE;
       
    24       win_T		*win;
       
    25       win_T		*altwin;
       
    26 +     int			flags;
       
    27   #endif
       
    28       win_T		*oldwin = curwin;
       
    29       int			print_message = TRUE;
       
    30 ***************
       
    31 *** 1531,1537 ****
       
    32       if (qf_ptr->qf_type == 1 && (!curwin->w_buffer->b_help || cmdmod.tab != 0))
       
    33       {
       
    34   	win_T	*wp;
       
    35 - 	int	n;
       
    36   
       
    37   	if (cmdmod.tab != 0)
       
    38   	    wp = NULL;
       
    39 --- 1532,1537 ----
       
    40 ***************
       
    41 *** 1547,1559 ****
       
    42   	     * Split off help window; put it at far top if no position
       
    43   	     * specified, the current window is vertically split and narrow.
       
    44   	     */
       
    45 ! 	    n = WSP_HELP;
       
    46   # ifdef FEAT_VERTSPLIT
       
    47   	    if (cmdmod.split == 0 && curwin->w_width != Columns
       
    48   						      && curwin->w_width < 80)
       
    49 ! 		n |= WSP_TOP;
       
    50   # endif
       
    51 ! 	    if (win_split(0, n) == FAIL)
       
    52   		goto theend;
       
    53   	    opened_window = TRUE;	/* close it when fail */
       
    54   
       
    55 --- 1547,1562 ----
       
    56   	     * Split off help window; put it at far top if no position
       
    57   	     * specified, the current window is vertically split and narrow.
       
    58   	     */
       
    59 ! 	    flags = WSP_HELP;
       
    60   # ifdef FEAT_VERTSPLIT
       
    61   	    if (cmdmod.split == 0 && curwin->w_width != Columns
       
    62   						      && curwin->w_width < 80)
       
    63 ! 		flags |= WSP_TOP;
       
    64   # endif
       
    65 ! 	    if (qi != &ql_info)
       
    66 ! 		flags |= WSP_NEWLOC;  /* don't copy the location list */
       
    67 ! 
       
    68 ! 	    if (win_split(0, flags) == FAIL)
       
    69   		goto theend;
       
    70   	    opened_window = TRUE;	/* close it when fail */
       
    71   
       
    72 ***************
       
    73 *** 1563,1569 ****
       
    74   	    if (qi != &ql_info)	    /* not a quickfix list */
       
    75   	    {
       
    76   		/* The new window should use the supplied location list */
       
    77 - 		qf_free_all(curwin);
       
    78   		curwin->w_llist = qi;
       
    79   		qi->qf_refcount++;
       
    80   	    }
       
    81 --- 1566,1571 ----
       
    82 ***************
       
    83 *** 1624,1630 ****
       
    84   	{
       
    85   	    ll_ref = curwin->w_llist_ref;
       
    86   
       
    87 ! 	    if (win_split(0, WSP_ABOVE) == FAIL)
       
    88   		goto failed;		/* not enough room for window */
       
    89   	    opened_window = TRUE;	/* close it when fail */
       
    90   	    p_swb = empty_option;	/* don't split again */
       
    91 --- 1626,1635 ----
       
    92   	{
       
    93   	    ll_ref = curwin->w_llist_ref;
       
    94   
       
    95 ! 	    flags = WSP_ABOVE;
       
    96 ! 	    if (ll_ref != NULL)
       
    97 ! 		flags |= WSP_NEWLOC;
       
    98 ! 	    if (win_split(0, flags) == FAIL)
       
    99   		goto failed;		/* not enough room for window */
       
   100   	    opened_window = TRUE;	/* close it when fail */
       
   101   	    p_swb = empty_option;	/* don't split again */
       
   102 ***************
       
   103 *** 1636,1642 ****
       
   104   	    {
       
   105   		/* The new window should use the location list from the
       
   106   		 * location list window */
       
   107 - 		qf_free_all(curwin);
       
   108   		curwin->w_llist = ll_ref;
       
   109   		ll_ref->qf_refcount++;
       
   110   	    }
       
   111 --- 1641,1646 ----
       
   112 ***************
       
   113 *** 2311,2325 ****
       
   114   	if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
       
   115   	    /* Create the new window at the very bottom. */
       
   116   	    win_goto(lastwin);
       
   117 ! 	if (win_split(height, WSP_BELOW) == FAIL)
       
   118   	    return;		/* not enough room for window */
       
   119   #ifdef FEAT_SCROLLBIND
       
   120   	curwin->w_p_scb = FALSE;
       
   121   #endif
       
   122   
       
   123 - 	/* Remove the location list for the quickfix window */
       
   124 - 	qf_free_all(curwin);
       
   125 - 
       
   126   	if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
       
   127   	{
       
   128   	    /*
       
   129 --- 2315,2326 ----
       
   130   	if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
       
   131   	    /* Create the new window at the very bottom. */
       
   132   	    win_goto(lastwin);
       
   133 ! 	if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)
       
   134   	    return;		/* not enough room for window */
       
   135   #ifdef FEAT_SCROLLBIND
       
   136   	curwin->w_p_scb = FALSE;
       
   137   #endif
       
   138   
       
   139   	if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
       
   140   	{
       
   141   	    /*
       
   142 *** ../vim-7.2.119/src/vim.h	Thu Nov 20 14:11:47 2008
       
   143 --- src/vim.h	Sat Feb 21 22:53:03 2009
       
   144 ***************
       
   145 *** 1057,1062 ****
       
   146 --- 1057,1063 ----
       
   147   #define WSP_HELP	16	/* creating the help window */
       
   148   #define WSP_BELOW	32	/* put new window below/right */
       
   149   #define WSP_ABOVE	64	/* put new window above/left */
       
   150 + #define WSP_NEWLOC	128	/* don't copy location list */
       
   151   
       
   152   /*
       
   153    * arguments for gui_set_shellsize()
       
   154 *** ../vim-7.2.119/src/window.c	Sat Feb 21 20:27:00 2009
       
   155 --- src/window.c	Sat Feb 21 23:56:41 2009
       
   156 ***************
       
   157 *** 12,18 ****
       
   158   static int path_is_url __ARGS((char_u *p));
       
   159   #if defined(FEAT_WINDOWS) || defined(PROTO)
       
   160   static int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
       
   161 ! static void win_init __ARGS((win_T *newp, win_T *oldp));
       
   162   static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
       
   163   static void frame_setheight __ARGS((frame_T *curfrp, int height));
       
   164   #ifdef FEAT_VERTSPLIT
       
   165 --- 12,18 ----
       
   166   static int path_is_url __ARGS((char_u *p));
       
   167   #if defined(FEAT_WINDOWS) || defined(PROTO)
       
   168   static int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
       
   169 ! static void win_init __ARGS((win_T *newp, win_T *oldp, int flags));
       
   170   static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
       
   171   static void frame_setheight __ARGS((frame_T *curfrp, int height));
       
   172   #ifdef FEAT_VERTSPLIT
       
   173 ***************
       
   174 *** 911,917 ****
       
   175   	    return FAIL;
       
   176   
       
   177   	/* make the contents of the new window the same as the current one */
       
   178 ! 	win_init(wp, curwin);
       
   179       }
       
   180   
       
   181       /*
       
   182 --- 911,917 ----
       
   183   	    return FAIL;
       
   184   
       
   185   	/* make the contents of the new window the same as the current one */
       
   186 ! 	win_init(wp, curwin, flags);
       
   187       }
       
   188   
       
   189       /*
       
   190 ***************
       
   191 *** 1160,1170 ****
       
   192    * Initialize window "newp" from window "oldp".
       
   193    * Used when splitting a window and when creating a new tab page.
       
   194    * The windows will both edit the same buffer.
       
   195    */
       
   196       static void
       
   197 ! win_init(newp, oldp)
       
   198       win_T	*newp;
       
   199       win_T	*oldp;
       
   200   {
       
   201       int		i;
       
   202   
       
   203 --- 1160,1174 ----
       
   204    * Initialize window "newp" from window "oldp".
       
   205    * Used when splitting a window and when creating a new tab page.
       
   206    * The windows will both edit the same buffer.
       
   207 +  * WSP_NEWLOC may be specified in flags to prevent the location list from
       
   208 +  * being copied.
       
   209    */
       
   210 + /*ARGSUSED*/
       
   211       static void
       
   212 ! win_init(newp, oldp, flags)
       
   213       win_T	*newp;
       
   214       win_T	*oldp;
       
   215 +     int		 flags;
       
   216   {
       
   217       int		i;
       
   218   
       
   219 ***************
       
   220 *** 1189,1195 ****
       
   221       copy_jumplist(oldp, newp);
       
   222   #endif
       
   223   #ifdef FEAT_QUICKFIX
       
   224 !     copy_loclist(oldp, newp);
       
   225   #endif
       
   226       if (oldp->w_localdir != NULL)
       
   227   	newp->w_localdir = vim_strsave(oldp->w_localdir);
       
   228 --- 1193,1206 ----
       
   229       copy_jumplist(oldp, newp);
       
   230   #endif
       
   231   #ifdef FEAT_QUICKFIX
       
   232 !     if (flags & WSP_NEWLOC)
       
   233 !     {
       
   234 ! 	/* Don't copy the location list.  */
       
   235 ! 	newp->w_llist = NULL;
       
   236 ! 	newp->w_llist_ref = NULL;
       
   237 !     }
       
   238 !     else
       
   239 ! 	copy_loclist(oldp, newp);
       
   240   #endif
       
   241       if (oldp->w_localdir != NULL)
       
   242   	newp->w_localdir = vim_strsave(oldp->w_localdir);
       
   243 ***************
       
   244 *** 3219,3225 ****
       
   245       else
       
   246       {
       
   247   	/* First window in new tab page, initialize it from "oldwin". */
       
   248 ! 	win_init(curwin, oldwin);
       
   249   
       
   250   # ifdef FEAT_SCROLLBIND
       
   251   	/* We don't want scroll-binding in the first window. */
       
   252 --- 3230,3236 ----
       
   253       else
       
   254       {
       
   255   	/* First window in new tab page, initialize it from "oldwin". */
       
   256 ! 	win_init(curwin, oldwin, 0);
       
   257   
       
   258   # ifdef FEAT_SCROLLBIND
       
   259   	/* We don't want scroll-binding in the first window. */
       
   260 *** ../vim-7.2.119/src/version.c	Sun Feb 22 01:13:45 2009
       
   261 --- src/version.c	Sun Feb 22 02:32:14 2009
       
   262 ***************
       
   263 *** 678,679 ****
       
   264 --- 678,681 ----
       
   265   {   /* Add new patch number below this line */
       
   266 + /**/
       
   267 +     120,
       
   268   /**/
       
   269 
       
   270 -- 
       
   271 hundred-and-one symptoms of being an internet addict:
       
   272 110. You actually volunteer to become your employer's webmaster.
       
   273 
       
   274  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
       
   275 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
       
   276 \\\        download, build and distribute -- http://www.A-A-P.org        ///
       
   277  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///