mirror of
https://github.com/Ascyii/vim-gnupg.git
synced 2026-01-01 06:14:24 -05:00
Return early from Finish functions when buffer is not displayed
When bufwinnr() returns -1, the buffer isn't currently displayed. In this case, we need to return so the contents of a different buffer aren't used for recipients/options.
This commit is contained in:
@@ -769,8 +769,14 @@ function s:GPGFinishRecipientsBuffer()
|
|||||||
|
|
||||||
" go to buffer before doing work
|
" go to buffer before doing work
|
||||||
if (bufnr("%") != expand("<abuf>"))
|
if (bufnr("%") != expand("<abuf>"))
|
||||||
" switch to scratch buffer window
|
let winnr = bufwinnr(expand('<afile>:p'))
|
||||||
execute 'silent! ' . bufwinnr(expand("<afile>:p")) . "wincmd w"
|
if winnr >= 0
|
||||||
|
" switch to scratch buffer window
|
||||||
|
execute 'silent! ' . winnr . "wincmd w"
|
||||||
|
else
|
||||||
|
call s:GPGDebug(3, '<<<<<<<< Leaving s:GPGFinishRecipientsBuffer() early because buffer is not displayed')
|
||||||
|
return
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" get the recipients from the scratch buffer
|
" get the recipients from the scratch buffer
|
||||||
@@ -915,8 +921,14 @@ function s:GPGFinishOptionsBuffer()
|
|||||||
|
|
||||||
" go to buffer before doing work
|
" go to buffer before doing work
|
||||||
if (bufnr("%") != expand("<abuf>"))
|
if (bufnr("%") != expand("<abuf>"))
|
||||||
" switch to scratch buffer window
|
let winnr = bufwinnr(expand('<afile>:p'))
|
||||||
execute 'silent! ' . bufwinnr(expand("<afile>:p")) . "wincmd w"
|
if winnr >= 0
|
||||||
|
" switch to scratch buffer window
|
||||||
|
execute 'silent! ' . winnr . "wincmd w"
|
||||||
|
else
|
||||||
|
call s:GPGDebug(3, '<<<<<<<< Leaving s:GPGFinishOptionsBuffer() early because buffer is not displayed')
|
||||||
|
return
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" clear options and unknownOptions
|
" clear options and unknownOptions
|
||||||
|
|||||||
Reference in New Issue
Block a user