1
0
forked from aniani/vim

Fix: in compatible mode, in an empty buffer, ":r file" triggered an error

message.
This commit is contained in:
Bram Moolenaar
2010-08-14 14:32:54 +02:00
parent cda000e97f
commit bb3d5dc320

View File

@@ -317,20 +317,14 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
char_u conv_rest[CONV_RESTLEN]; char_u conv_rest[CONV_RESTLEN];
int conv_restlen = 0; /* nr of bytes in conv_rest[] */ int conv_restlen = 0; /* nr of bytes in conv_rest[] */
#endif #endif
#ifdef FEAT_AUTOCMD #ifdef FEAT_AUTOCMD
/* Remember the initial values of curbuf, curbuf->b_ffname and buf_T *old_curbuf;
* curbuf->b_fname to detect whether they are altered as a result of char_u *old_b_ffname;
* executing nasty autocommands. Also check if "fname" and "sfname" char_u *old_b_fname;
* point to one of these values. */ int using_b_ffname;
buf_T *old_curbuf = curbuf; int using_b_fname;
char_u *old_b_ffname = curbuf->b_ffname;
char_u *old_b_fname = curbuf->b_fname;
int using_b_ffname = (fname == curbuf->b_ffname)
|| (sfname == curbuf->b_ffname);
int using_b_fname = (fname == curbuf->b_fname)
|| (sfname == curbuf->b_fname);
#endif #endif
write_no_eol_lnum = 0; /* in case it was set by the previous read */ write_no_eol_lnum = 0; /* in case it was set by the previous read */
/* /*
@@ -349,6 +343,19 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
return FAIL; return FAIL;
} }
#ifdef FEAT_AUTOCMD
/* Remember the initial values of curbuf, curbuf->b_ffname and
* curbuf->b_fname to detect whether they are altered as a result of
* executing nasty autocommands. Also check if "fname" and "sfname"
* point to one of these values. */
old_curbuf = curbuf;
old_b_ffname = curbuf->b_ffname;
old_b_fname = curbuf->b_fname;
using_b_ffname = (fname == curbuf->b_ffname)
|| (sfname == curbuf->b_ffname);
using_b_fname = (fname == curbuf->b_fname) || (sfname == curbuf->b_fname);
#endif
/* After reading a file the cursor line changes but we don't want to /* After reading a file the cursor line changes but we don't want to
* display the line. */ * display the line. */
ex_no_reprint = TRUE; ex_no_reprint = TRUE;