1 | <?php |
||
5 | class ANSI implements CursorInterface |
||
6 | { |
||
7 | const ESCAPE = "\e"; |
||
8 | |||
9 | const CODE_MOVE_POSITION = '[%d;%dH'; // line, column |
||
10 | const CODE_MOVE_UP_LINES = '[%dA'; // lines |
||
11 | const CODE_MOVE_DOWN_LINES = '[%dB'; // lines |
||
12 | const CODE_MOVE_FORWARD = '[%dC'; // columns |
||
13 | const CODE_MOVE_BACKWARDS = '[%dD'; // columns |
||
14 | |||
15 | const CODE_ERASE_TO_END_OF_LINE = '[K'; |
||
16 | const CODE_ERASE_TO_START_OF_LINE = '[1K'; |
||
17 | const CODE_ERASE_LINE = '[2K'; |
||
18 | const CODE_ERASE_DOWN = '[J'; |
||
19 | const CODE_ERASE_UP = '[1J'; |
||
20 | const CODE_ERASE_SCREEN = '[2J'; |
||
21 | |||
22 | /** |
||
23 | * @param int $line |
||
24 | * @param int $column |
||
25 | * |
||
26 | * @return string |
||
27 | */ |
||
28 | public function move($line, $column) |
||
32 | |||
33 | /** |
||
34 | * @param int $lines |
||
35 | * |
||
36 | * @return string |
||
37 | */ |
||
38 | public function moveUp($lines) |
||
42 | |||
43 | /** |
||
44 | * @param int $lines |
||
45 | * |
||
46 | * @return string |
||
47 | */ |
||
48 | public function moveDown($lines) |
||
52 | |||
53 | /** |
||
54 | * @param int $columns |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | public function moveLeft($columns) |
||
62 | |||
63 | /** |
||
64 | * @param int $columns |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | public function moveRight($columns) |
||
72 | |||
73 | /** |
||
74 | * @return string |
||
75 | */ |
||
76 | public function eraseToEnd() |
||
80 | |||
81 | /** |
||
82 | * @return string |
||
83 | */ |
||
84 | public function eraseToStart() |
||
88 | |||
89 | /** |
||
90 | * @return string |
||
91 | */ |
||
92 | public function eraseDown() |
||
96 | |||
97 | /** |
||
98 | * @return string |
||
99 | */ |
||
100 | public function eraseUp() |
||
104 | |||
105 | /** |
||
106 | * @return string |
||
107 | */ |
||
108 | public function eraseScreen() |
||
112 | } |
||
113 |