Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(make_entry): fix ordinal basename #368

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions lua/telescope/_extensions/file_browser/make_entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ local make_entry = function(opts)
local parent_dir = Path:new(opts.cwd):parent():absolute()
local mt = {}
mt.cwd = opts.cwd
-- +1 to start at first file char; cwd may or may not end in os_sep
local cwd_substr = #mt.cwd + 1
cwd_substr = mt.cwd:sub(-1, -1) ~= os_sep and cwd_substr + os_sep_len or cwd_substr

-- TODO(fdschmidt93): handle VimResized with due to variable width
mt.display = function(entry)
Expand Down Expand Up @@ -245,7 +242,7 @@ local make_entry = function(opts)
local e = setmetatable({
absolute_path,
ordinal = (absolute_path == opts.cwd and ".")
or (absolute_path == parent_dir and ".." or absolute_path:sub(cwd_substr, -1)),
or (absolute_path == parent_dir and ".." or vim.fs.basename(absolute_path)),
Path = path,
path = absolute_path,
is_dir = is_dir,
Expand Down
Loading