Fix in completion - do not autocomplete when prefix does not match selected item exactly.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 03 Apr 2014 23:06:01 +0200
changeset 188 cfd4d30fcad7
parent 187 7baeeea7d8ae
child 189 8c32268000c5
Fix in completion - do not autocomplete when prefix does not match selected item exactly.
SmallSense__CompletionController.st
--- a/SmallSense__CompletionController.st	Wed Apr 02 23:42:42 2014 +0200
+++ b/SmallSense__CompletionController.st	Thu Apr 03 23:06:01 2014 +0200
@@ -240,8 +240,11 @@
         matches size == 1 ifTrue:[
             completionView selection:  matches anElement.
             completeIfUnambiguous ifTrue:[
-                self complete.
-                ^ true
+                "/ Do complete only if prefix matches!!
+                (matches anElement stringToComplete startsWith: prefix) ifTrue:[
+                    self complete.
+                    ^ true
+                ].
             ]
         ] ifFalse:[
             | selection |
@@ -259,7 +262,7 @@
     ^ false.
 
     "Created: / 27-09-2013 / 16:16:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-04-2014 / 23:32:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-04-2014 / 22:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !CompletionController methodsFor:'private-API'!