comparison src/bufwrite.c @ 25362:68a7e6d70a5e v8.2.3218

patch 8.2.3218: when using xchaha20 crypt undo file is not removed Commit: https://github.com/vim/vim/commit/8a4c812ede5b01a8e71082c1ff4ebfcbf1bd515f Author: Christian Brabandt <cb@256bit.org> Date: Sun Jul 25 14:36:05 2021 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Sun, 25 Jul 2021 14:45:04 +0200
parents 965d97f8208b
children d7e1cf30728c
comparison
equal deleted inserted replaced
25361:7784e9d84ff6 25362:68a7e6d70a5e
1980 } 1980 }
1981 } 1981 }
1982 write_info.bw_start_lnum = start; 1982 write_info.bw_start_lnum = start;
1983 1983
1984 #ifdef FEAT_PERSISTENT_UNDO 1984 #ifdef FEAT_PERSISTENT_UNDO
1985 // TODO: if the selected crypt method prevents the undo file from being
1986 // written, and existing undo file should be deleted.
1987 write_undo_file = (buf->b_p_udf 1985 write_undo_file = (buf->b_p_udf
1988 && overwriting 1986 && overwriting
1989 && !append 1987 && !append
1990 && !filtering 1988 && !filtering
1991 # ifdef CRYPT_NOT_INPLACE 1989 # ifdef CRYPT_NOT_INPLACE
1992 // writing undo file requires 1990 // writing undo file requires
1993 // crypt_encode_inplace() 1991 // crypt_encode_inplace()
1994 && (curbuf->b_cryptstate == NULL 1992 && (buf->b_cryptstate == NULL
1995 || crypt_works_inplace(curbuf->b_cryptstate)) 1993 || crypt_works_inplace(buf->b_cryptstate))
1996 # endif 1994 # endif
1997 && reset_changed 1995 && reset_changed
1998 && !checking_conversion); 1996 && !checking_conversion);
1997 # ifdef CRYPT_NOT_INPLACE
1998 // remove undo file if encrypting it is not possible
1999 if (buf->b_p_udf
2000 && overwriting
2001 && !append
2002 && !filtering
2003 && !checking_conversion
2004 && buf->b_cryptstate != NULL
2005 && !crypt_works_inplace(buf->b_cryptstate))
2006 u_undofile_reset_and_delete(buf);
2007 # endif
1999 if (write_undo_file) 2008 if (write_undo_file)
2000 // Prepare for computing the hash value of the text. 2009 // Prepare for computing the hash value of the text.
2001 sha256_start(&sha_ctx); 2010 sha256_start(&sha_ctx);
2002 #endif 2011 #endif
2003 2012