textWithBlockCursor method

TextWithBlockCursor textWithBlockCursor()

Returns text formatted for display with inverse-video cursor.

Returns a record with (beforeCursor, charAtCursor, afterCursor). If cursor is at end, charAtCursor is a space for block cursor effect.

Implementation

TextWithBlockCursor textWithBlockCursor() {
  final before = textBeforeCursor;
  final cursorChar = charAtCursor ?? ' ';
  final after = _cursorPosition < _buffer.length
      ? text.substring(_cursorPosition + 1)
      : '';

  return TextWithBlockCursor(
      before: before, cursor: cursorChar, after: after);
}