fix: searchcount exception on invalid search regex (#2693)

* fix: wrap searchcount in pcall to avoid error

* fix: searchcount in pcall

---------

Co-authored-by: xVermillionx <xVermillionx@notvalid>
This commit is contained in:
DB 2024-03-09 03:27:23 +01:00 committed by GitHub
parent efafd73efa
commit 041dbd18f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,8 +105,8 @@ function M.open_on_directory()
end end
function M.place_cursor_on_node() function M.place_cursor_on_node()
local search = vim.fn.searchcount() local ok, search = pcall(vim.fn.searchcount)
if search and search.exact_match == 1 then if ok and search and search.exact_match == 1 then
return return
end end