1 | <?php |
||
16 | class ANSI implements CursorInterface |
||
17 | { |
||
18 | const ESCAPE = "\e"; |
||
19 | |||
20 | const CODE_MOVE_POSITION = '[%d;%dH'; // line, column |
||
21 | const CODE_MOVE_UP_LINES = '[%dA'; // lines |
||
22 | const CODE_MOVE_DOWN_LINES = '[%dB'; // lines |
||
23 | const CODE_MOVE_FORWARD = '[%dC'; // columns |
||
24 | const CODE_MOVE_BACKWARDS = '[%dD'; // columns |
||
25 | |||
26 | const CODE_ERASE_TO_END_OF_LINE = '[K'; |
||
27 | const CODE_ERASE_TO_START_OF_LINE = '[1K'; |
||
28 | const CODE_ERASE_LINE = '[2K'; |
||
29 | const CODE_ERASE_DOWN = '[J'; |
||
30 | const CODE_ERASE_UP = '[1J'; |
||
31 | const CODE_ERASE_SCREEN = '[2J'; |
||
32 | |||
33 | /** |
||
34 | * @param int $line |
||
35 | * @param int $column |
||
36 | * |
||
37 | * @return string |
||
38 | */ |
||
39 | public function move($line, $column) |
||
43 | |||
44 | /** |
||
45 | * @param int $lines |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | public function moveUp($lines) |
||
53 | |||
54 | /** |
||
55 | * @param int $lines |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | public function moveDown($lines) |
||
63 | |||
64 | /** |
||
65 | * @param int $columns |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | public function moveLeft($columns) |
||
73 | |||
74 | /** |
||
75 | * @param int $columns |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | public function moveRight($columns) |
||
83 | |||
84 | /** |
||
85 | * @return string |
||
86 | */ |
||
87 | public function eraseToEnd() |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | public function eraseToStart() |
||
99 | |||
100 | /** |
||
101 | * @return string |
||
102 | */ |
||
103 | public function eraseDown() |
||
107 | |||
108 | /** |
||
109 | * @return string |
||
110 | */ |
||
111 | public function eraseUp() |
||
115 | |||
116 | /** |
||
117 | * @return string |
||
118 | */ |
||
119 | public function eraseScreen() |
||
123 | } |
||
124 |