summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-08-13 02:22:21 +0100
committerw0rp <devw0rp@gmail.com>2020-08-13 02:22:21 +0100
commit64d4c951aeacd34948246b4c391435dea26e56cd (patch)
tree934a2bab9181c0361e9772c6de23c0e8cc7a5c31 /autoload
parent7c4b1d8444c3674ac394ab73b66766a4068bbbec (diff)
downloadale-64d4c951aeacd34948246b4c391435dea26e56cd.zip
Fix #3281 - Stop CursorHold flickering
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/hover.vim21
1 files changed, 16 insertions, 5 deletions
diff --git a/autoload/ale/hover.vim b/autoload/ale/hover.vim
index fe4e5da7..168ff424 100644
--- a/autoload/ale/hover.vim
+++ b/autoload/ale/hover.vim
@@ -303,6 +303,8 @@ function! ale#hover#Show(buffer, line, col, opt) abort
endfor
endfunction
+let s:last_pos = [0, 0, 0]
+
" This function implements the :ALEHover command.
function! ale#hover#ShowAtCursor() abort
let l:buffer = bufnr('')
@@ -313,11 +315,20 @@ endfunction
function! ale#hover#ShowTruncatedMessageAtCursor() abort
let l:buffer = bufnr('')
- let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
-
- if empty(l:loc)
- let l:pos = getpos('.')
- call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], {'truncated_echo': 1})
+ let l:pos = getpos('.')[0:2]
+
+ if l:pos != s:last_pos
+ let s:last_pos = l:pos
+ let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
+
+ if empty(l:loc)
+ call ale#hover#Show(
+ \ l:buffer,
+ \ l:pos[1],
+ \ l:pos[2],
+ \ {'truncated_echo': 1},
+ \)
+ endif
endif
endfunction