Tk Library Source Code

Artifact [a5ef6f680c]
Login

Artifact a5ef6f680c6250b350fde80cd677648074f39100:

Attachment "bwidget-tree-delete-selected.patch" to ticket [621178ffff] added by jenglish 2003-01-17 07:24:35.
--- tree.tcl.tree-delete-selected.old	Mon Nov  4 15:31:48 2002
+++ tree.tcl	Thu Jan 16 16:14:49 2003
@@ -404,25 +404,17 @@
     variable $path
     upvar 0  $path data
 
-    set sel $data(selnodes)
-
     foreach lnodes $args {
 	foreach node $lnodes {
 	    if { [string compare $node "root"] && [info exists data($node)] } {
 		set parent [lindex $data($node) 0]
 		set idx	   [lsearch $data($parent) $node]
 		set data($parent) [lreplace $data($parent) $idx $idx]
-		set idx	   [lsearch $sel $node]
-		if { $idx >= 0 } {
-		    set sel [lreplace $sel $idx $idx]
-		}
 		_subdelete $path [list $node]
 	    }
 	}
     }
 
-    set data(selnodes) {}
-    eval [list selection $path set] $sel
     _redraw_idle $path 3
 }
 
@@ -1084,6 +1076,8 @@
     variable $path
     upvar 0  $path data
 
+    set sel $data(selnodes)
+
     while { [llength $lnodes] } {
         set lsubnodes [list]
         foreach node $lnodes {
@@ -1091,6 +1085,10 @@
                 lappend lsubnodes $subnode
             }
             unset data($node)
+	    set idx [lsearch $sel $node]
+	    if { $idx >= 0 } {
+		set sel [lreplace $sel $idx $idx]
+	    }
             if { [set win [Widget::getoption $path.$node -window]] != "" } {
                 destroy $win
             }
@@ -1098,6 +1096,8 @@
         }
         set lnodes $lsubnodes
     }
+
+    set data(selnodes) $sel
 }