comparison src/fileio.c @ 837:6bb1fa855dc9 v7.0e03

updated for version 7.0e03
author vimboss
date Wed, 19 Apr 2006 21:23:36 +0000
parents 5a7843c57316
children d3bbb5dd3913
comparison
equal deleted inserted replaced
836:5a7843c57316 837:6bb1fa855dc9
6480 savebuf = NULL; 6480 savebuf = NULL;
6481 else 6481 else
6482 { 6482 {
6483 /* Allocate a buffer without putting it in the buffer list. */ 6483 /* Allocate a buffer without putting it in the buffer list. */
6484 savebuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY); 6484 savebuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY);
6485 if (savebuf != NULL) 6485 if (savebuf != NULL && buf == curbuf)
6486 { 6486 {
6487 /* Open the memline. */ 6487 /* Open the memline. */
6488 curbuf = savebuf; 6488 curbuf = savebuf;
6489 curwin->w_buffer = savebuf; 6489 curwin->w_buffer = savebuf;
6490 saved = ml_open(curbuf); 6490 saved = ml_open(curbuf);
6491 curbuf = buf; 6491 curbuf = buf;
6492 curwin->w_buffer = buf; 6492 curwin->w_buffer = buf;
6493 } 6493 }
6494 if (savebuf == NULL || saved == FAIL 6494 if (savebuf == NULL || saved == FAIL || buf != curbuf
6495 || move_lines(buf, savebuf) == FAIL) 6495 || move_lines(buf, savebuf) == FAIL)
6496 { 6496 {
6497 EMSG2(_("E462: Could not prepare for reloading \"%s\""), 6497 EMSG2(_("E462: Could not prepare for reloading \"%s\""),
6498 buf->b_fname); 6498 buf->b_fname);
6499 saved = FAIL; 6499 saved = FAIL;
6512 { 6512 {
6513 #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) 6513 #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
6514 if (!aborting()) 6514 if (!aborting())
6515 #endif 6515 #endif
6516 EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname); 6516 EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname);
6517 if (savebuf != NULL) 6517 if (savebuf != NULL && buf_valid(savebuf) && buf == curbuf)
6518 { 6518 {
6519 /* Put the text back from the save buffer. First 6519 /* Put the text back from the save buffer. First
6520 * delete any lines that readfile() added. */ 6520 * delete any lines that readfile() added. */
6521 while (!bufempty()) 6521 while (!bufempty())
6522 if (ml_delete(curbuf->b_ml.ml_line_count, FALSE) 6522 if (ml_delete(buf->b_ml.ml_line_count, FALSE) == FAIL)
6523 == FAIL)
6524 break; 6523 break;
6525 (void)move_lines(savebuf, buf); 6524 (void)move_lines(savebuf, buf);
6526 } 6525 }
6527 } 6526 }
6528 else 6527 else if (buf == curbuf)
6529 { 6528 {
6530 /* Mark the buffer as unmodified and free undo info. */ 6529 /* Mark the buffer as unmodified and free undo info. */
6531 unchanged(buf, TRUE); 6530 unchanged(buf, TRUE);
6532 u_blockfree(buf); 6531 u_blockfree(buf);
6533 u_clearall(buf); 6532 u_clearall(buf);
6534 } 6533 }
6535 } 6534 }
6536 vim_free(ea.cmd); 6535 vim_free(ea.cmd);
6537 6536
6538 if (savebuf != NULL) 6537 if (savebuf != NULL && buf_valid(savebuf))
6539 wipe_buffer(savebuf, FALSE); 6538 wipe_buffer(savebuf, FALSE);
6540 6539
6541 #ifdef FEAT_DIFF 6540 #ifdef FEAT_DIFF
6542 /* Invalidate diff info if necessary. */ 6541 /* Invalidate diff info if necessary. */
6543 diff_invalidate(buf); 6542 diff_invalidate(curbuf);
6544 #endif 6543 #endif
6545 6544
6546 /* Restore the topline and cursor position and check it (lines may 6545 /* Restore the topline and cursor position and check it (lines may
6547 * have been removed). */ 6546 * have been removed). */
6548 if (old_topline > curbuf->b_ml.ml_line_count) 6547 if (old_topline > curbuf->b_ml.ml_line_count)