0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

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)
This commit is contained in:
Christian Brabandt
2021-07-25 14:36:05 +02:00
committed by Bram Moolenaar
parent 3ed0d93796
commit 8a4c812ede
6 changed files with 43 additions and 11 deletions

View File

@@ -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