getCursorPosition method

void getCursorPosition(
  1. void callback(
    1. int x,
    2. int y
    )
)

Requests the terminal to send the current cursor position.

The given callback is invoked with zero-based (x,y) coordinates.

Implementation

void getCursorPosition(void Function(int x, int y) callback) {
  stdout.write('\x1B[6n');
  _expectingCursorResponse = true;
  _cursorCallback = callback;
}