summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinda_pp <rhysd@users.noreply.github.com>2018-10-11 23:01:27 +0900
committerw0rp <devw0rp@gmail.com>2018-10-11 15:01:46 +0100
commitceb2e8d350620366574c4c5efea66adfbeb0bb19 (patch)
treed7c68d5efb1fbb8977baa47ee027cf6b3fe9d780
parent96d84aec8f95d3b67c29a16111b48914ead74e59 (diff)
downloadale-ceb2e8d350620366574c4c5efea66adfbeb0bb19.zip
Fix E523 on asynchronous truncated echo (#1987)
-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