mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 13:34:46 +08:00
Fix E523 on asynchronous truncated echo (#1987)
This commit is contained in:
@@ -26,7 +26,20 @@ function! ale#cursor#TruncatedEcho(original_message) abort
|
|||||||
|
|
||||||
" The message is truncated and saved to the history.
|
" The message is truncated and saved to the history.
|
||||||
setlocal shortmess+=T
|
setlocal shortmess+=T
|
||||||
exec "norm! :echomsg l:message\n"
|
|
||||||
|
try
|
||||||
|
exec "norm! :echomsg l:message\n"
|
||||||
|
catch /^Vim\%((\a\+)\)\=:E523/
|
||||||
|
" Fallback into manual truncate (#1987)
|
||||||
|
let l:winwidth = winwidth(0)
|
||||||
|
|
||||||
|
if l:winwidth < strdisplaywidth(l:message)
|
||||||
|
" Truncate message longer than window width with trailing '...'
|
||||||
|
let l:message = l:message[:l:winwidth - 4] . '...'
|
||||||
|
endif
|
||||||
|
|
||||||
|
exec 'echomsg l:message'
|
||||||
|
endtry
|
||||||
|
|
||||||
" Reset the cursor position if we moved off the end of the line.
|
" Reset the cursor position if we moved off the end of the line.
|
||||||
" Using :norm and :echomsg can move the cursor off the end of the
|
" Using :norm and :echomsg can move the cursor off the end of the
|
||||||
|
|||||||
Reference in New Issue
Block a user