DoWhatIMeanSupport.st
changeset 5713 c07c5d59bbff
parent 5706 6aa652210ae2
child 5714 043564e0ae20
--- a/DoWhatIMeanSupport.st	Tue Mar 06 16:38:51 2018 +0100
+++ b/DoWhatIMeanSupport.st	Tue Mar 06 17:37:30 2018 +0100
@@ -760,7 +760,7 @@
 resourceCompletion:aPartialResourceName inEnvironment:anEnvironment match:doMatch ignoreCase:ignoreCase
     "given a partial resource name, return an array consisting of
      2 entries: 1st: the longest match
-		2nd: collection consisting of matching defined resources"
+                2nd: collection consisting of matching defined resources"
 
     |matches best lcSym isMatch|
 
@@ -769,41 +769,51 @@
     isMatch := doMatch and:[aPartialResourceName includesMatchCharacters].
 
     anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
-	eachMethod hasResource ifTrue:[
-	    eachMethod resources keysDo:[:eachResourceName |
-		(isMatch
-		    ifTrue:[ (aPartialResourceName match:eachResourceName caseSensitive:ignoreCase not) ]
-		    ifFalse:[ ignoreCase
-				ifTrue:[ (eachResourceName asLowercase startsWith:aPartialResourceName asLowercase) ]
-				ifFalse:[ (eachResourceName startsWith:aPartialResourceName) ] ]
-		) ifTrue:[
-		    matches add:eachResourceName
-		].
-	    ].
-	].
+        eachMethod hasResource ifTrue:[
+            eachMethod resources keysDo:[:eachResourceName |
+                |addToMatches|
+
+                isMatch ifTrue:[ 
+                    addToMatches := aPartialResourceName match:eachResourceName caseSensitive:ignoreCase not 
+                ] ifFalse:[ 
+                    ignoreCase ifTrue:[ 
+                        addToMatches := eachResourceName asLowercase startsWith:aPartialResourceName asLowercase 
+                    ] ifFalse:[ 
+                        addToMatches := eachResourceName startsWith:aPartialResourceName 
+                    ] 
+                ].
+                addToMatches ifTrue:[
+                    matches add:eachResourceName
+                ].
+            ].
+        ].
     ].
     (matches isEmpty and:[ignoreCase not]) ifTrue:[
-	"/ search for case-ignoring match
-	lcSym := aPartialResourceName asLowercase.
-	anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
-	    eachMethod hasResource ifTrue:[
-		eachMethod resources keysDo:[:eachResourceName |
-		    (isMatch
-			ifTrue:[ (aPartialResourceName match:eachResourceName caseSensitive:false) ]
-			ifFalse:[ (eachResourceName asLowercase startsWith:lcSym) ])
-		     ifTrue:[
-			matches add:eachResourceName
-		    ].
-		].
-	    ].
-	].
+        "/ search for case-ignoring match
+        lcSym := aPartialResourceName asLowercase.
+        anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
+            eachMethod hasResource ifTrue:[
+                eachMethod resources keysDo:[:eachResourceName |
+                    |addToMatches|
+
+                    isMatch ifTrue:[ 
+                        addToMatches := aPartialResourceName match:eachResourceName caseSensitive:false 
+                    ] ifFalse:[ 
+                        addToMatches := eachResourceName asLowercase startsWith:lcSym 
+                    ].
+                    addToMatches ifTrue:[
+                        matches add:eachResourceName
+                    ].
+                ].
+            ].
+        ].
     ].
 
     matches isEmpty ifTrue:[
-	^ Array with:aPartialResourceName with:#()
+        ^ Array with:aPartialResourceName with:#()
     ].
     matches size == 1 ifTrue:[
-	^ Array with:matches first with:(matches asArray)
+        ^ Array with:matches first with:(matches asArray)
     ].
     matches := matches asSortedCollection.
     best := matches longestCommonPrefix.