Show all uids when disambiguating a key.
Previously, only a contiguous block of uids would be presented to the user when trying to disambiguate a key. This happened because a key may have other fields interspersed among the uids, like UAT. Signed-off-by: James McCoy <vega.james@gmail.com>
This commit is contained in:
parent
2f1d2c8244
commit
dcb9d3764a
@ -841,7 +841,7 @@ function s:GPGFinishRecipientsBuffer()
|
|||||||
endfor
|
endfor
|
||||||
|
|
||||||
" write back the new recipient list to the corresponding buffer and mark it
|
" write back the new recipient list to the corresponding buffer and mark it
|
||||||
" as modified. Buffer is now for sure a encrypted buffer.
|
" as modified. Buffer is now for sure an encrypted buffer.
|
||||||
call setbufvar(b:GPGCorrespondingTo, "GPGRecipients", recipients)
|
call setbufvar(b:GPGCorrespondingTo, "GPGRecipients", recipients)
|
||||||
call setbufvar(b:GPGCorrespondingTo, "&mod", 1)
|
call setbufvar(b:GPGCorrespondingTo, "&mod", 1)
|
||||||
call setbufvar(b:GPGCorrespondingTo, "GPGEncrypted", 1)
|
call setbufvar(b:GPGCorrespondingTo, "GPGEncrypted", 1)
|
||||||
@ -1091,26 +1091,24 @@ function s:GPGNameToID(name)
|
|||||||
let pubseen = 0
|
let pubseen = 0
|
||||||
let counter = 0
|
let counter = 0
|
||||||
let gpgids = []
|
let gpgids = []
|
||||||
let duplicates = {}
|
let seen_keys = {}
|
||||||
|
let skip_key = 0
|
||||||
|
let has_strftime = exists('*strftime')
|
||||||
let choices = "The name \"" . a:name . "\" is ambiguous. Please select the correct key:\n"
|
let choices = "The name \"" . a:name . "\" is ambiguous. Please select the correct key:\n"
|
||||||
for line in lines
|
for line in lines
|
||||||
|
|
||||||
" check if this line has already been processed
|
|
||||||
if !has_key(duplicates, line)
|
|
||||||
let duplicates[line] = 1
|
|
||||||
|
|
||||||
let fields = split(line, ":")
|
let fields = split(line, ":")
|
||||||
|
|
||||||
" search for the next uid
|
|
||||||
if pubseen
|
|
||||||
if (fields[0] == "uid")
|
|
||||||
let choices = choices . " " . fields[9] . "\n"
|
|
||||||
else
|
|
||||||
let pubseen = 0
|
|
||||||
endif
|
|
||||||
" search for the next pub
|
" search for the next pub
|
||||||
else
|
|
||||||
if (fields[0] == "pub")
|
if (fields[0] == "pub")
|
||||||
|
" check if this key has already been processed
|
||||||
|
if has_key(seen_keys, fields[4])
|
||||||
|
let skip_key = 1
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
let skip_key = 0
|
||||||
|
let seen_keys[fields[4]] = 1
|
||||||
|
|
||||||
" Ignore keys which are not usable for encryption
|
" Ignore keys which are not usable for encryption
|
||||||
if fields[11] !~? 'e'
|
if fields[11] !~? 'e'
|
||||||
continue
|
continue
|
||||||
@ -1118,15 +1116,16 @@ function s:GPGNameToID(name)
|
|||||||
|
|
||||||
let identity = fields[4]
|
let identity = fields[4]
|
||||||
let gpgids += [identity]
|
let gpgids += [identity]
|
||||||
if exists("*strftime")
|
if has_strftime
|
||||||
let choices = choices . counter . ": ID: 0x" . identity . " created at " . strftime("%c", fields[5]) . "\n"
|
let choices = choices . counter . ": ID: 0x" . identity . " created at " . strftime("%c", fields[5]) . "\n"
|
||||||
else
|
else
|
||||||
let choices = choices . counter . ": ID: 0x" . identity . "\n"
|
let choices = choices . counter . ": ID: 0x" . identity . "\n"
|
||||||
endif
|
endif
|
||||||
let counter = counter+1
|
let counter = counter+1
|
||||||
let pubseen = 1
|
let pubseen = 1
|
||||||
endif
|
" search for the next uid
|
||||||
endif
|
elseif (!skip_key && fields[0] == "uid")
|
||||||
|
let choices = choices . " " . fields[9] . "\n"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endfor
|
endfor
|
||||||
|
Loading…
Reference in New Issue
Block a user