Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1633.mcz==================== Summary ====================
Name: Morphic-mt.1633
Author: mt
Time: 4 March 2020, 9:00:16.537537 am
UUID: 0843c659-9523-9948-8013-dfdc0d9a973e
Ancestors: Morphic-nice.1632
Fixes filter issue on empty lists.
=============== Diff against Morphic-nice.1632 ===============
Item was changed:
----- Method: PluggableListMorph>>filterList:matching: (in category 'filtering') -----
filterList: someItems matching: aPattern
"Filter someStrings according to aPattern. Prepend best matches in the result. Update the model-to-view map."
| frontMatching substringMatching tmp |
aPattern ifEmpty: [ ^ someItems ].
someItems ifEmpty: [ ^ someItems ].
frontMatching := OrderedCollection new.
substringMatching := OrderedCollection new.
+ self assert: modelToView isEmpty.
+ self assert: viewToModel isEmpty.
- modelToView := Dictionary new.
- viewToModel := Dictionary new.
tmp := OrderedCollection new.
someItems doWithIndex:
[ :each :n | | foundPos |
foundPos := self filterListItem: each matching: aPattern.
foundPos = 1
ifTrue:
[ frontMatching add: each.
modelToView at: n put: frontMatching size.
viewToModel at: frontMatching size put: n ]
ifFalse:
[ foundPos > 1 ifTrue:
[ substringMatching add: each.
tmp add: n; add: substringMatching size ] ] ].
tmp pairsDo: [:modelIndex :viewIndex |
modelToView at: modelIndex put: viewIndex + frontMatching size.
viewToModel at: viewIndex + frontMatching size put: modelIndex].
^ frontMatching, substringMatching!
Item was changed:
----- Method: PluggableListMorph>>updateListFilter (in category 'updating') -----
updateListFilter
| selection |
selection := self selectionIndex = 0 "Avoid fetching #getList here."
ifTrue: [nil]
ifFalse: [self selection].
list := nil.
+ modelToView := Dictionary new.
+ viewToModel := Dictionary new.
+
- modelToView := nil.
- viewToModel := nil.
-
self getList.
"Try to restore the last selection."
selection ifNotNil: [self selection: selection].!