]> git.pld-linux.org Git - packages/vim.git/blob - 7.2.203
- new
[packages/vim.git] / 7.2.203
1 To: vim-dev@vim.org
2 Subject: Patch 7.2.203
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.2.203
11 Problem:    When reloading a buffer or doing anything else with a buffer that
12             is not displayed in a visible window, autocommands may be applied
13             to the current window, folds messed up, etc.
14 Solution:   Instead of using the current window for the hidden buffer use a
15             special window, splitting the current one temporarily.
16 Files:      src/fileio.c, src/globals.h, src/gui.c, src/if_perl.xs,
17             src/proto/gui.pro, src/proto/window.pro, src/screen.c,
18             src/structs.h, src/window.c
19
20
21 *** ../vim-7.2.202/src/fileio.c 2009-06-16 15:35:46.000000000 +0200
22 --- src/fileio.c        2009-06-11 21:22:37.000000000 +0200
23 ***************
24 *** 8365,8371 ****
25   
26             /* Execute the modeline settings, but don't set window-local
27              * options if we are using the current window for another buffer. */
28 !           do_modelines(aco.save_curwin == NULL ? OPT_NOWIN : 0);
29   
30             /* restore the current window */
31             aucmd_restbuf(&aco);
32 --- 8365,8371 ----
33   
34             /* Execute the modeline settings, but don't set window-local
35              * options if we are using the current window for another buffer. */
36 !           do_modelines(curwin == aucmd_win ? OPT_NOWIN : 0);
37   
38             /* restore the current window */
39             aucmd_restbuf(&aco);
40 ***************
41 *** 8381,8388 ****
42   
43   /*
44    * Prepare for executing autocommands for (hidden) buffer "buf".
45 !  * Search a window for the current buffer.  Save the cursor position and
46 !  * screen offset.
47    * Set "curbuf" and "curwin" to match "buf".
48    * When FEAT_AUTOCMD is not defined another version is used, see below.
49    */
50 --- 8381,8388 ----
51   
52   /*
53    * Prepare for executing autocommands for (hidden) buffer "buf".
54 !  * Search for a visible window containing the current buffer.  If there isn't
55 !  * one then use "aucmd_win".
56    * Set "curbuf" and "curwin" to match "buf".
57    * When FEAT_AUTOCMD is not defined another version is used, see below.
58    */
59 ***************
60 *** 8392,8399 ****
61       buf_T     *buf;           /* new curbuf */
62   {
63       win_T     *win;
64
65 !     aco->new_curbuf = buf;
66   
67       /* Find a window that is for the new buffer */
68       if (buf == curbuf)                /* be quick when buf is curbuf */
69 --- 8392,8400 ----
70       buf_T     *buf;           /* new curbuf */
71   {
72       win_T     *win;
73 ! #ifdef FEAT_WINDOWS
74 !     int               save_ea;
75 ! #endif
76   
77       /* Find a window that is for the new buffer */
78       if (buf == curbuf)                /* be quick when buf is curbuf */
79 ***************
80 *** 8407,8448 ****
81         win = NULL;
82   #endif
83   
84 !     /*
85 !      * Prefer to use an existing window for the buffer, it has the least side
86 !      * effects (esp. if "buf" is curbuf).
87 !      * Otherwise, use curwin for "buf".  It might make some items in the
88 !      * window invalid.  At least save the cursor and topline.
89 !      */
90       if (win != NULL)
91       {
92 !       /* there is a window for "buf", make it the curwin */
93 !       aco->save_curwin = curwin;
94         curwin = win;
95 -       aco->save_buf = win->w_buffer;
96 -       aco->new_curwin = win;
97       }
98       else
99       {
100 !       /* there is no window for "buf", use curwin */
101 !       aco->save_curwin = NULL;
102 !       aco->save_buf = curbuf;
103 !       --curbuf->b_nwindows;
104         curwin->w_buffer = buf;
105         ++buf->b_nwindows;
106   
107 !       /* save cursor and topline, set them to safe values */
108 !       aco->save_cursor = curwin->w_cursor;
109 !       curwin->w_cursor.lnum = 1;
110 !       curwin->w_cursor.col = 0;
111 !       aco->save_topline = curwin->w_topline;
112 !       curwin->w_topline = 1;
113 ! #ifdef FEAT_DIFF
114 !       aco->save_topfill = curwin->w_topfill;
115 !       curwin->w_topfill = 0;
116   #endif
117       }
118
119       curbuf = buf;
120   }
121   
122   /*
123 --- 8408,8460 ----
124         win = NULL;
125   #endif
126   
127 !     /* Allocate "aucmd_win" when needed.  If this fails (out of memory) fall
128 !      * back to using the current window. */
129 !     if (win == NULL && aucmd_win == NULL)
130 !     {
131 !       win_alloc_aucmd_win();
132 !       if (aucmd_win == NULL)
133 !           win = curwin;
134 !     }
135
136 !     aco->save_curwin = curwin;
137 !     aco->save_curbuf = curbuf;
138       if (win != NULL)
139       {
140 !       /* There is a window for "buf" in the current tab page, make it the
141 !        * curwin.  This is preferred, it has the least side effects (esp. if
142 !        * "buf" is curbuf). */
143         curwin = win;
144       }
145       else
146       {
147 !       /* There is no window for "buf", use "aucmd_win".  To minimize the side
148 !        * effects, insert it in a the current tab page.
149 !        * Anything related to a window (e.g., setting folds) may have
150 !        * unexpected results. */
151 !       curwin = aucmd_win;
152         curwin->w_buffer = buf;
153         ++buf->b_nwindows;
154   
155 ! #ifdef FEAT_WINDOWS
156 !       /* Split the current window, put the aucmd_win in the upper half. */
157 !       make_snapshot(SNAP_AUCMD_IDX);
158 !       save_ea = p_ea;
159 !       p_ea = FALSE;
160 !       (void)win_split_ins(0, WSP_TOP, aucmd_win, 0);
161 !       (void)win_comp_pos();   /* recompute window positions */
162 !       p_ea = save_ea;
163 ! #endif
164 !       /* set cursor and topline to safe values */
165 !       curwin_init();
166 ! #ifdef FEAT_VERTSPLIT
167 !       curwin->w_wincol = 0;
168 !       curwin->w_width = Columns;
169   #endif
170       }
171       curbuf = buf;
172 +     aco->new_curwin = curwin;
173 +     aco->new_curbuf = curbuf;
174   }
175   
176   /*
177 ***************
178 *** 8454,8474 ****
179   aucmd_restbuf(aco)
180       aco_save_T        *aco;           /* structure holding saved values */
181   {
182 !     if (aco->save_curwin != NULL)
183       {
184         /* restore curwin */
185   #ifdef FEAT_WINDOWS
186         if (win_valid(aco->save_curwin))
187   #endif
188         {
189 !           /* restore the buffer which was previously edited by curwin, if
190 !            * it's still the same window and it's valid */
191             if (curwin == aco->new_curwin
192 !                   && buf_valid(aco->save_buf)
193 !                   && aco->save_buf->b_ml.ml_mfp != NULL)
194             {
195                 --curbuf->b_nwindows;
196 !               curbuf = aco->save_buf;
197                 curwin->w_buffer = curbuf;
198                 ++curbuf->b_nwindows;
199             }
200 --- 8466,8551 ----
201   aucmd_restbuf(aco)
202       aco_save_T        *aco;           /* structure holding saved values */
203   {
204 ! #ifdef FEAT_WINDOWS
205 !     int dummy;
206 ! #endif
207
208 !     if (aco->new_curwin == aucmd_win)
209 !     {
210 !       --curbuf->b_nwindows;
211 ! #ifdef FEAT_WINDOWS
212 !       /* Find "aucmd_win", it can't be closed, but it may be in another tab
213 !        * page. */
214 !       if (curwin != aucmd_win)
215 !       {
216 !           tabpage_T   *tp;
217 !           win_T       *wp;
218
219 !           FOR_ALL_TAB_WINDOWS(tp, wp)
220 !           {
221 !               if (wp == aucmd_win)
222 !               {
223 !                   if (tp != curtab)
224 !                       goto_tabpage_tp(tp);
225 !                   win_goto(aucmd_win);
226 !                   break;
227 !               }
228 !           }
229 !       }
230
231 !       /* Remove the window and frame from the tree of frames. */
232 !       (void)winframe_remove(curwin, &dummy, NULL);
233 !       win_remove(curwin, NULL);
234 !       last_status(FALSE);         /* may need to remove last status line */
235 !       restore_snapshot(SNAP_AUCMD_IDX, FALSE);
236 !       (void)win_comp_pos();   /* recompute window positions */
237
238 !       if (win_valid(aco->save_curwin))
239 !           curwin = aco->save_curwin;
240 !       else
241 !           /* Hmm, original window disappeared.  Just use the first one. */
242 !           curwin = firstwin;
243 ! # ifdef FEAT_EVAL
244 !       vars_clear(&aucmd_win->w_vars.dv_hashtab);  /* free all w: variables */
245 ! # endif
246 ! #else
247 !       curwin = aco->save_curwin;
248 ! #endif
249 !       curbuf = curwin->w_buffer;
250
251 !       /* the buffer contents may have changed */
252 !       check_cursor();
253 !       if (curwin->w_topline > curbuf->b_ml.ml_line_count)
254 !       {
255 !           curwin->w_topline = curbuf->b_ml.ml_line_count;
256 ! #ifdef FEAT_DIFF
257 !           curwin->w_topfill = 0;
258 ! #endif
259 !       }
260 ! #if defined(FEAT_GUI)
261 !       /* Hide the scrollbars from the aucmd_win and update. */
262 !       gui_mch_enable_scrollbar(&aucmd_win->w_scrollbars[SBAR_LEFT], FALSE);
263 !       gui_mch_enable_scrollbar(&aucmd_win->w_scrollbars[SBAR_RIGHT], FALSE);
264 !       gui_may_update_scrollbars();
265 ! #endif
266 !     }
267 !     else
268       {
269         /* restore curwin */
270   #ifdef FEAT_WINDOWS
271         if (win_valid(aco->save_curwin))
272   #endif
273         {
274 !           /* Restore the buffer which was previously edited by curwin, if
275 !            * it was chagned, we are still the same window and the buffer is
276 !            * valid. */
277             if (curwin == aco->new_curwin
278 !                   && curbuf != aco->new_curbuf
279 !                   && buf_valid(aco->new_curbuf)
280 !                   && aco->new_curbuf->b_ml.ml_mfp != NULL)
281             {
282                 --curbuf->b_nwindows;
283 !               curbuf = aco->new_curbuf;
284                 curwin->w_buffer = curbuf;
285                 ++curbuf->b_nwindows;
286             }
287 ***************
288 *** 8477,8510 ****
289             curbuf = curwin->w_buffer;
290         }
291       }
292 -     else
293 -     {
294 -       /* restore buffer for curwin if it still exists and is loaded */
295 -       if (buf_valid(aco->save_buf) && aco->save_buf->b_ml.ml_mfp != NULL)
296 -       {
297 -           --curbuf->b_nwindows;
298 -           curbuf = aco->save_buf;
299 -           curwin->w_buffer = curbuf;
300 -           ++curbuf->b_nwindows;
301 -           curwin->w_cursor = aco->save_cursor;
302 -           check_cursor();
303 -           /* check topline < line_count, in case lines got deleted */
304 -           if (aco->save_topline <= curbuf->b_ml.ml_line_count)
305 -           {
306 -               curwin->w_topline = aco->save_topline;
307 - #ifdef FEAT_DIFF
308 -               curwin->w_topfill = aco->save_topfill;
309 - #endif
310 -           }
311 -           else
312 -           {
313 -               curwin->w_topline = curbuf->b_ml.ml_line_count;
314 - #ifdef FEAT_DIFF
315 -               curwin->w_topfill = 0;
316 - #endif
317 -           }
318 -       }
319 -     }
320   }
321   
322   static int    autocmd_nested = FALSE;
323 --- 8554,8559 ----
324 ***************
325 *** 9419,9427 ****
326       aco_save_T        *aco;           /* structure to save values in */
327       buf_T     *buf;           /* new curbuf */
328   {
329 !     aco->save_buf = curbuf;
330       curbuf = buf;
331       curwin->w_buffer = buf;
332   }
333   
334   /*
335 --- 9468,9478 ----
336       aco_save_T        *aco;           /* structure to save values in */
337       buf_T     *buf;           /* new curbuf */
338   {
339 !     aco->save_curbuf = curbuf;
340 !     --curbuf->b_nwindows;
341       curbuf = buf;
342       curwin->w_buffer = buf;
343 +     ++curbuf->b_nwindows;
344   }
345   
346   /*
347 ***************
348 *** 9432,9439 ****
349   aucmd_restbuf(aco)
350       aco_save_T        *aco;           /* structure holding saved values */
351   {
352 !     curbuf = aco->save_buf;
353       curwin->w_buffer = curbuf;
354   }
355   
356   #endif        /* FEAT_AUTOCMD */
357 --- 9483,9492 ----
358   aucmd_restbuf(aco)
359       aco_save_T        *aco;           /* structure holding saved values */
360   {
361 !     --curbuf->b_nwindows;
362 !     curbuf = aco->save_curbuf;
363       curwin->w_buffer = curbuf;
364 +     ++curbuf->b_nwindows;
365   }
366   
367   #endif        /* FEAT_AUTOCMD */
368 *** ../vim-7.2.202/src/globals.h        2009-06-16 15:23:07.000000000 +0200
369 --- src/globals.h       2009-06-12 21:10:30.000000000 +0200
370 ***************
371 *** 539,544 ****
372 --- 539,548 ----
373   
374   EXTERN win_T  *curwin;        /* currently active window */
375   
376 + #ifdef FEAT_AUTOCMD
377 + EXTERN win_T  *aucmd_win;     /* window used in aucmd_prepbuf() */
378 + #endif
379
380   /*
381    * The window layout is kept in a tree of frames.  topframe points to the top
382    * of the tree.
383 *** ../vim-7.2.202/src/gui.c    2009-05-21 23:25:38.000000000 +0200
384 --- src/gui.c   2009-06-11 20:58:05.000000000 +0200
385 ***************
386 *** 3879,3884 ****
387 --- 3879,3899 ----
388    * Scrollbar stuff:
389    */
390   
391 + /*
392 +  * Called when something in the window layout has changed.
393 +  */
394 +     void
395 + gui_may_update_scrollbars()
396 + {
397 +     if (gui.in_use && starting == 0)
398 +     {
399 +       out_flush();
400 +       gui_init_which_components(NULL);
401 +       gui_update_scrollbars(TRUE);
402 +     }
403 +     need_mouse_correct = TRUE;
404 + }
405
406       void
407   gui_update_scrollbars(force)
408       int               force;      /* Force all scrollbars to get updated */
409 *** ../vim-7.2.202/src/if_perl.xs       2008-12-03 13:18:16.000000000 +0100
410 --- src/if_perl.xs      2009-06-03 17:52:51.000000000 +0200
411 ***************
412 *** 1234,1240 ****
413                     {
414                         ml_delete(lnum, 0);
415                         deleted_lines_mark(lnum, 1L);
416 !                       if (aco.save_buf == curbuf)
417                             check_cursor();
418                     }
419   
420 --- 1236,1242 ----
421                     {
422                         ml_delete(lnum, 0);
423                         deleted_lines_mark(lnum, 1L);
424 !                       if (aco.save_curbuf == curbuf)
425                             check_cursor();
426                     }
427   
428 *** ../vim-7.2.202/src/proto/gui.pro    2007-05-05 19:42:19.000000000 +0200
429 --- src/proto/gui.pro   2009-06-11 20:58:08.000000000 +0200
430 ***************
431 *** 43,48 ****
432 --- 43,49 ----
433   void gui_create_scrollbar __ARGS((scrollbar_T *sb, int type, win_T *wp));
434   scrollbar_T *gui_find_scrollbar __ARGS((long ident));
435   void gui_drag_scrollbar __ARGS((scrollbar_T *sb, long value, int still_dragging));
436 + void gui_may_update_scrollbars __ARGS((void));
437   void gui_update_scrollbars __ARGS((int force));
438   int gui_do_scroll __ARGS((void));
439   int gui_do_horiz_scroll __ARGS((void));
440 *** ../vim-7.2.202/src/proto/window.pro 2007-07-26 22:57:45.000000000 +0200
441 --- src/proto/window.pro        2009-06-10 21:20:39.000000000 +0200
442 ***************
443 *** 1,6 ****
444 --- 1,7 ----
445   /* window.c */
446   void do_window __ARGS((int nchar, long Prenum, int xchar));
447   int win_split __ARGS((int size, int flags));
448 + int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
449   int win_valid __ARGS((win_T *win));
450   int win_count __ARGS((void));
451   int make_windows __ARGS((int count, int vertical));
452 ***************
453 *** 10,18 ****
454 --- 11,21 ----
455   void win_close __ARGS((win_T *win, int free_buf));
456   void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp));
457   void win_free_all __ARGS((void));
458 + win_T *winframe_remove __ARGS((win_T *win, int *dirp, tabpage_T *tp));
459   void close_others __ARGS((int message, int forceit));
460   void curwin_init __ARGS((void));
461   int win_alloc_first __ARGS((void));
462 + void win_alloc_aucmd_win __ARGS((void));
463   void win_init_size __ARGS((void));
464   void free_tabpage __ARGS((tabpage_T *tp));
465   int win_new_tabpage __ARGS((int after));
466 ***************
467 *** 30,35 ****
468 --- 33,40 ----
469   void win_enter __ARGS((win_T *wp, int undo_sync));
470   win_T *buf_jump_open_win __ARGS((buf_T *buf));
471   win_T *buf_jump_open_tab __ARGS((buf_T *buf));
472 + void win_append __ARGS((win_T *after, win_T *wp));
473 + void win_remove __ARGS((win_T *wp, tabpage_T *tp));
474   int win_alloc_lines __ARGS((win_T *wp));
475   void win_free_lsize __ARGS((win_T *wp));
476   void shell_new_rows __ARGS((void));
477 ***************
478 *** 58,63 ****
479 --- 63,70 ----
480   int min_rows __ARGS((void));
481   int only_one_window __ARGS((void));
482   void check_lnums __ARGS((int do_curwin));
483 + void make_snapshot __ARGS((int idx));
484 + void restore_snapshot __ARGS((int idx, int close_curwin));
485   int win_hasvertsplit __ARGS((void));
486   int match_add __ARGS((win_T *wp, char_u *grp, char_u *pat, int prio, int id));
487   int match_delete __ARGS((win_T *wp, int id, int perr));
488 *** ../vim-7.2.202/src/screen.c 2009-05-17 13:30:58.000000000 +0200
489 --- src/screen.c        2009-06-10 16:41:45.000000000 +0200
490 ***************
491 *** 7495,7500 ****
492 --- 7495,7504 ----
493   #endif
494         }
495       }
496 + #ifdef FEAT_AUTOCMD
497 +     if (aucmd_win != NULL && win_alloc_lines(aucmd_win) == FAIL)
498 +       outofmem = TRUE;
499 + #endif
500   #ifdef FEAT_WINDOWS
501   give_up:
502   #endif
503 *** ../vim-7.2.202/src/structs.h        2009-05-16 16:36:25.000000000 +0200
504 --- src/structs.h       2009-06-13 12:51:56.000000000 +0200
505 ***************
506 *** 1621,1626 ****
507 --- 1621,1634 ----
508   };
509   #endif
510   
511 + #define SNAP_HELP_IDX 0
512 + #ifdef FEAT_AUTOCMD
513 + # define SNAP_AUCMD_IDX 1
514 + # define SNAP_COUNT   2
515 + #else
516 + # define SNAP_COUNT   1
517 + #endif
518
519   /*
520    * Tab pages point to the top frame of each tab page.
521    * Note: Most values are NOT valid for the current tab page!  Use "curwin",
522 ***************
523 *** 1649,1655 ****
524       buf_T         *(tp_diffbuf[DB_COUNT]);
525       int                   tp_diff_invalid;    /* list of diffs is outdated */
526   #endif
527 !     frame_T       *tp_snapshot;    /* window layout snapshot */
528   #ifdef FEAT_EVAL
529       dictitem_T            tp_winvar;      /* variable for "t:" Dictionary */
530       dict_T        tp_vars;        /* internal variables, local to tab page */
531 --- 1657,1663 ----
532       buf_T         *(tp_diffbuf[DB_COUNT]);
533       int                   tp_diff_invalid;    /* list of diffs is outdated */
534   #endif
535 !     frame_T       *(tp_snapshot[SNAP_COUNT]);  /* window layout snapshots */
536   #ifdef FEAT_EVAL
537       dictitem_T            tp_winvar;      /* variable for "t:" Dictionary */
538       dict_T        tp_vars;        /* internal variables, local to tab page */
539 ***************
540 *** 2276,2291 ****
541    */
542   typedef struct
543   {
544 !     buf_T     *save_buf;      /* saved curbuf */
545   #ifdef FEAT_AUTOCMD
546 !     buf_T     *new_curbuf;    /* buffer to be used */
547 !     win_T     *save_curwin;   /* saved curwin, NULL if it didn't change */
548 !     win_T     *new_curwin;    /* new curwin if save_curwin != NULL */
549 !     pos_T     save_cursor;    /* saved cursor pos of save_curwin */
550 !     linenr_T  save_topline;   /* saved topline of save_curwin */
551 ! # ifdef FEAT_DIFF
552 !     int               save_topfill;   /* saved topfill of save_curwin */
553 ! # endif
554   #endif
555   } aco_save_T;
556   
557 --- 2284,2294 ----
558    */
559   typedef struct
560   {
561 !     buf_T     *save_curbuf;   /* saved curbuf */
562   #ifdef FEAT_AUTOCMD
563 !     win_T     *save_curwin;   /* saved curwin */
564 !     win_T     *new_curwin;    /* new curwin */
565 !     buf_T     *new_curbuf;    /* new curbuf */
566   #endif
567   } aco_save_T;
568   
569 *** ../vim-7.2.202/src/window.c 2009-05-21 23:25:38.000000000 +0200
570 --- src/window.c        2009-06-12 22:29:33.000000000 +0200
571 ***************
572 *** 11,18 ****
573   
574   static int path_is_url __ARGS((char_u *p));
575   #if defined(FEAT_WINDOWS) || defined(PROTO)
576 - static int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
577   static void win_init __ARGS((win_T *newp, win_T *oldp, int flags));
578   static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
579   static void frame_setheight __ARGS((frame_T *curfrp, int height));
580   #ifdef FEAT_VERTSPLIT
581 --- 11,18 ----
582   
583   static int path_is_url __ARGS((char_u *p));
584   #if defined(FEAT_WINDOWS) || defined(PROTO)
585   static void win_init __ARGS((win_T *newp, win_T *oldp, int flags));
586 + static void win_init_some __ARGS((win_T *newp, win_T *oldp));
587   static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
588   static void frame_setheight __ARGS((frame_T *curfrp, int height));
589   #ifdef FEAT_VERTSPLIT
590 ***************
591 *** 23,30 ****
592   static void win_totop __ARGS((int size, int flags));
593   static void win_equal_rec __ARGS((win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height));
594   static int last_window __ARGS((void));
595   static win_T *win_free_mem __ARGS((win_T *win, int *dirp, tabpage_T *tp));
596 - static win_T *winframe_remove __ARGS((win_T *win, int *dirp, tabpage_T *tp));
597   static frame_T *win_altframe __ARGS((win_T *win, tabpage_T *tp));
598   static tabpage_T *alt_tabpage __ARGS((void));
599   static win_T *frame2win __ARGS((frame_T *frp));
600 --- 23,30 ----
601   static void win_totop __ARGS((int size, int flags));
602   static void win_equal_rec __ARGS((win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height));
603   static int last_window __ARGS((void));
604 + static int one_window __ARGS((void));
605   static win_T *win_free_mem __ARGS((win_T *win, int *dirp, tabpage_T *tp));
606   static frame_T *win_altframe __ARGS((win_T *win, tabpage_T *tp));
607   static tabpage_T *alt_tabpage __ARGS((void));
608   static win_T *frame2win __ARGS((frame_T *frp));
609 ***************
610 *** 41,46 ****
611 --- 41,47 ----
612   #endif
613   #endif
614   static int win_alloc_firstwin __ARGS((win_T *oldwin));
615 + static void new_frame __ARGS((win_T *wp));
616   #if defined(FEAT_WINDOWS) || defined(PROTO)
617   static tabpage_T *alloc_tabpage __ARGS((void));
618   static int leave_tabpage __ARGS((buf_T *new_curbuf));
619 ***************
620 *** 49,56 ****
621   static int frame_minheight __ARGS((frame_T *topfrp, win_T *next_curwin));
622   static void win_enter_ext __ARGS((win_T *wp, int undo_sync, int no_curwin));
623   static void win_free __ARGS((win_T *wp, tabpage_T *tp));
624 - static void win_append __ARGS((win_T *, win_T *));
625 - static void win_remove __ARGS((win_T *, tabpage_T *tp));
626   static void frame_append __ARGS((frame_T *after, frame_T *frp));
627   static void frame_insert __ARGS((frame_T *before, frame_T *frp));
628   static void frame_remove __ARGS((frame_T *frp));
629 --- 50,55 ----
630 ***************
631 *** 62,78 ****
632   static void frame_add_height __ARGS((frame_T *frp, int n));
633   static void last_status_rec __ARGS((frame_T *fr, int statusline));
634   
635 - static void make_snapshot __ARGS((void));
636   static void make_snapshot_rec __ARGS((frame_T *fr, frame_T **frp));
637 ! static void clear_snapshot __ARGS((tabpage_T *tp));
638   static void clear_snapshot_rec __ARGS((frame_T *fr));
639 - static void restore_snapshot __ARGS((int close_curwin));
640   static int check_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
641   static win_T *restore_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
642   
643   #endif /* FEAT_WINDOWS */
644   
645 ! static win_T *win_alloc __ARGS((win_T *after));
646   static void win_new_height __ARGS((win_T *, int));
647   
648   #define URL_SLASH     1               /* path_is_url() has found "://" */
649 --- 61,75 ----
650   static void frame_add_height __ARGS((frame_T *frp, int n));
651   static void last_status_rec __ARGS((frame_T *fr, int statusline));
652   
653   static void make_snapshot_rec __ARGS((frame_T *fr, frame_T **frp));
654 ! static void clear_snapshot __ARGS((tabpage_T *tp, int idx));
655   static void clear_snapshot_rec __ARGS((frame_T *fr));
656   static int check_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
657   static win_T *restore_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
658   
659   #endif /* FEAT_WINDOWS */
660   
661 ! static win_T *win_alloc __ARGS((win_T *after, int hidden));
662   static void win_new_height __ARGS((win_T *, int));
663   
664   #define URL_SLASH     1               /* path_is_url() has found "://" */
665 ***************
666 *** 259,265 ****
667   /* cursor to previous window with wrap around */
668       case 'W':
669                 CHECK_CMDWIN
670 !               if (lastwin == firstwin && Prenum != 1) /* just one window */
671                     beep_flush();
672                 else
673                 {
674 --- 256,262 ----
675   /* cursor to previous window with wrap around */
676       case 'W':
677                 CHECK_CMDWIN
678 !               if (firstwin == lastwin && Prenum != 1) /* just one window */
679                     beep_flush();
680                 else
681                 {
682 ***************
683 *** 343,349 ****
684   
685   /* move window to new tab page */
686       case 'T':
687 !               if (firstwin == lastwin)
688                     MSG(_(m_onlyone));
689                 else
690                 {
691 --- 340,346 ----
692   
693   /* move window to new tab page */
694       case 'T':
695 !               if (one_window())
696                     MSG(_(m_onlyone));
697                 else
698                 {
699 ***************
700 *** 679,687 ****
701       /* When creating the help window make a snapshot of the window layout.
702        * Otherwise clear the snapshot, it's now invalid. */
703       if (flags & WSP_HELP)
704 !       make_snapshot();
705       else
706 !       clear_snapshot(curtab);
707   
708       return win_split_ins(size, flags, NULL, 0);
709   }
710 --- 676,684 ----
711       /* When creating the help window make a snapshot of the window layout.
712        * Otherwise clear the snapshot, it's now invalid. */
713       if (flags & WSP_HELP)
714 !       make_snapshot(SNAP_HELP_IDX);
715       else
716 !       clear_snapshot(curtab, SNAP_HELP_IDX);
717   
718       return win_split_ins(size, flags, NULL, 0);
719   }
720 ***************
721 *** 692,698 ****
722    * top/left/right/bottom.
723    * return FAIL for failure, OK otherwise
724    */
725 !     static int
726   win_split_ins(size, flags, newwin, dir)
727       int               size;
728       int               flags;
729 --- 689,695 ----
730    * top/left/right/bottom.
731    * return FAIL for failure, OK otherwise
732    */
733 !     int
734   win_split_ins(size, flags, newwin, dir)
735       int               size;
736       int               flags;
737 ***************
738 *** 893,906 ****
739       {
740         /* new window below/right of current one */
741         if (newwin == NULL)
742 !           wp = win_alloc(oldwin);
743         else
744             win_append(oldwin, wp);
745       }
746       else
747       {
748         if (newwin == NULL)
749 !           wp = win_alloc(oldwin->w_prev);
750         else
751             win_append(oldwin->w_prev, wp);
752       }
753 --- 890,903 ----
754       {
755         /* new window below/right of current one */
756         if (newwin == NULL)
757 !           wp = win_alloc(oldwin, FALSE);
758         else
759             win_append(oldwin, wp);
760       }
761       else
762       {
763         if (newwin == NULL)
764 !           wp = win_alloc(oldwin->w_prev, FALSE);
765         else
766             win_append(oldwin->w_prev, wp);
767       }
768 ***************
769 *** 910,915 ****
770 --- 907,919 ----
771         if (wp == NULL)
772             return FAIL;
773   
774 +       new_frame(wp);
775 +       if (wp->w_frame == NULL)
776 +       {
777 +           win_free(wp, NULL);
778 +           return FAIL;
779 +       }
780
781         /* make the contents of the new window the same as the current one */
782         win_init(wp, curwin, flags);
783       }
784 ***************
785 *** 970,982 ****
786       }
787   
788       if (newwin == NULL)
789 !     {
790 !       /* Create a frame for the new window. */
791 !       frp = (frame_T *)alloc_clear((unsigned)sizeof(frame_T));
792 !       frp->fr_layout = FR_LEAF;
793 !       frp->fr_win = wp;
794 !       wp->w_frame = frp;
795 !     }
796       else
797         frp = newwin->w_frame;
798       frp->fr_parent = curfrp->fr_parent;
799 --- 974,980 ----
800       }
801   
802       if (newwin == NULL)
803 !       frp = wp->w_frame;
804       else
805         frp = newwin->w_frame;
806       frp->fr_parent = curfrp->fr_parent;
807 ***************
808 *** 1156,1161 ****
809 --- 1154,1160 ----
810       return OK;
811   }
812   
813
814   /*
815    * Initialize window "newp" from window "oldp".
816    * Used when splitting a window and when creating a new tab page.
817 ***************
818 *** 1204,1217 ****
819       if (oldp->w_localdir != NULL)
820         newp->w_localdir = vim_strsave(oldp->w_localdir);
821   
822 !     /* Use the same argument list. */
823 !     newp->w_alist = oldp->w_alist;
824 !     ++newp->w_alist->al_refcount;
825 !     newp->w_arg_idx = oldp->w_arg_idx;
826
827 !     /*
828 !      * copy tagstack and options from existing window
829 !      */
830       for (i = 0; i < oldp->w_tagstacklen; i++)
831       {
832         newp->w_tagstack[i] = oldp->w_tagstack[i];
833 --- 1203,1209 ----
834       if (oldp->w_localdir != NULL)
835         newp->w_localdir = vim_strsave(oldp->w_localdir);
836   
837 !     /* copy tagstack and folds */
838       for (i = 0; i < oldp->w_tagstacklen; i++)
839       {
840         newp->w_tagstack[i] = oldp->w_tagstack[i];
841 ***************
842 *** 1221,1230 ****
843       }
844       newp->w_tagstackidx = oldp->w_tagstackidx;
845       newp->w_tagstacklen = oldp->w_tagstacklen;
846 -     win_copy_options(oldp, newp);
847   # ifdef FEAT_FOLDING
848       copyFoldingState(oldp, newp);
849   # endif
850   }
851   
852   #endif /* FEAT_WINDOWS */
853 --- 1213,1241 ----
854       }
855       newp->w_tagstackidx = oldp->w_tagstackidx;
856       newp->w_tagstacklen = oldp->w_tagstacklen;
857   # ifdef FEAT_FOLDING
858       copyFoldingState(oldp, newp);
859   # endif
860
861 +     win_init_some(newp, oldp);
862 + }
863
864 + /*
865 +  * Initialize window "newp" from window"old".
866 +  * Only the essential things are copied.
867 +  */
868 +     static void
869 + win_init_some(newp, oldp)
870 +     win_T     *newp;
871 +     win_T     *oldp;
872 + {
873 +     /* Use the same argument list. */
874 +     newp->w_alist = oldp->w_alist;
875 +     ++newp->w_alist->al_refcount;
876 +     newp->w_arg_idx = oldp->w_arg_idx;
877
878 +     /* copy options from existing window */
879 +     win_copy_options(oldp, newp);
880   }
881   
882   #endif /* FEAT_WINDOWS */
883 ***************
884 *** 1565,1579 ****
885   #if defined(FEAT_GUI) && defined(FEAT_VERTSPLIT)
886       /* When 'guioptions' includes 'L' or 'R' may have to remove or add
887        * scrollbars.  Have to update them anyway. */
888 !     if (gui.in_use)
889 !     {
890 !       out_flush();
891 !       gui_init_which_components(NULL);
892 !       gui_update_scrollbars(TRUE);
893 !     }
894 !     need_mouse_correct = TRUE;
895   #endif
896
897   }
898   
899   /*
900 --- 1576,1583 ----
901   #if defined(FEAT_GUI) && defined(FEAT_VERTSPLIT)
902       /* When 'guioptions' includes 'L' or 'R' may have to remove or add
903        * scrollbars.  Have to update them anyway. */
904 !     gui_may_update_scrollbars();
905   #endif
906   }
907   
908   /*
909 ***************
910 *** 2048,2060 ****
911   }
912   
913   /*
914 !  * Return TRUE if the current window is the only window that exists.
915    * Returns FALSE if there is a window, possibly in another tab page.
916    */
917       static int
918   last_window()
919   {
920 !     return (lastwin == firstwin && first_tabpage->tp_next == NULL);
921   }
922   
923   /*
924 --- 2052,2091 ----
925   }
926   
927   /*
928 !  * Return TRUE if the current window is the only window that exists (ignoring
929 !  * "aucmd_win").
930    * Returns FALSE if there is a window, possibly in another tab page.
931    */
932       static int
933   last_window()
934   {
935 !     return (one_window() && first_tabpage->tp_next == NULL);
936 ! }
937
938 ! /*
939 !  * Return TRUE if there is only one window other than "aucmd_win" in the
940 !  * current tab page.
941 !  */
942 !     static int
943 ! one_window()
944 ! {
945 ! #ifdef FEAT_AUTOCMD
946 !     win_T     *wp;
947 !     int               seen_one = FALSE;
948
949 !     FOR_ALL_WINDOWS(wp)
950 !     {
951 !       if (wp != aucmd_win)
952 !       {
953 !           if (seen_one)
954 !               return FALSE;
955 !           seen_one = TRUE;
956 !       }
957 !     }
958 !     return TRUE;
959 ! #else
960 !     return firstwin == lastwin;
961 ! #endif
962   }
963   
964   /*
965 ***************
966 *** 2083,2088 ****
967 --- 2114,2132 ----
968         return;
969       }
970   
971 + #ifdef FEAT_AUTOCMD
972 +     if (win == aucmd_win)
973 +     {
974 +       EMSG(_("E813: Cannot close autocmd window"));
975 +       return;
976 +     }
977 +     if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window())
978 +     {
979 +       EMSG(_("E814: Cannot close window, only autocmd window would remain"));
980 +       return;
981 +     }
982 + #endif
983
984       /*
985        * When closing the last window in a tab page first go to another tab
986        * page and then close the window and the tab page.  This avoids that
987 ***************
988 *** 2112,2118 ****
989       if (win->w_buffer->b_help)
990         help_window = TRUE;
991       else
992 !       clear_snapshot(curtab);
993   
994   #ifdef FEAT_AUTOCMD
995       if (win == curwin)
996 --- 2156,2162 ----
997       if (win->w_buffer->b_help)
998         help_window = TRUE;
999       else
1000 !       clear_snapshot(curtab, SNAP_HELP_IDX);
1001   
1002   #ifdef FEAT_AUTOCMD
1003       if (win == curwin)
1004 ***************
1005 *** 2229,2235 ****
1006       /* After closing the help window, try restoring the window layout from
1007        * before it was opened. */
1008       if (help_window)
1009 !       restore_snapshot(close_curwin);
1010   
1011   #if defined(FEAT_GUI) && defined(FEAT_VERTSPLIT)
1012       /* When 'guioptions' includes 'L' or 'R' may have to remove scrollbars. */
1013 --- 2273,2279 ----
1014       /* After closing the help window, try restoring the window layout from
1015        * before it was opened. */
1016       if (help_window)
1017 !       restore_snapshot(SNAP_HELP_IDX, close_curwin);
1018   
1019   #if defined(FEAT_GUI) && defined(FEAT_VERTSPLIT)
1020       /* When 'guioptions' includes 'L' or 'R' may have to remove scrollbars. */
1021 ***************
1022 *** 2344,2349 ****
1023 --- 2388,2401 ----
1024   
1025       while (firstwin != NULL)
1026         (void)win_free_mem(firstwin, &dummy, NULL);
1027
1028 + # ifdef FEAT_AUTOCMD
1029 +     if (aucmd_win != NULL)
1030 +     {
1031 +       (void)win_free_mem(aucmd_win, &dummy, NULL);
1032 +       aucmd_win = NULL;
1033 +     }
1034 + # endif
1035   }
1036   #endif
1037   
1038 ***************
1039 *** 2351,2357 ****
1040    * Remove a window and its frame from the tree of frames.
1041    * Returns a pointer to the window that got the freed up space.
1042    */
1043 !     static win_T *
1044   winframe_remove(win, dirp, tp)
1045       win_T     *win;
1046       int               *dirp UNUSED;   /* set to 'v' or 'h' for direction if 'ea' */
1047 --- 2403,2409 ----
1048    * Remove a window and its frame from the tree of frames.
1049    * Returns a pointer to the window that got the freed up space.
1050    */
1051 !     win_T *
1052   winframe_remove(win, dirp, tp)
1053       win_T     *win;
1054       int               *dirp UNUSED;   /* set to 'v' or 'h' for direction if 'ea' */
1055 ***************
1056 *** 3090,3096 ****
1057       win_T     *nextwp;
1058       int               r;
1059   
1060 !     if (lastwin == firstwin)
1061       {
1062         if (message
1063   #ifdef FEAT_AUTOCMD
1064 --- 3142,3148 ----
1065       win_T     *nextwp;
1066       int               r;
1067   
1068 !     if (one_window())
1069       {
1070         if (message
1071   #ifdef FEAT_AUTOCMD
1072 ***************
1073 *** 3194,3202 ****
1074 --- 3246,3275 ----
1075       first_tabpage->tp_topframe = topframe;
1076       curtab = first_tabpage;
1077   #endif
1078
1079       return OK;
1080   }
1081   
1082 + #if defined(FEAT_AUTOCMD) || defined(PROTO)
1083 + /*
1084 +  * Init "aucmd_win".  This can only be done after the first
1085 +  * window is fully initialized, thus it can't be in win_alloc_first().
1086 +  */
1087 +     void
1088 + win_alloc_aucmd_win()
1089 + {
1090 +     aucmd_win = win_alloc(NULL, TRUE);
1091 +     if (aucmd_win != NULL)
1092 +     {
1093 +       win_init_some(aucmd_win, curwin);
1094 + # ifdef FEAT_SCROLLBIND
1095 +       aucmd_win->w_p_scb = FALSE;
1096 + # endif
1097 +       new_frame(aucmd_win);
1098 +     }
1099 + }
1100 + #endif
1101
1102   /*
1103    * Allocate the first window or the first window in a new tab page.
1104    * When "oldwin" is NULL create an empty buffer for it.
1105 ***************
1106 *** 3208,3214 ****
1107   win_alloc_firstwin(oldwin)
1108       win_T     *oldwin;
1109   {
1110 !     curwin = win_alloc(NULL);
1111       if (oldwin == NULL)
1112       {
1113         /* Very first window, need to create an empty buffer for it and
1114 --- 3281,3287 ----
1115   win_alloc_firstwin(oldwin)
1116       win_T     *oldwin;
1117   {
1118 !     curwin = win_alloc(NULL, FALSE);
1119       if (oldwin == NULL)
1120       {
1121         /* Very first window, need to create an empty buffer for it and
1122 ***************
1123 *** 3236,3256 ****
1124       }
1125   #endif
1126   
1127 !     topframe = (frame_T *)alloc_clear((unsigned)sizeof(frame_T));
1128 !     if (topframe == NULL)
1129         return FAIL;
1130 !     topframe->fr_layout = FR_LEAF;
1131   #ifdef FEAT_VERTSPLIT
1132       topframe->fr_width = Columns;
1133   #endif
1134       topframe->fr_height = Rows - p_ch;
1135       topframe->fr_win = curwin;
1136 -     curwin->w_frame = topframe;
1137   
1138       return OK;
1139   }
1140   
1141   /*
1142    * Initialize the window and frame size to the maximum.
1143    */
1144       void
1145 --- 3309,3344 ----
1146       }
1147   #endif
1148   
1149 !     new_frame(curwin);
1150 !     if (curwin->w_frame == NULL)
1151         return FAIL;
1152 !     topframe = curwin->w_frame;
1153   #ifdef FEAT_VERTSPLIT
1154       topframe->fr_width = Columns;
1155   #endif
1156       topframe->fr_height = Rows - p_ch;
1157       topframe->fr_win = curwin;
1158   
1159       return OK;
1160   }
1161   
1162   /*
1163 +  * Create a frame for window "wp".
1164 +  */
1165 +     static void
1166 + new_frame(win_T *wp)
1167 + {
1168 +     frame_T *frp = (frame_T *)alloc_clear((unsigned)sizeof(frame_T));
1169
1170 +     wp->w_frame = frp;
1171 +     if (frp != NULL)
1172 +     {
1173 +       frp->fr_layout = FR_LEAF;
1174 +       frp->fr_win = wp;
1175 +     }
1176 + }
1177
1178 + /*
1179    * Initialize the window and frame size to the maximum.
1180    */
1181       void
1182 ***************
1183 *** 3300,3309 ****
1184   free_tabpage(tp)
1185       tabpage_T *tp;
1186   {
1187   # ifdef FEAT_DIFF
1188       diff_clear(tp);
1189   # endif
1190 !     clear_snapshot(tp);
1191   #ifdef FEAT_EVAL
1192       vars_clear(&tp->tp_vars.dv_hashtab);      /* free all t: variables */
1193   #endif
1194 --- 3388,3400 ----
1195   free_tabpage(tp)
1196       tabpage_T *tp;
1197   {
1198 +     int idx;
1199
1200   # ifdef FEAT_DIFF
1201       diff_clear(tp);
1202   # endif
1203 !     for (idx = 0; idx < SNAP_COUNT; ++idx)
1204 !       clear_snapshot(tp, idx);
1205   #ifdef FEAT_EVAL
1206       vars_clear(&tp->tp_vars.dv_hashtab);      /* free all t: variables */
1207   #endif
1208 ***************
1209 *** 3370,3381 ****
1210   #if defined(FEAT_GUI)
1211         /* When 'guioptions' includes 'L' or 'R' may have to remove or add
1212          * scrollbars.  Have to update them anyway. */
1213 !       if (gui.in_use && starting == 0)
1214 !       {
1215 !           gui_init_which_components(NULL);
1216 !           gui_update_scrollbars(TRUE);
1217 !       }
1218 !       need_mouse_correct = TRUE;
1219   #endif
1220   
1221         redraw_all_later(CLEAR);
1222 --- 3461,3467 ----
1223   #if defined(FEAT_GUI)
1224         /* When 'guioptions' includes 'L' or 'R' may have to remove or add
1225          * scrollbars.  Have to update them anyway. */
1226 !       gui_may_update_scrollbars();
1227   #endif
1228   
1229         redraw_all_later(CLEAR);
1230 ***************
1231 *** 3593,3604 ****
1232   #if defined(FEAT_GUI)
1233       /* When 'guioptions' includes 'L' or 'R' may have to remove or add
1234        * scrollbars.  Have to update them anyway. */
1235 !     if (gui.in_use && starting == 0)
1236 !     {
1237 !       gui_init_which_components(NULL);
1238 !       gui_update_scrollbars(TRUE);
1239 !     }
1240 !     need_mouse_correct = TRUE;
1241   #endif
1242   
1243       redraw_all_later(CLEAR);
1244 --- 3679,3685 ----
1245   #if defined(FEAT_GUI)
1246       /* When 'guioptions' includes 'L' or 'R' may have to remove or add
1247        * scrollbars.  Have to update them anyway. */
1248 !     gui_may_update_scrollbars();
1249   #endif
1250   
1251       redraw_all_later(CLEAR);
1252 ***************
1253 *** 4150,4160 ****
1254   #endif
1255   
1256   /*
1257 !  * allocate a window structure and link it in the window list
1258    */
1259       static win_T *
1260 ! win_alloc(after)
1261       win_T     *after UNUSED;
1262   {
1263       win_T     *newwin;
1264   
1265 --- 4231,4243 ----
1266   #endif
1267   
1268   /*
1269 !  * Allocate a window structure and link it in the window list when "hidden" is
1270 !  * FALSE.
1271    */
1272       static win_T *
1273 ! win_alloc(after, hidden)
1274       win_T     *after UNUSED;
1275 +     int               hidden UNUSED;
1276   {
1277       win_T     *newwin;
1278   
1279 ***************
1280 *** 4180,4186 ****
1281          * link the window in the window list
1282          */
1283   #ifdef FEAT_WINDOWS
1284 !       win_append(after, newwin);
1285   #endif
1286   #ifdef FEAT_VERTSPLIT
1287         newwin->w_wincol = 0;
1288 --- 4263,4270 ----
1289          * link the window in the window list
1290          */
1291   #ifdef FEAT_WINDOWS
1292 !       if (!hidden)
1293 !           win_append(after, newwin);
1294   #endif
1295   #ifdef FEAT_VERTSPLIT
1296         newwin->w_wincol = 0;
1297 ***************
1298 *** 4314,4320 ****
1299   /*
1300    * Append window "wp" in the window list after window "after".
1301    */
1302 !     static void
1303   win_append(after, wp)
1304       win_T     *after, *wp;
1305   {
1306 --- 4398,4404 ----
1307   /*
1308    * Append window "wp" in the window list after window "after".
1309    */
1310 !     void
1311   win_append(after, wp)
1312       win_T     *after, *wp;
1313   {
1314 ***************
1315 *** 4340,4346 ****
1316   /*
1317    * Remove a window from the window list.
1318    */
1319 !     static void
1320   win_remove(wp, tp)
1321       win_T     *wp;
1322       tabpage_T *tp;            /* tab page "win" is in, NULL for current */
1323 --- 4424,4430 ----
1324   /*
1325    * Remove a window from the window list.
1326    */
1327 !     void
1328   win_remove(wp, tp)
1329       win_T     *wp;
1330       tabpage_T *tp;            /* tab page "win" is in, NULL for current */
1331 ***************
1332 *** 6040,6045 ****
1333 --- 6124,6130 ----
1334   /*
1335    * Return TRUE if there is only one window (in the current tab page), not
1336    * counting a help or preview window, unless it is the current window.
1337 +  * Does not count "aucmd_win".
1338    */
1339       int
1340   only_one_window()
1341 ***************
1342 *** 6053,6063 ****
1343         return FALSE;
1344   
1345       for (wp = firstwin; wp != NULL; wp = wp->w_next)
1346 !       if (!((wp->w_buffer->b_help && !curbuf->b_help)
1347   # ifdef FEAT_QUICKFIX
1348                     || wp->w_p_pvw
1349   # endif
1350              ) || wp == curwin)
1351             ++count;
1352       return (count <= 1);
1353   #else
1354 --- 6138,6152 ----
1355         return FALSE;
1356   
1357       for (wp = firstwin; wp != NULL; wp = wp->w_next)
1358 !       if ((!((wp->w_buffer->b_help && !curbuf->b_help)
1359   # ifdef FEAT_QUICKFIX
1360                     || wp->w_p_pvw
1361   # endif
1362              ) || wp == curwin)
1363 + # ifdef FEAT_AUTOCMD
1364 +               && wp != aucmd_win
1365 + # endif
1366 +          )
1367             ++count;
1368       return (count <= 1);
1369   #else
1370 ***************
1371 *** 6112,6122 ****
1372   /*
1373    * Create a snapshot of the current frame sizes.
1374    */
1375 !     static void
1376 ! make_snapshot()
1377   {
1378 !     clear_snapshot(curtab);
1379 !     make_snapshot_rec(topframe, &curtab->tp_snapshot);
1380   }
1381   
1382       static void
1383 --- 6201,6212 ----
1384   /*
1385    * Create a snapshot of the current frame sizes.
1386    */
1387 !     void
1388 ! make_snapshot(idx)
1389 !     int idx;
1390   {
1391 !     clear_snapshot(curtab, idx);
1392 !     make_snapshot_rec(topframe, &curtab->tp_snapshot[idx]);
1393   }
1394   
1395       static void
1396 ***************
1397 *** 6144,6154 ****
1398    * Remove any existing snapshot.
1399    */
1400       static void
1401 ! clear_snapshot(tp)
1402       tabpage_T *tp;
1403   {
1404 !     clear_snapshot_rec(tp->tp_snapshot);
1405 !     tp->tp_snapshot = NULL;
1406   }
1407   
1408       static void
1409 --- 6234,6245 ----
1410    * Remove any existing snapshot.
1411    */
1412       static void
1413 ! clear_snapshot(tp, idx)
1414       tabpage_T *tp;
1415 +     int               idx;
1416   {
1417 !     clear_snapshot_rec(tp->tp_snapshot[idx]);
1418 !     tp->tp_snapshot[idx] = NULL;
1419   }
1420   
1421       static void
1422 ***************
1423 *** 6168,6193 ****
1424    * This is only done if the screen size didn't change and the window layout is
1425    * still the same.
1426    */
1427 !     static void
1428 ! restore_snapshot(close_curwin)
1429       int               close_curwin;       /* closing current window */
1430   {
1431       win_T     *wp;
1432   
1433 !     if (curtab->tp_snapshot != NULL
1434   # ifdef FEAT_VERTSPLIT
1435 !           && curtab->tp_snapshot->fr_width == topframe->fr_width
1436   # endif
1437 !           && curtab->tp_snapshot->fr_height == topframe->fr_height
1438 !           && check_snapshot_rec(curtab->tp_snapshot, topframe) == OK)
1439       {
1440 !       wp = restore_snapshot_rec(curtab->tp_snapshot, topframe);
1441         win_comp_pos();
1442         if (wp != NULL && close_curwin)
1443             win_goto(wp);
1444         redraw_all_later(CLEAR);
1445       }
1446 !     clear_snapshot(curtab);
1447   }
1448   
1449   /*
1450 --- 6259,6285 ----
1451    * This is only done if the screen size didn't change and the window layout is
1452    * still the same.
1453    */
1454 !     void
1455 ! restore_snapshot(idx, close_curwin)
1456 !     int               idx;
1457       int               close_curwin;       /* closing current window */
1458   {
1459       win_T     *wp;
1460   
1461 !     if (curtab->tp_snapshot[idx] != NULL
1462   # ifdef FEAT_VERTSPLIT
1463 !           && curtab->tp_snapshot[idx]->fr_width == topframe->fr_width
1464   # endif
1465 !           && curtab->tp_snapshot[idx]->fr_height == topframe->fr_height
1466 !           && check_snapshot_rec(curtab->tp_snapshot[idx], topframe) == OK)
1467       {
1468 !       wp = restore_snapshot_rec(curtab->tp_snapshot[idx], topframe);
1469         win_comp_pos();
1470         if (wp != NULL && close_curwin)
1471             win_goto(wp);
1472         redraw_all_later(CLEAR);
1473       }
1474 !     clear_snapshot(curtab, idx);
1475   }
1476   
1477   /*
1478 *** ../vim-7.2.202/src/version.c        2009-06-16 15:35:46.000000000 +0200
1479 --- src/version.c       2009-06-16 15:37:16.000000000 +0200
1480 ***************
1481 *** 678,679 ****
1482 --- 678,681 ----
1483   {   /* Add new patch number below this line */
1484 + /**/
1485 +     203,
1486   /**/
1487
1488 -- 
1489 How To Keep A Healthy Level Of Insanity:
1490 15. Five days in advance, tell your friends you can't attend their
1491     party because you're not in the mood.
1492
1493  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
1494 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
1495 \\\        download, build and distribute -- http://www.A-A-P.org        ///
1496  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.169723 seconds and 3 git commands to generate.