summaryrefslogtreecommitdiff
path: root/autoload/ale/cursor.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/ale/cursor.vim')
-rw-r--r--autoload/ale/cursor.vim15
1 files changed, 14 insertions, 1 deletions
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim
index c3b48ca3..32ce8c84 100644
--- a/autoload/ale/cursor.vim
+++ b/autoload/ale/cursor.vim
@@ -26,7 +26,20 @@ function! ale#cursor#TruncatedEcho(original_message) abort
" The message is truncated and saved to the history.
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.
" Using :norm and :echomsg can move the cursor off the end of the