summaryrefslogtreecommitdiff
path: root/src/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index df694234f..a3113d7b1 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -7060,8 +7060,23 @@ buf_check_timestamp(buf, focus)
}
if (reload)
+ {
/* Reload the buffer. */
buf_reload(buf, orig_mode);
+#ifdef FEAT_PERSISTENT_UNDO
+ if (buf->b_p_udf && buf->b_ffname != NULL)
+ {
+ char_u hash[UNDO_HASH_SIZE];
+ buf_T *save_curbuf = curbuf;
+
+ /* Any existing undo file is unusable, write it now. */
+ curbuf = buf;
+ u_compute_hash(hash);
+ u_write_undo(NULL, FALSE, buf, hash);
+ curbuf = save_curbuf;
+ }
+#endif
+ }
#ifdef FEAT_AUTOCMD
/* Trigger FileChangedShell when the file was changed in any way. */