rerender method

GitDiffModel rerender()

Re-renders the existing parsed files with the current configuration.

Use this after changing display options (viewMode, showLineNumbers, wrapLines, styles) via copyWith to rebuild the rendered lines and viewport without re-parsing the diff.

Implementation

GitDiffModel rerender() {
  if (_files.isEmpty) return this;
  final layout = _buildLayout(_files);
  final rendered = layout.lines;
  final newViewport = _viewport.copyWith(
    width: width,
    height: height,
    lines: rendered,
  );
  return copyWith(
    renderedLines: rendered,
    viewport: newViewport,
    layout: layout,
  );
}