@@ -15,8 +15,10 @@ class Readline extends EventEmitter
15
15
const ESC_RIGHT = "C " ;
16
16
const ESC_UP = "A " ;
17
17
const ESC_DOWN = "B " ;
18
- const ESC_DEL = "3 ~ " ;
18
+ const ESC_HOME = "1 ~ " ;
19
19
const ESC_INS = "2~ " ;
20
+ const ESC_DEL = "3~ " ;
21
+ const ESC_END = "4~ " ;
20
22
21
23
const ESC_F10 = "20~ " ;
22
24
@@ -45,8 +47,10 @@ public function __construct($output)
45
47
$ this ->sequencer ->addSequence (self ::ESC_SEQUENCE . self ::ESC_RIGHT , array ($ this , 'onKeyRight ' ));
46
48
$ this ->sequencer ->addSequence (self ::ESC_SEQUENCE . self ::ESC_UP , array ($ this , 'onKeyUp ' ));
47
49
$ this ->sequencer ->addSequence (self ::ESC_SEQUENCE . self ::ESC_DOWN , array ($ this , 'onKeyDown ' ));
48
- $ this ->sequencer ->addSequence (self ::ESC_SEQUENCE . self ::ESC_DEL , array ($ this , 'onKeyDelete ' ));
50
+ $ this ->sequencer ->addSequence (self ::ESC_SEQUENCE . self ::ESC_HOME , array ($ this , 'onKeyHome ' ));
49
51
$ this ->sequencer ->addSequence (self ::ESC_SEQUENCE . self ::ESC_INS , array ($ this , 'onKeyInsert ' ));
52
+ $ this ->sequencer ->addSequence (self ::ESC_SEQUENCE . self ::ESC_DEL , array ($ this , 'onKeyDelete ' ));
53
+ $ this ->sequencer ->addSequence (self ::ESC_SEQUENCE . self ::ESC_END , array ($ this , 'onKeyEnd ' ));
50
54
51
55
$ expect = 0 ;
52
56
$ char = '' ;
@@ -417,6 +421,18 @@ public function onKeyInsert()
417
421
// TODO: toggle insert mode
418
422
}
419
423
424
+ /** @internal */
425
+ public function onKeyHome ()
426
+ {
427
+ $ this ->moveCursorTo (0 );
428
+ }
429
+
430
+ /** @internal */
431
+ public function onKeyEnd ()
432
+ {
433
+ $ this ->moveCursorTo ($ this ->strlen ($ this ->linebuffer ));
434
+ }
435
+
420
436
/** @internal */
421
437
public function onKeyTab ()
422
438
{
0 commit comments