##// END OF EJS Templates
handle ! as priority
vivainio -
Show More
@@ -136,8 +136,9 b' def prefilter(line_info, ip):'
136 value, even if it's a blank ('')."""
136 value, even if it's a blank ('')."""
137 # Note: the order of these checks does matter.
137 # Note: the order of these checks does matter.
138 for check in [ checkEmacs,
138 for check in [ checkEmacs,
139 checkShellEscape,
139 checkIPyAutocall,
140 checkIPyAutocall,
140 checkMultiLineShell,
141 checkMultiLineMagic,
141 checkEscChars,
142 checkEscChars,
142 checkAssignment,
143 checkAssignment,
143 checkAutomagic,
144 checkAutomagic,
@@ -162,6 +163,11 b' def prefilter(line_info, ip):'
162 # In general, these checks should only take responsibility for their 'own'
163 # In general, these checks should only take responsibility for their 'own'
163 # handler. If it doesn't get triggered, they should just return None and
164 # handler. If it doesn't get triggered, they should just return None and
164 # let the rest of the check sequence run.
165 # let the rest of the check sequence run.
166
167 def checkShellEscape(l_info,ip):
168 if l_info.line.lstrip().startswith(ip.ESC_SHELL):
169 return ip.handle_shell_escape
170
165 def checkEmacs(l_info,ip):
171 def checkEmacs(l_info,ip):
166 "Emacs ipython-mode tags certain input lines."
172 "Emacs ipython-mode tags certain input lines."
167 if l_info.line.endswith('# PYTHON-MODE'):
173 if l_info.line.endswith('# PYTHON-MODE'):
@@ -179,15 +185,13 b' def checkIPyAutocall(l_info,ip):'
179 return None
185 return None
180
186
181
187
182 def checkMultiLineShell(l_info,ip):
188 def checkMultiLineMagic(l_info,ip):
183 "Allow ! and !! in multi-line statements if multi_line_specials is on"
189 "Allow ! and !! in multi-line statements if multi_line_specials is on"
184 # Note that this one of the only places we check the first character of
190 # Note that this one of the only places we check the first character of
185 # iFun and *not* the preChar. Also note that the below test matches
191 # iFun and *not* the preChar. Also note that the below test matches
186 # both ! and !!.
192 # both ! and !!.
187 if l_info.continue_prompt \
193 if l_info.continue_prompt \
188 and ip.rc.multi_line_specials:
194 and ip.rc.multi_line_specials:
189 if l_info.iFun.startswith(ip.ESC_SHELL):
190 return ip.handle_shell_escape
191 if l_info.iFun.startswith(ip.ESC_MAGIC):
195 if l_info.iFun.startswith(ip.ESC_MAGIC):
192 return ip.handle_magic
196 return ip.handle_magic
193 else:
197 else:
@@ -162,6 +162,7 b' esc_handler_tests = ['
162 ( '!thing arg?', handle_shell_escape),
162 ( '!thing arg?', handle_shell_escape),
163 ( '!!thing?', handle_shell_escape),
163 ( '!!thing?', handle_shell_escape),
164 ( '!!thing arg?', handle_shell_escape),
164 ( '!!thing arg?', handle_shell_escape),
165 ( ' !!thing arg?', handle_shell_escape),
165
166
166 # For all other leading esc chars, we always trigger help
167 # For all other leading esc chars, we always trigger help
167 ( '%cmd?', handle_help),
168 ( '%cmd?', handle_help),
General Comments 0
You need to be logged in to leave comments. Login now