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