mirror of
https://github.com/nadrad/h-m-m.git
synced 2024-06-08 03:52:12 +02:00
added 'T' for sorting siblings
This commit is contained in:
parent
cdaf8e5be4
commit
4e9e12d440
33
h-m-m
33
h-m-m
|
@ -2766,6 +2766,38 @@ function rank(&$mm, $add_positive, $add_negative)
|
||||||
.$mm['nodes'][ $mm['active_node'] ]['title']
|
.$mm['nodes'][ $mm['active_node'] ]['title']
|
||||||
;
|
;
|
||||||
|
|
||||||
|
push_change($mm);
|
||||||
|
$mm['modified'] = true;
|
||||||
|
build_map($mm);
|
||||||
|
display($mm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ sort
|
||||||
|
|
||||||
|
function sort_siblings(&$mm)
|
||||||
|
{
|
||||||
|
if ($mm['active_node'] <= $mm['root_id'])
|
||||||
|
return;
|
||||||
|
|
||||||
|
$siblings = [];
|
||||||
|
$sibling_ids = $mm['nodes'][ $mm['nodes'][ $mm['active_node'] ]['parent'] ]['children'];
|
||||||
|
|
||||||
|
if (empty($sibling_ids))
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach ($sibling_ids as $sid)
|
||||||
|
if (mb_ereg('^\((\d+)\+,(\d+)\-\)', $mm['nodes'][$sid]['title'], $values))
|
||||||
|
$siblings[ (9000000 - $values[1] + $values[2]).'.'.$sid ] = $sid;
|
||||||
|
else
|
||||||
|
$siblings[ $mm['nodes'][$sid]['title'].'.'.$sid ] = $sid;
|
||||||
|
|
||||||
|
ksort($siblings, SORT_NATURAL);
|
||||||
|
|
||||||
|
$mm['nodes'][ $mm['nodes'][ $mm['active_node'] ]['parent'] ]['children'] = $siblings;
|
||||||
|
|
||||||
|
push_change($mm);
|
||||||
$mm['modified'] = true;
|
$mm['modified'] = true;
|
||||||
build_map($mm);
|
build_map($mm);
|
||||||
display($mm);
|
display($mm);
|
||||||
|
@ -2847,6 +2879,7 @@ function monitor_key_presses(&$mm)
|
||||||
case 'S': save($mm, true); break;
|
case 'S': save($mm, true); break;
|
||||||
|
|
||||||
case 't': toggle_symbol($mm); break;
|
case 't': toggle_symbol($mm); break;
|
||||||
|
case 'T': sort_siblings($mm); break;
|
||||||
case '#': toggle_numbers($mm); break;
|
case '#': toggle_numbers($mm); break;
|
||||||
|
|
||||||
case 'u': undo($mm); break;
|
case 'u': undo($mm); break;
|
||||||
|
|
39
readme.md
39
readme.md
|
@ -29,19 +29,20 @@ Marks:
|
||||||
|
|
||||||
* `t` - toggles '✓ ', '✗ ', and '' at the beginning of the title
|
* `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
|
* `#` - adds or removes sequential numbers at the beginning of the titles of a node and its siblings
|
||||||
* `=` - increase the positive ranking
|
* `=` - increases the positive ranking
|
||||||
* `+` - decrease the positive ranking
|
* `+` - decreases the positive ranking
|
||||||
* `-` - increase the negative ranking
|
* `-` - increases the negative ranking
|
||||||
* `_` - decrease the negative ranking
|
* `_` - decreases the negative ranking
|
||||||
|
|
||||||
Relative navigating and moving:
|
Relative navigating and moving:
|
||||||
|
|
||||||
* `h` or `←` - activate the parent of the previously active node
|
* `h` or `←` - activates the parent of the previously active node
|
||||||
* `l` or `→` - activate the middle child of the previously active node
|
* `l` or `→` - activates the middle child of the previously active node
|
||||||
* `j` or `↓` - activate the lower sibling (or the nearest lower node if there's no lower sibling)
|
* `j` or `↓` - activates the lower sibling (or the nearest lower node if there's no lower sibling)
|
||||||
* `k` or `↑` - activate the higher sibling (or the nearest higher node if there's no higher sibling)
|
* `k` or `↑` - activates the higher sibling (or the nearest higher node if there's no higher sibling)
|
||||||
* `J` - moves the current node down among its siblings
|
* `J` - moves the current node down among its siblings
|
||||||
* `K` - moves the current node up among its siblings
|
* `K` - moves the current node up among its siblings
|
||||||
|
* `T` - sorts the siblings of the active node
|
||||||
|
|
||||||
Adjusting the view:
|
Adjusting the view:
|
||||||
|
|
||||||
|
@ -83,18 +84,18 @@ Save, export, and quit:
|
||||||
|
|
||||||
In the text editor:
|
In the text editor:
|
||||||
|
|
||||||
* `↓` - move the cursor to the end of the line
|
* `↓` - moves the cursor to the end of the line
|
||||||
* `↑` - move the cursor to the beginning of the line
|
* `↑` - moves the cursor to the beginning of the line
|
||||||
* `←` or `Home` - move the cursor to the left
|
* `←` or `Home` - moves the cursor to the left
|
||||||
* `→` or `End` - move the cursor to the right
|
* `→` or `End` - moves the cursor to the right
|
||||||
* `Ctrl+Left` or `Shift+Left` - move cursor to the previous word
|
* `Ctrl+Left` or `Shift+Left` - moves cursor to the previous word
|
||||||
* `Ctrl+Right` or `Shift+right` - move cursor to the next word
|
* `Ctrl+Right` or `Shift+right` - moves cursor to the next word
|
||||||
* `Delete` - delete character
|
* `Delete` - deletes character
|
||||||
* `Ctrl+Delete` - delete word
|
* `Ctrl+Delete` - deletes word
|
||||||
* `Backspace` - delete previous character
|
* `Backspace` - deletes previous character
|
||||||
* `ctrl+Backspace` - delete previous word
|
* `ctrl+Backspace` - deletes previous word
|
||||||
* `Ctrl+v` or `Ctrl+Shift+v` - paste
|
* `Ctrl+v` or `Ctrl+Shift+v` - paste
|
||||||
* `Esc` - cancel editing
|
* `Esc` - cancels editing
|
||||||
* `Enter` - wanna guess? ;)
|
* `Enter` - wanna guess? ;)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue