use vim.hl instead of vim.highlight
Some checks failed
NeoVim tests / plenary-tests (push) Failing after 7s
Some checks failed
NeoVim tests / plenary-tests (push) Failing after 7s
This commit is contained in:
parent
0e7b741b38
commit
1ba31a351d
@ -2,9 +2,10 @@ local Pos = require 'u.pos'
|
|||||||
|
|
||||||
-- Certain functions in the Range class yank text. In order to prevent unwanted
|
-- Certain functions in the Range class yank text. In order to prevent unwanted
|
||||||
-- highlighting, we intercept and discard some calls to the `on_yank` callback.
|
-- highlighting, we intercept and discard some calls to the `on_yank` callback.
|
||||||
local orig_on_yank = (vim.hl or vim.highlight).on_yank
|
local orig_on_yank = vim.hl.on_yank
|
||||||
local on_yank_enabled = true
|
local on_yank_enabled = true
|
||||||
((vim.hl or vim.highlight) --[[@as any]]).on_yank = function(opts)
|
--- @diagnostic disable-next-line: duplicate-set-field
|
||||||
|
function vim.hl.on_yank(opts)
|
||||||
if not on_yank_enabled then return end
|
if not on_yank_enabled then return end
|
||||||
return orig_on_yank(opts)
|
return orig_on_yank(opts)
|
||||||
end
|
end
|
||||||
@ -574,8 +575,8 @@ function Range:highlight(group, opts)
|
|||||||
|
|
||||||
local ns = vim.api.nvim_create_namespace ''
|
local ns = vim.api.nvim_create_namespace ''
|
||||||
|
|
||||||
local winview = vim.fn.winsaveview();
|
local winview = vim.fn.winsaveview()
|
||||||
(vim.hl or vim.highlight).range(
|
vim.hl.range(
|
||||||
self.start.bufnr,
|
self.start.bufnr,
|
||||||
ns,
|
ns,
|
||||||
group,
|
group,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user