Skip to content

Commit 724e8f0

Browse files
phanenibhagwan
authored andcommitted
fix: show debug information
regression from f82f986
1 parent 31b6713 commit 724e8f0

4 files changed

Lines changed: 10 additions & 12 deletions

File tree

lua/fzf-lua/path.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ function M.entry_to_file(entry, opts, force_uri)
524524
(opts.line_query(opts._last_query or opts.last_query)) or line) or 0,
525525
col = tonumber(col) or 0,
526526
ctag = opts._ctag and M.entry_to_ctag(stripped) or nil,
527+
debug = opts.debug and entry:match("^%[DEBUG]") and entry or nil,
527528
}
528529
end
529530

lua/fzf-lua/previewer/builtin.lua

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,8 @@ function Previewer.buffer_or_file:populate_preview_buf(entry_str)
917917
end
918918
do
919919
local lines = nil
920-
if entry.path:match("^%[DEBUG]") then
921-
lines = { tostring(entry.path:gsub("^%[DEBUG]", "")) }
920+
if entry.debug then
921+
lines = { entry.debug }
922922
elseif entry.content then
923923
lines = entry.content
924924
else
@@ -1285,16 +1285,12 @@ function Previewer.buffer_or_file:update_title(entry)
12851285
if not self.title then return end
12861286
local filepath = entry.path
12871287
if filepath then
1288-
if filepath:match("^%[DEBUG]") then
1289-
filepath = "[DEBUG]"
1290-
else
1291-
if self.opts.cwd then
1292-
filepath = path.relative_to(entry.path, self.opts.cwd)
1293-
end
1294-
filepath = path.HOME_to_tilde(filepath)
1288+
if self.opts.cwd then
1289+
filepath = path.relative_to(entry.path, self.opts.cwd)
12951290
end
1291+
filepath = path.HOME_to_tilde(filepath)
12961292
end
1297-
local title = filepath or entry.uri or entry.bufname
1293+
local title = entry.debug and "[DEBUG]" or filepath or entry.uri or entry.bufname
12981294
-- was transform function defined?
12991295
if self.title_fnamemodify then
13001296
local wincfg = vim.api.nvim_win_get_config(self.win.preview_winid)

lua/fzf-lua/previewer/fzf.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ function Previewer.cmd_async:parse_entry_and_verify(entrystr)
212212
end
213213
end
214214
local errcmd = nil
215-
if filepath:match("^%[DEBUG]") then
216-
errcmd = "echo " .. libuv.shellescape(tostring(filepath:gsub("^%[DEBUG]", "")))
215+
if entry.debug then
216+
errcmd = "echo " .. libuv.shellescape(entry.debug)
217217
else
218218
-- verify the file exists on disk and is accessible
219219
if #filepath == 0 or not uv.fs_stat(filepath) then

lua/fzf-lua/types.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ _G.FzfLua = require("fzf-lua")
6868
---@field ctag string?
6969
---@field uri string?
7070
---@field range { start: { line: integer, col: integer } }?
71+
---@field debug string? debug information
7172

7273
---@class fzf-lua.buffer_or_file.Entry : fzf-lua.path.Entry, {}
7374
---@field do_not_cache boolean?

0 commit comments

Comments
 (0)