--- 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.
]