From 85bfacfebe9b10980bd7f0ed4f292fe344877231 Mon Sep 17 00:00:00 2001 From: bhagwan Date: Tue, 17 Oct 2023 15:03:25 -0700 Subject: [PATCH] fix: path completion when query fuzzy matching is empty --- lua/fzf-lua/actions.lua | 1 - lua/fzf-lua/complete.lua | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/fzf-lua/actions.lua b/lua/fzf-lua/actions.lua index 2c980e9d..c080d1d1 100644 --- a/lua/fzf-lua/actions.lua +++ b/lua/fzf-lua/actions.lua @@ -56,7 +56,6 @@ end M.act = function(actions, selected, opts) if not actions or not selected then return end local keybind, entries = M.normalize_selected(actions, selected) - if #entries == 0 then return end -- no items selected local action = actions[keybind] if type(action) == "table" then -- Two types of action as table: diff --git a/lua/fzf-lua/complete.lua b/lua/fzf-lua/complete.lua index 6a60019f..200a0f63 100644 --- a/lua/fzf-lua/complete.lua +++ b/lua/fzf-lua/complete.lua @@ -65,6 +65,8 @@ local set_cmp_opts_path = function(opts) end -- completion function rebuilds the line with the full path opts.complete = function(selected, o, l, _) + -- query fuzzy matching is empty + if #selected == 0 then return end local replace_at = col - #before local relpath = path.relative(path.entry_to_file(selected[1], o).path, opts.cwd) local before_path = replace_at > 1 and l:sub(1, replace_at - 1) or ""