From f125a7d333472ada244b4564805ba11be3c269a9 Mon Sep 17 00:00:00 2001 From: tzachar Date: Tue, 23 May 2023 09:43:27 +0300 Subject: [PATCH] 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. --- lua/lazy/view/commands.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazy/view/commands.lua b/lua/lazy/view/commands.lua index 0476400..3b81e6b 100644 --- a/lua/lazy/view/commands.lua +++ b/lua/lazy/view/commands.lua @@ -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, })