Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1119.mcz ==================== Summary ==================== Name: Morphic-mt.1119 Author: mt Time: 19 April 2016, 4:03:07.333016 pm UUID: 920dd0b6-e2ab-da4d-81d3-530e1d7ff81b Ancestors: Morphic-mt.1118 Improves stability of filter in lists: 1) Restore prior selection on filter clear 2) Restore prior selection if there are matches (again) 3) Update prior selection of you make a new selection in a filtered list Note that this will still not be propagated between connected lists in, for example, the code browser. While you now will enjoy more stability when filtering the list of methods, filtering the list of system categories might still update/clear all other lists. =============== Diff against Morphic-mt.1118 =============== Item was changed: ----- Method: PluggableListMorph>>basicKeyPressed: (in category 'model access') ----- basicKeyPressed: aChar + | milliseconds slowKeyStroke listSize newSelectionIndex oldSelectionIndex startIndex newPriorSelection | - | milliseconds slowKeyStroke listSize newSelectionIndex oldSelectionIndex startIndex | 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 := newPriorSelection ] ]. - [ 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 uiIndexFor: newPriorSelection) > 0) + ifTrue: [newPriorSelection] + ifFalse: [0] ] - 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. priorSelection := newPriorSelection "Probably 0 for filterable lists. Preserve old selection."]! - [self changeModelSelection: newSelectionIndex]! 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 ]. + priorSelection := anInteger. "Preserve new selection when clearing the filter now."! - model perform: setIndexSelector with: anInteger ].! |
Free forum by Nabble | Edit this page |