diff options
author | w0rp <devw0rp@gmail.com> | 2017-12-19 12:06:08 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-12-19 12:06:08 +0000 |
commit | 2cacba5758614beadee38e493df957206aae8dde (patch) | |
tree | 87576161a7fcb785c702f8a816e2723520a601b3 | |
parent | 91090f1af8f8f03efbcf37b8570d832ac69c6797 (diff) | |
download | ale-2cacba5758614beadee38e493df957206aae8dde.zip |
Fix #1228 - Reset the cursor if echoing a message moves it
-rw-r--r-- | autoload/ale/cursor.vim | 9 |
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 |