[squeak-dev] The Trunk: Morphic-ul.587.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Oct 31 15:24:07 UTC 2011
Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.587.mcz
==================== Summary ====================
Name: Morphic-ul.587
Author: ul
Time: 31 October 2011, 5:23:54.884 pm
UUID: 6086ce82-310b-b14e-8ccf-84c807d3bccd
Ancestors: Morphic-cmm.586
- fix: avoid division by zero when searching in an empty PluggableListMorph
=============== Diff against Morphic-cmm.586 ===============
Item was changed:
----- Method: PluggableListMorph>>basicKeyPressed: (in category 'model access') -----
basicKeyPressed: aChar
| milliseconds slowKeyStroke listSize newSelectionIndex oldSelectionIndex startIndex |
oldSelectionIndex := newSelectionIndex := self getCurrentSelectionIndex.
listSize := self getListSize.
+ listSize = 0 ifTrue: [ ^self flash ].
milliseconds := Time millisecondClockValue.
slowKeyStroke := (Time
milliseconds: milliseconds
since: lastKeystrokeTime) > (self class filterableLists ifTrue: [500] ifFalse: [ 300 ]).
lastKeystrokeTime := milliseconds.
slowKeyStroke
ifTrue:
[ self class filterableLists ifTrue: [ self hasFilter ifFalse: [ priorSelection := self modelIndexFor: self selectionIndex] ].
"forget previous keystrokes and search in following elements"
lastKeystrokes := aChar asLowercase asString.
newSelectionIndex := newSelectionIndex \\ listSize + 1.
self class filterableLists ifTrue: [ list := self getFullList ] ]
ifFalse: [ "append quick keystrokes but don't move selection if it still matches"
lastKeystrokes := lastKeystrokes , aChar asLowercase asString.
newSelectionIndex := newSelectionIndex max: 1 ].
"No change if model is locked"
model okToChange ifFalse: [ ^ self ].
self class filterableLists
ifTrue:
[ self
filterList ;
updateList.
newSelectionIndex := self modelIndexFor: 1 ]
ifFalse:
[ startIndex := newSelectionIndex.
listSize := self getListSize.
[ (self getListItem: newSelectionIndex) asString withBlanksTrimmed asLowercase beginsWith: lastKeystrokes ] whileFalse:
[ (newSelectionIndex := newSelectionIndex \\ listSize + 1) = startIndex ifTrue: [ ^ self flash"Not in list." ] ].
newSelectionIndex = oldSelectionIndex ifTrue: [ ^ self flash ] ].
(self hasFilter and: [(self getCurrentSelectionIndex = newSelectionIndex) not]) ifTrue:
[self changeModelSelection: newSelectionIndex]!
More information about the Squeak-dev
mailing list
|