summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/cursor.vim9
1 files changed, 9 insertions, 0 deletions
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim
index 68dab75c..25e91e71 100644
--- a/autoload/ale/cursor.vim
+++ b/autoload/ale/cursor.vim
@@ -15,9 +15,18 @@ function! ale#cursor#TruncatedEcho(original_message) abort
let l:shortmess_options = &l:shortmess
try
+ let l:cursor_position = getcurpos()
+
" The message is truncated and saved to the history.
setlocal shortmess+=T
exec "norm! :echomsg l:message\n"
+
+ " 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
+ " line.
+ if l:cursor_position != getcurpos()
+ call setpos('.', l:cursor_position)
+ endif
finally
let &l:shortmess = l:shortmess_options
endtry