check mark and ballot X character toggle

It's a quick way of adding the ✓ and ✗ symbols at the beginning of titles by pressing the 't' key.
This commit is contained in:
nadrad 2022-10-12 13:25:21 +02:00
parent 3a1f2db77d
commit 9ab20b40da
2 changed files with 22 additions and 0 deletions

21
h-m-m
View file

@ -948,6 +948,25 @@ function build_map(&$mm)
}
// }}}
// {{{ toggle symbol
function toggle_symbol(&$mm)
{
$chr = mb_substr($mm['nodes'][ $mm['active_node'] ]['title'],0,2);
if ($chr=='✓ ')
$mm['nodes'][ $mm['active_node'] ]['title'] = '✗ '.mb_substr($mm['nodes'][ $mm['active_node'] ]['title'],2);
elseif ($chr=='✗ ')
$mm['nodes'][ $mm['active_node'] ]['title'] = mb_substr($mm['nodes'][ $mm['active_node'] ]['title'],2);
else
$mm['nodes'][ $mm['active_node'] ]['title'] = '✓ '.$mm['nodes'][ $mm['active_node'] ]['title'];
$mm['modified'] = true;
build_map($mm);
display($mm);
}
// }}}
// {{{ toggle node
@ -2709,6 +2728,8 @@ function monitor_key_presses(&$mm)
case 's': save($mm); break;
case 'S': save($mm, true); break;
case 't': toggle_symbol($mm); break;
case 'u': undo($mm); break;
case 'v': collapse_all($mm); break;

View file

@ -22,6 +22,7 @@ Adding, removing, and editing nodes:
* `Ctrl+p` - appends the clipboard text at the end of the active node's title
* `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
* `u` - undo
* `Ctrl+r` - redo