complete_dotted: fix for #361, filecompleter on dot files had differing behaviour from bash

Now if the prefix to expands ends in the directory seperator, then
'..../.*' is globbed as well.
This commit is contained in:
Anthon van der Neut 2013-10-01 16:33:15 +02:00
parent 9b9355b8da
commit 236fff00ad
1 changed files with 5 additions and 1 deletions

View File

@ -74,9 +74,13 @@ class FastFilesCompleter:
else:
prefix_dir = 0
completion = []
globbed = []
if '*' not in prefix and '?' not in prefix:
if prefix[-1] == os.path.sep: # we are on unix, otherwise no bash
globbed.extend(glob(prefix + '.*'))
prefix += '*'
for x in sorted(glob(prefix)):
globbed.extend(glob(prefix))
for x in sorted(globbed):
if os.path.isdir(x):
x += '/'
# append stripping the prefix (like bash, not like compgen)