Skip to content

Commit

Permalink
fix(previewer): keymaps/marks with no matche (closes #1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Jul 31, 2024
1 parent c7288e6 commit 2a82a2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/fzf-lua/path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ function M.keymap_to_entry(str, opts)
t = true,
}
local mode, keymap = string.match(str, "^(.-)│(.-)│")
if not mode or not keymap then return {} end
mode, keymap = vim.trim(mode), vim.trim(keymap)
mode = valid_modes[mode] and mode or "" -- only valid modes
local vmap = utils.strsplit(
Expand All @@ -567,7 +568,7 @@ function M.keymap_to_entry(str, opts)
entry = out[i]:match("<.-:%s+(.*)>")
end
end
return entry and M.entry_to_file(entry, opts) or { mode = mode, key = keymap, vmap = vmap }
return entry and M.entry_to_file(entry, opts) or { mode = mode, key = keymap, vmap = vmap } or {}
end

-- Minimal functionality so we can hijack during `vim.filetype.match`
Expand Down
1 change: 1 addition & 0 deletions lua/fzf-lua/previewer/builtin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@ end
function Previewer.marks:parse_entry(entry_str)
local bufnr = nil
local mark, lnum, col, filepath = entry_str:match("(.)%s+(%d+)%s+(%d+)%s+(.*)")
if not mark then return {} end
-- try to acquire position from sending buffer
-- if this succeeds (line>0) the mark is inside
local pos = vim.api.nvim_buf_get_mark(self.win.src_bufnr, mark)
Expand Down

0 comments on commit 2a82a2f

Please sign in to comment.