GPGEdit{Recipients,Options}: Check for presence of b:GPGCorrespondingTo

Since the user can control which file patterns are handled by the plugin
(via g:GPGFilePattern), the regular expression checking the buffer name
for GPGEdit{Recipients,Options} may not match.  A simpler and more
definitive check is to see whether b:GPGCorrespondingTo is set to
determine if the buffer is an existing recipients/options buffer.

Closes jamessan/vim-gnupg#72
Signed-off-by: James McCoy <jamessan@jamessan.com>
This commit is contained in:
James McCoy 2016-12-04 13:56:39 -05:00
parent 454090fe40
commit e7be112873
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB

View File

@ -1,5 +1,5 @@
" Name: gnupg.vim
" Last Change: 2016 Sep 17
" Last Change: 2016 Dec 04
" Maintainer: James McCoy <jamessan@jamessan.com>
" Original Author: Markus Braun <markus.braun@krawel.de>
" Summary: Vim plugin for transparent editing of gpg encrypted files.
@ -799,7 +799,7 @@ function s:GPGEditRecipients()
endif
" only do this if it isn't already a GPGRecipients_* buffer
if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0)
if (!exists('b:GPGCorrespondingTo'))
" save buffer name
let buffername = bufname("%")
@ -1026,7 +1026,7 @@ function s:GPGEditOptions()
endif
" only do this if it isn't already a GPGOptions_* buffer
if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0)
if (!exists('b:GPGCorrespondingTo'))
" save buffer name
let buffername = bufname("%")