pub fn render_diff(
current: &Buffer,
next: &Buffer,
dirty_rects: &[Rect],
output: &mut Vec<u8>,
state: &mut DiffState,
) -> DiffResultExpand description
Render the difference between two buffers into an ANSI sequence buffer.
This is the core diffing function. It compares current and next buffers,
generating minimal ANSI escape sequences for only the cells that changed.
§Optimizations
- Cursor movement: Skips explicit moves when writing adjacent cells
- Color tracking: Only emits color changes when fg/bg actually differ
- Modifier tracking: Only emits modifier changes when needed
- Dirty rectangles: Only iterates over specified dirty regions
§Arguments
current- The currently displayed buffernext- The buffer to transition todirty_rects- Regions to check for changes (empty = full buffer)output- Buffer to write ANSI sequences tostate- Mutable state tracking cursor/color positions
§Returns
Statistics about the diff operation.