fix(commands): completion error (#819)

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:
tzachar 2023-05-23 09:43:27 +03:00 committed by GitHub
parent 6610b15dfd
commit f125a7d333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -112,7 +112,7 @@ function M.setup()
---@param key string ---@param key string
return vim.tbl_filter(function(key) 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, vim.tbl_keys(M.commands))
end, end,
}) })