aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/hl.lua
diff options
context:
space:
mode:
authorphanium <91544758+phanen@users.noreply.github.com>2025-04-06 06:56:40 +0800
committerGitHub <noreply@github.com>2025-04-05 15:56:40 -0700
commit28e819018520a2300eaeeec6794ffcd614b25dd2 (patch)
treeafebd1fb4d3f8d98b09561dd5d555dcfc614ee95 /runtime/lua/vim/hl.lua
parentf9dec1228d1741859a89b64de7ac9765f12c2d3d (diff)
downloadrneovim-28e819018520a2300eaeeec6794ffcd614b25dd2.tar.gz
rneovim-28e819018520a2300eaeeec6794ffcd614b25dd2.tar.bz2
rneovim-28e819018520a2300eaeeec6794ffcd614b25dd2.zip
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.
Diffstat (limited to 'runtime/lua/vim/hl.lua')
-rw-r--r--runtime/lua/vim/hl.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/lua/vim/hl.lua b/runtime/lua/vim/hl.lua
index d15ee1fd10..50345d1dc7 100644
--- a/runtime/lua/vim/hl.lua
+++ b/runtime/lua/vim/hl.lua
@@ -128,6 +128,9 @@ function M.range(bufnr, ns, higroup, start, finish, opts)
end
local range_hl_clear = function()
+ if not api.nvim_buf_is_valid(bufnr) then
+ return
+ end
for _, mark in ipairs(extmarks) do
api.nvim_buf_del_extmark(bufnr, ns, mark)
end