fix(previewer): check bufnr is not nil (#3410)

This commit is contained in:
Jordan Mandel
2025-02-11 15:01:20 -05:00
committed by GitHub
parent 415af52339
commit 78857db9e8

View File

@@ -545,9 +545,11 @@ previewers.vimgrep = defaulter(function(opts)
local middle_ln = math.floor(lnum + (lnend - lnum) / 2) local middle_ln = math.floor(lnum + (lnend - lnum) / 2)
pcall(vim.api.nvim_win_set_cursor, self.state.winid, { middle_ln + 1, 0 }) pcall(vim.api.nvim_win_set_cursor, self.state.winid, { middle_ln + 1, 0 })
vim.api.nvim_buf_call(bufnr, function() if bufnr ~= nil then
vim.cmd "norm! zz" vim.api.nvim_buf_call(bufnr, function()
end) vim.cmd "norm! zz"
end)
end
end end
end end