Skip to content

Commit

Permalink
fix issues #4879 and #4872 (#4885)
Browse files Browse the repository at this point in the history
* fix bug #4879

* fix second bug reported in #4872

---------

Co-authored-by: Cristiano De Michele <[email protected]>
  • Loading branch information
cridemichel and Cristiano De Michele authored Feb 18, 2024
1 parent 9c079ad commit 02c4a31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion autoload/coc/api.vim
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ function! s:funcs.buf_add_highlight(bufnr, srcId, hlGroup, line, colStart, colEn
let id = s:generate_id(a:bufnr)
try
call prop_add(a:line + 1, a:colStart + 1, {'bufnr': bufnr, 'type': type, 'id': id, 'end_col': end})
catch /^Vim\%((\a\+)\)\=:E967/
catch /^Vim\%((\a\+)\)\=:\(E967\|E964\)/
" ignore 967
endtry
if a:srcId == 0
Expand Down
18 changes: 9 additions & 9 deletions autoload/coc/highlight.vim
Original file line number Diff line number Diff line change
Expand Up @@ -726,15 +726,15 @@ function! s:update_highlights_timer(bufnr, changedtick, key, priority, groups, i
endfunction

function! s:add_highlights_timer(bufnr, ns, highlights, priority) abort
let hls = []
let next = []
for i in range(0, len(a:highlights) - 1)
if i < g:coc_highlight_maximum_count
call add(hls, a:highlights[i])
else
call add(next, a:highlights[i])
endif
endfor
let lhl = len(a:highlights)
let maxc = g:coc_highlight_maximum_count
if maxc < lhl
let hls = a:highlights[:maxc-1]
let next = a:highlights[maxc:]
else
let hls = a:highlights[:]
let next = []
endif
call s:add_highlights(a:bufnr, a:ns, hls, a:priority)
if len(next)
call timer_start(30, {->s:add_highlights_timer(a:bufnr, a:ns, next, a:priority)})
Expand Down

0 comments on commit 02c4a31

Please sign in to comment.