Skip to content

Commit

Permalink
feat: filter out empty lines in picker
Browse files Browse the repository at this point in the history
  • Loading branch information
tanloong authored and Robitx committed May 28, 2024
1 parent aaec2ab commit 33a4d69
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lua/gp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2219,10 +2219,12 @@ M.cmd.ChatFinder = function()
preview_lines = {}
local picker_lines = {}
for _, f in ipairs(results) do
table.insert(picker_files, dir .. "/" .. f.file)
local fline = string.format("%s:%s %s", f.file:sub(3, -11), f.lnum, f.line)
table.insert(picker_lines, fline)
table.insert(preview_lines, tonumber(f.lnum))
if f.line:len() > 0 then
table.insert(picker_files, dir .. "/" .. f.file)
local fline = string.format("%s:%s %s", f.file:sub(3, -11), f.lnum, f.line)
table.insert(picker_lines, fline)
table.insert(preview_lines, tonumber(f.lnum))
end
end

vim.api.nvim_buf_set_lines(picker_buf, 0, -1, false, picker_lines)
Expand Down

0 comments on commit 33a4d69

Please sign in to comment.