moveUp method

void moveUp(
  1. int n
)

Move selection up by n rows.

Implementation

void moveUp(int n) {
  _cursor = (_cursor - n).clamp(0, _rows.length - 1);
  if (_start == 0) {
    _viewport = _viewport.copyWith(
      yOffset: _viewport.yOffset.clamp(0, _cursor),
    );
  } else if (_start < (_viewport.height ?? 0)) {
    _viewport = _viewport.copyWith(
      yOffset: (_viewport.yOffset + n)
          .clamp(0, _cursor)
          .clamp(0, _viewport.height ?? 0),
    );
  } else if (_viewport.yOffset >= 1) {
    _viewport = _viewport.copyWith(
      yOffset: (_viewport.yOffset + n).clamp(1, _viewport.height ?? 0),
    );
  }
  updateViewport();
}