diff options
-rw-r--r-- | src/ex_cmds.c | 29 | ||||
-rw-r--r-- | src/testdir/test86.ok | 4 | ||||
-rw-r--r-- | src/testdir/test87.ok | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 21 insertions, 18 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index cbdf91f3c..cd6772ed5 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -2421,10 +2421,11 @@ rename_buffer(new_fname) char_u *new_fname; { char_u *fname, *sfname, *xfname; -#ifdef FEAT_AUTOCMD - buf_T *buf = curbuf; + buf_T *buf; - apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, buf); +#ifdef FEAT_AUTOCMD + buf = curbuf; + apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); /* buffer changed, don't change name now */ if (buf != curbuf) return FAIL; @@ -2440,18 +2441,18 @@ rename_buffer(new_fname) * But don't set the alternate file name if the buffer didn't have a * name. */ - fname = buf->b_ffname; - sfname = buf->b_sfname; - xfname = buf->b_fname; - buf->b_ffname = NULL; - buf->b_sfname = NULL; - if (setfname(buf, new_fname, NULL, TRUE) == FAIL) - { - buf->b_ffname = fname; - buf->b_sfname = sfname; + fname = curbuf->b_ffname; + sfname = curbuf->b_sfname; + xfname = curbuf->b_fname; + curbuf->b_ffname = NULL; + curbuf->b_sfname = NULL; + if (setfname(curbuf, new_fname, NULL, TRUE) == FAIL) + { + curbuf->b_ffname = fname; + curbuf->b_sfname = sfname; return FAIL; } - buf->b_flags |= BF_NOTEDITED; + curbuf->b_flags |= BF_NOTEDITED; if (xfname != NULL && *xfname != NUL) { buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0); @@ -2461,7 +2462,7 @@ rename_buffer(new_fname) vim_free(fname); vim_free(sfname); #ifdef FEAT_AUTOCMD - apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, buf); + apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); #endif /* Change directories when the 'acd' option is set. */ DO_AUTOCHDIR diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index f44ebf7c2..0b79b0dbf 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -320,13 +320,13 @@ Second line Third line foo 1:BufFilePre:1 -6:BufFilePost:1 +1:BufFilePost:1 testdir/foo 5:BufFilePre:5 5:BufFilePost:5 testdir/bar 1:BufFilePre:1 -7:BufFilePost:1 +1:BufFilePost:1 testdir/test86.in valid: b:False, cb:True i:<buffer test86.in> diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index 3b39c18ba..3126fd36f 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -309,13 +309,13 @@ Second line Third line foo 1:BufFilePre:1 -6:BufFilePost:1 +1:BufFilePost:1 testdir/foo 5:BufFilePre:5 5:BufFilePost:5 testdir/bar 1:BufFilePre:1 -7:BufFilePost:1 +1:BufFilePost:1 testdir/test87.in valid: b:False, cb:True i:<buffer test87.in> diff --git a/src/version.c b/src/version.c index c7785bab0..795e175bc 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1054, +/**/ 1053, /**/ 1052, |