resize method

void resize(
  1. int newWidth
)

Resizes the tab stop table to newWidth.

Implementation

void resize(int newWidth) {
  if (newWidth == width) return;

  if (newWidth < width) {
    final size = (newWidth + (interval - 1)) ~/ interval;
    stops = stops.sublist(0, size);
  } else {
    final size = (newWidth - width + (interval - 1)) ~/ interval;
    stops = [...stops, ...List<int>.filled(size, 0)];
  }

  _init(width, newWidth);
  width = newWidth;
}