UIPainterView.st
changeset 886 3c67610b9631
parent 858 6b2e9e31cf06
child 887 79a6e12e1d0f
--- a/UIPainterView.st	Mon Jun 29 17:42:38 1998 +0200
+++ b/UIPainterView.st	Wed Jul 08 22:18:47 1998 +0200
@@ -200,13 +200,24 @@
     "cut the selection into the cut&paste-buffer
      and open a transaction
     "
-    |specs coll|
+    |specs coll oldSelectedNode newSelectedNode|
 
     coll := self minSetOfSuperViews:(self selection).
 
     coll notNil ifTrue:[
         treeView cvsEventsDisabledDo:[
-            self select:nil.
+
+            oldSelectedNode := treeView selectedNode. 
+            oldSelectedNode parent children size <= 1 ifTrue: [
+                newSelectedNode := oldSelectedNode parent
+            ]
+            ifFalse: [
+                newSelectedNode := oldSelectedNode parent children 
+                    at: (oldSelectedNode parent indexOfChild: oldSelectedNode) - 1 
+                    ifAbsent: [oldSelectedNode parent children at: 2]
+            ].
+
+            selection := nil.  
             specs := coll collect:[:aView| self fullSpecFor:aView ].
 
             self withinTransaction:#cut objects:coll do:[
@@ -215,8 +226,10 @@
                     self remove:aView
                 ]
             ].
-            self setSelection:specs.
-            treeView selection: (Array with: 1)
+            treeView selection: nil. 
+            treeView selection: (treeView model indexOf:newSelectedNode).
+            self setSelection:treeView selectedNode contents view withRedraw: true.
+
         ]
     ]
 !
@@ -1272,12 +1285,12 @@
 
 select:something
     "change selection to something
-    "
+    "         
     (self enabled and:[something ~= self selection]) ifTrue:[   
         something isNil 
             ifTrue: [treeView selection: (Array with: 1)]
             ifFalse:[treeView cvsSelection:something].
-        self setSelection:something withRedraw:true
+        self setSelection:something withRedraw:true 
     ]
 
 !