comparison src/evalbuffer.c @ 31263:d8e7d725a666 v9.0.0965

patch 9.0.0965: using one window for executing autocommands is insufficient Commit: https://github.com/vim/vim/commit/e76062c078debed0df818f70e4db14ad7a7cb53a Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 28 18:51:43 2022 +0000 patch 9.0.0965: using one window for executing autocommands is insufficient Problem: Using one window for executing autocommands is insufficient. Solution: Use up to five windows for executing autocommands.
author Bram Moolenaar <Bram@vim.org>
date Mon, 28 Nov 2022 20:00:05 +0100
parents 87ff5e71d3c2
children 08e6a44e5c77
comparison
equal deleted inserted replaced
31262:7f766b7e17d5 31263:d8e7d725a666
134 * "buf" the current buffer and find a window for this buffer, so that side 134 * "buf" the current buffer and find a window for this buffer, so that side
135 * effects are done correctly (e.g., adjusting marks). 135 * effects are done correctly (e.g., adjusting marks).
136 * 136 *
137 * Information is saved in "cob" and MUST be restored by calling 137 * Information is saved in "cob" and MUST be restored by calling
138 * change_other_buffer_restore(). 138 * change_other_buffer_restore().
139 *
140 * If this fails then "curbuf" will not be equal to "buf".
139 */ 141 */
140 static void 142 static void
141 change_other_buffer_prepare(cob_T *cob, buf_T *buf) 143 change_other_buffer_prepare(cob_T *cob, buf_T *buf)
142 { 144 {
143 CLEAR_POINTER(cob); 145 CLEAR_POINTER(cob);
154 { 156 {
155 // No existing window for this buffer. It is dangerous to have 157 // No existing window for this buffer. It is dangerous to have
156 // curwin->w_buffer differ from "curbuf", use the autocmd window. 158 // curwin->w_buffer differ from "curbuf", use the autocmd window.
157 curbuf = curwin->w_buffer; 159 curbuf = curwin->w_buffer;
158 aucmd_prepbuf(&cob->cob_aco, buf); 160 aucmd_prepbuf(&cob->cob_aco, buf);
159 cob->cob_using_aco = TRUE; 161 if (curbuf == buf)
162 cob->cob_using_aco = TRUE;
160 } 163 }
161 } 164 }
162 165
163 static void 166 static void
164 change_other_buffer_restore(cob_T *cob) 167 change_other_buffer_restore(cob_T *cob)