-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
~/ completes to \~/ on zsh #503
Comments
Hi, I'm experiencing this too - the consequence on I've done some quick tests and this happens both when using |
Thanks for your input. I can reproduce the issue but it appears cosmetic - while unnecessary, the escaping is semantically correct, right? Do you see any errors or completion blocking issues arise out of this? I agree that the escaping is unfortunate and would be glad to get rid of it, but I'm not sure how to do that yet. As @FlorianPommerening points out, zsh makes a complicated set of assumptions when escaping that I'm not fully confident we can control. |
Hi, thanks for looking into this! Unfortunately it's not just a cosmetic thing - the escaped version has a different meaning than the non-escaped version. Specifically, For example, in the example above, This means it would try to open a file in a subdirectory of the working directory called |
Ah, you're right. OK, into the mines of zsh completion I go. |
What a way to spend a Sunday... thanks and good luck! |
I'm thinking this is part of a broader issue where we use a bash subprocess to generate filename and directory completions instead of communicating back to the shellcode that we should ask the shell to do that directly. This will take a little bit of rearchitecting. |
The alias
~
for the home directory is escaped on zsh.To reproduce
Test environment:
Content of
foo.py
Expected completion is
./foo.py ~/.bashrc
and this is what happens on bash. However on zsh, I get./foo.py \~/.bashrc
.In both cases, the
FilesCompleter
returns the path as~/.bashrc
(not escaped), so the escaping happens later on in the pipeline. In particular, this is part of the zsh built-in_describe
which in turn callscompadd
to add the string~/.bashrc
to the list of suggestions. At this point the string is escaped. There are options to prevent this escaping that can also be passed to_describe
but it is not clear to me, which one to use (https://zsh.sourceforge.io/Doc/zsh_us.pdf, chapter 19.3 forcompadd
and 20.6 for_describe
). For example,-Q
would disable escaping completely but this would be an issue for paths with spaces. Then something like-f -W \~
might work but it assumes that the returned values are paths.The text was updated successfully, but these errors were encountered: