eraseRange method

void eraseRange(
  1. int start,
  2. int end,
  3. CursorStyle style
)

Erase cells whose index satisfies start <= index < end. Erased cells are filled with style.

Implementation

void eraseRange(int start, int end, CursorStyle style) {
  // reset cell one to the left if start is second cell of a wide char
  if (start > 0 && getWidth(start - 1) == 2) {
    _eraseCellRaw(start - 1, style);
  }

  // reset cell one to the right if end is second cell of a wide char
  if (end > 0 && end < _length && getWidth(end - 1) == 2) {
    _eraseCellRaw(end - 1, style);
  }

  end = min(end, _length);
  for (var i = start; i < end; i++) {
    _eraseCellRaw(i, style);
  }
  version++;
}