added 'del'

This commit is contained in:
nadrad 2022-09-16 21:03:12 +02:00
parent 9c0582889e
commit 2b913c599f
2 changed files with 11 additions and 4 deletions

14
h-m-m
View file

@ -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;

View file

@ -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