summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2016-10-25 16:07:20 +0100
committerw0rp <devw0rp@gmail.com>2016-10-25 16:07:20 +0100
commitaa4c669ea00b8658150b5b15784e717b51762562 (patch)
treebc185bd05a40d4fbefeee0885c414b0b824d9606 /autoload
parent60762d501872ec159c8851741f9435aa1bbf491b (diff)
downloadale-aa4c669ea00b8658150b5b15784e717b51762562.zip
#148 - Check the cursor position so we don't try to echo too frequently.
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/cursor.vim12
1 files changed, 11 insertions, 1 deletions
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim
index 7f490339..e9e678c6 100644
--- a/autoload/ale/cursor.vim
+++ b/autoload/ale/cursor.vim
@@ -64,6 +64,7 @@ function! ale#cursor#EchoCursorWarning(...) abort
endfunction
let s:cursor_timer = -1
+let s:last_pos = [0, 0, 0]
function! ale#cursor#EchoCursorWarningWithDelay() abort
if s:cursor_timer != -1
@@ -71,5 +72,14 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort
let s:cursor_timer = -1
endif
- let s:cursor_timer = timer_start(10, function('ale#cursor#EchoCursorWarning'))
+ let l:pos = getcurpos()[0:2]
+
+ " Check the current buffer, line, and column number against the last
+ " recorded position. If the position has actually changed, *then*
+ " we should echo something. Otherwise we can end up doing processing
+ " the echo message far too frequently.
+ if l:pos != s:last_pos
+ let s:last_pos = l:pos
+ let s:cursor_timer = timer_start(10, function('ale#cursor#EchoCursorWarning'))
+ endif
endfunction