summaryrefslogtreecommitdiff
path: root/src/undo.c
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2021-07-25 14:36:05 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-25 14:36:05 +0200
commit8a4c812ede5b01a8e71082c1ff4ebfcbf1bd515f (patch)
tree2da838678bac4dd3d5fa1681e818517421e0e86b /src/undo.c
parent3ed0d9379683246a77aa8c1a59da7a0ac6395339 (diff)
downloadvim-git-8a4c812ede5b01a8e71082c1ff4ebfcbf1bd515f.tar.gz
patch 8.2.3218: when using xchaha20 crypt undo file is not removedv8.2.3218
Problem: When using xchaha20 crypt undo file is not removed. Solution: Reset 'undofile' and delete the file. (Christian Brabandt, closes #8630, closes #8467)
Diffstat (limited to 'src/undo.c')
-rw-r--r--src/undo.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/undo.c b/src/undo.c
index 331c1e676..171e81776 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -3669,6 +3669,28 @@ f_undofile(typval_T *argvars UNUSED, typval_T *rettv)
rettv->vval.v_string = NULL;
#endif
}
+#ifdef FEAT_PERSISTENT_UNDO
+/*
+ * Reset undofile option and delete the undofile
+ */
+ void
+u_undofile_reset_and_delete(buf_T *buf)
+{
+ char_u *file_name;
+
+ if (!buf->b_p_udf)
+ return;
+
+ file_name = u_get_undo_file_name(buf->b_ffname, TRUE);
+ if (file_name != NULL)
+ {
+ mch_remove(file_name);
+ vim_free(file_name);
+ }
+
+ set_option_value((char_u *)"undofile", 0L, NULL, OPT_LOCAL);
+}
+ #endif
/*
* "undotree()" function