##// END OF EJS Templates
- Fix tab-completion so that quotes are not closed unless the completion is...
fptest -
Show More
@@ -49,16 +49,16 b' pkg_cache = None'
49 49
50 50 def module_completer(self,event):
51 51 """ Give completions after user has typed 'import' """
52
52
53 53 # only a local version for py 2.4, pkgutil has no walk_packages() there
54 if sys.version_info < (2,5):
55 for el in [f[:-3] for f in glob.glob("*.py")]:
56 yield el
54 if sys.version_info < (2,5):
55 for el in [f[:-3] for f in glob.glob("*.py")]:
56 yield el
57 57 return
58
58
59 59 global pkg_cache
60 60 import pkgutil,imp,time
61 #current =
61 #current =
62 62 if pkg_cache is None:
63 63 print "\n\n[Standby while scanning modules, this can take a while]\n\n"
64 64 pkg_cache = list(pkgutil.walk_packages())
@@ -95,11 +95,14 b' def runlistpy(self, event):'
95 95 comps = shlex.split(event.line)
96 96 relpath = (len(comps) > 1 and comps[-1] or '')
97 97
98 print "rp",relpath
98 #print "rp",relpath # dbg
99 glob = glob.glob
100 isdir = os.path.isdir
99 101 if relpath.startswith('~'):
100 102 relpath = os.path.expanduser(relpath)
101 dirs = [f.replace('\\','/') + "/" for f in glob.glob(relpath+'*') if os.path.isdir(f)]
102 pys = [f.replace('\\','/') for f in glob.glob(relpath+'*.py')]
103 dirs = [f.replace('\\','/') + "/" for f in glob(relpath+'*')
104 if isdir(f)]
105 pys = [f.replace('\\','/') for f in glob(relpath+'*.py')]
103 106 return dirs + pys
104 107
105 108 ip.set_hook('complete_command', runlistpy, str_key = '%run')
@@ -127,4 +130,4 b' def cd_completer(self, event):'
127 130 return [relpath]
128 131 return found
129 132
130 ip.set_hook('complete_command', cd_completer, str_key = '%cd')
133 ip.set_hook('complete_command', cd_completer, str_key = '%cd')
@@ -344,7 +344,7 b' class IPCompleter(Completer):'
344 344 current (as of Python 2.3) Python readline it's possible to do
345 345 better."""
346 346
347 # print 'Completer->file_matches: <%s>' % text # dbg
347 #print 'Completer->file_matches: <%s>' % text # dbg
348 348
349 349 # chars that require escaping with backslash - i.e. chars
350 350 # that readline treats incorrectly as delimiters, but we
@@ -406,7 +406,9 b' class IPCompleter(Completer):'
406 406 # Takes care of links to directories also. Use '/'
407 407 # explicitly, even under Windows, so that name completions
408 408 # don't end up escaped.
409 matches[0] += '/'
409 pjoin = os.path.join
410 d = matches[0]
411 matches = [ pjoin(d,p) for p in os.listdir(d) ]
410 412 return matches
411 413
412 414 def alias_matches(self, text):
@@ -1,3 +1,10 b''
1 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/completer.py (IPCompleter.file_matches): Fix
4 tab-completion so that quotes are not closed unless the completion
5 is unambiguous. After a request by Stefan. Minor cleanups in
6 ipy_stock_completers.
7
1 8 2006-11-02 Ville Vainio <vivainio@gmail.com>
2 9
3 10 * ipy_stock_completers.py: Add %run and %cd completers.
General Comments 0
You need to be logged in to leave comments. Login now