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

Handle paths with spaces #68

Closed
jessejoe opened this issue Mar 16, 2015 · 7 comments
Closed

Handle paths with spaces #68

jessejoe opened this issue Mar 16, 2015 · 7 comments
Labels
Milestone

Comments

@jessejoe
Copy link

When you tab complete folders with spaces in them, the spaces are not delimited with \, so you have to instead put quotes around them:

jesse@rmbp13 ~/xonsh $ mkdir "folder with spaces"
jesse@rmbp13 ~/xonsh $ ls
folder with spaces
jesse@rmbp13 ~/xonsh $ cd folder with spaces/
                             ^ Hit tab to complete
cd takes 0 or 1 arguments, not 3
jesse@rmbp13 ~/xonsh $ ls folder with spaces/
                             ^ Hit tab to complete
ls: folder: No such file or directory
ls: spaces/: No such file or directory
ls: with: No such file or directory
jesse@rmbp13 ~/xonsh $ cd "folder with spaces"
jesse@rmbp13 ~/xonsh/folder with spaces $

Adding the the \ instead doesn't work either (maybe why they aren't added during tab completion?):

jesse@rmbp13 ~ $ cd folder\ with\ spaces/
................
...
SyntaxError: <xonsh-code>:1:10: Invalid token '\\'

This is on OSX with xonsh 0.1.2.

@scopatz
Copy link
Member

scopatz commented Mar 17, 2015

Ahh super interesting. Maybe the tab-completion should add the quotes. How do you feel about that?

@scopatz
Copy link
Member

scopatz commented Mar 17, 2015

Thanks for reporting @jessejoe!

@scopatz scopatz added the bug label Mar 17, 2015
@scopatz scopatz added this to the v0.2 milestone Mar 17, 2015
@adqm
Copy link
Member

adqm commented Mar 17, 2015

To me, having the completer add the quotes feels like the right thing. I started working on this, but it looks like it is going to be difficult to get something that feels "right."

That is, it's easy to make the completer add the quotes. But it seems like it will be hard to get it to complete halfway-finished quoted strings (particularly after a space). So if we have a directory called name with spaces, then it will complete na or "na or 'na, but not "name wi.

This is maybe fine, but the downside is if we do: tab complete, backspace, tab; then it will not re-complete to the right value.

I will submit a pull request with what I have now in case it helps, but it isn't perfect.

@scopatz
Copy link
Member

scopatz commented Mar 17, 2015

Cool, It seems like the right thing to do to me would be to insert quotes on both sides, though. I'll check out your PR.

@jessejoe
Copy link
Author

Adding quotes seems okay, that's what cmd.exe does in Windows, however it is very annoying when it matches something else, you have to backspace, tab again, possibly backspace again, tab again, etc. This would honestly make it a little too annoying for daily use for me.

@scopatz
Copy link
Member

scopatz commented Mar 17, 2015

Adding quotes or not seems like the kind of thing that could easily be configure by an environment variable. If you wanted to add that behavior, that would be great!

@scopatz
Copy link
Member

scopatz commented Apr 2, 2015

I am closing this in favor of #181.

@scopatz scopatz closed this as completed Apr 2, 2015
@adqm adqm mentioned this issue Apr 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants