Optimizing overlap correction for common case
Most of the time there's nothing after the cursor.
This commit is contained in:
parent
a18807d31e
commit
96b28b93a1
@ -131,6 +131,8 @@ def AdjustCandidateInsertionText( candidates ):
|
|||||||
|
|
||||||
new_candidates = []
|
new_candidates = []
|
||||||
text_after_cursor = vimsupport.TextAfterCursor()
|
text_after_cursor = vimsupport.TextAfterCursor()
|
||||||
|
if not text_after_cursor:
|
||||||
|
return candidates
|
||||||
for candidate in candidates:
|
for candidate in candidates:
|
||||||
if type( candidate ) is dict:
|
if type( candidate ) is dict:
|
||||||
new_candidate = candidate.copy()
|
new_candidate = candidate.copy()
|
||||||
|
@ -67,8 +67,8 @@ def AdjustCandidateInsertionText_NotSuffix_test():
|
|||||||
|
|
||||||
def AdjustCandidateInsertionText_NothingAfterCursor_test():
|
def AdjustCandidateInsertionText_NothingAfterCursor_test():
|
||||||
vimsupport.TextAfterCursor = MagicMock( return_value = '' )
|
vimsupport.TextAfterCursor = MagicMock( return_value = '' )
|
||||||
eq_( [ { 'abbr': 'foofoo', 'word': 'foofoo' },
|
eq_( [ 'foofoo',
|
||||||
{ 'abbr': 'zobar', 'word': 'zobar' }, ],
|
'zobar' ],
|
||||||
base.AdjustCandidateInsertionText( [ 'foofoo',
|
base.AdjustCandidateInsertionText( [ 'foofoo',
|
||||||
'zobar' ] ) )
|
'zobar' ] ) )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user