Skip to content

Commit

Permalink
looks: when there is no file, display a single bar in the quickfix
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanueltouzery committed Dec 23, 2024
1 parent 049d665 commit 30ee80b
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions lua/quicker/display.lua
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,12 @@ function M.quickfixtextfunc(info)
if item.valid == 1 then
-- Matching line
local lnum = item.lnum == 0 and " " or item.lnum
local pieces = {
rpad(get_filename_from_item(item), col_width),
lnum_fmt:format(lnum),
remove_prefix(item.text, prefixes[item.bufnr]),
}
local pieces = {}
if col_width > 1 then
table.insert(pieces, rpad(get_filename_from_item(item), col_width))
end
table.insert(pieces, lnum_fmt:format(lnum))
table.insert(pieces, remove_prefix(item.text, prefixes[item.bufnr]))
table.insert(ret, table.concat(pieces, b.vert))
elseif user_data.header == "hard" then
-- Header when expanded QF list
Expand Down Expand Up @@ -467,20 +468,22 @@ function M.quickfixtextfunc(info)
table.insert(ret, table.concat(pieces, ""))
elseif user_data.lnum then
-- Non-matching line from quicker.nvim context lines
local pieces = {
string.rep(" ", col_width),
lnum_fmt:format(user_data.lnum),
remove_prefix(item.text, prefixes[item.bufnr]),
}
local pieces = {}
if col_width > 1 then
table.insert(pieces, string.rep(" ", col_width))
end
table.insert(pieces, lnum_fmt:format(user_data.lnum))
table.insert(pieces, remove_prefix(item.text, prefixes[item.bufnr]))
table.insert(ret, table.concat(pieces, b.vert))
else
-- Other non-matching line
local lnum = item.lnum == 0 and " " or item.lnum
local pieces = {
rpad(get_filename_from_item(item), col_width),
lnum_fmt:format(lnum),
remove_prefix(item.text, prefixes[item.bufnr]),
}
local pieces = {}
if col_width > 1 then
table.insert(pieces, rpad(get_filename_from_item(item), col_width))
end
table.insert(pieces, lnum_fmt:format(lnum))
table.insert(pieces, remove_prefix(item.text, prefixes[item.bufnr]))
table.insert(ret, table.concat(pieces, b.vert))
end
end
Expand Down

0 comments on commit 30ee80b

Please sign in to comment.