aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/autoload/provider/clipboard.vim15
1 files changed, 8 insertions, 7 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 86006497d9..8eb694e9fa 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -6,7 +6,7 @@ let s:paste = {}
" When caching is enabled, store the jobid of the xclip/xsel process keeping
" ownership of the selection, so we know how long the cache is valid.
-let s:selection = { 'owner': 0, 'data': [] }
+let s:selection = { 'owner': 0, 'data': [], 'on_stderr': function('provider#stderr_collector') }
function! s:selection.on_exit(jobid, data, event) abort
" At this point this nvim instance might already have launched
@@ -14,12 +14,13 @@ function! s:selection.on_exit(jobid, data, event) abort
if self.owner == a:jobid
let self.owner = 0
endif
-endfunction
-
-function! s:selection.on_stderr(jobid, data, event) abort
- echohl WarningMsg
- echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(a:data)
- echohl None
+ if a:data != 0
+ let stderr = provider#get_stderr(a:jobid)
+ echohl WarningMsg
+ echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(stderr)
+ echohl None
+ endif
+ call provider#clear_stderr(a:jobid)
endfunction
let s:selections = { '*': s:selection, '+': copy(s:selection)}