pub fn overwrite_cost(
line: &[Cell],
style: &Style,
from: u16,
to: u16,
) -> Option<usize>Expand description
Approximate byte cost of re-emitting the cells in line[from..to]
as a forward-move candidate.
Returns None when any width > 0 cell in the range has a
style or link that does not match the active pen — in that case
the row cannot be re-emitted without an interleaved pen change
and the candidate is not eligible.
The cost approximation is the sum of cell.width() over occupied
cells in the range. For plain ASCII this equals the emitted byte
length exactly. For wide CJK glyphs (width == 2, multi-byte
content) and other multi-byte single-width glyphs (combining
sequences, emoji selectors) the prediction underestimates the
emitted length, so an overwrite candidate may be picked here that
a strict byte minimisation would have rejected. Accepting this
approximation keeps the predictor allocation-free.