Show More
@@ -331,7 +331,29 b' def cd_completer(self, event):' | |||||
331 | if os.path.isdir(relpath): |
|
331 | if os.path.isdir(relpath): | |
332 | return [relpath] |
|
332 | return [relpath] | |
333 | raise IPython.ipapi.TryNext |
|
333 | raise IPython.ipapi.TryNext | |
334 | return found |
|
334 | ||
|
335 | ||||
|
336 | def single_dir_expand(matches): | |||
|
337 | "Recursively expand match lists containing a single dir." | |||
|
338 | ||||
|
339 | if len(matches) == 1 and os.path.isdir(matches[0]): | |||
|
340 | # Takes care of links to directories also. Use '/' | |||
|
341 | # explicitly, even under Windows, so that name completions | |||
|
342 | # don't end up escaped. | |||
|
343 | d = matches[0] | |||
|
344 | if d[-1] in ['/','\\']: | |||
|
345 | d = d[:-1] | |||
|
346 | ||||
|
347 | subdirs = [p for p in os.listdir(d) if os.path.isdir( d + '/' + p)] | |||
|
348 | if subdirs: | |||
|
349 | matches = [ (d + '/' + p) for p in subdirs ] | |||
|
350 | return single_dir_expand(matches) | |||
|
351 | else: | |||
|
352 | return matches | |||
|
353 | else: | |||
|
354 | return matches | |||
|
355 | ||||
|
356 | return single_dir_expand(found) | |||
335 |
|
357 | |||
336 | def apt_get_packages(prefix): |
|
358 | def apt_get_packages(prefix): | |
337 | out = os.popen('apt-cache pkgnames') |
|
359 | out = os.popen('apt-cache pkgnames') |
@@ -6,6 +6,9 b'' | |||||
6 | * Magic.py: cpaste strips whitespace before >>> (allow pasting |
|
6 | * Magic.py: cpaste strips whitespace before >>> (allow pasting | |
7 | doctests) |
|
7 | doctests) | |
8 |
|
8 | |||
|
9 | * ipy_completers.py: cd completer now does recursive path expand | |||
|
10 | (old behaviour is buggy on some readline versions) | |||
|
11 | ||||
9 | 2008-05-14 Ville Vainio <vivainio@gmail.com> |
|
12 | 2008-05-14 Ville Vainio <vivainio@gmail.com> | |
10 |
|
13 | |||
11 | * Extensions/ipy_greedycompleter.py: |
|
14 | * Extensions/ipy_greedycompleter.py: |
General Comments 0
You need to be logged in to leave comments.
Login now