touched method

int touched(
  1. Buffer buf
)

Returns the number of touched (dirty) lines in buf.

If dirty line tracking has been explicitly cleared by the renderer, the buffer uses LineData.clean markers on all rows. In that state we treat the buffer as fully touched for parity visibility, matching upstream UV's historical semantics for the public touched accessor.

Implementation

int touched(Buffer buf) {
  if (buf.touched.isNotEmpty) {
    var allClean = true;
    for (final lineData in buf.touched) {
      if (lineData != LineData.clean) {
        allClean = false;
        break;
      }
    }
    if (allClean) {
      return buf.height();
    }
  }
  return _touched(buf);
}