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

Trailing space incorrectly added to some directories #53

Open
dberlin opened this issue Oct 24, 2024 · 0 comments
Open

Trailing space incorrectly added to some directories #53

dberlin opened this issue Oct 24, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@dberlin
Copy link

dberlin commented Oct 24, 2024

There is code that purports to avoid adding trailing spaces to directory expansions, here:

if test (count $result) -eq 1; and not test -d (string unescape -- $result[1])

This works for some directories, but if you do something like cd ~/foo<tab> where foo is the unique prefix of a directory in your homedir, it will add a space.

Presumably because it is not tilde-expanding the result when it's a string. test -d does not tilde expand strings. In fact, i can't find any function that does - path resolve will not do it, etc.

It looks like fish added a way to expand tokens in master, which will be nice someday when everyone is on fish 3.8.
See the end of fish-shell/fish-shell#5793

Otherwise, the only way to make this work seems to be
eval "echo" <string>

IE
replacing
set -a result (string join -- "" "~" (string sub --start 2 -- $token | string escape))
with
set -a result (eval 'echo' (string join -- "" "~" (string sub --start 2 -- $token | string escape)))

makes it all work
this seems super ugly but even the bug report above mentions it as the way to get everything expanded.
Happy to prepare a patch.

@dberlin dberlin added the bug Something isn't working label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants