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