diff -r a0c9cfa85221 -r 5590362d7223 SmallSense__CompletionController.st --- a/SmallSense__CompletionController.st Sun May 18 13:29:17 2014 +0100 +++ b/SmallSense__CompletionController.st Sun May 18 21:29:52 2014 +0100 @@ -105,9 +105,10 @@ handleKeyPressTab "Tab has been pressed, try to complete longest common prefix" - | prefix matching longest minlen | + | first prefix matching longest minlen | - prefix := support wordBeforeCursor string. + first := completionView list first. + prefix := self prefixAlreadyWritten. matching := OrderedCollection new. minlen := SmallInteger maxVal. completionView list do:[:po | @@ -152,6 +153,7 @@ editView insertStringAtCursor:(longest copyFrom: prefix size + 1). "Created: / 31-03-2014 / 22:55:01 / Jan Vrany " + "Modified: / 18-05-2014 / 13:55:06 / Jan Vrany " ! postKeyPress:key @@ -172,6 +174,10 @@ key isCharacter ifTrue:[ key isLetterOrDigit not ifTrue:[ + "/ Hack for Java - should be delegated to completion engine + (key == $. and:[support notNil and:[ support language isJavaLike ]]) ifTrue:[ + ^ self + ]. self closeCompletionView ] ifFalse:[ | c | @@ -189,7 +195,7 @@ ]. "Created: / 28-09-2013 / 00:21:00 / Jan Vrany " - "Modified: / 11-04-2014 / 16:04:01 / Jan Vrany " + "Modified: / 18-05-2014 / 13:53:18 / Jan Vrany " ! ! !CompletionController methodsFor:'initialization'! @@ -223,6 +229,23 @@ "Created: / 31-03-2014 / 23:21:58 / Jan Vrany " ! +prefixAlreadyWritten + | list first | + + completionView notNil ifTrue:[ + list := completionView list. + list notEmptyOrNil ifTrue:[ + first := list first. + (completionView list allSatisfy:[:e | e class == first class ]) ifTrue:[ + first stringAlreadyWritten + ] + ] + ]. + ^ support wordBeforeCursor string . + + "Created: / 18-05-2014 / 13:55:06 / Jan Vrany " +! + stopCompletionProcess "kill any background completion process" @@ -257,7 +280,7 @@ list := completionView list. matcher1 := CompletionEngine exactMatcher. matcher2 := CompletionEngine inexactMatcher. - prefix := support wordBeforeCursor. + prefix := self prefixAlreadyWritten. matches1 := list select:[:po | matcher1 value: prefix value: po stringToComplete ]. matches1 notEmptyOrNil ifTrue:[ @@ -300,7 +323,7 @@ ^ false. "Created: / 27-09-2013 / 16:16:18 / Jan Vrany " - "Modified: / 08-04-2014 / 21:32:54 / Jan Vrany " + "Modified: / 18-05-2014 / 13:57:11 / Jan Vrany " ! ! !CompletionController methodsFor:'private-API'!