Tk Library Source Code

View Ticket
Login
Ticket UUID: 578460
Title: struct::tree move within same parent
Type: Bug Version: None
Submitter: btheado Created on: 2002-07-07 21:18:32
Subsystem: struct :: tree Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2002-07-09 06:26:14
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2002-07-08 23:26:14
Description:
The documentation for the tree move command states:
"Make the specified nodes children of parent, inserting them into 
the parent's child list at the index given by index. "

From this, I expect a node being moved to always end up with the 
given index (assuming it is valid) after it is moved.

Example:
package require struct
struct::tree mytree
mytree insert root node0 node1 node2
mytree move root 1 node0
mytree children root

Expected result:
node1 node0 node2

Actual result:
node0 node1 node2


There are several tests in the test suite that support the existing 
behavior, so maybe I misunderstand the way it is supposed to 
work.  If that's the case, then the documentation for this command 
should be expanded to describe the behavior (and maybe why).
User Comments: andreas_kupries added on 2002-07-09 06:26:14:
Logged In: YES 
user_id=75003

Committed to head.

andreas_kupries added on 2002-07-09 06:15:48:
Logged In: YES 
user_id=75003

Ok, I looked deeper and it is truly more complicated than that.
I accept the patch. It seems to be the best solution. I will add 
some clarifications to the manpage as well.

andreas_kupries added on 2002-07-09 05:18:59:
Logged In: YES 
user_id=75003

Just tried

% t move root 2 node0
% t children root
node1 node0 node2
% t index node0
1

It seems to be an off-by-one problem in 'move'.

btheado added on 2002-07-08 04:18:32:

File Added - 26576: movefix.txt

Attachments: