pub fn overwrite_cost(
line: &[Cell],
style: &Style,
from: u16,
to: u16,
) -> Option<usize>Expand description
Byte cost of re-emitting the cells in line[from..to] as a
forward-move candidate.
The cost is the summed byte length of the cells’ content, which is what the move writes, so it compares directly against the byte cost of a cursor sequence.
Returns None when the range is not eligible. This move travels by
drawing, so what it draws has to span exactly the columns it claims to
cross, and the pen has to survive the trip:
- the range opens on a continuation, which begins inside a glyph whose bytes have already gone out, so the walk would arrive a column short
- the last cluster in the range reaches past
to, so drawing it would carry the cursor a column too far - an occupied cell has a style or link the active pen does not match, which would need an interleaved pen change
- an occupied cell holds anything other than exactly one code point, which keeps the byte cost equal to the columns crossed and keeps the candidate off sequences whose rendered width a terminal may disagree about
The renderer decides eligibility the same way when it emits the move, and the two have to agree or the planner picks a move it cannot produce.