@@ -131,7 +131,7 @@ class LineInfo(object):
131131 def __init__ (self , line , continue_prompt ):
132132 self .line = line
133133 self .continue_prompt = continue_prompt
134- self .pre , self .ifun , self .the_rest = split_user_input (line )
134+ self .pre , self .esc , self . ifun , self .the_rest = split_user_input (line )
135135
136136 self .pre_char = self .pre .strip ()
137137 if self .pre_char :
@@ -630,7 +630,7 @@ def check(self, line_info):
630630 # both ! and !!.
631631 if line_info .continue_prompt \
632632 and self .prefilter_manager .multi_line_specials :
633- if line_info .ifun . startswith ( ESC_MAGIC ) :
633+ if line_info .esc == ESC_MAGIC :
634634 return self .prefilter_manager .get_handler_by_name ('magic' )
635635 else :
636636 return None
@@ -644,14 +644,16 @@ def check(self, line_info):
644644 """Check for escape character and return either a handler to handle it,
645645 or None if there is no escape char."""
646646 if line_info .line [- 1 ] == ESC_HELP \
647- and line_info .pre_char != ESC_SHELL \
648- and line_info .pre_char != ESC_SH_CAP :
647+ and line_info .esc != ESC_SHELL \
648+ and line_info .esc != ESC_SH_CAP :
649649 # the ? can be at the end, but *not* for either kind of shell escape,
650650 # because a ? can be a vaild final char in a shell cmd
651651 return self .prefilter_manager .get_handler_by_name ('help' )
652652 else :
653+ if line_info .pre :
654+ return None
653655 # This returns None like it should if no handler exists
654- return self .prefilter_manager .get_handler_by_esc (line_info .pre_char )
656+ return self .prefilter_manager .get_handler_by_esc (line_info .esc )
655657
656658
657659class AssignmentChecker (PrefilterChecker ):
@@ -872,6 +874,7 @@ def handle(self, line_info):
872874 ifun = line_info .ifun
873875 the_rest = line_info .the_rest
874876 pre = line_info .pre
877+ esc = line_info .esc
875878 continue_prompt = line_info .continue_prompt
876879 obj = line_info .ofind (self )['obj' ]
877880 #print 'pre <%s> ifun <%s> rest <%s>' % (pre,ifun,the_rest) # dbg
@@ -883,13 +886,13 @@ def handle(self, line_info):
883886 force_auto = isinstance (obj , IPyAutocall )
884887 auto_rewrite = getattr (obj , 'rewrite' , True )
885888
886- if pre == ESC_QUOTE :
889+ if esc == ESC_QUOTE :
887890 # Auto-quote splitting on whitespace
888891 newcmd = '%s("%s")' % (ifun ,'", "' .join (the_rest .split ()) )
889- elif pre == ESC_QUOTE2 :
892+ elif esc == ESC_QUOTE2 :
890893 # Auto-quote whole string
891894 newcmd = '%s("%s")' % (ifun ,the_rest )
892- elif pre == ESC_PAREN :
895+ elif esc == ESC_PAREN :
893896 newcmd = '%s(%s)' % (ifun ,"," .join (the_rest .split ()))
894897 else :
895898 # Auto-paren.
@@ -946,7 +949,7 @@ def handle(self, line_info):
946949 line = line [:- 1 ]
947950 if line :
948951 #print 'line:<%r>' % line # dbg
949- self .shell .magic_pinfo (line )
952+ self .shell .magic_pinfo (line_info . ifun )
950953 else :
951954 self .shell .show_usage ()
952955 return '' # Empty string is needed here!
0 commit comments