pub struct LineDiff { /* private fields */ }Expand description
Incremental line-diff transport: a stateful &str -> Vec<u8> writer that
emits the minimal ANSI byte sequence to transform the previously rendered
frame into the next one, mirroring ink’s createIncremental.
Implementations§
Source§impl LineDiff
impl LineDiff
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset to the initial state, as render.done() / render.reset() do for
the next render’s bootstrap branch.
Sourcepub fn last_changed_lines(&self) -> u32
pub fn last_changed_lines(&self) -> u32
How many visible lines the LAST diff rewrote (emitted
bytes for). 0 for a no-op (unchanged) frame; the visible line count for a
bootstrap/full-repaint. Additive telemetry only — reading it never
affects the emitted transport bytes.
Sourcepub fn sync(&mut self, str_value: &str)
pub fn sync(&mut self, str_value: &str)
Record str_value as the new previous frame without emitting any
bytes. Port of createIncremental’s render.sync(str)
(log-update.ts ~lines 344-350) for the pure path (no active cursor):
it sets previousOutput/previousLines from the argument so the next
diff is computed against this baseline.
The clear-decision layer calls this after a full-clear write so the next incremental diff is taken against what is actually on screen.
Sourcepub fn clear(&mut self) -> Vec<u8> ⓘ
pub fn clear(&mut self) -> Vec<u8> ⓘ
Emit the erase sequence that wipes the previously rendered frame and
reset the baseline to empty. Port of createIncremental’s
render.clear() (log-update.ts ~lines 312-323) for the pure path:
returnPrefix collapses to "", leaving eraseLines(previousLines.len).
After this the transport is back in its bootstrap state, so the next
diff re-emits the full frame.
Sourcepub fn diff(&mut self, next: &str) -> Vec<u8> ⓘ
pub fn diff(&mut self, next: &str) -> Vec<u8> ⓘ
Diff next against the previously rendered frame and return the bytes to
write. Returns an empty buffer when next is byte-identical to the prior
frame (the zero-flicker skip).
Port of createIncremental’s render(str) for the pure-transport path
(no active cursor). Mutates internal state to record next as the new
previous frame.