# HG changeset patch # User ca # Date 965815407 -7200 # Node ID c5559ad5c09e17799f03fcc141585da71640ecf1 # Parent 65c9df9cb1ad97732ac944684f727f7d608c3080 change selection behaviour after delete diff -r 65c9df9cb1ad -r c5559ad5c09e UIPainterView.st --- a/UIPainterView.st Wed Aug 09 11:32:15 2000 +0200 +++ b/UIPainterView.st Wed Aug 09 12:03:27 2000 +0200 @@ -249,19 +249,29 @@ "cut the selection into the cut&paste-buffer and open a transaction " - |specs coll oldSelection newSelection treeModel| + |specs coll index oldSelection newSelection treeModel parent children size| coll := self minSetOfSuperViews:(self selection). coll notNil ifTrue:[ treeView cvsEventsDisabledDo:[ - treeModel := treeView model. + treeModel := treeView model. oldSelection := treeModel selectedNodes at:1 ifAbsent: nil. oldSelection notNil ifTrue:[ - oldSelection := (treeModel indexOf:oldSelection) max:1 + children := oldSelection parent children. + (size := children size) > 1 ifTrue:[ + index := children identityIndexOf:oldSelection. + size == index ifTrue:[ + index := index - 1 + ]. + newSelection := children at:index ifAbsent:1. + ] ifFalse:[ + newSelection := oldSelection parent + ]. + newSelection := treeModel indexOf:newSelection. ] ifFalse:[ - oldSelection := 1. + newSelection := 1 ]. self hideSelection. @@ -276,7 +286,6 @@ ]. buffered ifTrue: [self setSelection:specs]. treeView selection:nil. - newSelection := oldSelection min:(treeModel list size). treeView selection:(Array with: newSelection). self setSelection:treeView selectedNode contents view withRedraw:true. ]