summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/make_entry.lua3
-rw-r--r--lua/telescope/utils.lua5
2 files changed, 6 insertions, 2 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index efeb750..8e9f84a 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -484,8 +484,9 @@ function make_entry.gen_from_buffer(opts)
local cwd = vim.fn.expand(opts.cwd or vim.loop.cwd())
local make_display = function(entry)
+ -- bufnr_width + modes + icon + 3 spaces + : + lnum
+ opts.__prefix = opts.bufnr_width + 4 + icon_width + 3 + 1 + #tostring(entry.lnum)
local display_bufname = utils.transform_path(opts, entry.filename)
-
local icon, hl_group = utils.get_devicons(entry.filename, disable_devicons)
return displayer {
diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua
index 07800b2..356d102 100644
--- a/lua/telescope/utils.lua
+++ b/lua/telescope/utils.lua
@@ -276,7 +276,10 @@ utils.transform_path = function(opts, path)
if opts.__length == nil then
opts.__length = calc_result_length(path_display.truncate)
end
- transformed_path = truncate(transformed_path, opts.__length, nil, -1)
+ if opts.__prefix == nil then
+ opts.__prefix = 0
+ end
+ transformed_path = truncate(transformed_path, opts.__length - opts.__prefix, nil, -1)
end
end