vim:au: Stop timer too when clearing cword highlight

When deleting the cword match, any running timer should stop too so that
the highlighting does not restart. This had led to some weird flickering
bug.
This commit is contained in:
2024-10-31 23:18:32 +01:00
parent 1ffd31d585
commit 3cdb9d6902

View File

@@ -146,10 +146,16 @@ endfunction
" Clear the highlights of <cword> and visual selection
function! ClearHighlights(what = s:CLEAR_HIGHS_ALL)
if and(a:what, s:CLEAR_HIGHS_CWORD) && exists('w:cword_match_id')
call matchdelete(w:cword_match_id)
unlet w:cword_match_id
unlet w:old_cword
if and(a:what, s:CLEAR_HIGHS_CWORD)
if exists('w:cword_match_id')
call matchdelete(w:cword_match_id)
unlet w:cword_match_id
unlet w:old_cword
endif
if exists('w:cword_timer_id')
call timer_stop(w:cword_timer_id)
unlet w:cword_timer_id
endif
endif
if and(a:what, s:CLEAR_HIGHS_VISUAL) && exists('w:visual_match_ids')
for l:pairs in w:visual_match_ids