mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
fix(vim.hl): nvim_buf_del_extmark on invalid buffer #33331
Problem: nvim_buf_del_extmark error if buffer is destroyed before timer stops Solution: check nvim_buf_is_valid.
This commit is contained in:
@ -128,6 +128,9 @@ function M.range(bufnr, ns, higroup, start, finish, opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local range_hl_clear = function()
|
local range_hl_clear = function()
|
||||||
|
if not api.nvim_buf_is_valid(bufnr) then
|
||||||
|
return
|
||||||
|
end
|
||||||
for _, mark in ipairs(extmarks) do
|
for _, mark in ipairs(extmarks) do
|
||||||
api.nvim_buf_del_extmark(bufnr, ns, mark)
|
api.nvim_buf_del_extmark(bufnr, ns, mark)
|
||||||
end
|
end
|
||||||
|
@ -222,6 +222,7 @@ describe('vim.hl.on_yank', function()
|
|||||||
|
|
||||||
it('does not show errors even if buffer is wiped before timeout', function()
|
it('does not show errors even if buffer is wiped before timeout', function()
|
||||||
command('new')
|
command('new')
|
||||||
|
n.feed('ifoo<esc>') -- set '[, ']
|
||||||
exec_lua(function()
|
exec_lua(function()
|
||||||
vim.hl.on_yank({
|
vim.hl.on_yank({
|
||||||
timeout = 10,
|
timeout = 10,
|
||||||
|
Reference in New Issue
Block a user