diff --git a/h-m-m b/h-m-m index 0c3057e..176ecfd 100755 --- a/h-m-m +++ b/h-m-m @@ -136,6 +136,8 @@ const arr_right = "\033\133\103"; const arr_up = "\033\133\101"; const arr_left = "\033\133\104"; +const del = "\033\133\063\176"; + const reset_page = "\033[2J\033[0;0f"; const reset_color = "\033[0m"; @@ -2150,11 +2152,13 @@ function yank_node(&$mm, $exclude_parent = false ) // }}} // {{{ delete -function delete_node(&$mm, $exclude_parent = false ) +function delete_node(&$mm, $exclude_parent = false, $dont_copy_to_clipboard = false ) { - if ($mm['active_node']==$mm['root']) $exclude_parent = true; + if ($mm['active_node']==$mm['root']) + $exclude_parent = true; - copy_to_clipboard($mm, encode_tree($mm, $mm['active_node'], $exclude_parent) ); + if (!$dont_copy_to_clipboard) + copy_to_clipboard($mm, encode_tree($mm, $mm['active_node'], $exclude_parent) ); push_change($mm); $mm['modified'] = true; @@ -2164,7 +2168,8 @@ function delete_node(&$mm, $exclude_parent = false ) build_map($mm); display($mm); - message($mm, 'Item(s) are cut and placed into the clipboard.'); + if (!$dont_copy_to_clipboard) + message($mm, 'Item(s) are cut and placed into the clipboard.'); } @@ -2600,6 +2605,7 @@ function monitor_key_presses(&$mm) case 'd': delete_node($mm); break; case 'D': delete_node($mm, true); break; + case del: delete_node($mm, false, true); break; case 'e': edit_node($mm); break; case 'E': edit_node($mm, true); break; diff --git a/readme.md b/readme.md index 3941313..ea3da71 100644 --- a/readme.md +++ b/readme.md @@ -16,6 +16,7 @@ Adding, removing, and editing nodes: * `Y` - yanks (copies) the descendants of the active node * `d` - deletes (cuts) the active node and its descendants * `D` - deletes (cuts) the descendants of the active node +* `delete` - deletes the active node and its descendants without putting them in the clipboard * `p` - pastes as descendants of the active node * `P` - pastes as siblings of the active node * `ctrl+p` - appends the clipboard text at the end of the active node's title