From 48e7932d4e220b52e7c4da555fb66f2165e1e4b4 Mon Sep 17 00:00:00 2001 From: nadrad Date: Tue, 13 Sep 2022 11:45:03 +0200 Subject: [PATCH] 'I' for collapsing children --- h-m-m | 15 +++++++++++++++ readme.md | 1 + 2 files changed, 16 insertions(+) diff --git a/h-m-m b/h-m-m index 83a486d..6c1ae26 100755 --- a/h-m-m +++ b/h-m-m @@ -2038,6 +2038,20 @@ function collapse_other_branches(&$mm) display($mm); } + +function collapse_inner(&$mm) +{ + foreach ($mm['nodes'][ $mm['active_node'] ]['children'] as $cid) + $mm['nodes'][$cid]['collapsed'] = true; + + $mm['nodes'][ $mm['active_node'] ]['collapsed'] = false; + + build_map($mm); + center_active_node($mm); + display($mm); +} + + function find_branch(&$mm, $cid) { if ($mm['nodes'][$cid]['parent'] == $mm['root']) @@ -2332,6 +2346,7 @@ function monitor_key_presses(&$mm) case 'h': change_active_node($mm, move_left); break; case 'i': collapse_other_branches($mm); break; + case 'I': collapse_inner($mm); break; case 'j': change_active_node($mm, move_down); break; case 'J': move_active_node_down($mm); break; diff --git a/readme.md b/readme.md index c3cef32..2a1b45d 100644 --- a/readme.md +++ b/readme.md @@ -52,6 +52,7 @@ Collapsing and expanding: * `f` - focuses by collapsing all, but the ancestors and descendants of the active node * `F` - locks focus as the active node changes (try it with the center lock) * `i` - collapses all the first level items except for the one that contains the active node +* `I` - collapses the children of the active node Search: