Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
fperez opened this Issue · 5 comments

4 participants

Fernando Perez Paul Ivanov Thomas Kluyver Min RK
Fernando Perez
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 /.

Paul Ivanov
Owner
Fernando Perez
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.

Thomas Kluyver
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.

Min RK minrk closed this issue from a commit
Min RK 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
Min RK minrk closed this in 2d60716
Min RK
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.

Fernando Perez
Owner

Thanks a ton, @minrk!

Brian E. Granger ellisonbg referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
matthew von rocketstein mattvonrocketstein referenced this issue from a commit in mattvonrocketstein/ipython
Min RK 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.