-
Notifications
You must be signed in to change notification settings - Fork 26
Description
There is code that purports to avoid adding trailing spaces to directory expansions, here:
Line 69 in e953fcd
| 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.