Marcel Taeumel uploaded a new version of Morphic to project The Trunk: http://source.squeak.org/trunk/Morphic-mt.2104.mcz
==================== Summary ====================
Name: Morphic-mt.2104 Author: mt Time: 17 April 2023, 10:03:09.882908 am UUID: 80b5342f-b2a5-df42-b408-edf46ec97c41 Ancestors: Morphic-mt.2103
When removing list filters, keep screen contents (i.e., text) stable by adjusting scroll position. Just like in tree widgets.
=============== Diff against Morphic-mt.2103 ===============
Item was added: + ----- Method: PluggableListMorph>>fixateSelectionDuring: (in category 'selection') ----- + fixateSelectionDuring: aBlock + + | vDelta sRow sRect | + (sRow := self listMorph selectedRow) ifNil: [aBlock value. ^ self]. + + sRect := self listMorph drawBoundsForRow: sRow. + vDelta := ((listMorph localPointToGlobal: sRect topLeft) + - (scroller localPointToGlobal: scroller topLeft)) y. + + aBlock value. + + (sRow := self listMorph selectedRow) ifNotNil: [ + sRect := self listMorph drawBoundsForRow: sRow. + self scrollToBottom. + self scrollToShow: (sRect outsetBy: (0@vDelta corner: 0@0))].!
Item was changed: ----- Method: PluggableListMorph>>keyboardFocusChange: (in category 'event handling') ----- keyboardFocusChange: aBoolean "Clear the hover effect and maybe the current list filter if we lose keyboard focus." aBoolean ifFalse: [self hoverRow: nil. self clearFilterAutomatically ifTrue: + [self fixateSelectionDuring: [self removeFilter]]]. - [self removeFilter]]. super keyboardFocusChange: aBoolean.!
Item was changed: ----- Method: PluggableListMorph>>specialKeyPressed: (in category 'model access - keystroke') ----- specialKeyPressed: asciiValue "A special key with the given ascii-value was pressed; dispatch it" | oldSelection nextSelection max howManyItemsShowing | (#(8 13) includes: asciiValue) ifTrue: + [ "complete type-in filter by clearing it; backspace key: restore prior selection; return key: keep selection" - [ "backspace key - clear the filter, restore the list with the selection" model okToChange ifFalse: [^ self]. + self fixateSelectionDuring: [self removeFilter]. - self removeFilter. priorSelection ifNotNil: [ | prior | prior := priorSelection. priorSelection := self getCurrentSelectionIndex. asciiValue = 8 ifTrue: [ self changeModelSelection: prior ] ]. ^ self ]. asciiValue = 27 ifTrue: [" escape key" ^ self currentEvent shiftPressed ifTrue: [self currentWorld putUpWorldMenuFromEscapeKey] ifFalse: [self yellowButtonActivity: false]].
max := self maximumSelection. max > 0 ifFalse: [^ self]. nextSelection := oldSelection := self selectionIndex. asciiValue = 31 ifTrue: [" down arrow" nextSelection := oldSelection + 1. nextSelection > max ifTrue: [nextSelection := 1]]. asciiValue = 30 ifTrue: [" up arrow" nextSelection := oldSelection - 1. nextSelection < 1 ifTrue: [nextSelection := max]]. asciiValue = 1 ifTrue: [" home" nextSelection := 1]. asciiValue = 4 ifTrue: [" end" nextSelection := max]. howManyItemsShowing := self numSelectionsInView. asciiValue = 11 ifTrue: [" page up" nextSelection := 1 max: oldSelection - howManyItemsShowing]. asciiValue = 12 ifTrue: [" page down" nextSelection := oldSelection + howManyItemsShowing min: max]. model okToChange ifFalse: [^ self]. "No change if model is locked" oldSelection = nextSelection ifTrue: [^ self flash]. ^ self changeModelSelection: (self modelIndexFor: nextSelection)!
squeak-dev@lists.squeakfoundation.org