[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#248798: hnb: Ability to expand subtrees would be nice; here's a patch!



Package: hnb
Version: 1.9.17-3
Severity: wishlist


The only tree expand/collapse functions involved the whole tree.  See
attached patch for the ability to expand/collapse a subtree.  It also
binds '[' and ']' for these purposes along with entries in the node menu
item for the default configuration file. Already generated user
configurations will need to be hand edited to take advantage of the new
functionality.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.5
Locale: LANG=C, LC_CTYPE=C

Versions of packages hnb depends on:
ii  libc6                       2.3.2.ds1-12 GNU C Library: Shared libraries an
ii  libncurses5                 5.4-3        Shared libraries for terminal hand

-- no debconf information
diff -ur hnb-1.9.17.orig/src/expanded.c hnb-1.9.17/src/expanded.c
--- hnb-1.9.17.orig/src/expanded.c	2003-03-13 15:31:18.000000000 -0600
+++ hnb-1.9.17/src/expanded.c	2004-05-12 22:49:05.000000000 -0500
@@ -47,6 +47,15 @@
 			tnode = node_recurse (tnode);
 		}
 		cli_outfun ("expanded all nodes");
+	} else if(!strcmp(argv[1],"--subtree")) {
+	        node_setflag(pos,F_expanded,1);
+		Node *tnode = node_right(pos);
+
+		while ((tnode != node_down(pos))&&(tnode != pos)) {
+			node_setflag(tnode,F_expanded,1);
+			tnode = node_recurse (tnode);
+		}
+		cli_outfun ("expanded subtree");
 	}
 	return (int) pos;
 }
@@ -71,6 +80,15 @@
 			tnode = node_recurse (tnode);
 		}
 		cli_outfun ("collapsed all nodes");
+	} else if(!strcmp(argv[1],"--subtree")) {
+	        node_setflag(pos,F_expanded,0);
+		Node *tnode = node_right(pos);
+
+		while ((tnode != node_down(pos))&&(tnode != pos)) {
+			node_setflag(tnode,F_expanded,0);
+			tnode = node_recurse (tnode);
+		}
+		cli_outfun ("collapsed subtree");
 	}
 	
 	return (int) pos;
diff -ur hnb-1.9.17.orig/src/hnbrc.inc hnb-1.9.17/src/hnbrc.inc
--- hnb-1.9.17.orig/src/hnbrc.inc	2003-03-14 00:08:35.000000000 -0600
+++ hnb-1.9.17/src/hnbrc.inc	2004-05-12 23:06:52.000000000 -0500
@@ -216,6 +216,8 @@
 		\n\
 		bind + expand\n\
 		bind - collapse\n\
+		bind ] \"expand --subtree\"\n\
+		bind [ \"collapse --subtree\"\n\
 		\n\
 		bind ^Z restore_state\n\
 		\n\
@@ -515,17 +517,19 @@
 		menu \"Edit\" \"---------\" \"\"\n\
 		menu \"Edit\" \"Search ^F\" \"macro m_search\"\n\
 	##### node\n\
-		menu \"Entry\" \"--------------\" \"\"\n\
-		menu \"Entry\" \"edit    return\" \"edit\"\n\
-		menu \"Entry\" \"delete     del\" \"remove\"\n\
-		menu \"Entry\" \"--------------\" \"\"\n\
-		menu \"Entry\" \"do action   ^A\" \"action\"\n\
-		menu \"Entry\" \"indent      >\" \"indent\"\n\
-		menu \"Entry\" \"outdent     <\" \"outdent\"\n\
-		menu \"Entry\" \"toggle todo ^T\" \"toggle_todo\"\n\
-		menu \"Entry\" \"toggle done ^D\" \"toggle_done\"\n\
-		menu \"Entry\" \"expand      +\" \"expand\"\n\
-		menu \"Entry\" \"collapse    -\" \"collapse\"\n\
+		menu \"Entry\" \"-------------------\" \"\"\n\
+		menu \"Entry\" \"edit         return\" \"edit\"\n\
+		menu \"Entry\" \"delete          del\" \"remove\"\n\
+		menu \"Entry\" \"-------------------\" \"\"\n\
+		menu \"Entry\" \"do action        ^A\" \"action\"\n\
+		menu \"Entry\" \"indent           >\" \"indent\"\n\
+		menu \"Entry\" \"outdent          <\" \"outdent\"\n\
+		menu \"Entry\" \"toggle todo      ^T\" \"toggle_todo\"\n\
+		menu \"Entry\" \"toggle done      ^D\" \"toggle_done\"\n\
+		menu \"Entry\" \"expand           +\" \"expand\"\n\
+		menu \"Entry\" \"expand subtree   ]\" \"expand --subtree\"\n\
+		menu \"Entry\" \"collapse         -\" \"collapse\"\n\
+		menu \"Entry\" \"collapse subtree [\" \"collapse --subtree\"\n\
 	##### level\n\
 		menu \"Level\" \"------------\" \"\"\n\
 		menu \"Level\" \"sort      ^S\" \"sort -a\"\n\

Reply to: