[squeak-dev] The Trunk: Morphic-cmm.1120.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Apr 19 15:33:52 UTC 2016


Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.1120.mcz

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

Name: Morphic-cmm.1120
Author: cmm
Time: 19 April 2016, 10:33:09.002758 am
UUID: b0dd74f2-189a-4b77-baed-280740462474
Ancestors: Morphic-mt.1119

Undo Morphic-mt.1119 because it totally broke the filtering function.

	- It broke navigation by filtering.
	- It broke toggling between two selections with the backspace key.

Filtering is its own isolated feature that works on texts of lists, it was never meant to interact with the model or user selections made outside the filtering feature.

=============== Diff against Morphic-mt.1119 ===============

Item was changed:
  ----- Method: PluggableListMorph>>basicKeyPressed: (in category 'model access') -----
  basicKeyPressed: aChar 
+ 	| milliseconds slowKeyStroke listSize newSelectionIndex oldSelectionIndex startIndex |
- 	| milliseconds slowKeyStroke listSize newSelectionIndex oldSelectionIndex startIndex newPriorSelection |
  	oldSelectionIndex := newSelectionIndex := self getCurrentSelectionIndex.
- 	
- 	"keep across matches that do not have current selection"
- 	newPriorSelection := priorSelection ifNil: [oldSelectionIndex] ifNotNil: [oldSelectionIndex = 0 ifTrue: [priorSelection] ifFalse: [oldSelectionIndex]].
- 	
  	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] ].
- 			[ self class filterableLists ifTrue: [ self hasFilter ifFalse: [ priorSelection := newPriorSelection ] ].
  			"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 ]
- 			newSelectionIndex := ((self uiIndexFor: newPriorSelection) > 0)
- 				ifTrue: [newPriorSelection]
- 				ifFalse: [0] ]
  		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]!
- 		[self changeModelSelection: newSelectionIndex. priorSelection := newPriorSelection "Probably 0 for filterable lists. Preserve old selection."]!

Item was changed:
  ----- Method: PluggableListMorph>>changeModelSelection: (in category 'model access') -----
  changeModelSelection: anInteger
  	" Change the model's selected item index to be anInteger. Enable the pre selection highlight. Step the World forward to let the pre selection highlight take effect. "
  
  	self rowAboutToBecomeSelected: (self uiIndexFor: anInteger).
  	self refreshWorld.
  	setIndexSelector ifNotNil: [
+ 		model perform: setIndexSelector with: anInteger ].!
- 		model perform: setIndexSelector with: anInteger ].
- 	priorSelection := anInteger. "Preserve new selection when clearing the filter now."!



More information about the Squeak-dev mailing list