--- a/Tools__NewSystemBrowser.st Wed Jun 05 17:12:34 2019 +0200
+++ b/Tools__NewSystemBrowser.st Fri Jun 07 11:52:34 2019 +0200
@@ -19003,7 +19003,7 @@
updateList := [
|nameToSearch list namesStarting namesEnding namesIncluding restList
- lcName nameList classList isMatch labelText|
+ lcName nameList1 classList1 nameList2 classList2 isMatch labelText|
(nameToSearch := classNameHolder value withoutSeparators) isEmpty ifTrue:[
labelText := 'Recently visited:'.
@@ -19024,8 +19024,17 @@
].
].
- nameList := showFullNameHolder value ifTrue:[ allFullNames ] ifFalse:[ allNames ].
- classList := showFullNameHolder value ifTrue:[ allClassesByFullName ] ifFalse:[ allClasses ].
+ showFullNameHolder value ifTrue:[
+ nameList1 := allFullNames.
+ classList1 := allClassesByFullName.
+ nameList2 := allNames.
+ classList2 := allClasses.
+ ] ifFalse:[
+ nameList1 := allNames.
+ classList1 := allClasses.
+ nameList2 := allFullNames.
+ classList2 := allClassesByFullName.
+ ].
lcName := nameToSearch asLowercase.
false "(lcName includesString:'::')" ifTrue:[
list := OrderedCollection new.
@@ -19038,31 +19047,51 @@
isIncluded := (cls name includesString:lcName caseSensitive:false)
].
isIncluded ifTrue:[
- list add:(nameList at:idx)
+ list add:(nameList1 at:idx)
].
].
] ifFalse:[
isMatch ifTrue:[
- list := (1 to:nameList size)
+ list := (1 to:nameList1 size)
select:[:idx |
|nm|
- nm := allFullNames "nameList" at:idx.
+ nm := nameList1 at:idx.
(lcName match:nm asLowercase)
- or:[ lcName match:(classList at:idx) name caseSensitive:false]
- ] thenCollect:[:idx | nameList at:idx].
+ or:[ lcName match:(classList1 at:idx) name caseSensitive:false]
+ ] thenCollect:[:idx | nameList1 at:idx].
+ "/ try the alternative list, if there was no match
+ list isEmpty ifTrue:[
+ list := (1 to:nameList2 size)
+ select:[:idx |
+ |nm|
+ nm := nameList2 at:idx.
+ (lcName match:nm asLowercase)
+ or:[ lcName match:(classList2 at:idx) name caseSensitive:false]
+ ] thenCollect:[:idx | nameList2 at:idx].
+ ].
] ifFalse:[
(doFuzzyMatchHolder value and:[FuzzyMatcher notNil]) ifTrue:[
|matcher matches|
matches := OrderedCollection new.
matcher := FuzzyMatcher pattern:lcName.
- allFullNames "nameList" do:[:eachClassName |
+ nameList1 do:[:eachClassName |
matcher
match:eachClassName
ifScored: [:score |
matches add: { eachClassName . score . (matcher indexes copy) }
]
].
+ "/ try the alternative list, if there was no match
+ matches isEmpty ifTrue:[
+ nameList2 do:[:eachClassName |
+ matcher
+ match:eachClassName
+ ifScored: [:score |
+ matches add: { eachClassName . score . (matcher indexes copy) }
+ ]
+ ].
+ ].
matches
sort:[:a :b |
|score_a score_b|
@@ -19087,17 +19116,17 @@
name
].
] ifFalse:[
- namesIncluding := (1 to:nameList size)
+ namesIncluding := (1 to:nameList1 size)
select:[:idx |
|nm|
- nm := nameList at:idx.
+ nm := nameList1 at:idx.
(nm asLowercase includesString:lcName caseSensitive:false)
- or:[ (classList at:idx) name includesString:lcName caseSensitive:false]
+ or:[ (classList1 at:idx) name includesString:lcName caseSensitive:false]
]
thenCollect:[:idx |
|nm matchIdx|
- nm := nameList at:idx.
+ nm := nameList1 at:idx.
matchIdx := nm asLowercase indexOfString:lcName.
matchIdx ~~ 0 ifTrue:[
nm := nm withColor:matchingCharsColor.
@@ -19105,6 +19134,26 @@
].
nm
].
+ namesIncluding isEmpty ifTrue:[
+ namesIncluding := (1 to:nameList2 size)
+ select:[:idx |
+ |nm|
+ nm := nameList2 at:idx.
+ (nm asLowercase includesString:lcName caseSensitive:false)
+ or:[ (classList2 at:idx) name includesString:lcName caseSensitive:false]
+ ]
+ thenCollect:[:idx |
+ |nm matchIdx|
+
+ nm := nameList2 at:idx.
+ matchIdx := nm asLowercase indexOfString:lcName.
+ matchIdx ~~ 0 ifTrue:[
+ nm := nm withColor:matchingCharsColor.
+ nm emphasizeFrom:matchIdx to:matchIdx+lcName size-1 with:{ #color->nonMatchingCharsColor }
+ ].
+ nm
+ ].
+ ].
].
namesStarting := namesIncluding select:[:nm | nm asLowercase startsWith:lcName].
restList := (namesIncluding \ namesStarting).
@@ -19205,7 +19254,7 @@
"Modified: / 04-09-2013 / 17:48:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 05-12-2017 / 13:02:53 / cg"
- "Modified: / 13-03-2019 / 22:10:38 / Claus Gittinger"
+ "Modified: / 07-06-2019 / 11:52:19 / Claus Gittinger"
!
enterBoxTitle:title okText:okText label:label