fix(treesitter): stop() should treat 0 as current buffer #24450

This commit is contained in:
Micah Halter 2023-07-24 10:26:38 -04:00 committed by GitHub
parent 78b56b21b4
commit 48085e40bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -462,7 +462,7 @@ end
---
---@param bufnr (integer|nil) Buffer to stop highlighting (default: current buffer)
function M.stop(bufnr)
bufnr = bufnr or api.nvim_get_current_buf()
bufnr = (bufnr and bufnr ~= 0) and bufnr or api.nvim_get_current_buf()
if M.highlighter.active[bufnr] then
M.highlighter.active[bufnr]:destroy()