diff options
| author | Rui Marques <mail@ruimarques.xyz> | 2020-09-22 22:38:38 +0200 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-26 10:42:19 -0400 |
| commit | 6b23ef988b0f469917ede79c8a61c31456d0a8b0 (patch) | |
| tree | a3ff0165ae88d36ff14afe746ded09ac3477e19a /lua | |
| parent | 541c4c33e62f93636b6f3e25067a0d20b69220e6 (diff) | |
Fix issue with trimming path separator '/'
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 7 |
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) |
