diff --git a/src/fileio.c b/src/fileio.c index 4113287870..b30d31102e 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 925ff24776..7d11c6ffa0 100644 --- a/src/version.c +++ b/src/version.c @@ -709,6 +709,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 290, /**/ 289, /**/