diff --git a/h-m-m b/h-m-m index d21d1f9..a36bd44 100755 --- a/h-m-m +++ b/h-m-m @@ -1728,7 +1728,9 @@ function magic_readline(&$mm, $title) $in==special_keys['arr_up'] || $in==special_keys['home_alternative1'] || $in==special_keys['home_alternative2'] || - $in==special_keys['home_alternative3'] + $in==special_keys['home_alternative3'] || + $in==special_keys['ctrl_p'] || + $in==special_keys['ctrl_a'] ) $cursor = 1; @@ -1737,17 +1739,27 @@ function magic_readline(&$mm, $title) $in==special_keys['arr_down'] || $in==special_keys['end_alternative1'] || $in==special_keys['end_alternative2'] || - $in==special_keys['end_alternative3'] + $in==special_keys['end_alternative3'] || + $in==special_keys['ctrl_n'] || + $in==special_keys['ctrl_e'] ) $cursor = mb_strlen($title)+1; - elseif ($in==special_keys['arr_right']) + elseif + ( + $in==special_keys['arr_right'] || + $in==special_keys['ctrl_f'] + ) $cursor = min( mb_strlen($title)+1, $cursor+1); - elseif ($in==special_keys['arr_left']) + elseif + ( + $in==special_keys['arr_left'] || + $in==special_keys['ctrl_b'] + ) $cursor = max(1, $cursor-1); - elseif ($in==special_keys['ctrl_arr_left'] || $in==special_keys['shift_arr_left'] || $in==special_keys['meta_arr_left']) + elseif ($in==special_keys['ctrl_arr_left'] || $in==special_keys['shift_arr_left'] || $in==special_keys['meta_arr_left'] || $in==special_keys['alt_b']) $cursor = $cursor < 3 ? 1 @@ -1761,7 +1773,7 @@ function magic_readline(&$mm, $title) ) ); - elseif ($in==special_keys['ctrl_arr_right'] || $in==special_keys['shift_arr_right'] || $in==special_keys['meta_arr_right']) + elseif ($in==special_keys['ctrl_arr_right'] || $in==special_keys['shift_arr_right'] || $in==special_keys['meta_arr_right'] || $in==special_keys['alt_f']) $cursor = $cursor > mb_strlen($title) -2 ? mb_strlen($title) + 1 @@ -1821,7 +1833,7 @@ function magic_readline(&$mm, $title) } } - elseif ($in==special_keys['ctrl_del']) + elseif ($in==special_keys['ctrl_del'] || $in==special_keys['alt_d']) { $len = mb_strlen($title); $from = @@ -1863,6 +1875,17 @@ function magic_readline(&$mm, $title) elseif ($in==special_keys['enter']) return trim($title); + elseif ($in==special_keys['ctrl_k']) + { + $title = mb_substr ($title, 0, $cursor-1); + } + + elseif ($in==special_keys['ctrl_u']) + { + $title = mb_substr ($title, $cursor-1); + $cursor = 1; + } + elseif ($in==special_keys['ctrl_v']) { $content = diff --git a/readme.md b/readme.md index 680f593..6219d06 100644 --- a/readme.md +++ b/readme.md @@ -94,16 +94,18 @@ Misc: In the text editor: -* `↓` - 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 +* `↓` or `Ctrl-e` or `Ctrl-n` - moves the cursor to the end of the line +* `↑` or `Ctrl-p` or `Ctrl-a` or `Ctrl-p` - moves the cursor to the beginning of the line +* `←` or `Home` or `Ctrl-b` - moves the cursor to the left +* `→` or `End` or `Ctrl-f` - moves the cursor to the right +* `Ctrl+Left` or `Shift+Left` or `Alt-b`- moves cursor to the previous word +* `Ctrl+Right` or `Shift+right`or `Atl-f` - moves cursor to the next word * `Delete` - deletes character -* `Ctrl+Delete` - deletes word +* `Ctrl+Delete`or `Alt-d` - deletes word * `Backspace` - deletes previous character * `ctrl+Backspace`, `ctrl+w` - deletes previous word +* `Ctrl-k` - deletes everything to the right of the cursor +* `Ctrl-u` - deletes everything to the left of the cursor * `Ctrl+v` or `Ctrl+Shift+v` - paste * `Esc` - cancels editing * `Enter` - wanna guess? ;)