Remove GPGCleanup function

If 'autowrite' is set, an encrypted buffer is modified, and ":q!"/"ZQ"
is executed, GPGCleanup's "only!" would cause the buffer to be
abandoned.  Due to 'autowrite' and the VimLeave autocmd not using
"nested", abandoning the buffer causes Vim to write the buffer, which is
currently unencrypted, overwriting the encrypted file with plain text.

Since the user can more reliably clear their own console/terminal scroll
back than we can, simply remove this functionality.  It's safer than
trying to unwind the twisty passages of Vim's autocmds, especially those
of the *WriteCmd variety.

Closes jamessan/vim-gnupg#77
Signed-off-by: James McCoy <jamessan@jamessan.com>
This commit is contained in:
James McCoy 2017-02-14 21:57:51 -05:00
parent fa18ce0c9e
commit 7d0a149169
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB

View File

@ -1,5 +1,5 @@
" Name: gnupg.vim " Name: gnupg.vim
" Last Change: 2016 Dec 18 " Last Change: 2017 Feb 14
" Maintainer: James McCoy <jamessan@jamessan.com> " Maintainer: James McCoy <jamessan@jamessan.com>
" Original Author: Markus Braun <markus.braun@krawel.de> " Original Author: Markus Braun <markus.braun@krawel.de>
" Summary: Vim plugin for transparent editing of gpg encrypted files. " Summary: Vim plugin for transparent editing of gpg encrypted files.
@ -205,9 +205,6 @@ augroup GnuPG
\ " call s:GPGInit(0) |" . \ " call s:GPGInit(0) |" .
\ " call s:GPGEncrypt() |" . \ " call s:GPGEncrypt() |" .
\ " endif" \ " endif"
" cleanup on leaving vim
exe "autocmd VimLeave " . g:GPGFilePattern . " call s:GPGCleanup()"
augroup END augroup END
" Section: Constants {{{1 " Section: Constants {{{1
@ -430,19 +427,6 @@ function s:GPGInit(bufread)
let s:GPGInitRun = 1 let s:GPGInitRun = 1
endfunction endfunction
" Function: s:GPGCleanup() {{{2
"
" cleanup on leaving vim
"
function s:GPGCleanup()
call s:GPGDebug(3, ">>>>>>>> Entering s:GPGCleanup()")
" wipe out screen
new +only!
redraw!
call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGCleanup()")
endfunction
" Function: s:GPGDecrypt(bufread) {{{2 " Function: s:GPGDecrypt(bufread) {{{2
" "