Fix #1228 - Reset the cursor if echoing a message moves it
This commit is contained in:
parent
91090f1af8
commit
2cacba5758
@ -15,9 +15,18 @@ function! ale#cursor#TruncatedEcho(original_message) abort
|
|||||||
let l:shortmess_options = &l:shortmess
|
let l:shortmess_options = &l:shortmess
|
||||||
|
|
||||||
try
|
try
|
||||||
|
let l:cursor_position = getcurpos()
|
||||||
|
|
||||||
" The message is truncated and saved to the history.
|
" The message is truncated and saved to the history.
|
||||||
setlocal shortmess+=T
|
setlocal shortmess+=T
|
||||||
exec "norm! :echomsg l:message\n"
|
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
|
finally
|
||||||
let &l:shortmess = l:shortmess_options
|
let &l:shortmess = l:shortmess_options
|
||||||
endtry
|
endtry
|
||||||
|
Loading…
Reference in New Issue
Block a user