@@ -360,35 +360,37 @@ local function copy_extmarks(bufnr, ctx_bufnr, contexts)
360360 local extmarks = api .nvim_buf_get_extmarks (bufnr , - 1 , {ctx_srow , ctx_scol }, {ctx_erow , ctx_ecol }, { details = true })
361361
362362 for _ , m in ipairs (extmarks ) do
363- --- @type integer , integer , integer , vim.api.keyset.extmark_details
364- local id , row , col , opts = m [1 ], m [2 ], m [3 ], m [4 ]
363+ if not config .filter_extmarks or config .filter_extmarks (m ) then
364+ --- @type integer , integer , integer , vim.api.keyset.extmark_details
365+ local id , row , col , opts = m [1 ], m [2 ], m [3 ], m [4 ]
365366
366- local start_row = offset + (row - ctx_srow )
367+ local start_row = offset + (row - ctx_srow )
367368
368- local end_row --- @type integer ?
369- if opts .end_row then
370- end_row = offset + (opts .end_row - ctx_srow )
371- end
369+ local end_row --- @type integer ?
370+ if opts .end_row then
371+ end_row = offset + (opts .end_row - ctx_srow )
372+ end
372373
373- -- Use pcall incase fields from opts are inconsistent with opts in
374- -- nvim_buf_set_extmark
375- pcall (add_extmark , ctx_bufnr , start_row , col , {
376- id = id ,
377- end_row = end_row ,
378- end_col = opts .end_col ,
379- priority = opts .priority ,
380- hl_group = opts .hl_group ,
381- end_right_gravity = opts .end_right_gravity ,
382- right_gravity = opts .right_gravity ,
383- hl_eol = opts .hl_eol ,
384- virt_text = opts .virt_text ,
385- virt_text_pos = opts .virt_text_pos ,
386- virt_text_win_col = opts .virt_text_win_col ,
387- hl_mode = opts .hl_mode ,
388- line_hl_group = opts .line_hl_group ,
389- spell = opts .spell ,
390- url = opts .url ,
391- }, opts .ns_id )
374+ -- Use pcall incase fields from opts are inconsistent with opts in
375+ -- nvim_buf_set_extmark
376+ pcall (add_extmark , ctx_bufnr , start_row , col , {
377+ id = id ,
378+ end_row = end_row ,
379+ end_col = opts .end_col ,
380+ priority = opts .priority ,
381+ hl_group = opts .hl_group ,
382+ end_right_gravity = opts .end_right_gravity ,
383+ right_gravity = opts .right_gravity ,
384+ hl_eol = opts .hl_eol ,
385+ virt_text = opts .virt_text ,
386+ virt_text_pos = opts .virt_text_pos ,
387+ virt_text_win_col = opts .virt_text_win_col ,
388+ hl_mode = opts .hl_mode ,
389+ line_hl_group = opts .line_hl_group ,
390+ spell = opts .spell ,
391+ url = opts .url ,
392+ }, opts .ns_id )
393+ end
392394 end
393395 offset = offset + util .get_range_height (context )
394396 end
0 commit comments