##// END OF EJS Templates
Applied Joergen's patch for %run completer quote mismatch exception, closing #127.
vivainio -
Show More
@@ -164,12 +164,30 b' def bzr_completer(self,event):'
164 return bzr_commands.split()
164 return bzr_commands.split()
165
165
166 ip.set_hook('complete_command', bzr_completer, str_key = 'bzr')
166 ip.set_hook('complete_command', bzr_completer, str_key = 'bzr')
167
167
168 def shlex_split(x):
169 """Helper function to split lines into segments."""
170 #shlex.split raise exception if syntax error in sh syntax
171 #for example if no closing " is found. This function keeps dropping
172 #the last character of the line until shlex.split does not raise
173 #exception. Adds end of the line to the result of shlex.split
174 #example: %run "c:/python -> ['%run','"c:/python']
175 endofline=[]
176 while x!="":
177 try:
178 comps=shlex.split(x)
179 if endofline>=1:
180 comps.append("".join(endofline))
181 return comps
182 except ValueError:
183 endofline=[x[-1:]]+endofline
184 x=x[:-1]
185 return ["".join(endofline)]
168
186
169 def runlistpy(self, event):
187 def runlistpy(self, event):
170 comps = shlex.split(event.line)
188 comps = shlex_split(event.line)
171 relpath = (len(comps) > 1 and comps[-1] or '')
189 relpath = (len(comps) > 1 and comps[-1] or '').strip("'\"")
172
190
173 #print "\nev=",event # dbg
191 #print "\nev=",event # dbg
174 #print "rp=",relpath # dbg
192 #print "rp=",relpath # dbg
175 #print 'comps=',comps # dbg
193 #print 'comps=',comps # dbg
@@ -1,3 +1,9 b''
1 2007-03-15 Ville Vainio <vivainio@gmail.com>
2
3 * Extensions/ipy_stock_completers.py: Fixed exception
4 on mismatching quotes in %run completer. Patch by
5 J�rgen Stenarson. Closes #127.
6
1 2007-03-14 Ville Vainio <vivainio@gmail.com>
7 2007-03-14 Ville Vainio <vivainio@gmail.com>
2
8
3 * Extensions/ext_rehashdir.py: Do not do auto_alias
9 * Extensions/ext_rehashdir.py: Do not do auto_alias
General Comments 0
You need to be logged in to leave comments. Login now