diff options
| author | Senghan Bright <senghan.bright@deltaprojects.com> | 2020-12-13 17:25:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-13 17:25:25 +0100 |
| commit | 9a97982fc7f83a732e2f7080515288512722a66f (patch) | |
| tree | 3be74f6a5785664e9198801ee1d13c165dbd3280 /lua/telescope/make_entry.lua | |
| parent | 7b5411ce54ac03c145d80d8cddecc8de4de4e213 (diff) | |
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
Diffstat (limited to 'lua/telescope/make_entry.lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index aee7f86..0a12764 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -233,24 +233,31 @@ function make_entry.gen_from_quickfix(opts) opts = opts or {} opts.tail_path = get_default(opts.tail_path, true) - local make_display = function(entry) - local to_concat = {} + local displayer = entry_display.create { + separator = "▏", + items = { + { width = 6 }, + { width = 50 }, + { remaining = true }, + }, + } + local make_display = function(entry) + local filename if not opts.hide_filename then - local filename = entry.filename + filename = entry.filename if opts.tail_path then filename = utils.path_tail(filename) elseif opts.shorten_path then filename = utils.path_shorten(filename) end - - table.insert(to_concat, filename) - table.insert(to_concat, ":") end - table.insert(to_concat, entry.text) - - return table.concat(to_concat, "") + return displayer { + entry.lnum .. ":" .. entry.col, + entry.text:gsub(".* | ", ""), + filename, + } end return function(entry) |
