# ----------------------------------------------------------------------------
#  Command Tree::delete
# ----------------------------------------------------------------------------
proc Tree::delete { path args } {
    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 selection $path set $sel
    _redraw_idle $path 3
}
