aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-08-22 20:31:54 +0200
committerGitHub <noreply@github.com>2017-08-22 20:31:54 +0200
commit85f3084e21e112a34d891d90cfaf37a7de726866 (patch)
tree70151b226e928e32b45a00332f3fdbf8bcc95432 /runtime/autoload
parent7f7698649fc15cbd929233ee7373ff3d9d113546 (diff)
downloadrneovim-85f3084e21e112a34d891d90cfaf37a7de726866.tar.gz
rneovim-85f3084e21e112a34d891d90cfaf37a7de726866.tar.bz2
rneovim-85f3084e21e112a34d891d90cfaf37a7de726866.zip
clipboard: disallow recursion; show hint only once (#7203)
- Show hint only once per session. - provider#clipboard#Call(): prevent recursion - provider#clear_stderr(): use has_key(), because :silent! is still captured by :redir. closes #7184
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/provider.vim4
-rw-r--r--runtime/autoload/provider/clipboard.vim12
2 files changed, 13 insertions, 3 deletions
diff --git a/runtime/autoload/provider.vim b/runtime/autoload/provider.vim
index b46ae12b3c..7439b638c2 100644
--- a/runtime/autoload/provider.vim
+++ b/runtime/autoload/provider.vim
@@ -10,7 +10,9 @@ function! provider#stderr_collector(chan_id, data, event) dict
endfunction
function! provider#clear_stderr(chan_id)
- silent! call remove(s:stderr, a:chan_id)
+ if has_key(s:stderr, a:chan_id)
+ call remove(s:stderr, a:chan_id)
+ endif
endfunction
function! provider#get_stderr(chan_id)
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 8fe53c495a..6454a01c2a 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -32,7 +32,7 @@ function! s:try_cmd(cmd, ...) abort
if v:shell_error
if !exists('s:did_error_try_cmd')
echohl WarningMsg
- echomsg "clipboard: error: ".(len(out) ? out[0] : '')
+ echomsg "clipboard: error: ".(len(out) ? out[0] : v:shell_error)
echohl None
let s:did_error_try_cmd = 1
endif
@@ -168,5 +168,13 @@ function! s:clipboard.set(lines, regtype, reg) abort
endfunction
function! provider#clipboard#Call(method, args) abort
- return call(s:clipboard[a:method],a:args,s:clipboard)
+ if get(s:, 'here', v:false) " Clipboard provider must not recurse. #7184
+ return 0
+ endif
+ let s:here = v:true
+ try
+ return call(s:clipboard[a:method],a:args,s:clipboard)
+ finally
+ let s:here = v:false
+ endtry
endfunction