terminalCursor property

Cursor? get terminalCursor

Returns a Cursor for rendering a real cursor in a TUI program. This requires that useVirtualCursor is set to false.

Implementation

Cursor? get terminalCursor {
  if (useVirtualCursor || !_focused) return null;

  final promptWidth = stringWidth(prompt);
  var xOffset = _pos - _offset + promptWidth;
  if (width > 0) {
    xOffset = math.min(xOffset, width + promptWidth);
  }

  return Cursor(
    position: Position(xOffset, 0),
    color: styles.cursor.color,
    shape: styles.cursor.shape,
    blink: styles.cursor.blink,
  );
}