Sort bencode keys
Closes https://github.com/tpope/vim-fireplace/issues/248
This commit is contained in:
parent
f57537135a
commit
1c75b56ceb
@ -21,7 +21,11 @@ function! fireplace#nrepl_connection#bencode(value) abort
|
|||||||
elseif type(a:value) == type([])
|
elseif type(a:value) == type([])
|
||||||
return 'l'.join(map(copy(a:value),'fireplace#nrepl_connection#bencode(v:val)'),'').'e'
|
return 'l'.join(map(copy(a:value),'fireplace#nrepl_connection#bencode(v:val)'),'').'e'
|
||||||
elseif type(a:value) == type({})
|
elseif type(a:value) == type({})
|
||||||
return 'd'.join(values(map(copy(a:value),'fireplace#nrepl_connection#bencode(v:key).fireplace#nrepl_connection#bencode(v:val)')),'').'e'
|
return 'd'.join(map(
|
||||||
|
\ sort(keys(a:value)),
|
||||||
|
\ 'fireplace#nrepl_connection#bencode(v:val) . ' .
|
||||||
|
\ 'fireplace#nrepl_connection#bencode(a:value[v:val])'
|
||||||
|
\ ),'').'e'
|
||||||
else
|
else
|
||||||
throw "Can't bencode ".string(a:value)
|
throw "Can't bencode ".string(a:value)
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user