The caret-range derivation checked only that the growth was arithmetically
consistent with an insertion. A replacement that grows by the same amount fits
that test and emitted just its tail, so a commit arriving on this path could
reach the pty with its leading characters missing. Require the text outside the
claimed range to be unchanged, and fall into the existing emit-nothing path.
Co-authored-by: Orca <help@stably.ai>