The Trunk: ToolBuilder-Morphic-ul.89.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: ToolBuilder-Morphic-ul.89.mcz

commits-2
Levente Uzonyi uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-ul.89.mcz

==================== Summary ====================

Name: ToolBuilder-Morphic-ul.89
Author: ul
Time: 2 March 2013, 1:36:31.1 am
UUID: f1b278f5-477a-47b4-bc8a-eec006d343fc
Ancestors: ToolBuilder-Morphic-fbs.88

Optimized version of ListChooser>>updateFilter. Don't add any stars to the pattern if the user added some already.

=============== Diff against ToolBuilder-Morphic-fbs.88 ===============

Item was changed:
  ----- Method: ListChooser>>updateFilter (in category 'event handling') -----
  updateFilter
+
  selectedItems :=
  searchText isEmptyOrNil
  ifTrue: [ fullList ]
  ifFalse: [ | pattern patternMatches prefixMatches |
+ pattern := (searchText includes: $*)
+ ifTrue: [ searchText ]
+ ifFalse: [ '*', searchText, '*' ].
+ patternMatches := fullList select: [:s | pattern match: s ].
+ prefixMatches := OrderedCollection new: patternMatches size.
+ patternMatches removeAllSuchThat: [ :each |
+ (each findString: searchText startingAt: 1 caseSensitive: false) = 1
+ and: [
+ prefixMatches add: each.
+ true ] ].
- pattern := (searchText beginsWith: '*')
- ifTrue: [searchText]
- ifFalse: ['*', searchText, '*'].
- prefixMatches := fullList select: [:s | (s findString: searchText startingAt: 1 caseSensitive: false) = 1].
- patternMatches := (fullList select: [:s | pattern match: s]) difference: prefixMatches.
  prefixMatches addAllLast: patternMatches; yourself].
  self changed: #list.
  self selectedIndex: 1.
  self changed: #selectedIndex.!