summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/make_entry.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index 4db664e..ede729b 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -212,7 +212,12 @@ function make_entry.gen_from_buffer(opts)
-- if bufname is inside the cwd, trim that part of the string
if bufname:sub(1, #cwd) == cwd then
- bufname = bufname:sub(#cwd + 1, #bufname)
+ local offset = 0
+ -- if cwd does ends in '/', we need to take it off
+ if cwd:sub(#cwd, #cwd) ~= '/' then
+ offset = 1
+ end
+ bufname = bufname:sub(#cwd + 1 + offset, #bufname)
end
local position = get_position(entry)