comparison src/buffer.c @ 20:4ac1dce8dd5e v7.0012

updated for version 7.0012
author vimboss
date Mon, 26 Jul 2004 12:53:41 +0000
parents 946da5994c01
children cc049b00ee70
comparison
equal deleted inserted replaced
19:a81bc802c17c 20:4ac1dce8dd5e
214 #else 214 #else
215 if (got_int) 215 if (got_int)
216 #endif 216 #endif
217 curbuf->b_flags |= BF_READERR; 217 curbuf->b_flags |= BF_READERR;
218 218
219 #ifdef FEAT_FOLDING
220 /* Need to update automatic folding. Do this before the autocommands,
221 * they may use the fold info. */
222 foldUpdateAll(curwin);
223 #endif
224
219 #ifdef FEAT_AUTOCMD 225 #ifdef FEAT_AUTOCMD
220 /* need to set w_topline, unless some autocommand already did that. */ 226 /* need to set w_topline, unless some autocommand already did that. */
221 if (!(curwin->w_valid & VALID_TOPLINE)) 227 if (!(curwin->w_valid & VALID_TOPLINE))
222 { 228 {
223 curwin->w_topline = 1; 229 curwin->w_topline = 1;
260 /* restore curwin/curbuf and a few other things */ 266 /* restore curwin/curbuf and a few other things */
261 aucmd_restbuf(&aco); 267 aucmd_restbuf(&aco);
262 } 268 }
263 #endif 269 #endif
264 } 270 }
265
266 #ifdef FEAT_FOLDING
267 /* Need to update automatic folding. */
268 foldUpdateAll(curwin);
269 #endif
270 271
271 return retval; 272 return retval;
272 } 273 }
273 274
274 /* 275 /*
406 #ifdef FEAT_AUTOCMD 407 #ifdef FEAT_AUTOCMD
407 /* Autocommands may have deleted the buffer. */ 408 /* Autocommands may have deleted the buffer. */
408 if (!buf_valid(buf)) 409 if (!buf_valid(buf))
409 return; 410 return;
410 # ifdef FEAT_EVAL 411 # ifdef FEAT_EVAL
411 /* Autocommands may abort script processing. */ 412 if (aborting()) /* autocmds may abort script processing */
412 if (aborting())
413 return; 413 return;
414 # endif 414 # endif
415 415
416 /* Autocommands may have opened or closed windows for this buffer. 416 /* Autocommands may have opened or closed windows for this buffer.
417 * Decrement the count for the close we do here. */ 417 * Decrement the count for the close we do here. */
536 FALSE, buf); 536 FALSE, buf);
537 if (!buf_valid(buf)) /* autocommands may delete the buffer */ 537 if (!buf_valid(buf)) /* autocommands may delete the buffer */
538 return; 538 return;
539 } 539 }
540 # ifdef FEAT_EVAL 540 # ifdef FEAT_EVAL
541 if (aborting()) /* autocmds may abort script processing */ 541 /* autocmds may abort script processing */
542 if (aborting())
542 return; 543 return;
543 # endif 544 # endif
544 545
545 /* 546 /*
546 * It's possible that autocommands change curbuf to the one being deleted. 547 * It's possible that autocommands change curbuf to the one being deleted.
667 start, dir, count, eap->forceit); 668 start, dir, count, eap->forceit);
668 # if defined(FEAT_WINDOWS) \ 669 # if defined(FEAT_WINDOWS) \
669 && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)) 670 && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG))
670 if (swap_exists_action == SEA_QUIT && *eap->cmd == 's') 671 if (swap_exists_action == SEA_QUIT && *eap->cmd == 's')
671 { 672 {
672 /* Quitting means closing the split window, nothing else. */ 673 int old_got_int = got_int;
674
675 /* Quitting means closing the split window, nothing else.
676 * Reset got_int here, because it causes aborting() to return TRUE
677 * which breaks closing a window. */
678 got_int = FALSE;
679
673 win_close(curwin, TRUE); 680 win_close(curwin, TRUE);
681
682 got_int |= old_got_int;
674 swap_exists_action = SEA_NONE; 683 swap_exists_action = SEA_NONE;
675 } 684 }
676 else 685 else
677 handle_swap_exists(old_curbuf); 686 handle_swap_exists(old_curbuf);
678 # endif 687 # endif
686 */ 695 */
687 void 696 void
688 handle_swap_exists(old_curbuf) 697 handle_swap_exists(old_curbuf)
689 buf_T *old_curbuf; 698 buf_T *old_curbuf;
690 { 699 {
700 int old_got_int = got_int;
701
702 /* Reset got_int here, because it causes aborting() to return TRUE which
703 * breaks closing a buffer. */
704 got_int = FALSE;
705
691 if (swap_exists_action == SEA_QUIT) 706 if (swap_exists_action == SEA_QUIT)
692 { 707 {
693 /* User selected Quit at ATTENTION prompt. Go back to previous 708 /* User selected Quit at ATTENTION prompt. Go back to previous
694 * buffer. If that buffer is gone or the same as the current one, 709 * buffer. If that buffer is gone or the same as the current one,
695 * open a new, empty buffer. */ 710 * open a new, empty buffer. */
710 MSG_PUTS("\n"); /* don't overwrite the last message */ 725 MSG_PUTS("\n"); /* don't overwrite the last message */
711 cmdline_row = msg_row; 726 cmdline_row = msg_row;
712 do_modelines(); 727 do_modelines();
713 } 728 }
714 swap_exists_action = SEA_NONE; 729 swap_exists_action = SEA_NONE;
730 got_int |= old_got_int;
715 } 731 }
716 #endif 732 #endif
717 733
718 #if defined(FEAT_LISTCMDS) || defined(PROTO) 734 #if defined(FEAT_LISTCMDS) || defined(PROTO)
719 /* 735 /*
4224 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) 4240 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
4225 swap_exists_action = SEA_DIALOG; 4241 swap_exists_action = SEA_DIALOG;
4226 #endif 4242 #endif
4227 set_curbuf(buf, DOBUF_GOTO); 4243 set_curbuf(buf, DOBUF_GOTO);
4228 #ifdef FEAT_AUTOCMD 4244 #ifdef FEAT_AUTOCMD
4229 # ifdef FEAT_EVAL
4230 /* Autocommands deleted the buffer or aborted script
4231 * processing!!! */
4232 if (!buf_valid(buf) || aborting())
4233 # else
4234 if (!buf_valid(buf)) /* autocommands deleted the buffer!!! */ 4245 if (!buf_valid(buf)) /* autocommands deleted the buffer!!! */
4246 {
4247 # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
4248 swap_exists_action = SEA_NONE;
4235 # endif 4249 # endif
4236 {
4237 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
4238 swap_exists_action = SEA_NONE;
4239 #endif
4240 break; 4250 break;
4241 } 4251 }
4242 #endif 4252 #endif
4243 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) 4253 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
4244 if (swap_exists_action == SEA_QUIT) 4254 if (swap_exists_action == SEA_QUIT)
4245 { 4255 {
4246 /* User selected Quit at ATTENTION prompt; close this window. */ 4256 int old_got_int = got_int;
4257
4258 /* User selected Quit at ATTENTION prompt; close this window.
4259 * Reset got_int here, because it causes aborting() to return
4260 * TRUE which breaks closing a window. */
4261 got_int = FALSE;
4262
4247 win_close(curwin, TRUE); 4263 win_close(curwin, TRUE);
4248 --open_wins; 4264 --open_wins;
4265
4266 got_int |= old_got_int;
4249 swap_exists_action = SEA_NONE; 4267 swap_exists_action = SEA_NONE;
4250 } 4268 }
4251 else 4269 else
4252 handle_swap_exists(NULL); 4270 handle_swap_exists(NULL);
4253 #endif 4271 #endif
4257 if (got_int) 4275 if (got_int)
4258 { 4276 {
4259 (void)vgetc(); /* only break the file loading, not the rest */ 4277 (void)vgetc(); /* only break the file loading, not the rest */
4260 break; 4278 break;
4261 } 4279 }
4280 #ifdef FEAT_EVAL
4281 /* Autocommands deleted the buffer or aborted script processing!!! */
4282 if (aborting())
4283 break;
4284 #endif
4262 } 4285 }
4263 #ifdef FEAT_AUTOCMD 4286 #ifdef FEAT_AUTOCMD
4264 --autocmd_no_enter; 4287 --autocmd_no_enter;
4265 #endif 4288 #endif
4266 win_enter(firstwin, FALSE); /* back to first window */ 4289 win_enter(firstwin, FALSE); /* back to first window */