@@ -510,6 +510,7 @@ def __init__(self):
510510 self .fileMap = {}
511511 self .pendingCompletions = []
512512 self .completionsReady = False
513+ self .completionsLoc = None
513514 self .completionView = None
514515 self .mruFileList = []
515516 self .pendingTimeout = 0
@@ -520,6 +521,7 @@ def __init__(self):
520521 self .about_to_close_all = False
521522 self .was_paren_pressed = False
522523
524+
523525 def getInfo (self , view ):
524526 info = None
525527 if view .file_name () is not None :
@@ -830,6 +832,9 @@ def on_selection_modified(self, view):
830832 # on_modified) what was inserted
831833 info .prevSel = copyRegionsStatic (view .sel ())
832834 if self .mod :
835+ # backspace past start of completion
836+ if info .lastCompletionLoc and (info .lastCompletionLoc > view .sel ()[0 ].begin ()):
837+ view .run_command ('hide_auto_complete' )
833838 self .setOnSelectionIdleTimer (1250 )
834839 else :
835840 self .setOnSelectionIdleTimer (50 )
@@ -990,7 +995,7 @@ def on_query_completions(self, view, prefix, locations):
990995 view .add_regions ("apresComp" , decrLocsToRegions (locations , 0 ), flags = sublime .HIDDEN )
991996 if (not self .completionsReady ) or cli .ST2 ():
992997 if info .lastCompletionLoc :
993- if (((len (prefix )- 1 )+ info .lastCompletionLoc == locations [0 ]) and (prefix .startswith (info .lastCompletionPrefix ))):
998+ if ((len ( prefix ) > 0 ) and ( (len (prefix )- 1 )+ info .lastCompletionLoc == locations [0 ]) and (prefix .startswith (info .lastCompletionPrefix ))):
994999 return (info .lastCompletions ,
9951000 sublime .INHIBIT_WORD_COMPLETIONS | sublime .INHIBIT_EXPLICIT_COMPLETIONS )
9961001
@@ -1001,9 +1006,9 @@ def on_query_completions(self, view, prefix, locations):
10011006 else :
10021007 cli .service .asyncCompletions (view .file_name (), location , prefix , self .handleCompletionInfo )
10031008 completions = self .pendingCompletions
1009+ info .lastCompletionLoc = locations [0 ]
10041010 if self .completionsReady :
10051011 info .lastCompletions = completions
1006- info .lastCompletionLoc = locations [0 ]
10071012 info .lastCompletionPrefix = prefix
10081013 self .pendingCompletions = []
10091014 self .completionsReady = False
0 commit comments