From 5e7087dae5ff84d3ffb1d374ece569909ea376b1 Mon Sep 17 00:00:00 2001 From: Cristiano De Michele Date: Sat, 3 Feb 2024 20:26:21 +0100 Subject: [PATCH 1/2] fix bug #4879 --- autoload/coc/highlight.vim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/autoload/coc/highlight.vim b/autoload/coc/highlight.vim index f506b3b0340..d844ed54c78 100644 --- a/autoload/coc/highlight.vim +++ b/autoload/coc/highlight.vim @@ -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)}) From 7851a7a62e468a8428f66958979fea173dbccdfc Mon Sep 17 00:00:00 2001 From: Cristiano De Michele Date: Sat, 3 Feb 2024 20:33:05 +0100 Subject: [PATCH 2/2] fix second bug reported in #4872 --- autoload/coc/api.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/coc/api.vim b/autoload/coc/api.vim index fb06ed8c6de..5aa9cd99928 100644 --- a/autoload/coc/api.vim +++ b/autoload/coc/api.vim @@ -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