summaryrefslogtreecommitdiffstats
path: root/gvim/vim-7.2/7.2.120
blob: cf687f3ed64cfd9dfcd6e47186897e7740854c02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
To: vim-dev@vim.org
Subject: Patch 7.2.120
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.2.120
Problem:    When opening the quickfix window or splitting the window and
            setting the location list, the location list is copied and then
            deleted, which is inefficient.
Solution:   Don't copy the location list when not needed. (Lech Lorens)
Files:      src/quickfix.c, src/vim.h, src/window.c


*** ../vim-7.2.119/src/quickfix.c	Sun Feb 22 00:01:42 2009
--- src/quickfix.c	Sat Feb 21 22:54:25 2009
***************
*** 1419,1424 ****
--- 1419,1425 ----
      int			opened_window = FALSE;
      win_T		*win;
      win_T		*altwin;
+     int			flags;
  #endif
      win_T		*oldwin = curwin;
      int			print_message = TRUE;
***************
*** 1531,1537 ****
      if (qf_ptr->qf_type == 1 && (!curwin->w_buffer->b_help || cmdmod.tab != 0))
      {
  	win_T	*wp;
- 	int	n;
  
  	if (cmdmod.tab != 0)
  	    wp = NULL;
--- 1532,1537 ----
***************
*** 1547,1559 ****
  	     * Split off help window; put it at far top if no position
  	     * specified, the current window is vertically split and narrow.
  	     */
! 	    n = WSP_HELP;
  # ifdef FEAT_VERTSPLIT
  	    if (cmdmod.split == 0 && curwin->w_width != Columns
  						      && curwin->w_width < 80)
! 		n |= WSP_TOP;
  # endif
! 	    if (win_split(0, n) == FAIL)
  		goto theend;
  	    opened_window = TRUE;	/* close it when fail */
  
--- 1547,1562 ----
  	     * Split off help window; put it at far top if no position
  	     * specified, the current window is vertically split and narrow.
  	     */
! 	    flags = WSP_HELP;
  # ifdef FEAT_VERTSPLIT
  	    if (cmdmod.split == 0 && curwin->w_width != Columns
  						      && curwin->w_width < 80)
! 		flags |= WSP_TOP;
  # endif
! 	    if (qi != &ql_info)
! 		flags |= WSP_NEWLOC;  /* don't copy the location list */
! 
! 	    if (win_split(0, flags) == FAIL)
  		goto theend;
  	    opened_window = TRUE;	/* close it when fail */
  
***************
*** 1563,1569 ****
  	    if (qi != &ql_info)	    /* not a quickfix list */
  	    {
  		/* The new window should use the supplied location list */
- 		qf_free_all(curwin);
  		curwin->w_llist = qi;
  		qi->qf_refcount++;
  	    }
--- 1566,1571 ----
***************
*** 1624,1630 ****
  	{
  	    ll_ref = curwin->w_llist_ref;
  
! 	    if (win_split(0, WSP_ABOVE) == FAIL)
  		goto failed;		/* not enough room for window */
  	    opened_window = TRUE;	/* close it when fail */
  	    p_swb = empty_option;	/* don't split again */
--- 1626,1635 ----
  	{
  	    ll_ref = curwin->w_llist_ref;
  
! 	    flags = WSP_ABOVE;
! 	    if (ll_ref != NULL)
! 		flags |= WSP_NEWLOC;
! 	    if (win_split(0, flags) == FAIL)
  		goto failed;		/* not enough room for window */
  	    opened_window = TRUE;	/* close it when fail */
  	    p_swb = empty_option;	/* don't split again */
***************
*** 1636,1642 ****
  	    {
  		/* The new window should use the location list from the
  		 * location list window */
- 		qf_free_all(curwin);
  		curwin->w_llist = ll_ref;
  		ll_ref->qf_refcount++;
  	    }
--- 1641,1646 ----
***************
*** 2311,2325 ****
  	if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
  	    /* Create the new window at the very bottom. */
  	    win_goto(lastwin);
! 	if (win_split(height, WSP_BELOW) == FAIL)
  	    return;		/* not enough room for window */
  #ifdef FEAT_SCROLLBIND
  	curwin->w_p_scb = FALSE;
  #endif
  
- 	/* Remove the location list for the quickfix window */
- 	qf_free_all(curwin);
- 
  	if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
  	{
  	    /*
--- 2315,2326 ----
  	if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
  	    /* Create the new window at the very bottom. */
  	    win_goto(lastwin);
! 	if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)
  	    return;		/* not enough room for window */
  #ifdef FEAT_SCROLLBIND
  	curwin->w_p_scb = FALSE;
  #endif
  
  	if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
  	{
  	    /*
*** ../vim-7.2.119/src/vim.h	Thu Nov 20 14:11:47 2008
--- src/vim.h	Sat Feb 21 22:53:03 2009
***************
*** 1057,1062 ****
--- 1057,1063 ----
  #define WSP_HELP	16	/* creating the help window */
  #define WSP_BELOW	32	/* put new window below/right */
  #define WSP_ABOVE	64	/* put new window above/left */
+ #define WSP_NEWLOC	128	/* don't copy location list */
  
  /*
   * arguments for gui_set_shellsize()
*** ../vim-7.2.119/src/window.c	Sat Feb 21 20:27:00 2009
--- src/window.c	Sat Feb 21 23:56:41 2009
***************
*** 12,18 ****
  static int path_is_url __ARGS((char_u *p));
  #if defined(FEAT_WINDOWS) || defined(PROTO)
  static int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
! static void win_init __ARGS((win_T *newp, win_T *oldp));
  static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
  static void frame_setheight __ARGS((frame_T *curfrp, int height));
  #ifdef FEAT_VERTSPLIT
--- 12,18 ----
  static int path_is_url __ARGS((char_u *p));
  #if defined(FEAT_WINDOWS) || defined(PROTO)
  static int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
! static void win_init __ARGS((win_T *newp, win_T *oldp, int flags));
  static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
  static void frame_setheight __ARGS((frame_T *curfrp, int height));
  #ifdef FEAT_VERTSPLIT
***************
*** 911,917 ****
  	    return FAIL;
  
  	/* make the contents of the new window the same as the current one */
! 	win_init(wp, curwin);
      }
  
      /*
--- 911,917 ----
  	    return FAIL;
  
  	/* make the contents of the new window the same as the current one */
! 	win_init(wp, curwin, flags);
      }
  
      /*
***************
*** 1160,1170 ****
   * Initialize window "newp" from window "oldp".
   * Used when splitting a window and when creating a new tab page.
   * The windows will both edit the same buffer.
   */
      static void
! win_init(newp, oldp)
      win_T	*newp;
      win_T	*oldp;
  {
      int		i;
  
--- 1160,1174 ----
   * Initialize window "newp" from window "oldp".
   * Used when splitting a window and when creating a new tab page.
   * The windows will both edit the same buffer.
+  * WSP_NEWLOC may be specified in flags to prevent the location list from
+  * being copied.
   */
+ /*ARGSUSED*/
      static void
! win_init(newp, oldp, flags)
      win_T	*newp;
      win_T	*oldp;
+     int		 flags;
  {
      int		i;
  
***************
*** 1189,1195 ****
      copy_jumplist(oldp, newp);
  #endif
  #ifdef FEAT_QUICKFIX
!     copy_loclist(oldp, newp);
  #endif
      if (oldp->w_localdir != NULL)
  	newp->w_localdir = vim_strsave(oldp->w_localdir);
--- 1193,1206 ----
      copy_jumplist(oldp, newp);
  #endif
  #ifdef FEAT_QUICKFIX
!     if (flags & WSP_NEWLOC)
!     {
! 	/* Don't copy the location list.  */
! 	newp->w_llist = NULL;
! 	newp->w_llist_ref = NULL;
!     }
!     else
! 	copy_loclist(oldp, newp);
  #endif
      if (oldp->w_localdir != NULL)
  	newp->w_localdir = vim_strsave(oldp->w_localdir);
***************
*** 3219,3225 ****
      else
      {
  	/* First window in new tab page, initialize it from "oldwin". */
! 	win_init(curwin, oldwin);
  
  # ifdef FEAT_SCROLLBIND
  	/* We don't want scroll-binding in the first window. */
--- 3230,3236 ----
      else
      {
  	/* First window in new tab page, initialize it from "oldwin". */
! 	win_init(curwin, oldwin, 0);
  
  # ifdef FEAT_SCROLLBIND
  	/* We don't want scroll-binding in the first window. */
*** ../vim-7.2.119/src/version.c	Sun Feb 22 01:13:45 2009
--- src/version.c	Sun Feb 22 02:32:14 2009
***************
*** 678,679 ****
--- 678,681 ----
  {   /* Add new patch number below this line */
+ /**/
+     120,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
110. You actually volunteer to become your employer's webmaster.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///