Smalltalk.st
changeset 3565 966a108e3765
parent 3560 5c474cd8142e
child 3610 12f32c1fe72b
--- a/Smalltalk.st	Sat Jun 13 19:18:39 1998 +0200
+++ b/Smalltalk.st	Sun Jun 14 15:56:06 1998 +0200
@@ -1673,40 +1673,60 @@
 selectorCompletion:aPartialSymbolName
     "given a partial selector, return an array consisting of
      2 entries: 1st: collection consisting of matching implemented selectors
-		2nd: the longest match"
-
-    |matches best|
+                2nd: the longest match"
+
+    |matches best lcSym|
 
     matches := IdentitySet new.
+
+    "/ search for exact match
     self allClassesDo:[:aClass |
-	aClass methodDictionary keysAndValuesDo:[:aSelector :aMethod |
-	    (aSelector startsWith:aPartialSymbolName) ifTrue:[
-		matches add:aSelector
-	    ]
-	].
-	aClass class methodDictionary keysAndValuesDo:[:aSelector :aMethod |
-	    (aSelector startsWith:aPartialSymbolName) ifTrue:[
-		matches add:aSelector
-	    ]
-	]
+        aClass methodDictionary keysAndValuesDo:[:aSelector :aMethod |
+            (aSelector startsWith:aPartialSymbolName) ifTrue:[
+                matches add:aSelector
+            ]
+        ].
+        aClass class methodDictionary keysAndValuesDo:[:aSelector :aMethod |
+            (aSelector startsWith:aPartialSymbolName) ifTrue:[
+                matches add:aSelector
+            ]
+        ]
+    ].
+    matches isEmpty ifTrue:[
+        "/ search for case-ignoring match
+        lcSym := aPartialSymbolName asLowercase.
+        self allClassesDo:[:aClass |
+            aClass methodDictionary keysAndValuesDo:[:aSelector :aMethod |
+                (aSelector asLowercase startsWith:lcSym) ifTrue:[
+                    matches add:aSelector
+                ]
+            ].
+            aClass class methodDictionary keysAndValuesDo:[:aSelector :aMethod |
+                (aSelector asLowercase startsWith:lcSym) ifTrue:[
+                    matches add:aSelector
+                ]
+            ]
+        ].
+    ].
+
+    matches isEmpty ifTrue:[
+        ^ Array with:aPartialSymbolName with:(Array with:aPartialSymbolName)
+    ].
+    matches size == 1 ifTrue:[
+        ^ Array with:matches first with:(matches asArray)
     ].
     matches := matches asSortedCollection.
-    matches isEmpty ifTrue:[
-	^ Array with:aPartialSymbolName with:(Array with:aPartialSymbolName)
-    ].
-    matches size == 1 ifTrue:[
-	^ Array with:matches first with:(matches asArray)
-    ].
     best := matches longestCommonPrefix.
     ^ Array with:best with:matches asArray
 
     "
      Smalltalk selectorCompletion:'at:p'  
      Smalltalk selectorCompletion:'nextP' 
+     Smalltalk selectorCompletion:'nextp' 
     "
 
-    "Modified: 7.6.1996 / 08:44:33 / stefan"
-    "Modified: 29.8.1997 / 08:00:35 / cg"
+    "Modified: / 7.6.1996 / 08:44:33 / stefan"
+    "Modified: / 14.6.1998 / 15:54:03 / cg"
 ! !
 
 !Smalltalk class methodsFor:'startup'!
@@ -4188,5 +4208,5 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.287 1998-06-12 14:52:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.288 1998-06-14 13:56:06 cg Exp $'
 ! !