|
1 | 1 | # clue/stdio-react [](https://travis-ci.org/clue/php-stdio-react) |
2 | 2 |
|
3 | | -Async standard console input & output (STDIN, STDOUT) for React PHP |
| 3 | +Async, event-driven and UTF-8 aware standard console input & output (STDIN, STDOUT) for React PHP |
4 | 4 |
|
5 | 5 | > Note: This project is in early beta stage! Feel free to report any issues you encounter. |
6 | 6 |
|
@@ -181,14 +181,28 @@ simply pass a boolean `true` like this: |
181 | 181 | $readline->setMove(true); |
182 | 182 | ``` |
183 | 183 |
|
184 | | -The `getCursorPosition()` method can be used to access the current cursor position. |
| 184 | +The `getCursorPosition()` method can be used to access the current cursor position, |
| 185 | +measured in number of characters. |
185 | 186 | This can be useful if you want to get a substring of the current *user input buffer*. |
186 | 187 | Simply invoke it like this: |
187 | 188 |
|
188 | 189 | ```php |
189 | 190 | $position = $readline->getCursorPosition(); |
190 | 191 | ``` |
191 | 192 |
|
| 193 | +The `getCursorCell()` method can be used to get the current cursor position, |
| 194 | +measured in number of monospace cells. |
| 195 | +Most *normal* characters (plain ASCII and most multi-byte UTF-8 sequences) take a single monospace cell. |
| 196 | +However, there are a number of characters that have no visual representation |
| 197 | +(and do not take a cell at all) or characters that do not fit within a single |
| 198 | +cell (like some asian glyphs). |
| 199 | +This method is mostly useful for calculating the visual cursor position on screen, |
| 200 | +but you may also invoke it like this: |
| 201 | + |
| 202 | +```php |
| 203 | +$cell = $readline->getCursorCell(); |
| 204 | +``` |
| 205 | + |
192 | 206 | The `moveCursorTo($position)` method can be used to set the current cursor position to the given absolute character position. |
193 | 207 | For example, to move the cursor to the beginning of the *user input buffer*, simply call: |
194 | 208 |
|
|
0 commit comments