Skip to content
This repository

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

Closed
fperez opened this Issue October 13, 2011 · 5 comments

4 participants

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

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 October 26, 2011
Min RK 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 October 26, 2011
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 January 10, 2012
Commit has since been removed from the repository and is no longer available.
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.