SmallSense__CompletionController.st
changeset 455 f1cd6e210528
parent 445 783f2a4af9c2
child 1070 031924a79f90
equal deleted inserted replaced
454:9ecaf7d56abe 455:f1cd6e210528
    19 "{ Package: 'stx:goodies/smallsense' }"
    19 "{ Package: 'stx:goodies/smallsense' }"
    20 
    20 
    21 "{ NameSpace: SmallSense }"
    21 "{ NameSpace: SmallSense }"
    22 
    22 
    23 EditTextViewCompletionSupport subclass:#CompletionController
    23 EditTextViewCompletionSupport subclass:#CompletionController
    24 	instanceVariableNames:'support seqno completeIfUnambiguous'
    24 	instanceVariableNames:'support seqno'
    25 	classVariableNames:''
    25 	classVariableNames:''
    26 	poolDictionaries:''
    26 	poolDictionaries:''
    27 	category:'SmallSense-Core'
    27 	category:'SmallSense-Core'
    28 !
    28 !
    29 
    29 
   246     "Invoked when a new instance is created."
   246     "Invoked when a new instance is created."
   247 
   247 
   248     "/ please change as required (and remove this comment)
   248     "/ please change as required (and remove this comment)
   249     "/ support := nil.
   249     "/ support := nil.
   250     seqno := 0.
   250     seqno := 0.
   251     completeIfUnambiguous := UserPreferences current smallSenseCompleteIfUnambiguous.
       
   252 
   251 
   253     "/ super initialize.   -- commented since inherited method does nothing
   252     "/ super initialize.   -- commented since inherited method does nothing
   254 
   253 
   255     "Modified: / 18-01-2014 / 23:10:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   254     "Modified: / 02-05-2015 / 22:07:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   256 ! !
   255 ! !
   257 
   256 
   258 !CompletionController methodsFor:'private'!
   257 !CompletionController methodsFor:'private'!
   259 
   258 
   260 complete
   259 complete
   355     matches1 notEmptyOrNil ifTrue:[
   354     matches1 notEmptyOrNil ifTrue:[
   356         matches1 size == 1 ifTrue:[
   355         matches1 size == 1 ifTrue:[
   357             | selection completeElectric |
   356             | selection completeElectric |
   358 
   357 
   359             selection := matches1 anElement.
   358             selection := matches1 anElement.
   360             completeElectric := completeIfUnambiguous and:[ support electricInsertSuppressed not ].
   359             completeElectric := (UserPreferences current smallSenseCompleteIfUnambiguous) and:[ support electricInsertSuppressed not ].
   361             (completeElectric and: [(editView sensor hasKeyEventFor:editView) not]) ifTrue:[
   360             (completeElectric and: [(editView sensor hasKeyEventFor:editView) not]) ifTrue:[
   362                 self complete: selection afterKeyPress: keyOrNil.
   361                 self complete: selection afterKeyPress: keyOrNil.
   363                 ^ true
   362                 ^ true
   364             ] ifFalse:[ 
   363             ] ifFalse:[ 
   365                 completionView selection: selection
   364                 completionView selection: selection
   395         completionView selection: nil.
   394         completionView selection: nil.
   396     ].
   395     ].
   397     ^ false.
   396     ^ false.
   398 
   397 
   399     "Created: / 17-06-2014 / 07:19:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   398     "Created: / 17-06-2014 / 07:19:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   400     "Modified: / 03-03-2015 / 17:15:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   399     "Modified: / 02-05-2015 / 22:07:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   401 ! !
   400 ! !
   402 
   401 
   403 !CompletionController methodsFor:'private-API'!
   402 !CompletionController methodsFor:'private-API'!
   404 
   403 
   405 closeCompletionView
   404 closeCompletionView