Skip to content

Commit

Permalink
clipboard: Revert unused check neovim#9309
Browse files Browse the repository at this point in the history
PR neovim#9304 added support for functions in clipboard providers. As part of
the PR I meant to move two checks in the provider code out of an if
statement into separate statements and adding additional checks for
g:clipboard attributes - as it turns out the code is wrong and it does
not implement additional checks while it adds two conditions that make
very little sense

    type(g:clipboard['copy']) #isnot# v:t_func

what would make sense would be something along the lines of

    type(g:clipboard['copy']['+']) #isnot# v:t_func

but might not be what we want either, so I'm reverting this.
  • Loading branch information
equalsraf authored and justinmk committed Dec 4, 2018
1 parent 7e97587 commit d207440
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions runtime/autoload/provider/clipboard.vim
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,12 @@ endfunction
function! provider#clipboard#Executable() abort
if exists('g:clipboard')
if type({}) isnot# type(g:clipboard)
\ || type({}) isnot# type(get(g:clipboard, 'copy', v:null))
\ || type({}) isnot# type(get(g:clipboard, 'paste', v:null))
let s:err = 'clipboard: invalid g:clipboard'
return ''
endif

if type(get(g:clipboard, 'copy', v:null)) isnot# v:t_dict
\ && type(get(g:clipboard, 'copy', v:null)) isnot# v:t_func
let s:err = "clipboard: invalid g:clipboard['copy']"
return ''
endif

if type(get(g:clipboard, 'paste', v:null)) isnot# v:t_dict
\ && type(get(g:clipboard, 'paste', v:null)) isnot# v:t_func
let s:err = "clipboard: invalid g:clipboard['paste']"
return ''
endif

let s:copy = get(g:clipboard, 'copy', { '+': v:null, '*': v:null })
let s:paste = get(g:clipboard, 'paste', { '+': v:null, '*': v:null })
let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0)
Expand Down

0 comments on commit d207440

Please sign in to comment.