patch 8.2.3218: when using xchaha20 crypt undo file is not removed
Problem: When using xchaha20 crypt undo file is not removed.
Solution: Reset 'undofile' and delete the file. (Christian Brabandt,
closes #8630, closes #8467)
diff --git a/src/undo.c b/src/undo.c
index 331c1e6..171e817 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -3669,6 +3669,28 @@
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