##// END OF EJS Templates
Fix completions for PTK 1.0
Matthias Bussonnier -
Show More
@@ -803,10 +803,13 b' class IPCompleter(Completer):'
803
803
804 def trim_start(completion):
804 def trim_start(completion):
805 """completions need to start with `text`, trim the beginning until it does"""
805 """completions need to start with `text`, trim the beginning until it does"""
806 if text in completion and not (completion.startswith(text)):
806 ltext = text.lower()
807 start_index = completion.index(text)
807 lcomp = completion.lower()
808 if ltext in lcomp and not (lcomp.startswith(ltext)):
809 start_index = lcomp.index(ltext)
808 if cursor_pos:
810 if cursor_pos:
809 assert start_index < cursor_pos
811 if start_index >= cursor_pos:
812 start_index = min(start_index, cursor_pos)
810 return completion[start_index:]
813 return completion[start_index:]
811 return completion
814 return completion
812
815
@@ -800,6 +800,6 b' def test_import_module_completer():'
800
800
801 def test_from_module_completer():
801 def test_from_module_completer():
802 ip = get_ipython()
802 ip = get_ipython()
803 _, matches = ip.complete('B', 'from io import B')
803 _, matches = ip.complete('B', 'from io import B', 16)
804 nt.assert_in('BytesIO', matches)
804 nt.assert_in('BytesIO', matches)
805 nt.assert_not_in('BaseException', matches)
805 nt.assert_not_in('BaseException', matches)
General Comments 0
You need to be logged in to leave comments. Login now