fix completion error

When Lazy commands are searched in command line mode, completion fails
horribly (sometime crashing nvim entirely) when the partial string to
complete contains non-escape characters.
For example, running `:Lazy up[` results in a crash.

The fix is to instruct string.find to perform a literal search, treating
the string to search not as a regular expression.
This commit is contained in:
Nir Tzachar 2023-05-23 08:47:05 +03:00
commit 98957febda

View file

@ -112,7 +112,7 @@ function M.setup()
---@param key string
return vim.tbl_filter(function(key)
return key:find(prefix) == 1
return key:find(prefix, 1, true) == 1
end, vim.tbl_keys(M.commands))
end,
})