From 90b1ea230db9132d7ef455ea3b395733c12206e1 Mon Sep 17 00:00:00 2001 From: w0rp Date: Tue, 28 May 2019 20:27:10 +0100 Subject: [PATCH] Fix #2438 - Print a friendly message when the clipboard is not available --- autoload/ale/debugging.vim | 6 ++++++ test/test_ale_info_to_clipboard.vader | 15 +++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 test/test_ale_info_to_clipboard.vader diff --git a/autoload/ale/debugging.vim b/autoload/ale/debugging.vim index e4bf5e7e..7cdbabaa 100644 --- a/autoload/ale/debugging.vim +++ b/autoload/ale/debugging.vim @@ -238,6 +238,12 @@ function! ale#debugging#Info() abort endfunction function! ale#debugging#InfoToClipboard() abort + if !has('clipboard') + call s:Echo('clipboard not available. Try :ALEInfoToFile instead.') + + return + endif + redir => l:output silent call ale#debugging#Info() redir END diff --git a/test/test_ale_info_to_clipboard.vader b/test/test_ale_info_to_clipboard.vader new file mode 100644 index 00000000..2014a310 --- /dev/null +++ b/test/test_ale_info_to_clipboard.vader @@ -0,0 +1,15 @@ +After: + unlet! g:output + +Execute(ALEInfoToClipboard should that clipboard support is required): + " When run in the Docker image, there's no clipboard support, so this test + " will actually run. + if !has('clipboard') + let g:output = '' + + redir => g:output + :ALEInfoToClipboard + redir END + + AssertEqual 'clipboard not available. Try :ALEInfoToFile instead.', join(split(g:output)) + endif