]> git.pld-linux.org Git - packages/vim.git/blob - 7.2.241
- new
[packages/vim.git] / 7.2.241
1 To: vim-dev@vim.org
2 Subject: Patch 7.2.241
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.241
11 Problem:    When using a combination of ":bufdo" and "doautoall" we may end up
12             in the wrong directory. (Ajit Thakkar)
13             Crash when triggering an autocommand in ":vimgrep".  (Yukihiro
14             Nakadaira)
15 Solution:   Clear w_localdir and globaldir when using the aucmd_win.
16             Use a separate flag to decide aucmd_win needs to be restored.
17 Files:      src/fileio.c, src/globals.h, src/structs.h
18
19
20 *** ../vim-7.2.240/src/fileio.c 2009-07-01 17:11:40.000000000 +0200
21 --- src/fileio.c        2009-07-22 19:08:55.000000000 +0200
22 ***************
23 *** 8420,8425 ****
24 --- 8420,8429 ----
25         if (aucmd_win == NULL)
26             win = curwin;
27       }
28 +     if (win == NULL && aucmd_win_used)
29 +       /* Strange recursive autocommand, fall back to using the current
30 +        * window.  Expect a few side effects... */
31 +       win = curwin;
32   
33       aco->save_curwin = curwin;
34       aco->save_curbuf = curbuf;
35 ***************
36 *** 8428,8433 ****
37 --- 8432,8438 ----
38         /* There is a window for "buf" in the current tab page, make it the
39          * curwin.  This is preferred, it has the least side effects (esp. if
40          * "buf" is curbuf). */
41 +       aco->use_aucmd_win = FALSE;
42         curwin = win;
43       }
44       else
45 ***************
46 *** 8436,8444 ****
47 --- 8441,8460 ----
48          * effects, insert it in a the current tab page.
49          * Anything related to a window (e.g., setting folds) may have
50          * unexpected results. */
51 +       aco->use_aucmd_win = TRUE;
52 +       aucmd_win_used = TRUE;
53         aucmd_win->w_buffer = buf;
54         ++buf->b_nwindows;
55         win_init_empty(aucmd_win); /* set cursor and topline to safe values */
56 +       vim_free(aucmd_win->w_localdir);
57 +       aucmd_win->w_localdir = NULL;
58
59 +       /* Make sure w_localdir and globaldir are NULL to avoid a chdir() in
60 +        * win_enter_ext(). */
61 +       aucmd_win->w_localdir = NULL;
62 +       aco->globaldir = globaldir;
63 +       globaldir = NULL;
64
65   
66   #ifdef FEAT_WINDOWS
67         /* Split the current window, put the aucmd_win in the upper half.
68 ***************
69 *** 8472,8478 ****
70       int dummy;
71   #endif
72   
73 !     if (aco->new_curwin == aucmd_win)
74       {
75         --curbuf->b_nwindows;
76   #ifdef FEAT_WINDOWS
77 --- 8488,8494 ----
78       int dummy;
79   #endif
80   
81 !     if (aco->use_aucmd_win)
82       {
83         --curbuf->b_nwindows;
84   #ifdef FEAT_WINDOWS
85 ***************
86 *** 8499,8504 ****
87 --- 8515,8521 ----
88         /* Remove the window and frame from the tree of frames. */
89         (void)winframe_remove(curwin, &dummy, NULL);
90         win_remove(curwin, NULL);
91 +       aucmd_win_used = FALSE;
92         last_status(FALSE);         /* may need to remove last status line */
93         restore_snapshot(SNAP_AUCMD_IDX, FALSE);
94         (void)win_comp_pos();   /* recompute window positions */
95 ***************
96 *** 8517,8522 ****
97 --- 8534,8542 ----
98   #endif
99         curbuf = curwin->w_buffer;
100   
101 +       vim_free(globaldir);
102 +       globaldir = aco->globaldir;
103
104         /* the buffer contents may have changed */
105         check_cursor();
106         if (curwin->w_topline > curbuf->b_ml.ml_line_count)
107 ***************
108 *** 8541,8547 ****
109   #endif
110         {
111             /* Restore the buffer which was previously edited by curwin, if
112 !            * it was chagned, we are still the same window and the buffer is
113              * valid. */
114             if (curwin == aco->new_curwin
115                     && curbuf != aco->new_curbuf
116 --- 8561,8567 ----
117   #endif
118         {
119             /* Restore the buffer which was previously edited by curwin, if
120 !            * it was changed, we are still the same window and the buffer is
121              * valid. */
122             if (curwin == aco->new_curwin
123                     && curbuf != aco->new_curbuf
124 *** ../vim-7.2.240/src/globals.h        2009-06-16 16:01:34.000000000 +0200
125 --- src/globals.h       2009-07-22 19:50:53.000000000 +0200
126 ***************
127 *** 541,546 ****
128 --- 541,547 ----
129   
130   #ifdef FEAT_AUTOCMD
131   EXTERN win_T  *aucmd_win;     /* window used in aucmd_prepbuf() */
132 + EXTERN int    aucmd_win_used INIT(= FALSE);   /* aucmd_win is being used */
133   #endif
134   
135   /*
136 *** ../vim-7.2.240/src/structs.h        2009-07-09 18:24:24.000000000 +0200
137 --- src/structs.h       2009-07-22 18:58:35.000000000 +0200
138 ***************
139 *** 2288,2296 ****
140 --- 2288,2298 ----
141   {
142       buf_T     *save_curbuf;   /* saved curbuf */
143   #ifdef FEAT_AUTOCMD
144 +     int               use_aucmd_win;  /* using aucmd_win */
145       win_T     *save_curwin;   /* saved curwin */
146       win_T     *new_curwin;    /* new curwin */
147       buf_T     *new_curbuf;    /* new curbuf */
148 +     char_u    *globaldir;     /* saved value of globaldir */
149   #endif
150   } aco_save_T;
151   
152 *** ../vim-7.2.240/src/version.c        2009-07-29 11:10:31.000000000 +0200
153 --- src/version.c       2009-07-29 12:06:31.000000000 +0200
154 ***************
155 *** 678,679 ****
156 --- 678,681 ----
157   {   /* Add new patch number below this line */
158 + /**/
159 +     241,
160   /**/
161
162 -- 
163 hundred-and-one symptoms of being an internet addict:
164 114. You are counting items, you go "0,1,2,3,4,5,6,7,8,9,A,B,C,D...".
165
166  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
167 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
168 \\\        download, build and distribute -- http://www.A-A-P.org        ///
169  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.037852 seconds and 3 git commands to generate.