Skip to content

Commit

Permalink
fix: path completion when query fuzzy matching is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Oct 17, 2023
1 parent 416b474 commit 85bfacf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion lua/fzf-lua/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions lua/fzf-lua/complete.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down

0 comments on commit 85bfacf

Please sign in to comment.