diff options
author | Bram Moolenaar <Bram@vim.org> | 2011-09-02 11:56:20 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2011-09-02 11:56:20 +0200 |
commit | 39fc42ef9d3d255d775198f47f0ba53caa078441 (patch) | |
tree | 317db54aca39494bde1b5367fc8804f8c65178ae | |
parent | 03aa60826e0a4ccfb69a1de3ddd101fd371a3db1 (diff) | |
download | vim-git-39fc42ef9d3d255d775198f47f0ba53caa078441.tar.gz |
updated for version 7.3.290v7.3.290
Problem: When a BufWriteCmd autocommand resets 'modified' this doesn't
change older buffer states to be marked as 'modified' like
":write" does. (Yukihiro Nakadaira)
Solution: When the BufWriteCmd resets 'modified' then adjust the undo
information like ":write" does.
-rw-r--r-- | src/fileio.c | 18 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/fileio.c b/src/fileio.c index 411328787..b30d31102 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3342,8 +3342,22 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, } else if (reset_changed && whole) { - if (!(did_cmd = apply_autocmds_exarg(EVENT_BUFWRITECMD, - sfname, sfname, FALSE, curbuf, eap))) + int was_changed = curbufIsChanged(); + + did_cmd = apply_autocmds_exarg(EVENT_BUFWRITECMD, + sfname, sfname, FALSE, curbuf, eap); + if (did_cmd) + { + if (was_changed && !curbufIsChanged()) + { + /* Written everything correctly and BufWriteCmd has reset + * 'modified': Correct the undo information so that an + * undo now sets 'modified'. */ + u_unchanged(curbuf); + u_update_save_nr(curbuf); + } + } + else { #ifdef FEAT_QUICKFIX if (overwriting && bt_nofile(curbuf)) diff --git a/src/version.c b/src/version.c index 925ff2477..7d11c6ffa 100644 --- a/src/version.c +++ b/src/version.c @@ -710,6 +710,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 290, +/**/ 289, /**/ 288, |