change quickfix make_entry to use column displayer (#331)
* change quickfix make_entry to use column displayer * fix: don't convert filename to empty string
This commit is contained in:
@@ -233,24 +233,31 @@ function make_entry.gen_from_quickfix(opts)
|
|||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
opts.tail_path = get_default(opts.tail_path, true)
|
opts.tail_path = get_default(opts.tail_path, true)
|
||||||
|
|
||||||
local make_display = function(entry)
|
local displayer = entry_display.create {
|
||||||
local to_concat = {}
|
separator = "▏",
|
||||||
|
items = {
|
||||||
|
{ width = 6 },
|
||||||
|
{ width = 50 },
|
||||||
|
{ remaining = true },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local make_display = function(entry)
|
||||||
|
local filename
|
||||||
if not opts.hide_filename then
|
if not opts.hide_filename then
|
||||||
local filename = entry.filename
|
filename = entry.filename
|
||||||
if opts.tail_path then
|
if opts.tail_path then
|
||||||
filename = utils.path_tail(filename)
|
filename = utils.path_tail(filename)
|
||||||
elseif opts.shorten_path then
|
elseif opts.shorten_path then
|
||||||
filename = utils.path_shorten(filename)
|
filename = utils.path_shorten(filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(to_concat, filename)
|
|
||||||
table.insert(to_concat, ":")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(to_concat, entry.text)
|
return displayer {
|
||||||
|
entry.lnum .. ":" .. entry.col,
|
||||||
return table.concat(to_concat, "")
|
entry.text:gsub(".* | ", ""),
|
||||||
|
filename,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
return function(entry)
|
return function(entry)
|
||||||
|
|||||||
Reference in New Issue
Block a user