[padb] r440 committed - Tweak the "tree" view output slightly, add a column at the left which ...
padb at googlecode.com
padb at googlecode.com
Sat Jun 18 23:21:32 BST 2011
Revision: 440
Author: apittman at gmail.com
Date: Sat Jun 18 15:21:15 2011
Log: Tweak the "tree" view output slightly, add a column at the left
which shows
shows the current indentation level so it's easier to match different
branches
of the tree.
As it's not possible to match branches by the number only indent each
subsequent
level by 1 rather than 2 characters to make the tree narrower and
(hopefully)
easier to read.
http://code.google.com/p/padb/source/detail?r=440
Modified:
/trunk/src/padb
=======================================
--- /trunk/src/padb Sat Jun 18 14:48:57 2011
+++ /trunk/src/padb Sat Jun 18 15:21:15 2011
@@ -4377,8 +4377,9 @@
}
sub _display_tree {
- my ( $tree, $parent, $indent, $path, $enforce_spec ) = @_;
-
+ my ( $tree, $parent, $indent_count, $path, $enforce_spec ) = @_;
+
+ my $indent = sprintf( "%3d: %*s", $indent_count, $indent_count, '' );
my $ret = $EMPTY_STRING;
# Sort peers by lowest rank of each branch.
@@ -4405,8 +4406,11 @@
}
if ( defined $tree->{$peer}->{desc} ) {
- $ret .= _display_tree( $tree->{$peer}->{desc},
- $vpspec, "$indent ", "$path,$peer", $child_enforce_spec );
+ $ret .= _display_tree(
+ $tree->{$peer}->{desc}, $vpspec,
+ $indent_count + 1, "$path,$peer",
+ $child_enforce_spec
+ );
}
}
return $ret;
@@ -4414,7 +4418,7 @@
sub display_tree {
my ( $tree, ) = @_;
- return _display_tree( $tree, "no-parent", $EMPTY_STRING,
$EMPTY_STRING, 1 );
+ return _display_tree( $tree, "no-parent", 0, $EMPTY_STRING, 1 );
}
# An experimental new tree format.
More information about the padb-devel
mailing list