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