Show More
@@ -267,20 +267,23 b' def magic_run_completer(self, event):' | |||
|
267 | 267 | isdir = os.path.isdir |
|
268 | 268 | relpath, tilde_expand, tilde_val = expand_user(relpath) |
|
269 | 269 | |
|
270 | dirs = [f.replace('\\','/') + "/" for f in lglob(relpath+'*') if isdir(f)] | |
|
271 | ||
|
272 | 270 | # Find if the user has already typed the first filename, after which we |
|
273 | 271 | # should complete on all files, since after the first one other files may |
|
274 | 272 | # be arguments to the input script. |
|
275 | 273 | |
|
276 | 274 | if any(magic_run_re.match(c) for c in comps): |
|
277 |
|
|
|
275 | matches = [f.replace('\\','/') + ('/' if isdir(f) else '') | |
|
276 | for f in lglob(relpath+'*')] | |
|
278 | 277 | else: |
|
278 | dirs = [f.replace('\\','/') + "/" for f in lglob(relpath+'*') if isdir(f)] | |
|
279 | 279 | pys = [f.replace('\\','/') |
|
280 | 280 | for f in lglob(relpath+'*.py') + lglob(relpath+'*.ipy') + |
|
281 | 281 | lglob(relpath+'*.ipynb') + lglob(relpath + '*.pyw')] |
|
282 | ||
|
283 | matches = dirs + pys | |
|
284 | ||
|
282 | 285 | #print('run comp:', dirs+pys) # dbg |
|
283 |
return [compress_user(p, tilde_expand, tilde_val) for p in |
|
|
286 | return [compress_user(p, tilde_expand, tilde_val) for p in matches] | |
|
284 | 287 | |
|
285 | 288 | |
|
286 | 289 | def cd_completer(self, event): |
@@ -32,7 +32,7 b' class MockEvent(object):' | |||
|
32 | 32 | #----------------------------------------------------------------------------- |
|
33 | 33 | class Test_magic_run_completer(unittest.TestCase): |
|
34 | 34 | files = [u"aao.py", u"a.py", u"b.py", u"aao.txt"] |
|
35 | dirs = [u"adir", "bdir"] | |
|
35 | dirs = [u"adir/", "bdir/"] | |
|
36 | 36 | |
|
37 | 37 | def setUp(self): |
|
38 | 38 | self.BASETESTDIR = tempfile.mkdtemp() |
@@ -83,7 +83,7 b' class Test_magic_run_completer(unittest.TestCase):' | |||
|
83 | 83 | print(repr(event.line)) |
|
84 | 84 | match = set(magic_run_completer(None, event)) |
|
85 | 85 | self.assertEqual(match, {join(self.BASETESTDIR, f) for |
|
86 | f in (u'a.py', u'aao.py', u'aao.txt', u'adir')}) | |
|
86 | f in (u'a.py', u'aao.py', u'aao.txt', u'adir/')}) | |
|
87 | 87 | |
|
88 | 88 | class Test_magic_run_completer_nonascii(unittest.TestCase): |
|
89 | 89 | @onlyif_unicode_paths |
General Comments 0
You need to be logged in to leave comments.
Login now