[squeak-dev] The Trunk: Morphic-mt.1196.mcz

Chris Muller asqueaker at gmail.com
Thu Jul 21 19:50:41 UTC 2016


The original intent was to have a working #flash, and do that when the
very next keystroke would result in an empty filter.

Because by the time you've emptied the list, you can't use backspace
to see where the matching started to fail, and the results thus far.
So does this option lead the user into a dead-end?

The system is too fast, #flash is rather useless, I think we should
put the delay back in to #flash, so it can be a the good indicator it
was meant to be of "no more results"...


On Thu, Jul 21, 2016 at 4:23 AM,  <commits at source.squeak.org> wrote:
> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1196.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1196
> Author: mt
> Time: 21 July 2016, 11:23:40.453126 am
> UUID: d866228c-fedc-2147-afd9-821191a84612
> Ancestors: Morphic-mt.1195
>
> For lists, add an option to allow empty filter results. Also support setting the current filter string programmatically.
>
> =============== Diff against Morphic-mt.1195 ===============
>
> Item was added:
> + ----- Method: PluggableListMorph>>allowEmptyFilterResult (in category 'filtering') -----
> + allowEmptyFilterResult
> +       ^ self valueOfProperty: #allowEmptyFilterResult ifAbsent: [false]!
>
> Item was added:
> + ----- Method: PluggableListMorph>>allowEmptyFilterResult: (in category 'filtering') -----
> + allowEmptyFilterResult: aBoolean
> +
> +       self
> +               setProperty: #allowEmptyFilterResult
> +               toValue: aBoolean.!
>
> Item was changed:
>   ----- Method: PluggableListMorph>>filterList (in category 'filtering') -----
>   filterList
>         self hasFilter
>                 ifTrue:
>                         [ | frontMatching substringMatching newList |
>                         self indicateFiltered.
>                         frontMatching := OrderedCollection new.
>                         substringMatching := OrderedCollection new.
>                         list withIndexDo:
>                                 [ : each : n | | foundPos |
>                                 foundPos := each asString
>                                         findString: lastKeystrokes
>                                         startingAt: 1
>                                         caseSensitive: false.
>                                 foundPos = 1
>                                         ifTrue: [ frontMatching add: each ]
>                                         ifFalse:
>                                                 [ foundPos = 0 ifFalse: [ substringMatching add: each ] ] ].
>                         newList := frontMatching , substringMatching.
> +                       (newList isEmpty not or: [ self allowEmptyFilterResult ])
> +                               ifTrue: [ list := newList ]
> +                               ifFalse:
> -                       newList
> -                               ifEmpty:
>                                         [ lastKeystrokes := lastKeystrokes allButLast: 1.
>                                         self
>                                                  flash ;
> +                                                filterList ] ]
> -                                                filterList ]
> -                               ifNotEmpty: [ list := newList ] ]
>                 ifFalse: [ self indicateUnfiltered ]!
>
> Item was added:
> + ----- Method: PluggableListMorph>>filterList: (in category 'filtering') -----
> + filterList: aString
> +       "Manually set the list filter."
> +
> +       lastKeystrokes := aString.
> +       self filterList.
> +       self updateList.
> +       self changeModelSelection: (list ifEmpty: [0] ifNotEmpty: [self modelIndexFor: 1]).!
>
>


More information about the Squeak-dev mailing list