Permalink
Browse files

Abbreviate all files with ... in tab-completion.

If there is a unique completion, readline will automatically close the
current string.  To prevent this behavior we present a fake '...' file in
non-empty directories.

Closes gh-1172.
  • Loading branch information...
1 parent c8874d7 commit 3ccf71808516bf7c072eee3ed916ace370e607ae @bfroehle committed Dec 18, 2011
Showing with 9 additions and 0 deletions.
  1. +9 −0 IPython/core/completer.py
@@ -140,6 +140,15 @@ def mark_dirs(matches):
out.append(x+'/')
else:
out.append(x)
+
+ # If there is a unique completion readline will automatically close the
+ # string. To prevent the behavior, we add a '...' entry to non-empty
+ # directories.
+ if len(matches) == 1:
+ x = matches[0]
+ if isdir(x) and len(os.listdir(x)):
+ out.append(x+'/...')
+
return out

0 comments on commit 3ccf718

Please sign in to comment.