4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: ml_get error when using ":vimgrep".
12 Solution: Load the memfile for the hidden buffer before putting it in a
13 window. Correct the order of splitting the window and filling
14 the window and buffer with data.
15 Files: src/fileio.c, src/proto/window.pro, src/quickfix.c, src/window.c
18 *** ../vim-7.2.214/src/fileio.c 2009-06-24 11:57:53.000000000 +0200
19 --- src/fileio.c 2009-06-24 12:53:19.000000000 +0200
24 /* Set swap file protection bits after creating it. */
25 ! if (swap_mode > 0 && curbuf->b_ml.ml_mfp->mf_fname != NULL)
26 (void)mch_setperm(curbuf->b_ml.ml_mfp->mf_fname, (long)swap_mode);
32 /* Set swap file protection bits after creating it. */
33 ! if (swap_mode > 0 && curbuf->b_ml.ml_mfp != NULL
34 ! && curbuf->b_ml.ml_mfp->mf_fname != NULL)
35 (void)mch_setperm(curbuf->b_ml.ml_mfp->mf_fname, (long)swap_mode);
40 * effects, insert it in a the current tab page.
41 * Anything related to a window (e.g., setting folds) may have
42 * unexpected results. */
44 ! curwin->w_buffer = buf;
48 /* Split the current window, put the aucmd_win in the upper half. */
50 * effects, insert it in a the current tab page.
51 * Anything related to a window (e.g., setting folds) may have
52 * unexpected results. */
53 ! aucmd_win->w_buffer = buf;
55 + win_init_empty(aucmd_win); /* set cursor and topline to safe values */
58 /* Split the current window, put the aucmd_win in the upper half. */
61 (void)win_comp_pos(); /* recompute window positions */
64 ! /* set cursor and topline to safe values */
66 ! #ifdef FEAT_VERTSPLIT
67 ! curwin->w_wincol = 0;
68 ! curwin->w_width = Columns;
72 aco->new_curwin = curwin;
74 (void)win_comp_pos(); /* recompute window positions */
80 aco->new_curwin = curwin;
81 *** ../vim-7.2.214/src/proto/window.pro 2009-06-16 16:01:34.000000000 +0200
82 --- src/proto/window.pro 2009-06-24 12:53:13.000000000 +0200
86 win_T *winframe_remove __ARGS((win_T *win, int *dirp, tabpage_T *tp));
87 void close_others __ARGS((int message, int forceit));
88 void curwin_init __ARGS((void));
89 + void win_init_empty __ARGS((win_T *wp));
90 int win_alloc_first __ARGS((void));
91 void win_alloc_aucmd_win __ARGS((void));
92 void win_init_size __ARGS((void));
93 *** ../vim-7.2.214/src/quickfix.c 2009-05-17 13:30:58.000000000 +0200
94 --- src/quickfix.c 2009-06-24 15:30:06.000000000 +0200
97 /* Init the options. */
98 buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP);
100 ! /* set curwin/curbuf to buf and save a few things */
101 ! aucmd_prepbuf(&aco, newbuf);
103 ! /* Need to set the filename for autocommands. */
104 ! (void)setfname(curbuf, fname, NULL, FALSE);
106 - if (ml_open(curbuf) == OK)
108 /* Create swap file now to avoid the ATTENTION message. */
109 check_need_swap(TRUE);
112 /* Init the options. */
113 buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP);
115 ! /* need to open the memfile before putting the buffer in a window */
116 ! if (ml_open(newbuf) == OK)
118 ! /* set curwin/curbuf to buf and save a few things */
119 ! aucmd_prepbuf(&aco, newbuf);
121 ! /* Need to set the filename for autocommands. */
122 ! (void)setfname(curbuf, fname, NULL, FALSE);
124 /* Create swap file now to avoid the ATTENTION message. */
125 check_need_swap(TRUE);
134 ! /* restore curwin/curbuf and a few other things */
135 ! aucmd_restbuf(&aco);
137 if (!buf_valid(newbuf))
144 ! /* restore curwin/curbuf and a few other things */
145 ! aucmd_restbuf(&aco);
148 if (!buf_valid(newbuf))
150 *** ../vim-7.2.214/src/window.c 2009-06-16 16:01:34.000000000 +0200
151 --- src/window.c 2009-06-24 14:35:16.000000000 +0200
157 - #ifdef FEAT_FOLDING
161 - /* reduce the reference count to the argument list. */
162 - alist_unlink(win->w_alist);
164 /* Remove the window and its frame from the tree of frames. */
166 wp = winframe_remove(win, dirp, tp);
173 - while (firstwin != NULL)
174 - (void)win_free_mem(firstwin, &dummy, NULL);
177 if (aucmd_win != NULL)
187 + while (firstwin != NULL)
188 + (void)win_free_mem(firstwin, &dummy, NULL);
197 ! redraw_win_later(curwin, NOT_VALID);
198 ! curwin->w_lines_valid = 0;
199 ! curwin->w_cursor.lnum = 1;
200 ! curwin->w_curswant = curwin->w_cursor.col = 0;
201 #ifdef FEAT_VIRTUALEDIT
202 ! curwin->w_cursor.coladd = 0;
204 ! curwin->w_pcmark.lnum = 1; /* pcmark not cleared but set to line 1 */
205 ! curwin->w_pcmark.col = 0;
206 ! curwin->w_prev_pcmark.lnum = 0;
207 ! curwin->w_prev_pcmark.col = 0;
208 ! curwin->w_topline = 1;
210 ! curwin->w_topfill = 0;
212 ! curwin->w_botline = 2;
214 ! if (curwin->w_p_rl)
215 ! curwin->w_farsi = W_CONV + W_R_L;
217 ! curwin->w_farsi = W_CONV;
225 ! win_init_empty(curwin);
232 ! redraw_win_later(wp, NOT_VALID);
233 ! wp->w_lines_valid = 0;
234 ! wp->w_cursor.lnum = 1;
235 ! wp->w_curswant = wp->w_cursor.col = 0;
236 #ifdef FEAT_VIRTUALEDIT
237 ! wp->w_cursor.coladd = 0;
239 ! wp->w_pcmark.lnum = 1; /* pcmark not cleared but set to line 1 */
240 ! wp->w_pcmark.col = 0;
241 ! wp->w_prev_pcmark.lnum = 0;
242 ! wp->w_prev_pcmark.col = 0;
250 ! wp->w_farsi = W_CONV + W_R_L;
252 ! wp->w_farsi = W_CONV;
262 + #ifdef FEAT_FOLDING
266 + /* reduce the reference count to the argument list. */
267 + alist_unlink(wp->w_alist);
270 /* Don't execute autocommands while the window is halfway being deleted.
271 * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */
275 #endif /* FEAT_GUI */
277 ! win_remove(wp, tp);
283 #endif /* FEAT_GUI */
285 ! #ifdef FEAT_AUTOCMD
286 ! if (wp != aucmd_win)
288 ! win_remove(wp, tp);
292 *** ../vim-7.2.214/src/version.c 2009-06-24 17:04:40.000000000 +0200
293 --- src/version.c 2009-06-24 17:27:38.000000000 +0200
297 { /* Add new patch number below this line */
303 Micro$oft: where do you want to go today?
304 Linux: where do you want to go tomorrow?
305 FreeBSD: are you guys coming, or what?
307 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
308 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
309 \\\ download, build and distribute -- http://www.A-A-P.org ///
310 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///