summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-12-18 11:22:24 +0000
committerw0rp <devw0rp@gmail.com>2017-12-18 11:22:24 +0000
commite0c3cbd16f2e29464667d7bf56936312f712185a (patch)
tree1104912de310f0451167d285db6982e2f5ba0c6c /autoload
parent8afd9a70a602a877f09f39ab34fbd1feb81ebc87 (diff)
downloadale-e0c3cbd16f2e29464667d7bf56936312f712185a.zip
Remove some now redundant echo code
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/cursor.vim38
1 files changed, 12 insertions, 26 deletions
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim
index abe3c5a0..68dab75c 100644
--- a/autoload/ale/cursor.vim
+++ b/autoload/ale/cursor.vim
@@ -4,37 +4,23 @@
let s:cursor_timer = -1
let s:last_pos = [0, 0, 0]
-function! s:EchoWithShortMess(setting, message) abort
- " We need to remember the setting for shormess and reset it again.
- let l:shortmess_options = getbufvar('%', '&shortmess')
-
- try
- " Turn shortmess on or off.
- if a:setting is# 'on'
- setlocal shortmess+=T
- " echomsg is needed for the message to get truncated and appear in
- " the message history.
- exec "norm! :echomsg a:message\n"
- elseif a:setting is# 'off'
- setlocal shortmess-=T
- " Regular echo is needed for printing newline characters.
- execute 'echo a:message'
- else
- throw 'Invalid setting: ' . string(a:setting)
- endif
- finally
- call setbufvar('%', '&shortmess', l:shortmess_options)
- endtry
-endfunction
-
-function! ale#cursor#TruncatedEcho(message) abort
- let l:message = a:message
+function! ale#cursor#TruncatedEcho(original_message) abort
+ let l:message = a:original_message
" Change tabs to spaces.
let l:message = substitute(l:message, "\t", ' ', 'g')
" Remove any newlines in the message.
let l:message = substitute(l:message, "\n", '', 'g')
- call s:EchoWithShortMess('on', l:message)
+ " We need to remember the setting for shortmess and reset it again.
+ let l:shortmess_options = &l:shortmess
+
+ try
+ " The message is truncated and saved to the history.
+ setlocal shortmess+=T
+ exec "norm! :echomsg l:message\n"
+ finally
+ let &l:shortmess = l:shortmess_options
+ endtry
endfunction
function! s:FindItemAtCursor() abort