mirror of
https://github.com/stevearc/aerial.nvim
synced 2024-09-16 14:34:08 +02:00
fix: error when switching buffers
This commit is contained in:
parent
8a59ed2dc9
commit
8d0915b1f8
1 changed files with 11 additions and 3 deletions
|
@ -192,8 +192,12 @@ M.update_aerial_buffer = function(buf)
|
|||
M.update_highlights(bufnr)
|
||||
end
|
||||
|
||||
-- Update the highlighted lines in the aerial buffer
|
||||
---Update the highlighted lines in the aerial buffer
|
||||
---@param buf integer
|
||||
M.update_highlights = function(buf)
|
||||
if not vim.api.nvim_buf_is_valid(buf) then
|
||||
return
|
||||
end
|
||||
local hl_mode = config.highlight_mode
|
||||
if not hl_mode or hl_mode == "none" then
|
||||
return
|
||||
|
@ -251,9 +255,13 @@ M.update_highlights = function(buf)
|
|||
end
|
||||
end
|
||||
|
||||
M.clear_highlights = function(buf)
|
||||
---@param bufnr integer
|
||||
M.clear_highlights = function(bufnr)
|
||||
if not vim.api.nvim_buf_is_valid(bufnr) then
|
||||
return
|
||||
end
|
||||
local ns = vim.api.nvim_create_namespace("aerial-line")
|
||||
vim.api.nvim_buf_clear_namespace(buf, ns, 0, -1)
|
||||
vim.api.nvim_buf_clear_namespace(bufnr, ns, 0, -1)
|
||||
return ns
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue