mirror of
https://github.com/nadrad/h-m-m.git
synced 2024-05-17 22:46:32 +02:00
key binding for adding and removing seq. nums
This commit is contained in:
parent
be86b68886
commit
70e1c5f875
29
h-m-m
29
h-m-m
|
@ -953,6 +953,34 @@ function build_map(&$mm)
|
|||
}
|
||||
|
||||
|
||||
// }}}
|
||||
// {{{ toggle numbers
|
||||
|
||||
function toggle_numbers(&$mm)
|
||||
{
|
||||
if ($mm['active_node'] <= $mm['root'])
|
||||
return;
|
||||
|
||||
$ordered= false;
|
||||
$i=1;
|
||||
foreach ($mm['nodes'][ $mm['nodes'][$mm['active_node']]['parent'] ]['children'] as $cid)
|
||||
$ordered = $ordered || mb_ereg('^\d+\.',$mm['nodes'][$cid]['title']);
|
||||
|
||||
$i=1;
|
||||
foreach ($mm['nodes'][ $mm['nodes'][$mm['active_node']]['parent'] ]['children'] as $cid)
|
||||
if ($ordered)
|
||||
$mm['nodes'][$cid]['title'] = mb_ereg_replace('^\d+\. *','',$mm['nodes'][$cid]['title']);
|
||||
else
|
||||
$mm['nodes'][$cid]['title'] = ($i++).'. '.$mm['nodes'][$cid]['title'];
|
||||
|
||||
$mm['modified'] = true;
|
||||
build_map($mm);
|
||||
display($mm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// }}}
|
||||
// {{{ toggle symbol
|
||||
|
||||
|
@ -2734,6 +2762,7 @@ function monitor_key_presses(&$mm)
|
|||
case 'S': save($mm, true); break;
|
||||
|
||||
case 't': toggle_symbol($mm); break;
|
||||
case '#': toggle_numbers($mm); break;
|
||||
|
||||
case 'u': undo($mm); break;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ Adding, removing, and editing nodes:
|
|||
* `e`, `i`, or `a` - edits the active node
|
||||
* `E`, `I`, or `A` - edits the active node, ignoring the existing text
|
||||
* `t` - toggles '✓ ', '✗ ', and '' at the beginning of the title
|
||||
* `#` - adds or removes sequential numbers at the beginning of the titles of a node and its siblings
|
||||
* `u` - undo
|
||||
* `Ctrl+r` - redo
|
||||
|
||||
|
|
Loading…
Reference in a new issue