mirror of
https://github.com/nadrad/h-m-m.git
synced 2024-05-20 23:16:32 +02:00
pressing '?' shows the key bindings
This commit is contained in:
parent
566e292ef8
commit
9e049112f4
56
h-m-m
56
h-m-m
|
@ -183,6 +183,7 @@ const special_keys =
|
||||||
'ctrl_e' => "\005",
|
'ctrl_e' => "\005",
|
||||||
'ctrl_f' => "\006",
|
'ctrl_f' => "\006",
|
||||||
'ctrl_g' => "\007",
|
'ctrl_g' => "\007",
|
||||||
|
'ctrl_back_space' => "\010",
|
||||||
'ctrl_h' => "\010",
|
'ctrl_h' => "\010",
|
||||||
'ctrl_i' => "\011",
|
'ctrl_i' => "\011",
|
||||||
'ctrl_j' => "\012",
|
'ctrl_j' => "\012",
|
||||||
|
@ -247,7 +248,6 @@ const special_keys =
|
||||||
'del' => "\033\133\063\176",
|
'del' => "\033\133\063\176",
|
||||||
'ctrl_del' => "\033\133\63\073\065\176",
|
'ctrl_del' => "\033\133\63\073\065\176",
|
||||||
'back_space' => "\177",
|
'back_space' => "\177",
|
||||||
'ctrl_back_space' => "\010",
|
|
||||||
|
|
||||||
'enter' => "\012",
|
'enter' => "\012",
|
||||||
'space' => "\040",
|
'space' => "\040",
|
||||||
|
@ -333,7 +333,6 @@ $keybindings['Q'] = 'shutdown';
|
||||||
|
|
||||||
$keybindings['r'] = 'collapse_other_branches';
|
$keybindings['r'] = 'collapse_other_branches';
|
||||||
$keybindings['R'] = 'collapse_inner';
|
$keybindings['R'] = 'collapse_inner';
|
||||||
$keybindings[special_keys['ctrl_r']] = 'redo';
|
|
||||||
|
|
||||||
$keybindings['s'] = 'save';
|
$keybindings['s'] = 'save';
|
||||||
$keybindings['S'] = 'save_as';
|
$keybindings['S'] = 'save_as';
|
||||||
|
@ -380,8 +379,8 @@ $keybindings['9'] = 'collapse_level_9';
|
||||||
|
|
||||||
$keybindings['|'] = 'toggle_align';
|
$keybindings['|'] = 'toggle_align';
|
||||||
|
|
||||||
|
$keybindings['?'] = 'help';
|
||||||
$keybindings['/'] = 'search';
|
$keybindings['/'] = 'search';
|
||||||
$keybindings['?'] = 'search';
|
|
||||||
$keybindings[special_keys['ctrl_f']] = 'search';
|
$keybindings[special_keys['ctrl_f']] = 'search';
|
||||||
|
|
||||||
$keybindings['='] = 'increase_positive_rank';
|
$keybindings['='] = 'increase_positive_rank';
|
||||||
|
@ -2074,6 +2073,57 @@ function go_to_bottom()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ help
|
||||||
|
|
||||||
|
function help()
|
||||||
|
{
|
||||||
|
|
||||||
|
global $mm;
|
||||||
|
global $keybindings;
|
||||||
|
|
||||||
|
$keynames = array_flip(special_keys);
|
||||||
|
|
||||||
|
$commands = [];
|
||||||
|
foreach ($keybindings as $key => $command)
|
||||||
|
$commands[$command][] = ( $keynames[$key] ?? $key );
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
foreach ($commands as $command => $keys)
|
||||||
|
$output[] =
|
||||||
|
str_pad($command.' ',32,'.',STR_PAD_RIGHT)
|
||||||
|
.' '
|
||||||
|
.implode(', ',$keys);
|
||||||
|
|
||||||
|
sort($output);
|
||||||
|
|
||||||
|
$breakpoint = floor((count($output)-1)/2);
|
||||||
|
|
||||||
|
for ($i=0 ; $i<=$breakpoint ; $i++)
|
||||||
|
echo
|
||||||
|
' '
|
||||||
|
.str_pad($output[$i],56,' ',STR_PAD_RIGHT)
|
||||||
|
.
|
||||||
|
($output[$i+$breakpoint+1] ?? '')
|
||||||
|
."\n"
|
||||||
|
;
|
||||||
|
echo "\n";
|
||||||
|
|
||||||
|
message($mm, "Press any key to exit this help screen.");
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
usleep(20000);
|
||||||
|
$in = fread(STDIN, 16);
|
||||||
|
if ($in != '')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
display($mm);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// }}}
|
// }}}
|
||||||
// {{{ search
|
// {{{ search
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ Collapsing and expanding:
|
||||||
|
|
||||||
Search:
|
Search:
|
||||||
|
|
||||||
* `/`, `?`, or `Ctrl+f` - searches for a phrase
|
* `/` or `Ctrl+f` - searches for a phrase
|
||||||
* `n` - goes to the next search result
|
* `n` - goes to the next search result
|
||||||
* `N` - goes to the previous search result
|
* `N` - goes to the previous search result
|
||||||
|
|
||||||
|
@ -86,6 +86,10 @@ Save, export, quit, etc.:
|
||||||
* `Q` - quits, ignoring the changes
|
* `Q` - quits, ignoring the changes
|
||||||
* `Ctrl+o` - open the active node as a file or URL using xdg-open
|
* `Ctrl+o` - open the active node as a file or URL using xdg-open
|
||||||
|
|
||||||
|
Misc:
|
||||||
|
|
||||||
|
* `?` - show the key bindings
|
||||||
|
|
||||||
In the text editor:
|
In the text editor:
|
||||||
|
|
||||||
* `↓` - moves the cursor to the end of the line
|
* `↓` - moves the cursor to the end of the line
|
||||||
|
|
Loading…
Reference in a new issue