mirror of
https://github.com/nadrad/h-m-m.git
synced 2026-03-13 20:25:45 +01:00
alternative key codes for home and end keys
This commit is contained in:
parent
65af378c6b
commit
4b8177a97e
1 changed files with 22 additions and 11 deletions
33
h-m-m
33
h-m-m
|
|
@ -249,14 +249,13 @@ const special_keys =
|
|||
'ctrl_arr_right' => "\033\133\061\073\065\103",
|
||||
'shift_arr_right' => "\033\133\061\073\062\103",
|
||||
|
||||
'home' => "\033\133\110",
|
||||
'end' => "\033\133\106",
|
||||
'home_alternative1' => "\033\133\110",
|
||||
'home_alternative2' => "\033\133\061\176",
|
||||
'home_alternative3' => "\033\133\067\176",
|
||||
|
||||
'home2' => "\033\133\067\176",
|
||||
'end2' => "\033\133\070\176",
|
||||
|
||||
'home_alternative' => "\033\133\061\176",
|
||||
'end_alternative' => "\033\133\064\176",
|
||||
'end_alternative1' => "\033\133\106",
|
||||
'end_alternative2' => "\033\133\064\176",
|
||||
'end_alternative3' => "\033\133\070\176",
|
||||
|
||||
'del' => "\033\133\063\176",
|
||||
'ctrl_del' => "\033\133\63\073\065\176",
|
||||
|
|
@ -1718,15 +1717,27 @@ function magic_readline(&$mm, $title)
|
|||
return false;
|
||||
}
|
||||
|
||||
elseif ($in==special_keys['arr_up'] || $in==special_keys['home'])
|
||||
elseif
|
||||
(
|
||||
$in==special_keys['arr_up'] ||
|
||||
$in==special_keys['home_alternative1'] ||
|
||||
$in==special_keys['home_alternative2'] ||
|
||||
$in==special_keys['home_alternative3']
|
||||
)
|
||||
$cursor = 1;
|
||||
|
||||
elseif
|
||||
(
|
||||
$in==special_keys['arr_down'] ||
|
||||
$in==special_keys['end_alternative1'] ||
|
||||
$in==special_keys['end_alternative2'] ||
|
||||
$in==special_keys['end_alternative3']
|
||||
)
|
||||
$cursor = mb_strlen($title)+1;
|
||||
|
||||
elseif ($in==special_keys['arr_right'])
|
||||
$cursor = min( mb_strlen($title)+1, $cursor+1);
|
||||
|
||||
elseif ($in==special_keys['arr_down'] || $in==special_keys['end'])
|
||||
$cursor = mb_strlen($title)+1;
|
||||
|
||||
elseif ($in==special_keys['arr_left'])
|
||||
$cursor = max(1, $cursor-1);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue