summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2022-04-06 10:51:07 +0900
committerGitHub <noreply@github.com>2022-04-06 10:51:07 +0900
commitc984daa0eca7b67ddfd445dfa27fbe4015690477 (patch)
tree115473a515ab98078c4dc3ae5bb2d7bfc58dea19
parentcae550f07b608ab591f7fd37ffcab78a07caad8f (diff)
downloadale-c984daa0eca7b67ddfd445dfa27fbe4015690477.zip
Fix 4141 - Stop press enter prompt on long diagnostic messages (#4144)
* Fix 4141 - Stop press enter prompt on long diagnostic messages * Fix 4139 - Check for array before join truncated_echo
-rw-r--r--autoload/ale/cursor.vim13
-rw-r--r--autoload/ale/hover.vim6
-rw-r--r--test/test_cursor_warnings.vader2
3 files changed, 9 insertions, 12 deletions
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim
index 3479603e..c83bbcb6 100644
--- a/autoload/ale/cursor.vim
+++ b/autoload/ale/cursor.vim
@@ -11,9 +11,9 @@ let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s')
let s:cursor_timer = -1
" A wrapper for echon so we can test messages we echo in Vader tests.
-function! ale#cursor#Echon(message) abort
+function! ale#cursor#Echom(message) abort
" no-custom-checks
- echon a:message
+ exec "norm! :echom a:message\n"
endfunction
function! ale#cursor#TruncatedEcho(original_message) abort
@@ -36,14 +36,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
silent! setlocal shortmess+=T
try
- " echon will not display the message if it exceeds the width of
- " the window
- if &columns < strdisplaywidth(l:message)
- " Truncate message longer than window width with trailing '...'
- let l:message = l:message[:&columns - 5] . '...'
- endif
-
- call ale#cursor#Echon(l:message)
+ call ale#cursor#Echom(l:message)
catch /^Vim\%((\a\+)\)\=:E523/
" Fallback into manual truncate (#1987)
let l:winwidth = winwidth(0)
diff --git a/autoload/ale/hover.vim b/autoload/ale/hover.vim
index a738c848..5b14df8c 100644
--- a/autoload/ale/hover.vim
+++ b/autoload/ale/hover.vim
@@ -231,7 +231,11 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort
\&& (l:set_balloons is 1 || l:set_balloons is# 'hover')
call balloon_show(join(l:lines, "\n"))
elseif get(l:options, 'truncated_echo', 0)
- call ale#cursor#TruncatedEcho(join(l:lines[0], '\n'))
+ if type(l:lines[0]) is# v:t_list
+ call ale#cursor#TruncatedEcho(join(l:lines[0], '\n'))
+ else
+ call ale#cursor#TruncatedEcho(l:lines[0])
+ endif
elseif g:ale_hover_to_floating_preview || g:ale_floating_preview
call ale#floating_preview#Show(l:lines, {
\ 'filetype': 'ale-preview.message',
diff --git a/test/test_cursor_warnings.vader b/test/test_cursor_warnings.vader
index f1f1781c..b767d225 100644
--- a/test/test_cursor_warnings.vader
+++ b/test/test_cursor_warnings.vader
@@ -89,7 +89,7 @@ Before:
let g:last_message = ''
- function! ale#cursor#Echon(message) abort
+ function! ale#cursor#Echom(message) abort
let g:last_message = a:message
endfunction