From 8a4c812ede5b01a8e71082c1ff4ebfcbf1bd515f Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sun, 25 Jul 2021 14:36:05 +0200 Subject: 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) --- src/undo.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/undo.c') 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 -- cgit v1.2.1