summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorLinda_pp <rhysd@users.noreply.github.com>2018-10-11 23:01:27 +0900
committerw0rp <w0rp@users.noreply.github.com>2018-10-11 15:01:27 +0100
commit87986520d62c497fbbde94e2e6bed35f5489cfcd (patch)
treead0cc52a4577ed54d41b33a5b7a1632a1c0fb539 /autoload
parent3dd2d9deddd68edd24bbe3f6b089a10c302c961e (diff)
downloadale-87986520d62c497fbbde94e2e6bed35f5489cfcd.zip
Fix E523 on asynchronous truncated echo (#1987)
Diffstat (limited to 'autoload')
-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