needsFullClear method

bool needsFullClear()

Returns true if the previous frame had significantly more content than the current one.

Implementation

bool needsFullClear() {
  // Check if current content footprint is smaller than previous
  // This indicates we might need to clear remnants
  int currentContent = 0;
  int previousContent = 0;

  for (int y = 0; y < terminal.height; y++) {
    for (int x = 0; x < terminal.width; x++) {
      if (_grid[y][x].char != ' ') currentContent++;
      if (_previousGrid[y][x].char != ' ') previousContent++;
    }
  }

  // If previous frame had significantly more content, we might have remnants
  return previousContent >
      currentContent + 10; // Threshold to avoid false positives
}