mirror of https://github.com/nadrad/h-m-m.git
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']
|
||||
;
|
||||
|
||||
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;
|
||||
build_map($mm);
|
||||
display($mm);
|
||||
|
@ -2847,6 +2879,7 @@ function monitor_key_presses(&$mm)
|
|||
case 'S': save($mm, true); break;
|
||||
|
||||
case 't': toggle_symbol($mm); break;
|
||||
case 'T': sort_siblings($mm); break;
|
||||
case '#': toggle_numbers($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
|
||||
* `#` - adds or removes sequential numbers at the beginning of the titles of a node and its siblings
|
||||
* `=` - increase the positive ranking
|
||||
* `+` - decrease the positive ranking
|
||||
* `-` - increase the negative ranking
|
||||
* `_` - decrease the negative ranking
|
||||
* `=` - increases the positive ranking
|
||||
* `+` - decreases the positive ranking
|
||||
* `-` - increases the negative ranking
|
||||
* `_` - decreases the negative ranking
|
||||
|
||||
Relative navigating and moving:
|
||||
|
||||
* `h` or `←` - activate the parent of the previously active node
|
||||
* `l` or `→` - activate 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)
|
||||
* `k` or `↑` - activate the higher sibling (or the nearest higher node if there's no higher sibling)
|
||||
* `h` or `←` - activates the parent of the previously active node
|
||||
* `l` or `→` - activates the middle child of the previously active node
|
||||
* `j` or `↓` - activates the lower sibling (or the nearest lower node if there's no lower 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
|
||||
* `K` - moves the current node up among its siblings
|
||||
* `T` - sorts the siblings of the active node
|
||||
|
||||
Adjusting the view:
|
||||
|
||||
|
@ -83,18 +84,18 @@ Save, export, and quit:
|
|||
|
||||
In the text editor:
|
||||
|
||||
* `↓` - move the cursor to the end of the line
|
||||
* `↑` - move the cursor to the beginning of the line
|
||||
* `←` or `Home` - move the cursor to the left
|
||||
* `→` or `End` - move the cursor to the right
|
||||
* `Ctrl+Left` or `Shift+Left` - move cursor to the previous word
|
||||
* `Ctrl+Right` or `Shift+right` - move cursor to the next word
|
||||
* `Delete` - delete character
|
||||
* `Ctrl+Delete` - delete word
|
||||
* `Backspace` - delete previous character
|
||||
* `ctrl+Backspace` - delete previous word
|
||||
* `↓` - moves the cursor to the end of the line
|
||||
* `↑` - moves the cursor to the beginning of the line
|
||||
* `←` or `Home` - moves the cursor to the left
|
||||
* `→` or `End` - moves the cursor to the right
|
||||
* `Ctrl+Left` or `Shift+Left` - moves cursor to the previous word
|
||||
* `Ctrl+Right` or `Shift+right` - moves cursor to the next word
|
||||
* `Delete` - deletes character
|
||||
* `Ctrl+Delete` - deletes word
|
||||
* `Backspace` - deletes previous character
|
||||
* `ctrl+Backspace` - deletes previous word
|
||||
* `Ctrl+v` or `Ctrl+Shift+v` - paste
|
||||
* `Esc` - cancel editing
|
||||
* `Esc` - cancels editing
|
||||
* `Enter` - wanna guess? ;)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue