4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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
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
23 int opened_window = FALSE;
28 win_T *oldwin = curwin;
29 int print_message = TRUE;
32 if (qf_ptr->qf_type == 1 && (!curwin->w_buffer->b_help || cmdmod.tab != 0))
42 * Split off help window; put it at far top if no position
43 * specified, the current window is vertically split and narrow.
46 # ifdef FEAT_VERTSPLIT
47 if (cmdmod.split == 0 && curwin->w_width != Columns
48 && curwin->w_width < 80)
51 ! if (win_split(0, n) == FAIL)
53 opened_window = TRUE; /* close it when fail */
56 * Split off help window; put it at far top if no position
57 * specified, the current window is vertically split and narrow.
60 # ifdef FEAT_VERTSPLIT
61 if (cmdmod.split == 0 && curwin->w_width != Columns
62 && curwin->w_width < 80)
66 ! flags |= WSP_NEWLOC; /* don't copy the location list */
68 ! if (win_split(0, flags) == FAIL)
70 opened_window = TRUE; /* close it when fail */
74 if (qi != &ql_info) /* not a quickfix list */
76 /* The new window should use the supplied location list */
77 - qf_free_all(curwin);
85 ll_ref = curwin->w_llist_ref;
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 */
93 ll_ref = curwin->w_llist_ref;
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 */
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++;
114 if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
115 /* Create the new window at the very bottom. */
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;
123 - /* Remove the location list for the quickfix window */
124 - qf_free_all(curwin);
126 if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
130 if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
131 /* Create the new window at the very bottom. */
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;
139 if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
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
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 */
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
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
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
177 /* make the contents of the new window the same as the current one */
178 ! win_init(wp, curwin);
185 /* make the contents of the new window the same as the current one */
186 ! win_init(wp, curwin, flags);
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.
197 ! win_init(newp, oldp)
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
212 ! win_init(newp, oldp, flags)
221 copy_jumplist(oldp, newp);
224 ! copy_loclist(oldp, newp);
226 if (oldp->w_localdir != NULL)
227 newp->w_localdir = vim_strsave(oldp->w_localdir);
229 copy_jumplist(oldp, newp);
232 ! if (flags & WSP_NEWLOC)
234 ! /* Don't copy the location list. */
235 ! newp->w_llist = NULL;
236 ! newp->w_llist_ref = NULL;
239 ! copy_loclist(oldp, newp);
241 if (oldp->w_localdir != NULL)
242 newp->w_localdir = vim_strsave(oldp->w_localdir);
247 /* First window in new tab page, initialize it from "oldwin". */
248 ! win_init(curwin, oldwin);
250 # ifdef FEAT_SCROLLBIND
251 /* We don't want scroll-binding in the first window. */
255 /* First window in new tab page, initialize it from "oldwin". */
256 ! win_init(curwin, oldwin, 0);
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
265 { /* Add new patch number below this line */
271 hundred-and-one symptoms of being an internet addict:
272 110. You actually volunteer to become your employer's webmaster.
274 /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///