Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Tab completion of `~/` shows no output post 0.10.x #869

Closed
fperez opened this Issue · 5 comments

4 participants

@fperez
Owner

This is a regression: in 0.10.x, doing cd ~/<TAB> properly completed, but now we only complete if there's at least a letter added after the /.

@ivanov
Owner
@fperez
Owner

Thanks for the data point, @ivanov. That's because ls is an alias while cd is a magic, and there are separate codepaths. But it's useful, as it helps us narrow where the broken part may lie.

@takluyver
Owner

It seems to be kind of working for me either with cd or ls. The ~/ gets expanded to /home/thomas/ within the line, but I still see the completions.

@minrk minrk closed this issue from a commit
@minrk minrk fix inappropriate str.replace in completer.expand_user
The replacement could catch extra matches, mangling the tilde_val.

This uses slicing instead, to prevent multiple replacements.

closes gh-869
2d60716
@minrk minrk closed this in 2d60716
@minrk
Owner

%run and %cd have special completers loaded from completerlib. The bug was a tiny one-liner in completer.expand_user, that makes an inappropriate call to str.replace, which doesn't take into account the fact that what it's replacing can occur more than once (e.g. it is '/' when expanding '~/', so the tilde_val is 'homeuser' instead of '/home/user'. I fixed it by truncating the path by length, rather than using str.replace.

@fperez
Owner

Thanks a ton, @minrk!

@ellisonbg ellisonbg referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@mattvonrocketstein mattvonrocketstein referenced this issue from a commit in mattvonrocketstein/ipython
@minrk minrk fix inappropriate str.replace in completer.expand_user
The replacement could catch extra matches, mangling the tilde_val.

This uses slicing instead, to prevent multiple replacements.

closes gh-869
3245421
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.