##// END OF EJS Templates
Fix bug for x.*a*? syntax, added tests for it.
Fernando Perez -
Show More
@@ -626,7 +626,7 b' class InputSplitter(object):'
626 line_split = re.compile("""
626 line_split = re.compile("""
627 ^(\s*) # any leading space
627 ^(\s*) # any leading space
628 ([,;/%]|!!?|\?\??) # escape character or characters
628 ([,;/%]|!!?|\?\??) # escape character or characters
629 \s*(%?[\w\.]*) # function/method, possibly with leading %
629 \s*(%?[\w\.\*]*) # function/method, possibly with leading %
630 # to correctly treat things like '?%magic'
630 # to correctly treat things like '?%magic'
631 (\s+.*$|$) # rest of line
631 (\s+.*$|$) # rest of line
632 """, re.VERBOSE)
632 """, re.VERBOSE)
@@ -674,6 +674,8 b' def split_user_input(line):'
674 ('', '', 'f.g', '(x)')
674 ('', '', 'f.g', '(x)')
675 >>> split_user_input('?%hist')
675 >>> split_user_input('?%hist')
676 ('', '?', '%hist', '')
676 ('', '?', '%hist', '')
677 >>> split_user_input('?x*')
678 ('', '?', 'x*', '')
677 """
679 """
678 match = line_split.match(line)
680 match = line_split.match(line)
679 if match:
681 if match:
@@ -850,6 +852,7 b' class EscapedTransformer(object):'
850
852
851 # There may be one or two '?' at the end, move them to the front so that
853 # There may be one or two '?' at the end, move them to the front so that
852 # the rest of the logic can assume escapes are at the start
854 # the rest of the logic can assume escapes are at the start
855 l_ori = line_info
853 line = line_info.line
856 line = line_info.line
854 if line.endswith('?'):
857 if line.endswith('?'):
855 line = line[-1] + line[:-1]
858 line = line[-1] + line[:-1]
@@ -857,8 +860,11 b' class EscapedTransformer(object):'
857 line = line[-1] + line[:-1]
860 line = line[-1] + line[:-1]
858 line_info = LineInfo(line)
861 line_info = LineInfo(line)
859
862
860 # From here on, simply choose which level of detail to get.
863 # From here on, simply choose which level of detail to get, and
861 if line_info.esc == '?':
864 # special-case the psearch syntax
865 if '*' in line_info.line:
866 pinfo = 'psearch'
867 elif line_info.esc == '?':
862 pinfo = 'pinfo'
868 pinfo = 'pinfo'
863 elif line_info.esc == '??':
869 elif line_info.esc == '??':
864 pinfo = 'pinfo2'
870 pinfo = 'pinfo2'
@@ -451,6 +451,8 b' syntax = \\'
451 ('x3?', 'get_ipython().magic("pinfo x3")'),
451 ('x3?', 'get_ipython().magic("pinfo x3")'),
452 ('x4??', 'get_ipython().magic("pinfo2 x4")'),
452 ('x4??', 'get_ipython().magic("pinfo2 x4")'),
453 ('%hist?', 'get_ipython().magic("pinfo %hist")'),
453 ('%hist?', 'get_ipython().magic("pinfo %hist")'),
454 ('f*?', 'get_ipython().magic("psearch f*")'),
455 ('ax.*aspe*?', 'get_ipython().magic("psearch ax.*aspe*")'),
454 ],
456 ],
455
457
456 # Explicit magic calls
458 # Explicit magic calls
General Comments 0
You need to be logged in to leave comments. Login now