Skip to main content

Module diff

Module diff 

Source
Expand description

Diffing Engine: Generate minimal ANSI sequences from buffer changes.

This module implements the core anti-flicker logic:

  1. Compare Current and Next buffers
  2. Generate minimal ANSI escape sequences for changed cells
  3. Optimize cursor movements (skip if adjacent)
  4. Track color state to avoid redundant SGR sequences

All output is accumulated in a single buffer and flushed with one syscall.

Structs§

DiffResult
Result of a diff operation.
DiffState
State tracker for the diffing algorithm.

Functions§

render_diff
Render the difference between two buffers into an ANSI sequence buffer.
render_full
Generate a full redraw sequence (no diffing).
render_full_diff
Perform a full buffer diff (convenience function).